text: !function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(r,s,function(t){return e[t]}.bind(null,s));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=13)}([function(e,t,n){"use strict";var r;n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return s})),function(e){e[e.Eof=0]="Eof",e[e.Panic=1]="Panic",e[e.Lambda=2]="Lambda",e[e.Ampersand=3]="Ampersand",e[e.AtSign=4]="AtSign",e[e.Caret=5]="Caret",e[e.Comma=6]="Comma",e[e.Dollar=7]="Dollar",e[e.Dot=8]="Dot",e[e.Hash=9]="Hash",e[e.LeftBrace=10]="LeftBrace",e[e.LeftBracket=11]="LeftBracket",e[e.LeftParen=12]="LeftParen",e[e.Percent=13]="Percent",e[e.Pipe=14]="Pipe",e[e.RightBrace=15]="RightBrace",e[e.RightBracket=16]="RightBracket",e[e.RightParen=17]="RightParen",e[e.Semicolon=18]="Semicolon",e[e.Slash=19]="Slash",e[e.Star=20]="Star",e[e.Arrow=21]="Arrow",e[e.Bang=22]="Bang",e[e.BangEqual=23]="BangEqual",e[e.Colon=24]="Colon",e[e.Equal=25]="Equal",e[e.EqualEqual=26]="EqualEqual",e[e.Greater=27]="Greater",e[e.GreaterEqual=28]="GreaterEqual",e[e.Less=29]="Less",e[e.LessEqual=30]="LessEqual",e[e.Minus=31]="Minus",e[e.MinusEqual=32]="MinusEqual",e[e.MinusMinus=33]="MinusMinus",e[e.PercentEqual=34]="PercentEqual",e[e.Plus=35]="Plus",e[e.PlusEqual=36]="PlusEqual",e[e.PlusPlus=37]="PlusPlus",e[e.Question=38]="Question",e[e.QuestionDot=39]="QuestionDot",e[e.QuestionQuestion=40]="QuestionQuestion",e[e.SlashEqual=41]="SlashEqual",e[e.StarEqual=42]="StarEqual",e[e.DotDot=43]="DotDot",e[e.DotDotDot=44]="DotDotDot",e[e.LessEqualGreater=45]="LessEqualGreater",e[e.Identifier=46]="Identifier",e[e.Template=47]="Template",e[e.String=48]="String",e[e.Number=49]="Number",e[e.Regex=50]="Regex",e[e.And=51]="And",e[e.Break=52]="Break",e[e.Base=53]="Base",e[e.Class=54]="Class",e[e.Continue=55]="Continue",e[e.Delete=56]="Delete",e[e.Do=57]="Do",e[e.Else=58]="Else",e[e.Extends=59]="Extends",e[e.False=60]="False",e[e.For=61]="For",e[e.Foreach=62]="Foreach",e[e.Function=63]="Function",e[e.If=64]="If",e[e.In=65]="In",e[e.Instanceof=66]="Instanceof",e[e.Is=67]="Is",e[e.New=68]="New",e[e.Null=69]="Null",e[e.Or=70]="Or",e[e.Print=71]="Print",e[e.Return=72]="Return",e[e.True=73]="True",e[e.Typeof=74]="Typeof",e[e.Var=75]="Var",e[e.Void=76]="Void",e[e.While=77]="While",e[e.With=78]="With"}(r||(r={}));class s{constructor(e,t,n,s,i){this.name=r[e],this.type=e,this.lexeme=t,this.literal=n,this.line=s,this.col=i}toString(){return`[(${this.line}):"${this.lexeme}"]`}}},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e[e.Null=0]="Null",e[e.Any=1]="Any",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.List=5]="List",e[e.Dictionary=6]="Dictionary",e[e.Object=7]="Object",e[e.Class=8]="Class",e[e.Function=9]="Function",e[e.Lambda=10]="Lambda",e[e.Range=11]="Range",e[e.RegExp=12]="RegExp",e[e.Error=13]="Error",e[e.Iterator=14]="Iterator",e[e.Void=100]="Void",e[e.Return=101]="Return",e[e.Break=102]="Break",e[e.Continue=103]="Continue"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return o})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return l})),n.d(t,"g",(function(){return c})),n.d(t,"h",(function(){return h})),n.d(t,"i",(function(){return p})),n.d(t,"j",(function(){return d})),n.d(t,"k",(function(){return m})),n.d(t,"l",(function(){return v})),n.d(t,"m",(function(){return f})),n.d(t,"n",(function(){return w})),n.d(t,"q",(function(){return b})),n.d(t,"o",(function(){return x})),n.d(t,"p",(function(){return g})),n.d(t,"r",(function(){return E})),n.d(t,"s",(function(){return y})),n.d(t,"t",(function(){return S})),n.d(t,"u",(function(){return k})),n.d(t,"v",(function(){return P})),n.d(t,"w",(function(){return C})),n.d(t,"x",(function(){return L})),n.d(t,"y",(function(){return B})),n.d(t,"z",(function(){return D})),n.d(t,"A",(function(){return N})),n.d(t,"B",(function(){return q})),n.d(t,"C",(function(){return R})),n.d(t,"D",(function(){return T})),n.d(t,"E",(function(){return $}));class r{constructor(){}}class s extends r{constructor(e,t,n){super(),this.name=e,this.value=t,this.line=n}accept(e){return e.visitAssignExpr(this)}toString(){return"Expr.Assign"}}class i extends r{constructor(e,t){super(),this.paren=e,this.line=t}accept(e){return e.visitBaseExpr(this)}toString(){return"Expr.Base"}}class a extends r{constructor(e,t,n,r){super(),this.left=e,this.operator=t,this.right=n,this.line=r}accept(e){return e.visitBinaryExpr(this)}toString(){return"Expr.Binary"}}class o extends r{constructor(e,t,n,r,s){super(),this.callee=e,this.paren=t,this.args=n,this.thiz=r,this.line=s}accept(e){return e.visitCallExpr(this)}toString(){return"Expr.Call"}}class u extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitCharExpr(this)}toString(){return"Expr.Char"}}class l extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitDeleteExpr(this)}toString(){return"Expr.Delete"}}class c extends r{constructor(e,t){super(),this.properties=e,this.line=t}accept(e){return e.visitDictionaryExpr(this)}toString(){return"Expr.Dictionary"}}class h extends r{constructor(e,t,n,r){super(),this.entity=e,this.key=t,this.type=n,this.line=r}accept(e){return e.visitGetExpr(this)}toString(){return"Expr.Get"}}class p extends r{constructor(e,t){super(),this.expression=e,this.line=t}accept(e){return e.visitGroupingExpr(this)}toString(){return"Expr.Grouping"}}class d extends r{constructor(e,t,n){super(),this.key=e,this.entity=t,this.line=n}accept(e){return e.visitInExpr(this)}toString(){return"Expr.In"}}class m extends r{constructor(e,t,n){super(),this.left=e,this.right=t,this.line=n}accept(e){return e.visitInstanceOfExpr(this)}toString(){return"Expr.InstanceOf"}}class v extends r{constructor(e,t,n){super(),this.left=e,this.right=t,this.line=n}accept(e){return e.visitIsExpr(this)}toString(){return"Expr.Is"}}class f extends r{constructor(e,t){super(),this.name=e,this.line=t}accept(e){return e.visitKeyExpr(this)}toString(){return"Expr.Key"}}class w extends r{constructor(e,t){super(),this.lambda=e,this.line=t}accept(e){return e.visitLambdaExpr(this)}toString(){return"Expr.Lambda"}}class b extends r{constructor(e,t,n,r){super(),this.left=e,this.operator=t,this.right=n,this.line=r}accept(e){return e.visitLogicalExpr(this)}toString(){return"Expr.Logical"}}class x extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitListExpr(this)}toString(){return"Expr.List"}}class g extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitLiteralExpr(this)}toString(){return"Expr.Literal"}}class E extends r{constructor(e,t){super(),this.clazz=e,this.line=t}accept(e){return e.visitNewExpr(this)}toString(){return"Expr.New"}}class y extends r{constructor(e,t,n){super(),this.left=e,this.right=t,this.line=n}accept(e){return e.visitNullCoalescingExpr(this)}toString(){return"Expr.NullCoalescing"}}class S extends r{constructor(e,t,n){super(),this.name=e,this.increment=t,this.line=n}accept(e){return e.visitPostfixExpr(this)}toString(){return"Expr.Postfix"}}class k extends r{constructor(e,t,n,r){super(),this.start=e,this.end=t,this.step=n,this.line=r}accept(e){return e.visitRangeExpr(this)}toString(){return"Expr.Range"}}class P extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitRegExExpr(this)}toString(){return"Expr.RegEx"}}class C extends r{constructor(e,t,n,r){super(),this.entity=e,this.key=t,this.value=n,this.line=r}accept(e){return e.visitSetExpr(this)}toString(){return"Expr.Set"}}class L extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitSpreadExpr(this)}toString(){return"Expr.Spread"}}class B extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitTemplateExpr(this)}toString(){return"Expr.Template"}}class D extends r{constructor(e,t,n,r){super(),this.condition=e,this.thenExpr=t,this.elseExpr=n,this.line=r}accept(e){return e.visitTernaryExpr(this)}toString(){return"Expr.Ternary"}}class N extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitTypeofExpr(this)}toString(){return"Expr.Typeof"}}class q extends r{constructor(e,t,n){super(),this.operator=e,this.right=t,this.line=n}accept(e){return e.visitUnaryExpr(this)}toString(){return"Expr.Unary"}}class R extends r{constructor(e,t){super(),this.name=e,this.line=t}accept(e){return e.visitVariableExpr(this)}toString(){return"Expr.Variable"}}class T extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitVoidExpr(this)}toString(){return"Expr.Void"}}class $ extends r{constructor(e,t){super(),this.value=e,this.line=t}accept(e){return e.visitZtringExpr(this)}toString(){return"Expr.Ztring"}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(1),s=n(4);class i extends s.a{constructor(e){super(e,r.a.Number)}toString(){return this.value.toString()}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(1);class s{constructor(e,t=r.a.Any){this.type=r.a.Any,this.value=e,this.type=t}isString(){return this.type===r.a.String}isNull(){return this.type===r.a.Null}isBoolean(){return this.type===r.a.Boolean}isNumber(){return this.type===r.a.Number}isRange(){return this.type===r.a.Range}isFunction(){return this.type===r.a.Function}isClass(){return this.type===r.a.Class}isLambda(){return this.type===r.a.Function&&"@"===this.name}isList(){return this.type===r.a.List}isDictionary(){return this.type===r.a.Dictionary}isObject(){return this.type===r.a.Object}isTruthy(){if(this.isNull())return!1;if(this.isBoolean())return Boolean(this.value);if(this.isNumber()&&0===this.value)return!1;if(this.isString()&&0===this.value.toString().length)return!1;if(this.isList()&&0===this.value.length)return!1;if(this.isDictionary()&&0===this.value.size)return!1;if(null===this.value)throw new Error("Unknown error value Any is null");if(void 0===this.value)throw new Error("Unknown error value Any is undefined");return!0}isEqual(e){return this.value===e.value}isKeyValue(){return this.type===r.a.Class||this.type===r.a.Dictionary||this.type===r.a.Object}get(e){throw conzole.error(`key ${e} does not exist in ${this}`),new Error("Error in Any getter")}set(e,t){throw conzole.error(`key ${e} does not exist in ${this}`),new Error("Error in Any setter")}delete(e){throw conzole.error(this+" does not support operator"),new Error("Error in Any delete")}toString(){return this.value.toString()}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(1),s=n(4);class i extends s.a{constructor(){super(null),this.type=r.a.Null}toString(){return"null"}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(1),s=n(4);class i extends s.a{constructor(e){super(e,r.a.Boolean)}}},function(e,t,n){"use strict";n.d(t,"d",(function(){return s})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"e",(function(){return o})),n.d(t,"a",(function(){return u}));var r=n(0);function s(e){return e>="0"&&e<="9"}function i(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function a(e){return i(e)||s(e)}function o(e){return r.b[e]>=r.b.And}function u(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),s=n(7);class i{scan(e){for(this.source=e,this.tokens=[],this.errors=[],this.current=0,this.start=0,this.line=1,this.col=1;!this.eof();){this.start=this.current;try{this.getToken()}catch(e){if(this.errors.push(e.message),this.errors.length>100)return this.errors.push("Error limit exceeded"),this.tokens}}return this.tokens.push(new r.a(r.b.Eof,"",null,this.line,0)),this.tokens}eof(){return this.current>=this.source.length}advance(){return"\n"===this.peek()&&(this.line++,this.col=0),this.current++,this.col++,this.source.charAt(this.current-1)}addToken(e,t){const n=this.source.substring(this.start,this.current);this.tokens.push(new r.a(e,n,t,this.line,this.col))}match(e){return!this.eof()&&(this.source.charAt(this.current)===e&&(this.current++,!0))}peek(){return this.eof()?"\0":this.source.charAt(this.current)}peekNext(){return this.current+1>=this.source.length?"\0":this.source.charAt(this.current+1)}comment(){for(;"\n"!==this.peek()&&!this.eof();)this.advance()}multilineComment(){for(;!this.eof()&&("*"!==this.peek()||"/"!==this.peekNext());)this.advance();this.eof()?this.error('Unterminated comment, expecting closing "*/"'):(this.advance(),this.advance())}string(e){for(;this.peek()!==e&&!this.eof();)this.advance();if(this.eof())return void this.error("Unterminated string, expecting closing "+e);this.advance();const t=this.source.substring(this.start+1,this.current-1);this.addToken("`"!==e?r.b.String:r.b.Template,t)}number(){for(;s.d(this.peek());)this.advance();for("."===this.peek()&&s.d(this.peekNext())&&this.advance();s.d(this.peek());)this.advance();for("e"===this.peek().toLowerCase()&&(this.advance(),"-"!==this.peek()&&"+"!==this.peek()||this.advance());s.d(this.peek());)this.advance();const e=this.source.substring(this.start,this.current);this.addToken(r.b.Number,Number(e))}identifier(){for(;s.c(this.peek());)this.advance();const e=this.source.substring(this.start,this.current),t=s.a(e);s.e(t)?this.addToken(r.b[t],e):this.addToken(r.b.Identifier,e)}getToken(){const e=this.advance();switch(e){case"(":this.addToken(r.b.LeftParen,null);break;case")":this.addToken(r.b.RightParen,null);break;case"[":this.addToken(r.b.LeftBracket,null);break;case"]":this.addToken(r.b.RightBracket,null);break;case"{":this.addToken(r.b.LeftBrace,null);break;case"}":this.addToken(r.b.RightBrace,null);break;case",":this.addToken(r.b.Comma,null);break;case";":this.addToken(r.b.Semicolon,null);break;case"^":this.addToken(r.b.Caret,null);break;case"$":this.addToken(r.b.Dollar,null);break;case"#":this.addToken(r.b.Hash,null);break;case"@":this.addToken(r.b.Function,"@");break;case":":this.addToken(this.match("=")?r.b.Arrow:r.b.Colon,null);break;case"*":this.addToken(this.match("=")?r.b.StarEqual:r.b.Star,null);break;case"%":this.addToken(this.match("=")?r.b.PercentEqual:r.b.Percent,null);break;case"|":this.addToken(this.match("|")?r.b.Or:r.b.Pipe,null);break;case"&":this.addToken(this.match("&")?r.b.And:r.b.Ampersand,null);break;case">":this.addToken(this.match("=")?r.b.GreaterEqual:r.b.Greater,null);break;case"!":this.addToken(this.match("=")?r.b.BangEqual:r.b.Bang,null);break;case"?":this.addToken(this.match("?")?r.b.QuestionQuestion:this.match(".")?r.b.QuestionDot:r.b.Question,null);break;case"=":this.addToken(this.match("=")?r.b.EqualEqual:this.match(">")?r.b.Arrow:r.b.Equal,null);break;case"+":this.addToken(this.match("+")?r.b.PlusPlus:this.match("=")?r.b.PlusEqual:r.b.Plus,null);break;case"-":this.addToken(this.match("-")?r.b.MinusMinus:this.match(">")?r.b.Return:this.match("=")?r.b.MinusEqual:r.b.Minus,null);break;case"<":this.addToken(this.match("=")?this.match(">")?r.b.LessEqualGreater:r.b.LessEqual:r.b.Less,null);break;case".":this.match(".")?this.match(".")?this.addToken(r.b.DotDotDot,null):this.addToken(r.b.DotDot,null):this.addToken(r.b.Dot,null);break;case"/":this.match("/")?this.comment():this.match("*")?this.multilineComment():this.addToken(this.match("=")?r.b.SlashEqual:r.b.Slash,null);break;case"'":case'"':case"`":this.string(e);break;case"\n":case" ":case"\r":case"\t":break;default:s.d(e)?this.number():s.b(e)?this.identifier():this.error(`Unexpected character '${e}'`)}}error(e){throw new Error(`Scan Error (${this.line}:${this.col}) => ${e}`)}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return P}));var r=n(2);class s{constructor(){}}class i extends s{constructor(e,t){super(),this.statements=e,this.line=t}accept(e){return e.visitBlockStmt(this)}toString(){return"Stmt.Block"}}class a extends s{constructor(e,t){super(),this.keyword=e,this.line=t}accept(e){return e.visitBreakStmt(this)}toString(){return"Stmt.Break"}}class o extends s{constructor(e,t,n,r){super(),this.name=e,this.parent=t,this.methods=n,this.line=r}accept(e){return e.visitClassStmt(this)}toString(){return"Stmt.Class"}}class u extends s{constructor(e,t){super(),this.keyword=e,this.line=t}accept(e){return e.visitContinueStmt(this)}toString(){return"Stmt.Continue"}}class l extends s{constructor(e,t,n){super(),this.loop=e,this.condition=t,this.line=n}accept(e){return e.visitDoWhileStmt(this)}toString(){return"Stmt.DoWhile"}}class c extends s{constructor(e,t){super(),this.expression=e,this.line=t}accept(e){return e.visitExpressionStmt(this)}toString(){return"Stmt.Expression"}}class h extends s{constructor(e,t,n,r,s){super(),this.name=e,this.key=t,this.iterable=n,this.loop=r,this.line=s}accept(e){return e.visitForeachStmt(this)}toString(){return"Stmt.Foreach"}}class p extends s{constructor(e,t,n,r){super(),this.name=e,this.params=t,this.body=n,this.line=r}accept(e){return e.visitFuncStmt(this)}toString(){return"Stmt.Func"}}class d extends s{constructor(e,t,n,r){super(),this.condition=e,this.thenStmt=t,this.elseStmt=n,this.line=r}accept(e){return e.visitIfStmt(this)}toString(){return"Stmt.If"}}class m extends s{constructor(e,t){super(),this.expression=e,this.line=t}accept(e){return e.visitPrintStmt(this)}toString(){return"Stmt.Print"}}class v extends s{constructor(e,t,n){super(),this.keyword=e,this.value=t,this.line=n}accept(e){return e.visitReturnStmt(this)}toString(){return"Stmt.Return"}}class f extends s{constructor(e,t,n,r){super(),this.name=e,this.type=t,this.initializer=n,this.line=r}accept(e){return e.visitVarStmt(this)}toString(){return"Stmt.Var"}}class w extends s{constructor(e,t,n){super(),this.condition=e,this.loop=t,this.line=n}accept(e){return e.visitWhileStmt(this)}toString(){return"Stmt.While"}}var b=n(0),x=n(6),g=n(5),E=n(3),y=n(1),S=n(4);class k extends S.a{constructor(e,t,n){super(e,y.a.Error),this.line=t,this.col=n}toString(){return this.value.toString()}}class P{constructor(){this.errorLevel=1}parse(e){this.current=0,this.tokens=e,this.errors=[];const t=[];for(;!this.eof();)try{t.push(this.declaration())}catch(e){if(e instanceof k)this.errors.push(`Parse Error (${e.line}:${e.col}) => ${e.value}`);else if(this.errors.push(e),this.errors.length>100)return this.errors.push("Parse Error limit exceeded"),t;this.synchronize()}return t}match(...e){for(const t of e)if(this.check(t))return this.advance(),!0;return!1}advance(){return this.eof()||this.current++,this.previous()}peek(){return this.tokens[this.current]}previous(){return this.tokens[this.current-1]}peekNext(){return this.eof()?this.peek():this.tokens[this.current+1]}check(e){return this.peek().type===e}eof(){return this.check(b.b.Eof)}consume(e,t){return this.check(e)?this.advance():this.error(this.previous(),t+`, unexpected token "${this.peek().lexeme}"`)}extraSemicolon(){const e=this.match(b.b.Semicolon);if(this.check(b.b.Semicolon))for(;this.check(b.b.Semicolon);)this.consume(b.b.Semicolon,"");return e}error(e,t){throw new k(t,e.line,e.col)}warning(e){if(1===this.errorLevel){const t=this.previous();conzole.warn(`[line (${t.line}) parse warning at "${t.lexeme}"] => ${e}`)}}synchronize(){do{switch(this.peek().type){case b.b.Class:case b.b.Function:case b.b.Var:case b.b.For:case b.b.If:case b.b.While:case b.b.Do:case b.b.Print:case b.b.Return:return void this.advance()}if(this.check(b.b.Semicolon)||this.check(b.b.RightBrace))return void this.advance();this.advance()}while(!this.eof())}declaration(){return this.match(b.b.Class)?this.classDeclaration():this.match(b.b.Function)?this.funcDeclaration("function"):this.match(b.b.Var)?this.varDeclaration():this.statement()}classDeclaration(){const e=this.consume(b.b.Identifier,"Expected a class name");let t=null;this.match(b.b.Extends)&&(t=this.consume(b.b.Identifier,"Expected a parent name")),this.consume(b.b.LeftBrace,'Expected open brace "{" after class name');const n=[];for(;!this.check(b.b.RightBrace)&&!this.eof();)this.check(b.b.Function)&&this.consume(b.b.Function,""),n.push(this.funcDeclaration("method"));return this.consume(b.b.RightBrace,`Expected "}" after class "${e.literal}" methods`),this.extraSemicolon()&&this.warning(`Unnecessary semicolon after class ${e.lexeme} declaration`),new o(e,t,n,e.line)}funcDeclaration(e){const t=this.consume(b.b.Identifier,`Expected a ${e} name`);return this.funcParamsBody(t,e)}funcParams(e){const t=[];if(!this.check(b.b.RightParen))do{t.length>=255&&this.error(this.peek(),"Parameter count exceeds 255"),t.push(this.consume(b.b.Identifier,"Expected a parameter name"))}while(this.match(b.b.Comma));return this.consume(b.b.RightParen,`Expected close parenthesis ")" after ${e} parameters`),t}funcParamsBody(e,t){this.consume(b.b.LeftParen,'Expected open parenthesis "(" after '+t);const n=this.funcParams(t);if(this.match(b.b.LeftBrace)){const t=this.block();return e.type!==b.b.Lambda&&this.extraSemicolon()&&this.warning(`Unnecessary semicolon after function ${e.lexeme} declaration`),new p(e,n,t,e.line)}if(this.match(b.b.Arrow)){const t=[];let r;const s=this.previous();return this.check(b.b.Semicolon)||(r=this.expression()),this.match(b.b.Semicolon),t.push(new v(s,r,s.line)),new p(e,n,t,e.line)}this.consume(b.b.LeftBrace,`Expect "{" before ${t} body`)}varDeclaration(){const e=this.consume(b.b.Identifier,'Expected a variable name after "var" keyword');let t=null;return this.match(b.b.Equal)&&(t=this.expression()),this.consume(b.b.Semicolon,'Expected semicolon ";" after a variable declaration'),new f(e,null,t,e.line)}statement(){return this.match(b.b.If)?this.ifStatement():this.match(b.b.Print)?this.printStatement():this.match(b.b.Do)?this.doWhileStatement():this.match(b.b.While)?this.whileStatement():this.match(b.b.For)?this.forStatement():this.match(b.b.Foreach)?this.foreachStatement():this.match(b.b.LeftBrace)?new i(this.block(),this.previous().line):this.match(b.b.Return)?this.returnStatement():this.match(b.b.Break)?this.breakStatement():this.match(b.b.Continue)?this.continueStatement():this.expressionStatement()}ifStatement(){const e=this.previous();this.consume(b.b.LeftParen,'Expected open parenthesis "(" after an "if" keyword');const t=this.expression();this.consume(b.b.RightParen,'Expected close parenthesis ")" after "if" statement condition');const n=this.statement();let r=null;return this.match(b.b.Else)&&(r=this.statement()),new d(t,n,r,e.line)}whileStatement(){const e=this.previous();this.consume(b.b.LeftParen,'Expected open parenthesis "(" after a "while" statement');const t=this.expression();this.consume(b.b.RightParen,'Expected close parenthesis ")" after "while" condition');const n=this.statement();return new w(t,n,e.line)}forStatement(){const e=this.previous();let t,n,s;this.consume(b.b.LeftParen,'Expected open parenthesis "(" after a "for" statement'),t=this.match(b.b.Semicolon)?null:this.match(b.b.Var)?this.varDeclaration():this.expressionStatement(),this.check(b.b.Semicolon)||(n=this.expression()),this.consume(b.b.Semicolon,'Expected semicolon ";" after a "for" statement loop condition'),this.check(b.b.RightParen)||(s=this.expression()),this.consume(b.b.RightParen,'Expected semicolon ";" after a "for" stement increment expression');let a=this.statement();return null!==s&&(a=new i([a,new c(s,e.line)],e.line)),null===n&&(n=new r.p(new x.a(!0),e.line)),a=new w(n,a,e.line),null!==t&&(a=new i([t,a],e.line)),a}foreachStatement(){const e=this.previous();this.consume(b.b.LeftParen,'Expected open parenthesis "(" after a "foreach" statement');const t=this.consume(b.b.Identifier,'Expected an identifier inside "foreach" statement');let n=null;this.match(b.b.With)&&(n=this.consume(b.b.Identifier,'Expected a "key" identifier after "with" keyword in foreach statement')),this.consume(b.b.In,'Expected "in" keyword inside foreach statement');const r=this.expression();this.consume(b.b.RightParen,'Expected close parenthesis ")" after a "foreach" initialization');const s=this.statement();return new h(t,n,r,s,e.line)}doWhileStatement(){const e=this.previous(),t=this.statement();this.consume(b.b.While,'Expected a "while" condition after "do" statement'),this.consume(b.b.LeftParen,'Expected open parenthesis "(" after a "while" keyword');const n=this.expression();return this.consume(b.b.RightParen,'Expected close parenthesis ")" after "while" condition'),this.consume(b.b.Semicolon,'Expected semicolon ";" after a do while condition'),new l(t,n,e.line)}printStatement(){const e=this.previous(),t=this.expression();return this.consume(b.b.Semicolon,'Expected semicolon ";" after expression'),new m(t,e.line)}returnStatement(){const e=this.previous();let t=null;return this.check(b.b.Semicolon)||(t=this.expression()),this.consume(b.b.Semicolon,'Exected semicolon ";" after return statement'),new v(e,t,e.line)}breakStatement(){const e=this.previous();return this.consume(b.b.Semicolon,'Exected semicolon ";" after break statement'),new a(e,e.line)}continueStatement(){const e=this.previous();return this.consume(b.b.Semicolon,'Exected semicolon ";" after continue statement'),new u(e,e.line)}block(){const e=[];for(;!this.check(b.b.RightBrace)&&!this.eof();)e.push(this.declaration());return this.consume(b.b.RightBrace,'Expected close brace "}" after block statement'),e}expressionStatement(){const e=this.expression();if(this.consume(b.b.Semicolon,`Expected semicolon ";" after ${e} expression`),this.match(b.b.Semicolon)){const e=this.previous();for(this.warning(`[line (${e.line}) parse warning at "${e.lexeme}"] => unnecessary semicolon or empty statement`);this.match(b.b.Semicolon););}return new c(e,e.line)}expression(){return this.assignment()}assignment(){const e=this.ternary();if(this.match(b.b.Equal,b.b.PlusEqual,b.b.MinusEqual,b.b.StarEqual,b.b.SlashEqual)){const t=this.previous();let n=this.assignment();if(e instanceof r.C){const s=e.name;return t.type!==b.b.Equal&&(n=new r.c(new r.C(s,s.line),t,n,t.line)),new r.a(s,n,s.line)}if(e instanceof r.h)return t.type!==b.b.Equal&&(n=new r.c(new r.h(e.entity,e.key,e.type,e.line),t,n,t.line)),new r.w(e.entity,e.key,n,e.line);this.error(t,"Invalid l-value, is not an assigning target.")}return e}ternary(){const e=this.nullCoalescing();if(this.match(b.b.Question)){const t=this.ternary();this.consume(b.b.Colon,'Expected ":" after ternary ? expression');const n=this.ternary();return new r.z(e,t,n,e.line)}return e}nullCoalescing(){const e=this.logicalOr();if(this.match(b.b.QuestionQuestion)){const t=this.nullCoalescing();return new r.s(e,t,e.line)}return e}logicalOr(){let e=this.logicalAnd();for(;this.match(b.b.Or);){const t=this.previous(),n=this.logicalAnd();e=new r.q(e,t,n,t.line)}return e}logicalAnd(){let e=this.equality();for(;this.match(b.b.And);){const t=this.previous(),n=this.equality();e=new r.q(e,t,n,t.line)}return e}equality(){let e=this.instanceof();for(;this.match(b.b.BangEqual,b.b.EqualEqual,b.b.LessEqualGreater);){const t=this.previous(),n=this.instanceof();e=new r.c(e,t,n,t.line)}return e}instanceof(){let e=this.in();for(;this.match(b.b.Is,b.b.Instanceof);){const t=this.previous();if(this.match(b.b.Identifier,b.b.Class,b.b.Function,b.b.Null)){const n=this.previous();e=t.type===b.b.Instanceof?new r.k(e,n,t.line):new r.l(e,n,t.line)}else this.error(this.previous(),'Expected a Type or ClassName identifier after "is" operator')}return e}in(){let e=this.comparison();for(;this.match(b.b.In);){const t=this.previous(),n=this.expression();e=new r.j(e,n,t.line)}return e}comparison(){let e=this.addition();for(;this.match(b.b.Greater,b.b.GreaterEqual,b.b.Less,b.b.LessEqual);){const t=this.previous(),n=this.addition();e=new r.c(e,t,n,t.line)}return e}addition(){let e=this.modulus();for(;this.match(b.b.Minus,b.b.Plus);){const t=this.previous(),n=this.modulus();e=new r.c(e,t,n,t.line)}return e}modulus(){let e=this.multiplication();for(;this.match(b.b.Percent);){const t=this.previous(),n=this.multiplication();e=new r.c(e,t,n,t.line)}return e}multiplication(){let e=this.typeof();for(;this.match(b.b.Slash,b.b.Star);){const t=this.previous(),n=this.typeof();e=new r.c(e,t,n,t.line)}return e}typeof(){if(this.match(b.b.Typeof)){const e=this.previous(),t=this.typeof();return new r.A(t,e.line)}return this.delete()}delete(){if(this.match(b.b.Delete)){const e=this.previous(),t=this.delete();return new r.f(t,e.line)}return this.range()}range(){let e=this.unary();if(this.match(b.b.DotDot)){const t=this.unary();e=new r.u(e,t,null,e.line)}return e}unary(){if(this.match(b.b.Minus,b.b.Bang,b.b.Dollar,b.b.PlusPlus,b.b.MinusMinus)){const e=this.previous(),t=this.unary();return new r.B(e,t,e.line)}return this.newKeyword()}newKeyword(){if(this.match(b.b.New)){const e=this.previous(),t=this.call();return new r.r(t,e.line)}return this.call()}call(){let e=this.primary(),t=!0;do{if(t=!1,this.match(b.b.LeftParen)){t=!0;do{const t=[];if(!this.check(b.b.RightParen))do{t.push(this.expression())}while(this.match(b.b.Comma));const n=this.consume(b.b.RightParen,'Expected ")" after arguments');e=new r.d(e,n,t,null,n.line)}while(this.match(b.b.LeftParen))}this.match(b.b.Dot,b.b.QuestionDot)&&(t=!0,e=this.dotGet(e,this.previous())),this.match(b.b.LeftBracket)&&(t=!0,e=this.bracketGet(e,this.previous()))}while(t);return e}dotGet(e,t){const n=this.consume(b.b.Identifier,"Expect property name after '.'"),s=new r.m(n,n.line);return new r.h(e,s,t.type,n.line)}bracketGet(e,t){let n=null,s=null,i=new r.p(new E.a(1),t.line),a=!1;if(this.check(b.b.Colon)||(n=this.expression()),this.match(b.b.Colon)&&!this.check(b.b.Colon)&&(a=!0,s=this.expression()),this.match(b.b.Colon)&&!this.check(b.b.RightBracket)&&(a=!0,i=this.expression()),this.consume(b.b.RightBracket,'Expected "]" after an index'),a){const a=new r.u(n,s,i,t.line);return new r.h(e,a,t.type,t.line)}return new r.h(e,n,t.type,t.line)}primary(){if(this.match(b.b.False))return new r.p(new x.a(!1),this.previous().line);if(this.match(b.b.True))return new r.p(new x.a(!0),this.previous().line);if(this.match(b.b.Null))return new r.p(new g.a,this.previous().line);if(this.match(b.b.Number))return new r.p(new E.a(this.previous().literal),this.previous().line);if(this.match(b.b.String))return new r.E(this.previous().literal,this.previous().line);if(this.match(b.b.Template))return new r.y(this.previous().literal,this.previous().line);if(this.match(b.b.Regex))return new r.v(this.previous().literal,this.previous().line);if(this.match(b.b.Base)){const e=this.previous();return e.lexeme="this",new r.b(e,e.line)}if(this.match(b.b.Identifier)){const e=this.previous();return this.match(b.b.PlusPlus)?new r.t(e,1,e.line):this.match(b.b.MinusMinus)?new r.t(e,-1,e.line):new r.C(e,e.line)}if(this.match(b.b.LeftParen)){const e=this.expression();return this.consume(b.b.RightParen,'Expected ")" after expression'),new r.i(e,e.line)}if(this.match(b.b.LeftBrace))return this.dictionary();if(this.match(b.b.Function)){const e=new b.a(b.b.Lambda,"@","@",this.previous().line,this.previous().col),t=this.funcParamsBody(e,"lambda");return new r.n(t,e.line)}if(this.match(b.b.LeftBracket))return this.list();if(this.match(b.b.Void)){const e=this.expression();return new r.D(e,this.previous().line)}if(this.match(b.b.DotDotDot)){const e=this.range();return new r.x(e,this.previous().line)}if(this.match(b.b.Hash))return new r.e(this.call(),this.previous().line);throw this.error(this.peek(),`Expected expression, unexpected token "${this.peek().lexeme}"`)}dictionary(){const e=this.previous();if(this.match(b.b.RightBrace))return new r.g([],this.previous().line);const t=[];do{if(this.match(b.b.String,b.b.Identifier,b.b.Number)){const e=this.previous();if(this.match(b.b.Colon)){const n=this.expression();t.push(new r.w(null,new r.m(e,e.line),n,e.line))}else{const n=new r.C(e,e.line);t.push(new r.w(null,new r.m(e,e.line),n,e.line))}}else if(this.match(b.b.DotDotDot)){const e=this.expression();t.push(new r.x(e,e.line))}else this.error(this.peek(),"String, Number or Identifier expected as a Key of Dictionary {, unexpected token "+this.peek().lexeme)}while(this.match(b.b.Comma));return this.consume(b.b.RightBrace,'Expected "}" after object literal'),new r.g(t,e.line)}list(){const e=[],t=this.previous();if(this.match(b.b.RightBracket))return new r.o([],this.previous().line);if(this.peekNext().type===b.b.Colon){let n=new r.p(new E.a(1),t.line);const s=this.expression();this.consume(b.b.Colon,'Expected ":" color after start of range expression');const i=this.expression();this.consume(b.b.Colon,'Expected ":" color after end of range expression'),this.check(b.b.RightBracket)||(n=this.expression()),e.push(new r.u(s,i,n,s.line))}else do{e.push(this.expression())}while(this.match(b.b.Comma));return this.consume(b.b.RightBracket,'Expected "]" after array declaration'),new r.o(e,t.line)}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return q}));var r=n(2),s=n(5);class i{constructor(e=null){this.values=new Map,this.parent=e}error(e){throw new Error("Runtime Error => "+e)}set(e,t){this.values.set(e,t)}define(e,t){this.values.has(e)?this.error(`Identifier "${e}" has already been defined`):this.set(e,t)}assign(e,t){if(this.values.has(e))this.set(e,t);else{if(null!==this.parent)return this.parent.assign(e,t);this.error(`Identifier "${e}" has not been defined`)}}get(e,t=null){return this.values.has(e)?this.values.get(e):null!==this.parent?this.parent.get(e):(t?this.error(` at (${t.line}:${t.col}) => "${t.lexeme}" is not defined`):this.error(`"${e}" is not defined`),new s.a)}}var a=n(0),o=n(1),u=n(4);class l extends u.a{constructor(e,t,n){super(n,o.a.Function),this.arity=t,this.name=e}call(e,t,n){return this.value(e,t,n)}toString(){return`<${this.name}  function>`}}class c extends l{constructor(e,t){super(e.name.lexeme,e.params.length,null),this.declaration=e,this.closure=t}call(e,t,n){const r=new i(this.closure);for(let e=0;e<this.declaration.params.length;e++)r.define(this.declaration.params[e].lexeme,t[e]);r.set("this",e);let a=null;try{a=n.scope,n.executeBlock(this.declaration.body,r)}catch(e){if(e instanceof u.a&&e.type===o.a.Return)return a&&(n.scope=a),e.value;throw e}return new s.a}}var h=n(6),p=n(3);let d=(()=>{class e extends u.a{constructor(e){super(e,o.a.List)}get(t){return t.isNumber()?void 0!==this.value[t.value]?this.value[t.value]:new s.a:t.isRange()?this.range(t):e.runtime.has(t.value)?e.runtime.get(t.value):new s.a}set(e,t){return e.isNumber()&&(this.value[e.value]=t),t}range(t){const n=[];return t.iterate(this.value.length,e=>{n.push(this.value[e])}),new e(n)}toString(){return`[${this.value.join(",")}]`}static size(e,t){return new p.a(t[0].value.length)}static each(e,t,n){for(let r=0;r<e.value.length;++r)t[0].call(e,[e.value[r],new p.a(r),e],n);return e}static sort(e,t,n){const r=e.value;return t.length?r.sort((r,s)=>t[0].call(e,[r,s],n).value):r.sort((e,t)=>e.value-t.value),e}static map(e,t,n){for(let r=0;r<e.value.length;++r)e.value[r]=t[0].call(e,[new u.a(e.value[r]),new p.a(r),e],n);return e}}return e.runtime=new Map([["concat",g("concat",-1,o.a.List)],["each",new l("each",1,e.each)],["sort",new l("sort",-1,e.sort)],["includes",g("includes",1,o.a.Boolean)],["indexOf",g("indexOf",1,o.a.Number)],["join",g("join",1,o.a.String)],["lastIndexOf",g("lastIndexOf",1,o.a.Number)],["map",new l("map",1,e.map)],["pop",g("pop",0,o.a.List)],["push",g("push",-1,o.a.List)],["shift",g("shift",0,o.a.List)],["size",new l("size",0,(e,t)=>new p.a(e.value.length))],["slice",g("slice",-1,o.a.List)],["splice",g("splice",-1,o.a.List)],["unshift",g("unshift",-1,o.a.List)]]),e})(),m=(()=>{class e extends u.a{constructor(e){super(e,o.a.String)}get(t){return t.isNumber()?new e(this.value[t.value]):t.isRange()?this.range(t):e.runtime.has(t.value)?e.runtime.get(t.value):new s.a}set(e,t){return new s.a}toString(){return""+this.value}range(t){let n="";return t.iterate(this.value.length,e=>{n+=this.value[e]}),new e(n)}static replace(t,n,r){return n[1].isFunction()?t.value.replace(n[0].value,s=>n[1].call(t,[new e(s)],r).value):new e(t.value.replace(n[0].value,n[1].value))}static split(t,n,r){const s=t.value.split(n[0].value).map(t=>new e(t));return new d(s)}}return e.runtime=new Map([["toUpper",g("toUpperCase",0,o.a.String)],["toLower",g("toLowerCase",0,o.a.String)],["size",new l("size",0,(e,t)=>new p.a(e.value.length))],["split",new l("split",1,e.split)],["concat",g("concat",1,o.a.String)],["includes",g("includes",1,o.a.Boolean)],["indexOf",g("indexOf",1,o.a.Number)],["lastIndexOf",g("lastIndexOf",1,o.a.Number)],["repeat",g("repeat",1,o.a.String)],["replace",new l("replace",-1,e.replace)],["search",g("search",1,o.a.Number)],["slice",g("slice",-1,o.a.String)],["substring",g("substring",-1,o.a.String)],["trim",g("trim",0,o.a.String)]]),e})();class v extends u.a{constructor(e){super(e,o.a.Void)}}class f extends u.a{constructor(e){super(e,o.a.RegExp)}}let w=(()=>{class e extends u.a{constructor(e){super(e,o.a.Dictionary)}get(t){return this.value.has(t.value)?this.value.get(t.value):e.runtime.has(t.value)?e.runtime.get(t.value):new s.a}set(e,t){return this.value.set(e.value,t),t}delete(e){const t=this.value.delete(e.value);return new h.a(t)}toString(){const e=[];return this.value.forEach((t,n)=>{e.push(`${n.toString()}: ${t}`)}),`{${e.join("; ")}}`}static each(e,t,n){return e.value.forEach((r,s)=>{t[0].call(e,[r,new m(s),e],n)}),e}static map(e,t,n){return e.value.forEach((r,s)=>{e.value.set("key",t[0].call(e,[r,new m(s),e],n))}),e}static indexOf(e,t,n){let r=null;return e.value.forEach((e,n)=>{e.type===t[0].type&&e.value===t[0].value&&(r=n)}),null!==r?new m(r):new s.a}}return e.runtime=new Map([["clear",g("clear",0,o.a.Null)],["delete",g("delete",1,o.a.Boolean)],["each",new l("each",1,e.each)],["has",g("has",1,o.a.Boolean)],["indexOf",new l("indexOf",1,e.indexOf)],["map",new l("map",1,e.map)],["merge",new l("merge",1,(t,n)=>new e(new Map([...t.value,...n[0].value])))],["size",new l("size",0,(e,t)=>new p.a(e.value.size))]]),e})();class b{constructor(e,t,n,r){this.value=e,this.index=t,this.done=n,this.inner=r}}let x=(()=>{class e extends u.a{constructor(e){super(e,o.a.RegExp),this.iter=new b(new s.a,new s.a,new h.a(!1),null)}get(t){return"key"===t.value||"index"===t.value?this.iter.index:"done"===t.value?this.iter.done:"value"===t.value?this.iter.value:e.runtime.has(t.value)?e.runtime.get(t.value):new s.a}complete(){this.iter.done=new h.a(!0),this.iter.value=new s.a,this.iter.index=new s.a}set(e,t){return void 0!==this.iter[e.value]&&(this.iter[e.value]=t),t}toString(){return`<${o.a[this.value.type]} iterator>`}static next(t,n,r){const s=t;return s.iter.done.value?s:s.value.isList()?(e.listNext(t),s):s.value.isDictionary()?(e.dictionaryNext(t),s):s.value.isString()?(e.stringNext(t),s):s.value.isNumber()?(e.numberNext(t),s):s.value.isRange()?(e.rangeNext(t),s):s.value.isObject()?(t.value.get(r.strings.next).call(t.value,[t],r),s):(r.error(`${o.a[s.value.type].toLowerCase()} with value ${s.value} is not an iterable`),s.complete(),s)}static listNext(e){const t=e,n=t.value,r=t.iter.index;if(!n.value.length)return t.complete(),t;if(null===t.iter.inner)return t.iter.inner=!0,t.iter.index=new p.a(0),t.iter.value=n.value[0],t;if(r.value>=n.value.length-1)return t.complete(),t;const s=r.value+1;return t.iter.index=new p.a(s),t.iter.value=n.value[s],t}static stringNext(e){const t=e,n=t.value,r=t.iter.index;if(!n.value.length)return t.complete(),t;if(null===t.iter.inner)return t.iter.inner=!0,t.iter.index=new p.a(0),t.iter.value=new m(n.value.charAt(0)),t;if(r.value>=n.value.length-1)return t.complete(),t;const s=r.value+1;return t.iter.index=new p.a(s),t.iter.value=new m(n.value.charAt(s)),t}static numberNext(e){const t=e,n=t.value,r=t.iter.index;if(n.value<=0)return t.complete(),t;if(null===t.iter.inner)return t.iter.inner=n.value-1,t.iter.index=new p.a(0),t.iter.value=t.iter.index,t;if(r.value>=t.iter.inner)return t.complete(),t;const s=r.value+1;return t.iter.index=new p.a(s),t.iter.value=t.iter.index,t}static rangeNext(e){const t=e,n=t.value.value;if(0===n.step||n.start>n.end&&n.step>0||n.start<n.end&&n.step<0)return t.complete(),t;if(null===t.iter.inner)return t.iter.inner=!0,t.iter.index=new p.a(0),t.iter.value=new p.a(n.start),t;if(n.step>0){if(t.iter.value.value>=n.end)return t.complete(),t}else if(t.iter.value.value<=n.end)return t.complete(),t;const r=t.iter.index.value+1,s=t.iter.value.value+n.step;return t.iter.index=new p.a(r),t.iter.value=new p.a(s),t}static dictionaryNext(e){const t=e,n=t.value;if(!n.value.size)return t.complete(),t;null===t.iter.inner&&(t.iter.inner=n.value.keys());const r=t.iter.inner.next();return t.iter.value=t.value.get(new u.a(r.value)),t.iter.index=new m(r.value),r.done&&t.complete(),t}static first(e,t,n){return e.value.value.isList()?new w(new Map([["key",0],["value",e.value.value[0]]])):new s.a}}return e.runtime=new Map([["first",new l("first",0,e.first)],["next",new l("next",0,e.next)]]),e})();function g(e,t,n){return new l(e,t,(t,r)=>{const i=r.map(e=>e.value),a=t.value[e](...i);switch(n){case o.a.Boolean:return new h.a(a);case o.a.String:return new m(a);case o.a.Number:return new p.a(a);case o.a.List:return new d(a);case o.a.Null:return new s.a;default:return new u.a(a)}})}function E(e,t,n){return new l(t,n,(t,n)=>{const r=n.map(e=>e.value),s=e(...r);return new p.a(s)})}function y(e,t,n){return new l(t,n,(t,n)=>{const r=n.map(e=>e.value);return e(...r),new v("void")})}const S={Console:new Map([["log",y(console.log,"console.log",-1)],["warn",y(console.warn,"console.warn",-1)],["info",y(console.info,"console.info",-1)],["error",y(console.error,"console.error",-1)]]),Math:new Map([["ceil",E(Math.ceil,"ceil",1)],["cos",E(Math.cos,"cos",1)],["floor",E(Math.floor,"floor",1)],["log",E(Math.log,"log",1)],["max",E(Math.max,"max",-1)],["min",E(Math.min,"min",-1)],["pi",new p.a(Math.PI)],["pow",E(Math.pow,"pow",2)],["random",E(Math.random,"random",0)],["round",E(Math.round,"round",1)],["sin",E(Math.sin,"sin",1)],["sqrt",E(Math.sqrt,"sqrt",1)],["tan",E(Math.tan,"tan",1)],["trunc",E(Math.trunc,"trunc",1)]]),Utils:new Map([["re",new l("regex",-1,(e,t)=>{const n=t.map(e=>e.value);return 1===n.length?new f(new RegExp(n[0])):new f(new RegExp(n[0],n[1]))})],["iter",new l("iter",1,(e,t)=>new x(t[0]))],["delay",new l("delay",2,(e,t,n)=>(setTimeout(()=>{t[0].call(e,[],n)},t[1].value),new s.a))],["fetch",new l("fetch",2,(e,t,n)=>(fetch(t[0].value).then(e=>e.text()).then(r=>{t[1].call(e,[new m(r)],n)}),new s.a))]])};class k extends u.a{constructor(e,t,n){super(t,o.a.Class),this.name=e,this.parent=n}get(e){return this.value.has(e.value)?this.value.get(e.value):this.parent.isClass()?this.parent.get(e):new s.a}set(e,t){return this.value.set(e.value,t),t}delete(e){const t=this.value.delete(e.value);return new h.a(t)}toString(){return`<${this.name} class>`}}class P extends u.a{constructor(e,t){super(e,o.a.Object),this.conztructor=t,this.name=t.name}get(e){const t=this.conztructor.get(e);return t.isFunction()?t:this.value.has(e.value)?this.value.get(e.value):new s.a}set(e,t){return this.value.set(e.value,t),t}delete(e){const t=this.value.delete(e.value);return new h.a(t)}toString(){return`<${this.name} object>`}}class C{constructor(e,t,n){this.start=e,this.end=t,this.step=n}normalize(e){null===this.step&&(this.step=1),null===this.end&&(this.end=this.step>0?e-1:0),null===this.start&&(this.start=this.step>0?0:e-1)}}class L extends u.a{constructor(e){super(e,o.a.Range)}iterate(e,t){if(this.value.normalize(e),this.value.step>0)for(let e=this.value.start;e<=this.value.end;e+=this.value.step)t(e);else if(this.value.step<0)for(let e=this.value.start;e>=this.value.end;e+=this.value.step)t(e);else conzole.warn("[range error] => 0 is not a valid step")}toString(){return`[${this.value.start}:${this.value.end}:${this.value.step}]`}}var B=n(7),D=n(8),N=n(9);class q{constructor(){this.global=new i,this.scope=this.global,this.errors=[],this.scanner=new D.a,this.parser=new N.a,this.strings={next:new m("next")},this.global.set("math",new w(S.Math)),this.global.set("console",new w(S.Console)),this.global.set("echo",S.Console.get("log")),this.global.set("re",S.Utils.get("re")),this.global.set("iter",S.Utils.get("iter")),this.global.set("delay",S.Utils.get("delay")),this.global.set("fetch",S.Utils.get("fetch")),this.parser.errorLevel=0}evaluate(e){return e.result=e.accept(this)}execute(e){return e.result=e.accept(this)}eval(e){try{return{error:!1,value:e.accept(this).toString()}}catch(e){return{error:!0,value:e.message}}}interpet(e){this.errors=[];for(const t of e)try{this.execute(t)}catch(t){if(conzole.error(t.message),this.errors.push(t.message),this.errors.length>100)return this.errors.push("Runtime Error limit exceeded"),e}return e}error(e){throw new Error("Runtime Error => "+e)}visitExpressionStmt(e){return this.evaluate(e.expression)}visitPrintStmt(e){const t=this.evaluate(e.expression);return conzole.log(t.toString()),t}visitVarStmt(e){let t=new s.a;return null!==e.initializer&&(t=this.evaluate(e.initializer)),t.isLambda()&&(t.name=e.name.lexeme),this.scope.define(e.name.lexeme,t),t}visitVariableExpr(e){return this.scope.get(e.name.lexeme,e.name)}visitPostfixExpr(e){const t=this.scope.get(e.name.lexeme,e.name),n=new p.a(t.value+e.increment);return this.scope.assign(e.name.lexeme,n),t}visitListExpr(e){const t=[];for(const n of e.value)if(n instanceof r.x){const e=this.evaluate(n.value);this.spreadAnyIntoList(e,t)}else if(n instanceof r.u){const e=this.evaluate(n).value;if(e.step=e.step?e.step:1,e.step>0&&e.start<=e.end)for(let n=e.start;n<=e.end;n+=e.step)t.push(new p.a(n));else if(e.step<0&&e.start>=e.end)for(let n=e.start;n>=e.end;n+=e.step)t.push(new p.a(n));else this.error(`Invalid range expression at line ${n.line} with range value of [${e.start}:${e.end}:${e.step}]`)}else{const e=this.evaluate(n);t.push(e)}return new d(t)}spreadAnyIntoList(e,t){const n=new x(e);for(;!x.next(n,[],this).iter.done.value;)t.push(n.iter.value)}visitZtringExpr(e){return new m(e.value)}templateParse(e){const t=this.scanner.scan(e),n=this.parser.parse(t);this.parser.errors.length&&this.error("Template string  error: "+this.parser.errors[0]);let r="";for(const e of n)r+=this.execute(e).toString();return r}visitTemplateExpr(e){const t=e.value.replace(/\$\{([\s\S]+?)\}/g,(e,t)=>(";"!==t[t.length]&&(t+=";"),this.templateParse(t)));return new m(t)}visitRegExExpr(e){return new s.a}visitAssignExpr(e){const t=this.evaluate(e.value);return this.scope.assign(e.name.lexeme,t),t}visitBinaryExpr(e){if(e.left instanceof r.x&&e.right instanceof r.x)return this.spreadBinaryExpr(e.left.value,e.right.value,e.operator);const t=this.evaluate(e.left),n=this.evaluate(e.right);switch(e.operator.type){case a.b.Minus:case a.b.MinusEqual:return new p.a(t.value-n.value);case a.b.Slash:case a.b.SlashEqual:return new p.a(t.value/n.value);case a.b.Star:case a.b.StarEqual:return new p.a(t.value*n.value);case a.b.Percent:case a.b.PercentEqual:return new p.a(t.value%n.value);case a.b.Plus:case a.b.PlusEqual:return t.isNumber()&&n.isNumber()?new p.a(t.value+n.value):t.isString()&&n.isString()?new m(t.value+n.value):t.isList()&&n.isList()?new d(t.value.concat(n.value)):t.isDictionary()&&n.isDictionary()?new w(new Map([...t.value,...n.value])):new m(t.toString()+n.toString());case a.b.Pipe:return new p.a(t.value|n.value);case a.b.Caret:return new p.a(t.value^n.value);case a.b.Greater:return new h.a(t.value>n.value);case a.b.GreaterEqual:return new h.a(t.value>=n.value);case a.b.Less:return new h.a(t.value<n.value);case a.b.LessEqual:return new h.a(t.value<=n.value);case a.b.EqualEqual:return new h.a(t.value===n.value);case a.b.BangEqual:return new h.a(t.value!==n.value);case a.b.LessEqualGreater:return t.value<n.value?new p.a(-1):t.value>n.value?new p.a(1):new p.a(0);default:return this.error("Unknown binary operator "+e.operator),new s.a}}spreadBinaryExpr(e,t,n){const s=new x(this.evaluate(e)),i=new x(this.evaluate(t)),a=[];for(;x.next(s,[],this),x.next(i,[],this),!s.iter.done.value&&!i.iter.done.value;){const o=new r.c(new r.p(s.iter.value,e.line),n,new r.p(i.iter.value,t.line),n.line);a.push(this.evaluate(o))}return new d(a)}visitLogicalExpr(e){const t=this.evaluate(e.left);if(e.operator.type===a.b.Or){if(t.isTruthy())return t}else if(!t.isTruthy())return t;return this.evaluate(e.right)}visitTernaryExpr(e){return this.evaluate(e.condition).isTruthy()?this.evaluate(e.thenExpr):this.evaluate(e.elseExpr)}visitNullCoalescingExpr(e){const t=this.evaluate(e.left);return t.isNull()?this.evaluate(e.right):t}visitGroupingExpr(e){return this.evaluate(e.expression)}visitLiteralExpr(e){return e.value}visitUnaryExpr(e){const t=this.evaluate(e.right);switch(e.operator.type){case a.b.Minus:return new p.a(-Number(t.value));case a.b.Bang:return new h.a(!t.isTruthy());case a.b.PlusPlus:case a.b.MinusMinus:t.isNumber()||this.error(`Invalid right-hand side expression in prefix operation:  "${o.a[t.type]} ${t} is not a number`);const n=Number(t.value)+(e.operator.type===a.b.PlusPlus?1:-1);if(e.right instanceof r.C)this.scope.assign(e.right.name.lexeme,new p.a(n));else if(e.right instanceof r.h){const t=new r.w(e.right.entity,e.right.key,new r.p(new p.a(n),e.line),e.line);this.evaluate(t)}else this.error("Invalid right-hand side expression in prefix operation:  "+e.right);return new p.a(n);default:return this.error("Unknown unary operator ' + expr.operator"),new s.a}}executeBlock(e,t){const n=this.scope;this.scope=t;for(const t of e)t.result=this.execute(t);return this.scope=n,new v("block")}visitBlockStmt(e){return this.executeBlock(e.statements,new i(this.scope))}visitIfStmt(e){return this.evaluate(e.condition).isTruthy()?this.execute(e.thenStmt):null!==e.elseStmt?this.execute(e.elseStmt):void 0}visitWhileStmt(e){for(;this.evaluate(e.condition).isTruthy();)try{this.execute(e.loop)}catch(e){if(e instanceof u.a&&e.type===o.a.Break)break;if(e instanceof u.a&&e.type===o.a.Continue)continue;throw e}return new v("while")}visitDoWhileStmt(e){do{try{this.execute(e.loop)}catch(e){if(e instanceof u.a&&e.type===o.a.Break)break;if(e instanceof u.a&&e.type===o.a.Continue)continue;throw e}}while(this.evaluate(e.condition).isTruthy());return new v("dowhile")}visitForeachStmt(e){const t=new x(this.evaluate(e.iterable)),n=this.scope;for(;!x.next(t,[],this).iter.done.value;){const r=new i(this.scope);r.set(e.name.lexeme,t.iter.value),e.key&&r.set(e.key.lexeme,t.iter.index);try{this.executeBlock([e.loop],r)}catch(e){if(this.scope=n,e instanceof u.a&&e.type===o.a.Break)break;if(e instanceof u.a&&e.type===o.a.Continue)continue;throw e}}return new v("foreach")}visitCallExpr(e){const t=this.evaluate(e.callee);t.isFunction()||this.error(t+" is not a function");let n=null;e.callee instanceof r.h?n=e.callee.entity instanceof r.b?this.scope.get("this",e.paren):this.evaluate(e.callee.entity):null!==e.thiz&&(n=e.thiz);const i=[];for(const t of e.args)if(t instanceof r.x){const e=this.evaluate(t.value);this.spreadAnyIntoList(e,i)}else i.push(this.evaluate(t));const a=t;if(i.length!==a.arity&&-1!==a.arity&&(conzole.warn(`Warning at (${e.paren.line}): ${t} mismatched argument count; \n Expected ${a.arity} but got ${i.length} `),i.length<a.arity))for(let e=i.length;e<=a.arity;++e)i.push(new s.a);return a.call(n,i,this)}visitBaseExpr(e){const t=this.scope.get(e.paren.lexeme,e.paren);t.isObject()||this.error("base expression can be used only inside methods");const n=t.conztructor,r=n.parent;return r.isNull()&&this.error("Class "+n+" has not been extended and has no base"),r}visitNewExpr(e){const t=e.clazz,n=this.evaluate(t.callee);n.isClass()||this.error(`'${n}' is not a class. 'new' statement must be used with classes.`);const s=new P(new Map,n),i=n.get(new m("constructor"));return i.isFunction()&&this.evaluate(new r.d(new r.h(new r.p(s,e.line),new r.m(i.declaration.name,e.line),a.b.Dot,e.line),i.declaration.name,t.args,s,e.line)),s}visitDictionaryExpr(e){const t=new w(new Map);for(const n of e.properties)if(n instanceof r.x){const e=this.evaluate(n.value),r=new x(e);for(;!x.next(r,[],this).iter.done.value;)t.set(r.iter.index,r.iter.value)}else{const e=this.evaluate(n.key),r=this.evaluate(n.value);t.set(e,r)}return t}visitKeyExpr(e){return new u.a(e.name.literal)}visitGetExpr(e){const t=this.evaluate(e.entity),n=this.evaluate(e.key);return t.isNull()&&e.type===a.b.QuestionDot?new s.a:t.get(n)}visitSetExpr(e){const t=this.evaluate(e.entity),n=this.evaluate(e.key),r=this.evaluate(e.value);return t.set(n,r),r.value}visitFuncStmt(e){const t=new c(e,this.scope);return this.scope.define(e.name.lexeme,t),t}visitClassStmt(e){let t;t=null===e.parent?new s.a:this.scope.get(e.parent.lexeme,e.parent);const n=new Map;for(const t of e.methods)n.set(t.name.lexeme,new c(t,this.scope));const r=new k(e.name.lexeme,n,t);return this.scope.define(e.name.lexeme,r),r}visitLambdaExpr(e){const t=e.lambda;return new c(t,this.scope)}visitReturnStmt(e){let t=new s.a;throw e.value&&(t=this.evaluate(e.value)),new u.a(t,o.a.Return)}visitBreakStmt(e){throw new u.a(null,o.a.Break)}visitContinueStmt(e){throw new u.a(null,o.a.Continue)}visitRangeExpr(e){const t=e.start?this.evaluate(e.start).value:null,n=e.end?this.evaluate(e.end).value:null,r=e.step?this.evaluate(e.step).value:t<=n?1:-1;return new L(new C(t,n,r))}visitTypeofExpr(e){const t=this.evaluate(e.value);return new m(o.a[t.type].toLowerCase())}visitIsExpr(e){const t=this.evaluate(e.left),n=o.a[Object(B.a)(e.right.lexeme)];return t.isObject()&&t.name===e.right.lexeme?new h.a(!0):void 0===n||isNaN(n)?new h.a(!1):new h.a(t.type===n)}visitInstanceOfExpr(e){const t=this.evaluate(e.left);if(!t.isObject())return new h.a(!1);const n=e.right.lexeme;if("object"===n.toLowerCase())return new h.a(!0);let r=t.conztructor;if(r.name===n)return new h.a(!0);for(;!r.parent.isNull();)if(r=r.parent,r.name===n)return new h.a(!0);return new h.a(!1)}visitVoidExpr(e){return this.evaluate(e.value),new s.a}visitInExpr(e){const t=this.evaluate(e.key),n=this.evaluate(e.entity);return n.isKeyValue()?new h.a(n.value.has(t.value)):n.isList()?new h.a(void 0!==n.value[t.value]):n.isString()?new h.a(n.value.includes(t.value)):(this.error(`Operator "in" can't be used on type ${o.a[n.type]} with value "${n}"`),new s.a)}visitCharExpr(e){const t=this.evaluate(e.value);return new m(String.fromCharCode(t.value))}visitSpreadExpr(e){return new s.a}visitDeleteExpr(e){if(!(e.value instanceof r.h)){const t=this.evaluate(e.value),n=o.a[t.type].toLowerCase();return this.error(`Can't delete on type ${n} with value '${t}'. Not a Dictionary, Class or Entity`),new s.a}const t=e.value,n=this.evaluate(t.entity),i=this.evaluate(t.key);return n.delete(i)}}},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return s})),function(e){e[e.User=0]="User",e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Info=3]="Info"}(r||(r={}));class s{constructor(){this.messages=[]}add(e,t){this.messages.push({text:e,time:new Date,type:t})}clear(){this.messages=[]}log(e){this.add(e,r.User)}warn(e){this.add(e,r.Warning)}error(e){this.add(e,r.Error)}info(e){this.add(e,r.Info)}first(){return this.messages[0].text}last(){return this.messages[this.messages.length-1].text}print(){return console.log(this.messages.map(e=>e.text))}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r="\n// slicing strings\nprint \"one two three four\"[4:7:1]; // prints two\nprint \"hello world\"[::-1]; //prints dlrow olleh\n\n// range operator on list contstruction\nprint [0:10:3]; // prints a list [0,3,6,9]\nprint [1..5]; // prints [1,2,3,4,5]\n\n// spread operator\nprint {...[1,2,3]}; // prints {0: 1; 1: 2; 2: 3}\nprint ...1..3 == ...1..3; // prints [true,true,true];\nprint ...\"abz\" <=> ...\"ayc\"; // prints [0,-1,1]\n\n\n// functions\nfunction BasicFunction(text) {\n    print text;\n}\nBasicFunction('BasicFunctionArgument');\n\n// classes\nclass Person {\n    constructor(name) {\n        this.name = name;\n    }\n    hello() {\n        print this.name + ' says hi';\n    }\n}\nclass Student extends Person {\n    constructor(name, grade) {\n        base.constructor(name);\n        this.grade = grade;\n    }\n    hello() {\n        base.hello();\n        print 'from ' + this.grade + ' grade';\n    }\n}\nvar student = new Student('John', 3);\nstudent.hello();\n\n// Recursive function\nfunction factorialize(n) {\n    if (n < 0) {\n        return -1;\n    }\n    if (n == 0) {\n        return 1;\n    }\n    return (n * factorialize(n - 1));\n}\nprint 'factor of 11: ' + factorialize(11);\n// same as factorialize but with ternary\n// and short form function definition\n@factor(n) =>\n    n < 0 ? -1 : (n == 0 ? 1 : (n * factorialize(n - 1)));\nprint 'factor of 11: ' +factor(11);\n\n// nested function returns function\n@add(a) => @(b) => @(c) => a + b + c;\nprint add(100)(20)(3);\n\n// literals\nvar literal = {\n    firstname: \"John\",\n    lastname: \"Doe\",\n    records: {\n        prev: \"previous\",\n        next: \"next\"\n    }\n};\nprint literal.records.prev;\n\n// safe navigator operator ?.\nprint literal.safeNavigator?.propertyDoesNotExist;\n\n// delete operator\ndelete literal.firstname;\n\n// new scope test\n{\n    var a = {a: 'one'};\n    var b = {b: 'two'};\n    var c = a + b;\n    print c; // prints {a: 'one', b: 'two'}\n}\n// new scope test\n{\n    var a = {d: 'three'};\n    var b = {e: 'four'};\n    var c = a + b;\n    print c; // prints {d: 'three', e: 'four'}\n}\n\n// typeof, is, instanceof operator\nprint typeof Person;\nprint typeof student;\nprint 'Student is Class: ' + (Student is Class);\nprint 'student is Object: ' + (student is Object);\nprint 'student is Person: ' + (student is Person);\nprint 'student is Student: ' + (student is Student);\nprint 'student instanceof Person: ' + (student instanceof Person);\nprint typeof '' + 'string';\n\n// iterators\nvar it = iter(['one', 'two', 'three']);\nwhile (!it.next().done) {\n    print it.value;\n}\n\n// foreach statement\nforeach (item with key in ['one', 'two', 'three']) {\n    print item;\n}\n\n// spread operator\n{\n    var a1 = ['one', 'two', 'three'];\n    var b2 = [...a1, ...\"spreading\"];\n    var d3 = {\n        ...a1,\n        ...\"spreding\"\n    };\n    print b2;\n    print d3;\n}\n\n// loggin into js console\necho ('execution finished');\n\n// fetching data. Currently unparsed text\nfetch ('https://jsonplaceholder.typicode.com/todos/1', @(res) {\n    echo(res);\n});\n"},function(e,t,n){"use strict";n.r(t),function(e){var t=n(8),r=n(9),s=n(10),i=n(11),a=n(12);const o=new i.a,u={execute:e=>{const n=new t.a,i=new r.a,a=new s.a,u=n.scan(e);if(n.errors.length)return n.errors.forEach(e=>{o.error(e)}),[];const l=i.parse(u);return i.errors.length?(i.errors.forEach(e=>{o.error(e)}),[]):a.interpet(l)},interpreter:s.a,parser:r.a,scanner:t.a};"undefined"!=typeof window?(window.demoSourceCode=a.a,window.atscript=u,window.conzole=o):(e.conzole=o,exports.atscript=u)}.call(this,n(14))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n}]);