assemblyscript/dist/assemblyscript.js
2019-02-21 23:04:41 +01:00

3 lines
487 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("binaryen")):"function"==typeof define&&define.amd?define(["binaryen"],t):"object"==typeof exports?exports.assemblyscript=t(require("binaryen")):e.assemblyscript=t(e.binaryen)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=16)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.NONE=0]="NONE",e[e.IMPORT=1]="IMPORT",e[e.EXPORT=2]="EXPORT",e[e.DECLARE=4]="DECLARE",e[e.CONST=8]="CONST",e[e.LET=16]="LET",e[e.STATIC=32]="STATIC",e[e.READONLY=64]="READONLY",e[e.ABSTRACT=128]="ABSTRACT",e[e.PUBLIC=256]="PUBLIC",e[e.PRIVATE=512]="PRIVATE",e[e.PROTECTED=1024]="PROTECTED",e[e.GET=2048]="GET",e[e.SET=4096]="SET",e[e.DEFINITE_ASSIGNMENT=8192]="DEFINITE_ASSIGNMENT",e[e.AMBIENT=16384]="AMBIENT",e[e.GENERIC=32768]="GENERIC",e[e.GENERIC_CONTEXT=65536]="GENERIC_CONTEXT",e[e.INSTANCE=131072]="INSTANCE",e[e.CONSTRUCTOR=262144]="CONSTRUCTOR",e[e.ARROW=524288]="ARROW",e[e.MODULE_EXPORT=1048576]="MODULE_EXPORT",e[e.MODULE_IMPORT=2097152]="MODULE_IMPORT",e[e.RESOLVED=4194304]="RESOLVED",e[e.COMPILED=8388608]="COMPILED",e[e.INLINED=16777216]="INLINED",e[e.SCOPED=33554432]="SCOPED",e[e.TRAMPOLINE=67108864]="TRAMPOLINE",e[e.VIRTUAL=134217728]="VIRTUAL",e[e.MAIN=268435456]="MAIN",e[e.QUOTED=536870912]="QUOTED"}(t.CommonFlags||(t.CommonFlags={})),t.PATH_DELIMITER="/",t.PARENT_SUBST="..",t.GETTER_PREFIX="get:",t.SETTER_PREFIX="set:",t.INSTANCE_DELIMITER="#",t.STATIC_DELIMITER=".",t.INNER_DELIMITER="~",t.LIBRARY_SUBST="~lib",t.LIBRARY_PREFIX=t.LIBRARY_SUBST+t.PATH_DELIMITER,t.INDEX_SUFFIX=t.PATH_DELIMITER+"index",function(e){e.EMPTY="",e.i8="i8",e.i16="i16",e.i32="i32",e.i64="i64",e.isize="isize",e.u8="u8",e.u16="u16",e.u32="u32",e.u64="u64",e.usize="usize",e.bool="bool",e.f32="f32",e.f64="f64",e.v128="v128",e.void_="void",e.number="number",e.boolean="boolean",e.string="string",e.native="native",e.null_="null",e.true_="true",e.false_="false",e.this_="this",e.super_="super",e.constructor="constructor"}(t.CommonSymbols||(t.CommonSymbols={})),function(e){e.ASC_TARGET="ASC_TARGET",e.ASC_NO_TREESHAKING="ASC_NO_TREESHAKING",e.ASC_NO_ASSERT="ASC_NO_ASSERT",e.ASC_MEMORY_BASE="ASC_MEMORY_BASE",e.ASC_OPTIMIZE_LEVEL="ASC_OPTIMIZE_LEVEL",e.ASC_SHRINK_LEVEL="ASC_SHRINK_LEVEL",e.ASC_FEATURE_MUTABLE_GLOBAL="ASC_FEATURE_MUTABLE_GLOBAL",e.ASC_FEATURE_SIGN_EXTENSION="ASC_FEATURE_SIGN_EXTENSION",e.ASC_FEATURE_BULK_MEMORY="ASC_FEATURE_BULK_MEMORY",e.ASC_FEATURE_SIMD="ASC_FEATURE_SIMD",e.I8="I8",e.I16="I16",e.I32="I32",e.I64="I64",e.Isize="Isize",e.U8="U8",e.U16="U16",e.U32="U32",e.U64="U64",e.Usize="Usize",e.Bool="Bool",e.F32="F32",e.F64="F64",e.V128="V128",e.String="String",e.Array="Array",e.ArrayBuffer="ArrayBuffer",e.Math="Math",e.Mathf="Mathf",e.memory="memory",e.allocate="allocate",e.abort="abort",e.main="main",e.length="length",e.byteLength="byteLength",e.pow="pow",e.mod="mod"}(t.LibrarySymbols||(t.LibrarySymbols={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(11),a=r(2),o=r(11);function s(e){switch(e){case n.INFO:return"INFO";case n.WARNING:return"WARNING";case n.ERROR:return"ERROR";default:return assert(!1),""}}function c(e){switch(e){case n.INFO:return t.COLOR_BLUE;case n.WARNING:return t.COLOR_YELLOW;case n.ERROR:return t.COLOR_RED;default:return assert(!1),""}}t.DiagnosticCode=o.DiagnosticCode,t.diagnosticCodeToString=o.diagnosticCodeToString,function(e){e[e.INFO=0]="INFO",e[e.WARNING=1]="WARNING",e[e.ERROR=2]="ERROR"}(n=t.DiagnosticCategory||(t.DiagnosticCategory={})),t.diagnosticCategoryToString=s,t.COLOR_BLUE="",t.COLOR_YELLOW="",t.COLOR_RED="",t.COLOR_RESET="",t.diagnosticCategoryToColor=c;var l=function(){function e(e,t,r){this.range=null,this.relatedRange=null,this.code=e,this.category=t,this.message=r}return e.create=function(t,r,n,a,o){void 0===n&&(n=null),void 0===a&&(a=null),void 0===o&&(o=null);var s=i.diagnosticCodeToString(t);return null!=n&&(s=s.replace("{0}",n)),null!=a&&(s=s.replace("{1}",a)),null!=o&&(s=s.replace("{2}",o)),new e(t,r,s)},e.createInfo=function(t,r,i){return void 0===r&&(r=null),void 0===i&&(i=null),e.create(t,n.INFO,r,i)},e.createWarning=function(t,r,i){return void 0===r&&(r=null),void 0===i&&(i=null),e.create(t,n.WARNING,r,i)},e.createError=function(t,r,i){return void 0===r&&(r=null),void 0===i&&(i=null),e.create(t,n.ERROR,r,i)},e.prototype.withRange=function(e){return this.range=e,this},e.prototype.withRelatedRange=function(e){return this.relatedRange=e,this},e.prototype.toString=function(){return this.range?s(this.category)+" "+this.code.toString(10)+': "'+this.message+'" in '+this.range.source.normalizedPath+":"+this.range.line.toString(10)+":"+this.range.column.toString(10):s(this.category)+" "+this.code.toString(10)+": "+this.message},e}();function p(e,r){void 0===r&&(r=!1);for(var n=e.source.text,i=n.length,o=e.start,s=e.end;o>0&&!a.isLineBreak(n.charCodeAt(o-1));)o--;for(;s<i&&!a.isLineBreak(n.charCodeAt(s));)s++;for(var c=["\n ",n.substring(o,s),"\n "];o<e.start;)c.push(" "),o++;if(r&&c.push(t.COLOR_RED),e.start==e.end)c.push("^");else for(;o++<e.end;)c.push("~");return r&&c.push(t.COLOR_RESET),c.join("")}t.DiagnosticMessage=l,t.formatDiagnosticMessage=function(e,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1);var i=[];if(r&&i.push(c(e.category)),i.push(s(e.category)),r&&i.push(t.COLOR_RESET),i.push(e.code<1e3?" AS":" TS"),i.push(e.code.toString(10)),i.push(": "),i.push(e.message),e.range){var a=e.range;n&&(i.push("\n"),i.push(p(a,r))),i.push("\n"),i.push(" in "),i.push(a.source.normalizedPath),i.push("("),i.push(a.line.toString(10)),i.push(","),i.push(a.column.toString(10)),i.push(")");var o=e.relatedRange;o&&(n&&(i.push("\n"),i.push(p(o,r))),i.push("\n"),i.push(" in "),i.push(a.source.normalizedPath),i.push("("),i.push(a.line.toString(10)),i.push(","),i.push(a.column.toString(10)),i.push(")"))}return i.join("")},t.formatDiagnosticContext=p;var u=function(){function e(e){void 0===e&&(e=null),this.diagnostics=e||new Array}return e.prototype.emitDiagnostic=function(e,t,r,n,i,a,o){void 0===i&&(i=null),void 0===a&&(a=null),void 0===o&&(o=null);var s=l.create(e,t,i,a,o).withRange(r);n&&(s.relatedRange=n),this.diagnostics.push(s)},e.prototype.info=function(e,t,r,i,a){void 0===r&&(r=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.INFO,t,null,r,i,a)},e.prototype.infoRelated=function(e,t,r,i,a,o){void 0===i&&(i=null),void 0===a&&(a=null),void 0===o&&(o=null),this.emitDiagnostic(e,n.INFO,t,r,i,a,o)},e.prototype.warning=function(e,t,r,i,a){void 0===r&&(r=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.WARNING,t,null,r,i,a)},e.prototype.warningRelated=function(e,t,r,i,a,o){void 0===i&&(i=null),void 0===a&&(a=null),void 0===o&&(o=null),this.emitDiagnostic(e,n.WARNING,t,r,i,a,o)},e.prototype.error=function(e,t,r,i,a){void 0===r&&(r=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.ERROR,t,null,r,i,a)},e.prototype.errorRelated=function(e,t,r,i,a,o){void 0===i&&(i=null),void 0===a&&(a=null),void 0===o&&(o=null),this.emitDiagnostic(e,n.ERROR,t,r,i,a,o)},e}();t.DiagnosticEmitter=u},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(25)),n(r(26)),n(r(27)),n(r(28)),n(r(29)),n(r(30))},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0});var s,c=r(0),l=r(1),p=r(6),u=r(5),_=r(9),h=r(12),d=function(){return function(e,t,r,n,i){this.localFile=e,this.localIdentifier=t,this.foreignIdentifier=r,this.foreignPath=n,this.foreignPathAlt=i}}(),y=function(){return function(e,t,r,n){this.localIdentifier=e,this.foreignIdentifier=t,this.foreignPath=r,this.foreignPathAlt=n}}(),m=function(){return function(e,t,r){this.foreignPath=e,this.foreignPathAlt=t,this.pathLiteral=r}}();function g(e,t){switch(assert(t.length),e){case u.DecoratorKind.OPERATOR:case u.DecoratorKind.OPERATOR_BINARY:switch(t.charCodeAt(0)){case 91:if("[]"==t)return s.INDEXED_GET;if("[]="==t)return s.INDEXED_SET;break;case 123:if("{}"==t)return s.UNCHECKED_INDEXED_GET;if("{}="==t)return s.UNCHECKED_INDEXED_SET;break;case 43:if("+"==t)return s.ADD;break;case 45:if("-"==t)return s.SUB;break;case 42:if("*"==t)return s.MUL;if("**"==t)return s.POW;break;case 47:if("/"==t)return s.DIV;break;case 37:if("%"==t)return s.REM;break;case 38:if("&"==t)return s.BITWISE_AND;break;case 124:if("|"==t)return s.BITWISE_OR;break;case 94:if("^"==t)return s.BITWISE_XOR;break;case 61:if("=="==t)return s.EQ;break;case 33:if("!="==t)return s.NE;break;case 62:if(">"==t)return s.GT;if(">="==t)return s.GE;if(">>"==t)return s.BITWISE_SHR;if(">>>"==t)return s.BITWISE_SHR_U;break;case 60:if("<"==t)return s.LT;if("<="==t)return s.LE;if("<<"==t)return s.BITWISE_SHL}break;case u.DecoratorKind.OPERATOR_PREFIX:switch(t.charCodeAt(0)){case 43:if("+"==t)return s.PLUS;if("++"==t)return s.PREFIX_INC;break;case 45:if("-"==t)return s.MINUS;if("--"==t)return s.PREFIX_DEC;break;case 33:if("!"==t)return s.NOT;break;case 126:if("~"==t)return s.BITWISE_NOT}break;case u.DecoratorKind.OPERATOR_POSTFIX:switch(t.charCodeAt(0)){case 43:if("++"==t)return s.POSTFIX_INC;break;case 45:if("--"==t)return s.POSTFIX_DEC}}return s.INVALID}!function(e){e[e.INVALID=0]="INVALID",e[e.INDEXED_GET=1]="INDEXED_GET",e[e.INDEXED_SET=2]="INDEXED_SET",e[e.UNCHECKED_INDEXED_GET=3]="UNCHECKED_INDEXED_GET",e[e.UNCHECKED_INDEXED_SET=4]="UNCHECKED_INDEXED_SET",e[e.ADD=5]="ADD",e[e.SUB=6]="SUB",e[e.MUL=7]="MUL",e[e.DIV=8]="DIV",e[e.REM=9]="REM",e[e.POW=10]="POW",e[e.BITWISE_AND=11]="BITWISE_AND",e[e.BITWISE_OR=12]="BITWISE_OR",e[e.BITWISE_XOR=13]="BITWISE_XOR",e[e.BITWISE_SHL=14]="BITWISE_SHL",e[e.BITWISE_SHR=15]="BITWISE_SHR",e[e.BITWISE_SHR_U=16]="BITWISE_SHR_U",e[e.EQ=17]="EQ",e[e.NE=18]="NE",e[e.GT=19]="GT",e[e.GE=20]="GE",e[e.LT=21]="LT",e[e.LE=22]="LE",e[e.PLUS=23]="PLUS",e[e.MINUS=24]="MINUS",e[e.NOT=25]="NOT",e[e.BITWISE_NOT=26]="BITWISE_NOT",e[e.PREFIX_INC=27]="PREFIX_INC",e[e.PREFIX_DEC=28]="PREFIX_DEC",e[e.POSTFIX_INC=29]="POSTFIX_INC",e[e.POSTFIX_DEC=30]="POSTFIX_DEC"}(s=t.OperatorKind||(t.OperatorKind={}));var T,f,E=function(e){function t(t){void 0===t&&(t=null);var r=e.call(this,t)||this;r.sources=[],r.diagnosticsOffset=0,r.explicitStartFunction=null,r.filesByName=new Map,r.elementsByName=new Map,r.elementsByDeclaration=new Map,r.instancesByName=new Map,r.typeClasses=new Map,r.arrayBufferInstance=null,r.arrayPrototype=null,r.stringInstance=null,r.abortInstance=null,r.memoryAllocateInstance=null,r.hasGC=!1,r.gcAllocateInstance=null,r.gcLinkInstance=null,r.gcMarkInstance=null,r.gcHeaderSize=0,r.gcHookOffset=0,r.nativeDummySignature=null;var n=new u.Source(c.LIBRARY_SUBST,"[native code]",u.SourceKind.LIBRARY);r.nativeSource=n;var i=new A(r,n);return r.nativeFile=i,r.filesByName.set(i.internalName,i),r.resolver=new _.Resolver(r),r}return i(t,e),t.prototype.makeNativeVariableDeclaration=function(e,t){void 0===t&&(t=c.CommonFlags.NONE);var r=this.nativeSource.range;return u.Node.createVariableDeclaration(u.Node.createIdentifierExpression(e,r),null,null,null,t,r)},t.prototype.makeNativeTypeDeclaration=function(e,t){void 0===t&&(t=c.CommonFlags.NONE);var r=this.nativeSource.range,n=u.Node.createIdentifierExpression(e,r);return u.Node.createTypeDeclaration(n,null,u.Node.createOmittedType(r),null,t,r)},t.prototype.makeNativeFunctionDeclaration=function(e,t){void 0===t&&(t=c.CommonFlags.NONE);var r=this.nativeSource.range;return u.Node.createFunctionDeclaration(u.Node.createIdentifierExpression(e,r),null,this.nativeDummySignature||(this.nativeDummySignature=u.Node.createSignature([],u.Node.createType(u.Node.createSimpleTypeName(c.CommonSymbols.void_,r),null,!1,r),null,!1,r)),null,null,t,r)},t.prototype.makeNativeNamespaceDeclaration=function(e,t){void 0===t&&(t=c.CommonFlags.NONE);var r=this.nativeSource.range;return u.Node.createNamespaceDeclaration(u.Node.createIdentifierExpression(e,r),[],null,t,r)},t.prototype.makeNativeFunction=function(e,t,r,n,i){return void 0===r&&(r=this.nativeFile),void 0===n&&(n=c.CommonFlags.NONE),void 0===i&&(i=f.NONE),new D(e,new B(e,r,this.makeNativeFunctionDeclaration(e,n),i),t)},t.prototype.getElementByDeclaration=function(e){var t=this.elementsByDeclaration;return assert(t.has(e)),t.get(e)},t.prototype.initialize=function(e){var t,r,n,i,s,_,h,d,y,m,g,E;this.options=e,this.registerNativeType(c.CommonSymbols.i8,p.Type.i8),this.registerNativeType(c.CommonSymbols.i16,p.Type.i16),this.registerNativeType(c.CommonSymbols.i32,p.Type.i32),this.registerNativeType(c.CommonSymbols.i64,p.Type.i64),this.registerNativeType(c.CommonSymbols.isize,e.isizeType),this.registerNativeType(c.CommonSymbols.u8,p.Type.u8),this.registerNativeType(c.CommonSymbols.u16,p.Type.u16),this.registerNativeType(c.CommonSymbols.u32,p.Type.u32),this.registerNativeType(c.CommonSymbols.u64,p.Type.u64),this.registerNativeType(c.CommonSymbols.usize,e.usizeType),this.registerNativeType(c.CommonSymbols.bool,p.Type.bool),this.registerNativeType(c.CommonSymbols.f32,p.Type.f32),this.registerNativeType(c.CommonSymbols.f64,p.Type.f64),this.registerNativeType(c.CommonSymbols.void_,p.Type.void),this.registerNativeType(c.CommonSymbols.number,p.Type.f64),this.registerNativeType(c.CommonSymbols.boolean,p.Type.bool),this.nativeFile.add(c.CommonSymbols.native,new N(c.CommonSymbols.native,this.nativeFile,this.makeNativeTypeDeclaration(c.CommonSymbols.native,c.CommonFlags.EXPORT|c.CommonFlags.GENERIC),f.BUILTIN)),e.hasFeature(8)&&this.registerNativeType(c.CommonSymbols.v128,p.Type.v128),this.registerConstantInteger(c.LibrarySymbols.ASC_TARGET,p.Type.i32,i64_new(e.isWasm64?2:1)),this.registerConstantInteger(c.LibrarySymbols.ASC_NO_ASSERT,p.Type.bool,i64_new(e.noAssert?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_MEMORY_BASE,p.Type.i32,i64_new(e.memoryBase,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_OPTIMIZE_LEVEL,p.Type.i32,i64_new(e.optimizeLevelHint,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_SHRINK_LEVEL,p.Type.i32,i64_new(e.shrinkLevelHint,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_MUTABLE_GLOBAL,p.Type.bool,i64_new(e.hasFeature(2)?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_SIGN_EXTENSION,p.Type.bool,i64_new(e.hasFeature(1)?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_BULK_MEMORY,p.Type.bool,i64_new(e.hasFeature(4)?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_SIMD,p.Type.bool,i64_new(e.hasFeature(8)?1:0,0));for(var I=new Array,v=new Map,S=new Map,C=new Array,O=new Array,x=0,k=this.sources.length;x<k;++x){var L=this.sources[x],R=new A(this,L);this.filesByName.set(R.internalName,R);for(var F=L.statements,B=0,D=F.length;B<D;++B){var U=F[B];switch(U.kind){case u.NodeKind.EXPORT:this.initializeExports(U,R,v,S);break;case u.NodeKind.IMPORT:this.initializeImports(U,R,I,v);break;case u.NodeKind.VARIABLE:this.initializeVariables(U,R);break;case u.NodeKind.CLASSDECLARATION:this.initializeClass(U,R,C,O);break;case u.NodeKind.ENUMDECLARATION:this.initializeEnum(U,R);break;case u.NodeKind.FUNCTIONDECLARATION:this.initializeFunction(U,R);break;case u.NodeKind.INTERFACEDECLARATION:this.initializeInterface(U,R);break;case u.NodeKind.NAMESPACEDECLARATION:this.initializeNamespace(U,R,C,O);break;case u.NodeKind.TYPEDECLARATION:this.initializeTypeDefinition(U,R)}}}try{for(var P=a(S),w=P.next();!w.done;w=P.next()){var M=o(w.value,2),G=(R=M[0],M[1]);for(x=0,k=G.length;x<k;++x){var V=G[x];(K=this.lookupForeignFile(V.foreignPath,V.foreignPathAlt))?R.ensureExportStar(K):this.error(l.DiagnosticCode.File_0_not_found,V.pathLiteral.range,V.pathLiteral.value)}}}catch(e){t={error:e}}finally{try{w&&!w.done&&(r=P.return)&&r.call(P)}finally{if(t)throw t.error}}for(x=0,k=I.length;x<k;++x){var K,z=I[x],H=z.foreignIdentifier;if(H)(me=this.lookupForeign(H.text,z.foreignPath,z.foreignPathAlt,v))?z.localFile.add(z.localIdentifier.text,me,!0):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,H.range,z.foreignPath,H.text);else if(K=this.lookupForeignFile(z.foreignPath,z.foreignPathAlt)){var Y=z.localFile,W=z.localIdentifier.text;Y.add(W,K.asImportedNamespace(W,Y),!0)}else assert(!1)}try{for(var X=a(v),Q=X.next();!Q.done;Q=X.next()){var q=o(Q.value,2),j=(R=q[0],q[1]);try{for(var Z=a(j),J=Z.next();!J.done;J=Z.next()){var $=o(J.value,2),ee=$[0],te=$[1],re=(W=te.localIdentifier.text,te.foreignPath);if(re)(me=this.lookupForeign(W,re,assert(te.foreignPathAlt),v))?R.ensureExport(ee,me):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,te.localIdentifier.range,re,W);else if(me=R.lookupInSelf(W))R.ensureExport(ee,me);else{var ne=this.lookupGlobal(W);ne&&ne instanceof b?R.ensureExport(ee,ne):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,te.foreignIdentifier.range,R.internalName,te.foreignIdentifier.text)}}}catch(e){s={error:e}}finally{try{J&&!J.done&&(_=Z.return)&&_.call(Z)}finally{if(s)throw s.error}}}}catch(e){n={error:e}}finally{try{Q&&!Q.done&&(i=X.return)&&i.call(X)}finally{if(n)throw n.error}}this.registerNativeTypeClass(0,c.LibrarySymbols.I8),this.registerNativeTypeClass(1,c.LibrarySymbols.I16),this.registerNativeTypeClass(2,c.LibrarySymbols.I32),this.registerNativeTypeClass(3,c.LibrarySymbols.I64),this.registerNativeTypeClass(4,c.LibrarySymbols.Isize),this.registerNativeTypeClass(5,c.LibrarySymbols.U8),this.registerNativeTypeClass(6,c.LibrarySymbols.U16),this.registerNativeTypeClass(7,c.LibrarySymbols.U32),this.registerNativeTypeClass(8,c.LibrarySymbols.U64),this.registerNativeTypeClass(9,c.LibrarySymbols.Usize),this.registerNativeTypeClass(10,c.LibrarySymbols.Bool),this.registerNativeTypeClass(11,c.LibrarySymbols.F32),this.registerNativeTypeClass(12,c.LibrarySymbols.F64),e.hasFeature(8)&&this.registerNativeTypeClass(13,c.LibrarySymbols.V128);var ie=this.resolver;for(x=0,k=C.length;x<k;++x){var ae=C[x],oe=assert(ae.extendsNode),se=ie.resolveTypeName(oe.name,ae.parent);if(se)if(se.kind==T.CLASS_PROTOTYPE){var ce=se;ce.hasDecorator(f.SEALED)&&this.error(l.DiagnosticCode.Class_0_is_sealed_and_cannot_be_extended,oe.range,se.identifierNode.text),ce.hasDecorator(f.UNMANAGED)!=ae.hasDecorator(f.UNMANAGED)&&this.error(l.DiagnosticCode.Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa,u.Range.join(ae.identifierNode.range,oe.range)),ae.basePrototype=ce}else this.error(l.DiagnosticCode.A_class_may_only_extend_another_class,oe.range)}var le=e.globalAliases;if(le)try{for(var pe=a(le),ue=pe.next();!ue.done;ue=pe.next()){var _e=o(ue.value,2),he=_e[0],de=_e[1];if(de.length){var ye=this.elementsByName;if(!(me=ye.get(de)))throw new Error("no such global element: "+de);if(ye.has(he))throw new Error("duplicate global element: "+de);ye.set(he,me)}}}catch(e){h={error:e}}finally{try{ue&&!ue.done&&(d=pe.return)&&d.call(pe)}finally{if(h)throw h.error}}var me=void 0;if((me=this.lookupGlobal(c.LibrarySymbols.String))&&(assert(me.kind==T.CLASS_PROTOTYPE),this.stringInstance=ie.resolveClass(me,null)),(me=this.lookupGlobal(c.LibrarySymbols.ArrayBuffer))&&(assert(me.kind==T.CLASS_PROTOTYPE),this.arrayBufferInstance=ie.resolveClass(me,null)),(me=this.lookupGlobal(c.LibrarySymbols.Array))&&(assert(me.kind==T.CLASS_PROTOTYPE),this.arrayPrototype=me),(me=this.lookupGlobal(c.LibrarySymbols.abort))&&(assert(me.kind==T.FUNCTION_PROTOTYPE),this.abortInstance=this.resolver.resolveFunction(me,null)),(me=this.lookupGlobal(c.LibrarySymbols.memory))&&(me=me.lookupInSelf(c.LibrarySymbols.allocate))&&(assert(me.kind==T.FUNCTION_PROTOTYPE),this.memoryAllocateInstance=this.resolver.resolveFunction(me,null)),this.elementsByName.has("__gc_allocate")&&this.elementsByName.has("__gc_link")&&this.elementsByName.has("__gc_mark")){me=this.elementsByName.get("__gc_allocate");assert(me.kind==T.FUNCTION_PROTOTYPE);var ge=assert(this.resolver.resolveFunction(me,null)),Te=ge.signature;assert(2==Te.parameterTypes.length),assert(Te.parameterTypes[0]==this.options.usizeType),assert(Te.parameterTypes[1].signatureReference),assert(Te.returnType==this.options.usizeType),me=this.elementsByName.get("__gc_link"),assert(me.kind==T.FUNCTION_PROTOTYPE);var fe=assert(this.resolver.resolveFunction(me,null));Te=fe.signature,assert(2==Te.parameterTypes.length),assert(Te.parameterTypes[0]==this.options.usizeType),assert(Te.parameterTypes[1]==this.options.usizeType),assert(Te.returnType==p.Type.void),me=this.elementsByName.get("__gc_mark"),assert(me.kind==T.FUNCTION_PROTOTYPE);var Ee=assert(this.resolver.resolveFunction(me,null));Te=Ee.signature,assert(1==Te.parameterTypes.length),assert(Te.parameterTypes[0]==this.options.usizeType),assert(Te.returnType==p.Type.void),this.gcAllocateInstance=ge,this.gcLinkInstance=fe,this.gcMarkInstance=Ee;var Ie=2*e.usizeType.byteSize;this.gcHookOffset=Ie,this.gcHeaderSize=Ie+4+7&-8,this.hasGC=!0}try{for(var ve=a(this.filesByName.values()),be=ve.next();!be.done;be=ve.next()){j=(R=be.value).exports;if(R.source.isEntry&&j)try{for(var Se=a(j.values()),Ae=Se.next();!Ae.done;Ae=Se.next()){me=Ae.value;this.markModuleExport(me)}}catch(e){g={error:e}}finally{try{Ae&&!Ae.done&&(E=Se.return)&&E.call(Se)}finally{if(g)throw g.error}}}}catch(e){y={error:e}}finally{try{be&&!be.done&&(m=ve.return)&&m.call(ve)}finally{if(y)throw y.error}}},t.prototype.markModuleExport=function(e){var t,r,n,i;switch(e.set(c.CommonFlags.MODULE_EXPORT),e.kind){case T.CLASS_PROTOTYPE:var o=e.instanceMembers;if(o)try{for(var s=a(o.values()),l=s.next();!l.done;l=s.next()){var p=l.value;this.markModuleExport(p)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}break;case T.PROPERTY_PROTOTYPE:var u=e.getterPrototype;u&&this.markModuleExport(u);var _=e.setterPrototype;_&&this.markModuleExport(_);break;case T.PROPERTY:case T.FUNCTION:case T.FIELD:case T.CLASS:assert(!1)}var h=e.members;if(h)try{for(var d=a(h.values()),y=d.next();!y.done;y=d.next()){p=y.value;this.markModuleExport(p)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}},t.prototype.registerNativeType=function(e,t){var r=new N(e,this.nativeFile,this.makeNativeTypeDeclaration(e,c.CommonFlags.EXPORT),f.BUILTIN);r.setType(t),this.nativeFile.add(e,r)},t.prototype.registerNativeTypeClass=function(e,t){assert(!this.typeClasses.has(e));var r=this.lookupGlobal(t);if(r){assert(r.kind==T.CLASS_PROTOTYPE);var n=this.resolver.resolveClass(r,null);n&&this.typeClasses.set(e,n)}},t.prototype.registerConstantInteger=function(e,t,r){assert(t.is(4));var n=new L(e,this.nativeFile,f.NONE,this.makeNativeVariableDeclaration(e,c.CommonFlags.CONST|c.CommonFlags.EXPORT));n.setConstantIntegerValue(r,t),this.nativeFile.add(e,n)},t.prototype.registerConstantFloat=function(e,t,r){assert(t.is(8));var n=new L(e,this.nativeFile,f.NONE,this.makeNativeVariableDeclaration(e,c.CommonFlags.CONST|c.CommonFlags.EXPORT));n.setConstantFloatValue(r,t),this.nativeFile.add(e,n)},t.prototype.ensureGlobal=function(e,t){var r=this.elementsByName;if(r.has(e)&&r.get(e)!==t){var n=W(r.get(e),t);if(!n)return void this.error(l.DiagnosticCode.Duplicate_identifier_0,t.identifierNode.range,e);t=n}r.set(e,t)},t.prototype.lookupGlobal=function(e){var t=this.elementsByName;return t.has(e)?t.get(e):null},t.prototype.lookupForeignFile=function(e,t){var r=this.filesByName;return r.has(e)?r.get(e):r.has(t)?r.get(t):null},t.prototype.lookupForeign=function(e,t,r,n){for(;;){var i=this.lookupForeignFile(t,r);if(!i)return null;var a=i.lookupExport(e);if(a)return a;if(n.has(i)){var o=n.get(i);if(o.has(e)){var s=o.get(e);if(s.foreignPath){e=s.localIdentifier.text,t=s.foreignPath,r=assert(s.foreignPathAlt);continue}if(a=i.lookupInSelf(s.localIdentifier.text))return a}}break}return null},t.prototype.checkDecorators=function(e,t){var r=f.NONE;if(e)for(var n=0,i=e.length;n<i;++n){var a=e[n],o=I(u.decoratorNameToKind(a.name));o&&(o==f.BUILTIN?a.range.source.isLibrary?r|=o:this.error(l.DiagnosticCode.Decorator_0_is_not_valid_here,a.range,a.name.range.toString()):t&o?r&o?this.error(l.DiagnosticCode.Duplicate_decorator,a.range,a.name.range.toString()):r|=o:this.error(l.DiagnosticCode.Decorator_0_is_not_valid_here,a.range,a.name.range.toString()))}return r},t.prototype.initializeClass=function(e,t,r,n){var i=e.name.text,a=new V(i,t,e,this.checkDecorators(e.decorators,f.GLOBAL|f.SEALED|f.UNMANAGED));if(t.add(i,a)){var o=e.implementsTypes;if(o){var s=o.length;if(a.hasDecorator(f.UNMANAGED))s&&this.error(l.DiagnosticCode.Unmanaged_classes_cannot_implement_interfaces,u.Range.join(e.name.range,o[s-1].range));else if(s){for(var p=0;p<s;++p)this.warning(l.DiagnosticCode.Operation_not_supported,o[p].range);n.push(a)}}e.extendsType&&r.push(a);for(var _=e.members,h=(p=0,_.length);p<h;++p){var d=_[p];switch(d.kind){case u.NodeKind.FIELDDECLARATION:this.initializeField(d,a);break;case u.NodeKind.METHODDECLARATION:d.isAny(c.CommonFlags.GET|c.CommonFlags.SET)?this.initializeProperty(d,a):this.initializeMethod(d,a);break;case u.NodeKind.INDEXSIGNATUREDECLARATION:break;default:assert(!1)}}}},t.prototype.initializeField=function(e,t){var r,n=e.name.text,i=e.decorators;if(e.is(c.CommonFlags.STATIC)){if(assert(t.kind!=T.INTERFACE_PROTOTYPE),r=new L(n,t,this.checkDecorators(i,(e.is(c.CommonFlags.READONLY)?f.INLINE:f.NONE)|f.LAZY),e),!t.add(n,r))return}else if(assert(!e.isAny(c.CommonFlags.ABSTRACT|c.CommonFlags.GET|c.CommonFlags.SET)),r=new P(n,t,e,this.checkDecorators(i,f.NONE)),!t.addInstance(n,r))return},t.prototype.initializeMethod=function(e,t){var r=e.name.text,n=e.is(c.CommonFlags.STATIC),i=f.INLINE;e.is(c.CommonFlags.GENERIC)||(i|=f.OPERATOR_BINARY|f.OPERATOR_PREFIX|f.OPERATOR_POSTFIX);var a=new B(r,t,e,this.checkDecorators(e.decorators,i));if(n){if(assert(e.name.kind!=u.NodeKind.CONSTRUCTOR),!t.add(r,a))return}else if(!t.addInstance(r,a))return;this.checkOperatorOverloads(e.decorators,a,t)},t.prototype.checkOperatorOverloads=function(e,t,r){if(e)for(var n=0,i=e.length;n<i;++n){var a=e[n];switch(a.decoratorKind){case u.DecoratorKind.OPERATOR:case u.DecoratorKind.OPERATOR_BINARY:case u.DecoratorKind.OPERATOR_PREFIX:case u.DecoratorKind.OPERATOR_POSTFIX:var o=a.arguments&&a.arguments.length||0;if(1==o){var c=a.arguments[0];if(c.kind==u.NodeKind.LITERAL&&c.literalKind==u.LiteralKind.STRING){var p=g(a.decoratorKind,c.value);if(p==s.INVALID)this.error(l.DiagnosticCode.Operation_not_supported,c.range);else{var _=r.overloadPrototypes;_.has(p)?this.error(l.DiagnosticCode.Duplicate_function_implementation,c.range):(t.operatorKind=p,_.set(p,t))}}else this.error(l.DiagnosticCode.String_literal_expected,c.range)}else this.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,a.range,"1",o.toString(10))}}},t.prototype.ensureProperty=function(e,t){var r=e.name.text;if(e.is(c.CommonFlags.STATIC)){if(!(i=t.members)||!i.has(r)){var n=new M(r,t,e);return t.add(r,n)?n:null}if((n=i.get(r)).kind==T.PROPERTY_PROTOTYPE)return n}else{var i;if(!(i=t.instanceMembers)||!i.has(r)){n=new M(r,t,e);return t.addInstance(r,n)?n:null}if((n=i.get(r)).kind==T.PROPERTY_PROTOTYPE)return n}return this.error(l.DiagnosticCode.Duplicate_property_0,e.name.range,r),null},t.prototype.initializeProperty=function(e,t){var r=this.ensureProperty(e,t);if(r){var n=e.name.text,i=e.is(c.CommonFlags.GET);if(i){if(r.getterPrototype)return void this.error(l.DiagnosticCode.Duplicate_property_0,e.name.range,n)}else if(r.setterPrototype)return void this.error(l.DiagnosticCode.Duplicate_property_0,e.name.range,n);var a=new B((i?c.GETTER_PREFIX:c.SETTER_PREFIX)+n,r,e,this.checkDecorators(e.decorators,f.INLINE));i?r.getterPrototype=a:r.setterPrototype=a}},t.prototype.initializeEnum=function(e,t){var r=e.name.text,n=new O(r,t,e,this.checkDecorators(e.decorators,f.GLOBAL|f.INLINE|f.LAZY));if(t.add(r,n))for(var i=e.values,a=0,o=i.length;a<o;++a)this.initializeEnumValue(i[a],n)},t.prototype.initializeEnumValue=function(e,t){var r=e.name.text,n=new k(r,t,e,this.checkDecorators(e.decorators,f.NONE));t.add(r,n)},t.prototype.initializeExports=function(e,t,r,n){var i=e.members;if(i)for(var a=0,o=i.length;a<o;++a)this.initializeExport(i[a],t,e.internalPath,r);else{var s=void 0;n.has(t)?s=n.get(t):n.set(t,s=[]);var l=assert(e.internalPath);s.push(new m(l,l.endsWith(c.INDEX_SUFFIX)?l.substring(0,l.length-c.INDEX_SUFFIX.length):l+c.INDEX_SUFFIX,assert(e.path)))}},t.prototype.initializeExport=function(e,t,r,n){var i=e.localName.text,a=e.exportedName.text,o=t.lookupExport(a);if(o)this.error(l.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.exportedName.range,a);else if(null===r)if(o=t.lookupInSelf(i))t.ensureExport(a,o);else{var s=void 0;n.has(t)?s=n.get(t):n.set(t,s=new Map),s.set(a,new y(e.localName,e.exportedName,null,null))}else{s=void 0;n.has(t)?s=n.get(t):n.set(t,s=new Map),s.set(a,new y(e.localName,e.exportedName,r,r.endsWith(c.INDEX_SUFFIX)?r.substring(0,r.length-c.INDEX_SUFFIX.length):r+c.INDEX_SUFFIX))}},t.prototype.initializeImports=function(e,t,r,n){var i=e.declarations;if(i)for(var a=0,o=i.length;a<o;++a)this.initializeImport(i[a],t,e.internalPath,r,n);else e.namespaceName&&r.push(new d(t,e.namespaceName,null,e.internalPath,e.internalPath+c.INDEX_SUFFIX))},t.prototype.initializeImport=function(e,t,r,n,i){var a=r.endsWith(c.INDEX_SUFFIX)?r.substring(0,r.length-c.INDEX_SUFFIX.length):r+c.INDEX_SUFFIX,o=this.lookupForeign(e.foreignName.text,r,a,i);o?t.add(e.name.text,o,!0):n.push(new d(t,e.name,e.foreignName,r,a))},t.prototype.initializeFunction=function(e,t){var r=e.name.text,n=f.NONE;e.is(c.CommonFlags.AMBIENT)||(n|=f.INLINE),t.kind==T.CLASS_PROTOTYPE||e.is(c.CommonFlags.INSTANCE)||(n|=f.GLOBAL),e.is(c.CommonFlags.GENERIC)||(e.is(c.CommonFlags.AMBIENT)?n|=f.EXTERNAL:t.kind==T.FILE&&t.source.isEntry&&(n|=f.START));var i=new B(r,t,e,this.checkDecorators(e.decorators,n));t.add(r,i)&&i.hasDecorator(f.START)&&(this.explicitStartFunction?this.error(l.DiagnosticCode.Module_cannot_have_multiple_start_functions,assert(u.findDecorator(u.DecoratorKind.START,e.decorators)).range):this.explicitStartFunction=i)},t.prototype.initializeInterface=function(e,t){var r=e.name.text,n=new z(r,t,e,this.checkDecorators(e.decorators,f.GLOBAL));if(t.add(r,n))for(var i=e.members,a=0,o=i.length;a<o;++a){var s=i[a];switch(s.kind){case u.NodeKind.FIELDDECLARATION:this.initializeField(s,n);break;case u.NodeKind.METHODDECLARATION:s.isAny(c.CommonFlags.GET|c.CommonFlags.SET)?this.initializeProperty(s,n):this.initializeMethod(s,n);break;default:assert(!1)}}},t.prototype.initializeNamespace=function(e,t,r,n){var i=e.name.text,a=new C(i,t,e);if(t.add(i,a)){a=assert(t.lookupInSelf(i));for(var o=e.members,s=0,c=o.length;s<c;++s)switch(o[s].kind){case u.NodeKind.CLASSDECLARATION:this.initializeClass(o[s],a,r,n);break;case u.NodeKind.ENUMDECLARATION:this.initializeEnum(o[s],a);break;case u.NodeKind.FUNCTIONDECLARATION:this.initializeFunction(o[s],a);break;case u.NodeKind.INTERFACEDECLARATION:this.initializeInterface(o[s],a);break;case u.NodeKind.NAMESPACEDECLARATION:this.initializeNamespace(o[s],a,r,n);break;case u.NodeKind.TYPEDECLARATION:this.initializeTypeDefinition(o[s],a);break;case u.NodeKind.VARIABLE:this.initializeVariables(o[s],a);break;default:assert(!1)}}},t.prototype.initializeTypeDefinition=function(e,t){var r=e.name.text,n=new N(r,t,e,this.checkDecorators(e.decorators,f.NONE));t.add(r,n)},t.prototype.initializeVariables=function(e,t){for(var r=e.declarations,n=0,i=r.length;n<i;++n){var a=r[n],o=a.name.text,s=f.GLOBAL|f.LAZY;a.is(c.CommonFlags.DECLARE)&&(s|=f.EXTERNAL),a.is(c.CommonFlags.CONST)&&(s|=f.INLINE);var l=new L(o,t,this.checkDecorators(a.decorators,s),a);t.add(o,l)}},t}(l.DiagnosticEmitter);function I(e){switch(e){case u.DecoratorKind.GLOBAL:return f.GLOBAL;case u.DecoratorKind.OPERATOR:case u.DecoratorKind.OPERATOR_BINARY:return f.OPERATOR_BINARY;case u.DecoratorKind.OPERATOR_PREFIX:return f.OPERATOR_PREFIX;case u.DecoratorKind.OPERATOR_POSTFIX:return f.OPERATOR_POSTFIX;case u.DecoratorKind.UNMANAGED:return f.UNMANAGED;case u.DecoratorKind.SEALED:return f.SEALED;case u.DecoratorKind.INLINE:return f.INLINE;case u.DecoratorKind.EXTERNAL:return f.EXTERNAL;case u.DecoratorKind.BUILTIN:return f.BUILTIN;case u.DecoratorKind.LAZY:return f.LAZY;case u.DecoratorKind.START:return f.START;default:return f.NONE}}t.Program=E,function(e){e[e.GLOBAL=0]="GLOBAL",e[e.LOCAL=1]="LOCAL",e[e.ENUM=2]="ENUM",e[e.ENUMVALUE=3]="ENUMVALUE",e[e.FUNCTION_PROTOTYPE=4]="FUNCTION_PROTOTYPE",e[e.FUNCTION=5]="FUNCTION",e[e.FUNCTION_TARGET=6]="FUNCTION_TARGET",e[e.CLASS_PROTOTYPE=7]="CLASS_PROTOTYPE",e[e.CLASS=8]="CLASS",e[e.INTERFACE_PROTOTYPE=9]="INTERFACE_PROTOTYPE",e[e.INTERFACE=10]="INTERFACE",e[e.FIELD_PROTOTYPE=11]="FIELD_PROTOTYPE",e[e.FIELD=12]="FIELD",e[e.PROPERTY_PROTOTYPE=13]="PROPERTY_PROTOTYPE",e[e.PROPERTY=14]="PROPERTY",e[e.NAMESPACE=15]="NAMESPACE",e[e.FILE=16]="FILE",e[e.TYPEDEFINITION=17]="TYPEDEFINITION"}(T=t.ElementKind||(t.ElementKind={})),function(e){e[e.NONE=0]="NONE",e[e.GLOBAL=1]="GLOBAL",e[e.OPERATOR_BINARY=2]="OPERATOR_BINARY",e[e.OPERATOR_PREFIX=4]="OPERATOR_PREFIX",e[e.OPERATOR_POSTFIX=8]="OPERATOR_POSTFIX",e[e.UNMANAGED=16]="UNMANAGED",e[e.SEALED=32]="SEALED",e[e.INLINE=64]="INLINE",e[e.EXTERNAL=128]="EXTERNAL",e[e.BUILTIN=256]="BUILTIN",e[e.LAZY=512]="LAZY",e[e.START=1024]="START"}(f=t.DecoratorFlags||(t.DecoratorFlags={})),t.decoratorKindToFlag=I;var v=function(){function e(e,t,r,n,i){this.kind=e,this.name=t,this.internalName=r,this.program=n,this.flags=c.CommonFlags.NONE,this.decoratorFlags=f.NONE,this.members=null,this.shadowType=null,this.program=n,this.name=t,this.internalName=r,i?this.parent=i:(assert(this.kind==T.FILE),this.parent=this)}return Object.defineProperty(e.prototype,"file",{get:function(){for(var e=this;;)if((e=e.parent).kind==T.FILE)return e},enumerable:!0,configurable:!0}),e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.isAny=function(e){return 0!=(this.flags&e)},e.prototype.set=function(e){this.flags|=e},e.prototype.hasDecorator=function(e){return(this.decoratorFlags&e)==e},e.prototype.lookupInSelf=function(e){var t=this.members;return t&&t.has(e)?t.get(e):null},e.prototype.add=function(e,t){var r=t.declaration,n=this.members;if(n){if(n.has(e)){var i=n.get(e);if(i.parent!==this);else{var a=W(i,t);if(!a)return this.program.error(l.DiagnosticCode.Duplicate_identifier_0,t.identifierNode.range,t.identifierNode.text),!1;t=a}}}else this.members=n=new Map;n.set(e,t);var o=this.program;return t.kind==T.FUNCTION_PROTOTYPE&&t.isBound||(o.elementsByName.set(t.internalName,t),o.elementsByDeclaration.set(r,t)),!0},e.prototype.toString=function(){return T[this.kind]+":"+this.internalName},e}();t.Element=v;var b=function(e){function t(t,r,n,i,a,o){var s=e.call(this,t,r,n,i,a)||this;return s.declaration=o,s.declaration=o,s.flags=o.flags,s}return i(t,e),Object.defineProperty(t.prototype,"isDeclaredInLibrary",{get:function(){return this.declaration.range.source.isLibrary},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifierNode",{get:function(){return this.declaration.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"decoratorNodes",{get:function(){return this.declaration.decorators},enumerable:!0,configurable:!0}),t}(v);t.DeclaredElement=b;var S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=p.Type.void,t}return i(t,e),t.prototype.setType=function(e){assert(!this.is(c.CommonFlags.RESOLVED)),this.type=e,this.set(c.CommonFlags.RESOLVED)},t}(b);t.TypedElement=S;var A=function(e){function t(t,r){var n=e.call(this,T.FILE,r.normalizedPath,r.internalPath,t,null)||this;n.source=r,n.exports=null,n.exportsStar=null,n.source=r,assert(!t.filesByName.has(n.internalName)),t.filesByName.set(n.internalName,n);var i=n.program.makeNativeFunction("start:"+n.internalName,new p.Signature(null,p.Type.void),n);return i.internalName=i.name,n.startFunction=i,n}return i(t,e),t.prototype.add=function(t,r,n){return void 0===n&&(n=!1),!!e.prototype.add.call(this,t,r)&&((r=assert(this.lookupInSelf(t))).is(c.CommonFlags.EXPORT)&&!n&&this.ensureExport(r.name,r),r.hasDecorator(f.GLOBAL)&&this.program.ensureGlobal(t,r),!0)},t.prototype.lookupInSelf=function(t){var r=e.prototype.lookupInSelf.call(this,t);if(r)return r;var n=this.exportsStar;if(n)for(var i=0,a=n.length;i<a;++i)if(r=n[i].lookupInSelf(t))return r;return null},t.prototype.lookup=function(e){var t=this.lookupInSelf(e);return t||this.program.lookupGlobal(e)},t.prototype.ensureExport=function(e,t){var r=this.exports;r||(this.exports=r=new Map),r.set(e,t),this.source.isLibrary&&this.program.ensureGlobal(e,t)},t.prototype.ensureExportStar=function(e){var t=this.exportsStar;if(t){if(t.includes(e))return}else this.exportsStar=t=[];t.push(e)},t.prototype.lookupExport=function(e){var t=this.exports;if(t&&t.has(e))return t.get(e);var r=this.exportsStar;if(r)for(var n=0,i=r.length;n<i;++n){var a=r[n].lookupExport(e);if(a)return a}return null},t.prototype.asImportedNamespace=function(e,t){var r,n,i=new C(e,t,this.program.makeNativeNamespaceDeclaration(e)),s=this.exports;if(s)try{for(var c=a(s),l=c.next();!l.done;l=c.next()){var p=o(l.value,2),u=p[0],_=p[1];i.add(u,_)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return i},t}(v);t.File=A;var N=function(e){function t(t,r,n,i){void 0===i&&(i=f.NONE);var a=e.call(this,T.TYPEDEFINITION,t,Q(t,r,!1),r.program,r,n)||this;return a.decoratorFlags=i,a}return i(t,e),Object.defineProperty(t.prototype,"typeParameterNodes",{get:function(){return this.declaration.typeParameters},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"typeNode",{get:function(){return this.declaration.type},enumerable:!0,configurable:!0}),t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(S);t.TypeDefinition=N;var C=function(e){function t(t,r,n){return e.call(this,T.NAMESPACE,t,Q(t,r,!1),r.program,r,n)||this}return i(t,e),t.prototype.lookup=function(e){return this.lookupInSelf(e)||this.parent.lookup(e)},t}(b);t.Namespace=C;var O=function(e){function t(t,r,n,i){void 0===i&&(i=f.NONE);var a=e.call(this,T.ENUM,t,Q(t,r,!1),r.program,r,n)||this;return a.decoratorFlags=i,a.setType(p.Type.i32),a}return i(t,e),t.prototype.lookup=function(e){return this.lookupInSelf(e)||this.parent.lookup(e)},t}(S);t.Enum=O,function(e){e[e.NONE=0]="NONE",e[e.INTEGER=1]="INTEGER",e[e.FLOAT=2]="FLOAT"}(t.ConstantValueKind||(t.ConstantValueKind={}));var x=function(e){function t(t,r,n,i){void 0===i&&(i=n.program.makeNativeVariableDeclaration(r));var a=e.call(this,t,r,Q(r,n,!1),n.program,n,i)||this;return a.constantValueKind=0,a.flags=i.flags,a}return i(t,e),Object.defineProperty(t.prototype,"typeNode",{get:function(){return this.declaration.type},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"initializerNode",{get:function(){return this.declaration.initializer},enumerable:!0,configurable:!0}),t.prototype.setConstantIntegerValue=function(e,t){assert(t.is(4)),this.type=t,this.constantValueKind=1,this.constantIntegerValue=e,this.set(c.CommonFlags.CONST|c.CommonFlags.INLINED|c.CommonFlags.RESOLVED)},t.prototype.setConstantFloatValue=function(e,t){assert(t.is(8)),this.type=t,this.constantValueKind=2,this.constantFloatValue=e,this.set(c.CommonFlags.CONST|c.CommonFlags.INLINED|c.CommonFlags.RESOLVED)},t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(S);t.VariableLikeElement=x;var k=function(e){function t(t,r,n,i){void 0===i&&(i=f.NONE);var a=e.call(this,T.ENUMVALUE,t,r,n)||this;return a.decoratorFlags=i,a.setType(p.Type.i32),a}return i(t,e),Object.defineProperty(t.prototype,"valueNode",{get:function(){return this.declaration.value},enumerable:!0,configurable:!0}),t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(x);t.EnumValue=k;var L=function(e){function t(t,r,n,i){void 0===i&&(i=r.program.makeNativeVariableDeclaration(t));var a=e.call(this,T.GLOBAL,t,r,i)||this;return a.decoratorFlags=n,a}return i(t,e),t}(x);t.Global=L;var R=function(){return function(e,t,r){void 0===r&&(r=null),this.name=e,this.type=t,this.initializer=r}}();t.Parameter=R;var F=function(e){function t(t,r,n,i,a){void 0===a&&(a=i.program.makeNativeVariableDeclaration(t));var o=e.call(this,T.LOCAL,t,i,a)||this;return o.index=r,o.index=r,assert(n!=p.Type.void),o.setType(n),o}return i(t,e),t}(x);t.Local=F;var B=function(e){function t(t,r,n,i){void 0===i&&(i=f.NONE);var a=e.call(this,T.FUNCTION_PROTOTYPE,t,Q(t,r,n.is(c.CommonFlags.INSTANCE)),r.program,r,n)||this;return a.operatorKind=s.INVALID,a.instances=null,a.boundPrototypes=null,a.decoratorFlags=i,a}return i(t,e),Object.defineProperty(t.prototype,"typeParameterNodes",{get:function(){return this.declaration.typeParameters},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"signatureNode",{get:function(){return this.declaration.signature},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bodyNode",{get:function(){return this.declaration.body},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBound",{get:function(){var e=this.parent;return e.kind==T.CLASS||e.kind==T.PROPERTY_PROTOTYPE&&e.parent.kind==T.CLASS},enumerable:!0,configurable:!0}),t.prototype.toBound=function(e){assert(this.is(c.CommonFlags.INSTANCE)),assert(!this.isBound);var r=this.boundPrototypes;if(r){if(r.has(e))return r.get(e)}else this.boundPrototypes=r=new Map;var n=this.declaration;assert(n.kind==u.NodeKind.METHODDECLARATION);var i=new t(this.name,e,n,this.decoratorFlags);return i.flags=this.flags,i.operatorKind=this.operatorKind,r.set(e,i),i},t.prototype.getResolvedInstance=function(e){var t=this.instances;return t&&t.has(e)?t.get(e):null},t.prototype.setResolvedInstance=function(e,t){var r=this.instances;r?assert(!r.has(e)):this.instances=r=new Map,r.set(e,t)},t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(b);t.FunctionPrototype=B;var D=function(e){function t(t,r,n,i){void 0===i&&(i=null);var a=e.call(this,T.FUNCTION,t,Q(t,r.parent,r.is(c.CommonFlags.INSTANCE)),r.program,r.parent,r.declaration)||this;if(a.localsByName=new Map,a.localsByIndex=[],a.additionalLocals=[],a.debugLocations=[],a.ref=0,a.functionTableIndex=-1,a.trampoline=null,a.nextInlineId=0,a.tempI32s=null,a.tempI64s=null,a.tempF32s=null,a.tempF64s=null,a.nextBreakId=0,a.breakStack=null,a.breakLabel=null,a.prototype=r,a.signature=n,a.flags=r.flags|c.CommonFlags.RESOLVED,a.decoratorFlags=r.decoratorFlags,a.contextualTypeArguments=i,a.type=p.Type.u32.asFunction(n),!r.is(c.CommonFlags.AMBIENT)){var o=0;if(a.is(c.CommonFlags.INSTANCE)){var s=new F(c.CommonSymbols.this_,o++,assert(n.thisType),a);a.localsByName.set(c.CommonSymbols.this_,s),a.localsByIndex[s.index]=s}for(var l=n.parameterTypes,u=0,_=l.length;u<_;++u){var d=l[u],y=n.getParameterName(u);s=new F(y,o++,d,a);a.localsByName.set(y,s),a.localsByIndex[s.index]=s}}return a.flow=h.Flow.create(a),Y(a.program,a),a}return i(t,e),t.prototype.addLocal=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=null);var n=this.signature.parameterTypes.length+this.additionalLocals.length;this.is(c.CommonFlags.INSTANCE)&&++n;var i=null!==t?t:"var$"+n.toString(),a=new F(i,n,e,this,r||this.program.makeNativeVariableDeclaration(i));if(t){if(this.localsByName.has(t))throw new Error("duplicate local name");this.localsByName.set(t,a)}return this.localsByIndex[a.index]=a,this.additionalLocals.push(e),a},t.prototype.lookup=function(e){var t=this.localsByName;return t.has(e)?t.get(e):this.parent.lookup(e)},t.prototype.finalize=function(e,t){if(this.ref=t,assert(!this.breakStack||!this.breakStack.length),this.breakStack=null,this.breakLabel=null,this.tempI32s=this.tempI64s=this.tempF32s=this.tempF64s=null,this.program.options.sourceMap)for(var r=this.debugLocations,n=0,i=r.length;n<i;++n){var a=r[n];e.setDebugLocation(t,a.debugInfoRef,a.source.debugInfoIndex,a.line,a.column)}},t}(S);t.Function=D;var U=function(e){function t(t,r,n){void 0===n&&(n="");var i=e.call(this,T.FUNCTION_TARGET,n="sig:"+t.toSignatureString(),n,r,r.nativeFile)||this;return i.signature=t,i.flags=c.CommonFlags.RESOLVED,i.type=p.Type.u32.asFunction(t),i}return i(t,e),t.prototype.lookup=function(e){return null},t}(v);t.FunctionTarget=U;var P=function(e){function t(t,r,n,i){void 0===i&&(i=f.NONE);var a=e.call(this,T.FIELD_PROTOTYPE,t,Q(t,r,assert(n.is(c.CommonFlags.INSTANCE))),r.program,r,n)||this;return a.decoratorFlags=i,a}return i(t,e),Object.defineProperty(t.prototype,"typeNode",{get:function(){return this.declaration.type},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"initializerNode",{get:function(){return this.declaration.initializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parameterIndex",{get:function(){return this.declaration.parameterIndex},enumerable:!0,configurable:!0}),t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(b);t.FieldPrototype=P;var w=function(e){function t(t,r,n){var i=e.call(this,T.FIELD,t.name,r,t.declaration)||this;return i.memoryOffset=-1,i.prototype=t,i.flags=t.flags,assert(n!=p.Type.void),i.setType(n),Y(i.program,i),i}return i(t,e),t}(x);t.Field=w;var M=function(e){function t(t,r,n){var i=e.call(this,T.PROPERTY_PROTOTYPE,t,Q(t,r,n.is(c.CommonFlags.INSTANCE)),r.program,r,n)||this;return i.getterPrototype=null,i.setterPrototype=null,i.flags&=~(c.CommonFlags.GET|c.CommonFlags.SET),i}return i(t,e),t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(b);t.PropertyPrototype=M;var G=function(e){function t(t,r){var n=e.call(this,T.PROPERTY,t.name,r,t.program.makeNativeVariableDeclaration(t.name,t.is(c.CommonFlags.INSTANCE)?c.CommonFlags.INSTANCE:c.CommonFlags.NONE))||this;return n.getterInstance=null,n.setterInstance=null,n.prototype=t,Y(n.program,n),n}return i(t,e),t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(x);t.Property=G;var V=function(e){function t(t,r,n,i,a){void 0===i&&(i=f.NONE),void 0===a&&(a=!1);var o=e.call(this,a?T.INTERFACE_PROTOTYPE:T.CLASS_PROTOTYPE,t,Q(t,r,n.is(c.CommonFlags.INSTANCE)),r.program,r,n)||this;return o.instanceMembers=null,o.basePrototype=null,o.constructorPrototype=null,o.overloadPrototypes=new Map,o.instances=null,o.decoratorFlags=i,o}return i(t,e),Object.defineProperty(t.prototype,"typeParameterNodes",{get:function(){return this.declaration.typeParameters},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"extendsNode",{get:function(){return this.declaration.extendsType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementsNodes",{get:function(){return this.declaration.implementsTypes},enumerable:!0,configurable:!0}),t.prototype.extends=function(e){var t=this;do{if(t===e)return!0}while(t=t.basePrototype);return!1},t.prototype.addInstance=function(e,t){var r=t.declaration,n=this.instanceMembers;if(n){if(n.has(e)){var i=W(n.get(e),t);if(!i)return this.program.error(l.DiagnosticCode.Duplicate_identifier_0,t.identifierNode.range,t.identifierNode.text),!1;t=i}}else this.instanceMembers=n=new Map;return n.set(e,t),t.is(c.CommonFlags.EXPORT)&&this.is(c.CommonFlags.MODULE_EXPORT)&&t.set(c.CommonFlags.MODULE_EXPORT),this.program.elementsByDeclaration.set(r,t),!0},t.prototype.getResolvedInstance=function(e){var t=this.instances;return t&&t.has(e)?t.get(e):null},t.prototype.setResolvedInstance=function(e,t){var r=this.instances;r?assert(!r.has(e)):this.instances=r=new Map,r.set(e,t)},t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(b);t.ClassPrototype=V;var K=function(e){function t(t,r,n,i,s){var l,p;void 0===n&&(n=null),void 0===i&&(i=null),void 0===s&&(s=!1);var u=e.call(this,s?T.INTERFACE:T.CLASS,t,Q(t,r.parent,r.is(c.CommonFlags.INSTANCE)),r.program,r.parent,r.declaration)||this;if(u.contextualTypeArguments=null,u.currentMemoryOffset=0,u.constructorInstance=null,u.overloads=null,u.gcHookIndex=-1,u.prototype=r,u.flags=r.flags,u.decoratorFlags=r.decoratorFlags,u.typeArguments=n,u.setType(u.program.options.usizeType.asClass(u)),u.base=i,i){var _=i.contextualTypeArguments;if(_){var h=u.contextualTypeArguments;try{for(var d=a(_),y=d.next();!y.done;y=d.next()){var m=o(y.value,2),g=m[0],f=m[1];h||(u.contextualTypeArguments=h=new Map),h.set(g,f)}}catch(e){l={error:e}}finally{try{y&&!y.done&&(p=d.return)&&p.call(d)}finally{if(l)throw l.error}}}}var E=r.typeParameterNodes;if(n){var I=n.length;if(!E||I!=E.length)throw new Error("type argument count mismatch");if(I){u.contextualTypeArguments||(u.contextualTypeArguments=new Map);for(var v=0;v<I;++v)u.contextualTypeArguments.set(E[v].name.text,n[v])}}else if(E&&E.length)throw new Error("type argument count mismatch");return Y(u.program,u),u}return i(t,e),t.prototype.isAssignableTo=function(e){var t=this;do{if(t==e)return!0}while(t=t.base);return!1},t.prototype.lookupOverload=function(e,t){if(void 0===t&&(t=!1),t)switch(e){case s.INDEXED_GET:if(r=this.lookupOverload(s.UNCHECKED_INDEXED_GET))return r;break;case s.INDEXED_SET:var r;if(r=this.lookupOverload(s.UNCHECKED_INDEXED_SET))return r;break;default:assert(!1)}var n=this;do{var i=n.overloads;if(i){var a=i.get(e);if(a)return a}}while(n=n.base);return null},t.prototype.lookup=function(e){return this.parent.lookup(e)},t.prototype.offsetof=function(e){var t=assert(this.members);assert(t.has(e));var r=t.get(e);return assert(r.kind==T.FIELD),r.memoryOffset},t}(S);t.Class=K;var z=function(e){function t(t,r,n,i){return e.call(this,t,r,n,i,!0)||this}return i(t,e),t}(V);t.InterfacePrototype=z;var H=function(e){function t(t,r,n,i){return void 0===n&&(n=[]),void 0===i&&(i=null),e.call(this,t,r,n,i,!0)||this}return i(t,e),t}(K);function Y(e,t){assert(!e.instancesByName.has(t.internalName)),e.instancesByName.set(t.internalName,t)}function W(e,t){assert(e.program===t.program),assert(!t.members);var r=null;switch(e.kind){case T.FUNCTION_PROTOTYPE:switch(t.kind){case T.NAMESPACE:X(t,e),r=e;break;case T.TYPEDEFINITION:e.shadowType||(e.shadowType=t,X(t,e),r=e)}break;case T.CLASS_PROTOTYPE:case T.ENUM:if(t.kind==T.NAMESPACE){X(t,e),r=e;break}break;case T.NAMESPACE:switch(t.kind){case T.ENUM:case T.CLASS_PROTOTYPE:case T.FUNCTION_PROTOTYPE:X(e,t),r=t;break;case T.NAMESPACE:X(t,e),r=e;break;case T.TYPEDEFINITION:e.shadowType||(e.shadowType=t,X(t,e),r=e)}break;case T.GLOBAL:t.kind==T.TYPEDEFINITION&&(e.shadowType||(e.shadowType=t,X(t,e),r=e));break;case T.TYPEDEFINITION:switch(t.kind){case T.GLOBAL:case T.FUNCTION_PROTOTYPE:case T.NAMESPACE:t.shadowType||(t.shadowType=e,X(e,t),r=t)}}return r&&e.is(c.CommonFlags.EXPORT)!=t.is(c.CommonFlags.EXPORT)&&e.program.error(l.DiagnosticCode.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local,r.identifierNode.range,r.identifierNode.text),r}function X(e,t){var r,n,i=e.members;if(i){var s=t.members;s||(t.members=s=new Map);try{for(var c=a(i),l=c.next();!l.done;l=c.next()){var p=o(l.value,2),u=p[0],_=p[1];s.set(u,_)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}}function Q(e,t,r,n){switch(void 0===n&&(n=!1),t.kind){case T.FILE:return n?e:t.internalName+c.PATH_DELIMITER+e;case T.FUNCTION:return n?e:(assert(!r),t.internalName+c.INNER_DELIMITER+e);default:return Q(t.name,t.parent,t.is(c.CommonFlags.INSTANCE),n)+(r?c.INSTANCE_DELIMITER:c.STATIC_DELIMITER)+e}}t.Interface=H,t.mangleInternalName=Q},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};Object.defineProperty(t,"__esModule",{value:!0});var i,a,o=r(10);!function(e){e[e.None=_BinaryenTypeNone()]="None",e[e.I32=_BinaryenTypeInt32()]="I32",e[e.I64=_BinaryenTypeInt64()]="I64",e[e.F32=_BinaryenTypeFloat32()]="F32",e[e.F64=_BinaryenTypeFloat64()]="F64",e[e.V128=_BinaryenTypeVec128()]="V128",e[e.Unreachable=_BinaryenTypeUnreachable()]="Unreachable",e[e.Auto=_BinaryenTypeAuto()]="Auto"}(i=t.NativeType||(t.NativeType={})),function(e){e[e.Invalid=_BinaryenInvalidId()]="Invalid",e[e.Block=_BinaryenBlockId()]="Block",e[e.If=_BinaryenIfId()]="If",e[e.Loop=_BinaryenLoopId()]="Loop",e[e.Break=_BinaryenBreakId()]="Break",e[e.Switch=_BinaryenSwitchId()]="Switch",e[e.Call=_BinaryenCallId()]="Call",e[e.CallIndirect=_BinaryenCallIndirectId()]="CallIndirect",e[e.GetLocal=_BinaryenGetLocalId()]="GetLocal",e[e.SetLocal=_BinaryenSetLocalId()]="SetLocal",e[e.GetGlobal=_BinaryenGetGlobalId()]="GetGlobal",e[e.SetGlobal=_BinaryenSetGlobalId()]="SetGlobal",e[e.Load=_BinaryenLoadId()]="Load",e[e.Store=_BinaryenStoreId()]="Store",e[e.Const=_BinaryenConstId()]="Const",e[e.Unary=_BinaryenUnaryId()]="Unary",e[e.Binary=_BinaryenBinaryId()]="Binary",e[e.Select=_BinaryenSelectId()]="Select",e[e.Drop=_BinaryenDropId()]="Drop",e[e.Return=_BinaryenReturnId()]="Return",e[e.Host=_BinaryenHostId()]="Host",e[e.Nop=_BinaryenNopId()]="Nop",e[e.Unreachable=_BinaryenUnreachableId()]="Unreachable",e[e.AtomicCmpxchg=_BinaryenAtomicCmpxchgId()]="AtomicCmpxchg",e[e.AtomicRMW=_BinaryenAtomicRMWId()]="AtomicRMW",e[e.AtomicWait=_BinaryenAtomicWaitId()]="AtomicWait",e[e.AtomicWake=_BinaryenAtomicWakeId()]="AtomicWake",e[e.SIMDExtract=_BinaryenSIMDExtractId()]="SIMDExtract",e[e.SIMDReplace=_BinaryenSIMDReplaceId()]="SIMDReplace",e[e.SIMDShuffle=_BinaryenSIMDShuffleId()]="SIMDShuffle",e[e.SIMDBitselect=_BinaryenSIMDBitselectId()]="SIMDBitselect",e[e.SIMDShift=_BinaryenSIMDShiftId()]="SIMDShift",e[e.MemoryInit=_BinaryenMemoryInitId()]="MemoryInit",e[e.DataDrop=_BinaryenDataDropId()]="DataDrop",e[e.MemoryCopy=_BinaryenMemoryCopyId()]="MemoryCopy",e[e.MemoryFill=_BinaryenMemoryFillId()]="MemoryFill"}(a=t.ExpressionId||(t.ExpressionId={})),function(e){e[e.ClzI32=_BinaryenClzInt32()]="ClzI32",e[e.CtzI32=_BinaryenCtzInt32()]="CtzI32",e[e.PopcntI32=_BinaryenPopcntInt32()]="PopcntI32",e[e.NegF32=_BinaryenNegFloat32()]="NegF32",e[e.AbsF32=_BinaryenAbsFloat32()]="AbsF32",e[e.CeilF32=_BinaryenCeilFloat32()]="CeilF32",e[e.FloorF32=_BinaryenFloorFloat32()]="FloorF32",e[e.TruncF32=_BinaryenTruncFloat32()]="TruncF32",e[e.NearestF32=_BinaryenNearestFloat32()]="NearestF32",e[e.SqrtF32=_BinaryenSqrtFloat32()]="SqrtF32",e[e.EqzI32=_BinaryenEqZInt32()]="EqzI32",e[e.ClzI64=_BinaryenClzInt64()]="ClzI64",e[e.CtzI64=_BinaryenCtzInt64()]="CtzI64",e[e.PopcntI64=_BinaryenPopcntInt64()]="PopcntI64",e[e.NegF64=_BinaryenNegFloat64()]="NegF64",e[e.AbsF64=_BinaryenAbsFloat64()]="AbsF64",e[e.CeilF64=_BinaryenCeilFloat64()]="CeilF64",e[e.FloorF64=_BinaryenFloorFloat64()]="FloorF64",e[e.TruncF64=_BinaryenTruncFloat64()]="TruncF64",e[e.NearestF64=_BinaryenNearestFloat64()]="NearestF64",e[e.SqrtF64=_BinaryenSqrtFloat64()]="SqrtF64",e[e.EqzI64=_BinaryenEqZInt64()]="EqzI64",e[e.ExtendI32=_BinaryenExtendSInt32()]="ExtendI32",e[e.ExtendU32=_BinaryenExtendUInt32()]="ExtendU32",e[e.WrapI64=_BinaryenWrapInt64()]="WrapI64",e[e.TruncF32ToI32=_BinaryenTruncSFloat32ToInt32()]="TruncF32ToI32",e[e.TruncF32ToI64=_BinaryenTruncSFloat32ToInt64()]="TruncF32ToI64",e[e.TruncF32ToU32=_BinaryenTruncUFloat32ToInt32()]="TruncF32ToU32",e[e.TruncF32ToU64=_BinaryenTruncUFloat32ToInt64()]="TruncF32ToU64",e[e.TruncF64ToI32=_BinaryenTruncSFloat64ToInt32()]="TruncF64ToI32",e[e.TruncF64ToI64=_BinaryenTruncSFloat64ToInt64()]="TruncF64ToI64",e[e.TruncF64ToU32=_BinaryenTruncUFloat64ToInt32()]="TruncF64ToU32",e[e.TruncF64ToU64=_BinaryenTruncUFloat64ToInt64()]="TruncF64ToU64",e[e.ReinterpretF32=_BinaryenReinterpretFloat32()]="ReinterpretF32",e[e.ReinterpretF64=_BinaryenReinterpretFloat64()]="ReinterpretF64",e[e.ConvertI32ToF32=_BinaryenConvertSInt32ToFloat32()]="ConvertI32ToF32",e[e.ConvertI32ToF64=_BinaryenConvertSInt32ToFloat64()]="ConvertI32ToF64",e[e.ConvertU32ToF32=_BinaryenConvertUInt32ToFloat32()]="ConvertU32ToF32",e[e.ConvertU32ToF64=_BinaryenConvertUInt32ToFloat64()]="ConvertU32ToF64",e[e.ConvertI64ToF32=_BinaryenConvertSInt64ToFloat32()]="ConvertI64ToF32",e[e.ConvertI64ToF64=_BinaryenConvertSInt64ToFloat64()]="ConvertI64ToF64",e[e.ConvertU64ToF32=_BinaryenConvertUInt64ToFloat32()]="ConvertU64ToF32",e[e.ConvertU64ToF64=_BinaryenConvertUInt64ToFloat64()]="ConvertU64ToF64",e[e.PromoteF32=_BinaryenPromoteFloat32()]="PromoteF32",e[e.DemoteF64=_BinaryenDemoteFloat64()]="DemoteF64",e[e.ReinterpretI32=_BinaryenReinterpretInt32()]="ReinterpretI32",e[e.ReinterpretI64=_BinaryenReinterpretInt64()]="ReinterpretI64",e[e.ExtendI8ToI32=_BinaryenExtendS8Int32()]="ExtendI8ToI32",e[e.ExtendI16ToI32=_BinaryenExtendS16Int32()]="ExtendI16ToI32",e[e.ExtendI8ToI64=_BinaryenExtendS8Int64()]="ExtendI8ToI64",e[e.ExtendI16ToI64=_BinaryenExtendS16Int64()]="ExtendI16ToI64",e[e.ExtendI32ToI64=_BinaryenExtendS32Int64()]="ExtendI32ToI64"}(t.UnaryOp||(t.UnaryOp={})),function(e){e[e.AddI32=_BinaryenAddInt32()]="AddI32",e[e.SubI32=_BinaryenSubInt32()]="SubI32",e[e.MulI32=_BinaryenMulInt32()]="MulI32",e[e.DivI32=_BinaryenDivSInt32()]="DivI32",e[e.DivU32=_BinaryenDivUInt32()]="DivU32",e[e.RemI32=_BinaryenRemSInt32()]="RemI32",e[e.RemU32=_BinaryenRemUInt32()]="RemU32",e[e.AndI32=_BinaryenAndInt32()]="AndI32",e[e.OrI32=_BinaryenOrInt32()]="OrI32",e[e.XorI32=_BinaryenXorInt32()]="XorI32",e[e.ShlI32=_BinaryenShlInt32()]="ShlI32",e[e.ShrU32=_BinaryenShrUInt32()]="ShrU32",e[e.ShrI32=_BinaryenShrSInt32()]="ShrI32",e[e.RotlI32=_BinaryenRotLInt32()]="RotlI32",e[e.RotrI32=_BinaryenRotRInt32()]="RotrI32",e[e.EqI32=_BinaryenEqInt32()]="EqI32",e[e.NeI32=_BinaryenNeInt32()]="NeI32",e[e.LtI32=_BinaryenLtSInt32()]="LtI32",e[e.LtU32=_BinaryenLtUInt32()]="LtU32",e[e.LeI32=_BinaryenLeSInt32()]="LeI32",e[e.LeU32=_BinaryenLeUInt32()]="LeU32",e[e.GtI32=_BinaryenGtSInt32()]="GtI32",e[e.GtU32=_BinaryenGtUInt32()]="GtU32",e[e.GeI32=_BinaryenGeSInt32()]="GeI32",e[e.GeU32=_BinaryenGeUInt32()]="GeU32",e[e.AddI64=_BinaryenAddInt64()]="AddI64",e[e.SubI64=_BinaryenSubInt64()]="SubI64",e[e.MulI64=_BinaryenMulInt64()]="MulI64",e[e.DivI64=_BinaryenDivSInt64()]="DivI64",e[e.DivU64=_BinaryenDivUInt64()]="DivU64",e[e.RemI64=_BinaryenRemSInt64()]="RemI64",e[e.RemU64=_BinaryenRemUInt64()]="RemU64",e[e.AndI64=_BinaryenAndInt64()]="AndI64",e[e.OrI64=_BinaryenOrInt64()]="OrI64",e[e.XorI64=_BinaryenXorInt64()]="XorI64",e[e.ShlI64=_BinaryenShlInt64()]="ShlI64",e[e.ShrU64=_BinaryenShrUInt64()]="ShrU64",e[e.ShrI64=_BinaryenShrSInt64()]="ShrI64",e[e.RotlI64=_BinaryenRotLInt64()]="RotlI64",e[e.RotrI64=_BinaryenRotRInt64()]="RotrI64",e[e.EqI64=_BinaryenEqInt64()]="EqI64",e[e.NeI64=_BinaryenNeInt64()]="NeI64",e[e.LtI64=_BinaryenLtSInt64()]="LtI64",e[e.LtU64=_BinaryenLtUInt64()]="LtU64",e[e.LeI64=_BinaryenLeSInt64()]="LeI64",e[e.LeU64=_BinaryenLeUInt64()]="LeU64",e[e.GtI64=_BinaryenGtSInt64()]="GtI64",e[e.GtU64=_BinaryenGtUInt64()]="GtU64",e[e.GeI64=_BinaryenGeSInt64()]="GeI64",e[e.GeU64=_BinaryenGeUInt64()]="GeU64",e[e.AddF32=_BinaryenAddFloat32()]="AddF32",e[e.SubF32=_BinaryenSubFloat32()]="SubF32",e[e.MulF32=_BinaryenMulFloat32()]="MulF32",e[e.DivF32=_BinaryenDivFloat32()]="DivF32",e[e.CopysignF32=_BinaryenCopySignFloat32()]="CopysignF32",e[e.MinF32=_BinaryenMinFloat32()]="MinF32",e[e.MaxF32=_BinaryenMaxFloat32()]="MaxF32",e[e.EqF32=_BinaryenEqFloat32()]="EqF32",e[e.NeF32=_BinaryenNeFloat32()]="NeF32",e[e.LtF32=_BinaryenLtFloat32()]="LtF32",e[e.LeF32=_BinaryenLeFloat32()]="LeF32",e[e.GtF32=_BinaryenGtFloat32()]="GtF32",e[e.GeF32=_BinaryenGeFloat32()]="GeF32",e[e.AddF64=_BinaryenAddFloat64()]="AddF64",e[e.SubF64=_BinaryenSubFloat64()]="SubF64",e[e.MulF64=_BinaryenMulFloat64()]="MulF64",e[e.DivF64=_BinaryenDivFloat64()]="DivF64",e[e.CopysignF64=_BinaryenCopySignFloat64()]="CopysignF64",e[e.MinF64=_BinaryenMinFloat64()]="MinF64",e[e.MaxF64=_BinaryenMaxFloat64()]="MaxF64",e[e.EqF64=_BinaryenEqFloat64()]="EqF64",e[e.NeF64=_BinaryenNeFloat64()]="NeF64",e[e.LtF64=_BinaryenLtFloat64()]="LtF64",e[e.LeF64=_BinaryenLeFloat64()]="LeF64",e[e.GtF64=_BinaryenGtFloat64()]="GtF64",e[e.GeF64=_BinaryenGeFloat64()]="GeF64"}(t.BinaryOp||(t.BinaryOp={})),function(e){e[e.CurrentMemory=_BinaryenCurrentMemory()]="CurrentMemory",e[e.GrowMemory=_BinaryenGrowMemory()]="GrowMemory"}(t.HostOp||(t.HostOp={})),function(e){e[e.Add=_BinaryenAtomicRMWAdd()]="Add",e[e.Sub=_BinaryenAtomicRMWSub()]="Sub",e[e.And=_BinaryenAtomicRMWAnd()]="And",e[e.Or=_BinaryenAtomicRMWOr()]="Or",e[e.Xor=_BinaryenAtomicRMWXor()]="Xor",e[e.Xchg=_BinaryenAtomicRMWXchg()]="Xchg"}(t.AtomicRMWOp||(t.AtomicRMWOp={})),function(e){e[e.SplatVecI8x16=_BinaryenSplatVecI8x16()]="SplatVecI8x16",e[e.SplatVecI16x8=_BinaryenSplatVecI16x8()]="SplatVecI16x8",e[e.SplatVecI32x4=_BinaryenSplatVecI32x4()]="SplatVecI32x4",e[e.SplatVecI64x2=_BinaryenSplatVecI64x2()]="SplatVecI64x2",e[e.SplatVecF32x4=_BinaryenSplatVecF32x4()]="SplatVecF32x4",e[e.SplatVecF64x2=_BinaryenSplatVecF64x2()]="SplatVecF64x2",e[e.NotVec128=_BinaryenNotVec128()]="NotVec128",e[e.NegVecI8x16=_BinaryenNegVecI8x16()]="NegVecI8x16",e[e.AnyTrueVecI8x16=_BinaryenAnyTrueVecI8x16()]="AnyTrueVecI8x16",e[e.AllTrueVecI8x16=_BinaryenAllTrueVecI8x16()]="AllTrueVecI8x16",e[e.NegVecI16x8=_BinaryenNegVecI16x8()]="NegVecI16x8",e[e.AnyTrueVecI16x8=_BinaryenAnyTrueVecI16x8()]="AnyTrueVecI16x8",e[e.AllTrueVecI16x8=_BinaryenAllTrueVecI16x8()]="AllTrueVecI16x8",e[e.NegVecI32x4=_BinaryenNegVecI32x4()]="NegVecI32x4",e[e.AnyTrueVecI32x4=_BinaryenAnyTrueVecI32x4()]="AnyTrueVecI32x4",e[e.AllTrueVecI32x4=_BinaryenAllTrueVecI32x4()]="AllTrueVecI32x4",e[e.NegVecI64x2=_BinaryenNegVecI64x2()]="NegVecI64x2",e[e.AnyTrueVecI64x2=_BinaryenAnyTrueVecI64x2()]="AnyTrueVecI64x2",e[e.AllTrueVecI64x2=_BinaryenAllTrueVecI64x2()]="AllTrueVecI64x2",e[e.AbsVecF32x4=_BinaryenAbsVecF32x4()]="AbsVecF32x4",e[e.NegVecF32x4=_BinaryenNegVecF32x4()]="NegVecF32x4",e[e.SqrtVecF32x4=_BinaryenSqrtVecF32x4()]="SqrtVecF32x4",e[e.AbsVecF64x2=_BinaryenAbsVecF64x2()]="AbsVecF64x2",e[e.NegVecF64x2=_BinaryenNegVecF64x2()]="NegVecF64x2",e[e.SqrtVecF64x2=_BinaryenSqrtVecF64x2()]="SqrtVecF64x2",e[e.TruncSatSVecF32x4ToVecI32x4=_BinaryenTruncSatSVecF32x4ToVecI32x4()]="TruncSatSVecF32x4ToVecI32x4",e[e.TruncSatUVecF32x4ToVecI32x4=_BinaryenTruncSatUVecF32x4ToVecI32x4()]="TruncSatUVecF32x4ToVecI32x4",e[e.TruncSatSVecF64x2ToVecI64x2=_BinaryenTruncSatSVecF64x2ToVecI64x2()]="TruncSatSVecF64x2ToVecI64x2",e[e.TruncSatUVecF64x2ToVecI64x2=_BinaryenTruncSatUVecF64x2ToVecI64x2()]="TruncSatUVecF64x2ToVecI64x2",e[e.ConvertSVecI32x4ToVecF32x4=_BinaryenConvertSVecI32x4ToVecF32x4()]="ConvertSVecI32x4ToVecF32x4",e[e.ConvertUVecI32x4ToVecF32x4=_BinaryenConvertUVecI32x4ToVecF32x4()]="ConvertUVecI32x4ToVecF32x4",e[e.ConvertSVecI64x2ToVecF64x2=_BinaryenConvertSVecI64x2ToVecF64x2()]="ConvertSVecI64x2ToVecF64x2",e[e.ConvertUVecI64x2ToVecF64x2=_BinaryenConvertUVecI64x2ToVecF64x2()]="ConvertUVecI64x2ToVecF64x2",e[e.EqVecI8x16=_BinaryenEqVecI8x16()]="EqVecI8x16",e[e.NeVecI8x16=_BinaryenNeVecI8x16()]="NeVecI8x16",e[e.LtSVecI8x16=_BinaryenLtSVecI8x16()]="LtSVecI8x16",e[e.LtUVecI8x16=_BinaryenLtUVecI8x16()]="LtUVecI8x16",e[e.LeSVecI8x16=_BinaryenLeSVecI8x16()]="LeSVecI8x16",e[e.LeUVecI8x16=_BinaryenLeUVecI8x16()]="LeUVecI8x16",e[e.GtSVecI8x16=_BinaryenGtSVecI8x16()]="GtSVecI8x16",e[e.GtUVecI8x16=_BinaryenGtUVecI8x16()]="GtUVecI8x16",e[e.GeSVecI8x16=_BinaryenGeSVecI8x16()]="GeSVecI8x16",e[e.GeUVecI8x16=_BinaryenGeUVecI8x16()]="GeUVecI8x16",e[e.EqVecI16x8=_BinaryenEqVecI16x8()]="EqVecI16x8",e[e.NeVecI16x8=_BinaryenNeVecI16x8()]="NeVecI16x8",e[e.LtSVecI16x8=_BinaryenLtSVecI16x8()]="LtSVecI16x8",e[e.LtUVecI16x8=_BinaryenLtUVecI16x8()]="LtUVecI16x8",e[e.LeSVecI16x8=_BinaryenLeSVecI16x8()]="LeSVecI16x8",e[e.LeUVecI16x8=_BinaryenLeUVecI16x8()]="LeUVecI16x8",e[e.GtSVecI16x8=_BinaryenGtSVecI16x8()]="GtSVecI16x8",e[e.GtUVecI16x8=_BinaryenGtUVecI16x8()]="GtUVecI16x8",e[e.GeSVecI16x8=_BinaryenGeSVecI16x8()]="GeSVecI16x8",e[e.GeUVecI16x8=_BinaryenGeUVecI16x8()]="GeUVecI16x8",e[e.EqVecI32x4=_BinaryenEqVecI32x4()]="EqVecI32x4",e[e.NeVecI32x4=_BinaryenNeVecI32x4()]="NeVecI32x4",e[e.LtSVecI32x4=_BinaryenLtSVecI32x4()]="LtSVecI32x4",e[e.LtUVecI32x4=_BinaryenLtUVecI32x4()]="LtUVecI32x4",e[e.LeSVecI32x4=_BinaryenLeSVecI32x4()]="LeSVecI32x4",e[e.LeUVecI32x4=_BinaryenLeUVecI32x4()]="LeUVecI32x4",e[e.GtSVecI32x4=_BinaryenGtSVecI32x4()]="GtSVecI32x4",e[e.GtUVecI32x4=_BinaryenGtUVecI32x4()]="GtUVecI32x4",e[e.GeSVecI32x4=_BinaryenGeSVecI32x4()]="GeSVecI32x4",e[e.GeUVecI32x4=_BinaryenGeUVecI32x4()]="GeUVecI32x4",e[e.EqVecF32x4=_BinaryenEqVecF32x4()]="EqVecF32x4",e[e.NeVecF32x4=_BinaryenNeVecF32x4()]="NeVecF32x4",e[e.LtVecF32x4=_BinaryenLtVecF32x4()]="LtVecF32x4",e[e.LeVecF32x4=_BinaryenLeVecF32x4()]="LeVecF32x4",e[e.GtVecF32x4=_BinaryenGtVecF32x4()]="GtVecF32x4",e[e.GeVecF32x4=_BinaryenGeVecF32x4()]="GeVecF32x4",e[e.EqVecF64x2=_BinaryenEqVecF64x2()]="EqVecF64x2",e[e.NeVecF64x2=_BinaryenNeVecF64x2()]="NeVecF64x2",e[e.LtVecF64x2=_BinaryenLtVecF64x2()]="LtVecF64x2",e[e.LeVecF64x2=_BinaryenLeVecF64x2()]="LeVecF64x2",e[e.GtVecF64x2=_BinaryenGtVecF64x2()]="GtVecF64x2",e[e.GeVecF64x2=_BinaryenGeVecF64x2()]="GeVecF64x2",e[e.AndVec128=_BinaryenAndVec128()]="AndVec128",e[e.OrVec128=_BinaryenOrVec128()]="OrVec128",e[e.XorVec128=_BinaryenXorVec128()]="XorVec128",e[e.AddVecI8x16=_BinaryenAddVecI8x16()]="AddVecI8x16",e[e.AddSatSVecI8x16=_BinaryenAddSatSVecI8x16()]="AddSatSVecI8x16",e[e.AddSatUVecI8x16=_BinaryenAddSatUVecI8x16()]="AddSatUVecI8x16",e[e.SubVecI8x16=_BinaryenSubVecI8x16()]="SubVecI8x16",e[e.SubSatSVecI8x16=_BinaryenSubSatSVecI8x16()]="SubSatSVecI8x16",e[e.SubSatUVecI8x16=_BinaryenSubSatUVecI8x16()]="SubSatUVecI8x16",e[e.MulVecI8x16=_BinaryenMulVecI8x16()]="MulVecI8x16",e[e.AddVecI16x8=_BinaryenAddVecI16x8()]="AddVecI16x8",e[e.AddSatSVecI16x8=_BinaryenAddSatSVecI16x8()]="AddSatSVecI16x8",e[e.AddSatUVecI16x8=_BinaryenAddSatUVecI16x8()]="AddSatUVecI16x8",e[e.SubVecI16x8=_BinaryenSubVecI16x8()]="SubVecI16x8",e[e.SubSatSVecI16x8=_BinaryenSubSatSVecI16x8()]="SubSatSVecI16x8",e[e.SubSatUVecI16x8=_BinaryenSubSatUVecI16x8()]="SubSatUVecI16x8",e[e.MulVecI16x8=_BinaryenMulVecI16x8()]="MulVecI16x8",e[e.AddVecI32x4=_BinaryenAddVecI32x4()]="AddVecI32x4",e[e.SubVecI32x4=_BinaryenSubVecI32x4()]="SubVecI32x4",e[e.MulVecI32x4=_BinaryenMulVecI32x4()]="MulVecI32x4",e[e.AddVecI64x2=_BinaryenAddVecI64x2()]="AddVecI64x2",e[e.SubVecI64x2=_BinaryenSubVecI64x2()]="SubVecI64x2",e[e.AddVecF32x4=_BinaryenAddVecF32x4()]="AddVecF32x4",e[e.SubVecF32x4=_BinaryenSubVecF32x4()]="SubVecF32x4",e[e.MulVecF32x4=_BinaryenMulVecF32x4()]="MulVecF32x4",e[e.DivVecF32x4=_BinaryenDivVecF32x4()]="DivVecF32x4",e[e.MinVecF32x4=_BinaryenMinVecF32x4()]="MinVecF32x4",e[e.MaxVecF32x4=_BinaryenMaxVecF32x4()]="MaxVecF32x4",e[e.AddVecF64x2=_BinaryenAddVecF64x2()]="AddVecF64x2",e[e.SubVecF64x2=_BinaryenSubVecF64x2()]="SubVecF64x2",e[e.MulVecF64x2=_BinaryenMulVecF64x2()]="MulVecF64x2",e[e.DivVecF64x2=_BinaryenDivVecF64x2()]="DivVecF64x2",e[e.MinVecF64x2=_BinaryenMinVecF64x2()]="MinVecF64x2",e[e.MaxVecF64x2=_BinaryenMaxVecF64x2()]="MaxVecF64x2"}(t.SIMDOp||(t.SIMDOp={}));var s=function(){function e(){}return e.create=function(t,r){var n=new e;return n.buffer=t,n.offset=r,n},e}();t.MemorySegment=s;var c=function(){function e(){this.hasTemporaryFunction=!1,this.cachedPrecomputeNames=0,this.cachedStrings=new Map}return e.create=function(){var t=new e;return t.ref=_BinaryenModuleCreate(),t.lit=memory.allocate(_BinaryenSizeofLiteral()),t},e.createFrom=function(t){var r=p(t);try{var n=new e;return n.ref=_BinaryenModuleRead(r,t.length),n.lit=memory.allocate(_BinaryenSizeofLiteral()),n}finally{memory.free(changetype(r))}},e.prototype.addFunctionType=function(e,t,r){var n=this.allocStringCached(e),i=u(r);try{return _BinaryenAddFunctionType(this.ref,n,t,i,r?r.length:0)}finally{memory.free(i)}},e.prototype.getFunctionTypeBySignature=function(e,t){var r=u(t);try{return _BinaryenGetFunctionTypeBySignature(this.ref,e,r,t?t.length:0)}finally{memory.free(r)}},e.prototype.removeFunctionType=function(e){var t=this.allocStringCached(e);_BinaryenRemoveFunctionType(this.ref,t)},e.prototype.createI32=function(e){var t=this.lit;return _BinaryenLiteralInt32(t,e),_BinaryenConst(this.ref,t)},e.prototype.createI64=function(e,t){void 0===t&&(t=0);var r=this.lit;return _BinaryenLiteralInt64(r,e,t),_BinaryenConst(this.ref,r)},e.prototype.createF32=function(e){var t=this.lit;return _BinaryenLiteralFloat32(t,e),_BinaryenConst(this.ref,t)},e.prototype.createF64=function(e){var t=this.lit;return _BinaryenLiteralFloat64(t,e),_BinaryenConst(this.ref,t)},e.prototype.createV128=function(e){assert(16==e.length);for(var t=this.lit,r=0;r<16;++r)store(t+r,e[r]);return _BinaryenLiteralVec128(t,t),_BinaryenConst(this.ref,t)},e.prototype.createUnary=function(e,t){return _BinaryenUnary(this.ref,e,t)},e.prototype.createBinary=function(e,t,r){return _BinaryenBinary(this.ref,e,t,r)},e.prototype.createHost=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=null);var n=this.allocStringCached(t),i=_(r);try{return _BinaryenHost(this.ref,e,n,i,r?r.length:0)}finally{memory.free(i)}},e.prototype.createGetLocal=function(e,t){return _BinaryenGetLocal(this.ref,e,t)},e.prototype.createTeeLocal=function(e,t){return _BinaryenTeeLocal(this.ref,e,t)},e.prototype.createGetGlobal=function(e,t){var r=this.allocStringCached(e);return _BinaryenGetGlobal(this.ref,r,t)},e.prototype.createLoad=function(e,t,r,n,i){return void 0===i&&(i=0),_BinaryenLoad(this.ref,e,t?1:0,i,e,n,r)},e.prototype.createStore=function(e,t,r,n,i){return void 0===i&&(i=0),_BinaryenStore(this.ref,e,i,e,t,r,n)},e.prototype.createAtomicLoad=function(e,t,r,n){return void 0===n&&(n=0),_BinaryenAtomicLoad(this.ref,e,n,r,t)},e.prototype.createAtomicStore=function(e,t,r,n,i){return void 0===i&&(i=0),_BinaryenAtomicStore(this.ref,e,i,t,r,n)},e.prototype.createAtomicRMW=function(e,t,r,n,i,a){return _BinaryenAtomicRMW(this.ref,e,t,r,n,i,a)},e.prototype.createAtomicCmpxchg=function(e,t,r,n,i,a){return _BinaryenAtomicCmpxchg(this.ref,e,t,r,n,i,a)},e.prototype.createAtomicWait=function(e,t,r,n){return _BinaryenAtomicWait(this.ref,e,t,r,n)},e.prototype.createAtomicWake=function(e,t){return _BinaryenAtomicWake(this.ref,e,t)},e.prototype.createSetLocal=function(e,t){return _BinaryenSetLocal(this.ref,e,t)},e.prototype.createSetGlobal=function(e,t){var r=this.allocStringCached(e);return _BinaryenSetGlobal(this.ref,r,t)},e.prototype.createBlock=function(e,t,r){void 0===r&&(r=i.None);var n=this.allocStringCached(e),a=_(t);try{return _BinaryenBlock(this.ref,n,a,t.length,r)}finally{memory.free(a)}},e.prototype.createBreak=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0);var n=this.allocStringCached(e);return _BinaryenBreak(this.ref,n,t,r)},e.prototype.createDrop=function(e){return _BinaryenDrop(this.ref,e)},e.prototype.createLoop=function(e,t){var r=this.allocStringCached(e);return _BinaryenLoop(this.ref,r,t)},e.prototype.createIf=function(e,t,r){return void 0===r&&(r=0),_BinaryenIf(this.ref,e,t,r)},e.prototype.createNop=function(){return _BinaryenNop(this.ref)},e.prototype.createReturn=function(e){return void 0===e&&(e=0),_BinaryenReturn(this.ref,e)},e.prototype.createSelect=function(e,t,r){return _BinaryenSelect(this.ref,r,e,t)},e.prototype.createSwitch=function(e,t,r,n){void 0===n&&(n=0);for(var i=e.length,a=new Array(i),o=0;o<i;++o)a[o]=this.allocStringCached(e[o]);var s=u(a),c=this.allocStringCached(t);try{return _BinaryenSwitch(this.ref,s,i,c,r,n)}finally{memory.free(s)}},e.prototype.createCall=function(e,t,r){var n=this.allocStringCached(e),i=_(t);try{return _BinaryenCall(this.ref,n,i,t&&t.length||0,r)}finally{memory.free(i)}},e.prototype.createCallIndirect=function(e,t,r){var n=this.allocStringCached(r),i=_(t);try{return _BinaryenCallIndirect(this.ref,e,i,t&&t.length||0,n)}finally{memory.free(i)}},e.prototype.createUnreachable=function(){return _BinaryenUnreachable(this.ref)},e.prototype.createMemoryCopy=function(e,t,r){return _BinaryenMemoryCopy(this.ref,e,t,r)},e.prototype.createMemoryFill=function(e,t,r){return _BinaryenMemoryFill(this.ref,e,t,r)},e.prototype.addGlobal=function(e,t,r,n){var i=this.allocStringCached(e);return _BinaryenAddGlobal(this.ref,i,t,r?1:0,n)},e.prototype.removeGlobal=function(e){var t=this.allocStringCached(e);_BinaryenRemoveGlobal(this.ref,t)},e.prototype.addFunction=function(e,t,r,n){var i=this.allocStringCached(e),a=u(r);try{return _BinaryenAddFunction(this.ref,i,t,a,r?r.length:0,n)}finally{memory.free(a)}},e.prototype.removeFunction=function(e){var t=this.allocStringCached(e);_BinaryenRemoveFunction(this.ref,t)},e.prototype.addTemporaryFunction=function(e,t,r){this.hasTemporaryFunction=assert(!this.hasTemporaryFunction);var n=this.allocStringCached(""),i=u(t);try{var a=_BinaryenAddFunctionType(this.ref,n,e,i,t?t.length:0);return _BinaryenAddFunction(this.ref,n,a,0,0,r)}finally{memory.free(i)}},e.prototype.removeTemporaryFunction=function(){this.hasTemporaryFunction=!assert(this.hasTemporaryFunction);var e=this.allocStringCached("");_BinaryenRemoveFunction(this.ref,e),_BinaryenRemoveFunctionType(this.ref,e)},e.prototype.addFunctionExport=function(e,t){var r=this.allocStringCached(e),n=this.allocStringCached(t);return _BinaryenAddFunctionExport(this.ref,r,n)},e.prototype.addTableExport=function(e,t){var r=this.allocStringCached(e),n=this.allocStringCached(t);return _BinaryenAddTableExport(this.ref,r,n)},e.prototype.addMemoryExport=function(e,t){var r=this.allocStringCached(e),n=this.allocStringCached(t);return _BinaryenAddMemoryExport(this.ref,r,n)},e.prototype.addGlobalExport=function(e,t){var r=this.allocStringCached(e),n=this.allocStringCached(t);return _BinaryenAddGlobalExport(this.ref,r,n)},e.prototype.removeExport=function(e){var t=this.allocStringCached(e);_BinaryenRemoveExport(this.ref,t)},e.prototype.addFunctionImport=function(e,t,r,n){var i=this.allocStringCached(e),a=this.allocStringCached(t),o=this.allocStringCached(r);return _BinaryenAddFunctionImport(this.ref,i,a,o,n)},e.prototype.addTableImport=function(e,t,r){var n=this.allocStringCached(e),i=this.allocStringCached(t),a=this.allocStringCached(r);return _BinaryenAddTableImport(this.ref,n,i,a)},e.prototype.addMemoryImport=function(e,t,r,n){void 0===n&&(n=!1);var i=this.allocStringCached(e),a=this.allocStringCached(t),o=this.allocStringCached(r);return _BinaryenAddMemoryImport(this.ref,i,a,o,n)},e.prototype.addGlobalImport=function(e,t,r,n){var i=this.allocStringCached(e),a=this.allocStringCached(t),o=this.allocStringCached(r);return _BinaryenAddGlobalImport(this.ref,i,a,o,n)},e.prototype.setMemory=function(e,t,r,n,i,a){void 0===i&&(i=null),void 0===a&&(a=!1);for(var s=this.allocStringCached(i),c=r.length,l=new Array(c),_=new Array(c),h=new Array(c),d=0;d<c;++d){var y=r[d].buffer,m=r[d].offset;l[d]=p(y),_[d]=n==o.Target.WASM64?this.createI64(i64_low(m),i64_high(m)):this.createI32(i64_low(m)),h[d]=y.length}var g=u(l),T=u(_),f=u(h);try{_BinaryenSetMemory(this.ref,e,t,s,g,T,f,c,a)}finally{memory.free(f),memory.free(T),memory.free(g);for(d=c-1;d>=0;--d)memory.free(l[d])}},e.prototype.setFunctionTable=function(e,t,r){for(var n=r.length,i=new Array(n),a=0;a<n;++a)i[a]=this.allocStringCached(r[a]);var o=u(i);try{_BinaryenSetFunctionTable(this.ref,e,t,o,n)}finally{memory.free(o)}},e.prototype.setStart=function(e){_BinaryenSetStart(this.ref,e)},e.prototype.getOptimizeLevel=function(){return _BinaryenGetOptimizeLevel()},e.prototype.setOptimizeLevel=function(e){void 0===e&&(e=2),_BinaryenSetOptimizeLevel(e)},e.prototype.getShrinkLevel=function(){return _BinaryenGetShrinkLevel()},e.prototype.setShrinkLevel=function(e){void 0===e&&(e=1),_BinaryenSetShrinkLevel(e)},e.prototype.setDebugInfo=function(e){void 0===e&&(e=!1),_BinaryenSetDebugInfo(e)},e.prototype.optimize=function(e){void 0===e&&(e=0),e?_BinaryenFunctionOptimize(e,this.ref):_BinaryenModuleOptimize(this.ref)},e.prototype.runPasses=function(e,t){void 0===t&&(t=0);for(var r=e.length,n=new Array(r),i=0;i<r;++i)n[i]=h(e[i]);var a=u(n);try{t?_BinaryenFunctionRunPasses(t,this.ref,a,r):_BinaryenModuleRunPasses(this.ref,a,r)}finally{memory.free(a);for(i=r;i>=0;--i)memory.free(n[i])}},e.prototype.precomputeExpression=function(e){var t=_BinaryenGetOptimizeLevel(),r=_BinaryenGetShrinkLevel(),n=_BinaryenGetDebugInfo();_BinaryenSetOptimizeLevel(4),_BinaryenSetShrinkLevel(0),_BinaryenSetDebugInfo(!1);var i=_BinaryenExpressionGetType(e),a=this.addTemporaryFunction(i,null,e),o=this.cachedPrecomputeNames;return o||(this.cachedPrecomputeNames=o=u([this.allocStringCached("precompute")])),_BinaryenFunctionRunPasses(a,this.ref,o,1),e=_BinaryenFunctionGetBody(a),this.removeTemporaryFunction(),_BinaryenSetOptimizeLevel(t),_BinaryenSetShrinkLevel(r),_BinaryenSetDebugInfo(n),e},e.prototype.validate=function(){return 1==_BinaryenModuleValidate(this.ref)},e.prototype.interpret=function(){_BinaryenModuleInterpret(this.ref)},e.prototype.toBinary=function(e){var t=this.lit;assert(_BinaryenSizeofLiteral()>=12);var r=h(e),n=0,i=0;try{_BinaryenModuleAllocateAndWrite(t,this.ref,r),n=d(t);var a=d(t+4);i=d(t+8);var o=new m;return o.output=function(e,t){for(var r=new Uint8Array(t),n=0;n<t;++n)r[n]=load(e+n);return r}(n,a),o.sourceMap=y(i),o}finally{r&&memory.free(r),n&&memory.free(n),i&&memory.free(i)}},e.prototype.toText=function(){throw new Error("not implemented")},e.prototype.toAsmjs=function(){throw new Error("not implemented")},e.prototype.allocStringCached=function(e){if(null==e)return 0;var t=this.cachedStrings;if(t.has(e))return t.get(e);var r=h(e);return t.set(e,r),r},e.prototype.dispose=function(){var e,t;assert(this.ref);try{for(var r=n(this.cachedStrings.values()),i=r.next();!i.done;i=r.next()){var a=i.value;memory.free(a)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.cachedStrings=new Map,memory.free(this.lit),memory.free(this.cachedPrecomputeNames),this.cachedPrecomputeNames=0,_BinaryenModuleDispose(this.ref),this.ref=0},e.prototype.createRelooper=function(){return l.create(this)},e.prototype.cloneExpression=function(e,t,r){if(void 0===t&&(t=!1),void 0===r&&(r=i32.MAX_VALUE),r<0)return 0;var n,o;switch(r-=1,_BinaryenExpressionGetId(e)){case a.Const:switch(_BinaryenExpressionGetType(e)){case i.I32:return this.createI32(_BinaryenConstGetValueI32(e));case i.I64:return this.createI64(_BinaryenConstGetValueI64Low(e),_BinaryenConstGetValueI64High(e));case i.F32:return this.createF32(_BinaryenConstGetValueF32(e));case i.F64:return this.createF64(_BinaryenConstGetValueF64(e));default:throw new Error("concrete type expected")}case a.GetLocal:return _BinaryenGetLocal(this.ref,_BinaryenGetLocalGetIndex(e),_BinaryenExpressionGetType(e));case a.GetGlobal:var s=_BinaryenGetGlobalGetName(e);if(!s)break;return _BinaryenGetGlobal(this.ref,s,_BinaryenExpressionGetType(e));case a.Load:if(!(n=this.cloneExpression(_BinaryenLoadGetPtr(e),t,r)))break;return _BinaryenLoadIsAtomic(e)?_BinaryenAtomicLoad(this.ref,_BinaryenLoadGetBytes(e),_BinaryenLoadGetOffset(e),_BinaryenExpressionGetType(e),n):_BinaryenLoad(this.ref,_BinaryenLoadGetBytes(e),_BinaryenLoadIsSigned(e)?1:0,_BinaryenLoadGetOffset(e),_BinaryenLoadGetAlign(e),_BinaryenExpressionGetType(e),n);case a.Unary:if(!(n=this.cloneExpression(_BinaryenUnaryGetValue(e),t,r)))break;return _BinaryenUnary(this.ref,_BinaryenUnaryGetOp(e),n);case a.Binary:if(!(n=this.cloneExpression(_BinaryenBinaryGetLeft(e),t,r)))break;if(!(o=this.cloneExpression(_BinaryenBinaryGetRight(e),t,r)))break;return _BinaryenBinary(this.ref,_BinaryenBinaryGetOp(e),n,o)}return 0},e.prototype.addDebugInfoFile=function(e){var t=h(e);try{return _BinaryenModuleAddDebugInfoFileName(this.ref,t)}finally{memory.free(t)}},e.prototype.getDebugInfoFile=function(e){return y(_BinaryenModuleGetDebugInfoFileName(this.ref,e))},e.prototype.setDebugLocation=function(e,t,r,n,i){_BinaryenFunctionSetDebugLocation(e,t,r,n,i)},e.UNLIMITED_MEMORY=-1,e}();t.Module=c,t.getExpressionId=function(e){return _BinaryenExpressionGetId(e)},t.getExpressionType=function(e){return _BinaryenExpressionGetType(e)},t.getConstValueI32=function(e){return _BinaryenConstGetValueI32(e)},t.getConstValueI64Low=function(e){return _BinaryenConstGetValueI64Low(e)},t.getConstValueI64High=function(e){return _BinaryenConstGetValueI64High(e)},t.getConstValueF32=function(e){return _BinaryenConstGetValueF32(e)},t.getConstValueF64=function(e){return _BinaryenConstGetValueF64(e)},t.getGetLocalIndex=function(e){return _BinaryenGetLocalGetIndex(e)},t.getSetLocalIndex=function(e){return _BinaryenSetLocalGetIndex(e)},t.getSetLocalValue=function(e){return _BinaryenSetLocalGetValue(e)},t.isTeeLocal=function(e){return _BinaryenSetLocalIsTee(e)},t.getGetGlobalName=function(e){return y(_BinaryenGetGlobalGetName(e))},t.getBinaryOp=function(e){return _BinaryenBinaryGetOp(e)},t.getBinaryLeft=function(e){return _BinaryenBinaryGetLeft(e)},t.getBinaryRight=function(e){return _BinaryenBinaryGetRight(e)},t.getUnaryOp=function(e){return _BinaryenUnaryGetOp(e)},t.getUnaryValue=function(e){return _BinaryenUnaryGetValue(e)},t.getLoadBytes=function(e){return _BinaryenLoadGetBytes(e)},t.getLoadOffset=function(e){return _BinaryenLoadGetOffset(e)},t.getLoadPtr=function(e){return _BinaryenLoadGetPtr(e)},t.isLoadSigned=function(e){return _BinaryenLoadIsSigned(e)},t.getStoreBytes=function(e){return _BinaryenStoreGetBytes(e)},t.getStoreOffset=function(e){return _BinaryenStoreGetOffset(e)},t.getStorePtr=function(e){return _BinaryenStoreGetPtr(e)},t.getStoreValue=function(e){return _BinaryenStoreGetValue(e)},t.getBlockName=function(e){return y(_BinaryenBlockGetName(e))},t.getBlockChildCount=function(e){return _BinaryenBlockGetNumChildren(e)},t.getBlockChild=function(e,t){return _BinaryenBlockGetChild(e,t)},t.getIfCondition=function(e){return _BinaryenIfGetCondition(e)},t.getIfTrue=function(e){return _BinaryenIfGetIfTrue(e)},t.getIfFalse=function(e){return _BinaryenIfGetIfFalse(e)},t.getLoopName=function(e){return y(_BinaryenLoopGetName(e))},t.getLoopBody=function(e){return _BinaryenLoopGetBody(e)},t.getBreakName=function(e){return y(_BinaryenBreakGetName(e))},t.getBreakCondition=function(e){return _BinaryenBreakGetCondition(e)},t.getSelectThen=function(e){return _BinaryenSelectGetIfTrue(e)},t.getSelectElse=function(e){return _BinaryenSelectGetIfFalse(e)},t.getSelectCondition=function(e){return _BinaryenSelectGetCondition(e)},t.getDropValue=function(e){return _BinaryenDropGetValue(e)},t.getReturnValue=function(e){return _BinaryenReturnGetValue(e)},t.getCallTarget=function(e){return y(_BinaryenCallGetTarget(e))},t.getHostOp=function(e){return _BinaryenHostGetOp(e)},t.getHostOperandCount=function(e){return _BinaryenHostGetNumOperands(e)},t.getHostOperand=function(e,t){return _BinaryenHostGetOperand(e,t)},t.getHostName=function(e){return y(_BinaryenHostGetNameOperand(e))},t.getFunctionBody=function(e){return _BinaryenFunctionGetBody(e)},t.getFunctionName=function(e){return y(_BinaryenFunctionGetName(e))},t.getFunctionParamCount=function(e){return _BinaryenFunctionGetNumParams(e)},t.getFunctionParamType=function(e,t){return _BinaryenFunctionGetParam(e,t)},t.getFunctionResultType=function(e){return _BinaryenFunctionGetResult(e)};var l=function(){function e(){}return e.create=function(t){var r=new e;return r.module=t,r.ref=_RelooperCreate(t.ref),r},e.prototype.addBlock=function(e){return _RelooperAddBlock(this.ref,e)},e.prototype.addBranch=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0),_RelooperAddBranch(e,t,r,n)},e.prototype.addBlockWithSwitch=function(e,t){return _RelooperAddBlockWithSwitch(this.ref,e,t)},e.prototype.addBranchForSwitch=function(e,t,r,n){void 0===n&&(n=0);var i=u(r);try{_RelooperAddBranchForSwitch(e,t,i,r.length,n)}finally{memory.free(i)}},e.prototype.renderAndDispose=function(e,t){return _RelooperRenderAndDispose(this.ref,e,t)},e}();function p(e){if(!e)return 0;for(var t=e.length,r=memory.allocate(t),n=r,i=0;i<t;++i)store(n++,e[i]);return r}function u(e){if(!e)return 0;for(var t=memory.allocate(e.length<<2),r=t,n=0,i=e.length;n<i;++n){var a=e[n];store(r,255&a),store(r+1,a>>8&255),store(r+2,a>>16&255),store(r+3,a>>>24),r+=4}return t}function _(e){return u(e)}function h(e){if(null==e)return 0;for(var t=memory.allocate(function(e){for(var t=0,r=0,n=e.length;r<n;++r){var i=e.charCodeAt(r);i>=55296&&i<=57343&&r+1<n&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++r)),i<=127?++t:t+=i<=2047?2:i<=65535?3:i<=2097151?4:i<=67108863?5:6}return t}(e)+1),r=t,n=0,i=e.length;n<i;++n){var a=e.charCodeAt(n);a>=55296&&a<=57343&&n+1<i&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++n)),a<=127?store(r++,a):a<=2047?(store(r++,192|a>>>6),store(r++,128|63&a)):a<=65535?(store(r++,224|a>>>12),store(r++,128|a>>>6&63),store(r++,128|63&a)):a<=2097151?(store(r++,240|a>>>18),store(r++,128|a>>>12&63),store(r++,128|a>>>6&63),store(r++,128|63&a)):a<=67108863?(store(r++,248|a>>>24),store(r++,128|a>>>18&63),store(r++,128|a>>>12&63),store(r++,128|a>>>6&63),store(r++,128|63&a)):(store(r++,252|a>>>30),store(r++,128|a>>>24&63),store(r++,128|a>>>18&63),store(r++,128|a>>>12&63),store(r++,128|a>>>6&63),store(r++,128|63&a))}return store(r,0),t}function d(e){return load(e)|load(e+1)<<8|load(e+2)<<16|load(e+3)<<24}function y(e){if(!e)return null;for(var t,r,n,i,a,o=new Array;t=load(e++);)128&t?(r=63&load(e++),192!=(224&t)?(n=63&load(e++),224==(240&t)?t=(15&t)<<12|r<<6|n:(i=63&load(e++),240==(248&t)?t=(7&t)<<18|r<<12|n<<6|i:(a=63&load(e++),t=248==(252&t)?(3&t)<<24|r<<18|n<<12|i<<6|a:(1&t)<<30|r<<24|n<<18|i<<12|a<<6|63&load(e++))),o.push(t)):o.push((31&t)<<6|r)):o.push(t);return String.fromCodePoints(o)}t.Relooper=l,t.readString=y;var m=function(){return function(){}}();t.BinaryModule=m,t.needsExplicitUnreachable=function e(t){switch(_BinaryenExpressionGetType(t)){case i.I32:case i.I64:case i.F32:case i.F64:return!1}switch(_BinaryenExpressionGetId(t)){case a.Unreachable:case a.Return:return!1;case a.Break:return 0!=_BinaryenBreakGetCondition(t);case a.Block:if(!_BinaryenBlockGetName(t)){var r=_BinaryenBlockGetNumChildren(t);return r>0&&e(_BinaryenBlockGetChild(t,r-1))}}return!0}},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),o=r(7);t.Token=o.Token,t.Range=o.Range;var s,c=r(2);!function(e){e[e.SOURCE=0]="SOURCE",e[e.TYPE=1]="TYPE",e[e.TYPENAME=2]="TYPENAME",e[e.TYPEPARAMETER=3]="TYPEPARAMETER",e[e.PARAMETER=4]="PARAMETER",e[e.SIGNATURE=5]="SIGNATURE",e[e.IDENTIFIER=6]="IDENTIFIER",e[e.ASSERTION=7]="ASSERTION",e[e.BINARY=8]="BINARY",e[e.CALL=9]="CALL",e[e.CLASS=10]="CLASS",e[e.COMMA=11]="COMMA",e[e.ELEMENTACCESS=12]="ELEMENTACCESS",e[e.FALSE=13]="FALSE",e[e.FUNCTION=14]="FUNCTION",e[e.INSTANCEOF=15]="INSTANCEOF",e[e.LITERAL=16]="LITERAL",e[e.NEW=17]="NEW",e[e.NULL=18]="NULL",e[e.PARENTHESIZED=19]="PARENTHESIZED",e[e.PROPERTYACCESS=20]="PROPERTYACCESS",e[e.TERNARY=21]="TERNARY",e[e.SUPER=22]="SUPER",e[e.THIS=23]="THIS",e[e.TRUE=24]="TRUE",e[e.CONSTRUCTOR=25]="CONSTRUCTOR",e[e.UNARYPOSTFIX=26]="UNARYPOSTFIX",e[e.UNARYPREFIX=27]="UNARYPREFIX",e[e.BLOCK=28]="BLOCK",e[e.BREAK=29]="BREAK",e[e.CONTINUE=30]="CONTINUE",e[e.DO=31]="DO",e[e.EMPTY=32]="EMPTY",e[e.EXPORT=33]="EXPORT",e[e.EXPORTIMPORT=34]="EXPORTIMPORT",e[e.EXPRESSION=35]="EXPRESSION",e[e.FOR=36]="FOR",e[e.IF=37]="IF",e[e.IMPORT=38]="IMPORT",e[e.RETURN=39]="RETURN",e[e.SWITCH=40]="SWITCH",e[e.THROW=41]="THROW",e[e.TRY=42]="TRY",e[e.VARIABLE=43]="VARIABLE",e[e.VOID=44]="VOID",e[e.WHILE=45]="WHILE",e[e.CLASSDECLARATION=46]="CLASSDECLARATION",e[e.ENUMDECLARATION=47]="ENUMDECLARATION",e[e.ENUMVALUEDECLARATION=48]="ENUMVALUEDECLARATION",e[e.FIELDDECLARATION=49]="FIELDDECLARATION",e[e.FUNCTIONDECLARATION=50]="FUNCTIONDECLARATION",e[e.IMPORTDECLARATION=51]="IMPORTDECLARATION",e[e.INDEXSIGNATUREDECLARATION=52]="INDEXSIGNATUREDECLARATION",e[e.INTERFACEDECLARATION=53]="INTERFACEDECLARATION",e[e.METHODDECLARATION=54]="METHODDECLARATION",e[e.NAMESPACEDECLARATION=55]="NAMESPACEDECLARATION",e[e.TYPEDECLARATION=56]="TYPEDECLARATION",e[e.VARIABLEDECLARATION=57]="VARIABLEDECLARATION",e[e.DECORATOR=58]="DECORATOR",e[e.EXPORTMEMBER=59]="EXPORTMEMBER",e[e.SWITCHCASE=60]="SWITCHCASE",e[e.COMMENT=61]="COMMENT"}(s=t.NodeKind||(t.NodeKind={})),t.nodeIsConstantValue=function(e){switch(e){case s.LITERAL:case s.NULL:case s.TRUE:case s.FALSE:return!0}return!1},t.nodeIsCallable=function(e){switch(e){case s.IDENTIFIER:case s.ASSERTION:case s.CALL:case s.ELEMENTACCESS:case s.PARENTHESIZED:case s.PROPERTYACCESS:case s.SUPER:return!0}return!1},t.nodeIsGenericCallable=function(e){switch(e){case s.IDENTIFIER:case s.PROPERTYACCESS:return!0}return!1};var l=function(){function e(){}return e.createTypeName=function(e,t){var r=new u;return r.range=t,r.identifier=e,r.next=null,r},e.createSimpleTypeName=function(t,r){return e.createTypeName(e.createIdentifierExpression(t,r),r)},e.createType=function(e,t,r,n){var i=new _;return i.range=n,i.name=e,i.typeArguments=t,i.isNullable=r,i},e.createOmittedType=function(t){return e.createType(e.createSimpleTypeName("",t),null,!1,t)},e.createTypeParameter=function(e,t,r,n){var i=new h;return i.range=n,i.name=e,i.extendsType=t,i.defaultType=r,i},e.createParameter=function(e,t,r,n,i){var a=new d;return a.range=i,a.name=e,a.type=t,a.initializer=r,a.parameterKind=n,a},e.createSignature=function(e,t,r,n,i){var a=new m;return a.range=i,a.parameters=e,a.returnType=t,a.explicitThisType=r,a.isNullable=n,a},e.createDecorator=function(e,t,r){var n=new T;return n.range=r,n.name=e,n.arguments=t,n.decoratorKind=g(e),n},e.createComment=function(e,t,r){var n=new f;return n.range=r,n.commentKind=t,n.text=e,n},e.createIdentifierExpression=function(e,t,r){void 0===r&&(r=!1);var n=new v;return n.range=t,n.text=e,n.symbol=e,n.isQuoted=r,n},e.createEmptyIdentifierExpression=function(e){var t=new v;return t.range=e,t.text="",t},e.createArrayLiteralExpression=function(e,t){var r=new S;return r.range=t,r.elementExpressions=e,r},e.createAssertionExpression=function(e,t,r,n){var i=new A;return i.range=n,i.assertionKind=e,i.expression=t,i.toType=r,i},e.createBinaryExpression=function(e,t,r,n){var i=new N;return i.range=n,i.operator=e,i.left=t,i.right=r,i},e.createCallExpression=function(e,t,r,n){var i=new C;return i.range=n,i.expression=e,i.typeArguments=t,i.arguments=r,i},e.createClassExpression=function(e){var t=new O;return t.range=e.range,t.declaration=e,t},e.createCommaExpression=function(e,t){var r=new x;return r.range=t,r.expressions=e,r},e.createConstructorExpression=function(e){var t=new k;return t.range=e,t},e.createElementAccessExpression=function(e,t,r){var n=new L;return n.range=r,n.expression=e,n.elementExpression=t,n},e.createFalseExpression=function(e){var t=new X;return t.range=e,t},e.createFloatLiteralExpression=function(e,t){var r=new R;return r.range=t,r.value=e,r},e.createFunctionExpression=function(e){var t=new F;return t.range=e.range,t.declaration=e,t},e.createInstanceOfExpression=function(e,t,r){var n=new B;return n.range=r,n.expression=e,n.isType=t,n},e.createIntegerLiteralExpression=function(e,t){var r=new D;return r.range=t,r.value=e,r},e.createNewExpression=function(e,t,r,n){var i=new U;return i.range=n,i.expression=e,i.typeArguments=t,i.arguments=r,i},e.createNullExpression=function(e){var t=new P;return t.range=e,t},e.createObjectLiteralExpression=function(e,t,r){var n=new w;return n.range=r,n.names=e,n.values=t,n},e.createParenthesizedExpression=function(e,t){var r=new M;return r.range=t,r.expression=e,r},e.createPropertyAccessExpression=function(e,t,r){var n=new G;return n.range=r,n.expression=e,n.property=t,n},e.createRegexpLiteralExpression=function(e,t,r){var n=new V;return n.range=r,n.pattern=e,n.patternFlags=t,n},e.createTernaryExpression=function(e,t,r,n){var i=new K;return i.range=n,i.condition=e,i.ifThen=t,i.ifElse=r,i},e.createStringLiteralExpression=function(e,t){var r=new z;return r.range=t,r.value=e,r},e.createSuperExpression=function(e){var t=new H;return t.range=e,t},e.createThisExpression=function(e){var t=new Y;return t.range=e,t},e.createTrueExpression=function(e){var t=new W;return t.range=e,t},e.createUnaryPostfixExpression=function(e,t,r){var n=new q;return n.range=r,n.operator=e,n.operand=t,n},e.createUnaryPrefixExpression=function(e,t,r){var n=new j;return n.range=r,n.operator=e,n.operand=t,n},e.createBlockStatement=function(e,t){var r=new ne;return r.range=t,r.statements=e,r},e.createBreakStatement=function(e,t){var r=new ie;return r.range=t,r.label=e,r},e.createClassDeclaration=function(e,t,r,n,i,a,o,s){var c=new ae;return c.range=s,c.flags=o,c.name=e,c.typeParameters=t,c.extendsType=r,c.implementsTypes=n,c.members=i,c.decorators=a,c},e.createContinueStatement=function(e,t){var r=new oe;return r.range=t,r.label=e,r},e.createDoStatement=function(e,t,r){var n=new se;return n.range=r,n.statement=e,n.condition=t,n},e.createEmptyStatement=function(e){var t=new ce;return t.range=e,t},e.createEnumDeclaration=function(e,t,r,n,i){var a=new le;return a.range=i,a.flags=n,a.name=e,a.values=t,a.decorators=r,a},e.createEnumValueDeclaration=function(e,t,r,n){var i=new pe;return i.range=n,i.flags=r,i.name=e,i.value=t,i},e.createExportStatement=function(e,t,r,n){var i=new he;if(i.range=n,i.members=e,i.path=t,t){var a=c.normalizePath(t.value);t.value.startsWith(".")?i.normalizedPath=c.resolvePath(a,n.source.normalizedPath):i.normalizedPath=a,i.internalPath=Be(i.normalizedPath)}else i.normalizedPath=null,i.internalPath=null;return i.isDeclare=r,i},e.createExportImportStatement=function(e,t,r){var n=new ue;return n.range=r,n.name=e,n.externalName=t,n},e.createExportMember=function(e,t,r){var n=new _e;return n.range=r,n.localName=e,t||(t=e),n.exportedName=t,n},e.createExpressionStatement=function(e){var t=new de;return t.range=e.range,t.expression=e,t},e.createIfStatement=function(e,t,r,n){var i=new Te;return i.range=n,i.condition=e,i.ifTrue=t,i.ifFalse=r,i},e.createImportStatement=function(e,t,r){var n=new Ee;n.range=r,n.declarations=e,n.namespaceName=null,n.path=t;var i=c.normalizePath(t.value);return t.value.startsWith(".")?n.normalizedPath=c.resolvePath(i,r.source.normalizedPath):(i.startsWith(a.LIBRARY_PREFIX)||(i=a.LIBRARY_PREFIX+i),n.normalizedPath=i),n.internalPath=Be(n.normalizedPath),n},e.createImportStatementWithWildcard=function(e,t,r){var n=new Ee;return n.range=r,n.declarations=null,n.namespaceName=e,n.path=t,n.normalizedPath=c.resolvePath(c.normalizePath(t.value),r.source.normalizedPath),n.internalPath=Be(n.normalizedPath),n},e.createImportDeclaration=function(e,t,r){var n=new fe;return n.range=r,n.foreignName=e,t||(t=e),n.name=t,n},e.createInterfaceDeclaration=function(e,t,r,n,i,a,o){var s=new Ie;return s.range=o,s.flags=a,s.name=e,s.typeParameters=t,s.extendsType=r,s.members=n,s.decorators=i,s},e.createFieldDeclaration=function(e,t,r,n,i,a){var o=new ye;return o.range=a,o.flags=i,o.name=e,o.type=t,o.initializer=r,o.decorators=n,o},e.createForStatement=function(e,t,r,n,i){var a=new me;return a.range=i,a.initializer=e,a.condition=t,a.incrementor=r,a.statement=n,a},e.createFunctionDeclaration=function(e,t,r,n,i,a,o){var s=new ge;return s.range=o,s.flags=a,s.name=e,s.typeParameters=t,s.signature=r,s.body=n,s.decorators=i,s},e.createIndexSignatureDeclaration=function(e,t,r){var n=new te;return n.range=r,n.keyType=e,n.valueType=t,n},e.createMethodDeclaration=function(e,t,r,n,i,a,o){var s=new ve;return s.range=o,s.flags=a,s.name=e,s.typeParameters=t,s.signature=r,s.body=n,s.decorators=i,s},e.createNamespaceDeclaration=function(e,t,r,n,i){var a=new be;return a.range=i,a.flags=n,a.name=e,a.members=t,a.decorators=r,a},e.createReturnStatement=function(e,t){var r=new Se;return r.range=t,r.value=e,r},e.createSwitchStatement=function(e,t,r){var n=new Ne;return n.range=r,n.condition=e,n.cases=t,n},e.createSwitchCase=function(e,t,r){var n=new Ae;return n.range=r,n.label=e,n.statements=t,n},e.createThrowStatement=function(e,t){var r=new Ce;return r.range=t,r.value=e,r},e.createTryStatement=function(e,t,r,n,i){var a=new Oe;return a.range=i,a.statements=e,a.catchVariable=t,a.catchStatements=r,a.finallyStatements=n,a},e.createTypeDeclaration=function(e,t,r,n,i,a){var o=new xe;return o.range=a,o.flags=i,o.name=e,o.typeParameters=t,o.type=r,o.decorators=n,o},e.createVariableStatement=function(e,t,r){var n=new Le;return n.range=r,n.declarations=e,n.decorators=t,n},e.createVariableDeclaration=function(e,t,r,n,i,a){var o=new ke;return o.range=a,o.flags=i,o.name=e,o.type=t,o.initializer=r,o.decorators=n,o},e.createVoidStatement=function(e,t){var r=new Re;return r.range=t,r.expression=e,r},e.createWhileStatement=function(e,t,r){var n=new Fe;return n.range=r,n.condition=e,n.statement=t,n},e}();t.Node=l;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(l);t.CommonTypeNode=p;var u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TYPENAME,t}return i(t,e),t}(l);t.TypeName=u;var _=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TYPE,t}return i(t,e),t}(p);t.TypeNode=_;var h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TYPEPARAMETER,t}return i(t,e),t}(l);t.TypeParameterNode=h,function(e){e[e.DEFAULT=0]="DEFAULT",e[e.OPTIONAL=1]="OPTIONAL",e[e.REST=2]="REST"}(t.ParameterKind||(t.ParameterKind={}));var d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.PARAMETER,t.implicitFieldDeclaration=null,t.flags=a.CommonFlags.NONE,t}return i(t,e),t.prototype.is=function(e){return(this.flags&e)==e},t.prototype.isAny=function(e){return 0!=(this.flags&e)},t.prototype.set=function(e){this.flags|=e},t}(l);t.ParameterNode=d;var y,m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.SIGNATURE,t}return i(t,e),t}(p);function g(e){if(e.kind==s.IDENTIFIER){var t=e.text;switch(assert(t.length),t.charCodeAt(0)){case 98:if("builtin"==t)return y.BUILTIN;break;case 101:if("external"==t)return y.EXTERNAL;break;case 103:if("global"==t)return y.GLOBAL;break;case 105:if("inline"==t)return y.INLINE;break;case 108:if("lazy"==t)return y.LAZY;break;case 111:if("operator"==t)return y.OPERATOR;break;case 115:if("sealed"==t)return y.SEALED;if("start"==t)return y.START;break;case 117:if("unmanaged"==t)return y.UNMANAGED}}else if(e.kind==s.PROPERTYACCESS&&e.expression.kind==s.IDENTIFIER){t=e.expression.text;assert(t.length);var r=e.property.text;if(assert(r.length),"operator"==t)switch(r.charCodeAt(0)){case 98:if("binary"==r)return y.OPERATOR_BINARY;break;case 112:switch(r){case"prefix":return y.OPERATOR_PREFIX;case"postfix":return y.OPERATOR_POSTFIX}}}return y.CUSTOM}t.SignatureNode=m,function(e){e[e.CUSTOM=0]="CUSTOM",e[e.GLOBAL=1]="GLOBAL",e[e.OPERATOR=2]="OPERATOR",e[e.OPERATOR_BINARY=3]="OPERATOR_BINARY",e[e.OPERATOR_PREFIX=4]="OPERATOR_PREFIX",e[e.OPERATOR_POSTFIX=5]="OPERATOR_POSTFIX",e[e.UNMANAGED=6]="UNMANAGED",e[e.SEALED=7]="SEALED",e[e.INLINE=8]="INLINE",e[e.EXTERNAL=9]="EXTERNAL",e[e.BUILTIN=10]="BUILTIN",e[e.LAZY=11]="LAZY",e[e.START=12]="START"}(y=t.DecoratorKind||(t.DecoratorKind={})),t.decoratorNameToKind=g;var T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.DECORATOR,t}return i(t,e),t}(l);t.DecoratorNode=T,function(e){e[e.LINE=0]="LINE",e[e.TRIPLE=1]="TRIPLE",e[e.BLOCK=2]="BLOCK"}(t.CommentKind||(t.CommentKind={}));var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.COMMENT,t}return i(t,e),t}(l);t.CommentNode=f;var E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(l);t.Expression=E;var I,v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.IDENTIFIER,t}return i(t,e),t}(E);t.IdentifierExpression=v,function(e){e[e.FLOAT=0]="FLOAT",e[e.INTEGER=1]="INTEGER",e[e.STRING=2]="STRING",e[e.REGEXP=3]="REGEXP",e[e.ARRAY=4]="ARRAY",e[e.OBJECT=5]="OBJECT"}(I=t.LiteralKind||(t.LiteralKind={}));var b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.LITERAL,t}return i(t,e),t}(E);t.LiteralExpression=b;var S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=I.ARRAY,t}return i(t,e),t}(b);t.ArrayLiteralExpression=S,function(e){e[e.PREFIX=0]="PREFIX",e[e.AS=1]="AS",e[e.NONNULL=2]="NONNULL"}(t.AssertionKind||(t.AssertionKind={}));var A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.ASSERTION,t}return i(t,e),t}(E);t.AssertionExpression=A;var N=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.BINARY,t}return i(t,e),t}(E);t.BinaryExpression=N;var C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CALL,t}return i(t,e),t}(E);t.CallExpression=C;var O=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CLASS,t}return i(t,e),t}(E);t.ClassExpression=O;var x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.COMMA,t}return i(t,e),t}(E);t.CommaExpression=x;var k=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CONSTRUCTOR,t.text="constructor",t.symbol=a.CommonSymbols.constructor,t}return i(t,e),t}(v);t.ConstructorExpression=k;var L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.ELEMENTACCESS,t}return i(t,e),t}(E);t.ElementAccessExpression=L;var R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=I.FLOAT,t}return i(t,e),t}(b);t.FloatLiteralExpression=R;var F=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FUNCTION,t}return i(t,e),t}(E);t.FunctionExpression=F;var B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.INSTANCEOF,t}return i(t,e),t}(E);t.InstanceOfExpression=B;var D=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=I.INTEGER,t}return i(t,e),t}(b);t.IntegerLiteralExpression=D;var U=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.NEW,t}return i(t,e),t}(C);t.NewExpression=U;var P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.NULL,t.text="null",t.symbol=a.CommonSymbols.null_,t}return i(t,e),t}(v);t.NullExpression=P;var w=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=I.OBJECT,t}return i(t,e),t}(b);t.ObjectLiteralExpression=w;var M=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.PARENTHESIZED,t}return i(t,e),t}(E);t.ParenthesizedExpression=M;var G=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.PROPERTYACCESS,t}return i(t,e),t}(E);t.PropertyAccessExpression=G;var V=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=I.REGEXP,t}return i(t,e),t}(b);t.RegexpLiteralExpression=V;var K=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TERNARY,t}return i(t,e),t}(E);t.TernaryExpression=K;var z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=I.STRING,t}return i(t,e),t}(b);t.StringLiteralExpression=z;var H=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.SUPER,t.text="super",t.symbol=a.CommonSymbols.super_,t}return i(t,e),t}(v);t.SuperExpression=H;var Y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.THIS,t.text="this",t.symbol=a.CommonSymbols.this_,t}return i(t,e),t}(v);t.ThisExpression=Y;var W=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TRUE,t.text="true",t.symbol=a.CommonSymbols.true_,t}return i(t,e),t}(v);t.TrueExpression=W;var X=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FALSE,t.text="false",t.symbol=a.CommonSymbols.false_,t}return i(t,e),t}(v);t.FalseExpression=X;var Q=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(E);t.UnaryExpression=Q;var q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.UNARYPOSTFIX,t}return i(t,e),t}(Q);t.UnaryPostfixExpression=q;var j=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.UNARYPREFIX,t}return i(t,e),t}(Q);t.UnaryPrefixExpression=j;var Z,J=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(l);t.Statement=J,function(e){e[e.DEFAULT=0]="DEFAULT",e[e.ENTRY=1]="ENTRY",e[e.LIBRARY=2]="LIBRARY"}(Z=t.SourceKind||(t.SourceKind={}));var $=function(e){function t(t,r,n){var i=e.call(this)||this;i.kind=s.SOURCE,i.parent=null,i.tokenizer=null,i.debugInfoIndex=-1,i.exportPaths=null,i.sourceKind=n,i.normalizedPath=t;var c=Be(i.normalizedPath);i.internalPath=c;var l=c.lastIndexOf(a.PATH_DELIMITER);return i.simplePath=l>=0?c.substring(l+1):c,i.statements=new Array,i.range=new o.Range(i,0,r.length),i.text=r,i}return i(t,e),Object.defineProperty(t.prototype,"isEntry",{get:function(){return this.sourceKind==Z.ENTRY},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLibrary",{get:function(){return this.sourceKind==Z.LIBRARY},enumerable:!0,configurable:!0}),t}(l);t.Source=$;var ee=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.decorators=null,t.flags=a.CommonFlags.NONE,t}return i(t,e),t.prototype.is=function(e){return(this.flags&e)==e},t.prototype.isAny=function(e){return 0!=(this.flags&e)},t.prototype.set=function(e){this.flags|=e},t}(J);t.DeclarationStatement=ee;var te=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.INDEXSIGNATUREDECLARATION,t}return i(t,e),t}(ee);t.IndexSignatureDeclaration=te;var re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(ee);t.VariableLikeDeclarationStatement=re;var ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.BLOCK,t}return i(t,e),t}(J);t.BlockStatement=ne;var ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.BREAK,t}return i(t,e),t}(J);t.BreakStatement=ie;var ae=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CLASSDECLARATION,t}return i(t,e),Object.defineProperty(t.prototype,"isGeneric",{get:function(){var e=this.typeParameters;return null!=e&&e.length>0},enumerable:!0,configurable:!0}),t}(ee);t.ClassDeclaration=ae;var oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CONTINUE,t}return i(t,e),t}(J);t.ContinueStatement=oe;var se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.DO,t}return i(t,e),t}(J);t.DoStatement=se;var ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EMPTY,t}return i(t,e),t}(J);t.EmptyStatement=ce;var le=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.ENUMDECLARATION,t}return i(t,e),t}(ee);t.EnumDeclaration=le;var pe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.ENUMVALUEDECLARATION,t}return i(t,e),t}(re);t.EnumValueDeclaration=pe;var ue=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EXPORTIMPORT,t}return i(t,e),t}(l);t.ExportImportStatement=ue;var _e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EXPORTMEMBER,t}return i(t,e),t}(l);t.ExportMember=_e;var he=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EXPORT,t}return i(t,e),t}(J);t.ExportStatement=he;var de=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EXPRESSION,t}return i(t,e),t}(J);t.ExpressionStatement=de;var ye=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FIELDDECLARATION,t.parameterIndex=-1,t}return i(t,e),t}(re);t.FieldDeclaration=ye;var me=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FOR,t}return i(t,e),t}(J);t.ForStatement=me;var ge=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FUNCTIONDECLARATION,t}return i(t,e),Object.defineProperty(t.prototype,"isGeneric",{get:function(){var e=this.typeParameters;return null!=e&&e.length>0},enumerable:!0,configurable:!0}),t.prototype.clone=function(){return l.createFunctionDeclaration(this.name,this.typeParameters,this.signature,this.body,this.decorators,this.flags,this.range)},t}(ee);t.FunctionDeclaration=ge;var Te=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.IF,t}return i(t,e),t}(J);t.IfStatement=Te;var fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.IMPORTDECLARATION,t}return i(t,e),t}(ee);t.ImportDeclaration=fe;var Ee=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.IMPORT,t}return i(t,e),t}(J);t.ImportStatement=Ee;var Ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.INTERFACEDECLARATION,t}return i(t,e),t}(ae);t.InterfaceDeclaration=Ie;var ve=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.METHODDECLARATION,t}return i(t,e),t}(ge);t.MethodDeclaration=ve;var be=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.NAMESPACEDECLARATION,t}return i(t,e),t}(ee);t.NamespaceDeclaration=be;var Se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.RETURN,t}return i(t,e),t}(J);t.ReturnStatement=Se;var Ae=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.SWITCHCASE,t}return i(t,e),t}(l);t.SwitchCase=Ae;var Ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.SWITCH,t}return i(t,e),t}(J);t.SwitchStatement=Ne;var Ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.THROW,t}return i(t,e),t}(J);t.ThrowStatement=Ce;var Oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TRY,t}return i(t,e),t}(J);t.TryStatement=Oe;var xe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TYPEDECLARATION,t}return i(t,e),t}(ee);t.TypeDeclaration=xe;var ke=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.VARIABLEDECLARATION,t}return i(t,e),t}(re);t.VariableDeclaration=ke;var Le=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.VARIABLE,t}return i(t,e),t}(J);t.VariableStatement=Le;var Re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.VOID,t}return i(t,e),t}(J);t.VoidStatement=Re;var Fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.WHILE,t}return i(t,e),t}(J);function Be(e){return e.endsWith(".ts")&&(e=e.substring(0,e.length-3)),e}t.WhileStatement=Fe,t.findDecorator=function(e,t){if(t)for(var r=0,n=t.length;r<n;++r){var i=t[r];if(i.decoratorKind==e)return i}return null},t.mangleInternalPath=Be},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),i=r(4);!function(e){e[e.I8=0]="I8",e[e.I16=1]="I16",e[e.I32=2]="I32",e[e.I64=3]="I64",e[e.ISIZE=4]="ISIZE",e[e.U8=5]="U8",e[e.U16=6]="U16",e[e.U32=7]="U32",e[e.U64=8]="U64",e[e.USIZE=9]="USIZE",e[e.BOOL=10]="BOOL",e[e.F32=11]="F32",e[e.F64=12]="F64",e[e.V128=13]="V128",e[e.VOID=14]="VOID"}(t.TypeKind||(t.TypeKind={})),function(e){e[e.NONE=0]="NONE",e[e.SIGNED=1]="SIGNED",e[e.UNSIGNED=2]="UNSIGNED",e[e.INTEGER=4]="INTEGER",e[e.FLOAT=8]="FLOAT",e[e.POINTER=16]="POINTER",e[e.SHORT=32]="SHORT",e[e.LONG=64]="LONG",e[e.VALUE=128]="VALUE",e[e.REFERENCE=256]="REFERENCE",e[e.NULLABLE=512]="NULLABLE",e[e.VECTOR=1024]="VECTOR"}(t.TypeFlags||(t.TypeFlags={}));var a=new Uint8Array(16),o=function(){function e(e,t,r){this.cachedNullableType=null,this.kind=e,this.flags=t,this.size=r,this.byteSize=ceil(r/8),this.classReference=null,this.signatureReference=null,this.nonNullableType=this}return Object.defineProperty(e.prototype,"intType",{get:function(){switch(this.kind){case 0:return e.i8;case 1:return e.i16;case 11:case 2:return e.i32;case 12:case 3:return e.i64;case 4:return 64==this.size?e.isize64:e.isize32;case 5:return e.u8;case 6:return e.u16;case 7:return e.u32;case 8:return e.u64;case 9:return 64==this.size?e.usize64:e.usize32;case 10:default:return e.i32}},enumerable:!0,configurable:!0}),e.prototype.isManaged=function(e){if(e.hasGC){var t=this.classReference;return null!==t&&!t.hasDecorator(n.DecoratorFlags.UNMANAGED)}return!1},e.prototype.computeSmallIntegerShift=function(e){return e.size-this.size},e.prototype.computeSmallIntegerMask=function(e){var t=this.is(2)?this.size:this.size-1;return-1>>>e.size-t},e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.isAny=function(e){return 0!=(this.flags&e)},e.prototype.asClass=function(t){assert(9==this.kind&&!this.classReference);var r=new e(this.kind,-129&this.flags|256,this.size);return r.classReference=t,r},e.prototype.asFunction=function(t){assert(7==this.kind&&!this.signatureReference);var r=new e(this.kind,-129&this.flags|256,this.size);return r.signatureReference=t,r},e.prototype.asNullable=function(){return assert(this.is(256)),this.cachedNullableType||(assert(!this.is(512)),this.cachedNullableType=new e(this.kind,512|this.flags,this.size),this.cachedNullableType.nonNullableType=this,this.cachedNullableType.classReference=this.classReference,this.cachedNullableType.signatureReference=this.signatureReference),this.cachedNullableType},e.prototype.isAssignableTo=function(t,r){var n,i,a,o;if(void 0===r&&(r=!1),this.is(256)){if(t.is(256)&&(!this.is(512)||t.is(512)))if(n=this.classReference){if(i=t.classReference)return n.isAssignableTo(i)}else if((a=this.signatureReference)&&(o=t.signatureReference))return a.isAssignableTo(o)}else if(!t.is(256))if(this.is(4))if(t.is(4)){if(!r||this==e.bool||this.is(1)==t.is(1))return this.size<=t.size}else{if(11==t.kind)return this.size<=23;if(12==t.kind)return this.size<=52}else if(this.is(8)){if(t.is(8))return this.size<=t.size}else if(this.is(1024)&&t.is(1024))return this.size==t.size;return!1},e.commonCompatible=function(e,t,r){return t.isAssignableTo(e,r)?e:e.isAssignableTo(t,r)?t:null},e.prototype.toString=function(e){if(void 0===e&&(e=!1),!e&&this.is(256)){var t=this.classReference;if(t)return this.is(512)?t.name+" | null":t.name;var r=this.signatureReference;if(r)return this.is(512)?"("+r.toString(!0)+") | null":r.toString(!0);assert(!1)}switch(this.kind){case 0:return"i8";case 1:return"i16";case 2:return"i32";case 3:return"i64";case 4:return"isize";case 5:return"u8";case 6:return"u16";case 7:return"u32";case 8:return"u64";case 9:return"usize";case 10:return"bool";case 11:return"f32";case 12:return"f64";case 13:return"v128";default:assert(!1);case 14:return"void"}},e.prototype.toNativeType=function(){switch(this.kind){default:return i.NativeType.I32;case 3:case 8:return i.NativeType.I64;case 4:case 9:return 64==this.size?i.NativeType.I64:i.NativeType.I32;case 11:return i.NativeType.F32;case 12:return i.NativeType.F64;case 13:return i.NativeType.V128;case 14:return i.NativeType.None}},e.prototype.toNativeZero=function(e){switch(this.kind){case 14:assert(!1);default:return e.createI32(0);case 4:case 9:if(64!=this.size)return e.createI32(0);case 3:case 8:return e.createI64(0);case 11:return e.createF32(0);case 12:return e.createF64(0);case 13:return e.createV128(a)}},e.prototype.toNativeOne=function(e){switch(this.kind){case 13:case 14:assert(!1);default:return e.createI32(1);case 4:case 9:if(64!=this.size)return e.createI32(1);case 3:case 8:return e.createI64(1);case 11:return e.createF32(1);case 12:return e.createF64(1)}},e.prototype.toNativeNegOne=function(e){switch(this.kind){case 13:case 14:assert(!1);default:return e.createI32(-1);case 4:case 9:if(64!=this.size)return e.createI32(-1);case 3:case 8:return e.createI64(-1,-1);case 11:return e.createF32(-1);case 12:return e.createF64(-1)}},e.prototype.toSignatureString=function(){switch(this.kind){default:return"i";case 3:case 8:return"I";case 4:case 9:return 64==this.size?"I":"i";case 11:return"f";case 12:return"F";case 13:return"v";case 14:return"_"}},e.i8=new e(0,165,8),e.i16=new e(1,165,16),e.i32=new e(2,133,32),e.i64=new e(3,197,64),e.isize32=new e(4,149,32),e.isize64=new e(4,213,64),e.u8=new e(5,166,8),e.u16=new e(6,166,16),e.u32=new e(7,134,32),e.u64=new e(8,198,64),e.usize32=new e(9,150,32),e.usize64=new e(9,214,64),e.bool=new e(10,166,1),e.f32=new e(11,137,32),e.f64=new e(12,201,64),e.v128=new e(13,1152,128),e.void=new e(14,0,0),e}();t.Type=o,t.typesToNativeTypes=function(e){for(var t=e.length,r=new Array(t),n=0;n<t;++n)r[n]=e[n].toNativeType();return r},t.typesToString=function(e){var t=e.length;if(!t)return"";for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n].toString();return r.join(",")};var s=function(){function e(e,t,r){void 0===e&&(e=null),void 0===t&&(t=null),void 0===r&&(r=null),this.cachedFunctionTarget=null,this.parameterTypes=e||[],this.parameterNames=null,this.requiredParameters=0,this.returnType=t||o.void,this.thisType=r,this.hasRest=!1,this.type=o.u32.asFunction(this)}return e.prototype.asFunctionTarget=function(e){var t=this.cachedFunctionTarget;return t?assert(t.program==e):this.cachedFunctionTarget=t=new n.FunctionTarget(this,e),t},e.prototype.getParameterName=function(e){var t=this.parameterNames;return t&&t.length>e?t[e]:l(e)},e.prototype.isAssignableTo=function(e){var t=this.thisType,r=e.thisType;if(t){if(!r||!t.isAssignableTo(r))return!1}else if(r)return!1;if(this.hasRest!=e.hasRest)return!1;var n=this.parameterTypes,i=e.parameterTypes,a=n.length;if(a!=i.length)return!1;for(var o=0;o<a;++o){var s=n[o],c=i[o];if(!s.isAssignableTo(c))return!1}var l=this.returnType,p=e.returnType;return l==p||l.isAssignableTo(p)},e.makeSignatureString=function(e,t,r){void 0===r&&(r=null);var n=[];if(r&&n.push(r.toSignatureString()),e)for(var i=0,a=e.length;i<a;++i)n.push(e[i].toSignatureString());return n.push(t.toSignatureString()),n.join("")},e.prototype.toSignatureString=function(){return e.makeSignatureString(this.parameterTypes,this.returnType,this.thisType)},e.prototype.toString=function(e){void 0===e&&(e=!1);var t=new Array;t.push("(");var r=0,n=this.thisType;n&&e&&(t.push("this: "),t.push(n.toString()),r=1);var i=this.parameterTypes,a=i.length;if(a)for(var o=this.parameterNames,s=o?o.length:0,c=this.requiredParameters,p=this.hasRest?a-1:-1,u=0;u<a;++u,++r)r&&t.push(", "),u==p&&t.push("..."),u<s?t.push(o[u]):t.push(l(u)),u>=c&&u!=p?t.push("?: "):t.push(": "),t.push(i[u].toString());return t.push(") => "),t.push(this.returnType.toString()),t.join("")},e}();t.Signature=s;var c=null;function l(e){c||(c=[]);for(var t=c.length;t<=e;++t)c.push("arg$"+t.toString(10));return c[e-1]}t.getDefaultParameterName=l},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a,o,s=r(1),c=r(5),l=r(2);function p(e){switch(assert(e.length),e.charCodeAt(0)){case 97:switch(e){case"abstract":return a.ABSTRACT;case"as":return a.AS;case"async":return a.ASYNC;case"await":return a.AWAIT}break;case 98:switch(e){case"break":return a.BREAK}break;case 99:switch(e){case"case":return a.CASE;case"catch":return a.CATCH;case"class":return a.CLASS;case"continue":return a.CONTINUE;case"const":return a.CONST;case"constructor":return a.CONSTRUCTOR}break;case 100:switch(e){case"debugger":return a.DEBUGGER;case"declare":return a.DECLARE;case"default":return a.DEFAULT;case"delete":return a.DELETE;case"do":return a.DO}break;case 101:switch(e){case"else":return a.ELSE;case"enum":return a.ENUM;case"export":return a.EXPORT;case"extends":return a.EXTENDS}break;case 102:switch(e){case"false":return a.FALSE;case"finally":return a.FINALLY;case"for":return a.FOR;case"from":return a.FROM;case"function":return a.FUNCTION}break;case 103:switch(e){case"get":return a.GET}break;case 105:switch(e){case"if":return a.IF;case"implements":return a.IMPLEMENTS;case"import":return a.IMPORT;case"in":return a.IN;case"instanceof":return a.INSTANCEOF;case"interface":return a.INTERFACE;case"is":return a.IS}break;case 107:switch(e){case"keyof":return a.KEYOF}break;case 108:switch(e){case"let":return a.LET}break;case 109:switch(e){case"module":return a.MODULE}break;case 110:switch(e){case"namespace":return a.NAMESPACE;case"new":return a.NEW;case"null":return a.NULL}break;case 111:switch(e){case"of":return a.OF}break;case 112:switch(e){case"package":return a.PACKAGE;case"private":return a.PRIVATE;case"protected":return a.PROTECTED;case"public":return a.PUBLIC}break;case 114:switch(e){case"readonly":return a.READONLY;case"return":return a.RETURN}break;case 115:switch(e){case"set":return a.SET;case"static":return a.STATIC;case"super":return a.SUPER;case"switch":return a.SWITCH}break;case 116:switch(e){case"this":return a.THIS;case"throw":return a.THROW;case"true":return a.TRUE;case"try":return a.TRY;case"type":return a.TYPE;case"typeof":return a.TYPEOF}break;case 118:switch(e){case"var":return a.VAR;case"void":return a.VOID}break;case 119:switch(e){case"while":return a.WHILE;case"with":return a.WITH}break;case 121:switch(e){case"yield":return a.YIELD}}return a.INVALID}function u(e){switch(e){case a.ABSTRACT:case a.AS:case a.CONSTRUCTOR:case a.DECLARE:case a.DELETE:case a.FROM:case a.FOR:case a.GET:case a.IS:case a.KEYOF:case a.MODULE:case a.NAMESPACE:case a.READONLY:case a.SET:case a.TYPE:case a.VOID:return!0;default:return!1}}!function(e){e[e.ABSTRACT=0]="ABSTRACT",e[e.AS=1]="AS",e[e.ASYNC=2]="ASYNC",e[e.AWAIT=3]="AWAIT",e[e.BREAK=4]="BREAK",e[e.CASE=5]="CASE",e[e.CATCH=6]="CATCH",e[e.CLASS=7]="CLASS",e[e.CONST=8]="CONST",e[e.CONTINUE=9]="CONTINUE",e[e.CONSTRUCTOR=10]="CONSTRUCTOR",e[e.DEBUGGER=11]="DEBUGGER",e[e.DECLARE=12]="DECLARE",e[e.DEFAULT=13]="DEFAULT",e[e.DELETE=14]="DELETE",e[e.DO=15]="DO",e[e.ELSE=16]="ELSE",e[e.ENUM=17]="ENUM",e[e.EXPORT=18]="EXPORT",e[e.EXTENDS=19]="EXTENDS",e[e.FALSE=20]="FALSE",e[e.FINALLY=21]="FINALLY",e[e.FOR=22]="FOR",e[e.FROM=23]="FROM",e[e.FUNCTION=24]="FUNCTION",e[e.GET=25]="GET",e[e.IF=26]="IF",e[e.IMPLEMENTS=27]="IMPLEMENTS",e[e.IMPORT=28]="IMPORT",e[e.IN=29]="IN",e[e.INSTANCEOF=30]="INSTANCEOF",e[e.INTERFACE=31]="INTERFACE",e[e.IS=32]="IS",e[e.KEYOF=33]="KEYOF",e[e.LET=34]="LET",e[e.MODULE=35]="MODULE",e[e.NAMESPACE=36]="NAMESPACE",e[e.NEW=37]="NEW",e[e.NULL=38]="NULL",e[e.OF=39]="OF",e[e.PACKAGE=40]="PACKAGE",e[e.PRIVATE=41]="PRIVATE",e[e.PROTECTED=42]="PROTECTED",e[e.PUBLIC=43]="PUBLIC",e[e.READONLY=44]="READONLY",e[e.RETURN=45]="RETURN",e[e.SET=46]="SET",e[e.STATIC=47]="STATIC",e[e.SUPER=48]="SUPER",e[e.SWITCH=49]="SWITCH",e[e.THIS=50]="THIS",e[e.THROW=51]="THROW",e[e.TRUE=52]="TRUE",e[e.TRY=53]="TRY",e[e.TYPE=54]="TYPE",e[e.TYPEOF=55]="TYPEOF",e[e.VAR=56]="VAR",e[e.VOID=57]="VOID",e[e.WHILE=58]="WHILE",e[e.WITH=59]="WITH",e[e.YIELD=60]="YIELD",e[e.OPENBRACE=61]="OPENBRACE",e[e.CLOSEBRACE=62]="CLOSEBRACE",e[e.OPENPAREN=63]="OPENPAREN",e[e.CLOSEPAREN=64]="CLOSEPAREN",e[e.OPENBRACKET=65]="OPENBRACKET",e[e.CLOSEBRACKET=66]="CLOSEBRACKET",e[e.DOT=67]="DOT",e[e.DOT_DOT_DOT=68]="DOT_DOT_DOT",e[e.SEMICOLON=69]="SEMICOLON",e[e.COMMA=70]="COMMA",e[e.LESSTHAN=71]="LESSTHAN",e[e.GREATERTHAN=72]="GREATERTHAN",e[e.LESSTHAN_EQUALS=73]="LESSTHAN_EQUALS",e[e.GREATERTHAN_EQUALS=74]="GREATERTHAN_EQUALS",e[e.EQUALS_EQUALS=75]="EQUALS_EQUALS",e[e.EXCLAMATION_EQUALS=76]="EXCLAMATION_EQUALS",e[e.EQUALS_EQUALS_EQUALS=77]="EQUALS_EQUALS_EQUALS",e[e.EXCLAMATION_EQUALS_EQUALS=78]="EXCLAMATION_EQUALS_EQUALS",e[e.EQUALS_GREATERTHAN=79]="EQUALS_GREATERTHAN",e[e.PLUS=80]="PLUS",e[e.MINUS=81]="MINUS",e[e.ASTERISK_ASTERISK=82]="ASTERISK_ASTERISK",e[e.ASTERISK=83]="ASTERISK",e[e.SLASH=84]="SLASH",e[e.PERCENT=85]="PERCENT",e[e.PLUS_PLUS=86]="PLUS_PLUS",e[e.MINUS_MINUS=87]="MINUS_MINUS",e[e.LESSTHAN_LESSTHAN=88]="LESSTHAN_LESSTHAN",e[e.GREATERTHAN_GREATERTHAN=89]="GREATERTHAN_GREATERTHAN",e[e.GREATERTHAN_GREATERTHAN_GREATERTHAN=90]="GREATERTHAN_GREATERTHAN_GREATERTHAN",e[e.AMPERSAND=91]="AMPERSAND",e[e.BAR=92]="BAR",e[e.CARET=93]="CARET",e[e.EXCLAMATION=94]="EXCLAMATION",e[e.TILDE=95]="TILDE",e[e.AMPERSAND_AMPERSAND=96]="AMPERSAND_AMPERSAND",e[e.BAR_BAR=97]="BAR_BAR",e[e.QUESTION=98]="QUESTION",e[e.COLON=99]="COLON",e[e.EQUALS=100]="EQUALS",e[e.PLUS_EQUALS=101]="PLUS_EQUALS",e[e.MINUS_EQUALS=102]="MINUS_EQUALS",e[e.ASTERISK_EQUALS=103]="ASTERISK_EQUALS",e[e.ASTERISK_ASTERISK_EQUALS=104]="ASTERISK_ASTERISK_EQUALS",e[e.SLASH_EQUALS=105]="SLASH_EQUALS",e[e.PERCENT_EQUALS=106]="PERCENT_EQUALS",e[e.LESSTHAN_LESSTHAN_EQUALS=107]="LESSTHAN_LESSTHAN_EQUALS",e[e.GREATERTHAN_GREATERTHAN_EQUALS=108]="GREATERTHAN_GREATERTHAN_EQUALS",e[e.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS=109]="GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS",e[e.AMPERSAND_EQUALS=110]="AMPERSAND_EQUALS",e[e.BAR_EQUALS=111]="BAR_EQUALS",e[e.CARET_EQUALS=112]="CARET_EQUALS",e[e.AT=113]="AT",e[e.IDENTIFIER=114]="IDENTIFIER",e[e.STRINGLITERAL=115]="STRINGLITERAL",e[e.INTEGERLITERAL=116]="INTEGERLITERAL",e[e.FLOATLITERAL=117]="FLOATLITERAL",e[e.INVALID=118]="INVALID",e[e.ENDOFFILE=119]="ENDOFFILE"}(a=t.Token||(t.Token={})),function(e){e[e.DEFAULT=0]="DEFAULT",e[e.PREFER=1]="PREFER",e[e.ALWAYS=2]="ALWAYS"}(o=t.IdentifierHandling||(t.IdentifierHandling={})),t.tokenFromKeyword=p,t.tokenIsAlsoIdentifier=u,t.operatorTokenToString=function(e){switch(e){case a.DELETE:return"delete";case a.IN:return"in";case a.INSTANCEOF:return"instanceof";case a.NEW:return"new";case a.TYPEOF:return"typeof";case a.VOID:return"void";case a.YIELD:return"yield";case a.DOT_DOT_DOT:return"...";case a.COMMA:return",";case a.LESSTHAN:return"<";case a.GREATERTHAN:return">";case a.LESSTHAN_EQUALS:return"<=";case a.GREATERTHAN_EQUALS:return">=";case a.EQUALS_EQUALS:return"==";case a.EXCLAMATION_EQUALS:return"!=";case a.EQUALS_EQUALS_EQUALS:return"===";case a.EXCLAMATION_EQUALS_EQUALS:return"!==";case a.PLUS:return"+";case a.MINUS:return"-";case a.ASTERISK_ASTERISK:return"**";case a.ASTERISK:return"*";case a.SLASH:return"/";case a.PERCENT:return"%";case a.PLUS_PLUS:return"++";case a.MINUS_MINUS:return"--";case a.LESSTHAN_LESSTHAN:return"<<";case a.GREATERTHAN_GREATERTHAN:return">>";case a.GREATERTHAN_GREATERTHAN_GREATERTHAN:return">>>";case a.AMPERSAND:return"&";case a.BAR:return"|";case a.CARET:return"^";case a.EXCLAMATION:return"!";case a.TILDE:return"~";case a.AMPERSAND_AMPERSAND:return"&&";case a.BAR_BAR:return"||";case a.EQUALS:return"=";case a.PLUS_EQUALS:return"+=";case a.MINUS_EQUALS:return"-=";case a.ASTERISK_EQUALS:return"*=";case a.ASTERISK_ASTERISK_EQUALS:return"**=";case a.SLASH_EQUALS:return"/=";case a.PERCENT_EQUALS:return"%=";case a.LESSTHAN_LESSTHAN_EQUALS:return"<<=";case a.GREATERTHAN_GREATERTHAN_EQUALS:return">>=";case a.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:return">>>=";case a.AMPERSAND_EQUALS:return"&=";case a.BAR_EQUALS:return"|=";case a.CARET_EQUALS:return"^=";default:return assert(!1),""}};var _=function(){function e(e,t,r){this.debugInfoRef=0,this.source=e,this.start=t,this.end=r}return e.join=function(t,r){if(t.source!=r.source)throw new Error("source mismatch");return new e(t.source,t.start<r.start?t.start:r.start,t.end>r.end?t.end:r.end)},Object.defineProperty(e.prototype,"atStart",{get:function(){return new e(this.source,this.start,this.start)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"atEnd",{get:function(){return new e(this.source,this.end,this.end)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){for(var e=this.source.text,t=1,r=this.start;r>=0;--r)10==e.charCodeAt(r)&&t++;return t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"column",{get:function(){for(var e=this.source.text,t=0,r=this.start-1;r>=0&&10!=e.charCodeAt(r);--r)++t;return t},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return this.source.text.substring(this.start,this.end)},e}();t.Range=_;var h=function(e){function t(t,r){void 0===r&&(r=null);var n=e.call(this,r)||this;n.end=0,n.pos=0,n.token=-1,n.tokenPos=0,n.nextToken=-1,n.nextTokenPos=0,n.nextTokenOnNewLine=!1,n.onComment=null,n.source=t,n.pos=0,n.end=t.text.length,n.diagnostics=r||new Array;var i=t.text;if(n.pos<n.end&&65279==i.charCodeAt(n.pos)&&++n.pos,n.pos+1<n.end&&35==i.charCodeAt(n.pos)&&33==i.charCodeAt(n.pos+1))for(n.pos+=2;n.pos<n.end&&10!=i.charCodeAt(n.pos);)++n.pos;return n}return i(t,e),t.prototype.next=function(e){return void 0===e&&(e=o.DEFAULT),this.nextToken=-1,this.token=this.unsafeNext(e)},t.prototype.unsafeNext=function(e,t){void 0===e&&(e=o.DEFAULT),void 0===t&&(t=i32.MAX_VALUE);for(var r=this.source.text;this.pos<this.end;){this.tokenPos=this.pos;var n=r.charCodeAt(this.pos);switch(n){case 13:if(!(++this.pos<this.end&&10==r.charCodeAt(this.pos)))break;case 10:case 9:case 11:case 12:case 32:++this.pos;break;case 33:return++this.pos,t>1&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,t>2&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.EXCLAMATION_EQUALS_EQUALS):a.EXCLAMATION_EQUALS):a.EXCLAMATION;case 34:case 39:case 96:return a.STRINGLITERAL;case 37:return++this.pos,t>1&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.PERCENT_EQUALS):a.PERCENT;case 38:if(++this.pos,t>1&&this.pos<this.end){if(38==r.charCodeAt(this.pos))return++this.pos,a.AMPERSAND_AMPERSAND;if(61==r.charCodeAt(this.pos))return++this.pos,a.AMPERSAND_EQUALS}return a.AMPERSAND;case 40:return++this.pos,a.OPENPAREN;case 41:return++this.pos,a.CLOSEPAREN;case 42:if(++this.pos,t>1&&this.pos<this.end){if(61==r.charCodeAt(this.pos))return++this.pos,a.ASTERISK_EQUALS;if(42==r.charCodeAt(this.pos))return++this.pos,t>2&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.ASTERISK_ASTERISK_EQUALS):a.ASTERISK_ASTERISK}return a.ASTERISK;case 43:if(++this.pos,t>1&&this.pos<this.end){if(43==r.charCodeAt(this.pos))return++this.pos,a.PLUS_PLUS;if(61==r.charCodeAt(this.pos))return++this.pos,a.PLUS_EQUALS}return a.PLUS;case 44:return++this.pos,a.COMMA;case 45:if(++this.pos,t>1&&this.pos<this.end){if(45==r.charCodeAt(this.pos))return++this.pos,a.MINUS_MINUS;if(61==r.charCodeAt(this.pos))return++this.pos,a.MINUS_EQUALS}return a.MINUS;case 46:if(++this.pos,t>1&&this.pos<this.end){if(l.isDecimalDigit(r.charCodeAt(this.pos)))return--this.pos,a.FLOATLITERAL;if(t>2&&this.pos+1<this.end&&46==r.charCodeAt(this.pos)&&46==r.charCodeAt(this.pos+1))return this.pos+=2,a.DOT_DOT_DOT}return a.DOT;case 47:var i=this.pos;if(++this.pos,t>1&&this.pos<this.end){if(47==r.charCodeAt(this.pos)){var _=c.CommentKind.LINE;for(this.pos+1<this.end&&47==r.charCodeAt(this.pos+1)&&(++this.pos,_=c.CommentKind.TRIPLE);++this.pos<this.end;)if(10==r.charCodeAt(this.pos)){++this.pos;break}this.onComment&&this.onComment(_,r.substring(i,this.pos),this.range(i,this.pos));break}if(42==r.charCodeAt(this.pos)){for(var h=!1;++this.pos<this.end;)if(42==(n=r.charCodeAt(this.pos))&&this.pos+1<this.end&&47==r.charCodeAt(this.pos+1)){this.pos+=2,h=!0;break}h?this.onComment&&this.onComment(c.CommentKind.BLOCK,r.substring(i,this.pos),this.range(i,this.pos)):this.error(s.DiagnosticCode._0_expected,this.range(this.pos),"*/");break}if(61==r.charCodeAt(this.pos))return++this.pos,a.SLASH_EQUALS}return a.SLASH;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.testInteger()?a.INTEGERLITERAL:a.FLOATLITERAL;case 58:return++this.pos,a.COLON;case 59:return++this.pos,a.SEMICOLON;case 60:if(++this.pos,t>1&&this.pos<this.end){if(60==r.charCodeAt(this.pos))return++this.pos,t>2&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.LESSTHAN_LESSTHAN_EQUALS):a.LESSTHAN_LESSTHAN;if(61==r.charCodeAt(this.pos))return++this.pos,a.LESSTHAN_EQUALS}return a.LESSTHAN;case 61:if(++this.pos,t>1&&this.pos<this.end){if(61==r.charCodeAt(this.pos))return++this.pos,t>2&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.EQUALS_EQUALS_EQUALS):a.EQUALS_EQUALS;if(62==r.charCodeAt(this.pos))return++this.pos,a.EQUALS_GREATERTHAN}return a.EQUALS;case 62:if(++this.pos,t>1&&this.pos<this.end){if(62==r.charCodeAt(this.pos)){if(++this.pos,t>2&&this.pos<this.end){if(62==r.charCodeAt(this.pos))return++this.pos,t>3&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS):a.GREATERTHAN_GREATERTHAN_GREATERTHAN;if(61==r.charCodeAt(this.pos))return++this.pos,a.GREATERTHAN_GREATERTHAN_EQUALS}return a.GREATERTHAN_GREATERTHAN}if(61==r.charCodeAt(this.pos))return++this.pos,a.GREATERTHAN_EQUALS}return a.GREATERTHAN;case 63:return++this.pos,a.QUESTION;case 91:return++this.pos,a.OPENBRACKET;case 93:return++this.pos,a.CLOSEBRACKET;case 94:return++this.pos,t>1&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.CARET_EQUALS):a.CARET;case 123:return++this.pos,a.OPENBRACE;case 124:if(++this.pos,t>1&&this.pos<this.end){if(124==r.charCodeAt(this.pos))return++this.pos,a.BAR_BAR;if(61==r.charCodeAt(this.pos))return++this.pos,a.BAR_EQUALS}return a.BAR;case 125:return++this.pos,a.CLOSEBRACE;case 126:return++this.pos,a.TILDE;case 64:return++this.pos,a.AT;default:if(l.isIdentifierStart(n)){if(l.isKeywordCharacter(n)){for(var d=this.pos;++this.pos<this.end&&l.isIdentifierPart(n=r.charCodeAt(this.pos));)if(!l.isKeywordCharacter(n))return this.pos=d,a.IDENTIFIER;var y=p(r.substring(d,this.pos));if(y!=a.INVALID&&e!==o.ALWAYS&&(e!==o.PREFER||!u(y)))return y;this.pos=d}return a.IDENTIFIER}if(l.isWhiteSpace(n)){++this.pos;break}return this.error(s.DiagnosticCode.Invalid_character,this.range(this.pos,this.pos+1)),++this.pos,a.INVALID}}return a.ENDOFFILE},t.prototype.peek=function(e,t,r){void 0===e&&(e=!1),void 0===t&&(t=o.DEFAULT),void 0===r&&(r=i32.MAX_VALUE);var n=this.source.text;if(this.nextToken<0){var i=this.pos,a=this.token,s=this.tokenPos;if(this.nextToken=this.unsafeNext(t,r),this.nextTokenPos=this.tokenPos,e){this.nextTokenOnNewLine=!1;for(var c=i,p=this.nextTokenPos;c<p;++c)if(l.isLineBreak(n.charCodeAt(c))){this.nextTokenOnNewLine=!0;break}}this.pos=i,this.token=a,this.tokenPos=s}return this.nextToken},t.prototype.skipIdentifier=function(e){return void 0===e&&(e=o.PREFER),this.skip(a.IDENTIFIER,e)},t.prototype.skip=function(e,t){void 0===t&&(t=o.DEFAULT);var r=this.pos,n=this.token,i=this.tokenPos,s=i32.MAX_VALUE;switch(e){case a.GREATERTHAN:s=1}return this.token=this.unsafeNext(t,s),this.token==e?(this.nextToken=-1,!0):(this.pos=r,this.token=n,this.tokenPos=i,!1)},t.prototype.mark=function(){var e;return y?(e=y,y=null):e=new d,e.pos=this.pos,e.token=this.token,e.tokenPos=this.tokenPos,e},t.prototype.discard=function(e){y=e},t.prototype.reset=function(e){this.pos=e.pos,this.token=e.token,this.tokenPos=e.tokenPos,this.nextToken=-1},t.prototype.range=function(e,t){return void 0===e&&(e=-1),void 0===t&&(t=-1),e<0?(e=this.tokenPos,t=this.pos):t<0&&(t=e),new _(this.source,e,t)},t.prototype.readIdentifier=function(){for(var e=this.source.text,t=this.pos;++this.pos<this.end&&l.isIdentifierPart(e.charCodeAt(this.pos)););return e.substring(t,this.pos)},t.prototype.readString=function(){for(var e=this.source.text,t=e.charCodeAt(this.pos++),r=this.pos,n="";;){if(this.pos>=this.end){n+=e.substring(r,this.pos),this.error(s.DiagnosticCode.Unterminated_string_literal,this.range(r-1,this.end));break}var i=e.charCodeAt(this.pos);if(i==t){n+=e.substring(r,this.pos++);break}if(92!=i){if(l.isLineBreak(i)){n+=e.substring(r,this.pos),this.error(s.DiagnosticCode.Unterminated_string_literal,this.range(r-1,this.pos));break}++this.pos}else n+=e.substring(r,this.pos),n+=this.readEscapeSequence(),r=this.pos}return n},t.prototype.readEscapeSequence=function(){if(++this.pos>=this.end)return this.error(s.DiagnosticCode.Unexpected_end_of_text,this.range(this.end)),"";var e=this.source.text,t=e.charCodeAt(this.pos++);switch(t){case 48:return"\0";case 98:return"\b";case 116:return"\t";case 110:return"\n";case 118:return"\v";case 102:return"\f";case 114:return"\r";case 39:return"'";case 34:return'"';case 117:return this.pos<this.end&&123==e.charCodeAt(this.pos)?(++this.pos,this.readExtendedUnicodeEscape()):this.readUnicodeEscape();case 13:this.pos<this.end&&10==e.charCodeAt(this.pos)&&++this.pos;case 10:case 8232:case 8233:return"";default:return String.fromCharCode(t)}},t.prototype.readRegexpPattern=function(){for(var e=this.source.text,t=this.pos,r=!1;;){if(this.pos>=this.end){this.error(s.DiagnosticCode.Unterminated_regular_expression_literal,this.range(t,this.end));break}if(92!=e.charCodeAt(this.pos)){var n=e.charCodeAt(this.pos);if(47==n&&!r)break;if(l.isLineBreak(n)){this.error(s.DiagnosticCode.Unterminated_regular_expression_literal,this.range(t,this.pos));break}++this.pos,r=!1}else++this.pos,r=!0}return e.substring(t,this.pos)},t.prototype.readRegexpFlags=function(){for(var e=this.source.text,t=this.pos,r=0;this.pos<this.end;){var n=e.charCodeAt(this.pos);if(!l.isIdentifierPart(n))break;switch(++this.pos,n){case 103:r|=1&r?-1:1;break;case 105:r|=2&r?-1:2;break;case 109:r|=4&r?-1:4;break;default:r=-1}}return-1==r&&this.error(s.DiagnosticCode.Invalid_regular_expression_flags,this.range(t,this.pos)),e.substring(t,this.pos)},t.prototype.testInteger=function(){var e=this.source.text;if(48==e.charCodeAt(this.pos)&&this.pos+1<this.end)switch(e.charCodeAt(this.pos+2)){case 88:case 120:case 66:case 98:case 79:case 111:return!0}for(var t=this.pos;t<this.end;){var r=e.charCodeAt(t);if(46==r||69==r||101==r)return!1;if((r<48||r>57)&&95!=r)break;t++}return!0},t.prototype.readInteger=function(){var e=this.source.text;if(48==e.charCodeAt(this.pos)&&this.pos+2<this.end){switch(e.charCodeAt(this.pos+1)){case 88:case 120:return this.pos+=2,this.readHexInteger();case 66:case 98:return this.pos+=2,this.readBinaryInteger();case 79:case 111:return this.pos+=2,this.readOctalInteger()}if(l.isOctalDigit(e.charCodeAt(this.pos+1))){var t=this.pos;++this.pos;var r=this.readOctalInteger();return this.error(s.DiagnosticCode.Octal_literals_are_not_allowed_in_strict_mode,this.range(t,this.pos)),r}}return this.readDecimalInteger()},t.prototype.readHexInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0,0),n=i64_new(16,0),i=t;this.pos<this.end;){var a=this.pos,o=e.charCodeAt(a);if(o>=48&&o<=57)r=i64_add(i64_mul(r,n),i64_new(o-48,0));else if(o>=65&&o<=70)r=i64_add(i64_mul(r,n),i64_new(10+o-65,0));else if(o>=97&&o<=102)r=i64_add(i64_mul(r,n),i64_new(10+o-97,0));else{if(95!=o)break;i==a&&this.error(i==t?s.DiagnosticCode.Numeric_separators_are_not_allowed_here:s.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}this.pos=a+1}return this.pos==t?this.error(s.DiagnosticCode.Hexadecimal_digit_expected,this.range(t)):i==this.pos&&this.error(s.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(i-1)),r},t.prototype.readDecimalInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0,0),n=i64_new(10,0),i=t;this.pos<this.end;){var a=this.pos,o=e.charCodeAt(a);if(o>=48&&o<=57)r=i64_add(i64_mul(r,n),i64_new(o-48,0));else{if(95!=o)break;i==a&&this.error(i==t?s.DiagnosticCode.Numeric_separators_are_not_allowed_here:s.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}this.pos=a+1}return this.pos==t?this.error(s.DiagnosticCode.Digit_expected,this.range(t)):i==this.pos&&this.error(s.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(i-1)),r},t.prototype.readOctalInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0,0),n=i64_new(8,0),i=t;this.pos<this.end;){var a=this.pos,o=e.charCodeAt(a);if(o>=48&&o<=55)r=i64_add(i64_mul(r,n),i64_new(o-48,0));else{if(95!=o)break;i==a&&this.error(i==t?s.DiagnosticCode.Numeric_separators_are_not_allowed_here:s.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}++this.pos}return this.pos==t?this.error(s.DiagnosticCode.Octal_digit_expected,this.range(t)):i==this.pos&&this.error(s.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(i-1)),r},t.prototype.readBinaryInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0,0),n=i64_new(2,0),i=i64_new(1,0),a=t;this.pos<this.end;){var o=this.pos,c=e.charCodeAt(o);if(48==c)r=i64_mul(r,n);else if(49==c)r=i64_add(i64_mul(r,n),i);else{if(95!=c)break;a==o&&this.error(a==t?s.DiagnosticCode.Numeric_separators_are_not_allowed_here:s.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(o)),a=o+1}this.pos=o+1}return this.pos==t?this.error(s.DiagnosticCode.Binary_digit_expected,this.range(t)):a==this.pos&&this.error(s.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(a-1)),r},t.prototype.readFloat=function(){return this.readDecimalFloat()},t.prototype.readDecimalFloat=function(){for(var e=this.pos,t=this.source.text;this.pos<this.end&&l.isDecimalDigit(t.charCodeAt(this.pos));)++this.pos;if(this.pos<this.end&&46==t.charCodeAt(this.pos))for(++this.pos;this.pos<this.end&&l.isDecimalDigit(t.charCodeAt(this.pos));)++this.pos;if(this.pos<this.end){var r=t.charCodeAt(this.pos);if(69==r||101==r)for(++this.pos<this.end&&(45==t.charCodeAt(this.pos)||43==t.charCodeAt(this.pos))&&l.isDecimalDigit(t.charCodeAt(this.pos+1))&&++this.pos;this.pos<this.end&&l.isDecimalDigit(t.charCodeAt(this.pos));)++this.pos}return parseFloat(t.substring(e,this.pos))},t.prototype.readHexFloat=function(){throw new Error("not implemented")},t.prototype.readUnicodeEscape=function(){for(var e=4,t=0,r=this.source.text;this.pos<this.end;){var n=r.charCodeAt(this.pos++);if(n>=48&&n<=57)t=16*t+n-48;else if(n>=65&&n<=70)t=16*t+10+n-65;else{if(!(n>=97&&n<=102))return this.error(s.DiagnosticCode.Hexadecimal_digit_expected,this.range(this.pos-1,this.pos)),"";t=16*t+10+n-97}if(0==--e)break}return e?(this.error(s.DiagnosticCode.Unexpected_end_of_text,this.range(this.pos)),""):String.fromCharCode(t)},t.prototype.readExtendedUnicodeEscape=function(){var e=this.pos,t=this.readHexInteger(),r=i64_low(t),n=!1;assert(!i64_high(t)),r>1114111&&(this.error(s.DiagnosticCode.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive,this.range(e,this.pos)),n=!0);var i=this.source.text;return this.pos>=this.end?(this.error(s.DiagnosticCode.Unexpected_end_of_text,this.range(e,this.end)),n=!0):125==i.charCodeAt(this.pos)?++this.pos:(this.error(s.DiagnosticCode.Unterminated_Unicode_escape_sequence,this.range(e,this.pos)),n=!0),n?"":r<65536?String.fromCharCode(r):String.fromCharCode(55296+((r-65536)/1024|0),(r-65536)%1024+56320)},t.prototype.finish=function(){},t}(s.DiagnosticEmitter);t.Tokenizer=h;var d=function(){return function(){}}();t.State=d;var y=null},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0});var s,c=r(1),l=r(3),p=r(5),u=r(6),_=r(0),h=r(2),d=r(7);!function(e){e[e.REPORT=0]="REPORT",e[e.SWALLOW=1]="SWALLOW"}(s=t.ReportMode||(t.ReportMode={}));var y=function(e){function t(t){var r=e.call(this,t.diagnostics)||this;return r.currentThisExpression=null,r.currentElementExpression=null,r.program=t,r}return i(t,e),t.prototype.resolveType=function(e,t,r,n){if(void 0===r&&(r=null),void 0===n&&(n=s.REPORT),e.kind==p.NodeKind.SIGNATURE){var i=e.explicitThisType,a=null;if(i&&!(a=this.resolveType(i,t,r,n)))return null;for(var o=e.parameters,d=o.length,y=new Array(d),m=new Array(d),g=0,T=!1,f=0;f<d;++f){var E=o[f];switch(E.parameterKind){case p.ParameterKind.DEFAULT:g=f+1;break;case p.ParameterKind.REST:assert(f==d),T=!0}var I=this.resolveType(assert(E.type),t,r,n);if(!I)return null;y[f]=I,m[f]=E.name.text}var v=e.returnType,b=void 0;if(v){if(!(b=this.resolveType(v,t,r,n)))return null}else b=u.Type.void;var S=new u.Signature(y,b,a);return S.parameterNames=m,S.requiredParameters=g,S.hasRest=T,e.isNullable?S.type.asNullable():S.type}assert(e.kind==p.NodeKind.TYPE);var A=e,N=A.name,C=A.typeArguments,O=!N.next;if(O&&r&&r.has(N.identifier.text)){var x=r.get(N.identifier.text);return null!==C&&C.length&&n==s.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,x.toString()),e.isNullable?(x.is(256)||n==s.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,e.range,x.toString()),x.asNullable()):x}var k=this.resolveTypeName(N,t,n);if(!k)return null;if(k.shadowType)k=k.shadowType;else{if(k.kind==l.ElementKind.ENUM)return null!==C&&C.length&&n==s.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,k.internalName),e.isNullable&&n==s.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,e.range,k.name),u.Type.i32;if(k.kind==l.ElementKind.CLASS_PROTOTYPE){var L=this.resolveClassInclTypeArguments(k,C,t,h.makeMap(r),e);return L?e.isNullable?L.type.asNullable():L.type:null}}if(k.kind==l.ElementKind.TYPEDEFINITION){if(k.is(_.CommonFlags.RESOLVED)){null!==C&&C.length&&n==s.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,k.internalName);x=k.type;if(e.isNullable){if(x.is(256))return x.asNullable();n==s.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,A.name.range,N.identifier.text)}return x}if(O&&N.identifier.text==_.CommonSymbols.native){if(!C||1!=C.length)return n==s.REPORT&&this.error(c.DiagnosticCode.Expected_0_type_arguments_but_got_1,A.range,"1",(C?C.length:1).toString(10)),null;var R=this.resolveType(C[0],t,r,n);if(!R)return null;switch(R.kind){case 0:case 1:case 2:return u.Type.i32;case 4:if(!this.program.options.isWasm64)return u.Type.i32;case 3:return u.Type.i64;case 5:case 6:case 7:case 10:return u.Type.u32;case 9:if(!this.program.options.isWasm64)return u.Type.u32;case 8:return u.Type.u64;case 11:return u.Type.f32;case 12:return u.Type.f64;case 13:return u.Type.v128;case 14:return u.Type.void;default:assert(!1)}}var F=k.typeParameterNodes;if(F){if(!this.resolveTypeArguments(F,C,t,r=h.makeMap(r),e,n))return null}else C&&C.length&&this.error(c.DiagnosticCode.Type_0_is_not_generic,A.range,N.identifier.text);return this.resolveType(k.typeNode,k,r,n)}return n==s.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,A.name.range,N.identifier.text),null},t.prototype.resolveTypeName=function(e,t,r){void 0===r&&(r=s.REPORT);var n=t.lookup(e.identifier.text);if(!n)return r==s.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,e.identifier.text),null;for(var i=e,a=e.next;a;){if(!(n=n.lookupInSelf(a.identifier.text)))return r==s.REPORT&&this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,a.range,a.identifier.text,i.identifier.text),null;i=a,a=a.next}return n},t.prototype.resolveTypeArguments=function(e,t,r,n,i,a){void 0===n&&(n=h.makeMap()),void 0===i&&(i=null),void 0===a&&(a=s.REPORT);for(var o=0,l=0,u=0;u<e.length;++u)e[u].defaultType||++o,++l;var _=t?t.length:0;if(_<o||_>l)return this.error(c.DiagnosticCode.Expected_0_type_arguments_but_got_1,_?p.Range.join(t[0].range,t[_-1].range):assert(i).range,(_<o?o:l).toString(10),_.toString(10)),null;var d=new Array(l);for(u=0;u<l;++u){var y=u<_?this.resolveType(t[u],r,n,a):this.resolveType(assert(e[u].defaultType),r,n,a);if(!y)return null;n.set(e[u].name.text,y),d[u]=y}return d},t.prototype.resolveIdentifier=function(e,t,r,n){void 0===n&&(n=s.REPORT);var i,a=e.text;return t&&(i=t.lookup(a))?(this.currentThisExpression=null,this.currentElementExpression=null,i):r&&(i=r.lookup(a))?(this.currentThisExpression=null,this.currentElementExpression=null,i):(i=this.program.lookupGlobal(a))?(this.currentThisExpression=null,this.currentElementExpression=null,i):(n==s.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,a),null)},t.prototype.ensureResolvedLazyGlobal=function(e,t){if(void 0===t&&(t=s.REPORT),e.is(_.CommonFlags.RESOLVED))return!0;var r=e.typeNode;if(!r)return!1;var n=this.resolveType(r,e.parent,null,t);return!!n&&(e.setType(n),!0)},t.prototype.resolvePropertyAccessExpression=function(e,t,r,n){void 0===n&&(n=s.REPORT);var i=e.expression,a=this.resolveExpression(i,t,r,n);if(!a)return null;var o=e.property.text;switch(a.kind){case l.ElementKind.GLOBAL:if(!this.ensureResolvedLazyGlobal(a,n))return null;case l.ElementKind.LOCAL:case l.ElementKind.FIELD:var p=a.type;if(assert(p!=u.Type.void),!(y=p.classReference)){var _=this.program.typeClasses;if(p.is(256)||!_.has(p.kind))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,o,a.type.toString()),null;y=_.get(p.kind)}a=y;break;case l.ElementKind.PROPERTY_PROTOTYPE:if(!(d=this.resolveFunction(assert(a.getterPrototype),null,h.makeMap(),n)))return null;if(!(y=d.signature.returnType.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,o,d.signature.returnType.toString()),null;a=y;break;case l.ElementKind.PROPERTY:var d,y;if(!(y=(d=assert(a.getterInstance)).signature.returnType.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,o,d.signature.returnType.toString()),null;a=y;break;case l.ElementKind.CLASS:var m=this.currentElementExpression;if(m){var g=a.lookupOverload(l.OperatorKind.INDEXED_GET);if(!g)return this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,m.range,a.internalName),null;var T=g.signature.returnType;if(!(a=T.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,o,T.toString()),null}}switch(a.kind){case l.ElementKind.CLASS_PROTOTYPE:case l.ElementKind.CLASS:for(;;){if((f=a.members)&&f.has(o))return this.currentThisExpression=i,this.currentElementExpression=null,f.get(o);if(a.kind==l.ElementKind.CLASS_PROTOTYPE){if(!a.basePrototype)break;a=a.basePrototype}else{if(a.kind!=l.ElementKind.CLASS)break;if(!a.base)break;a=a.base}}break;default:var f;if((f=a.members)&&f.has(o))return this.currentThisExpression=i,this.currentElementExpression=null,f.get(o)}return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,o,a.internalName),null},t.prototype.resolveElementAccessExpression=function(e,t,r,n){void 0===n&&(n=s.REPORT);var i=e.expression,a=this.resolveExpression(i,t,r,n);if(!a)return null;switch(a.kind){case l.ElementKind.GLOBAL:if(!this.ensureResolvedLazyGlobal(a,n))return null;case l.ElementKind.LOCAL:case l.ElementKind.FIELD:if(a=a.type.classReference)return this.currentThisExpression=i,this.currentElementExpression=e.elementExpression,a;break;case l.ElementKind.CLASS:var o=a.lookupOverload(l.OperatorKind.INDEXED_GET);return o?i.kind==p.NodeKind.ELEMENTACCESS?(a=o.signature.returnType.classReference)?(this.currentThisExpression=i,this.currentElementExpression=e.elementExpression,a):null:(this.currentThisExpression=i,this.currentElementExpression=e.elementExpression,a):(n==s.REPORT&&this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,a.internalName),null)}return n==s.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,i.range),null},t.prototype.determineIntegerLiteralType=function(e,t){if(!t.is(256))switch(t.kind){case 0:if(i64_is_i8(e))return u.Type.i8;break;case 5:if(i64_is_u8(e))return u.Type.u8;break;case 1:if(i64_is_i16(e))return u.Type.i16;break;case 6:if(i64_is_u16(e))return u.Type.u16;break;case 2:if(i64_is_i32(e))return u.Type.i32;break;case 7:if(i64_is_u32(e))return u.Type.u32;break;case 10:if(i64_is_bool(e))return u.Type.bool;break;case 4:if(!this.program.options.isWasm64){if(i64_is_i32(e))return u.Type.isize32;break}return u.Type.isize64;case 9:if(!this.program.options.isWasm64){if(i64_is_u32(e))return u.Type.usize32;break}return u.Type.usize64;case 3:return u.Type.i64;case 8:return u.Type.u64;case 11:return u.Type.f32;case 12:return u.Type.f64;case 14:break;default:assert(!1)}return i64_is_i32(e)?u.Type.i32:i64_is_u32(e)?u.Type.u32:u.Type.i64},t.prototype.resolveExpression=function(e,t,r,n){for(void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT);e.kind==p.NodeKind.PARENTHESIZED;)e=e.expression;switch(e.kind){case p.NodeKind.ASSERTION:return this.resolveAssertionExpression(e,t,r,n);case p.NodeKind.UNARYPREFIX:return this.resolveUnaryPrefixExpression(e,t,r,n);case p.NodeKind.UNARYPOSTFIX:return this.resolveUnaryPostfixExpression(e,t,r,n);case p.NodeKind.BINARY:return this.resolveBinaryExpression(e,t,r,n);case p.NodeKind.THIS:return this.resolveThisExpression(e,t,r,n);case p.NodeKind.SUPER:return this.resolveSuperExpression(e,t,r,n);case p.NodeKind.IDENTIFIER:return this.resolveIdentifier(e,t,t.actualFunction,n);case p.NodeKind.LITERAL:return this.resolveLiteralExpression(e,t,r,n);case p.NodeKind.PROPERTYACCESS:return this.resolvePropertyAccessExpression(e,t,r,n);case p.NodeKind.ELEMENTACCESS:return this.resolveElementAccessExpression(e,t,r,n);case p.NodeKind.CALL:return this.resolveCallExpression(e,t,r,n)}return n==s.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveAssertionExpression=function(e,t,r,n){if(void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT),e.assertionKind==p.AssertionKind.NONNULL)return this.resolveExpression(e.expression,t,r,n);var i=this.resolveType(assert(e.toType),t.actualFunction,t.contextualTypeArguments,n);if(!i)return null;var a=i.classReference;if(!a){var o=i.signatureReference;if(!o)return null;a=o.asFunctionTarget(this.program)}return this.currentThisExpression=null,this.currentElementExpression=null,a},t.prototype.resolveUnaryPrefixExpression=function(e,t,r,n){void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT);var i=e.operand;switch(e.operator){case d.Token.MINUS:if(i.kind==p.NodeKind.LITERAL&&i.literalKind==p.LiteralKind.INTEGER){var a=this.determineIntegerLiteralType(i64_sub(i64_zero,i.value),r);return(o=this.program.typeClasses).has(a.kind)?o.get(a.kind):null}return this.resolveExpression(i,t,r,n);case d.Token.PLUS:case d.Token.PLUS_PLUS:case d.Token.MINUS_MINUS:return this.resolveExpression(e.operand,t,r,n);case d.Token.EXCLAMATION:var o;return(o=this.program.typeClasses).has(10)?o.get(10):null;case d.Token.TILDE:if(!this.resolveExpression(e.operand,t,r,n))return null;break;default:assert(!1)}return n==s.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveUnaryPostfixExpression=function(e,t,r,n){switch(void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT),e.operator){case d.Token.PLUS_PLUS:case d.Token.MINUS_MINUS:return this.resolveExpression(e.operand,t,r,n);default:assert(!1)}return n==s.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveBinaryExpression=function(e,t,r,n){return void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT),n==s.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveThisExpression=function(e,t,r,n){if(void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT),t.is(4096)){var i=t.lookupLocal(_.CommonSymbols.this_);if(i)return this.currentThisExpression=null,this.currentElementExpression=null,i}var a=t.actualFunction.parent;return a?(this.currentThisExpression=null,this.currentElementExpression=null,a):(n==s.REPORT&&this.error(c.DiagnosticCode._this_cannot_be_referenced_in_current_location,e.range),null)},t.prototype.resolveSuperExpression=function(e,t,r,n){if(void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT),t.is(4096)){var i=t.lookupLocal(_.CommonSymbols.super_);if(i)return this.currentThisExpression=null,this.currentElementExpression=null,i}var a=t.actualFunction.parent;return a&&a.kind==l.ElementKind.CLASS&&(a=a.base)?(this.currentThisExpression=null,this.currentElementExpression=null,a):(n==s.REPORT&&this.error(c.DiagnosticCode._super_can_only_be_referenced_in_a_derived_class,e.range),null)},t.prototype.resolveLiteralExpression=function(e,t,r,n){switch(void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT),e.literalKind){case p.LiteralKind.INTEGER:this.currentThisExpression=e,this.currentElementExpression=null;var i=this.determineIntegerLiteralType(e.value,r);return(a=this.program.typeClasses).has(i.kind)?a.get(i.kind):null;case p.LiteralKind.FLOAT:this.currentThisExpression=e,this.currentElementExpression=null;var a;i=r==u.Type.f32?u.Type.f32:u.Type.f64;return(a=this.program.typeClasses).has(i.kind)?a.get(i.kind):null;case p.LiteralKind.STRING:return this.currentThisExpression=e,this.currentElementExpression=null,this.program.stringInstance}return n==s.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveCallExpression=function(e,t,r,n){void 0===r&&(r=u.Type.void),void 0===n&&(n=s.REPORT);var i=e.expression,a=this.resolveExpression(i,t,r,n);if(!a)return null;if(a.kind==l.ElementKind.FUNCTION_PROTOTYPE){var o=this.resolveFunctionInclTypeArguments(a,e.typeArguments,t.actualFunction,h.makeMap(t.contextualTypeArguments),e,n);if(!o)return null;var p=o.signature.returnType,_=p.classReference;if(_)return _;var d=p.signatureReference;return d?d.asFunctionTarget(this.program):(n==s.REPORT&&this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,i.range,a.internalName),null)}return n==s.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveFunction=function(e,t,r,n){void 0===r&&(r=h.makeMap()),void 0===n&&(n=s.REPORT);var i=e.parent.kind==l.ElementKind.PROPERTY_PROTOTYPE?e.parent.parent:e.parent,a=null,o=t?u.typesToString(t):"";if(e.is(_.CommonFlags.INSTANCE)){if(assert(i.kind==l.ElementKind.CLASS),a=i,T=e.getResolvedInstance(o))return T;var c=a.typeArguments;if(c){var d=assert(a.prototype.typeParameterNodes),y=d.length;assert(y==d.length);for(var m=0;m<y;++m){var g=d[m].name.text;r.has(g)||r.set(g,c[m])}}}else{var T;if(assert(i.kind!=l.ElementKind.CLASS),T=e.getResolvedInstance(o))return T}var f,E=e.signatureNode,I=e.typeParameterNodes;if(t&&(f=t.length)){assert(I&&f==I.length);for(m=0;m<f;++m)r.set(I[m].name.text,t[m])}else assert(!I||0==I.length);var v=null,b=E.explicitThisType;if(b){if(!(v=this.resolveType(b,e.parent,r,n)))return null;r.set(_.CommonSymbols.this_,v)}else a&&(v=a.type,r.set(_.CommonSymbols.this_,v));var S,A=E.parameters,N=A.length,C=new Array(N),O=new Array(N),x=0;for(m=0;m<N;++m){var k=A[m];k.parameterKind==p.ParameterKind.DEFAULT&&(x=m+1);var L=assert(k.type),R=this.resolveType(L,e.parent,r,n);if(!R)return null;C[m]=R,O[m]=k.name.text}if(e.is(_.CommonFlags.SET))S=u.Type.void;else if(e.is(_.CommonFlags.CONSTRUCTOR))S=assert(a).type;else{L=assert(E.returnType);var F=this.resolveType(L,e.parent,r,n);if(!F)return null;S=F}var B=new u.Signature(C,S,v);B.parameterNames=O,B.requiredParameters=x;var D=e.name;o.length&&(D+="<"+o+">");var U=new l.Function(D,e,B,r);return e.setResolvedInstance(o,U),U},t.prototype.resolveFunctionInclTypeArguments=function(e,t,r,n,i,a){void 0===a&&(a=s.REPORT);var o=e.parent.kind==l.ElementKind.PROPERTY_PROTOTYPE?e.parent.parent:e.parent,p=null;if(e.is(_.CommonFlags.GENERIC)){if(e.is(_.CommonFlags.INSTANCE)){assert(o.kind==l.ElementKind.CLASS);var u=o.typeArguments;if(u){var h=assert(o.prototype.typeParameterNodes),d=u.length;assert(d==h.length);for(var y=0;y<d;++y)n.set(h[y].name.text,u[y])}}if(!(p=this.resolveTypeArguments(assert(e.typeParameterNodes),t,r,n,i,a)))return null}else if(null!==t&&t.length)return a==s.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,i.range,e.internalName),null;return this.resolveFunction(e,p,n,a)},t.prototype.resolveClass=function(e,t,r,n){var i,p,d,y,m,g;void 0===r&&(r=h.makeMap()),void 0===n&&(n=s.REPORT);var T=t?u.typesToString(t):"",f=e.getResolvedInstance(T);if(f)return f;if(t){var E=(b=assert(e.typeParameterNodes)).length,I=t.length;assert(I==E);for(var v=0;v<I;++v)r.set(b[v].name.text,t[v])}else{var b=e.typeParameterNodes;assert(!(b&&b.length))}var S=e.basePrototype,A=null;if(S){var N=assert(e.extendsNode);if(!(A=this.resolveClassInclTypeArguments(S,N.typeArguments,e.parent,h.makeMap(r),N,n)))return null}var C=e.name;T.length&&(C+="<"+T+">"),(f=new l.Class(C,e,t,A)).contextualTypeArguments=r,e.setResolvedInstance(T,f);var O=0;if(A){if(V=A.members){(w=f.members)||(f.members=w=new Map);try{for(var x=a(V),k=x.next();!k.done;k=x.next()){var L=o(k.value,2),R=L[0],F=L[1];w.set(R,F)}}catch(e){i={error:e}}finally{try{k&&!k.done&&(p=x.return)&&p.call(x)}finally{if(i)throw i.error}}}O=A.currentMemoryOffset}var B=e.instanceMembers;if(B)try{for(var D=a(B.values()),U=D.next();!U.done;U=D.next()){var P=U.value;switch(P.kind){case l.ElementKind.FIELD_PROTOTYPE:var w;if(w=f.members){if(w.has(P.name)){this.error(c.DiagnosticCode.Duplicate_identifier_0,P.identifierNode.range,P.name);break}}else f.members=w=new Map;var M=P.typeNode,G=null;if(M)G=this.resolveType(M,e.parent,f.contextualTypeArguments,n);else{var V;if(A)if((V=A.members)&&V.has(P.name)){var K=V.get(P.name);K.is(_.CommonFlags.PRIVATE)||(assert(K.kind==l.ElementKind.FIELD),G=K.type)}G||n==s.REPORT&&this.error(c.DiagnosticCode.Type_expected,P.identifierNode.range.atEnd)}if(!G)break;var z=new l.Field(P,f,G);switch(G.byteSize){case 1:break;case 2:1&O&&++O;break;case 4:3&O&&(O=1+(3|O));break;case 8:7&O&&(O=1+(7|O));break;default:assert(!1)}z.memoryOffset=O,O+=G.byteSize,f.add(P.name,z);break;case l.ElementKind.FUNCTION_PROTOTYPE:var H=P.toBound(f);f.add(H.name,H);break;case l.ElementKind.PROPERTY_PROTOTYPE:var Y=new l.Property(P,f),W=P.getterPrototype;if(W){var X=this.resolveFunction(W.toBound(f),null,h.makeMap(f.contextualTypeArguments),n);X&&(Y.getterInstance=X,Y.setType(X.signature.returnType))}var Q=P.setterPrototype;if(Q){var q=this.resolveFunction(Q.toBound(f),null,h.makeMap(f.contextualTypeArguments),n);q&&(Y.setterInstance=q,Y.is(_.CommonFlags.RESOLVED)||(assert(1==q.signature.parameterTypes.length),Y.setType(q.signature.parameterTypes[0])))}f.add(Y.name,Y);break;default:assert(!1)}}}catch(e){d={error:e}}finally{try{U&&!U.done&&(y=D.return)&&y.call(D)}finally{if(d)throw d.error}}f.currentMemoryOffset=O;var j=f.lookupInSelf(_.CommonSymbols.constructor);if(j&&j.parent===f){assert(j.kind==l.ElementKind.FUNCTION_PROTOTYPE);var Z=this.resolveFunction(j,null,f.contextualTypeArguments,n);Z&&(f.constructorInstance=Z)}try{for(var J=a(e.overloadPrototypes),$=J.next();!$.done;$=J.next()){var ee=o($.value,2),te=ee[0],re=ee[1];assert(te!=l.OperatorKind.INVALID);var ne=void 0;if(re.is(_.CommonFlags.INSTANCE)){H=re.toBound(f);ne=this.resolveFunction(H,null,h.makeMap(),n)}else ne=this.resolveFunction(re,null,h.makeMap(),n);if(ne){var ie=f.overloads;ie||(f.overloads=ie=new Map),ie.set(te,ne)}}}catch(e){m={error:e}}finally{try{$&&!$.done&&(g=J.return)&&g.call(J)}finally{if(m)throw m.error}}return f},t.prototype.resolveClassInclTypeArguments=function(e,t,r,n,i,a){void 0===a&&(a=s.REPORT);var o=null;if(e.is(_.CommonFlags.GENERIC)){if(!(o=this.resolveTypeArguments(assert(e.typeParameterNodes),t,r,n,i,a)))return null}else if(null!==t&&t.length)return a==s.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,i.range,e.internalName),null;return this.resolveClass(e,o,n,a)},t}(c.DiagnosticEmitter);t.Resolver=y},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0});var s,c=r(24),l=r(1),p=r(4),u=r(0),_=r(3),h=r(12),d=r(9),y=r(7),m=r(5),g=r(6),T=r(2);!function(e){e[e.WASM32=0]="WASM32",e[e.WASM64=1]="WASM64"}(s=t.Target||(t.Target={}));var f=function(){function e(){this.target=s.WASM32,this.noAssert=!1,this.importMemory=!1,this.sharedMemory=0,this.importTable=!1,this.sourceMap=!1,this.memoryBase=0,this.globalAliases=null,this.features=0,this.optimizeLevelHint=0,this.shrinkLevelHint=0}return Object.defineProperty(e.prototype,"isWasm64",{get:function(){return this.target==s.WASM64},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usizeType",{get:function(){return this.target==s.WASM64?g.Type.usize64:g.Type.usize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isizeType",{get:function(){return this.target==s.WASM64?g.Type.isize64:g.Type.isize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nativeSizeType",{get:function(){return this.target==s.WASM64?p.NativeType.I64:p.NativeType.I32},enumerable:!0,configurable:!0}),e.prototype.hasFeature=function(e){return 0!=(this.features&e)},e}();t.Options=f,function(e){e[e.NONE=0]="NONE",e[e.SIGN_EXTENSION=1]="SIGN_EXTENSION",e[e.MUTABLE_GLOBAL=2]="MUTABLE_GLOBAL",e[e.BULK_MEMORY=4]="BULK_MEMORY",e[e.SIMD=8]="SIMD",e[e.THREADS=16]="THREADS"}(t.Feature||(t.Feature={})),function(e){e[e.NONE=0]="NONE",e[e.IMPLICIT=1]="IMPLICIT",e[e.EXPLICIT=2]="EXPLICIT"}(t.ConversionKind||(t.ConversionKind={})),function(e){e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP"}(t.WrapMode||(t.WrapMode={}));var E,I,v,b=function(e){function t(t,r){void 0===r&&(r=null);var n=e.call(this,t.diagnostics)||this;return n.currentInlineFunctions=[],n.currentEnum=null,n.currentType=g.Type.void,n.memorySegments=[],n.stringSegments=new Map,n.functionTable=["null"],n.argcVar=0,n.argcSet=0,n.needsIterateRoots=!1,n.f32ModInstance=null,n.f64ModInstance=null,n.f32PowInstance=null,n.f64PowInstance=null,n.program=t,n.resolver=t.resolver,r||(r=new f),n.options=r,n.memoryOffset=i64_new(max(r.memoryBase,8)),n.module=p.Module.create(),n}return i(t,e),t.compile=function(e,r){return void 0===r&&(r=null),new t(e,r).compile()},t.prototype.compile=function(){var e,t,r,n,i=this.options,o=this.module,s=this.program;s.initialize(i);var l=s.makeNativeFunction("start",new g.Signature([],g.Type.void));l.internalName="start";var u=new Array;this.currentFlow=l.flow,this.currentBody=u,i.isWasm64?o.addGlobal(c.BuiltinSymbols.HEAP_BASE,p.NativeType.I64,!0,o.createI64(0,0)):o.addGlobal(c.BuiltinSymbols.HEAP_BASE,p.NativeType.I32,!1,o.createI32(0));var _=s.filesByName;try{for(var h=a(_.values()),d=h.next();!d.done;d=h.next()){(S=d.value).source.isEntry&&(this.compileFile(S),this.compileExports(S))}}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}var y=s.explicitStartFunction;if(u.length||y){var m=l.signature,T=o.addFunction(l.internalName,this.ensureFunctionType(m.parameterTypes,m.returnType,m.thisType),g.typesToNativeTypes(l.additionalLocals),o.createBlock(null,u));l.finalize(o,T),y||o.setStart(T)}var f=this.memoryOffset;f=i64_align(f,i.usizeType.byteSize),this.memoryOffset=f,o.removeGlobal(c.BuiltinSymbols.HEAP_BASE),i.isWasm64?o.addGlobal(c.BuiltinSymbols.HEAP_BASE,p.NativeType.I64,!1,o.createI64(i64_low(f),i64_high(f))):o.addGlobal(c.BuiltinSymbols.HEAP_BASE,p.NativeType.I32,!1,o.createI32(i64_low(f)));var E=i.hasFeature(16)&&i.sharedMemory>0;o.setMemory(this.options.memoryBase||this.memorySegments.length?i64_low(i64_shr_u(i64_align(f,65536),i64_new(16,0))):0,E?i.sharedMemory:p.Module.UNLIMITED_MEMORY,this.memorySegments,i.target,"memory"),i.importMemory&&o.addMemoryImport("0","env","memory",E);var I=this.functionTable;o.setFunctionTable(I.length,4294967295,I),o.addTableExport("0","table"),o.addFunction("null",this.ensureFunctionType(null,g.Type.void),null,o.createBlock(null,[])),i.importTable&&o.addTableImport("0","env","table");try{for(var v=a(this.program.filesByName.values()),b=v.next();!b.done;b=v.next()){var S;(S=b.value).source.isEntry&&this.makeModuleExports(S)}}catch(e){r={error:e}}finally{try{b&&!b.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}return this.needsIterateRoots&&c.compileIterateRoots(this),o},t.prototype.makeModuleExports=function(e){var t,r,n=e.exports;if(n)try{for(var i=a(n),s=i.next();!s.done;s=i.next()){var c=o(s.value,2),l=c[0],p=c[1];this.makeModuleExport(l,p)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}var u=e.exportsStar;if(u)for(var _=0,h=u.length;_<h;++_)this.makeModuleExports(u[_])},t.prototype.makeModuleExport=function(e,t,r){var n,i,o,s,c,p,h,d;switch(void 0===r&&(r=""),t.kind){case _.ElementKind.FUNCTION_PROTOTYPE:if(E=t.instances)try{for(var y=a(E.values()),m=y.next();!m.done;m=y.next()){var T=m.value,f=e;if(T.is(u.CommonFlags.GENERIC))f+=(b=T.internalName).substring(b.lastIndexOf("<"));this.makeModuleExport(f,T,r)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(i=y.return)&&i.call(y)}finally{if(n)throw n.error}}break;case _.ElementKind.CLASS_PROTOTYPE:var E;if(E=t.instances)try{for(var I=a(E.values()),v=I.next();!v.done;v=I.next()){var b;T=v.value,f=e;if(T.is(u.CommonFlags.GENERIC))f+=(b=T.internalName).substring(b.lastIndexOf("<"));this.makeModuleExport(f,T,r)}}catch(e){o={error:e}}finally{try{v&&!v.done&&(s=I.return)&&s.call(I)}finally{if(o)throw o.error}}break;case _.ElementKind.PROPERTY_PROTOTYPE:var S=t.getterPrototype,A=t.setterPrototype;S&&this.makeModuleExport(u.GETTER_PREFIX+e,S,r),A&&this.makeModuleExport(u.SETTER_PREFIX+e,A,r);break;case _.ElementKind.GLOBAL:t.is(u.CommonFlags.CONST)||t.is(u.CommonFlags.STATIC|u.CommonFlags.READONLY)||this.options.hasFeature(2)?this.module.addGlobalExport(t.internalName,r+e):this.error(l.DiagnosticCode.Cannot_export_a_mutable_global,t.identifierNode.range);break;case _.ElementKind.ENUMVALUE:assert(t.parent).is(u.CommonFlags.CONST)||this.options.hasFeature(2)?this.module.addGlobalExport(t.internalName,r+e):this.error(l.DiagnosticCode.Cannot_export_a_mutable_global,t.identifierNode.range);break;case _.ElementKind.FUNCTION:var N=(T=t).signature;N.requiredParameters<N.parameterTypes.length&&(T=this.ensureTrampoline(T),this.ensureArgcSet()),T.is(u.CommonFlags.COMPILED)&&this.module.addFunctionExport(T.internalName,r+e);break;case _.ElementKind.PROPERTY:(S=t.getterInstance)&&this.makeModuleExport(u.GETTER_PREFIX+e,S,r),(A=t.setterInstance)&&this.makeModuleExport(u.SETTER_PREFIX+e,A,r);break;case _.ElementKind.FIELD:var C=this.module,O=t.type,x=O.toNativeType(),k=t.memoryOffset,L=this.options.usizeType,R=this.options.nativeSizeType,F=r+u.GETTER_PREFIX+e;if(C.addFunction(F,this.ensureFunctionType(null,O,L),null,C.createLoad(O.byteSize,O.is(1),C.createGetLocal(0,R),x,k)),C.addFunctionExport(F,F),!t.is(u.CommonFlags.READONLY)){var B=r+u.SETTER_PREFIX+e;C.addFunction(B,this.ensureFunctionType([O],g.Type.void,L),null,C.createStore(O.byteSize,C.createGetLocal(0,R),C.createGetLocal(1,x),x,k)),C.addFunctionExport(B,B)}break;case _.ElementKind.ENUM:case _.ElementKind.CLASS:case _.ElementKind.NAMESPACE:case _.ElementKind.FILE:case _.ElementKind.TYPEDEFINITION:break;default:assert(!1)}var D=t.members;if(D){var U=r+e+(t.kind==_.ElementKind.CLASS?u.INSTANCE_DELIMITER:u.STATIC_DELIMITER);if(t.kind==_.ElementKind.NAMESPACE||t.kind==_.ElementKind.FILE)try{for(var P=a(D.values()),w=P.next();!w.done;w=P.next()){(V=w.value).is(u.CommonFlags.EXPORT)&&this.makeModuleExport(V.name,V,U)}}catch(e){c={error:e}}finally{try{w&&!w.done&&(p=P.return)&&p.call(P)}finally{if(c)throw c.error}}else try{for(var M=a(D.values()),G=M.next();!G.done;G=M.next()){var V;(V=G.value).is(u.CommonFlags.PRIVATE)||this.makeModuleExport(V.name,V,U)}}catch(e){h={error:e}}finally{try{G&&!G.done&&(d=M.return)&&d.call(M)}finally{if(h)throw h.error}}}},t.prototype.compileElement=function(e,t){switch(void 0===t&&(t=!0),e.kind){case _.ElementKind.GLOBAL:this.compileGlobal(e);break;case _.ElementKind.ENUM:this.compileEnum(e);break;case _.ElementKind.FUNCTION_PROTOTYPE:e.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(e,[]);break;case _.ElementKind.CLASS_PROTOTYPE:e.is(u.CommonFlags.GENERIC)||this.compileClassUsingTypeArguments(e,[]);break;case _.ElementKind.PROPERTY_PROTOTYPE:var r=e.getterPrototype;r&&this.compileFunctionUsingTypeArguments(r,[]);var n=e.setterPrototype;n&&this.compileFunctionUsingTypeArguments(n,[]);break;case _.ElementKind.NAMESPACE:case _.ElementKind.TYPEDEFINITION:case _.ElementKind.ENUMVALUE:break;default:assert(!1,_.ElementKind[e.kind])}t&&this.compileMembers(e)},t.prototype.compileMembers=function(e){var t,r,n=e.members;if(n)try{for(var i=a(n.values()),o=i.next();!o.done;o=i.next()){var s=o.value;this.compileElement(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.compileExports=function(e){var t,r,n,i,o=e.exports;if(o)try{for(var s=a(o.values()),c=s.next();!c.done;c=s.next()){var l=c.value;this.compileElement(l)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}var p=e.exportsStar;if(p)try{for(var u=a(p),_=u.next();!_.done;_=u.next()){var h=_.value;this.compileFile(h)}}catch(e){n={error:e}}finally{try{_&&!_.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}},t.prototype.compileFileByPath=function(e,t){var r,n,i=this.program.filesByName;if(i.has(e))r=i.get(e);else{if(!i.has(n=e+u.INDEX_SUFFIX))return void this.error(l.DiagnosticCode.File_0_not_found,t.range,e);r=i.get(n)}this.compileFile(r)},t.prototype.compileFile=function(e){if(!e.is(u.CommonFlags.COMPILED)){e.set(u.CommonFlags.COMPILED);var t=e.startFunction,r=this.currentBody,n=new Array;this.currentBody=n;var i=this.currentFlow;this.currentFlow=t.flow;for(var a=e.source.statements,o=0,s=a.length;o<s;++o)this.compileTopLevelStatement(a[o],n);if(this.currentFlow=i,this.currentBody=r,n.length){var c=this.module,l=t.localsByIndex,_=l.length,h=new Array(_);for(o=0;o<_;++o)h[o]=l[o].type.toNativeType();c.addFunction(t.internalName,this.ensureFunctionType(t.signature.parameterTypes,t.signature.returnType),h,n.length>1?c.createBlock(null,n):n[0]),r.push(c.createCall(t.internalName,null,p.NativeType.None))}}},t.prototype.compileGlobal=function(e){if(e.is(u.CommonFlags.COMPILED))return!0;e.set(u.CommonFlags.COMPILED);var t=this.module,r=0,n=e.typeNode,i=e.initializerNode;if(!e.is(u.CommonFlags.RESOLVED))if(n){var a=this.resolver.resolveType(n,e.parent);if(!a)return!1;if(a==g.Type.void)return this.error(l.DiagnosticCode.Type_expected,n.range),!1;e.setType(a)}else{if(!i)return this.error(l.DiagnosticCode.Type_expected,e.identifierNode.range.atEnd),!1;var o=this.currentFlow;if(e.hasDecorator(_.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow),r=this.compileExpressionRetainType(i,g.Type.void,1),this.currentFlow=o,this.currentType==g.Type.void)return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,i.range,this.currentType.toString(),"<auto>"),!1;e.setType(this.currentType)}if(e.is(u.CommonFlags.AMBIENT)&&e.hasDecorator(_.DecoratorFlags.BUILTIN))return!0;var s=e.type.toNativeType(),c=e.is(u.CommonFlags.CONST)||e.is(u.CommonFlags.STATIC|u.CommonFlags.READONLY);if(e.is(u.CommonFlags.AMBIENT))return c||this.options.hasFeature(2)?(e.set(u.CommonFlags.MODULE_IMPORT),S(e,e.declaration),t.addGlobalImport(e.internalName,E,I,s),e.set(u.CommonFlags.COMPILED),!0):(this.error(l.DiagnosticCode.Operation_not_supported,e.declaration.range),!1);var h=!1;if(i){if(!r){o=this.currentFlow;e.hasDecorator(_.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow),r=this.compileExpression(i,e.type,1,1),this.currentFlow=o}if(p.getExpressionId(r)!=p.ExpressionId.Const&&(c?(r=t.precomputeExpression(r),p.getExpressionId(r)!=p.ExpressionId.Const&&(this.warning(l.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,i.range),h=!0)):h=!0),e.hasDecorator(_.DecoratorFlags.INLINE)&&!h){switch(assert(p.getExpressionId(r)==p.ExpressionId.Const),p.getExpressionType(r)){case p.NativeType.I32:e.constantValueKind=1,e.constantIntegerValue=i64_new(p.getConstValueI32(r),0);break;case p.NativeType.I64:e.constantValueKind=1,e.constantIntegerValue=i64_new(p.getConstValueI64Low(r),p.getConstValueI64High(r));break;case p.NativeType.F32:e.constantValueKind=2,e.constantFloatValue=p.getConstValueF32(r);break;case p.NativeType.F64:e.constantValueKind=2,e.constantFloatValue=p.getConstValueF64(r);break;default:return assert(!1),!1}e.set(u.CommonFlags.INLINED)}}else r=e.type.toNativeZero(t);var d=e.internalName;return h?(e.hasDecorator(_.DecoratorFlags.INLINE)&&this.error(l.DiagnosticCode.Decorator_0_is_not_valid_here,e.identifierNode.range,"inline"),t.addGlobal(d,s,!0,e.type.toNativeZero(t)),this.currentBody.push(t.createSetGlobal(d,r))):e.hasDecorator(_.DecoratorFlags.INLINE)||t.addGlobal(d,s,!c,r),!0},t.prototype.compileEnum=function(e){var t,r;if(e.is(u.CommonFlags.COMPILED))return!0;e.set(u.CommonFlags.COMPILED);var n=this.module;this.currentEnum=e;var i=null,o=!1,s=e.is(u.CommonFlags.CONST)||e.hasDecorator(_.DecoratorFlags.INLINE);if(e.members)try{for(var c=a(e.members.values()),h=c.next();!h.done;h=c.next()){var d=h.value;if(d.kind==_.ElementKind.ENUMVALUE){var y=!1,m=d,T=m.valueNode;m.set(u.CommonFlags.COMPILED);var f=this.currentFlow;e.hasDecorator(_.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow);var E=void 0;T?(E=this.compileExpression(T,g.Type.i32,1,0),p.getExpressionId(E)!=p.ExpressionId.Const&&(e.is(u.CommonFlags.CONST)?(E=n.precomputeExpression(E),p.getExpressionId(E)!=p.ExpressionId.Const&&(this.error(l.DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression,T.range),y=!0)):y=!0)):null==i?E=n.createI32(0):(o&&this.error(l.DiagnosticCode.Enum_member_must_have_initializer,d.identifierNode.range.atEnd),E=n.createBinary(p.BinaryOp.AddI32,n.createGetGlobal(i.internalName,p.NativeType.I32),n.createI32(1)),E=n.precomputeExpression(E),p.getExpressionId(E)!=p.ExpressionId.Const&&(e.is(u.CommonFlags.CONST)&&this.error(l.DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression,d.declaration.range),y=!0)),this.currentFlow=f,y?(n.addGlobal(m.internalName,p.NativeType.I32,!0,n.createI32(0)),this.currentBody.push(n.createSetGlobal(m.internalName,E)),o=!0):(s?(m.setConstantIntegerValue(i64_new(p.getConstValueI32(E)),g.Type.i32),m.is(u.CommonFlags.MODULE_EXPORT)&&n.addGlobal(m.internalName,p.NativeType.I32,!1,E)):n.addGlobal(m.internalName,p.NativeType.I32,!0,E),o=!1),i=m}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return this.currentEnum=null,!0},t.prototype.compileFunctionUsingTypeArguments=function(e,t,r,n){if(void 0===r&&(r=T.makeMap()),void 0===n&&(n=null),e.hasDecorator(_.DecoratorFlags.BUILTIN))return null;var i=this.resolver.resolveFunctionInclTypeArguments(e,t,e.parent,r,n||e.declaration);return i&&this.compileFunction(i)?i:null},t.prototype.ensureFunctionType=function(e,t,r){void 0===r&&(r=null);var n,i=e?e.length:0,a=0;if(r?((n=new Array(1+i))[0]=r.toNativeType(),a=1):n=new Array(i),e)for(var o=0;o<i;++o,++a)n[a]=e[o].toNativeType();var s=t.toNativeType(),c=this.module,l=c.getFunctionTypeBySignature(s,n);if(!l){var p=g.Signature.makeSignatureString(e,t,r);l=c.addFunctionType(p,s,n)}return l},t.prototype.compileFunctionBody=function(e){var t,r=this.module,n=assert(e.prototype.bodyNode),i=e.signature.returnType,a=this.currentFlow;if(n.kind==m.NodeKind.BLOCK)t=this.compileStatements(n.statements,!0);else{assert(n.kind==m.NodeKind.EXPRESSION),assert(e.is(u.CommonFlags.ARROW)),assert(!e.isAny(u.CommonFlags.CONSTRUCTOR|u.CommonFlags.GET|u.CommonFlags.SET|u.CommonFlags.MAIN));var o=this.compileExpression(n.expression,i,1,0);a.set(1),a.canOverflow(o,i)||a.set(2),t=[o]}if(e.prototype==this.program.explicitStartFunction&&(r.addGlobal(v.started,p.NativeType.I32,!0,r.createI32(0)),t.unshift(r.createIf(r.createUnary(p.UnaryOp.EqzI32,r.createGetGlobal(v.started,p.NativeType.I32)),r.createBlock(null,[r.createCall("start",null,p.NativeType.None),r.createSetGlobal(v.started,r.createI32(1))])))),e.is(u.CommonFlags.CONSTRUCTOR)){var s=this.options.nativeSizeType;assert(e.is(u.CommonFlags.INSTANCE));var c=assert(e.parent);if(assert(c.kind==_.ElementKind.CLASS),!a.isAny(29)){var h=a.is(4096)?assert(a.lookupLocal(u.CommonSymbols.this_)).index:0;a.is(32)||(t.push(r.createIf(r.createUnary(s==p.NativeType.I64?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,r.createGetLocal(h,s)),r.createSetLocal(h,this.makeAllocation(c)))),this.makeFieldInitialization(c,t)),t.push(r.createGetLocal(h,s))}c.base&&!a.is(64)&&this.error(l.DiagnosticCode.Constructors_for_derived_classes_must_contain_a_super_call,e.prototype.declaration.range)}else i==g.Type.void||a.is(1)||this.error(l.DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value,e.prototype.signatureNode.returnType.range);return t},t.prototype.compileFunction=function(e){if(e.is(u.CommonFlags.COMPILED))return!0;assert(!(e.is(u.CommonFlags.AMBIENT)&&e.hasDecorator(_.DecoratorFlags.BUILTIN))),e.set(u.CommonFlags.COMPILED);var t,r=this.module,n=e.signature,i=e.prototype.bodyNode,a=this.ensureFunctionType(n.parameterTypes,n.returnType,n.thisType);if(i){if(e.is(u.CommonFlags.AMBIENT)&&this.error(l.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.identifierNode.range),e.hasDecorator(_.DecoratorFlags.EXTERNAL)){var o=e.decoratorNodes,s=assert(m.findDecorator(m.DecoratorKind.EXTERNAL,o));this.error(l.DiagnosticCode.Operation_not_supported,s.range)}var c=this.currentFlow;this.currentFlow=e.flow;var p=this.compileFunctionBody(e);this.currentFlow=c,t=r.addFunction(e.internalName,a,g.typesToNativeTypes(e.additionalLocals),p.length?1==p.length?p[0]:r.createBlock(null,p,e.signature.returnType.toNativeType()):r.createNop())}else e.is(u.CommonFlags.AMBIENT)||this.error(l.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.identifierNode.range),e.set(u.CommonFlags.MODULE_IMPORT),S(e,e.declaration),t=r.addFunctionImport(e.internalName,E,I,a);return e.finalize(r,t),!0},t.prototype.compileClassUsingTypeArguments=function(e,t,r,n){void 0===r&&(r=T.makeMap()),void 0===n&&(n=null);var i=this.resolver.resolveClassInclTypeArguments(e,t,e.parent,r,n||e.declaration);i&&this.compileClass(i)},t.prototype.compileClass=function(e){var t,r,n,i;if(e.is(u.CommonFlags.COMPILED))return!0;e.set(u.CommonFlags.COMPILED);var o=e.prototype.members;if(o)try{for(var s=a(o.values()),c=s.next();!c.done;c=s.next()){switch((y=c.value).kind){case _.ElementKind.GLOBAL:this.compileGlobal(y);break;case _.ElementKind.FUNCTION_PROTOTYPE:y.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(y,[],T.makeMap(),y.identifierNode);break;case _.ElementKind.PROPERTY_PROTOTYPE:(m=y.getterPrototype)&&this.compileFunctionUsingTypeArguments(m,[],T.makeMap(),m.identifierNode),(g=y.setterPrototype)&&this.compileFunctionUsingTypeArguments(g,[],T.makeMap(),g.identifierNode);break;case _.ElementKind.PROPERTY:}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}var l=e.constructorInstance;l&&this.compileFunction(l);var p=e.members;if(p)try{for(var h=a(p.values()),d=h.next();!d.done;d=h.next()){var y;switch((y=d.value).kind){case _.ElementKind.FUNCTION_PROTOTYPE:y.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(y,[],T.makeMap(e.contextualTypeArguments),y.declaration.name);break;case _.ElementKind.FIELD_PROTOTYPE:y.set(u.CommonFlags.COMPILED);break;case _.ElementKind.PROPERTY:var m,g;(m=y.getterInstance)&&this.compileFunction(m),(g=y.setterInstance)&&this.compileFunction(g)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return!0},t.prototype.compileInterfaceDeclaration=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=null),this.error(l.DiagnosticCode.Operation_not_supported,e.range)},t.prototype.addMemorySegment=function(e,t){void 0===t&&(t=8);var r=i64_align(this.memoryOffset,t),n=p.MemorySegment.create(e,r);return this.memorySegments.push(n),this.memoryOffset=i64_add(r,i64_new(e.length,0)),n},t.prototype.ensureFunctionTableEntry=function(e){if(assert(e.is(u.CommonFlags.COMPILED)),e.functionTableIndex>=0)return e.functionTableIndex;var t=this.functionTable,r=t.length;return!e.is(u.CommonFlags.TRAMPOLINE)&&e.signature.requiredParameters<e.signature.parameterTypes.length&&(e=this.ensureTrampoline(e)),t.push(e.internalName),e.functionTableIndex=r,r},t.prototype.compileTopLevelStatement=function(e,t){switch(e.kind){case m.NodeKind.CLASSDECLARATION:for(var r=0,n=(a=e.members).length;r<n;++r)this.compileTopLevelStatement(a[r],t);break;case m.NodeKind.ENUMDECLARATION:var i=this.program.getElementByDeclaration(e);assert(i.kind==_.ElementKind.ENUM),i.hasDecorator(_.DecoratorFlags.LAZY)||this.compileEnum(i);break;case m.NodeKind.NAMESPACEDECLARATION:var a;for(r=0,n=(a=e.members).length;r<n;++r)this.compileTopLevelStatement(a[r],t);break;case m.NodeKind.VARIABLE:var o=e.declarations;for(r=0,n=o.length;r<n;++r){i=this.program.getElementByDeclaration(o[r]);assert(i.kind==_.ElementKind.GLOBAL),i.is(u.CommonFlags.AMBIENT)||i.hasDecorator(_.DecoratorFlags.LAZY)||this.compileGlobal(i)}break;case m.NodeKind.FIELDDECLARATION:(i=this.program.getElementByDeclaration(e)).kind==_.ElementKind.GLOBAL&&(i.hasDecorator(_.DecoratorFlags.LAZY)||this.compileGlobal(i));break;case m.NodeKind.EXPORT:null!=e.normalizedPath&&this.compileFileByPath(e.normalizedPath,e.path);break;case m.NodeKind.IMPORT:this.compileFileByPath(e.normalizedPath,e.path);break;case m.NodeKind.FUNCTIONDECLARATION:case m.NodeKind.METHODDECLARATION:case m.NodeKind.INTERFACEDECLARATION:case m.NodeKind.INDEXSIGNATUREDECLARATION:case m.NodeKind.TYPEDECLARATION:break;default:var s=this.compileStatement(e);p.getExpressionId(s)!=p.ExpressionId.Nop&&t.push(s)}},t.prototype.compileStatement=function(e,t){void 0===t&&(t=!1);var r,n=this.module;switch(e.kind){case m.NodeKind.BLOCK:r=this.compileBlockStatement(e);break;case m.NodeKind.BREAK:r=this.compileBreakStatement(e);break;case m.NodeKind.CONTINUE:r=this.compileContinueStatement(e);break;case m.NodeKind.DO:r=this.compileDoStatement(e);break;case m.NodeKind.EMPTY:r=this.compileEmptyStatement(e);break;case m.NodeKind.EXPRESSION:r=this.compileExpressionStatement(e);break;case m.NodeKind.FOR:r=this.compileForStatement(e);break;case m.NodeKind.IF:r=this.compileIfStatement(e);break;case m.NodeKind.RETURN:r=this.compileReturnStatement(e,t);break;case m.NodeKind.SWITCH:r=this.compileSwitchStatement(e);break;case m.NodeKind.THROW:r=this.compileThrowStatement(e);break;case m.NodeKind.TRY:r=this.compileTryStatement(e);break;case m.NodeKind.VARIABLE:(r=this.compileVariableStatement(e))||(r=n.createNop());break;case m.NodeKind.VOID:r=this.compileVoidStatement(e);break;case m.NodeKind.WHILE:r=this.compileWhileStatement(e);break;case m.NodeKind.TYPEDECLARATION:this.error(l.DiagnosticCode.Operation_not_supported,e.range),r=n.createUnreachable();break;default:assert(!1),r=n.createUnreachable()}return this.options.sourceMap&&this.addDebugLocation(r,e.range),r},t.prototype.compileStatements=function(e,t){void 0===t&&(t=!1);var r=e.length,n=new Array(r);n.length=0;for(var i=this.currentFlow,a=0;a<r;++a){var o=this.compileStatement(e[a],t&&a==r-1);switch(p.getExpressionId(o)){case p.ExpressionId.Block:if(!p.getBlockName(o)){for(var s=0,c=p.getBlockChildCount(o);s<c;++s)n.push(p.getBlockChild(o,s));break}default:n.push(o);case p.ExpressionId.Nop:}if(i.isAny(29)){p.needsExplicitUnreachable(o)&&n.push(this.module.createUnreachable());break}}return n},t.prototype.compileBlockStatement=function(e){var t=e.statements,r=this.currentFlow,n=r.fork();this.currentFlow=n;var i=this.compileStatements(t),a=0==i.length?this.module.createNop():1==i.length?i[0]:this.module.createBlock(null,i,p.getExpressionType(i[i.length-1]));return n.freeScopedLocals(),r.inherit(n),this.currentFlow=r,a},t.prototype.compileBreakStatement=function(e){var t=this.module;if(e.label)return this.error(l.DiagnosticCode.Operation_not_supported,e.label.range),t.createUnreachable();var r=this.currentFlow,n=r.breakLabel;return null==n?(this.error(l.DiagnosticCode.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement,e.range),t.createUnreachable()):(r.set(8),t.createBreak(n))},t.prototype.compileContinueStatement=function(e){var t=this.module,r=e.label;if(r)return this.error(l.DiagnosticCode.Operation_not_supported,r.range),t.createUnreachable();var n=this.currentFlow,i=n.continueLabel;return null==i?(this.error(l.DiagnosticCode.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement,e.range),t.createUnreachable()):(n.set(16),t.createBreak(i))},t.prototype.compileDoStatement=function(e){var t=this.module,r=this.currentFlow,n=r.pushBreakLabel(),i=r.fork();this.currentFlow=i;var a="break|"+n;i.breakLabel=a;var o="continue|"+n;i.continueLabel=o;var s=this.compileStatement(e.statement),c=this.makeIsTrueish(this.compileExpression(e.condition,g.Type.i32,0,0),this.currentType);i.freeScopedLocals(),r.popBreakLabel(),this.currentFlow=r;var l=i.isAny(29);i.unset(1560),r.inherit(i);var u=[t.createLoop(o,l?s:t.createBlock(null,[s,t.createBreak(o,c)],p.NativeType.None))];return l&&u.push(t.createUnreachable()),t.createBlock(a,u)},t.prototype.compileEmptyStatement=function(e){return this.module.createNop()},t.prototype.compileExpressionStatement=function(e){var t=this.compileExpression(e.expression,g.Type.void,0,0);return this.currentType!=g.Type.void&&(t=this.module.createDrop(t),this.currentType=g.Type.void),t},t.prototype.compileForStatement=function(e){var t=this.currentFlow,r=t.pushBreakLabel(),n=t.fork();this.currentFlow=n;var i=n.breakLabel="break|"+r;n.breakLabel=i;var a="continue|"+r;n.continueLabel=a;var o="repeat|"+r,s=this.module,c=e.initializer?this.compileStatement(e.initializer):0,l=0,u=!1;if(e.condition){l=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,g.Type.bool,0),this.currentType);var _=s.precomputeExpression(l);p.getExpressionId(_)==p.ExpressionId.Const&&(assert(p.getExpressionType(_)==p.NativeType.I32),0!=p.getConstValueI32(_)&&(u=!0)),l=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,g.Type.bool,0),this.currentType)}else l=s.createI32(1),u=!0;var h=e.incrementor?this.compileExpression(e.incrementor,g.Type.void,1,0):0,d=e.statement,y=d.kind==m.NodeKind.BLOCK&&1==d.statements.length?this.compileStatement(d.statements[0]):this.compileStatement(d);n.freeScopedLocals(),t.popBreakLabel(),this.currentFlow=t;var T=n.isAny(1040);n.unset(1560),u?t.inherit(n):t.inheritConditional(n);var f=new Array;c&&f.push(c);var E=new Array;return T?E.push(s.createBlock(a,[s.createBreak(i,s.createUnary(p.UnaryOp.EqzI32,l)),y],p.NativeType.None)):(E.push(s.createBreak(i,s.createUnary(p.UnaryOp.EqzI32,l))),E.push(y)),h&&E.push(h),E.push(s.createBreak(o)),f.push(s.createLoop(o,s.createBlock(null,E,p.NativeType.None))),s.createBlock(i,f)},t.prototype.compileIfStatement=function(e){var t=this.module,r=e.ifTrue,n=e.ifFalse,i=this.currentFlow,a=(i.actualFunction,this.makeIsTrueish(this.compileExpressionRetainType(e.condition,g.Type.bool,0),this.currentType)),o=t.precomputeExpression(a);if(p.getExpressionId(o)==p.ExpressionId.Const&&p.getExpressionType(o)==p.NativeType.I32)return p.getConstValueI32(o)?this.compileStatement(r):n?this.compileStatement(n):t.createNop();a=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,g.Type.bool,0),this.currentType);var s=i.fork();this.currentFlow=s;var c=this.compileStatement(r);s.freeScopedLocals(),this.currentFlow=i;var l=0;if(n){var u=i.fork();this.currentFlow=u,l=this.compileStatement(n),u.freeScopedLocals(),this.currentFlow=i,i.inheritMutual(s,u)}else i.inheritConditional(s);return t.createIf(a,c,l)},t.prototype.compileReturnStatement=function(e,t){var r=this.module,n=0,i=this.currentFlow,a=i.returnType;if(i.set(1),e.value){if(a==g.Type.void)return this.compileExpressionRetainType(e.value,a,0),this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.value.range,this.currentType.toString(),a.toString()),this.currentType=g.Type.void,r.createUnreachable();n=this.compileExpression(e.value,a,1,i.actualFunction.is(u.CommonFlags.MODULE_EXPORT)?1:0),i.canOverflow(n,a)||i.set(2)}else a!=g.Type.void&&(this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,"void",a.toString()),n=r.createUnreachable());return t?n||r.createNop():i.is(4096)?r.createBreak(assert(i.inlineReturnLabel),0,n):r.createReturn(n)},t.prototype.compileSwitchStatement=function(e){var t=this.module,r=e.cases,n=r.length;if(!n)return this.compileExpression(e.condition,g.Type.void,1,0);var i=this.currentFlow,a=i.pushBreakLabel(),o=i.getTempLocal(g.Type.u32,!1),s=o.index,c=new Array(1+n);c[0]=t.createSetLocal(s,this.compileExpression(e.condition,g.Type.u32,1,0));for(var l=1,u=-1,_=0;_<n;++_){var h=r[_].label;h?c[l++]=t.createBreak("case"+_.toString(10)+"|"+a,t.createBinary(p.BinaryOp.EqI32,t.createGetLocal(s,p.NativeType.I32),this.compileExpression(h,g.Type.u32,1,0))):u=_}i.freeTempLocal(o),c[l]=t.createBreak((u>=0?"case"+u.toString(10):"break")+"|"+a);var d=t.createBlock("case0|"+a,c,p.NativeType.None),y=!0,m=!0,T=!0,f=!0;for(_=0;_<n;++_){var E=r[_].statements,I=E.length,v=i.fork();this.currentFlow=v;var b="break|"+a;v.breakLabel=b;var S=_==n-1,A=S?b:"case"+(_+1).toString(10)+"|"+a,N=new Array(1+I);N[0]=d;for(var C=1,O=!1,x=0;x<I;++x){var k=this.compileStatement(E[x]);if(p.getExpressionId(k)!=p.ExpressionId.Nop&&(N[C++]=k,v.isAny(29))){O=!0;break}}N.length=C,(O||S)&&(v.is(1)||(y=!1),v.is(2)||(m=!1),v.is(4)||(T=!1),v.is(32)||(f=!1)),v.unset(520),v.freeScopedLocals(),this.currentFlow=i,d=t.createBlock(A,N,p.NativeType.None)}return i.popBreakLabel(),u>=0&&(y&&i.set(1),m&&i.set(2),T&&i.set(4),f&&i.set(32)),d},t.prototype.compileThrowStatement=function(e){var t=this.currentFlow;return t.set(4),t.set(1),c.compileAbort(this,null,e)},t.prototype.compileTryStatement=function(e){return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},t.prototype.compileVariableStatement=function(e){for(var t=e.declarations,r=t.length,n=this.currentFlow,i=new Array,a=this.resolver,o=0;o<r;++o){var s=t[o],c=s.name.text,h=null,d=0;if(s.type){if(!(h=a.resolveType(s.type,n.actualFunction,n.contextualTypeArguments)))continue;s.initializer&&(d=this.compileExpression(s.initializer,h,1,0))}else{if(!s.initializer){this.error(l.DiagnosticCode.Type_expected,s.name.range.atEnd);continue}if(d=this.compileExpressionRetainType(s.initializer,g.Type.void,0),this.currentType==g.Type.void){this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,s.range,this.currentType.toString(),"<auto>");continue}h=this.currentType}var y=!1;if(s.is(u.CommonFlags.CONST))if(d)if(d=this.module.precomputeExpression(d),p.getExpressionId(d)==p.ExpressionId.Const){var m=new _.Local(c,-1,h,n.parentFunction);switch(p.getExpressionType(d)){case p.NativeType.I32:m.setConstantIntegerValue(i64_new(p.getConstValueI32(d),0),h);break;case p.NativeType.I64:m.setConstantIntegerValue(i64_new(p.getConstValueI64Low(d),p.getConstValueI64High(d)),h);break;case p.NativeType.F32:m.setConstantFloatValue(p.getConstValueF32(d),h);break;case p.NativeType.F64:m.setConstantFloatValue(p.getConstValueF64(d),h);break;default:return assert(!1),this.module.createUnreachable()}var T=n.scopedLocals;if(T){if(T.has(c))return this.error(l.DiagnosticCode.Duplicate_identifier_0,s.name.range,c),this.module.createUnreachable()}else n.scopedLocals=T=new Map;T.set(c,m),y=!0}else this.warning(l.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,s.range);else this.error(l.DiagnosticCode._const_declarations_must_be_initialized,s.range);if(!y){m=void 0;if(s.isAny(u.CommonFlags.LET|u.CommonFlags.CONST)||n.is(4096))m=n.addScopedLocal(c,h,!1,s.name);else{if(n.lookupLocal(c)){this.error(l.DiagnosticCode.Duplicate_identifier_0,s.name.range,c);continue}m=n.parentFunction.addLocal(h,c,s)}d?(i.push(this.compileAssignmentWithValue(s.name,d)),m.type.is(36)&&n.setLocalWrapped(m.index,!n.canOverflow(d,h))):m.type.is(36)&&n.setLocalWrapped(m.index,!0)}}return i.length?1==i.length?i[0]:this.module.createBlock(null,i,p.NativeType.None):0},t.prototype.compileVoidStatement=function(e){return this.compileExpression(e.expression,g.Type.void,2,0)},t.prototype.compileWhileStatement=function(e){var t=this.module,r=this.currentFlow,n=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,g.Type.bool,0),this.currentType),i=t.precomputeExpression(n);if(p.getExpressionId(i)==p.ExpressionId.Const&&p.getExpressionType(i)==p.NativeType.I32){if(!p.getConstValueI32(i))return t.createNop()}else n=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,g.Type.bool,0),this.currentType);var a=r.pushBreakLabel(),o=r.fork();this.currentFlow=o;var s="break|"+a;o.breakLabel=s;var c="continue|"+a;o.continueLabel=c;var l=this.compileStatement(e.statement),u=o.isAny(29);return o.freeScopedLocals(),r.popBreakLabel(),this.currentFlow=r,o.unset(1560),r.inheritConditional(o),t.createBlock(s,[t.createLoop(c,t.createIf(n,u?l:t.createBlock(null,[l,t.createBreak(c)],p.NativeType.None)))])},t.prototype.compileInlineConstant=function(e,t,r){assert(e.is(u.CommonFlags.INLINED));var n=e.type;switch(!r&&n.is(4)&&t.is(4)&&n.size<t.size?(this.currentType=t).kind:(this.currentType=n).kind){case 0:case 1:var i=n.computeSmallIntegerShift(g.Type.i32);return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue)<<i>>i:0);case 5:case 6:case 10:var a=e.type.computeSmallIntegerMask(g.Type.i32);return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue)&a:0);case 2:case 7:return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue):0);case 4:case 9:if(!e.program.options.isWasm64)return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue):0);case 3:case 8:return 1==e.constantValueKind?this.module.createI64(i64_low(e.constantIntegerValue),i64_high(e.constantIntegerValue)):this.module.createI64(0);case 12:if(!e.hasDecorator(_.DecoratorFlags.BUILTIN)||t!=g.Type.f32)return this.module.createF64(e.constantFloatValue);this.currentType=g.Type.f32;case 11:return this.module.createF32(e.constantFloatValue);default:return assert(!1),this.module.createUnreachable()}},t.prototype.compileExpression=function(e,t,r,n){var i;switch(this.currentType=t,e.kind){case m.NodeKind.ASSERTION:i=this.compileAssertionExpression(e,t);break;case m.NodeKind.BINARY:i=this.compileBinaryExpression(e,t);break;case m.NodeKind.CALL:i=this.compileCallExpression(e,t);break;case m.NodeKind.COMMA:i=this.compileCommaExpression(e,t);break;case m.NodeKind.ELEMENTACCESS:i=this.compileElementAccessExpression(e,t);break;case m.NodeKind.FUNCTION:i=this.compileFunctionExpression(e,t);break;case m.NodeKind.IDENTIFIER:case m.NodeKind.FALSE:case m.NodeKind.NULL:case m.NodeKind.THIS:case m.NodeKind.SUPER:case m.NodeKind.TRUE:i=this.compileIdentifierExpression(e,t,0==r);break;case m.NodeKind.INSTANCEOF:i=this.compileInstanceOfExpression(e,t);break;case m.NodeKind.LITERAL:i=this.compileLiteralExpression(e,t);break;case m.NodeKind.NEW:i=this.compileNewExpression(e,t);break;case m.NodeKind.PARENTHESIZED:i=this.compileParenthesizedExpression(e,t);break;case m.NodeKind.PROPERTYACCESS:i=this.compilePropertyAccessExpression(e,t,0==r);break;case m.NodeKind.TERNARY:i=this.compileTernaryExpression(e,t);break;case m.NodeKind.UNARYPOSTFIX:i=this.compileUnaryPostfixExpression(e,t);break;case m.NodeKind.UNARYPREFIX:i=this.compileUnaryPrefixExpression(e,t);break;default:this.error(l.DiagnosticCode.Operation_not_supported,e.range),i=this.module.createUnreachable()}var a=this.currentType;return 0!=r&&a!=t?(i=this.convertExpression(i,a,t,r,n,e),this.currentType=t):1==n&&(i=this.ensureSmallIntegerWrap(i,a)),this.options.sourceMap&&this.addDebugLocation(i,e.range),i},t.prototype.compileExpressionRetainType=function(e,t,r){return this.compileExpression(e,t==g.Type.void?g.Type.i32:t,0,r)},t.prototype.precomputeExpression=function(e,t,r,n){return this.module.precomputeExpression(this.compileExpression(e,t,r,n))},t.prototype.convertExpression=function(e,t,r,n,i,a){assert(0!=n);var o=this.module;return 14==t.kind?(assert(14!=r.kind),this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,a.range,t.toString(),r.toString()),o.createUnreachable()):14==r.kind?o.createDrop(e):(t.isAssignableTo(r)||1==n&&this.error(l.DiagnosticCode.Conversion_from_type_0_to_1_requires_an_explicit_cast,a.range,t.toString(),r.toString()),t.is(8)?r.is(8)?11==t.kind?12==r.kind&&(e=o.createUnary(p.UnaryOp.PromoteF32,e)):11==r.kind&&(e=o.createUnary(p.UnaryOp.DemoteF64,e)):r.is(4)?11==t.kind?r==g.Type.bool?(e=o.createBinary(p.BinaryOp.NeF32,e,o.createF32(0)),i=0):e=r.is(1)?r.is(64)?o.createUnary(p.UnaryOp.TruncF32ToI64,e):o.createUnary(p.UnaryOp.TruncF32ToI32,e):r.is(64)?o.createUnary(p.UnaryOp.TruncF32ToU64,e):o.createUnary(p.UnaryOp.TruncF32ToU32,e):r==g.Type.bool?(e=o.createBinary(p.BinaryOp.NeF64,e,o.createF64(0)),i=0):e=r.is(1)?r.is(64)?o.createUnary(p.UnaryOp.TruncF64ToI64,e):o.createUnary(p.UnaryOp.TruncF64ToI32,e):r.is(64)?o.createUnary(p.UnaryOp.TruncF64ToU64,e):o.createUnary(p.UnaryOp.TruncF64ToU32,e):(assert(0==r.flags,"void type expected"),e=o.createDrop(e)):t.is(4)&&r.is(8)?e=11==r.kind?t.is(64)?o.createUnary(t.is(1)?p.UnaryOp.ConvertI64ToF32:p.UnaryOp.ConvertU64ToF32,e):o.createUnary(t.is(1)?p.UnaryOp.ConvertI32ToF32:p.UnaryOp.ConvertU32ToF32,e):t.is(64)?o.createUnary(t.is(1)?p.UnaryOp.ConvertI64ToF64:p.UnaryOp.ConvertU64ToF64,e):o.createUnary(t.is(1)?p.UnaryOp.ConvertI32ToF64:p.UnaryOp.ConvertU32ToF64,e):t.is(64)?r==g.Type.bool?(e=o.createBinary(p.BinaryOp.NeI64,e,o.createI64(0)),i=0):r.is(64)||(e=o.createUnary(p.UnaryOp.WrapI64,e)):r.is(64)?(e=o.createUnary(t.is(1)?p.UnaryOp.ExtendI32:p.UnaryOp.ExtendU32,this.ensureSmallIntegerWrap(e,t)),i=0):t.is(32)&&t.size<r.size&&(e=this.ensureSmallIntegerWrap(e,t),i=0),this.currentType=r,1==i?this.ensureSmallIntegerWrap(e,r):e)},t.prototype.compileAssertionExpression=function(e,t){switch(e.assertionKind){case m.AssertionKind.PREFIX:case m.AssertionKind.AS:var r=this.resolver.resolveType(assert(e.toType),this.currentFlow.actualFunction,this.currentFlow.contextualTypeArguments);return r?this.compileExpression(e.expression,r,2,0):this.module.createUnreachable();case m.AssertionKind.NONNULL:assert(!e.toType);var n=this.compileExpressionRetainType(e.expression,t,0);return this.currentType=this.currentType.nonNullableType,n;default:assert(!1)}return this.module.createUnreachable()},t.prototype.compileBinaryExpression=function(e,t){var r,n,i,a,o,s,c=this.module,h=e.left,d=e.right,m=!1,T=e.operator;switch(T){case y.Token.LESSTHAN:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.LT)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=o,1,1,h),i=this.convertExpression(i,a,a=o,1,1,d),o.kind){case 0:case 1:case 2:s=c.createBinary(p.BinaryOp.LtI32,r,i);break;case 3:s=c.createBinary(p.BinaryOp.LtI64,r,i);break;case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.LtI64:p.BinaryOp.LtI32,r,i);break;case 5:case 6:case 7:case 10:s=c.createBinary(p.BinaryOp.LtU32,r,i);break;case 9:s=c.createBinary(this.options.isWasm64?p.BinaryOp.LtU64:p.BinaryOp.LtU32,r,i);break;case 8:s=c.createBinary(p.BinaryOp.LtU64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.LtF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.LtF64,r,i);break;default:assert(!1),s=c.createUnreachable()}this.currentType=g.Type.bool;break;case y.Token.GREATERTHAN:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.GT)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=o,1,1,h),i=this.convertExpression(i,a,a=o,1,1,d),o.kind){case 0:case 1:case 2:s=c.createBinary(p.BinaryOp.GtI32,r,i);break;case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.GtI64:p.BinaryOp.GtI32,r,i);break;case 3:s=c.createBinary(p.BinaryOp.GtI64,r,i);break;case 5:case 6:case 7:case 10:s=c.createBinary(p.BinaryOp.GtU32,r,i);break;case 9:s=c.createBinary(this.options.isWasm64?p.BinaryOp.GtU64:p.BinaryOp.GtU32,r,i);break;case 8:s=c.createBinary(p.BinaryOp.GtU64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.GtF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.GtF64,r,i);break;default:assert(!1),s=c.createUnreachable()}this.currentType=g.Type.bool;break;case y.Token.LESSTHAN_EQUALS:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.LE)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<=",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=o,1,1,h),i=this.convertExpression(i,a,a=o,1,1,d),o.kind){case 0:case 1:case 2:s=c.createBinary(p.BinaryOp.LeI32,r,i);break;case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.LeI64:p.BinaryOp.LeI32,r,i);break;case 3:s=c.createBinary(p.BinaryOp.LeI64,r,i);break;case 5:case 6:case 7:case 10:s=c.createBinary(p.BinaryOp.LeU32,r,i);break;case 9:s=c.createBinary(this.options.isWasm64?p.BinaryOp.LeU64:p.BinaryOp.LeU32,r,i);break;case 8:s=c.createBinary(p.BinaryOp.LeU64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.LeF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.LeF64,r,i);break;default:assert(!1),s=c.createUnreachable()}this.currentType=g.Type.bool;break;case y.Token.GREATERTHAN_EQUALS:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.GE)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">=",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=o,1,1,h),i=this.convertExpression(i,a,a=o,1,1,d),o.kind){case 0:case 1:case 2:s=c.createBinary(p.BinaryOp.GeI32,r,i);break;case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.GeI64:p.BinaryOp.GeI32,r,i);break;case 3:s=c.createBinary(p.BinaryOp.GeI64,r,i);break;case 5:case 6:case 7:case 10:s=c.createBinary(p.BinaryOp.GeU32,r,i);break;case 9:s=c.createBinary(this.options.isWasm64?p.BinaryOp.GeU64:p.BinaryOp.GeU32,r,i);break;case 8:s=c.createBinary(p.BinaryOp.GeU64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.GeF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.GeF64,r,i);break;default:assert(!1),s=c.createUnreachable()}this.currentType=g.Type.bool;break;case y.Token.EQUALS_EQUALS_EQUALS:case y.Token.EQUALS_EQUALS:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,T==y.Token.EQUALS_EQUALS&&this.currentType.is(256))if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.EQ)){s=this.compileBinaryOverload(b,h,r,d,e);break}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,y.operatorTokenToString(e.operator),n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=o,1,1,h),i=this.convertExpression(i,a,a=o,1,1,d),o.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:s=c.createBinary(p.BinaryOp.EqI32,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.EqI64:p.BinaryOp.EqI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.EqI64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.EqF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.EqF64,r,i);break;default:assert(!1),s=c.createUnreachable()}this.currentType=g.Type.bool;break;case y.Token.EXCLAMATION_EQUALS_EQUALS:case y.Token.EXCLAMATION_EQUALS:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,T==y.Token.EXCLAMATION_EQUALS&&this.currentType.is(256))if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.NE)){s=this.compileBinaryOverload(b,h,r,d,e);break}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,y.operatorTokenToString(e.operator),n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=o,1,1,h),i=this.convertExpression(i,a,a=o,1,1,d),o.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:s=c.createBinary(p.BinaryOp.NeI32,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.NeI64:p.BinaryOp.NeI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.NeI64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.NeF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.NeF64,r,i);break;default:assert(!1),s=c.createUnreachable()}this.currentType=g.Type.bool;break;case y.Token.EQUALS:return this.compileAssignment(h,d,t);case y.Token.PLUS_EQUALS:m=!0;case y.Token.PLUS:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.ADD)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0);else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"+",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=o,1,0,h),i=this.convertExpression(i,a,a=o,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:s=c.createBinary(p.BinaryOp.AddI32,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.AddI64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.AddF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.AddF64,r,i);break;default:assert(!1),s=c.createUnreachable()}break;case y.Token.MINUS_EQUALS:m=!0;case y.Token.MINUS:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.SUB)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"-",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=o,1,0,h),i=this.convertExpression(i,a,a=o,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:s=c.createBinary(p.BinaryOp.SubI32,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.SubI64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.SubF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.SubF64,r,i);break;default:assert(!1),s=c.createUnreachable()}break;case y.Token.ASTERISK_EQUALS:m=!0;case y.Token.ASTERISK:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.MUL)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,1);else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"*",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=o,1,0,h),i=this.convertExpression(i,a,a=o,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:s=c.createBinary(p.BinaryOp.MulI32,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.MulI64:p.BinaryOp.MulI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.MulI64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.MulF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.MulF64,r,i);break;default:assert(!1),s=c.createUnreachable()}break;case y.Token.ASTERISK_ASTERISK_EQUALS:m=!0;case y.Token.ASTERISK_ASTERISK:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.POW)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}var f=void 0;if(11==this.currentType.kind){if(i=this.compileExpression(d,g.Type.f32,1,0),a=this.currentType,!(f=this.f32PowInstance)){if(!(E=this.program.lookupGlobal(u.LibrarySymbols.Mathf))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf"),s=c.createUnreachable();break}if(!(I=E.members?E.members.get(u.LibrarySymbols.pow):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf.pow"),s=c.createUnreachable();break}assert(I.kind==_.ElementKind.FUNCTION_PROTOTYPE),this.f32PowInstance=f=this.resolver.resolveFunction(I,null)}}else if(r=this.convertExpression(r,this.currentType,g.Type.f64,1,0,h),n=this.currentType,i=this.compileExpression(d,g.Type.f64,1,0),a=this.currentType,!(f=this.f64PowInstance)){if(!(E=this.program.lookupGlobal(u.LibrarySymbols.Math))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math"),s=c.createUnreachable();break}if(!(I=E.members?E.members.get(u.LibrarySymbols.pow):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math.pow"),s=c.createUnreachable();break}assert(I.kind==_.ElementKind.FUNCTION_PROTOTYPE),this.f64PowInstance=f=this.resolver.resolveFunction(I,null)}s=f&&this.compileFunction(f)?this.makeCallDirect(f,[r,i]):c.createUnreachable();break;case y.Token.SLASH_EQUALS:m=!0;case y.Token.SLASH:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.DIV)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,1),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"/",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=o,1,1,h),i=this.convertExpression(i,a,a=o,1,1,d)}switch(this.currentType.kind){case 0:case 1:case 2:s=c.createBinary(p.BinaryOp.DivI32,r,i);break;case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.DivI64:p.BinaryOp.DivI32,r,i);break;case 3:s=c.createBinary(p.BinaryOp.DivI64,r,i);break;case 5:case 6:case 10:case 7:s=c.createBinary(p.BinaryOp.DivU32,r,i);break;case 9:s=c.createBinary(this.options.isWasm64?p.BinaryOp.DivU64:p.BinaryOp.DivU32,r,i);break;case 8:s=c.createBinary(p.BinaryOp.DivU64,r,i);break;case 11:s=c.createBinary(p.BinaryOp.DivF32,r,i);break;case 12:s=c.createBinary(p.BinaryOp.DivF64,r,i);break;default:assert(!1),s=c.createUnreachable()}break;case y.Token.PERCENT_EQUALS:m=!0;case y.Token.PERCENT:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.REM)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,1),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"%",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=o,1,1,h),i=this.convertExpression(i,a,a=o,1,1,d)}switch(this.currentType.kind){case 0:case 1:case 2:s=c.createBinary(p.BinaryOp.RemI32,r,i);break;case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.RemI64:p.BinaryOp.RemI32,r,i);break;case 3:s=c.createBinary(p.BinaryOp.RemI64,r,i);break;case 5:case 6:case 10:case 7:s=c.createBinary(p.BinaryOp.RemU32,r,i);break;case 9:s=c.createBinary(this.options.isWasm64?p.BinaryOp.RemU64:p.BinaryOp.RemU32,r,i);break;case 8:s=c.createBinary(p.BinaryOp.RemU64,r,i);break;case 11:if(!(f=this.f32ModInstance)){if(!(E=this.program.lookupGlobal(u.LibrarySymbols.Mathf))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf"),s=c.createUnreachable();break}if(!(I=E.members?E.members.get(u.LibrarySymbols.mod):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf.mod"),s=c.createUnreachable();break}assert(I.kind==_.ElementKind.FUNCTION_PROTOTYPE),this.f32ModInstance=f=this.resolver.resolveFunction(I,null)}s=f&&this.compileFunction(f)?this.makeCallDirect(f,[r,i]):c.createUnreachable();break;case 12:if(!(f=this.f64ModInstance)){var E,I;if(!(E=this.program.lookupGlobal(u.LibrarySymbols.Math))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math"),s=c.createUnreachable();break}if(!(I=E.members?E.members.get(u.LibrarySymbols.mod):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math.mod"),s=c.createUnreachable();break}assert(I.kind==_.ElementKind.FUNCTION_PROTOTYPE),this.f64ModInstance=f=this.resolver.resolveFunction(I,null)}s=f&&this.compileFunction(f)?this.makeCallDirect(f,[r,i]):c.createUnreachable();break;default:assert(!1),s=c.createUnreachable()}break;case y.Token.LESSTHAN_LESSTHAN_EQUALS:m=!0;case y.Token.LESSTHAN_LESSTHAN:if(r=this.compileExpressionRetainType(h,t.intType,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.BITWISE_SHL)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(i=this.compileExpression(d,n,1,0),a=this.currentType,this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:s=c.createBinary(p.BinaryOp.ShlI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.ShlI64,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.ShlI64:p.BinaryOp.ShlI32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),s=c.createUnreachable()}break;case y.Token.GREATERTHAN_GREATERTHAN_EQUALS:m=!0;case y.Token.GREATERTHAN_GREATERTHAN:if(r=this.compileExpressionRetainType(h,t.intType,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.BITWISE_SHR)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,1),a=this.currentType,this.currentType.kind){case 0:case 1:case 2:s=c.createBinary(p.BinaryOp.ShrI32,r,i);break;case 3:s=c.createBinary(p.BinaryOp.ShrI64,r,i);break;case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrI64:p.BinaryOp.ShrI32,r,i);break;case 5:case 6:case 10:case 7:s=c.createBinary(p.BinaryOp.ShrU32,r,i);break;case 8:s=c.createBinary(p.BinaryOp.ShrU64,r,i);break;case 9:s=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrU64:p.BinaryOp.ShrU32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),s=c.createUnreachable()}break;case y.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:m=!0;case y.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:if(r=this.compileExpressionRetainType(h,t.intType,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.BITWISE_SHR_U)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,0),a=this.currentType,this.currentType.kind){case 5:case 6:case 10:s=c.createBinary(p.BinaryOp.ShrU32,r,i);case 0:case 1:case 2:case 7:s=c.createBinary(p.BinaryOp.ShrU32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.ShrU64,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrU64:p.BinaryOp.ShrU32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),s=c.createUnreachable()}break;case y.Token.AMPERSAND_EQUALS:m=!0;case y.Token.AMPERSAND:if(r=this.compileExpressionRetainType(h,t.intType,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.BITWISE_AND)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"&",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=o,1,0,h),i=this.convertExpression(i,a,a=o,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 10:case 7:s=c.createBinary(p.BinaryOp.AndI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.AndI64,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.AndI64:p.BinaryOp.AndI32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),s=c.createUnreachable()}break;case y.Token.BAR_EQUALS:m=!0;case y.Token.BAR:if(r=this.compileExpressionRetainType(h,t.intType,0),n=this.currentType,this.currentType.is(256)){if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.BITWISE_OR)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"|",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=o,1,0,h),i=this.convertExpression(i,a,a=o,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:s=c.createBinary(p.BinaryOp.OrI32,r,i);break;case 2:case 7:s=c.createBinary(p.BinaryOp.OrI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.OrI64,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.OrI64:p.BinaryOp.OrI32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),s=c.createUnreachable()}break;case y.Token.CARET_EQUALS:m=!0;case y.Token.CARET:if(r=this.compileExpressionRetainType(h,t.intType,0),n=this.currentType,this.currentType.is(256)){var v,b;if(v=n.classReference)if(b=v.lookupOverload(_.OperatorKind.BITWISE_XOR)){s=this.compileBinaryOverload(b,h,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(o=g.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"^",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=o,1,0,h),i=this.convertExpression(i,a,a=o,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:s=c.createBinary(p.BinaryOp.XorI32,r,i);break;case 2:case 7:s=c.createBinary(p.BinaryOp.XorI32,r,i);break;case 3:case 8:s=c.createBinary(p.BinaryOp.XorI64,r,i);break;case 9:case 4:s=c.createBinary(this.options.isWasm64?p.BinaryOp.XorI64:p.BinaryOp.XorI32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),s=c.createUnreachable()}break;case y.Token.AMPERSAND_AMPERSAND:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,i=this.compileExpression(d,n,1,0),a=this.currentType,s=c.cloneExpression(r,!0,0))this.makeIsTrueish(r,this.currentType),s=c.createIf(this.makeIsTrueish(r,this.currentType),i,s);else{var S=(A=this.currentFlow).getAndFreeTempLocal(this.currentType,!A.canOverflow(r,this.currentType));s=c.createIf(this.makeIsTrueish(c.createTeeLocal(S.index,r),this.currentType),i,c.createGetLocal(assert(S).index,this.currentType.toNativeType()))}break;case y.Token.BAR_BAR:if(r=this.compileExpressionRetainType(h,t,0),n=this.currentType,i=this.compileExpression(d,n,1,0),a=this.currentType,s=this.module.cloneExpression(r,!0,0))s=this.module.createIf(this.makeIsTrueish(r,this.currentType),s,i);else{var A;S=(A=this.currentFlow).getAndFreeTempLocal(this.currentType,!A.canOverflow(r,this.currentType));s=c.createIf(this.makeIsTrueish(c.createTeeLocal(S.index,r),this.currentType),c.createGetLocal(assert(S).index,this.currentType.toNativeType()),i)}break;default:assert(!1),s=this.module.createUnreachable()}return m?this.compileAssignmentWithValue(h,s,t!=g.Type.void):s},t.prototype.compileUnaryOverload=function(e,t,r,n){var i,a=0;return e.is(u.CommonFlags.INSTANCE)?(a=r,i=[]):i=[t],this.compileCallDirect(e,i,n,a)},t.prototype.compileBinaryOverload=function(e,t,r,n,i){var a,o=0;if(e.is(u.CommonFlags.INSTANCE)){var s=assert(e.parent);assert(s.kind==_.ElementKind.CLASS),o=r,a=[n]}else a=[t,n];return this.compileCallDirect(e,a,i,o)},t.prototype.compileAssignment=function(e,t,r){var n,i=this.program.resolver,a=this.currentFlow,o=i.resolveExpression(e,a);if(!o)return this.module.createUnreachable();switch(o.kind){case _.ElementKind.GLOBAL:if(!this.compileGlobal(o))return this.module.createUnreachable();assert(o.type!=g.Type.void);case _.ElementKind.LOCAL:case _.ElementKind.FIELD:n=o.type;break;case _.ElementKind.PROPERTY_PROTOTYPE:var s=o.setterPrototype;if(!s)return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,o.internalName),this.module.createUnreachable();if(!(c=this.resolver.resolveFunction(s,null,T.makeMap(),d.ReportMode.REPORT)))return this.module.createUnreachable();assert(1==c.signature.parameterTypes.length),n=c.signature.parameterTypes[0];break;case _.ElementKind.PROPERTY:var c;if(!(c=o.setterInstance))return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,o.internalName),this.module.createUnreachable();assert(1==c.signature.parameterTypes.length),n=c.signature.parameterTypes[0];break;case _.ElementKind.CLASS:if(i.currentElementExpression){var p=a.is(8192),u=o.lookupOverload(_.OperatorKind.INDEXED_SET,p);if(!u)return o.lookupOverload(_.OperatorKind.INDEXED_GET,p)?this.error(l.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,e.range,o.internalName):this.error(l.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,o.internalName),this.module.createUnreachable();assert(2==u.signature.parameterTypes.length),n=u.signature.parameterTypes[1];break}default:return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}assert(n!=g.Type.void);var h=this.compileExpression(t,n,1,0);return this.compileAssignmentWithValue(e,h,r!=g.Type.void)},t.prototype.compileAssignmentWithValue=function(e,t,r){void 0===r&&(r=!1);var n=this.module,i=this.currentFlow,a=this.resolver.resolveExpression(e,i);if(!a)return n.createUnreachable();switch(a.kind){case _.ElementKind.LOCAL:var o=a.type;return assert(o!=g.Type.void),this.currentType=r?o:g.Type.void,a.is(u.CommonFlags.CONST)?(this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable()):(o.is(36)&&i.setLocalWrapped(a.index,!i.canOverflow(t,o)),r?n.createTeeLocal(a.index,t):n.createSetLocal(a.index,t));case _.ElementKind.GLOBAL:if(!this.compileGlobal(a))return n.createUnreachable();o=a.type;if(assert(o!=g.Type.void),this.currentType=r?o:g.Type.void,a.is(u.CommonFlags.CONST))return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();if(t=this.ensureSmallIntegerWrap(t,o),r){var s=o.toNativeType(),c=a.internalName;return n.createBlock(null,[n.createSetGlobal(c,t),n.createGetGlobal(c,s)],s)}return n.createSetGlobal(a.internalName,t);case _.ElementKind.FIELD:var p=a.initializerNode;if(a.is(u.CommonFlags.READONLY)&&!i.actualFunction.is(u.CommonFlags.CONSTRUCTOR)&&!p)return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();var h=assert(this.resolver.currentThisExpression),y=this.compileExpressionRetainType(h,this.options.usizeType,0);o=a.type;this.currentType=r?o:g.Type.void;s=o.toNativeType();if(10==o.kind&&(t=this.ensureSmallIntegerWrap(t,o)),r){var m=this.currentFlow,f=m.getAndFreeTempLocal(o,!m.canOverflow(t,o)).index;return n.createBlock(null,[n.createSetLocal(f,t),n.createStore(o.byteSize,y,n.createGetLocal(f,s),s,a.memoryOffset),n.createGetLocal(f,s)],s)}return n.createStore(o.byteSize,y,t,s,a.memoryOffset);case _.ElementKind.PROPERTY_PROTOTYPE:var E=a.setterPrototype;if(!E)return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();if(!(b=this.resolver.resolveFunction(E,null,T.makeMap(),d.ReportMode.REPORT)))return n.createUnreachable();if(!r)return this.makeCallDirect(b,[t]);var I=assert(a.getterPrototype);if(!(A=this.resolver.resolveFunction(I,null,T.makeMap(),d.ReportMode.REPORT)))return n.createUnreachable();var v=(B=A.signature.returnType).toNativeType();return n.createBlock(null,[this.makeCallDirect(b,[t]),this.makeCallDirect(A)],v);case _.ElementKind.PROPERTY:var b;if(!(b=a.setterInstance))return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();if(!r){var S=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0);return this.makeCallDirect(b,[S,t])}var A;v=(B=(A=assert(a.getterInstance)).signature.returnType).toNativeType(),y=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0),f=i.getAndFreeTempLocal(B,!1).index;return n.createBlock(null,[this.makeCallDirect(b,[n.createTeeLocal(f,y),t]),this.makeCallDirect(A,[n.createGetLocal(f,v)])],v);case _.ElementKind.CLASS:var N=this.resolver.currentElementExpression;if(N){var C=i.is(8192),O=a.lookupOverload(_.OperatorKind.INDEXED_GET,C);if(!O)return this.error(l.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,a.internalName),n.createUnreachable();var x=a.lookupOverload(_.OperatorKind.INDEXED_SET,C);if(!x)return this.error(l.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,e.range,a.internalName),this.currentType=r?O.signature.returnType:g.Type.void,n.createUnreachable();var k=a.type,L=(h=assert(this.resolver.currentThisExpression),y=this.compileExpressionRetainType(h,this.options.usizeType,0),this.compileExpression(N,g.Type.i32,1,0));if(r){var R=i.getTempLocal(k,!1),F=i.getAndFreeTempLocal(this.currentType,!1),B=O.signature.returnType;return i.freeTempLocal(R),n.createBlock(null,[this.makeCallDirect(x,[n.createTeeLocal(R.index,y),n.createTeeLocal(F.index,L),t]),this.makeCallDirect(O,[n.createGetLocal(R.index,R.type.toNativeType()),n.createGetLocal(F.index,F.type.toNativeType())])],B.toNativeType())}return this.makeCallDirect(x,[y,L,t])}}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()},t.prototype.compileCallExpression=function(e,t){var r=this.module,n=this.currentFlow;if(e.expression.kind==m.NodeKind.SUPER){var i=this.currentFlow,a=i.actualFunction;if(!a.is(u.CommonFlags.CONSTRUCTOR))return this.error(l.DiagnosticCode.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors,e.range),r.createUnreachable();var o=assert(a.parent);assert(o.kind==_.ElementKind.CLASS);var s=assert(o.base),c=assert(i.lookupLocal(u.CommonSymbols.this_)),h=this.options.nativeSizeType,d=[r.createSetLocal(c.index,this.compileCallDirect(this.ensureConstructor(s,e),e.arguments,e,r.createIf(r.createGetLocal(c.index,h),r.createGetLocal(c.index,h),this.makeAllocation(o))))];return this.makeFieldInitialization(o,d),i.isAny(2080)?(this.error(l.DiagnosticCode._super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class,e.range),r.createUnreachable()):(i.set(96),this.currentType=g.Type.void,r.createBlock(null,d))}var y,f,E=this.resolver.resolveExpression(e.expression,n);if(!E)return r.createUnreachable();switch(E.kind){case _.ElementKind.FUNCTION_PROTOTYPE:var I=E,v=e.typeArguments;if(I.hasDecorator(_.DecoratorFlags.BUILTIN))return this.compileCallExpressionBuiltin(I,e,t);var b=null;if(v){if(!I.is(u.CommonFlags.GENERIC))return this.error(l.DiagnosticCode.Type_0_is_not_generic,e.expression.range,I.internalName),r.createUnreachable();b=this.resolver.resolveFunctionInclTypeArguments(I,v,n.actualFunction.parent,T.makeMap(n.contextualTypeArguments),e)}else{if(I.is(u.CommonFlags.GENERIC)){for(var S=new Map,A=assert(I.typeParameterNodes),N=A.length,C=0;C<N;++C)S.set(A[C].name.text,null);var O=I.signatureNode.parameters,x=O.length,k=e.arguments,L=k.length,R=new Array(L);for(C=0;C<x;++C){var F=O[C].type,B=F.kind!=m.NodeKind.TYPE||F.name.next?null:F.name.identifier.text,D=C<L?k[C]:O[C].initializer;if(!D)return this.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,e.range,x.toString(10),L.toString(10)),r.createUnreachable();if(null!==B&&S.has(B)){if(M=S.get(B)){R[C]=this.compileExpressionRetainType(D,M,0);var U=void 0;if(!(U=g.Type.commonCompatible(M,this.currentType,!0))&&!(U=g.Type.commonCompatible(M,this.currentType,!1)))return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,O[C].type.range,this.currentType.toString(),M.toString()),r.createUnreachable();M=U}else R[C]=this.compileExpressionRetainType(D,g.Type.i32,0),M=this.currentType;S.set(B,M)}else{var P=this.resolver.resolveType(O[C].type,n.actualFunction,n.contextualTypeArguments);if(!P)return r.createUnreachable();R[C]=this.compileExpression(D,P,1,0)}}var w=new Array(N);for(C=0;C<N;++C){var M=assert(S.get(A[C].name.text));w[C]=M}return(b=this.resolver.resolveFunction(I,w,T.makeMap(n.contextualTypeArguments)))?this.makeCallDirect(b,R):this.module.createUnreachable()}b=this.resolver.resolveFunction(I,null)}if(!b)return this.module.createUnreachable();var G=0;return b.is(u.CommonFlags.INSTANCE)&&(G=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0)),this.compileCallDirect(b,e.arguments,e,G);case _.ElementKind.LOCAL:if(y=E.type.signatureReference){f=E.is(u.CommonFlags.INLINED)?r.createI32(i64_low(E.constantIntegerValue)):r.createGetLocal(E.index,p.NativeType.I32);break}return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,E.type.toString()),r.createUnreachable();case _.ElementKind.GLOBAL:if(y=E.type.signatureReference){f=r.createGetGlobal(E.internalName,E.type.toNativeType());break}return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,E.type.toString()),r.createUnreachable();case _.ElementKind.FIELD:var V=E.type;if(y=V.signatureReference){var K=assert(this.resolver.currentThisExpression);G=this.compileExpressionRetainType(K,this.options.usizeType,0);f=r.createLoad(4,!1,G,p.NativeType.I32,E.memoryOffset);break}return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,V.toString()),r.createUnreachable();case _.ElementKind.FUNCTION_TARGET:y=E.signature,f=this.compileExpression(e.expression,E.type,1,0);break;case _.ElementKind.PROPERTY_PROTOTYPE:var z=assert(E.getterPrototype);if(!(H=this.resolver.resolveFunction(z,null)))return r.createUnreachable();if(f=this.compileCallDirect(H,[],e.expression),!(y=this.currentType.signatureReference))return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,this.currentType.toString()),r.createUnreachable();break;case _.ElementKind.PROPERTY:var H=assert(E.getterInstance);if(f=this.compileCallDirect(H,[],e.expression,this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0)),!(y=this.currentType.signatureReference))return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,this.currentType.toString()),r.createUnreachable();break;default:return this.error(l.DiagnosticCode.Operation_not_supported,e.range),r.createUnreachable()}return this.compileCallIndirect(y,f,e.arguments,e)},t.prototype.compileCallExpressionBuiltin=function(e,t,r){var n=null,i=e.typeParameterNodes,a=t.typeArguments;t.typeArguments&&(e.is(u.CommonFlags.GENERIC)||this.error(l.DiagnosticCode.Type_0_is_not_generic,t.range,e.internalName),n=this.resolver.resolveTypeArguments(assert(i),a,this.currentFlow.actualFunction.parent,T.makeMap(this.currentFlow.contextualTypeArguments),t));var o=c.compileCall(this,e,n,t.arguments,r,t);return o||(this.error(l.DiagnosticCode.Operation_not_supported,t.range),this.module.createUnreachable())},t.prototype.checkCallSignature=function(e,t,r,n){if(r!=(null!=e.thisType))return this.error(l.DiagnosticCode.Operation_not_supported,n.range),!1;var i=e.hasRest;if(i)return this.error(l.DiagnosticCode.Operation_not_supported,n.range),!1;var a=e.requiredParameters,o=e.parameterTypes.length;return t<a?(this.error(a<o?l.DiagnosticCode.Expected_at_least_0_arguments_but_got_1:l.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,a.toString(),t.toString()),!1):!(t>o&&!i)||(this.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,o.toString(),t.toString()),!1)},t.prototype.compileCallDirect=function(e,t,r,n){void 0===n&&(n=0);var i=t.length,a=e.signature;if(!this.checkCallSignature(a,i,0!=n,r))return this.module.createUnreachable();if(e.hasDecorator(_.DecoratorFlags.INLINE)){if(assert(!e.is(u.CommonFlags.TRAMPOLINE)),!this.currentInlineFunctions.includes(e)){this.currentInlineFunctions.push(e);var o=this.compileCallInlinePrechecked(e,t,n);return this.currentInlineFunctions.pop(),o}this.warning(l.DiagnosticCode.Function_0_cannot_be_inlined_into_itself,r.range,e.internalName)}var s=n?i+1:i,c=new Array(s),p=0;n&&(c[0]=n,p=1);for(var h=a.parameterTypes,d=0;d<i;++d,++p)c[p]=this.compileExpression(t[d],h[d],1,0);return assert(p==s),this.makeCallDirect(e,c)},t.prototype.compileCallInlinePrechecked=function(e,t,r){void 0===r&&(r=0);var n=this.module,i=this.currentFlow,a=h.Flow.createInline(i.parentFunction,e),o=[];if(r){var s=assert(e.parent);assert(s.kind==_.ElementKind.CLASS);var c=assert(e.signature.thisType),l=a.addScopedLocal(u.CommonSymbols.this_,c,!1);o.push(n.createSetLocal(l.index,r));var p=s.base;p&&a.addScopedAlias(u.CommonSymbols.super_,p.type,l.index)}for(var d=t.length,y=e.signature,m=y.parameterTypes,g=0;g<d;++g){var T=this.compileExpression(t[g],m[g],1,0),f=a.addScopedLocal(y.getParameterName(g),m[g],!i.canOverflow(T,m[g]));o.push(n.createSetLocal(f.index,T))}this.currentFlow=a;var E=y.parameterTypes.length;for(g=d;g<E;++g){var I=this.compileExpression(assert(e.prototype.signatureNode.parameters[g].initializer),m[g],1,1);f=a.addScopedLocal(y.getParameterName(g),m[g],!a.canOverflow(I,m[g]));o.push(n.createSetLocal(f.index,I))}for(var v=this.compileFunctionBody(e),b=(g=0,v.length);g<b;++g)o.push(v[g]);a.freeScopedLocals();var S=a.returnType;return this.currentFlow=i,this.currentType=S,n.createBlock(a.inlineReturnLabel,o,S.toNativeType())},t.prototype.ensureTrampoline=function(e){var t=e.trampoline;if(t)return t;var r=e.signature,n=e.internalName,i=r.parameterTypes,a=e.prototype.signatureNode.parameters,o=r.returnType,s=r.thisType,c=e.is(u.CommonFlags.INSTANCE),h=r.requiredParameters,d=h,y=i.length,m=y;c&&(++d,++m);var T=assert(m-d),f=new Array(d),E=0,I=this.module;c&&(f[0]=I.createGetLocal(0,this.options.nativeSizeType),E=1);for(var b=0;b<h;++b,++E)f[E]=I.createGetLocal(E,i[b].toNativeType());assert(E==d);var S=new g.Signature(i,o,s);S.requiredParameters=y,(t=new _.Function(e.name+"|trampoline",e.prototype,S,e.contextualTypeArguments)).set(e.flags|u.CommonFlags.TRAMPOLINE|u.CommonFlags.COMPILED),e.trampoline=t;var A=this.currentFlow;this.currentFlow=t.flow;var N=T+1,C=new Array(N),O="of"+T.toString(10);for(b=0;b<N;++b){var x=b.toString(10)+O;C[b]=x}var k=I.createBlock(C[0],[I.createBlock("outOfRange",[I.createSwitch(C,"outOfRange",h?I.createBinary(p.BinaryOp.SubI32,I.createGetGlobal(v.argc,p.NativeType.I32),I.createI32(h)):I.createGetGlobal(v.argc,p.NativeType.I32))]),I.createUnreachable()]);for(b=0;b<T;++b,++E){var L=i[h+b],R=a[h+b],F=R.initializer,B=void 0;F?B=I.createSetLocal(E,this.compileExpression(F,L,1,1)):(this.error(l.DiagnosticCode.Optional_parameter_must_have_an_initializer,R.range),B=I.createUnreachable()),k=I.createBlock(C[b+1],[k,B]),f[E]=I.createGetLocal(E,L.toNativeType())}this.currentFlow=A,assert(E==m);var D=I.addFunction(t.internalName,this.ensureFunctionType(S.parameterTypes,S.returnType,S.thisType),g.typesToNativeTypes(t.additionalLocals),I.createBlock(null,[k,I.createCall(n,f,o.toNativeType())],o.toNativeType()));return t.finalize(I,D),t},t.prototype.ensureArgcVar=function(){if(!this.argcVar){var e=this.module;this.argcVar=e.addGlobal(v.argc,p.NativeType.I32,!0,e.createI32(0))}return v.argc},t.prototype.ensureArgcSet=function(){var e=v.setargc;if(!this.argcSet){var t=this.module;this.argcSet=t.addFunction(e,this.ensureFunctionType([g.Type.u32],g.Type.void),null,t.createSetGlobal(this.ensureArgcVar(),t.createGetLocal(0,p.NativeType.I32))),t.addFunctionExport(e,"_setargc")}return e},t.prototype.makeCallDirect=function(e,t){void 0===t&&(t=null);var r=t?t.length:0,n=r,i=e.signature.requiredParameters,a=e.signature.parameterTypes.length,o=a;e.is(u.CommonFlags.INSTANCE)&&(++i,++o,--n),assert(r>=i);var s=this.module;if(!this.compileFunction(e))return s.createUnreachable();var c=e.signature.returnType,l=e.is(u.CommonFlags.MODULE_IMPORT);if(r<o){t||((t=new Array(o)).length=0);for(var p=e.signature.parameterTypes,_=e.prototype.signatureNode.parameters,h=!0,d=n;d<a;++d){var y=_[d].initializer;if(null===y||!m.nodeIsConstantValue(y.kind)){h=!1;break}}if(h)for(d=n;d<a;++d)t.push(this.compileExpression(_[d].initializer,p[d],1,0));else{for(d=n;d<a;++d)t.push(p[d].toNativeZero(s));if(!l){var g=e;if(e=this.ensureTrampoline(e),!this.compileFunction(e))return s.createUnreachable();e.flow.flags=g.flow.flags;var T=c.toNativeType();return this.currentType=c,s.createBlock(null,[s.createSetGlobal(this.ensureArgcVar(),s.createI32(n)),s.createCall(e.internalName,t,T)],T)}}}return this.currentType=c,s.createCall(e.internalName,t,c.toNativeType())},t.prototype.compileCallIndirect=function(e,t,r,n,i){void 0===i&&(i=0);var a=r.length;if(!this.checkCallSignature(e,a,0!=i,n))return this.module.createUnreachable();var o=i?a+1:a,s=new Array(o),c=0;i&&(s[0]=i,c=1);for(var l=e.parameterTypes,p=0;p<a;++p,++c)s[c]=this.compileExpression(r[p],l[p],1,0);return assert(c==o),this.makeCallIndirect(e,t,s)},t.prototype.makeCallIndirect=function(e,t,r){void 0===r&&(r=null);var n=r?r.length:0,i=n,a=e.requiredParameters,o=e.parameterTypes.length,s=o;e.thisType&&(++a,++s,--i),assert(n>=a),this.ensureFunctionType(e.parameterTypes,e.returnType,e.thisType);var c=this.module;if(n<s){r||((r=new Array(s)).length=0);for(var l=e.parameterTypes,p=i;p<o;++p)r.push(l[p].toNativeZero(c))}var u=e.returnType;return this.currentType=u,c.createBlock(null,[c.createSetGlobal(this.ensureArgcVar(),c.createI32(i)),c.createCallIndirect(t,r,e.toSignatureString())],u.toNativeType())},t.prototype.compileCommaExpression=function(e,t){for(var r=e.expressions,n=r.length,i=new Array(n--),a=0;a<n;++a)i[a]=this.compileExpression(r[a],g.Type.void,2,0);return i[n]=this.compileExpression(r[n],t,1,0),this.module.createBlock(null,i,this.currentType.toNativeType())},t.prototype.compileElementAccessExpression=function(e,t){var r=this.resolver.resolveElementAccessExpression(e,this.currentFlow,t);if(!r)return this.module.createUnreachable();switch(r.kind){case _.ElementKind.CLASS:var n=this.currentFlow.is(8192),i=r.lookupOverload(_.OperatorKind.INDEXED_GET,n);if(!i)return this.error(l.DiagnosticCode.Index_signature_is_missing_in_type_0,e.expression.range,r.internalName),this.module.createUnreachable();var a=this.compileExpression(e.expression,r.type,1,0);return this.compileCallDirect(i,[e.elementExpression],e,a)}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},t.prototype.compileFunctionExpression=function(e,t){var r=e.declaration,n=r.name,i=(n.text.length?n.text:"anonymous")+"|"+this.functionTable.length.toString(10),a=this.currentFlow,o=new _.FunctionPrototype(i,a.actualFunction,r.clone(),_.DecoratorFlags.NONE),s=this.compileFunctionUsingTypeArguments(o,[],T.makeMap(a.contextualTypeArguments),r);if(!s)return this.module.createUnreachable();this.currentType=s.signature.type;var c=this.ensureFunctionTableEntry(s);return c<0?this.module.createUnreachable():this.module.createI32(c)},t.prototype.maybeCompileEnclosingSource=function(e){var t=e.range.source.internalPath,r=this.program.filesByName;assert(r.has(t)),r.get(t).is(u.CommonFlags.COMPILED)||this.compileFileByPath(t,e)},t.prototype.compileIdentifierExpression=function(e,t,r){var n=this.module,i=this.currentFlow,a=i.actualFunction;switch(e.kind){case m.NodeKind.NULL:var o=this.options;return t.classReference||(this.currentType=o.usizeType),o.isWasm64?n.createI64(0):n.createI32(0);case m.NodeKind.TRUE:return this.currentType=g.Type.bool,n.createI32(1);case m.NodeKind.FALSE:return this.currentType=g.Type.bool,n.createI32(0);case m.NodeKind.THIS:if(a.is(u.CommonFlags.INSTANCE)){var s=assert(i.lookupLocal(u.CommonSymbols.this_)),c=assert(a.parent);assert(c.kind==_.ElementKind.CLASS);var h=this.options.nativeSizeType;if(a.is(u.CommonFlags.CONSTRUCTOR)&&!i.is(32)){i.set(32);var d=[n.createIf(n.createUnary(h==p.NativeType.I64?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,n.createGetLocal(s.index,h)),n.createSetLocal(s.index,this.makeAllocation(c)))];return this.makeFieldInitialization(c,d),d.push(n.createGetLocal(s.index,h)),this.currentType=s.type,n.createBlock(null,d,h)}var y=assert(a.signature.thisType);return this.currentType=y,n.createGetLocal(s.index,y.toNativeType())}return this.error(l.DiagnosticCode._this_cannot_be_referenced_in_current_location,e.range),this.currentType=this.options.usizeType,n.createUnreachable();case m.NodeKind.SUPER:var f=this.currentFlow,E=f.actualFunction;if(E.is(u.CommonFlags.CONSTRUCTOR)&&(f.is(64)||this.error(l.DiagnosticCode._super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class,e.range)),f.is(4096)){var I=f.lookupLocal(u.CommonSymbols.this_);if(I){var v=assert(I.type.classReference).base;if(v)return this.currentType=v.type,n.createGetLocal(I.index,v.type.toNativeType())}}if(E.is(u.CommonFlags.INSTANCE)){c=assert(E.parent);assert(c.kind==_.ElementKind.CLASS);var b=c.base;if(b){var S=b.type;return this.currentType=S,n.createGetLocal(0,S.toNativeType())}}return this.error(l.DiagnosticCode._super_can_only_be_referenced_in_a_derived_class,e.range),this.currentType=this.options.usizeType,n.createUnreachable()}this.maybeCompileEnclosingSource(e);var A=this.resolver.resolveIdentifier(e,i,this.currentEnum||a);if(!A)return n.createUnreachable();switch(A.kind){case _.ElementKind.LOCAL:var N=A.type;if(assert(N!=g.Type.void),A.is(u.CommonFlags.INLINED))return this.compileInlineConstant(A,t,r);var C=A.index;return assert(C>=0),this.currentType=N,this.module.createGetLocal(C,N.toNativeType());case _.ElementKind.GLOBAL:if(!this.compileGlobal(A))return this.module.createUnreachable();var O=A.type;return assert(O!=g.Type.void),A.is(u.CommonFlags.INLINED)?this.compileInlineConstant(A,t,r):(this.currentType=O,this.module.createGetGlobal(A.internalName,O.toNativeType()));case _.ElementKind.ENUMVALUE:return A.is(u.CommonFlags.COMPILED)?(this.currentType=g.Type.i32,A.is(u.CommonFlags.INLINED)?(assert(1==A.constantValueKind),this.module.createI32(i64_low(A.constantIntegerValue))):this.module.createGetGlobal(A.internalName,p.NativeType.I32)):(this.error(l.DiagnosticCode.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums,e.range),this.currentType=g.Type.i32,this.module.createUnreachable());case _.ElementKind.FUNCTION_PROTOTYPE:var x=this.resolver.resolveFunction(A,null,T.makeMap(i.contextualTypeArguments));if(!x||!this.compileFunction(x))return n.createUnreachable();var k=this.ensureFunctionTableEntry(x);return this.currentType=x.signature.type,this.module.createI32(k)}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},t.prototype.compileInstanceOfExpression=function(e,t){var r=this.module,n=this.compileExpressionRetainType(e.expression,this.options.usizeType,0),i=this.currentType,a=this.resolver.resolveType(e.isType,this.currentFlow.actualFunction);return this.currentType=g.Type.bool,a?a.is(256)?i.is(512)&&!a.is(512)&&i.nonNullableType.isAssignableTo(a)?r.createBinary(i.is(64)?p.BinaryOp.NeI64:p.BinaryOp.NeI32,n,i.toNativeZero(r)):r.createI32(i.isAssignableTo(a)?1:0):r.createI32(i==a?1:0):r.createUnreachable()},t.prototype.compileLiteralExpression=function(e,t,r){void 0===r&&(r=!1);var n=this.module;switch(e.literalKind){case m.LiteralKind.ARRAY:assert(!r);var i=t.classReference;return i&&i.prototype==this.program.arrayPrototype?this.compileArrayLiteral(assert(i.typeArguments)[0],e.elementExpressions,!1,e):(this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable());case m.LiteralKind.FLOAT:var a=e.value;return r&&(a=-a),t==g.Type.f32?n.createF32(a):(this.currentType=g.Type.f64,n.createF64(a));case m.LiteralKind.INTEGER:var o=e.value;r&&(o=i64_sub(i64_new(0),o));var s=this.resolver.determineIntegerLiteralType(o,t);switch(this.currentType=s,s.kind){case 4:if(!this.options.isWasm64)return n.createI32(i64_low(o));case 3:return n.createI64(i64_low(o),i64_high(o));case 9:if(!this.options.isWasm64)return n.createI32(i64_low(o));case 8:return n.createI64(i64_low(o),i64_high(o));case 11:return n.createF32(i64_to_f32(o));case 12:return n.createF64(i64_to_f64(o));default:return n.createI32(i64_low(o))}case m.LiteralKind.STRING:return assert(!r),this.compileStringLiteral(e);case m.LiteralKind.OBJECT:return assert(!r),this.compileObjectLiteral(e,t)}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.currentType=t,n.createUnreachable()},t.prototype.ensureStaticString=function(e){var t,r=this.program,n=r.hasGC,i=r.gcHeaderSize,a=assert(r.stringInstance),o=this.stringSegments;if(o.has(e))t=o.get(e);else{var s=e.length,l=a.currentMemoryOffset+1&-2,p=l+2*s,_=void 0,h=void 0;n?(_=new Uint8Array(i+p),h=i,T.writeI32(c.ensureGCHook(this,a),_,r.gcHookOffset)):(_=new Uint8Array(p),h=0),T.writeI32(s,_,h+a.offsetof(u.LibrarySymbols.length)),h+=l;for(var d=0;d<s;++d)T.writeI16(e.charCodeAt(d),_,h+(d<<1));t=this.addMemorySegment(_),o.set(e,t)}var y=t.offset;return n&&(y=i64_add(y,i64_new(i))),this.currentType=a.type,this.options.isWasm64?this.module.createI64(i64_low(y),i64_high(y)):(assert(i64_is_u32(y)),this.module.createI32(i64_low(y)))},t.prototype.compileStringLiteral=function(e){return this.ensureStaticString(e.value)},t.prototype.ensureStaticArray=function(e,t){var r,n,i=this.program,a=i.hasGC,o=i.gcHeaderSize,s=t.length,l=e.byteSize,_=s*l,h=this.options.usizeType.byteSize,d=assert(i.arrayBufferInstance),y=d.currentMemoryOffset+7&-8,m=1<<32-clz(y+_-1);a?(r=new Uint8Array(o+m),n=o,T.writeI32(c.ensureGCHook(this,d),r,i.gcHookOffset)):(r=new Uint8Array(m),n=0),T.writeI32(_,r,n+d.offsetof(u.LibrarySymbols.byteLength)),n+=y;var g=e.toNativeType();switch(g){case p.NativeType.I32:switch(l){case 1:for(var f=0;f<s;++f){var E=t[f];assert(p.getExpressionType(E)==g),assert(p.getExpressionId(E)==p.ExpressionId.Const),T.writeI8(p.getConstValueI32(E),r,n),n+=1}break;case 2:for(f=0;f<s;++f){E=t[f];assert(p.getExpressionType(E)==g),assert(p.getExpressionId(E)==p.ExpressionId.Const),T.writeI16(p.getConstValueI32(E),r,n),n+=2}break;case 4:for(f=0;f<s;++f){E=t[f];assert(p.getExpressionType(E)==g),assert(p.getExpressionId(E)==p.ExpressionId.Const),T.writeI32(p.getConstValueI32(E),r,n),n+=4}break;default:assert(!1)}break;case p.NativeType.I64:for(f=0;f<s;++f){E=t[f];assert(p.getExpressionType(E)==g),assert(p.getExpressionId(E)==p.ExpressionId.Const),T.writeI64(i64_new(p.getConstValueI64Low(E),p.getConstValueI64High(E)),r,n),n+=8}break;case p.NativeType.F32:for(f=0;f<s;++f){E=t[f];assert(p.getExpressionType(E)==g),assert(p.getExpressionId(E)==p.ExpressionId.Const),T.writeF32(p.getConstValueF32(E),r,n),n+=4}break;case p.NativeType.F64:for(f=0;f<s;++f){E=t[f];assert(p.getExpressionType(E)==g),assert(p.getExpressionId(E)==p.ExpressionId.Const),T.writeF64(p.getConstValueF64(E),r,n),n+=8}break;default:assert(!1)}var I=this.addMemorySegment(r).offset;a&&(I=i64_add(I,i64_new(o)));var v=assert(i.arrayPrototype),b=assert(this.resolver.resolveClass(v,[e],T.makeMap())),S=b.currentMemoryOffset+7&-8;a?(r=new Uint8Array(o+S),n=o,T.writeI32(c.ensureGCHook(this,b),r,i.gcHookOffset)):(r=new Uint8Array(S),n=0);var A=this.addMemorySegment(r).offset;return a&&(A=i64_add(A,i64_new(o))),this.currentType=b.type,8==h?(T.writeI64(I,r,n+b.offsetof("buffer_")),T.writeI32(s,r,n+b.offsetof("length_")),this.module.createI64(i64_low(A),i64_high(A))):(assert(i64_is_u32(I)),T.writeI32(i64_low(I),r,n+b.offsetof("buffer_")),T.writeI32(s,r,n+b.offsetof("length_")),assert(i64_is_u32(A)),this.module.createI32(i64_low(A)))},t.prototype.compileArrayLiteral=function(e,t,r,n){for(var i=this.module,a=t.length,o=new Array(a),s=new Array(a),c=e.toNativeType(),u=!0,h=0;h<a;++h){var d=t[h]?this.compileExpression(t[h],e,1,0):e.toNativeZero(i);o[h]=d,u&&(d=i.precomputeExpression(o[h]),p.getExpressionId(d)==p.ExpressionId.Const?(assert(p.getExpressionType(d)==c),s[h]=d):(r&&this.warning(l.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,n.range),u=!1))}if(u)return this.ensureStaticArray(e,s);var y=assert(this.program.arrayPrototype),m=assert(this.resolver.resolveClass(y,[e],T.makeMap())),g=m.type;this.currentType=g;var f=m.lookupOverload(_.OperatorKind.INDEXED_SET,!0);if(!f)return this.error(l.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,n.range,m.internalName),i.createUnreachable();var E=g.toNativeType(),I=this.currentFlow,v=I.parentFunction.addLocal(g),b=new Array(2+a),S=0;b[S++]=i.createSetLocal(v.index,this.makeCallDirect(assert(m.constructorInstance),[i.createI32(0),i.createI32(a)]));for(h=0;h<a;++h)b[S++]=this.makeCallDirect(f,[i.createGetLocal(v.index,E),i.createI32(h),o[h]]);return assert(S+1==b.length),b[S]=i.createGetLocal(v.index,E),I.freeTempLocal(v),this.currentType=g,i.createBlock(null,b,E)},t.prototype.compileObjectLiteral=function(e,t){var r=this.module,n=t.classReference;if(!n||n.is(u.CommonFlags.ABSTRACT))return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,"<object>",t.toString()),r.createUnreachable();var i=n.constructorInstance;if(i){if(i.signature.requiredParameters)return this.error(l.DiagnosticCode.Constructor_of_class_0_must_not_require_any_arguments,e.range,n.toString()),r.createUnreachable();if(i.is(u.CommonFlags.PRIVATE))return this.error(l.DiagnosticCode.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration,e.range,n.toString()),r.createUnreachable();if(i.is(u.CommonFlags.PROTECTED))return this.error(l.DiagnosticCode.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration,e.range,n.toString()),r.createUnreachable()}var a=e.names,o=a.length,s=e.values,c=n.members,p=!1,h=new Array(o+2),d=this.currentFlow.getTempLocal(this.options.usizeType);assert(o==s.length);for(var y=0,m=o;y<m;++y){var g=c?c.get(a[y].text):null;if(g&&g.kind==_.ElementKind.FIELD){var T=g.type;h[y+1]=this.module.createStore(T.byteSize,this.module.createGetLocal(d.index,this.options.nativeSizeType),this.compileExpression(s[y],g.type,1,0),T.toNativeType(),g.memoryOffset)}else this.error(l.DiagnosticCode.Property_0_does_not_exist_on_type_1,a[y].range,a[y].text,n.toString()),p=!0}return this.currentType=n.type.nonNullableType,p?r.createUnreachable():(h[0]=r.createSetLocal(d.index,this.makeAllocation(n)),h[h.length-1]=r.createGetLocal(d.index,this.options.nativeSizeType),r.createBlock(null,h,this.options.nativeSizeType))},t.prototype.compileNewExpression=function(e,t){var r=this.module,n=this.currentFlow,i=this.resolver.resolveExpression(e.expression,n);if(!i)return r.createUnreachable();if(i.kind!=_.ElementKind.CLASS_PROTOTYPE)return this.error(l.DiagnosticCode.Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature,e.expression.range),this.module.createUnreachable();var a,o=i,s=null,c=e.typeArguments;return(s=!c&&null!==(a=t.classReference)&&a.is(u.CommonFlags.GENERIC)?this.resolver.resolveClass(o,a.typeArguments,T.makeMap(n.contextualTypeArguments)):this.resolver.resolveClassInclTypeArguments(o,c,n.actualFunction.parent,T.makeMap(n.contextualTypeArguments),e))?this.compileInstantiate(s,e.arguments,e):r.createUnreachable()},t.prototype.ensureConstructor=function(e,t){var r=e.constructorInstance;if(r)return r.hasDecorator(_.DecoratorFlags.INLINE)||this.compileFunction(r),r;var n=e.base,i=n?this.ensureConstructor(n,t).signature:new g.Signature(null,e.type,e.type);(r=new _.Function(u.CommonSymbols.constructor,new _.FunctionPrototype(u.CommonSymbols.constructor,e,this.program.makeNativeFunctionDeclaration(u.CommonSymbols.constructor,u.CommonFlags.INSTANCE|u.CommonFlags.CONSTRUCTOR)),i,null)).internalName=e.internalName+u.INSTANCE_DELIMITER+"constructor",r.set(u.CommonFlags.COMPILED),r.prototype.setResolvedInstance("",r),e.constructorInstance=r;var a=this.currentFlow;this.currentFlow=r.flow;var o=this.module,s=this.options.nativeSizeType,c=new Array;if(c.push(o.createIf(o.createUnary(s==p.NativeType.I64?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,o.createGetLocal(0,s)),o.createSetLocal(0,this.makeAllocation(e)))),n){var l=i.parameterTypes,h=l.length,d=new Array(1+h);d[0]=o.createGetLocal(0,s);for(var y=0;y<h;++y)d[y+1]=o.createGetLocal(y+1,l[y].toNativeType());c.push(o.createSetLocal(0,this.makeCallDirect(assert(n.constructorInstance),d)))}this.makeFieldInitialization(e,c),c.push(o.createGetLocal(0,s));var m=this.ensureFunctionType(i.parameterTypes,i.returnType,i.thisType),T=r.localsByIndex,f=new Array,E=1+i.parameterTypes.length,I=T.length;if(I>E)for(y=E;y<I;++y)f.push(T[y].type.toNativeType());var v=o.addFunction(r.internalName,m,f,1==c.length?c[0]:o.createBlock(null,c,s));return r.finalize(o,v),this.currentFlow=a,r},t.prototype.compileInstantiate=function(e,t,r){var n=this.ensureConstructor(e,r),i=this.compileCallDirect(n,t,r,this.options.usizeType.toNativeZero(this.module));return this.currentType=e.type,i},t.prototype.compileParenthesizedExpression=function(e,t){return this.compileExpression(e.expression,t,0,0)},t.prototype.compilePropertyAccessExpression=function(e,t,r){var n=this.module,i=this.currentFlow;this.maybeCompileEnclosingSource(e);var a=this.resolver.resolvePropertyAccessExpression(e,i,t);if(!a)return n.createUnreachable();switch(a.kind){case _.ElementKind.GLOBAL:if(!this.compileGlobal(a))return n.createUnreachable();var o=a.type;return assert(o!=g.Type.void),a.is(u.CommonFlags.INLINED)?this.compileInlineConstant(a,t,r):(this.currentType=o,n.createGetGlobal(a.internalName,o.toNativeType()));case _.ElementKind.ENUMVALUE:var s=assert(a.parent);return assert(s.kind==_.ElementKind.ENUM),this.compileEnum(s)?(this.currentType=g.Type.i32,a.is(u.CommonFlags.INLINED)?(assert(1==a.constantValueKind),n.createI32(i64_low(a.constantIntegerValue))):n.createGetGlobal(a.internalName,p.NativeType.I32)):(this.currentType=g.Type.i32,this.module.createUnreachable());case _.ElementKind.FIELD:assert(a.memoryOffset>=0);var c=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0);return this.currentType=a.type,n.createLoad(a.type.byteSize,a.type.is(5),c,a.type.toNativeType(),a.memoryOffset);case _.ElementKind.PROPERTY_PROTOTYPE:var h=a.getterPrototype;if(h){var d=this.resolver.resolveFunction(h,null);if(d)return this.compileCallDirect(d,[],e,0)}return n.createUnreachable();case _.ElementKind.PROPERTY:var y=assert(a.getterInstance);return this.compileCallDirect(y,[],e,this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0));case _.ElementKind.FUNCTION_PROTOTYPE:return this.error(l.DiagnosticCode.Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set,e.range,a.name),n.createUnreachable()}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()},t.prototype.compileGetter=function(e,t){var r=e.getterPrototype;if(r){var n=this.resolver.resolveFunction(r,null);if(!n)return this.module.createUnreachable();var i=n.signature;if(!this.checkCallSignature(i,0,n.is(u.CommonFlags.INSTANCE),t))return this.module.createUnreachable();if(n.is(u.CommonFlags.INSTANCE)){var a=assert(n.parent);assert(a.kind==_.ElementKind.CLASS);var o=assert(this.resolver.currentThisExpression),s=this.compileExpressionRetainType(o,this.options.usizeType,0);//!!!
return this.currentType=i.returnType,this.compileCallDirect(n,[],t,s)}return this.currentType=i.returnType,this.compileCallDirect(n,[],t,0)}return this.error(l.DiagnosticCode.Property_0_does_not_exist_on_type_1,t.range,e.name,e.parent.toString()),this.module.createUnreachable()},t.prototype.compileTernaryExpression=function(e,t){var r=e.ifThen,n=e.ifElse,i=this.currentFlow,a=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,g.Type.bool,0),this.currentType),o=this.module.precomputeExpression(a);if(p.getExpressionId(o)==p.ExpressionId.Const&&p.getExpressionType(o)==p.NativeType.I32)return p.getConstValueI32(o)?this.compileExpressionRetainType(r,t,0):this.compileExpressionRetainType(n,t,0);a=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,g.Type.bool,0),this.currentType);var s=i.fork();this.currentFlow=s;var c=this.compileExpressionRetainType(r,t,0),u=this.currentType;s.freeScopedLocals();var _=i.fork();this.currentFlow=_;var h=this.compileExpressionRetainType(n,t,0),d=this.currentType;_.freeScopedLocals(),this.currentFlow=i,i.inheritMutual(s,_);var y=g.Type.commonCompatible(u,d,!1);return y?(c=this.convertExpression(c,u,y,1,0,r),h=this.convertExpression(h,d,y,1,0,n),this.currentType=y,this.module.createIf(a,c,h)):(this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,u.toString(),d.toString()),this.currentType=t,this.module.createUnreachable())},t.prototype.compileUnaryPostfixExpression=function(e,t){var r=this.module,n=this.currentFlow,i=this.compileExpression(e.operand,t==g.Type.void?g.Type.i32:t,0,0);if(p.getExpressionId(i)==p.ExpressionId.Unreachable)return i;var a,o=this.currentType,s=null;switch(t!=g.Type.void&&(s=n.getTempLocal(o,!1),i=r.createTeeLocal(s.index,i)),e.operator){case y.Token.PLUS_PLUS:switch(o.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:a=r.createBinary(p.BinaryOp.AddI32,i,r.createI32(1));break;case 9:if(this.currentType.is(256)){if(u=this.currentType.classReference)if(h=u.lookupOverload(_.OperatorKind.POSTFIX_INC)){a=this.compileUnaryOverload(h,e.operand,i,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),r.createUnreachable()}case 4:var c=this.options;a=r.createBinary(c.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,i,o.toNativeOne(r));break;case 3:case 8:a=r.createBinary(p.BinaryOp.AddI64,i,r.createI64(1));break;case 11:a=r.createBinary(p.BinaryOp.AddF32,i,r.createF32(1));break;case 12:a=r.createBinary(p.BinaryOp.AddF64,i,r.createF64(1));break;default:return assert(!1),r.createUnreachable()}break;case y.Token.MINUS_MINUS:switch(o.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:a=r.createBinary(p.BinaryOp.SubI32,i,r.createI32(1));break;case 9:if(this.currentType.is(256)){var u,h;if(u=this.currentType.classReference)if(h=u.lookupOverload(_.OperatorKind.POSTFIX_DEC)){a=this.compileUnaryOverload(h,e.operand,i,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),r.createUnreachable()}case 4:c=this.options;a=r.createBinary(c.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,i,o.toNativeOne(r));break;case 3:case 8:a=r.createBinary(p.BinaryOp.SubI64,i,r.createI64(1));break;case 11:a=r.createBinary(p.BinaryOp.SubF32,i,r.createF32(1));break;case 12:a=r.createBinary(p.BinaryOp.SubF64,i,r.createF64(1));break;default:return assert(!1),r.createUnreachable()}break;default:return assert(!1),r.createUnreachable()}if(!s)return this.currentType=g.Type.void,this.compileAssignmentWithValue(e.operand,a,!1);var d=this.compileAssignmentWithValue(e.operand,a,!1);this.currentType=s.type,n.freeTempLocal(s);var m=s.type.toNativeType();return r.createBlock(null,[d,r.createGetLocal(s.index,m)],m)},t.prototype.compileUnaryPrefixExpression=function(e,t){var r,n=this.module,i=!1;switch(e.operator){case y.Token.PLUS:if(r=this.compileExpression(e.operand,t==g.Type.void?g.Type.i32:t,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(o=a.lookupOverload(_.OperatorKind.PLUS)){r=this.compileUnaryOverload(o,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}break;case y.Token.MINUS:if(e.operand.kind==m.NodeKind.LITERAL&&(e.operand.literalKind==m.LiteralKind.INTEGER||e.operand.literalKind==m.LiteralKind.FLOAT)){r=this.compileLiteralExpression(e.operand,t,!0),this.options.sourceMap&&this.addDebugLocation(r,e.range);break}if(r=this.compileExpression(e.operand,t==g.Type.void?g.Type.i32:t,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(o=a.lookupOverload(_.OperatorKind.MINUS)){r=this.compileUnaryOverload(o,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:r=n.createBinary(p.BinaryOp.SubI32,n.createI32(0),r);break;case 9:case 4:r=n.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,this.currentType.toNativeZero(n),r);break;case 3:case 8:r=n.createBinary(p.BinaryOp.SubI64,n.createI64(0),r);break;case 11:r=n.createUnary(p.UnaryOp.NegF32,r);break;case 12:r=n.createUnary(p.UnaryOp.NegF64,r);break;default:assert(!1),r=n.createUnreachable()}break;case y.Token.PLUS_PLUS:if(i=!0,r=this.compileExpression(e.operand,t==g.Type.void?g.Type.i32:t,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(o=a.lookupOverload(_.OperatorKind.PREFIX_INC)){r=this.compileUnaryOverload(o,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:r=n.createBinary(p.BinaryOp.AddI32,r,this.module.createI32(1));break;case 9:case 4:r=n.createBinary(this.options.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,r,this.currentType.toNativeOne(n));break;case 3:case 8:r=n.createBinary(p.BinaryOp.AddI64,r,n.createI64(1));break;case 11:r=n.createBinary(p.BinaryOp.AddF32,r,n.createF32(1));break;case 12:r=n.createBinary(p.BinaryOp.AddF64,r,n.createF64(1));break;default:assert(!1),r=n.createUnreachable()}break;case y.Token.MINUS_MINUS:if(i=!0,r=this.compileExpression(e.operand,t==g.Type.void?g.Type.i32:t,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(o=a.lookupOverload(_.OperatorKind.PREFIX_DEC)){r=this.compileUnaryOverload(o,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:r=n.createBinary(p.BinaryOp.SubI32,r,n.createI32(1));break;case 9:case 4:r=n.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,r,this.currentType.toNativeOne(n));break;case 3:case 8:r=n.createBinary(p.BinaryOp.SubI64,r,n.createI64(1));break;case 11:r=n.createBinary(p.BinaryOp.SubF32,r,n.createF32(1));break;case 12:r=n.createBinary(p.BinaryOp.SubF64,r,n.createF64(1));break;default:assert(!1),r=n.createUnreachable()}break;case y.Token.EXCLAMATION:if(r=this.compileExpression(e.operand,t==g.Type.void?g.Type.i32:t,0,0),this.currentType.is(256))if(a=this.currentType.classReference)if(o=a.lookupOverload(_.OperatorKind.NOT)){r=this.compileUnaryOverload(o,e.operand,r,e);break}r=this.makeIsFalseish(r,this.currentType),this.currentType=g.Type.bool;break;case y.Token.TILDE:if(r=this.compileExpression(e.operand,t==g.Type.void?g.Type.i32:t.is(8)?g.Type.i64:t,0,0),this.currentType.is(256)){var a,o;if(a=this.currentType.classReference)if(o=a.lookupOverload(_.OperatorKind.BITWISE_NOT)){r=this.compileUnaryOverload(o,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(r=this.convertExpression(r,this.currentType,this.currentType.intType,1,0,e.operand),this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:r=n.createBinary(p.BinaryOp.XorI32,r,n.createI32(-1));break;case 9:case 4:r=n.createBinary(this.options.isWasm64?p.BinaryOp.XorI64:p.BinaryOp.XorI32,r,this.currentType.toNativeNegOne(n));break;case 3:case 8:r=n.createBinary(p.BinaryOp.XorI64,r,n.createI64(-1,-1));break;default:assert(!1),r=n.createUnreachable()}break;case y.Token.TYPEOF:return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable();default:return assert(!1),n.createUnreachable()}return i?this.compileAssignmentWithValue(e.operand,r,t!=g.Type.void):r},t.prototype.ensureSmallIntegerWrap=function(e,t){var r=this.module,n=this.currentFlow;switch(t.kind){case 0:n.canOverflow(e,t)&&(e=this.options.hasFeature(1)?r.createUnary(p.UnaryOp.ExtendI8ToI32,e):r.createBinary(p.BinaryOp.ShrI32,r.createBinary(p.BinaryOp.ShlI32,e,r.createI32(24)),r.createI32(24)));break;case 1:n.canOverflow(e,t)&&(e=this.options.hasFeature(1)?r.createUnary(p.UnaryOp.ExtendI16ToI32,e):r.createBinary(p.BinaryOp.ShrI32,r.createBinary(p.BinaryOp.ShlI32,e,r.createI32(16)),r.createI32(16)));break;case 5:n.canOverflow(e,t)&&(e=r.createBinary(p.BinaryOp.AndI32,e,r.createI32(255)));break;case 6:n.canOverflow(e,t)&&(e=r.createBinary(p.BinaryOp.AndI32,e,r.createI32(65535)));break;case 10:n.canOverflow(e,t)&&(e=r.createBinary(p.BinaryOp.NeI32,e,r.createI32(0)))}return e},t.prototype.makeIsFalseish=function(e,t){var r=this.module;switch(t.kind){case 0:case 1:case 5:case 6:case 10:e=this.ensureSmallIntegerWrap(e,t);case 2:case 7:return r.createUnary(p.UnaryOp.EqzI32,e);case 3:case 8:return r.createUnary(p.UnaryOp.EqzI64,e);case 9:case 4:return r.createUnary(64==t.size?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,e);case 11:return r.createBinary(p.BinaryOp.EqF32,e,r.createF32(0));case 12:return r.createBinary(p.BinaryOp.EqF64,e,r.createF64(0));default:return assert(!1),r.createI32(1)}},t.prototype.makeIsTrueish=function(e,t){var r=this.module;switch(t.kind){case 0:case 1:case 5:case 6:case 10:e=this.ensureSmallIntegerWrap(e,t);case 2:case 7:return e;case 3:case 8:return r.createBinary(p.BinaryOp.NeI64,e,r.createI64(0));case 9:case 4:return 64==t.size?r.createBinary(p.BinaryOp.NeI64,e,r.createI64(0)):e;case 11:return r.createBinary(p.BinaryOp.NeF32,e,r.createF32(0));case 12:return r.createBinary(p.BinaryOp.NeF64,e,r.createF64(0));default:return assert(!1),r.createI32(0)}},t.prototype.makeAllocation=function(e){var t=this.program;assert(e.program==t);var r=this.module,n=this.options;if(t.hasGC&&e.type.isManaged(t)){var i=assert(t.gcAllocateInstance);return this.compileFunction(i)?(this.currentType=e.type,r.createCall(i.internalName,[n.isWasm64?r.createI64(e.currentMemoryOffset):r.createI32(e.currentMemoryOffset),r.createI32(c.ensureGCHook(this,e))],n.nativeSizeType)):r.createUnreachable()}return(i=t.memoryAllocateInstance)&&this.compileFunction(i)?(this.currentType=e.type,r.createCall(i.internalName,[n.isWasm64?r.createI64(e.currentMemoryOffset):r.createI32(e.currentMemoryOffset)],n.nativeSizeType)):r.createUnreachable()},t.prototype.makeFieldInitialization=function(e,t){var r,n;void 0===t&&(t=[]);var i=e.members;if(!i)return[];var o=this.module,s=this.currentFlow,c=s.is(4096),l=c?assert(s.lookupLocal(u.CommonSymbols.this_)).index:0,p=this.options.nativeSizeType;try{for(var h=a(i.values()),d=h.next();!d.done;d=h.next()){var y=d.value;if(y.kind==_.ElementKind.FIELD&&y.parent==e){var m=y;assert(!m.isAny(u.CommonFlags.CONST));var g=m.type,T=g.toNativeType(),f=m.prototype.initializerNode;if(f)t.push(o.createStore(g.byteSize,o.createGetLocal(l,p),this.compileExpression(f,g,1,0),T,m.memoryOffset));else{var E=m.prototype.parameterIndex;t.push(o.createStore(g.byteSize,o.createGetLocal(l,p),E>=0?o.createGetLocal(c?assert(s.lookupLocal(m.name)).index:1+E,T):g.toNativeZero(o),T,m.memoryOffset))}}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return t},t.prototype.addDebugLocation=function(e,t){var r=this.currentFlow.parentFunction,n=t.source;n.debugInfoIndex<0&&(n.debugInfoIndex=this.module.addDebugInfoFile(n.normalizedPath)),t.debugInfoRef=e,r.debugLocations.push(t)},t}(l.DiagnosticEmitter);function S(e,t){if(E=t.range.source.simplePath,I=_.mangleInternalName(e.name,e.parent,e.is(u.CommonFlags.INSTANCE),!0),e.hasDecorator(_.DecoratorFlags.EXTERNAL)){var r=e.program,n=assert(m.findDecorator(m.DecoratorKind.EXTERNAL,t.decorators)),i=n.arguments;if(i&&i.length){var a=i[0];a.kind==m.NodeKind.LITERAL&&a.literalKind==m.LiteralKind.STRING?(I=a.value,i.length>=2&&((a=i[1]).kind==m.NodeKind.LITERAL&&a.literalKind==m.LiteralKind.STRING?(E=I,I=a.value,i.length>2&&r.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,"2",i.length.toString())):r.error(l.DiagnosticCode.String_literal_expected,a.range))):r.error(l.DiagnosticCode.String_literal_expected,a.range)}else r.error(l.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,n.range,"1","0")}}t.Compiler=b,function(e){e.started="~lib/started",e.argc="~lib/argc",e.setargc="~lib/setargc"}(v||(v={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Operation_not_supported=100]="Operation_not_supported",e[e.Operation_is_unsafe=101]="Operation_is_unsafe",e[e.User_defined_0=102]="User_defined_0",e[e.Conversion_from_type_0_to_1_requires_an_explicit_cast=200]="Conversion_from_type_0_to_1_requires_an_explicit_cast",e[e.Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit=201]="Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit",e[e.Type_0_cannot_be_changed_to_type_1=202]="Type_0_cannot_be_changed_to_type_1",e[e.Type_0_cannot_be_reinterpreted_as_type_1=203]="Type_0_cannot_be_reinterpreted_as_type_1",e[e.Basic_type_0_cannot_be_nullable=204]="Basic_type_0_cannot_be_nullable",e[e.Cannot_export_a_mutable_global=205]="Cannot_export_a_mutable_global",e[e.Compiling_constant_with_non_constant_initializer_as_mutable=206]="Compiling_constant_with_non_constant_initializer_as_mutable",e[e.Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa=207]="Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa",e[e.Unmanaged_classes_cannot_implement_interfaces=208]="Unmanaged_classes_cannot_implement_interfaces",e[e.Invalid_regular_expression_flags=209]="Invalid_regular_expression_flags",e[e.Implementation_0_must_match_the_signature_1=210]="Implementation_0_must_match_the_signature_1",e[e.Class_0_is_sealed_and_cannot_be_extended=211]="Class_0_is_sealed_and_cannot_be_extended",e[e.Decorator_0_is_not_valid_here=212]="Decorator_0_is_not_valid_here",e[e.Duplicate_decorator=213]="Duplicate_decorator",e[e.An_allocator_must_be_declared_to_allocate_memory_Try_importing_allocator_arena_or_allocator_tlsf=214]="An_allocator_must_be_declared_to_allocate_memory_Try_importing_allocator_arena_or_allocator_tlsf",e[e.Optional_parameter_must_have_an_initializer=215]="Optional_parameter_must_have_an_initializer",e[e.Constructor_of_class_0_must_not_require_any_arguments=216]="Constructor_of_class_0_must_not_require_any_arguments",e[e.Function_0_cannot_be_inlined_into_itself=217]="Function_0_cannot_be_inlined_into_itself",e[e.Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set=218]="Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set",e[e.Optional_properties_are_not_supported=219]="Optional_properties_are_not_supported",e[e.Expression_must_be_a_compile_time_constant=220]="Expression_must_be_a_compile_time_constant",e[e.Module_cannot_have_multiple_start_functions=221]="Module_cannot_have_multiple_start_functions",e[e.Unterminated_string_literal=1002]="Unterminated_string_literal",e[e.Identifier_expected=1003]="Identifier_expected",e[e._0_expected=1005]="_0_expected",e[e.A_file_cannot_have_a_reference_to_itself=1006]="A_file_cannot_have_a_reference_to_itself",e[e.Trailing_comma_not_allowed=1009]="Trailing_comma_not_allowed",e[e.Unexpected_token=1012]="Unexpected_token",e[e.A_rest_parameter_must_be_last_in_a_parameter_list=1014]="A_rest_parameter_must_be_last_in_a_parameter_list",e[e.Parameter_cannot_have_question_mark_and_initializer=1015]="Parameter_cannot_have_question_mark_and_initializer",e[e.A_required_parameter_cannot_follow_an_optional_parameter=1016]="A_required_parameter_cannot_follow_an_optional_parameter",e[e.Statements_are_not_allowed_in_ambient_contexts=1036]="Statements_are_not_allowed_in_ambient_contexts",e[e.Initializers_are_not_allowed_in_ambient_contexts=1039]="Initializers_are_not_allowed_in_ambient_contexts",e[e._0_modifier_cannot_be_used_here=1042]="_0_modifier_cannot_be_used_here",e[e.A_rest_parameter_cannot_be_optional=1047]="A_rest_parameter_cannot_be_optional",e[e.A_rest_parameter_cannot_have_an_initializer=1048]="A_rest_parameter_cannot_have_an_initializer",e[e.A_set_accessor_must_have_exactly_one_parameter=1049]="A_set_accessor_must_have_exactly_one_parameter",e[e.A_set_accessor_parameter_cannot_have_an_initializer=1052]="A_set_accessor_parameter_cannot_have_an_initializer",e[e.A_get_accessor_cannot_have_parameters=1054]="A_get_accessor_cannot_have_parameters",e[e.Enum_member_must_have_initializer=1061]="Enum_member_must_have_initializer",e[e.Type_parameters_cannot_appear_on_a_constructor_declaration=1092]="Type_parameters_cannot_appear_on_a_constructor_declaration",e[e.Type_annotation_cannot_appear_on_a_constructor_declaration=1093]="Type_annotation_cannot_appear_on_a_constructor_declaration",e[e.An_accessor_cannot_have_type_parameters=1094]="An_accessor_cannot_have_type_parameters",e[e.A_set_accessor_cannot_have_a_return_type_annotation=1095]="A_set_accessor_cannot_have_a_return_type_annotation",e[e.Type_parameter_list_cannot_be_empty=1098]="Type_parameter_list_cannot_be_empty",e[e.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement=1104]="A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement",e[e.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement=1105]="A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement",e[e.A_return_statement_can_only_be_used_within_a_function_body=1108]="A_return_statement_can_only_be_used_within_a_function_body",e[e.Expression_expected=1109]="Expression_expected",e[e.Type_expected=1110]="Type_expected",e[e.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement=1113]="A_default_clause_cannot_appear_more_than_once_in_a_switch_statement",e[e.Duplicate_label_0=1114]="Duplicate_label_0",e[e.Octal_literals_are_not_allowed_in_strict_mode=1121]="Octal_literals_are_not_allowed_in_strict_mode",e[e.Digit_expected=1124]="Digit_expected",e[e.Hexadecimal_digit_expected=1125]="Hexadecimal_digit_expected",e[e.Unexpected_end_of_text=1126]="Unexpected_end_of_text",e[e.Invalid_character=1127]="Invalid_character",e[e._case_or_default_expected=1130]="_case_or_default_expected",e[e._super_must_be_followed_by_an_argument_list_or_member_access=1034]="_super_must_be_followed_by_an_argument_list_or_member_access",e[e.A_declare_modifier_cannot_be_used_in_an_already_ambient_context=1038]="A_declare_modifier_cannot_be_used_in_an_already_ambient_context",e[e.Type_argument_expected=1140]="Type_argument_expected",e[e.String_literal_expected=1141]="String_literal_expected",e[e.Line_break_not_permitted_here=1142]="Line_break_not_permitted_here",e[e.Declaration_expected=1146]="Declaration_expected",e[e._const_declarations_must_be_initialized=1155]="_const_declarations_must_be_initialized",e[e.Unterminated_regular_expression_literal=1161]="Unterminated_regular_expression_literal",e[e.Interface_declaration_cannot_have_implements_clause=1176]="Interface_declaration_cannot_have_implements_clause",e[e.Binary_digit_expected=1177]="Binary_digit_expected",e[e.Octal_digit_expected=1178]="Octal_digit_expected",e[e.An_implementation_cannot_be_declared_in_ambient_contexts=1183]="An_implementation_cannot_be_declared_in_ambient_contexts",e[e.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive=1198]="An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive",e[e.Unterminated_Unicode_escape_sequence=1199]="Unterminated_Unicode_escape_sequence",e[e.Decorators_are_not_valid_here=1206]="Decorators_are_not_valid_here",e[e._abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration=1242]="_abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration",e[e.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract=1245]="Method_0_cannot_have_an_implementation_because_it_is_marked_abstract",e[e.A_definite_assignment_assertion_is_not_permitted_in_this_context=1255]="A_definite_assignment_assertion_is_not_permitted_in_this_context",e[e.A_class_may_only_extend_another_class=1311]="A_class_may_only_extend_another_class",e[e.A_parameter_property_cannot_be_declared_using_a_rest_parameter=1317]="A_parameter_property_cannot_be_declared_using_a_rest_parameter",e[e.Duplicate_identifier_0=2300]="Duplicate_identifier_0",e[e.Cannot_find_name_0=2304]="Cannot_find_name_0",e[e.Module_0_has_no_exported_member_1=2305]="Module_0_has_no_exported_member_1",e[e.Generic_type_0_requires_1_type_argument_s=2314]="Generic_type_0_requires_1_type_argument_s",e[e.Type_0_is_not_generic=2315]="Type_0_is_not_generic",e[e.Type_0_is_not_assignable_to_type_1=2322]="Type_0_is_not_assignable_to_type_1",e[e.Index_signature_is_missing_in_type_0=2329]="Index_signature_is_missing_in_type_0",e[e._this_cannot_be_referenced_in_current_location=2332]="_this_cannot_be_referenced_in_current_location",e[e._super_can_only_be_referenced_in_a_derived_class=2335]="_super_can_only_be_referenced_in_a_derived_class",e[e.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors=2337]="Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors",e[e.Property_0_does_not_exist_on_type_1=2339]="Property_0_does_not_exist_on_type_1",e[e.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures=2349]="Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures",e[e.Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature=2351]="Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature",e[e.A_function_whose_declared_type_is_not_void_must_return_a_value=2355]="A_function_whose_declared_type_is_not_void_must_return_a_value",e[e.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access=2357]="The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access",e[e.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access=2364]="The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access",e[e.Operator_0_cannot_be_applied_to_types_1_and_2=2365]="Operator_0_cannot_be_applied_to_types_1_and_2",e[e.A_super_call_must_be_the_first_statement_in_the_constructor=2376]="A_super_call_must_be_the_first_statement_in_the_constructor",e[e.Constructors_for_derived_classes_must_contain_a_super_call=2377]="Constructors_for_derived_classes_must_contain_a_super_call",e[e._get_and_set_accessor_must_have_the_same_type=2380]="_get_and_set_accessor_must_have_the_same_type",e[e.Constructor_implementation_is_missing=2390]="Constructor_implementation_is_missing",e[e.Function_implementation_is_missing_or_not_immediately_following_the_declaration=2391]="Function_implementation_is_missing_or_not_immediately_following_the_declaration",e[e.Multiple_constructor_implementations_are_not_allowed=2392]="Multiple_constructor_implementations_are_not_allowed",e[e.Duplicate_function_implementation=2393]="Duplicate_function_implementation",e[e.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local=2395]="Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local",e[e.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged=2434]="A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged",e[e.Type_0_has_no_property_1=2460]="Type_0_has_no_property_1",e[e.The_0_operator_cannot_be_applied_to_type_1=2469]="The_0_operator_cannot_be_applied_to_type_1",e[e.In_const_enum_declarations_member_initializer_must_be_constant_expression=2474]="In_const_enum_declarations_member_initializer_must_be_constant_expression",e[e.Export_declaration_conflicts_with_exported_declaration_of_0=2484]="Export_declaration_conflicts_with_exported_declaration_of_0",e[e.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property=2540]="Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property",e[e.The_target_of_an_assignment_must_be_a_variable_or_a_property_access=2541]="The_target_of_an_assignment_must_be_a_variable_or_a_property_access",e[e.Index_signature_in_type_0_only_permits_reading=2542]="Index_signature_in_type_0_only_permits_reading",e[e.Expected_0_arguments_but_got_1=2554]="Expected_0_arguments_but_got_1",e[e.Expected_at_least_0_arguments_but_got_1=2555]="Expected_at_least_0_arguments_but_got_1",e[e.Expected_0_type_arguments_but_got_1=2558]="Expected_0_type_arguments_but_got_1",e[e.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums=2651]="A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums",e[e.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration=2673]="Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration",e[e.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration=2674]="Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration",e[e.Namespace_0_has_no_exported_member_1=2694]="Namespace_0_has_no_exported_member_1",e[e.Required_type_parameters_may_not_follow_optional_type_parameters=2706]="Required_type_parameters_may_not_follow_optional_type_parameters",e[e.Duplicate_property_0=2718]="Duplicate_property_0",e[e.File_0_not_found=6054]="File_0_not_found",e[e.Numeric_separators_are_not_allowed_here=6188]="Numeric_separators_are_not_allowed_here",e[e.Multiple_consecutive_numeric_separators_are_not_permitted=6189]="Multiple_consecutive_numeric_separators_are_not_permitted",e[e._super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class=17009]="_super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class",e[e._super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class=17011]="_super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class"}(t.DiagnosticCode||(t.DiagnosticCode={})),t.diagnosticCodeToString=function(e){switch(e){case 100:return"Operation not supported.";case 101:return"Operation is unsafe.";case 102:return"User-defined: {0}";case 200:return"Conversion from type '{0}' to '{1}' requires an explicit cast.";case 201:return"Conversion from type '{0}' to '{1}' will require an explicit cast when switching between 32/64-bit.";case 202:return"Type '{0}' cannot be changed to type '{1}'.";case 203:return"Type '{0}' cannot be reinterpreted as type '{1}'.";case 204:return"Basic type '{0}' cannot be nullable.";case 205:return"Cannot export a mutable global.";case 206:return"Compiling constant with non-constant initializer as mutable.";case 207:return"Unmanaged classes cannot extend managed classes and vice-versa.";case 208:return"Unmanaged classes cannot implement interfaces.";case 209:return"Invalid regular expression flags.";case 210:return"Implementation '{0}' must match the signature '{1}'.";case 211:return"Class '{0}' is sealed and cannot be extended.";case 212:return"Decorator '{0}' is not valid here.";case 213:return"Duplicate decorator.";case 214:return"An allocator must be declared to allocate memory. Try importing allocator/arena or allocator/tlsf.";case 215:return"Optional parameter must have an initializer.";case 216:return"Constructor of class '{0}' must not require any arguments.";case 217:return"Function '{0}' cannot be inlined into itself.";case 218:return"Cannot access method '{0}' without calling it as it requires 'this' to be set.";case 219:return"Optional properties are not supported.";case 220:return"Expression must be a compile-time constant.";case 221:return"Module cannot have multiple start functions.";case 1002:return"Unterminated string literal.";case 1003:return"Identifier expected.";case 1005:return"'{0}' expected.";case 1006:return"A file cannot have a reference to itself.";case 1009:return"Trailing comma not allowed.";case 1012:return"Unexpected token.";case 1014:return"A rest parameter must be last in a parameter list.";case 1015:return"Parameter cannot have question mark and initializer.";case 1016:return"A required parameter cannot follow an optional parameter.";case 1036:return"Statements are not allowed in ambient contexts.";case 1039:return"Initializers are not allowed in ambient contexts.";case 1042:return"'{0}' modifier cannot be used here.";case 1047:return"A rest parameter cannot be optional.";case 1048:return"A rest parameter cannot have an initializer.";case 1049:return"A 'set' accessor must have exactly one parameter.";case 1052:return"A 'set' accessor parameter cannot have an initializer.";case 1054:return"A 'get' accessor cannot have parameters.";case 1061:return"Enum member must have initializer.";case 1092:return"Type parameters cannot appear on a constructor declaration.";case 1093:return"Type annotation cannot appear on a constructor declaration.";case 1094:return"An accessor cannot have type parameters.";case 1095:return"A 'set' accessor cannot have a return type annotation.";case 1098:return"Type parameter list cannot be empty.";case 1104:return"A 'continue' statement can only be used within an enclosing iteration statement.";case 1105:return"A 'break' statement can only be used within an enclosing iteration or switch statement.";case 1108:return"A 'return' statement can only be used within a function body.";case 1109:return"Expression expected.";case 1110:return"Type expected.";case 1113:return"A 'default' clause cannot appear more than once in a 'switch' statement.";case 1114:return"Duplicate label '{0}'.";case 1121:return"Octal literals are not allowed in strict mode.";case 1124:return"Digit expected.";case 1125:return"Hexadecimal digit expected.";case 1126:return"Unexpected end of text.";case 1127:return"Invalid character.";case 1130:return"'case' or 'default' expected.";case 1034:return"'super' must be followed by an argument list or member access.";case 1038:return"A 'declare' modifier cannot be used in an already ambient context.";case 1140:return"Type argument expected.";case 1141:return"String literal expected.";case 1142:return"Line break not permitted here.";case 1146:return"Declaration expected.";case 1155:return"'const' declarations must be initialized.";case 1161:return"Unterminated regular expression literal.";case 1176:return"Interface declaration cannot have 'implements' clause.";case 1177:return"Binary digit expected.";case 1178:return"Octal digit expected.";case 1183:return"An implementation cannot be declared in ambient contexts.";case 1198:return"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.";case 1199:return"Unterminated Unicode escape sequence.";case 1206:return"Decorators are not valid here.";case 1242:return"'abstract' modifier can only appear on a class, method, or property declaration.";case 1245:return"Method '{0}' cannot have an implementation because it is marked abstract.";case 1255:return"A definite assignment assertion '!' is not permitted in this context.";case 1311:return"A class may only extend another class.";case 1317:return"A parameter property cannot be declared using a rest parameter.";case 2300:return"Duplicate identifier '{0}'.";case 2304:return"Cannot find name '{0}'.";case 2305:return"Module '{0}' has no exported member '{1}'.";case 2314:return"Generic type '{0}' requires {1} type argument(s).";case 2315:return"Type '{0}' is not generic.";case 2322:return"Type '{0}' is not assignable to type '{1}'.";case 2329:return"Index signature is missing in type '{0}'.";case 2332:return"'this' cannot be referenced in current location.";case 2335:return"'super' can only be referenced in a derived class.";case 2337:return"Super calls are not permitted outside constructors or in nested functions inside constructors.";case 2339:return"Property '{0}' does not exist on type '{1}'.";case 2349:return"Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.";case 2351:return"Cannot use 'new' with an expression whose type lacks a construct signature.";case 2355:return"A function whose declared type is not 'void' must return a value.";case 2357:return"The operand of an increment or decrement operator must be a variable or a property access.";case 2364:return"The left-hand side of an assignment expression must be a variable or a property access.";case 2365:return"Operator '{0}' cannot be applied to types '{1}' and '{2}'.";case 2376:return"A 'super' call must be the first statement in the constructor.";case 2377:return"Constructors for derived classes must contain a 'super' call.";case 2380:return"'get' and 'set' accessor must have the same type.";case 2390:return"Constructor implementation is missing.";case 2391:return"Function implementation is missing or not immediately following the declaration.";case 2392:return"Multiple constructor implementations are not allowed.";case 2393:return"Duplicate function implementation.";case 2395:return"Individual declarations in merged declaration '{0}' must be all exported or all local.";case 2434:return"A namespace declaration cannot be located prior to a class or function with which it is merged.";case 2460:return"Type '{0}' has no property '{1}'.";case 2469:return"The '{0}' operator cannot be applied to type '{1}'.";case 2474:return"In 'const' enum declarations member initializer must be constant expression.";case 2484:return"Export declaration conflicts with exported declaration of '{0}'.";case 2540:return"Cannot assign to '{0}' because it is a constant or a read-only property.";case 2541:return"The target of an assignment must be a variable or a property access.";case 2542:return"Index signature in type '{0}' only permits reading.";case 2554:return"Expected {0} arguments, but got {1}.";case 2555:return"Expected at least {0} arguments, but got {1}.";case 2558:return"Expected {0} type arguments, but got {1}.";case 2651:return"A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.";case 2673:return"Constructor of class '{0}' is private and only accessible within the class declaration.";case 2674:return"Constructor of class '{0}' is protected and only accessible within the class declaration.";case 2694:return"Namespace '{0}' has no exported member '{1}'.";case 2706:return"Required type parameters may not follow optional type parameters.";case 2718:return"Duplicate property '{0}'.";case 6054:return"File '{0}' not found.";case 6188:return"Numeric separators are not allowed here.";case 6189:return"Multiple consecutive numeric separators are not permitted.";case 17009:return"'super' must be called before accessing 'this' in the constructor of a derived class.";case 17011:return"'super' must be called before accessing a property of 'super' in the constructor of a derived class.";default:return""}}},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(6),a=r(3),o=r(4),s=r(0),c=r(1),l=r(2);!function(e){e[e.NONE=0]="NONE",e[e.RETURNS=1]="RETURNS",e[e.RETURNS_WRAPPED=2]="RETURNS_WRAPPED",e[e.THROWS=4]="THROWS",e[e.BREAKS=8]="BREAKS",e[e.CONTINUES=16]="CONTINUES",e[e.ALLOCATES=32]="ALLOCATES",e[e.CALLS_SUPER=64]="CALLS_SUPER",e[e.CONDITIONALLY_RETURNS=128]="CONDITIONALLY_RETURNS",e[e.CONDITIONALLY_THROWS=256]="CONDITIONALLY_THROWS",e[e.CONDITIONALLY_BREAKS=512]="CONDITIONALLY_BREAKS",e[e.CONDITIONALLY_CONTINUES=1024]="CONDITIONALLY_CONTINUES",e[e.CONDITIONALLY_ALLOCATES=2048]="CONDITIONALLY_ALLOCATES",e[e.INLINE_CONTEXT=4096]="INLINE_CONTEXT",e[e.UNCHECKED_CONTEXT=8192]="UNCHECKED_CONTEXT",e[e.ANY_TERMINATING=29]="ANY_TERMINATING",e[e.ANY_CATEGORICAL=127]="ANY_CATEGORICAL",e[e.ANY_CONDITIONAL=3968]="ANY_CONDITIONAL"}(t.FlowFlags||(t.FlowFlags={}));var p=function(){function e(){this.scopedLocals=null}return e.create=function(t){var r=new e;return r.parent=null,r.flags=0,r.parentFunction=t,r.continueLabel=null,r.breakLabel=null,r.returnType=t.signature.returnType,r.contextualTypeArguments=t.contextualTypeArguments,r.wrappedLocals=i64_new(0),r.wrappedLocalsExt=null,r.inlineFunction=null,r.inlineReturnLabel=null,r},e.createInline=function(t,r){var n=e.create(t);return n.set(4096),n.inlineFunction=r,n.inlineReturnLabel=r.internalName+"|inlined."+(r.nextInlineId++).toString(10),n.returnType=r.signature.returnType,n.contextualTypeArguments=r.contextualTypeArguments,n},Object.defineProperty(e.prototype,"actualFunction",{get:function(){return this.inlineFunction||this.parentFunction},enumerable:!0,configurable:!0}),e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.isAny=function(e){return 0!=(this.flags&e)},e.prototype.set=function(e){this.flags|=e},e.prototype.unset=function(e){this.flags&=~e},e.prototype.fork=function(){var t=new e;return t.parent=this,t.flags=this.flags,t.parentFunction=this.parentFunction,t.continueLabel=this.continueLabel,t.breakLabel=this.breakLabel,t.returnType=this.returnType,t.contextualTypeArguments=this.contextualTypeArguments,t.wrappedLocals=this.wrappedLocals,t.wrappedLocalsExt=this.wrappedLocalsExt?this.wrappedLocalsExt.slice():null,t.inlineFunction=this.inlineFunction,t.inlineReturnLabel=this.inlineReturnLabel,t},e.prototype.getTempLocal=function(e,t){void 0===t&&(t=!1);var r,n,i=this.parentFunction;switch(e.toNativeType()){case o.NativeType.I32:r=i.tempI32s;break;case o.NativeType.I64:r=i.tempI64s;break;case o.NativeType.F32:r=i.tempF32s;break;case o.NativeType.F64:r=i.tempF64s;break;default:throw new Error("concrete type expected")}return r&&r.length?((n=r.pop()).type=e,n.flags=s.CommonFlags.NONE):n=i.addLocal(e),e.is(36)&&this.setLocalWrapped(n.index,t),n},e.prototype.freeTempLocal=function(e){if(!e.is(s.CommonFlags.INLINED)){assert(e.index>=0);var t,r=this.parentFunction;switch(assert(null!=e.type),e.type.toNativeType()){case o.NativeType.I32:t=r.tempI32s||(r.tempI32s=[]);break;case o.NativeType.I64:t=r.tempI64s||(r.tempI64s=[]);break;case o.NativeType.F32:t=r.tempF32s||(r.tempF32s=[]);break;case o.NativeType.F64:t=r.tempF64s||(r.tempF64s=[]);break;default:throw new Error("concrete type expected")}assert(e.index>=0),t.push(e)}},e.prototype.getAndFreeTempLocal=function(e,t){var r,n,i=this.parentFunction;switch(e.toNativeType()){case o.NativeType.I32:r=i.tempI32s||(i.tempI32s=[]);break;case o.NativeType.I64:r=i.tempI64s||(i.tempI64s=[]);break;case o.NativeType.F32:r=i.tempF32s||(i.tempF32s=[]);break;case o.NativeType.F64:r=i.tempF64s||(i.tempF64s=[]);break;default:throw new Error("concrete type expected")}return r.length?(n=r[r.length-1]).type=e:(n=i.addLocal(e),r.push(n)),e.is(36)&&this.setLocalWrapped(n.index,t),n},e.prototype.addScopedLocal=function(e,t,r,n){void 0===n&&(n=null);var i=this.getTempLocal(t,!1);if(this.scopedLocals){var a=this.scopedLocals.get(e);if(a)return n&&this.parentFunction.program.error(c.DiagnosticCode.Duplicate_identifier_0,n.range),a}else this.scopedLocals=new Map;return i.set(s.CommonFlags.SCOPED),this.scopedLocals.set(e,i),t.is(36)&&this.setLocalWrapped(i.index,r),i},e.prototype.addScopedAlias=function(e,t,r,n){if(void 0===n&&(n=null),this.scopedLocals){var i=this.scopedLocals.get(e);if(i)return n&&this.parentFunction.program.error(c.DiagnosticCode.Duplicate_identifier_0,n.range),i}else this.scopedLocals=new Map;assert(r<this.parentFunction.localsByIndex.length);var o=new a.Local(e,r,t,this.parentFunction);return this.scopedLocals.set(e,o),o},e.prototype.freeScopedLocals=function(){var e,t;if(this.scopedLocals){try{for(var r=n(this.scopedLocals.values()),i=r.next();!i.done;i=r.next()){var a=i.value;a.is(s.CommonFlags.SCOPED)&&this.freeTempLocal(a)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.scopedLocals=null}},e.prototype.lookupLocal=function(e){var t,r=this;do{if((t=r.scopedLocals)&&t.has(e))return t.get(e)}while(r=r.parent);return this.parentFunction.localsByName.get(e)},e.prototype.lookup=function(e){var t=this.lookupLocal(e);return t||this.actualFunction.lookup(e)},e.prototype.isLocalWrapped=function(e){if(e<0)return!0;if(e<64)return l.bitsetIs(this.wrappedLocals,e);var t=this.wrappedLocalsExt,r=(e-64)/64|0;return!!(t&&r<t.length)&&l.bitsetIs(t[r],e-64*(r+1))},e.prototype.setLocalWrapped=function(e,t){if(!(e<0))if(e<64)this.wrappedLocals=l.bitsetSet(this.wrappedLocals,e,t);else{var r=this.wrappedLocalsExt,n=(e-64)/64|0;if(r)for(;r.length<=n;)r.push(i64_new(0));else{this.wrappedLocalsExt=r=new Array(n+1);for(var i=0;i<=n;++i)r[i]=i64_new(0)}r[n]=l.bitsetSet(r[n],e-64*(n+1),t)}},e.prototype.pushBreakLabel=function(){var e=this.parentFunction,t=e.nextBreakId++,r=e.breakStack;return r?r.push(t):e.breakStack=[t],e.breakLabel=t.toString(10)},e.prototype.popBreakLabel=function(){var e=this.parentFunction,t=assert(e.breakStack),r=assert(t.length);t.pop(),r>1?e.breakLabel=t[r-2].toString(10):(e.breakLabel=null,e.breakStack=null)},e.prototype.inherit=function(e){this.flags|=4095&e.flags,this.wrappedLocals=e.wrappedLocals,this.wrappedLocalsExt=e.wrappedLocalsExt},e.prototype.inheritConditional=function(e){e.is(1)&&this.set(128),e.is(4)&&this.set(256),e.is(8)&&e.breakLabel==this.breakLabel&&this.set(512),e.is(16)&&e.continueLabel==this.continueLabel&&this.set(1024),e.is(32)&&this.set(2048)},e.prototype.inheritMutual=function(e,t){this.flags|=e.flags&t.flags&127,this.flags|=3968&e.flags,this.flags|=3968&t.flags,this.wrappedLocals=i64_and(e.wrappedLocals,t.wrappedLocals);var r=e.wrappedLocalsExt,n=t.wrappedLocalsExt;if(null!=r&&null!=n){var i=this.wrappedLocalsExt,a=min(r.length,n.length);if(a){if(i)for(;i.length<a;)i.push(i64_new(0));else i=new Array(a);for(var o=0;o<a;++o)i[o]=i64_and(r[o],n[o])}}},e.prototype.canOverflow=function(e,t){if(assert(t!=i.Type.void),!t.is(36))return!1;var r;switch(o.getExpressionId(e)){case o.ExpressionId.GetLocal:var n=this.parentFunction.localsByIndex[o.getGetLocalIndex(e)];return!this.isLocalWrapped(n.index)||u(n.type,t);case o.ExpressionId.SetLocal:return assert(o.isTeeLocal(e)),this.canOverflow(o.getSetLocalValue(e),t);case o.ExpressionId.GetGlobal:var s=assert(this.parentFunction.program.elementsByName.get(assert(o.getGetGlobalName(e))));return assert(s.kind==a.ElementKind.GLOBAL),u(assert(s.type),t);case o.ExpressionId.Binary:switch(o.getBinaryOp(e)){case o.BinaryOp.EqI32:case o.BinaryOp.EqI64:case o.BinaryOp.EqF32:case o.BinaryOp.EqF64:case o.BinaryOp.NeI32:case o.BinaryOp.NeI64:case o.BinaryOp.NeF32:case o.BinaryOp.NeF64:case o.BinaryOp.LtI32:case o.BinaryOp.LtU32:case o.BinaryOp.LtI64:case o.BinaryOp.LtU64:case o.BinaryOp.LtF32:case o.BinaryOp.LtF64:case o.BinaryOp.LeI32:case o.BinaryOp.LeU32:case o.BinaryOp.LeI64:case o.BinaryOp.LeU64:case o.BinaryOp.LeF32:case o.BinaryOp.LeF64:case o.BinaryOp.GtI32:case o.BinaryOp.GtU32:case o.BinaryOp.GtI64:case o.BinaryOp.GtU64:case o.BinaryOp.GtF32:case o.BinaryOp.GtF64:case o.BinaryOp.GeI32:case o.BinaryOp.GeU32:case o.BinaryOp.GeI64:case o.BinaryOp.GeU64:case o.BinaryOp.GeF32:case o.BinaryOp.GeF64:return!1;case o.BinaryOp.MulI32:return!(o.getExpressionId(r=o.getBinaryLeft(e))==o.ExpressionId.Const&&(0==o.getConstValueI32(r)||1==o.getConstValueI32(r)&&!this.canOverflow(o.getBinaryRight(e),t))||o.getExpressionId(r=o.getBinaryRight(e))==o.ExpressionId.Const&&(0==o.getConstValueI32(r)||1==o.getConstValueI32(r)&&!this.canOverflow(o.getBinaryLeft(e),t)));case o.BinaryOp.AndI32:return!(o.getExpressionId(r=o.getBinaryLeft(e))==o.ExpressionId.Const&&o.getConstValueI32(r)<=t.computeSmallIntegerMask(i.Type.i32)||!this.canOverflow(r,t)||o.getExpressionId(r=o.getBinaryRight(e))==o.ExpressionId.Const&&o.getConstValueI32(r)<=t.computeSmallIntegerMask(i.Type.i32)||!this.canOverflow(r,t));case o.BinaryOp.ShlI32:var c=32-t.size;return o.getExpressionId(r=o.getBinaryRight(e))!=o.ExpressionId.Const||o.getConstValueI32(r)<c;case o.BinaryOp.ShrI32:c=32-t.size;return this.canOverflow(o.getBinaryLeft(e),t)&&(o.getExpressionId(r=o.getBinaryRight(e))!=o.ExpressionId.Const||o.getConstValueI32(r)<c);case o.BinaryOp.ShrU32:c=32-t.size;return t.is(1)?!(o.getExpressionId(r=o.getBinaryRight(e))==o.ExpressionId.Const&&o.getConstValueI32(r)>c):this.canOverflow(o.getBinaryLeft(e),t)&&!(o.getExpressionId(r=o.getBinaryRight(e))==o.ExpressionId.Const&&o.getConstValueI32(r)>=c);case o.BinaryOp.DivU32:case o.BinaryOp.RemI32:case o.BinaryOp.RemU32:return this.canOverflow(o.getBinaryLeft(e),t)||this.canOverflow(o.getBinaryRight(e),t)}break;case o.ExpressionId.Unary:switch(o.getUnaryOp(e)){case o.UnaryOp.EqzI32:case o.UnaryOp.EqzI64:return!1;case o.UnaryOp.ClzI32:case o.UnaryOp.CtzI32:case o.UnaryOp.PopcntI32:return t.size<7}break;case o.ExpressionId.Const:var l=0;switch(o.getExpressionType(e)){case o.NativeType.I32:l=o.getConstValueI32(e);break;case o.NativeType.I64:l=o.getConstValueI64Low(e);break;case o.NativeType.F32:l=i32(o.getConstValueF32(e));break;case o.NativeType.F64:l=i32(o.getConstValueF64(e));break;default:assert(!1)}switch(t.kind){case 0:return l<i8.MIN_VALUE||l>i8.MAX_VALUE;case 1:return l<i16.MIN_VALUE||l>i16.MAX_VALUE;case 5:return l<0||l>u8.MAX_VALUE;case 6:return l<0||l>u16.MAX_VALUE;case 10:return 0!=(-2&l)}break;case o.ExpressionId.Load:var p=void 0;switch(o.getLoadBytes(e)){case 1:p=o.isLoadSigned(e)?i.Type.i8:i.Type.u8;break;case 2:p=o.isLoadSigned(e)?i.Type.i16:i.Type.u16;break;default:p=o.isLoadSigned(e)?i.Type.i32:i.Type.u32}return u(p,t);case o.ExpressionId.Block:if(!o.getBlockName(e)){var _=assert(o.getBlockChildCount(e)),h=o.getBlockChild(e,_-1);return this.canOverflow(h,t)}break;case o.ExpressionId.If:return this.canOverflow(o.getIfTrue(e),t)||this.canOverflow(assert(o.getIfFalse(e)),t);case o.ExpressionId.Select:return this.canOverflow(o.getSelectThen(e),t)||this.canOverflow(o.getSelectElse(e),t);case o.ExpressionId.Call:var d=this.parentFunction.program,y=assert(d.instancesByName.get(assert(o.getCallTarget(e))));assert(y.kind==a.ElementKind.FUNCTION);var m=y.signature.returnType;return!y.flow.is(2)||u(m,t);case o.ExpressionId.Unreachable:return!1}return!0},e}();function u(e,t){return!e.is(4)||e.size>t.size||e.is(1)!=t.is(1)}t.Flow=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),i=function(){function e(){this.text=[],this.functionId=0}return e.decompile=function(t){var r=new e;return r.decompile(t),r.finish()},e.prototype.decompile=function(e){throw new Error("not implemented")},e.prototype.decompileFunction=function(e){var t=n.getFunctionName(e)||"$"+this.functionId.toString(10),r=n.getFunctionBody(e);this.push("function "),this.push(t),this.push("(");for(var i=0,o=n.getFunctionParamCount(e);i<o;++i)i>0&&this.push(", "),this.push("$"),this.push(i.toString(10)),this.push(": "),this.push(a(n.getFunctionParamType(e,i)));this.push("): "),this.push(a(n.getFunctionResultType(e))),this.push(" "),n.getExpressionId(r)!=n.ExpressionId.Block&&this.push("{\n"),this.decompileExpression(r),n.getExpressionId(r)!=n.ExpressionId.Block&&this.push("\n}\n"),++this.functionId},e.prototype.decompileExpression=function(e){var t,r,i,o,s=n.getExpressionId(e),c=n.getExpressionType(e);switch(s){case n.ExpressionId.Block:for(null!=(r=n.getBlockName(e))&&(this.push(r),this.push(": ")),this.push("{\n"),o=n.getBlockChildCount(e),i=0;i<o;++i)this.decompileExpression(n.getBlockChild(e,i));return void this.push("}\n");case n.ExpressionId.If:return void(c==n.NativeType.None?(this.push("if ("),this.decompileExpression(n.getIfCondition(e)),this.push(") "),this.decompileExpression(n.getIfTrue(e)),(t=n.getIfFalse(e))&&(this.push(" else "),this.decompileExpression(t))):(this.decompileExpression(n.getIfCondition(e)),this.push(" ? "),this.decompileExpression(n.getIfTrue(e)),this.push(" : "),this.decompileExpression(n.getIfFalse(e))));case n.ExpressionId.Loop:null!=(r=n.getLoopName(e))&&(this.push(r),this.push(": ")),this.push("do "),this.decompileExpression(n.getLoopBody(e)),this.push("while (0);\n");case n.ExpressionId.Break:return(t=n.getBreakCondition(e))&&(this.push("if ("),this.decompileExpression(t),this.push(") ")),void(null!=(r=n.getBreakName(e))?(this.push("break "),this.push(r),this.push(";\n")):this.push("break;\n"));case n.ExpressionId.Switch:case n.ExpressionId.Call:case n.ExpressionId.CallIndirect:throw new Error("not implemented");case n.ExpressionId.GetLocal:return this.push("$"),void this.push(n.getGetLocalIndex(e).toString(10));case n.ExpressionId.SetLocal:return this.push("$"),this.push(n.getSetLocalIndex(e).toString(10)),this.push(" = "),void this.decompileExpression(n.getSetLocalValue(e));case n.ExpressionId.GetGlobal:case n.ExpressionId.SetGlobal:throw new Error("not implemented");case n.ExpressionId.Load:return this.push("load<"),this.push(a(c)),this.push(">("),this.push(n.getLoadOffset(e).toString(10)),this.push(" + "),this.decompileExpression(n.getLoadPtr(e)),void this.push(")");case n.ExpressionId.Store:return this.push("store<"),this.push(a(c)),this.push(">("),this.push(n.getStoreOffset(e).toString(10)),this.push(" + "),this.decompileExpression(n.getStorePtr(e)),this.push(", "),this.decompileExpression(n.getStoreValue(e)),void this.push(")");case n.ExpressionId.Const:switch(c){case n.NativeType.I32:return void this.push(n.getConstValueI32(e).toString(10));case n.NativeType.I64:return void this.push(i64_to_string(i64_new(n.getConstValueI64Low(e),n.getConstValueI64High(e))));case n.NativeType.F32:return void this.push(n.getConstValueF32(e).toString(10));case n.NativeType.F64:return void this.push(n.getConstValueF64(e).toString(10))}break;case n.ExpressionId.Unary:switch(n.getUnaryOp(e)){case n.UnaryOp.ClzI32:return this.push("clz<i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CtzI32:return this.push("ctz<i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.PopcntI32:return this.push("popcnt<i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.NegF32:case n.UnaryOp.NegF64:return this.push("-"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.AbsF32:return this.push("abs<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CeilF32:return this.push("ceil<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.FloorF32:return this.push("floor<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.TruncF32:return this.push("trunc<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.NearestF32:return this.push("nearest<i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.SqrtF32:return this.push("sqrt<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.EqzI32:case n.UnaryOp.EqzI64:return this.push("!"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ClzI64:return this.push("clz<i64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CtzI64:return this.push("ctz<i64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.PopcntI64:return this.push("popcnt<i64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.AbsF64:return this.push("abs<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CeilF64:return this.push("ceil<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.FloorF64:return this.push("floor<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.TruncF64:return this.push("trunc<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.NearestF64:return this.push("nearest<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.SqrtF64:return this.push("sqrt<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ExtendI32:return this.push("<i64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ExtendU32:return this.push("<i64><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.WrapI64:case n.UnaryOp.TruncF32ToI32:return this.push("<i32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToI64:return this.push("<i64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToU32:return this.push("<i32><u32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToU64:return this.push("<i64><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToI32:return this.push("<i32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToI64:return this.push("<i64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToU32:return this.push("<i32><u32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToU64:return this.push("<i64><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ReinterpretF32:return this.push("reinterpret<f32,i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ReinterpretF64:return this.push("reinterpret<f64,i64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ConvertI32ToF32:return this.push("<f32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI32ToF64:return this.push("<f64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU32ToF32:return this.push("<f32><u32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU32ToF64:return this.push("<f64><u32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI64ToF32:return this.push("<f32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI64ToF64:return this.push("<f64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU64ToF32:return this.push("<f32><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU64ToF64:return this.push("<f64><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.PromoteF32:return this.push("<f64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.DemoteF64:return this.push("<f32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ReinterpretI32:return this.push("reinterpret<i32,f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ReinterpretI64:return this.push("reinterpret<i64,f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")")}break;case n.ExpressionId.Binary:switch(n.getBinaryOp(e)){case n.BinaryOp.AddI32:case n.BinaryOp.AddI64:case n.BinaryOp.AddF32:case n.BinaryOp.AddF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" + "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.SubI32:case n.BinaryOp.SubI64:case n.BinaryOp.SubF32:case n.BinaryOp.SubF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" - "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.MulI32:case n.BinaryOp.MulI64:case n.BinaryOp.MulF32:case n.BinaryOp.MulF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" * "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.DivI32:case n.BinaryOp.DivI64:case n.BinaryOp.DivF32:case n.BinaryOp.DivF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" / "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.DivU32:return this.push("<i32>(<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / <u32>"),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.RemI32:case n.BinaryOp.RemI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" % "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RemU32:return this.push("<i32>(<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / <u32>"),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.AndI32:case n.BinaryOp.AndI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" & "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.OrI32:case n.BinaryOp.OrI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" | "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.XorI32:case n.BinaryOp.XorI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" ^ "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.ShlI32:case n.BinaryOp.ShlI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" << "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.ShrU32:case n.BinaryOp.ShrU64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" >>> "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.ShrI32:case n.BinaryOp.ShrI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" >> "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RotlI32:return this.push("rotl<i32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.RotrI32:return this.push("rotr<i32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.EqI32:case n.BinaryOp.EqI64:case n.BinaryOp.EqF32:case n.BinaryOp.EqF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" == "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.NeI32:case n.BinaryOp.NeI64:case n.BinaryOp.NeF32:case n.BinaryOp.NeF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" != "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LtI32:case n.BinaryOp.LtI64:case n.BinaryOp.LtF32:case n.BinaryOp.LtF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" < "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LtU32:return this.push("<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" < <u32>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LeI32:case n.BinaryOp.LeI64:case n.BinaryOp.LeF32:case n.BinaryOp.LeF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" <= "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LeU32:return this.push("<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" <= <u32>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GtI32:case n.BinaryOp.GtI64:case n.BinaryOp.GtF32:case n.BinaryOp.GtF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" > "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GtU32:return this.push("<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" > <u32>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GeI32:case n.BinaryOp.GeI64:case n.BinaryOp.GeF32:case n.BinaryOp.GeF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" >= "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GeU32:return this.push("<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" >= <u32>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.DivU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RemU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" % <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RotlI64:return this.push("rotl<i64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.RotrI64:return this.push("rotr<i64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.LtU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" < <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LeU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" <= <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GtU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" > <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GeU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" >= <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.CopysignF32:return this.push("copysign<f32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MinF32:return this.push("min<f32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MaxF32:return this.push("max<f32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.CopysignF64:return this.push("copysign<f64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MinF64:return this.push("min<f64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MaxF64:return this.push("max<f64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")")}return;case n.ExpressionId.Select:return this.push("select<"),this.push(a(c)),this.push(">("),this.decompileExpression(n.getSelectThen(e)),this.push(", "),this.decompileExpression(n.getSelectElse(e)),this.push(", "),this.decompileExpression(n.getSelectCondition(e)),void this.push(")");case n.ExpressionId.Drop:return this.decompileExpression(n.getDropValue(e)),void this.push(";\n");case n.ExpressionId.Return:return void((t=n.getReturnValue(e))?(this.push("return "),this.decompileExpression(t),this.push(";\n")):this.push("return;\n"));case n.ExpressionId.Host:switch(n.getHostOp(e)){case n.HostOp.CurrentMemory:return void this.push("memory.size()");case n.HostOp.GrowMemory:return this.push("memory.grow("),this.decompileExpression(n.getHostOperand(e,0)),void this.push(")")}break;case n.ExpressionId.Nop:return void this.push(";\n");case n.ExpressionId.Unreachable:return void this.push("unreachable()");case n.ExpressionId.AtomicCmpxchg:case n.ExpressionId.AtomicRMW:case n.ExpressionId.AtomicWait:case n.ExpressionId.AtomicWake:}throw new Error("not implemented")},e.prototype.push=function(e){this.text.push(e)},e.prototype.finish=function(){var e=this.text.join("");return this.text=[],e},e}();function a(e){switch(e){case n.NativeType.None:return"void";case n.NativeType.I32:return"i32";case n.NativeType.I64:return"i64";case n.NativeType.F32:return"f32";case n.NativeType.F64:return"f64";case n.NativeType.V128:return"v128";case n.NativeType.Unreachable:throw new Error("unreachable type");case n.NativeType.Auto:throw new Error("auto type");default:throw new Error("unexpected type")}}t.Decompiler=i},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0});var s=r(0),c=r(3),l=r(2),p=function(){function e(e,t){void 0===t&&(t=!1),this.todo=[],this.seen=new Set,this.program=e,this.includePrivate}return e.prototype.walk=function(){var e,t,r,n;try{for(var i=a(this.program.filesByName.values()),o=i.next();!o.done;o=i.next()){var s=o.value.members;if(s)try{for(var c=a(s.values()),l=c.next();!l.done;l=c.next()){var p=l.value;this.visitElement(p)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}for(var u=this.todo;0<u.length;)this.visitElement(u[0])},e.prototype.visitElement=function(e){if((!e.is(s.CommonFlags.PRIVATE)||this.includePrivate)&&!this.seen.has(e))switch(this.seen.add(e),e.kind){case c.ElementKind.GLOBAL:e.is(s.CommonFlags.COMPILED)&&this.visitGlobal(e);break;case c.ElementKind.ENUM:e.is(s.CommonFlags.COMPILED)&&this.visitEnum(e);break;case c.ElementKind.FUNCTION_PROTOTYPE:this.visitFunctionInstances(e);break;case c.ElementKind.CLASS_PROTOTYPE:this.visitClassInstances(e);break;case c.ElementKind.FIELD:e.is(s.CommonFlags.COMPILED)&&this.visitField(e);break;case c.ElementKind.PROPERTY_PROTOTYPE:this.visitPropertyInstances(e);break;case c.ElementKind.PROPERTY:var t=e,r=t.getterInstance;r&&this.visitFunction(r);var n=t.setterInstance;n&&this.visitFunction(n);break;case c.ElementKind.NAMESPACE:(function e(t){var r,n,i,o,l,p;var u=t.members;if(u)try{for(var _=a(u.values()),h=_.next();!h.done;h=_.next()){var d=h.value;switch(d.kind){case c.ElementKind.FUNCTION_PROTOTYPE:var y=d.instances;if(y)try{for(var m=a(y.values()),g=m.next();!g.done;g=m.next()){var T=g.value;if(T.is(s.CommonFlags.COMPILED))return!0}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(i)throw i.error}}break;case c.ElementKind.CLASS_PROTOTYPE:var y=d.instances;if(y)try{for(var f=a(y.values()),E=f.next();!E.done;E=f.next()){var T=E.value;if(T.is(s.CommonFlags.COMPILED))return!0}}catch(e){l={error:e}}finally{try{E&&!E.done&&(p=f.return)&&p.call(f)}finally{if(l)throw l.error}}break;default:if(d.is(s.CommonFlags.COMPILED)||e(d))return!0}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}return!1})(e)&&this.visitNamespace(e);break;case c.ElementKind.TYPEDEFINITION:break;default:assert(!1)}},e.prototype.visitFunctionInstances=function(e){var t,r,n=e.instances;if(n)try{for(var i=a(n.values()),o=i.next();!o.done;o=i.next()){var c=o.value;c.is(s.CommonFlags.COMPILED)&&this.visitFunction(c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},e.prototype.visitClassInstances=function(e){var t,r,n=e.instances;if(n)try{for(var i=a(n.values()),o=i.next();!o.done;o=i.next()){var c=o.value;c.is(s.CommonFlags.COMPILED)&&this.visitClass(c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},e.prototype.visitPropertyInstances=function(e){assert(!1)},e}(),u=function(e){function t(t,r){void 0===r&&(r=!1);var n=e.call(this,t,r)||this;return n.sb=[],n.indentLevel=0,n}return i(t,e),t.build=function(e){return new t(e).build()},t.prototype.visitGlobal=function(e){var t=this.sb,r=e.is(s.CommonFlags.INLINED);if(l.indent(t,this.indentLevel),r&&t.push("const "),t.push(this.typeToString(e.type)),t.push(" "),t.push(e.name),r)switch(e.constantValueKind){case 1:t.push(" = "),t.push(i64_to_string(e.constantIntegerValue));break;case 2:t.push(" = "),t.push(e.constantFloatValue.toString());break;default:assert(!1)}t.push(";\n")},t.prototype.visitEnum=function(e){var t,r,n,i,p=this.sb;l.indent(p,this.indentLevel++),p.push("interface "),p.push(e.name),p.push(" {\n");var u=e.members;if(u){try{for(var _=a(u),h=_.next();!h.done;h=_.next()){var d=o(h.value,2),y=d[0];if((f=d[1]).kind==c.ElementKind.ENUMVALUE){var m=f.is(s.CommonFlags.INLINED);l.indent(p,this.indentLevel),m?p.push("const "):p.push("readonly "),p.push("unsigned long "),p.push(y),m&&(p.push(" = "),assert(1==f.constantValueKind),p.push(i64_low(f.constantIntegerValue).toString(10))),p.push(";\n")}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(r=_.return)&&r.call(_)}finally{if(t)throw t.error}}try{for(var g=a(u.values()),T=g.next();!T.done;T=g.next()){var f;(f=T.value).kind!=c.ElementKind.ENUMVALUE&&this.visitElement(f)}}catch(e){n={error:e}}finally{try{T&&!T.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}l.indent(p,--this.indentLevel),p.push("}\n")},t.prototype.visitFunction=function(e){var t,r,n=this.sb,i=e.signature;l.indent(n,this.indentLevel),n.push(this.typeToString(i.returnType)),n.push(" "),n.push(e.name),n.push("(");for(var o=i.parameterTypes,s=o.length,c=0;c<s;++c)c&&n.push(", "),n.push(this.typeToString(o[c])),n.push(" "),n.push(i.getParameterName(c));n.push(");\n");var p=e.members;if(p&&p.size){l.indent(n,this.indentLevel),n.push("interface "),n.push(e.name),n.push(" {\n");try{for(var u=a(p.values()),_=u.next();!_.done;_=u.next()){var h=_.value;this.visitElement(h)}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}l.indent(n,--this.indentLevel),n.push("}\n")}},t.prototype.visitClass=function(e){var t=this.sb;l.indent(t,this.indentLevel++),t.push("interface "),t.push(e.name),t.push(" {\n"),l.indent(t,--this.indentLevel),t.push("}\n")},t.prototype.visitInterface=function(e){this.visitClass(e)},t.prototype.visitField=function(e){},t.prototype.visitNamespace=function(e){var t,r,n=this.sb;l.indent(n,this.indentLevel++),n.push("interface "),n.push(e.name),n.push(" {\n");var i=e.members;if(i)try{for(var o=a(i.values()),s=o.next();!s.done;s=o.next()){var c=s.value;this.visitElement(c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}l.indent(n,--this.indentLevel),n.push("}\n")},t.prototype.typeToString=function(e){switch(e.kind){case 0:return"byte";case 1:return"short";case 2:return"long";case 3:return"long long";case 4:return this.program.options.isWasm64?"long long":"long";case 5:return"octet";case 6:return"unsigned short";case 7:return"unsigned long";case 8:return"unsigned long long";case 9:return this.program.options.isWasm64?"unsigned long long":"unsigned long";case 10:return"boolean";case 11:return"unrestricted float";case 12:return"unrestricted double";case 14:return"void";default:return assert(!1),""}},t.prototype.build=function(){var e=this.sb;return e.push("interface ASModule {\n"),++this.indentLevel,this.walk(),--this.indentLevel,e.push("}\n"),e.join("")},t}(p);t.IDLBuilder=u;var _=function(e){function t(t,r){void 0===r&&(r=!1);var n=e.call(this,t,r)||this;return n.sb=[],n.indentLevel=0,n}return i(t,e),t.build=function(e){return new t(e).build()},t.prototype.visitGlobal=function(e){var t=this.sb,r=e.is(s.CommonFlags.INLINED);l.indent(t,this.indentLevel),e.is(s.CommonFlags.STATIC)?r?t.push("static readonly "):t.push("static "):r?t.push("const "):t.push("var "),t.push(e.name),t.push(": "),t.push(this.typeToString(e.type)),t.push(";\n"),this.visitNamespace(e)},t.prototype.visitEnum=function(e){var t,r,n=this.sb;l.indent(n,this.indentLevel++),n.push("enum "),n.push(e.name),n.push(" {\n");var i=e.members;if(i){var p=i.size;try{for(var u=a(i),_=u.next();!_.done;_=u.next()){var h=o(_.value,2),d=h[0],y=h[1];y.kind==c.ElementKind.ENUMVALUE&&(l.indent(n,this.indentLevel),n.push(d),y.is(s.CommonFlags.INLINED)&&(n.push(" = "),assert(1==y.constantValueKind),n.push(i64_low(y.constantIntegerValue).toString(10))),n.push(",\n"),--p)}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}p&&this.visitNamespace(e)}l.indent(n,--this.indentLevel),n.push("}\n")},t.prototype.visitFunction=function(e){if(!e.isAny(s.CommonFlags.PRIVATE|s.CommonFlags.SET)){var t=this.sb,r=e.signature;if(l.indent(t,this.indentLevel),e.is(s.CommonFlags.PROTECTED)&&t.push("protected "),e.is(s.CommonFlags.STATIC)&&t.push("static "),e.is(s.CommonFlags.GET))return t.push(e.identifierNode.text),t.push(": "),t.push(this.typeToString(r.returnType)),void t.push(";\n");e.isAny(s.CommonFlags.STATIC|s.CommonFlags.INSTANCE)||t.push("function "),t.push(e.name),t.push("(");for(var n=r.parameterTypes,i=n.length,a=0;a<i;++a)a&&t.push(", "),t.push(r.getParameterName(a)),t.push(": "),t.push(this.typeToString(n[a]));e.isAny(s.CommonFlags.CONSTRUCTOR|s.CommonFlags.SET)?t.push(")"):(t.push("): "),t.push(this.typeToString(r.returnType))),t.push(";\n"),this.visitNamespace(e)}},t.prototype.visitClass=function(e){var t,r,n,i,o=this.sb,p=e.kind==c.ElementKind.INTERFACE;l.indent(o,this.indentLevel++),p?o.push("interface "):(e.is(s.CommonFlags.ABSTRACT)&&o.push("abstract "),o.push("class ")),o.push(e.name);var u=e.base;u&&u.is(s.CommonFlags.COMPILED|s.CommonFlags.MODULE_EXPORT)&&(o.push(" extends "),o.push(u.name)),o.push(" {\n");var _=e.parent.members;if(_)try{for(var h=a(_.values()),d=h.next();!d.done;d=h.next()){var y=d.value;this.visitElement(y)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}var m=e.constructorInstance;if(m&&this.visitFunction(m),_=e.members)try{for(var g=a(_.values()),T=g.next();!T.done;T=g.next()){y=T.value;this.visitElement(y)}}catch(e){n={error:e}}finally{try{T&&!T.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}l.indent(o,--this.indentLevel),o.push("}\n")},t.prototype.visitInterface=function(e){this.visitClass(e)},t.prototype.visitField=function(e){if(!e.is(s.CommonFlags.PRIVATE)){var t=this.sb;l.indent(t,this.indentLevel),e.is(s.CommonFlags.PROTECTED)&&t.push("protected "),e.is(s.CommonFlags.STATIC)&&t.push("static "),e.is(s.CommonFlags.READONLY)&&t.push("readonly "),t.push(e.name),t.push(": "),t.push(this.typeToString(e.type)),t.push(";\n")}},t.prototype.visitNamespace=function(e){var t,r,n=e.members;if(n&&n.size){var i=this.sb;l.indent(i,this.indentLevel++),i.push("namespace "),i.push(e.name),i.push(" {\n");try{for(var o=a(n.values()),s=o.next();!s.done;s=o.next()){var c=s.value;this.visitElement(c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}l.indent(i,--this.indentLevel),i.push("}\n")}},t.prototype.typeToString=function(e){switch(e.kind){case 0:return"i8";case 1:return"i16";case 2:return"i32";case 3:return"I64";case 4:return this.program.options.isWasm64?"I64":"i32";case 5:return"u8";case 6:return"u16";case 7:return"u32";case 8:return"U64";case 9:return this.program.options.isWasm64?"U64":"u32";case 10:return"bool";case 11:return"f32";case 12:return"f64";case 13:return"v128";case 14:return"void";default:return assert(!1),""}},t.prototype.build=function(){var e=this.sb;return e.push("declare module ASModule {\n"),e.push(" type i8 = number;\n"),e.push(" type i16 = number;\n"),e.push(" type i32 = number;\n"),e.push(" type u8 = number;\n"),e.push(" type u16 = number;\n"),e.push(" type u32 = number;\n"),e.push(" type f32 = number;\n"),e.push(" type f64 = number;\n"),e.push(" type bool = any;\n"),++this.indentLevel,this.walk(),--this.indentLevel,e.push("}\n"),e.push("export default ASModule;\n"),this.sb.join("")},t}(p);t.TSDBuilder=_},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),o=r(3),s=r(7),c=r(1),l=r(2),p=r(5),u=function(e){function t(){var t=e.call(this)||this;return t.backlog=new Array,t.seenlog=new Set,t.donelog=new Set,t.onComment=null,t.tryParseSignatureIsSignature=!1,t.parseParametersThis=null,t.program=new o.Program(t.diagnostics),t}return i(t,e),t.prototype.parseFile=function(e,t,r){var n=l.normalizePath(t),i=p.mangleInternalPath(n);if(!this.donelog.has(i)){this.donelog.add(i),this.seenlog.add(i);var o=new p.Source(n,e,r?p.SourceKind.ENTRY:t.startsWith(a.LIBRARY_PREFIX)&&t.indexOf(a.PATH_DELIMITER,a.LIBRARY_PREFIX.length)<0?p.SourceKind.LIBRARY:p.SourceKind.DEFAULT),c=this.program;c.sources.push(o);var u=new s.Tokenizer(o,c.diagnostics);u.onComment=this.onComment,o.tokenizer=u;for(var _=o.statements;!u.skip(s.Token.ENDOFFILE);){var h=this.parseTopLevelStatement(u,null);h&&_.push(h)}u.finish()}},t.prototype.parseTopLevelStatement=function(e,t){void 0===t&&(t=null);for(var r=a.CommonFlags.NONE,n=-1,i=null;e.skip(s.Token.AT);){n<0&&(n=e.tokenPos);var o=this.parseDecorator(e);o?(i||(i=[]),i.push(o)):this.skipStatement(e)}var l=0,p=0;e.skip(s.Token.EXPORT)&&(e.skip(s.Token.DEFAULT)&&this.error(c.DiagnosticCode.Operation_not_supported,e.range()),n<0&&(n=e.tokenPos),r|=a.CommonFlags.EXPORT,l=e.tokenPos,p=e.pos);var u=null!=t&&t.is(a.CommonFlags.AMBIENT);e.skip(s.Token.DECLARE)?(n<0&&(n=e.tokenPos),u&&this.error(c.DiagnosticCode.A_declare_modifier_cannot_be_used_in_an_already_ambient_context,e.range()),r|=a.CommonFlags.DECLARE|a.CommonFlags.AMBIENT):u&&(r|=a.CommonFlags.AMBIENT);var _=null,h=e.peek();switch(n<0&&(n=e.nextTokenPos),h){case s.Token.CONST:e.next(),r|=a.CommonFlags.CONST,_=e.skip(s.Token.ENUM)?this.parseEnum(e,r,i,n):this.parseVariable(e,r,i,n),i=null;break;case s.Token.LET:r|=a.CommonFlags.LET;case s.Token.VAR:e.next(),_=this.parseVariable(e,r,i,n),i=null;break;case s.Token.ENUM:e.next(),_=this.parseEnum(e,r,i,n),i=null;break;case s.Token.FUNCTION:e.next(),_=this.parseFunction(e,r,i,n),i=null;break;case s.Token.ABSTRACT:var d=e.mark();if(e.next(),!e.skip(s.Token.CLASS)){e.reset(d),_=this.parseStatement(e,!0);break}e.discard(d),r|=a.CommonFlags.ABSTRACT;case s.Token.CLASS:case s.Token.INTERFACE:e.next(),_=this.parseClassOrInterface(e,r,i,n),i=null;break;case s.Token.NAMESPACE:d=e.mark();e.next(),e.peek(!1,s.IdentifierHandling.PREFER)==s.Token.IDENTIFIER?(e.discard(d),_=this.parseNamespace(e,r,i,n),i=null):(e.reset(d),_=this.parseStatement(e,!0));break;case s.Token.IMPORT:e.next(),_=(r|=a.CommonFlags.IMPORT)&a.CommonFlags.EXPORT?this.parseExportImport(e,n):this.parseImport(e);break;case s.Token.TYPE:d=e.mark();e.next(),e.peek(!1,s.IdentifierHandling.PREFER)==s.Token.IDENTIFIER?(e.discard(d),_=this.parseTypeDeclaration(e,r,i,n),i=null):(e.reset(d),_=this.parseStatement(e,!0));break;default:r&a.CommonFlags.EXPORT?_=this.parseExport(e,n,0!=(r&a.CommonFlags.DECLARE)):(p&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(l,p),"export"),t||(_=this.parseStatement(e,!0)))}if(i)for(var y=0,m=i.length;y<m;++y)this.error(c.DiagnosticCode.Decorators_are_not_valid_here,i[y].range);return _},t.prototype.nextFile=function(){var e=this.backlog;return e.length?e.shift():null},t.prototype.finish=function(){if(this.backlog.length)throw new Error("backlog is not empty");return this.backlog=[],this.seenlog.clear(),this.donelog.clear(),this.program},t.prototype.parseType=function(e,t,r){void 0===t&&(t=!0),void 0===r&&(r=!1);var n,i=e.next(),a=e.tokenPos;if(i==s.Token.OPENPAREN){var o=e.skip(s.Token.OPENPAREN),l=this.tryParseSignature(e);if(l){if(o){if(!e.skip(s.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null;if(!e.skip(s.Token.BAR))return this.error(c.DiagnosticCode._0_expected,e.range(),"|"),null;e.skip(s.Token.NULL)||this.error(c.DiagnosticCode._0_expected,e.range(),"null"),l.isNullable=!0}return l}if(o||this.tryParseSignatureIsSignature)return this.error(c.DiagnosticCode.Unexpected_token,e.range()),null;if(!t)return this.error(c.DiagnosticCode.Unexpected_token,e.range()),null;var u=this.parseType(e,!1,r);if(!u)return null;if(!e.skip(s.Token.CLOSEPAREN))return r||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"}"),null;(n=u).range.start=a,n.range.end=e.pos}else if(i==s.Token.VOID)n=p.Node.createType(p.Node.createSimpleTypeName("void",e.range()),[],!1,e.range(a,e.pos));else if(i==s.Token.THIS)n=p.Node.createType(p.Node.createSimpleTypeName("this",e.range()),[],!1,e.range(a,e.pos));else if(i==s.Token.TRUE||i==s.Token.FALSE)n=p.Node.createType(p.Node.createSimpleTypeName("bool",e.range()),[],!1,e.range(a,e.pos));else if(i==s.Token.STRINGLITERAL)e.readString(),n=p.Node.createType(p.Node.createSimpleTypeName("string",e.range()),[],!1,e.range(a,e.pos));else{if(i!=s.Token.IDENTIFIER)return r||this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;for(var _=p.Node.createSimpleTypeName(e.readIdentifier(),e.range()),h=_,d=new Array,y=!1;e.skip(s.Token.DOT);){if(!e.skip(s.Token.IDENTIFIER))return this.error(c.DiagnosticCode.Identifier_expected,e.range(e.pos)),null;var m=p.Node.createSimpleTypeName(e.readIdentifier(),e.range());h.next=m,h=m}if(e.skip(s.Token.LESSTHAN)){do{var g=this.parseType(e,!0,r);if(!g)return null;d.push(g)}while(e.skip(s.Token.COMMA));if(!e.skip(s.Token.GREATERTHAN))return r||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),">"),null}for(;e.skip(s.Token.BAR);){if(!e.skip(s.Token.NULL))return r||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"null"),null;y=!0}n=p.Node.createType(_,d,y,e.range(a,e.pos))}for(;e.skip(s.Token.OPENBRACKET);){var T=e.tokenPos;if(!e.skip(s.Token.CLOSEBRACKET))return r||this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null;var f=e.range(T,e.pos);y=!1;if(e.skip(s.Token.BAR)){if(!e.skip(s.Token.NULL))return r||this.error(c.DiagnosticCode._0_expected,e.range(),"null"),null;y=!0}if(n=p.Node.createType(p.Node.createSimpleTypeName("Array",f),[n],y,e.range(a,e.pos)),y)break}return n},t.prototype.tryParseSignature=function(e){var t,r=e.mark(),n=e.tokenPos,i=null,a=null,o=!1;if(e.skip(s.Token.CLOSEPAREN))o=!0,e.discard(r),i=[];else{o=!1;do{var l=p.ParameterKind.DEFAULT;if(e.skip(s.Token.DOT_DOT_DOT)&&(o=!0,e.discard(r),l=p.ParameterKind.REST),e.skip(s.Token.THIS)){if(!e.skip(s.Token.COLON))return e.reset(r),this.tryParseSignatureIsSignature=!1,null;o=!0,e.discard(r);var u=this.parseType(e,!1);if(!u)return null;if(u.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,u.range),this.tryParseSignatureIsSignature=!0,null;a=u}else{if(!e.skipIdentifier())return o?this.error(c.DiagnosticCode.Identifier_expected,e.range()):e.reset(r),this.tryParseSignatureIsSignature=o,null;var _=p.Node.createIdentifierExpression(e.readIdentifier(),e.range(e.tokenPos,e.pos));if(e.skip(s.Token.QUESTION)&&(o=!0,e.discard(r),l==p.ParameterKind.REST?this.error(c.DiagnosticCode.A_rest_parameter_cannot_be_optional,e.range()):l=p.ParameterKind.OPTIONAL),e.skip(s.Token.COLON)){o=!0,e.discard(r);var h=this.parseType(e);if(!h)return this.tryParseSignatureIsSignature=o,null;var d=new p.ParameterNode;d.parameterKind=l,d.name=_,d.type=h,i?i.push(d):i=[d]}else o&&this.error(c.DiagnosticCode.Type_expected,e.range())}}while(e.skip(s.Token.COMMA));if(!e.skip(s.Token.CLOSEPAREN))return o?this.error(c.DiagnosticCode._0_expected,e.range(),")"):e.reset(r),this.tryParseSignatureIsSignature=o,null}return e.skip(s.Token.EQUALS_GREATERTHAN)?(o=!0,e.discard(r),(t=this.parseType(e))?(this.tryParseSignatureIsSignature=!0,p.Node.createSignature(i||[],t,a,!1,e.range(n,e.pos))):(this.tryParseSignatureIsSignature=o,null)):(o?this.error(c.DiagnosticCode._0_expected,e.range(),"=>"):e.reset(r),this.tryParseSignatureIsSignature=o,null)},t.prototype.parseDecorator=function(e){var t=e.tokenPos;if(e.skipIdentifier()){for(var r=e.readIdentifier(),n=p.Node.createIdentifierExpression(r,e.range(t,e.pos));e.skip(s.Token.DOT);){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;r=e.readIdentifier(),n=p.Node.createPropertyAccessExpression(n,p.Node.createIdentifierExpression(r,e.range()),e.range(t,e.pos))}var i=void 0;if(!e.skip(s.Token.OPENPAREN))return p.Node.createDecorator(n,null,e.range(t,e.pos));if(i=this.parseArguments(e))return p.Node.createDecorator(n,i,e.range(t,e.pos))}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseVariable=function(e,t,r,n){var i=new Array;do{var a=this.parseVariableDeclaration(e,t,r);if(!a)return null;i.push(a)}while(e.skip(s.Token.COMMA));var o=p.Node.createVariableStatement(i,r,e.range(n,e.pos));return e.skip(s.Token.SEMICOLON),o},t.prototype.parseVariableDeclaration=function(e,t,r){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var n=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),i=t;e.skip(s.Token.EXCLAMATION)&&(i|=a.CommonFlags.DEFINITE_ASSIGNMENT);var o=null;e.skip(s.Token.COLON)&&(o=this.parseType(e));var l=null;if(e.skip(s.Token.EQUALS)){if(i&a.CommonFlags.AMBIENT&&this.error(c.DiagnosticCode.Initializers_are_not_allowed_in_ambient_contexts,e.range()),!(l=this.parseExpression(e,2)))return null}else i&a.CommonFlags.CONST?i&a.CommonFlags.AMBIENT||this.error(c.DiagnosticCode._const_declarations_must_be_initialized,n.range):o||this.error(c.DiagnosticCode.Type_expected,e.range(e.pos));var u=s.Range.join(n.range,e.range());return i&a.CommonFlags.DEFINITE_ASSIGNMENT&&l&&this.error(c.DiagnosticCode.A_definite_assignment_assertion_is_not_permitted_in_this_context,u),p.Node.createVariableDeclaration(n,o,l,r,i,u)},t.prototype.parseEnum=function(e,t,r,n){if(e.next()!=s.Token.IDENTIFIER)return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.next()!=s.Token.OPENBRACE)return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(var o=new Array;!e.skip(s.Token.CLOSEBRACE);){var l=this.parseEnumValue(e,a.CommonFlags.NONE);if(!l)return null;if(o.push(l),!e.skip(s.Token.COMMA)){if(e.skip(s.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}var u=p.Node.createEnumDeclaration(i,o,r,t,e.range(n,e.pos));return e.skip(s.Token.SEMICOLON),u},t.prototype.parseEnumValue=function(e,t){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),n=null;return e.skip(s.Token.EQUALS)&&!(n=this.parseExpression(e,2))?null:p.Node.createEnumValueDeclaration(r,n,t,s.Range.join(r.range,e.range()))},t.prototype.parseReturn=function(e){var t=null;if(e.peek(!0)!=s.Token.SEMICOLON&&e.nextToken!=s.Token.CLOSEBRACE&&!e.nextTokenOnNewLine&&!(t=this.parseExpression(e)))return null;var r=p.Node.createReturnStatement(t,e.range());return e.skip(s.Token.SEMICOLON),r},t.prototype.parseTypeParameters=function(e){for(var t=new Array,r=!1;!e.skip(s.Token.GREATERTHAN);){var n=this.parseTypeParameter(e);if(!n)return null;if(null!==n.defaultType?r=!0:r&&(this.error(c.DiagnosticCode.Required_type_parameters_may_not_follow_optional_type_parameters,n.range),n.defaultType=null),t.push(n),!e.skip(s.Token.COMMA)){if(e.skip(s.Token.GREATERTHAN))break;return this.error(c.DiagnosticCode._0_expected,e.range(),">"),null}}return 0===t.length&&this.error(c.DiagnosticCode.Type_parameter_list_cannot_be_empty,e.range()),t},t.prototype.parseTypeParameter=function(e){if(e.next()==s.Token.IDENTIFIER){var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(s.Token.EXTENDS)){if(!(i=this.parseType(e)))return null;if(i.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,i.range),null;r=i}var n=null;if(e.skip(s.Token.EQUALS)){var i;if(!(i=this.parseType(e)))return null;if(i.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,i.range),null;n=i}return p.Node.createTypeParameter(t,r,n,s.Range.join(t.range,e.range()))}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseParameters=function(e,t){void 0===t&&(t=!1);var r=new Array,n=null,i=!1,a=!1,o=null;if(this.parseParametersThis=null,e.skip(s.Token.THIS)){if(!e.skip(s.Token.COLON))return this.error(c.DiagnosticCode._0_expected,e.range(),":"),null;if(!(o=this.parseType(e)))return null;if(o.kind==p.NodeKind.TYPE?this.parseParametersThis=o:this.error(c.DiagnosticCode.Operation_not_supported,o.range),!e.skip(s.Token.COMMA))return e.skip(s.Token.CLOSEPAREN)?r:(this.error(c.DiagnosticCode._0_expected,e.range(),")"),null)}for(;!e.skip(s.Token.CLOSEPAREN);){var l=this.parseParameter(e,t);if(!l)return null;switch(n&&!a&&(this.error(c.DiagnosticCode.A_rest_parameter_must_be_last_in_a_parameter_list,n.name.range),a=!0),l.parameterKind){default:i&&this.error(c.DiagnosticCode.A_required_parameter_cannot_follow_an_optional_parameter,l.name.range);break;case p.ParameterKind.OPTIONAL:i=!0;break;case p.ParameterKind.REST:n=l}if(r.push(l),!e.skip(s.Token.COMMA)){if(e.skip(s.Token.CLOSEPAREN))break;return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null}}return r},t.prototype.parseParameter=function(e,t){void 0===t&&(t=!1);var r=!1,n=!1,i=null,o=a.CommonFlags.NONE;if(t&&(e.skip(s.Token.PUBLIC)?(i=e.range(),o|=a.CommonFlags.PUBLIC):e.skip(s.Token.PROTECTED)?(i=e.range(),o|=a.CommonFlags.PROTECTED):e.skip(s.Token.PRIVATE)&&(i=e.range(),o|=a.CommonFlags.PRIVATE),e.peek()==s.Token.READONLY)){var l=e.mark();e.next(),e.peek()!=s.Token.COLON?(e.discard(l),i||(i=e.range()),o|=a.CommonFlags.READONLY):e.reset(l)}if(e.skip(s.Token.DOT_DOT_DOT)&&(o?this.error(c.DiagnosticCode.A_parameter_property_cannot_be_declared_using_a_rest_parameter,e.range()):i=e.range(),r=!0),e.skipIdentifier()){r||(i=e.range());var u=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),_=null;if((n=e.skip(s.Token.QUESTION))&&r&&this.error(c.DiagnosticCode.A_rest_parameter_cannot_be_optional,u.range),e.skip(s.Token.COLON)){if(!(_=this.parseType(e)))return null}else _=p.Node.createOmittedType(e.range(e.pos));var h=null;if(e.skip(s.Token.EQUALS)&&(r&&this.error(c.DiagnosticCode.A_rest_parameter_cannot_have_an_initializer,u.range),n?this.error(c.DiagnosticCode.Parameter_cannot_have_question_mark_and_initializer,u.range):n=!0,!(h=this.parseExpression(e,2))))return null;var d=p.Node.createParameter(u,_,h,r?p.ParameterKind.REST:n?p.ParameterKind.OPTIONAL:p.ParameterKind.DEFAULT,s.Range.join(i,e.range()));return d.flags|=o,d}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseFunction=function(e,t,r,n){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range(e.pos)),null;var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),o=-1,l=null;if(e.skip(s.Token.LESSTHAN)){if(o=e.tokenPos,!(l=this.parseTypeParameters(e)))return null;t|=a.CommonFlags.GENERIC}if(!e.skip(s.Token.OPENPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"("),null;o<0&&(o=e.tokenPos);var u=this.parseParameters(e);if(!u)return null;var _=this.parseParametersThis,h=0!=(t&a.CommonFlags.SET);h&&(1!=u.length&&this.error(c.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,i.range),u.length&&u[0].initializer&&this.error(c.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,i.range)),t&a.CommonFlags.GET&&u.length&&this.error(c.DiagnosticCode.A_get_accessor_cannot_have_parameters,i.range);var d=null;if(e.skip(s.Token.COLON)&&!(d=this.parseType(e,!0,h)))return null;d||(d=p.Node.createOmittedType(e.range(e.pos)),h||this.error(c.DiagnosticCode.Type_expected,d.range));var y=p.Node.createSignature(u,d,_,!1,e.range(o,e.pos)),m=null;if(e.skip(s.Token.OPENBRACE)){if(t&a.CommonFlags.AMBIENT&&this.error(c.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.range()),!(m=this.parseBlockStatement(e,!1)))return null}else t&a.CommonFlags.AMBIENT||this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.range(e.pos));var g=p.Node.createFunctionDeclaration(i,l,y,m,r,t,e.range(n,e.pos));return e.skip(s.Token.SEMICOLON),g},t.prototype.parseFunctionExpression=function(e){var t,r=e.tokenPos,n=!1;if(e.token==s.Token.FUNCTION){if(t=e.skipIdentifier()?p.Node.createIdentifierExpression(e.readIdentifier(),e.range()):p.Node.createEmptyIdentifierExpression(e.range(e.pos)),!e.skip(s.Token.OPENPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"("),null}else n=!0,assert(e.token==s.Token.OPENPAREN),t=p.Node.createEmptyIdentifierExpression(e.range(e.tokenPos));var i=e.pos,a=this.parseParameters(e);return a?this.parseFunctionExpressionCommon(e,t,a,n,r,i):null},t.prototype.parseFunctionExpressionCommon=function(e,t,r,n,i,o){void 0===i&&(i=-1),void 0===o&&(o=-1),i<0&&(i=t.range.start),o<0&&(o=i);var l=null;if(e.skip(s.Token.COLON)){if(!(l=this.parseType(e)))return null}else l=p.Node.createOmittedType(e.range(e.pos)),this.error(c.DiagnosticCode.Type_expected,l.range);if(n&&!e.skip(s.Token.EQUALS_GREATERTHAN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"=>"),null;var u,_=p.Node.createSignature(r,l,null,!1,e.range(o,e.pos));if(n)u=this.parseStatement(e,!1);else{if(!e.skip(s.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;u=this.parseBlockStatement(e,!1)}if(!u)return null;var h=p.Node.createFunctionDeclaration(t,null,_,u,null,n?a.CommonFlags.ARROW:a.CommonFlags.NONE,e.range(i,e.pos));return p.Node.createFunctionExpression(h)},t.prototype.parseClassOrInterface=function(e,t,r,n){var i=e.token==s.Token.INTERFACE;if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var o=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),l=null;if(e.skip(s.Token.LESSTHAN)){if(!(l=this.parseTypeParameters(e)))return null;t|=a.CommonFlags.GENERIC}var u=null;if(e.skip(s.Token.EXTENDS)){var _=this.parseType(e);if(!_)return null;if(_.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,_.range),null;u=_}var h=null;if(e.skip(s.Token.IMPLEMENTS)){i&&this.error(c.DiagnosticCode.Interface_declaration_cannot_have_implements_clause,e.range());do{var d=this.parseType(e);if(!d)return null;i||(h||(h=[]),h.push(d))}while(e.skip(s.Token.COMMA))}if(!e.skip(s.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;var y,m=new Array;if(i?(assert(!h),y=p.Node.createInterfaceDeclaration(o,l,u,m,r,t,e.range(n,e.pos))):y=p.Node.createClassDeclaration(o,l,u,h,m,r,t,e.range(n,e.pos)),!e.skip(s.Token.CLOSEBRACE))do{var g=this.parseClassMember(e,y);g&&m.push(g)}while(!e.skip(s.Token.CLOSEBRACE));return y},t.prototype.parseClassExpression=function(e){var t,r=e.tokenPos;if(t=e.skipIdentifier()?p.Node.createIdentifierExpression(e.readIdentifier(),e.range()):p.Node.createEmptyIdentifierExpression(e.range(e.pos)),!e.skip(s.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;var n=new Array,i=p.Node.createClassDeclaration(t,[],null,null,n,null,a.CommonFlags.NONE,e.range(r,e.pos));if(!e.skip(s.Token.CLOSEBRACE))do{var o=this.parseClassMember(e,i);o&&n.push(o)}while(!e.skip(s.Token.CLOSEBRACE));return p.Node.createClassExpression(i)},t.prototype.parseClassMember=function(e,t){var r=e.pos,n=t.kind==p.NodeKind.INTERFACEDECLARATION,i=new Array;if(e.skip(s.Token.AT)){do{var o=this.parseDecorator(e);if(!o)break;i.push(o)}while(e.skip(s.Token.AT));n&&this.error(c.DiagnosticCode.Decorators_are_not_valid_here,s.Range.join(i[0].range,i[i.length-1].range))}var l=t.flags&a.CommonFlags.AMBIENT;n&&(l|=a.CommonFlags.VIRTUAL);var u=0,_=0;e.skip(s.Token.PUBLIC)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"public"),l|=a.CommonFlags.PUBLIC,u=e.tokenPos,_=e.pos):e.skip(s.Token.PRIVATE)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"private"),l|=a.CommonFlags.PRIVATE,u=e.tokenPos,_=e.pos):e.skip(s.Token.PROTECTED)&&(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"protected"),l|=a.CommonFlags.PROTECTED,u=e.tokenPos,_=e.pos);var h=0,d=0,y=0,m=0;e.skip(s.Token.STATIC)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"static"),l|=a.CommonFlags.STATIC,h=e.tokenPos,d=e.pos):(l|=a.CommonFlags.INSTANCE,e.skip(s.Token.ABSTRACT)&&(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"abstract"),l|=a.CommonFlags.ABSTRACT,y=e.tokenPos,m=e.pos),t.flags&a.CommonFlags.GENERIC&&(l|=a.CommonFlags.GENERIC_CONTEXT));var g=0,T=0;e.skip(s.Token.READONLY)&&(l|=a.CommonFlags.READONLY,g=e.tokenPos,T=e.pos);var f,E=e.mark(),I=!1,v=!1,b=!1,S=0,A=0;if(n||(e.skip(s.Token.GET)?e.peek(!0,s.IdentifierHandling.PREFER)!=s.Token.IDENTIFIER||e.nextTokenOnNewLine?e.reset(E):(l|=a.CommonFlags.GET,v=!0,S=e.tokenPos,A=e.pos,l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(g,T),"readonly")):e.skip(s.Token.SET)?e.peek(!0,s.IdentifierHandling.PREFER)!=s.Token.IDENTIFIER||e.nextTokenOnNewLine?e.reset(E):(l|=a.CommonFlags.SET,b=!0,S=e.tokenPos,A=e.pos,l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(g,T),"readonly")):e.skip(s.Token.CONSTRUCTOR)&&(I=!0,(l|=a.CommonFlags.CONSTRUCTOR)&a.CommonFlags.STATIC&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(h,d),"static"),l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(y,m),"abstract"),l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(g,T),"readonly"))),I)f=p.Node.createConstructorExpression(e.range());else{if(!v&&!b&&e.skip(s.Token.OPENBRACKET)){l&a.CommonFlags.PUBLIC?this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,_),"public"):l&a.CommonFlags.PROTECTED?this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,_),"protected"):l&a.CommonFlags.PRIVATE&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,_),"protected"),l&a.CommonFlags.STATIC&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(h,d),"static"),l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(y,m),"abstract"),l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(g,T),"readonly");var N=this.parseIndexSignatureDeclaration(e,i);return N?(e.skip(s.Token.SEMICOLON),N):null}if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;f=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}var C=null;if(e.skip(s.Token.LESSTHAN)){var O=e.tokenPos;if(!(C=this.parseTypeParameters(e)))return null;I?this.error(c.DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration,e.range(O,e.pos)):v||b?this.error(c.DiagnosticCode.An_accessor_cannot_have_type_parameters,e.range(O,e.pos)):l|=a.CommonFlags.GENERIC}if(e.skip(s.Token.OPENPAREN)){var x=e.tokenPos,k=this.parseParameters(e,I);if(!k)return null;var L=this.parseParametersThis;if(I)for(var R=0,F=k.length;R<F;++R){var B=k[R];if(B.isAny(a.CommonFlags.PUBLIC|a.CommonFlags.PROTECTED|a.CommonFlags.PRIVATE|a.CommonFlags.READONLY)){var D=p.Node.createFieldDeclaration(B.name,B.type,null,null,B.flags|a.CommonFlags.INSTANCE,B.range);D.parameterIndex=R,B.implicitFieldDeclaration=D,t.members.push(D)}}else v?k.length&&this.error(c.DiagnosticCode.A_get_accessor_cannot_have_parameters,f.range):b&&(1!=k.length&&this.error(c.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,f.range),k.length&&k[0].initializer&&this.error(c.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,f.range));var U=null;if(e.skip(s.Token.COLON)){if(f.kind==p.NodeKind.CONSTRUCTOR?this.error(c.DiagnosticCode.Type_annotation_cannot_appear_on_a_constructor_declaration,e.range()):b&&this.error(c.DiagnosticCode.A_set_accessor_cannot_have_a_return_type_annotation,e.range()),!(U=this.parseType(e,f.kind==p.NodeKind.CONSTRUCTOR||b)))return null}else U=p.Node.createOmittedType(e.range(e.pos)),b||f.kind==p.NodeKind.CONSTRUCTOR||this.error(c.DiagnosticCode.Type_expected,U.range);var P=p.Node.createSignature(k,U,L,!1,e.range(x,e.pos)),w=null;if(e.skip(s.Token.OPENBRACE)){if(l&a.CommonFlags.AMBIENT?this.error(c.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.range()):l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract,e.range(),f.text),!(w=this.parseBlockStatement(e,!1)))return null}else l&a.CommonFlags.AMBIENT||n||this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.range());var M=p.Node.createMethodDeclaration(f,C,P,w,i,l,e.range(r,e.pos));return e.skip(s.Token.SEMICOLON),M}if(I)this.error(c.DiagnosticCode.Constructor_implementation_is_missing,f.range);else{if(!v&&!b){l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(y,m),"abstract"),l&a.CommonFlags.GET&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(0,0),"get"),l&a.CommonFlags.SET&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(S,A),"set");var G=null;if(e.skip(s.Token.QUESTION)&&this.error(c.DiagnosticCode.Optional_properties_are_not_supported,e.range(r,e.pos)),e.skip(s.Token.EXCLAMATION)&&(l|=a.CommonFlags.DEFINITE_ASSIGNMENT),e.skip(s.Token.COLON)){if(!(G=this.parseType(e)))return null}else this.error(c.DiagnosticCode.Type_expected,e.range());var V=null;if(e.skip(s.Token.EQUALS)&&!(V=this.parseExpression(e)))return null;var K=e.range(r,e.pos);l&a.CommonFlags.DEFINITE_ASSIGNMENT&&(l&a.CommonFlags.STATIC||n||V)&&this.error(c.DiagnosticCode.A_definite_assignment_assertion_is_not_permitted_in_this_context,K);var z=p.Node.createFieldDeclaration(f,G,V,i,l,K);return e.skip(s.Token.SEMICOLON),z}this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,f.range)}return null},t.prototype.parseIndexSignatureDeclaration=function(e,t){t.length&&this.error(c.DiagnosticCode.Decorators_are_not_valid_here,s.Range.join(t[0].range,t[t.length-1].range));var r=e.tokenPos;if(e.skipIdentifier())if("key"==e.readIdentifier())if(e.skip(s.Token.COLON)){var n=this.parseType(e);if(!n)return null;if(n.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Type_expected,e.range()),null;if(e.skip(s.Token.CLOSEBRACKET)){if(e.skip(s.Token.COLON)){var i=this.parseType(e);return i?p.Node.createIndexSignatureDeclaration(n,i,e.range(r,e.pos)):null}this.error(c.DiagnosticCode._0_expected,e.range(),":")}else this.error(c.DiagnosticCode._0_expected,e.range(),"]")}else this.error(c.DiagnosticCode._0_expected,e.range(),":");else this.error(c.DiagnosticCode._0_expected,e.range(),"key");else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseNamespace=function(e,t,r,n){if(e.skipIdentifier()){var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(s.Token.OPENBRACE)){for(var a=new Array,o=p.Node.createNamespaceDeclaration(i,a,r,t,e.range(n,e.pos));!e.skip(s.Token.CLOSEBRACE);){var l=this.parseTopLevelStatement(e,o);l&&a.push(l)}return e.skip(s.Token.SEMICOLON),o}this.error(c.DiagnosticCode._0_expected,e.range(),"{")}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseExport=function(e,t,r){var n=null;if(e.skip(s.Token.OPENBRACE)){for(var i=new Array;!e.skip(s.Token.CLOSEBRACE);){var a=this.parseExportMember(e);if(!a)return null;if(i.push(a),!e.skip(s.Token.COMMA)){if(e.skip(s.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}if(e.skip(s.Token.FROM)){if(!e.skip(s.Token.STRINGLITERAL))return this.error(c.DiagnosticCode.String_literal_expected,e.range()),null;n=p.Node.createStringLiteralExpression(e.readString(),e.range())}return null===(l=(o=p.Node.createExportStatement(i,n,r,e.range(t,e.pos))).internalPath)||this.seenlog.has(l)||(this.backlog.push(l),this.seenlog.add(l)),e.skip(s.Token.SEMICOLON),o}if(e.skip(s.Token.ASTERISK))if(e.skip(s.Token.FROM)){if(e.skip(s.Token.STRINGLITERAL)){n=p.Node.createStringLiteralExpression(e.readString(),e.range());var o=p.Node.createExportStatement(null,n,r,e.range(t,e.pos)),l=assert(o.internalPath),u=e.source;return u.exportPaths||(u.exportPaths=new Set),u.exportPaths.add(l),this.seenlog.has(l)||(this.backlog.push(l),this.seenlog.add(l)),e.skip(s.Token.SEMICOLON),o}this.error(c.DiagnosticCode.String_literal_expected,e.range())}else this.error(c.DiagnosticCode._0_expected,e.range(),"from");else this.error(c.DiagnosticCode._0_expected,e.range(),"{");return null},t.prototype.parseExportMember=function(e){if(e.skipIdentifier()){var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(s.Token.AS)){if(!e.skipIdentifier(s.IdentifierHandling.ALWAYS))return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}return p.Node.createExportMember(t,r,r?s.Range.join(t.range,r.range):t.range)}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseImport=function(e){var t=e.tokenPos,r=null,n=null,i=!1;if(e.skip(s.Token.OPENBRACE))for(r=new Array;!e.skip(s.Token.CLOSEBRACE);){var a=this.parseImportDeclaration(e);if(!a)return null;if(r.push(a),!e.skip(s.Token.COMMA)){if(e.skip(s.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}else if(e.skip(s.Token.ASTERISK)){if(!e.skip(s.Token.AS))return this.error(c.DiagnosticCode._0_expected,e.range(),"as"),null;if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;n=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}else i=!0;if(i||e.skip(s.Token.FROM)){if(e.skip(s.Token.STRINGLITERAL)){var o=p.Node.createStringLiteralExpression(e.readString(),e.range()),l=void 0;n?(assert(!r),l=p.Node.createImportStatementWithWildcard(n,o,e.range(t,e.pos))):l=p.Node.createImportStatement(r,o,e.range(t,e.pos));var u=l.internalPath;return this.seenlog.has(u)||(this.backlog.push(u),this.seenlog.add(u)),e.skip(s.Token.SEMICOLON),l}this.error(c.DiagnosticCode.String_literal_expected,e.range())}else this.error(c.DiagnosticCode._0_expected,e.range(),"from");return null},t.prototype.parseImportDeclaration=function(e){if(e.skipIdentifier(s.IdentifierHandling.ALWAYS)){var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(s.Token.AS)){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}return p.Node.createImportDeclaration(t,r,r?s.Range.join(t.range,r.range):t.range)}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseExportImport=function(e,t){if(e.skipIdentifier()){var r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(s.Token.EQUALS)){if(e.skipIdentifier()){var n=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),i=p.Node.createExportImportStatement(n,r,e.range(t,e.pos));return e.skip(s.Token.SEMICOLON),i}this.error(c.DiagnosticCode.Identifier_expected,e.range())}else this.error(c.DiagnosticCode._0_expected,e.range(),"=")}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseStatement=function(e,t){void 0===t&&(t=!1);var r=e.mark(),n=null;switch(e.next()){case s.Token.BREAK:n=this.parseBreak(e);break;case s.Token.CONST:n=this.parseVariable(e,a.CommonFlags.CONST,null,e.tokenPos);break;case s.Token.CONTINUE:n=this.parseContinue(e);break;case s.Token.DO:n=this.parseDoStatement(e);break;case s.Token.FOR:n=this.parseForStatement(e);break;case s.Token.IF:n=this.parseIfStatement(e);break;case s.Token.LET:n=this.parseVariable(e,a.CommonFlags.LET,null,e.tokenPos);break;case s.Token.VAR:n=this.parseVariable(e,a.CommonFlags.NONE,null,e.tokenPos);break;case s.Token.OPENBRACE:n=this.parseBlockStatement(e,t);break;case s.Token.RETURN:t&&this.error(c.DiagnosticCode.A_return_statement_can_only_be_used_within_a_function_body,e.range()),n=this.parseReturn(e);break;case s.Token.SEMICOLON:return p.Node.createEmptyStatement(e.range(e.tokenPos));case s.Token.SWITCH:n=this.parseSwitchStatement(e);break;case s.Token.THROW:n=this.parseThrowStatement(e);break;case s.Token.TRY:n=this.parseTryStatement(e);break;case s.Token.VOID:n=this.parseVoidStatement(e);break;case s.Token.WHILE:n=this.parseWhileStatement(e);break;case s.Token.TYPE:if(e.peek(!1,s.IdentifierHandling.PREFER)==s.Token.IDENTIFIER){n=this.parseTypeDeclaration(e,a.CommonFlags.NONE,null,e.tokenPos);break}default:e.reset(r),n=this.parseExpressionStatement(e)}return n?e.discard(r):(e.reset(r),this.skipStatement(e)),n},t.prototype.parseBlockStatement=function(e,t){for(var r=e.tokenPos,n=new Array;!e.skip(s.Token.CLOSEBRACE);){var i=e.mark(),a=this.parseStatement(e,t);if(a)e.discard(i),n.push(a);else{if(e.token==s.Token.ENDOFFILE)return null;e.reset(i),this.skipStatement(e)}}var o=p.Node.createBlockStatement(n,e.range(r,e.pos));return e.skip(s.Token.SEMICOLON),o},t.prototype.parseBreak=function(e){var t=null;e.peek(!0)!=s.Token.IDENTIFIER||e.nextTokenOnNewLine||(e.next(s.IdentifierHandling.PREFER),t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()));var r=p.Node.createBreakStatement(t,e.range());return e.skip(s.Token.SEMICOLON),r},t.prototype.parseContinue=function(e){var t=null;e.peek(!0)!=s.Token.IDENTIFIER||e.nextTokenOnNewLine||(e.next(s.IdentifierHandling.PREFER),t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()));var r=p.Node.createContinueStatement(t,e.range());return e.skip(s.Token.SEMICOLON),r},t.prototype.parseDoStatement=function(e){var t=e.tokenPos,r=this.parseStatement(e);if(!r)return null;if(e.skip(s.Token.WHILE))if(e.skip(s.Token.OPENPAREN)){var n=this.parseExpression(e);if(!n)return null;if(e.skip(s.Token.CLOSEPAREN)){var i=p.Node.createDoStatement(r,n,e.range(t,e.pos));return e.skip(s.Token.SEMICOLON),i}this.error(c.DiagnosticCode._0_expected,e.range(),")")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");else this.error(c.DiagnosticCode._0_expected,e.range(),"while");return null},t.prototype.parseExpressionStatement=function(e){var t=this.parseExpression(e);if(!t)return null;var r=p.Node.createExpressionStatement(t);return e.skip(s.Token.SEMICOLON),r},t.prototype.parseForStatement=function(e){var t=e.tokenPos;if(e.skip(s.Token.OPENPAREN)){var r=null;if(e.skip(s.Token.CONST))r=this.parseVariable(e,a.CommonFlags.CONST,null,e.tokenPos);else if(e.skip(s.Token.LET))r=this.parseVariable(e,a.CommonFlags.LET,null,e.tokenPos);else if(e.skip(s.Token.VAR))r=this.parseVariable(e,a.CommonFlags.NONE,null,e.tokenPos);else if(!e.skip(s.Token.SEMICOLON)&&!(r=this.parseExpressionStatement(e)))return null;if(e.token==s.Token.SEMICOLON){var n=null;if(!e.skip(s.Token.SEMICOLON)&&!(n=this.parseExpressionStatement(e)))return null;if(e.token==s.Token.SEMICOLON){var i=null;if(!e.skip(s.Token.CLOSEPAREN)){if(!(i=this.parseExpression(e)))return null;if(!e.skip(s.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null}var o=this.parseStatement(e);return o?p.Node.createForStatement(r,n?n.expression:null,i,o,e.range(t,e.pos)):null}this.error(c.DiagnosticCode._0_expected,e.range(),";")}else this.error(c.DiagnosticCode._0_expected,e.range(),";")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");return null},t.prototype.parseIfStatement=function(e){var t=e.tokenPos;if(e.skip(s.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(s.Token.CLOSEPAREN)){var n=this.parseStatement(e);if(!n)return null;var i=null;return e.skip(s.Token.ELSE)&&!(i=this.parseStatement(e))?null:p.Node.createIfStatement(r,n,i,e.range(t,e.pos))}this.error(c.DiagnosticCode._0_expected,e.range(),")")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");return null},t.prototype.parseSwitchStatement=function(e){var t=e.tokenPos;if(e.skip(s.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(s.Token.CLOSEPAREN)){if(e.skip(s.Token.OPENBRACE)){for(var n=new Array;!e.skip(s.Token.CLOSEBRACE);){var i=this.parseSwitchCase(e);if(!i)return null;n.push(i)}var a=p.Node.createSwitchStatement(r,n,e.range(t,e.pos));return e.skip(s.Token.SEMICOLON),a}this.error(c.DiagnosticCode._0_expected,e.range(),"{")}else this.error(c.DiagnosticCode._0_expected,e.range(),")")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");return null},t.prototype.parseSwitchCase=function(e){var t,r,n=e.tokenPos;if(e.skip(s.Token.CASE)){var i=this.parseExpression(e);if(!i)return null;if(e.skip(s.Token.COLON)){for(t=new Array;e.peek()!=s.Token.CASE&&e.nextToken!=s.Token.DEFAULT&&e.nextToken!=s.Token.CLOSEBRACE;){if(!(r=this.parseStatement(e)))return null;t.push(r)}return p.Node.createSwitchCase(i,t,e.range(n,e.pos))}this.error(c.DiagnosticCode._0_expected,e.range(),":")}else if(e.skip(s.Token.DEFAULT)){if(e.skip(s.Token.COLON)){for(t=new Array;e.peek()!=s.Token.CASE&&e.nextToken!=s.Token.DEFAULT&&e.nextToken!=s.Token.CLOSEBRACE;){if(!(r=this.parseStatement(e)))return null;t.push(r)}return p.Node.createSwitchCase(null,t,e.range(n,e.pos))}this.error(c.DiagnosticCode._0_expected,e.range(),":")}else this.error(c.DiagnosticCode._case_or_default_expected,e.range());return null},t.prototype.parseThrowStatement=function(e){var t=e.tokenPos,r=this.parseExpression(e);if(!r)return null;var n=p.Node.createThrowStatement(r,e.range(t,e.pos));return e.skip(s.Token.SEMICOLON),n},t.prototype.parseTryStatement=function(e){var t,r=e.tokenPos;if(e.skip(s.Token.OPENBRACE)){for(var n=new Array;!e.skip(s.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;n.push(t)}var i=null,a=null,o=null;if(e.skip(s.Token.CATCH)){if(!e.skip(s.Token.OPENPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),"("),null;if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;if(i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),!e.skip(s.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null;if(!e.skip(s.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(a=[];!e.skip(s.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;a.push(t)}}if(e.skip(s.Token.FINALLY)){if(!e.skip(s.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(o=[];!e.skip(s.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;o.push(t)}}if(!a&&!o)return this.error(c.DiagnosticCode._0_expected,e.range(),"catch"),null;var l=p.Node.createTryStatement(n,i,a,o,e.range(r,e.pos));return e.skip(s.Token.SEMICOLON),l}return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null},t.prototype.parseTypeDeclaration=function(e,t,r,n){if(e.skipIdentifier()){var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),o=null;if(e.skip(s.Token.LESSTHAN)){if(!(o=this.parseTypeParameters(e)))return null;t|=a.CommonFlags.GENERIC}if(e.skip(s.Token.EQUALS)){var l=this.parseType(e);if(!l)return null;var u=p.Node.createTypeDeclaration(i,o,l,r,t,e.range(n,e.pos));return e.skip(s.Token.SEMICOLON),u}this.error(c.DiagnosticCode._0_expected,e.range(),"=")}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseVoidStatement=function(e){var t=e.tokenPos,r=this.parseExpression(e,21);if(!r)return null;var n=p.Node.createVoidStatement(r,e.range(t,e.pos));return e.skip(s.Token.SEMICOLON),n},t.prototype.parseWhileStatement=function(e){var t=e.tokenPos;if(e.skip(s.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(s.Token.CLOSEPAREN)){var n=this.parseStatement(e);if(!n)return null;var i=p.Node.createWhileStatement(r,n,e.range(t,e.pos));return e.skip(s.Token.SEMICOLON),i}this.error(c.DiagnosticCode._0_expected,e.range(),")")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");return null},t.prototype.parseExpressionStart=function(e){var t=e.next(s.IdentifierHandling.PREFER),r=e.tokenPos,n=function(e){switch(e){case s.Token.DOT_DOT_DOT:return 2;case s.Token.YIELD:return 3;case s.Token.EXCLAMATION:case s.Token.TILDE:case s.Token.PLUS:case s.Token.MINUS:case s.Token.PLUS_PLUS:case s.Token.MINUS_MINUS:case s.Token.TYPEOF:case s.Token.VOID:case s.Token.DELETE:return 17;case s.Token.NEW:return 20}return 0}(t);if(0!=n){var i=void 0;return t==s.Token.NEW?(i=this.parseExpression(e,19))?i.kind==p.NodeKind.CALL?p.Node.createNewExpression(i.expression,i.typeArguments,i.arguments,e.range(r,e.pos)):(this.error(c.DiagnosticCode.Operation_not_supported,e.range()),null):null:(i=this.parseExpression(e,n))?(t!=s.Token.PLUS_PLUS&&t!=s.Token.MINUS_MINUS||i.kind!=p.NodeKind.IDENTIFIER&&i.kind!=p.NodeKind.ELEMENTACCESS&&i.kind!=p.NodeKind.PROPERTYACCESS&&this.error(c.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,i.range),p.Node.createUnaryPrefixExpression(t,i,e.range(r,e.pos))):null}var a=null;switch(t){case s.Token.NULL:return p.Node.createNullExpression(e.range());case s.Token.TRUE:return p.Node.createTrueExpression(e.range());case s.Token.FALSE:return p.Node.createFalseExpression(e.range());case s.Token.OPENPAREN:if(e.skip(s.Token.CLOSEPAREN))return this.parseFunctionExpressionCommon(e,p.Node.createEmptyIdentifierExpression(e.range(r)),[],!0);var o=e.mark(),l=!0;do{switch(e.next(s.IdentifierHandling.PREFER)){case s.Token.DOT_DOT_DOT:return e.reset(o),this.parseFunctionExpression(e);case s.Token.IDENTIFIER:switch(e.readIdentifier(),e.next()){case s.Token.CLOSEPAREN:if(!e.skip(s.Token.COLON)&&!e.skip(s.Token.EQUALS_GREATERTHAN)){l=!1;break}case s.Token.COLON:return e.reset(o),this.parseFunctionExpression(e);case s.Token.QUESTION:if(e.skip(s.Token.COLON)||e.skip(s.Token.COMMA)||e.skip(s.Token.CLOSEPAREN))return e.reset(o),this.parseFunctionExpression(e);l=!1;break;case s.Token.COMMA:break;default:l=!1}break;default:l=!1}}while(l);return e.reset(o),(a=this.parseExpression(e))?e.skip(s.Token.CLOSEPAREN)?p.Node.createParenthesizedExpression(a,e.range(r,e.pos)):(this.error(c.DiagnosticCode._0_expected,e.range(),")"),null):null;case s.Token.OPENBRACKET:for(var u=new Array;!e.skip(s.Token.CLOSEBRACKET);){if(e.peek()==s.Token.COMMA)a=null;else if(!(a=this.parseExpression(e,2)))return null;if(u.push(a),!e.skip(s.Token.COMMA)){if(e.skip(s.Token.CLOSEBRACKET))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null}}return p.Node.createArrayLiteralExpression(u,e.range(r,e.pos));case s.Token.OPENBRACE:for(var _=e.tokenPos,h=new Array,d=new Array,y=void 0;!e.skip(s.Token.CLOSEBRACE);){if(e.skipIdentifier())y=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());else{if(!e.skip(s.Token.STRINGLITERAL))return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;(y=p.Node.createIdentifierExpression(e.readString(),e.range())).isQuoted=!0}if(h.push(y),e.skip(s.Token.COLON)){var m=this.parseExpression(e,2);if(!m)return null;d.push(m)}else{if(y.isQuoted)return this.error(c.DiagnosticCode._0_expected,e.range(),":"),null;d.push(y)}if(!e.skip(s.Token.COMMA)){if(e.skip(s.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}return p.Node.createObjectLiteralExpression(h,d,e.range(_,e.pos));case s.Token.LESSTHAN:var g=this.parseType(e);return g?e.skip(s.Token.GREATERTHAN)?(a=this.parseExpression(e,19))?p.Node.createAssertionExpression(p.AssertionKind.PREFIX,a,g,e.range(r,e.pos)):null:(this.error(c.DiagnosticCode._0_expected,e.range(),">"),null):null;case s.Token.IDENTIFIER:return p.Node.createIdentifierExpression(e.readIdentifier(),e.range(r,e.pos));case s.Token.THIS:return p.Node.createThisExpression(e.range(r,e.pos));case s.Token.CONSTRUCTOR:return p.Node.createConstructorExpression(e.range(r,e.pos));case s.Token.SUPER:return e.peek()!=s.Token.DOT&&e.nextToken!=s.Token.OPENPAREN&&this.error(c.DiagnosticCode._super_must_be_followed_by_an_argument_list_or_member_access,e.range()),p.Node.createSuperExpression(e.range(r,e.pos));case s.Token.STRINGLITERAL:return p.Node.createStringLiteralExpression(e.readString(),e.range(r,e.pos));case s.Token.INTEGERLITERAL:return p.Node.createIntegerLiteralExpression(e.readInteger(),e.range(r,e.pos));case s.Token.FLOATLITERAL:return p.Node.createFloatLiteralExpression(e.readFloat(),e.range(r,e.pos));case s.Token.SLASH:var T=e.readRegexpPattern();return e.skip(s.Token.SLASH)?p.Node.createRegexpLiteralExpression(T,e.readRegexpFlags(),e.range(r,e.pos)):(this.error(c.DiagnosticCode._0_expected,e.range(),"/"),null);case s.Token.FUNCTION:return this.parseFunctionExpression(e);case s.Token.CLASS:return this.parseClassExpression(e);default:return t==s.Token.ENDOFFILE?this.error(c.DiagnosticCode.Unexpected_end_of_text,e.range(r)):this.error(c.DiagnosticCode.Expression_expected,e.range()),null}},t.prototype.tryParseTypeArgumentsBeforeArguments=function(e){var t=e.mark();if(!e.skip(s.Token.LESSTHAN))return null;var r=new Array;do{if(e.peek()===s.Token.GREATERTHAN)break;var n=this.parseType(e,!0,!0);if(!n)return e.reset(t),null;r.push(n)}while(e.skip(s.Token.COMMA));return e.skip(s.Token.GREATERTHAN)&&e.skip(s.Token.OPENPAREN)?r:(e.reset(t),null)},t.prototype.parseArguments=function(e){for(var t=new Array;!e.skip(s.Token.CLOSEPAREN);){var r=this.parseExpression(e,2);if(!r)return null;if(t.push(r),!e.skip(s.Token.COMMA)){if(e.skip(s.Token.CLOSEPAREN))break;return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null}}return t},t.prototype.parseExpression=function(e,t){void 0===t&&(t=1),assert(0!=t);var r=this.parseExpressionStart(e);if(!r)return null;for(var n,i,a=(r=this.maybeParseCallExpression(e,r)).range.start,o=null;(i=_(n=e.peek()))>=t;){switch(e.next(),n){case s.Token.AS:var l=this.parseType(e);if(!l)return null;r=p.Node.createAssertionExpression(p.AssertionKind.AS,r,l,e.range(a,e.pos));break;case s.Token.EXCLAMATION:r=p.Node.createAssertionExpression(p.AssertionKind.NONNULL,r,null,e.range(a,e.pos));break;case s.Token.INSTANCEOF:var u=this.parseType(e);if(!u)return null;r=p.Node.createInstanceOfExpression(r,u,e.range(a,e.pos));break;case s.Token.OPENBRACKET:if(!(o=this.parseExpression(e)))return null;if(!e.skip(s.Token.CLOSEBRACKET))return this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null;r=p.Node.createElementAccessExpression(r,o,e.range(a,e.pos));break;case s.Token.PLUS_PLUS:case s.Token.MINUS_MINUS:r.kind!=p.NodeKind.IDENTIFIER&&r.kind!=p.NodeKind.ELEMENTACCESS&&r.kind!=p.NodeKind.PROPERTYACCESS&&this.error(c.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,r.range),r=p.Node.createUnaryPostfixExpression(n,r,e.range(a,e.pos));break;case s.Token.QUESTION:var d=this.parseExpression(e);if(!d)return null;if(!e.skip(s.Token.COLON))return this.error(c.DiagnosticCode._0_expected,e.range(),":"),null;var y=this.parseExpression(e,t>1?2:1);if(!y)return null;r=p.Node.createTernaryExpression(r,d,y,e.range(a,e.pos));break;case s.Token.COMMA:var m=[r];do{if(!(r=this.parseExpression(e,2)))return null;m.push(r)}while(e.skip(s.Token.COMMA));r=p.Node.createCommaExpression(m,e.range(a,e.pos));break;default:if(n==s.Token.DOT){if(e.skipIdentifier())o=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());else if(!(o=this.parseExpression(e,h(n)?i:i+1)))return null;if(o.kind==p.NodeKind.IDENTIFIER)r=p.Node.createPropertyAccessExpression(r,o,e.range(a,e.pos));else{if(o.kind!=p.NodeKind.CALL)return this.error(c.DiagnosticCode.Identifier_expected,o.range),null;if(!(r=this.joinPropertyCall(e,a,r,o)))return null}}else{if(!(o=this.parseExpression(e,h(n)?i:i+1)))return null;r=p.Node.createBinaryExpression(n,r,o,e.range(a,e.pos))}}r=this.maybeParseCallExpression(e,r)}return r},t.prototype.joinPropertyCall=function(e,t,r,n){var i=n.expression;switch(i.kind){case p.NodeKind.IDENTIFIER:n.expression=p.Node.createPropertyAccessExpression(r,i,e.range(t,e.pos));break;case p.NodeKind.CALL:var a=this.joinPropertyCall(e,t,r,i);if(!a)return null;n.expression=a,n.range=e.range(t,e.pos);break;default:return this.error(c.DiagnosticCode.Identifier_expected,n.range),null}return n},t.prototype.maybeParseCallExpression=function(e,t){if(p.nodeIsCallable(t.kind))for(var r=null;e.skip(s.Token.OPENPAREN)||p.nodeIsGenericCallable(t.kind)&&null!==(r=this.tryParseTypeArgumentsBeforeArguments(e));){var n=this.parseArguments(e);if(!n)break;t=p.Node.createCallExpression(t,r,n,e.range(t.range.start,e.pos))}return t},t.prototype.skipStatement=function(e){for(e.peek(!0),e.nextTokenOnNewLine&&e.next();;){var t=e.peek(!0);if(t==s.Token.ENDOFFILE||t==s.Token.SEMICOLON){e.next();break}if(e.nextTokenOnNewLine)break;switch(e.next()){case s.Token.IDENTIFIER:e.readIdentifier();break;case s.Token.STRINGLITERAL:e.readString();break;case s.Token.INTEGERLITERAL:e.readInteger();break;case s.Token.FLOATLITERAL:e.readFloat()}}},t.prototype.skipBlock=function(e){var t=1,r=!0;do{switch(e.next()){case s.Token.ENDOFFILE:this.error(c.DiagnosticCode._0_expected,e.range(),"}"),r=!1;break;case s.Token.OPENBRACE:++t;break;case s.Token.CLOSEBRACE:--t||(r=!1);break;case s.Token.IDENTIFIER:e.readIdentifier();break;case s.Token.STRINGLITERAL:e.readString();break;case s.Token.INTEGERLITERAL:e.readInteger();break;case s.Token.FLOATLITERAL:e.readFloat()}}while(r)},t}(c.DiagnosticEmitter);function _(e){switch(e){case s.Token.COMMA:return 1;case s.Token.EQUALS:case s.Token.PLUS_EQUALS:case s.Token.MINUS_EQUALS:case s.Token.ASTERISK_ASTERISK_EQUALS:case s.Token.ASTERISK_EQUALS:case s.Token.SLASH_EQUALS:case s.Token.PERCENT_EQUALS:case s.Token.LESSTHAN_LESSTHAN_EQUALS:case s.Token.GREATERTHAN_GREATERTHAN_EQUALS:case s.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:case s.Token.AMPERSAND_EQUALS:case s.Token.CARET_EQUALS:case s.Token.BAR_EQUALS:return 4;case s.Token.QUESTION:return 5;case s.Token.BAR_BAR:return 6;case s.Token.AMPERSAND_AMPERSAND:return 7;case s.Token.BAR:return 8;case s.Token.CARET:return 9;case s.Token.AMPERSAND:return 10;case s.Token.EQUALS_EQUALS:case s.Token.EXCLAMATION_EQUALS:case s.Token.EQUALS_EQUALS_EQUALS:case s.Token.EXCLAMATION_EQUALS_EQUALS:return 11;case s.Token.AS:case s.Token.IN:case s.Token.INSTANCEOF:case s.Token.LESSTHAN:case s.Token.GREATERTHAN:case s.Token.LESSTHAN_EQUALS:case s.Token.GREATERTHAN_EQUALS:return 12;case s.Token.LESSTHAN_LESSTHAN:case s.Token.GREATERTHAN_GREATERTHAN:case s.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:return 13;case s.Token.PLUS:case s.Token.MINUS:return 14;case s.Token.ASTERISK:case s.Token.SLASH:case s.Token.PERCENT:return 15;case s.Token.ASTERISK_ASTERISK:return 16;case s.Token.PLUS_PLUS:case s.Token.MINUS_MINUS:return 18;case s.Token.DOT:case s.Token.NEW:case s.Token.OPENBRACKET:case s.Token.EXCLAMATION:return 20}return 0}function h(e){switch(e){case s.Token.EQUALS:case s.Token.PLUS_EQUALS:case s.Token.MINUS_EQUALS:case s.Token.ASTERISK_ASTERISK_EQUALS:case s.Token.ASTERISK_EQUALS:case s.Token.SLASH_EQUALS:case s.Token.PERCENT_EQUALS:case s.Token.LESSTHAN_LESSTHAN_EQUALS:case s.Token.GREATERTHAN_GREATERTHAN_EQUALS:case s.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:case s.Token.AMPERSAND_EQUALS:case s.Token.CARET_EQUALS:case s.Token.BAR_EQUALS:case s.Token.QUESTION:case s.Token.ASTERISK_ASTERISK:return!0;default:return!1}}t.Parser=u,function(e){e[e.NONE=0]="NONE",e[e.COMMA=1]="COMMA",e[e.SPREAD=2]="SPREAD",e[e.YIELD=3]="YIELD",e[e.ASSIGNMENT=4]="ASSIGNMENT",e[e.CONDITIONAL=5]="CONDITIONAL",e[e.LOGICAL_OR=6]="LOGICAL_OR",e[e.LOGICAL_AND=7]="LOGICAL_AND",e[e.BITWISE_OR=8]="BITWISE_OR",e[e.BITWISE_XOR=9]="BITWISE_XOR",e[e.BITWISE_AND=10]="BITWISE_AND",e[e.EQUALITY=11]="EQUALITY",e[e.RELATIONAL=12]="RELATIONAL",e[e.SHIFT=13]="SHIFT",e[e.ADDITIVE=14]="ADDITIVE",e[e.MULTIPLICATIVE=15]="MULTIPLICATIVE",e[e.EXPONENTIATED=16]="EXPONENTIATED",e[e.UNARY_PREFIX=17]="UNARY_PREFIX",e[e.UNARY_POSTFIX=18]="UNARY_POSTFIX",e[e.CALL=19]="CALL",e[e.MEMBERACCESS=20]="MEMBERACCESS",e[e.GROUPING=21]="GROUPING"}(t.Precedence||(t.Precedence={}))},function(e,t,r){r(17),e.exports=r(31)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(18),r(20),r(21),r(22);var n=r(4);n.Module.prototype.toText=function(){return binaryen.wrapModule(this.ref).emitStackIR()},n.Module.prototype.toAsmjs=function(){return binaryen.wrapModule(this.ref).emitAsmjs()}},function(e,t,r){(function(e){const t=e.Binaryen||r(19);for(var n in e.binaryen=t,t)(n.startsWith("_Binaryen")||n.startsWith("_Relooper"))&&(e[n]=t[n]);e.__memory_allocate=t._malloc,e.__memory_free=t._free,e.__memory_copy=t._memmove,e.__store=function(e,r){t.HEAPU8[e]=r},e.__load=function(e){return t.HEAPU8[e]}}).call(this,r(8))},function(t,r){t.exports=e},function(e,t,r){(function(e){var t="undefined"!=typeof window&&window||void 0!==e&&e||self;t.ASC_TARGET=0,t.ASC_NO_ASSERT=!1,t.ASC_MEMORY_BASE=0,t.ASC_OPTIMIZE_LEVEL=3,t.ASC_SHRINK_LEVEL=0,t.ASC_FEATURE_MUTABLE_GLOBAL=!1,t.ASC_FEATURE_SIGN_EXTENSION=!1,t.ASC_FEATURE_BULK_MEMORY=!1,t.ASC_FEATURE_SIMD=!1,t.ASC_FEATURE_THREADS=!1;var r=new Float64Array(1),n=new Uint32Array(r.buffer);function i(){Error.captureStackTrace?Error.captureStackTrace(this,i):this.stack=this.name+": "+this.message+"\n"+(new Error).stack}function a(e){this.message=e||"assertion failed",Error.captureStackTrace?Error.captureStackTrace(this,a):this.stack=this.name+": "+this.message+"\n"+(new Error).stack}Object.defineProperties(t.i8=function(e){return e<<24>>24},{MIN_VALUE:{value:-128,writable:!1},MAX_VALUE:{value:127,writable:!1}}),Object.defineProperties(t.i16=function(e){return e<<16>>16},{MIN_VALUE:{value:-32768,writable:!1},MAX_VALUE:{value:32767,writable:!1}}),Object.defineProperties(t.i32=t.isize=function(e){return 0|e},{MIN_VALUE:{value:-2147483648,writable:!1},MAX_VALUE:{value:2147483647,writable:!1}}),Object.defineProperties(t.u8=function(e){return 255&e},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:255,writable:!1}}),Object.defineProperties(t.u16=function(e){return 65535&e},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:65535,writable:!1}}),Object.defineProperties(t.u32=t.usize=function(e){return e>>>0},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:4294967295,writable:!1}}),Object.defineProperties(t.bool=function(e){return!!e},{MIN_VALUE:{value:!1,writable:!1},MAX_VALUE:{value:!0,writable:!1}}),Object.defineProperties(t.f32=function(e){return Math.fround(e)},{EPSILON:{value:Math.fround(1.1920929e-7),writable:!1},MIN_VALUE:{value:Math.fround(1.4012985e-45),writable:!1},MAX_VALUE:{value:Math.fround(3.4028235e38),writable:!1},MIN_NORMAL_VALUE:{value:Math.fround(1.17549435e-38),writable:!1},MIN_SAFE_INTEGER:{value:-16777215,writable:!1},MAX_SAFE_INTEGER:{value:16777215,writable:!1}}),Object.defineProperties(t.f64=function(e){return+e},{EPSILON:{value:2.220446049250313e-16,writable:!1},MIN_VALUE:{value:5e-324,writable:!1},MAX_VALUE:{value:1.7976931348623157e308,writable:!1},MIN_NORMAL_VALUE:{value:2.2250738585072014e-308,writable:!1},MIN_SAFE_INTEGER:{value:-9007199254740991,writable:!1},MAX_SAFE_INTEGER:{value:9007199254740991,writable:!1}}),t.clz=Math.clz32,t.ctz=function(e){var t=Math.clz32(e&-e);return e?31-t:t},t.popcnt=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},t.rotl=function(e,t){return e<<(t&=31)|e>>>32-t},t.rotr=function(e,t){return e>>>(t&=31)|e<<32-t},t.abs=Math.abs,t.max=Math.max,t.min=Math.min,t.ceil=Math.ceil,t.floor=Math.floor,t.nearest=function(e){return.5===Math.abs(e-Math.trunc(e))?2*Math.round(.5*e):Math.round(e)},t.select=function(e,t,r){return r?e:t},t.sqrt=Math.sqrt,t.trunc=Math.trunc,t.copysign=function(e,t){return Math.abs(e)*Math.sign(t)},t.bswap=function(e){var t=e>>8&16711935,r=(16711935&e)<<8;return(t=(e=t|r)>>16&65535)|(r=(65535&e)<<16)},t.bswap16=function(e){return e<<8&65280|e>>8&255|4294901760&e},i.prototype=Object.create(Error.prototype),i.prototype.name="UnreachableError",i.prototype.message="unreachable",t.unreachable=function(){throw new i},a.prototype=Object.create(Error.prototype),a.prototype.name="AssertionError",t.assert=function(e,t){if(e)return e;throw new a(t)},t.changetype=function(e){return e},t.parseI32=function(e,t){return 0|parseInt(e,void 0)},String.fromCharCodes=function(e){return String.fromCharCode.apply(String,e)},String.fromCodePoints=function(e){return String.fromCodePoint.apply(String,e)},t.isInteger=Number.isInteger,t.isFloat=function(e){return"number"==typeof e},t.isReference=function(e){return"object"==typeof e||"string"==typeof e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isArray=Array.isArray,t.isDefined=function(e){return void 0!==e},t.isConstant=function(e){return!1},t.unchecked=function(e){return e},t.fmod=function(e,t){return e%t},t.fmodf=function(e,t){return Math.fround(e%t)},t.JSMath=Math,t.JSMath.signbit=function(e){return r[0]=e,Boolean(n[1]>>>31&e==e)},t.memory=(()=>{var e=new Uint8Array(0),r=0;return{allocate:t.__memory_allocate||function(t){if(!(t>>>=0))return 0;if(r+t>e.length){var n=e;(e=new Uint8Array(Math.max(65536,e.length+t,2*e.length))).set(n)}var i=r;return 7&(r+=t)&&(r=1+(7|r)),i},fill:t.__memory_fill||function(t,r,n){e.fill(r,t,t+n)},free:t.__memory_free||function(e){},copy:t.__memory_copy||function(t,r,n){e.copyWithin(t,r,r+n)},reset:t.__memory_reset||function(){e=new Uint8Array(0),r=0}}})(),t.store=t.__store||function(e,t,r){HEAP[(0|e)+(0|r)]=t},t.load=t.__load||function(e,t){return HEAP[(0|e)+(0|t)]}}).call(this,r(8))},function(e,t,r){(function(e){const t=new Float64Array(1),r=new Float32Array(t.buffer),n=new Int32Array(t.buffer);e.f32_as_i32=function(e){return r[0]=e,n[0]},e.i32_as_f32=function(e){return n[0]=e,r[0]},e.f64_as_i64=function(e){return t[0]=e,i64_new(n[0],n[1])},e.i64_as_f64=function(e){return n[0]=i64_low(e),n[1]=i64_high(e),t[0]}}).call(this,r(8))},function(e,t,r){(function(e){const t=e.Long||r(23);e.i64_zero=t.ZERO,e.i64_one=t.ONE,e.i64_new=function(e,r){return t.fromBits(e,r)},e.i64_low=function(e){return e.low},e.i64_high=function(e){return e.high},e.i64_add=function(e,t){return e.add(t)},e.i64_sub=function(e,t){return e.sub(t)},e.i64_mul=function(e,t){return e.mul(t)},e.i64_div=function(e,t){return e.div(t)},e.i64_div_u=function(e,t){return e.toUnsigned().div(t.toUnsigned()).toSigned()},e.i64_rem=function(e,t){return e.mod(t)},e.i64_rem_u=function(e,t){return e.toUnsigned().mod(t.toUnsigned()).toSigned()},e.i64_and=function(e,t){return e.and(t)},e.i64_or=function(e,t){return e.or(t)},e.i64_xor=function(e,t){return e.xor(t)},e.i64_shl=function(e,t){return e.shl(t)},e.i64_shr=function(e,t){return e.shr(t)},e.i64_shr_u=function(e,t){return e.shru(t)},e.i64_not=function(e){return e.not()},e.i64_eq=function(e,t){return e.eq(t)},e.i64_ne=function(e,t){return e.ne(t)},e.i64_align=function(e,r){assert(r&&0==(r&r-1));var n=t.fromInt(r-1);return e.add(n).and(n.not())},e.i64_is_i8=function(e){return 0===e.high&&e.low>=0&&e.low<=i8.MAX_VALUE||-1===e.high&&e.low>=i8.MIN_VALUE&&e.low<0},e.i64_is_i16=function(e){return 0===e.high&&e.low>=0&&e.low<=i16.MAX_VALUE||-1===e.high&&e.low>=i16.MIN_VALUE&&e.low<0},e.i64_is_i32=function(e){return 0===e.high&&e.low>=0||-1===e.high&&e.low<0},e.i64_is_u8=function(e){return 0===e.high&&e.low>=0&&e.low<=u8.MAX_VALUE},e.i64_is_u16=function(e){return 0===e.high&&e.low>=0&&e.low<=u16.MAX_VALUE},e.i64_is_u32=function(e){return 0===e.high},e.i64_is_bool=function(e){return 0===e.high&&(0===e.low||1===e.low)};const n=t.fromNumber(f32.MIN_SAFE_INTEGER),i=t.fromNumber(f32.MAX_SAFE_INTEGER);e.i64_is_f32=function(e){return e.gte(n)&&e.lte(i)};const a=t.fromNumber(f64.MIN_SAFE_INTEGER),o=t.fromNumber(f64.MAX_SAFE_INTEGER);e.i64_is_f64=function(e){return e.gte(a)&&e.lte(o)},e.i64_to_f32=function(t){return e.Math.fround(t.toNumber())},e.i64_to_f64=function(e){return e.toNumber()},e.i64_to_string=function(e,t){return(t?e.toUnsigned():e).toString(10)}}).call(this,r(8))},function(e,t){e.exports=n;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var a={},o={};function s(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=o[e])?n:(r=l(e,(0|e)<0?-1:0,!0),i&&(o[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=a[e])?n:(r=l(e,e<0?-1:0,!1),i&&(a[e]=r),r)}function c(e,t){if(isNaN(e))return t?T:g;if(t){if(e<0)return T;if(e>=d)return b}else{if(e<=-y)return S;if(e+1>=y)return v}return e<0?c(-e,t).neg():l(e%h|0,e/h|0,t)}function l(e,t,r){return new n(e,t,r)}n.fromInt=s,n.fromNumber=c,n.fromBits=l;var p=Math.pow;function u(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return u(e.substring(1),t,r).neg();for(var i=c(p(r,8)),a=g,o=0;o<e.length;o+=8){var s=Math.min(8,e.length-o),l=parseInt(e.substring(o,o+s),r);if(s<8){var _=c(p(r,s));a=a.mul(_).add(c(l))}else a=(a=a.mul(i)).add(c(l))}return a.unsigned=t,a}function _(e,t){return"number"==typeof e?c(e,t):"string"==typeof e?u(e,t):l(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=u,n.fromValue=_;var h=4294967296,d=h*h,y=d/2,m=s(1<<24),g=s(0);n.ZERO=g;var T=s(0,!0);n.UZERO=T;var f=s(1);n.ONE=f;var E=s(1,!0);n.UONE=E;var I=s(-1);n.NEG_ONE=I;var v=l(-1,2147483647,!1);n.MAX_VALUE=v;var b=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=b;var S=l(0,-2147483648,!1);n.MIN_VALUE=S;var A=n.prototype;A.toInt=function(){return this.unsigned?this.low>>>0:this.low},A.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},A.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(S)){var t=c(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=c(p(e,6),this.unsigned),a=this,o="";;){var s=a.div(i),l=(a.sub(s.mul(i)).toInt()>>>0).toString(e);if((a=s).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},A.getHighBits=function(){return this.high},A.getHighBitsUnsigned=function(){return this.high>>>0},A.getLowBits=function(){return this.low},A.getLowBitsUnsigned=function(){return this.low>>>0},A.getNumBitsAbs=function(){if(this.isNegative())return this.eq(S)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},A.isZero=function(){return 0===this.high&&0===this.low},A.eqz=A.isZero,A.isNegative=function(){return!this.unsigned&&this.high<0},A.isPositive=function(){return this.unsigned||this.high>=0},A.isOdd=function(){return 1==(1&this.low)},A.isEven=function(){return 0==(1&this.low)},A.equals=function(e){return i(e)||(e=_(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},A.eq=A.equals,A.notEquals=function(e){return!this.eq(e)},A.neq=A.notEquals,A.ne=A.notEquals,A.lessThan=function(e){return this.comp(e)<0},A.lt=A.lessThan,A.lessThanOrEqual=function(e){return this.comp(e)<=0},A.lte=A.lessThanOrEqual,A.le=A.lessThanOrEqual,A.greaterThan=function(e){return this.comp(e)>0},A.gt=A.greaterThan,A.greaterThanOrEqual=function(e){return this.comp(e)>=0},A.gte=A.greaterThanOrEqual,A.ge=A.greaterThanOrEqual,A.compare=function(e){if(i(e)||(e=_(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},A.comp=A.compare,A.negate=function(){return!this.unsigned&&this.eq(S)?S:this.not().add(f)},A.neg=A.negate,A.add=function(e){i(e)||(e=_(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,a=65535&this.low,o=e.high>>>16,s=65535&e.high,c=e.low>>>16,p=0,u=0,h=0,d=0;return h+=(d+=a+(65535&e.low))>>>16,u+=(h+=n+c)>>>16,p+=(u+=r+s)>>>16,p+=t+o,l((h&=65535)<<16|(d&=65535),(p&=65535)<<16|(u&=65535),this.unsigned)},A.subtract=function(e){return i(e)||(e=_(e)),this.add(e.neg())},A.sub=A.subtract,A.multiply=function(e){if(this.isZero())return g;if(i(e)||(e=_(e)),r)return l(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(S))return e.isOdd()?S:g;if(e.eq(S))return this.isOdd()?S:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return c(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,a=this.low>>>16,o=65535&this.low,s=e.high>>>16,p=65535&e.high,u=e.low>>>16,h=65535&e.low,d=0,y=0,T=0,f=0;return T+=(f+=o*h)>>>16,y+=(T+=a*h)>>>16,T&=65535,y+=(T+=o*u)>>>16,d+=(y+=n*h)>>>16,y&=65535,d+=(y+=a*u)>>>16,y&=65535,d+=(y+=o*p)>>>16,d+=t*h+n*u+a*p+o*s,l((T&=65535)<<16|(f&=65535),(d&=65535)<<16|(y&=65535),this.unsigned)},A.mul=A.multiply,A.divide=function(e){if(i(e)||(e=_(e)),e.isZero())throw Error("division by zero");var t,n,a;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?T:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return T;if(e.gt(this.shru(1)))return E;a=T}else{if(this.eq(S))return e.eq(f)||e.eq(I)?S:e.eq(S)?f:(t=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?f:I:(n=this.sub(e.mul(t)),a=t.add(n.div(e)));if(e.eq(S))return this.unsigned?T:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();a=g}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),s=o<=48?1:p(2,o-48),u=c(t),h=u.mul(e);h.isNegative()||h.gt(n);)h=(u=c(t-=s,this.unsigned)).mul(e);u.isZero()&&(u=f),a=a.add(u),n=n.sub(h)}return a},A.div=A.divide,A.modulo=function(e){return i(e)||(e=_(e)),r?l((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},A.mod=A.modulo,A.rem=A.modulo,A.not=function(){return l(~this.low,~this.high,this.unsigned)},A.and=function(e){return i(e)||(e=_(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},A.or=function(e){return i(e)||(e=_(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},A.xor=function(e){return i(e)||(e=_(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},A.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):l(0,this.low<<e-32,this.unsigned)},A.shl=A.shiftLeft,A.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},A.shr=A.shiftRight,A.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?l(this.low>>>e|t<<32-e,t>>>e,this.unsigned):l(32===e?t:t>>>e-32,0,this.unsigned)},A.shru=A.shiftRightUnsigned,A.shr_u=A.shiftRightUnsigned,A.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},A.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},A.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},A.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},A.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};Object.defineProperty(t,"__esModule",{value:!0});var i,a=r(1),o=r(5),s=r(6),c=r(4),l=r(3),p=r(9),u=r(0);function _(e,t,r,n,u,_){var g,T,f,E,I=e.module;switch(t.internalName){case i.isInteger:var v=d(e,r,n,_);return e.currentType=s.Type.bool,v?v.is(4)&&!v.is(256)?I.createI32(1):I.createI32(0):I.createUnreachable();case i.isFloat:v=d(e,r,n,_);return e.currentType=s.Type.bool,v?v.is(8)?I.createI32(1):I.createI32(0):I.createUnreachable();case i.isSigned:v=d(e,r,n,_);return e.currentType=s.Type.bool,v?v.is(1)?I.createI32(1):I.createI32(0):I.createUnreachable();case i.isReference:v=d(e,r,n,_);return e.currentType=s.Type.bool,v?v.is(256)?I.createI32(1):I.createI32(0):I.createUnreachable();case i.isString:v=d(e,r,n,_);if(e.currentType=s.Type.bool,!v)return I.createUnreachable();if(M=v.classReference){var b=e.program.stringInstance;if(b&&M.isAssignableTo(b))return I.createI32(1)}return I.createI32(0);case i.isArray:v=d(e,r,n,_);if(e.currentType=s.Type.bool,!v)return I.createUnreachable();var S=v.classReference;if(!S)return I.createI32(0);var A=S.prototype;return I.createI32(A.extends(e.program.arrayPrototype)?1:0);case i.isDefined:if(e.currentType=s.Type.bool,r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length)return e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();var N=e.resolver.resolveExpression(n[0],e.currentFlow,s.Type.void,p.ReportMode.SWALLOW);return I.createI32(N?1:0);case i.isConstant:if(e.currentType=s.Type.bool,r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length)return e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();var C=e.compileExpressionRetainType(n[0],s.Type.i32,0);return e.currentType=s.Type.bool,I.createI32(c.getExpressionId(C)==c.ExpressionId.Const?1:0);case i.isManaged:if(!e.program.hasGC)return e.currentType=s.Type.bool,I.createI32(0);v=d(e,r,n,_);return e.currentType=s.Type.bool,v?null===(M=v.classReference)||M.hasDecorator(l.DecoratorFlags.UNMANAGED)?I.createI32(0):I.createI32(1):I.createUnreachable();case i.clz:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,1)}else g=e.compileExpression(n[0],s.Type.i32,0,1);switch(e.currentType.kind){case 0:case 1:case 5:case 6:E=I.createUnary(c.UnaryOp.ClzI32,g);break;case 10:case 2:case 7:E=I.createUnary(c.UnaryOp.ClzI32,g);break;case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}case 4:E=I.createUnary(e.options.isWasm64?c.UnaryOp.ClzI64:c.UnaryOp.ClzI32,g);break;case 3:case 8:E=I.createUnary(c.UnaryOp.ClzI64,g);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.ctz:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],0,1)}else g=e.compileExpression(n[0],s.Type.i32,0,1);switch(e.currentType.kind){case 0:case 1:case 5:case 6:E=I.createUnary(c.UnaryOp.CtzI32,g);break;case 10:case 2:case 7:E=I.createUnary(c.UnaryOp.CtzI32,g);break;case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}case 4:E=I.createUnary(e.options.isWasm64?c.UnaryOp.CtzI64:c.UnaryOp.CtzI32,g);break;case 3:case 8:E=I.createUnary(c.UnaryOp.CtzI64,g);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.popcnt:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,1)}else g=e.compileExpression(n[0],s.Type.i32,0,1);switch(e.currentType.kind){case 0:case 1:case 5:case 6:E=I.createUnary(c.UnaryOp.PopcntI32,g);break;case 10:case 2:case 7:E=I.createUnary(c.UnaryOp.PopcntI32,g);break;case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}case 4:E=I.createUnary(e.options.isWasm64?c.UnaryOp.PopcntI64:c.UnaryOp.PopcntI32,g);break;case 3:case 8:E=I.createUnary(c.UnaryOp.PopcntI64,g);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.rotl:if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,1)}else g=e.compileExpression(n[0],s.Type.i32,0,1);switch(T=e.compileExpression(n[1],e.currentType,1,0),e.currentType.kind){case 0:case 1:case 5:case 6:case 10:E=e.ensureSmallIntegerWrap(I.createBinary(c.BinaryOp.RotlI32,g,T),e.currentType);case 2:case 7:E=I.createBinary(c.BinaryOp.RotlI32,g,T);break;case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}case 4:E=I.createBinary(e.options.isWasm64?c.BinaryOp.RotlI64:c.BinaryOp.RotlI32,g,T);break;case 3:case 8:E=I.createBinary(c.BinaryOp.RotlI64,g,T);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.rotr:if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,1)}else g=e.compileExpression(n[0],s.Type.i32,0,1);switch(T=e.compileExpression(n[1],e.currentType,1,0),e.currentType.kind){case 0:case 1:case 5:case 6:case 10:E=e.ensureSmallIntegerWrap(I.createBinary(c.BinaryOp.RotrI32,g,T),e.currentType);break;case 2:case 7:E=I.createBinary(c.BinaryOp.RotrI32,g,T);break;case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}case 4:E=I.createBinary(e.options.isWasm64?c.BinaryOp.RotrI64:c.BinaryOp.RotrI32,g,T);break;case 3:case 8:E=I.createBinary(c.BinaryOp.RotrI64,g,T);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.abs:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,1)}else g=e.compileExpression(n[0],s.Type.f64,0,1);switch(e.currentType.kind){case 0:case 1:case 2:var O=(R=e.currentFlow).getTempLocal(s.Type.i32,!1),x=R.getAndFreeTempLocal(s.Type.i32,!1).index,k=O.index;E=I.createBinary(c.BinaryOp.XorI32,I.createBinary(c.BinaryOp.AddI32,I.createTeeLocal(x,I.createBinary(c.BinaryOp.ShrI32,I.createTeeLocal(k,g),I.createI32(31))),I.createGetLocal(k,c.NativeType.I32)),I.createGetLocal(x,c.NativeType.I32)),R.freeTempLocal(O);break;case 4:var L=e.options,R=e.currentFlow,F=L.isWasm64;O=R.getTempLocal(L.usizeType,!1),x=R.getAndFreeTempLocal(L.usizeType,!1).index,k=O.index;E=I.createBinary(F?c.BinaryOp.XorI64:c.BinaryOp.XorI32,I.createBinary(F?c.BinaryOp.AddI64:c.BinaryOp.AddI32,I.createTeeLocal(x,I.createBinary(F?c.BinaryOp.ShrI64:c.BinaryOp.ShrI32,I.createTeeLocal(k,g),F?I.createI64(63):I.createI32(31))),I.createGetLocal(k,L.nativeSizeType)),I.createGetLocal(x,L.nativeSizeType)),R.freeTempLocal(O);break;case 3:O=(R=e.currentFlow).getTempLocal(s.Type.i64,!1),x=R.getAndFreeTempLocal(s.Type.i64,!1).index,k=O.index;E=I.createBinary(c.BinaryOp.XorI64,I.createBinary(c.BinaryOp.AddI64,I.createTeeLocal(x,I.createBinary(c.BinaryOp.ShrI64,I.createTeeLocal(k,g),I.createI64(63))),I.createGetLocal(k,c.NativeType.I64)),I.createGetLocal(x,c.NativeType.I64)),R.freeTempLocal(O);break;case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}case 5:case 6:case 7:case 8:case 10:E=g;break;case 11:E=I.createUnary(c.UnaryOp.AbsF32,g);break;case 12:E=I.createUnary(c.UnaryOp.AbsF64,g);break;case 14:E=I.createUnreachable();break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.max:if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,1)}else g=e.compileExpression(n[0],s.Type.f64,0,1);switch(T=e.compileExpression(n[1],e.currentType,1,1),e.currentType.kind){case 0:case 1:case 2:var B=(R=e.currentFlow).getTempLocal(e.currentType,!R.canOverflow(g,e.currentType));O=R.getAndFreeTempLocal(e.currentType,!R.canOverflow(T,e.currentType));R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(c.BinaryOp.GtI32,I.createGetLocal(B.index,c.NativeType.I32),I.createGetLocal(O.index,c.NativeType.I32)));break;case 5:case 6:case 7:case 10:B=(R=e.currentFlow).getTempLocal(e.currentType,!R.canOverflow(g,e.currentType)),O=R.getAndFreeTempLocal(e.currentType,!R.canOverflow(T,e.currentType));R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(c.BinaryOp.GtU32,I.createGetLocal(B.index,c.NativeType.I32),I.createGetLocal(O.index,c.NativeType.I32)));break;case 3:B=(R=e.currentFlow).getTempLocal(s.Type.i64,!1),O=R.getAndFreeTempLocal(s.Type.i64,!1);R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(c.BinaryOp.GtI64,I.createGetLocal(B.index,c.NativeType.I64),I.createGetLocal(O.index,c.NativeType.I64)));break;case 8:B=(R=e.currentFlow).getTempLocal(s.Type.i64,!1),O=R.getAndFreeTempLocal(s.Type.i64,!1);R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(c.BinaryOp.GtU64,I.createGetLocal(B.index,c.NativeType.I64),I.createGetLocal(O.index,c.NativeType.I64)));break;case 4:B=(R=e.currentFlow).getTempLocal(e.options.usizeType,!1),O=R.getAndFreeTempLocal(e.options.usizeType,!1);R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(e.options.isWasm64?c.BinaryOp.GtI64:c.BinaryOp.GtI32,I.createGetLocal(B.index,e.options.nativeSizeType),I.createGetLocal(O.index,e.options.nativeSizeType)));break;case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}B=(R=e.currentFlow).getTempLocal(e.options.usizeType,!1),O=R.getAndFreeTempLocal(e.options.usizeType,!1);R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(e.options.isWasm64?c.BinaryOp.GtU64:c.BinaryOp.GtU32,I.createGetLocal(B.index,e.options.nativeSizeType),I.createGetLocal(O.index,e.options.nativeSizeType)));break;case 11:E=I.createBinary(c.BinaryOp.MaxF32,g,T);break;case 12:E=I.createBinary(c.BinaryOp.MaxF64,g,T);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.min:if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,1)}else g=e.compileExpression(n[0],s.Type.f64,0,1);switch(T=e.compileExpression(n[1],e.currentType,1,1),e.currentType.kind){case 0:case 1:case 2:B=(R=e.currentFlow).getTempLocal(e.currentType,!R.canOverflow(g,e.currentType)),O=R.getAndFreeTempLocal(e.currentType,!R.canOverflow(T,e.currentType));R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(c.BinaryOp.LtI32,I.createGetLocal(B.index,c.NativeType.I32),I.createGetLocal(O.index,c.NativeType.I32)));break;case 5:case 6:case 7:case 10:B=(R=e.currentFlow).getTempLocal(e.currentType,!R.canOverflow(g,e.currentType)),O=R.getAndFreeTempLocal(e.currentType,!R.canOverflow(T,e.currentType));R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(c.BinaryOp.LtU32,I.createGetLocal(B.index,c.NativeType.I32),I.createGetLocal(O.index,c.NativeType.I32)));break;case 3:B=(R=e.currentFlow).getTempLocal(s.Type.i64,!1),O=R.getAndFreeTempLocal(s.Type.i64,!1);R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(c.BinaryOp.LtI64,I.createGetLocal(B.index,c.NativeType.I64),I.createGetLocal(O.index,c.NativeType.I64)));break;case 8:B=(R=e.currentFlow).getTempLocal(s.Type.i64,!1),O=R.getAndFreeTempLocal(s.Type.i64,!1);R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(c.BinaryOp.LtU64,I.createGetLocal(B.index,c.NativeType.I64),I.createGetLocal(O.index,c.NativeType.I64)));break;case 4:B=(R=e.currentFlow).getTempLocal(e.options.usizeType,!1),O=R.getAndFreeTempLocal(e.options.usizeType,!1);R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(e.options.isWasm64?c.BinaryOp.LtI64:c.BinaryOp.LtI32,I.createGetLocal(B.index,e.options.nativeSizeType),I.createGetLocal(O.index,e.options.nativeSizeType)));break;case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}B=(R=e.currentFlow).getTempLocal(e.options.usizeType,!1),O=R.getAndFreeTempLocal(e.options.usizeType,!1);R.freeTempLocal(B),E=I.createSelect(I.createTeeLocal(B.index,g),I.createTeeLocal(O.index,T),I.createBinary(e.options.isWasm64?c.BinaryOp.LtU64:c.BinaryOp.LtU32,I.createGetLocal(B.index,e.options.nativeSizeType),I.createGetLocal(O.index,e.options.nativeSizeType)));break;case 11:E=I.createBinary(c.BinaryOp.MinF32,g,T);break;case 12:E=I.createBinary(c.BinaryOp.MinF64,g,T);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.ceil:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,0)}else g=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}default:E=g;break;case 11:E=I.createUnary(c.UnaryOp.CeilF32,g);break;case 12:E=I.createUnary(c.UnaryOp.CeilF64,g);break;case 14:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.floor:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,0)}else g=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}default:E=g;break;case 11:E=I.createUnary(c.UnaryOp.FloorF32,g);break;case 12:E=I.createUnary(c.UnaryOp.FloorF64,g);break;case 14:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.copysign:if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,0)}else g=e.compileExpression(n[0],s.Type.f64,0,0);switch(T=e.compileExpression(n[1],e.currentType,1,0),e.currentType.kind){case 11:E=I.createBinary(c.BinaryOp.CopysignF32,g,T);break;case 12:E=I.createBinary(c.BinaryOp.CopysignF64,g,T);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.nearest:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,0)}else g=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}default:E=g;break;case 11:E=I.createUnary(c.UnaryOp.NearestF32,g);break;case 12:E=I.createUnary(c.UnaryOp.NearestF64,g);break;case 14:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.reinterpret:if(1!=n.length)return r&&1==r.length||(r&&r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0")),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(!r||1!=r.length)return r&&r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable();switch(r[0].kind){case 2:case 7:g=e.compileExpression(n[0],s.Type.f32,1,0),E=I.createUnary(c.UnaryOp.ReinterpretF32,g);break;case 3:case 8:g=e.compileExpression(n[0],s.Type.f64,1,0),E=I.createUnary(c.UnaryOp.ReinterpretF64,g);break;case 9:if(r[0].is(256))return e.error(a.DiagnosticCode.Operation_not_supported,_.range),e.currentType=r[0],I.createUnreachable();case 4:g=e.compileExpression(n[0],e.options.isWasm64?s.Type.f64:s.Type.f32,1,0),E=I.createUnary(e.options.isWasm64?c.UnaryOp.ReinterpretF64:c.UnaryOp.ReinterpretF32,g);break;case 11:g=e.compileExpression(n[0],s.Type.i32,1,0),E=I.createUnary(c.UnaryOp.ReinterpretI32,g);break;case 12:g=e.compileExpression(n[0],s.Type.i64,1,0),E=I.createUnary(c.UnaryOp.ReinterpretI64,g);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return e.currentType=r[0],E;case i.sqrt:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,0)}else g=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 11:E=I.createUnary(c.UnaryOp.SqrtF32,g);break;case 12:E=I.createUnary(c.UnaryOp.SqrtF64,g);break;default:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.trunc:if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(r&&r.length){if(e.currentType=r[0],1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,0)}else g=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 9:if(e.currentType.is(256)){e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable();break}default:E=g;break;case 11:E=I.createUnary(c.UnaryOp.TruncF32,g);break;case 12:E=I.createUnary(c.UnaryOp.TruncF64,g);break;case 14:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.load:return n.length<1||n.length>2?(r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),n.length<1?e.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,_.range,"1",n.length.toString(10)):e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),I.createUnreachable()):r&&1==r.length?(g=e.compileExpression(n[0],e.options.usizeType,1,0),(G=2==n.length?y(e,n[1]):0)<0?I.createUnreachable():(e.currentType=r[0],I.createLoad(r[0].byteSize,r[0].is(5),g,r[0].is(4)&&u.is(4)&&u.size>r[0].size?(e.currentType=u).toNativeType():(e.currentType=r[0]).toNativeType(),G))):(r&&r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable());case i.store:if(e.currentType=s.Type.void,n.length<2||n.length>3)return r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),n.length<2?e.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,_.range,"2",n.length.toString(10)):e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"3",n.length.toString(10)),I.createUnreachable();if(!r||1!=r.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable();g=e.compileExpression(n[0],e.options.usizeType,1,0),T=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0);v=void 0;return r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size<r[0].size)?(T=e.convertExpression(T,e.currentType,r[0],1,0,n[1]),v=r[0]):v=e.currentType,(G=3==n.length?y(e,n[2]):0)<0?I.createUnreachable():(e.currentType=s.Type.void,I.createStore(r[0].byteSize,g,T,v.toNativeType(),G));case i.atomic_load:if(!e.options.hasFeature(16))break;return n.length<1||n.length>2?(r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),n.length<1?e.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,_.range,"1",n.length.toString(10)):e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),I.createUnreachable()):r&&1==r.length?(g=e.compileExpression(n[0],e.options.usizeType,1,0),(G=2==n.length?y(e,n[1]):0)<0?I.createUnreachable():(e.currentType=r[0],I.createAtomicLoad(r[0].byteSize,g,r[0].is(4)&&u.is(4)&&u.size>r[0].size?(e.currentType=u).toNativeType():(e.currentType=r[0]).toNativeType(),G))):(r&&r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable());case i.atomic_store:if(!e.options.hasFeature(16))break;if(e.currentType=s.Type.void,n.length<2||n.length>3)return r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),n.length<2?e.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,_.range,"2",n.length.toString(10)):e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"3",n.length.toString(10)),I.createUnreachable();if(!r||1!=r.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable();g=e.compileExpression(n[0],e.options.usizeType,1,0),T=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0);v=void 0;return r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size<r[0].size)?(T=e.convertExpression(T,e.currentType,r[0],1,0,n[1]),v=r[0]):v=e.currentType,(G=3==n.length?y(e,n[2]):0)<0?I.createUnreachable():(e.currentType=s.Type.void,I.createAtomicStore(r[0].byteSize,g,T,v.toNativeType(),G));case i.atomic_add:case i.atomic_sub:case i.atomic_and:case i.atomic_or:case i.atomic_xor:case i.atomic_xchg:if(!e.options.hasFeature(16))break;if(n.length<2||n.length>3)return r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),n.length<2?e.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,_.range,"2",n.length.toString(10)):e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"3",n.length.toString(10)),I.createUnreachable();if(!r||1!=r.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable();g=e.compileExpression(n[0],e.options.usizeType,1,0),T=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0);v=void 0;if(r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size<r[0].size)?(T=e.convertExpression(T,e.currentType,r[0],1,0,n[1]),v=r[0]):v=e.currentType,(G=3==n.length?y(e,n[2]):0)<0)return I.createUnreachable();var D=null;switch(t.internalName){case i.atomic_add:D=c.AtomicRMWOp.Add;break;case i.atomic_sub:D=c.AtomicRMWOp.Sub;break;case i.atomic_and:D=c.AtomicRMWOp.And;break;case i.atomic_or:D=c.AtomicRMWOp.Or;break;case i.atomic_xor:D=c.AtomicRMWOp.Xor;break;case i.atomic_xchg:D=c.AtomicRMWOp.Xchg}return e.currentType=r[0],null!==D?I.createAtomicRMW(D,r[0].byteSize,G,g,T,v.toNativeType()):(e.error(a.DiagnosticCode.Operation_not_supported,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable());case i.atomic_cmpxchg:if(!e.options.hasFeature(16))break;if(n.length<3||n.length>4)return r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),n.length<3?e.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,_.range,"2",n.length.toString(10)):e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"3",n.length.toString(10)),I.createUnreachable();if(!r||1!=r.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable();g=e.compileExpression(n[0],e.options.usizeType,1,0),T=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0),f=e.compileExpression(n[2],r[0],r[0].is(4)?0:1,0);v=void 0;return r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size<r[0].size)?(T=e.convertExpression(T,e.currentType,r[0],1,0,n[1]),f=e.convertExpression(f,e.currentType,r[0],1,0,n[2]),v=r[0]):v=e.currentType,(G=4==n.length?y(e,n[3]):0)<0?I.createUnreachable():(e.currentType=r[0],I.createAtomicCmpxchg(r[0].byteSize,G,g,T,f,v.toNativeType()));case i.atomic_wait:if(!e.options.hasFeature(16))break;var U=null==r;if(3!=n.length&&(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"3",n.length.toString(10)),U=!0),r&&1==r.length||(e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),U=!0),!r||U)return I.createUnreachable();g=e.compileExpression(n[0],e.options.usizeType,1,0),T=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0),f=e.compileExpression(n[2],s.Type.i64,1,0);v=r[0];return r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size<r[0].size)&&(T=e.convertExpression(T,e.currentType,r[0],1,0,n[1]),f=e.convertExpression(f,e.currentType,r[0],1,0,n[2])),I.createAtomicWait(g,T,f,v.toNativeType());case i.atomic_notify:if(!e.options.hasFeature(16))break;U=null==r;return 2!=n.length&&(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),U=!0),r&&1==r.length||(e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),U=!0),!r||U?I.createUnreachable():(g=e.compileExpression(n[0],e.options.usizeType,1,0),T=e.compileExpression(n[1],s.Type.i32,1,0),I.createAtomicWake(g,T));case i.sizeof:if(e.currentType=e.options.usizeType,0!=n.length)return r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"0",n.length.toString(10)),I.createUnreachable();r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0");var P=r[0].byteSize;return e.options.isWasm64?u.is(4)&&u.size<=32?(e.currentType=s.Type.u32,E=I.createI32(P)):E=I.createI64(P,0):u.is(4)&&64==u.size?(e.currentType=s.Type.u64,E=I.createI64(P,0)):E=I.createI32(P),E;case i.alignof:if(e.currentType=e.options.usizeType,0!=n.length)return r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"0",n.length.toString(10)),I.createUnreachable();if(!r||1!=r.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable();var w=void 0;switch(P=r[0].byteSize){case 1:w=0;break;case 2:w=1;break;case 4:w=2;break;case 8:w=3;break;default:return assert(!1,"unexected byte size"),I.createUnreachable()}return e.options.isWasm64?u.is(4)&&u.size<=32?(e.currentType=s.Type.u32,E=I.createI32(w)):E=I.createI64(w,0):u.is(4)&&64==u.size?(e.currentType=s.Type.u64,E=I.createI64(w,0)):E=I.createI32(w),E;case i.offsetof:if(e.currentType=e.options.usizeType,n.length>1)return r&&1==r.length||e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();if(!r||1!=r.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable();var M;if(!(M=r[0].classReference))return e.error(a.DiagnosticCode.Operation_not_supported,_.range),I.createUnreachable();var G=void 0;if(n.length){if(n[0].kind!=o.NodeKind.LITERAL||n[0].literalKind!=o.LiteralKind.STRING)return e.error(a.DiagnosticCode.String_literal_expected,n[0].range),I.createUnreachable();var V=n[0].value,K=M.members?M.members.get(V):null;if(!K||K.kind!=l.ElementKind.FIELD)return e.error(a.DiagnosticCode.Type_0_has_no_property_1,n[0].range,M.internalName,V),I.createUnreachable();G=K.memoryOffset}else G=M.currentMemoryOffset;return e.options.isWasm64?u.is(4)&&u.size<=32?(e.currentType=s.Type.u32,I.createI32(G)):I.createI64(G):u.is(4)&&64==u.size?(e.currentType=s.Type.u64,I.createI64(G)):I.createI32(G);case i.select:if(3!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"3",n.length.toString(10)),I.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,0)}else g=e.compileExpressionRetainType(n[0],s.Type.i32,0);v=e.currentType;switch(T=e.compileExpression(n[1],v,1,0),f=e.makeIsTrueish(e.compileExpressionRetainType(n[2],s.Type.bool,0),e.currentType),e.currentType=v,e.currentType.kind){case 0:case 1:case 5:case 6:case 10:default:E=I.createSelect(g,T,f);break;case 14:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=I.createUnreachable()}return E;case i.unreachable:return 0!=n.length&&e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"0",n.length.toString(10)),r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),I.createUnreachable();case i.memory_size:return e.currentType=s.Type.i32,0!=n.length&&e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"0",n.length.toString(10)),r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),I.createHost(c.HostOp.CurrentMemory);case i.memory_grow:return e.currentType=s.Type.i32,1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"0",n.length.toString(10)),g=I.createUnreachable()):g=e.compileExpression(n[0],s.Type.i32,1,0),r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),I.createHost(c.HostOp.GrowMemory,null,[g]);case i.memory_copy:if(!e.options.hasFeature(4)){var z=e.resolver.resolveFunction(t,null);return e.currentType=s.Type.void,z?e.compileCallDirect(z,n,_):I.createUnreachable()}if(r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),3!=n.length)return e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"3",n.length.toString(10)),e.currentType=s.Type.void,I.createUnreachable();var H=e.options.usizeType;return g=e.compileExpression(n[0],H,1,0),T=e.compileExpression(n[1],H,1,0),f=e.compileExpression(n[2],H,1,0),e.currentType=s.Type.void,I.createMemoryCopy(g,T,f);case i.memory_fill:if(!e.options.hasFeature(4)){z=e.resolver.resolveFunction(t,null);return e.currentType=s.Type.void,z?e.compileCallDirect(z,n,_):I.createUnreachable()}if(r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),3!=n.length)return e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"3",n.length.toString(10)),e.currentType=s.Type.void,I.createUnreachable();H=e.options.usizeType;return g=e.compileExpression(n[0],H,1,0),T=e.compileExpression(n[1],s.Type.u32,1,0),f=e.compileExpression(n[2],H,1,0),e.currentType=s.Type.void,I.createMemoryFill(g,T,f);case i.changetype:return r&&1==r.length?1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=r[0],I.createUnreachable()):(g=e.compileExpressionRetainType(n[0],r[0],0),e.currentType=r[0],e.currentType.size!=r[0].size?(e.error(a.DiagnosticCode.Operation_not_supported,_.range),I.createUnreachable()):g):(r&&r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable());case i.assert:if(n.length<1||n.length>2)return r&&(r.length&&(e.currentType=r[0].nonNullableType),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),n.length<1?e.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,_.range,"1",n.length.toString(10)):n.length>2&&e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"2",n.length.toString(10)),I.createUnreachable();if(r){if(r.length&&(e.currentType=r[0].nonNullableType),1!=r.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();g=e.compileExpression(n[0],r[0],1,1)}else g=e.compileExpressionRetainType(n[0],s.Type.bool,1);v=e.currentType;if(e.currentType=v.nonNullableType,e.options.noAssert)return u==s.Type.void?(e.currentType=s.Type.void,I.createNop()):g;var Y=m(e,2==n.length?n[1]:null,_);if(e.currentType=v.nonNullableType,u==s.Type.void){switch(e.currentType.kind){default:E=I.createIf(I.createUnary(c.UnaryOp.EqzI32,g),Y);break;case 3:case 8:E=I.createIf(I.createUnary(c.UnaryOp.EqzI64,g),Y);break;case 4:case 9:E=I.createIf(I.createUnary(e.options.isWasm64?c.UnaryOp.EqzI64:c.UnaryOp.EqzI32,g),Y);break;case 11:E=I.createIf(I.createBinary(c.BinaryOp.EqF32,g,I.createF32(0)),Y);break;case 12:E=I.createIf(I.createBinary(c.BinaryOp.EqF64,g,I.createF64(0)),Y);break;case 14:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=Y}e.currentType=s.Type.void}else switch(e.currentType.kind){case 0:case 1:case 5:case 6:case 10:var W=(R=e.currentFlow).getAndFreeTempLocal(e.currentType,!R.canOverflow(g,e.currentType));E=I.createIf(I.createTeeLocal(W.index,g),I.createGetLocal(W.index,c.NativeType.I32),Y);break;case 2:case 7:default:W=e.currentFlow.getAndFreeTempLocal(s.Type.i32,!1);E=I.createIf(I.createTeeLocal(W.index,g),I.createGetLocal(W.index,c.NativeType.I32),Y);break;case 3:case 8:W=e.currentFlow.getAndFreeTempLocal(s.Type.i64,!1);E=I.createIf(I.createUnary(c.UnaryOp.EqzI64,I.createTeeLocal(W.index,g)),Y,I.createGetLocal(W.index,c.NativeType.I64));break;case 4:case 9:W=e.currentFlow.getAndFreeTempLocal(e.options.usizeType,!1);E=I.createIf(I.createUnary(e.options.isWasm64?c.UnaryOp.EqzI64:c.UnaryOp.EqzI32,I.createTeeLocal(W.index,g)),Y,I.createGetLocal(W.index,e.options.nativeSizeType));break;case 11:W=e.currentFlow.getAndFreeTempLocal(s.Type.f32,!1);E=I.createIf(I.createBinary(c.BinaryOp.EqF32,I.createTeeLocal(W.index,g),I.createF32(0)),Y,I.createGetLocal(W.index,c.NativeType.F32));break;case 12:W=e.currentFlow.getAndFreeTempLocal(s.Type.f64,!1);E=I.createIf(I.createBinary(c.BinaryOp.EqF64,I.createTeeLocal(W.index,g),I.createF64(0)),Y,I.createGetLocal(W.index,c.NativeType.F64));break;case 14:e.error(a.DiagnosticCode.Operation_not_supported,_.range),E=Y}return E;case i.unchecked:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable()):((R=e.currentFlow).set(8192),E=e.compileExpressionRetainType(n[0],u,0),R.unset(8192),E);case i.call_indirect:if(n.length<1)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10))),e.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),I.createUnreachable();var X=void 0;if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r.length.toString(10)),I.createUnreachable();X=r[0]}else X=u;if(g=e.compileExpressionRetainType(n[0],s.Type.u32,0),7!=e.currentType.kind)return e.error(a.DiagnosticCode.Operation_not_supported,n[0].range),I.createUnreachable();for(var Q=n.length-1,q=new Array(Q),j=new Array(Q+1),Z=X.toNativeType(),J=new Array(Q),$=0;$<Q;++$){q[$]=e.compileExpressionRetainType(n[1+$],s.Type.i32,0);var ee=e.currentType;j[$]=ee.toSignatureString(),J[$]=ee.toNativeType()}j[Q]=X.toSignatureString();var te=j.join(""),re=I.getFunctionTypeBySignature(Z,J);return re||(re=I.addFunctionType(te,Z,J)),e.currentType=X,I.createCallIndirect(g,q,te);case i.instantiate:if(!r||1!=r.length)return r&&r.length&&(e.currentType=r[0]),e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,_.range,"1",r?r.length.toString(10):"0"),I.createUnreachable();var ne=r[0].classReference;return ne?e.compileInstantiate(ne,n,_):(e.error(a.DiagnosticCode.Operation_not_supported,_.range),I.createUnreachable());case i.ERROR:return e.error(a.DiagnosticCode.User_defined_0,_.range,(n.length?n[0]:_).range.toString()),I.createUnreachable();case i.WARNING:return e.warning(a.DiagnosticCode.User_defined_0,_.range,(n.length?n[0]:_).range.toString()),I.createNop();case i.INFO:return e.info(a.DiagnosticCode.User_defined_0,_.range,(n.length?n[0]:_).range.toString()),I.createNop();case i.i8:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.i8,I.createUnreachable()):e.compileExpression(n[0],s.Type.i8,2,0);case i.i16:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.i16,I.createUnreachable()):e.compileExpression(n[0],s.Type.i16,2,0);case i.i32:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.i32,I.createUnreachable()):e.compileExpression(n[0],s.Type.i32,2,0);case i.i64:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.i64,I.createUnreachable()):e.compileExpression(n[0],s.Type.i64,2,0);case i.isize:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=e.options.isWasm64?s.Type.isize64:s.Type.isize32,I.createUnreachable()):e.compileExpression(n[0],e.options.isWasm64?s.Type.isize64:s.Type.isize32,2,0);case i.u8:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.u8,I.createUnreachable()):e.compileExpression(n[0],s.Type.u8,2,0);case i.u16:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.u16,I.createUnreachable()):e.compileExpression(n[0],s.Type.u16,2,0);case i.u32:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.u32,I.createUnreachable()):e.compileExpression(n[0],s.Type.u32,2,0);case i.u64:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.u64,I.createUnreachable()):e.compileExpression(n[0],s.Type.u64,2,0);case i.usize:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=e.options.usizeType,I.createUnreachable()):e.compileExpression(n[0],e.options.usizeType,2,0);case i.bool:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.bool,I.createUnreachable()):e.compileExpression(n[0],s.Type.bool,2,0);case i.f32:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.f32,I.createUnreachable()):e.compileExpression(n[0],s.Type.f32,2,0);case i.f64:return r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length?(e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.f64,I.createUnreachable()):e.compileExpression(n[0],s.Type.f64,2,0);case i.iterateRoots:if(r&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),1!=n.length)return e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,_.range,"1",n.length.toString(10)),e.currentType=s.Type.void,I.createUnreachable();var ie=e.compileExpressionRetainType(n[0],s.Type.u32,0),ae=(v=e.currentType).signatureReference;return e.currentType=s.Type.void,v.is(256)&&ae&&1==ae.parameterTypes.length&&ae.parameterTypes[0]==e.options.usizeType?(e.currentType=s.Type.void,e.needsIterateRoots=!0,I.createCall("~iterateRoots",[ie],c.NativeType.None)):(e.error(a.DiagnosticCode.Type_0_is_not_assignable_to_type_1,_.range,v.toString(),"(ref: usize) => void"),I.createUnreachable())}var oe=function(e,t,r,n,a){switch(t.internalName){case i.i32_clz:return h(i.clz,e,s.Type.i32,r,s.Type.i32,a);case i.i64_clz:return h(i.clz,e,s.Type.i64,r,s.Type.i64,a);case i.i32_ctz:return h(i.ctz,e,s.Type.i32,r,s.Type.i32,a);case i.i64_ctz:return h(i.ctz,e,s.Type.i64,r,s.Type.i64,a);case i.i32_popcnt:return h(i.popcnt,e,s.Type.i32,r,s.Type.i32,a);case i.i64_popcnt:return h(i.popcnt,e,s.Type.i64,r,s.Type.i64,a);case i.i32_rotl:return h(i.rotl,e,s.Type.i32,r,s.Type.i32,a);case i.i64_rotl:return h(i.rotl,e,s.Type.i64,r,s.Type.i64,a);case i.i32_rotr:return h(i.rotr,e,s.Type.i32,r,s.Type.i32,a);case i.i64_rotr:return h(i.rotr,e,s.Type.i64,r,s.Type.i64,a);case i.f32_abs:return h(i.abs,e,s.Type.f32,r,s.Type.f32,a);case i.f64_abs:return h(i.abs,e,s.Type.f64,r,s.Type.f64,a);case i.f32_max:return h(i.max,e,s.Type.f32,r,s.Type.f32,a);case i.f64_max:return h(i.max,e,s.Type.f64,r,s.Type.f64,a);case i.f32_min:return h(i.min,e,s.Type.f32,r,s.Type.f32,a);case i.f64_min:return h(i.min,e,s.Type.f64,r,s.Type.f64,a);case i.f32_ceil:return h(i.ceil,e,s.Type.f32,r,s.Type.f32,a);case i.f64_ceil:return h(i.ceil,e,s.Type.f64,r,s.Type.f64,a);case i.f32_floor:return h(i.floor,e,s.Type.f32,r,s.Type.f32,a);case i.f64_floor:return h(i.floor,e,s.Type.f64,r,s.Type.f64,a);case i.f32_copysign:return h(i.copysign,e,s.Type.f32,r,s.Type.f32,a);case i.f64_copysign:return h(i.copysign,e,s.Type.f64,r,s.Type.f64,a);case i.f32_nearest:return h(i.nearest,e,s.Type.f32,r,s.Type.f32,a);case i.f64_nearest:return h(i.nearest,e,s.Type.f64,r,s.Type.f64,a);case i.i32_reinterpret_f32:return h(i.reinterpret,e,s.Type.i32,r,s.Type.f32,a);case i.i64_reinterpret_f64:return h(i.reinterpret,e,s.Type.i64,r,s.Type.f64,a);case i.f32_reinterpret_i32:return h(i.reinterpret,e,s.Type.f32,r,s.Type.i32,a);case i.f64_reinterpret_i64:return h(i.reinterpret,e,s.Type.f64,r,s.Type.i64,a);case i.f32_sqrt:return h(i.sqrt,e,s.Type.f32,r,s.Type.f32,a);case i.f64_sqrt:return h(i.sqrt,e,s.Type.f64,r,s.Type.f64,a);case i.f32_trunc:return h(i.trunc,e,s.Type.f32,r,s.Type.f32,a);case i.f64_trunc:return h(i.trunc,e,s.Type.f64,r,s.Type.f64,a);case i.i32_load8_s:return h(i.load,e,s.Type.i8,r,s.Type.i32,a);case i.i32_load8_u:return h(i.load,e,s.Type.u8,r,s.Type.u32,a);case i.i32_load16_s:return h(i.load,e,s.Type.i16,r,s.Type.i32,a);case i.i32_load16_u:return h(i.load,e,s.Type.u16,r,s.Type.u32,a);case i.i32_load:return h(i.load,e,s.Type.i32,r,s.Type.i32,a);case i.i64_load8_s:return h(i.load,e,s.Type.i8,r,s.Type.i64,a);case i.i64_load8_u:return h(i.load,e,s.Type.u8,r,s.Type.u64,a);case i.i64_load16_s:return h(i.load,e,s.Type.i16,r,s.Type.i64,a);case i.i64_load16_u:return h(i.load,e,s.Type.u16,r,s.Type.u64,a);case i.i64_load32_s:return h(i.load,e,s.Type.i32,r,s.Type.i64,a);case i.i64_load32_u:return h(i.load,e,s.Type.u32,r,s.Type.u64,a);case i.i64_load:return h(i.load,e,s.Type.i64,r,s.Type.i64,a);case i.f32_load:return h(i.load,e,s.Type.f32,r,s.Type.f32,a);case i.f64_load:return h(i.load,e,s.Type.f64,r,s.Type.f64,a);case i.i32_store8:return h(i.store,e,s.Type.i8,r,s.Type.i32,a);case i.i32_store16:return h(i.store,e,s.Type.i16,r,s.Type.i32,a);case i.i32_store:return h(i.store,e,s.Type.i32,r,s.Type.i32,a);case i.i64_store8:return h(i.store,e,s.Type.i8,r,s.Type.i64,a);case i.i64_store16:return h(i.store,e,s.Type.i16,r,s.Type.i64,a);case i.i64_store32:return h(i.store,e,s.Type.i32,r,s.Type.i64,a);case i.i64_store:return h(i.store,e,s.Type.i64,r,s.Type.i64,a);case i.f32_store:return h(i.store,e,s.Type.f32,r,s.Type.f32,a);case i.f64_store:return h(i.store,e,s.Type.f64,r,s.Type.f64,a)}if(e.options.hasFeature(16))switch(t.internalName){case i.i32_atomic_load8_u:return h(i.atomic_load,e,s.Type.u8,r,s.Type.u32,a);case i.i32_atomic_load16_u:return h(i.atomic_load,e,s.Type.u16,r,s.Type.u32,a);case i.i32_atomic_load:return h(i.atomic_load,e,s.Type.i32,r,s.Type.i32,a);case i.i64_atomic_load8_u:return h(i.atomic_load,e,s.Type.u8,r,s.Type.u64,a);case i.i64_atomic_load16_u:return h(i.atomic_load,e,s.Type.u16,r,s.Type.u64,a);case i.i64_atomic_load32_u:return h(i.atomic_load,e,s.Type.u32,r,s.Type.u64,a);case i.i64_atomic_load:return h(i.atomic_load,e,s.Type.i64,r,s.Type.i64,a);case i.i32_atomic_store8:return h(i.atomic_store,e,s.Type.i8,r,s.Type.i32,a);case i.i32_atomic_store16:return h(i.atomic_store,e,s.Type.i16,r,s.Type.i32,a);case i.i32_atomic_store:return h(i.atomic_store,e,s.Type.i32,r,s.Type.i32,a);case i.i64_atomic_store8:return h(i.atomic_store,e,s.Type.i8,r,s.Type.i64,a);case i.i64_atomic_store16:return h(i.atomic_store,e,s.Type.i16,r,s.Type.i64,a);case i.i64_atomic_store32:return h(i.atomic_store,e,s.Type.i32,r,s.Type.i64,a);case i.i64_atomic_store:return h(i.atomic_store,e,s.Type.i64,r,s.Type.i64,a);case i.i32_atomic_rmw8_u_add:return h(i.atomic_add,e,s.Type.u8,r,s.Type.u32,a);case i.i32_atomic_rmw16_u_add:return h(i.atomic_add,e,s.Type.u16,r,s.Type.u32,a);case i.i32_atomic_rmw_add:return h(i.atomic_add,e,s.Type.u32,r,s.Type.u32,a);case i.i64_atomic_rmw8_u_add:return h(i.atomic_add,e,s.Type.u8,r,s.Type.u64,a);case i.i64_atomic_rmw16_u_add:return h(i.atomic_add,e,s.Type.u16,r,s.Type.u64,a);case i.i64_atomic_rmw32_u_add:return h(i.atomic_add,e,s.Type.u32,r,s.Type.u64,a);case i.i64_atomic_rmw_add:return h(i.atomic_add,e,s.Type.u64,r,s.Type.u64,a);case i.i32_atomic_rmw8_u_sub:return h(i.atomic_sub,e,s.Type.u8,r,s.Type.u32,a);case i.i32_atomic_rmw16_u_sub:return h(i.atomic_sub,e,s.Type.u16,r,s.Type.u32,a);case i.i32_atomic_rmw_sub:return h(i.atomic_sub,e,s.Type.u32,r,s.Type.u32,a);case i.i64_atomic_rmw8_u_sub:return h(i.atomic_sub,e,s.Type.u8,r,s.Type.u64,a);case i.i64_atomic_rmw16_u_sub:return h(i.atomic_sub,e,s.Type.u16,r,s.Type.u64,a);case i.i64_atomic_rmw32_u_sub:return h(i.atomic_sub,e,s.Type.u32,r,s.Type.u64,a);case i.i64_atomic_rmw_sub:return h(i.atomic_sub,e,s.Type.u64,r,s.Type.u64,a);case i.i32_atomic_rmw8_u_and:return h(i.atomic_and,e,s.Type.u8,r,s.Type.u32,a);case i.i32_atomic_rmw16_u_and:return h(i.atomic_and,e,s.Type.u16,r,s.Type.u32,a);case i.i32_atomic_rmw_and:return h(i.atomic_and,e,s.Type.u32,r,s.Type.u32,a);case i.i64_atomic_rmw8_u_and:return h(i.atomic_and,e,s.Type.u8,r,s.Type.u64,a);case i.i64_atomic_rmw16_u_and:return h(i.atomic_and,e,s.Type.u16,r,s.Type.u64,a);case i.i64_atomic_rmw32_u_and:return h(i.atomic_and,e,s.Type.u32,r,s.Type.u64,a);case i.i64_atomic_rmw_and:return h(i.atomic_and,e,s.Type.u64,r,s.Type.u64,a);case i.i32_atomic_rmw8_u_or:return h(i.atomic_or,e,s.Type.u8,r,s.Type.u32,a);case i.i32_atomic_rmw16_u_or:return h(i.atomic_or,e,s.Type.u16,r,s.Type.u32,a);case i.i32_atomic_rmw_or:return h(i.atomic_or,e,s.Type.u32,r,s.Type.u32,a);case i.i64_atomic_rmw8_u_or:return h(i.atomic_or,e,s.Type.u8,r,s.Type.u64,a);case i.i64_atomic_rmw16_u_or:return h(i.atomic_or,e,s.Type.u16,r,s.Type.u64,a);case i.i64_atomic_rmw32_u_or:return h(i.atomic_or,e,s.Type.u32,r,s.Type.u64,a);case i.i64_atomic_rmw_or:return h(i.atomic_or,e,s.Type.u64,r,s.Type.u64,a);case i.i32_atomic_rmw8_u_xor:case i.i32_atomic_rmw16_u_xor:case i.i32_atomic_rmw_xor:return h(i.atomic_xor,e,s.Type.u8,r,s.Type.u32,a);case i.i64_atomic_rmw8_u_xor:return h(i.atomic_xor,e,s.Type.u8,r,s.Type.u64,a);case i.i64_atomic_rmw16_u_xor:return h(i.atomic_xor,e,s.Type.u16,r,s.Type.u64,a);case i.i64_atomic_rmw32_u_xor:return h(i.atomic_xor,e,s.Type.u32,r,s.Type.u64,a);case i.i64_atomic_rmw_xor:return h(i.atomic_xor,e,s.Type.u64,r,s.Type.u64,a);case i.i32_atomic_rmw8_u_xchg:case i.i32_atomic_rmw16_u_xchg:case i.i32_atomic_rmw_xchg:return h(i.atomic_xchg,e,s.Type.u8,r,s.Type.u32,a);case i.i64_atomic_rmw8_u_xchg:return h(i.atomic_xchg,e,s.Type.u8,r,s.Type.u64,a);case i.i64_atomic_rmw16_u_xchg:return h(i.atomic_xchg,e,s.Type.u16,r,s.Type.u64,a);case i.i64_atomic_rmw32_u_xchg:return h(i.atomic_xchg,e,s.Type.u32,r,s.Type.u64,a);case i.i64_atomic_rmw_xchg:return h(i.atomic_xchg,e,s.Type.u64,r,s.Type.u64,a);case i.i32_atomic_rmw8_u_cmpxchg:case i.i32_atomic_rmw16_u_cmpxchg:case i.i32_atomic_rmw_cmpxchg:return h(i.atomic_cmpxchg,e,s.Type.u8,r,s.Type.u32,a);case i.i64_atomic_rmw8_u_cmpxchg:return h(i.atomic_cmpxchg,e,s.Type.u8,r,s.Type.u64,a);case i.i64_atomic_rmw16_u_cmpxchg:return h(i.atomic_cmpxchg,e,s.Type.u16,r,s.Type.u64,a);case i.i64_atomic_rmw32_u_cmpxchg:return h(i.atomic_cmpxchg,e,s.Type.u32,r,s.Type.u64,a);case i.i64_atomic_rmw_cmpxchg:return h(i.atomic_cmpxchg,e,s.Type.u64,r,s.Type.u64,a);case i.i32_wait:return h(i.atomic_wait,e,s.Type.i32,r,s.Type.u32,a);case i.i64_wait:return h(i.atomic_wait,e,s.Type.i64,r,s.Type.i64,a);case i.i32_notify:return h(i.atomic_notify,e,s.Type.i32,r,s.Type.u32,a);case i.i64_notify:return h(i.atomic_notify,e,s.Type.i64,r,s.Type.i64,a)}return 0}(e,t,n,0,_);return oe?(r&&r.length&&e.error(a.DiagnosticCode.Type_0_is_not_generic,_.range,t.internalName),oe):(e.error(a.DiagnosticCode.Cannot_find_name_0,_.expression.range,t.internalName),I.createUnreachable())}function h(e,t,r,n,i,a){assert(t.program.elementsByName.has(e));var o=t.program.elementsByName.get(e);return assert(o.kind==l.ElementKind.FUNCTION_PROTOTYPE),_(t,o,[r],n,i,a)}function d(e,t,r,n){if(0==r.length)return t&&1==t.length?t[0]:(e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.range,"1",t?t.length.toString(10):"0"),null);if(1==r.length){if(t)if(1==t.length)e.compileExpression(r[0],t[0],1,0);else{if(t.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.range,"1",t.length.toString(10)),null;e.compileExpressionRetainType(r[0],s.Type.i32,0)}else e.compileExpressionRetainType(r[0],s.Type.i32,0);return e.currentType}return t&&t.length>1&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.range,"1",t.length.toString(10)),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,"1",r.length.toString(10)),null}function y(e,t){var r,n;return e.options.isWasm64?(r=e.precomputeExpression(t,s.Type.usize64,1,0),(c.getExpressionId(r)!=c.ExpressionId.Const||c.getExpressionType(r)!=c.NativeType.I64||0!=c.getConstValueI64High(r)||(n=c.getConstValueI64Low(r))<0)&&(e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,t.range),n=-1)):(r=e.precomputeExpression(t,s.Type.usize32,1,0),(c.getExpressionId(r)!=c.ExpressionId.Const||c.getExpressionType(r)!=c.NativeType.I32||(n=c.getConstValueI32(r))<0)&&(e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,t.range),n=-1)),n}function m(e,t,r){var n=e.program,i=e.module,a=e.program.stringInstance;if(!a)return i.createUnreachable();var o=n.abortInstance;if(!o||!e.compileFunction(o))return i.createUnreachable();var l=null!=t?e.compileExpression(t,a.type,1,0):a.type.toNativeZero(i),p=e.ensureStaticString(r.range.source.normalizedPath);return e.currentType=s.Type.void,i.createBlock(null,[i.createCall(o.internalName,[l,p,i.createI32(r.range.line),i.createI32(r.range.column)],c.NativeType.None),i.createUnreachable()])}!function(e){e.isInteger="~lib/builtins/isInteger",e.isFloat="~lib/builtins/isFloat",e.isSigned="~lib/builtins/isSigned",e.isReference="~lib/builtins/isReference",e.isString="~lib/builtins/isString",e.isArray="~lib/builtins/isArray",e.isDefined="~lib/builtins/isDefined",e.isConstant="~lib/builtins/isConstant",e.isManaged="~lib/builtins/isManaged",e.clz="~lib/builtins/clz",e.ctz="~lib/builtins/ctz",e.popcnt="~lib/builtins/popcnt",e.rotl="~lib/builtins/rotl",e.rotr="~lib/builtins/rotr",e.abs="~lib/builtins/abs",e.max="~lib/builtins/max",e.min="~lib/builtins/min",e.ceil="~lib/builtins/ceil",e.floor="~lib/builtins/floor",e.copysign="~lib/builtins/copysign",e.nearest="~lib/builtins/nearest",e.reinterpret="~lib/builtins/reinterpret",e.sqrt="~lib/builtins/sqrt",e.trunc="~lib/builtins/trunc",e.load="~lib/builtins/load",e.store="~lib/builtins/store",e.atomic_load="~lib/builtins/atomic.load",e.atomic_store="~lib/builtins/atomic.store",e.atomic_add="~lib/builtins/atomic.add",e.atomic_sub="~lib/builtins/atomic.sub",e.atomic_and="~lib/builtins/atomic.and",e.atomic_or="~lib/builtins/atomic.or",e.atomic_xor="~lib/builtins/atomic.xor",e.atomic_xchg="~lib/builtins/atomic.xchg",e.atomic_cmpxchg="~lib/builtins/atomic.cmpxchg",e.atomic_wait="~lib/builtins/atomic.wait",e.atomic_notify="~lib/builtins/atomic.notify",e.sizeof="~lib/builtins/sizeof",e.alignof="~lib/builtins/alignof",e.offsetof="~lib/builtins/offsetof",e.select="~lib/builtins/select",e.unreachable="~lib/builtins/unreachable",e.changetype="~lib/builtins/changetype",e.assert="~lib/builtins/assert",e.unchecked="~lib/builtins/unchecked",e.call_indirect="~lib/builtins/call_indirect",e.instantiate="~lib/builtins/instantiate",e.i8="~lib/builtins/i8",e.i16="~lib/builtins/i16",e.i32="~lib/builtins/i32",e.i64="~lib/builtins/i64",e.isize="~lib/builtins/isize",e.u8="~lib/builtins/u8",e.u16="~lib/builtins/u16",e.u32="~lib/builtins/u32",e.u64="~lib/builtins/u64",e.usize="~lib/builtins/usize",e.bool="~lib/builtins/bool",e.f32="~lib/builtins/f32",e.f64="~lib/builtins/f64",e.v128="~lib/builtins/v128",e.void_="~lib/builtins/void",e.i32_clz="~lib/builtins/i32.clz",e.i64_clz="~lib/builtins/i64.clz",e.i32_ctz="~lib/builtins/i32.ctz",e.i64_ctz="~lib/builtins/i64.ctz",e.i32_popcnt="~lib/builtins/i32.popcnt",e.i64_popcnt="~lib/builtins/i64.popcnt",e.i32_rotl="~lib/builtins/i32.rotl",e.i64_rotl="~lib/builtins/i64.rotl",e.i32_rotr="~lib/builtins/i32.rotr",e.i64_rotr="~lib/builtins/i64.rotr",e.f32_abs="~lib/builtins/f32.abs",e.f64_abs="~lib/builtins/f64.abs",e.f32_max="~lib/builtins/f32.max",e.f64_max="~lib/builtins/f64.max",e.f32_min="~lib/builtins/f32.min",e.f64_min="~lib/builtins/f64.min",e.f32_ceil="~lib/builtins/f32.ceil",e.f64_ceil="~lib/builtins/f64.ceil",e.f32_floor="~lib/builtins/f32.floor",e.f64_floor="~lib/builtins/f64.floor",e.f32_copysign="~lib/builtins/f32.copysign",e.f64_copysign="~lib/builtins/f64.copysign",e.f32_nearest="~lib/builtins/f32.nearest",e.f64_nearest="~lib/builtins/f64.nearest",e.i32_reinterpret_f32="~lib/builtins/i32.reinterpret_f32",e.i64_reinterpret_f64="~lib/builtins/i64.reinterpret_f64",e.f32_reinterpret_i32="~lib/builtins/f32.reinterpret_i32",e.f64_reinterpret_i64="~lib/builtins/f64.reinterpret_i64",e.f32_sqrt="~lib/builtins/f32.sqrt",e.f64_sqrt="~lib/builtins/f64.sqrt",e.f32_trunc="~lib/builtins/f32.trunc",e.f64_trunc="~lib/builtins/f64.trunc",e.i32_load8_s="~lib/builtins/i32.load8_s",e.i32_load8_u="~lib/builtins/i32.load8_u",e.i32_load16_s="~lib/builtins/i32.load16_s",e.i32_load16_u="~lib/builtins/i32.load16_u",e.i32_load="~lib/builtins/i32.load",e.i64_load8_s="~lib/builtins/i64.load8_s",e.i64_load8_u="~lib/builtins/i64.load8_u",e.i64_load16_s="~lib/builtins/i64.load16_s",e.i64_load16_u="~lib/builtins/i64.load16_u",e.i64_load32_s="~lib/builtins/i64.load32_s",e.i64_load32_u="~lib/builtins/i64.load32_u",e.i64_load="~lib/builtins/i64.load",e.f32_load="~lib/builtins/f32.load",e.f64_load="~lib/builtins/f64.load",e.i32_store8="~lib/builtins/i32.store8",e.i32_store16="~lib/builtins/i32.store16",e.i32_store="~lib/builtins/i32.store",e.i64_store8="~lib/builtins/i64.store8",e.i64_store16="~lib/builtins/i64.store16",e.i64_store32="~lib/builtins/i64.store32",e.i64_store="~lib/builtins/i64.store",e.f32_store="~lib/builtins/f32.store",e.f64_store="~lib/builtins/f64.store",e.i32_atomic_load8_u="~lib/builtins/i32.atomic.load8_u",e.i32_atomic_load16_u="~lib/builtins/i32.atomic.load16_u",e.i32_atomic_load="~lib/builtins/i32.atomic.load",e.i64_atomic_load8_u="~lib/builtins/i64.atomic.load8_u",e.i64_atomic_load16_u="~lib/builtins/i64.atomic.load16_u",e.i64_atomic_load32_u="~lib/builtins/i64.atomic.load32_u",e.i64_atomic_load="~lib/builtins/i64.atomic.load",e.i32_atomic_store8="~lib/builtins/i32.atomic.store8",e.i32_atomic_store16="~lib/builtins/i32.atomic.store16",e.i32_atomic_store="~lib/builtins/i32.atomic.store",e.i64_atomic_store8="~lib/builtins/i64.atomic.store8",e.i64_atomic_store16="~lib/builtins/i64.atomic.store16",e.i64_atomic_store32="~lib/builtins/i64.atomic.store32",e.i64_atomic_store="~lib/builtins/i64.atomic.store",e.i32_atomic_rmw8_u_add="~lib/builtins/i32.atomic.rmw8_u.add",e.i32_atomic_rmw16_u_add="~lib/builtins/i32.atomic.rmw16_u.add",e.i32_atomic_rmw_add="~lib/builtins/i32.atomic.rmw.add",e.i64_atomic_rmw8_u_add="~lib/builtins/i64.atomic.rmw8_u.add",e.i64_atomic_rmw16_u_add="~lib/builtins/i64.atomic.rmw16_u.add",e.i64_atomic_rmw32_u_add="~lib/builtins/i64.atomic.rmw32_u.add",e.i64_atomic_rmw_add="~lib/builtins/i64.atomic.rmw.add",e.i32_atomic_rmw8_u_sub="~lib/builtins/i32.atomic.rmw8_u.sub",e.i32_atomic_rmw16_u_sub="~lib/builtins/i32.atomic.rmw16_u.sub",e.i32_atomic_rmw_sub="~lib/builtins/i32.atomic.rmw.sub",e.i64_atomic_rmw8_u_sub="~lib/builtins/i64.atomic.rmw8_u.sub",e.i64_atomic_rmw16_u_sub="~lib/builtins/i64.atomic.rmw16_u.sub",e.i64_atomic_rmw32_u_sub="~lib/builtins/i64.atomic.rmw32_u.sub",e.i64_atomic_rmw_sub="~lib/builtins/i64.atomic.rmw.sub",e.i32_atomic_rmw8_u_and="~lib/builtins/i32.atomic.rmw8_u.and",e.i32_atomic_rmw16_u_and="~lib/builtins/i32.atomic.rmw16_u.and",e.i32_atomic_rmw_and="~lib/builtins/i32.atomic.rmw.and",e.i64_atomic_rmw8_u_and="~lib/builtins/i64.atomic.rmw8_u.and",e.i64_atomic_rmw16_u_and="~lib/builtins/i64.atomic.rmw16_u.and",e.i64_atomic_rmw32_u_and="~lib/builtins/i64.atomic.rmw32_u.and",e.i64_atomic_rmw_and="~lib/builtins/i64.atomic.rmw.and",e.i32_atomic_rmw8_u_or="~lib/builtins/i32.atomic.rmw8_u.or",e.i32_atomic_rmw16_u_or="~lib/builtins/i32.atomic.rmw16_u.or",e.i32_atomic_rmw_or="~lib/builtins/i32.atomic.rmw.or",e.i64_atomic_rmw8_u_or="~lib/builtins/i64.atomic.rmw8_u.or",e.i64_atomic_rmw16_u_or="~lib/builtins/i64.atomic.rmw16_u.or",e.i64_atomic_rmw32_u_or="~lib/builtins/i64.atomic.rmw32_u.or",e.i64_atomic_rmw_or="~lib/builtins/i64.atomic.rmw.or",e.i32_atomic_rmw8_u_xor="~lib/builtins/i32.atomic.rmw8_u.xor",e.i32_atomic_rmw16_u_xor="~lib/builtins/i32.atomic.rmw16_u.xor",e.i32_atomic_rmw_xor="~lib/builtins/i32.atomic.rmw.xor",e.i64_atomic_rmw8_u_xor="~lib/builtins/i64.atomic.rmw8_u.xor",e.i64_atomic_rmw16_u_xor="~lib/builtins/i64.atomic.rmw16_u.xor",e.i64_atomic_rmw32_u_xor="~lib/builtins/i64.atomic.rmw32_u.xor",e.i64_atomic_rmw_xor="~lib/builtins/i64.atomic.rmw.xor",e.i32_atomic_rmw8_u_xchg="~lib/builtins/i32.atomic.rmw8_u.xchg",e.i32_atomic_rmw16_u_xchg="~lib/builtins/i32.atomic.rmw16_u.xchg",e.i32_atomic_rmw_xchg="~lib/builtins/i32.atomic.rmw.xchg",e.i64_atomic_rmw8_u_xchg="~lib/builtins/i64.atomic.rmw8_u.xchg",e.i64_atomic_rmw16_u_xchg="~lib/builtins/i64.atomic.rmw16_u.xchg",e.i64_atomic_rmw32_u_xchg="~lib/builtins/i64.atomic.rmw32_u.xchg",e.i64_atomic_rmw_xchg="~lib/builtins/i64.atomic.rmw.xchg",e.i32_atomic_rmw8_u_cmpxchg="~lib/builtins/i32.atomic.rmw8_u.cmpxchg",e.i32_atomic_rmw16_u_cmpxchg="~lib/builtins/i32.atomic.rmw16_u.cmpxchg",e.i32_atomic_rmw_cmpxchg="~lib/builtins/i32.atomic.rmw.cmpxchg",e.i64_atomic_rmw8_u_cmpxchg="~lib/builtins/i64.atomic.rmw8_u.cmpxchg",e.i64_atomic_rmw16_u_cmpxchg="~lib/builtins/i64.atomic.rmw16_u.cmpxchg",e.i64_atomic_rmw32_u_cmpxchg="~lib/builtins/i64.atomic.rmw32_u.cmpxchg",e.i64_atomic_rmw_cmpxchg="~lib/builtins/i64.atomic.rmw.cmpxchg",e.i32_wait="~lib/builtins/i32.wait",e.i64_wait="~lib/builtins/i64.wait",e.i32_notify="~lib/builtins/i32.notify",e.i64_notify="~lib/builtins/i64.notify",e.ERROR="~lib/diagnostics/ERROR",e.WARNING="~lib/diagnostics/WARNING",e.INFO="~lib/diagnostics/INFO",e.HEAP_BASE="~lib/memory/HEAP_BASE",e.memory_size="~lib/memory/memory.size",e.memory_grow="~lib/memory/memory.grow",e.memory_copy="~lib/memory/memory.copy",e.memory_fill="~lib/memory/memory.fill",e.iterateRoots="~lib/gc/iterateRoots"}(i=t.BuiltinSymbols||(t.BuiltinSymbols={})),t.compileCall=_,t.compileAbort=m,t.compileIterateRoots=function(e){var t,r,i=e.module,a=new Array;try{for(var o=n(e.program.elementsByName.values()),p=o.next();!p.done;p=o.next()){var _=p.value;if(_.kind==l.ElementKind.GLOBAL){var h=_,d=h.type.classReference;if(h.is(u.CommonFlags.COMPILED)&&null!==d&&!d.hasDecorator(l.DecoratorFlags.UNMANAGED))if(h.is(u.CommonFlags.INLINED)){var y=h.constantIntegerValue;a.push(i.createCallIndirect(i.createGetLocal(0,c.NativeType.I32),[e.options.isWasm64?i.createI64(i64_low(y),i64_high(y)):i.createI32(i64_low(y))],"i_"))}else a.push(i.createCallIndirect(i.createGetLocal(0,c.NativeType.I32),[i.createGetGlobal(h.internalName,e.options.nativeSizeType)],"i_"))}}}catch(e){t={error:e}}finally{try{p&&!p.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}var m=e.ensureFunctionType([s.Type.i32],s.Type.void);i.addFunction("~iterateRoots",m,[],a.length?i.createBlock(null,a):i.createNop())},t.ensureGCHook=function e(t,r){var i,a,o=t.program;assert(r.type.isManaged(o));var p=r.gcHookIndex;if(-1!=p)return p;var _=r.members;if(r.isDeclaredInLibrary&&null!==_&&_.has("__gc")){var h=assert(_.get("__gc"));assert(h.kind==l.ElementKind.FUNCTION_PROTOTYPE);var d=assert(o.resolver.resolveFunction(h,null));assert(d.is(u.CommonFlags.PRIVATE|u.CommonFlags.INSTANCE)),assert(!d.isAny(u.CommonFlags.AMBIENT|u.CommonFlags.VIRTUAL)),assert(0==d.signature.parameterTypes.length),assert(d.signature.returnType==s.Type.void),d.internalName=r.internalName+"~gc",assert(t.compileFunction(d));var y=t.ensureFunctionTableEntry(d);return r.gcHookIndex=y,y}var m=t.module,g=t.options,T=g.nativeSizeType,f=g.usizeType.byteSize,E=new Array;E.push(m.createIf(m.createUnary(g.isWasm64?c.UnaryOp.EqzI64:c.UnaryOp.EqzI32,m.createGetLocal(0,T)),m.createReturn()));var I=t.functionTable,v=I.length;I.push("<placeholder>"),r.gcHookIndex=v;var b=r.base;if(b?(assert(b.type.isManaged(o)),E.push(m.createCallIndirect(m.createI32(e(t,b.type.classReference)),[m.createGetLocal(0,T)],T==c.NativeType.I64?"I_":"i_"))):E.push(m.createCall(assert(o.gcMarkInstance).internalName,[m.createGetLocal(0,T)],c.NativeType.None)),_)try{for(var S=n(_.values()),A=S.next();!A.done;A=S.next()){var N=A.value;if(N.kind==l.ElementKind.FIELD&&N.parent===r&&N.type.isManaged(o)){var C=N.memoryOffset;assert(C>=0),E.push(m.createCall(assert(o.gcMarkInstance).internalName,[m.createLoad(f,!1,m.createGetLocal(0,T),T,C)],c.NativeType.None))}}}catch(e){i={error:e}}finally{try{A&&!A.done&&(a=S.return)&&a.call(S)}finally{if(i)throw i.error}}var O=r.internalName+"~gc";return m.addFunction(O,t.ensureFunctionType(null,s.Type.void,g.usizeType),null,m.createBlock(null,E)),I[v]=O,v}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bitsetIs=function(e,t){return assert(t>=0&&t<64),i64_ne(i64_and(e,i64_shl(i64_one,i64_new(t))),i64_zero)},t.bitsetSet=function(e,t,r){return assert(t>=0&&t<64),r?i64_or(e,i64_shl(i64_one,i64_new(t))):i64_and(e,i64_not(i64_shl(i64_one,i64_new(t))))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.NULL=0]="NULL",e[e.LINEFEED=10]="LINEFEED",e[e.CARRIAGERETURN=13]="CARRIAGERETURN",e[e.LINESEPARATOR=8232]="LINESEPARATOR",e[e.PARAGRAPHSEPARATOR=8233]="PARAGRAPHSEPARATOR",e[e.NEXTLINE=133]="NEXTLINE",e[e.SPACE=32]="SPACE",e[e.NONBREAKINGSPACE=160]="NONBREAKINGSPACE",e[e.ENQUAD=8192]="ENQUAD",e[e.EMQUAD=8193]="EMQUAD",e[e.ENSPACE=8194]="ENSPACE",e[e.EMSPACE=8195]="EMSPACE",e[e.THREEPEREMSPACE=8196]="THREEPEREMSPACE",e[e.FOURPEREMSPACE=8197]="FOURPEREMSPACE",e[e.SIXPEREMSPACE=8198]="SIXPEREMSPACE",e[e.FIGURESPACE=8199]="FIGURESPACE",e[e.PUNCTUATIONSPACE=8200]="PUNCTUATIONSPACE",e[e.THINSPACE=8201]="THINSPACE",e[e.HAIRSPACE=8202]="HAIRSPACE",e[e.ZEROWIDTHSPACE=8203]="ZEROWIDTHSPACE",e[e.NARROWNOBREAKSPACE=8239]="NARROWNOBREAKSPACE",e[e.IDEOGRAPHICSPACE=12288]="IDEOGRAPHICSPACE",e[e.MATHEMATICALSPACE=8287]="MATHEMATICALSPACE",e[e.OGHAM=5760]="OGHAM",e[e._=95]="_",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.AMPERSAND=38]="AMPERSAND",e[e.ASTERISK=42]="ASTERISK",e[e.AT=64]="AT",e[e.BACKSLASH=92]="BACKSLASH",e[e.BACKTICK=96]="BACKTICK",e[e.BAR=124]="BAR",e[e.CARET=94]="CARET",e[e.CLOSEBRACE=125]="CLOSEBRACE",e[e.CLOSEBRACKET=93]="CLOSEBRACKET",e[e.CLOSEPAREN=41]="CLOSEPAREN",e[e.COLON=58]="COLON",e[e.COMMA=44]="COMMA",e[e.DOLLAR=36]="DOLLAR",e[e.DOT=46]="DOT",e[e.DOUBLEQUOTE=34]="DOUBLEQUOTE",e[e.EQUALS=61]="EQUALS",e[e.EXCLAMATION=33]="EXCLAMATION",e[e.GREATERTHAN=62]="GREATERTHAN",e[e.HASH=35]="HASH",e[e.LESSTHAN=60]="LESSTHAN",e[e.MINUS=45]="MINUS",e[e.OPENBRACE=123]="OPENBRACE",e[e.OPENBRACKET=91]="OPENBRACKET",e[e.OPENPAREN=40]="OPENPAREN",e[e.PERCENT=37]="PERCENT",e[e.PLUS=43]="PLUS",e[e.QUESTION=63]="QUESTION",e[e.SEMICOLON=59]="SEMICOLON",e[e.SINGLEQUOTE=39]="SINGLEQUOTE",e[e.SLASH=47]="SLASH",e[e.TILDE=126]="TILDE",e[e.BACKSPACE=8]="BACKSPACE",e[e.FORMFEED=12]="FORMFEED",e[e.BYTEORDERMARK=65279]="BYTEORDERMARK",e[e.TAB=9]="TAB",e[e.VERTICALTAB=11]="VERTICALTAB"}(t.CharCode||(t.CharCode={})),t.isLineBreak=function(e){switch(e){case 10:case 13:case 8232:case 8233:return!0;default:return!1}},t.isWhiteSpace=function(e){switch(e){case 32:case 9:case 11:case 12:case 160:case 133:case 5760:case 8239:case 8287:case 12288:case 65279:return!0;default:return e>=8192&&e<=8203}},t.isDecimalDigit=function(e){return e>=48&&e<=57},t.isOctalDigit=function(e){return e>=48&&e<=55},t.isIdentifierStart=function(e){return e>=65&&e<=90||e>=97&&e<=122||36==e||95==e||e>127&&!((t=e)<0||t>65535)&&a(t,n);var t},t.isKeywordCharacter=function(e){return e>=97&&e<=122},t.isIdentifierPart=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||36==e||95==e||e>127&&!((t=e)<0||t>65535)&&a(t,i);var t};var n=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1319,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2208,2208,2210,2220,2308,2361,2365,2365,2384,2384,2392,2401,2417,2423,2425,2431,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3133,3160,3161,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3424,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6263,6272,6312,6314,6314,6320,6389,6400,6428,6480,6509,6512,6516,6528,6571,6593,6599,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7401,7404,7406,7409,7413,7414,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42647,42656,42735,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43648,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],i=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1319,1329,1366,1369,1369,1377,1415,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1520,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2048,2093,2112,2139,2208,2208,2210,2220,2276,2302,2304,2403,2406,2415,2417,2423,2425,2431,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3161,3168,3171,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3330,3331,3333,3340,3342,3344,3346,3386,3389,3396,3398,3400,3402,3406,3415,3415,3424,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6263,6272,6314,6320,6389,6400,6428,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7376,7378,7380,7414,7424,7654,7676,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8204,8205,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,11823,11823,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42647,42655,42737,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43047,43072,43123,43136,43204,43216,43225,43232,43255,43259,43259,43264,43309,43312,43347,43360,43388,43392,43456,43471,43481,43520,43574,43584,43597,43600,43609,43616,43638,43642,43643,43648,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65062,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500];function a(e,t){if(e<t[0])return!1;for(var r,n=0,i=t.length;n+1<i;){if(r=n+(i-n)/2,t[r-=r%2]<=e&&e<=t[r+1])return!0;e<t[r]?i=r:n=r+2}return!1}},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.makeArray=function(e){if(void 0===e&&(e=null),e){for(var t=new Array(e.length),r=0,n=e.length;r<n;++r)unchecked(t[r]=e[r]);return t}return new Array},t.makeSet=function(e){var t,r;if(void 0===e&&(e=null),e){var i=new Set;try{for(var a=n(e),o=a.next();!o.done;o=a.next()){var s=o.value;i.add(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i}return new Set},t.makeMap=function(e,t){var r,a,o,s,c,l;void 0===e&&(e=null),void 0===t&&(t=null);var p=new Map;if(e){try{for(var u=n(e),_=u.next();!_.done;_=u.next()){var h=i(_.value,2),d=h[0],y=h[1];p.set(d,y)}}catch(e){r={error:e}}finally{try{_&&!_.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}if(t)try{for(var m=n(t),g=m.next();!g.done;g=m.next()){var T=i(g.value,2);d=T[0],y=T[1],p.set(d,y)}}catch(e){o={error:e}}finally{try{g&&!g.done&&(s=m.return)&&s.call(m)}finally{if(o)throw o.error}}}else if(t)try{for(var f=n(t),E=f.next();!E.done;E=f.next()){var I=i(E.value,2);d=I[0],y=I[1],p.set(d,y)}}catch(e){c={error:e}}finally{try{E&&!E.done&&(l=f.return)&&l.call(f)}finally{if(c)throw c.error}}return p}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=47;function i(e){for(var t,r=0,i=e.length;r+1<i&&46==e.charCodeAt(r)&&e.charCodeAt(r+1)==n;)r+=2;for((r>0||i<e.length)&&(e=e.substring(r,i),i-=r,r=0);r+1<i;){if(t=!1,e.charCodeAt(r)==n&&46==e.charCodeAt(r+1)){if((t=r+2==i)||r+2<i&&e.charCodeAt(r+2)==n){e=t?e.substring(0,r):e.substring(0,r)+e.substring(r+2),i-=2;continue}if((t=r+3==i)&&46==e.charCodeAt(r+2)||r+3<i&&46==e.charCodeAt(r+2)&&e.charCodeAt(r+3)==n){for(var a=r;--a>=0;)if(e.charCodeAt(a)==n){r-a==3&&46==e.charCodeAt(a+1)&&46==e.charCodeAt(a+2)||(e=t?e.substring(0,a):e.substring(0,a)+e.substring(r+3),i-=r+3-a,r=a-1);break}if(a<0&&r>0&&(2!=r||46!=e.charCodeAt(0)||46!=e.charCodeAt(1))){i=(e=e.substring(r+4)).length;continue}}}r++}return i>0?e:"."}function a(e){for(var t=e.length;--t>0;)if(e.charCodeAt(t)==n)return e.substring(0,t);return"."}t.normalizePath=i,t.resolvePath=function(e,t){return e.startsWith("std/")?e:i(a(t)+String.fromCharCode(n)+e)},t.dirname=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=" ",i=" ",a=" ";t.indent=function(e,t){for(;t>=4;)e.push(a),t-=4;t>=2&&(e.push(i),t-=2),t&&e.push(n)}},function(e,t,r){"use strict";function n(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function i(e,t,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function a(e,t){var r=n(e,t),i=n(e,t+4);return i64_new(r,i)}Object.defineProperty(t,"__esModule",{value:!0}),t.readI8=function(e,t){return e[t]},t.writeI8=function(e,t,r){t[r]=e},t.readI16=function(e,t){return e[t]|e[t+1]<<8},t.writeI16=function(e,t,r){t[r]=e,t[r+1]=e>>>8},t.readI32=n,t.writeI32=i,t.readI64=a,t.writeI64=function(e,t,r){i(i64_low(e),t,r),i(i64_high(e),t,r+4)},t.readF32=function(e,t){return i32_as_f32(n(e,t))},t.writeF32=function(e,t,r){i(f32_as_i32(e),t,r)},t.readF64=function(e,t){return i64_as_f64(a(e,t))},t.writeF64=function(e,t,r){var n=f64_as_i64(e);i(i64_low(n),t,r),i(i64_high(n),t,r+4)}},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0});var i=r(10),a=r(13),o=r(14),s=r(1);t.formatDiagnostic=s.formatDiagnosticMessage;var c=r(15);t.parseFile=function(e,t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=null),n||(n=new c.Parser),n.parseFile(e,t,r),n},t.nextFile=function(e){return e.nextFile()},t.nextDiagnostic=function(e){var t=e.program;return t.diagnosticsOffset<t.diagnostics.length?t.diagnostics[t.diagnosticsOffset++]:null},t.isInfo=function(e){return e.category==s.DiagnosticCategory.INFO},t.isWarning=function(e){return e.category==s.DiagnosticCategory.WARNING},t.isError=function(e){return e.category==s.DiagnosticCategory.ERROR},t.createOptions=function(){return new i.Options},t.setTarget=function(e,t){e.target=t},t.setNoAssert=function(e,t){e.noAssert=t},t.setImportMemory=function(e,t){e.importMemory=t},t.setSharedMemory=function(e,t){e.sharedMemory=t},t.setImportTable=function(e,t){e.importTable=t},t.setSourceMap=function(e,t){e.sourceMap=t},t.setMemoryBase=function(e,t){e.memoryBase=t},t.setGlobalAlias=function(e,t,r){var n=e.globalAliases;n||(e.globalAliases=n=new Map),n.set(t,r)},t.FEATURE_SIGN_EXTENSION=1,t.FEATURE_MUTABLE_GLOBAL=2,t.FEATURE_BULK_MEMORY=4,t.FEATURE_SIMD=8,t.FEATURE_THREADS=16,t.enableFeature=function(e,t){e.features|=t},t.setOptimizeLevelHints=function(e,t,r){e.optimizeLevelHint=t,e.shrinkLevelHint=r},t.finishParsing=function(e){return e.finish()},t.compileProgram=function(e,t){return void 0===t&&(t=null),new i.Compiler(e,t).compile()},t.decompileModule=function(e){var t=new a.Decompiler;return t.decompile(e),t.finish()},t.buildIDL=function(e){return o.IDLBuilder.build(e)},t.buildTSD=function(e){return o.TSDBuilder.build(e)};var l=r(0);t.LIBRARY_PREFIX=l.LIBRARY_PREFIX,n(r(5)),n(r(0)),n(r(10)),n(r(13)),n(r(14)),n(r(11)),n(r(1)),n(r(12)),n(r(4)),n(r(15)),n(r(3)),n(r(9)),n(r(7)),n(r(6)),n(r(2))}])});
//# sourceMappingURL=assemblyscript.js.map