miniscript-languageserver 1.5.3 → 1.5.4
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
@@ -104,13 +104,13 @@ ${e}`;for(let a=0;a<this.details.length;++a){let u=a+1;o=`${o}
|
|
104
104
|
|
105
105
|
`),n=t.tags.filter(s=>s.tag===Na.Param).map(s=>({label:s.name,types:s.type.split("|"),opt:s.optional})),r=t.tags.find(s=>s.tag===Na.Return)??{type:"any"},i=t.tags.filter(s=>s.tag===Na.Example).map(J0);return{descriptions:e,args:n,returns:r,examples:i}}function kM(t){let e=(0,TM.parse)(`/**
|
106
106
|
${t.getDescription()}
|
107
|
-
*/`),[n]=e;if(n.tags.length>0){let{descriptions:r,args:i,returns:s,examples:o}=SM(n);return Y0.SignatureDefinitionFunction.parse({type:Y0.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}ss.enrichWithMetaInformation=kM});var oy=g(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.createResolveChain=void 0;var an=qe();function wi(t,e,n=null,r=!1){switch(t.type){case an.ASTType.ParenthesisExpression:{wi(t.expression,e,n);return}case an.ASTType.MemberExpression:{let i=t;wi(i.base,e),e.push({ref:t,getter:i.identifier,unary:n,isInCallExpression:r});return}case an.ASTType.IndexExpression:{let i=t;wi(i.base,e),e.push({ref:t,getter:i.index,unary:n,isInCallExpression:r});return}case an.ASTType.CallStatement:{wi(t.expression,e,n,!0);return}case an.ASTType.CallExpression:{wi(t.base,e,n,!0);return}case an.ASTType.NegationExpression:case an.ASTType.BinaryNegatedExpression:case an.ASTType.UnaryExpression:{let i=t;wi(i.argument,e,i);return}case an.ASTType.Identifier:{e.push({ref:t,getter:t,unary:n,isInCallExpression:r});return}case an.ASTType.NumericLiteral:case an.ASTType.StringLiteral:case an.ASTType.NilLiteral:case an.ASTType.MapConstructorExpression:case an.ASTType.ListConstructorExpression:{e.push({ref:t,value:t,unary:n,isInCallExpression:r});return}case an.ASTType.SliceExpression:wi(t.base,e),e.push({ref:t,unary:n,isInCallExpression:r})}}function xM(t){let e=[];return wi(t,e),e}Hl.createResolveChain=xM});var Z0=g(ay=>{function Q0(t,e){return t>e?1:-1}ay.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(Q0),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},ay.sortNumbers=Q0});var ly=g(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.ObjectSet=co.ObjectSetIterator=void 0;var uy=Z0(),Wl=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}}};co.ObjectSetIterator=Wl;var cy=class{constructor(e){let r=(e?Array.from(e):[]).map(i=>[(0,uy.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 Wl(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,uy.hash)(e);return this._map.set(n,e),this._first??(this._first=n),this._last=n,this}delete(e){let n=(0,uy.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()}};co.ObjectSet=cy});var dy=g(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=void 0;Gl.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 os=g(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.CompletionItemKind=void 0;var wM;(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"})(wM=qa.CompletionItemKind||(qa.CompletionItemKind={}))});var fy=g(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.isResolveChainItemWithValue=Ar.isResolveChainItemWithIdentifier=Ar.isResolveChainItemWithMember=Ar.isResolveChainItemWithIndex=void 0;var Ei=qe(),EM=t=>t!=null&&t.ref.type===Ei.ASTType.IndexExpression;Ar.isResolveChainItemWithIndex=EM;var AM=t=>t!=null&&t.ref.type===Ei.ASTType.MemberExpression;Ar.isResolveChainItemWithMember=AM;var OM=t=>t!=null&&t.ref.type===Ei.ASTType.Identifier;Ar.isResolveChainItemWithIdentifier=OM;var CM=t=>t!=null&&(t.ref.type===Ei.ASTType.NumericLiteral||t.ref.type===Ei.ASTType.StringLiteral||t.ref.type===Ei.ASTType.NilLiteral||t.ref.type===Ei.ASTType.MapConstructorExpression||t.ref.type===Ei.ASTType.ListConstructorExpression);Ar.isResolveChainItemWithValue=CM});var py=g(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.isSignatureDefinitionFunction=void 0;var RM=Wn(),PM=t=>t.getType().type===RM.SignatureDefinitionBaseType.Function;Kl.isSignatureDefinitionFunction=PM});var hy=g(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});Vl.aggregateEntity=void 0;var DM=t=>{let e=[],n=t;for(;n!=null;)e.push(n),n=n.getIsa();return e};Vl.aggregateEntity=DM});var ja=g(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.injectIdentifers=void 0;var IM=hy(),MM=(t,e)=>{let n=(0,IM.aggregateEntity)(e);for(let r=0;r<n.length;r++){let i=n[r];for(let[s,o]of i.values)if(s.startsWith("i:")){let a=s.slice(2);if(t.has(a))continue;t.set(a,{kind:o.kind,line:o.source===e.source?o.line:-1})}}};zl.injectIdentifers=MM});var Yl=g(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});Xl.isEligibleForProperties=void 0;var gy=Wn(),LM=t=>t.types.has(gy.SignatureDefinitionBaseType.Map)||t.types.has(gy.SignatureDefinitionBaseType.List)||t.types.has(gy.SignatureDefinitionBaseType.Any);Xl.isEligibleForProperties=LM});var Ql=g(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.lookupProperty=void 0;var NM=Yl(),qM=(t,e)=>{let n=t;for(;(0,NM.isEligibleForProperties)(n);){let r=n.values.get(`i:${e}`);if(r!=null)return r;let i=n.getIsa();if(i==null)break;n=i}return null};Jl.lookupProperty=qM});var po=g(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.Entity=Ai.resolveEntity=void 0;var lo=Wn(),fo=os(),jM=py(),FM=ja(),Zl=Yl(),eE=Ql(),tE=ly(),$M=(t,e,n=!1)=>{if(e.isCallable()&&!n){let r=e.getReturnEntity();if(r!==null)return r;let i=e.getCallableReturnTypes();return i?new as({source:e.source,kind:fo.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addTypes(i):new as({source:e.source,kind:fo.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addType(lo.SignatureDefinitionBaseType.Any)}return e};Ai.resolveEntity=$M;var my={hasProperty(t,e,n){return!!(0,eE.lookupProperty)(t,n)||!t.isAPI()&&!!e.getDefinition(Array.from(t.types),n,!0)},resolveProperty(t,e,n,r=!1){let i=(0,eE.lookupProperty)(t,n)??null;return i==null?t.isAPI()?null:e.getDefinition(Array.from(t.types),n,r):(0,Ai.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Zl.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,definitions:[]})),!0}},yy={hasProperty(t,e,n){if(!(0,Zl.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,Zl.isEligibleForProperties)(t))return new as({source:t.source,kind:fo.CompletionItemKind.Variable,container:e,label:n.label,context:t}).addType(lo.SignatureDefinitionBaseType.Any);let i=new as({source:n.source,kind:fo.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(lo.SignatureDefinitionBaseType.Any),(0,Ai.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Zl.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,definitions:[]}))}return!0}},as=class t{get source(){return this._source}get definitions(){return this._definitions}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._source=e.source,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 tE.ObjectSet,this._types=e.types??new Set,this._values=e.values??new Map,this._context=e.context??null,this._container=e.container,this._definitions=e.definitions??[],this._returnEntity=e.returnEntity??null}isFromSignature(){return this._isFromSignature}hasContext(){return this._context!=null&&!this._context.isAPI}getIsa(){return this._values.get("i:__isa")??null}hasIsa(){return this._values.has("i:__isa")}isAPI(){return this._isAPI}isCallable(){return this._types.has(lo.SignatureDefinitionBaseType.Function)}getCallableReturnTypes(){if(!this.isCallable())return null;let e=Array.from(this._signatureDefinitions).filter(n=>(0,jM.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){return this._types.add(e),this}addTypes(e){for(let n=0;n<e.length;n++)this._types.add(e[n]);return this}hasProperty(e){switch(typeof e){case"object":return yy.hasProperty(this,this._container,e);default:return my.hasProperty(this,this._container,e)}}resolveProperty(e,n=!1){switch(typeof e){case"object":return yy.resolveProperty(this,this._container,e,n);default:return my.resolveProperty(this,this._container,e,n)}}setProperty(e,n){switch(typeof e){case"object":return yy.setProperty(this,this._container,e,n);default:return my.setProperty(this,this._container,e,n)}}extend(e){if(e===this)return this;this._isFromSignature=!1,this._signatureDefinitions.extend(e.signatureDefinitions),this.addTypes(Array.from(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(lo.SignatureDefinitionBaseType.Map);for(let r=0;r<n.length;r++){let i=n[r],s=e.getDefinition(i),o=new t({source:this._source,label:i,kind:s.getType().type===lo.SignatureDefinitionBaseType.Function?fo.CompletionItemKind.Function:fo.CompletionItemKind.Property,container:this._container,isFromSignature:!0});o.addSignatureType(s),this.setProperty(i,o)}return this}getAllIdentifier(){let e=new Map;for(let n of this._types){let r=this._container.getAllIdentifier(n);for(let i of r)e.set(...i)}return(0,FM.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({source:this._source,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 tE.ObjectSet(Array.from(this._signatureDefinitions,r=>r.copy())),types:new Set(this._types),returnEntity:this._returnEntity,values:e.values??this.values,definitions:e.definitions??this._definitions});return e.deepCopy&&(n._values=new Map(Array.from(this._values,([r,i])=>[r,i.copy({deepCopy:e.deepCopy,container:e.container,line:e.line,context:n,values:i.values})])),n._definitions=[...this._definitions]),n}};Ai.Entity=as});var _y=g(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.Scope=void 0;var ed=Wn(),us=os(),by=ja(),td=po(),vy=class t{get source(){return this._source}get definitions(){return[]}get signatureDefinitions(){return null}get kind(){return us.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(ed.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._source=e.source,this._container=e.container,this._parent=e.parent??null,this._globals=e.globals,this._locals=e.locals??new td.Entity({source:this._source,kind:us.CompletionItemKind.Constant,container:this._container,label:"locals"}).addType(ed.SignatureDefinitionBaseType.Map)}getIsa(){return null}hasIsa(){return!1}setCustomType(e,n){this._container.setCustomType(e,n)}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,td.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,td.resolveEntity)(this._container,r,n)}else if(this._globals.values.has(`i:${e}`)){let r=this._globals.values.get(`i:${e}`);return(0,td.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!")}addTypes(){throw new Error("Scope cannot get types 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:us.CompletionItemKind.Constant,line:-1}],["locals",{kind:us.CompletionItemKind.Constant,line:-1}],["outer",{kind:us.CompletionItemKind.Constant,line:-1}],...this._container.getAllIdentifier(ed.SignatureDefinitionBaseType.General)]);return this._locals!==this._globals&&(0,by.injectIdentifers)(e,this._globals),this._parent&&(0,by.injectIdentifers)(e,this._parent.locals),(0,by.injectIdentifers)(e,this._locals),this.isSelfAvailable()&&e.set("self",{kind:us.CompletionItemKind.Constant,line:-1}),this.isSuperAvailable()&&e.set("super",{kind:us.CompletionItemKind.Constant,line:-1}),e}isSelfAvailable(){return this._locals.context!=null&&this._locals.context.types.has(ed.SignatureDefinitionBaseType.Map)}isSuperAvailable(){return this.isSelfAvailable()&&this._locals.context.hasProperty("__isa")}toJSON(){return this._locals.toJSON()}copy(e={}){return new t({source:this._source,container:e.container??this._container,parent:this._parent.copy({container:e.container,deepCopy:!0}),globals:this._globals.copy({container:e.container,deepCopy:!0}),locals:this._locals.copy({...e,deepCopy:!0})})}};nd.Scope=vy});var ho=g(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.GreybelKeyword=void 0;var BM;(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"})(BM=Fa.GreybelKeyword||(Fa.GreybelKeyword={}))});var ky=g(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:!0});var cs=qe(),UM=ho(),Ty=class extends cs.LexerValidator{constructor(){super(...arguments),this.isKeyword=Set.prototype.has.bind(new Set([...Object.values(cs.Keyword),...Object.values(UM.GreybelKeyword)]))}isIdentifierStart(e){return super.isIdentifierStart(e)||e===cs.CharacterCode.HASH}isMultilineComment(e,n){return cs.CharacterCode.SLASH===e&&cs.CharacterCode.ASTERISK===n}isMultilineCommentEnd(e,n){return cs.CharacterCode.ASTERISK===e&&cs.CharacterCode.SLASH===n}isComment(e,n){return super.isComment(e,n)||this.isMultilineComment(e,n)}};Sy.default=Ty});var xy=g($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.CharacterCode=void 0;var HM;(function(t){t[t.VERTICAL_LINE=124]="VERTICAL_LINE",t[t.AMPERSAND=38]="AMPERSAND"})(HM=$a.CharacterCode||($a.CharacterCode={}))});var go=g(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.Operator=void 0;var WM;(function(t){t.BitwiseAnd="&",t.BitwiseOr="|",t.LeftShift="<<",t.RightShift=">>",t.UnsignedRightShift=">>>"})(WM=Ba.Operator||(Ba.Operator={}))});var Ey=g(Ua=>{"use strict";var GM=Ua&&Ua.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ua,"__esModule",{value:!0});var or=qe(),KM=GM(ky()),nE=xy(),rE=ho(),wy=go();function iE(t){let e=this.content[this.index];return this.index+=e.length,this.createPunctuator(e,t)}var rd=class t extends or.Lexer{constructor(e,n={}){n.validator=n.validator||new KM.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,o=n.offset,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++,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 or.ASTRange(new or.ASTPosition(r,s-o+1),new or.ASTPosition(n.line,n.index-a+3)));let c=n.content.slice(s+2,n.index);n.index+=2;let l=new or.Token({type:or.TokenType.Comment,value:c,line:r,lineStart:i,range:[n.tokenStart,n.index],offsetRange:[o,a],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(rE.GreybelKeyword.ImportWithComment,n.index)||n.content.startsWith(rE.GreybelKeyword.IncludeWithComment,n.index)?(n.index++,n.scanIdentifierOrKeyword(e)):r.isMultilineComment(n.codeAt(),n.codeAt(1))?n.scanMultilineComment(e):super.scanComment(e)}};Ua.default=rd;rd.greybelScanHandlers={[or.CharacterCode.ARROW_LEFT]:function(e){if(or.CharacterCode.ARROW_LEFT===this.codeAt(1))return this.scanPunctuator(wy.Operator.LeftShift,e)},[or.CharacterCode.ARROW_RIGHT]:function(e){if(or.CharacterCode.ARROW_RIGHT===this.codeAt(1))return or.CharacterCode.ARROW_RIGHT===this.codeAt(2)?this.scanPunctuator(wy.Operator.UnsignedRightShift,e):this.scanPunctuator(wy.Operator.RightShift,e)},[nE.CharacterCode.AMPERSAND]:iE,[nE.CharacterCode.VERTICAL_LINE]:iE}});var id=g(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.ASTType=void 0;var VM;(function(t){t.FeatureImportExpression="FeatureImportExpression",t.FeatureIncludeExpression="FeatureIncludeExpression",t.FeatureEnvarExpression="FeatureEnvarExpression",t.FeatureInjectExpression="FeatureInjectExpression",t.FeatureDebuggerExpression="FeatureDebuggerExpression",t.FeatureLineExpression="FeatureLineExpression",t.FeatureFileExpression="FeatureFileExpression"})(VM=Ha.ASTType||(Ha.ASTType={}))});var Oy=g(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.ASTChunkAdvanced=void 0;var zM=qe(),Ay=class t extends zM.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,range:this.range,scope:this.scope})}};sd.ASTChunkAdvanced=Ay});var My=g(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.ASTFeatureFileExpression=Gn.ASTFeatureInjectExpression=Gn.ASTFeatureEnvarExpression=Gn.ASTFeatureIncludeExpression=Gn.ASTFeatureImportExpression=void 0;var Wa=qe(),Ga=id(),Cy=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureImportExpression=Cy;var Ry=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureIncludeExpression=Ry;var Py=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureEnvarExpression=Py;var Dy=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureInjectExpression=Dy;var Iy=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureFileExpression=Iy});var qy=g(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.ASTFeatureInjectExpression=Nt.ASTFeatureIncludeExpression=Nt.ASTFeatureImportExpression=Nt.ASTFeatureFileExpression=Nt.ASTFeatureEnvarExpression=Nt.ASTChunkAdvanced=Nt.ASTType=Nt.ASTProvider=void 0;var Ly=qe(),sE=id(),XM=Oy(),Ka=My(),Ny=class extends Ly.ASTProvider{featureImportExpression(e){return new Ka.ASTFeatureImportExpression(e)}featureIncludeExpression(e){return new Ka.ASTFeatureIncludeExpression(e)}featureEnvarExpression(e){return new Ka.ASTFeatureEnvarExpression(e)}featureInjectExpression(e){return new Ka.ASTFeatureInjectExpression(e)}featureDebuggerExpression(e){return new Ly.ASTBase(sE.ASTType.FeatureDebuggerExpression,e)}featureLineExpression(e){return new Ly.ASTBase(sE.ASTType.FeatureLineExpression,e)}featureFileExpression(e){return new Ka.ASTFeatureFileExpression(e)}chunkAdvanced(e){return new XM.ASTChunkAdvanced(e)}};Nt.ASTProvider=Ny;var YM=id();Object.defineProperty(Nt,"ASTType",{enumerable:!0,get:function(){return YM.ASTType}});var JM=Oy();Object.defineProperty(Nt,"ASTChunkAdvanced",{enumerable:!0,get:function(){return JM.ASTChunkAdvanced}});var Va=My();Object.defineProperty(Nt,"ASTFeatureEnvarExpression",{enumerable:!0,get:function(){return Va.ASTFeatureEnvarExpression}});Object.defineProperty(Nt,"ASTFeatureFileExpression",{enumerable:!0,get:function(){return Va.ASTFeatureFileExpression}});Object.defineProperty(Nt,"ASTFeatureImportExpression",{enumerable:!0,get:function(){return Va.ASTFeatureImportExpression}});Object.defineProperty(Nt,"ASTFeatureIncludeExpression",{enumerable:!0,get:function(){return Va.ASTFeatureIncludeExpression}});Object.defineProperty(Nt,"ASTFeatureInjectExpression",{enumerable:!0,get:function(){return Va.ASTFeatureInjectExpression}})});var jy=g(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.SelectorGroups=gt.SelectorGroupType=gt.Selectors=gt.SelectorTypes=void 0;var He=qe(),od=ho(),za=go(),QM;(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"})(QM=gt.SelectorTypes||(gt.SelectorTypes={}));gt.Selectors=Object.assign(Object.assign({},He.Selectors),{From:(0,He.createSelector)({type:He.TokenType.Identifier,value:"from"}),Envar:(0,He.createSelector)({type:He.TokenType.Keyword,value:od.GreybelKeyword.Envar}),Inject:(0,He.createSelector)({type:He.TokenType.Keyword,value:od.GreybelKeyword.Inject}),Line:(0,He.createSelector)({type:He.TokenType.Keyword,value:od.GreybelKeyword.Line}),File:(0,He.createSelector)({type:He.TokenType.Keyword,value:od.GreybelKeyword.File}),LeftShift:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.LeftShift}),RightShift:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.RightShift}),UnsignedRightShift:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.UnsignedRightShift}),BitwiseOr:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.BitwiseOr}),BitwiseAnd:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.BitwiseAnd}),Escape:(0,He.createSelector)({type:He.TokenType.Punctuator,value:He.Operator.Escape})});var Kr;(function(t){t.MapSeparator="MapSeparator",t.ListSeparator="ListSeparator",t.PathSegmentEnd="PathSegmentEnd",t.BitwiseOperators="BitwiseOperators"})(Kr=gt.SelectorGroupType||(gt.SelectorGroupType={}));gt.SelectorGroups=Object.assign(Object.assign({},He.SelectorGroups),{[Kr.MapSeparator]:(0,He.createSelectorGroup)(Kr.MapSeparator,[gt.Selectors.MapSeperator,gt.Selectors.CRBracket]),[Kr.ListSeparator]:(0,He.createSelectorGroup)(Kr.ListSeparator,[gt.Selectors.MapSeperator,gt.Selectors.SRBracket]),[Kr.PathSegmentEnd]:(0,He.createSelectorGroup)(Kr.PathSegmentEnd,[gt.Selectors.EndOfLine,gt.Selectors.Comment,gt.Selectors.EndOfFile]),[Kr.BitwiseOperators]:(0,He.createSelectorGroup)(Kr.BitwiseOperators,[gt.Selectors.LeftShift,gt.Selectors.RightShift,gt.Selectors.UnsignedRightShift])})});var uE=g(Xa=>{"use strict";var ZM=Xa&&Xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xa,"__esModule",{value:!0});var gn=qe(),eL=ra(),oE=ca(),tL=ZM(Ey()),nL=qy(),ls=ho(),aE=go(),Fe=jy(),Fy=class extends gn.Parser{constructor(e,n={}){var r;n.lexer=n.lexer||new tL.default(e,{unsafe:n.unsafe,tabWidth:n.tabWidth}),n.astProvider=n.astProvider||new nL.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(Fe.Selectors.Comment(e.token)){let r=e.astProvider.comment({value:e.token.value,isMultiline:e.token.value.indexOf(`
|
107
|
+
*/`),[n]=e;if(n.tags.length>0){let{descriptions:r,args:i,returns:s,examples:o}=SM(n);return Y0.SignatureDefinitionFunction.parse({type:Y0.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}ss.enrichWithMetaInformation=kM});var oy=g(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.createResolveChain=void 0;var an=qe();function wi(t,e,n=null,r=!1){switch(t.type){case an.ASTType.ParenthesisExpression:{wi(t.expression,e,n);return}case an.ASTType.MemberExpression:{let i=t;wi(i.base,e),e.push({ref:t,getter:i.identifier,unary:n,isInCallExpression:r});return}case an.ASTType.IndexExpression:{let i=t;wi(i.base,e),e.push({ref:t,getter:i.index,unary:n,isInCallExpression:r});return}case an.ASTType.CallStatement:{wi(t.expression,e,n,!0);return}case an.ASTType.CallExpression:{wi(t.base,e,n,!0);return}case an.ASTType.NegationExpression:case an.ASTType.BinaryNegatedExpression:case an.ASTType.UnaryExpression:{let i=t;wi(i.argument,e,i);return}case an.ASTType.Identifier:{e.push({ref:t,getter:t,unary:n,isInCallExpression:r});return}case an.ASTType.NumericLiteral:case an.ASTType.StringLiteral:case an.ASTType.NilLiteral:case an.ASTType.MapConstructorExpression:case an.ASTType.ListConstructorExpression:{e.push({ref:t,value:t,unary:n,isInCallExpression:r});return}case an.ASTType.SliceExpression:wi(t.base,e),e.push({ref:t,unary:n,isInCallExpression:r})}}function xM(t){let e=[];return wi(t,e),e}Hl.createResolveChain=xM});var Z0=g(ay=>{function Q0(t,e){return t>e?1:-1}ay.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(Q0),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},ay.sortNumbers=Q0});var ly=g(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.ObjectSet=co.ObjectSetIterator=void 0;var uy=Z0(),Wl=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}}};co.ObjectSetIterator=Wl;var cy=class{constructor(e){let r=(e?Array.from(e):[]).map(i=>[(0,uy.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 Wl(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,uy.hash)(e);return this._map.set(n,e),this._first??(this._first=n),this._last=n,this}delete(e){let n=(0,uy.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()}};co.ObjectSet=cy});var dy=g(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=void 0;Gl.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 os=g(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.CompletionItemKind=void 0;var wM;(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"})(wM=qa.CompletionItemKind||(qa.CompletionItemKind={}))});var fy=g(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.isResolveChainItemWithValue=Ar.isResolveChainItemWithIdentifier=Ar.isResolveChainItemWithMember=Ar.isResolveChainItemWithIndex=void 0;var Ei=qe(),EM=t=>t!=null&&t.ref.type===Ei.ASTType.IndexExpression;Ar.isResolveChainItemWithIndex=EM;var AM=t=>t!=null&&t.ref.type===Ei.ASTType.MemberExpression;Ar.isResolveChainItemWithMember=AM;var OM=t=>t!=null&&t.ref.type===Ei.ASTType.Identifier;Ar.isResolveChainItemWithIdentifier=OM;var CM=t=>t!=null&&(t.ref.type===Ei.ASTType.NumericLiteral||t.ref.type===Ei.ASTType.StringLiteral||t.ref.type===Ei.ASTType.NilLiteral||t.ref.type===Ei.ASTType.MapConstructorExpression||t.ref.type===Ei.ASTType.ListConstructorExpression);Ar.isResolveChainItemWithValue=CM});var py=g(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.isSignatureDefinitionFunction=void 0;var RM=Wn(),PM=t=>t.getType().type===RM.SignatureDefinitionBaseType.Function;Kl.isSignatureDefinitionFunction=PM});var hy=g(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});Vl.aggregateEntity=void 0;var DM=t=>{let e=[],n=t;for(;n!=null;)e.push(n),n=n.getIsa();return e};Vl.aggregateEntity=DM});var ja=g(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.injectIdentifers=void 0;var IM=hy(),MM=(t,e)=>{let n=(0,IM.aggregateEntity)(e);for(let r=0;r<n.length;r++){let i=n[r];for(let[s,o]of i.values)if(s.startsWith("i:")){let a=s.slice(2);if(t.has(a))continue;t.set(a,{kind:o.kind,line:o.source===e.source?o.line:-1})}}};zl.injectIdentifers=MM});var Yl=g(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});Xl.isEligibleForProperties=void 0;var gy=Wn(),LM=t=>t.types.has(gy.SignatureDefinitionBaseType.Map)||t.types.has(gy.SignatureDefinitionBaseType.List)||t.types.has(gy.SignatureDefinitionBaseType.Any);Xl.isEligibleForProperties=LM});var Ql=g(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.lookupProperty=void 0;var NM=Yl(),qM=(t,e)=>{let n=t;for(;(0,NM.isEligibleForProperties)(n);){let r=n.values.get(`i:${e}`);if(r!=null)return r;let i=n.getIsa();if(i==null)break;n=i}return null};Jl.lookupProperty=qM});var po=g(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.Entity=Ai.resolveEntity=void 0;var lo=Wn(),fo=os(),jM=py(),FM=ja(),Zl=Yl(),eE=Ql(),tE=ly(),$M=(t,e,n=!1)=>{if(e.isCallable()&&!n){let r=e.getReturnEntity();if(r!==null)return r;let i=e.getCallableReturnTypes();return i?new as({source:e.source,kind:fo.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addTypes(i):new as({source:e.source,kind:fo.CompletionItemKind.Variable,container:t,label:e.label,context:e.context}).addType(lo.SignatureDefinitionBaseType.Any)}return e};Ai.resolveEntity=$M;var my={hasProperty(t,e,n){return!!(0,eE.lookupProperty)(t,n)||!t.isAPI()&&!!e.getDefinition(Array.from(t.types),n,!0)},resolveProperty(t,e,n,r=!1){let i=(0,eE.lookupProperty)(t,n)??null;return i==null?t.isAPI()?null:e.getDefinition(Array.from(t.types),n,r):(0,Ai.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Zl.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,definitions:[]})),!0}},yy={hasProperty(t,e,n){if(!(0,Zl.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,Zl.isEligibleForProperties)(t))return new as({source:t.source,kind:fo.CompletionItemKind.Variable,container:e,label:n.label,context:t}).addType(lo.SignatureDefinitionBaseType.Any);let i=new as({source:n.source,kind:fo.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(lo.SignatureDefinitionBaseType.Any),(0,Ai.resolveEntity)(e,i,r)},setProperty(t,e,n,r){if(!(0,Zl.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,definitions:[]}))}return!0}},as=class t{get source(){return this._source}get definitions(){return this._definitions}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._source=e.source,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 tE.ObjectSet,this._types=e.types??new Set,this._values=e.values??new Map,this._context=e.context??null,this._container=e.container,this._definitions=e.definitions??[],this._returnEntity=e.returnEntity??null}isFromSignature(){return this._isFromSignature}hasContext(){return this._context!=null&&!this._context.isAPI}getIsa(){return this._values.get("i:__isa")??null}hasIsa(){return this._values.has("i:__isa")}isAPI(){return this._isAPI}isCallable(){return this._types.has(lo.SignatureDefinitionBaseType.Function)}getCallableReturnTypes(){if(!this.isCallable())return null;let e=Array.from(this._signatureDefinitions).filter(n=>(0,jM.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){return this._types.add(e),this}addTypes(e){for(let n=0;n<e.length;n++)this._types.add(e[n]);return this}hasProperty(e){switch(typeof e){case"object":return yy.hasProperty(this,this._container,e);default:return my.hasProperty(this,this._container,e)}}resolveProperty(e,n=!1){switch(typeof e){case"object":return yy.resolveProperty(this,this._container,e,n);default:return my.resolveProperty(this,this._container,e,n)}}setProperty(e,n){switch(typeof e){case"object":return yy.setProperty(this,this._container,e,n);default:return my.setProperty(this,this._container,e,n)}}extend(e){if(e===this)return this;this._isFromSignature=!1,this._signatureDefinitions.extend(e.signatureDefinitions),this.addTypes(Array.from(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(lo.SignatureDefinitionBaseType.Map);for(let r=0;r<n.length;r++){let i=n[r],s=e.getDefinition(i),o=new t({source:this._source,label:i,kind:s.getType().type===lo.SignatureDefinitionBaseType.Function?fo.CompletionItemKind.Function:fo.CompletionItemKind.Property,container:this._container,isFromSignature:!0});o.addSignatureType(s),this.setProperty(i,o)}return this}getAllIdentifier(){let e=new Map;for(let n of this._types){let r=this._container.getAllIdentifier(n);for(let i of r)e.set(...i)}return(0,FM.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({source:e.source??this._source,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 tE.ObjectSet(Array.from(this._signatureDefinitions,r=>r.copy())),types:new Set(this._types),returnEntity:this._returnEntity,values:e.values??this.values,definitions:e.definitions??this._definitions});return e.deepCopy&&(n._values=new Map(Array.from(this._values,([r,i])=>[r,i.copy({deepCopy:e.deepCopy,container:e.container,line:e.line,context:n,values:i.values})])),n._definitions=[...this._definitions]),n}};Ai.Entity=as});var _y=g(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.Scope=void 0;var ed=Wn(),us=os(),by=ja(),td=po(),vy=class t{get source(){return this._source}get definitions(){return[]}get signatureDefinitions(){return null}get kind(){return us.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(ed.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._source=e.source,this._container=e.container,this._parent=e.parent??null,this._globals=e.globals,this._locals=e.locals??new td.Entity({source:this._source,kind:us.CompletionItemKind.Constant,container:this._container,label:"locals"}).addType(ed.SignatureDefinitionBaseType.Map)}getIsa(){return null}hasIsa(){return!1}setCustomType(e,n){this._container.setCustomType(e,n)}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,td.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,td.resolveEntity)(this._container,r,n)}else if(this._globals.values.has(`i:${e}`)){let r=this._globals.values.get(`i:${e}`);return(0,td.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!")}addTypes(){throw new Error("Scope cannot get types 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:us.CompletionItemKind.Constant,line:-1}],["locals",{kind:us.CompletionItemKind.Constant,line:-1}],["outer",{kind:us.CompletionItemKind.Constant,line:-1}],...this._container.getAllIdentifier(ed.SignatureDefinitionBaseType.General)]);return this._locals!==this._globals&&(0,by.injectIdentifers)(e,this._globals),this._parent&&(0,by.injectIdentifers)(e,this._parent.locals),(0,by.injectIdentifers)(e,this._locals),this.isSelfAvailable()&&e.set("self",{kind:us.CompletionItemKind.Constant,line:-1}),this.isSuperAvailable()&&e.set("super",{kind:us.CompletionItemKind.Constant,line:-1}),e}isSelfAvailable(){return this._locals.context!=null&&this._locals.context.types.has(ed.SignatureDefinitionBaseType.Map)}isSuperAvailable(){return this.isSelfAvailable()&&this._locals.context.hasProperty("__isa")}toJSON(){return this._locals.toJSON()}copy(e={}){return new t({source:this._source,container:e.container??this._container,parent:this._parent.copy({container:e.container,deepCopy:!0}),globals:this._globals.copy({container:e.container,deepCopy:!0}),locals:this._locals.copy({...e,deepCopy:!0})})}};nd.Scope=vy});var ho=g(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.GreybelKeyword=void 0;var BM;(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"})(BM=Fa.GreybelKeyword||(Fa.GreybelKeyword={}))});var ky=g(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:!0});var cs=qe(),UM=ho(),Ty=class extends cs.LexerValidator{constructor(){super(...arguments),this.isKeyword=Set.prototype.has.bind(new Set([...Object.values(cs.Keyword),...Object.values(UM.GreybelKeyword)]))}isIdentifierStart(e){return super.isIdentifierStart(e)||e===cs.CharacterCode.HASH}isMultilineComment(e,n){return cs.CharacterCode.SLASH===e&&cs.CharacterCode.ASTERISK===n}isMultilineCommentEnd(e,n){return cs.CharacterCode.ASTERISK===e&&cs.CharacterCode.SLASH===n}isComment(e,n){return super.isComment(e,n)||this.isMultilineComment(e,n)}};Sy.default=Ty});var xy=g($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.CharacterCode=void 0;var HM;(function(t){t[t.VERTICAL_LINE=124]="VERTICAL_LINE",t[t.AMPERSAND=38]="AMPERSAND"})(HM=$a.CharacterCode||($a.CharacterCode={}))});var go=g(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.Operator=void 0;var WM;(function(t){t.BitwiseAnd="&",t.BitwiseOr="|",t.LeftShift="<<",t.RightShift=">>",t.UnsignedRightShift=">>>"})(WM=Ba.Operator||(Ba.Operator={}))});var Ey=g(Ua=>{"use strict";var GM=Ua&&Ua.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ua,"__esModule",{value:!0});var or=qe(),KM=GM(ky()),nE=xy(),rE=ho(),wy=go();function iE(t){let e=this.content[this.index];return this.index+=e.length,this.createPunctuator(e,t)}var rd=class t extends or.Lexer{constructor(e,n={}){n.validator=n.validator||new KM.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,o=n.offset,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++,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 or.ASTRange(new or.ASTPosition(r,s-o+1),new or.ASTPosition(n.line,n.index-a+3)));let c=n.content.slice(s+2,n.index);n.index+=2;let l=new or.Token({type:or.TokenType.Comment,value:c,line:r,lineStart:i,range:[n.tokenStart,n.index],offsetRange:[o,a],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(rE.GreybelKeyword.ImportWithComment,n.index)||n.content.startsWith(rE.GreybelKeyword.IncludeWithComment,n.index)?(n.index++,n.scanIdentifierOrKeyword(e)):r.isMultilineComment(n.codeAt(),n.codeAt(1))?n.scanMultilineComment(e):super.scanComment(e)}};Ua.default=rd;rd.greybelScanHandlers={[or.CharacterCode.ARROW_LEFT]:function(e){if(or.CharacterCode.ARROW_LEFT===this.codeAt(1))return this.scanPunctuator(wy.Operator.LeftShift,e)},[or.CharacterCode.ARROW_RIGHT]:function(e){if(or.CharacterCode.ARROW_RIGHT===this.codeAt(1))return or.CharacterCode.ARROW_RIGHT===this.codeAt(2)?this.scanPunctuator(wy.Operator.UnsignedRightShift,e):this.scanPunctuator(wy.Operator.RightShift,e)},[nE.CharacterCode.AMPERSAND]:iE,[nE.CharacterCode.VERTICAL_LINE]:iE}});var id=g(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.ASTType=void 0;var VM;(function(t){t.FeatureImportExpression="FeatureImportExpression",t.FeatureIncludeExpression="FeatureIncludeExpression",t.FeatureEnvarExpression="FeatureEnvarExpression",t.FeatureInjectExpression="FeatureInjectExpression",t.FeatureDebuggerExpression="FeatureDebuggerExpression",t.FeatureLineExpression="FeatureLineExpression",t.FeatureFileExpression="FeatureFileExpression"})(VM=Ha.ASTType||(Ha.ASTType={}))});var Oy=g(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.ASTChunkAdvanced=void 0;var zM=qe(),Ay=class t extends zM.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,range:this.range,scope:this.scope})}};sd.ASTChunkAdvanced=Ay});var My=g(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.ASTFeatureFileExpression=Gn.ASTFeatureInjectExpression=Gn.ASTFeatureEnvarExpression=Gn.ASTFeatureIncludeExpression=Gn.ASTFeatureImportExpression=void 0;var Wa=qe(),Ga=id(),Cy=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureImportExpression=Cy;var Ry=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureIncludeExpression=Ry;var Py=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureEnvarExpression=Py;var Dy=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureInjectExpression=Dy;var Iy=class t extends Wa.ASTBase{constructor(e){super(Ga.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,range:this.range,scope:this.scope})}};Gn.ASTFeatureFileExpression=Iy});var qy=g(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.ASTFeatureInjectExpression=Nt.ASTFeatureIncludeExpression=Nt.ASTFeatureImportExpression=Nt.ASTFeatureFileExpression=Nt.ASTFeatureEnvarExpression=Nt.ASTChunkAdvanced=Nt.ASTType=Nt.ASTProvider=void 0;var Ly=qe(),sE=id(),XM=Oy(),Ka=My(),Ny=class extends Ly.ASTProvider{featureImportExpression(e){return new Ka.ASTFeatureImportExpression(e)}featureIncludeExpression(e){return new Ka.ASTFeatureIncludeExpression(e)}featureEnvarExpression(e){return new Ka.ASTFeatureEnvarExpression(e)}featureInjectExpression(e){return new Ka.ASTFeatureInjectExpression(e)}featureDebuggerExpression(e){return new Ly.ASTBase(sE.ASTType.FeatureDebuggerExpression,e)}featureLineExpression(e){return new Ly.ASTBase(sE.ASTType.FeatureLineExpression,e)}featureFileExpression(e){return new Ka.ASTFeatureFileExpression(e)}chunkAdvanced(e){return new XM.ASTChunkAdvanced(e)}};Nt.ASTProvider=Ny;var YM=id();Object.defineProperty(Nt,"ASTType",{enumerable:!0,get:function(){return YM.ASTType}});var JM=Oy();Object.defineProperty(Nt,"ASTChunkAdvanced",{enumerable:!0,get:function(){return JM.ASTChunkAdvanced}});var Va=My();Object.defineProperty(Nt,"ASTFeatureEnvarExpression",{enumerable:!0,get:function(){return Va.ASTFeatureEnvarExpression}});Object.defineProperty(Nt,"ASTFeatureFileExpression",{enumerable:!0,get:function(){return Va.ASTFeatureFileExpression}});Object.defineProperty(Nt,"ASTFeatureImportExpression",{enumerable:!0,get:function(){return Va.ASTFeatureImportExpression}});Object.defineProperty(Nt,"ASTFeatureIncludeExpression",{enumerable:!0,get:function(){return Va.ASTFeatureIncludeExpression}});Object.defineProperty(Nt,"ASTFeatureInjectExpression",{enumerable:!0,get:function(){return Va.ASTFeatureInjectExpression}})});var jy=g(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.SelectorGroups=gt.SelectorGroupType=gt.Selectors=gt.SelectorTypes=void 0;var He=qe(),od=ho(),za=go(),QM;(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"})(QM=gt.SelectorTypes||(gt.SelectorTypes={}));gt.Selectors=Object.assign(Object.assign({},He.Selectors),{From:(0,He.createSelector)({type:He.TokenType.Identifier,value:"from"}),Envar:(0,He.createSelector)({type:He.TokenType.Keyword,value:od.GreybelKeyword.Envar}),Inject:(0,He.createSelector)({type:He.TokenType.Keyword,value:od.GreybelKeyword.Inject}),Line:(0,He.createSelector)({type:He.TokenType.Keyword,value:od.GreybelKeyword.Line}),File:(0,He.createSelector)({type:He.TokenType.Keyword,value:od.GreybelKeyword.File}),LeftShift:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.LeftShift}),RightShift:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.RightShift}),UnsignedRightShift:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.UnsignedRightShift}),BitwiseOr:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.BitwiseOr}),BitwiseAnd:(0,He.createSelector)({type:He.TokenType.Punctuator,value:za.Operator.BitwiseAnd}),Escape:(0,He.createSelector)({type:He.TokenType.Punctuator,value:He.Operator.Escape})});var Kr;(function(t){t.MapSeparator="MapSeparator",t.ListSeparator="ListSeparator",t.PathSegmentEnd="PathSegmentEnd",t.BitwiseOperators="BitwiseOperators"})(Kr=gt.SelectorGroupType||(gt.SelectorGroupType={}));gt.SelectorGroups=Object.assign(Object.assign({},He.SelectorGroups),{[Kr.MapSeparator]:(0,He.createSelectorGroup)(Kr.MapSeparator,[gt.Selectors.MapSeperator,gt.Selectors.CRBracket]),[Kr.ListSeparator]:(0,He.createSelectorGroup)(Kr.ListSeparator,[gt.Selectors.MapSeperator,gt.Selectors.SRBracket]),[Kr.PathSegmentEnd]:(0,He.createSelectorGroup)(Kr.PathSegmentEnd,[gt.Selectors.EndOfLine,gt.Selectors.Comment,gt.Selectors.EndOfFile]),[Kr.BitwiseOperators]:(0,He.createSelectorGroup)(Kr.BitwiseOperators,[gt.Selectors.LeftShift,gt.Selectors.RightShift,gt.Selectors.UnsignedRightShift])})});var uE=g(Xa=>{"use strict";var ZM=Xa&&Xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xa,"__esModule",{value:!0});var gn=qe(),eL=ra(),oE=ca(),tL=ZM(Ey()),nL=qy(),ls=ho(),aE=go(),Fe=jy(),Fy=class extends gn.Parser{constructor(e,n={}){var r;n.lexer=n.lexer||new tL.default(e,{unsafe:n.unsafe,tabWidth:n.tabWidth}),n.astProvider=n.astProvider||new nL.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(Fe.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,range:e.token.range,scope:e.currentScope});e.addItemToLines(r),e.backpatches.peek().body.push(r)}else if(Fe.Selectors.EndOfLine(e.token))n++;else break;e.next()}return n}parseMap(e=!1,n=!1){let r=this;if(!Fe.Selectors.CLBracket(r.token))return r.parseList(e,n);let i=r.currentScope,s=r.token,o=[],a=r.astProvider.mapConstructorExpression({fields:o,start:s.start,end:null,range:[s.range[0],null],scope:i});if(r.next(),Fe.Selectors.CRBracket(r.token))r.next();else for(;!Fe.Selectors.EndOfFile(r.token);){if(r.skipNewlines(),Fe.Selectors.CRBracket(r.token)){r.next();break}let u=r.astProvider.mapKeyString({key:null,value:null,start:r.token.start,end:null,range:[r.token.range[0],null],scope:i});if(u.key=r.parseExpr(null),r.requireToken(Fe.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,range:[u.range[0],r.token.range[1]],scope:i}),init:null,start:u.start,end:null,range:[u.range[0],null]}),d=r.currentAssignment;r.currentAssignment=l,u.value=r.parseExpr(u),r.currentAssignment=d,l.init=u.value,l.end=r.previousToken.end,l.range[1]=r.previousToken.range[1],i.assignments.push(l)}else u.value=r.parseExpr(u);u.end=r.previousToken.end,u.range[1]=r.previousToken.range[1],o.push(u),r.skipNewlines();let c=r.requireTokenOfAny(Fe.SelectorGroups.MapSeparator,s.start);if(Fe.Selectors.CRBracket(c))break}return a.end=r.token.start,a.range[1]=r.token.range[1],a}parseList(e=!1,n=!1){let r=this;if(!Fe.Selectors.SLBracket(r.token))return r.parseQuantity(e,n);let i=r.currentScope,s=r.token,o=[],a=r.astProvider.listConstructorExpression({fields:o,start:s.start,end:null,range:[s.range[0],null],scope:i});if(r.next(),Fe.Selectors.SRBracket(r.token))r.next();else for(;!Fe.Selectors.EndOfFile(r.token);){if(r.skipNewlines(),Fe.Selectors.SRBracket(r.token)){r.next();break}let u=r.astProvider.listValue({value:null,start:r.token.start,end:null,range:[r.token.range[0],null],scope:i});if(r.currentAssignment){let l=r.astProvider.assignmentStatement({variable:r.astProvider.indexExpression({index:r.astProvider.literal(gn.TokenType.NumericLiteral,{value:o.length,raw:`${o.length}`,start:s.start,end:r.token.end,range:[s.range[0],r.token.range[1]],scope:i}),base:r.currentAssignment.variable,start:null,end:null,range:[null,null],scope:i}),init:null,start:null,end:null,range:[null,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.variable.range=[p.range[0],r.previousToken.range[1]],l.init=u.value,l.start=u.start,l.end=r.previousToken.end,l.range=[u.range[0],r.previousToken.range[1]],i.assignments.push(l)}else u.value=r.parseExpr(u);u.end=r.previousToken.end,u.range[1]=r.previousToken.range[1],o.push(u),r.skipNewlines();let c=r.requireTokenOfAny(Fe.SelectorGroups.ListSeparator,s.start);if(Fe.Selectors.SRBracket(c))break}return a.end=r.token.start,a.range[1]=r.token.range[1],a}parsePathSegment(){let e=this;if(this.token.type===gn.ASTType.StringLiteral){let r=this.token.value;return this.next(),r}let n="";for(;!Fe.SelectorGroups.PathSegmentEnd(e.token);)n=n+e.token.value,e.next();return e.consumeMany(Fe.SelectorGroups.PathSegmentEnd),n}parseFeatureIncludeStatement(){let e=this,n=e.previousToken,r=e.parsePathSegment(),i=e.astProvider.featureIncludeExpression({path:r,start:n.start,end:e.previousToken.end,range:[n.range[0],e.previousToken.range[1]],scope:e.currentScope});return e.includes.push(i),i}parseFeatureImportStatement(){var e;let n=this,r=n.previousToken,i=n.parseIdentifier();if(!n.consume(Fe.Selectors.From))return n.raise("expected from keyword",new oE.Range(r.start,new eL.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.start,end:n.previousToken.end,range:[r.range[0],n.previousToken.range[1]],scope:n.currentScope});n.imports.push(o);let a=n.astProvider.assignmentStatement({variable:i,init:n.astProvider.literal(gn.TokenType.NilLiteral,{value:null,raw:"null",start:i.start,end:i.end,range:i.range,scope:n.currentScope}),start:i.start,end:i.end,range:i.range,scope:n.currentScope});return n.currentScope.assignments.push(a),o}parseFeatureEnvarExpression(){let e=this,n=e.previousToken,r=e.token.value;return e.next(),e.astProvider.featureEnvarExpression({name:r,start:n.start,end:e.previousToken.end,range:[n.range[0],e.previousToken.range[1]],scope:e.currentScope})}parseFeatureInjectExpression(){let e=this,n=e.previousToken,r=this.parsePathSegment();e.next();let i=e.astProvider.featureInjectExpression({path:r,start:n.start,end:e.previousToken.end,range:[n.range[0],e.previousToken.range[1]],scope:e.currentScope});return e.injects.push(i),i}parseIsa(e=!1,n=!1){let r=this,i=r.token,s=r.parseBitwiseOr(e,n);if(Fe.Selectors.Isa(r.token)){r.next(),r.skipNewlines();let o=r.parseBitwiseOr();return r.astProvider.isaExpression({operator:gn.Operator.Isa,left:s,right:o,start:i.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return s}parseBitwiseOr(e=!1,n=!1){let r=this,i=r.token,o=r.parseBitwiseAnd(e,n);for(;Fe.Selectors.BitwiseOr(r.token);){r.next();let a=r.parseBitwiseAnd();o=r.astProvider.binaryExpression({operator:aE.Operator.BitwiseOr,left:o,right:a,start:i.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return o}parseBitwiseAnd(e=!1,n=!1){let r=this,i=r.token,o=r.parseComparisons(e,n);for(;Fe.Selectors.BitwiseAnd(r.token);){r.next();let a=r.parseComparisons();o=r.astProvider.binaryExpression({operator:aE.Operator.BitwiseAnd,left:o,right:a,start:i.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return o}parseAddSub(e=!1,n=!1){let r=this,i=r.token,o=r.parseBitwise(e,n);for(;Fe.Selectors.Plus(r.token)||Fe.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.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return o}parseBitwise(e=!1,n=!1){let r=this,i=r.token,o=r.parseMultDiv(e,n);for(;Fe.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.start,end:r.previousToken.end,range:[i.range[0],r.previousToken.range[1]],scope:r.currentScope})}return o}parseAtom(){let e=this;return Fe.Selectors.Envar(e.token)?(e.next(),e.parseFeatureEnvarExpression()):Fe.Selectors.Inject(e.token)?(e.next(),e.parseFeatureInjectExpression()):Fe.Selectors.Line(e.token)?(e.next(),e.astProvider.featureLineExpression({start:new gn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new gn.ASTPosition(e.previousToken.line,e.previousToken.end.character),range:e.previousToken.range,scope:e.currentScope})):Fe.Selectors.File(e.token)?(e.next(),e.astProvider.featureFileExpression({filename:e.filename,start:new gn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new gn.ASTPosition(e.previousToken.line,e.previousToken.end.character),range:e.previousToken.range,scope:e.currentScope})):super.parseAtom()}parseStatement(){let e=this,n=e.backpatches.peek();if(e.isType(gn.TokenType.Keyword))switch(e.token.value){case ls.GreybelKeyword.Include:case ls.GreybelKeyword.IncludeWithComment:{e.next();let i=e.parseFeatureIncludeStatement();e.addItemToLines(i),n.body.push(i);return}case ls.GreybelKeyword.Import:case ls.GreybelKeyword.ImportWithComment:{e.next();let i=e.parseFeatureImportStatement();e.addItemToLines(i),n.body.push(i);return}case ls.GreybelKeyword.Envar:{e.next();let i=e.parseFeatureEnvarExpression();e.addItemToLines(i),n.body.push(i);return}case ls.GreybelKeyword.Inject:{e.next();let i=e.parseFeatureInjectExpression();e.addItemToLines(i),n.body.push(i);return}case ls.GreybelKeyword.Debugger:{e.next();let i=e.astProvider.featureDebuggerExpression({start:new gn.ASTPosition(e.previousToken.line,e.previousToken.start.character),end:new gn.ASTPosition(e.previousToken.line,e.previousToken.end.character),range:e.previousToken.range,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,r=e.astProvider.chunkAdvanced({start:n.start,end:null,range:[n.range[0],null]}),i=new gn.PendingChunk(r);for(e.backpatches.setDefault(i),e.pushScope(r);!Fe.Selectors.EndOfFile(e.token)&&(e.skipNewlines(),!Fe.Selectors.EndOfFile(e.token));)e.lexer.recordSnapshot(),e.statementErrors=[],e.parseStatement(),e.statementErrors.length>0&&e.tryToRecover();let s=e.backpatches.pop();for(;!(0,gn.isPendingChunk)(s);){let o=e.raise(`found open block ${s.block.type}`,new oE.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}};Xa.default=Fy});var Or=g(Pt=>{"use strict";var rL=Pt&&Pt.__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]}),Ya=Pt&&Pt.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&rL(e,t,n)},$y=Pt&&Pt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.Parser=Pt.LexerValidator=Pt.Lexer=void 0;var iL=Ey();Object.defineProperty(Pt,"Lexer",{enumerable:!0,get:function(){return $y(iL).default}});var sL=ky();Object.defineProperty(Pt,"LexerValidator",{enumerable:!0,get:function(){return $y(sL).default}});var oL=uE();Object.defineProperty(Pt,"Parser",{enumerable:!0,get:function(){return $y(oL).default}});Ya(qy(),Pt);Ya(xy(),Pt);Ya(ho(),Pt);Ya(go(),Pt);Ya(jy(),Pt)});var By=g(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.merge=void 0;function aL(t,e,n=1e4){if(e.length<=n){Array.prototype.push.apply(t,e);return}for(let r=0;r<e.length;r+=n)Array.prototype.push.apply(t,e.slice(r,r+n))}ad.merge=aL});var cE=g(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});ud.mergeUnique=void 0;function uL(t,e,n=1e4){let r=Array.from(new Set([...t,...e]));if(t.length=0,r.length<=n){Array.prototype.push.apply(t,r);return}for(let i=0;i<r.length;i+=n)Array.prototype.push.apply(t,r.slice(i,i+n))}ud.mergeUnique=uL});var lE=g(cd=>{"use strict";Object.defineProperty(cd,"__esModule",{value:!0});cd.parseMapDescription=void 0;var cL=iy();function lL(t){return{path:t.name,type:t.type}}function dL(t){let e=t.tags.find(r=>r.tag==="type");if(!e)return null;let n=t.tags.filter(r=>r.tag==="property");return{type:e.name,properties:n.map(lL)}}function fL(t){let e=(0,cL.parse)(`/**
|
109
109
|
${t}
|
110
110
|
*/`),[n]=e;return n.tags.length>0?dL(n):null}cd.parseMapDescription=fL});var Hy=g(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.Aggregator=void 0;var ld=Or(),Me=Wn(),Oe=qe(),pL=dy(),we=os(),ds=fy(),dE=Bm(),hL=sy(),fE=oy(),pE=Ca(),hE=By(),gL=cE(),mL=lE(),yL=po(),Uy=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,this._lastModifiedProperty=null}factory(e){return new yL.Entity({source:this._document.source,kind:e,container:this._document.container})}createMapDescription(e){let n=this._document.getLastASTItemOfLine(e.start.line-1),r=this._document.findASTItemInLine(e.start.line,Oe.ASTType.Comment);if(n instanceof Oe.ASTComment){let i=new Set,s=[],o=e.start.line-1;for(;o>=0;){let a=this._document.getLastASTItemOfLine(o--);if(!i.has(a))if(a instanceof Oe.ASTComment)i.add(a),s.unshift(a.value);else break}return s.join(`
|
111
111
|
`)}else if(r instanceof Oe.ASTComment)return r.value;return null}createCustomTypeFromMap(e,n){let r=this.createMapDescription(e);if(r==null)return;let i=(0,mL.parseMapDescription)(r);i!=null&&(i.properties.forEach(s=>{if(s.path==="__isa")return;let o=s.path.split("."),a=this.factory(we.CompletionItemKind.Property).addType(s.type).setLabel(o[o.length-1]);this.setEntityInPath(n,o,a)}),this._scope.setCustomType(i.type,n))}createFunctionDescription(e,n=pL.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION){let r=this._document.getLastASTItemOfLine(e.start.line-1),i=this._document.findASTItemInLine(e.start.line,Oe.ASTType.Comment);if(r instanceof Oe.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 Oe.ASTComment)s.add(u),o.unshift(u.value);else break}return o.join(`
|
112
112
|
|
113
|
-
`)}else if(i instanceof Oe.ASTComment)return i.value;return n}resolveFunctionStatement(e){let n=Me.SignatureDefinitionFunction.parse({type:Me.SignatureDefinitionBaseType.Function,description:this.createFunctionDescription(e),arguments:e.parameters.map(r=>{if(r.type===Oe.ASTType.Identifier)return{label:r.name??"unknown",type:Me.SignatureDefinitionBaseType.Any};let i=r;return{label:i.variable?.name??"unknown",types:Array.from(this.resolveTypeWithDefault(i.init).types)}}),returns:["any"]});return this.factory(we.CompletionItemKind.Function).addType(Me.SignatureDefinitionBaseType.Function).addSignatureType((0,hL.enrichWithMetaInformation)(n)).setLine(e.start.line)}resolveParenthesisExpression(e){return this.resolveTypeWithDefault(e.expression)}resolveBinaryExpression(e){let n=this.factory(we.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(we.CompletionItemKind.Expression).setLabel("Logical Expr").addType(Me.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveComparisonGroupExpression(e){return this.factory(we.CompletionItemKind.Expression).setLabel("Comparison Group Expr").addType(Me.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveIsaExpression(e){return this.factory(we.CompletionItemKind.Expression).setLabel("Isa Expr").addType(Me.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveCallStatement(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveCallExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveUnaryExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveMapConstructorExpression(e){let n=this.factory(we.CompletionItemKind.MapConstructor).addType(Me.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===Oe.ASTType.StringLiteral){let o=i.key.value.toString();n.setProperty(o,s),n.values.get(`i:${o}`)?.definitions.push({source:this._document.source,node:i})}else{let o=this.resolveTypeWithDefault(i.key).setLine(i.start.line);n.setProperty(o,s)}}return this.createCustomTypeFromMap(e,n),n.setLabel("{}").setLine(e.start.line)}resolveListConstructorExpression(e){let n=this.factory(we.CompletionItemKind.ListConstructor).addType(Me.SignatureDefinitionBaseType.List);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.factory(we.CompletionItemKind.Variable).addType(Me.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);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):n.setLine(e.start.line)}resolveIndexExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):r}resolveMemberExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(we.CompletionItemKind.Property).addType(Me.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(we.CompletionItemKind.Property).addType(Me.SignatureDefinitionBaseType.Any).setLabel(e.name).setLine(e.start.line):r}resolveType(e,n=!1){if(e==null)return null;switch(e.type){case Oe.ASTType.ParenthesisExpression:return this.resolveParenthesisExpression(e);case Oe.ASTType.CallStatement:return this.resolveCallStatement(e);case Oe.ASTType.CallExpression:return this.resolveCallExpression(e);case Oe.ASTType.BinaryExpression:return this.resolveBinaryExpression(e);case Oe.ASTType.LogicalExpression:return this.resolveLogicalExpression(e);case Oe.ASTType.IsaExpression:return this.resolveIsaExpression(e);case Oe.ASTType.ComparisonGroupExpression:return this.resolveComparisonGroupExpression(e);case Oe.ASTType.FunctionDeclaration:return this.resolveFunctionStatement(e);case Oe.ASTType.SliceExpression:return this.resolveSliceExpression(e);case Oe.ASTType.IndexExpression:return this.resolveIndexExpression(e,n);case Oe.ASTType.MemberExpression:return this.resolveMemberExpression(e,n);case Oe.ASTType.Identifier:return this.resolveIdentifier(e,n);case Oe.ASTType.MapConstructorExpression:return this.resolveMapConstructorExpression(e);case Oe.ASTType.ListConstructorExpression:return this.resolveListConstructorExpression(e);case Oe.ASTType.NegationExpression:case Oe.ASTType.BinaryNegatedExpression:case Oe.ASTType.UnaryExpression:return this.resolveUnaryExpression(e);case Oe.ASTType.NilLiteral:return this.factory(we.CompletionItemKind.Literal).addType("null").setLabel("null").setLine(e.start.line);case Oe.ASTType.StringLiteral:{let r=e.value.toString();return this.factory(we.CompletionItemKind.Literal).addType(Me.SignatureDefinitionBaseType.String).setLabel(`"${r.length>20?r.substr(0,20)+"...":r}"`).setLine(e.start.line)}case Oe.ASTType.NumericLiteral:case Oe.ASTType.BooleanLiteral:{let r=e.value.toString();return this.factory(we.CompletionItemKind.Literal).addType(Me.SignatureDefinitionBaseType.Number).setLabel(r).setLine(e.start.line)}case ld.ASTType.FeatureFileExpression:return this.factory(we.CompletionItemKind.Expression).addType(Me.SignatureDefinitionBaseType.String).setLabel("File Expr").setLine(e.start.line);case ld.ASTType.FeatureLineExpression:return this.factory(we.CompletionItemKind.Expression).addType(Me.SignatureDefinitionBaseType.Number).setLabel("Line Expr").setLine(e.start.line);case ld.ASTType.FeatureEnvarExpression:return this.factory(we.CompletionItemKind.Expression).addType(Me.SignatureDefinitionBaseType.String).setLabel("Envar Expr").setLine(e.start.line);case ld.ASTType.FeatureInjectExpression:return this.factory(we.CompletionItemKind.Expression).addType(Me.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(we.CompletionItemKind.Variable).addType(Me.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,ds.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?.getIsa();a==null?r=this.factory(we.CompletionItemKind.Constant).addType("null").setLabel("super"):r=a.copy({kind:we.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(we.CompletionItemKind.Constant).addType("null").setLabel("self"):r=a.copy({kind:we.CompletionItemKind.Constant,label:"self",values:a.values})}else r=this._scope.resolveNamespace(i.getter.name,s)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLabel(i.getter.name);else if((0,ds.isResolveChainItemWithValue)(i))r=this.resolveTypeWithDefault(i.value,s);else return null;if(i.unary?.operator===Oe.Keyword.New&&r!==null){let a=this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Map).setLabel(r.label);a.setProperty("__isa",r),this.createCustomTypeFromMap(i.unary,a),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,ds.isResolveChainItemWithMember)(u))r=r.resolveProperty(u.getter.name,c)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLabel(u.getter.name);else if((0,ds.isResolveChainItemWithIndex)(u))if((0,pE.isValidIdentifierLiteral)(u.getter)){let l=u.getter.value.toString();r=r.resolveProperty(l,u.isInCallExpression)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLabel(l)}else{let l=this.resolveTypeWithDefault(u.getter);r=r.resolveProperty(l,u.isInCallExpression)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any)}else if(u.ref.type===Oe.ASTType.SliceExpression)r=r.copy();else return null;if(u.unary?.operator===Oe.Keyword.New&&r!==null){let l=this.factory(we.CompletionItemKind.Property).addType(Me.SignatureDefinitionBaseType.Map).setLabel(r.label);l.setProperty("__isa",r),this.createCustomTypeFromMap(u.unary,l),r=l}}return r}setEntityInPath(e,n,r){let i=e;for(let s=0;s<n.length-1;s++){let o=n[s],a=i.resolveProperty(o);if(a==null){let u=this.factory(we.CompletionItemKind.Property).addType(Me.SignatureDefinitionBaseType.Map).setLabel(o);i.setProperty(o,u),a=u}i=a}return i.setProperty(n[n.length-1],r)}getEntityInPath(e,n){let r=e;for(let i=0;i<n.length;i++){let s=n[i],o=r.resolveProperty(s);if(o==null)return null;r=o}return r}resolveNamespace(e,n=!1){let r=(0,fE.createResolveChain)(e);return this.resolveChain(r,n)}defineProperty(e,n,r){let i=e.setProperty(n,r);return this._lastModifiedProperty=e.resolveProperty(n,!0),i}defineNamespace(e,n){let r=(0,fE.createResolveChain)(e),i=r.pop();if(this._lastModifiedProperty=null,r.length>0){let o=this.resolveChain(r);if(o===null)return!1;if((0,ds.isResolveChainItemWithMember)(i))return this.defineProperty(o,i.getter.name,n);if((0,ds.isResolveChainItemWithIndex)(i)){if((0,pE.isValidIdentifierLiteral)(i.getter))return this.defineProperty(o,i.getter.value.toString(),n);{let a=this.resolveTypeWithDefault(i.getter);return this.defineProperty(o,a,n)}}return!1}let s=this._scope;return(0,ds.isResolveChainItemWithIdentifier)(i)?this.defineProperty(s,i.getter.name,n):!1}addDefinition(e){this._lastModifiedProperty?.definitions.push({source:this._document.source,node:e});let n=(0,dE.createExpressionId)(e.variable),r=this._definitions;n.startsWith("globals.")?(r=this._document.getRootScopeContext().aggregator.definitions,n=n.slice(8)):n.startsWith("locals.")?(r=this._definitions,n=n.slice(7)):n.startsWith("outer.")&&(r=this.parent.definitions,n=n.slice(6));let i=r.get(n);i?i.push({source:this._document.source,node:e}):r.set(n,[{source:this._document.source,node:e}])}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);(0,hE.merge)(n,a)}}return n}resolveAvailableAssignments(e){let n=(0,dE.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.resolveNamespace(e,!0);a!=null&&(0,hE.merge)(i,a.definitions)}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(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(n.start.line);this.defineNamespace(n.variable,r),this.addDefinition(n)}}extend(e){for(let[n,r]of e.definitions){let i=this.definitions.get(n);i?(0,gL.mergeUnique)(i,r):this.definitions.set(n,r)}}};dd.Aggregator=Uy});var Gy=g(fd=>{"use strict";Object.defineProperty(fd,"__esModule",{value:!0});fd.Document=void 0;var Vr=Wn(),bL=qe(),gE=os(),vL=By(),mE=Hy(),yE=po(),bE=_y(),Wy=class t{get source(){return this._source}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._source=e.source,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(Vr.SignatureDefinitionBaseType.Map),funcRef:this._container.primitives.get(Vr.SignatureDefinitionBaseType.Function),number:this._container.primitives.get(Vr.SignatureDefinitionBaseType.Number),string:this._container.primitives.get(Vr.SignatureDefinitionBaseType.String),list:this._container.primitives.get(Vr.SignatureDefinitionBaseType.List)}}initApi(){let e=this._container.primitives.get(Vr.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 yE.Entity({source:this._source,kind:gE.CompletionItemKind.Constant,container:this._container,label:"globals"}).addType(Vr.SignatureDefinitionBaseType.Map)}analyzeScope(e){let n=this._scopeMapping.get(e.scope),r=new bE.Scope({source:this._source,container:this._container,parent:n?.scope,globals:this._globals}),i=new mE.Aggregator({scope:r,root:e,document:this,parent:n?.aggregator});this._scopeMapping.set(e,{scope:r,aggregator:i});let s=e.assignment instanceof bL.ASTAssignmentStatement?this.resolveNamespace(e.assignment.variable,!0):null;if(s!==null){let o=s?.context;o!=null&&o.types.has(Vr.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 yE.Entity({source:this._source,kind:gE.CompletionItemKind.Variable,container:this._container}).addTypes(d)):(l.types.delete(Vr.SignatureDefinitionBaseType.Any),l.addTypes(d))}}}}analyze(){let e=new bE.Scope({source:this._source,container:this._container,globals:this._globals,locals:this._globals}),n=new mE.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);(0,vL.merge)(n,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({source:this._source,root:this._root,container:this._container.copy()});for(let r=0;r<e.length;r++){let i=e[r];n._globals.extend(i._globals),n._intrinscis.map.extend(i._intrinscis.map),n._intrinscis.funcRef.extend(i._intrinscis.funcRef),n._intrinscis.number.extend(i._intrinscis.number),n._intrinscis.string.extend(i._intrinscis.string),n._intrinscis.list.extend(i._intrinscis.list),n._container.mergeCustomTypes(i._container)}n.analyze();for(let r=0;r<e.length;r++){let i=e[r];n.getRootScopeContext().aggregator.extend(i.getRootScopeContext().aggregator)}return n}};fd.Document=Wy});var zy=g(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});pd.ContainerProxy=void 0;var ar=Wn(),Oi=po(),vE=os(),_E=ja(),Ky=Ql(),Vy=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(),this._customTypes=new Set}createPrimitives(){let e=new Map;for(let[n,r]of this._container.getPrimitives()){let i=new Oi.Entity({source:"internal",kind:vE.CompletionItemKind.Constant,container:this,isAPI:n===ar.SignatureDefinitionBaseType.General}).addType(ar.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 Oi.Entity({source:"internal",kind:vE.CompletionItemKind.Constant,container:this}).addType(ar.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}setCustomType(e,n){this._types.has(e)||(this._types.set(e,n),this._customTypes.add(e))}mergeCustomTypes(e){for(let n of e._customTypes){let r=e._types.get(n);r!=null&&this.setCustomType(n,r.copy({deepCopy:!0}))}}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(ar.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,Ky.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,Ky.lookupProperty)(this._primitives.get(ar.SignatureDefinitionBaseType.Any),n);if(e.includes(ar.SignatureDefinitionBaseType.Any)&&i)return(0,Oi.resolveEntity)(this,i,r);let s=this.searchDefinitionMatches(e,n);return s.size===0?null:s.size===1?(0,Oi.resolveEntity)(this,s.values().next().value,r):s.has(ar.SignatureDefinitionBaseType.Any)?(0,Oi.resolveEntity)(this,s.get(ar.SignatureDefinitionBaseType.Any),r):i!==null?(0,Oi.resolveEntity)(this,i,r):(0,Oi.resolveEntity)(this,s.values().next().value,r)}getGeneralDefinition(e,n=!1){let r=(0,Ky.lookupProperty)(this._primitives.get(ar.SignatureDefinitionBaseType.General),e);return r==null?null:(0,Oi.resolveEntity)(this,r,n)}injectTypeIdentifiers(e,n){let r=this.getTypeSignature(n);if(r!=null&&((0,_E.injectIdentifers)(e,r),this._types.has(n))){let i=this._primitives.get(ar.SignatureDefinitionBaseType.Map);(0,_E.injectIdentifers)(e,i)}}getAllIdentifier(e){let n=new Map;if(e===ar.SignatureDefinitionBaseType.Any){let r=this._container.getAllVisibleTypes();for(let i=0;i<r.length;i++)this.injectTypeIdentifiers(n,r[i]);return n}return this.injectTypeIdentifiers(n,e),n}copy(){return new t({container:this._container})}};pd.ContainerProxy=Vy});var TE=g(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});hd.TypeManager=void 0;var _L=Gy(),TL=zy(),Xy=class{constructor(e){this._container=new TL.ContainerProxy({container:e.container}),this._types=new Map}analyze(e,n){let r=new _L.Document({source:e,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}};hd.TypeManager=Xy});var Ja=g(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.TypeManager=se.ContainerProxy=se.Document=se.Aggregator=se.Scope=se.Entity=se.aggregateEntity=se.lookupProperty=se.isEligibleForProperties=se.injectIdentifers=se.isSignatureDefinitionFunction=se.isResolveChainItemWithValue=se.isResolveChainItemWithMember=se.isResolveChainItemWithIndex=se.isResolveChainItemWithIdentifier=se.CompletionItemKind=se.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=se.ObjectSetIterator=se.ObjectSet=se.rotateBits=se.getStringHashCode=se.getHashCode=se.createResolveChain=se.enrichWithMetaInformation=se.createExpressionId=se.createExpressionHash=se.isValidIdentifierLiteral=void 0;var SL=Ca();Object.defineProperty(se,"isValidIdentifierLiteral",{enumerable:!0,get:function(){return SL.isValidIdentifierLiteral}});var kL=I0();Object.defineProperty(se,"createExpressionHash",{enumerable:!0,get:function(){return kL.createExpressionHash}});var xL=Bm();Object.defineProperty(se,"createExpressionId",{enumerable:!0,get:function(){return xL.createExpressionId}});var wL=sy();Object.defineProperty(se,"enrichWithMetaInformation",{enumerable:!0,get:function(){return wL.enrichWithMetaInformation}});var EL=oy();Object.defineProperty(se,"createResolveChain",{enumerable:!0,get:function(){return EL.createResolveChain}});var Yy=$m();Object.defineProperty(se,"getHashCode",{enumerable:!0,get:function(){return Yy.getHashCode}});Object.defineProperty(se,"getStringHashCode",{enumerable:!0,get:function(){return Yy.getStringHashCode}});Object.defineProperty(se,"rotateBits",{enumerable:!0,get:function(){return Yy.rotateBits}});var SE=ly();Object.defineProperty(se,"ObjectSet",{enumerable:!0,get:function(){return SE.ObjectSet}});Object.defineProperty(se,"ObjectSetIterator",{enumerable:!0,get:function(){return SE.ObjectSetIterator}});var AL=dy();Object.defineProperty(se,"DEFAULT_CUSTOM_FUNCTION_DESCRIPTION",{enumerable:!0,get:function(){return AL.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION}});var OL=os();Object.defineProperty(se,"CompletionItemKind",{enumerable:!0,get:function(){return OL.CompletionItemKind}});var gd=fy();Object.defineProperty(se,"isResolveChainItemWithIdentifier",{enumerable:!0,get:function(){return gd.isResolveChainItemWithIdentifier}});Object.defineProperty(se,"isResolveChainItemWithIndex",{enumerable:!0,get:function(){return gd.isResolveChainItemWithIndex}});Object.defineProperty(se,"isResolveChainItemWithMember",{enumerable:!0,get:function(){return gd.isResolveChainItemWithMember}});Object.defineProperty(se,"isResolveChainItemWithValue",{enumerable:!0,get:function(){return gd.isResolveChainItemWithValue}});var CL=py();Object.defineProperty(se,"isSignatureDefinitionFunction",{enumerable:!0,get:function(){return CL.isSignatureDefinitionFunction}});var RL=ja();Object.defineProperty(se,"injectIdentifers",{enumerable:!0,get:function(){return RL.injectIdentifers}});var PL=Yl();Object.defineProperty(se,"isEligibleForProperties",{enumerable:!0,get:function(){return PL.isEligibleForProperties}});var DL=Ql();Object.defineProperty(se,"lookupProperty",{enumerable:!0,get:function(){return DL.lookupProperty}});var IL=hy();Object.defineProperty(se,"aggregateEntity",{enumerable:!0,get:function(){return IL.aggregateEntity}});var ML=po();Object.defineProperty(se,"Entity",{enumerable:!0,get:function(){return ML.Entity}});var LL=_y();Object.defineProperty(se,"Scope",{enumerable:!0,get:function(){return LL.Scope}});var NL=Hy();Object.defineProperty(se,"Aggregator",{enumerable:!0,get:function(){return NL.Aggregator}});var qL=Gy();Object.defineProperty(se,"Document",{enumerable:!0,get:function(){return qL.Document}});var jL=zy();Object.defineProperty(se,"ContainerProxy",{enumerable:!0,get:function(){return jL.ContainerProxy}});var FL=TE();Object.defineProperty(se,"TypeManager",{enumerable:!0,get:function(){return FL.TypeManager}})});var Qy=g(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.findEx=void 0;var $L=qe(),BL=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:()=>{}}},Jy=class{constructor(e){this.map=BL(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 UL(t,e){let n=[];return new Jy((i,s)=>{let o=t(i,s)||{};return o.valid&&i.type!==$L.ASTType.InvalidCodeExpression&&n.push(i),{exit:!!o.exit,skip:!!o.skip}}).visit(e),n}md.findEx=UL});var kE=g((KU,HL)=>{HL.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 xE=g((VU,WL)=>{WL.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:
|
113
|
+
`)}else if(i instanceof Oe.ASTComment)return i.value;return n}resolveFunctionStatement(e){let n=Me.SignatureDefinitionFunction.parse({type:Me.SignatureDefinitionBaseType.Function,description:this.createFunctionDescription(e),arguments:e.parameters.map(r=>{if(r.type===Oe.ASTType.Identifier)return{label:r.name??"unknown",type:Me.SignatureDefinitionBaseType.Any};let i=r;return{label:i.variable?.name??"unknown",types:Array.from(this.resolveTypeWithDefault(i.init).types)}}),returns:["any"]});return this.factory(we.CompletionItemKind.Function).addType(Me.SignatureDefinitionBaseType.Function).addSignatureType((0,hL.enrichWithMetaInformation)(n)).setLine(e.start.line)}resolveParenthesisExpression(e){return this.resolveTypeWithDefault(e.expression)}resolveBinaryExpression(e){let n=this.factory(we.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(we.CompletionItemKind.Expression).setLabel("Logical Expr").addType(Me.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveComparisonGroupExpression(e){return this.factory(we.CompletionItemKind.Expression).setLabel("Comparison Group Expr").addType(Me.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveIsaExpression(e){return this.factory(we.CompletionItemKind.Expression).setLabel("Isa Expr").addType(Me.SignatureDefinitionBaseType.Number).setLine(e.start.line)}resolveCallStatement(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveCallExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveUnaryExpression(e){let n=this.resolveNamespace(e);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):n}resolveMapConstructorExpression(e){let n=this.factory(we.CompletionItemKind.MapConstructor).addType(Me.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===Oe.ASTType.StringLiteral){let o=i.key.value.toString();n.setProperty(o,s),n.values.get(`i:${o}`)?.definitions.push({source:this._document.source,node:i})}else{let o=this.resolveTypeWithDefault(i.key).setLine(i.start.line);n.setProperty(o,s)}}return this.createCustomTypeFromMap(e,n),n.setLabel("{}").setLine(e.start.line)}resolveListConstructorExpression(e){let n=this.factory(we.CompletionItemKind.ListConstructor).addType(Me.SignatureDefinitionBaseType.List);for(let r=0;r<e.fields.length;r++){let i=e.fields[r],s=this.factory(we.CompletionItemKind.Variable).addType(Me.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);return n===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):n.setLine(e.start.line)}resolveIndexExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(e.start.line):r}resolveMemberExpression(e,n=!1){let r=this.resolveNamespace(e,n);return r===null?this.factory(we.CompletionItemKind.Property).addType(Me.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(we.CompletionItemKind.Property).addType(Me.SignatureDefinitionBaseType.Any).setLabel(e.name).setLine(e.start.line):r}resolveType(e,n=!1){if(e==null)return null;switch(e.type){case Oe.ASTType.ParenthesisExpression:return this.resolveParenthesisExpression(e);case Oe.ASTType.CallStatement:return this.resolveCallStatement(e);case Oe.ASTType.CallExpression:return this.resolveCallExpression(e);case Oe.ASTType.BinaryExpression:return this.resolveBinaryExpression(e);case Oe.ASTType.LogicalExpression:return this.resolveLogicalExpression(e);case Oe.ASTType.IsaExpression:return this.resolveIsaExpression(e);case Oe.ASTType.ComparisonGroupExpression:return this.resolveComparisonGroupExpression(e);case Oe.ASTType.FunctionDeclaration:return this.resolveFunctionStatement(e);case Oe.ASTType.SliceExpression:return this.resolveSliceExpression(e);case Oe.ASTType.IndexExpression:return this.resolveIndexExpression(e,n);case Oe.ASTType.MemberExpression:return this.resolveMemberExpression(e,n);case Oe.ASTType.Identifier:return this.resolveIdentifier(e,n);case Oe.ASTType.MapConstructorExpression:return this.resolveMapConstructorExpression(e);case Oe.ASTType.ListConstructorExpression:return this.resolveListConstructorExpression(e);case Oe.ASTType.NegationExpression:case Oe.ASTType.BinaryNegatedExpression:case Oe.ASTType.UnaryExpression:return this.resolveUnaryExpression(e);case Oe.ASTType.NilLiteral:return this.factory(we.CompletionItemKind.Literal).addType("null").setLabel("null").setLine(e.start.line);case Oe.ASTType.StringLiteral:{let r=e.value.toString();return this.factory(we.CompletionItemKind.Literal).addType(Me.SignatureDefinitionBaseType.String).setLabel(`"${r.length>20?r.substr(0,20)+"...":r}"`).setLine(e.start.line)}case Oe.ASTType.NumericLiteral:case Oe.ASTType.BooleanLiteral:{let r=e.value.toString();return this.factory(we.CompletionItemKind.Literal).addType(Me.SignatureDefinitionBaseType.Number).setLabel(r).setLine(e.start.line)}case ld.ASTType.FeatureFileExpression:return this.factory(we.CompletionItemKind.Expression).addType(Me.SignatureDefinitionBaseType.String).setLabel("File Expr").setLine(e.start.line);case ld.ASTType.FeatureLineExpression:return this.factory(we.CompletionItemKind.Expression).addType(Me.SignatureDefinitionBaseType.Number).setLabel("Line Expr").setLine(e.start.line);case ld.ASTType.FeatureEnvarExpression:return this.factory(we.CompletionItemKind.Expression).addType(Me.SignatureDefinitionBaseType.String).setLabel("Envar Expr").setLine(e.start.line);case ld.ASTType.FeatureInjectExpression:return this.factory(we.CompletionItemKind.Expression).addType(Me.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(we.CompletionItemKind.Variable).addType(Me.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,ds.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?.getIsa();a==null?r=this.factory(we.CompletionItemKind.Constant).addType("null").setLabel("super"):r=a.copy({kind:we.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(we.CompletionItemKind.Constant).addType("null").setLabel("self"):r=a.copy({kind:we.CompletionItemKind.Constant,label:"self",values:a.values})}else r=this._scope.resolveNamespace(i.getter.name,s)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLabel(i.getter.name);else if((0,ds.isResolveChainItemWithValue)(i))r=this.resolveTypeWithDefault(i.value,s);else return null;if(i.unary?.operator===Oe.Keyword.New&&r!==null){let a=this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Map).setLabel(r.label);a.setProperty("__isa",r),this.createCustomTypeFromMap(i.unary,a),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,ds.isResolveChainItemWithMember)(u))r=r.resolveProperty(u.getter.name,c)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLabel(u.getter.name);else if((0,ds.isResolveChainItemWithIndex)(u))if((0,pE.isValidIdentifierLiteral)(u.getter)){let l=u.getter.value.toString();r=r.resolveProperty(l,u.isInCallExpression)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLabel(l)}else{let l=this.resolveTypeWithDefault(u.getter);r=r.resolveProperty(l,u.isInCallExpression)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any)}else if(u.ref.type===Oe.ASTType.SliceExpression)r=r.copy();else return null;if(u.unary?.operator===Oe.Keyword.New&&r!==null){let l=this.factory(we.CompletionItemKind.Property).addType(Me.SignatureDefinitionBaseType.Map).setLabel(r.label);l.setProperty("__isa",r),this.createCustomTypeFromMap(u.unary,l),r=l}}return r}setEntityInPath(e,n,r){let i=e;for(let s=0;s<n.length-1;s++){let o=n[s],a=i.resolveProperty(o);if(a==null){let u=this.factory(we.CompletionItemKind.Property).addType(Me.SignatureDefinitionBaseType.Map).setLabel(o);i.setProperty(o,u),a=u}i=a}return i.setProperty(n[n.length-1],r)}getEntityInPath(e,n){let r=e;for(let i=0;i<n.length;i++){let s=n[i],o=r.resolveProperty(s);if(o==null)return null;r=o}return r}resolveNamespace(e,n=!1){let r=(0,fE.createResolveChain)(e);return this.resolveChain(r,n)}defineProperty(e,n,r){let i=e.setProperty(n,r);return this._lastModifiedProperty=e.resolveProperty(n,!0),i}defineNamespace(e,n){let r=(0,fE.createResolveChain)(e),i=r.pop();if(this._lastModifiedProperty=null,r.length>0){let o=this.resolveChain(r);if(o===null)return!1;if((0,ds.isResolveChainItemWithMember)(i))return this.defineProperty(o,i.getter.name,n);if((0,ds.isResolveChainItemWithIndex)(i)){if((0,pE.isValidIdentifierLiteral)(i.getter))return this.defineProperty(o,i.getter.value.toString(),n);{let a=this.resolveTypeWithDefault(i.getter);return this.defineProperty(o,a,n)}}return!1}let s=this._scope;return(0,ds.isResolveChainItemWithIdentifier)(i)?this.defineProperty(s,i.getter.name,n):!1}addDefinition(e){this._lastModifiedProperty?.definitions.push({source:this._document.source,node:e});let n=(0,dE.createExpressionId)(e.variable),r=this._definitions;n.startsWith("globals.")?(r=this._document.getRootScopeContext().aggregator.definitions,n=n.slice(8)):n.startsWith("locals.")?(r=this._definitions,n=n.slice(7)):n.startsWith("outer.")&&(r=this.parent.definitions,n=n.slice(6));let i=r.get(n);i?i.push({source:this._document.source,node:e}):r.set(n,[{source:this._document.source,node:e}])}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);(0,hE.merge)(n,a)}}return n}resolveAvailableAssignments(e){let n=(0,dE.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.resolveNamespace(e,!0);a!=null&&(0,hE.merge)(i,a.definitions)}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({source:this._document.source}).setLine(n.start.line)??this.factory(we.CompletionItemKind.Variable).addType(Me.SignatureDefinitionBaseType.Any).setLine(n.start.line);this.defineNamespace(n.variable,r),this.addDefinition(n)}}extend(e){for(let[n,r]of e.definitions){let i=this.definitions.get(n);i?(0,gL.mergeUnique)(i,r):this.definitions.set(n,r)}}};dd.Aggregator=Uy});var Gy=g(fd=>{"use strict";Object.defineProperty(fd,"__esModule",{value:!0});fd.Document=void 0;var Vr=Wn(),bL=qe(),gE=os(),vL=By(),mE=Hy(),yE=po(),bE=_y(),Wy=class t{get source(){return this._source}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._source=e.source,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(Vr.SignatureDefinitionBaseType.Map),funcRef:this._container.primitives.get(Vr.SignatureDefinitionBaseType.Function),number:this._container.primitives.get(Vr.SignatureDefinitionBaseType.Number),string:this._container.primitives.get(Vr.SignatureDefinitionBaseType.String),list:this._container.primitives.get(Vr.SignatureDefinitionBaseType.List)}}initApi(){let e=this._container.primitives.get(Vr.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 yE.Entity({source:this._source,kind:gE.CompletionItemKind.Constant,container:this._container,label:"globals"}).addType(Vr.SignatureDefinitionBaseType.Map)}analyzeScope(e){let n=this._scopeMapping.get(e.scope),r=new bE.Scope({source:this._source,container:this._container,parent:n?.scope,globals:this._globals}),i=new mE.Aggregator({scope:r,root:e,document:this,parent:n?.aggregator});this._scopeMapping.set(e,{scope:r,aggregator:i});let s=e.assignment instanceof bL.ASTAssignmentStatement?this.resolveNamespace(e.assignment.variable,!0):null;if(s!==null){let o=s?.context;o!=null&&o.types.has(Vr.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 yE.Entity({source:this._source,kind:gE.CompletionItemKind.Variable,container:this._container}).addTypes(d)):(l.types.delete(Vr.SignatureDefinitionBaseType.Any),l.addTypes(d))}}}}analyze(){let e=new bE.Scope({source:this._source,container:this._container,globals:this._globals,locals:this._globals}),n=new mE.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);(0,vL.merge)(n,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({source:this._source,root:this._root,container:this._container.copy()});for(let r=0;r<e.length;r++){let i=e[r];n._globals.extend(i._globals),n._intrinscis.map.extend(i._intrinscis.map),n._intrinscis.funcRef.extend(i._intrinscis.funcRef),n._intrinscis.number.extend(i._intrinscis.number),n._intrinscis.string.extend(i._intrinscis.string),n._intrinscis.list.extend(i._intrinscis.list),n._container.mergeCustomTypes(i._container)}n.analyze();for(let r=0;r<e.length;r++){let i=e[r];n.getRootScopeContext().aggregator.extend(i.getRootScopeContext().aggregator)}return n}};fd.Document=Wy});var zy=g(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});pd.ContainerProxy=void 0;var ar=Wn(),Oi=po(),vE=os(),_E=ja(),Ky=Ql(),Vy=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(),this._customTypes=new Set}createPrimitives(){let e=new Map;for(let[n,r]of this._container.getPrimitives()){let i=new Oi.Entity({source:"internal",kind:vE.CompletionItemKind.Constant,container:this,isAPI:n===ar.SignatureDefinitionBaseType.General}).addType(ar.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 Oi.Entity({source:"internal",kind:vE.CompletionItemKind.Constant,container:this}).addType(ar.SignatureDefinitionBaseType.Map).insertSignature(r);e.set(n,i)}return e}setCustomType(e,n){this._types.has(e)||(this._types.set(e,n),this._customTypes.add(e))}mergeCustomTypes(e){for(let n of e._customTypes){let r=e._types.get(n);r!=null&&this.setCustomType(n,r.copy({deepCopy:!0}))}}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(ar.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,Ky.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,Ky.lookupProperty)(this._primitives.get(ar.SignatureDefinitionBaseType.Any),n);if(e.includes(ar.SignatureDefinitionBaseType.Any)&&i)return(0,Oi.resolveEntity)(this,i,r);let s=this.searchDefinitionMatches(e,n);return s.size===0?null:s.size===1?(0,Oi.resolveEntity)(this,s.values().next().value,r):s.has(ar.SignatureDefinitionBaseType.Any)?(0,Oi.resolveEntity)(this,s.get(ar.SignatureDefinitionBaseType.Any),r):i!==null?(0,Oi.resolveEntity)(this,i,r):(0,Oi.resolveEntity)(this,s.values().next().value,r)}getGeneralDefinition(e,n=!1){let r=(0,Ky.lookupProperty)(this._primitives.get(ar.SignatureDefinitionBaseType.General),e);return r==null?null:(0,Oi.resolveEntity)(this,r,n)}injectTypeIdentifiers(e,n){let r=this.getTypeSignature(n);if(r!=null&&((0,_E.injectIdentifers)(e,r),this._types.has(n))){let i=this._primitives.get(ar.SignatureDefinitionBaseType.Map);(0,_E.injectIdentifers)(e,i)}}getAllIdentifier(e){let n=new Map;if(e===ar.SignatureDefinitionBaseType.Any){let r=this._container.getAllVisibleTypes();for(let i=0;i<r.length;i++)this.injectTypeIdentifiers(n,r[i]);return n}return this.injectTypeIdentifiers(n,e),n}copy(){return new t({container:this._container})}};pd.ContainerProxy=Vy});var TE=g(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});hd.TypeManager=void 0;var _L=Gy(),TL=zy(),Xy=class{constructor(e){this._container=new TL.ContainerProxy({container:e.container}),this._types=new Map}analyze(e,n){let r=new _L.Document({source:e,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}};hd.TypeManager=Xy});var Ja=g(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.TypeManager=se.ContainerProxy=se.Document=se.Aggregator=se.Scope=se.Entity=se.aggregateEntity=se.lookupProperty=se.isEligibleForProperties=se.injectIdentifers=se.isSignatureDefinitionFunction=se.isResolveChainItemWithValue=se.isResolveChainItemWithMember=se.isResolveChainItemWithIndex=se.isResolveChainItemWithIdentifier=se.CompletionItemKind=se.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION=se.ObjectSetIterator=se.ObjectSet=se.rotateBits=se.getStringHashCode=se.getHashCode=se.createResolveChain=se.enrichWithMetaInformation=se.createExpressionId=se.createExpressionHash=se.isValidIdentifierLiteral=void 0;var SL=Ca();Object.defineProperty(se,"isValidIdentifierLiteral",{enumerable:!0,get:function(){return SL.isValidIdentifierLiteral}});var kL=I0();Object.defineProperty(se,"createExpressionHash",{enumerable:!0,get:function(){return kL.createExpressionHash}});var xL=Bm();Object.defineProperty(se,"createExpressionId",{enumerable:!0,get:function(){return xL.createExpressionId}});var wL=sy();Object.defineProperty(se,"enrichWithMetaInformation",{enumerable:!0,get:function(){return wL.enrichWithMetaInformation}});var EL=oy();Object.defineProperty(se,"createResolveChain",{enumerable:!0,get:function(){return EL.createResolveChain}});var Yy=$m();Object.defineProperty(se,"getHashCode",{enumerable:!0,get:function(){return Yy.getHashCode}});Object.defineProperty(se,"getStringHashCode",{enumerable:!0,get:function(){return Yy.getStringHashCode}});Object.defineProperty(se,"rotateBits",{enumerable:!0,get:function(){return Yy.rotateBits}});var SE=ly();Object.defineProperty(se,"ObjectSet",{enumerable:!0,get:function(){return SE.ObjectSet}});Object.defineProperty(se,"ObjectSetIterator",{enumerable:!0,get:function(){return SE.ObjectSetIterator}});var AL=dy();Object.defineProperty(se,"DEFAULT_CUSTOM_FUNCTION_DESCRIPTION",{enumerable:!0,get:function(){return AL.DEFAULT_CUSTOM_FUNCTION_DESCRIPTION}});var OL=os();Object.defineProperty(se,"CompletionItemKind",{enumerable:!0,get:function(){return OL.CompletionItemKind}});var gd=fy();Object.defineProperty(se,"isResolveChainItemWithIdentifier",{enumerable:!0,get:function(){return gd.isResolveChainItemWithIdentifier}});Object.defineProperty(se,"isResolveChainItemWithIndex",{enumerable:!0,get:function(){return gd.isResolveChainItemWithIndex}});Object.defineProperty(se,"isResolveChainItemWithMember",{enumerable:!0,get:function(){return gd.isResolveChainItemWithMember}});Object.defineProperty(se,"isResolveChainItemWithValue",{enumerable:!0,get:function(){return gd.isResolveChainItemWithValue}});var CL=py();Object.defineProperty(se,"isSignatureDefinitionFunction",{enumerable:!0,get:function(){return CL.isSignatureDefinitionFunction}});var RL=ja();Object.defineProperty(se,"injectIdentifers",{enumerable:!0,get:function(){return RL.injectIdentifers}});var PL=Yl();Object.defineProperty(se,"isEligibleForProperties",{enumerable:!0,get:function(){return PL.isEligibleForProperties}});var DL=Ql();Object.defineProperty(se,"lookupProperty",{enumerable:!0,get:function(){return DL.lookupProperty}});var IL=hy();Object.defineProperty(se,"aggregateEntity",{enumerable:!0,get:function(){return IL.aggregateEntity}});var ML=po();Object.defineProperty(se,"Entity",{enumerable:!0,get:function(){return ML.Entity}});var LL=_y();Object.defineProperty(se,"Scope",{enumerable:!0,get:function(){return LL.Scope}});var NL=Hy();Object.defineProperty(se,"Aggregator",{enumerable:!0,get:function(){return NL.Aggregator}});var qL=Gy();Object.defineProperty(se,"Document",{enumerable:!0,get:function(){return qL.Document}});var jL=zy();Object.defineProperty(se,"ContainerProxy",{enumerable:!0,get:function(){return jL.ContainerProxy}});var FL=TE();Object.defineProperty(se,"TypeManager",{enumerable:!0,get:function(){return FL.TypeManager}})});var Qy=g(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.findEx=void 0;var $L=qe(),BL=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:()=>{}}},Jy=class{constructor(e){this.map=BL(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 UL(t,e){let n=[];return new Jy((i,s)=>{let o=t(i,s)||{};return o.valid&&i.type!==$L.ASTType.InvalidCodeExpression&&n.push(i),{exit:!!o.exit,skip:!!o.skip}}).visit(e),n}md.findEx=UL});var kE=g((KU,HL)=>{HL.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 xE=g((VU,WL)=>{WL.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:
|
114
114
|
miniscript: a string such as "1.5"
|
115
115
|
buildDate: a date in yyyy-mm-dd format, like "2020-05-28"
|
116
116
|
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.5.
|
3
|
+
"version": "1.5.4",
|
4
4
|
"description": "Language server for MiniScript",
|
5
5
|
"main": "./index.js",
|
6
6
|
"scripts": {
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"greybel-core": "~2.1.1",
|
71
71
|
"miniscript-meta": "~1.2.3",
|
72
72
|
"greybel-transpiler": "~3.2.4",
|
73
|
-
"miniscript-type-analyzer": "~0.13.
|
73
|
+
"miniscript-type-analyzer": "~0.13.3",
|
74
74
|
"miniscript-languageserver-core": "^1.4.3"
|
75
75
|
}
|
76
76
|
}
|