miniscript-languageserver 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +2 -2
- package/package.json +2 -2
package/index.js
CHANGED
@@ -93,7 +93,7 @@ ${e}
|
|
93
93
|
${r.length>0?`switch(token.value) {
|
94
94
|
${r}
|
95
95
|
}`:""}
|
96
|
-
return false;`);return Object.defineProperty(o,"name",{value:`selector_group_${t}`,writable:!1}),o.selectors=e,o}se.createSelectorGroup=ur;function PR(t){return t.selectors}se.getSelectorsFromGroup=PR;var cr;(function(t){t.BlockEndOfLine="BlockEndOfLine",t.AssignmentEndOfExpr="AssignmentEndOfExpr",t.AssignmentShorthand="AssignmentShorthand",t.AssignmentCommandArgs="AssignmentCommandArgs",t.ReturnStatementEnd="ReturnStatementEnd",t.FunctionDeclarationArgEnd="FunctionDeclarationArgEnd",t.ComparisonOperators="ComparisonOperators",t.MultiDivOperators="MultiDivOperators",t.CallArgsEnd="CallArgsEnd"})(cr=se.SelectorGroupType||(se.SelectorGroupType={}));se.SelectorGroups={BlockEndOfLine:ur(cr.AssignmentEndOfExpr,[se.Selectors.EndOfLine,se.Selectors.Comment]),AssignmentEndOfExpr:ur(cr.AssignmentEndOfExpr,[se.Selectors.EndOfFile,se.Selectors.EndOfLine,se.Selectors.Else,se.Selectors.Comment]),AssignmentShorthand:ur(cr.AssignmentShorthand,[se.Selectors.AddShorthand,se.Selectors.SubtractShorthand,se.Selectors.MultiplyShorthand,se.Selectors.DivideShorthand,se.Selectors.PowerShorthand,se.Selectors.ModuloShorthand]),AssignmentCommandArgs:ur(cr.AssignmentCommandArgs,[se.Selectors.ArgumentSeperator,se.Selectors.EndOfLine,se.Selectors.EndOfFile]),ReturnStatementEnd:ur(cr.ReturnStatementEnd,[se.Selectors.EndOfLine,se.Selectors.Else,se.Selectors.Comment]),FunctionDeclarationArgEnd:ur(cr.FunctionDeclarationArgEnd,[se.Selectors.RParenthesis,se.Selectors.EndOfFile]),ComparisonOperators:ur(cr.ComparisonOperators,[se.Selectors.Equal,se.Selectors.NotEqual,se.Selectors.Greater,se.Selectors.GreaterEqual,se.Selectors.Lesser,se.Selectors.LessEqual]),MultiDivOperators:ur(cr.MultiDivOperators,[se.Selectors.Times,se.Selectors.Divide,se.Selectors.Mod]),CallArgsEnd:ur(cr.CallArgsEnd,[se.Selectors.ArgumentSeperator,se.Selectors.RParenthesis])}});var Tm=m(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.Stack=void 0;var Sm=class{constructor(){this._items=[],this._last=null,this._default=null}setDefault(e){this._default=e}push(e){return this._items.push(this._last=e)}pop(){switch(this._items.length){case 0:return this._default;case 1:return this._last=null,this._items.pop()}let e=this._items.pop();return this._last=this._items[this._items.length-1],e}peek(){return this._last||this._default}};tl.Stack=Sm});var Cm=m(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.PendingWhile=Ve.isPendingWhile=Ve.PendingIf=Ve.isPendingIf=Ve.PendingFunction=Ve.isPendingFunction=Ve.PendingFor=Ve.isPendingFor=Ve.PendingChunk=Ve.isPendingChunk=Ve.PendingBlockType=void 0;var Yn;(function(t){t[t.Chunk=0]="Chunk",t[t.For=1]="For",t[t.Function=2]="Function",t[t.If=3]="If",t[t.While=4]="While"})(Yn=Ve.PendingBlockType||(Ve.PendingBlockType={}));var ji=class{constructor(e,n){this.block=e,this.body=[],this.type=n,this.onComplete=null}complete(e){var n;(n=this.onComplete)===null||n===void 0||n.call(this,this)}};function MR(t){return t.type===Yn.Chunk}Ve.isPendingChunk=MR;var wm=class extends ji{constructor(e){super(e,Yn.Chunk)}complete(e){this.block.body=this.body,this.block.end=e.end,super.complete(e)}};Ve.PendingChunk=wm;function LR(t){return t.type===Yn.For}Ve.isPendingFor=LR;var Em=class extends ji{constructor(e){super(e,Yn.For)}complete(e){this.block.body=this.body,this.block.end=e.end,super.complete(e)}};Ve.PendingFor=Em;function NR(t){return t.type===Yn.Function}Ve.isPendingFunction=NR;var Am=class extends ji{constructor(e){super(e,Yn.Function)}complete(e){this.block.body=this.body,this.block.end=e.end,super.complete(e)}};Ve.PendingFunction=Am;function qR(t){return t.type===Yn.If}Ve.isPendingIf=qR;var xm=class extends ji{constructor(e,n){super(e,Yn.If),this.currentClause=n}next(e){this.currentClause.body=this.body,this.currentClause.end=e.end,this.block.clauses.push(this.currentClause),super.complete(e),this.body=[]}complete(e){this.body.length>0&&this.next(e),this.block.end=e.end,super.complete(e)}};Ve.PendingIf=xm;function jR(t){return t.type===Yn.While}Ve.isPendingWhile=jR;var km=class extends ji{constructor(e){super(e,Yn.While)}complete(e){this.block.body=this.body,this.block.end=e.end,super.complete(e)}};Ve.PendingWhile=km});var jw=m(oa=>{"use strict";var qw=oa&&oa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(oa,"__esModule",{value:!0});var FR=qw(ph()),ai=ni(),lr=mm(),$R=qw(bm()),BR=Dc(),Nt=js(),Or=$s(),Kt=Zo(),z=vm(),UR=Tm(),dr=Cm(),Om=class{constructor(e,n={}){let r=this;r.content=e,r.backpatches=new UR.Stack,r.statementErrors=[],r.lexer=n.lexer||new FR.default(e,{unsafe:n.unsafe,tabWidth:n.tabWidth}),r.token=null,r.previousToken=null,r.lines={},r.scopes=[],r.currentScope=null,r.currentAssignment=null,r.outerScopes=[],r.literals=[],r.validator=n.validator||new $R.default,r.astProvider=n.astProvider||new lr.ASTProvider,r.unsafe=n.unsafe||!1,r.errors=[]}next(){this.previousToken=this.token,this.token=this.lexer.next()}isType(e){return this.token!==null&&e===this.token.type}consume(e){return e(this.token)?(this.next(),!0):!1}consumeMany(e){return e(this.token)?(this.next(),!0):!1}requireType(e,n){let r=this.token;return this.token.type!==e?(this.raise(`got ${r} where ${e} is required`,new Kt.Range(n||r.start,r.end)),null):(this.next(),r)}requireToken(e,n){let r=this.token;return e(r)?(this.next(),r):(this.raise(`got ${r} where "${(0,z.getSelectorValue)(e)}" is required`,new Kt.Range(n||r.start,r.end)),null)}requireTokenOfAny(e,n){let r=this.token;return e(r)?(this.next(),r):(this.raise(`got ${r} where any of ${(0,z.getSelectorsFromGroup)(e).map(i=>`"${(0,z.getSelectorValue)(i)}"`).join(", ")} is required`,new Kt.Range(n||r.start,r.end)),null)}addItemToLines(e){let n=this.lines,r=e.end.line;for(let i=e.start.line;i<=r;i++){let s=n[i];s?s.push(e):n[i]=[e]}}skipNewlines(){let e=this,n=0;for(;;){if(z.Selectors.Comment(e.token)){let r=e.astProvider.comment({value:e.token.value,start:e.token.start,end:e.token.end,scope:e.currentScope});e.addItemToLines(r),e.backpatches.peek().body.push(r)}else if(z.Selectors.EndOfLine(e.token))n++;else break;e.next()}return n}pushScope(e){let n=this;n.currentScope!==null&&(n.scopes.push(e),n.outerScopes.push(n.currentScope)),n.currentScope=e}popScope(){let e=this;e.currentScope=e.outerScopes.pop()}tryToRecover(){let e=this,n=e.statementErrors[0];if(e.errors.push(n),!e.unsafe)throw n;for(e.lexer.recoverFromSnapshot(),e.next();e.token.type!==ai.TokenType.EOL&&e.token.type!==ai.TokenType.EOF;e.next());}finishRemaingScopes(){let e=this,n=e.backpatches.pop();for(;!(0,dr.isPendingChunk)(n);){let r=e.raise(`found open block ${n.block.type}`,new Kt.Range(n.block.start,n.block.start));if(n.complete(e.previousToken),e.errors.push(r),!e.unsafe)throw r;n=e.backpatches.pop()}}parseChunk(){let e=this;e.next();let n=e.token.start,r=e.astProvider.chunk({start:n,end:null}),i=new dr.PendingChunk(r);for(e.backpatches.setDefault(i),e.pushScope(r);!z.Selectors.EndOfFile(e.token)&&(e.skipNewlines(),!z.Selectors.EndOfFile(e.token));)e.lexer.recordSnapshot(),e.statementErrors=[],e.parseStatement(),e.statementErrors.length>0&&e.tryToRecover();return e.finishRemaingScopes(),e.popScope(),i.complete(e.token),r.literals=e.literals,r.scopes=e.scopes,r.lines=e.lines,r}parseStatement(){let e=this;if(ai.TokenType.Keyword===e.token.type&&Nt.Keyword.Not!==e.token.value){e.parseKeyword();return}let n=e.backpatches.peek(),r=e.parseAssignment();r.end!==null&&e.addItemToLines(r),n.body.push(r)}parseKeyword(){let e=this;switch(e.token.value){case Nt.Keyword.Return:{let r=e.backpatches.peek();e.next();let i=e.parseReturnStatement();i.end!==null&&e.addItemToLines(i),r.body.push(i);return}case Nt.Keyword.If:{e.next(),e.parseIfStatement();return}case Nt.Keyword.ElseIf:{e.next(),e.nextIfClause(lr.ASTType.ElseifClause);return}case Nt.Keyword.Else:{e.next(),e.nextIfClause(lr.ASTType.ElseClause);return}case Nt.Keyword.While:{e.next(),e.parseWhileStatement();return}case Nt.Keyword.For:{e.next(),e.parseForStatement();return}case Nt.Keyword.EndFunction:{e.next(),e.finalizeFunction();return}case Nt.Keyword.EndFor:{e.next(),e.finalizeForStatement();return}case Nt.Keyword.EndWhile:{e.next(),e.finalizeWhileStatement();return}case Nt.Keyword.EndIf:{e.next(),e.nextIfClause(null);return}case Nt.Keyword.Continue:{let r=e.backpatches.peek();e.next();let i=e.astProvider.continueStatement({start:e.previousToken.start,end:e.previousToken.end,scope:e.currentScope});e.addItemToLines(i),r.body.push(i);return}case Nt.Keyword.Break:{let r=e.backpatches.peek();e.next();let i=e.astProvider.breakStatement({start:e.previousToken.start,end:e.previousToken.end,scope:e.currentScope});e.addItemToLines(i),r.body.push(i);return}}e.raise(`unexpected keyword ${e.token} at start of line`,new Kt.Range(e.token.start,e.token.end))}parseShortcutStatement(){let e=this;if(ai.TokenType.Keyword===e.token.type&&Nt.Keyword.Not!==e.token.value)switch(e.token.value){case Nt.Keyword.Return:return e.next(),e.parseReturnStatement();case Nt.Keyword.Continue:return e.next(),e.astProvider.continueStatement({start:e.previousToken.start,end:e.previousToken.end,scope:e.currentScope});case Nt.Keyword.Break:return e.next(),e.astProvider.breakStatement({start:e.previousToken.start,end:e.previousToken.end,scope:e.currentScope});default:return e.raise(`unexpected keyword ${e.token} in shorthand statement`,new Kt.Range(e.token.start,e.token.end)),e.parseInvalidCode()}return e.parseAssignment()}parseAssignment(){let e=this,n=e.currentScope,r=e.token.start,i=e.parseExpr(null,!0,!0);if(z.SelectorGroups.AssignmentEndOfExpr(e.token))return i;if(z.Selectors.Assign(e.token)){e.next();let o=e.astProvider.assignmentStatement({variable:i,init:null,start:r,end:null,scope:n}),a=e.currentAssignment;if(e.currentAssignment=o,o.init=e.parseExpr(o),o.end=e.previousToken.end,o.init.type===lr.ASTType.FunctionDeclaration){let u=e.backpatches.peek();u.onComplete=c=>o.end=c.block.end}return e.currentAssignment=a,n.assignments.push(o),o}else if(z.SelectorGroups.AssignmentShorthand(e.token)){let o=e.token;e.next();let a=e.astProvider.assignmentStatement({variable:i,init:null,start:r,end:null,scope:n}),u=e.currentAssignment;e.currentAssignment=a;let c=e.token.start,l=o.value.charAt(0),d=e.parseExpr(a),p=e.astProvider.parenthesisExpression({start:d.start,end:d.end,expression:d});return a.init=e.astProvider.binaryExpression({operator:l,left:i.clone(),right:p,start:c,end:e.previousToken.end,scope:n}),a.end=e.previousToken.end,e.currentAssignment=u,n.assignments.push(a),a}let s=[];for(;!z.Selectors.EndOfFile(e.token);){let o=e.parseExpr(null);if(s.push(o),z.SelectorGroups.BlockEndOfLine(e.token)||z.Selectors.Else(e.token))break;if(z.Selectors.ArgumentSeperator(e.token)){e.next(),e.skipNewlines();continue}let a=e.requireTokenOfAny(z.SelectorGroups.AssignmentCommandArgs,r);if(z.Selectors.EndOfLine(a)||z.Selectors.EndOfFile(a))break}return s.length===0?e.astProvider.callStatement({expression:i,start:r,end:e.previousToken.end,scope:n}):e.astProvider.callStatement({expression:e.astProvider.callExpression({base:i,arguments:s,start:r,end:e.previousToken.end,scope:n}),start:r,end:e.previousToken.end,scope:n})}parseReturnStatement(){let e=this,n=e.currentScope,r=e.previousToken.start,i=null,s=e.astProvider.returnStatement({argument:null,start:r,end:null,scope:n});if(z.SelectorGroups.ReturnStatementEnd(e.token))s.end=e.previousToken.end;else{if(i=e.parseExpr(s),i.type===lr.ASTType.FunctionDeclaration){let o=e.backpatches.peek();o.onComplete=a=>s.end=a.block.end}else s.end=e.previousToken.end;s.argument=i}return n.returns.push(s),s}parseIfStatement(){let e=this,n=e.previousToken.start,r=e.parseExpr(null);if(e.addItemToLines(r),e.requireToken(z.Selectors.Then,n),!z.SelectorGroups.BlockEndOfLine(e.token)){e.parseIfShortcutStatement(r,n);return}let i=e.astProvider.ifStatement({clauses:[],start:n,end:null,scope:e.currentScope}),s=e.astProvider.ifClause({condition:r,start:n,end:e.token.end,scope:e.currentScope}),o=new dr.PendingIf(i,s);e.backpatches.push(o)}nextIfClause(e){let n=this,r=n.backpatches.peek();if(!(0,dr.isPendingIf)(r)){n.raise("no matching open if block",new Kt.Range(n.token.start,n.token.end));return}switch(r.next(n.previousToken),e){case lr.ASTType.ElseifClause:{let i=n.token.start,s=n.parseExpr(null);n.requireToken(z.Selectors.Then,i),r.currentClause=n.astProvider.elseifClause({condition:s,start:i,end:null,scope:n.currentScope});break}case lr.ASTType.ElseClause:{let i=n.token.start;r.currentClause=n.astProvider.elseClause({start:i,end:null,scope:n.currentScope});break}}e===null&&(r.complete(n.previousToken),n.addItemToLines(r.block),n.backpatches.pop(),n.backpatches.peek().body.push(r.block))}parseIfShortcutStatement(e,n){let r=this,i=[],s=r.backpatches.peek(),o=r.astProvider.ifShortcutStatement({clauses:i,start:n,end:null,scope:r.currentScope}),a=r.parseShortcutStatement();if(i.push(r.astProvider.ifShortcutClause({condition:e,body:[a],start:n,end:r.token.end,scope:r.currentScope})),z.Selectors.Else(r.token)){r.next();let u=r.token.start,c=r.parseShortcutStatement();i.push(r.astProvider.elseShortcutClause({body:[c],start:u,end:r.token.end,scope:r.currentScope}))}o.end=r.token.end,r.addItemToLines(o),s.body.push(o)}parseWhileStatement(){let e=this,n=e.previousToken.start,r=e.parseExpr(null);if(!r){e.raise("while requires a condition",new Kt.Range(n,e.token.end));return}if(!z.SelectorGroups.BlockEndOfLine(e.token))return e.parseWhileShortcutStatement(r,n);let i=e.astProvider.whileStatement({condition:r,start:n,end:null,scope:e.currentScope}),s=new dr.PendingWhile(i);e.backpatches.push(s),s.onComplete=o=>{e.addItemToLines(o.block),e.backpatches.pop(),e.backpatches.peek().body.push(o.block)}}finalizeWhileStatement(){let e=this,n=e.backpatches.peek();if(!(0,dr.isPendingWhile)(n)){e.raise("no matching open while block",new Kt.Range(e.token.start,e.token.end));return}n.complete(e.previousToken)}parseWhileShortcutStatement(e,n){let r=this,i=r.backpatches.peek(),s=r.parseShortcutStatement(),o=r.astProvider.whileStatement({condition:e,body:[s],start:n,end:r.previousToken.end,scope:r.currentScope});r.addItemToLines(o),i.body.push(o)}parseForStatement(){let e=this,n=e.currentScope,r=e.previousToken.start,i=e.parseIdentifier(),s=e.astProvider.assignmentStatement({variable:i,init:e.astProvider.unknown({start:i.start,end:i.end,scope:n}),start:i.start,end:i.end,scope:n}),o=e.astProvider.assignmentStatement({variable:e.astProvider.identifier({name:`__${i.name}_idx`,start:i.start,end:i.end,scope:n}),init:e.astProvider.literal(ai.TokenType.NumericLiteral,{value:0,raw:"0",start:i.start,end:i.end,scope:n}),start:i.start,end:i.end,scope:n});n.assignments.push(s,o),e.requireToken(z.Selectors.In,r);let a=e.parseExpr(null);if(!a){e.raise("sequence expression expected for 'for' loop",new Kt.Range(r,e.token.end));return}if(!z.SelectorGroups.BlockEndOfLine(e.token))return e.parseForShortcutStatement(i,a,r);let u=e.astProvider.forGenericStatement({variable:i,iterator:a,start:r,end:e.previousToken.end,scope:n}),c=new dr.PendingFor(u);e.backpatches.push(c)}finalizeForStatement(){let e=this,n=e.backpatches.peek();if(!(0,dr.isPendingFor)(n)){e.raise("no matching open for block",new Kt.Range(e.token.start,e.token.end));return}n.complete(e.previousToken),e.addItemToLines(n.block),e.backpatches.pop(),e.backpatches.peek().body.push(n.block)}parseForShortcutStatement(e,n,r){let i=this,s=i.backpatches.peek(),o=i.parseShortcutStatement(),a=i.astProvider.forGenericStatement({variable:e,iterator:n,body:[o],start:r,end:i.previousToken.end,scope:i.currentScope});i.addItemToLines(a),s.body.push(a)}parseExpr(e,n=!1,r=!1){return this.parseFunctionDeclaration(e,n,r)}parseFunctionDeclaration(e,n=!1,r=!1){let i=this;if(!z.Selectors.Function(i.token))return i.parseOr(n,r);i.next();let s=i.previousToken.start,o=i.astProvider.functionStatement({start:s,end:null,scope:i.currentScope,parent:i.outerScopes[i.outerScopes.length-1],assignment:i.currentAssignment}),a=[];if(i.pushScope(o),!z.SelectorGroups.BlockEndOfLine(i.token)){for(i.requireToken(z.Selectors.LParenthesis,s);!z.SelectorGroups.FunctionDeclarationArgEnd(i.token);){let c=i.parseIdentifier(),l=c.start;if(i.consume(z.Selectors.Assign)){let d=i.parseExpr(null);if(d instanceof lr.ASTLiteral){let p=i.astProvider.assignmentStatement({variable:c,init:d,start:l,end:i.previousToken.end,scope:i.currentScope});i.currentScope.assignments.push(p),a.push(p)}else i.raise("parameter default value must be a literal value",new Kt.Range(l,i.token.end)),a.push(i.astProvider.invalidCodeExpression({start:l,end:i.previousToken.end}))}else{let d=i.astProvider.assignmentStatement({variable:c,init:i.astProvider.unknown({start:l,end:i.previousToken.end,scope:i.currentScope}),start:l,end:i.previousToken.end,scope:i.currentScope});i.currentScope.assignments.push(d),a.push(c)}if(z.Selectors.RParenthesis(i.token))break;if(i.requireToken(z.Selectors.ArgumentSeperator,s),z.Selectors.RParenthesis(i.token)){i.raise("expected argument instead received right parenthesis",new Kt.Range(i.previousToken.end,i.previousToken.end));break}}i.requireToken(z.Selectors.RParenthesis,s)}o.parameters=a;let u=new dr.PendingFunction(o);return i.backpatches.push(u),u.onComplete=c=>{e!==null?(e.end=c.block.end,i.addItemToLines(e)):i.addItemToLines(c.block)},o}finalizeFunction(){let e=this,n=e.backpatches.peek();if(!(0,dr.isPendingFunction)(n)){e.raise("no matching open function block",new Kt.Range(e.token.start,e.token.end));return}e.popScope(),n.complete(e.previousToken),e.backpatches.pop()}parseOr(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseAnd(e,n);for(;z.Selectors.Or(r.token);){r.next(),r.skipNewlines();let a=r.parseAnd();o=r.astProvider.logicalExpression({operator:Or.Operator.Or,left:o,right:a,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseAnd(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseNot(e,n);for(;z.Selectors.And(r.token);){r.next(),r.skipNewlines();let a=r.parseNot();o=r.astProvider.logicalExpression({operator:Or.Operator.And,left:o,right:a,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseNot(e=!1,n=!1){let r=this,i=r.token.start;if(z.Selectors.Not(r.token)){r.next(),r.skipNewlines();let s=r.parseIsa();return r.astProvider.unaryExpression({operator:Or.Operator.Not,argument:s,start:i,end:r.previousToken.end,scope:r.currentScope})}return r.parseIsa(e,n)}parseIsa(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseComparisons(e,n);if(z.Selectors.Isa(r.token)){r.next(),r.skipNewlines();let o=r.parseComparisons();return r.astProvider.isaExpression({operator:Or.Operator.Isa,left:s,right:o,start:i,end:r.previousToken.end,scope:r.currentScope})}return s}parseComparisons(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseAddSub(e,n);if(!z.SelectorGroups.ComparisonOperators(r.token))return s;let o=[s],a=[];do{let u=r.token;r.next(),r.skipNewlines();let c=r.parseAddSub();a.push(u.value),o.push(c)}while(z.SelectorGroups.ComparisonOperators(r.token));return a.length===1?r.astProvider.binaryExpression({operator:a[0],left:o[0],right:o[1],start:i,end:r.previousToken.end,scope:r.currentScope}):r.astProvider.comparisonGroupExpression({operators:a,expressions:o,start:i,end:r.previousToken.end,scope:r.currentScope})}parseAddSub(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseMultDiv(e,n);for(;z.Selectors.Plus(r.token)||z.Selectors.Minus(r.token)&&(!n||!r.token.afterSpace||r.lexer.isAtWhitespace());){let a=r.token;r.next(),r.skipNewlines();let u=r.parseMultDiv();o=r.astProvider.binaryExpression({operator:a.value,left:o,right:u,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseMultDiv(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseUnaryMinus(e,n);for(;z.SelectorGroups.MultiDivOperators(r.token);){let a=r.token;r.next(),r.skipNewlines();let u=r.parseUnaryMinus();o=r.astProvider.binaryExpression({operator:a.value,left:o,right:u,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseUnaryMinus(e=!1,n=!1){let r=this;if(!z.Selectors.Minus(r.token))return r.parseNew(e,n);let i=r.token.start;r.next(),r.skipNewlines();let s=r.parseNew();return s instanceof lr.ASTNumericLiteral||s instanceof lr.ASTBooleanLiteral?(s.negated=!0,s):r.astProvider.unaryExpression({operator:Or.Operator.Minus,argument:s,start:i,end:r.previousToken.end,scope:r.currentScope})}parseNew(e=!1,n=!1){let r=this;if(!z.Selectors.New(r.token))return r.parseAddressOf(e,n);let i=r.token.start;r.next(),r.skipNewlines();let s=r.parseNew();return r.astProvider.unaryExpression({operator:Or.Operator.New,argument:s,start:i,end:r.previousToken.end,scope:r.currentScope})}parseAddressOf(e=!1,n=!1){let r=this;if(!z.Selectors.Reference(r.token))return r.parsePower(e,n);let i=r.token.start;r.next(),r.skipNewlines();let s=r.parsePower();return r.astProvider.unaryExpression({operator:Or.Operator.Reference,argument:s,start:i,end:r.previousToken.end,scope:r.currentScope})}parsePower(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseCallExpr(e,n);if(z.Selectors.Power(r.token)){r.next(),r.skipNewlines();let o=r.parseCallExpr();return r.astProvider.binaryExpression({operator:Or.Operator.Power,left:s,right:o,start:i,end:r.previousToken.end,scope:r.currentScope})}return s}parseCallExpr(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseMap(e,n);for(;!z.Selectors.EndOfFile(r.token);)if(z.Selectors.MemberSeperator(r.token)){r.next(),r.skipNewlines();let o=r.parseIdentifier();s=r.astProvider.memberExpression({base:s,indexer:Or.Operator.Member,identifier:o,start:i,end:r.previousToken.end,scope:r.currentScope})}else if(z.Selectors.SLBracket(r.token)&&!r.token.afterSpace){if(r.next(),r.skipNewlines(),z.Selectors.SliceSeperator(r.token)){let o=r.astProvider.emptyExpression({start:r.previousToken.start,end:r.previousToken.end,scope:r.currentScope});r.next(),r.skipNewlines();let a=z.Selectors.SRBracket(r.token)?r.astProvider.emptyExpression({start:r.previousToken.start,end:r.previousToken.end,scope:r.currentScope}):r.parseExpr(null);s=r.astProvider.sliceExpression({base:s,left:o,right:a,start:i,end:r.token.end,scope:r.currentScope})}else{let o=r.parseExpr(null);if(z.Selectors.SliceSeperator(r.token)){r.next(),r.skipNewlines();let a=z.Selectors.SRBracket(r.token)?r.astProvider.emptyExpression({start:r.previousToken.start,end:r.previousToken.end,scope:r.currentScope}):r.parseExpr(null);s=r.astProvider.sliceExpression({base:s,left:o,right:a,start:i,end:r.token.end,scope:r.currentScope})}else s=r.astProvider.indexExpression({base:s,index:o,start:i,end:r.token.end,scope:r.currentScope})}r.requireToken(z.Selectors.SRBracket,i)}else if(z.Selectors.LParenthesis(r.token)&&(!e||!r.token.afterSpace)){let o=r.parseCallArgs();s=r.astProvider.callExpression({base:s,arguments:o,start:i,end:r.previousToken.end,scope:r.currentScope})}else break;return s}parseCallArgs(){let e=this,n=[];if(z.Selectors.LParenthesis(e.token))if(e.next(),z.Selectors.RParenthesis(e.token))e.next();else for(;!z.Selectors.EndOfFile(e.token);){e.skipNewlines();let r=e.parseExpr(null);if(n.push(r),e.skipNewlines(),z.Selectors.RParenthesis(e.requireTokenOfAny(z.SelectorGroups.CallArgsEnd,r.start)))break}return n}parseMap(e=!1,n=!1){let r=this;if(!z.Selectors.CLBracket(r.token))return r.parseList(e,n);let i=r.currentScope,s=r.token.start,o=[],a=r.astProvider.mapConstructorExpression({fields:o,start:s,end:null,scope:i});if(r.next(),z.Selectors.CRBracket(r.token))r.next();else for(r.skipNewlines();!z.Selectors.EndOfFile(r.token);){if(z.Selectors.CRBracket(r.token)){r.next();break}let u=r.astProvider.mapKeyString({key:null,value:null,start:r.token.start,end:null,scope:i});if(u.key=r.parseExpr(null),r.requireToken(z.Selectors.MapKeyValueSeperator),r.skipNewlines(),r.currentAssignment){let c=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:u.key,base:r.currentAssignment.variable,start:u.start,end:r.token.end,scope:i}),init:null,start:u.start,end:null}),l=r.currentAssignment;r.currentAssignment=c,u.value=r.parseExpr(u),r.currentAssignment=l,c.init=u.value,c.end=r.previousToken.end,i.assignments.push(c)}else u.value=r.parseExpr(u);if(u.end=r.previousToken.end,o.push(u),z.Selectors.MapSeperator(r.token)&&(r.next(),r.skipNewlines()),z.Selectors.CRBracket(r.token)){r.next();break}}return a.end=r.token.start,a}parseList(e=!1,n=!1){let r=this;if(!z.Selectors.SLBracket(r.token))return r.parseQuantity(e,n);let i=r.currentScope,s=r.token.start,o=[],a=r.astProvider.listConstructorExpression({fields:o,start:s,end:null,scope:i});if(r.next(),z.Selectors.SRBracket(r.token))r.next();else for(r.skipNewlines();!z.Selectors.EndOfFile(r.token);){if(z.Selectors.SRBracket(r.token)){r.next();break}let u=r.astProvider.listValue({value:null,start:r.token.start,end:null,scope:i});if(r.currentAssignment){let c=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:r.astProvider.literal(ai.TokenType.NumericLiteral,{value:o.length,raw:`${o.length}`,start:s,end:r.token.end,scope:i}),base:r.currentAssignment.variable,start:null,end:null,scope:i}),init:null,start:null,end:null}),l=r.currentAssignment,d=r.token;r.currentAssignment=l,u.value=r.parseExpr(u),r.currentAssignment=l,c.variable.start=d.start,c.variable.end=r.previousToken.end,c.init=u.value,c.start=u.start,c.end=r.previousToken.end,i.assignments.push(c)}else u.value=r.parseExpr(u);if(u.end=r.previousToken.end,o.push(u),z.Selectors.MapSeperator(r.token)&&(r.next(),r.skipNewlines()),z.Selectors.SRBracket(r.token)){r.next();break}}return a.end=r.token.start,a}parseQuantity(e=!1,n=!1){let r=this;if(!z.Selectors.LParenthesis(r.token))return r.parseAtom(e,n);let i=r.token.start;r.next(),r.skipNewlines();let s=r.parseExpr(null);return r.requireToken(z.Selectors.RParenthesis,i),r.astProvider.parenthesisExpression({expression:s,start:i,end:r.previousToken.end,scope:r.currentScope})}parseAtom(e=!1,n=!1){let r=this;return r.validator.isLiteral(r.token.type)?r.parseLiteral():r.isType(ai.TokenType.Identifier)?r.parseIdentifier():(r.raise(`got ${r.token} where number, string, or identifier is required`,new Kt.Range(r.token.start,r.token.end)),r.parseInvalidCode())}parseLiteral(){let e=this,n=e.token.start,r=e.token.type,i=e.astProvider.literal(r,{value:e.token.value,raw:e.token.raw,start:n,end:e.token.end,scope:e.currentScope});return e.literals.push(i),e.next(),i}parseIdentifier(){let e=this,n=e.token.start,r=e.token.end,i=e.requireType(ai.TokenType.Identifier);return i===null?e.parseInvalidCode():(e.currentScope.namespaces.add(i.value),e.astProvider.identifier({name:i.value,start:n,end:r,scope:e.currentScope}))}parseInvalidCode(){let e=this,n=e.token.start,r=e.token.end,i=e.astProvider.invalidCodeExpression({start:n,end:r});return e.next(),i}raise(e,n){let r=this,i=new BR.ParserException(e,n);return r.statementErrors.push(i),i}};oa.default=Om});var je=m(Oe=>{"use strict";var HR=Oe&&Oe.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Jn=Oe&&Oe.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&HR(e,t,n)},nl=Oe&&Oe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.ASTRange=Oe.ASTPosition=Oe.ParserValidatorm=Oe.Parser=Oe.LexerValidator=Oe.Lexer=void 0;var WR=ph();Object.defineProperty(Oe,"Lexer",{enumerable:!0,get:function(){return nl(WR).default}});Jn(ni(),Oe);var GR=rh();Object.defineProperty(Oe,"LexerValidator",{enumerable:!0,get:function(){return nl(GR).default}});var VR=jw();Object.defineProperty(Oe,"Parser",{enumerable:!0,get:function(){return nl(VR).default}});Jn(mm(),Oe);var zR=bm();Object.defineProperty(Oe,"ParserValidatorm",{enumerable:!0,get:function(){return nl(zR).default}});Jn(Cm(),Oe);Jn(Tm(),Oe);Jn(lh(),Oe);Jn(Rc(),Oe);Jn(Dc(),Oe);Jn(js(),Oe);Jn(oh(),Oe);Jn($s(),Oe);var KR=zo();Object.defineProperty(Oe,"ASTPosition",{enumerable:!0,get:function(){return KR.Position}});var XR=Zo();Object.defineProperty(Oe,"ASTRange",{enumerable:!0,get:function(){return XR.Range}});Jn(vm(),Oe)});var aa=m(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.isValidIdentifierLiteral=void 0;var YR=je(),JR=t=>{if(t.type!==YR.ASTType.StringLiteral)return!1;let e=t.value.toString();return/^[_a-z][_a-z0-9]*$/i.test(e)};rl.isValidIdentifierLiteral=JR});var Rm=m(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.getStringHashCode=ui.getHashCode=ui.rotateBits=void 0;function QR(t){return t>>1|t<<31}ui.rotateBits=QR;function ZR(t,e=0){let n=t>>>0;return n=(n>>16^n)*73244475,n=(n>>16^n)*73244475,n=n>>16^n,(e<<5)-e+n|0}ui.getHashCode=ZR;ui.getStringHashCode=function(){let t=new Map,e=n=>{let r,i;for(r=0,i=0;r<n.length;r++)i=Math.imul(31,i)+n.charCodeAt(r)|0;return i};return n=>{if(n.length===0)return 0;let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}()});var Fw=m(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.createExpressionHash=void 0;var He=je(),pt=Rm(),e1=aa(),qt=(t,e)=>t.$$hash=e,t1=t=>t.$$hash??null;function et(t){let e=t1(t);if(e!==null)return e;let n=(0,pt.getStringHashCode)(t.type);switch(t.type){case He.ASTType.BinaryExpression:{let r=t;return n^=(0,pt.getStringHashCode)(r.operator),n^=et(r.left),n^=et(r.right),qt(t,n)}case He.ASTType.LogicalExpression:{let r=t;return n^=(0,pt.getStringHashCode)(r.operator),n^=et(r.left),n^=et(r.right),qt(t,n)}case He.ASTType.IsaExpression:{let r=t;return n^=(0,pt.getStringHashCode)(r.operator),n^=et(r.left),n^=et(r.right),qt(t,n)}case He.ASTType.ComparisonGroupExpression:{let r=t;for(let i=0;i<r.expressions.length;i++)n^=et(r.expressions[i]);for(let i=0;i<r.operators.length;i++)n^=(0,pt.getStringHashCode)(r.operators[i]);return qt(t,n)}case He.ASTType.FunctionDeclaration:{let r=t;n^=(0,pt.getHashCode)(r.parameters.length);for(let i=0;i<r.parameters.length;i++){let s=r.parameters[i];if(s.type===He.ASTType.Identifier){n^=(0,pt.getStringHashCode)(s.name);continue}let o=s;n^=(0,pt.getStringHashCode)(o.variable.name),n^=et(o.init)}return qt(t,n)}case He.ASTType.ParenthesisExpression:return et(t.expression);case He.ASTType.MemberExpression:{let r=t;if(r.base.type===He.ASTType.Identifier){let i=r.base.name;if(i==="globals"||i==="locals"||i==="outer")return n=(0,pt.getStringHashCode)(He.ASTType.Identifier),n^=(0,pt.getStringHashCode)(r.identifier.name),qt(t,n)}return n^=et(r.base),n^=et(r.identifier),qt(t,n)}case He.ASTType.IndexExpression:{let r=t;if((0,e1.isValidIdentifierLiteral)(r.index)){if(r.base.type===He.ASTType.Identifier){let s=r.base.name;if(s==="globals"||s==="locals"||s==="outer")return n=(0,pt.getStringHashCode)(He.ASTType.Identifier),n^=(0,pt.getStringHashCode)(r.index.value.toString()),qt(t,n)}n=(0,pt.getStringHashCode)(He.ASTType.MemberExpression),n^=et(r.base);let i=(0,pt.getStringHashCode)(He.ASTType.Identifier);i^=(0,pt.getStringHashCode)(r.index.value.toString()),n^=i}else n^=et(r.base),n^=et(r.index);return qt(t,n)}case He.ASTType.CallExpression:{let r=t;n^=et(r.base),n^=(0,pt.getHashCode)(r.arguments.length);for(let i=0;i<r.arguments.length;i++){let s=r.arguments[i];n^=et(s)}return qt(t,n)}case He.ASTType.NegationExpression:case He.ASTType.BinaryNegatedExpression:case He.ASTType.UnaryExpression:{let r=t;return n^=r.operator?(0,pt.getStringHashCode)(r.operator):1,n^=et(r.argument),qt(t,n)}case He.ASTType.Identifier:{let r=t;return n^=(0,pt.getStringHashCode)(r.name),qt(t,n)}case He.ASTType.NumericLiteral:case He.ASTType.StringLiteral:case He.ASTType.NilLiteral:return n^=(0,pt.getStringHashCode)(t.value.toString()),qt(t,n);case He.ASTType.MapConstructorExpression:{let r=t;n^=(0,pt.getHashCode)(r.fields.length);for(let i=0;i<r.fields.length;i++){let s=r.fields[i];n^=et(s.key),n^=et(s.value)}return qt(t,n)}case He.ASTType.ListConstructorExpression:{let r=t;n^=(0,pt.getHashCode)(r.fields.length);for(let i=0;i<r.fields.length;i++){let s=r.fields[i];n^=et(s.value)}return qt(t,n)}case He.ASTType.SliceExpression:{let r=t;return n^=et(r.base),n^=et(r.left),n^=et(r.right),qt(t,n)}}return console.warn(`Unexpected ast type ${t.type} in hash handler!`),qt(t,n)}function n1(t){return et(t)}il.createExpressionHash=n1});var Dm=m(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.createExpressionId=void 0;var _t=je(),r1=aa(),Tt=(t,e)=>t.$$id=e,i1=t=>t.$$id??null;function ze(t){let e=i1(t);if(e!==null)return e;switch(t.type){case _t.ASTType.BinaryExpression:{let n=t;return Tt(t,ze(n.left)+n.operator+ze(n.right))}case _t.ASTType.LogicalExpression:{let n=t;return Tt(t,ze(n.left)+n.operator+ze(n.right))}case _t.ASTType.IsaExpression:{let n=t;return Tt(t,ze(n.left)+n.operator+ze(n.right))}case _t.ASTType.ComparisonGroupExpression:{let n=t,r=n.expressions.map(s=>ze(s)),i=[r[0]];for(let s=0;s<n.operators.length;s++)i.push(n.operators[s],r[s+1]);return Tt(t,i.join(" "))}case _t.ASTType.FunctionDeclaration:{let n=t,r="function",i=[];for(let s=0;s<n.parameters.length;s++){let o=n.parameters[s];if(o.type===_t.ASTType.Identifier){i.push(o.name);continue}let a=o;i.push(a.variable.name+"="+ze(a.init))}return i.length>0&&(r+="("+i.join(",")+")"),Tt(t,r)}case _t.ASTType.ParenthesisExpression:return Tt(t,ze(t.expression));case _t.ASTType.MemberExpression:{let n=t;return Tt(t,ze(n.base)+"."+n.identifier.name)}case _t.ASTType.IndexExpression:{let n=t;return(0,r1.isValidIdentifierLiteral)(n.index)?Tt(t,ze(n.base)+"."+n.index.value.toString()):Tt(t,ze(n.base)+"["+ze(n.index)+"]")}case _t.ASTType.CallExpression:{let n=t,r=ze(n.base),i=[];for(let s=0;s<n.arguments.length;s++){let o=n.arguments[s];i.push(ze(o))}return i.length>0&&(r+="("+i.join(",")+")"),Tt(t,r)}case _t.ASTType.NegationExpression:case _t.ASTType.BinaryNegatedExpression:case _t.ASTType.UnaryExpression:{let n=t;return n.operator==null?Tt(t,ze(n.argument)):n.operator==="@"?Tt(t,n.operator+ze(n.argument)):Tt(t,n.operator+" "+ze(n.argument))}case _t.ASTType.Identifier:return Tt(t,t.name);case _t.ASTType.NumericLiteral:case _t.ASTType.StringLiteral:case _t.ASTType.NilLiteral:return Tt(t,t.raw.toString());case _t.ASTType.MapConstructorExpression:{let n=t,r=[];for(let i=0;i<n.fields.length;i++){let s=n.fields[i];r.push(ze(s.key)+":"+ze(s.value))}return Tt(t,"{"+r.join(",")+"}")}case _t.ASTType.ListConstructorExpression:{let n=t,r=[];for(let i=0;i<n.fields.length;i++){let s=n.fields[i];r.push(ze(s.value))}return Tt(t,"["+r.join(",")+"]")}case _t.ASTType.SliceExpression:{let n=t;return Tt(t,ze(n.base)+"["+ze(n.left)+":"+ze(n.right)+"]")}}return console.warn(`Unexpected ast type ${t.type} in hash handler!`),Tt(t,"")}function s1(t){return ze(t)}sl.createExpressionId=s1});var Vs=m(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.Markers=void 0;var o1;(function(t){t.start="/**",t.nostart="/***",t.delim="*",t.end="*/"})(o1=ua.Markers||(ua.Markers={}))});var Qn=m(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.rewireSpecs=at.rewireSource=at.seedTokens=at.seedSpec=at.seedBlock=at.splitLines=at.splitSpace=at.splitCR=at.hasCR=at.isSpace=void 0;function a1(t){return/^\s+$/.test(t)}at.isSpace=a1;function u1(t){return/\r$/.test(t)}at.hasCR=u1;function c1(t){let e=t.match(/\r+$/);return e==null?["",t]:[t.slice(-e[0].length),t.slice(0,-e[0].length)]}at.splitCR=c1;function l1(t){let e=t.match(/^\s+/);return e==null?["",t]:[t.slice(0,e[0].length),t.slice(e[0].length)]}at.splitSpace=l1;function d1(t){return t.split(/\n/)}at.splitLines=d1;function f1(t={}){return Object.assign({description:"",tags:[],source:[],problems:[]},t)}at.seedBlock=f1;function p1(t={}){return Object.assign({tag:"",name:"",type:"",optional:!1,description:"",problems:[],source:[]},t)}at.seedSpec=p1;function h1(t={}){return Object.assign({start:"",delimiter:"",postDelimiter:"",tag:"",postTag:"",name:"",postName:"",type:"",postType:"",description:"",end:"",lineEnd:""},t)}at.seedTokens=h1;function m1(t){let e=t.source.reduce((n,r)=>n.set(r.number,r),new Map);for(let n of t.tags)n.source=n.source.map(r=>e.get(r.number));return t}at.rewireSource=m1;function g1(t){let e=t.tags.reduce((n,r)=>r.source.reduce((i,s)=>i.set(s.number,s),n),new Map);return t.source=t.source.map(n=>e.get(n.number)||n),t}at.rewireSpecs=g1});var $w=m(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});var y1=/^@\S+/;function b1({fence:t="```"}={}){let e=_1(t),n=(r,i)=>e(r)?!i:i;return function(i){let s=[[]],o=!1;for(let a of i)y1.test(a.tokens.description)&&!o?s.push([a]):s[s.length-1].push(a),o=n(a.tokens.description,o);return s}}Im.default=b1;function _1(t){return typeof t=="string"?e=>e.split(t).length%2===0:t}});var Bw=m(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var v1=Vs(),ca=Qn();function S1({startLine:t=0,markers:e=v1.Markers}={}){let n=null,r=t;return function(s){let o=s,a=(0,ca.seedTokens)();if([a.lineEnd,o]=(0,ca.splitCR)(o),[a.start,o]=(0,ca.splitSpace)(o),n===null&&o.startsWith(e.start)&&!o.startsWith(e.nostart)&&(n=[],a.delimiter=o.slice(0,e.start.length),o=o.slice(e.start.length),[a.postDelimiter,o]=(0,ca.splitSpace)(o)),n===null)return r++,null;let u=o.trimRight().endsWith(e.end);if(a.delimiter===""&&o.startsWith(e.delim)&&!o.startsWith(e.end)&&(a.delimiter=e.delim,o=o.slice(e.delim.length),[a.postDelimiter,o]=(0,ca.splitSpace)(o)),u){let c=o.trimRight();a.end=o.slice(c.length-e.end.length),o=c.slice(0,-e.end.length)}if(a.description=o,n.push({number:r,source:s,tokens:a}),r++,u){let c=n.slice();return n=null,c}return null}}Pm.default=S1});var Uw=m(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});var T1=Qn();function w1({tokenizers:t}){return function(n){var r;let i=(0,T1.seedSpec)({source:n});for(let s of t)if(i=s(i),!((r=i.problems[i.problems.length-1])===null||r===void 0)&&r.critical)break;return i}}Mm.default=w1});var Nm=m(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});function E1(){return t=>{let{tokens:e}=t.source[0],n=e.description.match(/\s*(@(\S+))(\s*)/);return n===null?(t.problems.push({code:"spec:tag:prefix",message:'tag should start with "@" symbol',line:t.source[0].number,critical:!0}),t):(e.tag=n[1],e.postTag=n[3],e.description=e.description.slice(n[0].length),t.tag=n[2],t)}}Lm.default=E1});var jm=m(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});var A1=Qn();function x1(t="compact"){let e=C1(t);return n=>{let r=0,i=[];for(let[a,{tokens:u}]of n.source.entries()){let c="";if(a===0&&u.description[0]!=="{")return n;for(let l of u.description)if(l==="{"&&r++,l==="}"&&r--,c+=l,r===0)break;if(i.push([u,c]),r===0)break}if(r!==0)return n.problems.push({code:"spec:type:unpaired-curlies",message:"unpaired curlies",line:n.source[0].number,critical:!0}),n;let s=[],o=i[0][0].postDelimiter.length;for(let[a,[u,c]]of i.entries())u.type=c,a>0&&(u.type=u.postDelimiter.slice(o)+c,u.postDelimiter=u.postDelimiter.slice(0,o)),[u.postType,u.description]=(0,A1.splitSpace)(u.description.slice(c.length)),s.push(u.type);return s[0]=s[0].slice(1),s[s.length-1]=s[s.length-1].slice(0,-1),n.type=e(s),n}}qm.default=x1;var k1=t=>t.trim();function C1(t){return t==="compact"?e=>e.map(k1).join(""):t==="preserve"?e=>e.join(`
|
96
|
+
return false;`);return Object.defineProperty(o,"name",{value:`selector_group_${t}`,writable:!1}),o.selectors=e,o}se.createSelectorGroup=ur;function PR(t){return t.selectors}se.getSelectorsFromGroup=PR;var cr;(function(t){t.BlockEndOfLine="BlockEndOfLine",t.AssignmentEndOfExpr="AssignmentEndOfExpr",t.AssignmentShorthand="AssignmentShorthand",t.AssignmentCommandArgs="AssignmentCommandArgs",t.ReturnStatementEnd="ReturnStatementEnd",t.FunctionDeclarationArgEnd="FunctionDeclarationArgEnd",t.ComparisonOperators="ComparisonOperators",t.MultiDivOperators="MultiDivOperators",t.CallArgsEnd="CallArgsEnd"})(cr=se.SelectorGroupType||(se.SelectorGroupType={}));se.SelectorGroups={BlockEndOfLine:ur(cr.AssignmentEndOfExpr,[se.Selectors.EndOfLine,se.Selectors.Comment]),AssignmentEndOfExpr:ur(cr.AssignmentEndOfExpr,[se.Selectors.EndOfFile,se.Selectors.EndOfLine,se.Selectors.Else,se.Selectors.Comment]),AssignmentShorthand:ur(cr.AssignmentShorthand,[se.Selectors.AddShorthand,se.Selectors.SubtractShorthand,se.Selectors.MultiplyShorthand,se.Selectors.DivideShorthand,se.Selectors.PowerShorthand,se.Selectors.ModuloShorthand]),AssignmentCommandArgs:ur(cr.AssignmentCommandArgs,[se.Selectors.ArgumentSeperator,se.Selectors.EndOfLine,se.Selectors.EndOfFile]),ReturnStatementEnd:ur(cr.ReturnStatementEnd,[se.Selectors.EndOfLine,se.Selectors.Else,se.Selectors.Comment]),FunctionDeclarationArgEnd:ur(cr.FunctionDeclarationArgEnd,[se.Selectors.RParenthesis,se.Selectors.EndOfFile]),ComparisonOperators:ur(cr.ComparisonOperators,[se.Selectors.Equal,se.Selectors.NotEqual,se.Selectors.Greater,se.Selectors.GreaterEqual,se.Selectors.Lesser,se.Selectors.LessEqual]),MultiDivOperators:ur(cr.MultiDivOperators,[se.Selectors.Times,se.Selectors.Divide,se.Selectors.Mod]),CallArgsEnd:ur(cr.CallArgsEnd,[se.Selectors.ArgumentSeperator,se.Selectors.RParenthesis])}});var Tm=m(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.Stack=void 0;var Sm=class{constructor(){this._items=[],this._last=null,this._default=null}setDefault(e){this._default=e}push(e){return this._items.push(this._last=e)}pop(){switch(this._items.length){case 0:return this._default;case 1:return this._last=null,this._items.pop()}let e=this._items.pop();return this._last=this._items[this._items.length-1],e}peek(){return this._last||this._default}};tl.Stack=Sm});var Cm=m(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.PendingWhile=Ve.isPendingWhile=Ve.PendingIf=Ve.isPendingIf=Ve.PendingFunction=Ve.isPendingFunction=Ve.PendingFor=Ve.isPendingFor=Ve.PendingChunk=Ve.isPendingChunk=Ve.PendingBlockType=void 0;var Yn;(function(t){t[t.Chunk=0]="Chunk",t[t.For=1]="For",t[t.Function=2]="Function",t[t.If=3]="If",t[t.While=4]="While"})(Yn=Ve.PendingBlockType||(Ve.PendingBlockType={}));var ji=class{constructor(e,n){this.block=e,this.body=[],this.type=n,this.onComplete=null}complete(e){var n;(n=this.onComplete)===null||n===void 0||n.call(this,this)}};function MR(t){return t.type===Yn.Chunk}Ve.isPendingChunk=MR;var wm=class extends ji{constructor(e){super(e,Yn.Chunk)}complete(e){this.block.body=this.body,this.block.end=e.end,super.complete(e)}};Ve.PendingChunk=wm;function LR(t){return t.type===Yn.For}Ve.isPendingFor=LR;var Em=class extends ji{constructor(e){super(e,Yn.For)}complete(e){this.block.body=this.body,this.block.end=e.end,super.complete(e)}};Ve.PendingFor=Em;function NR(t){return t.type===Yn.Function}Ve.isPendingFunction=NR;var Am=class extends ji{constructor(e){super(e,Yn.Function)}complete(e){this.block.body=this.body,this.block.end=e.end,super.complete(e)}};Ve.PendingFunction=Am;function qR(t){return t.type===Yn.If}Ve.isPendingIf=qR;var xm=class extends ji{constructor(e,n){super(e,Yn.If),this.currentClause=n}next(e){this.currentClause.body=this.body,this.currentClause.end=e.end,this.block.clauses.push(this.currentClause),super.complete(e),this.body=[]}complete(e){this.body.length>0&&this.next(e),this.block.end=e.end,super.complete(e)}};Ve.PendingIf=xm;function jR(t){return t.type===Yn.While}Ve.isPendingWhile=jR;var km=class extends ji{constructor(e){super(e,Yn.While)}complete(e){this.block.body=this.body,this.block.end=e.end,super.complete(e)}};Ve.PendingWhile=km});var jw=m(oa=>{"use strict";var qw=oa&&oa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(oa,"__esModule",{value:!0});var FR=qw(ph()),ai=ni(),lr=mm(),$R=qw(bm()),BR=Dc(),Nt=js(),Or=$s(),Kt=Zo(),z=vm(),UR=Tm(),dr=Cm(),Om=class{constructor(e,n={}){let r=this;r.content=e,r.backpatches=new UR.Stack,r.statementErrors=[],r.lexer=n.lexer||new FR.default(e,{unsafe:n.unsafe,tabWidth:n.tabWidth}),r.token=null,r.previousToken=null,r.lines={},r.scopes=[],r.currentScope=null,r.currentAssignment=null,r.outerScopes=[],r.literals=[],r.validator=n.validator||new $R.default,r.astProvider=n.astProvider||new lr.ASTProvider,r.unsafe=n.unsafe||!1,r.errors=[]}next(){this.previousToken=this.token,this.token=this.lexer.next()}isType(e){return this.token!==null&&e===this.token.type}consume(e){return e(this.token)?(this.next(),!0):!1}consumeMany(e){return e(this.token)?(this.next(),!0):!1}requireType(e,n){let r=this.token;return this.token.type!==e?(this.raise(`got ${r} where ${e} is required`,new Kt.Range(n||r.start,r.end)),null):(this.next(),r)}requireToken(e,n){let r=this.token;return e(r)?(this.next(),r):(this.raise(`got ${r} where "${(0,z.getSelectorValue)(e)}" is required`,new Kt.Range(n||r.start,r.end)),null)}requireTokenOfAny(e,n){let r=this.token;return e(r)?(this.next(),r):(this.raise(`got ${r} where any of ${(0,z.getSelectorsFromGroup)(e).map(i=>`"${(0,z.getSelectorValue)(i)}"`).join(", ")} is required`,new Kt.Range(n||r.start,r.end)),null)}addItemToLines(e){let n=this.lines,r=e.end.line;for(let i=e.start.line;i<=r;i++){let s=n[i];s?s.push(e):n[i]=[e]}}skipNewlines(){let e=this,n=0;for(;;){if(z.Selectors.Comment(e.token)){let r=e.astProvider.comment({value:e.token.value,start:e.token.start,end:e.token.end,scope:e.currentScope});e.addItemToLines(r),e.backpatches.peek().body.push(r)}else if(z.Selectors.EndOfLine(e.token))n++;else break;e.next()}return n}pushScope(e){let n=this;n.currentScope!==null&&(n.scopes.push(e),n.outerScopes.push(n.currentScope)),n.currentScope=e}popScope(){let e=this;e.currentScope=e.outerScopes.pop()}tryToRecover(){let e=this,n=e.statementErrors[0];if(e.errors.push(n),!e.unsafe)throw n;for(e.lexer.recoverFromSnapshot(),e.next();e.token.type!==ai.TokenType.EOL&&e.token.type!==ai.TokenType.EOF;e.next());}finishRemaingScopes(){let e=this,n=e.backpatches.pop();for(;!(0,dr.isPendingChunk)(n);){let r=e.raise(`found open block ${n.block.type}`,new Kt.Range(n.block.start,n.block.start));if(n.complete(e.previousToken),e.errors.push(r),!e.unsafe)throw r;n=e.backpatches.pop()}}parseChunk(){let e=this;e.next();let n=e.token.start,r=e.astProvider.chunk({start:n,end:null}),i=new dr.PendingChunk(r);for(e.backpatches.setDefault(i),e.pushScope(r);!z.Selectors.EndOfFile(e.token)&&(e.skipNewlines(),!z.Selectors.EndOfFile(e.token));)e.lexer.recordSnapshot(),e.statementErrors=[],e.parseStatement(),e.statementErrors.length>0&&e.tryToRecover();return e.finishRemaingScopes(),e.popScope(),i.complete(e.token),r.literals=e.literals,r.scopes=e.scopes,r.lines=e.lines,r}parseStatement(){let e=this;if(ai.TokenType.Keyword===e.token.type&&Nt.Keyword.Not!==e.token.value){e.parseKeyword();return}let n=e.backpatches.peek(),r=e.parseAssignment();r.end!==null&&e.addItemToLines(r),n.body.push(r)}parseKeyword(){let e=this;switch(e.token.value){case Nt.Keyword.Return:{let r=e.backpatches.peek();e.next();let i=e.parseReturnStatement();i.end!==null&&e.addItemToLines(i),r.body.push(i);return}case Nt.Keyword.If:{e.next(),e.parseIfStatement();return}case Nt.Keyword.ElseIf:{e.next(),e.nextIfClause(lr.ASTType.ElseifClause);return}case Nt.Keyword.Else:{e.next(),e.nextIfClause(lr.ASTType.ElseClause);return}case Nt.Keyword.While:{e.next(),e.parseWhileStatement();return}case Nt.Keyword.For:{e.next(),e.parseForStatement();return}case Nt.Keyword.EndFunction:{e.next(),e.finalizeFunction();return}case Nt.Keyword.EndFor:{e.next(),e.finalizeForStatement();return}case Nt.Keyword.EndWhile:{e.next(),e.finalizeWhileStatement();return}case Nt.Keyword.EndIf:{e.next(),e.nextIfClause(null);return}case Nt.Keyword.Continue:{let r=e.backpatches.peek();e.next();let i=e.astProvider.continueStatement({start:e.previousToken.start,end:e.previousToken.end,scope:e.currentScope});e.addItemToLines(i),r.body.push(i);return}case Nt.Keyword.Break:{let r=e.backpatches.peek();e.next();let i=e.astProvider.breakStatement({start:e.previousToken.start,end:e.previousToken.end,scope:e.currentScope});e.addItemToLines(i),r.body.push(i);return}}e.raise(`unexpected keyword ${e.token} at start of line`,new Kt.Range(e.token.start,e.token.end))}parseShortcutStatement(){let e=this;if(ai.TokenType.Keyword===e.token.type&&Nt.Keyword.Not!==e.token.value)switch(e.token.value){case Nt.Keyword.Return:return e.next(),e.parseReturnStatement();case Nt.Keyword.Continue:return e.next(),e.astProvider.continueStatement({start:e.previousToken.start,end:e.previousToken.end,scope:e.currentScope});case Nt.Keyword.Break:return e.next(),e.astProvider.breakStatement({start:e.previousToken.start,end:e.previousToken.end,scope:e.currentScope});default:return e.raise(`unexpected keyword ${e.token} in shorthand statement`,new Kt.Range(e.token.start,e.token.end)),e.parseInvalidCode()}return e.parseAssignment()}parseAssignment(){let e=this,n=e.currentScope,r=e.token.start,i=e.parseExpr(null,!0,!0);if(z.SelectorGroups.AssignmentEndOfExpr(e.token))return i;if(z.Selectors.Assign(e.token)){e.next();let o=e.astProvider.assignmentStatement({variable:i,init:null,start:r,end:null,scope:n}),a=e.currentAssignment;if(e.currentAssignment=o,o.init=e.parseExpr(o),o.end=e.previousToken.end,o.init.type===lr.ASTType.FunctionDeclaration){let u=e.backpatches.peek();u.onComplete=c=>o.end=c.block.end}return e.currentAssignment=a,n.assignments.push(o),o}else if(z.SelectorGroups.AssignmentShorthand(e.token)){let o=e.token;e.next();let a=e.astProvider.assignmentStatement({variable:i,init:null,start:r,end:null,scope:n}),u=e.currentAssignment;e.currentAssignment=a;let c=e.token.start,l=o.value.charAt(0),d=e.parseExpr(a),p=e.astProvider.parenthesisExpression({start:d.start,end:d.end,expression:d});return a.init=e.astProvider.binaryExpression({operator:l,left:i.clone(),right:p,start:c,end:e.previousToken.end,scope:n}),a.end=e.previousToken.end,e.currentAssignment=u,n.assignments.push(a),a}let s=[];for(;!z.Selectors.EndOfFile(e.token);){let o=e.parseExpr(null);if(s.push(o),z.SelectorGroups.BlockEndOfLine(e.token)||z.Selectors.Else(e.token))break;if(z.Selectors.ArgumentSeperator(e.token)){e.next(),e.skipNewlines();continue}let a=e.requireTokenOfAny(z.SelectorGroups.AssignmentCommandArgs,r);if(z.Selectors.EndOfLine(a)||z.Selectors.EndOfFile(a))break}return s.length===0?e.astProvider.callStatement({expression:i,start:r,end:e.previousToken.end,scope:n}):e.astProvider.callStatement({expression:e.astProvider.callExpression({base:i,arguments:s,start:r,end:e.previousToken.end,scope:n}),start:r,end:e.previousToken.end,scope:n})}parseReturnStatement(){let e=this,n=e.currentScope,r=e.previousToken.start,i=null,s=e.astProvider.returnStatement({argument:null,start:r,end:null,scope:n});if(z.SelectorGroups.ReturnStatementEnd(e.token))s.end=e.previousToken.end;else{if(i=e.parseExpr(s),i.type===lr.ASTType.FunctionDeclaration){let o=e.backpatches.peek();o.onComplete=a=>s.end=a.block.end}else s.end=e.previousToken.end;s.argument=i}return n.returns.push(s),s}parseIfStatement(){let e=this,n=e.previousToken.start,r=e.parseExpr(null);if(e.addItemToLines(r),e.requireToken(z.Selectors.Then,n),!z.SelectorGroups.BlockEndOfLine(e.token)){e.parseIfShortcutStatement(r,n);return}let i=e.astProvider.ifStatement({clauses:[],start:n,end:null,scope:e.currentScope}),s=e.astProvider.ifClause({condition:r,start:n,end:e.token.end,scope:e.currentScope}),o=new dr.PendingIf(i,s);e.backpatches.push(o)}nextIfClause(e){let n=this,r=n.backpatches.peek();if(!(0,dr.isPendingIf)(r)){n.raise("no matching open if block",new Kt.Range(n.token.start,n.token.end));return}switch(r.next(n.previousToken),e){case lr.ASTType.ElseifClause:{let i=n.token.start,s=n.parseExpr(null);n.requireToken(z.Selectors.Then,i),r.currentClause=n.astProvider.elseifClause({condition:s,start:i,end:null,scope:n.currentScope});break}case lr.ASTType.ElseClause:{let i=n.token.start;r.currentClause=n.astProvider.elseClause({start:i,end:null,scope:n.currentScope});break}}e===null&&(r.complete(n.previousToken),n.addItemToLines(r.block),n.backpatches.pop(),n.backpatches.peek().body.push(r.block))}parseIfShortcutStatement(e,n){let r=this,i=[],s=r.backpatches.peek(),o=r.astProvider.ifShortcutStatement({clauses:i,start:n,end:null,scope:r.currentScope}),a=r.parseShortcutStatement();if(i.push(r.astProvider.ifShortcutClause({condition:e,body:[a],start:n,end:r.token.end,scope:r.currentScope})),z.Selectors.Else(r.token)){r.next();let u=r.token.start,c=r.parseShortcutStatement();i.push(r.astProvider.elseShortcutClause({body:[c],start:u,end:r.token.end,scope:r.currentScope}))}o.end=r.token.end,r.addItemToLines(o),s.body.push(o)}parseWhileStatement(){let e=this,n=e.previousToken.start,r=e.parseExpr(null);if(!r){e.raise("while requires a condition",new Kt.Range(n,e.token.end));return}if(!z.SelectorGroups.BlockEndOfLine(e.token))return e.parseWhileShortcutStatement(r,n);let i=e.astProvider.whileStatement({condition:r,start:n,end:null,scope:e.currentScope}),s=new dr.PendingWhile(i);e.backpatches.push(s),s.onComplete=o=>{e.addItemToLines(o.block),e.backpatches.pop(),e.backpatches.peek().body.push(o.block)}}finalizeWhileStatement(){let e=this,n=e.backpatches.peek();if(!(0,dr.isPendingWhile)(n)){e.raise("no matching open while block",new Kt.Range(e.token.start,e.token.end));return}n.complete(e.previousToken)}parseWhileShortcutStatement(e,n){let r=this,i=r.backpatches.peek(),s=r.parseShortcutStatement(),o=r.astProvider.whileStatement({condition:e,body:[s],start:n,end:r.previousToken.end,scope:r.currentScope});r.addItemToLines(o),i.body.push(o)}parseForStatement(){let e=this,n=e.currentScope,r=e.previousToken.start,i=e.parseIdentifier(),s=e.astProvider.assignmentStatement({variable:i,init:e.astProvider.unknown({start:i.start,end:i.end,scope:n}),start:i.start,end:i.end,scope:n}),o=e.astProvider.assignmentStatement({variable:e.astProvider.identifier({name:`__${i.name}_idx`,start:i.start,end:i.end,scope:n}),init:e.astProvider.literal(ai.TokenType.NumericLiteral,{value:0,raw:"0",start:i.start,end:i.end,scope:n}),start:i.start,end:i.end,scope:n});n.assignments.push(s,o),e.requireToken(z.Selectors.In,r);let a=e.parseExpr(null);if(!a){e.raise("sequence expression expected for 'for' loop",new Kt.Range(r,e.token.end));return}if(!z.SelectorGroups.BlockEndOfLine(e.token))return e.parseForShortcutStatement(i,a,r);let u=e.astProvider.forGenericStatement({variable:i,iterator:a,start:r,end:e.previousToken.end,scope:n}),c=new dr.PendingFor(u);e.backpatches.push(c)}finalizeForStatement(){let e=this,n=e.backpatches.peek();if(!(0,dr.isPendingFor)(n)){e.raise("no matching open for block",new Kt.Range(e.token.start,e.token.end));return}n.complete(e.previousToken),e.addItemToLines(n.block),e.backpatches.pop(),e.backpatches.peek().body.push(n.block)}parseForShortcutStatement(e,n,r){let i=this,s=i.backpatches.peek(),o=i.parseShortcutStatement(),a=i.astProvider.forGenericStatement({variable:e,iterator:n,body:[o],start:r,end:i.previousToken.end,scope:i.currentScope});i.addItemToLines(a),s.body.push(a)}parseExpr(e,n=!1,r=!1){return this.parseFunctionDeclaration(e,n,r)}parseFunctionDeclaration(e,n=!1,r=!1){let i=this;if(!z.Selectors.Function(i.token))return i.parseOr(n,r);i.next();let s=i.previousToken.start,o=i.astProvider.functionStatement({start:s,end:null,scope:i.currentScope,parent:i.outerScopes[i.outerScopes.length-1],assignment:i.currentAssignment}),a=[];if(i.pushScope(o),!z.SelectorGroups.BlockEndOfLine(i.token)){for(i.requireToken(z.Selectors.LParenthesis,s);!z.SelectorGroups.FunctionDeclarationArgEnd(i.token);){let c=i.parseIdentifier(),l=c.start;if(i.consume(z.Selectors.Assign)){let d=i.parseExpr(null);if(d instanceof lr.ASTLiteral){let p=i.astProvider.assignmentStatement({variable:c,init:d,start:l,end:i.previousToken.end,scope:i.currentScope});i.currentScope.assignments.push(p),a.push(p)}else i.raise("parameter default value must be a literal value",new Kt.Range(l,i.token.end)),a.push(i.astProvider.invalidCodeExpression({start:l,end:i.previousToken.end}))}else{let d=i.astProvider.assignmentStatement({variable:c,init:i.astProvider.unknown({start:l,end:i.previousToken.end,scope:i.currentScope}),start:l,end:i.previousToken.end,scope:i.currentScope});i.currentScope.assignments.push(d),a.push(c)}if(z.Selectors.RParenthesis(i.token))break;if(i.requireToken(z.Selectors.ArgumentSeperator,s),z.Selectors.RParenthesis(i.token)){i.raise("expected argument instead received right parenthesis",new Kt.Range(i.previousToken.end,i.previousToken.end));break}}i.requireToken(z.Selectors.RParenthesis,s)}o.parameters=a;let u=new dr.PendingFunction(o);return i.backpatches.push(u),u.onComplete=c=>{e!==null?(e.end=c.block.end,i.addItemToLines(e)):i.addItemToLines(c.block)},o}finalizeFunction(){let e=this,n=e.backpatches.peek();if(!(0,dr.isPendingFunction)(n)){e.raise("no matching open function block",new Kt.Range(e.token.start,e.token.end));return}e.popScope(),n.complete(e.previousToken),e.backpatches.pop()}parseOr(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseAnd(e,n);for(;z.Selectors.Or(r.token);){r.next(),r.skipNewlines();let a=r.parseAnd();o=r.astProvider.logicalExpression({operator:Or.Operator.Or,left:o,right:a,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseAnd(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseNot(e,n);for(;z.Selectors.And(r.token);){r.next(),r.skipNewlines();let a=r.parseNot();o=r.astProvider.logicalExpression({operator:Or.Operator.And,left:o,right:a,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseNot(e=!1,n=!1){let r=this,i=r.token.start;if(z.Selectors.Not(r.token)){r.next(),r.skipNewlines();let s=r.parseIsa();return r.astProvider.unaryExpression({operator:Or.Operator.Not,argument:s,start:i,end:r.previousToken.end,scope:r.currentScope})}return r.parseIsa(e,n)}parseIsa(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseComparisons(e,n);if(z.Selectors.Isa(r.token)){r.next(),r.skipNewlines();let o=r.parseComparisons();return r.astProvider.isaExpression({operator:Or.Operator.Isa,left:s,right:o,start:i,end:r.previousToken.end,scope:r.currentScope})}return s}parseComparisons(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseAddSub(e,n);if(!z.SelectorGroups.ComparisonOperators(r.token))return s;let o=[s],a=[];do{let u=r.token;r.next(),r.skipNewlines();let c=r.parseAddSub();a.push(u.value),o.push(c)}while(z.SelectorGroups.ComparisonOperators(r.token));return a.length===1?r.astProvider.binaryExpression({operator:a[0],left:o[0],right:o[1],start:i,end:r.previousToken.end,scope:r.currentScope}):r.astProvider.comparisonGroupExpression({operators:a,expressions:o,start:i,end:r.previousToken.end,scope:r.currentScope})}parseAddSub(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseMultDiv(e,n);for(;z.Selectors.Plus(r.token)||z.Selectors.Minus(r.token)&&(!n||!r.token.afterSpace||r.lexer.isAtWhitespace());){let a=r.token;r.next(),r.skipNewlines();let u=r.parseMultDiv();o=r.astProvider.binaryExpression({operator:a.value,left:o,right:u,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseMultDiv(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseUnaryMinus(e,n);for(;z.SelectorGroups.MultiDivOperators(r.token);){let a=r.token;r.next(),r.skipNewlines();let u=r.parseUnaryMinus();o=r.astProvider.binaryExpression({operator:a.value,left:o,right:u,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseUnaryMinus(e=!1,n=!1){let r=this;if(!z.Selectors.Minus(r.token))return r.parseNew(e,n);let i=r.token.start;r.next(),r.skipNewlines();let s=r.parseNew();return s instanceof lr.ASTNumericLiteral||s instanceof lr.ASTBooleanLiteral?(s.negated=!0,s):r.astProvider.unaryExpression({operator:Or.Operator.Minus,argument:s,start:i,end:r.previousToken.end,scope:r.currentScope})}parseNew(e=!1,n=!1){let r=this;if(!z.Selectors.New(r.token))return r.parseAddressOf(e,n);let i=r.token.start;r.next(),r.skipNewlines();let s=r.parseNew();return r.astProvider.unaryExpression({operator:Or.Operator.New,argument:s,start:i,end:r.previousToken.end,scope:r.currentScope})}parseAddressOf(e=!1,n=!1){let r=this;if(!z.Selectors.Reference(r.token))return r.parsePower(e,n);let i=r.token.start;r.next(),r.skipNewlines();let s=r.parsePower();return r.astProvider.unaryExpression({operator:Or.Operator.Reference,argument:s,start:i,end:r.previousToken.end,scope:r.currentScope})}parsePower(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseCallExpr(e,n);if(z.Selectors.Power(r.token)){r.next(),r.skipNewlines();let o=r.parseCallExpr();return r.astProvider.binaryExpression({operator:Or.Operator.Power,left:s,right:o,start:i,end:r.previousToken.end,scope:r.currentScope})}return s}parseCallExpr(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseMap(e,n);for(;!z.Selectors.EndOfFile(r.token);)if(z.Selectors.MemberSeperator(r.token)){r.next(),r.skipNewlines();let o=r.parseIdentifier();s=r.astProvider.memberExpression({base:s,indexer:Or.Operator.Member,identifier:o,start:i,end:r.previousToken.end,scope:r.currentScope})}else if(z.Selectors.SLBracket(r.token)&&!r.token.afterSpace){if(r.next(),r.skipNewlines(),z.Selectors.SliceSeperator(r.token)){let o=r.astProvider.emptyExpression({start:r.previousToken.start,end:r.previousToken.end,scope:r.currentScope});r.next(),r.skipNewlines();let a=z.Selectors.SRBracket(r.token)?r.astProvider.emptyExpression({start:r.previousToken.start,end:r.previousToken.end,scope:r.currentScope}):r.parseExpr(null);s=r.astProvider.sliceExpression({base:s,left:o,right:a,start:i,end:r.token.end,scope:r.currentScope})}else{let o=r.parseExpr(null);if(z.Selectors.SliceSeperator(r.token)){r.next(),r.skipNewlines();let a=z.Selectors.SRBracket(r.token)?r.astProvider.emptyExpression({start:r.previousToken.start,end:r.previousToken.end,scope:r.currentScope}):r.parseExpr(null);s=r.astProvider.sliceExpression({base:s,left:o,right:a,start:i,end:r.token.end,scope:r.currentScope})}else s=r.astProvider.indexExpression({base:s,index:o,start:i,end:r.token.end,scope:r.currentScope})}r.requireToken(z.Selectors.SRBracket,i)}else if(z.Selectors.LParenthesis(r.token)&&(!e||!r.token.afterSpace)){let o=r.parseCallArgs();s=r.astProvider.callExpression({base:s,arguments:o,start:i,end:r.previousToken.end,scope:r.currentScope})}else break;return s}parseCallArgs(){let e=this,n=[];if(z.Selectors.LParenthesis(e.token))if(e.next(),z.Selectors.RParenthesis(e.token))e.next();else for(;!z.Selectors.EndOfFile(e.token);){e.skipNewlines();let r=e.parseExpr(null);if(n.push(r),e.skipNewlines(),z.Selectors.RParenthesis(e.requireTokenOfAny(z.SelectorGroups.CallArgsEnd,r.start)))break}return n}parseMap(e=!1,n=!1){let r=this;if(!z.Selectors.CLBracket(r.token))return r.parseList(e,n);let i=r.currentScope,s=r.token.start,o=[],a=r.astProvider.mapConstructorExpression({fields:o,start:s,end:null,scope:i});if(r.next(),z.Selectors.CRBracket(r.token))r.next();else for(r.skipNewlines();!z.Selectors.EndOfFile(r.token);){if(z.Selectors.CRBracket(r.token)){r.next();break}let u=r.astProvider.mapKeyString({key:null,value:null,start:r.token.start,end:null,scope:i});if(u.key=r.parseExpr(null),r.requireToken(z.Selectors.MapKeyValueSeperator),r.skipNewlines(),r.currentAssignment){let c=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:u.key,base:r.currentAssignment.variable,start:u.start,end:r.token.end,scope:i}),init:null,start:u.start,end:null}),l=r.currentAssignment;r.currentAssignment=c,u.value=r.parseExpr(u),r.currentAssignment=l,c.init=u.value,c.end=r.previousToken.end,i.assignments.push(c)}else u.value=r.parseExpr(u);if(u.end=r.previousToken.end,o.push(u),z.Selectors.MapSeperator(r.token)&&(r.next(),r.skipNewlines()),z.Selectors.CRBracket(r.token)){r.next();break}}return a.end=r.token.start,a}parseList(e=!1,n=!1){let r=this;if(!z.Selectors.SLBracket(r.token))return r.parseQuantity(e,n);let i=r.currentScope,s=r.token.start,o=[],a=r.astProvider.listConstructorExpression({fields:o,start:s,end:null,scope:i});if(r.next(),z.Selectors.SRBracket(r.token))r.next();else for(r.skipNewlines();!z.Selectors.EndOfFile(r.token);){if(z.Selectors.SRBracket(r.token)){r.next();break}let u=r.astProvider.listValue({value:null,start:r.token.start,end:null,scope:i});if(r.currentAssignment){let c=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:r.astProvider.literal(ai.TokenType.NumericLiteral,{value:o.length,raw:`${o.length}`,start:s,end:r.token.end,scope:i}),base:r.currentAssignment.variable,start:null,end:null,scope:i}),init:null,start:null,end:null}),l=r.currentAssignment,d=r.token;r.currentAssignment=l,u.value=r.parseExpr(u),r.currentAssignment=l,c.variable.start=d.start,c.variable.end=r.previousToken.end,c.init=u.value,c.start=u.start,c.end=r.previousToken.end,i.assignments.push(c)}else u.value=r.parseExpr(u);if(u.end=r.previousToken.end,o.push(u),z.Selectors.MapSeperator(r.token)&&(r.next(),r.skipNewlines()),z.Selectors.SRBracket(r.token)){r.next();break}}return a.end=r.token.start,a}parseQuantity(e=!1,n=!1){let r=this;if(!z.Selectors.LParenthesis(r.token))return r.parseAtom(e,n);let i=r.token.start;r.next(),r.skipNewlines();let s=r.parseExpr(null);return r.requireToken(z.Selectors.RParenthesis,i),r.astProvider.parenthesisExpression({expression:s,start:i,end:r.previousToken.end,scope:r.currentScope})}parseAtom(e=!1,n=!1){let r=this;return r.validator.isLiteral(r.token.type)?r.parseLiteral():r.isType(ai.TokenType.Identifier)?r.parseIdentifier():(r.raise(`got ${r.token} where number, string, or identifier is required`,new Kt.Range(r.token.start,r.token.end)),r.parseInvalidCode())}parseLiteral(){let e=this,n=e.token.start,r=e.token.type,i=e.astProvider.literal(r,{value:e.token.value,raw:e.token.raw,start:n,end:e.token.end,scope:e.currentScope});return e.literals.push(i),e.next(),i}parseIdentifier(){let e=this,n=e.token.start,r=e.token.end,i=e.requireType(ai.TokenType.Identifier);return i===null?e.parseInvalidCode():(e.currentScope.namespaces.add(i.value),e.astProvider.identifier({name:i.value,start:n,end:r,scope:e.currentScope}))}parseInvalidCode(){let e=this,n=e.token.start,r=e.token.end,i=e.astProvider.invalidCodeExpression({start:n,end:r});return e.next(),i}raise(e,n){let r=this,i=new BR.ParserException(e,n);return r.statementErrors.push(i),i}};oa.default=Om});var je=m(Oe=>{"use strict";var HR=Oe&&Oe.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Jn=Oe&&Oe.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&HR(e,t,n)},nl=Oe&&Oe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.ASTRange=Oe.ASTPosition=Oe.ParserValidatorm=Oe.Parser=Oe.LexerValidator=Oe.Lexer=void 0;var WR=ph();Object.defineProperty(Oe,"Lexer",{enumerable:!0,get:function(){return nl(WR).default}});Jn(ni(),Oe);var GR=rh();Object.defineProperty(Oe,"LexerValidator",{enumerable:!0,get:function(){return nl(GR).default}});var VR=jw();Object.defineProperty(Oe,"Parser",{enumerable:!0,get:function(){return nl(VR).default}});Jn(mm(),Oe);var zR=bm();Object.defineProperty(Oe,"ParserValidatorm",{enumerable:!0,get:function(){return nl(zR).default}});Jn(Cm(),Oe);Jn(Tm(),Oe);Jn(lh(),Oe);Jn(Rc(),Oe);Jn(Dc(),Oe);Jn(js(),Oe);Jn(oh(),Oe);Jn($s(),Oe);var KR=zo();Object.defineProperty(Oe,"ASTPosition",{enumerable:!0,get:function(){return KR.Position}});var XR=Zo();Object.defineProperty(Oe,"ASTRange",{enumerable:!0,get:function(){return XR.Range}});Jn(vm(),Oe)});var aa=m(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.isValidIdentifierLiteral=void 0;var YR=je(),JR=t=>{if(t.type!==YR.ASTType.StringLiteral)return!1;let e=t.value.toString();return/^[_a-z][_a-z0-9]*$/i.test(e)};rl.isValidIdentifierLiteral=JR});var Rm=m(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.getStringHashCode=ui.getHashCode=ui.rotateBits=void 0;function QR(t){return t>>1|t<<31}ui.rotateBits=QR;function ZR(t,e=0){let n=t>>>0;return n=(n>>16^n)*73244475,n=(n>>16^n)*73244475,n=n>>16^n,(e<<5)-e+n|0}ui.getHashCode=ZR;ui.getStringHashCode=function(){let t=new Map,e=n=>{let r,i;for(r=0,i=0;r<n.length;r++)i=Math.imul(31,i)+n.charCodeAt(r)|0;return i};return n=>{if(n.length===0)return 0;let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}()});var Fw=m(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.createExpressionHash=void 0;var He=je(),pt=Rm(),e1=aa(),qt=(t,e)=>t.$$hash=e,t1=t=>t.$$hash??null;function et(t){let e=t1(t);if(e!==null)return e;let n=(0,pt.getStringHashCode)(t.type);switch(t.type){case He.ASTType.BinaryExpression:{let r=t;return n^=(0,pt.getStringHashCode)(r.operator),n^=et(r.left),n^=et(r.right),qt(t,n)}case He.ASTType.LogicalExpression:{let r=t;return n^=(0,pt.getStringHashCode)(r.operator),n^=et(r.left),n^=et(r.right),qt(t,n)}case He.ASTType.IsaExpression:{let r=t;return n^=(0,pt.getStringHashCode)(r.operator),n^=et(r.left),n^=et(r.right),qt(t,n)}case He.ASTType.ComparisonGroupExpression:{let r=t;for(let i=0;i<r.expressions.length;i++)n^=et(r.expressions[i]);for(let i=0;i<r.operators.length;i++)n^=(0,pt.getStringHashCode)(r.operators[i]);return qt(t,n)}case He.ASTType.FunctionDeclaration:{let r=t;n^=(0,pt.getHashCode)(r.parameters.length);for(let i=0;i<r.parameters.length;i++){let s=r.parameters[i];if(s.type===He.ASTType.Identifier){n^=(0,pt.getStringHashCode)(s.name);continue}let o=s;n^=(0,pt.getStringHashCode)(o.variable.name),n^=et(o.init)}return qt(t,n)}case He.ASTType.ParenthesisExpression:return et(t.expression);case He.ASTType.MemberExpression:{let r=t;if(r.base.type===He.ASTType.Identifier){let i=r.base.name;if(i==="globals"||i==="locals"||i==="outer")return n=(0,pt.getStringHashCode)(He.ASTType.Identifier),n^=(0,pt.getStringHashCode)(r.identifier.name),qt(t,n)}return n^=et(r.base),n^=et(r.identifier),qt(t,n)}case He.ASTType.IndexExpression:{let r=t;if((0,e1.isValidIdentifierLiteral)(r.index)){if(r.base.type===He.ASTType.Identifier){let s=r.base.name;if(s==="globals"||s==="locals"||s==="outer")return n=(0,pt.getStringHashCode)(He.ASTType.Identifier),n^=(0,pt.getStringHashCode)(r.index.value.toString()),qt(t,n)}n=(0,pt.getStringHashCode)(He.ASTType.MemberExpression),n^=et(r.base);let i=(0,pt.getStringHashCode)(He.ASTType.Identifier);i^=(0,pt.getStringHashCode)(r.index.value.toString()),n^=i}else n^=et(r.base),n^=et(r.index);return qt(t,n)}case He.ASTType.CallExpression:{let r=t;n^=et(r.base),n^=(0,pt.getHashCode)(r.arguments.length);for(let i=0;i<r.arguments.length;i++){let s=r.arguments[i];n^=et(s)}return qt(t,n)}case He.ASTType.NegationExpression:case He.ASTType.BinaryNegatedExpression:case He.ASTType.UnaryExpression:{let r=t;return n^=r.operator?(0,pt.getStringHashCode)(r.operator):1,n^=et(r.argument),qt(t,n)}case He.ASTType.Identifier:{let r=t;return n^=(0,pt.getStringHashCode)(r.name),qt(t,n)}case He.ASTType.NumericLiteral:case He.ASTType.StringLiteral:case He.ASTType.NilLiteral:return n^=(0,pt.getStringHashCode)(t.value.toString()),qt(t,n);case He.ASTType.MapConstructorExpression:{let r=t;n^=(0,pt.getHashCode)(r.fields.length);for(let i=0;i<r.fields.length;i++){let s=r.fields[i];n^=et(s.key),n^=et(s.value)}return qt(t,n)}case He.ASTType.ListConstructorExpression:{let r=t;n^=(0,pt.getHashCode)(r.fields.length);for(let i=0;i<r.fields.length;i++){let s=r.fields[i];n^=et(s.value)}return qt(t,n)}case He.ASTType.SliceExpression:{let r=t;return n^=et(r.base),n^=et(r.left),n^=et(r.right),qt(t,n)}}return qt(t,n)}function n1(t){return et(t)}il.createExpressionHash=n1});var Dm=m(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.createExpressionId=void 0;var _t=je(),r1=aa(),Tt=(t,e)=>t.$$id=e,i1=t=>t.$$id??null;function ze(t){let e=i1(t);if(e!==null)return e;switch(t.type){case _t.ASTType.BinaryExpression:{let n=t;return Tt(t,ze(n.left)+n.operator+ze(n.right))}case _t.ASTType.LogicalExpression:{let n=t;return Tt(t,ze(n.left)+n.operator+ze(n.right))}case _t.ASTType.IsaExpression:{let n=t;return Tt(t,ze(n.left)+n.operator+ze(n.right))}case _t.ASTType.ComparisonGroupExpression:{let n=t,r=n.expressions.map(s=>ze(s)),i=[r[0]];for(let s=0;s<n.operators.length;s++)i.push(n.operators[s],r[s+1]);return Tt(t,i.join(" "))}case _t.ASTType.FunctionDeclaration:{let n=t,r="function",i=[];for(let s=0;s<n.parameters.length;s++){let o=n.parameters[s];if(o.type===_t.ASTType.Identifier){i.push(o.name);continue}let a=o;i.push(a.variable.name+"="+ze(a.init))}return i.length>0&&(r+="("+i.join(",")+")"),Tt(t,r)}case _t.ASTType.ParenthesisExpression:return Tt(t,ze(t.expression));case _t.ASTType.MemberExpression:{let n=t;return Tt(t,ze(n.base)+"."+n.identifier.name)}case _t.ASTType.IndexExpression:{let n=t;return(0,r1.isValidIdentifierLiteral)(n.index)?Tt(t,ze(n.base)+"."+n.index.value.toString()):Tt(t,ze(n.base)+"["+ze(n.index)+"]")}case _t.ASTType.CallExpression:{let n=t,r=ze(n.base),i=[];for(let s=0;s<n.arguments.length;s++){let o=n.arguments[s];i.push(ze(o))}return i.length>0&&(r+="("+i.join(",")+")"),Tt(t,r)}case _t.ASTType.NegationExpression:case _t.ASTType.BinaryNegatedExpression:case _t.ASTType.UnaryExpression:{let n=t;return n.operator==null?Tt(t,ze(n.argument)):n.operator==="@"?Tt(t,n.operator+ze(n.argument)):Tt(t,n.operator+" "+ze(n.argument))}case _t.ASTType.Identifier:return Tt(t,t.name);case _t.ASTType.NumericLiteral:case _t.ASTType.StringLiteral:case _t.ASTType.NilLiteral:return Tt(t,t.raw.toString());case _t.ASTType.MapConstructorExpression:{let n=t,r=[];for(let i=0;i<n.fields.length;i++){let s=n.fields[i];r.push(ze(s.key)+":"+ze(s.value))}return Tt(t,"{"+r.join(",")+"}")}case _t.ASTType.ListConstructorExpression:{let n=t,r=[];for(let i=0;i<n.fields.length;i++){let s=n.fields[i];r.push(ze(s.value))}return Tt(t,"["+r.join(",")+"]")}case _t.ASTType.SliceExpression:{let n=t;return Tt(t,ze(n.base)+"["+ze(n.left)+":"+ze(n.right)+"]")}}return Tt(t,"")}function s1(t){return ze(t)}sl.createExpressionId=s1});var Vs=m(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.Markers=void 0;var o1;(function(t){t.start="/**",t.nostart="/***",t.delim="*",t.end="*/"})(o1=ua.Markers||(ua.Markers={}))});var Qn=m(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.rewireSpecs=at.rewireSource=at.seedTokens=at.seedSpec=at.seedBlock=at.splitLines=at.splitSpace=at.splitCR=at.hasCR=at.isSpace=void 0;function a1(t){return/^\s+$/.test(t)}at.isSpace=a1;function u1(t){return/\r$/.test(t)}at.hasCR=u1;function c1(t){let e=t.match(/\r+$/);return e==null?["",t]:[t.slice(-e[0].length),t.slice(0,-e[0].length)]}at.splitCR=c1;function l1(t){let e=t.match(/^\s+/);return e==null?["",t]:[t.slice(0,e[0].length),t.slice(e[0].length)]}at.splitSpace=l1;function d1(t){return t.split(/\n/)}at.splitLines=d1;function f1(t={}){return Object.assign({description:"",tags:[],source:[],problems:[]},t)}at.seedBlock=f1;function p1(t={}){return Object.assign({tag:"",name:"",type:"",optional:!1,description:"",problems:[],source:[]},t)}at.seedSpec=p1;function h1(t={}){return Object.assign({start:"",delimiter:"",postDelimiter:"",tag:"",postTag:"",name:"",postName:"",type:"",postType:"",description:"",end:"",lineEnd:""},t)}at.seedTokens=h1;function m1(t){let e=t.source.reduce((n,r)=>n.set(r.number,r),new Map);for(let n of t.tags)n.source=n.source.map(r=>e.get(r.number));return t}at.rewireSource=m1;function g1(t){let e=t.tags.reduce((n,r)=>r.source.reduce((i,s)=>i.set(s.number,s),n),new Map);return t.source=t.source.map(n=>e.get(n.number)||n),t}at.rewireSpecs=g1});var $w=m(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});var y1=/^@\S+/;function b1({fence:t="```"}={}){let e=_1(t),n=(r,i)=>e(r)?!i:i;return function(i){let s=[[]],o=!1;for(let a of i)y1.test(a.tokens.description)&&!o?s.push([a]):s[s.length-1].push(a),o=n(a.tokens.description,o);return s}}Im.default=b1;function _1(t){return typeof t=="string"?e=>e.split(t).length%2===0:t}});var Bw=m(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var v1=Vs(),ca=Qn();function S1({startLine:t=0,markers:e=v1.Markers}={}){let n=null,r=t;return function(s){let o=s,a=(0,ca.seedTokens)();if([a.lineEnd,o]=(0,ca.splitCR)(o),[a.start,o]=(0,ca.splitSpace)(o),n===null&&o.startsWith(e.start)&&!o.startsWith(e.nostart)&&(n=[],a.delimiter=o.slice(0,e.start.length),o=o.slice(e.start.length),[a.postDelimiter,o]=(0,ca.splitSpace)(o)),n===null)return r++,null;let u=o.trimRight().endsWith(e.end);if(a.delimiter===""&&o.startsWith(e.delim)&&!o.startsWith(e.end)&&(a.delimiter=e.delim,o=o.slice(e.delim.length),[a.postDelimiter,o]=(0,ca.splitSpace)(o)),u){let c=o.trimRight();a.end=o.slice(c.length-e.end.length),o=c.slice(0,-e.end.length)}if(a.description=o,n.push({number:r,source:s,tokens:a}),r++,u){let c=n.slice();return n=null,c}return null}}Pm.default=S1});var Uw=m(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});var T1=Qn();function w1({tokenizers:t}){return function(n){var r;let i=(0,T1.seedSpec)({source:n});for(let s of t)if(i=s(i),!((r=i.problems[i.problems.length-1])===null||r===void 0)&&r.critical)break;return i}}Mm.default=w1});var Nm=m(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});function E1(){return t=>{let{tokens:e}=t.source[0],n=e.description.match(/\s*(@(\S+))(\s*)/);return n===null?(t.problems.push({code:"spec:tag:prefix",message:'tag should start with "@" symbol',line:t.source[0].number,critical:!0}),t):(e.tag=n[1],e.postTag=n[3],e.description=e.description.slice(n[0].length),t.tag=n[2],t)}}Lm.default=E1});var jm=m(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});var A1=Qn();function x1(t="compact"){let e=C1(t);return n=>{let r=0,i=[];for(let[a,{tokens:u}]of n.source.entries()){let c="";if(a===0&&u.description[0]!=="{")return n;for(let l of u.description)if(l==="{"&&r++,l==="}"&&r--,c+=l,r===0)break;if(i.push([u,c]),r===0)break}if(r!==0)return n.problems.push({code:"spec:type:unpaired-curlies",message:"unpaired curlies",line:n.source[0].number,critical:!0}),n;let s=[],o=i[0][0].postDelimiter.length;for(let[a,[u,c]]of i.entries())u.type=c,a>0&&(u.type=u.postDelimiter.slice(o)+c,u.postDelimiter=u.postDelimiter.slice(0,o)),[u.postType,u.description]=(0,A1.splitSpace)(u.description.slice(c.length)),s.push(u.type);return s[0]=s[0].slice(1),s[s.length-1]=s[s.length-1].slice(0,-1),n.type=e(s),n}}qm.default=x1;var k1=t=>t.trim();function C1(t){return t==="compact"?e=>e.map(k1).join(""):t==="preserve"?e=>e.join(`
|
97
97
|
`):t}});var Bm=m($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});var Fm=Qn(),O1=t=>t&&t.startsWith('"')&&t.endsWith('"');function R1(){let t=(e,{tokens:n},r)=>n.type===""?e:r;return e=>{let{tokens:n}=e.source[e.source.reduce(t,0)],r=n.description.trimLeft(),i=r.split('"');if(i.length>1&&i[0]===""&&i.length%2===1)return e.name=i[1],n.name=`"${i[1]}"`,[n.postName,n.description]=(0,Fm.splitSpace)(r.slice(n.name.length)),e;let s=0,o="",a=!1,u;for(let l of r){if(s===0&&(0,Fm.isSpace)(l))break;l==="["&&s++,l==="]"&&s--,o+=l}if(s!==0)return e.problems.push({code:"spec:name:unpaired-brackets",message:"unpaired brackets",line:e.source[0].number,critical:!0}),e;let c=o;if(o[0]==="["&&o[o.length-1]==="]"){a=!0,o=o.slice(1,-1);let l=o.split("=");if(o=l[0].trim(),l[1]!==void 0&&(u=l.slice(1).join("=").trim()),o==="")return e.problems.push({code:"spec:name:empty-name",message:"empty name",line:e.source[0].number,critical:!0}),e;if(u==="")return e.problems.push({code:"spec:name:empty-default",message:"empty default value",line:e.source[0].number,critical:!0}),e;if(!O1(u)&&/=(?!>)/.test(u))return e.problems.push({code:"spec:name:invalid-default",message:"invalid default value syntax",line:e.source[0].number,critical:!0}),e}return e.optional=a,e.name=o,n.name=c,u!==void 0&&(e.default=u),[n.postName,n.description]=(0,Fm.splitSpace)(r.slice(n.name.length)),e}}$m.default=R1});var Hm=m(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.getJoiner=void 0;var Um=Vs();function D1(t="compact",e=Um.Markers){let n=Hw(t);return r=>(r.description=n(r.source,e),r)}la.default=D1;function Hw(t){return t==="compact"?I1:t==="preserve"?L1:t}la.getJoiner=Hw;function I1(t,e=Um.Markers){return t.map(({tokens:{description:n}})=>n.trim()).filter(n=>n!=="").join(" ")}var P1=(t,{tokens:e},n)=>e.type===""?t:n,M1=({tokens:t})=>(t.delimiter===""?t.start:t.postDelimiter.slice(1))+t.description;function L1(t,e=Um.Markers){if(t.length===0)return"";t[0].tokens.description===""&&t[0].tokens.delimiter===e.start&&(t=t.slice(1));let n=t[t.length-1];return n!==void 0&&n.tokens.description===""&&n.tokens.end.endsWith(e.end)&&(t=t.slice(0,-1)),t=t.slice(t.reduce(P1,0)),t.map(M1).join(`
|
98
98
|
`)}});var Gw=m(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});var N1=Vs(),q1=Qn(),j1=$w(),F1=Bw(),$1=Uw(),B1=Nm(),U1=jm(),H1=Bm(),Ww=Hm();function W1({startLine:t=0,fence:e="```",spacing:n="compact",markers:r=N1.Markers,tokenizers:i=[(0,B1.default)(),(0,U1.default)(n),(0,H1.default)(),(0,Ww.default)(n)]}={}){if(t<0||t%1>0)throw new Error("Invalid startLine");let s=(0,F1.default)({startLine:t,markers:r}),o=(0,j1.default)({fence:e}),a=(0,$1.default)({tokenizers:i}),u=(0,Ww.getJoiner)(n);return function(c){let l=[];for(let d of(0,q1.splitLines)(c)){let p=s(d);if(p===null)continue;let y=o(p),v=y.slice(1).map(a);l.push({description:u(y[0],r),tags:v,source:p,problems:v.reduce((x,I)=>x.concat(I.problems),[])})}return l}}Wm.default=W1});var Vw=m(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});function G1(t){return t.start+t.delimiter+t.postDelimiter+t.tag+t.postTag+t.type+t.postType+t.name+t.postName+t.description+t.end+t.lineEnd}function V1(){return t=>t.source.map(({tokens:e})=>G1(e)).join(`
|
99
99
|
`)}Gm.default=V1});var Kw=m(da=>{"use strict";var z1=da&&da.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};Object.defineProperty(da,"__esModule",{value:!0});var zw=Vs(),K1=Qn(),X1={start:0,tag:0,type:0,name:0},Y1=(t=zw.Markers)=>(e,{tokens:n})=>({start:n.delimiter===t.start?n.start.length:e.start,tag:Math.max(e.tag,n.tag.length),type:Math.max(e.type,n.type.length),name:Math.max(e.name,n.name.length)}),Fi=t=>"".padStart(t," ");function J1(t=zw.Markers){let e=!1,n;function r(i){let s=Object.assign({},i.tokens);s.tag!==""&&(e=!0);let o=s.tag===""&&s.name===""&&s.type===""&&s.description==="";if(s.end===t.end&&o)return s.start=Fi(n.start+1),Object.assign(Object.assign({},i),{tokens:s});switch(s.delimiter){case t.start:s.start=Fi(n.start);break;case t.delim:s.start=Fi(n.start+1);break;default:s.delimiter="",s.start=Fi(n.start+2)}if(!e)return s.postDelimiter=s.description===""?"":" ",Object.assign(Object.assign({},i),{tokens:s});let a={delim:!1,tag:!1,type:!1,name:!1};return s.description===""&&(a.name=!0,s.postName="",s.name===""&&(a.type=!0,s.postType="",s.type===""&&(a.tag=!0,s.postTag="",s.tag===""&&(a.delim=!0)))),s.postDelimiter=a.delim?"":" ",a.tag||(s.postTag=Fi(n.tag-s.tag.length+1)),a.type||(s.postType=Fi(n.type-s.type.length+1)),a.name||(s.postName=Fi(n.name-s.name.length+1)),Object.assign(Object.assign({},i),{tokens:s})}return i=>{var{source:s}=i,o=z1(i,["source"]);return n=s.reduce(Y1(t),Object.assign({},X1)),(0,K1.rewireSource)(Object.assign(Object.assign({},o),{source:s.map(r)}))}}da.default=J1});var Xw=m(fa=>{"use strict";var Q1=fa&&fa.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};Object.defineProperty(fa,"__esModule",{value:!0});var Z1=Qn(),eD=t=>e=>e.slice(t),tD=t=>{let e="".padStart(t," ");return n=>n+e};function nD(t){let e,n=i=>{if(e===void 0){let s=t-i.length;e=s>0?tD(s):eD(-s)}return e(i)},r=i=>Object.assign(Object.assign({},i),{tokens:Object.assign(Object.assign({},i.tokens),{start:n(i.tokens.start)})});return i=>{var{source:s}=i,o=Q1(i,["source"]);return(0,Z1.rewireSource)(Object.assign(Object.assign({},o),{source:s.map(r)}))}}fa.default=nD});var Yw=m(pa=>{"use strict";var rD=pa&&pa.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};Object.defineProperty(pa,"__esModule",{value:!0});var iD=Qn();function sD(t){function e(n){return Object.assign(Object.assign({},n),{tokens:Object.assign(Object.assign({},n.tokens),{lineEnd:t==="LF"?"":"\r"})})}return n=>{var{source:r}=n,i=rD(n,["source"]);return(0,iD.rewireSource)(Object.assign(Object.assign({},i),{source:r.map(e)}))}}pa.default=sD});var Jw=m(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.flow=void 0;function oD(...t){return e=>t.reduce((n,r)=>r(n),e)}ol.flow=oD});var t0=m(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var aD=Qn(),Zw={line:0,start:0,delimiter:0,postDelimiter:0,tag:0,postTag:0,name:0,postName:0,type:0,postType:0,description:0,end:0,lineEnd:0},Qw={lineEnd:"CR"},Vm=Object.keys(Zw),e0=t=>(0,aD.isSpace)(t)?`{${t.length}}`:t,uD=t=>"|"+t.join("|")+"|",cD=(t,e)=>Object.keys(e).map(n=>e0(e[n]).padEnd(t[n]));function lD({source:t}){var e,n;if(t.length===0)return"";let r=Object.assign({},Zw);for(let s of Vm)r[s]=((e=Qw[s])!==null&&e!==void 0?e:s).length;for(let{number:s,tokens:o}of t){r.line=Math.max(r.line,s.toString().length);for(let a in o)r[a]=Math.max(r[a],e0(o[a]).length)}let i=[[],[]];for(let s of Vm)i[0].push(((n=Qw[s])!==null&&n!==void 0?n:s).padEnd(r[s]));for(let s of Vm)i[1].push("-".padEnd(r[s],"-"));for(let{number:s,tokens:o}of t){let a=s.toString().padStart(r.line);i.push([a,...cD(r,o)])}return i.map(uD).join(`
|
@@ -107,7 +107,7 @@ ${e}`;for(let a=0;a<this.details.length;++a){let u=a+1;o=`${o}
|
|
107
107
|
`),i=n.tags.filter(a=>a.tag==="param").map(a=>({label:a.name,types:a.type.split("|"),opt:a.optional})),s=n.tags.find(a=>a.tag==="return")??{type:"any"},o=n.tags.filter(a=>a.tag==="example").map(hA);return pA.SignatureDefinitionFunction.parse({type:pA.SignatureDefinitionBaseType.Function,arguments:t.getArguments().map((a,u)=>{let c=a.getLabel(),l=a.getTypes().map(p=>p.toString()),d=a.isOptional();return{types:l,opt:d,...i[u],label:c}}),returns:s.type.split("|"),description:r,example:o})}return t}Il.enrichWithMetaInformation=OP});var Ng=m(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.createResolveChain=void 0;var tn=je();function bi(t,e,n=null,r=!1){switch(t.type){case tn.ASTType.ParenthesisExpression:{bi(t.expression,e,n);return}case tn.ASTType.MemberExpression:{let i=t;bi(i.base,e),e.push({ref:t,getter:i.identifier,unary:n,isInCallExpression:r});return}case tn.ASTType.IndexExpression:{let i=t;bi(i.base,e),e.push({ref:t,getter:i.index,unary:n,isInCallExpression:r});return}case tn.ASTType.CallStatement:{bi(t.expression,e,n,!0);return}case tn.ASTType.CallExpression:{bi(t.base,e,n,!0);return}case tn.ASTType.NegationExpression:case tn.ASTType.BinaryNegatedExpression:case tn.ASTType.UnaryExpression:{let i=t;bi(i.argument,e,i);return}case tn.ASTType.Identifier:{e.push({ref:t,getter:t,unary:n,isInCallExpression:r});return}case tn.ASTType.NumericLiteral:case tn.ASTType.StringLiteral:case tn.ASTType.NilLiteral:case tn.ASTType.MapConstructorExpression:case tn.ASTType.ListConstructorExpression:{e.push({ref:t,value:t,unary:n,isInCallExpression:r});return}case tn.ASTType.SliceExpression:bi(t.base,e),e.push({ref:t,unary:n,isInCallExpression:r})}}function RP(t){let e=[];return bi(t,e),e}Pl.createResolveChain=RP});var gA=m(qg=>{function mA(t,e){return t>e?1:-1}qg.hash=function t(e,n){var r=5381;if(typeof e=="object"&&e!==null&&(e.toString===Object.prototype.toString||e.toString===Array.prototype.toString)){n||(n=new WeakSet);for(var i=Object.keys(e).sort(mA),s=0;s<i.length;s++){var o=i[s],a=e[o];if(r=33*r^t(o,n),typeof a=="object"&&a!==null&&(e.toString===Object.prototype.toString||e.toString===Array.prototype.toString)){if(n.has(a))continue;n.add(a)}r=33*r^t(a,n)}return 33*r^t(e.constructor,n)}var u=typeof e;try{e instanceof Date?u+=e.getTime():u+=String(e)}catch{u+=String(Object.assign({},e))}for(var c=0;c<u.length;c++)r=33*r^u.charCodeAt(c);return r},qg.sortNumbers=mA});var $g=m(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.ObjectSet=no.ObjectSetIterator=void 0;var jg=gA(),Ml=class{constructor(e){let n=this;n.value=e,n.index=0}next(){let e=this;return e.index>=e.value.length?{value:null,done:!0}:{value:e.value[e.index++],done:!1}}};no.ObjectSetIterator=Ml;var Fg=class{constructor(e){let r=(e?Array.from(e):[]).map(i=>[(0,jg.hash)(i),i]);this._map=new Map(r),this._first=null,this._last=null,r.length>0&&(this._first=r[0][0],this._last=r[r.length-1][0])}[Symbol.iterator](){return new Ml(Array.from(this._map.values()))}first(){return this._first!=null?this._map.get(this._first)??null:null}last(){return this._last!=null?this._map.get(this._last)??null:null}toArray(){return Array.from(this._map.values())}add(e){let n=(0,jg.hash)(e);return this._map.set(n,e),this._first??(this._first=n),this._last=n,this}delete(e){let n=(0,jg.hash)(e);return this._map.delete(n)}extend(e){for(let[n,r]of e._map)this._map.set(n,r),this._first??(this._first=n),this._last=n;return this}toJSON(){return Array.from(this._map.values())}clear(){this._map.clear()}};no.ObjectSet=Fg});var Bg=m(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=void 0;Ll.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION="This is a custom method. You can add a description for this method by adding a comment above or after the function.\n```\nmyFunction = function(a, b, c) // This function does xyz\n```\nor\n```\n/*\n This function does xyz\n*/\nmyFunction = function(a, b, c)\n```"});var Qi=m(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.CompletionItemKind=void 0;var DP;(function(t){t.Variable="var",t.Property="var",t.Function="function",t.Literal="literal",t.Constant="constant",t.ListConstructor="list",t.MapConstructor="map",t.Expression="expr",t.Unknown="unknown"})(DP=xa.CompletionItemKind||(xa.CompletionItemKind={}))});var Ug=m(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.isResolveChainItemWithValue=Sr.isResolveChainItemWithIdentifier=Sr.isResolveChainItemWithMember=Sr.isResolveChainItemWithIndex=void 0;var _i=je(),IP=t=>t!=null&&t.ref.type===_i.ASTType.IndexExpression;Sr.isResolveChainItemWithIndex=IP;var PP=t=>t!=null&&t.ref.type===_i.ASTType.MemberExpression;Sr.isResolveChainItemWithMember=PP;var MP=t=>t!=null&&t.ref.type===_i.ASTType.Identifier;Sr.isResolveChainItemWithIdentifier=MP;var LP=t=>t!=null&&(t.ref.type===_i.ASTType.NumericLiteral||t.ref.type===_i.ASTType.StringLiteral||t.ref.type===_i.ASTType.NilLiteral||t.ref.type===_i.ASTType.MapConstructorExpression||t.ref.type===_i.ASTType.ListConstructorExpression);Sr.isResolveChainItemWithValue=LP});var Hg=m(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.isSignatureDefinitionFunction=void 0;var NP=$n(),qP=t=>t.getType().type===NP.SignatureDefinitionBaseType.Function;Nl.isSignatureDefinitionFunction=qP});var ka=m(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.injectIdentifers=void 0;var jP=(t,e)=>{for(let[n,r]of e.values)n.startsWith("i:")&&t.set(n.slice(2),{kind:r.kind,line:r.line})};ql.injectIdentifers=jP});var Fl=m(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.isEligibleForProperties=void 0;var Wg=$n(),FP=t=>t.types.has(Wg.SignatureDefinitionBaseType.Map)||t.types.has(Wg.SignatureDefinitionBaseType.List)||t.types.has(Wg.SignatureDefinitionBaseType.Any);jl.isEligibleForProperties=FP});var Bl=m($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.lookupProperty=void 0;var $P=Fl(),BP=(t,e)=>{let n=t;for(;(0,$P.isEligibleForProperties)(n);){let r=n.values.get(`i:${e}`);if(r!=null)return r;let i=n.values.get("i:__isa");if(i==null)break;n=i}return null};$l.lookupProperty=BP});var so=m(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.Entity=vi.resolveEntity=void 0;var ro=$n(),io=Qi(),UP=Hg(),HP=ka(),Ul=Fl(),yA=Bl(),bA=$g(),WP=(t,e,n=!1)=>{if(e.isCallable()&&!n){let r=e.getReturnEntity();if(r!==null)return r;let i=e.getCallableReturnTypes();return i?new Zi({kind:io.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addType(...i):new Zi({kind:io.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addType(ro.SignatureDefinitionBaseType.Any)}return e};vi.resolveEntity=WP;var Gg={hasProperty(t,e,n){return!!(0,yA.lookupProperty)(t,n)||!t.isAPI()&&!!e.getDefinition(Array.from(t.types),n,!0)},resolveProperty(t,e,n,r=!1){let i=(0,yA.lookupProperty)(t,n)??null;return i==null?t.isAPI()?null:e.getDefinition(Array.from(t.types),n,r):(0,vi.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Ul.isEligibleForProperties)(t))return!1;let i=`i:${n}`,s=t.values.get(i);return s?s.extend(r):t.values.set(i,r.copy({container:e,label:n,context:t})),!0}},Vg={hasProperty(t,e,n){if(!(0,Ul.isEligibleForProperties)(t))return!1;for(let r of n.types)if(t.values.has(`t:${r}`))return!0;return!1},resolveProperty(t,e,n,r=!1){if(!(0,Ul.isEligibleForProperties)(t))return new Zi({kind:io.CompletionItemKind.Variable,container:e,label:n.label,context:t}).addType(ro.SignatureDefinitionBaseType.Any);let i=new Zi({kind:io.CompletionItemKind.Variable,container:e,label:n.label,context:t});for(let s of n.types){let o=t.values.get(`t:${s}`);o&&i.extend(o)}return i.types.size===0&&i.addType(ro.SignatureDefinitionBaseType.Any),(0,vi.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Ul.isEligibleForProperties)(t))return!1;for(let i of n.types){let s=`t:${i}`,o=t.values.get(s);o?o.extend(r):t.values.set(s,r.copy({container:e,label:i,context:t}))}return!0}},Zi=class t{get kind(){return this._kind}get line(){return this._line}get signatureDefinitions(){return this._signatureDefinitions}get context(){return this._context}get label(){return this._label}get types(){return this._types}get values(){return this._values}constructor(e){this._isAPI=e.isAPI??!1,this._isFromSignature=e.isFromSignature??!1,this._kind=e.kind,this._line=e.line??-1,this._label=e.label??"anonymous",this._signatureDefinitions=e.signatureDefinitions??new bA.ObjectSet,this._types=e.types??new Set,this._values=e.values??new Map,this._context=e.context??null,this._container=e.container,this._returnEntity=e.returnEntity??null}isFromSignature(){return this._isFromSignature}hasContext(){return this._context!=null&&!this._context.isAPI}isAPI(){return this._isAPI}isCallable(){return this._types.has(ro.SignatureDefinitionBaseType.Function)}getCallableReturnTypes(){if(!this.isCallable())return null;let e=Array.from(this._signatureDefinitions).filter(n=>(0,UP.isSignatureDefinitionFunction)(n));return e.length===0?null:e.flatMap(n=>n.getReturns()).map(n=>n.type)}addSignatureType(e){return this._signatureDefinitions.add(e),this.addType(e.getType().type),this}setReturnEntity(e){return this._returnEntity=e,this}getReturnEntity(){return this._returnEntity}setKind(e){return this._kind=e,this}setLine(e){return this._line=e,this}setLabel(e){return this._label=e,this}setContext(e){return this._context=e,this}addType(...e){for(let n of e)this._types.add(n);return this}hasProperty(e){switch(typeof e){case"object":return Vg.hasProperty(this,this._container,e);default:return Gg.hasProperty(this,this._container,e)}}resolveProperty(e,n=!1){switch(typeof e){case"object":return Vg.resolveProperty(this,this._container,e,n);default:return Gg.resolveProperty(this,this._container,e,n)}}setProperty(e,n){switch(typeof e){case"object":return Vg.setProperty(this,this._container,e,n);default:return Gg.setProperty(this,this._container,e,n)}}extend(e){if(e===this)return this;this._isFromSignature=!1,this._signatureDefinitions.extend(e.signatureDefinitions),this.addType(...e.types);for(let[n,r]of e.values){let i=this.values.get(n);i==null?this.values.set(n,r.copy({container:this._container,context:this})):i.extend(r)}return this}insertSignature(e){let n=Object.keys(e.getDefinitions());this.addType(ro.SignatureDefinitionBaseType.Map);for(let r=0;r<n.length;r++){let i=n[r],s=e.getDefinition(i),o=new t({label:i,kind:s.getType().type===ro.SignatureDefinitionBaseType.Function?io.CompletionItemKind.Function:io.CompletionItemKind.Property,container:this._container,isFromSignature:!0});o.addSignatureType(s),this.setProperty(i,o)}return this}getAllIdentifier(){let e=new Map,n=this._values.get("i:__isa");if(n!=null)for(let r of n.getAllIdentifier())e.set(...r);for(let r of this._types){let i=this._container.getAllIdentifier(r);for(let s of i)e.set(...s)}return(0,HP.injectIdentifers)(e,this),e}toJSONInternal(e=new WeakMap){if(e.has(this))return e.get(this);let n={};return e.set(this,n),n.kind=this.kind,n.signatureDefinitions=this._signatureDefinitions.toJSON(),n.types=Array.from(this._types),n.values=Array.from(this._values).reduce((r,[i,s])=>(r[i]=s?.toJSONInternal(e),r),{}),n}toJSON(){return this.toJSONInternal()}copy(e={}){let n=new t({kind:e.kind??this._kind,line:e.line??this._line,isFromSignature:e.isFromSignature??this._isFromSignature,isAPI:e.isAPI??this._isAPI,container:e.container??this._container,label:e.label??this._label,context:e.context??this._context,signatureDefinitions:new bA.ObjectSet(Array.from(this._signatureDefinitions,r=>r.copy())),types:new Set(this._types),returnEntity:this._returnEntity});return e.values?n._values=e.values:n._values=new Map(Array.from(this._values,([r,i])=>[r,i.copy({container:e.container,line:e.line,context:n,values:i.values})])),n}};vi.Entity=Zi});var Xg=m(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.Scope=void 0;var Hl=$n(),es=Qi(),zg=ka(),Wl=so(),Kg=class t{get signatureDefinitions(){return null}get kind(){return es.CompletionItemKind.Constant}get line(){return this._locals.line}get label(){return this._locals.label}get context(){return this._locals.context}get types(){return new Set(Hl.SignatureDefinitionBaseType.Map)}get values(){return this._locals.values}get globals(){return this._globals}get outer(){return this._parent?.locals??null}get locals(){return this._locals}constructor(e){this._container=e.container,this._parent=e.parent??null,this._globals=e.globals,this._locals=e.locals??new Wl.Entity({kind:es.CompletionItemKind.Constant,container:this._container,label:"locals"}).addType(Hl.SignatureDefinitionBaseType.Map)}addSignatureType(){throw new Error("Cannot add signature type to scope!")}hasProperty(e){return this._locals.hasProperty(e)}resolveProperty(e,n){return this._locals.resolveProperty(e,n)}resolveNamespace(e,n=!1){if(typeof e!="string")throw new Error("Invalid property type for scope!");if(e==="locals")return this._locals;if(e==="outer")return this._parent?.locals??this._globals;if(e==="globals")return this._globals;if(this._locals.values.has(`i:${e}`)){let r=this._locals.values.get(`i:${e}`);return(0,Wl.resolveEntity)(this._container,r,n)}else if(this._parent?.locals.values.has(`i:${e}`)){let r=this._parent.locals.values.get(`i:${e}`);return(0,Wl.resolveEntity)(this._container,r,n)}else if(this._globals.values.has(`i:${e}`)){let r=this._globals.values.get(`i:${e}`);return(0,Wl.resolveEntity)(this._container,r,n)}return this._container.getGeneralDefinition(e,n)}setProperty(e,n){return this._locals.setProperty(e,n)}extend(e){return this._locals.extend(e),this}addType(){throw new Error("Scope cannot get type assigned!")}setReturnEntity(){throw new Error("Scope cannot set return entity!")}getReturnEntity(){throw new Error("Scope cannot get return entity!")}setKind(e){return this._locals.setKind(e),this}setLine(e){return this._locals.setLine(e),this}setLabel(e){return this._locals.setLabel(e),this}setContext(e){return this._locals.setContext(e),this}insertSignature(e){return this._locals.insertSignature(e),this}isAPI(){return!1}hasContext(){return!1}isFromSignature(){return!1}isCallable(){return!1}getCallableReturnTypes(){return null}getAllIdentifier(){let e=new Map([["globals",{kind:es.CompletionItemKind.Constant,line:-1}],["locals",{kind:es.CompletionItemKind.Constant,line:-1}],["outer",{kind:es.CompletionItemKind.Constant,line:-1}],...this._container.getAllIdentifier(Hl.SignatureDefinitionBaseType.General)]);return this._locals!==this._globals&&(0,zg.injectIdentifers)(e,this._globals),this._parent&&(0,zg.injectIdentifers)(e,this._parent.locals),(0,zg.injectIdentifers)(e,this._locals),this.isSelfAvailable()&&e.set("self",{kind:es.CompletionItemKind.Constant,line:-1}),this.isSuperAvailable()&&e.set("super",{kind:es.CompletionItemKind.Constant,line:-1}),e}isSelfAvailable(){return this._locals.context!=null&&this._locals.context.types.has(Hl.SignatureDefinitionBaseType.Map)}isSuperAvailable(){return this.isSelfAvailable()&&this._locals.context.hasProperty("__isa")}toJSON(){return this._locals.toJSON()}copy(e={}){return new t({container:e.container??this._container,parent:this._parent.copy({container:e.container}),globals:this._globals.copy({container:e.container}),locals:this._locals.copy(e)})}};Gl.Scope=Kg});var oo=m(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.GreybelKeyword=void 0;var GP;(function(t){t.Envar="#envar",t.Import="#import",t.Include="#include",t.ImportWithComment="//import",t.IncludeWithComment="//include",t.Debugger="debugger",t.Line="#line",t.File="#filename",t.Inject="#inject"})(GP=Ca.GreybelKeyword||(Ca.GreybelKeyword={}))});var Qg=m(Jg=>{"use strict";Object.defineProperty(Jg,"__esModule",{value:!0});var ts=je(),VP=oo(),Yg=class extends ts.LexerValidator{constructor(){super(...arguments),this.isKeyword=Set.prototype.has.bind(new Set([...Object.values(ts.Keyword),...Object.values(VP.GreybelKeyword)]))}isIdentifierStart(e){return super.isIdentifierStart(e)||e===ts.CharacterCode.HASH}isMultilineComment(e,n){return ts.CharacterCode.SLASH===e&&ts.CharacterCode.ASTERISK===n}isMultilineCommentEnd(e,n){return ts.CharacterCode.ASTERISK===e&&ts.CharacterCode.SLASH===n}isComment(e,n){return super.isComment(e,n)||this.isMultilineComment(e,n)}};Jg.default=Yg});var Zg=m(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.CharacterCode=void 0;var zP;(function(t){t[t.VERTICAL_LINE=124]="VERTICAL_LINE",t[t.AMPERSAND=38]="AMPERSAND"})(zP=Oa.CharacterCode||(Oa.CharacterCode={}))});var ao=m(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.Operator=void 0;var KP;(function(t){t.BitwiseAnd="&",t.BitwiseOr="|",t.LeftShift="<<",t.RightShift=">>",t.UnsignedRightShift=">>>"})(KP=Ra.Operator||(Ra.Operator={}))});var ty=m(Da=>{"use strict";var XP=Da&&Da.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Da,"__esModule",{value:!0});var tr=je(),YP=XP(Qg()),_A=Zg(),vA=oo(),ey=ao();function SA(t){let e=this.content[this.index];return this.index+=e.length,this.createPunctuator(e,t)}var Vl=class t extends tr.Lexer{constructor(e,n={}){n.validator=n.validator||new YP.default,super(e,n)}scan(e,n){let r=t.greybelScanHandlers[e];return r?r.call(this,n)||super.scan(e,n):super.scan(e,n)}scanMultilineComment(e){let n=this,r=n.line,i=n.lineStart,s=n.index+2,o=0,a=n.offset,u=!1;for(;n.index<n.length;){let d=n.codeAt();if(n.validator.isEndOfLine(d))n.validator.isWinNewline(d,n.codeAt(1))&&n.index++,n.line++,o=n.index+1-n.offset,a=n.index+1;else if(n.validator.isMultilineCommentEnd(n.codeAt(),n.codeAt(1))){u=!0;break}n.index++}if(!u)return n.raise("Unexpected end of file in multiline comment.",new tr.ASTRange(new tr.ASTPosition(r,i-a+1),new tr.ASTPosition(n.line,n.index-a+1)));let c=n.content.slice(s,n.index);n.index+=2;let l=new tr.Token({type:tr.TokenType.Comment,value:c,line:r,lineStart:i,range:[n.tokenStart,n.index-o],offset:n.offset,afterSpace:e,lastLine:n.line,lastLineStart:n.lineStart});return n.offset=a,n.snapshot.enqueue(l),l}scanComment(e){let n=this,r=n.validator;return n.content.startsWith(vA.GreybelKeyword.ImportWithComment,n.index)||n.content.startsWith(vA.GreybelKeyword.IncludeWithComment,n.index)?(n.index++,n.scanIdentifierOrKeyword(e)):r.isMultilineComment(n.codeAt(),n.codeAt(1))?n.scanMultilineComment(e):super.scanComment(e)}};Da.default=Vl;Vl.greybelScanHandlers={[tr.CharacterCode.ARROW_LEFT]:function(e){if(tr.CharacterCode.ARROW_LEFT===this.codeAt(1))return this.scanPunctuator(ey.Operator.LeftShift,e)},[tr.CharacterCode.ARROW_RIGHT]:function(e){if(tr.CharacterCode.ARROW_RIGHT===this.codeAt(1))return tr.CharacterCode.ARROW_RIGHT===this.codeAt(2)?this.scanPunctuator(ey.Operator.UnsignedRightShift,e):this.scanPunctuator(ey.Operator.RightShift,e)},[_A.CharacterCode.AMPERSAND]:SA,[_A.CharacterCode.VERTICAL_LINE]:SA}});var zl=m(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.ASTType=void 0;var JP;(function(t){t.FeatureImportExpression="FeatureImportExpression",t.FeatureIncludeExpression="FeatureIncludeExpression",t.FeatureEnvarExpression="FeatureEnvarExpression",t.FeatureInjectExpression="FeatureInjectExpression",t.FeatureDebuggerExpression="FeatureDebuggerExpression",t.FeatureLineExpression="FeatureLineExpression",t.FeatureFileExpression="FeatureFileExpression"})(JP=Ia.ASTType||(Ia.ASTType={}))});var ry=m(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.ASTChunkAdvanced=void 0;var QP=je(),ny=class t extends QP.ASTChunk{constructor(e){super(e),this.imports=e.imports||[],this.includes=e.includes||[],this.injects=e.injects||[]}clone(){return new t({literals:this.literals.map(e=>e.clone()),scopes:this.scopes.map(e=>e.clone()),imports:this.imports.map(e=>e.clone()),includes:this.includes.map(e=>e.clone()),injects:this.injects.map(e=>e.clone()),lines:this.lines,start:this.start,end:this.end,scope:this.scope})}};Kl.ASTChunkAdvanced=ny});var cy=m(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.ASTFeatureFileExpression=Bn.ASTFeatureInjectExpression=Bn.ASTFeatureEnvarExpression=Bn.ASTFeatureIncludeExpression=Bn.ASTFeatureImportExpression=void 0;var Pa=je(),Ma=zl(),iy=class t extends Pa.ASTBase{constructor(e){super(Ma.ASTType.FeatureImportExpression,e),this.name=e.name,this.path=e.path,this.chunk=e.chunk,this.namespace=e.namespace}toString(){return`FeatureImportExpression[${this.start}-${this.end}][name = ${this.name}, path = ${this.path}]`}clone(){return new t({name:this.name.clone(),path:this.path,chunk:this.chunk.clone(),namespace:this.namespace,start:this.start,end:this.end,scope:this.scope})}};Bn.ASTFeatureImportExpression=iy;var sy=class t extends Pa.ASTBase{constructor(e){super(Ma.ASTType.FeatureIncludeExpression,e),this.path=e.path,this.chunk=e.chunk,this.namespace=e.namespace}toString(){return`FeatureIncludeExpression[${this.start}-${this.end}][path = ${this.path}]`}clone(){return new t({path:this.path,chunk:this.chunk.clone(),namespace:this.namespace,start:this.start,end:this.end,scope:this.scope})}};Bn.ASTFeatureIncludeExpression=sy;var oy=class t extends Pa.ASTBase{constructor(e){super(Ma.ASTType.FeatureEnvarExpression,e),this.name=e.name}toString(){return`FeatureEnvarExpression[${this.start}-${this.end}][name = ${this.name}]`}clone(){return new t({name:this.name,start:this.start,end:this.end,scope:this.scope})}};Bn.ASTFeatureEnvarExpression=oy;var ay=class t extends Pa.ASTBase{constructor(e){super(Ma.ASTType.FeatureInjectExpression,e),this.path=e.path}toString(){return`FeatureInjectExpression[${this.start}-${this.end}][path = ${this.path}]`}clone(){return new t({path:this.path,start:this.start,end:this.end,scope:this.scope})}};Bn.ASTFeatureInjectExpression=ay;var uy=class t extends Pa.ASTBase{constructor(e){super(Ma.ASTType.FeatureFileExpression,e),this.filename=e.filename}toString(){return`FeatureFileExpression[${this.start}-${this.end}][path = ${this.filename}]`}clone(){return new t({filename:this.filename,start:this.start,end:this.end,scope:this.scope})}};Bn.ASTFeatureFileExpression=uy});var fy=m(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.ASTFeatureInjectExpression=It.ASTFeatureIncludeExpression=It.ASTFeatureImportExpression=It.ASTFeatureFileExpression=It.ASTFeatureEnvarExpression=It.ASTChunkAdvanced=It.ASTType=It.ASTProvider=void 0;var ly=je(),TA=zl(),ZP=ry(),La=cy(),dy=class extends ly.ASTProvider{featureImportExpression(e){return new La.ASTFeatureImportExpression(e)}featureIncludeExpression(e){return new La.ASTFeatureIncludeExpression(e)}featureEnvarExpression(e){return new La.ASTFeatureEnvarExpression(e)}featureInjectExpression(e){return new La.ASTFeatureInjectExpression(e)}featureDebuggerExpression(e){return new ly.ASTBase(TA.ASTType.FeatureDebuggerExpression,e)}featureLineExpression(e){return new ly.ASTBase(TA.ASTType.FeatureLineExpression,e)}featureFileExpression(e){return new La.ASTFeatureFileExpression(e)}chunkAdvanced(e){return new ZP.ASTChunkAdvanced(e)}};It.ASTProvider=dy;var eM=zl();Object.defineProperty(It,"ASTType",{enumerable:!0,get:function(){return eM.ASTType}});var tM=ry();Object.defineProperty(It,"ASTChunkAdvanced",{enumerable:!0,get:function(){return tM.ASTChunkAdvanced}});var Na=cy();Object.defineProperty(It,"ASTFeatureEnvarExpression",{enumerable:!0,get:function(){return Na.ASTFeatureEnvarExpression}});Object.defineProperty(It,"ASTFeatureFileExpression",{enumerable:!0,get:function(){return Na.ASTFeatureFileExpression}});Object.defineProperty(It,"ASTFeatureImportExpression",{enumerable:!0,get:function(){return Na.ASTFeatureImportExpression}});Object.defineProperty(It,"ASTFeatureIncludeExpression",{enumerable:!0,get:function(){return Na.ASTFeatureIncludeExpression}});Object.defineProperty(It,"ASTFeatureInjectExpression",{enumerable:!0,get:function(){return Na.ASTFeatureInjectExpression}})});var py=m(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.SelectorGroups=lt.SelectorGroupType=lt.Selectors=lt.SelectorTypes=void 0;var Ne=je(),Xl=oo(),qa=ao(),nM;(function(t){t.From="From",t.Envar="Envar",t.Inject="Inject",t.Line="Line",t.File="File",t.LeftShift="LeftShift",t.RightShift="RightShift",t.UnsignedRightShift="UnsignedRightShift",t.BitwiseOr="BitwiseOr",t.BitwiseAnd="BitwiseAnd",t.Escape="Escape"})(nM=lt.SelectorTypes||(lt.SelectorTypes={}));lt.Selectors=Object.assign(Object.assign({},Ne.Selectors),{From:(0,Ne.createSelector)({type:Ne.TokenType.Identifier,value:"from"}),Envar:(0,Ne.createSelector)({type:Ne.TokenType.Keyword,value:Xl.GreybelKeyword.Envar}),Inject:(0,Ne.createSelector)({type:Ne.TokenType.Keyword,value:Xl.GreybelKeyword.Inject}),Line:(0,Ne.createSelector)({type:Ne.TokenType.Keyword,value:Xl.GreybelKeyword.Line}),File:(0,Ne.createSelector)({type:Ne.TokenType.Keyword,value:Xl.GreybelKeyword.File}),LeftShift:(0,Ne.createSelector)({type:Ne.TokenType.Punctuator,value:qa.Operator.LeftShift}),RightShift:(0,Ne.createSelector)({type:Ne.TokenType.Punctuator,value:qa.Operator.RightShift}),UnsignedRightShift:(0,Ne.createSelector)({type:Ne.TokenType.Punctuator,value:qa.Operator.UnsignedRightShift}),BitwiseOr:(0,Ne.createSelector)({type:Ne.TokenType.Punctuator,value:qa.Operator.BitwiseOr}),BitwiseAnd:(0,Ne.createSelector)({type:Ne.TokenType.Punctuator,value:qa.Operator.BitwiseAnd}),Escape:(0,Ne.createSelector)({type:Ne.TokenType.Punctuator,value:Ne.Operator.Escape})});var jr;(function(t){t.MapSeparator="MapSeparator",t.ListSeparator="ListSeparator",t.PathSegmentEnd="PathSegmentEnd",t.BitwiseOperators="BitwiseOperators"})(jr=lt.SelectorGroupType||(lt.SelectorGroupType={}));lt.SelectorGroups=Object.assign(Object.assign({},Ne.SelectorGroups),{[jr.MapSeparator]:(0,Ne.createSelectorGroup)(jr.MapSeparator,[lt.Selectors.MapSeperator,lt.Selectors.CRBracket]),[jr.ListSeparator]:(0,Ne.createSelectorGroup)(jr.ListSeparator,[lt.Selectors.MapSeperator,lt.Selectors.SRBracket]),[jr.PathSegmentEnd]:(0,Ne.createSelectorGroup)(jr.PathSegmentEnd,[lt.Selectors.EndOfLine,lt.Selectors.Comment,lt.Selectors.EndOfFile]),[jr.BitwiseOperators]:(0,Ne.createSelectorGroup)(jr.BitwiseOperators,[lt.Selectors.LeftShift,lt.Selectors.RightShift,lt.Selectors.UnsignedRightShift])})});var AA=m(ja=>{"use strict";var rM=ja&&ja.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ja,"__esModule",{value:!0});var dn=je(),iM=zo(),wA=Zo(),sM=rM(ty()),oM=fy(),ns=oo(),EA=ao(),Ie=py(),hy=class extends dn.Parser{constructor(e,n={}){var r;n.lexer=n.lexer||new sM.default(e,{unsafe:n.unsafe,tabWidth:n.tabWidth}),n.astProvider=n.astProvider||new oM.ASTProvider,super(e,n);let i=this;i.filename=(r=n.filename)!==null&&r!==void 0?r:"unknown",i.imports=[],i.includes=[],i.injects=[]}skipNewlines(){let e=this,n=0;for(;;){if(Ie.Selectors.Comment(e.token)){let r=e.astProvider.comment({value:e.token.value,isMultiline:e.token.value.indexOf(`
|
108
108
|
`)!==-1,start:e.token.start,end:e.token.end,scope:e.currentScope});e.addItemToLines(r),e.backpatches.peek().body.push(r)}else if(Ie.Selectors.EndOfLine(e.token))n++;else break;e.next()}return n}parseMap(e=!1,n=!1){let r=this;if(!Ie.Selectors.CLBracket(r.token))return r.parseList(e,n);let i=r.currentScope,s=r.token.start,o=[],a=r.astProvider.mapConstructorExpression({fields:o,start:s,end:null,scope:i});if(r.next(),Ie.Selectors.CRBracket(r.token))r.next();else for(;!Ie.Selectors.EndOfFile(r.token);){if(r.skipNewlines(),Ie.Selectors.CRBracket(r.token)){r.next();break}let u=r.astProvider.mapKeyString({key:null,value:null,start:r.token.start,end:null,scope:i});if(u.key=r.parseExpr(null),r.requireToken(Ie.Selectors.MapKeyValueSeperator),r.skipNewlines(),r.currentAssignment){let l=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:u.key,base:r.currentAssignment.variable,start:u.start,end:r.token.end,scope:i}),init:null,start:u.start,end:null}),d=r.currentAssignment;r.currentAssignment=l,u.value=r.parseExpr(u),r.currentAssignment=d,l.init=u.value,l.end=r.previousToken.end,i.assignments.push(l)}else u.value=r.parseExpr(u);u.end=r.previousToken.end,o.push(u),r.skipNewlines();let c=r.requireTokenOfAny(Ie.SelectorGroups.MapSeparator,s);if(Ie.Selectors.CRBracket(c))break}return a.end=r.token.start,a}parseList(e=!1,n=!1){let r=this;if(!Ie.Selectors.SLBracket(r.token))return r.parseQuantity(e,n);let i=r.currentScope,s=r.token.start,o=[],a=r.astProvider.listConstructorExpression({fields:o,start:s,end:null,scope:i});if(r.next(),Ie.Selectors.SRBracket(r.token))r.next();else for(;!Ie.Selectors.EndOfFile(r.token);){if(r.skipNewlines(),Ie.Selectors.SRBracket(r.token)){r.next();break}let u=r.astProvider.listValue({value:null,start:r.token.start,end:null,scope:i});if(r.currentAssignment){let l=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:r.astProvider.literal(dn.TokenType.NumericLiteral,{value:o.length,raw:`${o.length}`,start:s,end:r.token.end,scope:i}),base:r.currentAssignment.variable,start:null,end:null,scope:i}),init:null,start:null,end:null}),d=r.currentAssignment,p=r.token;r.currentAssignment=d,u.value=r.parseExpr(u),r.currentAssignment=d,l.variable.start=p.start,l.variable.end=r.previousToken.end,l.init=u.value,l.start=u.start,l.end=r.previousToken.end,i.assignments.push(l)}else u.value=r.parseExpr(u);u.end=r.previousToken.end,o.push(u),r.skipNewlines();let c=r.requireTokenOfAny(Ie.SelectorGroups.ListSeparator,s);if(Ie.Selectors.SRBracket(c))break}return a.end=r.token.start,a}parsePathSegment(){let e=this;if(this.token.type===dn.ASTType.StringLiteral){let r=this.token.value;return this.next(),r}let n="";for(;!Ie.SelectorGroups.PathSegmentEnd(e.token);)n=n+e.token.value,e.next();return e.consumeMany(Ie.SelectorGroups.PathSegmentEnd),n}parseFeatureIncludeStatement(){let e=this,n=e.previousToken.start,r=e.parsePathSegment(),i=e.astProvider.featureIncludeExpression({path:r,start:n,end:e.previousToken.end,scope:e.currentScope});return e.includes.push(i),i}parseFeatureImportStatement(){var e;let n=this,r=n.previousToken.start,i=n.parseIdentifier();if(!n.consume(Ie.Selectors.From))return n.raise("expected from keyword",new wA.Range(r,new iM.Position((e=n.token.lastLine)!==null&&e!==void 0?e:n.token.line,n.token.end.character))),n.parseInvalidCode();let s=n.parsePathSegment(),o=n.astProvider.featureImportExpression({name:i,path:s,start:r,end:n.previousToken.end,scope:n.currentScope});n.imports.push(o);let a=n.astProvider.assignmentStatement({variable:i,init:n.astProvider.literal(dn.TokenType.NilLiteral,{value:null,raw:"null",start:i.start,end:i.end,scope:n.currentScope}),start:i.start,end:i.end,scope:n.currentScope});return n.currentScope.assignments.push(a),o}parseFeatureEnvarExpression(){let e=this,n=e.previousToken.start,r=e.token.value;return e.next(),e.astProvider.featureEnvarExpression({name:r,start:n,end:e.previousToken.end,scope:e.currentScope})}parseFeatureInjectExpression(){let e=this,n=e.previousToken.start,r=this.parsePathSegment();e.next();let i=e.astProvider.featureInjectExpression({path:r,start:n,end:e.previousToken.end,scope:e.currentScope});return e.injects.push(i),i}parseIsa(e=!1,n=!1){let r=this,i=r.token.start,s=r.parseBitwiseOr(e,n);if(Ie.Selectors.Isa(r.token)){r.next(),r.skipNewlines();let o=r.parseBitwiseOr();return r.astProvider.isaExpression({operator:dn.Operator.Isa,left:s,right:o,start:i,end:r.previousToken.end,scope:r.currentScope})}return s}parseBitwiseOr(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseBitwiseAnd(e,n);for(;Ie.Selectors.BitwiseOr(r.token);){r.next();let a=r.parseBitwiseAnd();o=r.astProvider.binaryExpression({operator:EA.Operator.BitwiseOr,left:o,right:a,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseBitwiseAnd(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseComparisons(e,n);for(;Ie.Selectors.BitwiseAnd(r.token);){r.next();let a=r.parseComparisons();o=r.astProvider.binaryExpression({operator:EA.Operator.BitwiseAnd,left:o,right:a,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseAddSub(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseBitwise(e,n);for(;Ie.Selectors.Plus(r.token)||Ie.Selectors.Minus(r.token)&&(!n||!r.token.afterSpace||r.lexer.isAtWhitespace());){let a=r.token;r.next(),r.skipNewlines();let u=r.parseBitwise();o=r.astProvider.binaryExpression({operator:a.value,left:o,right:u,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseBitwise(e=!1,n=!1){let r=this,i=r.token.start,o=r.parseMultDiv(e,n);for(;Ie.SelectorGroups.BitwiseOperators(r.token);){let a=r.token;r.next(),r.skipNewlines();let u=r.parseMultDiv();o=r.astProvider.binaryExpression({operator:a.value,left:o,right:u,start:i,end:r.previousToken.end,scope:r.currentScope})}return o}parseAtom(){let e=this;return Ie.Selectors.Envar(e.token)?(e.next(),e.parseFeatureEnvarExpression()):Ie.Selectors.Inject(e.token)?(e.next(),e.parseFeatureInjectExpression()):Ie.Selectors.Line(e.token)?(e.next(),e.astProvider.featureLineExpression({start:new dn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new dn.ASTPosition(e.previousToken.line,e.previousToken.end.character),scope:e.currentScope})):Ie.Selectors.File(e.token)?(e.next(),e.astProvider.featureFileExpression({filename:e.filename,start:new dn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new dn.ASTPosition(e.previousToken.line,e.previousToken.end.character),scope:e.currentScope})):super.parseAtom()}parseStatement(){let e=this,n=e.backpatches.peek();if(e.isType(dn.TokenType.Keyword))switch(e.token.value){case ns.GreybelKeyword.Include:case ns.GreybelKeyword.IncludeWithComment:{e.next();let i=e.parseFeatureIncludeStatement();e.addItemToLines(i),n.body.push(i);return}case ns.GreybelKeyword.Import:case ns.GreybelKeyword.ImportWithComment:{e.next();let i=e.parseFeatureImportStatement();e.addItemToLines(i),n.body.push(i);return}case ns.GreybelKeyword.Envar:{e.next();let i=e.parseFeatureEnvarExpression();e.addItemToLines(i),n.body.push(i);return}case ns.GreybelKeyword.Inject:{e.next();let i=e.parseFeatureInjectExpression();e.addItemToLines(i),n.body.push(i);return}case ns.GreybelKeyword.Debugger:{e.next();let i=e.astProvider.featureDebuggerExpression({start:new dn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new dn.ASTPosition(e.previousToken.line,e.previousToken.end.character),scope:e.currentScope});e.addItemToLines(i),n.body.push(i);return}default:break}super.parseStatement()}parseChunk(){let e=this;e.next();let n=e.token.start,r=e.astProvider.chunkAdvanced({start:n,end:null}),i=new dn.PendingChunk(r);for(e.backpatches.setDefault(i),e.pushScope(r);!Ie.Selectors.EndOfFile(e.token)&&(e.skipNewlines(),!Ie.Selectors.EndOfFile(e.token));)e.lexer.recordSnapshot(),e.statementErrors=[],e.parseStatement(),e.statementErrors.length>0&&e.tryToRecover();let s=e.backpatches.pop();for(;!(0,dn.isPendingChunk)(s);){let o=e.raise(`found open block ${s.block.type}`,new wA.Range(s.block.start,s.block.start));if(s.complete(e.previousToken),e.errors.push(o),!e.unsafe)throw o;s=e.backpatches.pop()}return e.finishRemaingScopes(),e.popScope(),i.complete(e.token),r.literals=e.literals,r.scopes=e.scopes,r.lines=e.lines,r.imports=e.imports,r.includes=e.includes,r.injects=e.injects,r}};ja.default=hy});var Fr=m(xt=>{"use strict";var aM=xt&&xt.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Fa=xt&&xt.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&aM(e,t,n)},my=xt&&xt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xt,"__esModule",{value:!0});xt.Parser=xt.LexerValidator=xt.Lexer=void 0;var uM=ty();Object.defineProperty(xt,"Lexer",{enumerable:!0,get:function(){return my(uM).default}});var cM=Qg();Object.defineProperty(xt,"LexerValidator",{enumerable:!0,get:function(){return my(cM).default}});var lM=AA();Object.defineProperty(xt,"Parser",{enumerable:!0,get:function(){return my(lM).default}});Fa(fy(),xt);Fa(Zg(),xt);Fa(oo(),xt);Fa(ao(),xt);Fa(py(),xt)});var yy=m(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.Aggregator=void 0;var Yl=Fr(),Re=$n(),Fe=je(),dM=Bg(),Te=Qi(),rs=Ug(),xA=Dm(),fM=Lg(),kA=Ng(),CA=aa(),pM=so(),gy=class{get definitions(){return this._definitions}get parent(){return this._parent}constructor(e){this._root=e.root,this._scope=e.scope,this._document=e.document,this._parent=e.parent??null,this._definitions=new Map}factory(e){return new pM.Entity({kind:e,container:this._document.container})}createFunctionDescription(e,n=dM.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION){let r=this._document.getLastASTItemOfLine(e.start.line-1),i=this._document.findASTItemInLine(e.start.line,Fe.ASTType.Comment);if(r instanceof Fe.ASTComment){let s=new Set,o=[],a=e.start.line-1;for(;a>=0;){let u=this._document.getLastASTItemOfLine(a--);if(!s.has(u))if(u instanceof Fe.ASTComment)s.add(u),o.unshift(u.value);else break}return o.join(`
|
109
109
|
|
110
|
-
`)}else if(i instanceof Fe.ASTComment)return i.value;return n}resolveFunctionStatement(e){let n=Re.SignatureDefinitionFunction.parse({type:Re.SignatureDefinitionBaseType.Function,description:this.createFunctionDescription(e),arguments:e.parameters.map(r=>{if(r.type===Fe.ASTType.Identifier)return{label:r.name??"unknown",type:Re.SignatureDefinitionBaseType.Any};let i=r;return{label:i.variable?.name??"unknown",types:Array.from(this.resolveTypeWithDefault(i.init).types)}}),returns:["any"]});return this.factory(Te.CompletionItemKind.Function).addType(Re.SignatureDefinitionBaseType.Function).addSignatureType((0,fM.enrichWithMetaInformation)(n)).setLine(e.start.line)}resolveParenthesisExpression(e){return this.resolveTypeWithDefault(e.expression)}resolveBinaryExpression(e){let n=this.factory(Te.CompletionItemKind.Expression).setLabel("Binary Expr").setLine(e.start.line),r=this.resolveTypeWithDefault(e.left),i=this.resolveTypeWithDefault(e.right);return n.extend(r),n.extend(i),n}resolveLogicalExpression(e){return this.factory(Te.CompletionItemKind.Expression).setLabel("Logical Expr").addType(Re.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveComparisonGroupExpression(e){return this.factory(Te.CompletionItemKind.Expression).setLabel("Comparison Group Expr").addType(Re.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveIsaExpression(e){return this.factory(Te.CompletionItemKind.Expression).setLabel("Isa Expr").addType(Re.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveCallStatement(e){let n=this.resolveNamespace(e);return n===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveCallExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveUnaryExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveMapConstructorExpression(e){let n=this.factory(Te.CompletionItemKind.MapConstructor).addType(Re.SignatureDefinitionBaseType.Map);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.resolveTypeWithDefault(i.value).setLine(i.start.line);if(i.key.type===Fe.ASTType.StringLiteral)n.setProperty(i.key.value.toString(),s);else{let o=this.resolveTypeWithDefault(i.key).setLine(i.start.line);n.setProperty(o,s)}}return n.setLabel("{}").setLine(e.start.line)}resolveListConstructorExpression(e){let n=this.factory(Te.CompletionItemKind.ListConstructor).addType(Re.SignatureDefinitionBaseType.List);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Number).setLine(i.start.line),o=this.resolveTypeWithDefault(i.value).setLine(i.start.line);n.setProperty(s,o)}return n.setLabel("[]").setLine(e.start.line)}resolveSliceExpression(e){let n=this.resolveNamespace(e).setLine(e.start.line);return n===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveIndexExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):r}resolveMemberExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(Te.CompletionItemKind.Property).addType(Re.SignatureDefinitionBaseType.Any).setLabel(e.identifier.name).setLine(e.start.line):r}resolveIdentifier(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(Te.CompletionItemKind.Property).addType(Re.SignatureDefinitionBaseType.Any).setLabel(e.name).setLine(e.start.line):r}resolveType(e,n=!1){if(e==null)return null;switch(e.type){case Fe.ASTType.ParenthesisExpression:return this.resolveParenthesisExpression(e);case Fe.ASTType.CallStatement:return this.resolveCallStatement(e);case Fe.ASTType.CallExpression:return this.resolveCallExpression(e);case Fe.ASTType.BinaryExpression:return this.resolveBinaryExpression(e);case Fe.ASTType.LogicalExpression:return this.resolveLogicalExpression(e);case Fe.ASTType.IsaExpression:return this.resolveIsaExpression(e);case Fe.ASTType.ComparisonGroupExpression:return this.resolveComparisonGroupExpression(e);case Fe.ASTType.FunctionDeclaration:return this.resolveFunctionStatement(e);case Fe.ASTType.SliceExpression:return this.resolveSliceExpression(e);case Fe.ASTType.IndexExpression:return this.resolveIndexExpression(e,n);case Fe.ASTType.MemberExpression:return this.resolveMemberExpression(e,n);case Fe.ASTType.Identifier:return this.resolveIdentifier(e,n);case Fe.ASTType.MapConstructorExpression:return this.resolveMapConstructorExpression(e);case Fe.ASTType.ListConstructorExpression:return this.resolveListConstructorExpression(e);case Fe.ASTType.NegationExpression:case Fe.ASTType.BinaryNegatedExpression:case Fe.ASTType.UnaryExpression:return this.resolveUnaryExpression(e);case Fe.ASTType.NilLiteral:return this.factory(Te.CompletionItemKind.Literal).addType("null").setLabel("null").setLine(e.start.line);case Fe.ASTType.StringLiteral:{let r=e.value.toString();return this.factory(Te.CompletionItemKind.Literal).addType(Re.SignatureDefinitionBaseType.String).setLabel(`"${r.length>20?r.substr(0,20)+"...":r}"`).setLine(e.start.line)}case Fe.ASTType.NumericLiteral:case Fe.ASTType.BooleanLiteral:{let r=e.value.toString();return this.factory(Te.CompletionItemKind.Literal).addType(Re.SignatureDefinitionBaseType.Number).setLabel(r).setLine(e.start.line)}case Yl.ASTType.FeatureFileExpression:return this.factory(Te.CompletionItemKind.Expression).addType(Re.SignatureDefinitionBaseType.String).setLabel("File Expr").setLine(e.start.line);case Yl.ASTType.FeatureLineExpression:return this.factory(Te.CompletionItemKind.Expression).addType(Re.SignatureDefinitionBaseType.Number).setLabel("Line Expr").setLine(e.start.line);case Yl.ASTType.FeatureEnvarExpression:return this.factory(Te.CompletionItemKind.Expression).addType(Re.SignatureDefinitionBaseType.String).setLabel("Envar Expr").setLine(e.start.line);case Yl.ASTType.FeatureInjectExpression:return this.factory(Te.CompletionItemKind.Expression).addType(Re.SignatureDefinitionBaseType.String).setLabel("Inject Expr").setLine(e.start.line);default:return null}}resolveTypeWithDefault(e,n=!1){return this.resolveType(e,n)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line)}resolveChain(e,n=!1){if(e.length===0)return null;let r=null,i=e[0],s=i.unary?.operator==="@"&&!i.isInCallExpression||n&&e.length===1;if((0,rs.isResolveChainItemWithIdentifier)(i))if(i.getter.name==="globals")r=this._scope.globals;else if(i.getter.name==="outer")r=this._scope.outer;else if(i.getter.name==="locals")r=this._scope.locals;else if(i.getter.name==="super"){let a=this._document.getScopeContext(i.ref.scope)?.scope.context?.values.get("i:__isa");a==null?r=this.factory(Te.CompletionItemKind.Constant).addType("null").setLabel("super"):r=a.copy({kind:Te.CompletionItemKind.Constant,label:"super",values:a.values})}else if(i.getter.name==="self"){let a=this._document.getScopeContext(i.ref.scope)?.scope.context;a==null?r=this.factory(Te.CompletionItemKind.Constant).addType("null").setLabel("self"):r=a.copy({kind:Te.CompletionItemKind.Constant,label:"self",values:a.values})}else r=this._scope.resolveNamespace(i.getter.name,s)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLabel(i.getter.name);else if((0,rs.isResolveChainItemWithValue)(i))r=this.resolveTypeWithDefault(i.value,s);else return null;if(i.unary?.operator==="new"&&r!==null){let a=this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Map).setLabel(r.label);a.setProperty("__isa",r),r=a}let o=e.length;for(let a=1;a<o&&r!==null;a++){let u=e[a],c=u.unary?.operator==="@"&&!u.isInCallExpression||n&&e.length-1===a;if((0,rs.isResolveChainItemWithMember)(u))r=r.resolveProperty(u.getter.name,c)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLabel(u.getter.name);else if((0,rs.isResolveChainItemWithIndex)(u))if((0,CA.isValidIdentifierLiteral)(u.getter)){let l=u.getter.value.toString();r=r.resolveProperty(l,u.isInCallExpression)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLabel(l)}else{let l=this.resolveTypeWithDefault(u.getter);r=r.resolveProperty(l,u.isInCallExpression)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any)}else if(u.ref.type===Fe.ASTType.SliceExpression)r=r.copy();else return null;if(u.unary?.operator==="new"&&r!==null){let l=this.factory(Te.CompletionItemKind.Property).addType(Re.SignatureDefinitionBaseType.Map).setLabel(r.label);l.setProperty("__isa",r),r=l}}return r}resolveNamespace(e,n=!1){let r=(0,kA.createResolveChain)(e);return this.resolveChain(r,n)}defineNamespace(e,n){let r=(0,kA.createResolveChain)(e),i=r.pop();if(r.length>0){let o=this.resolveChain(r);if(o===null)return!1;if((0,rs.isResolveChainItemWithMember)(i))return o.setProperty(i.getter.name,n);if((0,rs.isResolveChainItemWithIndex)(i)){if((0,CA.isValidIdentifierLiteral)(i.getter))return o.setProperty(i.getter.value.toString(),n);{let a=this.resolveTypeWithDefault(i.getter);return o.setProperty(a,n)}}return!1}let s=this._scope;return(0,rs.isResolveChainItemWithIdentifier)(i)?s.setProperty(i.getter.name,n):!1}resolveAvailableAssignmentsWithQuery(e){let n=[],r=new Set([this,this._parent,this._document.getRootScopeContext().aggregator]);for(let i of r){let s=i.definitions;for(let o of s.keys())if(o.includes(e)){let a=s.get(o);n.push(...a)}}return n}resolveAvailableAssignments(e){let n=(0,xA.createExpressionId)(e),r=this;n.startsWith("globals.")?(r=this._document.getRootScopeContext().aggregator,n=n.slice(8)):n.startsWith("locals.")?(r=this,n=n.slice(7)):n.startsWith("outer.")&&(r=this.parent,n=n.slice(6));let i=[],s=new Set([r,r._parent,r._document.getRootScopeContext().aggregator]);for(let o of s){if(o==null)continue;let a=o._definitions.get(n);a!=null&&i.push(...a)}return i}analyze(){for(let e=0;e<this._root.assignments.length;e++){let n=this._root.assignments[e],r=this.resolveType(n.init)?.copy().setLine(n.start.line)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(n.start.line);this.defineNamespace(n.variable,r);let i=(0,xA.createExpressionId)(n.variable),s=this._definitions;i.startsWith("globals.")?(s=this._document.getRootScopeContext().aggregator.definitions,i=i.slice(8)):i.startsWith("locals.")?(s=this._definitions,i=i.slice(7)):i.startsWith("outer.")&&(s=this.parent.definitions,i=i.slice(6));let o=s.get(i);o?o.push(n):s.set(i,[n])}}};Jl.Aggregator=gy});var _y=m(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.Document=void 0;var $r=$n(),hM=je(),OA=Qi(),RA=yy(),DA=so(),IA=Xg(),by=class t{get root(){return this._root}get container(){return this._container}get intrinsics(){return this._intrinscis}get globals(){return this._globals}get api(){return this._api}constructor(e){this._root=e.root,this._container=e.container,this._scopeMapping=e.scopeMapping??new WeakMap,this._intrinscis=e.intrinsics??this.createIntrinscis(),this._api=e.api??this.initApi(),this._globals=e.globals??this.initGlobals()}createIntrinscis(){return{map:this._container.primitives.get($r.SignatureDefinitionBaseType.Map),funcRef:this._container.primitives.get($r.SignatureDefinitionBaseType.Function),number:this._container.primitives.get($r.SignatureDefinitionBaseType.Number),string:this._container.primitives.get($r.SignatureDefinitionBaseType.String),list:this._container.primitives.get($r.SignatureDefinitionBaseType.List)}}initApi(){let e=this._container.primitives.get($r.SignatureDefinitionBaseType.General);return e.resolveProperty("map",!0).setReturnEntity(this._intrinscis.map),e.resolveProperty("funcRef",!0).setReturnEntity(this._intrinscis.funcRef),e.resolveProperty("number",!0).setReturnEntity(this._intrinscis.number),e.resolveProperty("string",!0).setReturnEntity(this._intrinscis.string),e.resolveProperty("list",!0).setReturnEntity(this._intrinscis.list),e}initGlobals(){return new DA.Entity({kind:OA.CompletionItemKind.Constant,container:this._container,label:"globals"}).addType($r.SignatureDefinitionBaseType.Map)}analyzeScope(e){let n=this._scopeMapping.get(e.scope),r=new IA.Scope({container:this._container,parent:n?.scope,globals:this._globals}),i=new RA.Aggregator({scope:r,root:e,document:this,parent:n?.aggregator});this._scopeMapping.set(e,{scope:r,aggregator:i});let s=e.assignment instanceof hM.ASTAssignmentStatement?this.resolveNamespace(e.assignment.variable,!0):null;if(s!==null){let o=s?.context;o!=null&&o.types.has($r.SignatureDefinitionBaseType.Map)&&o!==this._globals&&r.setContext(o)}if(i.analyze(),s!==null){let o=s.signatureDefinitions.last();if(o!=null){let a=o.getArguments();for(let u=0;u<a.length;u++){let c=a[u],l=r.resolveProperty(c.getLabel(),!0),d=c.getTypes().map(p=>p.type);l===null?r.setProperty(c.getLabel(),new DA.Entity({kind:OA.CompletionItemKind.Variable,container:this._container}).addType(...d)):(l.types.delete($r.SignatureDefinitionBaseType.Any),l.addType(...d))}}}}analyze(){let e=new IA.Scope({container:this._container,globals:this._globals,locals:this._globals}),n=new RA.Aggregator({scope:e,root:this._root,document:this});this._scopeMapping.set(this._root,{scope:e,aggregator:n}),n.analyze();for(let r=0;r<this._root.scopes.length;r++){let i=this._root.scopes[r];this.analyzeScope(i)}}getRootScopeContext(){return this._scopeMapping.get(this._root)}getAllScopeContexts(){return[this._root,...this._root.scopes].map(e=>this._scopeMapping.get(e))}getScopeContext(e){return this._scopeMapping.get(e)??null}getLastASTItemOfLine(e){let n=this._root.lines[e];return n&&n.length>0?n[n.length-1]:null}findASTItemInLine(e,n){let r=this._root.lines[e];if(r&&r.length>0){let i=r.find(s=>s.type===n);if(i)return i}return null}resolveAllAssignmentsWithQuery(e){let n=[],r=[this._root,...this._root.scopes];for(let i=0;i<r.length;i++){let o=this._scopeMapping.get(r[i]).aggregator.definitions;for(let a of o.keys())if(a.includes(e)){let u=o.get(a);n.push(...u)}}return n}resolveAvailableAssignments(e){return this._scopeMapping.get(e.scope)?.aggregator.resolveAvailableAssignments(e)??[]}resolveType(e,n){return this._scopeMapping.get(e.scope)?.aggregator.resolveType(e,n)??null}resolveTypeWithDefault(e,n){return this._scopeMapping.get(e.scope)?.aggregator.resolveTypeWithDefault(e,n)}resolveNamespace(e,n=!1){return this._scopeMapping.get(e.scope)?.aggregator.resolveNamespace(e,n)??null}merge(...e){let n=new t({root:this._root,container:this._container.copy()});for(let r of e)n._globals.extend(r._globals.copy({line:-1})),n._intrinscis.map.extend(r._intrinscis.map.copy({line:-1})),n._intrinscis.funcRef.extend(r._intrinscis.funcRef.copy({line:-1})),n._intrinscis.number.extend(r._intrinscis.number.copy({line:-1})),n._intrinscis.string.extend(r._intrinscis.string.copy({line:-1})),n._intrinscis.list.extend(r._intrinscis.list.copy({line:-1}));return n.analyze(),n}};Ql.Document=by});var Ty=m(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});Zl.ContainerProxy=void 0;var Tr=$n(),Si=so(),PA=Qi(),MA=ka(),vy=Bl(),Sy=class t{get primitives(){return this._primitives}get types(){return this._types}constructor(e){this._container=e.container,this._primitives=e.primitives??this.createPrimitives(),this._types=e.types??this.createTypes()}createPrimitives(){let e=new Map;for(let[n,r]of this._container.getPrimitives()){let i=new Si.Entity({kind:PA.CompletionItemKind.Constant,container:this,isAPI:n===Tr.SignatureDefinitionBaseType.General}).addType(Tr.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}createTypes(){let e=new Map;for(let[n,r]of this._container.getTypes()){let i=new Si.Entity({kind:PA.CompletionItemKind.Constant,container:this}).addType(Tr.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}getTypeSignature(e){return this._primitives.get(e)??this._types.get(e)??null}searchDefinitionMatches(e,n){if(typeof e=="string")return this.searchDefinitionMatches([e],n);let r=e.includes(Tr.SignatureDefinitionBaseType.Any)?new Set(this._container.getAllVisibleTypes()):new Set(e),i=new Map;for(let s of r){let o=this.getTypeSignature(s);if(o===null)continue;let a=(0,vy.lookupProperty)(o,n);a!==null&&i.set(s,a)}return i}getDefinition(e,n,r=!1){if(typeof e=="string")return this.getDefinition([e],n);let i=(0,vy.lookupProperty)(this._primitives.get(Tr.SignatureDefinitionBaseType.Any),n);if(e.includes(Tr.SignatureDefinitionBaseType.Any)&&i)return(0,Si.resolveEntity)(this,i,r);let s=this.searchDefinitionMatches(e,n);return s.size===0?null:s.size===1?(0,Si.resolveEntity)(this,s.values().next().value,r):s.has(Tr.SignatureDefinitionBaseType.Any)?(0,Si.resolveEntity)(this,s.get(Tr.SignatureDefinitionBaseType.Any),r):i!==null?(0,Si.resolveEntity)(this,i,r):(0,Si.resolveEntity)(this,s.values().next().value,r)}getGeneralDefinition(e,n=!1){let r=(0,vy.lookupProperty)(this._primitives.get(Tr.SignatureDefinitionBaseType.General),e);return r==null?null:(0,Si.resolveEntity)(this,r,n)}getAllIdentifier(e){let n=new Map;if(e===Tr.SignatureDefinitionBaseType.Any){for(let i of this._container.getAllVisibleTypes()){let s=this.getTypeSignature(i);s!=null&&(0,MA.injectIdentifers)(n,s)}return n}let r=this.getTypeSignature(e);return r!=null&&(0,MA.injectIdentifers)(n,r),n}copy(){return new t({container:this._container})}};Zl.ContainerProxy=Sy});var LA=m(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.TypeManager=void 0;var mM=_y(),gM=Ty(),wy=class{constructor(e){this._container=new gM.ContainerProxy({container:e.container}),this._types=new Map}analyze(e,n){let r=new mM.Document({container:this._container.copy(),root:n});try{r.analyze()}catch(i){console.error(i)}return this._types.set(e,r),r}get(e){return this._types.get(e)??null}};ed.TypeManager=wy});var $a=m(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.TypeManager=ne.ContainerProxy=ne.Document=ne.Aggregator=ne.Scope=ne.Entity=ne.lookupProperty=ne.isEligibleForProperties=ne.injectIdentifers=ne.isSignatureDefinitionFunction=ne.isResolveChainItemWithValue=ne.isResolveChainItemWithMember=ne.isResolveChainItemWithIndex=ne.isResolveChainItemWithIdentifier=ne.CompletionItemKind=ne.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=ne.ObjectSetIterator=ne.ObjectSet=ne.rotateBits=ne.getStringHashCode=ne.getHashCode=ne.createResolveChain=ne.enrichWithMetaInformation=ne.createExpressionId=ne.createExpressionHash=ne.isValidIdentifierLiteral=void 0;var yM=aa();Object.defineProperty(ne,"isValidIdentifierLiteral",{enumerable:!0,get:function(){return yM.isValidIdentifierLiteral}});var bM=Fw();Object.defineProperty(ne,"createExpressionHash",{enumerable:!0,get:function(){return bM.createExpressionHash}});var _M=Dm();Object.defineProperty(ne,"createExpressionId",{enumerable:!0,get:function(){return _M.createExpressionId}});var vM=Lg();Object.defineProperty(ne,"enrichWithMetaInformation",{enumerable:!0,get:function(){return vM.enrichWithMetaInformation}});var SM=Ng();Object.defineProperty(ne,"createResolveChain",{enumerable:!0,get:function(){return SM.createResolveChain}});var Ey=Rm();Object.defineProperty(ne,"getHashCode",{enumerable:!0,get:function(){return Ey.getHashCode}});Object.defineProperty(ne,"getStringHashCode",{enumerable:!0,get:function(){return Ey.getStringHashCode}});Object.defineProperty(ne,"rotateBits",{enumerable:!0,get:function(){return Ey.rotateBits}});var NA=$g();Object.defineProperty(ne,"ObjectSet",{enumerable:!0,get:function(){return NA.ObjectSet}});Object.defineProperty(ne,"ObjectSetIterator",{enumerable:!0,get:function(){return NA.ObjectSetIterator}});var TM=Bg();Object.defineProperty(ne,"DEFAULT_CUSTOM_FUNCTION_DESCRIPTION",{enumerable:!0,get:function(){return TM.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION}});var wM=Qi();Object.defineProperty(ne,"CompletionItemKind",{enumerable:!0,get:function(){return wM.CompletionItemKind}});var td=Ug();Object.defineProperty(ne,"isResolveChainItemWithIdentifier",{enumerable:!0,get:function(){return td.isResolveChainItemWithIdentifier}});Object.defineProperty(ne,"isResolveChainItemWithIndex",{enumerable:!0,get:function(){return td.isResolveChainItemWithIndex}});Object.defineProperty(ne,"isResolveChainItemWithMember",{enumerable:!0,get:function(){return td.isResolveChainItemWithMember}});Object.defineProperty(ne,"isResolveChainItemWithValue",{enumerable:!0,get:function(){return td.isResolveChainItemWithValue}});var EM=Hg();Object.defineProperty(ne,"isSignatureDefinitionFunction",{enumerable:!0,get:function(){return EM.isSignatureDefinitionFunction}});var AM=ka();Object.defineProperty(ne,"injectIdentifers",{enumerable:!0,get:function(){return AM.injectIdentifers}});var xM=Fl();Object.defineProperty(ne,"isEligibleForProperties",{enumerable:!0,get:function(){return xM.isEligibleForProperties}});var kM=Bl();Object.defineProperty(ne,"lookupProperty",{enumerable:!0,get:function(){return kM.lookupProperty}});var CM=so();Object.defineProperty(ne,"Entity",{enumerable:!0,get:function(){return CM.Entity}});var OM=Xg();Object.defineProperty(ne,"Scope",{enumerable:!0,get:function(){return OM.Scope}});var RM=yy();Object.defineProperty(ne,"Aggregator",{enumerable:!0,get:function(){return RM.Aggregator}});var DM=_y();Object.defineProperty(ne,"Document",{enumerable:!0,get:function(){return DM.Document}});var IM=Ty();Object.defineProperty(ne,"ContainerProxy",{enumerable:!0,get:function(){return IM.ContainerProxy}});var PM=LA();Object.defineProperty(ne,"TypeManager",{enumerable:!0,get:function(){return PM.TypeManager}})});var Ay=m(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.getSymbolItemKind=uo.getCompletionItemKind=void 0;var Vt=$a(),MM=t=>{switch(t){case Vt.CompletionItemKind.Constant:return 21;case Vt.CompletionItemKind.Variable:return 6;case Vt.CompletionItemKind.Expression:return 6;case Vt.CompletionItemKind.Function:return 3;case Vt.CompletionItemKind.ListConstructor:case Vt.CompletionItemKind.MapConstructor:case Vt.CompletionItemKind.Literal:case Vt.CompletionItemKind.Unknown:return 12}};uo.getCompletionItemKind=MM;var LM=t=>{switch(t){case Vt.CompletionItemKind.Constant:return 14;case Vt.CompletionItemKind.Variable:return 13;case Vt.CompletionItemKind.Expression:return 13;case Vt.CompletionItemKind.Function:return 12;case Vt.CompletionItemKind.ListConstructor:return 18;case Vt.CompletionItemKind.MapConstructor:return 19;case Vt.CompletionItemKind.Literal:case Vt.CompletionItemKind.Unknown:return 13}};uo.getSymbolItemKind=LM});var ky=m(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.findEx=void 0;var NM=je(),qM=function(t){return{ParenthesisExpression:(e,n)=>{t(e.expression,n)},AssignmentStatement:function(e,n){t(e.init,n),t(e.variable,n)},MemberExpression:function(e,n){t(e.base,n),t(e.identifier,n)},FunctionDeclaration:function(e,n){for(let r=0;r<e.parameters.length;r++)t(e.parameters[r],n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},MapConstructorExpression:function(e,n){for(let r=0;r<e.fields.length;r++)t(e.fields[r],n)},ReturnStatement:function(e,n){e.argument&&t(e.argument,n)},WhileStatement:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},IndexExpression:function(e,n){t(e.base,n),t(e.index,n)},SliceExpression:function(e,n){t(e.base,n),t(e.left,n),t(e.right,n)},ListValue:function(e,n){t(e.value,n)},MapKeyString:function(e,n){t(e.key,n),t(e.value,n)},IfShortcutStatement:function(e,n){for(let r=0;r<e.clauses.length;r++)t(e.clauses[r],n)},IfShortcutClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseifShortcutClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseShortcutClause:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ForGenericStatement:function(e,n){t(e.variable,n),t(e.iterator,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},IfStatement:function(e,n){for(let r=0;r<e.clauses.length;r++)t(e.clauses[r],n)},IfClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseifClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseClause:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},NegationExpression:function(e,n){t(e.argument,n)},CallExpression:function(e,n){t(e.base,n);for(let r=0;r<e.arguments.length;r++)t(e.arguments[r],n)},CallStatement:function(e,n){t(e.expression,n)},ListConstructorExpression:function(e,n){for(let r=0;r<e.fields.length;r++)t(e.fields[r],n)},BinaryExpression:function(e,n){t(e.left,n),t(e.right,n)},BinaryNegatedExpression:function(e,n){t(e.argument,n)},IsaExpression:function(e,n){t(e.left,n),t(e.right,n)},LogicalExpression:function(e,n){t(e.left,n),t(e.right,n)},ComparisonGroupExpression:function(e,n){for(let r=0;r<e.expressions.length;r++)t(e.expressions[r],n)},UnaryExpression:function(e,n){t(e.argument,n)},Chunk:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},InvalidCodeExpression:()=>{}}},xy=class{constructor(e){this.map=qM(this.visit.bind(this)),this.callback=e,this.state={exit:!1}}visit(e,n=0){let r=this;if(e==null)return;if(e.type==null)throw console.error("Error ast type:",e),new Error("Unexpected as type");if(r.state=r.callback(e,n),r.state.exit||r.state.skip)return;let i=r.map[e.type];i?.call(r,e,n+1)}};function jM(t,e){let n=[];return new xy((i,s)=>{let o=t(i,s)||{};return o.valid&&i.type!==NM.ASTType.InvalidCodeExpression&&n.push(i),{exit:!!o.exit,skip:!!o.skip}}).visit(e),n}nd.findEx=jM});var qA=m((g5,FM)=>{FM.exports={insert:{description:"Depending on the data type this method will insert a value to the provided index. Due to the insertion, the object will be mutated. To get a better idea about the behaviour look into the `insert` method related to `list` or `string`.",example:["list = [2, 3, 4]","list.insert(2, 42)",'print("List with inserted item: " + list.join(", "))']},indexOf:{description:"Depending on the data type this function searches for the index of the provided value. To get a better idea about the behaviour look into the `indexOf` methods related to `string`, `list` and `map`.",example:['index = "test".indexOf("e")','print("e is at: " + index)']},hasIndex:{description:"Depending on data type this function checks if the provided index is available inside the value. To get a better idea about the behaviour look into the `hasIndex` methods related to `string`, `list` and `map`.",example:['print("List has index: " + [1, 2, 3].hasIndex(2)']},remove:{description:"Depending on the data type this function will remove a value in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `remove` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","list.remove(5)",'print("List after removal: " + list.join(", "))']},push:{description:"Depending on data type this function will append a value to the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `push` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","list.push(42)",'print("The answer to everything is: " + list.pop)']},pull:{description:"Depending on data type this function will return the first item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["myList = [42, 1, 3]","answer = myList.pull",'print("Answer to everything: " + answer)']},pop:{description:"Depending on data type this function will return the last item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The last item is: " + list.pop)']},shuffle:{description:"Depending on data type this function will shuffle data. Instead of returning the newly shuffled data, this function will mutate the data. To get a better idea about the behaviour look into the `shuffle` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","list.shuffle",'print("And the winner is: " + list[0])']},sum:{description:"Depending on data type this function returns the sum of all items. To get a better idea about the behaviour look into the `sum` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("Sum of all items is: " + list.sum)']},indexes:{description:"Depending on data type this function returns a `list` with all available indexes. To get a better idea about the behaviour look into the `indexes` methods related to `string`, `list` and `map`.",example:['indexesOfStr = "test".indexes','print("Following indexes are available: " + indexesOfStr.join(", "))']},len:{description:"Depending on data type this function returns the length of the provided value. To get a better idea about the behaviour look into the `len` methods related to `string`, `list` and `map`.",example:['length = "test".len','print("Length of string is: " + length)']},values:{description:"Depending on data type this function returns a `list` with all available values. To get a better idea about the behaviour look into the `values` methods related to `string`, `list` and `map`.",example:['indexesOfStr = "test".values','print("Following values are available: " + indexesOfStr.join(", "))']}}});var jA=m((y5,$M)=>{$M.exports={hasIndex:{description:"Depending on data type this function checks if the provided index is available inside the value. To get a better idea about the behaviour look into the `hasIndex` methods related to `string`, `list` and `map`.",example:['print("List has index: " + hasIndex([1, 2, 3], 2)']},print:{description:"Print a message on the Terminal.",example:['print("hello world")']},indexes:{description:"Depending on data type this function returns a `list` with all available indexes. To get a better idea about the behaviour look into the `indexes` methods related to `string`, `list` and `map`.",example:['indexesOfStr = indexes("test")','print("Following indexes are available: " + indexesOfStr.join(", "))']},values:{description:"Depending on data type this function returns a `list` with all available values. To get a better idea about the behaviour look into the `values` methods related to `string`, `list` and `map`.",example:['indexesOfStr = values("test")','print("Following values are available: " + indexesOfStr.join(", "))']},indexOf:{description:"Depending on the data type this function searches for the index of the provided value. To get a better idea about the behaviour look into the `indexOf` methods related to `string`, `list` and `map`.",example:['index = indexOf("test", "e")','print("e is at: " + index)']},len:{description:"Depending on data type this function returns the length of the provided value. To get a better idea about the behaviour look into the `len` methods related to `string`, `list` and `map`.",example:['length = len("test")','print("Length of string is: " + length)']},shuffle:{description:"Depending on data type this function will shuffle data. Instead of returning the newly shuffled data, this function will mutate the data. To get a better idea about the behaviour look into the `shuffle` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","shuffle(list)",'print("And the winner is: " + list[0])']},val:{description:"Casts a `string` to a `number`. In case the provided `string` does not represent a valid `number` the `number` zero will get returned.",example:['num = val("1.25")','print("Number in string is: " + num)']},lower:{description:"Returns a `string` which is the lowercase transformed version of the provided `string`.",example:['myString = lower("HELLO WORLD")',"print(myString)"]},upper:{description:"Returns a `string` which is the uppercase transformed version of the provided `string`.",example:['myString = upper("hello world")',"print(myString)"]},sum:{description:"Depending on data type this function returns the sum of all items. To get a better idea about the behaviour look into the `sum` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("Sum of all items is: " + sum(list))']},pop:{description:"Depending on data type this function will return the last item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The last item is: " + pop(list))']},pull:{description:"Depending on data type this function will return the first item in the provided value. Additionally, this function removes the first item and therefore mutates the object. To get a better idea about the behaviour look into the `pull` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The first item is: " + pull(list))']},push:{description:"Depending on data type this function will append a value to the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `push` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","push(list, 42)",'print("The answer to everything is: " + pop(list))']},sort:{description:"Depending on the data type this function will sort the values in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `sort` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","sort(list)",'print("Sorted list: " + list.join(", "))']},remove:{description:"Depending on the data type this function will remove a value in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `remove` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","remove(list, 5)",'print("List after removal: " + list.join(", "))']},wait:{description:"Puts script execution on hold. Optionally the duration can be provided via the time argument. By default, the duration will be 1 second. The duration cannot be below 0.01 or above 300.",example:["start = time","wait(5)","elapsed = time - start",'print("Waited: " + elapsed)']},bitwise:{description:'Enables to perform bitwise operations. Supported operators are: `"&"`, `"|"`, `"^"`, `"<<"`, `">>"`, `">>>"`. Returns a `number`.',example:["num = params[0].to_int",'isOdd = bitwise("&", num, 1) == 1',"if isOdd then",' print("Number is odd.")',"else",' print("Number is even.")',"end if"]},abs:{description:"Returns the absolute value of `number`.",example:["a = 1","b = 5","difference = abs(a - b)",'print("Difference between a and b is: " + difference)']},acos:{description:"Returns the inverse cosine (in radians) of a `number`.",example:["adjacent = 8","hypotenuse = 10","calcAngle = acos(adjacent / hypotenuse)",'print("Angle: " + calcAngle)']},asin:{description:"Returns the inverse sine (in radians) of a `number`.",example:["opposite = 6","hypotenuse = 10","calcAngle = acos(opposite / hypotenuse)",'print("Angle: " + calcAngle)']},atan:{description:"Returns the inverse tangent (in radians) of a `number`.",example:["opposite = 8","hypotenuse = 10","calcAngle = atan(opposite / hypotenuse)",'print("Angle: " + calcAngle)']},tan:{description:"Returns the tangent of a `number` in radians.",example:["degrees = 90","tanFromDegrees = tan(degress * pi / 180)",'print("Tan from degrees: " + tanFromDegrees)']},cos:{description:"Returns the cosine of a `number` in radians.",example:["radians = 1","radius = 10","circleX = cos(radians) * radius","print(circleX)"]},code:{description:"Returns the Unicode `number` of the first character of the string. In case an empty `string` is provided the script execution will crash.",example:['key = user_input("Press a key!", false, true)',"isA = key.code == 97","if isA then",' print("You pressed A.")',"else",' print("You did not press A.")',"end if"]},char:{description:"Returns the Unicode character `string` related to the provided unicode `number`. The provided `number` needs to be between 0 and 65535. Any `number` which is outside this range will cause the script to throw a runtime error.",example:['key = user_input("Press a key!", false, true)',"isA = key == char(97)","if isA then",' print("You pressed A.")',"else",' print("You did not press A.")',"end if"]},sin:{description:"Returns the sine of a `number` in radians.",example:["radians = 1","radius = 10","circleY = sin(radians) * radius","print(circleY)"]},floor:{description:"Returns `number` rounded down to the integer value of the provided `number`.",example:["price = 25.43467","floored = floor(price * 100) / 100",'print("Floored price: " + floored)']},range:{description:"Returns a `list` where each item is a `number`. By default, the `list` starts with the `number` zero and increments by one for each item. Optionally start and end can be defined. Additionally, the incremental value can be changed as well. In case the incremental value is zero this function will throw a runtime error.",example:['print("Countdown:")',"for num in range(10)"," print(num)","end for",'print("Done!")']},round:{description:"Returns `number` rounded to the integer value of the provided `number`.",example:["price = 25.43467","rounded = round(price * 100) / 100",'print("Price: " + rounded)']},rnd:{description:"Returns a random `number` between 0 and 1. Optionally a seed `number` can be provided.",example:["min = 10","max = 20","output = floor(rnd * (max - min + 1) + min)",'input = user_input("Guess a number between 10 and 20!").to_int',"if (input == output) then",' print("You guessed right!")',"else",' print("You failed! The number was " + output)',"end if"]},sign:{description:"Returns a one or minus one, indicating the sign of the number passed as argument. If the input is zero, it will be returned as-is.",example:["print(sign(40))","print(sign(-40))","print(sign(0))"]},sqrt:{description:"Returns the square root of a `number`.",example:["a = 3","b = 4","calcHypotenuse = sqrt((a * a) + (b * b))",'print("Hypotenuse: " + calcHypotenuse)']},str:{description:"Returns the `string` value of provided data. Can be used to turn a `number` into a `string` or to get the signature of a `function`.",example:["signature = str(@user_input)","argSegment = signature[9:signature.len - 1]",'args = argSegment.split(",")','print("Function has " + args.len + " arguments.")']},ceil:{description:"Returns `number` rounded up to the integer value of the provided `number`.",example:["price = 25.43467","upperPrice = ceil(price * 100) / 100",'print("Upper price: " + upperPrice)']},pi:{description:"Returns the `number` PI to the precision of six.",example:["radius = 10","circumference = 2 * pi * radius",'print("Circumference: " + circumference)']},slice:{description:"Returns a sliced `list`. Valid data types for slicing are `string` and `list`. The returned `list` will contain all elements related to the provided start and end index.",example:['myString = "not your text"','print("my " + slice(myString, 9))']},hash:{description:"Returns numeric hash for the provided data.",example:['hashA = hash({ "a": 2, "b": 1 })','hashB = hash({ "b": 1, "a": 2 })',"if (hashA == hashB) then",' print("Objects are alike!")',"else",' print("Objects are different!")',"end if"]},time:{description:"Returns a `number` of seconds representing the elapsed time since the script got started.",example:["start = time","for i in range(10000)"," var = i * 100","end for","endTime = time - start",'print("Script execution done within: " + endTime)']},bitAnd:{description:"Performs a bitwise AND for the provided values. Returns a `number`.",example:['print("Result of bitwise AND: " + bitAnd(1, 2))']},bitOr:{description:"Performs a bitwise OR for the provided values. Returns a `number`.",example:['print("Result of bitwise OR: " + bitOr(1, 2))']},bitXor:{description:"Permorms a bitwise XOR for the provided values. Returns a `number`.",example:['print("Result of bitwise XOR: " + bitXor(1, 2))']},log:{description:"Returns the natural logarithm of a `number`. By default, the base is 10. Optionally the base can be changed.",example:["a = 2","b = 8","baseLog = log(a) / log(b)",'print("Base log is: " + baseLog)']},yield:{description:"Waits for the next tick.",example:["while (true)"," yield",' print("tick")',"end while"]},get_custom_object:{description:"Returns `map` which is shared throughout all script executions. Can be helpful in case forwarding an entity is desired.",example:["get_custom_object.shouldEndScript = false","while (get_custom_object.shouldEndScript)",' print("Waiting...")'," wait(2)","end while"]},insert:{description:"Depending on the data type this function will insert a value to the provided index. Due to the insertion, the object will be mutated. To get a better idea about the behaviour look into the `insert` method related to `list` or `string`.",example:["list = [2, 3, 4]","insert(list, 2, 42)",'print("List with inserted item: " + list.join(", "))']},join:{description:"Returns a concatenated `string` containing all stringified values inside the `list`. These values will be separated via the provided separator.",example:["myList = [42, 1, 3]",`print(join(myList, " .-*'*-. "))`]},split:{description:"Returns a `list` where each item is a segment of the `string`. The separation depends on the provided separator `string`. Keep in mind that for some odd reason, this method is using regular expressions for matching.",example:['myString = "42 as an answer is wrong"','segments = split(myString, " ")','if segments[0] != "42" then',' print("Invalid information spotted!")',"else",' print("Information seems valid!")',"end if"]},replace:{description:"Depending on the data type this function will replace a value in the provided object. Due to the replacement, the object might get mutated. To get a better idea about the behaviour look into the `replace` method related to `map`, `list` or `string`.",example:['myString = "42 as an answer is wrong"','newString = replace(myString, "wrong", "right")',"print(newString)"]},refEquals:{description:"Tests whether two values refer to the very same object (rather than merely representing the same value). For numbers, this is the same as ==, but for strings, lists, and maps, it is reference equality."},version:{description:`Get a map with information about the version of MiniScript and the host environment that you're currently running. This will include at least the following keys:
|
110
|
+
`)}else if(i instanceof Fe.ASTComment)return i.value;return n}resolveFunctionStatement(e){let n=Re.SignatureDefinitionFunction.parse({type:Re.SignatureDefinitionBaseType.Function,description:this.createFunctionDescription(e),arguments:e.parameters.map(r=>{if(r.type===Fe.ASTType.Identifier)return{label:r.name??"unknown",type:Re.SignatureDefinitionBaseType.Any};let i=r;return{label:i.variable?.name??"unknown",types:Array.from(this.resolveTypeWithDefault(i.init).types)}}),returns:["any"]});return this.factory(Te.CompletionItemKind.Function).addType(Re.SignatureDefinitionBaseType.Function).addSignatureType((0,fM.enrichWithMetaInformation)(n)).setLine(e.start.line)}resolveParenthesisExpression(e){return this.resolveTypeWithDefault(e.expression)}resolveBinaryExpression(e){let n=this.factory(Te.CompletionItemKind.Expression).setLabel("Binary Expr").setLine(e.start.line),r=this.resolveTypeWithDefault(e.left),i=this.resolveTypeWithDefault(e.right);return n.extend(r),n.extend(i),n}resolveLogicalExpression(e){return this.factory(Te.CompletionItemKind.Expression).setLabel("Logical Expr").addType(Re.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveComparisonGroupExpression(e){return this.factory(Te.CompletionItemKind.Expression).setLabel("Comparison Group Expr").addType(Re.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveIsaExpression(e){return this.factory(Te.CompletionItemKind.Expression).setLabel("Isa Expr").addType(Re.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveCallStatement(e){let n=this.resolveNamespace(e);return n===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveCallExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveUnaryExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveMapConstructorExpression(e){let n=this.factory(Te.CompletionItemKind.MapConstructor).addType(Re.SignatureDefinitionBaseType.Map);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.resolveTypeWithDefault(i.value).setLine(i.start.line);if(i.key.type===Fe.ASTType.StringLiteral)n.setProperty(i.key.value.toString(),s);else{let o=this.resolveTypeWithDefault(i.key).setLine(i.start.line);n.setProperty(o,s)}}return n.setLabel("{}").setLine(e.start.line)}resolveListConstructorExpression(e){let n=this.factory(Te.CompletionItemKind.ListConstructor).addType(Re.SignatureDefinitionBaseType.List);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Number).setLine(i.start.line),o=this.resolveTypeWithDefault(i.value).setLine(i.start.line);n.setProperty(s,o)}return n.setLabel("[]").setLine(e.start.line)}resolveSliceExpression(e){let n=this.resolveNamespace(e).setLine(e.start.line);return n===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveIndexExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(e.start.line):r}resolveMemberExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(Te.CompletionItemKind.Property).addType(Re.SignatureDefinitionBaseType.Any).setLabel(e.identifier.name).setLine(e.start.line):r}resolveIdentifier(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(Te.CompletionItemKind.Property).addType(Re.SignatureDefinitionBaseType.Any).setLabel(e.name).setLine(e.start.line):r}resolveType(e,n=!1){if(e==null)return null;switch(e.type){case Fe.ASTType.ParenthesisExpression:return this.resolveParenthesisExpression(e);case Fe.ASTType.CallStatement:return this.resolveCallStatement(e);case Fe.ASTType.CallExpression:return this.resolveCallExpression(e);case Fe.ASTType.BinaryExpression:return this.resolveBinaryExpression(e);case Fe.ASTType.LogicalExpression:return this.resolveLogicalExpression(e);case Fe.ASTType.IsaExpression:return this.resolveIsaExpression(e);case Fe.ASTType.ComparisonGroupExpression:return this.resolveComparisonGroupExpression(e);case Fe.ASTType.FunctionDeclaration:return this.resolveFunctionStatement(e);case Fe.ASTType.SliceExpression:return this.resolveSliceExpression(e);case Fe.ASTType.IndexExpression:return this.resolveIndexExpression(e,n);case Fe.ASTType.MemberExpression:return this.resolveMemberExpression(e,n);case Fe.ASTType.Identifier:return this.resolveIdentifier(e,n);case Fe.ASTType.MapConstructorExpression:return this.resolveMapConstructorExpression(e);case Fe.ASTType.ListConstructorExpression:return this.resolveListConstructorExpression(e);case Fe.ASTType.NegationExpression:case Fe.ASTType.BinaryNegatedExpression:case Fe.ASTType.UnaryExpression:return this.resolveUnaryExpression(e);case Fe.ASTType.NilLiteral:return this.factory(Te.CompletionItemKind.Literal).addType("null").setLabel("null").setLine(e.start.line);case Fe.ASTType.StringLiteral:{let r=e.value.toString();return this.factory(Te.CompletionItemKind.Literal).addType(Re.SignatureDefinitionBaseType.String).setLabel(`"${r.length>20?r.substr(0,20)+"...":r}"`).setLine(e.start.line)}case Fe.ASTType.NumericLiteral:case Fe.ASTType.BooleanLiteral:{let r=e.value.toString();return this.factory(Te.CompletionItemKind.Literal).addType(Re.SignatureDefinitionBaseType.Number).setLabel(r).setLine(e.start.line)}case Yl.ASTType.FeatureFileExpression:return this.factory(Te.CompletionItemKind.Expression).addType(Re.SignatureDefinitionBaseType.String).setLabel("File Expr").setLine(e.start.line);case Yl.ASTType.FeatureLineExpression:return this.factory(Te.CompletionItemKind.Expression).addType(Re.SignatureDefinitionBaseType.Number).setLabel("Line Expr").setLine(e.start.line);case Yl.ASTType.FeatureEnvarExpression:return this.factory(Te.CompletionItemKind.Expression).addType(Re.SignatureDefinitionBaseType.String).setLabel("Envar Expr").setLine(e.start.line);case Yl.ASTType.FeatureInjectExpression:return this.factory(Te.CompletionItemKind.Expression).addType(Re.SignatureDefinitionBaseType.String).setLabel("Inject Expr").setLine(e.start.line);default:return null}}resolveTypeWithDefault(e=null,n=!1){let r=this.resolveType(e,n);if(r==null){let i=this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any);return e!=null&&i.setLine(e.start.line),i}return r}resolveChain(e,n=!1){if(e.length===0)return null;let r=null,i=e[0],s=i.unary?.operator==="@"&&!i.isInCallExpression||n&&e.length===1;if((0,rs.isResolveChainItemWithIdentifier)(i))if(i.getter.name==="globals")r=this._scope.globals;else if(i.getter.name==="outer")r=this._scope.outer;else if(i.getter.name==="locals")r=this._scope.locals;else if(i.getter.name==="super"){let a=this._document.getScopeContext(i.ref.scope)?.scope.context?.values.get("i:__isa");a==null?r=this.factory(Te.CompletionItemKind.Constant).addType("null").setLabel("super"):r=a.copy({kind:Te.CompletionItemKind.Constant,label:"super",values:a.values})}else if(i.getter.name==="self"){let a=this._document.getScopeContext(i.ref.scope)?.scope.context;a==null?r=this.factory(Te.CompletionItemKind.Constant).addType("null").setLabel("self"):r=a.copy({kind:Te.CompletionItemKind.Constant,label:"self",values:a.values})}else r=this._scope.resolveNamespace(i.getter.name,s)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLabel(i.getter.name);else if((0,rs.isResolveChainItemWithValue)(i))r=this.resolveTypeWithDefault(i.value,s);else return null;if(i.unary?.operator==="new"&&r!==null){let a=this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Map).setLabel(r.label);a.setProperty("__isa",r),r=a}let o=e.length;for(let a=1;a<o&&r!==null;a++){let u=e[a],c=u.unary?.operator==="@"&&!u.isInCallExpression||n&&e.length-1===a;if((0,rs.isResolveChainItemWithMember)(u))r=r.resolveProperty(u.getter.name,c)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLabel(u.getter.name);else if((0,rs.isResolveChainItemWithIndex)(u))if((0,CA.isValidIdentifierLiteral)(u.getter)){let l=u.getter.value.toString();r=r.resolveProperty(l,u.isInCallExpression)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLabel(l)}else{let l=this.resolveTypeWithDefault(u.getter);r=r.resolveProperty(l,u.isInCallExpression)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any)}else if(u.ref.type===Fe.ASTType.SliceExpression)r=r.copy();else return null;if(u.unary?.operator==="new"&&r!==null){let l=this.factory(Te.CompletionItemKind.Property).addType(Re.SignatureDefinitionBaseType.Map).setLabel(r.label);l.setProperty("__isa",r),r=l}}return r}resolveNamespace(e,n=!1){let r=(0,kA.createResolveChain)(e);return this.resolveChain(r,n)}defineNamespace(e,n){let r=(0,kA.createResolveChain)(e),i=r.pop();if(r.length>0){let o=this.resolveChain(r);if(o===null)return!1;if((0,rs.isResolveChainItemWithMember)(i))return o.setProperty(i.getter.name,n);if((0,rs.isResolveChainItemWithIndex)(i)){if((0,CA.isValidIdentifierLiteral)(i.getter))return o.setProperty(i.getter.value.toString(),n);{let a=this.resolveTypeWithDefault(i.getter);return o.setProperty(a,n)}}return!1}let s=this._scope;return(0,rs.isResolveChainItemWithIdentifier)(i)?s.setProperty(i.getter.name,n):!1}resolveAvailableAssignmentsWithQuery(e){let n=[],r=new Set([this,this._parent,this._document.getRootScopeContext().aggregator]);for(let i of r){let s=i.definitions;for(let o of s.keys())if(o.includes(e)){let a=s.get(o);n.push(...a)}}return n}resolveAvailableAssignments(e){let n=(0,xA.createExpressionId)(e),r=this;n.startsWith("globals.")?(r=this._document.getRootScopeContext().aggregator,n=n.slice(8)):n.startsWith("locals.")?(r=this,n=n.slice(7)):n.startsWith("outer.")&&(r=this.parent,n=n.slice(6));let i=[],s=new Set([r,r._parent,r._document.getRootScopeContext().aggregator]);for(let o of s){if(o==null)continue;let a=o._definitions.get(n);a!=null&&i.push(...a)}return i}analyze(){for(let e=0;e<this._root.assignments.length;e++){let n=this._root.assignments[e],r=this.resolveType(n.init)?.copy().setLine(n.start.line)??this.factory(Te.CompletionItemKind.Variable).addType(Re.SignatureDefinitionBaseType.Any).setLine(n.start.line);this.defineNamespace(n.variable,r);let i=(0,xA.createExpressionId)(n.variable),s=this._definitions;i.startsWith("globals.")?(s=this._document.getRootScopeContext().aggregator.definitions,i=i.slice(8)):i.startsWith("locals.")?(s=this._definitions,i=i.slice(7)):i.startsWith("outer.")&&(s=this.parent.definitions,i=i.slice(6));let o=s.get(i);o?o.push(n):s.set(i,[n])}}};Jl.Aggregator=gy});var _y=m(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.Document=void 0;var $r=$n(),hM=je(),OA=Qi(),RA=yy(),DA=so(),IA=Xg(),by=class t{get root(){return this._root}get container(){return this._container}get intrinsics(){return this._intrinscis}get globals(){return this._globals}get api(){return this._api}constructor(e){this._root=e.root,this._container=e.container,this._scopeMapping=e.scopeMapping??new WeakMap,this._intrinscis=e.intrinsics??this.createIntrinscis(),this._api=e.api??this.initApi(),this._globals=e.globals??this.initGlobals()}createIntrinscis(){return{map:this._container.primitives.get($r.SignatureDefinitionBaseType.Map),funcRef:this._container.primitives.get($r.SignatureDefinitionBaseType.Function),number:this._container.primitives.get($r.SignatureDefinitionBaseType.Number),string:this._container.primitives.get($r.SignatureDefinitionBaseType.String),list:this._container.primitives.get($r.SignatureDefinitionBaseType.List)}}initApi(){let e=this._container.primitives.get($r.SignatureDefinitionBaseType.General);return e.resolveProperty("map",!0).setReturnEntity(this._intrinscis.map),e.resolveProperty("funcRef",!0).setReturnEntity(this._intrinscis.funcRef),e.resolveProperty("number",!0).setReturnEntity(this._intrinscis.number),e.resolveProperty("string",!0).setReturnEntity(this._intrinscis.string),e.resolveProperty("list",!0).setReturnEntity(this._intrinscis.list),e}initGlobals(){return new DA.Entity({kind:OA.CompletionItemKind.Constant,container:this._container,label:"globals"}).addType($r.SignatureDefinitionBaseType.Map)}analyzeScope(e){let n=this._scopeMapping.get(e.scope),r=new IA.Scope({container:this._container,parent:n?.scope,globals:this._globals}),i=new RA.Aggregator({scope:r,root:e,document:this,parent:n?.aggregator});this._scopeMapping.set(e,{scope:r,aggregator:i});let s=e.assignment instanceof hM.ASTAssignmentStatement?this.resolveNamespace(e.assignment.variable,!0):null;if(s!==null){let o=s?.context;o!=null&&o.types.has($r.SignatureDefinitionBaseType.Map)&&o!==this._globals&&r.setContext(o)}if(i.analyze(),s!==null){let o=s.signatureDefinitions.last();if(o!=null){let a=o.getArguments();for(let u=0;u<a.length;u++){let c=a[u],l=r.resolveProperty(c.getLabel(),!0),d=c.getTypes().map(p=>p.type);l===null?r.setProperty(c.getLabel(),new DA.Entity({kind:OA.CompletionItemKind.Variable,container:this._container}).addType(...d)):(l.types.delete($r.SignatureDefinitionBaseType.Any),l.addType(...d))}}}}analyze(){let e=new IA.Scope({container:this._container,globals:this._globals,locals:this._globals}),n=new RA.Aggregator({scope:e,root:this._root,document:this});this._scopeMapping.set(this._root,{scope:e,aggregator:n}),n.analyze();for(let r=0;r<this._root.scopes.length;r++){let i=this._root.scopes[r];this.analyzeScope(i)}}getRootScopeContext(){return this._scopeMapping.get(this._root)}getAllScopeContexts(){return[this._root,...this._root.scopes].map(e=>this._scopeMapping.get(e))}getScopeContext(e){return this._scopeMapping.get(e)??null}getLastASTItemOfLine(e){let n=this._root.lines[e];return n&&n.length>0?n[n.length-1]:null}findASTItemInLine(e,n){let r=this._root.lines[e];if(r&&r.length>0){let i=r.find(s=>s.type===n);if(i)return i}return null}resolveAllAssignmentsWithQuery(e){let n=[],r=[this._root,...this._root.scopes];for(let i=0;i<r.length;i++){let o=this._scopeMapping.get(r[i]).aggregator.definitions;for(let a of o.keys())if(a.includes(e)){let u=o.get(a);n.push(...u)}}return n}resolveAvailableAssignments(e){return this._scopeMapping.get(e.scope)?.aggregator.resolveAvailableAssignments(e)??[]}resolveType(e,n){return this._scopeMapping.get(e.scope)?.aggregator.resolveType(e,n)??null}resolveTypeWithDefault(e,n){return this._scopeMapping.get(e.scope)?.aggregator.resolveTypeWithDefault(e,n)}resolveNamespace(e,n=!1){return this._scopeMapping.get(e.scope)?.aggregator.resolveNamespace(e,n)??null}merge(...e){let n=new t({root:this._root,container:this._container.copy()});for(let r of e)n._globals.extend(r._globals.copy({line:-1})),n._intrinscis.map.extend(r._intrinscis.map.copy({line:-1})),n._intrinscis.funcRef.extend(r._intrinscis.funcRef.copy({line:-1})),n._intrinscis.number.extend(r._intrinscis.number.copy({line:-1})),n._intrinscis.string.extend(r._intrinscis.string.copy({line:-1})),n._intrinscis.list.extend(r._intrinscis.list.copy({line:-1}));return n.analyze(),n}};Ql.Document=by});var Ty=m(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});Zl.ContainerProxy=void 0;var Tr=$n(),Si=so(),PA=Qi(),MA=ka(),vy=Bl(),Sy=class t{get primitives(){return this._primitives}get types(){return this._types}constructor(e){this._container=e.container,this._primitives=e.primitives??this.createPrimitives(),this._types=e.types??this.createTypes()}createPrimitives(){let e=new Map;for(let[n,r]of this._container.getPrimitives()){let i=new Si.Entity({kind:PA.CompletionItemKind.Constant,container:this,isAPI:n===Tr.SignatureDefinitionBaseType.General}).addType(Tr.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}createTypes(){let e=new Map;for(let[n,r]of this._container.getTypes()){let i=new Si.Entity({kind:PA.CompletionItemKind.Constant,container:this}).addType(Tr.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}getTypeSignature(e){return this._primitives.get(e)??this._types.get(e)??null}searchDefinitionMatches(e,n){if(typeof e=="string")return this.searchDefinitionMatches([e],n);let r=e.includes(Tr.SignatureDefinitionBaseType.Any)?new Set(this._container.getAllVisibleTypes()):new Set(e),i=new Map;for(let s of r){let o=this.getTypeSignature(s);if(o===null)continue;let a=(0,vy.lookupProperty)(o,n);a!==null&&i.set(s,a)}return i}getDefinition(e,n,r=!1){if(typeof e=="string")return this.getDefinition([e],n);let i=(0,vy.lookupProperty)(this._primitives.get(Tr.SignatureDefinitionBaseType.Any),n);if(e.includes(Tr.SignatureDefinitionBaseType.Any)&&i)return(0,Si.resolveEntity)(this,i,r);let s=this.searchDefinitionMatches(e,n);return s.size===0?null:s.size===1?(0,Si.resolveEntity)(this,s.values().next().value,r):s.has(Tr.SignatureDefinitionBaseType.Any)?(0,Si.resolveEntity)(this,s.get(Tr.SignatureDefinitionBaseType.Any),r):i!==null?(0,Si.resolveEntity)(this,i,r):(0,Si.resolveEntity)(this,s.values().next().value,r)}getGeneralDefinition(e,n=!1){let r=(0,vy.lookupProperty)(this._primitives.get(Tr.SignatureDefinitionBaseType.General),e);return r==null?null:(0,Si.resolveEntity)(this,r,n)}getAllIdentifier(e){let n=new Map;if(e===Tr.SignatureDefinitionBaseType.Any){for(let i of this._container.getAllVisibleTypes()){let s=this.getTypeSignature(i);s!=null&&(0,MA.injectIdentifers)(n,s)}return n}let r=this.getTypeSignature(e);return r!=null&&(0,MA.injectIdentifers)(n,r),n}copy(){return new t({container:this._container})}};Zl.ContainerProxy=Sy});var LA=m(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.TypeManager=void 0;var mM=_y(),gM=Ty(),wy=class{constructor(e){this._container=new gM.ContainerProxy({container:e.container}),this._types=new Map}analyze(e,n){let r=new mM.Document({container:this._container.copy(),root:n});try{r.analyze()}catch(i){console.error(i)}return this._types.set(e,r),r}get(e){return this._types.get(e)??null}};ed.TypeManager=wy});var $a=m(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.TypeManager=ne.ContainerProxy=ne.Document=ne.Aggregator=ne.Scope=ne.Entity=ne.lookupProperty=ne.isEligibleForProperties=ne.injectIdentifers=ne.isSignatureDefinitionFunction=ne.isResolveChainItemWithValue=ne.isResolveChainItemWithMember=ne.isResolveChainItemWithIndex=ne.isResolveChainItemWithIdentifier=ne.CompletionItemKind=ne.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=ne.ObjectSetIterator=ne.ObjectSet=ne.rotateBits=ne.getStringHashCode=ne.getHashCode=ne.createResolveChain=ne.enrichWithMetaInformation=ne.createExpressionId=ne.createExpressionHash=ne.isValidIdentifierLiteral=void 0;var yM=aa();Object.defineProperty(ne,"isValidIdentifierLiteral",{enumerable:!0,get:function(){return yM.isValidIdentifierLiteral}});var bM=Fw();Object.defineProperty(ne,"createExpressionHash",{enumerable:!0,get:function(){return bM.createExpressionHash}});var _M=Dm();Object.defineProperty(ne,"createExpressionId",{enumerable:!0,get:function(){return _M.createExpressionId}});var vM=Lg();Object.defineProperty(ne,"enrichWithMetaInformation",{enumerable:!0,get:function(){return vM.enrichWithMetaInformation}});var SM=Ng();Object.defineProperty(ne,"createResolveChain",{enumerable:!0,get:function(){return SM.createResolveChain}});var Ey=Rm();Object.defineProperty(ne,"getHashCode",{enumerable:!0,get:function(){return Ey.getHashCode}});Object.defineProperty(ne,"getStringHashCode",{enumerable:!0,get:function(){return Ey.getStringHashCode}});Object.defineProperty(ne,"rotateBits",{enumerable:!0,get:function(){return Ey.rotateBits}});var NA=$g();Object.defineProperty(ne,"ObjectSet",{enumerable:!0,get:function(){return NA.ObjectSet}});Object.defineProperty(ne,"ObjectSetIterator",{enumerable:!0,get:function(){return NA.ObjectSetIterator}});var TM=Bg();Object.defineProperty(ne,"DEFAULT_CUSTOM_FUNCTION_DESCRIPTION",{enumerable:!0,get:function(){return TM.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION}});var wM=Qi();Object.defineProperty(ne,"CompletionItemKind",{enumerable:!0,get:function(){return wM.CompletionItemKind}});var td=Ug();Object.defineProperty(ne,"isResolveChainItemWithIdentifier",{enumerable:!0,get:function(){return td.isResolveChainItemWithIdentifier}});Object.defineProperty(ne,"isResolveChainItemWithIndex",{enumerable:!0,get:function(){return td.isResolveChainItemWithIndex}});Object.defineProperty(ne,"isResolveChainItemWithMember",{enumerable:!0,get:function(){return td.isResolveChainItemWithMember}});Object.defineProperty(ne,"isResolveChainItemWithValue",{enumerable:!0,get:function(){return td.isResolveChainItemWithValue}});var EM=Hg();Object.defineProperty(ne,"isSignatureDefinitionFunction",{enumerable:!0,get:function(){return EM.isSignatureDefinitionFunction}});var AM=ka();Object.defineProperty(ne,"injectIdentifers",{enumerable:!0,get:function(){return AM.injectIdentifers}});var xM=Fl();Object.defineProperty(ne,"isEligibleForProperties",{enumerable:!0,get:function(){return xM.isEligibleForProperties}});var kM=Bl();Object.defineProperty(ne,"lookupProperty",{enumerable:!0,get:function(){return kM.lookupProperty}});var CM=so();Object.defineProperty(ne,"Entity",{enumerable:!0,get:function(){return CM.Entity}});var OM=Xg();Object.defineProperty(ne,"Scope",{enumerable:!0,get:function(){return OM.Scope}});var RM=yy();Object.defineProperty(ne,"Aggregator",{enumerable:!0,get:function(){return RM.Aggregator}});var DM=_y();Object.defineProperty(ne,"Document",{enumerable:!0,get:function(){return DM.Document}});var IM=Ty();Object.defineProperty(ne,"ContainerProxy",{enumerable:!0,get:function(){return IM.ContainerProxy}});var PM=LA();Object.defineProperty(ne,"TypeManager",{enumerable:!0,get:function(){return PM.TypeManager}})});var Ay=m(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.getSymbolItemKind=uo.getCompletionItemKind=void 0;var Vt=$a(),MM=t=>{switch(t){case Vt.CompletionItemKind.Constant:return 21;case Vt.CompletionItemKind.Variable:return 6;case Vt.CompletionItemKind.Expression:return 6;case Vt.CompletionItemKind.Function:return 3;case Vt.CompletionItemKind.ListConstructor:case Vt.CompletionItemKind.MapConstructor:case Vt.CompletionItemKind.Literal:case Vt.CompletionItemKind.Unknown:return 12}};uo.getCompletionItemKind=MM;var LM=t=>{switch(t){case Vt.CompletionItemKind.Constant:return 14;case Vt.CompletionItemKind.Variable:return 13;case Vt.CompletionItemKind.Expression:return 13;case Vt.CompletionItemKind.Function:return 12;case Vt.CompletionItemKind.ListConstructor:return 18;case Vt.CompletionItemKind.MapConstructor:return 19;case Vt.CompletionItemKind.Literal:case Vt.CompletionItemKind.Unknown:return 13}};uo.getSymbolItemKind=LM});var ky=m(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.findEx=void 0;var NM=je(),qM=function(t){return{ParenthesisExpression:(e,n)=>{t(e.expression,n)},AssignmentStatement:function(e,n){t(e.init,n),t(e.variable,n)},MemberExpression:function(e,n){t(e.base,n),t(e.identifier,n)},FunctionDeclaration:function(e,n){for(let r=0;r<e.parameters.length;r++)t(e.parameters[r],n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},MapConstructorExpression:function(e,n){for(let r=0;r<e.fields.length;r++)t(e.fields[r],n)},ReturnStatement:function(e,n){e.argument&&t(e.argument,n)},WhileStatement:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},IndexExpression:function(e,n){t(e.base,n),t(e.index,n)},SliceExpression:function(e,n){t(e.base,n),t(e.left,n),t(e.right,n)},ListValue:function(e,n){t(e.value,n)},MapKeyString:function(e,n){t(e.key,n),t(e.value,n)},IfShortcutStatement:function(e,n){for(let r=0;r<e.clauses.length;r++)t(e.clauses[r],n)},IfShortcutClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseifShortcutClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseShortcutClause:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ForGenericStatement:function(e,n){t(e.variable,n),t(e.iterator,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},IfStatement:function(e,n){for(let r=0;r<e.clauses.length;r++)t(e.clauses[r],n)},IfClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseifClause:function(e,n){t(e.condition,n);for(let r=0;r<e.body.length;r++)t(e.body[r],n)},ElseClause:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},NegationExpression:function(e,n){t(e.argument,n)},CallExpression:function(e,n){t(e.base,n);for(let r=0;r<e.arguments.length;r++)t(e.arguments[r],n)},CallStatement:function(e,n){t(e.expression,n)},ListConstructorExpression:function(e,n){for(let r=0;r<e.fields.length;r++)t(e.fields[r],n)},BinaryExpression:function(e,n){t(e.left,n),t(e.right,n)},BinaryNegatedExpression:function(e,n){t(e.argument,n)},IsaExpression:function(e,n){t(e.left,n),t(e.right,n)},LogicalExpression:function(e,n){t(e.left,n),t(e.right,n)},ComparisonGroupExpression:function(e,n){for(let r=0;r<e.expressions.length;r++)t(e.expressions[r],n)},UnaryExpression:function(e,n){t(e.argument,n)},Chunk:function(e,n){for(let r=0;r<e.body.length;r++)t(e.body[r],n)},InvalidCodeExpression:()=>{}}},xy=class{constructor(e){this.map=qM(this.visit.bind(this)),this.callback=e,this.state={exit:!1}}visit(e,n=0){let r=this;if(e==null)return;if(e.type==null)throw console.error("Error ast type:",e),new Error("Unexpected as type");if(r.state=r.callback(e,n),r.state.exit||r.state.skip)return;let i=r.map[e.type];i?.call(r,e,n+1)}};function jM(t,e){let n=[];return new xy((i,s)=>{let o=t(i,s)||{};return o.valid&&i.type!==NM.ASTType.InvalidCodeExpression&&n.push(i),{exit:!!o.exit,skip:!!o.skip}}).visit(e),n}nd.findEx=jM});var qA=m((g5,FM)=>{FM.exports={insert:{description:"Depending on the data type this method will insert a value to the provided index. Due to the insertion, the object will be mutated. To get a better idea about the behaviour look into the `insert` method related to `list` or `string`.",example:["list = [2, 3, 4]","list.insert(2, 42)",'print("List with inserted item: " + list.join(", "))']},indexOf:{description:"Depending on the data type this function searches for the index of the provided value. To get a better idea about the behaviour look into the `indexOf` methods related to `string`, `list` and `map`.",example:['index = "test".indexOf("e")','print("e is at: " + index)']},hasIndex:{description:"Depending on data type this function checks if the provided index is available inside the value. To get a better idea about the behaviour look into the `hasIndex` methods related to `string`, `list` and `map`.",example:['print("List has index: " + [1, 2, 3].hasIndex(2)']},remove:{description:"Depending on the data type this function will remove a value in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `remove` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","list.remove(5)",'print("List after removal: " + list.join(", "))']},push:{description:"Depending on data type this function will append a value to the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `push` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","list.push(42)",'print("The answer to everything is: " + list.pop)']},pull:{description:"Depending on data type this function will return the first item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["myList = [42, 1, 3]","answer = myList.pull",'print("Answer to everything: " + answer)']},pop:{description:"Depending on data type this function will return the last item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The last item is: " + list.pop)']},shuffle:{description:"Depending on data type this function will shuffle data. Instead of returning the newly shuffled data, this function will mutate the data. To get a better idea about the behaviour look into the `shuffle` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","list.shuffle",'print("And the winner is: " + list[0])']},sum:{description:"Depending on data type this function returns the sum of all items. To get a better idea about the behaviour look into the `sum` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("Sum of all items is: " + list.sum)']},indexes:{description:"Depending on data type this function returns a `list` with all available indexes. To get a better idea about the behaviour look into the `indexes` methods related to `string`, `list` and `map`.",example:['indexesOfStr = "test".indexes','print("Following indexes are available: " + indexesOfStr.join(", "))']},len:{description:"Depending on data type this function returns the length of the provided value. To get a better idea about the behaviour look into the `len` methods related to `string`, `list` and `map`.",example:['length = "test".len','print("Length of string is: " + length)']},values:{description:"Depending on data type this function returns a `list` with all available values. To get a better idea about the behaviour look into the `values` methods related to `string`, `list` and `map`.",example:['indexesOfStr = "test".values','print("Following values are available: " + indexesOfStr.join(", "))']}}});var jA=m((y5,$M)=>{$M.exports={hasIndex:{description:"Depending on data type this function checks if the provided index is available inside the value. To get a better idea about the behaviour look into the `hasIndex` methods related to `string`, `list` and `map`.",example:['print("List has index: " + hasIndex([1, 2, 3], 2)']},print:{description:"Print a message on the Terminal.",example:['print("hello world")']},indexes:{description:"Depending on data type this function returns a `list` with all available indexes. To get a better idea about the behaviour look into the `indexes` methods related to `string`, `list` and `map`.",example:['indexesOfStr = indexes("test")','print("Following indexes are available: " + indexesOfStr.join(", "))']},values:{description:"Depending on data type this function returns a `list` with all available values. To get a better idea about the behaviour look into the `values` methods related to `string`, `list` and `map`.",example:['indexesOfStr = values("test")','print("Following values are available: " + indexesOfStr.join(", "))']},indexOf:{description:"Depending on the data type this function searches for the index of the provided value. To get a better idea about the behaviour look into the `indexOf` methods related to `string`, `list` and `map`.",example:['index = indexOf("test", "e")','print("e is at: " + index)']},len:{description:"Depending on data type this function returns the length of the provided value. To get a better idea about the behaviour look into the `len` methods related to `string`, `list` and `map`.",example:['length = len("test")','print("Length of string is: " + length)']},shuffle:{description:"Depending on data type this function will shuffle data. Instead of returning the newly shuffled data, this function will mutate the data. To get a better idea about the behaviour look into the `shuffle` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","shuffle(list)",'print("And the winner is: " + list[0])']},val:{description:"Casts a `string` to a `number`. In case the provided `string` does not represent a valid `number` the `number` zero will get returned.",example:['num = val("1.25")','print("Number in string is: " + num)']},lower:{description:"Returns a `string` which is the lowercase transformed version of the provided `string`.",example:['myString = lower("HELLO WORLD")',"print(myString)"]},upper:{description:"Returns a `string` which is the uppercase transformed version of the provided `string`.",example:['myString = upper("hello world")',"print(myString)"]},sum:{description:"Depending on data type this function returns the sum of all items. To get a better idea about the behaviour look into the `sum` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("Sum of all items is: " + sum(list))']},pop:{description:"Depending on data type this function will return the last item in the provided value. Additionally, this function removes the last item and therefore mutates the object. To get a better idea about the behaviour look into the `pop` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The last item is: " + pop(list))']},pull:{description:"Depending on data type this function will return the first item in the provided value. Additionally, this function removes the first item and therefore mutates the object. To get a better idea about the behaviour look into the `pull` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]",'print("The first item is: " + pull(list))']},push:{description:"Depending on data type this function will append a value to the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `push` methods related to `list` and `map`.",example:["list = [0, 1, 2, 3, 4, 5]","push(list, 42)",'print("The answer to everything is: " + pop(list))']},sort:{description:"Depending on the data type this function will sort the values in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `sort` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","sort(list)",'print("Sorted list: " + list.join(", "))']},remove:{description:"Depending on the data type this function will remove a value in the provided object. As a result, the object will get mutated. To get a better idea about the behaviour look into the `remove` methods related to `list` and `map`.",example:["list = [9, 3, 5, 7]","remove(list, 5)",'print("List after removal: " + list.join(", "))']},wait:{description:"Puts script execution on hold. Optionally the duration can be provided via the time argument. By default, the duration will be 1 second. The duration cannot be below 0.01 or above 300.",example:["start = time","wait(5)","elapsed = time - start",'print("Waited: " + elapsed)']},bitwise:{description:'Enables to perform bitwise operations. Supported operators are: `"&"`, `"|"`, `"^"`, `"<<"`, `">>"`, `">>>"`. Returns a `number`.',example:["num = params[0].to_int",'isOdd = bitwise("&", num, 1) == 1',"if isOdd then",' print("Number is odd.")',"else",' print("Number is even.")',"end if"]},abs:{description:"Returns the absolute value of `number`.",example:["a = 1","b = 5","difference = abs(a - b)",'print("Difference between a and b is: " + difference)']},acos:{description:"Returns the inverse cosine (in radians) of a `number`.",example:["adjacent = 8","hypotenuse = 10","calcAngle = acos(adjacent / hypotenuse)",'print("Angle: " + calcAngle)']},asin:{description:"Returns the inverse sine (in radians) of a `number`.",example:["opposite = 6","hypotenuse = 10","calcAngle = acos(opposite / hypotenuse)",'print("Angle: " + calcAngle)']},atan:{description:"Returns the inverse tangent (in radians) of a `number`.",example:["opposite = 8","hypotenuse = 10","calcAngle = atan(opposite / hypotenuse)",'print("Angle: " + calcAngle)']},tan:{description:"Returns the tangent of a `number` in radians.",example:["degrees = 90","tanFromDegrees = tan(degress * pi / 180)",'print("Tan from degrees: " + tanFromDegrees)']},cos:{description:"Returns the cosine of a `number` in radians.",example:["radians = 1","radius = 10","circleX = cos(radians) * radius","print(circleX)"]},code:{description:"Returns the Unicode `number` of the first character of the string. In case an empty `string` is provided the script execution will crash.",example:['key = user_input("Press a key!", false, true)',"isA = key.code == 97","if isA then",' print("You pressed A.")',"else",' print("You did not press A.")',"end if"]},char:{description:"Returns the Unicode character `string` related to the provided unicode `number`. The provided `number` needs to be between 0 and 65535. Any `number` which is outside this range will cause the script to throw a runtime error.",example:['key = user_input("Press a key!", false, true)',"isA = key == char(97)","if isA then",' print("You pressed A.")',"else",' print("You did not press A.")',"end if"]},sin:{description:"Returns the sine of a `number` in radians.",example:["radians = 1","radius = 10","circleY = sin(radians) * radius","print(circleY)"]},floor:{description:"Returns `number` rounded down to the integer value of the provided `number`.",example:["price = 25.43467","floored = floor(price * 100) / 100",'print("Floored price: " + floored)']},range:{description:"Returns a `list` where each item is a `number`. By default, the `list` starts with the `number` zero and increments by one for each item. Optionally start and end can be defined. Additionally, the incremental value can be changed as well. In case the incremental value is zero this function will throw a runtime error.",example:['print("Countdown:")',"for num in range(10)"," print(num)","end for",'print("Done!")']},round:{description:"Returns `number` rounded to the integer value of the provided `number`.",example:["price = 25.43467","rounded = round(price * 100) / 100",'print("Price: " + rounded)']},rnd:{description:"Returns a random `number` between 0 and 1. Optionally a seed `number` can be provided.",example:["min = 10","max = 20","output = floor(rnd * (max - min + 1) + min)",'input = user_input("Guess a number between 10 and 20!").to_int',"if (input == output) then",' print("You guessed right!")',"else",' print("You failed! The number was " + output)',"end if"]},sign:{description:"Returns a one or minus one, indicating the sign of the number passed as argument. If the input is zero, it will be returned as-is.",example:["print(sign(40))","print(sign(-40))","print(sign(0))"]},sqrt:{description:"Returns the square root of a `number`.",example:["a = 3","b = 4","calcHypotenuse = sqrt((a * a) + (b * b))",'print("Hypotenuse: " + calcHypotenuse)']},str:{description:"Returns the `string` value of provided data. Can be used to turn a `number` into a `string` or to get the signature of a `function`.",example:["signature = str(@user_input)","argSegment = signature[9:signature.len - 1]",'args = argSegment.split(",")','print("Function has " + args.len + " arguments.")']},ceil:{description:"Returns `number` rounded up to the integer value of the provided `number`.",example:["price = 25.43467","upperPrice = ceil(price * 100) / 100",'print("Upper price: " + upperPrice)']},pi:{description:"Returns the `number` PI to the precision of six.",example:["radius = 10","circumference = 2 * pi * radius",'print("Circumference: " + circumference)']},slice:{description:"Returns a sliced `list`. Valid data types for slicing are `string` and `list`. The returned `list` will contain all elements related to the provided start and end index.",example:['myString = "not your text"','print("my " + slice(myString, 9))']},hash:{description:"Returns numeric hash for the provided data.",example:['hashA = hash({ "a": 2, "b": 1 })','hashB = hash({ "b": 1, "a": 2 })',"if (hashA == hashB) then",' print("Objects are alike!")',"else",' print("Objects are different!")',"end if"]},time:{description:"Returns a `number` of seconds representing the elapsed time since the script got started.",example:["start = time","for i in range(10000)"," var = i * 100","end for","endTime = time - start",'print("Script execution done within: " + endTime)']},bitAnd:{description:"Performs a bitwise AND for the provided values. Returns a `number`.",example:['print("Result of bitwise AND: " + bitAnd(1, 2))']},bitOr:{description:"Performs a bitwise OR for the provided values. Returns a `number`.",example:['print("Result of bitwise OR: " + bitOr(1, 2))']},bitXor:{description:"Permorms a bitwise XOR for the provided values. Returns a `number`.",example:['print("Result of bitwise XOR: " + bitXor(1, 2))']},log:{description:"Returns the natural logarithm of a `number`. By default, the base is 10. Optionally the base can be changed.",example:["a = 2","b = 8","baseLog = log(a) / log(b)",'print("Base log is: " + baseLog)']},yield:{description:"Waits for the next tick.",example:["while (true)"," yield",' print("tick")',"end while"]},get_custom_object:{description:"Returns `map` which is shared throughout all script executions. Can be helpful in case forwarding an entity is desired.",example:["get_custom_object.shouldEndScript = false","while (get_custom_object.shouldEndScript)",' print("Waiting...")'," wait(2)","end while"]},insert:{description:"Depending on the data type this function will insert a value to the provided index. Due to the insertion, the object will be mutated. To get a better idea about the behaviour look into the `insert` method related to `list` or `string`.",example:["list = [2, 3, 4]","insert(list, 2, 42)",'print("List with inserted item: " + list.join(", "))']},join:{description:"Returns a concatenated `string` containing all stringified values inside the `list`. These values will be separated via the provided separator.",example:["myList = [42, 1, 3]",`print(join(myList, " .-*'*-. "))`]},split:{description:"Returns a `list` where each item is a segment of the `string`. The separation depends on the provided separator `string`. Keep in mind that for some odd reason, this method is using regular expressions for matching.",example:['myString = "42 as an answer is wrong"','segments = split(myString, " ")','if segments[0] != "42" then',' print("Invalid information spotted!")',"else",' print("Information seems valid!")',"end if"]},replace:{description:"Depending on the data type this function will replace a value in the provided object. Due to the replacement, the object might get mutated. To get a better idea about the behaviour look into the `replace` method related to `map`, `list` or `string`.",example:['myString = "42 as an answer is wrong"','newString = replace(myString, "wrong", "right")',"print(newString)"]},refEquals:{description:"Tests whether two values refer to the very same object (rather than merely representing the same value). For numbers, this is the same as ==, but for strings, lists, and maps, it is reference equality."},version:{description:`Get a map with information about the version of MiniScript and the host environment that you're currently running. This will include at least the following keys:
|
111
111
|
miniscript: a string such as "1.5"
|
112
112
|
buildDate: a date in yyyy-mm-dd format, like "2020-05-28"
|
113
113
|
host: a number for the host major and minor version, like 0.9
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "miniscript-languageserver",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.1",
|
4
4
|
"description": "Language server for MiniScript",
|
5
5
|
"main": "./index.js",
|
6
6
|
"scripts": {
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"greybel-core": "~2.0.4",
|
71
71
|
"miniscript-meta": "~1.2.3",
|
72
72
|
"greybel-transpiler": "~3.0.9",
|
73
|
-
"miniscript-type-analyzer": "~0.8.
|
73
|
+
"miniscript-type-analyzer": "~0.8.3",
|
74
74
|
"miniscript-languageserver-core": "^1.1.0"
|
75
75
|
}
|
76
76
|
}
|