assemblyscript/dist/assemblyscript.js
2019-06-05 22:51:03 +02:00

2 lines
552 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=17)}([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.MODULE_EXPORT=524288]="MODULE_EXPORT",e[e.MODULE_IMPORT=1048576]="MODULE_IMPORT",e[e.RESOLVED=2097152]="RESOLVED",e[e.COMPILED=4194304]="COMPILED",e[e.INLINED=8388608]="INLINED",e[e.SCOPED=16777216]="SCOPED",e[e.TRAMPOLINE=33554432]="TRAMPOLINE",e[e.VIRTUAL=67108864]="VIRTUAL",e[e.MAIN=134217728]="MAIN",e[e.QUOTED=268435456]="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.i8x16="i8x16",e.u8x16="u8x16",e.i16x8="i16x8",e.u16x8="u16x8",e.i32x4="i32x4",e.u32x4="u32x4",e.i64x2="i64x2",e.u64x2="u64x2",e.f32x4="f32x4",e.f64x2="f64x2",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",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.ASC_FEATURE_THREADS="ASC_FEATURE_THREADS",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.FixedArray="FixedArray",e.Set="Set",e.Map="Map",e.ArrayBufferView="ArrayBufferView",e.ArrayBuffer="ArrayBuffer",e.Math="Math",e.Mathf="Mathf",e.Int8Array="Int8Array",e.Int16Array="Int16Array",e.Int32Array="Int32Array",e.Int64Array="Int64Array",e.Uint8Array="Uint8Array",e.Uint8ClampedArray="Uint8ClampedArray",e.Uint16Array="Uint16Array",e.Uint32Array="Uint32Array",e.Uint64Array="Uint64Array",e.Float32Array="Float32Array",e.Float64Array="Float64Array",e.abort="abort",e.pow="pow",e.mod="mod",e.alloc="__alloc",e.realloc="__realloc",e.free="__free",e.retain="__retain",e.release="__release",e.collect="__collect",e.typeinfo="__typeinfo",e.instanceof_="__instanceof",e.visit="__visit",e.allocArray="__allocArray"}(t.CommonSymbols||(t.CommonSymbols={}));var n=r(25);t.Feature=n.Feature;var i=r(26);t.Target=i.Target;var a=r(27);t.Typeinfo=a.Typeinfo,t.TypeinfoFlags=a.TypeinfoFlags},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(29)),n(r(30)),n(r(31)),n(r(32)),n(r(33)),n(r(34)),t.isPowerOf2=function(e){return 0!=e&&0==(e&e-1)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(12),a=r(1),s=r(12);function o(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=s.DiagnosticCode,t.diagnosticCodeToString=s.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=o,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,s){void 0===n&&(n=null),void 0===a&&(a=null),void 0===s&&(s=null);var o=i.diagnosticCodeToString(t);return null!=n&&(o=o.replace("{0}",n)),null!=a&&(o=o.replace("{1}",a)),null!=s&&(o=o.replace("{2}",s)),new e(t,r,o)},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?o(this.category)+" "+this.code.toString(10)+': "'+this.message+'" in '+this.range.source.normalizedPath+":"+this.range.line.toString(10)+":"+this.range.column.toString(10):o(this.category)+" "+this.code.toString(10)+": "+this.message},e}();function u(e,r){void 0===r&&(r=!1);for(var n=e.source.text,i=n.length,s=e.start,o=e.end;s>0&&!a.isLineBreak(n.charCodeAt(s-1));)s--;for(;o<i&&!a.isLineBreak(n.charCodeAt(o));)o++;for(var c=["\n ",n.substring(s,o),"\n "];s<e.start;)c.push(" "),s++;if(r&&c.push(t.COLOR_RED),e.start==e.end)c.push("^");else for(;s++<e.end;){if(a.isLineBreak(n.charCodeAt(s))){c.push(s==e.start+1?"^":"~");break}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(o(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(u(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 s=e.relatedRange;s&&(n&&(i.push("\n"),i.push(u(s,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=u;var p=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,s){void 0===i&&(i=null),void 0===a&&(a=null),void 0===s&&(s=null);var o=l.create(e,t,i,a,s).withRange(r);n&&(o.relatedRange=n),this.diagnostics.push(o)},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,s){void 0===i&&(i=null),void 0===a&&(a=null),void 0===s&&(s=null),this.emitDiagnostic(e,n.INFO,t,r,i,a,s)},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,s){void 0===i&&(i=null),void 0===a&&(a=null),void 0===s&&(s=null),this.emitDiagnostic(e,n.WARNING,t,r,i,a,s)},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,s){void 0===i&&(i=null),void 0===a&&(a=null),void 0===s&&(s=null),this.emitDiagnostic(e,n.ERROR,t,r,i,a,s)},e}();t.DiagnosticEmitter=p},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}}}},s=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),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.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 s};Object.defineProperty(t,"__esModule",{value:!0});var o,c=r(0),l=r(2),u=r(6),p=r(5),_=r(1),h=r(9),d=r(10),y=function(){return function(e,t,r,n,i){this.localFile=e,this.localIdentifier=t,this.foreignIdentifier=r,this.foreignPath=n,this.foreignPathAlt=i}}(),m=function(){return function(e,t,r,n){this.localIdentifier=e,this.foreignIdentifier=t,this.foreignPath=r,this.foreignPathAlt=n}}(),f=function(){return function(e,t,r){this.foreignPath=e,this.foreignPathAlt=t,this.pathLiteral=r}}();function T(e,t){switch(assert(t.length),e){case p.DecoratorKind.OPERATOR:case p.DecoratorKind.OPERATOR_BINARY:switch(t.charCodeAt(0)){case 91:if("[]"==t)return o.INDEXED_GET;if("[]="==t)return o.INDEXED_SET;break;case 123:if("{}"==t)return o.UNCHECKED_INDEXED_GET;if("{}="==t)return o.UNCHECKED_INDEXED_SET;break;case 43:if("+"==t)return o.ADD;break;case 45:if("-"==t)return o.SUB;break;case 42:if("*"==t)return o.MUL;if("**"==t)return o.POW;break;case 47:if("/"==t)return o.DIV;break;case 37:if("%"==t)return o.REM;break;case 38:if("&"==t)return o.BITWISE_AND;break;case 124:if("|"==t)return o.BITWISE_OR;break;case 94:if("^"==t)return o.BITWISE_XOR;break;case 61:if("=="==t)return o.EQ;break;case 33:if("!="==t)return o.NE;break;case 62:if(">"==t)return o.GT;if(">="==t)return o.GE;if(">>"==t)return o.BITWISE_SHR;if(">>>"==t)return o.BITWISE_SHR_U;break;case 60:if("<"==t)return o.LT;if("<="==t)return o.LE;if("<<"==t)return o.BITWISE_SHL}break;case p.DecoratorKind.OPERATOR_PREFIX:switch(t.charCodeAt(0)){case 43:if("+"==t)return o.PLUS;if("++"==t)return o.PREFIX_INC;break;case 45:if("-"==t)return o.MINUS;if("--"==t)return o.PREFIX_DEC;break;case 33:if("!"==t)return o.NOT;break;case 126:if("~"==t)return o.BITWISE_NOT}break;case p.DecoratorKind.OPERATOR_POSTFIX:switch(t.charCodeAt(0)){case 43:if("++"==t)return o.POSTFIX_INC;break;case 45:if("--"==t)return o.POSTFIX_DEC}}return o.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"}(o=t.OperatorKind||(t.OperatorKind={}));var g,E,v=function(e){function t(t){void 0===t&&(t=null);var r=e.call(this,t)||this;r.sources=[],r.diagnosticsOffset=0,r.filesByName=new Map,r.elementsByName=new Map,r.elementsByDeclaration=new Map,r.instancesByName=new Map,r.typeClasses=new Map,r.managedClasses=new Map,r.nextClassId=0,r.nativeDummySignature=null;var n=new p.Source(c.LIBRARY_SUBST,"[native code]",p.SourceKind.LIBRARY);r.nativeSource=n;var i=new N(r,n);return r.nativeFile=i,r.filesByName.set(i.internalName,i),r.resolver=new h.Resolver(r),r}return i(t,e),t.prototype.writeRuntimeHeader=function(e,t,r,n){assert(n<1<<28),_.writeI32(n,e,t),_.writeI32(1,e,t+4),_.writeI32(r.id,e,t+8),_.writeI32(n,e,t+12)},Object.defineProperty(t.prototype,"runtimeHeaderSize",{get:function(){return 16},enumerable:!0,configurable:!0}),t.prototype.makeNativeVariableDeclaration=function(e,t){void 0===t&&(t=c.CommonFlags.NONE);var r=this.nativeSource.range;return p.Node.createVariableDeclaration(p.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=p.Node.createIdentifierExpression(e,r);return p.Node.createTypeDeclaration(n,null,p.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 p.Node.createFunctionDeclaration(p.Node.createIdentifierExpression(e,r),null,this.nativeDummySignature||(this.nativeDummySignature=p.Node.createSignature([],p.Node.createType(p.Node.createSimpleTypeName(c.CommonSymbols.void_,r),null,!1,r),null,!1,r)),null,null,t,0,r)},t.prototype.makeNativeNamespaceDeclaration=function(e,t){void 0===t&&(t=c.CommonFlags.NONE);var r=this.nativeSource.range;return p.Node.createNamespaceDeclaration(p.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=E.NONE),new P(e,new D(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,o,_,h,d,y,m,f,T;this.options=e,this.registerNativeType(c.CommonSymbols.i8,u.Type.i8),this.registerNativeType(c.CommonSymbols.i16,u.Type.i16),this.registerNativeType(c.CommonSymbols.i32,u.Type.i32),this.registerNativeType(c.CommonSymbols.i64,u.Type.i64),this.registerNativeType(c.CommonSymbols.isize,e.isizeType),this.registerNativeType(c.CommonSymbols.u8,u.Type.u8),this.registerNativeType(c.CommonSymbols.u16,u.Type.u16),this.registerNativeType(c.CommonSymbols.u32,u.Type.u32),this.registerNativeType(c.CommonSymbols.u64,u.Type.u64),this.registerNativeType(c.CommonSymbols.usize,e.usizeType),this.registerNativeType(c.CommonSymbols.bool,u.Type.bool),this.registerNativeType(c.CommonSymbols.f32,u.Type.f32),this.registerNativeType(c.CommonSymbols.f64,u.Type.f64),this.registerNativeType(c.CommonSymbols.void_,u.Type.void),this.registerNativeType(c.CommonSymbols.number,u.Type.f64),this.registerNativeType(c.CommonSymbols.boolean,u.Type.bool),this.nativeFile.add(c.CommonSymbols.native,new S(c.CommonSymbols.native,this.nativeFile,this.makeNativeTypeDeclaration(c.CommonSymbols.native,c.CommonFlags.EXPORT|c.CommonFlags.GENERIC),E.BUILTIN)),e.hasFeature(8)&&this.registerNativeType(c.CommonSymbols.v128,u.Type.v128),this.registerConstantInteger(c.CommonSymbols.ASC_TARGET,u.Type.i32,i64_new(e.isWasm64?c.Target.WASM64:c.Target.WASM32)),this.registerConstantInteger(c.CommonSymbols.ASC_NO_ASSERT,u.Type.bool,i64_new(e.noAssert?1:0,0)),this.registerConstantInteger(c.CommonSymbols.ASC_MEMORY_BASE,u.Type.i32,i64_new(e.memoryBase,0)),this.registerConstantInteger(c.CommonSymbols.ASC_OPTIMIZE_LEVEL,u.Type.i32,i64_new(e.optimizeLevelHint,0)),this.registerConstantInteger(c.CommonSymbols.ASC_SHRINK_LEVEL,u.Type.i32,i64_new(e.shrinkLevelHint,0)),this.registerConstantInteger(c.CommonSymbols.ASC_FEATURE_MUTABLE_GLOBAL,u.Type.bool,i64_new(e.hasFeature(2)?1:0,0)),this.registerConstantInteger(c.CommonSymbols.ASC_FEATURE_SIGN_EXTENSION,u.Type.bool,i64_new(e.hasFeature(1)?1:0,0)),this.registerConstantInteger(c.CommonSymbols.ASC_FEATURE_BULK_MEMORY,u.Type.bool,i64_new(e.hasFeature(4)?1:0,0)),this.registerConstantInteger(c.CommonSymbols.ASC_FEATURE_SIMD,u.Type.bool,i64_new(e.hasFeature(8)?1:0,0)),this.registerConstantInteger(c.CommonSymbols.ASC_FEATURE_THREADS,u.Type.bool,i64_new(e.hasFeature(16)?1:0,0));for(var v=new Array,b=new Map,I=new Map,A=new Array,O=new Array,C=0,k=this.sources.length;C<k;++C){var R=this.sources[C],L=new N(this,R);this.filesByName.set(L.internalName,L);for(var F=R.statements,B=0,D=F.length;B<D;++B){var P=F[B];switch(P.kind){case p.NodeKind.EXPORT:this.initializeExports(P,L,b,I);break;case p.NodeKind.EXPORTDEFAULT:this.initializeExportDefault(P,L,A,O);break;case p.NodeKind.IMPORT:this.initializeImports(P,L,v,b);break;case p.NodeKind.VARIABLE:this.initializeVariables(P,L);break;case p.NodeKind.CLASSDECLARATION:this.initializeClass(P,L,A,O);break;case p.NodeKind.ENUMDECLARATION:this.initializeEnum(P,L);break;case p.NodeKind.FUNCTIONDECLARATION:this.initializeFunction(P,L);break;case p.NodeKind.INTERFACEDECLARATION:this.initializeInterface(P,L);break;case p.NodeKind.NAMESPACEDECLARATION:this.initializeNamespace(P,L,A,O);break;case p.NodeKind.TYPEDECLARATION:this.initializeTypeDefinition(P,L)}}}try{for(var w=a(I),U=w.next();!U.done;U=w.next()){var M=s(U.value,2),V=(L=M[0],M[1]);for(C=0,k=V.length;C<k;++C){var G=V[C];(K=this.lookupForeignFile(G.foreignPath,G.foreignPathAlt))?L.ensureExportStar(K):this.error(l.DiagnosticCode.File_0_not_found,G.pathLiteral.range,G.pathLiteral.value)}}}catch(e){t={error:e}}finally{try{U&&!U.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}for(C=0,k=v.length;C<k;++C){var K,z=v[C],Y=z.foreignIdentifier;if(Y)(ve=this.lookupForeign(Y.text,z.foreignPath,z.foreignPathAlt,b))?z.localFile.add(z.localIdentifier.text,ve,!0):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,Y.range,z.foreignPath,Y.text);else if(K=this.lookupForeignFile(z.foreignPath,z.foreignPathAlt)){var H=z.localFile,W=z.localIdentifier.text;H.add(W,K.asImportedNamespace(W,H),!0)}else assert(!1)}try{for(var X=a(b),q=X.next();!q.done;q=X.next()){var Q=s(q.value,2),j=(L=Q[0],Q[1]);try{for(var Z=a(j),J=Z.next();!J.done;J=Z.next()){var $=s(J.value,2),ee=$[0],te=$[1],re=(W=te.localIdentifier.text,te.foreignPath);if(re)(ve=this.lookupForeign(W,re,assert(te.foreignPathAlt),b))?L.ensureExport(ee,ve):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,te.localIdentifier.range,re,W);else if(ve=L.lookupInSelf(W))L.ensureExport(ee,ve);else{var ne=this.lookupGlobal(W);ne&&ne instanceof x?L.ensureExport(ee,ne):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,te.foreignIdentifier.range,L.internalName,te.foreignIdentifier.text)}}}catch(e){o={error:e}}finally{try{J&&!J.done&&(_=Z.return)&&_.call(Z)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{q&&!q.done&&(i=X.return)&&i.call(X)}finally{if(n)throw n.error}}assert(0==this.nextClassId),this.arrayBufferInstance=this.requireClass(c.CommonSymbols.ArrayBuffer),assert(0==this.arrayBufferInstance.id),this.stringInstance=this.requireClass(c.CommonSymbols.String),assert(1==this.stringInstance.id),this.arrayBufferViewInstance=this.requireClass(c.CommonSymbols.ArrayBufferView),assert(2==this.arrayBufferViewInstance.id),this.registerNativeTypeClass(0,c.CommonSymbols.I8),this.registerNativeTypeClass(1,c.CommonSymbols.I16),this.registerNativeTypeClass(2,c.CommonSymbols.I32),this.registerNativeTypeClass(3,c.CommonSymbols.I64),this.registerNativeTypeClass(4,c.CommonSymbols.Isize),this.registerNativeTypeClass(5,c.CommonSymbols.U8),this.registerNativeTypeClass(6,c.CommonSymbols.U16),this.registerNativeTypeClass(7,c.CommonSymbols.U32),this.registerNativeTypeClass(8,c.CommonSymbols.U64),this.registerNativeTypeClass(9,c.CommonSymbols.Usize),this.registerNativeTypeClass(10,c.CommonSymbols.Bool),this.registerNativeTypeClass(11,c.CommonSymbols.F32),this.registerNativeTypeClass(12,c.CommonSymbols.F64),e.hasFeature(8)&&this.registerNativeTypeClass(13,c.CommonSymbols.V128),this.i8ArrayPrototype=this.require(c.CommonSymbols.Int8Array,g.CLASS_PROTOTYPE),this.i16ArrayPrototype=this.require(c.CommonSymbols.Int16Array,g.CLASS_PROTOTYPE),this.i32ArrayPrototype=this.require(c.CommonSymbols.Int32Array,g.CLASS_PROTOTYPE),this.i64ArrayPrototype=this.require(c.CommonSymbols.Int64Array,g.CLASS_PROTOTYPE),this.u8ArrayPrototype=this.require(c.CommonSymbols.Uint8Array,g.CLASS_PROTOTYPE),this.u8ClampedArrayPrototype=this.require(c.CommonSymbols.Uint8ClampedArray,g.CLASS_PROTOTYPE),this.u16ArrayPrototype=this.require(c.CommonSymbols.Uint16Array,g.CLASS_PROTOTYPE),this.u32ArrayPrototype=this.require(c.CommonSymbols.Uint32Array,g.CLASS_PROTOTYPE),this.u64ArrayPrototype=this.require(c.CommonSymbols.Uint64Array,g.CLASS_PROTOTYPE),this.f32ArrayPrototype=this.require(c.CommonSymbols.Float32Array,g.CLASS_PROTOTYPE),this.f64ArrayPrototype=this.require(c.CommonSymbols.Float64Array,g.CLASS_PROTOTYPE);var ie=this.resolver;for(C=0,k=A.length;C<k;++C){var ae=A[C],se=assert(ae.extendsNode),oe=ie.resolveTypeName(se.name,ae.parent);if(oe)if(oe.kind==g.CLASS_PROTOTYPE){var ce=oe;ce.hasDecorator(E.SEALED)&&this.error(l.DiagnosticCode.Class_0_is_sealed_and_cannot_be_extended,se.range,oe.identifierNode.text),ce.hasDecorator(E.UNMANAGED)!=ae.hasDecorator(E.UNMANAGED)&&this.error(l.DiagnosticCode.Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa,p.Range.join(ae.identifierNode.range,se.range)),ae.basePrototype=ce}else this.error(l.DiagnosticCode.A_class_may_only_extend_another_class,se.range)}var le=e.globalAliases;if(le)try{for(var ue=a(le),pe=ue.next();!pe.done;pe=ue.next()){var _e=s(pe.value,2),he=_e[0],de=_e[1];if(de.length){var ye=de.charCodeAt(0);if(ye>=48&&ye<=57)this.registerConstantInteger(he,u.Type.i32,i64_new(parseI32(de,10)));else{var me=this.elementsByName;if(!(ve=me.get(de)))throw new Error("no such global element: "+de);if(me.has(he))throw new Error("duplicate global element: "+de);me.set(he,ve)}}}}catch(e){h={error:e}}finally{try{pe&&!pe.done&&(d=ue.return)&&d.call(ue)}finally{if(h)throw h.error}}this.arrayPrototype=this.require(c.CommonSymbols.Array,g.CLASS_PROTOTYPE),this.fixedArrayPrototype=this.require(c.CommonSymbols.FixedArray,g.CLASS_PROTOTYPE),this.setPrototype=this.require(c.CommonSymbols.Set,g.CLASS_PROTOTYPE),this.mapPrototype=this.require(c.CommonSymbols.Map,g.CLASS_PROTOTYPE),this.abortInstance=this.requireFunction(c.CommonSymbols.abort),this.allocInstance=this.requireFunction(c.CommonSymbols.alloc),this.reallocInstance=this.requireFunction(c.CommonSymbols.realloc),this.freeInstance=this.requireFunction(c.CommonSymbols.free),this.retainInstance=this.requireFunction(c.CommonSymbols.retain),this.releaseInstance=this.requireFunction(c.CommonSymbols.release),this.collectInstance=this.requireFunction(c.CommonSymbols.collect),this.typeinfoInstance=this.requireFunction(c.CommonSymbols.typeinfo),this.instanceofInstance=this.requireFunction(c.CommonSymbols.instanceof_),this.visitInstance=this.requireFunction(c.CommonSymbols.visit),this.allocArrayInstance=this.requireFunction(c.CommonSymbols.allocArray);try{for(var fe=a(this.filesByName.values()),Te=fe.next();!Te.done;Te=fe.next()){j=(L=Te.value).exports;if(L.source.isEntry&&j)try{for(var ge=a(j.values()),Ee=ge.next();!Ee.done;Ee=ge.next()){var ve=Ee.value;this.markModuleExport(ve)}}catch(e){f={error:e}}finally{try{Ee&&!Ee.done&&(T=ge.return)&&T.call(ge)}finally{if(f)throw f.error}}}}catch(e){y={error:e}}finally{try{Te&&!Te.done&&(m=fe.return)&&m.call(fe)}finally{if(y)throw y.error}}},t.prototype.require=function(e,t){var r=this.lookupGlobal(e);if(!r)throw new Error("missing "+e);if(r.kind!=t)throw new Error("unexpected "+e);return r},t.prototype.requireClass=function(e){var t=this.require(e,g.CLASS_PROTOTYPE),r=this.resolver.resolveClass(t,null);if(!r)throw new Error("invalid "+e);return r},t.prototype.requireFunction=function(e){var t=this.require(e,g.FUNCTION_PROTOTYPE),r=this.resolver.resolveFunction(t,null);if(!r)throw new Error("invalid "+e);return r},t.prototype.markModuleExport=function(e){var t,r,n,i;switch(e.set(c.CommonFlags.MODULE_EXPORT),e.kind){case g.CLASS_PROTOTYPE:var s=e.instanceMembers;if(s)try{for(var o=a(s.values()),l=o.next();!l.done;l=o.next()){var u=l.value;this.markModuleExport(u)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}break;case g.PROPERTY_PROTOTYPE:var p=e.getterPrototype;p&&this.markModuleExport(p);var _=e.setterPrototype;_&&this.markModuleExport(_);break;case g.PROPERTY:case g.FUNCTION:case g.FIELD:case g.CLASS:assert(!1)}var h=e.members;if(h)try{for(var d=a(h.values()),y=d.next();!y.done;y=d.next()){u=y.value;this.markModuleExport(u)}}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 S(e,this.nativeFile,this.makeNativeTypeDeclaration(e,c.CommonFlags.EXPORT),E.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==g.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,E.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,E.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=q(r.get(e),t);if(!n)return this.error(l.DiagnosticCode.Duplicate_identifier_0,t.identifierNode.range,e),t;t=n}return r.set(e,t),t},t.prototype.lookupGlobal=function(e){var t=this.elementsByName;return t.has(e)?t.get(e):null},t.prototype.requireGlobal=function(e){var t=this.elementsByName;if(t.has(e))return t.get(e);throw new Error("missing global")},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 s=n.get(i);if(s.has(e)){var o=s.get(e);if(o.foreignPath){e=o.localIdentifier.text,t=o.foreignPath,r=assert(o.foreignPathAlt);continue}if(a=i.lookupInSelf(o.localIdentifier.text))return a}}break}return null},t.prototype.checkDecorators=function(e,t){var r=E.NONE;if(e)for(var n=0,i=e.length;n<i;++n){var a=e[n],s=b(p.decoratorNameToKind(a.name));s&&(s==E.BUILTIN?t&s||a.range.source.isLibrary?r|=s:this.error(l.DiagnosticCode.Decorator_0_is_not_valid_here,a.range,a.name.range.toString()):t&s?r&s?this.error(l.DiagnosticCode.Duplicate_decorator,a.range,a.name.range.toString()):r|=s: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 z(i,t,e,this.checkDecorators(e.decorators,E.GLOBAL|E.SEALED|E.UNMANAGED));if(!t.add(i,a))return null;var s=e.implementsTypes;if(s){var o=s.length;if(a.hasDecorator(E.UNMANAGED))o&&this.error(l.DiagnosticCode.Unmanaged_classes_cannot_implement_interfaces,p.Range.join(e.name.range,s[o-1].range));else if(o){for(var u=0;u<o;++u)this.warning(l.DiagnosticCode.Operation_not_supported,s[u].range);n.push(a)}}e.extendsType&&r.push(a);for(var _=e.members,h=(u=0,_.length);u<h;++u){var d=_[u];switch(d.kind){case p.NodeKind.FIELDDECLARATION:this.initializeField(d,a);break;case p.NodeKind.METHODDECLARATION:d.isAny(c.CommonFlags.GET|c.CommonFlags.SET)?this.initializeProperty(d,a):this.initializeMethod(d,a);break;case p.NodeKind.INDEXSIGNATUREDECLARATION:break;default:assert(!1)}}return a},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!=g.INTERFACE_PROTOTYPE),r=new L(n,t,this.checkDecorators(i,(e.is(c.CommonFlags.READONLY)?E.INLINE:E.NONE)|E.LAZY|E.UNSAFE),e),!t.add(n,r))return}else if(assert(!e.isAny(c.CommonFlags.ABSTRACT|c.CommonFlags.GET|c.CommonFlags.SET)),r=new U(n,t,e,this.checkDecorators(i,E.UNSAFE)),!t.addInstance(n,r))return},t.prototype.initializeMethod=function(e,t){var r=e.name.text,n=e.is(c.CommonFlags.STATIC),i=E.INLINE|E.UNSAFE;e.is(c.CommonFlags.GENERIC)||(i|=E.OPERATOR_BINARY|E.OPERATOR_PREFIX|E.OPERATOR_POSTFIX);var a=new D(r,t,e,this.checkDecorators(e.decorators,i));if(n){if(assert(e.name.kind!=p.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 p.DecoratorKind.OPERATOR:case p.DecoratorKind.OPERATOR_BINARY:case p.DecoratorKind.OPERATOR_PREFIX:case p.DecoratorKind.OPERATOR_POSTFIX:var s=a.arguments&&a.arguments.length||0;if(1==s){var c=a.arguments[0];if(c.kind==p.NodeKind.LITERAL&&c.literalKind==p.LiteralKind.STRING){var u=T(a.decoratorKind,c.value);if(u==o.INVALID)this.error(l.DiagnosticCode.Operation_not_supported,c.range);else{var _=r.overloadPrototypes;_.has(u)?this.error(l.DiagnosticCode.Duplicate_function_implementation,c.range):(t.operatorKind=u,_.set(u,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",s.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 V(r,t,e);return t.add(r,n)?n:null}if((n=i.get(r)).kind==g.PROPERTY_PROTOTYPE)return n}else{var i;if(!(i=t.instanceMembers)||!i.has(r)){n=new V(r,t,e);return t.addInstance(r,n)?n:null}if((n=i.get(r)).kind==g.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 D((i?c.GETTER_PREFIX:c.SETTER_PREFIX)+n,r,e,this.checkDecorators(e.decorators,E.INLINE|E.UNSAFE));i?r.getterPrototype=a:r.setterPrototype=a}},t.prototype.initializeEnum=function(e,t){var r=e.name.text,n=new C(r,t,e,this.checkDecorators(e.decorators,E.GLOBAL|E.INLINE|E.LAZY));if(!t.add(r,n))return null;for(var i=e.values,a=0,s=i.length;a<s;++a)this.initializeEnumValue(i[a],n);return n},t.prototype.initializeEnumValue=function(e,t){var r=e.name.text,n=new R(r,t,e,this.checkDecorators(e.decorators,E.NONE));t.add(r,n)},t.prototype.initializeExports=function(e,t,r,n){var i=e.members;if(i)for(var a=0,s=i.length;a<s;++a)this.initializeExport(i[a],t,e.internalPath,r);else{var o=void 0;n.has(t)?o=n.get(t):n.set(t,o=[]);var l=assert(e.internalPath);o.push(new f(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,s=t.lookupExport(a);if(s)this.error(l.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.exportedName.range,a);else if(null===r)if(s=t.lookupInSelf(i))t.ensureExport(a,s);else{var o=void 0;n.has(t)?o=n.get(t):n.set(t,o=new Map),o.set(a,new m(e.localName,e.exportedName,null,null))}else{o=void 0;n.has(t)?o=n.get(t):n.set(t,o=new Map),o.set(a,new m(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.initializeExportDefault=function(e,t,r,n){var i=e.declaration,a=null;switch(i.kind){case p.NodeKind.ENUMDECLARATION:a=this.initializeEnum(i,t);break;case p.NodeKind.FUNCTIONDECLARATION:a=this.initializeFunction(i,t);break;case p.NodeKind.CLASSDECLARATION:a=this.initializeClass(i,t,r,n);break;case p.NodeKind.INTERFACEDECLARATION:a=this.initializeInterface(i,t);break;case p.NodeKind.NAMESPACEDECLARATION:a=this.initializeNamespace(i,t,r,n);break;default:assert(!1)}if(a){var s=t.exports;if(s){if(s.has("default"))return void this.error(l.DiagnosticCode.Duplicate_identifier_0,i.name.range,"default")}else t.exports=s=new Map;s.set("default",a)}},t.prototype.initializeImports=function(e,t,r,n){var i=e.declarations;if(i)for(var a=0,s=i.length;a<s;++a)this.initializeImport(i[a],t,e.internalPath,r,n);else e.namespaceName&&r.push(new y(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,s=this.lookupForeign(e.foreignName.text,r,a,i);s?t.add(e.name.text,s,!0):n.push(new y(t,e.name,e.foreignName,r,a))},t.prototype.initializeFunction=function(e,t){var r=e.name.text,n=E.UNSAFE|E.BUILTIN;e.is(c.CommonFlags.AMBIENT)?n|=E.EXTERNAL:n|=E.INLINE,e.is(c.CommonFlags.INSTANCE)||t.kind!=g.CLASS_PROTOTYPE&&(n|=E.GLOBAL);var i=new D(r,t,e,this.checkDecorators(e.decorators,n));return t.add(r,i)?i:null},t.prototype.initializeInterface=function(e,t){var r=e.name.text,n=new H(r,t,e,this.checkDecorators(e.decorators,E.GLOBAL));if(!t.add(r,n))return null;for(var i=e.members,a=0,s=i.length;a<s;++a){var o=i[a];switch(o.kind){case p.NodeKind.FIELDDECLARATION:this.initializeField(o,n);break;case p.NodeKind.METHODDECLARATION:o.isAny(c.CommonFlags.GET|c.CommonFlags.SET)?this.initializeProperty(o,n):this.initializeMethod(o,n);break;default:assert(!1)}}return n},t.prototype.initializeNamespace=function(e,t,r,n){var i=e.name.text,a=new O(i,t,e,this.checkDecorators(e.decorators,E.GLOBAL));if(!t.add(i,a))return null;for(var s=assert(t.lookupInSelf(i)),o=e.members,c=0,l=o.length;c<l;++c){var u=o[c];switch(u.kind){case p.NodeKind.CLASSDECLARATION:this.initializeClass(u,a,r,n);break;case p.NodeKind.ENUMDECLARATION:this.initializeEnum(u,a);break;case p.NodeKind.FUNCTIONDECLARATION:this.initializeFunction(u,a);break;case p.NodeKind.INTERFACEDECLARATION:this.initializeInterface(u,a);break;case p.NodeKind.NAMESPACEDECLARATION:this.initializeNamespace(u,a,r,n);break;case p.NodeKind.TYPEDECLARATION:this.initializeTypeDefinition(u,a);break;case p.NodeKind.VARIABLE:this.initializeVariables(u,a);break;default:assert(!1)}}return a!=s&&Q(a,s),s},t.prototype.initializeTypeDefinition=function(e,t){var r=e.name.text,n=new S(r,t,e,this.checkDecorators(e.decorators,E.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],s=a.name.text,o=E.GLOBAL|E.LAZY;a.is(c.CommonFlags.DECLARE)&&(o|=E.EXTERNAL),a.is(c.CommonFlags.CONST)&&(o|=E.INLINE);var l=new L(s,t,this.checkDecorators(a.decorators,o),a);t.add(s,l)}},t}(l.DiagnosticEmitter);function b(e){switch(e){case p.DecoratorKind.GLOBAL:return E.GLOBAL;case p.DecoratorKind.OPERATOR:case p.DecoratorKind.OPERATOR_BINARY:return E.OPERATOR_BINARY;case p.DecoratorKind.OPERATOR_PREFIX:return E.OPERATOR_PREFIX;case p.DecoratorKind.OPERATOR_POSTFIX:return E.OPERATOR_POSTFIX;case p.DecoratorKind.UNMANAGED:return E.UNMANAGED;case p.DecoratorKind.SEALED:return E.SEALED;case p.DecoratorKind.INLINE:return E.INLINE;case p.DecoratorKind.EXTERNAL:return E.EXTERNAL;case p.DecoratorKind.BUILTIN:return E.BUILTIN;case p.DecoratorKind.LAZY:return E.LAZY;case p.DecoratorKind.UNSAFE:return E.UNSAFE;default:return E.NONE}}t.Program=v,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"}(g=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.UNSAFE=1024]="UNSAFE"}(E=t.DecoratorFlags||(t.DecoratorFlags={})),t.decoratorKindToFlag=b;var I=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=E.NONE,this.members=null,this.shadowType=null,this.program=n,this.name=t,this.internalName=r,i?this.parent=i:(assert(this.kind==g.FILE),this.parent=this)}return Object.defineProperty(e.prototype,"file",{get:function(){for(var e=this;;)if((e=e.parent).kind==g.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.unset=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=q(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 s=this.program;return t.kind==g.FUNCTION_PROTOTYPE&&t.isBound||(s.elementsByName.set(t.internalName,t),s.elementsByDeclaration.set(r,t)),!0},e.prototype.toString=function(){return g[this.kind]+":"+this.internalName},e}();t.Element=I;var x=function(e){function t(t,r,n,i,a,s){var o=e.call(this,t,r,n,i,a)||this;return o.declaration=s,o.declaration=s,o.flags=s.flags,o}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}(I);t.DeclaredElement=x;var A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=u.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}(x);t.TypedElement=A;var N=function(e){function t(t,r){var n=e.call(this,g.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 u.Signature(null,u.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),r.hasDecorator(E.GLOBAL)&&(r=this.program.ensureGlobal(t,r)),!!e.prototype.add.call(this,t,r)&&((r=assert(this.lookupInSelf(t))).is(c.CommonFlags.EXPORT)&&!n&&this.ensureExport(r.name,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 O(e,t,this.program.makeNativeNamespaceDeclaration(e)),o=this.exports;if(o)try{for(var c=a(o),l=c.next();!l.done;l=c.next()){var u=s(l.value,2),p=u[0],_=u[1];i.add(p,_)}}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}(I);t.File=N;var S=function(e){function t(t,r,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,g.TYPEDEFINITION,t,j(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}(A);t.TypeDefinition=S;var O=function(e){function t(t,r,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,g.NAMESPACE,t,j(t,r,!1),r.program,r,n)||this;return a.decoratorFlags=i,a}return i(t,e),t.prototype.lookup=function(e){return this.lookupInSelf(e)||this.parent.lookup(e)},t}(x);t.Namespace=O;var C=function(e){function t(t,r,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,g.ENUM,t,j(t,r,!1),r.program,r,n)||this;return a.decoratorFlags=i,a.setType(u.Type.i32),a}return i(t,e),t.prototype.lookup=function(e){return this.lookupInSelf(e)||this.parent.lookup(e)},t}(A);t.Enum=C,function(e){e[e.NONE=0]="NONE",e[e.INTEGER=1]="INTEGER",e[e.FLOAT=2]="FLOAT"}(t.ConstantValueKind||(t.ConstantValueKind={}));var k=function(e){function t(t,r,n,i){void 0===i&&(i=n.program.makeNativeVariableDeclaration(r));var a=e.call(this,t,r,j(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}(A);t.VariableLikeElement=k;var R=function(e){function t(t,r,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,g.ENUMVALUE,t,r,n)||this;return a.isImmutable=!1,a.decoratorFlags=i,a.setType(u.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}(k);t.EnumValue=R;var L=function(e){function t(t,r,n,i){void 0===i&&(i=r.program.makeNativeVariableDeclaration(t));var a=e.call(this,g.GLOBAL,t,r,i)||this;return a.decoratorFlags=n,a}return i(t,e),t}(k);t.Global=L;var F=function(){return function(e,t,r){void 0===r&&(r=null),this.name=e,this.type=t,this.initializer=r}}();t.Parameter=F;var B=function(e){function t(t,r,n,i,a){void 0===a&&(a=i.program.makeNativeVariableDeclaration(t));var s=e.call(this,g.LOCAL,t,i,a)||this;return s.index=r,s.index=r,assert(n!=u.Type.void),s.setType(n),s}return i(t,e),t}(k);t.Local=B;var D=function(e){function t(t,r,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,g.FUNCTION_PROTOTYPE,t,j(t,r,n.is(c.CommonFlags.INSTANCE)),r.program,r,n)||this;return a.operatorKind=o.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,"arrowKind",{get:function(){return this.declaration.arrowKind},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBound",{get:function(){var e=this.parent;return e.kind==g.CLASS||e.kind==g.PROPERTY_PROTOTYPE&&e.parent.kind==g.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==p.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}(x);t.FunctionPrototype=D;var P=function(e){function t(t,r,n,i){void 0===i&&(i=null);var a=e.call(this,g.FUNCTION,t,j(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.nextAnonymousId=0,a.nextAutoreleaseId=0,a.tempI32s=null,a.tempI64s=null,a.tempF32s=null,a.tempF64s=null,a.tempV128s=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=u.Type.u32.asFunction(n),!r.is(c.CommonFlags.AMBIENT)){var s=0;if(a.is(c.CommonFlags.INSTANCE)){var o=new B(c.CommonSymbols.this_,s++,assert(n.thisType),a);a.localsByName.set(c.CommonSymbols.this_,o),a.localsByIndex[o.index]=o}for(var l=n.parameterTypes,p=0,_=l.length;p<_;++p){var h=l[p],y=n.getParameterName(p);o=new B(y,s++,h,a);a.localsByName.set(y,o),a.localsByIndex[o.index]=o}}return a.flow=d.Flow.create(a),X(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 B(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}(A);t.Function=P;var w=function(e){function t(t,r,n){void 0===n&&(n="");var i=e.call(this,g.FUNCTION_TARGET,n="sig:"+t.toSignatureString(),n,r,r.nativeFile)||this;return i.signature=t,i.flags=c.CommonFlags.RESOLVED,i.type=u.Type.u32.asFunction(t),i}return i(t,e),t.prototype.lookup=function(e){return null},t}(I);t.FunctionTarget=w;var U=function(e){function t(t,r,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,g.FIELD_PROTOTYPE,t,j(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}(x);t.FieldPrototype=U;var M=function(e){function t(t,r,n){var i=e.call(this,g.FIELD,t.name,r,t.declaration)||this;return i.memoryOffset=-1,i.prototype=t,i.flags=t.flags,assert(n!=u.Type.void),i.setType(n),X(i.program,i),i}return i(t,e),t}(k);t.Field=M;var V=function(e){function t(t,r,n){var i=e.call(this,g.PROPERTY_PROTOTYPE,t,j(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}(x);t.PropertyPrototype=V;var G=function(e){function t(t,r){var n=e.call(this,g.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,X(n.program,n),n}return i(t,e),t.prototype.lookup=function(e){return this.parent.lookup(e)},t}(k);t.Property=G;var K,z=function(e){function t(t,r,n,i,a){void 0===i&&(i=E.NONE),void 0===a&&(a=!1);var s=e.call(this,a?g.INTERFACE_PROTOTYPE:g.CLASS_PROTOTYPE,t,j(t,r,n.is(c.CommonFlags.INSTANCE)),r.program,r,n)||this;return s.instanceMembers=null,s.basePrototype=null,s.constructorPrototype=null,s.overloadPrototypes=new Map,s.instances=null,s.decoratorFlags=i,s}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}),Object.defineProperty(t.prototype,"isBuiltinArray",{get:function(){var e=this.program.arrayBufferViewInstance;return null!==e&&this.extends(e.prototype)},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=q(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}(x);t.ClassPrototype=z,function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.ACYCLIC=1]="ACYCLIC",e[e.NOT_ACYCLIC=2]="NOT_ACYCLIC"}(K||(K={}));var Y=function(e){function t(t,r,n,i,o){var l,u;void 0===n&&(n=null),void 0===i&&(i=null),void 0===o&&(o=!1);var p=e.call(this,o?g.INTERFACE:g.CLASS,t,j(t,r.parent,r.is(c.CommonFlags.INSTANCE)),r.program,r.parent,r.declaration)||this;p.contextualTypeArguments=null,p.currentMemoryOffset=0,p.constructorInstance=null,p.overloads=null,p._id=0,p._acyclic=0,p.rttiFlags=0;var _=p.program;if(p.prototype=r,p.flags=r.flags,p.decoratorFlags=r.decoratorFlags,p.typeArguments=n,p.setType(_.options.usizeType.asClass(p)),p.base=i,!p.hasDecorator(E.UNMANAGED)){var h=_.nextClassId++;p._id=h,_.managedClasses.set(h,p)}if(i){var d=i.contextualTypeArguments;if(d){var y=p.contextualTypeArguments;try{for(var m=a(d),f=m.next();!f.done;f=m.next()){var T=s(f.value,2),v=T[0],b=T[1];y||(p.contextualTypeArguments=y=new Map),y.set(v,b)}}catch(e){l={error:e}}finally{try{f&&!f.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}}}var I=r.typeParameterNodes;if(n){var x=n.length;if(!I||x!=I.length)throw new Error("type argument count mismatch");if(x){p.contextualTypeArguments||(p.contextualTypeArguments=new Map);for(var A=0;A<x;++A)p.contextualTypeArguments.set(I[A].name.text,n[A])}}else if(I&&I.length)throw new Error("type argument count mismatch");return X(_,p),p}return i(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBuiltinArray",{get:function(){return this.prototype.isBuiltinArray},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isArrayLike",{get:function(){if(this.isBuiltinArray)return!0;var e=this.lookupInSelf("length");return null!==e&&(e.kind==g.FIELD||e.kind==g.PROPERTY&&null!==e.getterInstance)&&(null!==this.lookupOverload(o.INDEXED_GET)||null!==this.lookupOverload(o.UNCHECKED_INDEXED_GET))},enumerable:!0,configurable:!0}),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 o.INDEXED_GET:if(r=this.lookupOverload(o.UNCHECKED_INDEXED_GET))return r;break;case o.INDEXED_SET:var r;if(r=this.lookupOverload(o.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==g.FIELD),r.memoryOffset},t.prototype.writeField=function(e,t,r,n){var i=this.lookupInSelf(e);if(i&&i.kind==g.FIELD){var a=n+i.memoryOffset;switch(i.type.kind){case 0:case 5:return _.writeI8(i32(t),r,a),1;case 1:case 6:return _.writeI16(i32(t),r,a),2;case 2:case 7:return _.writeI32(i32(t),r,a),4;case 4:case 9:return assert(!this.program.options.isWasm64),_.writeI32(i32(t),r,a),4;case 11:return _.writeF32(f32(t),r,a),4;case 12:return _.writeF64(f64(t),r,a),8}}return assert(!1),0},t.prototype.extends=function(e){return this.prototype.extends(e)},t.prototype.getTypeArgumentsTo=function(e){var t=this;do{if(t.prototype===e)return t.typeArguments}while(t=t.base);return null},t.prototype.getArrayValueType=function(){for(var e=this,t=this.program,r=t.arrayBufferViewInstance;e.base!==r;)e=assert(e.base);switch(e.prototype){case t.i8ArrayPrototype:return u.Type.i8;case t.i16ArrayPrototype:return u.Type.i16;case t.i32ArrayPrototype:return u.Type.i32;case t.i64ArrayPrototype:return u.Type.i64;case t.u8ArrayPrototype:case t.u8ClampedArrayPrototype:return u.Type.u8;case t.u16ArrayPrototype:return u.Type.u16;case t.u32ArrayPrototype:return u.Type.u32;case t.u64ArrayPrototype:return u.Type.u64;case t.f32ArrayPrototype:return u.Type.f32;case t.f64ArrayPrototype:return u.Type.f64;case t.arrayPrototype:return assert(this.getTypeArgumentsTo(t.arrayPrototype))[0];default:assert(!1)}return u.Type.void},Object.defineProperty(t.prototype,"isAcyclic",{get:function(){var e=this._acyclic;if(0==e){var t=this.cyclesTo(this);this._acyclic=e=t?2:1}return 1==e},enumerable:!0,configurable:!0}),t.prototype.cyclesTo=function(e,t){var r,n,i;if(void 0===t&&(t=new Set),t.has(this))return!1;t.add(this);var s,o=this.members;if(o)try{for(var c=a(o.values()),l=c.next();!l.done;l=c.next()){var u=l.value;if(u.kind==g.FIELD&&null!==(i=u.type.classReference)&&(i===e||i.cyclesTo(e,t)))return!0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}if((s=this.program.arrayPrototype)&&this.prototype.extends(s)){var p=assert(this.getTypeArgumentsTo(s));if(assert(1==p.length),null!==(i=p[0].classReference)&&(i===e||i.cyclesTo(e,t)))return!0}else if((s=this.program.setPrototype)&&this.prototype.extends(s)){p=assert(this.getTypeArgumentsTo(s));if(assert(1==p.length),null!==(i=p[0].classReference)&&(i===e||i.cyclesTo(e,t)))return!0}else if((s=this.program.mapPrototype)&&this.prototype.extends(s)){p=assert(this.getTypeArgumentsTo(s));if(assert(2==p.length),null!==(i=p[0].classReference)&&(i===e||i.cyclesTo(e,t)))return!0;if(null!==(i=p[1].classReference)&&(i===e||i.cyclesTo(e,t)))return!0}return!1},t}(A);t.Class=Y;var H=function(e){function t(t,r,n,i){return e.call(this,t,r,n,i,!0)||this}return i(t,e),t}(z);t.InterfacePrototype=H;var W=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}(Y);function X(e,t){assert(!e.instancesByName.has(t.internalName)),e.instancesByName.set(t.internalName,t)}function q(e,t){assert(e.program===t.program),assert(!t.members);var r=null;switch(e.kind){case g.FUNCTION_PROTOTYPE:switch(t.kind){case g.NAMESPACE:Q(t,e),r=e;break;case g.TYPEDEFINITION:e.shadowType||(e.shadowType=t,Q(t,e),r=e)}break;case g.CLASS_PROTOTYPE:case g.ENUM:if(t.kind==g.NAMESPACE){Q(t,e),r=e;break}break;case g.NAMESPACE:switch(t.kind){case g.ENUM:case g.CLASS_PROTOTYPE:case g.FUNCTION_PROTOTYPE:Q(e,t),r=t;break;case g.NAMESPACE:Q(t,e),r=e;break;case g.TYPEDEFINITION:e.shadowType||(e.shadowType=t,Q(t,e),r=e)}break;case g.GLOBAL:t.kind==g.TYPEDEFINITION&&(e.shadowType||(e.shadowType=t,Q(t,e),r=e));break;case g.TYPEDEFINITION:switch(t.kind){case g.GLOBAL:case g.FUNCTION_PROTOTYPE:case g.NAMESPACE:t.shadowType||(t.shadowType=e,Q(e,t),r=t)}}r&&((e.is(c.CommonFlags.EXPORT)||e.hasDecorator(E.GLOBAL))!=(t.is(c.CommonFlags.EXPORT)||t.hasDecorator(E.GLOBAL))&&e.program.error(l.DiagnosticCode.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local,r.identifierNode.range,r.identifierNode.text));return r}function Q(e,t){var r,n,i=e.members;if(i){var o=t.members;o||(t.members=o=new Map);try{for(var c=a(i),l=c.next();!l.done;l=c.next()){var u=s(l.value,2),p=u[0],_=u[1];o.set(p,_)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}}function j(e,t,r,n){switch(void 0===n&&(n=!1),t.kind){case g.FILE:return n?e:t.internalName+c.PATH_DELIMITER+e;case g.FUNCTION:return n?e:(assert(!r),t.internalName+c.INNER_DELIMITER+e);default:return j(t.name,t.parent,t.is(c.CommonFlags.INSTANCE),n)+(r?c.INSTANCE_DELIMITER:c.STATIC_DELIMITER)+e}}t.Interface=W,t.mangleInternalName=j},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,s=r(0);!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.Atomics=_BinaryenFeatureAtomics()]="Atomics",e[e.MutableGloabls=_BinaryenFeatureMutableGlobals()]="MutableGloabls",e[e.NontrappingFPToInt=_BinaryenFeatureNontrappingFPToInt()]="NontrappingFPToInt",e[e.SIMD128=_BinaryenFeatureSIMD128()]="SIMD128",e[e.BulkMemory=_BinaryenFeatureBulkMemory()]="BulkMemory",e[e.SignExt=_BinaryenFeatureSignExt()]="SignExt",e[e.ExceptionHandling=_BinaryenFeatureExceptionHandling()]="ExceptionHandling"}(t.FeatureFlags||(t.FeatureFlags={})),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.LocalGet=_BinaryenLocalGetId()]="LocalGet",e[e.LocalSet=_BinaryenLocalSetId()]="LocalSet",e[e.GlobalGet=_BinaryenGlobalGetId()]="GlobalGet",e[e.GlobalSet=_BinaryenGlobalSetId()]="GlobalSet",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.AtomicNotify=_BinaryenAtomicNotifyId()]="AtomicNotify",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",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"}(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",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.BinaryOp||(t.BinaryOp={})),function(e){e[e.MemorySize=_BinaryenMemorySize()]="MemorySize",e[e.MemoryGrow=_BinaryenMemoryGrow()]="MemoryGrow"}(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.ExtractLaneSVecI8x16=_BinaryenExtractLaneSVecI8x16()]="ExtractLaneSVecI8x16",e[e.ExtractLaneUVecI8x16=_BinaryenExtractLaneUVecI8x16()]="ExtractLaneUVecI8x16",e[e.ExtractLaneSVecI16x8=_BinaryenExtractLaneSVecI16x8()]="ExtractLaneSVecI16x8",e[e.ExtractLaneUVecI16x8=_BinaryenExtractLaneUVecI16x8()]="ExtractLaneUVecI16x8",e[e.ExtractLaneVecI32x4=_BinaryenExtractLaneVecI32x4()]="ExtractLaneVecI32x4",e[e.ExtractLaneVecI64x2=_BinaryenExtractLaneVecI64x2()]="ExtractLaneVecI64x2",e[e.ExtractLaneVecF32x4=_BinaryenExtractLaneVecF32x4()]="ExtractLaneVecF32x4",e[e.ExtractLaneVecF64x2=_BinaryenExtractLaneVecF64x2()]="ExtractLaneVecF64x2"}(t.SIMDExtractOp||(t.SIMDExtractOp={})),function(e){e[e.ReplaceLaneVecI8x16=_BinaryenReplaceLaneVecI8x16()]="ReplaceLaneVecI8x16",e[e.ReplaceLaneVecI16x8=_BinaryenReplaceLaneVecI16x8()]="ReplaceLaneVecI16x8",e[e.ReplaceLaneVecI32x4=_BinaryenReplaceLaneVecI32x4()]="ReplaceLaneVecI32x4",e[e.ReplaceLaneVecI64x2=_BinaryenReplaceLaneVecI64x2()]="ReplaceLaneVecI64x2",e[e.ReplaceLaneVecF32x4=_BinaryenReplaceLaneVecF32x4()]="ReplaceLaneVecF32x4",e[e.ReplaceLaneVecF64x2=_BinaryenReplaceLaneVecF64x2()]="ReplaceLaneVecF64x2"}(t.SIMDReplaceOp||(t.SIMDReplaceOp={})),function(e){e[e.ShlVecI8x16=_BinaryenShlVecI8x16()]="ShlVecI8x16",e[e.ShrSVecI8x16=_BinaryenShrSVecI8x16()]="ShrSVecI8x16",e[e.ShrUVecI8x16=_BinaryenShrUVecI8x16()]="ShrUVecI8x16",e[e.ShlVecI16x8=_BinaryenShlVecI16x8()]="ShlVecI16x8",e[e.ShrSVecI16x8=_BinaryenShrSVecI16x8()]="ShrSVecI16x8",e[e.ShrUVecI16x8=_BinaryenShrUVecI16x8()]="ShrUVecI16x8",e[e.ShlVecI32x4=_BinaryenShlVecI32x4()]="ShlVecI32x4",e[e.ShrSVecI32x4=_BinaryenShrSVecI32x4()]="ShrSVecI32x4",e[e.ShrUVecI32x4=_BinaryenShrUVecI32x4()]="ShrUVecI32x4",e[e.ShlVecI64x2=_BinaryenShlVecI64x2()]="ShlVecI64x2",e[e.ShrSVecI64x2=_BinaryenShrSVecI64x2()]="ShrSVecI64x2",e[e.ShrUVecI64x2=_BinaryenShrUVecI64x2()]="ShrUVecI64x2"}(t.SIMDShiftOp||(t.SIMDShiftOp={}));var o=function(){function e(){}return e.create=function(t,r){var n=new e;return n.buffer=t,n.offset=r,n},e}();t.MemorySegment=o;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=_(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=_(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.i32=function(e){var t=this.lit;return _BinaryenLiteralInt32(t,e),_BinaryenConst(this.ref,t)},e.prototype.i64=function(e,t){void 0===t&&(t=0);var r=this.lit;return _BinaryenLiteralInt64(r,e,t),_BinaryenConst(this.ref,r)},e.prototype.f32=function(e){var t=this.lit;return _BinaryenLiteralFloat32(t,e),_BinaryenConst(this.ref,t)},e.prototype.f64=function(e){var t=this.lit;return _BinaryenLiteralFloat64(t,e),_BinaryenConst(this.ref,t)},e.prototype.v128=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.unary=function(e,t){return _BinaryenUnary(this.ref,e,t)},e.prototype.binary=function(e,t,r){return _BinaryenBinary(this.ref,e,t,r)},e.prototype.host=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=null);var n=this.allocStringCached(t),i=h(r);try{return _BinaryenHost(this.ref,e,n,i,r?r.length:0)}finally{memory.free(i)}},e.prototype.local_get=function(e,t){return _BinaryenLocalGet(this.ref,e,t)},e.prototype.local_tee=function(e,t){return _BinaryenLocalTee(this.ref,e,t)},e.prototype.global_get=function(e,t){var r=this.allocStringCached(e);return _BinaryenGlobalGet(this.ref,r,t)},e.prototype.load=function(e,t,r,n,i,a){return void 0===i&&(i=0),void 0===a&&(a=e),_BinaryenLoad(this.ref,e,t?1:0,i,a,n,r)},e.prototype.store=function(e,t,r,n,a,s){if(void 0===a&&(a=0),void 0===s&&(s=e),n<i.None||n>i.V128)throw new Error("here: "+n);return _BinaryenStore(this.ref,e,a,s,t,r,n)},e.prototype.atomic_load=function(e,t,r,n){return void 0===n&&(n=0),_BinaryenAtomicLoad(this.ref,e,n,r,t)},e.prototype.atomic_store=function(e,t,r,n,i){return void 0===i&&(i=0),_BinaryenAtomicStore(this.ref,e,i,t,r,n)},e.prototype.atomic_rmw=function(e,t,r,n,i,a){return _BinaryenAtomicRMW(this.ref,e,t,r,n,i,a)},e.prototype.atomic_cmpxchg=function(e,t,r,n,i,a){return _BinaryenAtomicCmpxchg(this.ref,e,t,r,n,i,a)},e.prototype.atomic_wait=function(e,t,r,n){return _BinaryenAtomicWait(this.ref,e,t,r,n)},e.prototype.atomic_notify=function(e,t){return _BinaryenAtomicNotify(this.ref,e,t)},e.prototype.local_set=function(e,t){return _BinaryenLocalSet(this.ref,e,t)},e.prototype.global_set=function(e,t){var r=this.allocStringCached(e);return _BinaryenGlobalSet(this.ref,r,t)},e.prototype.block=function(e,t,r){void 0===r&&(r=i.None);var n=this.allocStringCached(e),a=h(t);try{return _BinaryenBlock(this.ref,n,a,t.length,r)}finally{memory.free(a)}},e.prototype.br=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.drop=function(e){return _BinaryenDrop(this.ref,e)},e.prototype.loop=function(e,t){var r=this.allocStringCached(e);return _BinaryenLoop(this.ref,r,t)},e.prototype.if=function(e,t,r){return void 0===r&&(r=0),_BinaryenIf(this.ref,e,t,r)},e.prototype.nop=function(){return _BinaryenNop(this.ref)},e.prototype.return=function(e){return void 0===e&&(e=0),_BinaryenReturn(this.ref,e)},e.prototype.select=function(e,t,r){return _BinaryenSelect(this.ref,r,e,t)},e.prototype.switch=function(e,t,r,n){void 0===n&&(n=0);for(var i=e.length,a=new Array(i),s=0;s<i;++s)a[s]=this.allocStringCached(e[s]);var o=_(a),c=this.allocStringCached(t);try{return _BinaryenSwitch(this.ref,o,i,c,r,n)}finally{memory.free(o)}},e.prototype.call=function(e,t,r){var n=this.allocStringCached(e),i=h(t);try{return _BinaryenCall(this.ref,n,i,t&&t.length||0,r)}finally{memory.free(i)}},e.prototype.call_indirect=function(e,t,r){var n=this.allocStringCached(r),i=h(t);try{return _BinaryenCallIndirect(this.ref,e,i,t&&t.length||0,n)}finally{memory.free(i)}},e.prototype.unreachable=function(){return _BinaryenUnreachable(this.ref)},e.prototype.memory_copy=function(e,t,r){return _BinaryenMemoryCopy(this.ref,e,t,r)},e.prototype.memory_fill=function(e,t,r){return _BinaryenMemoryFill(this.ref,e,t,r)},e.prototype.simd_extract=function(e,t,r){return _BinaryenSIMDExtract(this.ref,e,t,r)},e.prototype.simd_replace=function(e,t,r,n){return _BinaryenSIMDReplace(this.ref,e,t,r,n)},e.prototype.simd_shuffle=function(e,t,r){assert(16==r.length);var n=p(r);try{return _BinaryenSIMDShuffle(this.ref,e,t,n)}finally{memory.free(n)}},e.prototype.simd_bitselect=function(e,t,r){return _BinaryenSIMDBitselect(this.ref,e,t,r)},e.prototype.simd_shift=function(e,t,r){return _BinaryenSIMDShift(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=_(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=_(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),s=this.allocStringCached(r);return _BinaryenAddFunctionImport(this.ref,i,a,s,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),s=this.allocStringCached(r);return _BinaryenAddMemoryImport(this.ref,i,a,s,n)},e.prototype.addGlobalImport=function(e,t,r,n){var i=this.allocStringCached(e),a=this.allocStringCached(t),s=this.allocStringCached(r);return _BinaryenAddGlobalImport(this.ref,i,a,s,n)},e.prototype.setMemory=function(e,t,r,n,i,a){void 0===i&&(i=null),void 0===a&&(a=!1);for(var o=this.allocStringCached(i),c=r.length,l=new Array(c),u=new Array(c),h=new Array(c),d=new Array(c),y=0;y<c;++y){var m=r[y].buffer,f=r[y].offset;l[y]=p(m),u[y]=0,h[y]=n==s.Target.WASM64?this.i64(i64_low(f),i64_high(f)):this.i32(i64_low(f)),d[y]=m.length}var T=_(l),g=p(u),E=_(h),v=_(d);try{_BinaryenSetMemory(this.ref,e,t,o,T,g,E,v,c,a)}finally{memory.free(v),memory.free(E),memory.free(g),memory.free(T);for(y=c-1;y>=0;--y)memory.free(l[y])}},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 s=_(i);try{_BinaryenSetFunctionTable(this.ref,e,t,s,n)}finally{memory.free(s)}},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.getFeatures=function(){return _BinaryenModuleGetFeatures(this.ref)},e.prototype.setFeatures=function(e){_BinaryenModuleSetFeatures(this.ref,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]=d(e[i]);var a=_(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),s=this.cachedPrecomputeNames;return s||(this.cachedPrecomputeNames=s=_([this.allocStringCached("precompute")])),_BinaryenFunctionRunPasses(a,this.ref,s,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=d(e),n=0,i=0;try{_BinaryenModuleAllocateAndWrite(t,this.ref,r),n=y(t);var a=y(t+4);i=y(t+8);var s=new f;return s.output=function(e,t){for(var r=new Uint8Array(t),n=0;n<t;++n)r[n]=load(e+n);return r}(n,a),s.sourceMap=m(i),s}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=d(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 u.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,s;switch(r-=1,_BinaryenExpressionGetId(e)){case a.Const:switch(_BinaryenExpressionGetType(e)){case i.I32:return this.i32(_BinaryenConstGetValueI32(e));case i.I64:return this.i64(_BinaryenConstGetValueI64Low(e),_BinaryenConstGetValueI64High(e));case i.F32:return this.f32(_BinaryenConstGetValueF32(e));case i.F64:return this.f64(_BinaryenConstGetValueF64(e));case i.V128:return 0;default:throw new Error("concrete type expected")}case a.LocalGet:return _BinaryenLocalGet(this.ref,_BinaryenLocalGetGetIndex(e),_BinaryenExpressionGetType(e));case a.GlobalGet:var o=_BinaryenGlobalGetGetName(e);if(!o)break;return _BinaryenGlobalGet(this.ref,o,_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(!(s=this.cloneExpression(_BinaryenBinaryGetRight(e),t,r)))break;return _BinaryenBinary(this.ref,_BinaryenBinaryGetOp(e),n,s)}return 0},e.prototype.addDebugInfoFile=function(e){var t=d(e);try{return _BinaryenModuleAddDebugInfoFileName(this.ref,t)}finally{memory.free(t)}},e.prototype.getDebugInfoFile=function(e){return m(_BinaryenModuleGetDebugInfoFileName(this.ref,e))},e.prototype.setDebugLocation=function(e,t,r,n,i){_BinaryenFunctionSetDebugLocation(e,t,r,n,i)},e.UNLIMITED_MEMORY=-1,e}();function l(e){return _BinaryenExpressionGetId(e)}t.Module=c,t.getExpressionId=l,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.getLocalGetIndex=function(e){return _BinaryenLocalGetGetIndex(e)},t.getLocalSetIndex=function(e){return _BinaryenLocalSetGetIndex(e)},t.getLocalSetValue=function(e){return _BinaryenLocalSetGetValue(e)},t.isLocalTee=function(e){return _BinaryenLocalSetIsTee(e)},t.getGlobalGetName=function(e){return m(_BinaryenGlobalGetGetName(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 m(_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 m(_BinaryenLoopGetName(e))},t.getLoopBody=function(e){return _BinaryenLoopGetBody(e)},t.getBreakName=function(e){return m(_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 m(_BinaryenCallGetTarget(e))},t.getCallOperandCount=function(e){return _BinaryenCallGetNumOperands(e)},t.getCallOperand=function(e,t){return _BinaryenCallGetOperand(e,t)},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 m(_BinaryenHostGetNameOperand(e))},t.getFunctionBody=function(e){return _BinaryenFunctionGetBody(e)},t.getFunctionName=function(e){return m(_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 u=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=_(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 _(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 h(e){return _(e)}function d(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 y(e){return load(e)|load(e+1)<<8|load(e+2)<<16|load(e+3)<<24}function m(e){if(!e)return null;for(var t,r,n,i,a,s=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++))),s.push(t)):s.push((31&t)<<6|r)):s.push(t);return String.fromCodePoints(s)}t.Relooper=u,t.readString=m;var f=function(){return function(){}}();t.BinaryModule=f,t.needsExplicitUnreachable=function e(t){if(_BinaryenExpressionGetType(t)!=i.Unreachable)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},t.traverse=function(e,t,r){switch(l(e)){case a.Block:for(var n=0,i=_BinaryenBlockGetNumChildren(e);n<i;++n)r(_BinaryenBlockGetChild(e,n),t);break;case a.If:r(_BinaryenIfGetCondition(e),t),r(_BinaryenIfGetIfTrue(e),t);var s=_BinaryenIfGetIfFalse(e);s&&r(s,t);break;case a.Loop:r(_BinaryenLoopGetBody(e),t);break;case a.Break:var o=_BinaryenBreakGetCondition(e);o&&r(o,t);break;case a.Switch:r(_BinaryenSwitchGetCondition(e),t);break;case a.Call:for(n=0,i=_BinaryenCallGetNumOperands(e);n<i;++n)r(_BinaryenCallGetOperand(e,n),t);break;case a.CallIndirect:for(n=0,i=_BinaryenCallIndirectGetNumOperands(e);n<i;++n)r(_BinaryenCallIndirectGetOperand(e,n),t);break;case a.LocalGet:break;case a.LocalSet:r(_BinaryenLocalSetGetValue(e),t);break;case a.GlobalGet:break;case a.GlobalSet:r(_BinaryenGlobalSetGetValue(e),t);break;case a.Load:r(_BinaryenLoadGetPtr(e),t);break;case a.Store:r(_BinaryenStoreGetPtr(e),t),r(_BinaryenStoreGetValue(e),t);break;case a.AtomicRMW:r(_BinaryenAtomicRMWGetPtr(e),t),r(_BinaryenAtomicRMWGetValue(e),t);break;case a.AtomicCmpxchg:r(_BinaryenAtomicCmpxchgGetPtr(e),t),r(_BinaryenAtomicCmpxchgGetExpected(e),t),r(_BinaryenAtomicCmpxchgGetReplacement(e),t);break;case a.AtomicWait:r(_BinaryenAtomicWaitGetPtr(e),t),r(_BinaryenAtomicWaitGetExpected(e),t),r(_BinaryenAtomicWaitGetTimeout(e),t);break;case a.AtomicNotify:r(_BinaryenAtomicNotifyGetPtr(e),t);break;case a.SIMDExtract:r(_BinaryenSIMDExtractGetVec(e),t);break;case a.SIMDReplace:r(_BinaryenSIMDReplaceGetVec(e),t),r(_BinaryenSIMDReplaceGetValue(e),t);break;case a.SIMDShuffle:r(_BinaryenSIMDShuffleGetLeft(e),t),r(_BinaryenSIMDShuffleGetRight(e),t);break;case a.SIMDBitselect:r(_BinaryenSIMDBitselectGetLeft(e),t),r(_BinaryenSIMDBitselectGetRight(e),t),r(_BinaryenSIMDBitselectGetCond(e),t);break;case a.SIMDShift:r(_BinaryenSIMDShiftGetVec(e),t),r(_BinaryenSIMDShiftGetShift(e),t);break;case a.MemoryInit:r(_BinaryenMemoryInitGetDest(e),t),r(_BinaryenMemoryInitGetOffset(e),t),r(_BinaryenMemoryInitGetSize(e),t);break;case a.DataDrop:break;case a.MemoryCopy:r(_BinaryenMemoryCopyGetDest(e),t),r(_BinaryenMemoryCopyGetSource(e),t),r(_BinaryenMemoryCopyGetSize(e),t);break;case a.MemoryFill:r(_BinaryenMemoryFillGetDest(e),t),r(_BinaryenMemoryFillGetValue(e),t),r(_BinaryenMemoryFillGetSize(e),t);break;case a.Const:break;case a.Unary:r(_BinaryenUnaryGetValue(e),t);break;case a.Binary:r(_BinaryenBinaryGetLeft(e),t),r(_BinaryenBinaryGetRight(e),t);break;case a.Select:r(_BinaryenSelectGetIfTrue(e),t),r(_BinaryenSelectGetIfFalse(e),t),r(_BinaryenSelectGetCondition(e),t);break;case a.Drop:r(_BinaryenDropGetValue(e),t);break;case a.Return:r(_BinaryenReturnGetValue(e),t);break;case a.Host:for(n=0,i=_BinaryenHostGetNumOperands(e);n<i;++n)r(_BinaryenHostGetOperand(e,n),t);break;case a.Nop:case a.Unreachable:break;default:assert(!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),s=r(7);t.Token=s.Token,t.Range=s.Range;var o,c=r(1);!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.EXPORTDEFAULT=34]="EXPORTDEFAULT",e[e.EXPORTIMPORT=35]="EXPORTIMPORT",e[e.EXPRESSION=36]="EXPRESSION",e[e.FOR=37]="FOR",e[e.IF=38]="IF",e[e.IMPORT=39]="IMPORT",e[e.RETURN=40]="RETURN",e[e.SWITCH=41]="SWITCH",e[e.THROW=42]="THROW",e[e.TRY=43]="TRY",e[e.VARIABLE=44]="VARIABLE",e[e.VOID=45]="VOID",e[e.WHILE=46]="WHILE",e[e.CLASSDECLARATION=47]="CLASSDECLARATION",e[e.ENUMDECLARATION=48]="ENUMDECLARATION",e[e.ENUMVALUEDECLARATION=49]="ENUMVALUEDECLARATION",e[e.FIELDDECLARATION=50]="FIELDDECLARATION",e[e.FUNCTIONDECLARATION=51]="FUNCTIONDECLARATION",e[e.IMPORTDECLARATION=52]="IMPORTDECLARATION",e[e.INDEXSIGNATUREDECLARATION=53]="INDEXSIGNATUREDECLARATION",e[e.INTERFACEDECLARATION=54]="INTERFACEDECLARATION",e[e.METHODDECLARATION=55]="METHODDECLARATION",e[e.NAMESPACEDECLARATION=56]="NAMESPACEDECLARATION",e[e.TYPEDECLARATION=57]="TYPEDECLARATION",e[e.VARIABLEDECLARATION=58]="VARIABLEDECLARATION",e[e.DECORATOR=59]="DECORATOR",e[e.EXPORTMEMBER=60]="EXPORTMEMBER",e[e.SWITCHCASE=61]="SWITCHCASE",e[e.COMMENT=62]="COMMENT"}(o=t.NodeKind||(t.NodeKind={})),t.nodeIsConstantValue=function(e){switch(e){case o.LITERAL:case o.NULL:case o.TRUE:case o.FALSE:return!0}return!1},t.nodeIsCallable=function(e){switch(e){case o.IDENTIFIER:case o.ASSERTION:case o.CALL:case o.ELEMENTACCESS:case o.PARENTHESIZED:case o.PROPERTYACCESS:case o.SUPER:return!0}return!1},t.nodeIsGenericCallable=function(e){switch(e){case o.IDENTIFIER:case o.PROPERTYACCESS:return!0}return!1};var l=function(){function e(){}return e.createTypeName=function(e,t){var r=new p;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=f(e),n},e.createComment=function(e,t,r){var n=new g;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 b;return n.range=t,n.text=e,n.symbol=e,n.isQuoted=r,n},e.createEmptyIdentifierExpression=function(e){var t=new b;return t.range=e,t.text="",t},e.createArrayLiteralExpression=function(e,t){var r=new x;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 S;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 C;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 R;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 L;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 P;return i.range=n,i.expression=e,i.typeArguments=t,i.arguments=r,i},e.createNullExpression=function(e){var t=new w;return t.range=e,t},e.createObjectLiteralExpression=function(e,t,r){var n=new U;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 V;return n.range=r,n.expression=e,n.property=t,n},e.createRegexpLiteralExpression=function(e,t,r){var n=new G;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 Y;return t.range=e,t},e.createThisExpression=function(e){var t=new H;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,s,o){var c=new ae;return c.range=o,c.flags=s,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 se;return r.range=t,r.label=e,r},e.createDoStatement=function(e,t,r){var n=new oe;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 ue;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 s=c.normalizePath(t.value);t.value.startsWith(".")?i.normalizedPath=c.resolvePath(s,n.source.normalizedPath):(s.startsWith(a.LIBRARY_PREFIX)||(s=a.LIBRARY_PREFIX+s),i.normalizedPath=s),i.internalPath=De(i.normalizedPath)}else i.normalizedPath=null,i.internalPath=null;return i.isDeclare=r,i},e.createExportDefaultStatement=function(e,t){var r=new de;return r.declaration=e,r.range=t,r},e.createExportImportStatement=function(e,t,r){var n=new pe;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 ye;return t.range=e.range,t.expression=e,t},e.createIfStatement=function(e,t,r,n){var i=new ge;return i.range=n,i.condition=e,i.ifTrue=t,i.ifFalse=r,i},e.createImportStatement=function(e,t,r){var n=new ve;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=De(n.normalizedPath),n},e.createImportStatementWithWildcard=function(e,t,r){var n=new ve;n.range=r,n.declarations=null,n.namespaceName=e,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=De(n.normalizedPath),n},e.createImportDeclaration=function(e,t,r){var n=new Ee;return n.range=r,n.foreignName=e,t||(t=e),n.name=t,n},e.createInterfaceDeclaration=function(e,t,r,n,i,a,s){var o=new be;return o.range=s,o.flags=a,o.name=e,o.typeParameters=t,o.extendsType=r,o.members=n,o.decorators=i,o},e.createFieldDeclaration=function(e,t,r,n,i,a){var s=new me;return s.range=a,s.flags=i,s.name=e,s.type=t,s.initializer=r,s.decorators=n,s},e.createForStatement=function(e,t,r,n,i){var a=new fe;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,s,o){var c=new Te;return c.range=o,c.flags=a,c.name=e,c.typeParameters=t,c.signature=r,c.body=n,c.decorators=i,c.arrowKind=s,c},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,s){var o=new Ie;return o.range=s,o.flags=a,o.name=e,o.typeParameters=t,o.signature=r,o.body=n,o.decorators=i,o},e.createNamespaceDeclaration=function(e,t,r,n,i){var a=new xe;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 Ae;return r.range=t,r.value=e,r},e.createSwitchStatement=function(e,t,r){var n=new Se;return n.range=r,n.condition=e,n.cases=t,n},e.createSwitchCase=function(e,t,r){var n=new Ne;return n.range=r,n.label=e,n.statements=t,n},e.createThrowStatement=function(e,t){var r=new Oe;return r.range=t,r.value=e,r},e.createTryStatement=function(e,t,r,n,i){var a=new Ce;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 s=new ke;return s.range=a,s.flags=i,s.name=e,s.typeParameters=t,s.type=r,s.decorators=n,s},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 s=new Re;return s.range=a,s.flags=i,s.name=e,s.type=t,s.initializer=r,s.decorators=n,s},e.createVoidStatement=function(e,t){var r=new Fe;return r.range=t,r.expression=e,r},e.createWhileStatement=function(e,t,r){var n=new Be;return n.range=r,n.condition=e,n.statement=t,n},e}();t.Node=l;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(l);t.CommonTypeNode=u;var p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.TYPENAME,t}return i(t,e),t}(l);t.TypeName=p;var _=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.TYPE,t}return i(t,e),t}(u);t.TypeNode=_;var h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.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=o.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=o.SIGNATURE,t}return i(t,e),t}(u);function f(e){if(e.kind==o.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;break;case 117:if("unmanaged"==t)return y.UNMANAGED;if("unsafe"==t)return y.UNSAFE}}else if(e.kind==o.PROPERTYACCESS&&e.expression.kind==o.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.UNSAFE=12]="UNSAFE"}(y=t.DecoratorKind||(t.DecoratorKind={})),t.decoratorNameToKind=f;var T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.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 g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.COMMENT,t}return i(t,e),t}(l);t.CommentNode=g;var E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(l);t.Expression=E;var v,b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.IDENTIFIER,t}return i(t,e),t}(E);t.IdentifierExpression=b,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"}(v=t.LiteralKind||(t.LiteralKind={}));var I=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.LITERAL,t}return i(t,e),t}(E);t.LiteralExpression=I;var x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=v.ARRAY,t}return i(t,e),t}(I);t.ArrayLiteralExpression=x,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=o.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=o.BINARY,t}return i(t,e),t}(E);t.BinaryExpression=N;var S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.CALL,t}return i(t,e),Object.defineProperty(t.prototype,"typeArgumentsRange",{get:function(){var e,t=this.typeArguments;return t&&(e=t.length)?s.Range.join(t[0].range,t[e-1].range):this.expression.range},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"argumentsRange",{get:function(){var e=this.arguments,t=e.length;return t?s.Range.join(e[0].range,e[t-1].range):this.expression.range},enumerable:!0,configurable:!0}),t}(E);t.CallExpression=S;var O=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.CLASS,t}return i(t,e),t}(E);t.ClassExpression=O;var C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.COMMA,t}return i(t,e),t}(E);t.CommaExpression=C;var k=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.CONSTRUCTOR,t.text="constructor",t.symbol=a.CommonSymbols.constructor,t}return i(t,e),t}(b);t.ConstructorExpression=k;var R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.ELEMENTACCESS,t}return i(t,e),t}(E);t.ElementAccessExpression=R;var L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=v.FLOAT,t}return i(t,e),t}(I);t.FloatLiteralExpression=L;var F=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.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=o.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=v.INTEGER,t}return i(t,e),t}(I);t.IntegerLiteralExpression=D;var P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.NEW,t}return i(t,e),t}(S);t.NewExpression=P;var w=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.NULL,t.text="null",t.symbol=a.CommonSymbols.null_,t}return i(t,e),t}(b);t.NullExpression=w;var U=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=v.OBJECT,t}return i(t,e),t}(I);t.ObjectLiteralExpression=U;var M=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.PARENTHESIZED,t}return i(t,e),t}(E);t.ParenthesizedExpression=M;var V=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.PROPERTYACCESS,t}return i(t,e),t}(E);t.PropertyAccessExpression=V;var G=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=v.REGEXP,t}return i(t,e),t}(I);t.RegexpLiteralExpression=G;var K=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.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=v.STRING,t}return i(t,e),t}(I);t.StringLiteralExpression=z;var Y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.SUPER,t.text="super",t.symbol=a.CommonSymbols.super_,t}return i(t,e),t}(b);t.SuperExpression=Y;var H=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.THIS,t.text="this",t.symbol=a.CommonSymbols.this_,t}return i(t,e),t}(b);t.ThisExpression=H;var W=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.TRUE,t.text="true",t.symbol=a.CommonSymbols.true_,t}return i(t,e),t}(b);t.TrueExpression=W;var X=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.FALSE,t.text="false",t.symbol=a.CommonSymbols.false_,t}return i(t,e),t}(b);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=o.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=o.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=o.SOURCE,i.parent=null,i.tokenizer=null,i.debugInfoIndex=-1,i.exportPaths=null,i.sourceKind=n,i.normalizedPath=t;var c=De(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 s.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=o.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=o.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=o.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=o.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 se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.CONTINUE,t}return i(t,e),t}(J);t.ContinueStatement=se;var oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.DO,t}return i(t,e),t}(J);t.DoStatement=oe;var ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.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=o.ENUMDECLARATION,t}return i(t,e),t}(ee);t.EnumDeclaration=le;var ue=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.ENUMVALUEDECLARATION,t}return i(t,e),t}(re);t.EnumValueDeclaration=ue;var pe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.EXPORTIMPORT,t}return i(t,e),t}(l);t.ExportImportStatement=pe;var _e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.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=o.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=o.EXPORTDEFAULT,t}return i(t,e),t}(J);t.ExportDefaultStatement=de;var ye=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.EXPRESSION,t}return i(t,e),t}(J);t.ExpressionStatement=ye;var me=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.FIELDDECLARATION,t.parameterIndex=-1,t}return i(t,e),t}(re);t.FieldDeclaration=me;var fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.FOR,t}return i(t,e),t}(J);t.ForStatement=fe,function(e){e[e.NONE=0]="NONE",e[e.ARROW_PARENTHESIZED=1]="ARROW_PARENTHESIZED",e[e.ARROW_SINGLE=2]="ARROW_SINGLE"}(t.ArrowKind||(t.ArrowKind={}));var Te=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.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.arrowKind,this.range)},t}(ee);t.FunctionDeclaration=Te;var ge=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.IF,t}return i(t,e),t}(J);t.IfStatement=ge;var Ee=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.IMPORTDECLARATION,t}return i(t,e),t}(ee);t.ImportDeclaration=Ee;var ve=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.IMPORT,t}return i(t,e),t}(J);t.ImportStatement=ve;var be=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.INTERFACEDECLARATION,t}return i(t,e),t}(ae);t.InterfaceDeclaration=be;var Ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.METHODDECLARATION,t}return i(t,e),t}(Te);t.MethodDeclaration=Ie;var xe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.NAMESPACEDECLARATION,t}return i(t,e),t}(ee);t.NamespaceDeclaration=xe;var Ae=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.RETURN,t}return i(t,e),t}(J);t.ReturnStatement=Ae;var Ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.SWITCHCASE,t}return i(t,e),t}(l);t.SwitchCase=Ne;var Se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.SWITCH,t}return i(t,e),t}(J);t.SwitchStatement=Se;var Oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.THROW,t}return i(t,e),t}(J);t.ThrowStatement=Oe;var Ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.TRY,t}return i(t,e),t}(J);t.TryStatement=Ce;var ke=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.TYPEDECLARATION,t}return i(t,e),t}(ee);t.TypeDeclaration=ke;var Re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.VARIABLEDECLARATION,t}return i(t,e),t}(re);t.VariableDeclaration=Re;var Le=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.VARIABLE,t}return i(t,e),t}(J);t.VariableStatement=Le;var Fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.VOID,t}return i(t,e),t}(J);t.VoidStatement=Fe;var Be=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.WHILE,t}return i(t,e),t}(J);function De(e){return e.endsWith(".ts")&&(e=e.substring(0,e.length-3)),e}t.WhileStatement=Be,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=De,t.isTypeOmitted=function(e){if(e.kind==o.TYPE){var t=e.name;return!(t.next||t.identifier.text.length)}return!1}},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),s=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}),Object.defineProperty(e.prototype,"alignLog2",{get:function(){return 31-clz(this.byteSize)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isManaged",{get:function(){var e=this.classReference;return null!==e&&!e.hasDecorator(n.DecoratorFlags.UNMANAGED)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUnmanaged",{get:function(){var e=this.classReference;return null!==e&&e.hasDecorator(n.DecoratorFlags.UNMANAGED)},enumerable:!0,configurable:!0}),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,s;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)&&(s=t.signatureReference))return a.isAssignableTo(s)}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.prototype.isStrictlyAssignableTo=function(e,t){return void 0===t&&(t=!1),this.is(256)?this.isAssignableTo(e):!e.is(256)&&(this.is(4)?e.is(4)&&e.size==this.size&&(!t||this.is(1)==e.is(1)):this.kind==e.kind)},e.commonDenominator=function(e,t,r){return t.isAssignableTo(e,r)?e:e.isAssignableTo(t,r)?t:null},e.prototype.toString=function(){if(this.is(256)){var e=this.classReference;if(e)return this.is(512)?e.internalName+" | null":e.internalName;var t=this.signatureReference;if(t)return this.is(512)?"("+t.toString()+") | null":t.toString();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.i32(0);case 4:case 9:if(64!=this.size)return e.i32(0);case 3:case 8:return e.i64(0);case 11:return e.f32(0);case 12:return e.f64(0);case 13:return e.v128(a)}},e.prototype.toNativeOne=function(e){switch(this.kind){case 13:case 14:assert(!1);default:return e.i32(1);case 4:case 9:if(64!=this.size)return e.i32(1);case 3:case 8:return e.i64(1);case 11:return e.f32(1);case 12:return e.f64(1)}},e.prototype.toNativeNegOne=function(e){switch(this.kind){case 13:case 14:assert(!1);default:return e.i32(-1);case 4:case 9:if(64!=this.size)return e.i32(-1);case 3:case 8:return e.i64(-1,-1);case 11:return e.f32(-1);case 12:return e.f64(-1)}},e.prototype.toSignatureString=function(){switch(this.kind){case 0:case 5:case 1:case 6:case 2:case 7:case 10:return"i";case 3:case 8:return"j";case 4:case 9:return 64==this.size?"j":"i";case 11:return"f";case 12:return"d";case 13:return"V";case 14:return"v";default:assert(!1)}return"i"},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=s,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 o=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||s.void,this.thisType=r,this.hasRest=!1,this.type=s.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 s=0;s<a;++s){var o=n[s],c=i[s];if(!o.isAssignableTo(c))return!1}var l=this.returnType,u=e.returnType;return l==u||l.isAssignableTo(u)},e.makeSignatureString=function(e,t,r){void 0===r&&(r=null);var n=[];if(n.push(t.toSignatureString()),r&&n.push(r.toSignatureString()),e)for(var i=0,a=e.length;i<a;++i)n.push(e[i].toSignatureString());return"FUNCSIG$"+n.join("")},e.prototype.toSignatureString=function(){return e.makeSignatureString(this.parameterTypes,this.returnType,this.thisType)},e.prototype.toString=function(){var e=new Array;e.push("(");var t=0,r=this.thisType;r&&(e.push("this: "),assert(!r.signatureReference),e.push(r.toString()),t=1);var n=this.parameterTypes,i=n.length;if(i)for(var a=this.parameterNames,s=a?a.length:0,o=this.requiredParameters,c=this.hasRest?i-1:-1,u=0;u<i;++u,++t)t&&e.push(", "),u==c&&e.push("..."),u<s?e.push(a[u]):e.push(l(u)),u>=o&&u!=c?e.push("?: "):e.push(": "),e.push(n[u].toString());return e.push(") => "),e.push(this.returnType.toString()),e.join("")},e}();t.Signature=o;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,s,o=r(2),c=r(5),l=r(1);function u(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 p(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.INSTANCEOF: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"}(s=t.IdentifierHandling||(t.IdentifierHandling={})),t.tokenFromKeyword=u,t.tokenIsAlsoIdentifier=p,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=n.end,a=t.text;if(n.pos<i&&65279==a.charCodeAt(n.pos)&&++n.pos,n.pos+1<i&&35==a.charCodeAt(n.pos)&&33==a.charCodeAt(n.pos+1))for(n.pos+=2;n.pos<i&&10!=a.charCodeAt(n.pos);)++n.pos;return n}return i(t,e),t.prototype.next=function(e){return void 0===e&&(e=s.DEFAULT),this.nextToken=-1,this.token=this.unsafeNext(e)},t.prototype.unsafeNext=function(e,t){void 0===e&&(e=s.DEFAULT),void 0===t&&(t=i32.MAX_VALUE);for(var r=this.end,n=this.source.text;this.pos<r;){this.tokenPos=this.pos;var i=n.charCodeAt(this.pos);switch(i){case 13:if(!(++this.pos<r&&10==n.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<r&&61==n.charCodeAt(this.pos)?(++this.pos,t>2&&this.pos<r&&61==n.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<r&&61==n.charCodeAt(this.pos)?(++this.pos,a.PERCENT_EQUALS):a.PERCENT;case 38:if(++this.pos,t>1&&this.pos<r){if(38==(_=n.charCodeAt(this.pos)))return++this.pos,a.AMPERSAND_AMPERSAND;if(61==_)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<r){if(61==(_=n.charCodeAt(this.pos)))return++this.pos,a.ASTERISK_EQUALS;if(42==_)return++this.pos,t>2&&this.pos<r&&61==n.charCodeAt(this.pos)?(++this.pos,a.ASTERISK_ASTERISK_EQUALS):a.ASTERISK_ASTERISK}return a.ASTERISK;case 43:if(++this.pos,t>1&&this.pos<r){if(43==(_=n.charCodeAt(this.pos)))return++this.pos,a.PLUS_PLUS;if(61==_)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<r){if(45==(_=n.charCodeAt(this.pos)))return++this.pos,a.MINUS_MINUS;if(61==_)return++this.pos,a.MINUS_EQUALS}return a.MINUS;case 46:if(++this.pos,t>1&&this.pos<r){var _=n.charCodeAt(this.pos);if(l.isDecimalDigit(_))return--this.pos,a.FLOATLITERAL;if(t>2&&this.pos+1<r&&46==_&&46==n.charCodeAt(this.pos+1))return this.pos+=2,a.DOT_DOT_DOT}return a.DOT;case 47:var h=this.pos;if(++this.pos,t>1&&this.pos<r){if(47==(_=n.charCodeAt(this.pos))){var d=c.CommentKind.LINE;for(this.pos+1<r&&47==n.charCodeAt(this.pos+1)&&(++this.pos,d=c.CommentKind.TRIPLE);++this.pos<r;)if(10==n.charCodeAt(this.pos)){++this.pos;break}this.onComment&&this.onComment(d,n.substring(h,this.pos),this.range(h,this.pos));break}if(42==_){for(var y=!1;++this.pos<r;)if(42==(i=n.charCodeAt(this.pos))&&this.pos+1<r&&47==n.charCodeAt(this.pos+1)){this.pos+=2,y=!0;break}y?this.onComment&&this.onComment(c.CommentKind.BLOCK,n.substring(h,this.pos),this.range(h,this.pos)):this.error(o.DiagnosticCode._0_expected,this.range(this.pos),"*/");break}if(61==_)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<r){if(60==(_=n.charCodeAt(this.pos)))return++this.pos,t>2&&this.pos<r&&61==n.charCodeAt(this.pos)?(++this.pos,a.LESSTHAN_LESSTHAN_EQUALS):a.LESSTHAN_LESSTHAN;if(61==_)return++this.pos,a.LESSTHAN_EQUALS}return a.LESSTHAN;case 61:if(++this.pos,t>1&&this.pos<r){if(61==(_=n.charCodeAt(this.pos)))return++this.pos,t>2&&this.pos<r&&61==n.charCodeAt(this.pos)?(++this.pos,a.EQUALS_EQUALS_EQUALS):a.EQUALS_EQUALS;if(62==_)return++this.pos,a.EQUALS_GREATERTHAN}return a.EQUALS;case 62:if(++this.pos,t>1&&this.pos<r){if(62==(_=n.charCodeAt(this.pos))){if(++this.pos,t>2&&this.pos<r){if(62==(_=n.charCodeAt(this.pos)))return++this.pos,t>3&&this.pos<r&&61==n.charCodeAt(this.pos)?(++this.pos,a.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS):a.GREATERTHAN_GREATERTHAN_GREATERTHAN;if(61==_)return++this.pos,a.GREATERTHAN_GREATERTHAN_EQUALS}return a.GREATERTHAN_GREATERTHAN}if(61==_)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<r&&61==n.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<r){if(124==(_=n.charCodeAt(this.pos)))return++this.pos,a.BAR_BAR;if(61==_)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(i)){if(l.isKeywordCharacter(i)){for(var m=this.pos;++this.pos<r&&l.isIdentifierPart(i=n.charCodeAt(this.pos));)if(!l.isKeywordCharacter(i))return this.pos=m,a.IDENTIFIER;var f=u(n.substring(m,this.pos));if(f!==a.INVALID&&e!==s.ALWAYS&&(e!==s.PREFER||!p(f)))return f;this.pos=m}return a.IDENTIFIER}if(l.isWhiteSpace(i)){++this.pos;break}return this.error(o.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=s.DEFAULT),void 0===r&&(r=i32.MAX_VALUE);var n=this.source.text;if(this.nextToken<0){var i=this.pos,a=this.token,o=this.tokenPos;if(this.nextToken=this.unsafeNext(t,r),this.nextTokenPos=this.tokenPos,e){this.nextTokenOnNewLine=!1;for(var c=i,u=this.nextTokenPos;c<u;++c)if(l.isLineBreak(n.charCodeAt(c))){this.nextTokenOnNewLine=!0;break}}this.pos=i,this.token=a,this.tokenPos=o}return this.nextToken},t.prototype.skipIdentifier=function(e){return void 0===e&&(e=s.PREFER),this.skip(a.IDENTIFIER,e)},t.prototype.skip=function(e,t){void 0===t&&(t=s.DEFAULT);var r=this.pos,n=this.token,i=this.tokenPos,o=i32.MAX_VALUE;switch(e){case a.GREATERTHAN:o=1}return this.token=this.unsafeNext(t,o),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,r=this.end;++this.pos<r&&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=this.end,i="";;){if(this.pos>=n){i+=e.substring(r,this.pos),this.error(o.DiagnosticCode.Unterminated_string_literal,this.range(r-1,n));break}var a=e.charCodeAt(this.pos);if(a==t){i+=e.substring(r,this.pos++);break}if(92!=a){if(l.isLineBreak(a)){i+=e.substring(r,this.pos),this.error(o.DiagnosticCode.Unterminated_string_literal,this.range(r-1,this.pos));break}++this.pos}else i+=e.substring(r,this.pos),i+=this.readEscapeSequence(),r=this.pos}return i},t.prototype.readEscapeSequence=function(){var e=this.end;if(++this.pos>=e)return this.error(o.DiagnosticCode.Unexpected_end_of_text,this.range(e)),"";var t=this.source.text,r=t.charCodeAt(this.pos++);switch(r){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<e&&123==t.charCodeAt(this.pos)?(++this.pos,this.readExtendedUnicodeEscape()):this.readUnicodeEscape();case 13:this.pos<e&&10==t.charCodeAt(this.pos)&&++this.pos;case 10:case 8232:case 8233:return"";default:return String.fromCharCode(r)}},t.prototype.readRegexpPattern=function(){for(var e=this.source.text,t=this.pos,r=this.end,n=!1;;){if(this.pos>=r){this.error(o.DiagnosticCode.Unterminated_regular_expression_literal,this.range(t,r));break}if(92!=e.charCodeAt(this.pos)){var i=e.charCodeAt(this.pos);if(!n&&47==i)break;if(l.isLineBreak(i)){this.error(o.DiagnosticCode.Unterminated_regular_expression_literal,this.range(t,this.pos));break}++this.pos,n=!1}else++this.pos,n=!0}return e.substring(t,this.pos)},t.prototype.readRegexpFlags=function(){for(var e=this.source.text,t=this.pos,r=this.end,n=0;this.pos<r;){var i=e.charCodeAt(this.pos);if(!l.isIdentifierPart(i))break;switch(++this.pos,i){case 103:n|=1&n?-1:1;break;case 105:n|=2&n?-1:2;break;case 109:n|=4&n?-1:4;break;default:n=-1}}return-1==n&&this.error(o.DiagnosticCode.Invalid_regular_expression_flags,this.range(t,this.pos)),e.substring(t,this.pos)},t.prototype.testInteger=function(){var e=this.end,t=this.source.text;if(this.pos+1<e&&48==t.charCodeAt(this.pos))switch(t.charCodeAt(this.pos+2)){case 120:case 88:case 98:case 66:case 111:case 79:return!0}for(var r=this.pos;r<e;){var n=t.charCodeAt(r);if(46==n||101==n||69==n)return!1;if((n<48||n>57)&&95!=n)break;r++}return!0},t.prototype.readInteger=function(){var e=this.source.text;if(this.pos+2<this.end&&48==e.charCodeAt(this.pos)){switch(e.charCodeAt(this.pos+1)){case 120:case 88:return this.pos+=2,this.readHexInteger();case 98:case 66:return this.pos+=2,this.readBinaryInteger();case 111:case 79: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(o.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),n=i64_new(4),i=t,a=this.end;this.pos<a;){var s=this.pos,c=e.charCodeAt(s);if(c>=48&&c<=57)r=i64_add(i64_shl(r,n),i64_new(c-48));else if(c>=65&&c<=70)r=i64_add(i64_shl(r,n),i64_new(10+c-65));else if(c>=97&&c<=102)r=i64_add(i64_shl(r,n),i64_new(10+c-97));else{if(95!=c)break;i==s&&this.error(i==t?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(s)),i=s+1}this.pos=s+1}return this.pos==t?this.error(o.DiagnosticCode.Hexadecimal_digit_expected,this.range(t)):i==this.pos&&this.error(o.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=this.end,n=i64_new(0),i=i64_new(10),a=t;this.pos<r;){var s=this.pos,c=e.charCodeAt(s);if(c>=48&&c<=57)n=i64_add(i64_mul(n,i),i64_new(c-48));else{if(95!=c)break;a==s&&this.error(a==t?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(s)),a=s+1}this.pos=s+1}return this.pos==t?this.error(o.DiagnosticCode.Digit_expected,this.range(t)):a==this.pos&&this.error(o.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(a-1)),n},t.prototype.readOctalInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0),n=i64_new(3),i=t,a=this.end;this.pos<a;){var s=this.pos,c=e.charCodeAt(s);if(c>=48&&c<=55)r=i64_add(i64_shl(r,n),i64_new(c-48));else{if(95!=c)break;i==s&&this.error(i==t?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(s)),i=s+1}++this.pos}return this.pos==t?this.error(o.DiagnosticCode.Octal_digit_expected,this.range(t)):i==this.pos&&this.error(o.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),n=i64_new(1),i=t,a=this.end;this.pos<a;){var s=this.pos,c=e.charCodeAt(s);if(48==c)r=i64_shl(r,n);else if(49==c)r=i64_add(i64_shl(r,n),n);else{if(95!=c)break;i==s&&this.error(i==t?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(s)),i=s+1}this.pos=s+1}return this.pos==t?this.error(o.DiagnosticCode.Binary_digit_expected,this.range(t)):i==this.pos&&this.error(o.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(i-1)),r},t.prototype.readFloat=function(){return this.readDecimalFloat()},t.prototype.readDecimalFloat=function(){for(var e=this.pos,t=this.end,r=this.source.text;this.pos<t&&l.isDecimalDigit(r.charCodeAt(this.pos));)++this.pos;if(this.pos<t&&46==r.charCodeAt(this.pos))for(++this.pos;this.pos<t&&l.isDecimalDigit(r.charCodeAt(this.pos));)++this.pos;if(this.pos<t){var n=r.charCodeAt(this.pos);if(101==n||69==n)for((++this.pos<t&&45==(n=r.charCodeAt(this.pos))||43==n&&l.isDecimalDigit(r.charCodeAt(this.pos+1)))&&++this.pos;this.pos<t&&l.isDecimalDigit(r.charCodeAt(this.pos));)++this.pos}return parseFloat(r.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.end,n=this.source.text;this.pos<r;){var i=n.charCodeAt(this.pos++);if(i>=48&&i<=57)t=(t<<4)+i-48;else if(i>=65&&i<=70)t=(t<<4)+i+-55;else{if(!(i>=97&&i<=102))return this.error(o.DiagnosticCode.Hexadecimal_digit_expected,this.range(this.pos-1,this.pos)),"";t=(t<<4)+i+-87}if(0==--e)break}return e?(this.error(o.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(o.DiagnosticCode.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive,this.range(e,this.pos)),n=!0);var i=this.end,a=this.source.text;return this.pos>=i?(this.error(o.DiagnosticCode.Unexpected_end_of_text,this.range(e,i)),n=!0):125==a.charCodeAt(this.pos)?++this.pos:(this.error(o.DiagnosticCode.Unterminated_Unicode_escape_sequence,this.range(e,this.pos)),n=!0),n?"":r<65536?String.fromCharCode(r):String.fromCharCode(55296+(r-65536>>>10),56320+(r-65536&1023))},t.prototype.finish=function(){},t}(o.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}}}},s=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),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.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 s};Object.defineProperty(t,"__esModule",{value:!0});var o,c=r(2),l=r(3),u=r(5),p=r(6),_=r(0),h=r(1),d=r(7),y=r(13);!function(e){e[e.REPORT=0]="REPORT",e[e.SWALLOW=1]="SWALLOW"}(o=t.ReportMode||(t.ReportMode={}));var m=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=o.REPORT),e.kind==u.NodeKind.SIGNATURE){var i=e.explicitThisType,a=null;if(i&&!(a=this.resolveType(i,t,r,n)))return null;for(var s=e.parameters,d=s.length,y=new Array(d),m=new Array(d),f=0,T=!1,g=0;g<d;++g){var E=s[g];switch(E.parameterKind){case u.ParameterKind.DEFAULT:f=g+1;break;case u.ParameterKind.REST:assert(g==d),T=!0}var v=E.type;if(u.isTypeOmitted(v))return n==o.REPORT&&this.error(c.DiagnosticCode.Type_expected,v.range),null;var b=this.resolveType(v,t,r,n);if(!b)return null;y[g]=b,m[g]=E.name.text}var I=e.returnType;if(u.isTypeOmitted(I))return n==o.REPORT&&this.error(c.DiagnosticCode.Type_expected,I.range),null;var x=void 0;if(I){if(!(x=this.resolveType(I,t,r,n)))return null}else x=p.Type.void;var A=new p.Signature(y,x,a);return A.parameterNames=m,A.requiredParameters=f,A.hasRest=T,e.isNullable?A.type.asNullable():A.type}assert(e.kind==u.NodeKind.TYPE);var N=e,S=N.name,O=N.typeArguments,C=!S.next;if(C&&r&&r.has(S.identifier.text)){var k=r.get(S.identifier.text);return null!==O&&O.length&&n==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,k.toString()),e.isNullable?(k.is(256)||n==o.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,e.range,k.toString()),k.asNullable()):k}var R=this.resolveTypeName(S,t,n);if(!R)return null;if(R.shadowType)R=R.shadowType;else{if(R.kind==l.ElementKind.ENUM)return null!==O&&O.length&&n==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,R.internalName),e.isNullable&&n==o.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,e.range,R.name),p.Type.i32;if(R.kind==l.ElementKind.CLASS_PROTOTYPE){var L=this.resolveClassInclTypeArguments(R,O,t,h.makeMap(r),e);return L?e.isNullable?L.type.asNullable():L.type:null}}if(R.kind==l.ElementKind.TYPEDEFINITION){if(R.is(_.CommonFlags.RESOLVED)){null!==O&&O.length&&n==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,R.internalName);var F=R.type;if(e.isNullable){if(F.is(256))return F.asNullable();n==o.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,N.name.range,S.identifier.text)}return F}if(C&&S.identifier.text==_.CommonSymbols.native){if(!O||1!=O.length)return n==o.REPORT&&this.error(c.DiagnosticCode.Expected_0_type_arguments_but_got_1,N.range,"1",(O?O.length:1).toString(10)),null;var B=this.resolveType(O[0],t,r,n);if(!B)return null;switch(B.kind){case 0:case 1:case 2:return p.Type.i32;case 4:if(!this.program.options.isWasm64)return p.Type.i32;case 3:return p.Type.i64;case 5:case 6:case 7:case 10:return p.Type.u32;case 9:if(!this.program.options.isWasm64)return p.Type.u32;case 8:return p.Type.u64;case 11:return p.Type.f32;case 12:return p.Type.f64;case 13:return p.Type.v128;case 14:return p.Type.void;default:assert(!1)}}var D=R.typeParameterNodes;if(D){if(!this.resolveTypeArguments(D,O,t,r=h.makeMap(r),e,n))return null}else O&&O.length&&this.error(c.DiagnosticCode.Type_0_is_not_generic,N.range,S.identifier.text);if(!(k=this.resolveType(R.typeNode,R,r,n)))return null;if(e.isNullable){if(k.is(256))return k.asNullable();n==o.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,N.name.range,S.identifier.text)}return k}return n==o.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,N.name.range,S.identifier.text),null},t.prototype.resolveTypeName=function(e,t,r){void 0===r&&(r=o.REPORT);var n=t.lookup(e.identifier.text);if(!n)return r==o.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==o.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=o.REPORT);for(var s=0,l=0,p=0,_=e.length;p<_;++p)e[p].defaultType||++s,++l;var d=t?t.length:0;if(d<s||d>l)return this.error(c.DiagnosticCode.Expected_0_type_arguments_but_got_1,d?u.Range.join(t[0].range,t[d-1].range):assert(i).range,(d<s?s:l).toString(10),d.toString(10)),null;var y=new Array(l);for(p=0;p<l;++p){var m=p<d?this.resolveType(t[p],r,n,a):this.resolveType(assert(e[p].defaultType),r,n,a);if(!m)return null;n.set(e[p].name.text,m),y[p]=m}return y},t.prototype.resolveIdentifier=function(e,t,r,n){void 0===n&&(n=o.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==o.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,a),null)},t.prototype.ensureResolvedLazyGlobal=function(e,t){if(void 0===t&&(t=o.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=o.REPORT);var i=e.expression,a=this.resolveExpression(i,t,r,n);if(!a)return null;var s=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 u=a.type;if(assert(u!=p.Type.void),!(v=u.classReference)){var d=this.program.typeClasses;if(u.is(256)||!d.has(u.kind))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,a.type.toString()),null;v=d.get(u.kind)}a=v;break;case l.ElementKind.PROPERTY_PROTOTYPE:if(!(y=this.resolveFunction(assert(a.getterPrototype),null,h.makeMap(),n)))return null;if(!(v=y.signature.returnType.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,y.signature.returnType.toString()),null;a=v;break;case l.ElementKind.PROPERTY:var y;if(!(v=(y=assert(a.getterInstance)).signature.returnType.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,y.signature.returnType.toString()),null;a=v;break;case l.ElementKind.CLASS:var m=this.currentElementExpression;if(m){var f=a.lookupOverload(l.OperatorKind.INDEXED_GET);if(!f)return this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,m.range,a.internalName),null;var T=f.signature.returnType;if(!(a=T.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,T.toString()),null}break;case l.ElementKind.FUNCTION_PROTOTYPE:var g=a.shadowType;if(g){if(!g.is(_.CommonFlags.RESOLVED)){var E=this.resolveType(g.typeNode,g.parent,null,n);E&&g.setType(E)}var v;(v=g.type.classReference)&&(a=v.prototype);break}}switch(a.kind){case l.ElementKind.CLASS_PROTOTYPE:case l.ElementKind.CLASS:for(;;){if((b=a.members)&&b.has(s))return this.currentThisExpression=i,this.currentElementExpression=null,b.get(s);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 b;if((b=a.members)&&b.has(s))return this.currentThisExpression=i,this.currentElementExpression=null,b.get(s)}return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,a.internalName),null},t.prototype.resolveElementAccessExpression=function(e,t,r,n){void 0===n&&(n=o.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 s=a.lookupOverload(l.OperatorKind.INDEXED_GET);if(!s)return n==o.REPORT&&this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,a.internalName),null;var p=s.signature.returnType;return i.kind==u.NodeKind.ELEMENTACCESS?(a=p.classReference)?(this.currentThisExpression=i,this.currentElementExpression=e.elementExpression,a):null:(this.currentThisExpression=i,this.currentElementExpression=e.elementExpression,a)}return n==o.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 p.Type.i8;break;case 5:if(i64_is_u8(e))return p.Type.u8;break;case 1:if(i64_is_i16(e))return p.Type.i16;break;case 6:if(i64_is_u16(e))return p.Type.u16;break;case 2:if(i64_is_i32(e))return p.Type.i32;break;case 7:if(i64_is_u32(e))return p.Type.u32;break;case 10:if(i64_is_bool(e))return p.Type.bool;break;case 4:if(!this.program.options.isWasm64){if(i64_is_i32(e))return p.Type.isize32;break}return p.Type.isize64;case 9:if(!this.program.options.isWasm64){if(i64_is_u32(e))return p.Type.usize32;break}return p.Type.usize64;case 3:return p.Type.i64;case 8:return p.Type.u64;case 11:return p.Type.f32;case 12:return p.Type.f64;case 14:break;default:assert(!1)}return i64_is_i32(e)?p.Type.i32:i64_is_u32(e)?p.Type.u32:p.Type.i64},t.prototype.resolveExpression=function(e,t,r,n){for(void 0===r&&(r=p.Type.void),void 0===n&&(n=o.REPORT);e.kind==u.NodeKind.PARENTHESIZED;)e=e.expression;switch(e.kind){case u.NodeKind.ASSERTION:return this.resolveAssertionExpression(e,t,r,n);case u.NodeKind.UNARYPREFIX:return this.resolveUnaryPrefixExpression(e,t,r,n);case u.NodeKind.UNARYPOSTFIX:return this.resolveUnaryPostfixExpression(e,t,r,n);case u.NodeKind.BINARY:return this.resolveBinaryExpression(e,t,r,n);case u.NodeKind.THIS:return this.resolveThisExpression(e,t,r,n);case u.NodeKind.SUPER:return this.resolveSuperExpression(e,t,r,n);case u.NodeKind.IDENTIFIER:return this.resolveIdentifier(e,t,t.actualFunction,n);case u.NodeKind.LITERAL:return this.resolveLiteralExpression(e,t,r,n);case u.NodeKind.PROPERTYACCESS:return this.resolvePropertyAccessExpression(e,t,r,n);case u.NodeKind.ELEMENTACCESS:return this.resolveElementAccessExpression(e,t,r,n);case u.NodeKind.CALL:return this.resolveCallExpression(e,t,r,n)}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveAssertionExpression=function(e,t,r,n){if(void 0===r&&(r=p.Type.void),void 0===n&&(n=o.REPORT),e.assertionKind==u.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 s=i.signatureReference;if(!s)return null;a=s.asFunctionTarget(this.program)}return this.currentThisExpression=null,this.currentElementExpression=null,a},t.prototype.resolveUnaryPrefixExpression=function(e,t,r,n){void 0===r&&(r=p.Type.void),void 0===n&&(n=o.REPORT);var i=e.operand;switch(e.operator){case d.Token.MINUS:if(i.kind==u.NodeKind.LITERAL&&i.literalKind==u.LiteralKind.INTEGER){var a=this.determineIntegerLiteralType(i64_sub(i64_zero,i.value),r);return(s=this.program.typeClasses).has(a.kind)?s.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 s;return(s=this.program.typeClasses).has(10)?s.get(10):null;case d.Token.TILDE:if(!this.resolveExpression(e.operand,t,r,n))return null;break;default:assert(!1)}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveUnaryPostfixExpression=function(e,t,r,n){switch(void 0===r&&(r=p.Type.void),void 0===n&&(n=o.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==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveBinaryExpression=function(e,t,r,n){return void 0===r&&(r=p.Type.void),void 0===n&&(n=o.REPORT),n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveThisExpression=function(e,t,r,n){if(void 0===r&&(r=p.Type.void),void 0===n&&(n=o.REPORT),t.is(8192)){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==o.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=p.Type.void),void 0===n&&(n=o.REPORT),t.is(8192)){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==o.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=p.Type.void),void 0===n&&(n=o.REPORT),e.literalKind){case u.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 u.LiteralKind.FLOAT:this.currentThisExpression=e,this.currentElementExpression=null;var a;i=r==p.Type.f32?p.Type.f32:p.Type.f64;return(a=this.program.typeClasses).has(i.kind)?a.get(i.kind):null;case u.LiteralKind.STRING:return this.currentThisExpression=e,this.currentElementExpression=null,this.program.stringInstance}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},t.prototype.resolveCallExpression=function(e,t,r,n){void 0===r&&(r=p.Type.void),void 0===n&&(n=o.REPORT);var i=e.expression,a=this.resolveExpression(i,t,r,n);if(!a)return null;if(a.kind==l.ElementKind.FUNCTION_PROTOTYPE){if(a.internalName==y.BuiltinSymbols.unchecked&&e.arguments.length>0)return this.resolveExpression(e.arguments[0],t,r,n);var s=this.resolveFunctionInclTypeArguments(a,e.typeArguments,t.actualFunction,h.makeMap(t.contextualTypeArguments),e,n);if(!s)return null;var u=s.signature.returnType,_=u.classReference;if(_)return _;var d=u.signatureReference;return d?d.asFunctionTarget(this.program):(n==o.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==o.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=o.REPORT);var i=e.parent.kind==l.ElementKind.PROPERTY_PROTOTYPE?e.parent.parent:e.parent,a=null,s=t?p.typesToString(t):"";if(e.is(_.CommonFlags.INSTANCE)){if(assert(i.kind==l.ElementKind.CLASS),a=i,g=e.getResolvedInstance(s))return g;var d=a.typeArguments;if(d){var y=assert(a.prototype.typeParameterNodes),m=y.length;assert(m==y.length);for(var f=0;f<m;++f){var T=y[f].name.text;r.has(T)||r.set(T,d[f])}}}else{var g;if(assert(i.kind!=l.ElementKind.CLASS),g=e.getResolvedInstance(s))return g}var E,v=e.signatureNode,b=e.typeParameterNodes;if(t&&(E=t.length)){assert(b&&E==b.length);for(f=0;f<E;++f)r.set(b[f].name.text,t[f])}else assert(!b||0==b.length);var I=null,x=v.explicitThisType;if(x){if(!(I=this.resolveType(x,e.parent,r,n)))return null;r.set(_.CommonSymbols.this_,I)}else a&&(I=a.type,r.set(_.CommonSymbols.this_,I));var A,N=v.parameters,S=N.length,O=new Array(S),C=new Array(S),k=0;for(f=0;f<S;++f){var R=N[f];R.parameterKind==u.ParameterKind.DEFAULT&&(k=f+1);var L=R.type;if(u.isTypeOmitted(L))return this.error(c.DiagnosticCode.Type_expected,L.range),null;var F=this.resolveType(L,e.parent,r,n);if(!F)return null;O[f]=F,C[f]=R.name.text}if(e.is(_.CommonFlags.SET))A=p.Type.void;else if(e.is(_.CommonFlags.CONSTRUCTOR))A=assert(a).type;else{L=v.returnType;if(u.isTypeOmitted(L))return this.error(c.DiagnosticCode.Type_expected,L.range),null;var B=this.resolveType(L,e.parent,r,n);if(!B)return null;A=B}var D=new p.Signature(O,A,I);D.parameterNames=C,D.requiredParameters=k;var P=e.name;s.length&&(P+="<"+s+">");var w=new l.Function(P,e,D,r);return e.setResolvedInstance(s,w),w},t.prototype.resolveFunctionInclTypeArguments=function(e,t,r,n,i,a){void 0===a&&(a=o.REPORT);var s=e.parent.kind==l.ElementKind.PROPERTY_PROTOTYPE?e.parent.parent:e.parent,u=null;if(e.is(_.CommonFlags.GENERIC)){if(e.is(_.CommonFlags.INSTANCE)){assert(s.kind==l.ElementKind.CLASS);var p=s.typeArguments;if(p){var h=assert(s.prototype.typeParameterNodes),d=p.length;assert(d==h.length);for(var y=0;y<d;++y)n.set(h[y].name.text,p[y])}}if(!(u=this.resolveTypeArguments(assert(e.typeParameterNodes),t,r,n,i,a)))return null}else if(null!==t&&t.length)return a==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,i.range,e.internalName),null;return this.resolveFunction(e,u,n,a)},t.prototype.resolveClass=function(e,t,r,n){var i,u,d,y,m,f;void 0===r&&(r=h.makeMap()),void 0===n&&(n=o.REPORT);var T=t?p.typesToString(t):"",g=e.getResolvedInstance(T);if(g)return g;if(t){var E=(I=assert(e.typeParameterNodes)).length,v=t.length;assert(v==E);for(var b=0;b<v;++b)r.set(I[b].name.text,t[b])}else{var I=e.typeParameterNodes;assert(!(I&&I.length))}var x=e.basePrototype,A=null;if(x){var N=assert(e.extendsNode);if(!(A=this.resolveClassInclTypeArguments(x,N.typeArguments,e.parent,h.makeMap(r),N,n)))return null}var S=e.name;T.length&&(S+="<"+T+">"),(g=new l.Class(S,e,t,A)).contextualTypeArguments=r,e.setResolvedInstance(T,g);var O=0;if(A){if(G=A.members){(U=g.members)||(g.members=U=new Map);try{for(var C=a(G),k=C.next();!k.done;k=C.next()){var R=s(k.value,2),L=R[0],F=R[1];U.set(L,F)}}catch(e){i={error:e}}finally{try{k&&!k.done&&(u=C.return)&&u.call(C)}finally{if(i)throw i.error}}}O=A.currentMemoryOffset}var B=e.instanceMembers;if(B)try{for(var D=a(B.values()),P=D.next();!P.done;P=D.next()){var w=P.value;switch(w.kind){case l.ElementKind.FIELD_PROTOTYPE:var U;if(U=g.members){if(U.has(w.name)){this.error(c.DiagnosticCode.Duplicate_identifier_0,w.identifierNode.range,w.name);break}}else g.members=U=new Map;var M=w.typeNode,V=null;if(M)V=this.resolveType(M,e.parent,g.contextualTypeArguments,n);else{var G;if(A)if((G=A.members)&&G.has(w.name)){var K=G.get(w.name);K.is(_.CommonFlags.PRIVATE)||(assert(K.kind==l.ElementKind.FIELD),V=K.type)}V||n==o.REPORT&&this.error(c.DiagnosticCode.Type_expected,w.identifierNode.range.atEnd)}if(!V)break;var z=new l.Field(w,g,V);assert(h.isPowerOf2(V.byteSize));var Y=V.byteSize-1;O&Y&&(O=1+(O|Y)),z.memoryOffset=O,O+=V.byteSize,g.add(w.name,z);break;case l.ElementKind.FUNCTION_PROTOTYPE:var H=w.toBound(g);g.add(H.name,H);break;case l.ElementKind.PROPERTY_PROTOTYPE:var W=new l.Property(w,g),X=w.getterPrototype;if(X){var q=this.resolveFunction(X.toBound(g),null,h.makeMap(g.contextualTypeArguments),n);q&&(W.getterInstance=q,W.setType(q.signature.returnType))}var Q=w.setterPrototype;if(Q){var j=this.resolveFunction(Q.toBound(g),null,h.makeMap(g.contextualTypeArguments),n);j&&(W.setterInstance=j,W.is(_.CommonFlags.RESOLVED)||(assert(1==j.signature.parameterTypes.length),W.setType(j.signature.parameterTypes[0])))}g.add(W.name,W);break;default:assert(!1)}}}catch(e){d={error:e}}finally{try{P&&!P.done&&(y=D.return)&&y.call(D)}finally{if(d)throw d.error}}g.currentMemoryOffset=O;var Z=g.lookupInSelf(_.CommonSymbols.constructor);if(Z&&Z.parent===g){assert(Z.kind==l.ElementKind.FUNCTION_PROTOTYPE);var J=this.resolveFunction(Z,null,g.contextualTypeArguments,n);J&&(g.constructorInstance=J)}try{for(var $=a(e.overloadPrototypes),ee=$.next();!ee.done;ee=$.next()){var te=s(ee.value,2),re=te[0],ne=te[1];assert(re!=l.OperatorKind.INVALID);var ie=void 0;if(ne.is(_.CommonFlags.INSTANCE)){H=ne.toBound(g);ie=this.resolveFunction(H,null,h.makeMap(),n)}else ie=this.resolveFunction(ne,null,h.makeMap(),n);if(ie){var ae=g.overloads;ae||(g.overloads=ae=new Map),ae.set(re,ie)}}}catch(e){m={error:e}}finally{try{ee&&!ee.done&&(f=$.return)&&f.call($)}finally{if(m)throw m.error}}return g},t.prototype.resolveClassInclTypeArguments=function(e,t,r,n,i,a){void 0===a&&(a=o.REPORT);var s=null;if(e.is(_.CommonFlags.GENERIC)){if(!(s=this.resolveTypeArguments(assert(e.typeParameterNodes),t,r,n,i,a)))return null}else if(null!==t&&t.length)return a==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,i.range,e.internalName),null;return this.resolveClass(e,s,n,a)},t}(c.DiagnosticEmitter);t.Resolver=m},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(6),s=r(3),o=r(4),c=r(0),l=r(2);!function(e){e[e.NONE=0]="NONE",e[e.RETURNS=1]="RETURNS",e[e.RETURNS_WRAPPED=2]="RETURNS_WRAPPED",e[e.RETURNS_NONNULL=4]="RETURNS_NONNULL",e[e.THROWS=8]="THROWS",e[e.BREAKS=16]="BREAKS",e[e.CONTINUES=32]="CONTINUES",e[e.ALLOCATES=64]="ALLOCATES",e[e.CALLS_SUPER=128]="CALLS_SUPER",e[e.CONDITIONALLY_RETURNS=256]="CONDITIONALLY_RETURNS",e[e.CONDITIONALLY_THROWS=512]="CONDITIONALLY_THROWS",e[e.CONDITIONALLY_BREAKS=1024]="CONDITIONALLY_BREAKS",e[e.CONDITIONALLY_CONTINUES=2048]="CONDITIONALLY_CONTINUES",e[e.CONDITIONALLY_ALLOCATES=4096]="CONDITIONALLY_ALLOCATES",e[e.INLINE_CONTEXT=8192]="INLINE_CONTEXT",e[e.UNCHECKED_CONTEXT=16384]="UNCHECKED_CONTEXT",e[e.ANY_TERMINATING=57]="ANY_TERMINATING",e[e.ANY_CATEGORICAL=255]="ANY_CATEGORICAL",e[e.ANY_CONDITIONAL=7936]="ANY_CONDITIONAL"}(t.FlowFlags||(t.FlowFlags={})),function(e){e[e.NONE=0]="NONE",e[e.CONSTANT=1]="CONSTANT",e[e.WRAPPED=2]="WRAPPED",e[e.NONNULL=4]="NONNULL",e[e.READFROM=8]="READFROM",e[e.WRITTENTO=16]="WRITTENTO",e[e.RETAINED=32]="RETAINED",e[e.CONDITIONALLY_READFROM=64]="CONDITIONALLY_READFROM",e[e.CONDITIONALLY_WRITTENTO=128]="CONDITIONALLY_WRITTENTO",e[e.CONDITIONALLY_RETAINED=256]="CONDITIONALLY_RETAINED",e[e.ANY_CATEGORICAL=63]="ANY_CATEGORICAL",e[e.ANY_CONDITIONAL=480]="ANY_CONDITIONAL",e[e.ANY_RETAINED=288]="ANY_RETAINED"}(i=t.LocalFlags||(t.LocalFlags={})),function(e){e.join=function(t,r){return t&e.ANY_CATEGORICAL&r&e.ANY_CATEGORICAL|t&e.ANY_CONDITIONAL|r&e.ANY_CONDITIONAL}}(i=t.LocalFlags||(t.LocalFlags={})),function(e){e[e.NONE=0]="NONE",e[e.INITIALIZED=1]="INITIALIZED",e[e.CONDITIONALLY_INITIALIZED=2]="CONDITIONALLY_INITIALIZED",e[e.ANY_CATEGORICAL=1]="ANY_CATEGORICAL",e[e.ANY_CONDITIONAL=2]="ANY_CONDITIONAL"}(t.FieldFlags||(t.FieldFlags={})),function(e){e.join=function(t,r){return t&e.ANY_CATEGORICAL&r&e.ANY_CATEGORICAL|t&e.ANY_CONDITIONAL|r&e.ANY_CONDITIONAL}}(t.FieldFlags||(t.FieldFlags={}));var u=function(){function e(){this.scopedLocals=null,this.fieldFlags=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.localFlags=[],r.inlineFunction=null,r.inlineReturnLabel=null,r},e.createInline=function(t,r){var n=e.create(t);return n.set(8192),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.localFlags=this.localFlags.slice(),t.inlineFunction=this.inlineFunction,t.inlineReturnLabel=this.inlineReturnLabel,t},e.prototype.getTempLocal=function(e,t){void 0===t&&(t=null);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;case o.NativeType.V128:r=i.tempV128s;break;default:throw new Error("concrete type expected")}if(t){if(r&&r.length)for(var a=0,s=r.length;a<s;++a)if(!t.has(r[a].index)){n=r[a];for(var l=r.length-1;a<l;)unchecked(r[a]=r[1+a++]);return r.length=l,n.type=e,n.flags=c.CommonFlags.NONE,this.unsetLocalFlag(n.index,-1),n}n=i.addLocal(e)}else r&&r.length?((n=r.pop()).type=e,n.flags=c.CommonFlags.NONE):n=i.addLocal(e);return this.unsetLocalFlag(n.index,-1),n},e.prototype.getAutoreleaseLocal=function(e,t){void 0===t&&(t=null);var r=this.getTempLocal(e,t);r.set(c.CommonFlags.SCOPED);var n=this.scopedLocals;return n||(this.scopedLocals=n=new Map),n.set("~auto"+this.parentFunction.nextAutoreleaseId++,r),this.setLocalFlag(r.index,i.RETAINED),r},e.prototype.freeTempLocal=function(e){if(!e.is(c.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;case o.NativeType.V128:t=r.tempV128s||(r.tempV128s=[]);break;default:throw new Error("concrete type expected")}assert(e.index>=0),t.push(e)}},e.prototype.getAndFreeTempLocal=function(e,t){void 0===t&&(t=null);var r=this.getTempLocal(e,t);return this.freeTempLocal(r),r},e.prototype.getScopedLocal=function(e){var t=this.scopedLocals;return t&&t.has(e)?t.get(e):null},e.prototype.addScopedLocal=function(e,t,r){void 0===r&&(r=null);var n=this.getTempLocal(t,r),i=this.scopedLocals;return i?assert(!i.has(e)):this.scopedLocals=i=new Map,n.set(c.CommonFlags.SCOPED),i.set(e,n),n},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(l.DiagnosticCode.Duplicate_identifier_0,n.range),i}else this.scopedLocals=new Map;assert(r<this.parentFunction.localsByIndex.length);var a=new s.Local(e,r,t,this.parentFunction);return this.scopedLocals.set(e,a),a},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(c.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.isLocalFlag=function(e,t,r){return void 0===r&&(r=!0),e<0?r:e<this.localFlags.length&&(unchecked(this.localFlags[e])&t)==t},e.prototype.isAnyLocalFlag=function(e,t,r){return void 0===r&&(r=!0),e<0?r:e<this.localFlags.length&&0!=(unchecked(this.localFlags[e])&t)},e.prototype.setLocalFlag=function(e,t){if(!(e<0)){var r=this.localFlags,n=e<r.length?unchecked(r[e]):0;this.localFlags[e]=n|t}},e.prototype.unsetLocalFlag=function(e,t){if(!(e<0)){var r=this.localFlags,n=e<r.length?unchecked(r[e]):0;this.localFlags[e]=n&~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|=8191&e.flags,this.localFlags=e.localFlags},e.prototype.inheritConditional=function(e){e.is(1)&&this.set(256),e.is(8)&&this.set(512),e.is(16)&&e.breakLabel==this.breakLabel&&this.set(1024),e.is(32)&&e.continueLabel==this.continueLabel&&this.set(2048),e.is(64)&&this.set(4096);for(var t=e.localFlags,r=0,n=t.length;r<n;++r){var a=t[r];a&i.RETAINED&&this.setLocalFlag(r,i.CONDITIONALLY_RETAINED),a&i.READFROM&&this.setLocalFlag(r,i.CONDITIONALLY_READFROM),a&i.WRITTENTO&&this.setLocalFlag(r,i.CONDITIONALLY_WRITTENTO)}},e.prototype.inheritMutual=function(e,t){this.set(e.flags&t.flags&255),this.set(7936&e.flags),this.set(7936&t.flags);for(var r=e.localFlags,n=r.length,a=t.localFlags,s=a.length,o=new Array(max(n,s)),c=0;c<n;++c)o[c]=i.join(unchecked(r[c]),c<s?unchecked(a[c]):0);for(c=n;c<s;++c)o[c]=i.join(0,unchecked(a[c]));this.localFlags=o},e.prototype.isNonnull=function(e,t){if(!t.is(512))return!0;switch(o.getExpressionId(e)){case o.ExpressionId.LocalSet:if(!o.isLocalTee(e))break;return!(r=this.parentFunction.localsByIndex[o.getLocalSetIndex(e)]).type.is(512)||this.isLocalFlag(r.index,i.NONNULL,!1);case o.ExpressionId.LocalGet:var r;return!(r=this.parentFunction.localsByIndex[o.getLocalGetIndex(e)]).type.is(512)||this.isLocalFlag(r.index,i.NONNULL,!1)}return!1},e.prototype.inheritNonnullIfTrue=function(e){switch(o.getExpressionId(e)){case o.ExpressionId.LocalSet:if(!o.isLocalTee(e))break;var t=this.parentFunction.localsByIndex[o.getLocalSetIndex(e)];this.setLocalFlag(t.index,i.NONNULL),this.inheritNonnullIfTrue(o.getLocalSetValue(e));break;case o.ExpressionId.LocalGet:t=this.parentFunction.localsByIndex[o.getLocalGetIndex(e)];this.setLocalFlag(t.index,i.NONNULL);break;case o.ExpressionId.If:var r=o.getIfFalse(e);if(!r)break;o.getExpressionId(r)==o.ExpressionId.Const&&(o.getExpressionType(r)==o.NativeType.I32&&0==o.getConstValueI32(r)||o.getExpressionType(r)==o.NativeType.I64&&0==o.getConstValueI64Low(r)&&0==o.getConstValueI64High(r))&&(this.inheritNonnullIfTrue(o.getIfCondition(e)),this.inheritNonnullIfTrue(o.getIfTrue(e)));break;case o.ExpressionId.Unary:switch(o.getUnaryOp(e)){case o.UnaryOp.EqzI32:case o.UnaryOp.EqzI64:this.inheritNonnullIfFalse(o.getUnaryValue(e))}break;case o.ExpressionId.Binary:switch(o.getBinaryOp(e)){case o.BinaryOp.EqI32:var n=o.getBinaryLeft(e),a=o.getBinaryRight(e);o.getExpressionId(n)==o.ExpressionId.Const&&0!=o.getConstValueI32(n)?this.inheritNonnullIfTrue(a):o.getExpressionId(a)==o.ExpressionId.Const&&0!=o.getConstValueI32(a)&&this.inheritNonnullIfTrue(n);break;case o.BinaryOp.EqI64:n=o.getBinaryLeft(e),a=o.getBinaryRight(e);o.getExpressionId(n)!=o.ExpressionId.Const||0==o.getConstValueI64Low(n)&&0==o.getConstValueI64High(n)?o.getExpressionId(a)==o.ExpressionId.Const&&0!=o.getConstValueI64Low(a)&&0!=o.getConstValueI64High(a)&&this.inheritNonnullIfTrue(n):this.inheritNonnullIfTrue(a);break;case o.BinaryOp.NeI32:n=o.getBinaryLeft(e),a=o.getBinaryRight(e);o.getExpressionId(n)==o.ExpressionId.Const&&0==o.getConstValueI32(n)?this.inheritNonnullIfTrue(a):o.getExpressionId(a)==o.ExpressionId.Const&&0==o.getConstValueI32(a)&&this.inheritNonnullIfTrue(n);break;case o.BinaryOp.NeI64:n=o.getBinaryLeft(e),a=o.getBinaryRight(e);o.getExpressionId(n)==o.ExpressionId.Const&&0==o.getConstValueI64Low(n)&&0==o.getConstValueI64High(n)?this.inheritNonnullIfTrue(a):o.getExpressionId(a)==o.ExpressionId.Const&&0==o.getConstValueI64Low(a)&&0==o.getConstValueI64High(a)&&this.inheritNonnullIfTrue(n)}break;case o.ExpressionId.Call:switch(o.getCallTarget(e)){case this.parentFunction.program.retainInstance.internalName:this.inheritNonnullIfTrue(o.getCallOperand(e,0))}}},e.prototype.inheritNonnullIfFalse=function(e){switch(o.getExpressionId(e)){case o.ExpressionId.Unary:switch(o.getUnaryOp(e)){case o.UnaryOp.EqzI32:case o.UnaryOp.EqzI64:this.inheritNonnullIfTrue(o.getUnaryValue(e))}break;case o.ExpressionId.If:var t=o.getIfTrue(e);if(o.getExpressionId(t)==o.ExpressionId.Const){if(!o.getIfFalse(e))break;(o.getExpressionType(t)==o.NativeType.I32&&0!=o.getConstValueI32(t)||o.getExpressionType(t)==o.NativeType.I64&&(0!=o.getConstValueI64Low(t)||0!=o.getConstValueI64High(t)))&&(this.inheritNonnullIfFalse(o.getIfCondition(e)),this.inheritNonnullIfFalse(o.getIfFalse(e)))}break;case o.ExpressionId.Binary:switch(o.getBinaryOp(e)){case o.BinaryOp.EqI32:var r=o.getBinaryLeft(e),n=o.getBinaryRight(e);o.getExpressionId(r)==o.ExpressionId.Const&&0==o.getConstValueI32(r)?this.inheritNonnullIfTrue(n):o.getExpressionId(n)==o.ExpressionId.Const&&0==o.getConstValueI32(n)&&this.inheritNonnullIfTrue(r);break;case o.BinaryOp.EqI64:r=o.getBinaryLeft(e),n=o.getBinaryRight(e);o.getExpressionId(r)==o.ExpressionId.Const&&0==o.getConstValueI64Low(r)&&0==o.getConstValueI64High(r)?this.inheritNonnullIfTrue(n):o.getExpressionId(n)==o.ExpressionId.Const&&0==o.getConstValueI64Low(n)&&0==o.getConstValueI64High(n)&&this.inheritNonnullIfTrue(r);break;case o.BinaryOp.NeI32:r=o.getBinaryLeft(e),n=o.getBinaryRight(e);o.getExpressionId(r)==o.ExpressionId.Const&&0!=o.getConstValueI32(r)?this.inheritNonnullIfTrue(n):o.getExpressionId(n)==o.ExpressionId.Const&&0!=o.getConstValueI32(n)&&this.inheritNonnullIfTrue(r);break;case o.BinaryOp.NeI64:r=o.getBinaryLeft(e),n=o.getBinaryRight(e);o.getExpressionId(r)!=o.ExpressionId.Const||0==o.getConstValueI64Low(r)&&0==o.getConstValueI64High(r)?o.getExpressionId(n)!=o.ExpressionId.Const||0==o.getConstValueI64Low(n)&&0==o.getConstValueI64High(n)||this.inheritNonnullIfTrue(r):this.inheritNonnullIfTrue(n)}}},e.prototype.canOverflow=function(e,t){if(assert(t!=a.Type.void),!t.is(36))return!1;var r;switch(o.getExpressionId(e)){case o.ExpressionId.LocalGet:var n=this.parentFunction.localsByIndex[o.getLocalGetIndex(e)];return!this.isLocalFlag(n.index,i.WRAPPED,!0)||p(n.type,t);case o.ExpressionId.LocalSet:return assert(o.isLocalTee(e)),this.canOverflow(o.getLocalSetValue(e),t);case o.ExpressionId.GlobalGet:var c=assert(this.parentFunction.program.elementsByName.get(assert(o.getGlobalGetName(e))));return assert(c.kind==s.ElementKind.GLOBAL),p(assert(c.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(a.Type.i32)||!this.canOverflow(r,t)||o.getExpressionId(r=o.getBinaryRight(e))==o.ExpressionId.Const&&o.getConstValueI32(r)<=t.computeSmallIntegerMask(a.Type.i32)||!this.canOverflow(r,t));case o.BinaryOp.ShlI32:var l=32-t.size;return o.getExpressionId(r=o.getBinaryRight(e))!=o.ExpressionId.Const||o.getConstValueI32(r)<l;case o.BinaryOp.ShrI32:l=32-t.size;return this.canOverflow(o.getBinaryLeft(e),t)&&(o.getExpressionId(r=o.getBinaryRight(e))!=o.ExpressionId.Const||o.getConstValueI32(r)<l);case o.BinaryOp.ShrU32:l=32-t.size;return t.is(1)?!(o.getExpressionId(r=o.getBinaryRight(e))==o.ExpressionId.Const&&o.getConstValueI32(r)>l):this.canOverflow(o.getBinaryLeft(e),t)&&!(o.getExpressionId(r=o.getBinaryRight(e))==o.ExpressionId.Const&&o.getConstValueI32(r)>=l);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 u=0;switch(o.getExpressionType(e)){case o.NativeType.I32:u=o.getConstValueI32(e);break;case o.NativeType.I64:u=o.getConstValueI64Low(e);break;case o.NativeType.F32:u=i32(o.getConstValueF32(e));break;case o.NativeType.F64:u=i32(o.getConstValueF64(e));break;default:assert(!1)}switch(t.kind){case 0:return u<i8.MIN_VALUE||u>i8.MAX_VALUE;case 1:return u<i16.MIN_VALUE||u>i16.MAX_VALUE;case 5:return u<0||u>u8.MAX_VALUE;case 6:return u<0||u>u16.MAX_VALUE;case 10:return 0!=(-2&u)}break;case o.ExpressionId.Load:var _=void 0,h=o.isLoadSigned(e);switch(o.getLoadBytes(e)){case 1:_=h?a.Type.i8:a.Type.u8;break;case 2:_=h?a.Type.i16:a.Type.u16;break;default:_=h?a.Type.i32:a.Type.u32}return p(_,t);case o.ExpressionId.Block:if(!o.getBlockName(e)){var d=assert(o.getBlockChildCount(e)),y=o.getBlockChild(e,d-1);return this.canOverflow(y,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 m=this.parentFunction.program.instancesByName,f=assert(o.getCallTarget(e));if(m.has(f)){var T=m.get(f);assert(T.kind==s.ElementKind.FUNCTION);var g=T.signature.returnType;return!T.flow.is(2)||p(g,t)}return!1;case o.ExpressionId.Unreachable:return!1}return!0},e.prototype.toString=function(){for(var e=0,t=this.parent;t;)t=t.parent,++e;return"Flow("+this.actualFunction+")["+e.toString()+"]"},e}();function p(e,t){return!e.is(4)||e.size>t.size||e.is(1)!=t.is(1)}function _(e,t){switch(o.getExpressionId(e)){case o.ExpressionId.LocalGet:t.add(o.getLocalGetIndex(e));break;case o.ExpressionId.LocalSet:t.add(o.getLocalSetIndex(e));default:o.traverse(e,t,_)}}t.Flow=u,t.findUsedLocals=function(e,t){return void 0===t&&(t=new Set),o.traverse(e,t,_),t}},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}}}},s=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),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.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 s};Object.defineProperty(t,"__esModule",{value:!0});var o=r(13),c=r(2),l=r(4),u=r(0),p=r(3),_=r(10),h=r(9),d=r(7),y=r(5),m=r(6),f=r(1),T=function(){function e(){this.target=u.Target.WASM32,this.noAssert=!1,this.importMemory=!1,this.sharedMemory=0,this.importTable=!1,this.sourceMap=!1,this.explicitStart=!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==u.Target.WASM64},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usizeType",{get:function(){return this.target==u.Target.WASM64?m.Type.usize64:m.Type.usize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isizeType",{get:function(){return this.target==u.Target.WASM64?m.Type.isize64:m.Type.isize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nativeSizeType",{get:function(){return this.target==u.Target.WASM64?l.NativeType.I64:l.NativeType.I32},enumerable:!0,configurable:!0}),e.prototype.hasFeature=function(e){return 0!=(this.features&e)},e}();t.Options=T,function(e){e[e.NONE=0]="NONE",e[e.IMPLICIT=1]="IMPLICIT",e[e.EXPLICIT=2]="EXPLICIT",e[e.WRAP=4]="WRAP",e[e.WILL_DROP=8]="WILL_DROP",e[e.SKIP_AUTORELEASE=16]="SKIP_AUTORELEASE",e[e.LAST_IN_BODY=32]="LAST_IN_BODY",e[e.STATIC_CAPABLE=64]="STATIC_CAPABLE"}(t.ContextualFlags||(t.ContextualFlags={})),function(e){e[e.NONE=0]="NONE",e[e.HEAP=1]="HEAP",e[e.RTTI=2]="RTTI",e[e.visitGlobals=4]="visitGlobals",e[e.visitMembers=8]="visitMembers"}(t.RuntimeFeatures||(t.RuntimeFeatures={}));var g,E,v=function(e){function t(t,r){void 0===r&&(r=null);var n=e.call(this,t.diagnostics)||this;n.currentInlineFunctions=[],n.currentEnum=null,n.currentType=m.Type.void,n.memorySegments=[],n.stringSegments=new Map,n.functionTable=["null"],n.argcVar=0,n.argcSet=0,n.runtimeFeatures=0,n.skippedAutoreleases=new Set,n.f32ModInstance=null,n.f64ModInstance=null,n.f32PowInstance=null,n.f64PowInstance=null,n.program=t,n.resolver=t.resolver,r||(r=new T),n.options=r,n.memoryOffset=i64_new(max(r.memoryBase,8)),n.module=l.Module.create();var i=0;return n.options.hasFeature(16)&&(i|=l.FeatureFlags.Atomics),n.options.hasFeature(2)&&(i|=l.FeatureFlags.MutableGloabls),n.options.hasFeature(8)&&(i|=l.FeatureFlags.SIMD128),n.options.hasFeature(4)&&(i|=l.FeatureFlags.BulkMemory),n.options.hasFeature(1)&&(i|=l.FeatureFlags.SignExt),n.module.setFeatures(i),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,s=this.module,c=this.program;c.initialize(i);var u=c.makeNativeFunction("start",new m.Signature([],m.Type.void));u.internalName="start";var p=new Array;this.currentFlow=u.flow,this.currentBody=p,i.isWasm64?(s.addGlobal(o.BuiltinSymbols.heap_base,l.NativeType.I64,!0,s.i64(0)),s.addGlobal(o.BuiltinSymbols.rtti_base,l.NativeType.I64,!0,s.i64(0))):(s.addGlobal(o.BuiltinSymbols.heap_base,l.NativeType.I32,!0,s.i32(0)),s.addGlobal(o.BuiltinSymbols.rtti_base,l.NativeType.I32,!0,s.i32(0)));var _=c.filesByName;try{for(var h=a(_.values()),d=h.next();!d.done;d=h.next()){(A=d.value).source.isEntry&&(this.compileFile(A),this.compileExports(A))}}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}var y=!p.length,f=i.explicitStart;if(!y||f){var T=u.signature;!y&&f&&(s.addGlobal(o.BuiltinSymbols.started,l.NativeType.I32,!0,s.i32(0)),p.unshift(s.if(s.global_get(o.BuiltinSymbols.started,l.NativeType.I32),s.return(),s.global_set(o.BuiltinSymbols.started,s.i32(1)))));var g=s.addFunction(u.internalName,this.ensureFunctionType(T.parameterTypes,T.returnType,T.thisType),m.typesToNativeTypes(u.additionalLocals),s.block(null,p));u.finalize(s,g),f?s.addFunctionExport(u.internalName,"__start"):s.setStart(g)}4&this.runtimeFeatures&&o.compileVisitGlobals(this),8&this.runtimeFeatures&&o.compileVisitMembers(this),s.removeGlobal(o.BuiltinSymbols.rtti_base),2&this.runtimeFeatures&&o.compileRTTI(this);var E=this.memoryOffset;E=i64_align(E,i.usizeType.byteSize),this.memoryOffset=E,s.removeGlobal(o.BuiltinSymbols.heap_base),1&this.runtimeFeatures&&(i.isWasm64?s.addGlobal(o.BuiltinSymbols.heap_base,l.NativeType.I64,!1,s.i64(i64_low(E),i64_high(E))):s.addGlobal(o.BuiltinSymbols.heap_base,l.NativeType.I32,!1,s.i32(i64_low(E))));var v=i.hasFeature(16)&&i.sharedMemory>0;s.setMemory(this.options.memoryBase||this.memorySegments.length?i64_low(i64_shr_u(i64_align(E,65536),i64_new(16,0))):0,v?i.sharedMemory:l.Module.UNLIMITED_MEMORY,this.memorySegments,i.target,"memory",v),i.importMemory&&s.addMemoryImport("0","env","memory",v);var b=this.functionTable;s.setFunctionTable(b.length,4294967295,b),s.addFunction("null",this.ensureFunctionType(null,m.Type.void),null,s.block(null,[])),i.importTable&&s.addTableImport("0","env","table");try{for(var I=a(this.program.filesByName.values()),x=I.next();!x.done;x=I.next()){var A;(A=x.value).source.isEntry&&this.ensureModuleExports(A)}}catch(e){r={error:e}}finally{try{x&&!x.done&&(n=I.return)&&n.call(I)}finally{if(r)throw r.error}}return s},t.prototype.ensureModuleExports=function(e){var t,r,n=e.exports;if(n)try{for(var i=a(n),o=i.next();!o.done;o=i.next()){var c=s(o.value,2),l=c[0],u=c[1];this.ensureModuleExport(l,u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}var p=e.exportsStar;if(p)for(var _=0,h=p.length;_<h;++_)this.ensureModuleExports(p[_])},t.prototype.ensureModuleExport=function(e,t,r){var n,i,s,o,_,h,d,y;switch(void 0===r&&(r=""),t.kind){case p.ElementKind.FUNCTION_PROTOTYPE:if(E=t.instances)try{for(var m=a(E.values()),f=m.next();!f.done;f=m.next()){var T=f.value,g=e;if(T.is(u.CommonFlags.GENERIC))g+=(I=T.internalName).substring(I.lastIndexOf("<"));this.ensureModuleExport(g,T,r)}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}break;case p.ElementKind.CLASS_PROTOTYPE:var E;if(E=t.instances)try{for(var v=a(E.values()),b=v.next();!b.done;b=v.next()){var I;T=b.value,g=e;if(T.is(u.CommonFlags.GENERIC))g+=(I=T.internalName).substring(I.lastIndexOf("<"));this.ensureModuleExport(g,T,r)}}catch(e){s={error:e}}finally{try{b&&!b.done&&(o=v.return)&&o.call(v)}finally{if(s)throw s.error}}break;case p.ElementKind.PROPERTY_PROTOTYPE:var x=t.getterPrototype,A=t.setterPrototype;x&&this.ensureModuleExport(u.GETTER_PREFIX+e,x,r),A&&this.ensureModuleExport(u.SETTER_PREFIX+e,A,r);break;case p.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(c.DiagnosticCode.Cannot_export_a_mutable_global,t.identifierNode.range);break;case p.ElementKind.ENUMVALUE:t.isImmutable||this.options.hasFeature(2)?this.module.addGlobalExport(t.internalName,r+e):this.error(c.DiagnosticCode.Cannot_export_a_mutable_global,t.identifierNode.range);break;case p.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 p.ElementKind.PROPERTY:(x=t.getterInstance)&&this.ensureModuleExport(u.GETTER_PREFIX+e,x,r),(A=t.setterInstance)&&this.ensureModuleExport(u.SETTER_PREFIX+e,A,r);break;case p.ElementKind.FIELD:this.ensureModuleFieldGetter(r+u.GETTER_PREFIX+e,t),t.is(u.CommonFlags.READONLY)||this.ensureModuleFieldSetter(r+u.SETTER_PREFIX+e,t);break;case p.ElementKind.CLASS:if(!t.type.isUnmanaged){var S=this.module,O=t.internalName;S.addGlobal(O,l.NativeType.I32,!1,S.i32(t.id)),S.addGlobalExport(O,r+e)}break;case p.ElementKind.ENUM:case p.ElementKind.NAMESPACE:case p.ElementKind.FILE:case p.ElementKind.TYPEDEFINITION:break;default:assert(!1)}var C=t.members;if(C){var k=r+e+(t.kind==p.ElementKind.CLASS?u.INSTANCE_DELIMITER:u.STATIC_DELIMITER);if(t.kind==p.ElementKind.NAMESPACE||t.kind==p.ElementKind.FILE)try{for(var R=a(C.values()),L=R.next();!L.done;L=R.next()){(D=L.value).is(u.CommonFlags.EXPORT)&&this.ensureModuleExport(D.name,D,k)}}catch(e){_={error:e}}finally{try{L&&!L.done&&(h=R.return)&&h.call(R)}finally{if(_)throw _.error}}else try{for(var F=a(C.values()),B=F.next();!B.done;B=F.next()){var D;(D=B.value).is(u.CommonFlags.PRIVATE)||this.ensureModuleExport(D.name,D,k)}}catch(e){d={error:e}}finally{try{B&&!B.done&&(y=F.return)&&y.call(F)}finally{if(d)throw d.error}}}},t.prototype.ensureModuleFieldGetter=function(e,t){var r=this.module,n=t.type,i=this.options.usizeType,a=r.load(n.byteSize,n.is(1),r.local_get(0,i.toNativeType()),n.toNativeType(),t.memoryOffset);n.isManaged&&(a=this.makeRetain(a)),r.addFunction(e,this.ensureFunctionType(null,n,i),null,a),r.addFunctionExport(e,e)},t.prototype.ensureModuleFieldSetter=function(e,t){var r=this.module,n=t.type,i=n.toNativeType(),a=this.options.usizeType,s=a.toNativeType(),o=r.local_get(1,i);n.isManaged&&(o=this.makeRetainRelease(r.load(n.byteSize,!1,r.local_get(0,s),i,t.memoryOffset),o)),r.addFunction(e,this.ensureFunctionType([n],m.Type.void,a),null,r.store(n.byteSize,r.local_get(0,s),o,i,t.memoryOffset)),r.addFunctionExport(e,e)},t.prototype.compileElement=function(e,t){switch(void 0===t&&(t=!0),e.kind){case p.ElementKind.GLOBAL:this.compileGlobal(e);break;case p.ElementKind.ENUM:this.compileEnum(e);break;case p.ElementKind.FUNCTION_PROTOTYPE:e.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(e,[]);break;case p.ElementKind.CLASS_PROTOTYPE:e.is(u.CommonFlags.GENERIC)||this.compileClassUsingTypeArguments(e,[]);break;case p.ElementKind.PROPERTY_PROTOTYPE:var r=e.getterPrototype;r&&this.compileFunctionUsingTypeArguments(r,[]);var n=e.setterPrototype;n&&this.compileFunctionUsingTypeArguments(n,[]);break;case p.ElementKind.NAMESPACE:case p.ElementKind.TYPEDEFINITION:case p.ElementKind.ENUMVALUE:break;default:assert(!1,p.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()),s=i.next();!s.done;s=i.next()){var o=s.value;this.compileElement(o)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t.prototype.compileExports=function(e){var t,r,n,i,s=e.exports;if(s)try{for(var o=a(s.values()),c=o.next();!c.done;c=o.next()){var l=c.value;this.compileElement(l)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}var u=e.exportsStar;if(u)try{for(var p=a(u),_=p.next();!_.done;_=p.next()){var h=_.value;this.compileFile(h),this.compileExports(h)}}catch(e){n={error:e}}finally{try{_&&!_.done&&(i=p.return)&&i.call(p)}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(c.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,a=t.flow;this.currentFlow=a;for(var s=e.source.statements,o=0,c=s.length;o<c;++o)this.compileTopLevelStatement(s[o],n);if(this.finishAutoreleases(a,n),this.currentFlow=i,this.currentBody=r,n.length){var p=this.module,_=t.localsByIndex,h=_.length,d=new Array(h);for(o=0;o<h;++o)d[o]=_[o].type.toNativeType();p.addFunction(t.internalName,this.ensureFunctionType(t.signature.parameterTypes,t.signature.returnType),d,n.length>1?p.block(null,n):n[0]),r.push(p.call(t.internalName,null,l.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=!1,i=e.typeNode,a=e.initializerNode;if(!e.is(u.CommonFlags.RESOLVED))if(i){var s=this.resolver.resolveType(i,e.parent);if(!s)return!1;if(s==m.Type.void)return this.error(c.DiagnosticCode.Type_expected,i.range),!1;e.setType(s)}else{if(!a)return this.error(c.DiagnosticCode.Type_expected,e.identifierNode.range.atEnd),!1;var _=this.currentFlow;if(e.hasDecorator(p.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow),r=this.compileExpression(a,m.Type.i32,20),this.skippedAutoreleases.has(r)&&(n=!0),this.currentFlow=_,this.currentType==m.Type.void)return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,a.range,this.currentType.toString(),"<auto>"),!1;e.setType(this.currentType)}if(e.is(u.CommonFlags.AMBIENT)&&e.hasDecorator(p.DecoratorFlags.BUILTIN))return e.internalName==o.BuiltinSymbols.heap_base?this.runtimeFeatures|=1:e.internalName==o.BuiltinSymbols.rtti_base&&(this.runtimeFeatures|=2),!0;var h=e.type,d=h.toNativeType(),f=e.is(u.CommonFlags.CONST)||e.is(u.CommonFlags.STATIC|u.CommonFlags.READONLY),T=e.hasDecorator(p.DecoratorFlags.INLINE);if(e.is(u.CommonFlags.AMBIENT))return f||this.options.hasFeature(2)?(e.set(u.CommonFlags.MODULE_IMPORT),b(e,e.declaration),t.addGlobalImport(e.internalName,g,E,d),e.set(u.CommonFlags.COMPILED),!0):(this.error(c.DiagnosticCode.Operation_not_supported,e.declaration.range),!1);var v=!1;if(a){if(!r){_=this.currentFlow;e.hasDecorator(p.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow),r=this.compileExpression(a,h,85),this.skippedAutoreleases.has(r)&&(n=!0),this.currentFlow=_}if(l.getExpressionId(r)!=l.ExpressionId.Const&&(f?(r=t.precomputeExpression(r),l.getExpressionId(r)!=l.ExpressionId.Const&&(v=!0)):v=!0),T)if(v)this.warning(c.DiagnosticCode.Mutable_value_cannot_be_inlined,a.range);else{switch(assert(l.getExpressionId(r)==l.ExpressionId.Const),l.getExpressionType(r)){case l.NativeType.I32:e.constantValueKind=1,e.constantIntegerValue=i64_new(l.getConstValueI32(r),0);break;case l.NativeType.I64:e.constantValueKind=1,e.constantIntegerValue=i64_new(l.getConstValueI64Low(r),l.getConstValueI64High(r));break;case l.NativeType.F32:e.constantValueKind=2,e.constantFloatValue=l.getConstValueF32(r);break;case l.NativeType.F64:e.constantValueKind=2,e.constantFloatValue=l.getConstValueF64(r);break;default:return assert(!1),!1}e.set(u.CommonFlags.INLINED)}}else r=h.toNativeZero(t);var I=e.internalName;return v?(T&&this.error(c.DiagnosticCode.Decorator_0_is_not_valid_here,assert(y.findDecorator(y.DecoratorKind.INLINE,e.decoratorNodes)).range,"inline"),t.addGlobal(I,d,!0,h.toNativeZero(t)),h.isManaged&&!n&&(r=this.makeRetain(r)),this.currentBody.push(t.global_set(I,r))):T||t.addGlobal(I,d,!f,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,s=!1,o=e.is(u.CommonFlags.CONST)||e.hasDecorator(p.DecoratorFlags.INLINE);if(e.members)try{for(var _=a(e.members.values()),h=_.next();!h.done;h=_.next()){var d=h.value;if(d.kind==p.ElementKind.ENUMVALUE){var y=!1,f=d,T=f.valueNode;f.set(u.CommonFlags.COMPILED);var g=this.currentFlow;e.hasDecorator(p.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow);var E=void 0;T?(E=this.compileExpression(T,m.Type.i32,1),l.getExpressionId(E)!=l.ExpressionId.Const&&(E=n.precomputeExpression(E),l.getExpressionId(E)!=l.ExpressionId.Const&&(e.is(u.CommonFlags.CONST)&&this.error(c.DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression,T.range),y=!0))):null==i?E=n.i32(0):(s&&this.error(c.DiagnosticCode.Enum_member_must_have_initializer,d.identifierNode.range.atEnd),E=n.binary(l.BinaryOp.AddI32,n.global_get(i.internalName,l.NativeType.I32),n.i32(1)),E=n.precomputeExpression(E),l.getExpressionId(E)!=l.ExpressionId.Const&&(e.is(u.CommonFlags.CONST)&&this.error(c.DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression,d.declaration.range),y=!0)),this.currentFlow=g,y?(n.addGlobal(f.internalName,l.NativeType.I32,!0,n.i32(0)),this.currentBody.push(this.makeGlobalAssignment(f,E,!1)),s=!0):(o?(f.setConstantIntegerValue(i64_new(l.getConstValueI32(E)),m.Type.i32),f.is(u.CommonFlags.MODULE_EXPORT)&&n.addGlobal(f.internalName,l.NativeType.I32,!1,E)):n.addGlobal(f.internalName,l.NativeType.I32,!1,E),f.isImmutable=!0,s=!1),i=f}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(r=_.return)&&r.call(_)}finally{if(t)throw t.error}}return this.currentEnum=null,!0},t.prototype.compileFunctionUsingTypeArguments=function(e,t,r,n){if(void 0===r&&(r=f.makeMap()),void 0===n&&(n=null),e.hasDecorator(p.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 s=0;s<i;++s,++a)n[a]=e[s].toNativeType();var o=t.toNativeType(),c=this.module,l=c.getFunctionTypeBySignature(o,n);if(!l){var u=m.Signature.makeSignatureString(e,t,r);l=c.addFunctionType(u,o,n)}return l},t.prototype.compileFunctionBody=function(e,t){void 0===t&&(t=null);var r=this.module,n=assert(e.prototype.bodyNode),i=e.signature.returnType,a=this.currentFlow;if(n.kind==y.NodeKind.BLOCK)t=this.compileStatements(n.statements,!0,t);else{assert(n.kind==y.NodeKind.EXPRESSION),assert(e.prototype.arrowKind),assert(!e.isAny(u.CommonFlags.CONSTRUCTOR|u.CommonFlags.GET|u.CommonFlags.SET|u.CommonFlags.MAIN));var s=this.compileExpression(n.expression,i,1);if(t?t.push(s):t=[s],!a.isAny(57)){var o=t.length;this.performAutoreleases(a,t),this.finishAutoreleases(a,t);var h=a.canOverflow(s,i),d=a.isNonnull(s,i);if(t.length>o){var f=a.getAndFreeTempLocal(i);h||a.setLocalFlag(f.index,_.LocalFlags.WRAPPED),d&&a.setLocalFlag(f.index,_.LocalFlags.NONNULL),t[o-1]=r.local_set(f.index,s),t.push(r.local_get(f.index,i.toNativeType()))}h||a.set(2),d&&a.set(4),a.set(1)}}if(e.is(u.CommonFlags.CONSTRUCTOR)){var T=this.options.nativeSizeType;assert(e.is(u.CommonFlags.INSTANCE));var g=assert(e.parent);if(assert(g.kind==p.ElementKind.CLASS),!a.isAny(57)){var E=assert(a.lookupLocal(u.CommonSymbols.this_));a.is(64)||(t.push(r.if(r.unary(T==l.NativeType.I64?l.UnaryOp.EqzI64:l.UnaryOp.EqzI32,r.local_get(E.index,T)),r.local_set(E.index,this.makeRetain(this.makeAllocation(g))))),this.makeFieldInitialization(g,t)),this.performAutoreleases(a,t),this.finishAutoreleases(a,t),t.push(r.local_get(E.index,this.options.nativeSizeType)),a.set(5)}g.base&&!a.is(128)&&this.error(c.DiagnosticCode.Constructors_for_derived_classes_must_contain_a_super_call,e.prototype.declaration.range)}else i==m.Type.void||a.is(1)||this.error(c.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(p.DecoratorFlags.BUILTIN)));var t=this.currentType;e.set(u.CommonFlags.COMPILED);var r,n=this.module,i=e.signature,a=e.prototype.bodyNode,s=this.ensureFunctionType(i.parameterTypes,i.returnType,i.thisType);if(a){if(e.is(u.CommonFlags.AMBIENT)&&this.error(c.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.identifierNode.range),e.hasDecorator(p.DecoratorFlags.EXTERNAL)){var o=e.decoratorNodes,l=assert(y.findDecorator(y.DecoratorKind.EXTERNAL,o));this.error(c.DiagnosticCode.Operation_not_supported,l.range)}var h=this.currentFlow,d=e.flow;this.currentFlow=d;var f=new Array,T=0;i.thisType&&++T;for(var v=i.parameterTypes,x=0,A=v.length;x<A;++x,++T){var N=v[x];N.isManaged&&(f.push(n.drop(this.makeRetain(n.local_get(T,N.toNativeType())))),d.setLocalFlag(T,_.LocalFlags.RETAINED))}this.compileFunctionBody(e,f),d.isAny(57)||(this.performAutoreleases(d,f),this.finishAutoreleases(d,f)),this.currentFlow=h,r=n.addFunction(e.internalName,s,m.typesToNativeTypes(e.additionalLocals),I(n,f,e.signature.returnType.toNativeType()))}else e.is(u.CommonFlags.AMBIENT)||this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.identifierNode.range),e.set(u.CommonFlags.MODULE_IMPORT),b(e,e.declaration),r=n.addFunctionImport(e.internalName,g,E,s);return e.finalize(n,r),this.currentType=t,!0},t.prototype.compileClassUsingTypeArguments=function(e,t,r,n){void 0===r&&(r=f.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 s=e.prototype.members;if(s)try{for(var o=a(s.values()),c=o.next();!c.done;c=o.next()){switch((y=c.value).kind){case p.ElementKind.GLOBAL:this.compileGlobal(y);break;case p.ElementKind.FUNCTION_PROTOTYPE:y.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(y,[],f.makeMap(),y.identifierNode);break;case p.ElementKind.PROPERTY_PROTOTYPE:(m=y.getterPrototype)&&this.compileFunctionUsingTypeArguments(m,[],f.makeMap(),m.identifierNode),(T=y.setterPrototype)&&this.compileFunctionUsingTypeArguments(T,[],f.makeMap(),T.identifierNode);break;case p.ElementKind.PROPERTY:}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}var l=e.constructorInstance;l&&this.compileFunction(l);var _=e.members;if(_)try{for(var h=a(_.values()),d=h.next();!d.done;d=h.next()){var y;switch((y=d.value).kind){case p.ElementKind.FUNCTION_PROTOTYPE:y.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(y,[],f.makeMap(e.contextualTypeArguments),y.declaration.name);break;case p.ElementKind.FIELD_PROTOTYPE:y.set(u.CommonFlags.COMPILED);break;case p.ElementKind.PROPERTY:var m,T;(m=y.getterInstance)&&this.compileFunction(m),(T=y.setterInstance)&&this.compileFunction(T)}}}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(c.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=l.MemorySegment.create(e,r);return this.memorySegments.push(n),this.memoryOffset=i64_add(r,i64_new(e.length,0)),n},t.prototype.ensureStaticString=function(e){var t,r=this.program,n=r.runtimeHeaderSize,i=assert(r.stringInstance),a=this.stringSegments;if(a.has(e))t=a.get(e);else{var s=e.length,o=new Uint8Array(n+(s<<1));r.writeRuntimeHeader(o,0,i,s<<1);for(var c=0;c<s;++c)f.writeI16(e.charCodeAt(c),o,n+(c<<1));t=this.addMemorySegment(o),a.set(e,t)}var l=i64_add(t.offset,i64_new(n));return this.currentType=i.type,this.options.isWasm64?this.module.i64(i64_low(l),i64_high(l)):(assert(i64_is_u32(l)),this.module.i32(i64_low(l)))},t.prototype.ensureStaticArrayBuffer=function(e,t){var r=this.program,n=t.length,i=e.byteSize,a=n*i,s=assert(r.arrayBufferInstance),o=r.runtimeHeaderSize,c=new Uint8Array(o+a);r.writeRuntimeHeader(c,0,s,a);var u=o,p=e.toNativeType();switch(p){case l.NativeType.I32:switch(i){case 1:for(var _=0;_<n;++_){var h=t[_];assert(l.getExpressionType(h)==p),assert(l.getExpressionId(h)==l.ExpressionId.Const),f.writeI8(l.getConstValueI32(h),c,u),u+=1}break;case 2:for(_=0;_<n;++_){h=t[_];assert(l.getExpressionType(h)==p),assert(l.getExpressionId(h)==l.ExpressionId.Const),f.writeI16(l.getConstValueI32(h),c,u),u+=2}break;case 4:for(_=0;_<n;++_){h=t[_];assert(l.getExpressionType(h)==p),assert(l.getExpressionId(h)==l.ExpressionId.Const),f.writeI32(l.getConstValueI32(h),c,u),u+=4}break;default:assert(!1)}break;case l.NativeType.I64:for(_=0;_<n;++_){h=t[_];assert(l.getExpressionType(h)==p),assert(l.getExpressionId(h)==l.ExpressionId.Const),f.writeI64(i64_new(l.getConstValueI64Low(h),l.getConstValueI64High(h)),c,u),u+=8}break;case l.NativeType.F32:for(_=0;_<n;++_){h=t[_];assert(l.getExpressionType(h)==p),assert(l.getExpressionId(h)==l.ExpressionId.Const),f.writeF32(l.getConstValueF32(h),c,u),u+=4}break;case l.NativeType.F64:for(_=0;_<n;++_){h=t[_];assert(l.getExpressionType(h)==p),assert(l.getExpressionId(h)==l.ExpressionId.Const),f.writeF64(l.getConstValueF64(h),c,u),u+=8}break;default:assert(!1)}return assert(u==c.length),this.addMemorySegment(c)},t.prototype.ensureStaticArrayHeader=function(e,t){var r=this.program,n=r.runtimeHeaderSize,i=assert(r.arrayPrototype),a=assert(this.resolver.resolveClass(i,[e])),s=a.currentMemoryOffset,o=t.buffer.length-n,c=i32(o/e.byteSize),l=new Uint8Array(n+s);r.writeRuntimeHeader(l,0,a,s);var u=i64_low(t.offset)+n;return assert(!r.options.isWasm64),assert(a.writeField("data",u,l,n)),assert(a.writeField("dataStart",u,l,n)),assert(a.writeField("dataLength",o,l,n)),assert(a.writeField("length_",c,l,n)),this.addMemorySegment(l)},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==y.NodeKind.EXPORTDEFAULT&&(e=e.declaration),e.kind){case y.NodeKind.CLASSDECLARATION:for(var r=0,n=(a=e.members).length;r<n;++r)this.compileTopLevelStatement(a[r],t);break;case y.NodeKind.ENUMDECLARATION:var i=this.program.getElementByDeclaration(e);assert(i.kind==p.ElementKind.ENUM),i.hasDecorator(p.DecoratorFlags.LAZY)||this.compileEnum(i);break;case y.NodeKind.NAMESPACEDECLARATION:var a;for(r=0,n=(a=e.members).length;r<n;++r)this.compileTopLevelStatement(a[r],t);break;case y.NodeKind.VARIABLE:var s=e.declarations;for(r=0,n=s.length;r<n;++r){i=this.program.getElementByDeclaration(s[r]);assert(i.kind==p.ElementKind.GLOBAL),i.is(u.CommonFlags.AMBIENT)||i.hasDecorator(p.DecoratorFlags.LAZY)||this.compileGlobal(i)}break;case y.NodeKind.FIELDDECLARATION:(i=this.program.getElementByDeclaration(e)).kind==p.ElementKind.GLOBAL&&(i.hasDecorator(p.DecoratorFlags.LAZY)||this.compileGlobal(i));break;case y.NodeKind.EXPORT:null!=e.normalizedPath&&this.compileFileByPath(e.normalizedPath,e.path);break;case y.NodeKind.IMPORT:this.compileFileByPath(e.normalizedPath,e.path);break;case y.NodeKind.FUNCTIONDECLARATION:case y.NodeKind.METHODDECLARATION:case y.NodeKind.INTERFACEDECLARATION:case y.NodeKind.INDEXSIGNATUREDECLARATION:case y.NodeKind.TYPEDECLARATION:break;default:var o=this.compileStatement(e);l.getExpressionId(o)!=l.ExpressionId.Nop&&t.push(o)}},t.prototype.compileStatement=function(e,t){void 0===t&&(t=0);var r,n=this.module;switch(e.kind){case y.NodeKind.BLOCK:r=this.compileBlockStatement(e,t);break;case y.NodeKind.BREAK:r=this.compileBreakStatement(e,t);break;case y.NodeKind.CONTINUE:r=this.compileContinueStatement(e,t);break;case y.NodeKind.DO:r=this.compileDoStatement(e,t);break;case y.NodeKind.EMPTY:r=this.compileEmptyStatement(e,t);break;case y.NodeKind.EXPRESSION:r=this.compileExpressionStatement(e,t);break;case y.NodeKind.FOR:r=this.compileForStatement(e,t);break;case y.NodeKind.IF:r=this.compileIfStatement(e,t);break;case y.NodeKind.RETURN:r=this.compileReturnStatement(e,t);break;case y.NodeKind.SWITCH:r=this.compileSwitchStatement(e,t);break;case y.NodeKind.THROW:r=this.compileThrowStatement(e,t);break;case y.NodeKind.TRY:r=this.compileTryStatement(e,t);break;case y.NodeKind.VARIABLE:(r=this.compileVariableStatement(e,t))||(r=n.nop());break;case y.NodeKind.VOID:r=this.compileVoidStatement(e,t);break;case y.NodeKind.WHILE:r=this.compileWhileStatement(e,t);break;case y.NodeKind.TYPEDECLARATION:this.error(c.DiagnosticCode.Operation_not_supported,e.range),r=n.unreachable();break;default:assert(!1),r=n.unreachable()}return this.options.sourceMap&&this.addDebugLocation(r,e.range),r},t.prototype.compileStatements=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=null);var n=e.length;r||((r=new Array(n)).length=0);for(var i=this.currentFlow,a=0;a<n;++a){var s=this.compileStatement(e[a],t&&a==n-1?32:0);switch(l.getExpressionId(s)){case l.ExpressionId.Block:if(!l.getBlockName(s)){for(var o=0,c=l.getBlockChildCount(s);o<c;++o)r.push(l.getBlockChild(s,o));break}default:r.push(s);case l.ExpressionId.Nop:}if(i.isAny(57)){l.needsExplicitUnreachable(s)&&r.push(this.module.unreachable());break}}return r},t.prototype.compileBlockStatement=function(e,t){var r=e.statements,n=this.currentFlow,i=n.fork();this.currentFlow=i;var a=this.compileStatements(r);return i.isAny(57)||this.performAutoreleases(i,a),i.freeScopedLocals(),n.inherit(i),this.currentFlow=n,I(this.module,a,l.NativeType.None)},t.prototype.compileBreakStatement=function(e,t){var r=this.module;if(e.label)return this.error(c.DiagnosticCode.Operation_not_supported,e.label.range),r.unreachable();var n=this.currentFlow,i=n.breakLabel;if(null==i)return this.error(c.DiagnosticCode.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement,e.range),r.unreachable();var a=new Array;this.performAutoreleases(n,a);for(var s=n.parent;s&&s.breakLabel===i;)this.performAutoreleases(s,a,!1),s=s.parent;return n.freeScopedLocals(),a.push(r.br(i)),n.set(16),I(r,a,l.NativeType.None)},t.prototype.compileContinueStatement=function(e,t){var r=this.module,n=e.label;if(n)return this.error(c.DiagnosticCode.Operation_not_supported,n.range),r.unreachable();var i=this.currentFlow,a=i.continueLabel;if(null==a)return this.error(c.DiagnosticCode.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement,e.range),r.unreachable();i.set(32);var s=new Array;this.performAutoreleases(i,s);for(var o=i.parent;o&&o.continueLabel===a;)this.performAutoreleases(o,s,!1),o=o.parent;return i.freeScopedLocals(),s.push(r.br(a)),I(r,s,l.NativeType.None)},t.prototype.compileDoStatement=function(e,t){var r=this.module,n=this.currentFlow,i=n.pushBreakLabel(),a=n.fork();this.currentFlow=a;var s="break|"+i;a.breakLabel=s;var o="continue|"+i;a.continueLabel=o;var c=new Array;e.statement.kind==y.NodeKind.BLOCK?this.compileStatements(e.statement.statements,!1,c):c.push(this.compileStatement(e.statement));var u=this.makeIsTrueish(this.compileExpression(e.condition,m.Type.i32),this.currentType),p=a.isAny(57);p||this.performAutoreleases(a,c),a.freeScopedLocals(),n.popBreakLabel(),this.currentFlow=n,a.unset(3120),n.inherit(a);var _=[r.loop(o,p?I(r,c,l.NativeType.None):r.block(null,[I(r,c,l.NativeType.None),r.br(o,u)],l.NativeType.None))];return p&&_.push(r.unreachable()),r.block(s,_)},t.prototype.compileEmptyStatement=function(e,t){return this.module.nop()},t.prototype.compileExpressionStatement=function(e,t){return this.compileExpression(e.expression,m.Type.void,10|t)},t.prototype.compileForStatement=function(e,t){var r=this.currentFlow,n=r.pushBreakLabel(),i=r.fork();this.currentFlow=i;var a=i.breakLabel="break|"+n;i.breakLabel=a;var s="continue|"+n;i.continueLabel=s;var o="repeat|"+n,c=this.module,u=e.initializer?this.compileStatement(e.initializer):0,p=0,_=!1;e.condition?(p=c.precomputeExpression(this.makeIsTrueish(this.compileExpressionRetainType(e.condition,m.Type.bool),this.currentType)),l.getExpressionId(p)==l.ExpressionId.Const&&(assert(l.getExpressionType(p)==l.NativeType.I32),0!=l.getConstValueI32(p)&&(_=!0))):(p=c.i32(1),_=!0),i.inheritNonnullIfTrue(p);var h=e.incrementor?this.compileExpression(e.incrementor,m.Type.void,9):0,d=e.statement,f=new Array;d.kind==y.NodeKind.BLOCK?this.compileStatements(d.statements,!1,f):f.push(this.compileStatement(d)),i.isAny(57)||this.performAutoreleases(i,f),i.freeScopedLocals(),r.popBreakLabel(),this.currentFlow=r;var T=i.isAny(2080);i.unset(3120),_?r.inherit(i):r.inheritConditional(i);var g=new Array;u&&g.push(u);var E=new Array;if(T)f.unshift(c.br(a,c.unary(l.UnaryOp.EqzI32,p))),E.push(c.block(s,f,l.NativeType.None));else{E.push(c.br(a,c.unary(l.UnaryOp.EqzI32,p)));for(var v=0,b=f.length;v<b;++v)E.push(f[v])}return h&&E.push(h),E.push(c.br(o)),g.push(c.loop(o,c.block(null,E,l.NativeType.None))),c.block(a,g)},t.prototype.compileIfStatement=function(e,t){var r=this.module,n=e.ifTrue,i=e.ifFalse,a=this.currentFlow,s=r.precomputeExpression(this.makeIsTrueish(this.compileExpressionRetainType(e.condition,m.Type.bool),this.currentType));if(l.getExpressionId(s)==l.ExpressionId.Const&&l.getExpressionType(s)==l.NativeType.I32)return l.getConstValueI32(s)?this.compileStatement(n):i?this.compileStatement(i):r.nop();var o=new Array,c=a.fork();if(this.currentFlow=c,c.inheritNonnullIfTrue(s),n.kind==y.NodeKind.BLOCK?this.compileStatements(n.statements,!1,o):o.push(this.compileStatement(n)),c.isAny(57)||this.performAutoreleases(c,o),c.freeScopedLocals(),this.currentFlow=a,i){var u=a.fork();this.currentFlow=u,u.inheritNonnullIfFalse(s);var p=new Array;return i.kind==y.NodeKind.BLOCK?this.compileStatements(i.statements,!1,p):p.push(this.compileStatement(i)),u.isAny(57)||this.performAutoreleases(u,p),u.freeScopedLocals(),this.currentFlow=a,a.inheritMutual(c,u),r.if(s,I(r,o,l.NativeType.None),I(r,p,l.NativeType.None))}return a.inheritConditional(c),c.isAny(57)&&a.inheritNonnullIfFalse(s),r.if(s,I(r,o,l.NativeType.None))},t.prototype.compileReturnStatement=function(e,t){var r=this.module,n=0,i=this.currentFlow,a=i.returnType;i.set(1);var s=e.value;if(s){if(a==m.Type.void)return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,s.range,this.currentType.toString(),a.toString()),this.currentType=m.Type.void,r.unreachable();var o=1;i.actualFunction.is(u.CommonFlags.MODULE_EXPORT)&&(o|=4),n=this.compileExpression(s,a,16|o),this.skippedAutoreleases.has(n)||a.isManaged&&l.getExpressionId(n)==l.ExpressionId.LocalGet&&i.isAnyLocalFlag(l.getLocalGetIndex(n),_.LocalFlags.ANY_RETAINED)&&(i.unsetLocalFlag(l.getLocalGetIndex(n),_.LocalFlags.ANY_RETAINED),this.skippedAutoreleases.add(n)),i.canOverflow(n,a)||i.set(2),i.isNonnull(n,a)&&i.set(4)}else a!=m.Type.void&&(this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,"void",a.toString()),n=r.unreachable());var p=new Array;if(this.performAutoreleases(i,p),this.finishAutoreleases(i,p),a.isManaged&&!this.skippedAutoreleases.has(n)&&(n=this.makeRetain(n)),a!=m.Type.void&&p.length){var h=i.getAndFreeTempLocal(a);i.isNonnull(n,a)&&i.setLocalFlag(h.index,_.LocalFlags.NONNULL),p.unshift(r.local_set(h.index,n)),n=r.local_get(h.index,a.toNativeType())}return i.freeScopedLocals(),0!=(32&t)&&n&&a!=m.Type.void?p.length?(p.push(n),r.block(null,p,a.toNativeType())):n:i.is(8192)?p.length?(p.push(r.br(assert(i.inlineReturnLabel),0,n)),r.block(null,p)):r.br(assert(i.inlineReturnLabel),0,n):p.length?(p.push(r.return(n)),r.block(null,p)):r.return(n)},t.prototype.compileSwitchStatement=function(e,t){var r=this.module,n=e.cases,i=n.length;if(!i)return this.compileExpression(e.condition,m.Type.void,1);var a=this.currentFlow,s=a.pushBreakLabel(),o=a.getTempLocal(m.Type.u32),c=o.index,u=new Array(1+i);u[0]=r.local_set(c,this.compileExpression(e.condition,m.Type.u32,1));for(var p=1,_=-1,h=0;h<i;++h){var d=n[h].label;d?u[p++]=r.br("case"+h.toString(10)+"|"+s,r.binary(l.BinaryOp.EqI32,r.local_get(c,l.NativeType.I32),this.compileExpression(d,m.Type.u32,1))):_=h}a.freeTempLocal(o),u[p]=r.br((_>=0?"case"+_.toString(10):"break")+"|"+s);var y=r.block("case0|"+s,u,l.NativeType.None),f=!0,T=!0,g=!0,E=!0;for(h=0;h<i;++h){var v=n[h].statements,b=v.length,I=a.fork();this.currentFlow=I;var x="break|"+s;I.breakLabel=x;var A=h==i-1,N=A?x:"case"+(h+1).toString(10)+"|"+s,S=new Array(1+b);S[0]=y;for(var O=1,C=!1,k=0;k<b;++k){var R=this.compileStatement(v[k]);if(l.getExpressionId(R)!=l.ExpressionId.Nop&&(S[O++]=R,I.isAny(57))){C=!0;break}}S.length=O,(C||A)&&(I.is(1)||(f=!1),I.is(2)||(T=!1),I.is(8)||(g=!1),I.is(64)||(E=!1)),I.isAny(57)||this.performAutoreleases(I,S),I.unset(1040),I.freeScopedLocals(),this.currentFlow=a,y=r.block(N,S,l.NativeType.None)}return a.popBreakLabel(),_>=0&&(f&&a.set(1),T&&a.set(2),g&&a.set(8),E&&a.set(64)),y},t.prototype.compileThrowStatement=function(e,t){var r=this.currentFlow;r.set(8),r.set(1);var n=new Array;this.finishAutoreleases(r,n);var i=e.value,a=null;if(i.kind==y.NodeKind.NEW){var s=i.arguments;s.length&&(a=s[0])}return n.push(o.compileAbort(this,a,e)),I(this.module,n,l.NativeType.None)},t.prototype.compileTryStatement=function(e,t){return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()},t.prototype.compileVariableStatement=function(e,t){for(var r=this.module,n=e.declarations,i=n.length,a=this.currentFlow,s=new Array,o=this.resolver,h=0;h<i;++h){var d=n[h],y=d.name.text,f=null,T=0,g=!1;if(d.type){if(!(f=o.resolveType(d.type,a.actualFunction,a.contextualTypeArguments)))continue;d.initializer&&(T=this.compileExpression(d.initializer,f,17),g=this.skippedAutoreleases.has(T))}else{if(!d.initializer){this.error(c.DiagnosticCode.Type_expected,d.name.range.atEnd);continue}if(T=this.compileExpressionRetainType(d.initializer,m.Type.void,16),g=this.skippedAutoreleases.has(T),this.currentType==m.Type.void){this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,d.range,this.currentType.toString(),"<auto>");continue}f=this.currentType}var E=d.is(u.CommonFlags.CONST),v=!1;if(E)if(T){if(T=r.precomputeExpression(T),l.getExpressionId(T)==l.ExpressionId.Const){var b=new p.Local(y,-1,f,a.parentFunction);switch(l.getExpressionType(T)){case l.NativeType.I32:b.setConstantIntegerValue(i64_new(l.getConstValueI32(T),0),f);break;case l.NativeType.I64:b.setConstantIntegerValue(i64_new(l.getConstValueI64Low(T),l.getConstValueI64High(T)),f);break;case l.NativeType.F32:b.setConstantFloatValue(l.getConstValueF32(T),f);break;case l.NativeType.F64:b.setConstantFloatValue(l.getConstValueF64(T),f);break;default:return assert(!1),r.unreachable()}var x=a.scopedLocals;if(x){if(x.has(y))return this.error(c.DiagnosticCode.Duplicate_identifier_0,d.name.range,y),this.module.unreachable()}else a.scopedLocals=x=new Map;x.set(y,b),v=!0}}else this.error(c.DiagnosticCode._const_declarations_must_be_initialized,d.range);if(!v){b=void 0;if(d.isAny(u.CommonFlags.LET|u.CommonFlags.CONST)||a.is(8192)){var A=a.getScopedLocal(y);A?(this.error(c.DiagnosticCode.Duplicate_identifier_0,d.name.range,d.name.text),b=A):b=a.addScopedLocal(y,f),E&&a.setLocalFlag(b.index,_.LocalFlags.CONSTANT)}else{if(a.lookupLocal(y)){this.error(c.DiagnosticCode.Duplicate_identifier_0,d.name.range,y);continue}b=a.parentFunction.addLocal(f,y,d),E&&a.setLocalFlag(b.index,_.LocalFlags.CONSTANT)}var N=f.isManaged;T?(a.isNonnull(T,f)&&a.setLocalFlag(b.index,_.LocalFlags.NONNULL),N?(a.setLocalFlag(b.index,_.LocalFlags.RETAINED),s.push(r.local_set(b.index,g?T:this.makeRetain(T)))):(s.push(r.local_set(b.index,T)),b.type.is(36)&&(a.canOverflow(T,f)?a.unsetLocalFlag(b.index,_.LocalFlags.WRAPPED):a.setLocalFlag(b.index,_.LocalFlags.WRAPPED)))):N?(s.push(r.local_set(b.index,f.toNativeZero(r))),a.setLocalFlag(b.index,_.LocalFlags.CONDITIONALLY_RETAINED)):b.type.is(36)&&a.setLocalFlag(b.index,_.LocalFlags.WRAPPED)}}return 0==s.length?0:I(r,s,l.NativeType.None)},t.prototype.compileVoidStatement=function(e,t){return this.compileExpression(e.expression,m.Type.void,10)},t.prototype.compileWhileStatement=function(e,t){var r=this.module,n=this.currentFlow,i=r.precomputeExpression(this.makeIsTrueish(this.compileExpressionRetainType(e.condition,m.Type.bool),this.currentType));if(l.getExpressionId(i)==l.ExpressionId.Const&&l.getExpressionType(i)==l.NativeType.I32&&!l.getConstValueI32(i))return r.nop();var a=n.pushBreakLabel(),s=n.fork();this.currentFlow=s;var o="break|"+a;s.breakLabel=o;var c="continue|"+a;s.continueLabel=c,s.inheritNonnullIfTrue(i);var u=new Array;e.statement.kind==y.NodeKind.BLOCK?this.compileStatements(e.statement.statements,!1,u):u.push(this.compileStatement(e.statement));return s.isAny(57)||(this.performAutoreleases(s,u),u.push(r.br(c))),s.freeScopedLocals(),n.popBreakLabel(),this.currentFlow=n,s.unset(3120),n.inheritConditional(s),r.block(o,[r.loop(c,r.if(i,I(r,u,l.NativeType.None)))])},t.prototype.compileInlineConstant=function(e,t,r){assert(e.is(u.CommonFlags.INLINED));var n=e.type;switch(!(3&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(m.Type.i32);return this.module.i32(1==e.constantValueKind?i64_low(e.constantIntegerValue)<<i>>i:0);case 5:case 6:case 10:var a=e.type.computeSmallIntegerMask(m.Type.i32);return this.module.i32(1==e.constantValueKind?i64_low(e.constantIntegerValue)&a:0);case 2:case 7:return this.module.i32(1==e.constantValueKind?i64_low(e.constantIntegerValue):0);case 4:case 9:if(!e.program.options.isWasm64)return this.module.i32(1==e.constantValueKind?i64_low(e.constantIntegerValue):0);case 3:case 8:return 1==e.constantValueKind?this.module.i64(i64_low(e.constantIntegerValue),i64_high(e.constantIntegerValue)):this.module.i64(0);case 12:if(!e.hasDecorator(p.DecoratorFlags.BUILTIN)||t!=m.Type.f32)return this.module.f64(e.constantFloatValue);this.currentType=m.Type.f32;case 11:return this.module.f32(e.constantFloatValue);default:return assert(!1),this.module.unreachable()}},t.prototype.compileExpression=function(e,t,r){var n;switch(void 0===r&&(r=0),this.currentType=t,t==m.Type.void&&(r|=8),e.kind){case y.NodeKind.ASSERTION:n=this.compileAssertionExpression(e,t,r);break;case y.NodeKind.BINARY:n=this.compileBinaryExpression(e,t,r);break;case y.NodeKind.CALL:n=this.compileCallExpression(e,t,r);break;case y.NodeKind.COMMA:n=this.compileCommaExpression(e,t,r);break;case y.NodeKind.ELEMENTACCESS:n=this.compileElementAccessExpression(e,t,r);break;case y.NodeKind.FUNCTION:n=this.compileFunctionExpression(e,t.signatureReference,r);break;case y.NodeKind.IDENTIFIER:case y.NodeKind.FALSE:case y.NodeKind.NULL:case y.NodeKind.THIS:case y.NodeKind.SUPER:case y.NodeKind.TRUE:n=this.compileIdentifierExpression(e,t,r);break;case y.NodeKind.INSTANCEOF:n=this.compileInstanceOfExpression(e,t,r);break;case y.NodeKind.LITERAL:n=this.compileLiteralExpression(e,t,r);break;case y.NodeKind.NEW:n=this.compileNewExpression(e,t,r);break;case y.NodeKind.PARENTHESIZED:n=this.compileExpression(e.expression,t,r);break;case y.NodeKind.PROPERTYACCESS:n=this.compilePropertyAccessExpression(e,t,r);break;case y.NodeKind.TERNARY:n=this.compileTernaryExpression(e,t,r);break;case y.NodeKind.UNARYPOSTFIX:n=this.compileUnaryPostfixExpression(e,t,r);break;case y.NodeKind.UNARYPREFIX:n=this.compileUnaryPrefixExpression(e,t,r);break;default:this.error(c.DiagnosticCode.Operation_not_supported,e.range),n=this.module.unreachable()}var i=this.currentType,a=0!=(4&r);return i!=t&&(2&r?(n=this.convertExpression(n,i,t,!0,a,e),a=!1,this.currentType=t):1&r&&(n=this.convertExpression(n,i,t,!1,a,e),a=!1,this.currentType=t)),a&&(n=this.ensureSmallIntegerWrap(n,i)),this.options.sourceMap&&this.addDebugLocation(n,e.range),n},t.prototype.compileExpressionRetainType=function(e,t,r){return void 0===r&&(r=0),this.compileExpression(e,t==m.Type.void?m.Type.i32:t,-4&r)},t.prototype.precomputeExpression=function(e,t,r){return void 0===r&&(r=0),this.module.precomputeExpression(this.compileExpression(e,t,r))},t.prototype.convertExpression=function(e,t,r,n,i,a){var s=this.module;return 14==t.kind?(assert(14!=r.kind),this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,a.range,t.toString(),r.toString()),s.unreachable()):14==r.kind?s.drop(e):(this.currentFlow.isNonnull(e,t)&&(t=t.nonNullableType),t.isAssignableTo(r)||n||(t.nonNullableType==r?this.error(c.DiagnosticCode.Object_is_possibly_null,a.range):this.error(c.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=s.unary(l.UnaryOp.PromoteF32,e)):11==r.kind&&(e=s.unary(l.UnaryOp.DemoteF64,e)):r.is(4)?11==t.kind?r==m.Type.bool?(e=s.binary(l.BinaryOp.NeF32,e,s.f32(0)),i=!1):e=r.is(1)?r.is(64)?s.unary(l.UnaryOp.TruncF32ToI64,e):s.unary(l.UnaryOp.TruncF32ToI32,e):r.is(64)?s.unary(l.UnaryOp.TruncF32ToU64,e):s.unary(l.UnaryOp.TruncF32ToU32,e):r==m.Type.bool?(e=s.binary(l.BinaryOp.NeF64,e,s.f64(0)),i=!1):e=r.is(1)?r.is(64)?s.unary(l.UnaryOp.TruncF64ToI64,e):s.unary(l.UnaryOp.TruncF64ToI32,e):r.is(64)?s.unary(l.UnaryOp.TruncF64ToU64,e):s.unary(l.UnaryOp.TruncF64ToU32,e):(assert(0==r.flags,"void type expected"),e=s.drop(e)):t.is(4)&&r.is(8)?e=11==r.kind?t.is(64)?s.unary(t.is(1)?l.UnaryOp.ConvertI64ToF32:l.UnaryOp.ConvertU64ToF32,e):s.unary(t.is(1)?l.UnaryOp.ConvertI32ToF32:l.UnaryOp.ConvertU32ToF32,e):t.is(64)?s.unary(t.is(1)?l.UnaryOp.ConvertI64ToF64:l.UnaryOp.ConvertU64ToF64,e):s.unary(t.is(1)?l.UnaryOp.ConvertI32ToF64:l.UnaryOp.ConvertU32ToF64,e):t.is(64)?r==m.Type.bool?(e=s.binary(l.BinaryOp.NeI64,e,s.i64(0)),i=!1):r.is(64)||(e=s.unary(l.UnaryOp.WrapI64,e)):r.is(64)?(e=s.unary(t.is(1)?l.UnaryOp.ExtendI32:l.UnaryOp.ExtendU32,this.ensureSmallIntegerWrap(e,t)),i=!1):t.is(32)&&t.size<r.size&&(e=this.ensureSmallIntegerWrap(e,t),i=!1),this.currentType=r,i?this.ensureSmallIntegerWrap(e,r):e)},t.prototype.compileAssertionExpression=function(e,t,r){switch(e.assertionKind){case y.AssertionKind.PREFIX:case y.AssertionKind.AS:var n=this.currentFlow,i=this.resolver.resolveType(assert(e.toType),n.actualFunction,n.contextualTypeArguments);return i?this.compileExpression(e.expression,i,2|r):this.module.unreachable();case y.AssertionKind.NONNULL:assert(!e.toType);var a=this.compileExpressionRetainType(e.expression,t),s=this.currentType;if(this.currentFlow.isNonnull(a,s))this.info(c.DiagnosticCode.Expression_is_never_null,e.expression.range);else if(!this.options.noAssert){var o=this.module,l=(n=this.currentFlow).getAndFreeTempLocal(s).index;n.canOverflow(a,s)||n.setLocalFlag(l,_.LocalFlags.WRAPPED),n.setLocalFlag(l,_.LocalFlags.NONNULL),a=o.if(o.local_tee(l,a),o.local_get(l,s.toNativeType()),o.unreachable())}return this.currentType=this.currentType.nonNullableType,a;default:assert(!1)}return this.module.unreachable()},t.prototype.compileBinaryExpression=function(e,t,r){var n,i,a,s,o,h,y=this.module,f=e.left,T=e.right,g=!1,E=e.operator;switch(E){case d.Token.LESSTHAN:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.LT)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!0)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<",i.toString(),s.toString()),this.currentType=t,y.unreachable();switch(n=this.convertExpression(n,i,i=o,!1,!0,f),a=this.convertExpression(a,s,s=o,!1,!0,T),o.kind){case 0:case 1:case 2:h=y.binary(l.BinaryOp.LtI32,n,a);break;case 3:h=y.binary(l.BinaryOp.LtI64,n,a);break;case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.LtI64:l.BinaryOp.LtI32,n,a);break;case 5:case 6:case 7:case 10:h=y.binary(l.BinaryOp.LtU32,n,a);break;case 9:h=y.binary(this.options.isWasm64?l.BinaryOp.LtU64:l.BinaryOp.LtU32,n,a);break;case 8:h=y.binary(l.BinaryOp.LtU64,n,a);break;case 11:h=y.binary(l.BinaryOp.LtF32,n,a);break;case 12:h=y.binary(l.BinaryOp.LtF64,n,a);break;default:assert(!1),h=y.unreachable()}this.currentType=m.Type.bool;break;case d.Token.GREATERTHAN:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.GT)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!0)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">",i.toString(),s.toString()),this.currentType=t,y.unreachable();switch(n=this.convertExpression(n,i,i=o,!1,!0,f),a=this.convertExpression(a,s,s=o,!1,!0,T),o.kind){case 0:case 1:case 2:h=y.binary(l.BinaryOp.GtI32,n,a);break;case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.GtI64:l.BinaryOp.GtI32,n,a);break;case 3:h=y.binary(l.BinaryOp.GtI64,n,a);break;case 5:case 6:case 7:case 10:h=y.binary(l.BinaryOp.GtU32,n,a);break;case 9:h=y.binary(this.options.isWasm64?l.BinaryOp.GtU64:l.BinaryOp.GtU32,n,a);break;case 8:h=y.binary(l.BinaryOp.GtU64,n,a);break;case 11:h=y.binary(l.BinaryOp.GtF32,n,a);break;case 12:h=y.binary(l.BinaryOp.GtF64,n,a);break;default:assert(!1),h=y.unreachable()}this.currentType=m.Type.bool;break;case d.Token.LESSTHAN_EQUALS:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.LE)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!0)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<=",i.toString(),s.toString()),this.currentType=t,y.unreachable();switch(n=this.convertExpression(n,i,i=o,!1,!0,f),a=this.convertExpression(a,s,s=o,!1,!0,T),o.kind){case 0:case 1:case 2:h=y.binary(l.BinaryOp.LeI32,n,a);break;case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.LeI64:l.BinaryOp.LeI32,n,a);break;case 3:h=y.binary(l.BinaryOp.LeI64,n,a);break;case 5:case 6:case 7:case 10:h=y.binary(l.BinaryOp.LeU32,n,a);break;case 9:h=y.binary(this.options.isWasm64?l.BinaryOp.LeU64:l.BinaryOp.LeU32,n,a);break;case 8:h=y.binary(l.BinaryOp.LeU64,n,a);break;case 11:h=y.binary(l.BinaryOp.LeF32,n,a);break;case 12:h=y.binary(l.BinaryOp.LeF64,n,a);break;default:assert(!1),h=y.unreachable()}this.currentType=m.Type.bool;break;case d.Token.GREATERTHAN_EQUALS:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.GE)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!0)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">=",i.toString(),s.toString()),this.currentType=t,y.unreachable();switch(n=this.convertExpression(n,i,i=o,!1,!0,f),a=this.convertExpression(a,s,s=o,!1,!0,T),o.kind){case 0:case 1:case 2:h=y.binary(l.BinaryOp.GeI32,n,a);break;case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.GeI64:l.BinaryOp.GeI32,n,a);break;case 3:h=y.binary(l.BinaryOp.GeI64,n,a);break;case 5:case 6:case 7:case 10:h=y.binary(l.BinaryOp.GeU32,n,a);break;case 9:h=y.binary(this.options.isWasm64?l.BinaryOp.GeU64:l.BinaryOp.GeU32,n,a);break;case 8:h=y.binary(l.BinaryOp.GeU64,n,a);break;case 11:h=y.binary(l.BinaryOp.GeF32,n,a);break;case 12:h=y.binary(l.BinaryOp.GeF64,n,a);break;default:assert(!1),h=y.unreachable()}this.currentType=m.Type.bool;break;case d.Token.EQUALS_EQUALS_EQUALS:case d.Token.EQUALS_EQUALS:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,E==d.Token.EQUALS_EQUALS&&this.currentType.is(256))if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.EQ)){h=this.compileBinaryOverload(A,f,n,T,e);break}if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,d.operatorTokenToString(e.operator),i.toString(),s.toString()),this.currentType=t,y.unreachable();switch(n=this.convertExpression(n,i,i=o,!1,!0,f),a=this.convertExpression(a,s,s=o,!1,!0,T),o.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:h=y.binary(l.BinaryOp.EqI32,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.EqI64:l.BinaryOp.EqI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.EqI64,n,a);break;case 11:h=y.binary(l.BinaryOp.EqF32,n,a);break;case 12:h=y.binary(l.BinaryOp.EqF64,n,a);break;case 13:h=y.unary(l.UnaryOp.AllTrueVecI8x16,y.binary(l.BinaryOp.EqVecI8x16,n,a));break;default:assert(!1),h=y.unreachable()}this.currentType=m.Type.bool;break;case d.Token.EXCLAMATION_EQUALS_EQUALS:case d.Token.EXCLAMATION_EQUALS:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,E==d.Token.EXCLAMATION_EQUALS&&this.currentType.is(256))if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.NE)){h=this.compileBinaryOverload(A,f,n,T,e);break}if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,d.operatorTokenToString(e.operator),i.toString(),s.toString()),this.currentType=t,y.unreachable();switch(n=this.convertExpression(n,i,i=o,!1,!0,f),a=this.convertExpression(a,s,s=o,!1,!0,T),o.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:h=y.binary(l.BinaryOp.NeI32,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.NeI64:l.BinaryOp.NeI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.NeI64,n,a);break;case 11:h=y.binary(l.BinaryOp.NeF32,n,a);break;case 12:h=y.binary(l.BinaryOp.NeF64,n,a);break;case 13:h=y.unary(l.UnaryOp.AnyTrueVecI8x16,y.binary(l.BinaryOp.NeVecI8x16,n,a));break;default:assert(!1),h=y.unreachable()}this.currentType=m.Type.bool;break;case d.Token.EQUALS:return this.compileAssignment(f,T,t);case d.Token.PLUS_EQUALS:g=!0;case d.Token.PLUS:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.ADD)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(g)a=this.compileExpression(T,i,1);else{if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"+",i.toString(),s.toString()),this.currentType=t,y.unreachable();n=this.convertExpression(n,i,i=o,!1,!1,f),a=this.convertExpression(a,s,s=o,!1,!1,T)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:h=y.binary(l.BinaryOp.AddI32,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.AddI64:l.BinaryOp.AddI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.AddI64,n,a);break;case 11:h=y.binary(l.BinaryOp.AddF32,n,a);break;case 12:h=y.binary(l.BinaryOp.AddF64,n,a);break;default:assert(!1),h=y.unreachable()}break;case d.Token.MINUS_EQUALS:g=!0;case d.Token.MINUS:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.SUB)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(g)a=this.compileExpression(T,i,1),s=this.currentType;else{if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"-",i.toString(),s.toString()),this.currentType=t,y.unreachable();n=this.convertExpression(n,i,i=o,!1,!1,f),a=this.convertExpression(a,s,s=o,!1,!1,T)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:h=y.binary(l.BinaryOp.SubI32,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.SubI64:l.BinaryOp.SubI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.SubI64,n,a);break;case 11:h=y.binary(l.BinaryOp.SubF32,n,a);break;case 12:h=y.binary(l.BinaryOp.SubF64,n,a);break;default:assert(!1),h=y.unreachable()}break;case d.Token.ASTERISK_EQUALS:g=!0;case d.Token.ASTERISK:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.MUL)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(g)n=this.ensureSmallIntegerWrap(n,i),a=this.compileExpression(T,i,1);else{if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"*",i.toString(),s.toString()),this.currentType=t,y.unreachable();n=this.convertExpression(n,i,i=o,!1,!1,f),a=this.convertExpression(a,s,s=o,!1,!1,T)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:h=y.binary(l.BinaryOp.MulI32,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.MulI64:l.BinaryOp.MulI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.MulI64,n,a);break;case 11:h=y.binary(l.BinaryOp.MulF32,n,a);break;case 12:h=y.binary(l.BinaryOp.MulF64,n,a);break;default:assert(!1),h=y.unreachable()}break;case d.Token.ASTERISK_ASTERISK_EQUALS:g=!0;case d.Token.ASTERISK_ASTERISK:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.POW)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}var v=void 0;if(11==this.currentType.kind){if(a=this.compileExpression(T,m.Type.f32,1),s=this.currentType,!(v=this.f32PowInstance)){if(!(b=this.program.lookupGlobal(u.CommonSymbols.Mathf))){this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf"),h=y.unreachable();break}if(!(I=b.members?b.members.get(u.CommonSymbols.pow):null)){this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf.pow"),h=y.unreachable();break}assert(I.kind==p.ElementKind.FUNCTION_PROTOTYPE),this.f32PowInstance=v=this.resolver.resolveFunction(I,null)}}else if(n=this.convertExpression(n,this.currentType,m.Type.f64,!1,!1,f),i=this.currentType,a=this.compileExpression(T,m.Type.f64,1),s=this.currentType,!(v=this.f64PowInstance)){if(!(b=this.program.lookupGlobal(u.CommonSymbols.Math))){this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,"Math"),h=y.unreachable();break}if(!(I=b.members?b.members.get(u.CommonSymbols.pow):null)){this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,"Math.pow"),h=y.unreachable();break}assert(I.kind==p.ElementKind.FUNCTION_PROTOTYPE),this.f64PowInstance=v=this.resolver.resolveFunction(I,null)}h=v&&this.compileFunction(v)?this.makeCallDirect(v,[n,a],e):y.unreachable();break;case d.Token.SLASH_EQUALS:g=!0;case d.Token.SLASH:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.DIV)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(g)n=this.ensureSmallIntegerWrap(n,i),a=this.compileExpression(T,i,1),s=this.currentType;else{if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"/",i.toString(),s.toString()),this.currentType=t,y.unreachable();n=this.convertExpression(n,i,i=o,!1,!0,f),a=this.convertExpression(a,s,s=o,!1,!0,T)}switch(this.currentType.kind){case 0:case 1:case 2:h=y.binary(l.BinaryOp.DivI32,n,a);break;case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.DivI64:l.BinaryOp.DivI32,n,a);break;case 3:h=y.binary(l.BinaryOp.DivI64,n,a);break;case 5:case 6:case 10:case 7:h=y.binary(l.BinaryOp.DivU32,n,a);break;case 9:h=y.binary(this.options.isWasm64?l.BinaryOp.DivU64:l.BinaryOp.DivU32,n,a);break;case 8:h=y.binary(l.BinaryOp.DivU64,n,a);break;case 11:h=y.binary(l.BinaryOp.DivF32,n,a);break;case 12:h=y.binary(l.BinaryOp.DivF64,n,a);break;default:assert(!1),h=y.unreachable()}break;case d.Token.PERCENT_EQUALS:g=!0;case d.Token.PERCENT:if(n=this.compileExpressionRetainType(f,t),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.REM)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(g)n=this.ensureSmallIntegerWrap(n,i),a=this.compileExpression(T,i,1),s=this.currentType;else{if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"%",i.toString(),s.toString()),this.currentType=t,y.unreachable();n=this.convertExpression(n,i,i=o,!1,!0,f),a=this.convertExpression(a,s,s=o,!1,!0,T)}switch(this.currentType.kind){case 0:case 1:case 2:h=y.binary(l.BinaryOp.RemI32,n,a);break;case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.RemI64:l.BinaryOp.RemI32,n,a);break;case 3:h=y.binary(l.BinaryOp.RemI64,n,a);break;case 5:case 6:case 10:case 7:h=y.binary(l.BinaryOp.RemU32,n,a);break;case 9:h=y.binary(this.options.isWasm64?l.BinaryOp.RemU64:l.BinaryOp.RemU32,n,a);break;case 8:h=y.binary(l.BinaryOp.RemU64,n,a);break;case 11:if(!(v=this.f32ModInstance)){if(!(b=this.program.lookupGlobal(u.CommonSymbols.Mathf))){this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf"),h=y.unreachable();break}if(!(I=b.members?b.members.get(u.CommonSymbols.mod):null)){this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf.mod"),h=y.unreachable();break}assert(I.kind==p.ElementKind.FUNCTION_PROTOTYPE),this.f32ModInstance=v=this.resolver.resolveFunction(I,null)}h=v&&this.compileFunction(v)?this.makeCallDirect(v,[n,a],e):y.unreachable();break;case 12:if(!(v=this.f64ModInstance)){var b,I;if(!(b=this.program.lookupGlobal(u.CommonSymbols.Math))){this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,"Math"),h=y.unreachable();break}if(!(I=b.members?b.members.get(u.CommonSymbols.mod):null)){this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,"Math.mod"),h=y.unreachable();break}assert(I.kind==p.ElementKind.FUNCTION_PROTOTYPE),this.f64ModInstance=v=this.resolver.resolveFunction(I,null)}h=v&&this.compileFunction(v)?this.makeCallDirect(v,[n,a],e):y.unreachable();break;default:assert(!1),h=y.unreachable()}break;case d.Token.LESSTHAN_LESSTHAN_EQUALS:g=!0;case d.Token.LESSTHAN_LESSTHAN:if(n=this.compileExpressionRetainType(f,t.intType),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.BITWISE_SHL)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}switch(a=this.compileExpression(T,i,1),s=this.currentType,this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:h=y.binary(l.BinaryOp.ShlI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.ShlI64,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.ShlI64:l.BinaryOp.ShlI32,n,a);break;case 11:case 12:return this.error(c.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,d.operatorTokenToString(e.operator),this.currentType.toString()),y.unreachable();default:assert(!1),h=y.unreachable()}break;case d.Token.GREATERTHAN_GREATERTHAN_EQUALS:g=!0;case d.Token.GREATERTHAN_GREATERTHAN:if(n=this.compileExpressionRetainType(f,t.intType),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.BITWISE_SHR)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}switch(n=this.ensureSmallIntegerWrap(n,i),a=this.compileExpression(T,i,1),s=this.currentType,this.currentType.kind){case 0:case 1:case 2:h=y.binary(l.BinaryOp.ShrI32,n,a);break;case 3:h=y.binary(l.BinaryOp.ShrI64,n,a);break;case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.ShrI64:l.BinaryOp.ShrI32,n,a);break;case 5:case 6:case 10:case 7:h=y.binary(l.BinaryOp.ShrU32,n,a);break;case 8:h=y.binary(l.BinaryOp.ShrU64,n,a);break;case 9:h=y.binary(this.options.isWasm64?l.BinaryOp.ShrU64:l.BinaryOp.ShrU32,n,a);break;case 11:case 12:return this.error(c.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,d.operatorTokenToString(e.operator),this.currentType.toString()),y.unreachable();default:assert(!1),h=y.unreachable()}break;case d.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:g=!0;case d.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:if(n=this.compileExpressionRetainType(f,t.intType),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.BITWISE_SHR_U)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}switch(n=this.ensureSmallIntegerWrap(n,i),a=this.compileExpression(T,i,1),s=this.currentType,this.currentType.kind){case 5:case 6:case 10:h=y.binary(l.BinaryOp.ShrU32,n,a);case 0:case 1:case 2:case 7:h=y.binary(l.BinaryOp.ShrU32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.ShrU64,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.ShrU64:l.BinaryOp.ShrU32,n,a);break;case 11:case 12:return this.error(c.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,d.operatorTokenToString(e.operator),this.currentType.toString()),y.unreachable();default:assert(!1),h=y.unreachable()}break;case d.Token.AMPERSAND_EQUALS:g=!0;case d.Token.AMPERSAND:if(n=this.compileExpressionRetainType(f,t.intType),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.BITWISE_AND)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(g)a=this.compileExpression(T,i,1),s=this.currentType;else{if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"&",i.toString(),s.toString()),this.currentType=t,y.unreachable();n=this.convertExpression(n,i,i=o,!1,!1,f),a=this.convertExpression(a,s,s=o,!1,!1,T)}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 10:case 7:h=y.binary(l.BinaryOp.AndI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.AndI64,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.AndI64:l.BinaryOp.AndI32,n,a);break;case 11:case 12:return this.error(c.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,d.operatorTokenToString(e.operator),this.currentType.toString()),y.unreachable();default:assert(!1),h=y.unreachable()}break;case d.Token.BAR_EQUALS:g=!0;case d.Token.BAR:if(n=this.compileExpressionRetainType(f,t.intType),i=this.currentType,this.currentType.is(256)){if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.BITWISE_OR)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(g)a=this.compileExpression(T,i,1),s=this.currentType;else{if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"|",i.toString(),s.toString()),this.currentType=t,y.unreachable();n=this.convertExpression(n,i,i=o,!1,!1,f),a=this.convertExpression(a,s,s=o,!1,!1,T)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:h=y.binary(l.BinaryOp.OrI32,n,a);break;case 2:case 7:h=y.binary(l.BinaryOp.OrI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.OrI64,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.OrI64:l.BinaryOp.OrI32,n,a);break;case 11:case 12:return this.error(c.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,d.operatorTokenToString(e.operator),this.currentType.toString()),y.unreachable();default:assert(!1),h=y.unreachable()}break;case d.Token.CARET_EQUALS:g=!0;case d.Token.CARET:if(n=this.compileExpressionRetainType(f,t.intType),i=this.currentType,this.currentType.is(256)){var x,A;if(x=i.classReference)if(A=x.lookupOverload(p.OperatorKind.BITWISE_XOR)){h=this.compileBinaryOverload(A,f,n,T,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}if(g)a=this.compileExpression(T,i,1),s=this.currentType;else{if(a=this.compileExpressionRetainType(T,i),s=this.currentType,!(o=m.Type.commonDenominator(i,s,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"^",i.toString(),s.toString()),this.currentType=t,y.unreachable();n=this.convertExpression(n,i,i=o,!1,!1,f),a=this.convertExpression(a,s,s=o,!1,!1,T)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:h=y.binary(l.BinaryOp.XorI32,n,a);break;case 2:case 7:h=y.binary(l.BinaryOp.XorI32,n,a);break;case 3:case 8:h=y.binary(l.BinaryOp.XorI64,n,a);break;case 9:case 4:h=y.binary(this.options.isWasm64?l.BinaryOp.XorI64:l.BinaryOp.XorI32,n,a);break;case 11:case 12:return this.error(c.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,d.operatorTokenToString(e.operator),this.currentType.toString()),y.unreachable();default:assert(!1),h=y.unreachable()}break;case d.Token.AMPERSAND_AMPERSAND:var N=this.currentFlow;n=this.compileExpressionRetainType(f,t,r),i=this.currentType;var S=N.fork();if(this.currentFlow=S,S.inheritNonnullIfTrue(n),a=this.compileExpression(T,i,1|-9&r),s=i,t==m.Type.bool||t==m.Type.void)a=this.performAutoreleasesWithValue(S,a,s),S.freeScopedLocals(),this.currentFlow=N,this.currentType=m.Type.bool,h=y.if(this.makeIsTrueish(n,i),this.makeIsTrueish(a,s),y.i32(0));else if(i.isManaged){var O=this.skippedAutoreleases.has(n),C=this.skippedAutoreleases.has(a),k=N.getTempLocal(i);n=y.local_tee(k.index,n);var R=!1;O!=C?O?(a=this.makeRetain(a),C=!0):R=!0:16&r||(a=this.moveAutorelease(a,S,N));var L=new Array;O&&L.unshift(this.makeRelease(y.local_get(k.index,i.toNativeType()))),a=this.performAutoreleasesWithValue(S,a,s,L),S.freeScopedLocals(),this.currentFlow=N,h=y.if(this.makeIsTrueish(n,i),a,R?this.makeRetain(y.local_get(k.index,i.toNativeType())):y.local_get(k.index,i.toNativeType())),(O||C)&&this.skippedAutoreleases.add(h),k&&N.freeTempLocal(k)}else if(a=this.performAutoreleasesWithValue(S,a,s),S.freeScopedLocals(),this.currentFlow=N,h=y.cloneExpression(n,!0,0))h=y.if(this.makeIsTrueish(n,this.currentType),a,h);else{var F=N.getTempLocal(i);N.canOverflow(n,i)||N.setLocalFlag(F.index,_.LocalFlags.WRAPPED),N.isNonnull(n,i)&&N.setLocalFlag(F.index,_.LocalFlags.NONNULL),h=y.if(this.makeIsTrueish(y.local_tee(F.index,n),i),a,y.local_get(F.index,i.toNativeType()))}this.currentType=i;break;case d.Token.BAR_BAR:N=this.currentFlow;n=this.compileExpressionRetainType(f,t,r),i=this.currentType;S=N.fork();if(this.currentFlow=S,S.inheritNonnullIfFalse(n),a=this.compileExpression(T,i,1|r),s=i,t==m.Type.bool||t==m.Type.void)a=this.performAutoreleasesWithValue(S,a,i),S.freeScopedLocals(),this.currentFlow=N,this.currentType=m.Type.bool,h=y.if(this.makeIsTrueish(n,i),y.i32(1),this.makeIsTrueish(a,s));else if(i.isManaged){O=this.skippedAutoreleases.has(n),C=this.skippedAutoreleases.has(a),k=N.getTempLocal(i);n=y.local_tee(k.index,n);var B=!1;O!=C?O?(a=this.makeRetain(a),C=!0):B=!0:16&r||(a=this.moveAutorelease(a,S,N));L=new Array;O&&L.unshift(this.makeRelease(y.local_get(k.index,i.toNativeType()))),a=this.performAutoreleasesWithValue(S,a,s,L),S.freeScopedLocals(),this.currentFlow=N,h=y.if(this.makeIsTrueish(n,i),B?this.makeRetain(y.local_get(k.index,i.toNativeType())):y.local_get(k.index,i.toNativeType()),a),(O||C)&&this.skippedAutoreleases.add(h),k&&N.freeTempLocal(k)}else if(a=this.performAutoreleasesWithValue(S,a,s),S.freeScopedLocals(),this.currentFlow=N,h=y.cloneExpression(n,!0,0))h=y.if(this.makeIsTrueish(n,i),h,a);else{F=N.getAndFreeTempLocal(i);N.canOverflow(n,i)||N.setLocalFlag(F.index,_.LocalFlags.WRAPPED),N.isNonnull(n,i)&&N.setLocalFlag(F.index,_.LocalFlags.NONNULL),h=y.if(this.makeIsTrueish(y.local_tee(F.index,n),i),y.local_get(F.index,i.toNativeType()),a)}this.currentType=i;break;default:assert(!1),h=this.module.unreachable()}if(!g)return h;var D=this.resolver,P=this.resolver.resolveExpression(f,this.currentFlow);return P?this.makeAssignment(P,h,f,D.currentThisExpression,D.currentElementExpression,t!=m.Type.void):y.unreachable()},t.prototype.compileUnaryOverload=function(e,t,r,n){return this.makeCallDirect(e,[r],n,!1)},t.prototype.compileBinaryOverload=function(e,t,r,n,i){var a;if(e.is(u.CommonFlags.INSTANCE)){var s=assert(e.parent);assert(s.kind==p.ElementKind.CLASS),a=e.signature.parameterTypes[0]}else a=e.signature.parameterTypes[1];var o=this.compileExpression(n,a,1);return this.makeCallDirect(e,[r,o],i)},t.prototype.compileAssignment=function(e,t,r){var n=this.program.resolver,i=this.currentFlow,a=n.resolveExpression(e,i);if(!a)return this.module.unreachable();var s,o=n.currentThisExpression,l=n.currentElementExpression;switch(a.kind){case p.ElementKind.GLOBAL:if(!this.compileGlobal(a))return this.module.unreachable();case p.ElementKind.FIELD:case p.ElementKind.LOCAL:s=a.type;break;case p.ElementKind.PROPERTY_PROTOTYPE:var u=a.setterPrototype;if(!u)return this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),this.module.unreachable();if(!(_=this.resolver.resolveFunction(u,null,f.makeMap(),h.ReportMode.REPORT)))return this.module.unreachable();assert(1==_.signature.parameterTypes.length),s=_.signature.parameterTypes[0];break;case p.ElementKind.PROPERTY:var _;if(!(_=a.setterInstance))return this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),this.module.unreachable();assert(1==_.signature.parameterTypes.length),s=_.signature.parameterTypes[0];break;case p.ElementKind.CLASS:if(l){var d=i.is(16384),y=a.lookupOverload(p.OperatorKind.INDEXED_SET,d);if(!y)return a.lookupOverload(p.OperatorKind.INDEXED_GET,d)?this.error(c.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,e.range,a.internalName):this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,a.internalName),this.module.unreachable();assert(2==y.signature.parameterTypes.length),s=y.signature.parameterTypes[1];break}default:return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()}return assert(s!=m.Type.void),this.makeAssignment(a,this.compileExpression(t,s,17),e,o,l,r!=m.Type.void)},t.prototype.makeAssignment=function(e,t,r,n,i,a){var s=this.module,o=this.currentFlow;switch(e.kind){case p.ElementKind.LOCAL:return o.isLocalFlag(e.index,_.LocalFlags.CONSTANT,!0)?(this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,r.range,e.internalName),this.currentType=a?e.type:m.Type.void,s.unreachable()):this.makeLocalAssignment(e,t,a);case p.ElementKind.GLOBAL:return this.compileGlobal(e)?e.isAny(u.CommonFlags.CONST|u.CommonFlags.READONLY)?(this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,r.range,e.internalName),this.currentType=a?e.type:m.Type.void,s.unreachable()):this.makeGlobalAssignment(e,t,a):s.unreachable();case p.ElementKind.FIELD:var l=e.initializerNode;return!e.is(u.CommonFlags.READONLY)||o.actualFunction.is(u.CommonFlags.CONSTRUCTOR)||l?this.makeFieldAssignment(e,t,this.compileExpressionRetainType(assert(n),this.options.usizeType),a):(this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,r.range,e.internalName),s.unreachable());case p.ElementKind.PROPERTY_PROTOTYPE:this.skippedAutoreleases.has(t)&&(t=this.makeAutorelease(t,o));var d=e.setterPrototype;if(!d)return this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,r.range,e.internalName),s.unreachable();if(!(g=this.resolver.resolveFunction(d,null,f.makeMap(),h.ReportMode.REPORT)))return s.unreachable();if(!a)return this.makeCallDirect(g,[t],r);var y=assert(e.getterPrototype);if(!(v=this.resolver.resolveFunction(y,null,f.makeMap(),h.ReportMode.REPORT)))return s.unreachable();var T=(R=v.signature.returnType).toNativeType();return s.block(null,[this.makeCallDirect(g,[t],r),this.makeCallDirect(v,null,r)],T);case p.ElementKind.PROPERTY:var g;if(this.skippedAutoreleases.has(t)&&(t=this.makeAutorelease(t,o)),!(g=e.setterInstance))return this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,r.range,e.internalName),s.unreachable();if(!a){var E=this.compileExpressionRetainType(assert(n),this.options.usizeType);return this.makeCallDirect(g,[E,t],r)}T=(R=(v=assert(e.getterInstance)).signature.returnType).toNativeType();var v,b=this.compileExpressionRetainType(assert(n),this.options.usizeType),I=o.getAndFreeTempLocal(R).index;return s.block(null,[this.makeCallDirect(g,[s.local_tee(I,b),t],r),this.makeCallDirect(v,[s.local_get(I,T)],r)],T);case p.ElementKind.CLASS:if(this.skippedAutoreleases.has(t)&&(t=this.makeAutorelease(t,o)),i){var x=o.is(16384),A=e.lookupOverload(p.OperatorKind.INDEXED_GET,x);if(!A)return this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,r.range,e.internalName),s.unreachable();var N=e.lookupOverload(p.OperatorKind.INDEXED_SET,x);if(!N)return this.error(c.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,r.range,e.internalName),this.currentType=a?A.signature.returnType:m.Type.void,s.unreachable();var S=e.type,O=(b=this.compileExpressionRetainType(assert(n),this.options.usizeType),this.compileExpression(i,m.Type.i32,1));if(a){var C=o.getTempLocal(S),k=o.getAndFreeTempLocal(this.currentType),R=A.signature.returnType;return o.freeTempLocal(C),s.block(null,[this.makeCallDirect(N,[s.local_tee(C.index,b),s.local_tee(k.index,O),t],r),this.makeCallDirect(A,[s.local_get(C.index,C.type.toNativeType()),s.local_get(k.index,k.type.toNativeType())],r)],R.toNativeType())}return this.makeCallDirect(N,[b,O,t],r)}}return this.error(c.DiagnosticCode.Operation_not_supported,r.range),s.unreachable()},t.prototype.makeLocalAssignment=function(e,t,r){var n=e.type;assert(n!=m.Type.void);var i=this.currentFlow,a=e.index;if(n.is(512)&&(i.isNonnull(t,n)?i.setLocalFlag(a,_.LocalFlags.NONNULL):i.unsetLocalFlag(a,_.LocalFlags.NONNULL)),i.setLocalFlag(a,_.LocalFlags.WRITTENTO),n.isManaged){var s=this.module,o=n.toNativeType();return i.isAnyLocalFlag(a,_.LocalFlags.ANY_RETAINED)?this.skippedAutoreleases.has(t)?(t=this.makeSkippedRelease(s.local_get(a,o),t),r?(this.currentType=n,s.local_tee(a,t)):(this.currentType=m.Type.void,s.local_set(a,t))):(t=this.makeRetainRelease(s.local_get(a,o),t),r?(this.currentType=n,s.local_tee(a,t)):(this.currentType=m.Type.void,s.local_set(a,t))):(i.unsetLocalFlag(a,_.LocalFlags.CONDITIONALLY_RETAINED),i.setLocalFlag(a,_.LocalFlags.RETAINED),this.skippedAutoreleases.has(t)||(t=this.makeRetain(t)),r?(this.currentType=n,s.local_tee(a,t)):(this.currentType=m.Type.void,s.local_set(a,t)))}return n.is(36)&&(i.canOverflow(t,n)?i.unsetLocalFlag(a,_.LocalFlags.WRAPPED):i.setLocalFlag(a,_.LocalFlags.WRAPPED)),r?(this.currentType=n,this.module.local_tee(a,t)):(this.currentType=m.Type.void,this.module.local_set(a,t))},t.prototype.makeGlobalAssignment=function(e,t,r){var n=this.module,i=e.type;assert(i!=m.Type.void);var a=i.toNativeType();return i.isManaged?this.skippedAutoreleases.has(t)?r?(this.currentType=i,n.block(null,[n.global_set(e.internalName,this.makeSkippedRelease(n.global_get(e.internalName,a),t)),n.global_get(e.internalName,a)],a)):(this.currentType=m.Type.void,n.global_set(e.internalName,this.makeSkippedRelease(n.global_get(e.internalName,a),t))):r?(this.currentType=i,n.block(null,[n.global_set(e.internalName,this.makeRetainRelease(n.global_get(e.internalName,a),t)),n.global_get(e.internalName,a)],a)):(this.currentType=m.Type.void,n.global_set(e.internalName,this.makeRetainRelease(n.global_get(e.internalName,a),t))):(t=this.ensureSmallIntegerWrap(t,i),r?(this.currentType=i,n.block(null,[n.global_set(e.internalName,t),n.global_get(e.internalName,a)],a)):(this.currentType=m.Type.void,n.global_set(e.internalName,t)))},t.prototype.makeFieldAssignment=function(e,t,r,n){var i=this.module,a=this.currentFlow,s=e.type,o=s.toNativeType();assert(e.parent.kind==p.ElementKind.CLASS);var c=e.parent.type,l=c.toNativeType();if(s.isManaged&&c.isManaged){var u=a.getTempLocal(c);if(this.skippedAutoreleases.has(t)){if(n){var h=a.getAndFreeTempLocal(s);return a.canOverflow(t,s)||a.setLocalFlag(h.index,_.LocalFlags.WRAPPED),a.isNonnull(t,s)&&a.setLocalFlag(h.index,_.LocalFlags.NONNULL),a.freeTempLocal(u),this.currentType=s,i.block(null,[i.store(s.byteSize,i.local_tee(u.index,r),this.makeSkippedRelease(i.load(s.byteSize,s.is(1),i.local_get(u.index,l),o,e.memoryOffset),i.local_tee(h.index,t)),o,e.memoryOffset),i.local_get(h.index,o)],o)}return a.freeTempLocal(u),this.currentType=m.Type.void,i.store(s.byteSize,i.local_tee(u.index,r),this.makeSkippedRelease(i.load(s.byteSize,s.is(1),i.local_get(u.index,l),o,e.memoryOffset),t),o,e.memoryOffset)}if(n){h=a.getAndFreeTempLocal(s);return a.canOverflow(t,s)||a.setLocalFlag(h.index,_.LocalFlags.WRAPPED),a.isNonnull(t,s)&&a.setLocalFlag(h.index,_.LocalFlags.NONNULL),a.freeTempLocal(u),this.currentType=s,i.block(null,[i.store(s.byteSize,i.local_tee(u.index,r),this.makeRetainRelease(i.load(s.byteSize,s.is(1),i.local_get(u.index,l),o,e.memoryOffset),i.local_tee(h.index,t)),o,e.memoryOffset),i.local_get(h.index,o)],o)}return a.freeTempLocal(u),this.currentType=m.Type.void,i.store(s.byteSize,i.local_tee(u.index,r),this.makeRetainRelease(i.load(s.byteSize,s.is(1),i.local_get(u.index,l),o,e.memoryOffset),t),o,e.memoryOffset)}if(n){h=a.getAndFreeTempLocal(s);return a.canOverflow(t,s)||a.setLocalFlag(h.index,_.LocalFlags.WRAPPED),a.isNonnull(t,s)&&a.setLocalFlag(h.index,_.LocalFlags.NONNULL),this.currentType=s,i.block(null,[i.store(s.byteSize,r,i.local_tee(h.index,t),o,e.memoryOffset),i.local_get(h.index,o)],o)}return this.currentType=m.Type.void,i.store(s.byteSize,r,t,o,e.memoryOffset)},t.prototype.compileCallExpression=function(e,t,r){var n=this.module,i=this.currentFlow;if(e.expression.kind==y.NodeKind.SUPER){var a=this.currentFlow,s=a.actualFunction;if(!s.is(u.CommonFlags.CONSTRUCTOR))return this.error(c.DiagnosticCode.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors,e.range),n.unreachable();var o=assert(s.parent);assert(o.kind==p.ElementKind.CLASS);var _=assert(o.base),h=assert(a.lookupLocal(u.CommonSymbols.this_)),d=this.options.nativeSizeType,T=this.compileCallDirect(this.ensureConstructor(_,e),e.arguments,e,n.if(n.local_get(h.index,d),n.local_get(h.index,d),this.makeRetain(this.makeAllocation(o))),16);assert(this.skippedAutoreleases.has(T));var g=[n.local_set(h.index,T)];return this.makeFieldInitialization(o,g),a.isAny(4160)?(this.error(c.DiagnosticCode._super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class,e.range),n.unreachable()):(a.set(192),this.currentType=m.Type.void,n.block(null,g))}var E,v,b=this.resolver.resolveExpression(e.expression,i);if(!b)return n.unreachable();switch(b.kind){case p.ElementKind.FUNCTION_PROTOTYPE:var I=b,x=e.typeArguments;if(I.hasDecorator(p.DecoratorFlags.BUILTIN))return this.compileCallExpressionBuiltin(I,e,t);var A=null;if(x){if(!I.is(u.CommonFlags.GENERIC))return this.error(c.DiagnosticCode.Type_0_is_not_generic,e.expression.range,I.internalName),n.unreachable();A=this.resolver.resolveFunctionInclTypeArguments(I,x,i.actualFunction.parent,f.makeMap(i.contextualTypeArguments),e)}else{if(I.is(u.CommonFlags.GENERIC)){for(var N=new Map,S=assert(I.typeParameterNodes),O=S.length,C=0;C<O;++C)N.set(S[C].name.text,null);var k=I.signatureNode.parameters,R=k.length,L=e.arguments,F=L.length,B=new Array(F);for(C=0;C<R;++C){var D=k[C].type,P=D.kind!=y.NodeKind.TYPE||D.name.next?null:D.name.identifier.text,w=C<F?L[C]:k[C].initializer;if(!w)return this.error(c.DiagnosticCode.Expected_0_arguments_but_got_1,e.range,R.toString(10),F.toString(10)),n.unreachable();if(null!==P&&N.has(P)){if(G=N.get(P)){B[C]=this.compileExpressionRetainType(w,G);var U=void 0;if(!(U=m.Type.commonDenominator(G,this.currentType,!0))&&!(U=m.Type.commonDenominator(G,this.currentType,!1)))return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,k[C].type.range,this.currentType.toString(),G.toString()),n.unreachable();G=U}else B[C]=this.compileExpressionRetainType(w,m.Type.i32),G=this.currentType;N.set(P,G)}else{var M=this.resolver.resolveType(k[C].type,i.actualFunction,i.contextualTypeArguments);if(!M)return n.unreachable();B[C]=this.compileExpression(w,M,1)}}var V=new Array(O);for(C=0;C<O;++C){var G=assert(N.get(S[C].name.text));V[C]=G}return(A=this.resolver.resolveFunction(I,V,f.makeMap(i.contextualTypeArguments)))?this.makeCallDirect(A,B,e,t==m.Type.void):this.module.unreachable()}A=this.resolver.resolveFunction(I,null)}if(!A)return this.module.unreachable();var K=0;return A.is(u.CommonFlags.INSTANCE)&&(K=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType)),this.compileCallDirect(A,e.arguments,e,K,r);case p.ElementKind.LOCAL:if(E=b.type.signatureReference){v=b.is(u.CommonFlags.INLINED)?n.i32(i64_low(b.constantIntegerValue)):n.local_get(b.index,l.NativeType.I32);break}return this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,b.type.toString()),n.unreachable();case p.ElementKind.GLOBAL:if(E=b.type.signatureReference){v=n.global_get(b.internalName,b.type.toNativeType());break}return this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,b.type.toString()),n.unreachable();case p.ElementKind.FIELD:var z=b.type;if(E=z.signatureReference){var Y=assert(this.resolver.currentThisExpression);K=this.compileExpressionRetainType(Y,this.options.usizeType);v=n.load(4,!1,K,l.NativeType.I32,b.memoryOffset);break}return this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,z.toString()),n.unreachable();case p.ElementKind.FUNCTION_TARGET:E=b.signature,v=this.compileExpression(e.expression,b.type,1);break;case p.ElementKind.PROPERTY_PROTOTYPE:var H=assert(b.getterPrototype);if(!(W=this.resolver.resolveFunction(H,null)))return n.unreachable();if(v=this.compileCallDirect(W,[],e.expression),!(E=this.currentType.signatureReference))return this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,this.currentType.toString()),n.unreachable();break;case p.ElementKind.PROPERTY:var W=assert(b.getterInstance);if(v=this.compileCallDirect(W,[],e.expression,this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType)),!(E=this.currentType.signatureReference))return this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,this.currentType.toString()),n.unreachable();break;default:return this.error(c.DiagnosticCode.Operation_not_supported,e.range),n.unreachable()}return this.compileCallIndirect(E,v,e.arguments,e,0,t==m.Type.void)},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(c.DiagnosticCode.Type_0_is_not_generic,t.range,e.internalName),n=this.resolver.resolveTypeArguments(assert(i),a,this.currentFlow.actualFunction.parent,f.makeMap(this.currentFlow.contextualTypeArguments),t));var s=o.compileCall(this,e,n,t.arguments,r,t);return s||(this.error(c.DiagnosticCode.Operation_not_supported,t.range),this.module.unreachable())},t.prototype.checkCallSignature=function(e,t,r,n){if(r!=(null!=e.thisType))return this.error(c.DiagnosticCode.Operation_not_supported,n.range),!1;var i=e.hasRest;if(i)return this.error(c.DiagnosticCode.Operation_not_supported,n.range),!1;var a=e.requiredParameters,s=e.parameterTypes.length;return t<a?(this.error(a<s?c.DiagnosticCode.Expected_at_least_0_arguments_but_got_1:c.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,a.toString(),t.toString()),!1):!(t>s&&!i)||(this.error(c.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,s.toString(),t.toString()),!1)},t.prototype.compileCallDirect=function(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=0);var a=t.length,s=e.signature;if(!this.checkCallSignature(s,a,0!=n,r))return this.currentType=s.returnType,this.module.unreachable();if(e.hasDecorator(p.DecoratorFlags.INLINE)){if(assert(!e.is(u.CommonFlags.TRAMPOLINE)),!this.currentInlineFunctions.includes(e)){this.currentInlineFunctions.push(e);var o=s.parameterTypes;assert(a<=o.length);for(var l=new Array(a),_=0;_<a;++_)l[_]=this.compileExpression(t[_],o[_],17);var h=this.makeCallInline(e,l,n,0!=(8&i));return this.currentType.isManaged&&(16&i?this.skippedAutoreleases.add(h):h=this.makeAutorelease(h,this.currentFlow)),this.currentInlineFunctions.pop(),h}this.warning(c.DiagnosticCode.Function_0_cannot_be_inlined_into_itself,r.range,e.internalName)}var d=n?a+1:a,y=new Array(d),m=0;n&&(y[0]=n,m=1);var f=s.parameterTypes;for(_=0;_<a;++_,++m)y[m]=this.compileExpression(t[_],f[_],1);if(assert(m==d),s.returnType.isManaged){if(8&i)return this.makeCallDirect(e,y,r,!0);if(16&i){h=this.makeCallDirect(e,y,r,!1,!0);return this.skippedAutoreleases.add(h),h}return this.makeCallDirect(e,y,r,!1,!1)}return this.makeCallDirect(e,y,r,0!=(8&i))},t.prototype.makeCallInline=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=!1);for(var i=this.module,a=t?t.length:0,s=e.signature,o=s.parameterTypes,c=o.length,l=this.currentFlow,h=_.Flow.createInline(l.parentFunction,e),d=[],y=new Set,f=a-1;f>=0;--f){var T=t[f],g=o[f],E=h.addScopedLocal(s.getParameterName(f),g,y);_.findUsedLocals(T,y),l.canOverflow(T,g)||h.setLocalFlag(E.index,_.LocalFlags.WRAPPED),h.isNonnull(T,g)&&h.setLocalFlag(E.index,_.LocalFlags.NONNULL),g.isManaged&&(this.skippedAutoreleases.has(T)||(T=this.makeRetain(T)),h.setLocalFlag(E.index,_.LocalFlags.RETAINED)),d.unshift(i.local_set(E.index,T))}if(r){var v=assert(e.parent);assert(v.kind==p.ElementKind.CLASS);var b=assert(e.signature.thisType),I=h.addScopedLocal(u.CommonSymbols.this_,b,y);d.unshift(i.local_set(I.index,r));var x=v.base;x&&h.addScopedAlias(u.CommonSymbols.super_,x.type,I.index)}else assert(!e.signature.thisType);this.currentFlow=h;for(f=a;f<c;++f){var A=o[f],N=this.compileExpression(assert(e.prototype.signatureNode.parameters[f].initializer),A,1);E=h.addScopedLocal(s.getParameterName(f),A);h.canOverflow(N,A)||h.setLocalFlag(E.index,_.LocalFlags.WRAPPED),h.isNonnull(N,A)&&h.setLocalFlag(E.index,_.LocalFlags.NONNULL),A.isManaged?(h.setLocalFlag(E.index,_.LocalFlags.RETAINED),d.push(i.local_set(E.index,this.makeRetain(N)))):d.push(i.local_set(E.index,N))}this.compileFunctionBody(e,d),h.isAny(57)||(this.performAutoreleases(h,d),this.finishAutoreleases(h,d)),h.freeScopedLocals();var S=h.returnType;this.currentFlow=l;var O=i.block(h.inlineReturnLabel,d,S.toNativeType());return this.currentType=S,S.isManaged&&n&&(O=this.makeRelease(O),this.currentType=m.Type.void),O},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,s=r.returnType,_=r.thisType,h=e.is(u.CommonFlags.INSTANCE),d=r.requiredParameters,y=d,f=i.length,T=f;h&&(++y,++T);var g=assert(T-y),E=new Array(y),v=0,b=this.module;h&&(E[0]=b.local_get(0,this.options.nativeSizeType),v=1);for(var I=0;I<d;++I,++v)E[v]=b.local_get(v,i[I].toNativeType());assert(v==y);var x=new m.Signature(i,s,_);x.requiredParameters=f,x.parameterNames=r.parameterNames,(t=new p.Function(e.name+"|trampoline",e.prototype,x,e.contextualTypeArguments)).set(e.flags|u.CommonFlags.TRAMPOLINE|u.CommonFlags.COMPILED),e.trampoline=t;var A=this.currentFlow,N=t.flow;this.currentFlow=N;var S=g+1,O=new Array(S),C="of"+g.toString(10);for(I=0;I<S;++I){var k=I.toString(10)+C;O[I]=k}var R=b.block(O[0],[b.block("outOfRange",[b.switch(O,"outOfRange",d?b.binary(l.BinaryOp.SubI32,b.global_get(o.BuiltinSymbols.argc,l.NativeType.I32),b.i32(d)):b.global_get(o.BuiltinSymbols.argc,l.NativeType.I32))]),b.unreachable()]);for(I=0;I<g;++I,++v){var L=i[d+I],F=a[d+I],B=F.initializer,D=void 0;B?D=b.local_set(v,this.compileExpression(B,L,1)):(this.error(c.DiagnosticCode.Optional_parameter_must_have_an_initializer,F.range),D=b.unreachable()),R=b.block(O[I+1],[R,D]),E[v]=b.local_get(v,L.toNativeType())}assert(v==T);var P=[R],w=b.call(n,E,s.toNativeType());s!=m.Type.void?this.performAutoreleasesWithValue(N,w,s,P):(P.push(w),this.performAutoreleases(N,P)),N.freeScopedLocals(),this.currentFlow=A;var U=b.addFunction(t.internalName,this.ensureFunctionType(x.parameterTypes,s,_),m.typesToNativeTypes(t.additionalLocals),b.block(null,P,s.toNativeType()));return t.finalize(b,U),t},t.prototype.ensureArgcVar=function(){if(!this.argcVar){var e=this.module;this.argcVar=e.addGlobal(o.BuiltinSymbols.argc,l.NativeType.I32,!0,e.i32(0))}return o.BuiltinSymbols.argc},t.prototype.ensureArgcSet=function(){if(!this.argcSet){var e=this.module;this.argcSet=e.addFunction(o.BuiltinSymbols.setargc,this.ensureFunctionType([m.Type.u32],m.Type.void),null,e.global_set(this.ensureArgcVar(),e.local_get(0,l.NativeType.I32))),e.addFunctionExport(o.BuiltinSymbols.setargc,"__setargc")}return o.BuiltinSymbols.setargc},t.prototype.makeRetain=function(e){var t=this.program.retainInstance;return this.compileFunction(t),this.module.call(t.internalName,[e],this.options.nativeSizeType)},t.prototype.makeRetainRelease=function(e,t){var r=this.module,n=this.currentFlow,i=this.options.usizeType,a=this.options.nativeSizeType,s=n.getTempLocal(i,_.findUsedLocals(e)),o=n.getAndFreeTempLocal(i);return n.freeTempLocal(s),r.block(null,[r.if(r.binary(a==l.NativeType.I64?l.BinaryOp.NeI64:l.BinaryOp.NeI32,r.local_tee(s.index,t),r.local_tee(o.index,e)),r.block(null,[r.drop(this.makeRetain(r.local_get(s.index,a))),this.makeRelease(r.local_get(o.index,a))])),r.local_get(s.index,a)],a)},t.prototype.makeSkippedRelease=function(e,t){var r=this.module,n=this.currentFlow,i=this.options.usizeType,a=this.options.nativeSizeType,s=n.getAndFreeTempLocal(i,_.findUsedLocals(e));return r.block(null,[r.local_set(s.index,t),this.makeRelease(e),r.local_get(s.index,a)],a)},t.prototype.makeRelease=function(e){var t=this.program.releaseInstance;return this.compileFunction(t),this.module.call(t.internalName,[e],l.NativeType.None)},t.prototype.makeAutorelease=function(e,t){return void 0===t&&(t=this.currentFlow),this.module.local_tee(t.getAutoreleaseLocal(this.options.usizeType).index,e)},t.prototype.undoAutorelease=function(e,t){switch(l.getExpressionId(e)){case l.ExpressionId.LocalSet:if(l.isLocalTee(e)){var r=l.getLocalSetIndex(e);if(t.isAnyLocalFlag(r,_.LocalFlags.ANY_RETAINED))return t.unsetLocalFlag(r,_.LocalFlags.ANY_RETAINED),r}break;case l.ExpressionId.Block:if(null===l.getBlockName(e)){var n=l.getBlockChildCount(e);if(n)return this.undoAutorelease(l.getBlockChild(e,n-1),t)}}return-1},t.prototype.moveAutorelease=function(e,t,r){return~this.undoAutorelease(e,t)?this.makeAutorelease(e,r):this.makeAutorelease(this.makeRetain(e),r)},t.prototype.performAutoreleases=function(e,t,r){var n,i;void 0===r&&(r=!0);var s=e.scopedLocals;if(s){var o=this.module;try{for(var c=a(s.values()),l=c.next();!l.done;l=c.next()){var p=l.value;if(p.is(u.CommonFlags.SCOPED)){var h=p.index;e.isAnyLocalFlag(h,_.LocalFlags.ANY_RETAINED)&&(r&&e.unsetLocalFlag(h,_.LocalFlags.ANY_RETAINED),t.push(this.makeRelease(o.local_get(h,p.type.toNativeType()))))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}},t.prototype.performAutoreleasesWithValue=function(e,t,r,n,i){void 0===n&&(n=null),void 0===i&&(i=!0),n||(n=new Array),n.push(this.module.nop());var a=n.length;if(this.performAutoreleases(e,n,i),n.length>a){var s=r.toNativeType(),o=e.getAndFreeTempLocal(r);e.canOverflow(t,r)||e.setLocalFlag(o.index,_.LocalFlags.WRAPPED),e.isNonnull(t,r)&&e.setLocalFlag(o.index,_.LocalFlags.NONNULL);var c=this.module;return n[a-1]=c.local_set(o.index,t),n.push(c.local_get(o.index,s)),c.block(null,n,s)}return n.length>1?(n[a-1]=t,this.module.block(null,n,r.toNativeType())):t},t.prototype.finishAutoreleases=function(e,t){var r,n,i=this.module;if(e.is(8192)){for(var s=void 0;s=e.parent;)e=s;this.performAutoreleases(e,t,!1)}else try{for(var o=a(e.parentFunction.localsByIndex),c=o.next();!c.done;c=o.next()){var l=c.value,u=l.index;e.isAnyLocalFlag(u,_.LocalFlags.ANY_RETAINED)&&(e.unsetLocalFlag(u,_.LocalFlags.ANY_RETAINED),t.push(this.makeRelease(i.local_get(u,l.type.toNativeType()))))}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},t.prototype.makeCallDirect=function(e,t,r,n,i){void 0===n&&(n=!1),void 0===i&&(i=!1),e.hasDecorator(p.DecoratorFlags.INLINE)&&this.warning(c.DiagnosticCode.TODO_Cannot_inline_inferred_calls_and_specific_internals_yet,r.range,e.internalName);var a=t?t.length:0,s=a,o=e.signature.requiredParameters,l=e.signature.parameterTypes.length,_=l;e.is(u.CommonFlags.INSTANCE)&&(++o,++_,--s),assert(a>=o);var h=this.module;if(!this.compileFunction(e))return h.unreachable();var d=e.signature.returnType,f=e.is(u.CommonFlags.MODULE_IMPORT);if(a<_){t||((t=new Array(_)).length=0);var T=e.signature.parameterTypes,g=e.prototype.signatureNode.parameters;assert(g.length==T.length);for(var E=!0,v=s;v<l;++v){var b=g[v].initializer;if(b){if(y.nodeIsConstantValue(b.kind)){t.push(this.compileExpression(g[v].initializer,T[v],1));continue}var I=this.resolver.resolveExpression(b,e.flow,T[v]);if(I&&I.kind==p.ElementKind.GLOBAL){var x=I;if(this.compileGlobal(x)){x.is(u.CommonFlags.INLINED)?t.push(this.compileInlineConstant(x,T[v],1)):t.push(this.convertExpression(h.global_get(x.internalName,x.type.toNativeType()),x.type,T[v],!1,!1,b));continue}}}t.push(T[v].toNativeZero(h)),E=!1}if(!E&&!f){var A=e;if(e=this.ensureTrampoline(e),!this.compileFunction(e))return h.unreachable();e.flow.flags=A.flow.flags;var N=d.toNativeType(),S=h.call(e.internalName,t,N);return this.currentType=d,d.isManaged&&(n?(S=this.makeRelease(S),this.currentType=m.Type.void):i?this.skippedAutoreleases.add(S):S=this.makeAutorelease(S)),h.block(null,[h.global_set(this.ensureArgcVar(),h.i32(s)),S],this.currentType.toNativeType())}}var O=h.call(e.internalName,t,d.toNativeType());return this.currentType=d,d.isManaged&&(n?(O=this.makeRelease(O),this.currentType=m.Type.void):i||(O=this.makeAutorelease(O))),O},t.prototype.compileCallIndirect=function(e,t,r,n,i,a){void 0===i&&(i=0),void 0===a&&(a=!1);var s=r.length;if(!this.checkCallSignature(e,s,0!=i,n))return this.module.unreachable();var o=i?s+1:s,c=new Array(o),l=0;i&&(c[0]=i,l=1);for(var u=e.parameterTypes,p=0;p<s;++p,++l)c[l]=this.compileExpression(r[p],u[p],1);return assert(l==o),this.makeCallIndirect(e,t,c,a)},t.prototype.makeCallIndirect=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=!1);var i=r?r.length:0,a=i,s=e.requiredParameters,o=e.parameterTypes.length,c=o;e.thisType&&(++s,++c,--a),assert(i>=s),this.ensureFunctionType(e.parameterTypes,e.returnType,e.thisType);var l=this.module;if(i<c){r||((r=new Array(c)).length=0);for(var u=e.parameterTypes,p=a;p<o;++p)r.push(u[p].toNativeZero(l))}var _=e.returnType,h=l.call_indirect(t,r,e.toSignatureString());return this.currentType=_,_.isManaged&&(n?(h=this.makeRelease(h),this.currentType=m.Type.void):h=this.makeAutorelease(h)),l.block(null,[l.global_set(this.ensureArgcVar(),l.i32(a)),h],this.currentType.toNativeType())},t.prototype.compileCommaExpression=function(e,t,r){for(var n=e.expressions,i=n.length,a=new Array(i--),s=0;s<i;++s)a[s]=this.compileExpression(n[s],m.Type.void,9);return a[i]=this.compileExpression(n[i],t,r),this.module.block(null,a,this.currentType.toNativeType())},t.prototype.compileElementAccessExpression=function(e,t,r){var n=this.resolver.resolveElementAccessExpression(e,this.currentFlow,t);if(!n)return this.module.unreachable();switch(n.kind){case p.ElementKind.CLASS:var i=n.lookupOverload(p.OperatorKind.INDEXED_GET,this.currentFlow.is(16384));if(!i)return this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,e.expression.range,n.internalName),this.module.unreachable();var a=this.compileExpression(e.expression,n.type,1);return this.compileCallDirect(i,[e.elementExpression],e,a,24&r)}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()},t.prototype.compileFunctionExpression=function(e,t,r){var n=e.declaration.clone();assert(!n.typeParameters);var i,a=this.currentFlow,s=a.actualFunction,o=new p.FunctionPrototype(n.name.text.length?n.name.text:"anonymous|"+(s.nextAnonymousId++).toString(10),s,n,p.DecoratorFlags.NONE),l=f.makeMap(a.contextualTypeArguments);if(t){var u=o.signatureNode,_=u.parameters,h=_.length,d=t.parameterTypes,T=d.length;if(h>T)return this.error(c.DiagnosticCode.Expected_0_arguments_but_got_1,e.range,T.toString(),h.toString()),this.module.unreachable();for(var g=new Array(h),E=0;E<h;++E){var v=_[E];if(g[E]=v.name.text,!y.isTypeOmitted(v.type)){if(!(A=this.resolver.resolveType(v.type,s.parent,l)))return this.module.unreachable();if(!d[E].isStrictlyAssignableTo(A))return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,v.range,d[E].toString(),A.toString()),this.module.unreachable()}}var b=t.returnType;if(!y.isTypeOmitted(u.returnType)){if(!(A=this.resolver.resolveType(u.returnType,s.parent,l)))return this.module.unreachable();if(b==m.Type.void?A!=m.Type.void:!A.isStrictlyAssignableTo(b))return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,u.returnType.range,A.toString(),b.toString()),this.module.unreachable()}var I=t.thisType,x=u.explicitThisType;if(x){if(!I)return this.error(c.DiagnosticCode._this_cannot_be_referenced_in_current_location,x.range),this.module.unreachable();var A;if(!(A=this.resolver.resolveType(x,s.parent,l)))return this.module.unreachable();if(!I.isStrictlyAssignableTo(A))return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,x.range,I.toString(),A.toString()),this.module.unreachable()}var N=new m.Signature(d,b,I);if(N.requiredParameters=T,N.parameterNames=g,i=new p.Function(o.name,o,N,l),!this.compileFunction(i))return this.module.unreachable();this.currentType=t.type}else{if(!(i=this.compileFunctionUsingTypeArguments(o,[],l)))return this.module.unreachable();this.currentType=i.signature.type}var S=this.ensureFunctionTableEntry(i);return S<0?this.module.unreachable():this.module.i32(S)},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 y.NodeKind.NULL:var s=this.options;return t.classReference||(this.currentType=s.usizeType),s.isWasm64?n.i64(0):n.i32(0);case y.NodeKind.TRUE:return this.currentType=m.Type.bool,n.i32(1);case y.NodeKind.FALSE:return this.currentType=m.Type.bool,n.i32(0);case y.NodeKind.THIS:if(a.is(u.CommonFlags.INSTANCE)){var o=assert(i.lookupLocal(u.CommonSymbols.this_)),h=assert(a.parent);assert(h.kind==p.ElementKind.CLASS);var d=this.options.nativeSizeType;if(a.is(u.CommonFlags.CONSTRUCTOR)&&!i.is(64)){i.set(64);var T=[n.if(n.unary(d==l.NativeType.I64?l.UnaryOp.EqzI64:l.UnaryOp.EqzI32,n.local_get(o.index,d)),n.local_set(o.index,this.makeRetain(this.makeAllocation(h))))];return this.makeFieldInitialization(h,T),T.push(n.local_get(o.index,d)),this.currentType=o.type,n.block(null,T,d)}var g=assert(a.signature.thisType);return this.currentType=g,n.local_get(o.index,g.toNativeType())}return this.error(c.DiagnosticCode._this_cannot_be_referenced_in_current_location,e.range),this.currentType=this.options.usizeType,n.unreachable();case y.NodeKind.SUPER:var E=this.currentFlow,v=E.actualFunction;if(v.is(u.CommonFlags.CONSTRUCTOR)&&(E.is(128)||this.error(c.DiagnosticCode._super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class,e.range)),E.is(8192)){var b=E.lookupLocal(u.CommonSymbols.this_);if(b){var I=assert(b.type.classReference).base;if(I)return this.currentType=I.type,n.local_get(b.index,I.type.toNativeType())}}if(v.is(u.CommonFlags.INSTANCE)){h=assert(v.parent);assert(h.kind==p.ElementKind.CLASS);var x=h.base;if(x){var A=x.type;return this.currentType=A,n.local_get(0,A.toNativeType())}}return this.error(c.DiagnosticCode._super_can_only_be_referenced_in_a_derived_class,e.range),this.currentType=this.options.usizeType,n.unreachable()}this.maybeCompileEnclosingSource(e);var N=this.resolver.resolveIdentifier(e,i,this.currentEnum||a);if(!N)return n.unreachable();switch(N.kind){case p.ElementKind.LOCAL:var S=N.type;if(assert(S!=m.Type.void),N.is(u.CommonFlags.INLINED))return this.compileInlineConstant(N,t,r);var O=N.index;return assert(O>=0),S.is(512)&&i.isLocalFlag(O,_.LocalFlags.NONNULL,!1)&&(S=S.nonNullableType),this.currentType=S,this.module.local_get(O,S.toNativeType());case p.ElementKind.GLOBAL:if(!this.compileGlobal(N))return this.module.unreachable();S=N.type;return assert(S!=m.Type.void),N.is(u.CommonFlags.INLINED)?this.compileInlineConstant(N,t,r):(this.currentType=S,this.module.global_get(N.internalName,S.toNativeType()));case p.ElementKind.ENUMVALUE:return N.is(u.CommonFlags.COMPILED)?(this.currentType=m.Type.i32,N.is(u.CommonFlags.INLINED)?(assert(1==N.constantValueKind),this.module.i32(i64_low(N.constantIntegerValue))):this.module.global_get(N.internalName,l.NativeType.I32)):(this.error(c.DiagnosticCode.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums,e.range),this.currentType=m.Type.i32,this.module.unreachable());case p.ElementKind.FUNCTION_PROTOTYPE:var C=this.resolver.resolveFunction(N,null,f.makeMap(i.contextualTypeArguments));if(!C||!this.compileFunction(C))return n.unreachable();var k=this.ensureFunctionTableEntry(C);return this.currentType=C.signature.type,this.module.i32(k)}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.unreachable()},t.prototype.compileInstanceOfExpression=function(e,t,r){var n=this.module,i=this.compileExpressionRetainType(e.expression,this.options.usizeType),a=this.currentType,s=this.resolver.resolveType(e.isType,this.currentFlow.actualFunction);if(this.currentType=m.Type.bool,!s)return n.unreachable();if(!s.is(256))return n.block(null,[this.convertExpression(i,a,m.Type.void,0!=(2&r),!1,e.expression),n.i32(a==s?1:0)],l.NativeType.I32);if(!a.is(256))return n.block(null,[this.convertExpression(i,a,m.Type.void,0!=(2&r),!1,e.expression),n.i32(0)],l.NativeType.I32);var o=a.toNativeType();if(a.is(512)&&!s.is(512)){if(a.nonNullableType.isAssignableTo(s))return n.binary(o==l.NativeType.I64?l.BinaryOp.NeI64:l.BinaryOp.NeI32,i,a.toNativeZero(n));if(s.isAssignableTo(a)){var u=this.program;if(!a.isUnmanaged&&!s.isUnmanaged){var p=this.currentFlow.getAndFreeTempLocal(a),_=assert(u.instanceofInstance);return this.compileFunction(_),n.if(n.unary(o==l.NativeType.I64?l.UnaryOp.EqzI64:l.UnaryOp.EqzI32,n.local_tee(p.index,i)),n.i32(0),this.makeCallDirect(_,[n.local_get(p.index,o),n.i32(s.classReference.id)],e))}this.error(c.DiagnosticCode.Operation_not_supported,e.range)}}else{if(a.isAssignableTo(s))return n.block(null,[this.convertExpression(i,a,m.Type.void,0!=(2&r),!1,e.expression),n.i32(1)],l.NativeType.I32);if(s.isAssignableTo(a)){u=this.program;if(!a.isUnmanaged&&!s.isUnmanaged){p=this.currentFlow.getAndFreeTempLocal(a),_=assert(u.instanceofInstance);return this.compileFunction(_),n.if(n.unary(o==l.NativeType.I64?l.UnaryOp.EqzI64:l.UnaryOp.EqzI32,n.local_tee(p.index,i)),n.i32(0),this.makeCallDirect(_,[n.local_get(p.index,o),n.i32(s.classReference.id)],e))}this.error(c.DiagnosticCode.Operation_not_supported,e.range)}}return n.block(null,[this.convertExpression(i,a,m.Type.void,0!=(2&r),!1,e.expression),n.i32(0)],l.NativeType.I32)},t.prototype.compileLiteralExpression=function(e,t,r,n){void 0===n&&(n=!1);var i=this.module;switch(e.literalKind){case y.LiteralKind.ARRAY:assert(!n);var a=t.classReference;return a&&a.prototype==this.program.arrayPrototype?this.compileArrayLiteral(assert(a.typeArguments)[0],e.elementExpressions,!1,r,e):(this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.unreachable());case y.LiteralKind.FLOAT:var s=e.value;return n&&(s=-s),t==m.Type.f32?i.f32(s):(this.currentType=m.Type.f64,i.f64(s));case y.LiteralKind.INTEGER:var o=e.value;n&&(o=i64_sub(i64_new(0),o));var l=this.resolver.determineIntegerLiteralType(o,t);switch(this.currentType=l,l.kind){case 4:if(!this.options.isWasm64)return i.i32(i64_low(o));case 3:return i.i64(i64_low(o),i64_high(o));case 9:if(!this.options.isWasm64)return i.i32(i64_low(o));case 8:return i.i64(i64_low(o),i64_high(o));case 11:return i.f32(i64_to_f32(o));case 12:return i.f64(i64_to_f64(o));default:return i.i32(i64_low(o))}case y.LiteralKind.STRING:return assert(!n),this.compileStringLiteral(e);case y.LiteralKind.OBJECT:return assert(!n),this.compileObjectLiteral(e,t)}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.currentType=t,i.unreachable()},t.prototype.compileStringLiteral=function(e){return this.ensureStaticString(e.value)},t.prototype.compileArrayLiteral=function(e,t,r,n,i){for(var a=this.module,s=this.program,o=assert(s.arrayPrototype),u=assert(this.resolver.resolveClass(o,[e])),_=assert(s.arrayBufferInstance),h=u.type,d=this.currentFlow,y=d.getTempLocal(h),m=d.getTempLocal(_.type),f=t.length,T=new Array(f),g=!0,E=e.toNativeType(),v=0;v<f;++v){var b=t[v],I=b?a.precomputeExpression(this.compileExpression(b,e,1)):e.toNativeZero(a);l.getExpressionId(I)==l.ExpressionId.Const?assert(l.getExpressionType(I)==E):g=!1,T[v]=I}if(g){d.freeTempLocal(y),d.freeTempLocal(m);var x=s.runtimeHeaderSize,A=this.ensureStaticArrayBuffer(e,T),N=i64_add(A.offset,i64_new(x));if(64&n){var S=this.ensureStaticArrayHeader(e,A),O=i64_add(S.offset,i64_new(x));return this.currentType=h,s.options.isWasm64?this.module.i64(i64_low(O),i64_high(O)):this.module.i32(i64_low(O))}I=this.makeCallDirect(s.allocArrayInstance,[a.i32(f),s.options.isWasm64?a.i64(e.alignLog2):a.i32(e.alignLog2),a.i32(u.id),s.options.isWasm64?a.i64(i64_low(N),i64_high(N)):a.i32(i64_low(N))],i);return this.currentType=h,this.makeAutorelease(this.makeRetain(I))}if(!u.lookupOverload(p.OperatorKind.INDEXED_SET,!0))return d.freeTempLocal(y),d.freeTempLocal(m),this.error(c.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,i.range,u.internalName),this.currentType=h,a.unreachable();var C=h.toNativeType(),k=new Array;k.push(a.local_set(y.index,this.makeCallDirect(s.allocArrayInstance,[a.i32(f),s.options.isWasm64?a.i64(e.alignLog2):a.i32(e.alignLog2),a.i32(u.id),s.options.isWasm64?a.i64(0):a.i32(0)],i)));var R=assert(u.lookupInSelf("dataStart"));assert(R.kind==p.ElementKind.FIELD),k.push(a.local_set(m.index,a.load(h.byteSize,!1,a.local_get(y.index,C),C,R.memoryOffset)));for(var L=e.isManaged,F=(v=0,e.alignLog2);v<f;++v){var B=T[v];L&&(B=this.makeRetain(B)),k.push(a.store(e.byteSize,a.local_get(m.index,C),B,E,v<<F))}return k.push(a.local_get(y.index,C)),d.freeTempLocal(y),d.freeTempLocal(m),this.currentType=h,a.block(null,k,C)},t.prototype.compileObjectLiteral=function(e,t){var r=this.module,n=t.classReference;if(!n||n.is(u.CommonFlags.ABSTRACT))return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,"<object>",t.toString()),r.unreachable();var i=n.constructorInstance;if(i){if(i.signature.requiredParameters)return this.error(c.DiagnosticCode.Constructor_of_class_0_must_not_require_any_arguments,e.range,n.toString()),r.unreachable();if(i.is(u.CommonFlags.PRIVATE))return this.error(c.DiagnosticCode.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration,e.range,n.toString()),r.unreachable();if(i.is(u.CommonFlags.PROTECTED))return this.error(c.DiagnosticCode.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration,e.range,n.toString()),r.unreachable()}var a=e.names,s=a.length,o=e.values,l=n.members,_=!1,h=new Array(s+2),d=this.currentFlow.getAutoreleaseLocal(this.options.usizeType);assert(s==o.length);for(var y=0,m=s;y<m;++y){var f=l?l.get(a[y].text):null;if(f&&f.kind==p.ElementKind.FIELD){var T=f.type;h[y+1]=this.module.store(T.byteSize,this.module.local_get(d.index,this.options.nativeSizeType),this.compileExpression(o[y],f.type,1),T.toNativeType(),f.memoryOffset)}else this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,a[y].range,a[y].text,n.toString()),_=!0}return this.currentType=n.type.nonNullableType,_?r.unreachable():(h[0]=r.local_set(d.index,this.makeRetain(this.makeAllocation(n))),h[h.length-1]=r.local_get(d.index,this.options.nativeSizeType),this.currentType=n.type,r.block(null,h,this.options.nativeSizeType))},t.prototype.compileNewExpression=function(e,t,r){var n=this.module,i=this.currentFlow,a=this.resolver.resolveExpression(e.expression,i);if(!a)return n.unreachable();if(a.kind!=p.ElementKind.CLASS_PROTOTYPE)return this.error(c.DiagnosticCode.Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature,e.expression.range),this.module.unreachable();var s,o=a,l=null,_=e.typeArguments;return(l=!_&&null!==(s=t.classReference)&&s.is(u.CommonFlags.GENERIC)?this.resolver.resolveClass(o,s.typeArguments,f.makeMap(i.contextualTypeArguments)):this.resolver.resolveClassInclTypeArguments(o,_,i.actualFunction.parent,f.makeMap(i.contextualTypeArguments),e))?(t==m.Type.void&&(r|=8),this.compileInstantiate(l,e.arguments,r,e)):n.unreachable()},t.prototype.ensureConstructor=function(e,t){var r=e.constructorInstance;if(r)return r.hasDecorator(p.DecoratorFlags.INLINE)||this.compileFunction(r),r;var n=e.base;if(n){var i=this.ensureConstructor(n,t);r=new p.Function(u.CommonSymbols.constructor,new p.FunctionPrototype(u.CommonSymbols.constructor,e,i.declaration.clone()),i.signature,null)}else r=new p.Function(u.CommonSymbols.constructor,new p.FunctionPrototype(u.CommonSymbols.constructor,e,this.program.makeNativeFunctionDeclaration(u.CommonSymbols.constructor,u.CommonFlags.INSTANCE|u.CommonFlags.CONSTRUCTOR)),new m.Signature(null,e.type,e.type),null);r.internalName=e.internalName+u.INSTANCE_DELIMITER+"constructor",r.set(u.CommonFlags.COMPILED),r.prototype.setResolvedInstance("",r),e.constructorInstance=r;var a=this.currentFlow,s=r.flow;this.currentFlow=s;var o=r.signature,c=this.module,_=this.options.nativeSizeType,h=new Array;if(h.push(c.if(c.unary(_==l.NativeType.I64?l.UnaryOp.EqzI64:l.UnaryOp.EqzI32,c.local_get(0,_)),c.local_set(0,this.makeRetain(this.makeAllocation(e))))),n){var d=o.parameterTypes,y=d.length,f=new Array(1+y);f[0]=c.local_get(0,_);for(var T=0;T<y;++T)f[T+1]=c.local_get(T+1,d[T].toNativeType());h.push(c.local_set(0,this.makeCallDirect(assert(n.constructorInstance),f,t)))}this.makeFieldInitialization(e,h);var g=this.performAutoreleasesWithValue(s,c.local_get(0,_),e.type,h);s.freeScopedLocals(),this.currentFlow=a;var E=this.ensureFunctionType(o.parameterTypes,o.returnType,o.thisType),v=r.localsByIndex,b=new Array,I=1+o.parameterTypes.length,x=v.length;if(x>I)for(T=I;T<x;++T)b.push(v[T].type.toNativeType());var A=c.addFunction(r.internalName,E,b,g);return r.finalize(c,A),r},t.prototype.compileInstantiate=function(e,t,r,n){var i=this.ensureConstructor(e,n),a=this.compileCallDirect(i,t,n,this.options.usizeType.toNativeZero(this.module),r);return l.getExpressionType(a)!=l.NativeType.None&&(this.currentType=e.type),a},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.unreachable();switch(a.kind){case p.ElementKind.GLOBAL:if(!this.compileGlobal(a))return n.unreachable();var s=a.type;return assert(s!=m.Type.void),a.is(u.CommonFlags.INLINED)?this.compileInlineConstant(a,t,r):(this.currentType=s,n.global_get(a.internalName,s.toNativeType()));case p.ElementKind.ENUMVALUE:var o=assert(a.parent);return assert(o.kind==p.ElementKind.ENUM),this.compileEnum(o)?(this.currentType=m.Type.i32,a.is(u.CommonFlags.INLINED)?(assert(1==a.constantValueKind),n.i32(i64_low(a.constantIntegerValue))):n.global_get(a.internalName,l.NativeType.I32)):(this.currentType=m.Type.i32,this.module.unreachable());case p.ElementKind.FIELD:assert(a.memoryOffset>=0);var _=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType);return this.currentType=a.type,n.load(a.type.byteSize,a.type.is(5),_,a.type.toNativeType(),a.memoryOffset);case p.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.unreachable();case p.ElementKind.PROPERTY:var y=assert(a.getterInstance);return this.compileCallDirect(y,[],e,this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType));case p.ElementKind.FUNCTION_PROTOTYPE:return this.error(c.DiagnosticCode.Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set,e.range,a.name),n.unreachable()}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),n.unreachable()},t.prototype.compileTernaryExpression=function(e,t,r){var n=e.ifThen,i=e.ifElse,a=this.currentFlow,s=this.module.precomputeExpression(this.makeIsTrueish(this.compileExpressionRetainType(e.condition,m.Type.bool),this.currentType));if(l.getExpressionId(s)==l.ExpressionId.Const&&l.getExpressionType(s)==l.NativeType.I32)return l.getConstValueI32(s)?this.compileExpressionRetainType(n,t):this.compileExpressionRetainType(i,t);var o=a.fork();this.currentFlow=o;var u=this.compileExpressionRetainType(n,t,16&r),p=this.currentType,_=this.skippedAutoreleases.has(u),h=a.fork();this.currentFlow=h;var d=this.compileExpressionRetainType(i,t,16&r),y=this.currentType,f=this.skippedAutoreleases.has(d),T=m.Type.commonDenominator(p,y,!1);if(!T)return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,i.range,y.toString(),p.toString()),this.currentType=t,this.module.unreachable();u=this.convertExpression(u,p,T,!1,!1,n),d=this.convertExpression(d,y,T,!1,!1,i),this.currentType=T,_!=f?_?(d=this.makeRetain(d),f=!0):(u=this.makeRetain(u),_=!0):!_&&T.isManaged&&(u=this.moveAutorelease(u,o,a),d=this.moveAutorelease(d,h,a)),u=this.performAutoreleasesWithValue(o,u,T),o.freeScopedLocals(),d=this.performAutoreleasesWithValue(h,d,T),h.freeScopedLocals(),this.currentFlow=a,a.inheritMutual(o,h);var g=this.module.if(s,u,d);return assert(_==f),_&&this.skippedAutoreleases.add(g),g},t.prototype.compileUnaryPostfixExpression=function(e,t,r){var n=this.module,i=this.currentFlow,a=this.compileExpression(e.operand,t==m.Type.void?m.Type.i32:t,0);if(l.getExpressionId(a)==l.ExpressionId.Unreachable)return a;var s,o=null;switch(t!=m.Type.void&&(o=i.getTempLocal(this.currentType),a=n.local_tee(o.index,a)),e.operator){case d.Token.PLUS_PLUS:switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:s=n.binary(l.BinaryOp.AddI32,a,n.i32(1));break;case 9:if(this.currentType.is(256)){if(_=this.currentType.classReference)if(h=_.lookupOverload(p.OperatorKind.POSTFIX_INC)){s=this.compileUnaryOverload(h,e.operand,a,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),n.unreachable()}case 4:var u=this.options;s=n.binary(u.isWasm64?l.BinaryOp.AddI64:l.BinaryOp.AddI32,a,this.currentType.toNativeOne(n));break;case 3:case 8:s=n.binary(l.BinaryOp.AddI64,a,n.i64(1));break;case 11:s=n.binary(l.BinaryOp.AddF32,a,n.f32(1));break;case 12:s=n.binary(l.BinaryOp.AddF64,a,n.f64(1));break;default:return assert(!1),n.unreachable()}break;case d.Token.MINUS_MINUS:switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:s=n.binary(l.BinaryOp.SubI32,a,n.i32(1));break;case 9:if(this.currentType.is(256)){var _,h;if(_=this.currentType.classReference)if(h=_.lookupOverload(p.OperatorKind.POSTFIX_DEC)){s=this.compileUnaryOverload(h,e.operand,a,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),n.unreachable()}case 4:u=this.options;s=n.binary(u.isWasm64?l.BinaryOp.SubI64:l.BinaryOp.SubI32,a,this.currentType.toNativeOne(n));break;case 3:case 8:s=n.binary(l.BinaryOp.SubI64,a,n.i64(1));break;case 11:s=n.binary(l.BinaryOp.SubF32,a,n.f32(1));break;case 12:s=n.binary(l.BinaryOp.SubF64,a,n.f64(1));break;default:return assert(!1),n.unreachable()}break;default:return assert(!1),n.unreachable()}var y=this.resolver,f=y.resolveExpression(e.operand,i);if(!o)return this.currentType=m.Type.void,f?this.makeAssignment(f,s,e.operand,y.currentThisExpression,y.currentElementExpression,!1):n.unreachable();if(!f)return n.unreachable();var T=this.makeAssignment(f,s,e.operand,y.currentThisExpression,y.currentElementExpression,!1);this.currentType=o.type,i.freeTempLocal(o);var g=o.type.toNativeType();return n.block(null,[T,n.local_get(o.index,g)],g)},t.prototype.compileUnaryPrefixExpression=function(e,t,r){var n,i=this.module,a=!1;switch(e.operator){case d.Token.PLUS:if(n=this.compileExpression(e.operand,t==m.Type.void?m.Type.i32:t,0),this.currentType.is(256)){if(s=this.currentType.classReference)if(o=s.lookupOverload(p.OperatorKind.PLUS)){n=this.compileUnaryOverload(o,e.operand,n,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.unreachable()}break;case d.Token.MINUS:if(e.operand.kind==y.NodeKind.LITERAL&&(e.operand.literalKind==y.LiteralKind.INTEGER||e.operand.literalKind==y.LiteralKind.FLOAT)){n=this.compileLiteralExpression(e.operand,t,0,!0),this.options.sourceMap&&this.addDebugLocation(n,e.range);break}if(n=this.compileExpression(e.operand,t==m.Type.void?m.Type.i32:t,0),this.currentType.is(256)){if(s=this.currentType.classReference)if(o=s.lookupOverload(p.OperatorKind.MINUS)){n=this.compileUnaryOverload(o,e.operand,n,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.unreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:n=i.binary(l.BinaryOp.SubI32,i.i32(0),n);break;case 9:case 4:n=i.binary(this.options.isWasm64?l.BinaryOp.SubI64:l.BinaryOp.SubI32,this.currentType.toNativeZero(i),n);break;case 3:case 8:n=i.binary(l.BinaryOp.SubI64,i.i64(0),n);break;case 11:n=i.unary(l.UnaryOp.NegF32,n);break;case 12:n=i.unary(l.UnaryOp.NegF64,n);break;default:assert(!1),n=i.unreachable()}break;case d.Token.PLUS_PLUS:if(a=!0,n=this.compileExpression(e.operand,t==m.Type.void?m.Type.i32:t,0),this.currentType.is(256)){if(s=this.currentType.classReference)if(o=s.lookupOverload(p.OperatorKind.PREFIX_INC)){n=this.compileUnaryOverload(o,e.operand,n,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.unreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:n=i.binary(l.BinaryOp.AddI32,n,this.module.i32(1));break;case 9:case 4:n=i.binary(this.options.isWasm64?l.BinaryOp.AddI64:l.BinaryOp.AddI32,n,this.currentType.toNativeOne(i));break;case 3:case 8:n=i.binary(l.BinaryOp.AddI64,n,i.i64(1));break;case 11:n=i.binary(l.BinaryOp.AddF32,n,i.f32(1));break;case 12:n=i.binary(l.BinaryOp.AddF64,n,i.f64(1));break;default:assert(!1),n=i.unreachable()}break;case d.Token.MINUS_MINUS:if(a=!0,n=this.compileExpression(e.operand,t==m.Type.void?m.Type.i32:t,0),this.currentType.is(256)){if(s=this.currentType.classReference)if(o=s.lookupOverload(p.OperatorKind.PREFIX_DEC)){n=this.compileUnaryOverload(o,e.operand,n,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.unreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:n=i.binary(l.BinaryOp.SubI32,n,i.i32(1));break;case 9:case 4:n=i.binary(this.options.isWasm64?l.BinaryOp.SubI64:l.BinaryOp.SubI32,n,this.currentType.toNativeOne(i));break;case 3:case 8:n=i.binary(l.BinaryOp.SubI64,n,i.i64(1));break;case 11:n=i.binary(l.BinaryOp.SubF32,n,i.f32(1));break;case 12:n=i.binary(l.BinaryOp.SubF64,n,i.f64(1));break;default:assert(!1),n=i.unreachable()}break;case d.Token.EXCLAMATION:if(n=this.compileExpression(e.operand,t==m.Type.void?m.Type.i32:t,0),this.currentType.is(256))if(s=this.currentType.classReference)if(o=s.lookupOverload(p.OperatorKind.NOT)){n=this.compileUnaryOverload(o,e.operand,n,e);break}n=this.makeIsFalseish(n,this.currentType),this.currentType=m.Type.bool;break;case d.Token.TILDE:if(n=this.compileExpression(e.operand,t==m.Type.void?m.Type.i32:t.is(8)?m.Type.i64:t,0),this.currentType.is(256)){var s,o;if(s=this.currentType.classReference)if(o=s.lookupOverload(p.OperatorKind.BITWISE_NOT)){n=this.compileUnaryOverload(o,e.operand,n,e);break}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.unreachable()}switch(n=this.convertExpression(n,this.currentType,this.currentType.intType,!1,!1,e.operand),this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:n=i.binary(l.BinaryOp.XorI32,n,i.i32(-1));break;case 9:case 4:n=i.binary(this.options.isWasm64?l.BinaryOp.XorI64:l.BinaryOp.XorI32,n,this.currentType.toNativeNegOne(i));break;case 3:case 8:n=i.binary(l.BinaryOp.XorI64,n,i.i64(-1,-1));break;default:assert(!1),n=i.unreachable()}break;case d.Token.TYPEOF:return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.unreachable();default:return assert(!1),i.unreachable()}if(!a)return n;var u=this.resolver,_=u.resolveExpression(e.operand,this.currentFlow);return _?this.makeAssignment(_,n,e.operand,u.currentThisExpression,u.currentElementExpression,t!=m.Type.void):i.unreachable()},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.unary(l.UnaryOp.ExtendI8ToI32,e):r.binary(l.BinaryOp.ShrI32,r.binary(l.BinaryOp.ShlI32,e,r.i32(24)),r.i32(24)));break;case 1:n.canOverflow(e,t)&&(e=this.options.hasFeature(1)?r.unary(l.UnaryOp.ExtendI16ToI32,e):r.binary(l.BinaryOp.ShrI32,r.binary(l.BinaryOp.ShlI32,e,r.i32(16)),r.i32(16)));break;case 5:n.canOverflow(e,t)&&(e=r.binary(l.BinaryOp.AndI32,e,r.i32(255)));break;case 6:n.canOverflow(e,t)&&(e=r.binary(l.BinaryOp.AndI32,e,r.i32(65535)));break;case 10:n.canOverflow(e,t)&&(e=r.binary(l.BinaryOp.NeI32,e,r.i32(0)))}return e},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.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.unary(l.UnaryOp.EqzI32,e);case 3:case 8:return r.unary(l.UnaryOp.EqzI64,e);case 9:this.skippedAutoreleases.has(e)&&(e=this.makeAutorelease(e));case 4:return r.unary(64==t.size?l.UnaryOp.EqzI64:l.UnaryOp.EqzI32,e);case 11:return r.binary(l.BinaryOp.EqF32,e,r.f32(0));case 12:return r.binary(l.BinaryOp.EqF64,e,r.f64(0));default:return assert(!1),r.i32(1)}},t.prototype.makeIsTrueish=function(e,t){var r=this.module;switch(t.kind){case 0:case 1:case 5:case 6:e=this.ensureSmallIntegerWrap(e,t);case 10:case 2:case 7:return e;case 3:case 8:return r.binary(l.BinaryOp.NeI64,e,r.i64(0));case 9:this.skippedAutoreleases.has(e)&&(e=this.makeAutorelease(e));case 4:return 64==t.size?r.binary(l.BinaryOp.NeI64,e,r.i64(0)):e;case 11:return r.binary(l.BinaryOp.NeF32,e,r.f32(0));case 12:return r.binary(l.BinaryOp.NeF64,e,r.f64(0));default:return assert(!1),r.i32(0)}},t.prototype.makeAllocation=function(e){var t=this.program;assert(e.program==t);var r=this.module,n=this.options;this.currentType=e.type;var i=t.allocInstance;return this.compileFunction(i),r.call(i.internalName,[n.isWasm64?r.i64(e.currentMemoryOffset):r.i32(e.currentMemoryOffset),r.i32(e.hasDecorator(p.DecoratorFlags.UNMANAGED)?0:e.id)],n.nativeSizeType)},t.prototype.makeFieldInitialization=function(e,t){var r,n;void 0===t&&(t=[]);var i=e.members;if(!i)return[];var s=this.module,o=this.currentFlow,c=o.is(8192),l=c?assert(o.lookupLocal(u.CommonSymbols.this_)).index:0,_=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==p.ElementKind.FIELD&&y.parent==e){var m=y;assert(!m.isAny(u.CommonFlags.CONST));var f=m.type,T=f.toNativeType(),g=m.prototype.initializerNode;if(g){var E=this.compileExpression(g,f,17);f.isManaged&&!this.skippedAutoreleases.has(E)&&(E=this.makeRetain(E)),t.push(s.store(f.byteSize,s.local_get(l,_),E,T,m.memoryOffset))}else{var v=m.prototype.parameterIndex;t.push(s.store(f.byteSize,s.local_get(l,_),v>=0?s.local_get(c?assert(o.lookupLocal(m.name)).index:1+v,T):f.toNativeZero(s),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.makeInstanceOfClass=function(e,t){var r=this.module,n=this.currentFlow,i=n.getTempLocal(m.Type.i32),a=r.load(4,!1,r.binary(l.BinaryOp.SubI32,e,r.i32(this.program.runtimeHeaderSize)),l.NativeType.I32),s="instanceof_"+t.name+"|"+n.pushBreakLabel(),o=[];return o.push(r.drop(r.br(s,r.binary(l.BinaryOp.EqI32,r.local_tee(i.index,a),r.i32(t.id)),r.i32(1)))),o.push(r.i32(0)),n.freeTempLocal(i),n.popBreakLabel(),r.block(s,o,l.NativeType.I32)},t}(c.DiagnosticEmitter);function b(e,t){if(g=t.range.source.simplePath,E=p.mangleInternalName(e.name,e.parent,e.is(u.CommonFlags.INSTANCE),!0),e.hasDecorator(p.DecoratorFlags.EXTERNAL)){var r=e.program,n=assert(y.findDecorator(y.DecoratorKind.EXTERNAL,t.decorators)),i=n.arguments;if(i&&i.length){var a=i[0];a.kind==y.NodeKind.LITERAL&&a.literalKind==y.LiteralKind.STRING?(E=a.value,i.length>=2&&((a=i[1]).kind==y.NodeKind.LITERAL&&a.literalKind==y.LiteralKind.STRING?(g=E,E=a.value,i.length>2&&r.error(c.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,"2",i.length.toString())):r.error(c.DiagnosticCode.String_literal_expected,a.range))):r.error(c.DiagnosticCode.String_literal_expected,a.range)}else r.error(c.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,n.range,"1","0")}}function I(e,t,r){var n=t.length;return 0==n?e.nop():1==n?t[0]:e.block(null,t,r==l.NativeType.Auto?l.getExpressionType(t[n-1]):r)}t.Compiler=v,t.flatten=I},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.Mutable_value_cannot_be_inlined=206]="Mutable_value_cannot_be_inlined",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_present_to_use_0=214]="An_allocator_must_be_present_to_use_0",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._0_must_be_a_value_between_1_and_2_inclusive=222]="_0_must_be_a_value_between_1_and_2_inclusive",e[e._0_must_be_a_power_of_two=223]="_0_must_be_a_power_of_two",e[e.TODO_Cannot_inline_inferred_calls_and_specific_internals_yet=224]="TODO_Cannot_inline_inferred_calls_and_specific_internals_yet",e[e.Expression_is_never_null=225]="Expression_is_never_null",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.An_export_assignment_cannot_have_modifiers=1120]="An_export_assignment_cannot_have_modifiers",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.Object_is_possibly_null=2531]="Object_is_possibly_null",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"Mutable value cannot be inlined.";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 present to use '{0}'.";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 222:return"'{0}' must be a value between '{1}' and '{2}' inclusive.";case 223:return"'{0}' must be a power of two.";case 224:return"TODO: Cannot inline inferred calls and specific internals yet.";case 225:return"Expression is never 'null'.";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 1120:return"An export assignment cannot have modifiers.";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 2531:return"Object is possibly 'null'.";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}}}},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),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.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 s};Object.defineProperty(t,"__esModule",{value:!0});var a,s=r(11),o=r(2),c=r(5),l=r(6),u=r(4),p=r(3),_=r(10),h=r(9),d=r(0),y=r(1);function m(e,t,r,n,i,s,d){void 0===d&&(d=!1);var m=e.module,g=!1;switch(t.internalName){case a.isInteger:var S=E(e,r,n,s);return e.currentType=l.Type.bool,S?S.is(4)&&!S.is(256)?m.i32(1):m.i32(0):m.unreachable();case a.isFloat:S=E(e,r,n,s);return e.currentType=l.Type.bool,S?S.is(8)?m.i32(1):m.i32(0):m.unreachable();case a.isBoolean:S=E(e,r,n,s);return e.currentType=l.Type.bool,S?S==l.Type.bool?m.i32(1):m.i32(0):m.unreachable();case a.isSigned:S=E(e,r,n,s);return e.currentType=l.Type.bool,S?S.is(1)?m.i32(1):m.i32(0):m.unreachable();case a.isReference:S=E(e,r,n,s);return e.currentType=l.Type.bool,S?S.is(256)?m.i32(1):m.i32(0):m.unreachable();case a.isString:S=E(e,r,n,s);if(e.currentType=l.Type.bool,!S)return m.unreachable();if(B=S.classReference){var O=e.program.stringInstance;if(O&&B.isAssignableTo(O))return m.i32(1)}return m.i32(0);case a.isArray:S=E(e,r,n,s);if(e.currentType=l.Type.bool,!S)return m.unreachable();if(!(De=S.classReference))return m.i32(0);var C=De.prototype;return m.i32(C.extends(e.program.arrayPrototype)?1:0);case a.isArrayLike:S=E(e,r,n,s);return e.currentType=l.Type.bool,S?(De=S.classReference)?m.i32(De.isArrayLike?1:0):m.i32(0):m.unreachable();case a.isFunction:S=E(e,r,n,s);return e.currentType=l.Type.bool,S?m.i32(S.signatureReference?1:0):m.unreachable();case a.isNullable:S=E(e,r,n,s);return e.currentType=l.Type.bool,S?m.i32(S.is(512)?1:0):m.unreachable();case a.isDefined:if(e.currentType=l.Type.bool,x(r,s,t)|A(n,1,s,e))return m.unreachable();var k=e.resolver.resolveExpression(n[0],e.currentFlow,l.Type.void,h.ReportMode.SWALLOW);return m.i32(k?1:0);case a.isConstant:if(e.currentType=l.Type.bool,x(r,s,t)|A(n,1,s,e))return m.unreachable();var R=e.compileExpressionRetainType(n[0],l.Type.i32);return e.currentType=l.Type.bool,m.i32(u.getExpressionId(R)==u.ExpressionId.Const?1:0);case a.isManaged:S=E(e,r,n,s);return e.currentType=l.Type.bool,S?m.i32(S.isManaged?1:0):m.unreachable();case a.sizeof:if(e.currentType=e.options.usizeType,b(r,s,e)|A(n,0,s,e))return m.unreachable();var L=r[0].byteSize,R=void 0;return e.options.isWasm64?i.is(4)&&i.size<=32?(e.currentType=l.Type.u32,R=m.i32(L)):R=m.i64(L,0):i.is(4)&&64==i.size?(e.currentType=l.Type.u64,R=m.i64(L,0)):R=m.i32(L),R;case a.alignof:if(e.currentType=e.options.usizeType,b(r,s,e)|A(n,0,s,e))return m.unreachable();L=r[0].byteSize;assert(y.isPowerOf2(L));var F=ctz(L);R=void 0;return e.options.isWasm64?i.is(4)&&i.size<=32?(e.currentType=l.Type.u32,R=m.i32(F)):R=m.i64(F,0):i.is(4)&&64==i.size?(e.currentType=l.Type.u64,R=m.i64(F,0)):R=m.i32(F),R;case a.offsetof:if(e.currentType=e.options.usizeType,b(r,s,e)|N(n,0,1,s,e))return m.unreachable();var B;if(!(B=r[0].classReference))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();var D=void 0;if(n.length){if(n[0].kind!=c.NodeKind.LITERAL||n[0].literalKind!=c.LiteralKind.STRING)return e.error(o.DiagnosticCode.String_literal_expected,n[0].range),m.unreachable();var P=n[0].value,w=B.members?B.members.get(P):null;if(!w||w.kind!=p.ElementKind.FIELD)return e.error(o.DiagnosticCode.Type_0_has_no_property_1,n[0].range,B.internalName,P),m.unreachable();D=w.memoryOffset}else D=B.currentMemoryOffset;return e.options.isWasm64?i.is(4)&&i.size<=32?(e.currentType=l.Type.u32,m.i32(D)):m.i64(D):i.is(4)&&64==i.size?(e.currentType=l.Type.u64,m.i64(D)):m.i32(D);case a.clz:case a.ctz:case a.popcnt:if(I(r,s,e,!0)|A(n,1,s,e))return m.unreachable();var U=r?e.compileExpression(n[0],r[0],5):e.compileExpression(n[0],l.Type.i32,4);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();var M=-1;switch(t.internalName){case a.clz:switch(S.kind){case 10:case 0:case 5:case 1:case 6:case 2:case 7:M=u.UnaryOp.ClzI32;break;case 9:case 4:M=e.options.isWasm64?u.UnaryOp.ClzI64:u.UnaryOp.ClzI32;break;case 3:case 8:M=u.UnaryOp.ClzI64}break;case a.ctz:switch(S.kind){case 10:case 0:case 5:case 1:case 6:case 2:case 7:M=u.UnaryOp.CtzI32;break;case 9:case 4:M=e.options.isWasm64?u.UnaryOp.CtzI64:u.UnaryOp.CtzI32;break;case 3:case 8:M=u.UnaryOp.CtzI64}break;case a.popcnt:switch(e.currentType.kind){case 10:case 0:case 5:case 1:case 6:case 2:case 7:M=u.UnaryOp.PopcntI32;break;case 9:case 4:M=e.options.isWasm64?u.UnaryOp.PopcntI64:u.UnaryOp.PopcntI32;break;case 3:case 8:M=u.UnaryOp.PopcntI64}}return-1==M?(e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable()):m.unary(M,U);case a.rotl:if(I(r,s,e,!0)|A(n,2,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],5):e.compileExpression(n[0],l.Type.i32,4);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();var V=e.compileExpression(n[1],S,1);R=void 0;switch(S.kind){case 0:case 1:case 5:case 6:case 10:R=e.ensureSmallIntegerWrap(m.binary(u.BinaryOp.RotlI32,U,V),S);case 2:case 7:R=m.binary(u.BinaryOp.RotlI32,U,V);break;case 9:case 4:R=m.binary(e.options.isWasm64?u.BinaryOp.RotlI64:u.BinaryOp.RotlI32,U,V);break;case 3:case 8:R=m.binary(u.BinaryOp.RotlI64,U,V);break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=m.unreachable()}return R;case a.rotr:if(I(r,s,e,!0)|A(n,2,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],5):e.compileExpression(n[0],l.Type.i32,4);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();V=e.compileExpression(n[1],S,1),R=void 0;switch(S.kind){case 0:case 1:case 5:case 6:case 10:R=e.ensureSmallIntegerWrap(m.binary(u.BinaryOp.RotrI32,U,V),S);break;case 2:case 7:R=m.binary(u.BinaryOp.RotrI32,U,V);break;case 9:case 4:R=m.binary(e.options.isWasm64?u.BinaryOp.RotrI64:u.BinaryOp.RotrI32,U,V);break;case 3:case 8:R=m.binary(u.BinaryOp.RotrI64,U,V);break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=m.unreachable()}return R;case a.abs:if(I(r,s,e,!0)|A(n,1,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],5):e.compileExpression(n[0],l.Type.f64,4);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();R=void 0;switch(S.kind){case 0:case 1:case 2:var G=(H=e.currentFlow).getTempLocal(l.Type.i32),K=H.getAndFreeTempLocal(l.Type.i32).index,z=G.index;R=m.binary(u.BinaryOp.XorI32,m.binary(u.BinaryOp.AddI32,m.local_tee(K,m.binary(u.BinaryOp.ShrI32,m.local_tee(z,U),m.i32(31))),m.local_get(z,u.NativeType.I32)),m.local_get(K,u.NativeType.I32)),H.freeTempLocal(G);break;case 4:var Y=e.options,H=e.currentFlow,W=Y.isWasm64;G=H.getTempLocal(Y.usizeType),K=H.getAndFreeTempLocal(Y.usizeType).index,z=G.index;R=m.binary(W?u.BinaryOp.XorI64:u.BinaryOp.XorI32,m.binary(W?u.BinaryOp.AddI64:u.BinaryOp.AddI32,m.local_tee(K,m.binary(W?u.BinaryOp.ShrI64:u.BinaryOp.ShrI32,m.local_tee(z,U),W?m.i64(63):m.i32(31))),m.local_get(z,Y.nativeSizeType)),m.local_get(K,Y.nativeSizeType)),H.freeTempLocal(G);break;case 3:G=(H=e.currentFlow).getTempLocal(l.Type.i64),K=H.getAndFreeTempLocal(l.Type.i64).index,z=G.index;R=m.binary(u.BinaryOp.XorI64,m.binary(u.BinaryOp.AddI64,m.local_tee(K,m.binary(u.BinaryOp.ShrI64,m.local_tee(z,U),m.i64(63))),m.local_get(z,u.NativeType.I64)),m.local_get(K,u.NativeType.I64)),H.freeTempLocal(G);break;case 9:case 5:case 6:case 7:case 8:case 10:R=U;break;case 11:R=m.unary(u.UnaryOp.AbsF32,U);break;case 12:R=m.unary(u.UnaryOp.AbsF64,U);break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=m.unreachable()}return R;case a.max:if(I(r,s,e,!0)|A(n,2,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],5):e.compileExpression(n[0],l.Type.f64,4);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();V=e.compileExpression(n[1],S,5),M=void 0;switch(S.kind){case 0:case 1:case 2:M=u.BinaryOp.GtI32;break;case 5:case 6:case 7:case 10:M=u.BinaryOp.GtU32;break;case 3:M=u.BinaryOp.GtI64;break;case 8:M=u.BinaryOp.GtU64;break;case 4:M=e.options.isWasm64?u.BinaryOp.GtI64:u.BinaryOp.GtI32;break;case 9:M=e.options.isWasm64?u.BinaryOp.GtU64:u.BinaryOp.GtU32;break;case 11:return m.binary(u.BinaryOp.MaxF32,U,V);case 12:return m.binary(u.BinaryOp.MaxF64,U,V);default:return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable()}H=e.currentFlow;var X=S.toNativeType(),q=H.getTempLocal(S);H.setLocalFlag(q.index,_.LocalFlags.WRAPPED);G=H.getAndFreeTempLocal(S);return H.setLocalFlag(G.index,_.LocalFlags.WRAPPED),H.freeTempLocal(q),m.select(m.local_tee(q.index,U),m.local_tee(G.index,V),m.binary(M,m.local_get(q.index,X),m.local_get(G.index,X)));case a.min:if(I(r,s,e,!0)|A(n,2,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],5):e.compileExpression(n[0],l.Type.f64,4);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();V=e.compileExpression(n[1],S,5),M=void 0;switch(S.kind){case 0:case 1:case 2:M=u.BinaryOp.LtI32;break;case 5:case 6:case 7:case 10:M=u.BinaryOp.LtU32;break;case 3:M=u.BinaryOp.LtI64;break;case 8:M=u.BinaryOp.LtU64;break;case 4:M=e.options.isWasm64?u.BinaryOp.LtI64:u.BinaryOp.LtI32;break;case 9:M=e.options.isWasm64?u.BinaryOp.LtU64:u.BinaryOp.LtU32;break;case 11:return m.binary(u.BinaryOp.MinF32,U,V);case 12:return m.binary(u.BinaryOp.MinF64,U,V);default:return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable()}H=e.currentFlow,X=S.toNativeType(),q=H.getTempLocal(S);H.setLocalFlag(q.index,_.LocalFlags.WRAPPED);G=H.getAndFreeTempLocal(S);return H.setLocalFlag(G.index,_.LocalFlags.WRAPPED),H.freeTempLocal(q),m.select(m.local_tee(q.index,U),m.local_tee(G.index,V),m.binary(M,m.local_get(q.index,X),m.local_get(G.index,X)));case a.ceil:case a.floor:if(I(r,s,e,!0)|A(n,1,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],1):e.compileExpression(n[0],l.Type.f64,0);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();M=void 0;switch(S.kind){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return U;case 11:M=t.internalName==a.ceil?u.UnaryOp.CeilF32:u.UnaryOp.FloorF32;break;case 12:M=t.internalName==a.ceil?u.UnaryOp.CeilF64:u.UnaryOp.FloorF64;break;default:return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable()}return m.unary(M,U);case a.copysign:if(I(r,s,e,!0)|A(n,2,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],1):e.compileExpression(n[0],l.Type.f64,0);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();V=e.compileExpression(n[1],S,1),M=void 0;switch(S.kind){case 11:M=u.BinaryOp.CopysignF32;break;case 12:M=u.BinaryOp.CopysignF64;break;default:return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable()}return m.binary(M,U,V);case a.nearest:if(I(r,s,e,!0)|A(n,1,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],1):e.compileExpression(n[0],l.Type.f64,0);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();R=void 0;switch(S.kind){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:R=U;break;case 11:R=m.unary(u.UnaryOp.NearestF32,U);break;case 12:R=m.unary(u.UnaryOp.NearestF64,U);break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=m.unreachable()}return R;case a.reinterpret:if(b(r,s,e,!0)|A(n,1,s,e))return m.unreachable();if((S=r[0]).is(256))return e.currentType=S,e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();R=void 0;switch(S.kind){case 2:case 7:U=e.compileExpression(n[0],l.Type.f32,1);R=m.unary(u.UnaryOp.ReinterpretF32,U);break;case 3:case 8:U=e.compileExpression(n[0],l.Type.f64,1);R=m.unary(u.UnaryOp.ReinterpretF64,U);break;case 4:case 9:U=e.compileExpression(n[0],e.options.isWasm64?l.Type.f64:l.Type.f32,1);R=m.unary(e.options.isWasm64?u.UnaryOp.ReinterpretF64:u.UnaryOp.ReinterpretF32,U);break;case 11:U=e.compileExpression(n[0],l.Type.i32,1);R=m.unary(u.UnaryOp.ReinterpretI32,U);break;case 12:U=e.compileExpression(n[0],l.Type.i64,1);R=m.unary(u.UnaryOp.ReinterpretI64,U);break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=m.unreachable()}return e.currentType=S,R;case a.sqrt:if(I(r,s,e,!0)|A(n,1,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],1):e.compileExpression(n[0],l.Type.f64,0);if((S=e.currentType).is(256))return e.currentType=S,e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();R=void 0;switch(S.kind){case 11:R=m.unary(u.UnaryOp.SqrtF32,U);break;case 12:R=m.unary(u.UnaryOp.SqrtF64,U);break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=m.unreachable()}return R;case a.trunc:if(I(r,s,e,!0)|A(n,1,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],1):e.compileExpression(n[0],l.Type.f64,0);if((S=e.currentType).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.range),m.unreachable();R=void 0;switch(S.kind){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:R=U;break;case 11:R=m.unary(u.UnaryOp.TruncF32,U);break;case 12:R=m.unary(u.UnaryOp.TruncF64,U);break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=m.unreachable()}return R;case a.load:if(b(r,s,e,!0)|N(n,1,3,s,e))return m.unreachable();var Q=(S=r[0]).is(4)&&i.is(4)&&i.size>S.size?i:S;U=e.compileExpression(n[0],e.options.usizeType,1);if(($=(ue=n.length)>=2?v(n[1],e):0)<0)return e.currentType=Q,m.unreachable();var j=void 0,Z=S.byteSize;if(3==ue){if((j=v(n[2],e))<0)return e.currentType=Q,m.unreachable();if(j>Z)return e.error(o.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,n[2].range,"Alignment","0",Z.toString()),e.currentType=Q,m.unreachable();if(!y.isPowerOf2(j))return e.error(o.DiagnosticCode._0_must_be_a_power_of_two,n[2].range,"Alignment"),e.currentType=Q,m.unreachable()}else j=Z;return e.currentType=Q,m.load(S.byteSize,S.is(5),U,Q.toNativeType(),$,j);case a.store:if(e.currentType=l.Type.void,b(r,s,e)|N(n,2,4,s,e))return m.unreachable();S=r[0],U=e.compileExpression(n[0],e.options.usizeType,1),V=d?e.compileExpression(n[1],i,1):e.compileExpression(n[1],S,S.is(4)?0:1);var J=e.currentType;if(S.is(4)&&(!J.is(4)||J.size<S.size)&&(V=e.convertExpression(V,J,S,!1,!1,n[1]),J=S),($=n.length>=3?v(n[2],e):0)<0)return e.currentType=l.Type.void,m.unreachable();j=void 0,Z=S.byteSize;if(4==n.length){if((j=v(n[3],e))<0)return e.currentType=l.Type.void,m.unreachable();if(j>Z)return e.error(o.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,n[3].range,"Alignment","0",Z.toString()),e.currentType=l.Type.void,m.unreachable();if(!y.isPowerOf2(j))return e.error(o.DiagnosticCode._0_must_be_a_power_of_two,n[3].range,"Alignment"),e.currentType=l.Type.void,m.unreachable()}else j=Z;return e.currentType=l.Type.void,m.store(S.byteSize,U,V,J.toNativeType(),$,j);case a.atomic_load:if(!e.options.hasFeature(16))break;if(b(r,s,e,!0)|N(n,1,2,s,e))return m.unreachable();Q=(S=r[0]).is(4)&&i.is(4)&&i.size>S.size?i:S;if(!S.is(4))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=Q,m.unreachable();U=e.compileExpression(n[0],e.options.usizeType,1);return($=2==n.length?v(n[1],e):0)<0?(e.currentType=Q,m.unreachable()):(e.currentType=Q,m.atomic_load(S.byteSize,U,Q.toNativeType(),$));case a.atomic_store:if(!e.options.hasFeature(16))break;if(e.currentType=l.Type.void,b(r,s,e)|N(n,2,3,s,e))return m.unreachable();if(!(S=r[0]).is(4)||S.size<8)return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();U=e.compileExpression(n[0],e.options.usizeType,1),V=d?e.compileExpression(n[1],i,1):e.compileExpression(n[1],S,S.is(4)?0:1),J=e.currentType;return S.is(4)&&(!J.is(4)||J.size<S.size)&&(V=e.convertExpression(V,J,S,!1,!1,n[1]),J=S),($=3==n.length?v(n[2],e):0)<0?(e.currentType=l.Type.void,m.unreachable()):(e.currentType=l.Type.void,m.atomic_store(S.byteSize,U,V,J.toNativeType(),$));case a.atomic_add:case a.atomic_sub:case a.atomic_and:case a.atomic_or:case a.atomic_xor:case a.atomic_xchg:if(!e.options.hasFeature(16))break;if(b(r,s,e,!0)|N(n,2,3,s,e))return m.unreachable();if(!(S=r[0]).is(4)||S.size<8)return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();U=e.compileExpression(n[0],e.options.usizeType,1),V=d?e.compileExpression(n[1],i,1):e.compileExpression(n[1],S,S.is(4)?0:1),J=e.currentType;if(S.is(4)&&(!J.is(4)||J.size<S.size)&&(V=e.convertExpression(V,J,S,!1,!1,n[1]),J=S),($=3==n.length?v(n[2],e):0)<0)return e.currentType=J,m.unreachable();M=void 0;switch(t.internalName){default:assert(!1);case a.atomic_add:M=u.AtomicRMWOp.Add;break;case a.atomic_sub:M=u.AtomicRMWOp.Sub;break;case a.atomic_and:M=u.AtomicRMWOp.And;break;case a.atomic_or:M=u.AtomicRMWOp.Or;break;case a.atomic_xor:M=u.AtomicRMWOp.Xor;break;case a.atomic_xchg:M=u.AtomicRMWOp.Xchg}return e.currentType=J,m.atomic_rmw(M,S.byteSize,$,U,V,J.toNativeType());case a.atomic_cmpxchg:if(!e.options.hasFeature(16))break;if(b(r,s,e,!0)|N(n,3,4,s,e))return m.unreachable();if(!(S=r[0]).is(4)||S.size<8)return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();U=e.compileExpression(n[0],e.options.usizeType,1),V=d?e.compileExpression(n[1],i,1):e.compileExpression(n[1],S,S.is(4)?0:1),J=e.currentType;var $,ee=e.compileExpression(n[2],J,1);return S.is(4)&&(!J.is(4)||J.size<S.size)&&(V=e.convertExpression(V,J,S,!1,!1,n[1]),ee=e.convertExpression(ee,J,S,!1,!1,n[2]),J=S),($=4==n.length?v(n[3],e):0)<0?(e.currentType=J,m.unreachable()):(e.currentType=J,m.atomic_cmpxchg(S.byteSize,$,U,V,ee,J.toNativeType()));case a.atomic_wait:if(!e.options.hasFeature(16))break;if(e.currentType=l.Type.i32,b(r,s,e)|A(n,3,s,e))return m.unreachable();if(!(S=r[0]).is(4)||S.size<32)return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();U=e.compileExpression(n[0],e.options.usizeType,1),V=e.compileExpression(n[1],S,1),ee=e.compileExpression(n[2],l.Type.i64,1);return e.currentType=l.Type.i32,m.atomic_wait(U,V,ee,S.toNativeType());case a.atomic_notify:if(!e.options.hasFeature(16))break;if(e.currentType=l.Type.i32,x(r,s,t)|A(n,2,s,e))return m.unreachable();U=e.compileExpression(n[0],e.options.usizeType,1),V=e.compileExpression(n[1],l.Type.i32,1);return e.currentType=l.Type.i32,m.atomic_notify(U,V);case a.select:if(I(r,s,e,!0)|A(n,3,s,e))return m.unreachable();U=r?e.compileExpression(n[0],r[0],1):e.compileExpressionRetainType(n[0],l.Type.i32);if(!(S=e.currentType).isAny(384))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();V=e.compileExpression(n[1],S,1),ee=e.makeIsTrueish(e.compileExpressionRetainType(n[2],l.Type.bool),e.currentType);return e.currentType=S,m.select(U,V,ee);case a.unreachable:return r&&e.error(o.DiagnosticCode.Type_0_is_not_generic,s.typeArgumentsRange,t.internalName),A(n,0,s,e),m.unreachable();case a.memory_size:return e.currentType=l.Type.i32,x(r,s,t)|A(n,0,s,e)?m.unreachable():m.host(u.HostOp.MemorySize);case a.memory_grow:return e.currentType=l.Type.i32,x(r,s,t)|A(n,1,s,e)?m.unreachable():m.host(u.HostOp.MemoryGrow,null,[e.compileExpression(n[0],l.Type.i32,1)]);case a.memory_copy:if(e.currentType=l.Type.void,x(r,s,t)|A(n,3,s,e))return m.unreachable();if(!e.options.hasFeature(4)){var te=e.resolver.resolveFunction(t,null);return e.currentType=l.Type.void,te?e.compileCallDirect(te,n,s):m.unreachable()}var re=e.options.usizeType;U=e.compileExpression(n[0],re,1),V=e.compileExpression(n[1],re,1),ee=e.compileExpression(n[2],re,1);return e.currentType=l.Type.void,m.memory_copy(U,V,ee);case a.memory_fill:if(e.currentType=l.Type.void,x(r,s,t)|A(n,3,s,e))return m.unreachable();if(!e.options.hasFeature(4)){te=e.resolver.resolveFunction(t,null);return e.currentType=l.Type.void,te?e.compileCallDirect(te,n,s):m.unreachable()}re=e.options.usizeType,U=e.compileExpression(n[0],re,1),V=e.compileExpression(n[1],l.Type.u8,1),ee=e.compileExpression(n[2],re,1);return e.currentType=l.Type.void,m.memory_fill(U,V,ee);case a.changetype:if(b(r,s,e,!0)|A(n,1,s,e))return m.unreachable();var ne=r[0],ie=(U=e.compileExpressionRetainType(n[0],ne),e.currentType);return e.currentType=ne,ie.size!=ne.size?(e.error(o.DiagnosticCode.Operation_not_supported,s.range),m.unreachable()):U;case a.assert:if(I(r,s,e)|N(n,1,2,s,e))return r&&(assert(r.length),e.currentType=r[0].nonNullableType),m.unreachable();U=r?e.compileExpression(n[0],r[0],5):e.compileExpressionRetainType(n[0],l.Type.bool,4),S=e.currentType;if(e.currentType=S.nonNullableType,e.options.noAssert)return i==l.Type.void?(e.currentType=l.Type.void,m.nop()):U;var ae=T(e,2==n.length?n[1]:null,s);e.currentType=S.nonNullableType;R=void 0;if(i==l.Type.void)switch(e.currentType=l.Type.void,S.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:R=m.if(m.unary(u.UnaryOp.EqzI32,U),ae);break;case 3:case 8:R=m.if(m.unary(u.UnaryOp.EqzI64,U),ae);break;case 4:case 9:R=m.if(m.unary(e.options.isWasm64?u.UnaryOp.EqzI64:u.UnaryOp.EqzI32,U),ae);break;case 11:R=m.if(m.binary(u.BinaryOp.EqF32,U,m.f32(0)),ae);break;case 12:R=m.if(m.binary(u.BinaryOp.EqF64,U,m.f64(0)),ae);break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=ae}else switch(e.currentType=S.nonNullableType,e.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:var se=(H=e.currentFlow).getAndFreeTempLocal(S);H.setLocalFlag(se.index,_.LocalFlags.WRAPPED),R=m.if(m.local_tee(se.index,U),m.local_get(se.index,u.NativeType.I32),ae);break;case 3:case 8:se=e.currentFlow.getAndFreeTempLocal(l.Type.i64);R=m.if(m.unary(u.UnaryOp.EqzI64,m.local_tee(se.index,U)),ae,m.local_get(se.index,u.NativeType.I64));break;case 4:case 9:se=e.currentFlow.getAndFreeTempLocal(e.options.usizeType);R=m.if(m.unary(e.options.isWasm64?u.UnaryOp.EqzI64:u.UnaryOp.EqzI32,m.local_tee(se.index,U)),ae,m.local_get(se.index,e.options.nativeSizeType));break;case 11:se=e.currentFlow.getAndFreeTempLocal(l.Type.f32);R=m.if(m.binary(u.BinaryOp.EqF32,m.local_tee(se.index,U),m.f32(0)),ae,m.local_get(se.index,u.NativeType.F32));break;case 12:se=e.currentFlow.getAndFreeTempLocal(l.Type.f64);R=m.if(m.binary(u.BinaryOp.EqF64,m.local_tee(se.index,U),m.f64(0)),ae,m.local_get(se.index,u.NativeType.F64));break;default:e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),R=ae}return R;case a.unchecked:if(x(r,s,t)|A(n,1,s,e))return m.unreachable();var oe=(H=e.currentFlow).is(16384);H.set(16384);R=e.compileExpression(n[0],i);return oe||H.unset(16384),R;case a.call_direct:g=!0;case a.call_indirect:if(I(r,s,e,!0)|N(n,1,i32.MAX_VALUE,s,e))return m.unreachable();var ce=r?r[0]:i,le=(U=e.compileExpressionRetainType(n[0],l.Type.u32),e.currentType);if(!(le==l.Type.u32||7==le.kind&&le.signatureReference))return e.error(o.DiagnosticCode.Operation_not_supported,n[0].range),m.unreachable();for(var ue=n.length-1,pe=new Array(ue),_e=ce.toNativeType(),he=new Array(ue),de=new Array(ue),ye=0;ye<ue;++ye){pe[ye]=e.compileExpressionRetainType(n[1+ye],l.Type.i32);var me=e.currentType;he[ye]=me,de[ye]=me.toNativeType()}var fe=l.Signature.makeSignatureString(he,ce),Te=m.getFunctionTypeBySignature(_e,de);if(Te||(Te=m.addFunctionType(fe,_e,de)),e.currentType=ce,g){if(u.getExpressionId(U=m.precomputeExpression(U))==u.ExpressionId.Const){assert(u.getExpressionType(U)==u.NativeType.I32);var ge=u.getConstValueI32(U),Ee=e.functionTable;if(ge>=0&&ge<Ee.length)return m.call(Ee[ge],pe,_e)}return e.error(o.DiagnosticCode.Operation_not_supported,n[0].range),m.unreachable()}return m.call_indirect(U,pe,fe);case a.instantiate:if(b(r,s,e,!0))return m.unreachable();var ve=r[0].classReference;return ve?(e.currentType=ve.type,e.compileInstantiate(ve,n,0,s)):(e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable());case a.ERROR:return x(r,s,t),e.error(o.DiagnosticCode.User_defined_0,s.range,(n.length?n[0]:s).range.toString()),m.unreachable();case a.WARNING:return x(r,s,t),e.warning(o.DiagnosticCode.User_defined_0,s.range,(n.length?n[0]:s).range.toString()),m.nop();case a.INFO:return x(r,s,t),e.info(o.DiagnosticCode.User_defined_0,s.range,(n.length?n[0]:s).range.toString()),m.nop();case a.i8:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.i8,m.unreachable()):e.compileExpression(n[0],l.Type.i8,2);case a.i16:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.i16,m.unreachable()):e.compileExpression(n[0],l.Type.i16,2);case a.i32:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.i32,m.unreachable()):e.compileExpression(n[0],l.Type.i32,2);case a.i64:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.i64,m.unreachable()):e.compileExpression(n[0],l.Type.i64,2);case a.isize:var be=e.options.isizeType;return x(r,s,t)|A(n,1,s,e)?(e.currentType=be,m.unreachable()):e.compileExpression(n[0],be,2);case a.u8:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.u8,m.unreachable()):e.compileExpression(n[0],l.Type.u8,2);case a.u16:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.u16,m.unreachable()):e.compileExpression(n[0],l.Type.u16,2);case a.u32:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.u32,m.unreachable()):e.compileExpression(n[0],l.Type.u32,2);case a.u64:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.u64,m.unreachable()):e.compileExpression(n[0],l.Type.u64,2);case a.usize:re=e.options.usizeType;return x(r,s,t)|A(n,1,s,e)?(e.currentType=re,m.unreachable()):e.compileExpression(n[0],re,2);case a.bool:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.bool,m.unreachable()):e.compileExpression(n[0],l.Type.bool,2);case a.f32:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.f32,m.unreachable()):e.compileExpression(n[0],l.Type.f32,2);case a.f64:return x(r,s,t)|A(n,1,s,e)?(e.currentType=l.Type.f64,m.unreachable()):e.compileExpression(n[0],l.Type.f64,2);case a.v128:case a.i8x16:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,16,s,e))return e.currentType=l.Type.v128,m.unreachable();var Ie=new Uint8Array(16);for(ye=0;ye<16;++ye){if(Ae=n[ye]){R=e.precomputeExpression(Ae,l.Type.i8,1);if(u.getExpressionId(R)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ae.range),e.currentType=l.Type.v128,m.unreachable();assert(u.getExpressionType(R)==u.NativeType.I32),y.writeI8(u.getConstValueI32(R),Ie,ye)}}return e.currentType=l.Type.v128,m.v128(Ie);case a.i16x8:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,8,s,e))return e.currentType=l.Type.v128,m.unreachable();for(Ie=new Uint8Array(16),ye=0;ye<8;++ye){if(Ae=n[ye]){R=e.precomputeExpression(Ae,l.Type.i16,1);if(u.getExpressionId(R)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ae.range),e.currentType=l.Type.v128,m.unreachable();assert(u.getExpressionType(R)==u.NativeType.I32),y.writeI16(u.getConstValueI32(R),Ie,ye<<1)}}return e.currentType=l.Type.v128,m.v128(Ie);case a.i32x4:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,4,s,e))return e.currentType=l.Type.v128,m.unreachable();for(Ie=new Uint8Array(16),ye=0;ye<4;++ye){if(Ae=n[ye]){R=e.precomputeExpression(Ae,l.Type.i32,1);if(u.getExpressionId(R)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ae.range),e.currentType=l.Type.v128,m.unreachable();assert(u.getExpressionType(R)==u.NativeType.I32),y.writeI32(u.getConstValueI32(R),Ie,ye<<2)}}return e.currentType=l.Type.v128,m.v128(Ie);case a.i64x2:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,2,s,e))return e.currentType=l.Type.v128,m.unreachable();for(Ie=new Uint8Array(16),ye=0;ye<2;++ye){if(Ae=n[ye]){R=e.precomputeExpression(Ae,l.Type.i64,1);if(u.getExpressionId(R)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ae.range),e.currentType=l.Type.v128,m.unreachable();assert(u.getExpressionType(R)==u.NativeType.I64);var xe=ye<<3;y.writeI32(u.getConstValueI64Low(R),Ie,xe),y.writeI32(u.getConstValueI64High(R),Ie,xe+4)}}return e.currentType=l.Type.v128,m.v128(Ie);case a.f32x4:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,4,s,e))return e.currentType=l.Type.v128,m.unreachable();for(Ie=new Uint8Array(16),ye=0;ye<4;++ye){if(Ae=n[ye]){R=e.precomputeExpression(Ae,l.Type.f32,1);if(u.getExpressionId(R)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ae.range),e.currentType=l.Type.v128,m.unreachable();assert(u.getExpressionType(R)==u.NativeType.F32),y.writeF32(u.getConstValueF32(R),Ie,ye<<2)}}return e.currentType=l.Type.v128,m.v128(Ie);case a.f64x2:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,2,s,e))return e.currentType=l.Type.v128,m.unreachable();for(Ie=new Uint8Array(16),ye=0;ye<2;++ye){var Ae;if(Ae=n[ye]){R=e.precomputeExpression(Ae,l.Type.f64,1);if(u.getExpressionId(R)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ae.range),e.currentType=l.Type.v128,m.unreachable();assert(u.getExpressionType(R)==u.NativeType.F64),y.writeF64(u.getConstValueF64(R),Ie,ye<<3)}}return e.currentType=l.Type.v128,m.v128(Ie);case a.v128_splat:if(!e.options.hasFeature(8))break;if(b(r,s,e)|A(n,1,s,e))return e.currentType=l.Type.v128,m.unreachable();if((S=r[0]).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable();M=void 0;switch(S.kind){case 0:case 5:M=u.UnaryOp.SplatVecI8x16;break;case 1:case 6:M=u.UnaryOp.SplatVecI16x8;break;case 2:case 7:M=u.UnaryOp.SplatVecI32x4;break;case 3:case 8:M=u.UnaryOp.SplatVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.UnaryOp.SplatVecI64x2:u.UnaryOp.SplatVecI32x4;break;case 11:M=u.UnaryOp.SplatVecF32x4;break;case 12:M=u.UnaryOp.SplatVecF64x2;break;default:return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable()}U=e.compileExpression(n[0],S,1);return e.currentType=l.Type.v128,m.unary(M,U);case a.v128_extract_lane:if(!e.options.hasFeature(8))break;if(b(r,s,e,!0)|A(n,2,s,e))return m.unreachable();if((S=r[0]).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=S,m.unreachable();M=void 0;switch(S.kind){case 0:M=u.SIMDExtractOp.ExtractLaneSVecI8x16;break;case 5:M=u.SIMDExtractOp.ExtractLaneUVecI8x16;break;case 1:M=u.SIMDExtractOp.ExtractLaneSVecI16x8;break;case 6:M=u.SIMDExtractOp.ExtractLaneUVecI16x8;break;case 2:case 7:M=u.SIMDExtractOp.ExtractLaneVecI32x4;break;case 3:case 8:M=u.SIMDExtractOp.ExtractLaneVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.SIMDExtractOp.ExtractLaneVecI64x2:u.SIMDExtractOp.ExtractLaneVecI32x4;break;case 11:M=u.SIMDExtractOp.ExtractLaneVecF32x4;break;case 12:M=u.SIMDExtractOp.ExtractLaneVecF64x2;break;default:return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=S,m.unreachable()}U=e.compileExpression(n[0],l.Type.v128,1),V=e.precomputeExpression(n[1],l.Type.u8,1);if(e.currentType=S,u.getExpressionId(V)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,n[1].range),m.unreachable();assert(u.getExpressionType(V)==u.NativeType.I32);var Ne=16/S.byteSize-1;return(ke=u.getConstValueI32(V))<0||ke>Ne?(e.error(o.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,n[1].range,"Lane index","0",Ne.toString()),m.unreachable()):m.simd_extract(M,U,ke);case a.v128_replace_lane:if(!e.options.hasFeature(8))break;if(b(r,s,e)|A(n,3,s,e))return e.currentType=l.Type.v128,m.unreachable();if((S=r[0]).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable();M=void 0;switch(S.kind){case 0:case 5:M=u.SIMDReplaceOp.ReplaceLaneVecI8x16;break;case 1:case 6:M=u.SIMDReplaceOp.ReplaceLaneVecI16x8;break;case 2:case 7:M=u.SIMDReplaceOp.ReplaceLaneVecI32x4;break;case 3:case 8:M=u.SIMDReplaceOp.ReplaceLaneVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.SIMDReplaceOp.ReplaceLaneVecI64x2:u.SIMDReplaceOp.ReplaceLaneVecI32x4;break;case 11:M=u.SIMDReplaceOp.ReplaceLaneVecF32x4;break;case 12:M=u.SIMDReplaceOp.ReplaceLaneVecF64x2;break;default:return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable()}U=e.compileExpression(n[0],l.Type.v128,1),V=e.precomputeExpression(n[1],l.Type.u8,1);if(u.getExpressionId(V)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,n[1].range),e.currentType=l.Type.v128,m.unreachable();assert(u.getExpressionType(V)==u.NativeType.I32);Ne=16/S.byteSize-1;if((ke=u.getConstValueI32(V))<0||ke>Ne)return e.error(o.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,n[1].range,"Lane index","0",Ne.toString()),m.unreachable();ee=e.compileExpression(n[2],S,1);return e.currentType=l.Type.v128,m.simd_replace(M,U,ke,ee);case a.v128_shuffle:if(!e.options.hasFeature(8))break;if(b(r,s,e))return e.currentType=l.Type.v128,m.unreachable();if((S=r[0]).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable();var Se=S.byteSize,Oe=16/Se;if(assert(isInteger(Oe)&&y.isPowerOf2(Oe)),A(n,2+Oe,s,e))return e.currentType=l.Type.v128,m.unreachable();switch(S.kind){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 11:case 12:break;default:return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable()}U=e.compileExpression(n[0],l.Type.v128,1),V=e.compileExpression(n[1],l.Type.v128,1);var Ce=new Uint8Array(16);for(Ne=(Oe<<1)-1,ye=0;ye<Oe;++ye){var ke,Re=n[2+ye],Le=e.precomputeExpression(Re,l.Type.u8,1);if(u.getExpressionId(Le)!=u.ExpressionId.Const)return e.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,Re.range),e.currentType=l.Type.v128,m.unreachable();if(assert(u.getExpressionType(Le)==u.NativeType.I32),(ke=u.getConstValueI32(Le))<0||ke>Ne)return e.error(o.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,Re.range,"Lane index","0",Ne.toString()),e.currentType=l.Type.v128,m.unreachable();switch(Se){case 1:y.writeI8(ke,Ce,ye);break;case 2:var Fe=ye<<1,Be=ke<<1;y.writeI8(Be,Ce,Fe),y.writeI8(Be+1,Ce,Fe+1);break;case 4:Fe=ye<<2,Be=ke<<2;y.writeI8(Be,Ce,Fe),y.writeI8(Be+1,Ce,Fe+1),y.writeI8(Be+2,Ce,Fe+2),y.writeI8(Be+3,Ce,Fe+3);break;case 8:Fe=ye<<3,Be=ke<<3;y.writeI8(Be,Ce,Fe),y.writeI8(Be+1,Ce,Fe+1),y.writeI8(Be+2,Ce,Fe+2),y.writeI8(Be+3,Ce,Fe+3),y.writeI8(Be+4,Ce,Fe+4),y.writeI8(Be+5,Ce,Fe+5),y.writeI8(Be+6,Ce,Fe+6),y.writeI8(Be+7,Ce,Fe+7);break;default:assert(!1)}}return e.currentType=l.Type.v128,m.simd_shuffle(U,V,Ce);case a.v128_add:case a.v128_sub:case a.v128_mul:case a.v128_div:case a.v128_add_saturate:case a.v128_sub_saturate:case a.v128_min:case a.v128_max:case a.v128_eq:case a.v128_ne:case a.v128_lt:case a.v128_le:case a.v128_gt:case a.v128_ge:if(!e.options.hasFeature(8))break;if(b(r,s,e)|A(n,2,s,e))return e.currentType=l.Type.v128,m.unreachable();if((S=r[0]).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable();M=-1;switch(t.internalName){case a.v128_add:switch(S.kind){case 0:case 5:M=u.BinaryOp.AddVecI8x16;break;case 1:case 6:M=u.BinaryOp.AddVecI16x8;break;case 2:case 7:M=u.BinaryOp.AddVecI32x4;break;case 3:case 8:M=u.BinaryOp.AddVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.BinaryOp.AddVecI64x2:u.BinaryOp.AddVecI32x4;break;case 11:M=u.BinaryOp.AddVecF32x4;break;case 12:M=u.BinaryOp.AddVecF64x2}break;case a.v128_sub:switch(S.kind){case 0:case 5:M=u.BinaryOp.SubVecI8x16;break;case 1:case 6:M=u.BinaryOp.SubVecI16x8;break;case 2:case 7:M=u.BinaryOp.SubVecI32x4;break;case 3:case 8:M=u.BinaryOp.SubVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.BinaryOp.SubVecI64x2:u.BinaryOp.SubVecI32x4;break;case 11:M=u.BinaryOp.SubVecF32x4;break;case 12:M=u.BinaryOp.SubVecF64x2}break;case a.v128_mul:switch(S.kind){case 0:case 5:M=u.BinaryOp.MulVecI8x16;break;case 1:case 6:M=u.BinaryOp.MulVecI16x8;break;case 2:case 7:M=u.BinaryOp.MulVecI32x4;break;case 11:M=u.BinaryOp.MulVecF32x4;break;case 12:M=u.BinaryOp.MulVecF64x2;break;case 4:case 9:e.options.isWasm64||(M=u.BinaryOp.MulVecI32x4)}break;case a.v128_div:switch(S.kind){case 11:M=u.BinaryOp.DivVecF32x4;break;case 12:M=u.BinaryOp.DivVecF64x2}break;case a.v128_add_saturate:switch(S.kind){case 0:M=u.BinaryOp.AddSatSVecI8x16;break;case 5:M=u.BinaryOp.AddSatUVecI8x16;break;case 1:M=u.BinaryOp.AddSatSVecI16x8;break;case 6:M=u.BinaryOp.AddSatUVecI16x8}break;case a.v128_sub_saturate:switch(S.kind){case 0:M=u.BinaryOp.SubSatSVecI8x16;break;case 5:M=u.BinaryOp.SubSatUVecI8x16;break;case 1:M=u.BinaryOp.SubSatSVecI16x8;break;case 6:M=u.BinaryOp.SubSatUVecI16x8}break;case a.v128_min:switch(S.kind){case 11:M=u.BinaryOp.MinVecF32x4;break;case 12:M=u.BinaryOp.MinVecF64x2}break;case a.v128_max:switch(S.kind){case 11:M=u.BinaryOp.MaxVecF32x4;break;case 12:M=u.BinaryOp.MaxVecF64x2}break;case a.v128_eq:switch(S.kind){case 0:case 5:M=u.BinaryOp.EqVecI8x16;break;case 1:case 6:M=u.BinaryOp.EqVecI16x8;break;case 2:case 7:M=u.BinaryOp.EqVecI32x4;break;case 11:M=u.BinaryOp.EqVecF32x4;break;case 12:M=u.BinaryOp.EqVecF64x2;break;case 4:case 9:e.options.isWasm64||(M=u.BinaryOp.EqVecI32x4)}break;case a.v128_ne:switch(S.kind){case 0:case 5:M=u.BinaryOp.NeVecI8x16;break;case 1:case 6:M=u.BinaryOp.NeVecI16x8;break;case 2:case 7:M=u.BinaryOp.NeVecI32x4;break;case 11:M=u.BinaryOp.NeVecF32x4;break;case 12:M=u.BinaryOp.NeVecF64x2;break;case 4:case 9:e.options.isWasm64||(M=u.BinaryOp.NeVecI32x4)}break;case a.v128_lt:switch(S.kind){case 0:M=u.BinaryOp.LtSVecI8x16;break;case 5:M=u.BinaryOp.LtUVecI8x16;break;case 1:M=u.BinaryOp.LtSVecI16x8;break;case 6:M=u.BinaryOp.LtUVecI16x8;break;case 2:M=u.BinaryOp.LtSVecI32x4;break;case 7:M=u.BinaryOp.LtUVecI32x4;break;case 11:M=u.BinaryOp.LtVecF32x4;break;case 12:M=u.BinaryOp.LtVecF64x2;break;case 4:case 9:e.options.isWasm64||(M=4==S.kind?u.BinaryOp.LtSVecI32x4:u.BinaryOp.LtUVecI32x4)}break;case a.v128_le:switch(S.kind){case 0:M=u.BinaryOp.LeSVecI8x16;break;case 5:M=u.BinaryOp.LeUVecI8x16;break;case 1:M=u.BinaryOp.LeSVecI16x8;break;case 6:M=u.BinaryOp.LeUVecI16x8;break;case 2:M=u.BinaryOp.LeSVecI32x4;break;case 7:M=u.BinaryOp.LeUVecI32x4;break;case 11:M=u.BinaryOp.LeVecF32x4;break;case 12:M=u.BinaryOp.LeVecF64x2;break;case 4:case 9:e.options.isWasm64||(M=4==S.kind?u.BinaryOp.LeSVecI32x4:u.BinaryOp.LeUVecI32x4)}break;case a.v128_gt:switch(S.kind){case 0:M=u.BinaryOp.GtSVecI8x16;break;case 5:M=u.BinaryOp.GtUVecI8x16;break;case 1:M=u.BinaryOp.GtSVecI16x8;break;case 6:M=u.BinaryOp.GtUVecI16x8;break;case 2:M=u.BinaryOp.GtSVecI32x4;break;case 7:M=u.BinaryOp.GtUVecI32x4;break;case 11:M=u.BinaryOp.GtVecF32x4;break;case 12:M=u.BinaryOp.GtVecF64x2;break;case 4:case 9:e.options.isWasm64||(M=4==S.kind?u.BinaryOp.GtSVecI32x4:u.BinaryOp.GtUVecI32x4)}break;case a.v128_ge:switch(S.kind){case 0:M=u.BinaryOp.GeSVecI8x16;break;case 5:M=u.BinaryOp.GeUVecI8x16;break;case 1:M=u.BinaryOp.GeSVecI16x8;break;case 6:M=u.BinaryOp.GeUVecI16x8;break;case 2:M=u.BinaryOp.GeSVecI32x4;break;case 7:M=u.BinaryOp.GeUVecI32x4;break;case 11:M=u.BinaryOp.GeVecF32x4;break;case 12:M=u.BinaryOp.GeVecF64x2;break;case 4:case 9:e.options.isWasm64||(M=4==S.kind?u.BinaryOp.GeSVecI32x4:u.BinaryOp.GeUVecI32x4)}}if(-1==M)return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable();U=e.compileExpression(n[0],l.Type.v128,1),V=e.compileExpression(n[1],l.Type.v128,1);return e.currentType=l.Type.v128,m.binary(M,U,V);case a.v128_neg:case a.v128_abs:case a.v128_sqrt:case a.v128_convert:case a.v128_trunc:if(!e.options.hasFeature(8))break;if(b(r,s,e)|A(n,1,s,e))return e.currentType=l.Type.v128,m.unreachable();if((S=r[0]).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.range),e.currentType=l.Type.v128,m.unreachable();M=-1;switch(t.internalName){case a.v128_neg:switch(S.kind){case 0:case 5:M=u.UnaryOp.NegVecI8x16;break;case 1:case 6:M=u.UnaryOp.NegVecI16x8;break;case 2:case 7:M=u.UnaryOp.NegVecI32x4;break;case 3:case 8:M=u.UnaryOp.NegVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.UnaryOp.NegVecI64x2:u.UnaryOp.NegVecI32x4;break;case 11:M=u.UnaryOp.NegVecF32x4;break;case 12:M=u.UnaryOp.NegVecF64x2}break;case a.v128_abs:switch(S.kind){case 11:M=u.UnaryOp.AbsVecF32x4;break;case 12:M=u.UnaryOp.AbsVecF64x2}break;case a.v128_sqrt:switch(S.kind){case 11:M=u.UnaryOp.SqrtVecF32x4;break;case 12:M=u.UnaryOp.SqrtVecF64x2}break;case a.v128_convert:switch(S.kind){case 2:M=u.UnaryOp.ConvertSVecI32x4ToVecF32x4;break;case 7:M=u.UnaryOp.ConvertUVecI32x4ToVecF32x4;break;case 3:M=u.UnaryOp.ConvertSVecI64x2ToVecF64x2;break;case 8:M=u.UnaryOp.ConvertUVecI64x2ToVecF64x2}break;case a.v128_trunc:switch(S.kind){case 2:M=u.UnaryOp.TruncSatSVecF32x4ToVecI32x4;break;case 7:M=u.UnaryOp.TruncSatUVecF32x4ToVecI32x4;break;case 3:M=u.UnaryOp.TruncSatSVecF64x2ToVecI64x2;break;case 8:M=u.UnaryOp.TruncSatUVecF64x2ToVecI64x2}}if(-1==M)return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable();U=e.compileExpression(n[0],l.Type.v128,1);return e.currentType=l.Type.v128,m.unary(M,U);case a.v128_shl:case a.v128_shr:if(!e.options.hasFeature(8))break;if(b(r,s,e)|A(n,2,s,e))return e.currentType=l.Type.v128,m.unreachable();if((S=r[0]).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.v128,m.unreachable();M=-1;switch(t.internalName){case a.v128_shl:switch(S.kind){case 0:case 5:M=u.SIMDShiftOp.ShlVecI8x16;break;case 1:case 6:M=u.SIMDShiftOp.ShlVecI16x8;break;case 2:case 7:M=u.SIMDShiftOp.ShlVecI32x4;break;case 3:case 8:M=u.SIMDShiftOp.ShlVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.SIMDShiftOp.ShlVecI64x2:u.SIMDShiftOp.ShlVecI32x4}break;case a.v128_shr:switch(S.kind){case 0:M=u.SIMDShiftOp.ShrSVecI8x16;break;case 5:M=u.SIMDShiftOp.ShrUVecI8x16;break;case 1:M=u.SIMDShiftOp.ShrSVecI16x8;break;case 6:M=u.SIMDShiftOp.ShrUVecI16x8;break;case 2:M=u.SIMDShiftOp.ShrSVecI32x4;break;case 7:M=u.SIMDShiftOp.ShrUVecI32x4;break;case 3:M=u.SIMDShiftOp.ShrSVecI64x2;break;case 8:M=u.SIMDShiftOp.ShrUVecI64x2;break;case 4:M=e.options.isWasm64?u.SIMDShiftOp.ShrSVecI64x2:u.SIMDShiftOp.ShrSVecI32x4;break;case 9:M=e.options.isWasm64?u.SIMDShiftOp.ShrUVecI64x2:u.SIMDShiftOp.ShrUVecI32x4}}if(-1==M)return e.error(o.DiagnosticCode.Operation_not_supported,s.range),e.currentType=l.Type.v128,m.unreachable();U=e.compileExpression(n[0],l.Type.v128,1),V=e.compileExpression(n[1],l.Type.i32,1);return e.currentType=l.Type.v128,m.simd_shift(M,U,V);case a.v128_and:case a.v128_or:case a.v128_xor:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,2,s,e))return e.currentType=l.Type.v128,m.unreachable();M=-1;switch(t.internalName){default:assert(!1);case a.v128_and:M=u.BinaryOp.AndVec128;break;case a.v128_or:M=u.BinaryOp.OrVec128;break;case a.v128_xor:M=u.BinaryOp.XorVec128}U=e.compileExpression(n[0],l.Type.v128,1),V=e.compileExpression(n[1],l.Type.v128,1);return m.binary(M,U,V);case a.v128_not:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,1,s,e))return e.currentType=l.Type.v128,m.unreachable();U=e.compileExpression(n[0],l.Type.v128,1);return m.unary(u.UnaryOp.NotVec128,U);case a.v128_bitselect:if(!e.options.hasFeature(8))break;if(x(r,s,t)|A(n,3,s,e))return e.currentType=l.Type.v128,m.unreachable();U=e.compileExpression(n[0],l.Type.v128,1),V=e.compileExpression(n[1],l.Type.v128,1),ee=e.compileExpression(n[2],l.Type.v128,1);return m.simd_bitselect(U,V,ee);case a.v128_any_true:case a.v128_all_true:if(!e.options.hasFeature(8))break;if(b(r,s,e)|A(n,1,s,e))return e.currentType=l.Type.bool,m.unreachable();if((S=r[0]).is(256))return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),m.unreachable();M=-1;switch(t.internalName){default:assert(!1);case a.v128_any_true:switch(S.kind){case 0:case 5:M=u.UnaryOp.AnyTrueVecI8x16;break;case 1:case 6:M=u.UnaryOp.AnyTrueVecI16x8;break;case 2:case 7:M=u.UnaryOp.AnyTrueVecI32x4;break;case 3:case 8:M=u.UnaryOp.AnyTrueVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.UnaryOp.AnyTrueVecI64x2:u.UnaryOp.AnyTrueVecI32x4}break;case a.v128_all_true:switch(S.kind){case 0:case 5:M=u.UnaryOp.AllTrueVecI8x16;break;case 1:case 6:M=u.UnaryOp.AllTrueVecI16x8;break;case 2:case 7:M=u.UnaryOp.AllTrueVecI32x4;break;case 3:case 8:M=u.UnaryOp.AllTrueVecI64x2;break;case 4:case 9:M=e.options.isWasm64?u.UnaryOp.AllTrueVecI64x2:u.UnaryOp.AllTrueVecI32x4}}if(-1==M)return e.error(o.DiagnosticCode.Operation_not_supported,s.typeArgumentsRange),e.currentType=l.Type.bool,m.unreachable();U=e.compileExpression(n[0],l.Type.v128,1);return e.currentType=l.Type.bool,m.unary(M,U);case a.idof:var De;S=E(e,r,n,s);return e.currentType=l.Type.u32,S?!(De=S.classReference)||De.hasDecorator(p.DecoratorFlags.UNMANAGED)?(e.error(o.DiagnosticCode.Operation_not_supported,s.range),m.unreachable()):m.i32(De.id):m.unreachable();case a.visit_globals:if(x(r,s,t)|A(n,1,s,e))return e.currentType=l.Type.void,m.unreachable();U=e.compileExpression(n[0],l.Type.u32,1);return e.runtimeFeatures|=4,e.currentType=l.Type.void,m.call(a.visit_globals,[U],u.NativeType.None);case a.visit_members:if(x(r,s,t)|A(n,2,s,e))return e.currentType=l.Type.void,m.unreachable();U=e.compileExpression(n[0],e.options.usizeType,1),V=e.compileExpression(n[1],l.Type.u32,1);return e.runtimeFeatures|=8,e.currentType=l.Type.void,m.call(a.visit_members,[U,V],u.NativeType.None)}return(R=function(e,t,r,n){switch(t.internalName){case a.i32_clz:return f(a.clz,e,l.Type.i32,r,l.Type.i32,n);case a.i64_clz:return f(a.clz,e,l.Type.i64,r,l.Type.i64,n);case a.i32_ctz:return f(a.ctz,e,l.Type.i32,r,l.Type.i32,n);case a.i64_ctz:return f(a.ctz,e,l.Type.i64,r,l.Type.i64,n);case a.i32_popcnt:return f(a.popcnt,e,l.Type.i32,r,l.Type.i32,n);case a.i64_popcnt:return f(a.popcnt,e,l.Type.i64,r,l.Type.i64,n);case a.i32_rotl:return f(a.rotl,e,l.Type.i32,r,l.Type.i32,n);case a.i64_rotl:return f(a.rotl,e,l.Type.i64,r,l.Type.i64,n);case a.i32_rotr:return f(a.rotr,e,l.Type.i32,r,l.Type.i32,n);case a.i64_rotr:return f(a.rotr,e,l.Type.i64,r,l.Type.i64,n);case a.f32_abs:return f(a.abs,e,l.Type.f32,r,l.Type.f32,n);case a.f64_abs:return f(a.abs,e,l.Type.f64,r,l.Type.f64,n);case a.f32_max:return f(a.max,e,l.Type.f32,r,l.Type.f32,n);case a.f64_max:return f(a.max,e,l.Type.f64,r,l.Type.f64,n);case a.f32_min:return f(a.min,e,l.Type.f32,r,l.Type.f32,n);case a.f64_min:return f(a.min,e,l.Type.f64,r,l.Type.f64,n);case a.f32_ceil:return f(a.ceil,e,l.Type.f32,r,l.Type.f32,n);case a.f64_ceil:return f(a.ceil,e,l.Type.f64,r,l.Type.f64,n);case a.f32_floor:return f(a.floor,e,l.Type.f32,r,l.Type.f32,n);case a.f64_floor:return f(a.floor,e,l.Type.f64,r,l.Type.f64,n);case a.f32_copysign:return f(a.copysign,e,l.Type.f32,r,l.Type.f32,n);case a.f64_copysign:return f(a.copysign,e,l.Type.f64,r,l.Type.f64,n);case a.f32_nearest:return f(a.nearest,e,l.Type.f32,r,l.Type.f32,n);case a.f64_nearest:return f(a.nearest,e,l.Type.f64,r,l.Type.f64,n);case a.i32_reinterpret_f32:return f(a.reinterpret,e,l.Type.i32,r,l.Type.f32,n);case a.i64_reinterpret_f64:return f(a.reinterpret,e,l.Type.i64,r,l.Type.f64,n);case a.f32_reinterpret_i32:return f(a.reinterpret,e,l.Type.f32,r,l.Type.i32,n);case a.f64_reinterpret_i64:return f(a.reinterpret,e,l.Type.f64,r,l.Type.i64,n);case a.f32_sqrt:return f(a.sqrt,e,l.Type.f32,r,l.Type.f32,n);case a.f64_sqrt:return f(a.sqrt,e,l.Type.f64,r,l.Type.f64,n);case a.f32_trunc:return f(a.trunc,e,l.Type.f32,r,l.Type.f32,n);case a.f64_trunc:return f(a.trunc,e,l.Type.f64,r,l.Type.f64,n);case a.i32_load8_s:return f(a.load,e,l.Type.i8,r,l.Type.i32,n);case a.i32_load8_u:return f(a.load,e,l.Type.u8,r,l.Type.i32,n);case a.i32_load16_s:return f(a.load,e,l.Type.i16,r,l.Type.i32,n);case a.i32_load16_u:return f(a.load,e,l.Type.u16,r,l.Type.i32,n);case a.i32_load:return f(a.load,e,l.Type.i32,r,l.Type.i32,n);case a.i64_load8_s:return f(a.load,e,l.Type.i8,r,l.Type.i64,n);case a.i64_load8_u:return f(a.load,e,l.Type.u8,r,l.Type.i64,n);case a.i64_load16_s:return f(a.load,e,l.Type.i16,r,l.Type.i64,n);case a.i64_load16_u:return f(a.load,e,l.Type.u16,r,l.Type.i64,n);case a.i64_load32_s:return f(a.load,e,l.Type.i32,r,l.Type.i64,n);case a.i64_load32_u:return f(a.load,e,l.Type.u32,r,l.Type.i64,n);case a.i64_load:return f(a.load,e,l.Type.i64,r,l.Type.i64,n);case a.f32_load:return f(a.load,e,l.Type.f32,r,l.Type.f32,n);case a.f64_load:return f(a.load,e,l.Type.f64,r,l.Type.f64,n);case a.i32_store8:return f(a.store,e,l.Type.i8,r,l.Type.i32,n);case a.i32_store16:return f(a.store,e,l.Type.i16,r,l.Type.i32,n);case a.i32_store:return f(a.store,e,l.Type.i32,r,l.Type.i32,n);case a.i64_store8:return f(a.store,e,l.Type.i8,r,l.Type.i64,n);case a.i64_store16:return f(a.store,e,l.Type.i16,r,l.Type.i64,n);case a.i64_store32:return f(a.store,e,l.Type.i32,r,l.Type.i64,n);case a.i64_store:return f(a.store,e,l.Type.i64,r,l.Type.i64,n);case a.f32_store:return f(a.store,e,l.Type.f32,r,l.Type.f32,n);case a.f64_store:return f(a.store,e,l.Type.f64,r,l.Type.f64,n)}if(e.options.hasFeature(16))switch(t.internalName){case a.i32_atomic_load8_u:return f(a.atomic_load,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_load16_u:return f(a.atomic_load,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_load:return f(a.atomic_load,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_load8_u:return f(a.atomic_load,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_load16_u:return f(a.atomic_load,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_load32_u:return f(a.atomic_load,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_load:return f(a.atomic_load,e,l.Type.i64,r,l.Type.i64,n);case a.i32_atomic_store8:return f(a.atomic_store,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_store16:return f(a.atomic_store,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_store:return f(a.atomic_store,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_store8:return f(a.atomic_store,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_store16:return f(a.atomic_store,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_store32:return f(a.atomic_store,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_store:return f(a.atomic_store,e,l.Type.i64,r,l.Type.i64,n);case a.i32_atomic_rmw8_add_u:return f(a.atomic_add,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_rmw16_add_u:return f(a.atomic_add,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_rmw_add:return f(a.atomic_add,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_rmw8_add_u:return f(a.atomic_add,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_rmw16_add_u:return f(a.atomic_add,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_rmw32_add_u:return f(a.atomic_add,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_rmw_add:return f(a.atomic_add,e,l.Type.i64,r,l.Type.i64,n);case a.i32_atomic_rmw8_sub_u:return f(a.atomic_sub,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_rmw16_sub_u:return f(a.atomic_sub,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_rmw_sub:return f(a.atomic_sub,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_rmw8_sub_u:return f(a.atomic_sub,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_rmw16_sub_u:return f(a.atomic_sub,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_rmw32_sub_u:return f(a.atomic_sub,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_rmw_sub:return f(a.atomic_sub,e,l.Type.i64,r,l.Type.i64,n);case a.i32_atomic_rmw8_and_u:return f(a.atomic_and,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_rmw16_and_u:return f(a.atomic_and,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_rmw_and:return f(a.atomic_and,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_rmw8_and_u:return f(a.atomic_and,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_rmw16_and_u:return f(a.atomic_and,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_rmw32_and_u:return f(a.atomic_and,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_rmw_and:return f(a.atomic_and,e,l.Type.i64,r,l.Type.i64,n);case a.i32_atomic_rmw8_or_u:return f(a.atomic_or,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_rmw16_or_u:return f(a.atomic_or,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_rmw_or:return f(a.atomic_or,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_rmw8_or_u:return f(a.atomic_or,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_rmw16_or_u:return f(a.atomic_or,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_rmw32_or_u:return f(a.atomic_or,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_rmw_or:return f(a.atomic_or,e,l.Type.i64,r,l.Type.i64,n);case a.i32_atomic_rmw8_u_xor:return f(a.atomic_xor,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_rmw16_u_xor:return f(a.atomic_xor,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_rmw_xor:return f(a.atomic_xor,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_rmw8_xor_u:return f(a.atomic_xor,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_rmw16_xor_u:return f(a.atomic_xor,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_rmw32_xor_u:return f(a.atomic_xor,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_rmw_xor:return f(a.atomic_xor,e,l.Type.i64,r,l.Type.i64,n);case a.i32_atomic_rmw8_xchg_u:return f(a.atomic_xchg,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_rmw16_xchg_u:return f(a.atomic_xchg,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_rmw_xchg:return f(a.atomic_xchg,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_rmw8_xchg_u:return f(a.atomic_xchg,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_rmw16_xchg_u:return f(a.atomic_xchg,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_rmw32_xchg_u:return f(a.atomic_xchg,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_rmw_xchg:return f(a.atomic_xchg,e,l.Type.i64,r,l.Type.i64,n);case a.i32_atomic_rmw8_cmpxchg_u:return f(a.atomic_cmpxchg,e,l.Type.u8,r,l.Type.i32,n);case a.i32_atomic_rmw16_cmpxchg_u:return f(a.atomic_cmpxchg,e,l.Type.u16,r,l.Type.i32,n);case a.i32_atomic_rmw_cmpxchg:return f(a.atomic_cmpxchg,e,l.Type.i32,r,l.Type.i32,n);case a.i64_atomic_rmw8_cmpxchg_u:return f(a.atomic_cmpxchg,e,l.Type.u8,r,l.Type.i64,n);case a.i64_atomic_rmw16_cmpxchg_u:return f(a.atomic_cmpxchg,e,l.Type.u16,r,l.Type.i64,n);case a.i64_atomic_rmw32_cmpxchg_u:return f(a.atomic_cmpxchg,e,l.Type.u32,r,l.Type.i64,n);case a.i64_atomic_rmw_cmpxchg:return f(a.atomic_cmpxchg,e,l.Type.i64,r,l.Type.i64,n);case a.i32_wait:return f(a.atomic_wait,e,l.Type.i32,r,l.Type.i32,n);case a.i64_wait:return f(a.atomic_wait,e,l.Type.i64,r,l.Type.i32,n)}if(e.options.hasFeature(8))switch(t.internalName){case a.v128_load:return f(a.load,e,l.Type.v128,r,l.Type.v128,n);case a.v128_store:return f(a.store,e,l.Type.v128,r,l.Type.void,n);case a.i8x16_splat:return f(a.v128_splat,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_extract_lane_s:return f(a.v128_extract_lane,e,l.Type.i8,r,l.Type.i8,n);case a.i8x16_extract_lane_u:return f(a.v128_extract_lane,e,l.Type.u8,r,l.Type.u8,n);case a.i8x16_replace_lane:return f(a.v128_replace_lane,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_add:return f(a.v128_add,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_sub:return f(a.v128_sub,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_mul:return f(a.v128_mul,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_neg:return f(a.v128_neg,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_add_saturate_s:return f(a.v128_add_saturate,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_add_saturate_u:return f(a.v128_add_saturate,e,l.Type.u8,r,l.Type.v128,n);case a.i8x16_sub_saturate_s:return f(a.v128_sub_saturate,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_sub_saturate_u:return f(a.v128_sub_saturate,e,l.Type.u8,r,l.Type.v128,n);case a.i8x16_shl:return f(a.v128_shl,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_shr_s:return f(a.v128_shr,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_shr_u:return f(a.v128_shr,e,l.Type.u8,r,l.Type.v128,n);case a.i8x16_any_true:return f(a.v128_any_true,e,l.Type.i8,r,l.Type.i32,n);case a.i8x16_all_true:return f(a.v128_all_true,e,l.Type.i8,r,l.Type.i32,n);case a.i8x16_eq:return f(a.v128_eq,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_ne:return f(a.v128_ne,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_lt_s:return f(a.v128_lt,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_lt_u:return f(a.v128_lt,e,l.Type.u8,r,l.Type.v128,n);case a.i8x16_le_s:return f(a.v128_le,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_le_u:return f(a.v128_le,e,l.Type.u8,r,l.Type.v128,n);case a.i8x16_gt_s:return f(a.v128_gt,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_gt_u:return f(a.v128_gt,e,l.Type.u8,r,l.Type.v128,n);case a.i8x16_ge_s:return f(a.v128_ge,e,l.Type.i8,r,l.Type.v128,n);case a.i8x16_ge_u:return f(a.v128_ge,e,l.Type.u8,r,l.Type.v128,n);case a.i16x8_splat:return f(a.v128_splat,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_extract_lane_s:return f(a.v128_extract_lane,e,l.Type.i16,r,l.Type.i16,n);case a.i16x8_extract_lane_u:return f(a.v128_extract_lane,e,l.Type.u16,r,l.Type.u16,n);case a.i16x8_replace_lane:return f(a.v128_replace_lane,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_add:return f(a.v128_add,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_sub:return f(a.v128_sub,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_mul:return f(a.v128_mul,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_neg:return f(a.v128_neg,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_add_saturate_s:return f(a.v128_add_saturate,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_add_saturate_u:return f(a.v128_add_saturate,e,l.Type.u16,r,l.Type.v128,n);case a.i16x8_sub_saturate_s:return f(a.v128_sub_saturate,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_sub_saturate_u:return f(a.v128_sub_saturate,e,l.Type.u16,r,l.Type.v128,n);case a.i16x8_shl:return f(a.v128_shl,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_shr_s:return f(a.v128_shr,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_shr_u:return f(a.v128_shr,e,l.Type.u16,r,l.Type.v128,n);case a.i16x8_any_true:return f(a.v128_any_true,e,l.Type.i16,r,l.Type.i32,n);case a.i16x8_all_true:return f(a.v128_all_true,e,l.Type.i16,r,l.Type.i32,n);case a.i16x8_eq:return f(a.v128_eq,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_ne:return f(a.v128_ne,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_lt_s:return f(a.v128_lt,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_lt_u:return f(a.v128_lt,e,l.Type.u16,r,l.Type.v128,n);case a.i16x8_le_s:return f(a.v128_le,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_le_u:return f(a.v128_le,e,l.Type.u16,r,l.Type.v128,n);case a.i16x8_gt_s:return f(a.v128_gt,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_gt_u:return f(a.v128_gt,e,l.Type.u16,r,l.Type.v128,n);case a.i16x8_ge_s:return f(a.v128_ge,e,l.Type.i16,r,l.Type.v128,n);case a.i16x8_ge_u:return f(a.v128_ge,e,l.Type.u16,r,l.Type.v128,n);case a.i32x4_splat:return f(a.v128_splat,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_extract_lane:return f(a.v128_extract_lane,e,l.Type.i32,r,l.Type.i32,n);case a.i32x4_replace_lane:return f(a.v128_replace_lane,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_add:return f(a.v128_add,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_sub:return f(a.v128_sub,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_mul:return f(a.v128_mul,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_neg:return f(a.v128_neg,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_shl:return f(a.v128_shl,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_shr_s:return f(a.v128_shr,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_shr_u:return f(a.v128_shr,e,l.Type.u32,r,l.Type.v128,n);case a.i32x4_any_true:return f(a.v128_any_true,e,l.Type.i32,r,l.Type.i32,n);case a.i32x4_all_true:return f(a.v128_all_true,e,l.Type.i32,r,l.Type.i32,n);case a.i32x4_eq:return f(a.v128_eq,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_ne:return f(a.v128_ne,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_lt_s:return f(a.v128_lt,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_lt_u:return f(a.v128_lt,e,l.Type.u32,r,l.Type.v128,n);case a.i32x4_le_s:return f(a.v128_le,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_le_u:return f(a.v128_le,e,l.Type.u32,r,l.Type.v128,n);case a.i32x4_gt_s:return f(a.v128_gt,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_gt_u:return f(a.v128_gt,e,l.Type.u32,r,l.Type.v128,n);case a.i32x4_ge_s:return f(a.v128_ge,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_ge_u:return f(a.v128_ge,e,l.Type.u32,r,l.Type.v128,n);case a.i32x4_trunc_s_f32x4_sat:return f(a.v128_trunc,e,l.Type.i32,r,l.Type.v128,n);case a.i32x4_trunc_u_f32x4_sat:return f(a.v128_trunc,e,l.Type.u32,r,l.Type.v128,n);case a.i64x2_splat:return f(a.v128_splat,e,l.Type.i64,r,l.Type.v128,n);case a.i64x2_extract_lane:return f(a.v128_extract_lane,e,l.Type.i64,r,l.Type.i64,n);case a.i64x2_replace_lane:return f(a.v128_replace_lane,e,l.Type.i64,r,l.Type.v128,n);case a.i64x2_add:return f(a.v128_add,e,l.Type.i64,r,l.Type.v128,n);case a.i64x2_sub:return f(a.v128_sub,e,l.Type.i64,r,l.Type.v128,n);case a.i64x2_neg:return f(a.v128_neg,e,l.Type.i64,r,l.Type.v128,n);case a.i64x2_shl:return f(a.v128_shl,e,l.Type.i64,r,l.Type.v128,n);case a.i64x2_shr_s:return f(a.v128_shr,e,l.Type.i64,r,l.Type.v128,n);case a.i64x2_shr_u:return f(a.v128_shr,e,l.Type.u64,r,l.Type.v128,n);case a.i64x2_any_true:return f(a.v128_any_true,e,l.Type.i64,r,l.Type.i32,n);case a.i64x2_all_true:return f(a.v128_all_true,e,l.Type.i64,r,l.Type.i32,n);case a.i64x2_trunc_s_f64x2_sat:return f(a.v128_trunc,e,l.Type.i64,r,l.Type.v128,n);case a.i64x2_trunc_u_f64x2_sat:return f(a.v128_trunc,e,l.Type.u64,r,l.Type.v128,n);case a.f32x4_splat:return f(a.v128_splat,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_extract_lane:return f(a.v128_extract_lane,e,l.Type.f32,r,l.Type.f32,n);case a.f32x4_replace_lane:return f(a.v128_replace_lane,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_add:return f(a.v128_add,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_sub:return f(a.v128_sub,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_mul:return f(a.v128_mul,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_div:return f(a.v128_div,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_neg:return f(a.v128_neg,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_min:return f(a.v128_min,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_max:return f(a.v128_max,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_abs:return f(a.v128_abs,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_sqrt:return f(a.v128_sqrt,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_eq:return f(a.v128_eq,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_ne:return f(a.v128_ne,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_lt:return f(a.v128_lt,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_le:return f(a.v128_le,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_gt:return f(a.v128_gt,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_ge:return f(a.v128_ge,e,l.Type.f32,r,l.Type.v128,n);case a.f32x4_convert_s_i32x4:return f(a.v128_convert,e,l.Type.i32,r,l.Type.v128,n);case a.f32x4_convert_u_i32x4:return f(a.v128_convert,e,l.Type.u32,r,l.Type.v128,n);case a.f64x2_splat:return f(a.v128_splat,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_extract_lane:return f(a.v128_extract_lane,e,l.Type.f64,r,l.Type.f64,n);case a.f64x2_replace_lane:return f(a.v128_replace_lane,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_add:return f(a.v128_add,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_sub:return f(a.v128_sub,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_mul:return f(a.v128_mul,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_div:return f(a.v128_div,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_neg:return f(a.v128_neg,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_min:return f(a.v128_min,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_max:return f(a.v128_max,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_abs:return f(a.v128_abs,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_sqrt:return f(a.v128_sqrt,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_eq:return f(a.v128_eq,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_ne:return f(a.v128_ne,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_lt:return f(a.v128_lt,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_le:return f(a.v128_le,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_gt:return f(a.v128_gt,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_ge:return f(a.v128_ge,e,l.Type.f64,r,l.Type.v128,n);case a.f64x2_convert_s_i64x2:return f(a.v128_convert,e,l.Type.i64,r,l.Type.v128,n);case a.f64x2_convert_u_i64x2:return f(a.v128_convert,e,l.Type.u64,r,l.Type.v128,n);case a.v8x16_shuffle:return f(a.v128_shuffle,e,l.Type.i8,r,l.Type.v128,n)}return 0}(e,t,n,s))?(r&&e.error(o.DiagnosticCode.Type_0_is_not_generic,s.typeArgumentsRange,t.internalName),R):(e.error(o.DiagnosticCode.Cannot_find_name_0,s.expression.range,t.internalName),m.unreachable())}function f(e,t,r,n,i,a){assert(t.program.elementsByName.has(e));var s=t.program.elementsByName.get(e);return assert(s.kind==p.ElementKind.FUNCTION_PROTOTYPE),m(t,s,[r],n,i,a,!0)}function T(e,t,r){var n=e.program,i=e.module,a=e.program.stringInstance;if(!a)return i.unreachable();var s,o=n.abortInstance;if(!o||!e.compileFunction(o))return i.unreachable();s=null!==t?e.compileExpression(t,a.type,17):a.type.toNativeZero(i);var c=e.ensureStaticString(r.range.source.normalizedPath);return e.currentType=l.Type.void,i.block(null,[i.call(o.internalName,[s,c,i.i32(r.range.line),i.i32(r.range.column)],u.NativeType.None),i.unreachable()])}function g(e){var t=32*(1<<e.alignLog2);return e.is(1)&&(t|=1024),e.is(8)&&(t|=2048),e.is(512)&&(t|=4096),e.isManaged&&(t|=8192),t/32}function E(e,t,r,n){if(0==r.length)return t&&1==t.length?t[0]:(e.error(o.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.typeArgumentsRange,"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);else{if(t.length)return e.error(o.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.typeArgumentsRange,"1",t.length.toString(10)),null;e.compileExpressionRetainType(r[0],l.Type.i32)}else e.compileExpressionRetainType(r[0],l.Type.i32);return e.currentType}return t&&t.length>1&&e.error(o.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.typeArgumentsRange,"1",t.length.toString(10)),e.error(o.DiagnosticCode.Expected_0_arguments_but_got_1,n.argumentsRange,"1",r.length.toString(10)),null}function v(e,t){var r,n;return t.options.isWasm64?(r=t.precomputeExpression(e,l.Type.usize64,1),(u.getExpressionId(r)!=u.ExpressionId.Const||u.getExpressionType(r)!=u.NativeType.I64||0!=u.getConstValueI64High(r)||(n=u.getConstValueI64Low(r))<0)&&(t.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,e.range),n=-1)):(r=t.precomputeExpression(e,l.Type.usize32,1),(u.getExpressionId(r)!=u.ExpressionId.Const||u.getExpressionType(r)!=u.NativeType.I32||(n=u.getConstValueI32(r))<0)&&(t.error(o.DiagnosticCode.Expression_must_be_a_compile_time_constant,e.range),n=-1)),n}function b(e,t,r,n){if(void 0===n&&(n=!1),e){var i=e.length;if(1==i)return 0;assert(i),n&&(r.currentType=e[0]),r.error(o.DiagnosticCode.Expected_0_type_arguments_but_got_1,t.typeArgumentsRange,"1",i.toString())}else r.error(o.DiagnosticCode.Expected_0_type_arguments_but_got_1,t.range,"1","0");return 1}function I(e,t,r,n){if(void 0===n&&(n=!1),e){var i=e.length;return 1==i?0:(assert(i),n&&(r.currentType=e[0]),r.error(o.DiagnosticCode.Expected_0_type_arguments_but_got_1,t.typeArgumentsRange,"1",i.toString()),1)}return 0}function x(e,t,r){return e?(r.program.error(o.DiagnosticCode.Type_0_is_not_generic,t.typeArgumentsRange,r.internalName),1):0}function A(e,t,r,n){return e.length!=t?(n.error(o.DiagnosticCode.Expected_0_arguments_but_got_1,r.range,t.toString(),e.length.toString()),1):0}function N(e,t,r,n,i){var a=e.length;return a<t?(i.error(o.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,n.range,t.toString(),a.toString()),1):a>r?(i.error(o.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,r.toString(),a.toString()),1):0}!function(e){e.isInteger="~lib/builtins/isInteger",e.isFloat="~lib/builtins/isFloat",e.isBoolean="~lib/builtins/isBoolean",e.isSigned="~lib/builtins/isSigned",e.isReference="~lib/builtins/isReference",e.isString="~lib/builtins/isString",e.isArray="~lib/builtins/isArray",e.isArrayLike="~lib/builtins/isArrayLike",e.isFunction="~lib/builtins/isFunction",e.isNullable="~lib/builtins/isNullable",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_direct="~lib/builtins/call_direct",e.call_indirect="~lib/builtins/call_indirect",e.instantiate="~lib/builtins/instantiate",e.idof="~lib/builtins/idof",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_add_u="~lib/builtins/i32.atomic.rmw8.add_u",e.i32_atomic_rmw16_add_u="~lib/builtins/i32.atomic.rmw16.add_u",e.i32_atomic_rmw_add="~lib/builtins/i32.atomic.rmw.add",e.i64_atomic_rmw8_add_u="~lib/builtins/i64.atomic.rmw8.add_u",e.i64_atomic_rmw16_add_u="~lib/builtins/i64.atomic.rmw16.add_u",e.i64_atomic_rmw32_add_u="~lib/builtins/i64.atomic.rmw32.add_u",e.i64_atomic_rmw_add="~lib/builtins/i64.atomic.rmw.add",e.i32_atomic_rmw8_sub_u="~lib/builtins/i32.atomic.rmw8.sub_u",e.i32_atomic_rmw16_sub_u="~lib/builtins/i32.atomic.rmw16.sub_u",e.i32_atomic_rmw_sub="~lib/builtins/i32.atomic.rmw.sub",e.i64_atomic_rmw8_sub_u="~lib/builtins/i64.atomic.rmw8.sub_u",e.i64_atomic_rmw16_sub_u="~lib/builtins/i64.atomic.rmw16.sub_u",e.i64_atomic_rmw32_sub_u="~lib/builtins/i64.atomic.rmw32.sub_u",e.i64_atomic_rmw_sub="~lib/builtins/i64.atomic.rmw.sub",e.i32_atomic_rmw8_and_u="~lib/builtins/i32.atomic.rmw8.and_u",e.i32_atomic_rmw16_and_u="~lib/builtins/i32.atomic.rmw16.and_u",e.i32_atomic_rmw_and="~lib/builtins/i32.atomic.rmw.and",e.i64_atomic_rmw8_and_u="~lib/builtins/i64.atomic.rmw8.and_u",e.i64_atomic_rmw16_and_u="~lib/builtins/i64.atomic.rmw16.and_u",e.i64_atomic_rmw32_and_u="~lib/builtins/i64.atomic.rmw32.and_u",e.i64_atomic_rmw_and="~lib/builtins/i64.atomic.rmw.and",e.i32_atomic_rmw8_or_u="~lib/builtins/i32.atomic.rmw8.or_u",e.i32_atomic_rmw16_or_u="~lib/builtins/i32.atomic.rmw16.or_u",e.i32_atomic_rmw_or="~lib/builtins/i32.atomic.rmw.or",e.i64_atomic_rmw8_or_u="~lib/builtins/i64.atomic.rmw8.or_u",e.i64_atomic_rmw16_or_u="~lib/builtins/i64.atomic.rmw16.or_u",e.i64_atomic_rmw32_or_u="~lib/builtins/i64.atomic.rmw32.or_u",e.i64_atomic_rmw_or="~lib/builtins/i64.atomic.rmw.or",e.i32_atomic_rmw8_u_xor="~lib/builtins/i32.atomic.rmw8.xor_u",e.i32_atomic_rmw16_u_xor="~lib/builtins/i32.atomic.rmw16.xor_u",e.i32_atomic_rmw_xor="~lib/builtins/i32.atomic.rmw.xor",e.i64_atomic_rmw8_xor_u="~lib/builtins/i64.atomic.rmw8.xor_u",e.i64_atomic_rmw16_xor_u="~lib/builtins/i64.atomic.rmw16.xor_u",e.i64_atomic_rmw32_xor_u="~lib/builtins/i64.atomic.rmw32.xor_u",e.i64_atomic_rmw_xor="~lib/builtins/i64.atomic.rmw.xor",e.i32_atomic_rmw8_xchg_u="~lib/builtins/i32.atomic.rmw8.xchg_u",e.i32_atomic_rmw16_xchg_u="~lib/builtins/i32.atomic.rmw16.xchg_u",e.i32_atomic_rmw_xchg="~lib/builtins/i32.atomic.rmw.xchg",e.i64_atomic_rmw8_xchg_u="~lib/builtins/i64.atomic.rmw8.xchg_u",e.i64_atomic_rmw16_xchg_u="~lib/builtins/i64.atomic.rmw16.xchg_u",e.i64_atomic_rmw32_xchg_u="~lib/builtins/i64.atomic.rmw32.xchg_u",e.i64_atomic_rmw_xchg="~lib/builtins/i64.atomic.rmw.xchg",e.i32_atomic_rmw8_cmpxchg_u="~lib/builtins/i32.atomic.rmw8.cmpxchg_u",e.i32_atomic_rmw16_cmpxchg_u="~lib/builtins/i32.atomic.rmw16.cmpxchg_u",e.i32_atomic_rmw_cmpxchg="~lib/builtins/i32.atomic.rmw.cmpxchg",e.i64_atomic_rmw8_cmpxchg_u="~lib/builtins/i64.atomic.rmw8.cmpxchg_u",e.i64_atomic_rmw16_cmpxchg_u="~lib/builtins/i64.atomic.rmw16.cmpxchg_u",e.i64_atomic_rmw32_cmpxchg_u="~lib/builtins/i64.atomic.rmw32.cmpxchg_u",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.v128_splat="~lib/builtins/v128.splat",e.v128_extract_lane="~lib/builtins/v128.extract_lane",e.v128_replace_lane="~lib/builtins/v128.replace_lane",e.v128_shuffle="~lib/builtins/v128.shuffle",e.v128_load="~lib/builtins/v128.load",e.v128_store="~lib/builtins/v128.store",e.v128_add="~lib/builtins/v128.add",e.v128_sub="~lib/builtins/v128.sub",e.v128_mul="~lib/builtins/v128.mul",e.v128_div="~lib/builtins/v128.div",e.v128_neg="~lib/builtins/v128.neg",e.v128_add_saturate="~lib/builtins/v128.add_saturate",e.v128_sub_saturate="~lib/builtins/v128.sub_saturate",e.v128_shl="~lib/builtins/v128.shl",e.v128_shr="~lib/builtins/v128.shr",e.v128_and="~lib/builtins/v128.and",e.v128_or="~lib/builtins/v128.or",e.v128_xor="~lib/builtins/v128.xor",e.v128_not="~lib/builtins/v128.not",e.v128_bitselect="~lib/builtins/v128.bitselect",e.v128_any_true="~lib/builtins/v128.any_true",e.v128_all_true="~lib/builtins/v128.all_true",e.v128_min="~lib/builtins/v128.min",e.v128_max="~lib/builtins/v128.max",e.v128_abs="~lib/builtins/v128.abs",e.v128_sqrt="~lib/builtins/v128.sqrt",e.v128_eq="~lib/builtins/v128.eq",e.v128_ne="~lib/builtins/v128.ne",e.v128_lt="~lib/builtins/v128.lt",e.v128_le="~lib/builtins/v128.le",e.v128_gt="~lib/builtins/v128.gt",e.v128_ge="~lib/builtins/v128.ge",e.v128_convert="~lib/builtins/v128.convert",e.v128_trunc="~lib/builtins/v128.trunc",e.i8x16="~lib/builtins/i8x16",e.i16x8="~lib/builtins/i16x8",e.i32x4="~lib/builtins/i32x4",e.i64x2="~lib/builtins/i64x2",e.f32x4="~lib/builtins/f32x4",e.f64x2="~lib/builtins/f64x2",e.i8x16_splat="~lib/builtins/i8x16.splat",e.i8x16_extract_lane_s="~lib/builtins/i8x16.extract_lane_s",e.i8x16_extract_lane_u="~lib/builtins/i8x16.extract_lane_u",e.i8x16_replace_lane="~lib/builtins/i8x16.replace_lane",e.i8x16_add="~lib/builtins/i8x16.add",e.i8x16_sub="~lib/builtins/i8x16.sub",e.i8x16_mul="~lib/builtins/i8x16.mul",e.i8x16_neg="~lib/builtins/i8x16.neg",e.i8x16_add_saturate_s="~lib/builtins/i8x16.add_saturate_s",e.i8x16_add_saturate_u="~lib/builtins/i8x16.add_saturate_u",e.i8x16_sub_saturate_s="~lib/builtins/i8x16.sub_saturate_s",e.i8x16_sub_saturate_u="~lib/builtins/i8x16.sub_saturate_u",e.i8x16_shl="~lib/builtins/i8x16.shl",e.i8x16_shr_s="~lib/builtins/i8x16.shr_s",e.i8x16_shr_u="~lib/builtins/i8x16.shr_u",e.i8x16_any_true="~lib/builtins/i8x16.any_true",e.i8x16_all_true="~lib/builtins/i8x16.all_true",e.i8x16_eq="~lib/builtins/i8x16.eq",e.i8x16_ne="~lib/builtins/i8x16.ne",e.i8x16_lt_s="~lib/builtins/i8x16.lt_s",e.i8x16_lt_u="~lib/builtins/i8x16.lt_u",e.i8x16_le_s="~lib/builtins/i8x16.le_s",e.i8x16_le_u="~lib/builtins/i8x16.le_u",e.i8x16_gt_s="~lib/builtins/i8x16.gt_s",e.i8x16_gt_u="~lib/builtins/i8x16.gt_u",e.i8x16_ge_s="~lib/builtins/i8x16.ge_s",e.i8x16_ge_u="~lib/builtins/i8x16.ge_u",e.i16x8_splat="~lib/builtins/i16x8.splat",e.i16x8_extract_lane_s="~lib/builtins/i16x8.extract_lane_s",e.i16x8_extract_lane_u="~lib/builtins/i16x8.extract_lane_u",e.i16x8_replace_lane="~lib/builtins/i16x8.replace_lane",e.i16x8_add="~lib/builtins/i16x8.add",e.i16x8_sub="~lib/builtins/i16x8.sub",e.i16x8_mul="~lib/builtins/i16x8.mul",e.i16x8_neg="~lib/builtins/i16x8.neg",e.i16x8_add_saturate_s="~lib/builtins/i16x8.add_saturate_s",e.i16x8_add_saturate_u="~lib/builtins/i16x8.add_saturate_u",e.i16x8_sub_saturate_s="~lib/builtins/i16x8.sub_saturate_s",e.i16x8_sub_saturate_u="~lib/builtins/i16x8.sub_saturate_u",e.i16x8_shl="~lib/builtins/i16x8.shl",e.i16x8_shr_s="~lib/builtins/i16x8.shr_s",e.i16x8_shr_u="~lib/builtins/i16x8.shr_u",e.i16x8_any_true="~lib/builtins/i16x8.any_true",e.i16x8_all_true="~lib/builtins/i16x8.all_true",e.i16x8_eq="~lib/builtins/i16x8.eq",e.i16x8_ne="~lib/builtins/i16x8.ne",e.i16x8_lt_s="~lib/builtins/i16x8.lt_s",e.i16x8_lt_u="~lib/builtins/i16x8.lt_u",e.i16x8_le_s="~lib/builtins/i16x8.le_s",e.i16x8_le_u="~lib/builtins/i16x8.le_u",e.i16x8_gt_s="~lib/builtins/i16x8.gt_s",e.i16x8_gt_u="~lib/builtins/i16x8.gt_u",e.i16x8_ge_s="~lib/builtins/i16x8.ge_s",e.i16x8_ge_u="~lib/builtins/i16x8.ge_u",e.i32x4_splat="~lib/builtins/i32x4.splat",e.i32x4_extract_lane="~lib/builtins/i32x4.extract_lane",e.i32x4_replace_lane="~lib/builtins/i32x4.replace_lane",e.i32x4_add="~lib/builtins/i32x4.add",e.i32x4_sub="~lib/builtins/i32x4.sub",e.i32x4_mul="~lib/builtins/i32x4.mul",e.i32x4_neg="~lib/builtins/i32x4.neg",e.i32x4_shl="~lib/builtins/i32x4.shl",e.i32x4_shr_s="~lib/builtins/i32x4.shr_s",e.i32x4_shr_u="~lib/builtins/i32x4.shr_u",e.i32x4_any_true="~lib/builtins/i32x4.any_true",e.i32x4_all_true="~lib/builtins/i32x4.all_true",e.i32x4_eq="~lib/builtins/i32x4.eq",e.i32x4_ne="~lib/builtins/i32x4.ne",e.i32x4_lt_s="~lib/builtins/i32x4.lt_s",e.i32x4_lt_u="~lib/builtins/i32x4.lt_u",e.i32x4_le_s="~lib/builtins/i32x4.le_s",e.i32x4_le_u="~lib/builtins/i32x4.le_u",e.i32x4_gt_s="~lib/builtins/i32x4.gt_s",e.i32x4_gt_u="~lib/builtins/i32x4.gt_u",e.i32x4_ge_s="~lib/builtins/i32x4.ge_s",e.i32x4_ge_u="~lib/builtins/i32x4.ge_u",e.i32x4_trunc_s_f32x4_sat="~lib/builtins/i32x4.trunc_s_f32x4_sat",e.i32x4_trunc_u_f32x4_sat="~lib/builtins/i32x4.trunc_u_f32x4_sat",e.i64x2_splat="~lib/builtins/i64x2.splat",e.i64x2_extract_lane="~lib/builtins/i64x2.extract_lane",e.i64x2_replace_lane="~lib/builtins/i64x2.replace_lane",e.i64x2_add="~lib/builtins/i64x2.add",e.i64x2_sub="~lib/builtins/i64x2.sub",e.i64x2_neg="~lib/builtins/i64x2.neg",e.i64x2_shl="~lib/builtins/i64x2.shl",e.i64x2_shr_s="~lib/builtins/i64x2.shr_s",e.i64x2_shr_u="~lib/builtins/i64x2.shr_u",e.i64x2_any_true="~lib/builtins/i64x2.any_true",e.i64x2_all_true="~lib/builtins/i64x2.all_true",e.i64x2_trunc_s_f64x2_sat="~lib/builtins/i64x2.trunc_s_f64x2_sat",e.i64x2_trunc_u_f64x2_sat="~lib/builtins/i64x2.trunc_u_f64x2_sat",e.f32x4_splat="~lib/builtins/f32x4.splat",e.f32x4_extract_lane="~lib/builtins/f32x4.extract_lane",e.f32x4_replace_lane="~lib/builtins/f32x4.replace_lane",e.f32x4_add="~lib/builtins/f32x4.add",e.f32x4_sub="~lib/builtins/f32x4.sub",e.f32x4_mul="~lib/builtins/f32x4.mul",e.f32x4_div="~lib/builtins/f32x4.div",e.f32x4_neg="~lib/builtins/f32x4.neg",e.f32x4_min="~lib/builtins/f32x4.min",e.f32x4_max="~lib/builtins/f32x4.max",e.f32x4_abs="~lib/builtins/f32x4.abs",e.f32x4_sqrt="~lib/builtins/f32x4.sqrt",e.f32x4_eq="~lib/builtins/f32x4.eq",e.f32x4_ne="~lib/builtins/f32x4.ne",e.f32x4_lt="~lib/builtins/f32x4.lt",e.f32x4_le="~lib/builtins/f32x4.le",e.f32x4_gt="~lib/builtins/f32x4.gt",e.f32x4_ge="~lib/builtins/f32x4.ge",e.f32x4_convert_s_i32x4="~lib/builtins/f32x4.convert_s_i32x4",e.f32x4_convert_u_i32x4="~lib/builtins/f32x4.convert_u_i32x4",e.f64x2_splat="~lib/builtins/f64x2.splat",e.f64x2_extract_lane="~lib/builtins/f64x2.extract_lane",e.f64x2_replace_lane="~lib/builtins/f64x2.replace_lane",e.f64x2_add="~lib/builtins/f64x2.add",e.f64x2_sub="~lib/builtins/f64x2.sub",e.f64x2_mul="~lib/builtins/f64x2.mul",e.f64x2_div="~lib/builtins/f64x2.div",e.f64x2_neg="~lib/builtins/f64x2.neg",e.f64x2_min="~lib/builtins/f64x2.min",e.f64x2_max="~lib/builtins/f64x2.max",e.f64x2_abs="~lib/builtins/f64x2.abs",e.f64x2_sqrt="~lib/builtins/f64x2.sqrt",e.f64x2_eq="~lib/builtins/f64x2.eq",e.f64x2_ne="~lib/builtins/f64x2.ne",e.f64x2_lt="~lib/builtins/f64x2.lt",e.f64x2_le="~lib/builtins/f64x2.le",e.f64x2_gt="~lib/builtins/f64x2.gt",e.f64x2_ge="~lib/builtins/f64x2.ge",e.f64x2_convert_s_i64x2="~lib/builtins/f64x2.convert_s_i64x2",e.f64x2_convert_u_i64x2="~lib/builtins/f64x2.convert_u_i64x2",e.v8x16_shuffle="~lib/builtins/v8x16.shuffle",e.heap_base="~lib/heap/__heap_base",e.rtti_base="~lib/rt/__rtti_base",e.visit_globals="~lib/rt/__visit_globals",e.visit_members="~lib/rt/__visit_members",e.ERROR="~lib/diagnostics/ERROR",e.WARNING="~lib/diagnostics/WARNING",e.INFO="~lib/diagnostics/INFO",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.memory_allocate="~lib/memory/memory.allocate",e.memory_free="~lib/memory/memory.free",e.memory_reset="~lib/memory/memory.reset",e.runtime_instanceof="~lib/runtime/runtime.instanceof",e.runtime_flags="~lib/runtime/runtime.flags",e.runtime_allocate="~lib/util/runtime/allocate",e.runtime_reallocate="~lib/util/runtime/reallocate",e.runtime_register="~lib/util/runtime/register",e.runtime_discard="~lib/util/runtime/discard",e.runtime_makeArray="~lib/util/runtime/makeArray",e.Int8Array="~lib/typedarray/Int8Array",e.Uint8Array="~lib/typedarray/Uint8Array",e.Int16Array="~lib/typedarray/Int16Array",e.Uint16Array="~lib/typedarray/Uint16Array",e.Int32Array="~lib/typedarray/Int32Array",e.Uint32Array="~lib/typedarray/Uint32Array",e.Int64Array="~lib/typedarray/Int64Array",e.Uint64Array="~lib/typedarray/Uint64Array",e.Uint8ClampedArray="~lib/typedarray/Uint8ClampedArray",e.Float32Array="~lib/typedarray/Float32Array",e.Float64Array="~lib/typedarray/Float64Array",e.started="~lib/started",e.argc="~lib/argc",e.setargc="~lib/setargc",e.capabilities="~lib/capabilities"}(a=t.BuiltinSymbols||(t.BuiltinSymbols={})),t.compileCall=m,t.compileAbort=T,t.compileVisitGlobals=function(e){var t,r,i=e.module,s=new Array,o=e.ensureFunctionType([l.Type.u32],l.Type.void),c=e.options.nativeSizeType,_=assert(e.program.visitInstance);e.compileFunction(_);try{for(var h=n(e.program.elementsByName.values()),y=h.next();!y.done;y=h.next()){var m=y.value;if(m.kind==p.ElementKind.GLOBAL){var f=m,T=f.type.classReference;if(f.is(d.CommonFlags.COMPILED)&&null!==T&&!T.hasDecorator(p.DecoratorFlags.UNMANAGED))if(f.is(d.CommonFlags.INLINED)){var g=f.constantIntegerValue;(i64_low(g)||i64_high(g))&&s.push(i.call(_.internalName,[e.options.isWasm64?i.i64(i64_low(g),i64_high(g)):i.i32(i64_low(g))],u.NativeType.None))}else s.push(i.if(i.local_tee(1,i.global_get(f.internalName,c)),i.call(_.internalName,[i.local_get(1,c),i.local_get(0,u.NativeType.I32)],u.NativeType.None)))}}}catch(e){t={error:e}}finally{try{y&&!y.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}i.addFunction(a.visit_globals,o,[c],s.length?i.block(null,s):i.nop())},t.compileVisitMembers=function(e){var t,r,o,c,_,h,d=e.program,y=e.module,m=d.options.usizeType,f=m.toNativeType(),T=m.byteSize,g=e.ensureFunctionType([m,l.Type.i32],l.Type.void),E=d.managedClasses,v=assert(d.visitInstance),b=new Array,I=u.Relooper.create(y),x=I.addBlockWithSwitch(y.nop(),y.load(T,!1,f==u.NativeType.I64?y.binary(u.BinaryOp.SubI64,y.local_get(0,f),y.i64(8)):y.binary(u.BinaryOp.SubI32,y.local_get(0,f),y.i32(8)),u.NativeType.I32,0)),A=0;try{for(var N=n(E),S=N.next();!S.done;S=N.next()){var O=i(S.value,2),C=O[0],k=O[1];assert(k.type.isManaged),assert(C==A++);var R=void 0;if(k.isDeclaredInLibrary&&(R=k.lookupInSelf("__visit_impl"))){assert(R.kind==p.ElementKind.FUNCTION_PROTOTYPE);var L=d.resolver.resolveFunction(R,null),F=void 0;if(L&&e.compileFunction(L)){var B=L.signature;assert(1==B.parameterTypes.length&&B.parameterTypes[0]==l.Type.u32&&B.returnType==l.Type.void&&B.thisType==k.type);var D=y.call(L.internalName,[y.local_get(0,f),y.local_get(1,u.NativeType.I32)],u.NativeType.None);F=I.addBlock(k.base?D:y.block(null,[D,y.return()]))}else F=I.addBlock(y.unreachable());I.addBranchForSwitch(x,F,[C]),b.push(F)}else{var P=new Array,w=k.members;if(w)try{for(var U=n(w.values()),M=U.next();!M.done;M=U.next()){var V=M.value;if(V.kind==p.ElementKind.FIELD&&V.parent===k&&V.type.isManaged){var G=V.memoryOffset;assert(G>=0),P.push(y.if(y.local_tee(2,y.load(T,!1,y.local_get(0,f),f,G)),y.call(v.internalName,[y.local_get(2,f),y.local_get(1,u.NativeType.I32)],u.NativeType.None)))}}}catch(e){o={error:e}}finally{try{M&&!M.done&&(c=U.return)&&c.call(U)}finally{if(o)throw o.error}}k.base||P.push(y.return()),F=I.addBlock(s.flatten(y,P,u.NativeType.None)),I.addBranchForSwitch(x,F,[C]),b.push(F)}}}catch(e){t={error:e}}finally{try{S&&!S.done&&(r=N.return)&&r.call(N)}finally{if(t)throw t.error}}try{for(var K=n(E),z=K.next();!z.done;z=K.next()){var Y=i(z.value,2),H=(C=Y[0],(k=Y[1]).base);H&&I.addBranch(b[C],b[H.id])}}catch(e){_={error:e}}finally{try{z&&!z.done&&(h=K.return)&&h.call(K)}finally{if(_)throw _.error}}b.push(I.addBlock(y.unreachable())),I.addBranchForSwitch(x,b[b.length-1],[]),e.compileFunction(v),y.addFunction(a.visit_members,g,[f],I.renderAndDispose(x,2))},t.compileRTTI=function(e){var t,r,s=e.program,o=e.module,c=s.managedClasses,l=c.size,p=4+8*l,_=new Uint8Array(p);y.writeI32(l,_,0);var h=4,d=s.arrayBufferViewInstance,m=d.prototype,f=s.arrayPrototype,T=s.setPrototype,E=s.mapPrototype,v=0;try{for(var b=n(c),I=b.next();!I.done;I=b.next()){var x=i(I.value,2),A=x[0],N=x[1];assert(A==v++);var S=0;if(N.isAcyclic&&(S|=16),N!==d&&N.extends(m)){var O=N.getArrayValueType();S|=1,N.extends(f)&&(S|=2),S|=32*g(O)}else if(N.extends(T)){var C=assert(N.getTypeArgumentsTo(T));assert(1==C.length),S|=4,S|=32*g(C[0])}else N.extends(E)&&(C=assert(N.getTypeArgumentsTo(E)),assert(2==C.length),S|=8,S|=16384*g(C[0]),S|=32*g(C[1]));y.writeI32(S,_,h),h+=4,N.rttiFlags=S;var k=N.base;y.writeI32(k?k.id:0,_,h),h+=4}}catch(e){t={error:e}}finally{try{I&&!I.done&&(r=b.return)&&r.call(b)}finally{if(t)throw t.error}}assert(h==p);var R=s.options.usizeType,L=e.addMemorySegment(_);if(8==R.size){var F=L.offset;o.addGlobal(a.rtti_base,u.NativeType.I64,!1,o.i64(i64_low(F),i64_high(F)))}else o.addGlobal(a.rtti_base,u.NativeType.I32,!1,o.i32(i64_low(L.offset)))}},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,s=n.getFunctionParamCount(e);i<s;++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,s,o=n.getExpressionId(e),c=n.getExpressionType(e);switch(o){case n.ExpressionId.Block:for(null!=(r=n.getBlockName(e))&&(this.push(r),this.push(": ")),this.push("{\n"),s=n.getBlockChildCount(e),i=0;i<s;++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.LocalGet:return this.push("$"),void this.push(n.getLocalGetIndex(e).toString(10));case n.ExpressionId.LocalSet:return this.push("$"),this.push(n.getLocalSetIndex(e).toString(10)),this.push(" = "),void this.decompileExpression(n.getLocalSetValue(e));case n.ExpressionId.GlobalGet:case n.ExpressionId.GlobalSet: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.MemorySize:return void this.push("memory.size()");case n.HostOp.MemoryGrow: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.AtomicNotify:}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}}}},s=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),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.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 s};Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),c=r(3),l=r(1),u=function(){function e(e,t){void 0===t&&(t=!1),this.seen=new Map,this.program=e,this.includePrivate}return e.prototype.walk=function(){var e,t;try{for(var r=a(this.program.filesByName.values()),n=r.next();!n.done;n=r.next()){var i=n.value;i.source.isEntry&&this.visitFile(i)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},e.prototype.visitFile=function(e){var t,r,n,i,o=e.exports;if(o)try{for(var c=a(o),l=c.next();!l.done;l=c.next()){var u=s(l.value,2),p=u[0],_=u[1];this.visitElement(p,_)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var h=e.exportsStar;if(h)try{for(var d=a(h),y=d.next();!y.done;y=d.next()){var m=y.value;this.visitFile(m)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}},e.prototype.visitElement=function(e,t){if(!t.is(o.CommonFlags.PRIVATE)||this.includePrivate){var r=this.seen;if(r.has(t))this.visitAlias(e,t,r.get(t));else switch(r.set(t,e),t.kind){case c.ElementKind.GLOBAL:t.is(o.CommonFlags.COMPILED)&&this.visitGlobal(e,t);break;case c.ElementKind.ENUM:t.is(o.CommonFlags.COMPILED)&&this.visitEnum(e,t);break;case c.ElementKind.FUNCTION_PROTOTYPE:this.visitFunctionInstances(e,t);break;case c.ElementKind.CLASS_PROTOTYPE:this.visitClassInstances(e,t);break;case c.ElementKind.FIELD:t.is(o.CommonFlags.COMPILED)&&this.visitField(e,t);break;case c.ElementKind.PROPERTY_PROTOTYPE:this.visitPropertyInstances(e,t);break;case c.ElementKind.PROPERTY:var n=t,i=n.getterInstance;i&&this.visitFunction(e,i);var s=n.setterInstance;s&&this.visitFunction(e,s);break;case c.ElementKind.NAMESPACE:(function e(t){var r,n,i,s,l,u;var p=t.members;if(p)try{for(var _=a(p.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()),f=m.next();!f.done;f=m.next()){var T=f.value;if(T.is(o.CommonFlags.COMPILED))return!0}}catch(e){i={error:e}}finally{try{f&&!f.done&&(s=m.return)&&s.call(m)}finally{if(i)throw i.error}}break;case c.ElementKind.CLASS_PROTOTYPE:var y=d.instances;if(y)try{for(var g=a(y.values()),E=g.next();!E.done;E=g.next()){var T=E.value;if(T.is(o.CommonFlags.COMPILED))return!0}}catch(e){l={error:e}}finally{try{E&&!E.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}break;default:if(d.is(o.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})(t)&&this.visitNamespace(e,t);break;case c.ElementKind.TYPEDEFINITION:break;default:assert(!1)}}},e.prototype.visitFunctionInstances=function(e,t){var r,n,i=t.instances;if(i)try{for(var s=a(i.values()),c=s.next();!c.done;c=s.next()){var l=c.value;l.is(o.CommonFlags.COMPILED)&&this.visitFunction(e,l)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}},e.prototype.visitClassInstances=function(e,t){var r,n,i=t.instances;if(i)try{for(var s=a(i.values()),c=s.next();!c.done;c=s.next()){var l=c.value;l.is(o.CommonFlags.COMPILED)&&this.visitClass(e,l)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}},e.prototype.visitPropertyInstances=function(e,t){assert(!1)},e}(),p=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,t){var r=this.sb,n=t.is(o.CommonFlags.INLINED);if(l.indent(r,this.indentLevel),n&&r.push("const "),r.push(this.typeToString(t.type)),r.push(" "),r.push(e),n)switch(t.constantValueKind){case 1:r.push(" = "),r.push(i64_to_string(t.constantIntegerValue));break;case 2:r.push(" = "),r.push(t.constantFloatValue.toString());break;default:assert(!1)}r.push(";\n")},t.prototype.visitEnum=function(e,t){var r,n,i,u,p=this.sb;l.indent(p,this.indentLevel++),p.push("interface "),p.push(e),p.push(" {\n");var _=t.members;if(_){try{for(var h=a(_),d=h.next();!d.done;d=h.next()){var y=s(d.value,2),m=y[0];if((E=y[1]).kind==c.ElementKind.ENUMVALUE){var f=E.is(o.CommonFlags.INLINED);l.indent(p,this.indentLevel),f?p.push("const "):p.push("readonly "),p.push("unsigned long "),p.push(m),f&&(p.push(" = "),assert(1==E.constantValueKind),p.push(i64_low(E.constantIntegerValue).toString(10))),p.push(";\n")}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}try{for(var T=a(_.values()),g=T.next();!g.done;g=T.next()){var E;(E=g.value).kind!=c.ElementKind.ENUMVALUE&&this.visitElement(E.name,E)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(u=T.return)&&u.call(T)}finally{if(i)throw i.error}}}l.indent(p,--this.indentLevel),p.push("}\n")},t.prototype.visitFunction=function(e,t){var r,n,i=this.sb,s=t.signature;l.indent(i,this.indentLevel),i.push(this.typeToString(s.returnType)),i.push(" "),i.push(e),i.push("(");for(var o=s.parameterTypes,c=o.length,u=0;u<c;++u)u&&i.push(", "),i.push(this.typeToString(o[u])),i.push(" "),i.push(s.getParameterName(u));i.push(");\n");var p=t.members;if(p&&p.size){l.indent(i,this.indentLevel),i.push("interface "),i.push(t.name),i.push(" {\n");try{for(var _=a(p.values()),h=_.next();!h.done;h=_.next()){var d=h.value;this.visitElement(d.name,d)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}l.indent(i,--this.indentLevel),i.push("}\n")}},t.prototype.visitClass=function(e,t){var r=this.sb;l.indent(r,this.indentLevel++),r.push("interface "),r.push(e),r.push(" {\n"),l.indent(r,--this.indentLevel),r.push("}\n")},t.prototype.visitInterface=function(e,t){this.visitClass(e,t)},t.prototype.visitField=function(e,t){},t.prototype.visitNamespace=function(e,t){var r,n,i=this.sb;l.indent(i,this.indentLevel++),i.push("interface "),i.push(e),i.push(" {\n");var s=t.members;if(s)try{for(var o=a(s.values()),c=o.next();!c.done;c=o.next()){var u=c.value;this.visitElement(u.name,u)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}l.indent(i,--this.indentLevel),i.push("}\n")},t.prototype.visitAlias=function(e,t,r){},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}(u);t.IDLBuilder=p;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.unknown=new Set,n}return i(t,e),t.build=function(e){return new t(e).build()},t.prototype.visitGlobal=function(e,t){var r=this.sb,n=t.is(o.CommonFlags.INLINED);l.indent(r,this.indentLevel),t.is(o.CommonFlags.STATIC)?n?r.push("static readonly "):r.push("static "):n?r.push("export const "):r.push("export var "),r.push(e),r.push(": "),r.push(this.typeToString(t.type)),r.push(";\n"),this.visitNamespace(e,t)},t.prototype.visitEnum=function(e,t){var r,n,i=this.sb;l.indent(i,this.indentLevel++),i.push("export enum "),i.push(e),i.push(" {\n");var u=t.members;if(u){var p=u.size;try{for(var _=a(u),h=_.next();!h.done;h=_.next()){var d=s(h.value,2),y=d[0],m=d[1];m.kind==c.ElementKind.ENUMVALUE&&(l.indent(i,this.indentLevel),i.push(y),m.is(o.CommonFlags.INLINED)&&(i.push(" = "),assert(1==m.constantValueKind),i.push(i64_low(m.constantIntegerValue).toString(10))),i.push(",\n"),--p)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}p&&this.visitNamespace(e,t)}l.indent(i,--this.indentLevel),i.push("}\n")},t.prototype.visitFunction=function(e,t){if(!t.isAny(o.CommonFlags.PRIVATE|o.CommonFlags.SET)){var r=this.sb,n=t.signature;if(l.indent(r,this.indentLevel),t.is(o.CommonFlags.PROTECTED)&&r.push("protected "),t.is(o.CommonFlags.STATIC)&&r.push("static "),t.is(o.CommonFlags.GET))return r.push("get "),r.push(e),r.push("(): "),r.push(this.typeToString(n.returnType)),void r.push(";\n");t.isAny(o.CommonFlags.STATIC|o.CommonFlags.INSTANCE)||r.push("export function "),r.push(e),r.push("(");for(var i=n.parameterTypes,a=i.length,s=0;s<a;++s)s&&r.push(", "),r.push(n.getParameterName(s)),r.push(": "),r.push(this.typeToString(i[s]));t.isAny(o.CommonFlags.CONSTRUCTOR|o.CommonFlags.SET)?r.push(")"):(r.push("): "),r.push(this.typeToString(n.returnType))),r.push(";\n"),this.visitNamespace(e,t)}},t.prototype.visitClass=function(e,t){var r,n,i,s,u=this.sb,p=t.kind==c.ElementKind.INTERFACE;l.indent(u,this.indentLevel++),p?u.push("export interface "):(t.is(o.CommonFlags.ABSTRACT)&&u.push("abstract "),u.push("export class ")),u.push(e),u.push(" {\n");var _=t.prototype.members;if(_)try{for(var h=a(_.values()),d=h.next();!d.done;d=h.next()){var y=d.value;this.visitElement(y.name,y)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var m=t.members;if(m)try{for(var f=a(m.values()),T=f.next();!T.done;T=f.next()){y=T.value;this.visitElement(y.name,y)}}catch(e){i={error:e}}finally{try{T&&!T.done&&(s=f.return)&&s.call(f)}finally{if(i)throw i.error}}l.indent(u,--this.indentLevel),u.push("}\n")},t.prototype.visitInterface=function(e,t){this.visitClass(e,t)},t.prototype.visitField=function(e,t){if(!t.is(o.CommonFlags.PRIVATE)){var r=this.sb;l.indent(r,this.indentLevel),t.is(o.CommonFlags.PROTECTED)&&r.push("protected "),t.is(o.CommonFlags.STATIC)&&r.push("static "),t.is(o.CommonFlags.READONLY)&&r.push("readonly "),r.push(e),r.push(": "),r.push(this.typeToString(t.type)),r.push(";\n")}},t.prototype.visitNamespace=function(e,t){var r,n,i=t.members;if(i&&i.size){var s=this.sb;l.indent(s,this.indentLevel++),s.push("export namespace "),s.push(e),s.push(" {\n");try{for(var o=a(i.values()),c=o.next();!c.done;c=o.next()){var u=c.value;this.visitElement(u.name,u)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}l.indent(s,--this.indentLevel),s.push("}\n")}},t.prototype.visitAlias=function(e,t,r){var n=this.sb;l.indent(n,this.indentLevel),n.push("export const "),n.push(e),n.push(" = typeof "),n.push(r),n.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),"any"}},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}(u);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),s=r(3),o=r(7),c=r(2),l=r(1),u=r(5),p=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 s.Program(t.diagnostics),t}return i(t,e),t.prototype.parseFile=function(e,t,r){var n=l.normalizePath(t),i=u.mangleInternalPath(n);if(!this.donelog.has(i)){this.donelog.add(i),this.seenlog.add(i);var s=new u.Source(n,e,r?u.SourceKind.ENTRY:t.startsWith(a.LIBRARY_PREFIX)&&t.indexOf(a.PATH_DELIMITER,a.LIBRARY_PREFIX.length)<0?u.SourceKind.LIBRARY:u.SourceKind.DEFAULT),c=this.program;c.sources.push(s);var p=new o.Tokenizer(s,c.diagnostics);p.onComment=this.onComment,s.tokenizer=p;for(var _=s.statements;!p.skip(o.Token.ENDOFFILE);){var h=this.parseTopLevelStatement(p,null);h&&_.push(h)}p.finish()}},t.prototype.parseTopLevelStatement=function(e,t){void 0===t&&(t=null);for(var r=a.CommonFlags.NONE,n=-1,i=null;e.skip(o.Token.AT);){n<0&&(n=e.tokenPos);var s=this.parseDecorator(e);s?i?i.push(s):i=[s]:this.skipStatement(e)}var l=0,p=0,_=0,h=0;e.skip(o.Token.EXPORT)&&(n<0&&(n=e.tokenPos),r|=a.CommonFlags.EXPORT,l=e.tokenPos,p=e.pos,e.skip(o.Token.DEFAULT)&&(_=e.tokenPos,h=e.pos));var d=0,y=0,m=null!=t&&t.is(a.CommonFlags.AMBIENT);e.skip(o.Token.DECLARE)?m?this.error(c.DiagnosticCode.A_declare_modifier_cannot_be_used_in_an_already_ambient_context,e.range()):(n<0&&(n=e.tokenPos),d=n,y=e.pos,r|=a.CommonFlags.DECLARE|a.CommonFlags.AMBIENT):m&&(r|=a.CommonFlags.AMBIENT);var f=null,T=e.peek();switch(n<0&&(n=e.nextTokenPos),T){case o.Token.CONST:e.next(),r|=a.CommonFlags.CONST,f=e.skip(o.Token.ENUM)?this.parseEnum(e,r,i,n):this.parseVariable(e,r,i,n),i=null;break;case o.Token.LET:r|=a.CommonFlags.LET;case o.Token.VAR:e.next(),f=this.parseVariable(e,r,i,n),i=null;break;case o.Token.ENUM:e.next(),f=this.parseEnum(e,r,i,n),i=null;break;case o.Token.FUNCTION:e.next(),f=this.parseFunction(e,r,i,n),i=null;break;case o.Token.ABSTRACT:var g=e.mark();if(e.next(),!e.skip(o.Token.CLASS)){e.reset(g),f=this.parseStatement(e,!0);break}e.discard(g),r|=a.CommonFlags.ABSTRACT;case o.Token.CLASS:case o.Token.INTERFACE:e.next(),f=this.parseClassOrInterface(e,r,i,n),i=null;break;case o.Token.NAMESPACE:g=e.mark();e.next(),e.peek(!1,o.IdentifierHandling.PREFER)==o.Token.IDENTIFIER?(e.discard(g),f=this.parseNamespace(e,r,i,n),i=null):(e.reset(g),f=this.parseStatement(e,!0));break;case o.Token.IMPORT:e.next(),f=(r|=a.CommonFlags.IMPORT)&a.CommonFlags.EXPORT?this.parseExportImport(e,n):this.parseImport(e);break;case o.Token.TYPE:g=e.mark();e.next(),e.peek(!1,o.IdentifierHandling.PREFER)==o.Token.IDENTIFIER?(e.discard(g),f=this.parseTypeDeclaration(e,r,i,n),i=null):(e.reset(g),f=this.parseStatement(e,!0));break;default:r&a.CommonFlags.EXPORT?h&&e.skipIdentifier(o.IdentifierHandling.PREFER)?(y&&this.error(c.DiagnosticCode.An_export_assignment_cannot_have_modifiers,e.range(d,y)),f=this.parseExportDefaultAlias(e,n,_,h),_=h=0):f=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"),y&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(d,y),"declare"),t||(f=this.parseStatement(e,!0)))}if(i)for(var E=0,v=i.length;E<v;++E)this.error(c.DiagnosticCode.Decorators_are_not_valid_here,i[E].range);if(h&&null!==f)switch(f.kind){case u.NodeKind.ENUMDECLARATION:case u.NodeKind.FUNCTIONDECLARATION:case u.NodeKind.CLASSDECLARATION:case u.NodeKind.INTERFACEDECLARATION:case u.NodeKind.NAMESPACEDECLARATION:return u.Node.createExportDefaultStatement(f,e.range(n,e.pos));default:this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(_,h),"default")}return f},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==o.Token.OPENPAREN){var s=e.skip(o.Token.OPENPAREN),l=this.tryParseSignature(e);if(l){if(s){if(!e.skip(o.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null;if(!e.skip(o.Token.BAR))return this.error(c.DiagnosticCode._0_expected,e.range(),"|"),null;e.skip(o.Token.NULL)||this.error(c.DiagnosticCode._0_expected,e.range(),"null"),l.isNullable=!0}return l}if(s||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 p=this.parseType(e,!1,r);if(!p)return null;if(!e.skip(o.Token.CLOSEPAREN))return r||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"}"),null;(n=p).range.start=a,n.range.end=e.pos}else if(i==o.Token.VOID)n=u.Node.createType(u.Node.createSimpleTypeName("void",e.range()),[],!1,e.range(a,e.pos));else if(i==o.Token.THIS)n=u.Node.createType(u.Node.createSimpleTypeName("this",e.range()),[],!1,e.range(a,e.pos));else if(i==o.Token.TRUE||i==o.Token.FALSE)n=u.Node.createType(u.Node.createSimpleTypeName("bool",e.range()),[],!1,e.range(a,e.pos));else if(i==o.Token.STRINGLITERAL)e.readString(),n=u.Node.createType(u.Node.createSimpleTypeName("string",e.range()),[],!1,e.range(a,e.pos));else{if(i!=o.Token.IDENTIFIER)return r||this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;for(var _=u.Node.createSimpleTypeName(e.readIdentifier(),e.range()),h=_,d=null,y=!1;e.skip(o.Token.DOT);){if(!e.skip(o.Token.IDENTIFIER))return this.error(c.DiagnosticCode.Identifier_expected,e.range(e.pos)),null;var m=u.Node.createSimpleTypeName(e.readIdentifier(),e.range());h.next=m,h=m}if(e.skip(o.Token.LESSTHAN)){do{var f=this.parseType(e,!0,r);if(!f)return null;d?d.push(f):d=[f]}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.GREATERTHAN))return r||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),">"),null}for(;e.skip(o.Token.BAR);){if(!e.skip(o.Token.NULL))return r||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"null"),null;y=!0}n=u.Node.createType(_,d||[],y,e.range(a,e.pos))}for(;e.skip(o.Token.OPENBRACKET);){var T=e.tokenPos;if(!e.skip(o.Token.CLOSEBRACKET))return r||this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null;var g=e.range(T,e.pos);y=!1;if(e.skip(o.Token.BAR)){if(!e.skip(o.Token.NULL))return r||this.error(c.DiagnosticCode._0_expected,e.range(),"null"),null;y=!0}if(n=u.Node.createType(u.Node.createSimpleTypeName("Array",g),[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,s=!1;if(e.skip(o.Token.CLOSEPAREN))s=!0,e.discard(r),i=[];else{s=!1;do{var l=u.ParameterKind.DEFAULT;if(e.skip(o.Token.DOT_DOT_DOT)&&(s=!0,e.discard(r),l=u.ParameterKind.REST),e.skip(o.Token.THIS)){if(!e.skip(o.Token.COLON))return e.reset(r),this.tryParseSignatureIsSignature=!1,null;s=!0,e.discard(r);var p=this.parseType(e,!1);if(!p)return null;if(p.kind!=u.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,p.range),this.tryParseSignatureIsSignature=!0,null;a=p}else{if(!e.skipIdentifier())return s?this.error(c.DiagnosticCode.Identifier_expected,e.range()):e.reset(r),this.tryParseSignatureIsSignature=s,null;var _=u.Node.createIdentifierExpression(e.readIdentifier(),e.range(e.tokenPos,e.pos));if(e.skip(o.Token.QUESTION)&&(s=!0,e.discard(r),l==u.ParameterKind.REST?this.error(c.DiagnosticCode.A_rest_parameter_cannot_be_optional,e.range()):l=u.ParameterKind.OPTIONAL),e.skip(o.Token.COLON)){s=!0,e.discard(r);var h=this.parseType(e);if(!h)return this.tryParseSignatureIsSignature=s,null;var d=new u.ParameterNode;d.parameterKind=l,d.name=_,d.type=h,i?i.push(d):i=[d]}else s&&this.error(c.DiagnosticCode.Type_expected,e.range())}}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.CLOSEPAREN))return s?this.error(c.DiagnosticCode._0_expected,e.range(),")"):e.reset(r),this.tryParseSignatureIsSignature=s,null}return e.skip(o.Token.EQUALS_GREATERTHAN)?(s=!0,e.discard(r),(t=this.parseType(e))?(this.tryParseSignatureIsSignature=!0,u.Node.createSignature(i||[],t,a,!1,e.range(n,e.pos))):(this.tryParseSignatureIsSignature=s,null)):(s?this.error(c.DiagnosticCode._0_expected,e.range(),"=>"):e.reset(r),this.tryParseSignatureIsSignature=s,null)},t.prototype.parseDecorator=function(e){var t=e.tokenPos;if(e.skipIdentifier()){for(var r=e.readIdentifier(),n=u.Node.createIdentifierExpression(r,e.range(t,e.pos));e.skip(o.Token.DOT);){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;r=e.readIdentifier(),n=u.Node.createPropertyAccessExpression(n,u.Node.createIdentifierExpression(r,e.range()),e.range(t,e.pos))}var i=void 0;if(!e.skip(o.Token.OPENPAREN))return u.Node.createDecorator(n,null,e.range(t,e.pos));if(i=this.parseArguments(e))return u.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(o.Token.COMMA));var s=u.Node.createVariableStatement(i,r,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),s},t.prototype.parseVariableDeclaration=function(e,t,r){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var n=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),i=t;e.skip(o.Token.EXCLAMATION)&&(i|=a.CommonFlags.DEFINITE_ASSIGNMENT);var s=null;e.skip(o.Token.COLON)&&(s=this.parseType(e));var l=null;if(e.skip(o.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):s||this.error(c.DiagnosticCode.Type_expected,e.range(e.pos));var p=o.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,p),u.Node.createVariableDeclaration(n,s,l,r,i,p)},t.prototype.parseEnum=function(e,t,r,n){if(e.next()!=o.Token.IDENTIFIER)return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var i=u.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.next()!=o.Token.OPENBRACE)return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(var s=new Array;!e.skip(o.Token.CLOSEBRACE);){var l=this.parseEnumValue(e,a.CommonFlags.NONE);if(!l)return null;if(s.push(l),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}var p=u.Node.createEnumDeclaration(i,s,r,t,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),p},t.prototype.parseEnumValue=function(e,t){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var r=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),n=null;return e.skip(o.Token.EQUALS)&&!(n=this.parseExpression(e,2))?null:u.Node.createEnumValueDeclaration(r,n,t,o.Range.join(r.range,e.range()))},t.prototype.parseReturn=function(e){var t=null;if(e.peek(!0)!=o.Token.SEMICOLON&&e.nextToken!=o.Token.CLOSEBRACE&&!e.nextTokenOnNewLine&&!(t=this.parseExpression(e)))return null;var r=u.Node.createReturnStatement(t,e.range());return e.skip(o.Token.SEMICOLON),r},t.prototype.parseTypeParameters=function(e){for(var t=null,r=!1;!e.skip(o.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?t.push(n):t=[n],!e.skip(o.Token.COMMA)){if(e.skip(o.Token.GREATERTHAN))break;return this.error(c.DiagnosticCode._0_expected,e.range(),">"),null}}return t&&t.length||this.error(c.DiagnosticCode.Type_parameter_list_cannot_be_empty,e.range()),t},t.prototype.parseTypeParameter=function(e){if(e.next()==o.Token.IDENTIFIER){var t=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(o.Token.EXTENDS)){if(!(i=this.parseType(e)))return null;if(i.kind!=u.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,i.range),null;r=i}var n=null;if(e.skip(o.Token.EQUALS)){var i;if(!(i=this.parseType(e)))return null;if(i.kind!=u.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,i.range),null;n=i}return u.Node.createTypeParameter(t,r,n,o.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,s=null;if(this.parseParametersThis=null,e.skip(o.Token.THIS)){if(!e.skip(o.Token.COLON))return this.error(c.DiagnosticCode._0_expected,e.range(),":"),null;if(!(s=this.parseType(e)))return null;if(s.kind==u.NodeKind.TYPE?this.parseParametersThis=s:this.error(c.DiagnosticCode.Operation_not_supported,s.range),!e.skip(o.Token.COMMA))return e.skip(o.Token.CLOSEPAREN)?r:(this.error(c.DiagnosticCode._0_expected,e.range(),")"),null)}for(;!e.skip(o.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 u.ParameterKind.OPTIONAL:i=!0;break;case u.ParameterKind.REST:n=l}if(r.push(l),!e.skip(o.Token.COMMA)){if(e.skip(o.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,s=a.CommonFlags.NONE;if(t&&(e.skip(o.Token.PUBLIC)?(i=e.range(),s|=a.CommonFlags.PUBLIC):e.skip(o.Token.PROTECTED)?(i=e.range(),s|=a.CommonFlags.PROTECTED):e.skip(o.Token.PRIVATE)&&(i=e.range(),s|=a.CommonFlags.PRIVATE),e.peek()==o.Token.READONLY)){var l=e.mark();e.next(),e.peek()!=o.Token.COLON?(e.discard(l),i||(i=e.range()),s|=a.CommonFlags.READONLY):e.reset(l)}if(e.skip(o.Token.DOT_DOT_DOT)&&(s?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 p=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),_=null;if((n=e.skip(o.Token.QUESTION))&&r&&this.error(c.DiagnosticCode.A_rest_parameter_cannot_be_optional,p.range),e.skip(o.Token.COLON)){if(!(_=this.parseType(e)))return null}else _=u.Node.createOmittedType(e.range(e.pos));var h=null;if(e.skip(o.Token.EQUALS)&&(r&&this.error(c.DiagnosticCode.A_rest_parameter_cannot_have_an_initializer,p.range),n?this.error(c.DiagnosticCode.Parameter_cannot_have_question_mark_and_initializer,p.range):n=!0,!(h=this.parseExpression(e,2))))return null;var d=u.Node.createParameter(p,_,h,r?u.ParameterKind.REST:n?u.ParameterKind.OPTIONAL:u.ParameterKind.DEFAULT,o.Range.join(i,e.range()));return d.flags|=s,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=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),s=-1,l=null;if(e.skip(o.Token.LESSTHAN)){if(s=e.tokenPos,!(l=this.parseTypeParameters(e)))return null;t|=a.CommonFlags.GENERIC}if(!e.skip(o.Token.OPENPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"("),null;s<0&&(s=e.tokenPos);var p=this.parseParameters(e);if(!p)return null;var _=this.parseParametersThis,h=0!=(t&a.CommonFlags.SET);h&&(1!=p.length&&this.error(c.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,i.range),p.length&&p[0].initializer&&this.error(c.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,i.range)),t&a.CommonFlags.GET&&p.length&&this.error(c.DiagnosticCode.A_get_accessor_cannot_have_parameters,i.range);var d=null;if(e.skip(o.Token.COLON)&&!(d=this.parseType(e,!0,h)))return null;d||(d=u.Node.createOmittedType(e.range(e.pos)),h||this.error(c.DiagnosticCode.Type_expected,d.range));var y=u.Node.createSignature(p,d,_,!1,e.range(s,e.pos)),m=null;if(e.skip(o.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 f=u.Node.createFunctionDeclaration(i,l,y,m,r,t,0,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),f},t.prototype.parseFunctionExpression=function(e){var t,r=e.tokenPos,n=0;if(e.token==o.Token.FUNCTION){if(t=e.skipIdentifier()?u.Node.createIdentifierExpression(e.readIdentifier(),e.range()):u.Node.createEmptyIdentifierExpression(e.range(e.pos)),!e.skip(o.Token.OPENPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"("),null}else n=1,assert(e.token==o.Token.OPENPAREN),t=u.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,s){void 0===i&&(i=-1),void 0===s&&(s=-1),i<0&&(i=t.range.start),s<0&&(s=i);var l=null;if(2!=n&&e.skip(o.Token.COLON)){if(!(l=this.parseType(e)))return null}else l=u.Node.createOmittedType(e.range(e.pos));if(n&&!e.skip(o.Token.EQUALS_GREATERTHAN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"=>"),null;var p=u.Node.createSignature(r,l,null,!1,e.range(s,e.pos)),_=null;if(n)if(e.skip(o.Token.OPENBRACE))_=this.parseBlockStatement(e,!1);else{var h=this.parseExpression(e,2);h&&(_=u.Node.createExpressionStatement(h))}else{if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;_=this.parseBlockStatement(e,!1)}if(!_)return null;var d=u.Node.createFunctionDeclaration(t,null,p,_,null,a.CommonFlags.NONE,n,e.range(i,e.pos));return u.Node.createFunctionExpression(d)},t.prototype.parseClassOrInterface=function(e,t,r,n){var i=e.token==o.Token.INTERFACE;if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var s=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),l=null;if(e.skip(o.Token.LESSTHAN)){if(!(l=this.parseTypeParameters(e)))return null;t|=a.CommonFlags.GENERIC}var p=null;if(e.skip(o.Token.EXTENDS)){var _=this.parseType(e);if(!_)return null;if(_.kind!=u.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,_.range),null;p=_}var h=null;if(e.skip(o.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.push(d):h=[d])}while(e.skip(o.Token.COMMA))}if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;var y,m=new Array;if(i?(assert(!h),y=u.Node.createInterfaceDeclaration(s,l,p,m,r,t,e.range(n,e.pos))):y=u.Node.createClassDeclaration(s,l,p,h,m,r,t,e.range(n,e.pos)),!e.skip(o.Token.CLOSEBRACE))do{var f=this.parseClassMember(e,y);if(f)m.push(f);else if(this.skipStatement(e),e.skip(o.Token.ENDOFFILE))return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}while(!e.skip(o.Token.CLOSEBRACE));return y.range.end=e.pos,y},t.prototype.parseClassExpression=function(e){var t,r=e.tokenPos;if(t=e.skipIdentifier()?u.Node.createIdentifierExpression(e.readIdentifier(),e.range()):u.Node.createEmptyIdentifierExpression(e.range(e.pos)),!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;var n=new Array,i=u.Node.createClassDeclaration(t,[],null,null,n,null,a.CommonFlags.NONE,e.range(r,e.pos));if(!e.skip(o.Token.CLOSEBRACE))do{var s=this.parseClassMember(e,i);if(s)n.push(s);else if(this.skipStatement(e),e.skip(o.Token.ENDOFFILE))return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}while(!e.skip(o.Token.CLOSEBRACE));return i.range.end=e.pos,u.Node.createClassExpression(i)},t.prototype.parseClassMember=function(e,t){var r=e.pos,n=t.kind==u.NodeKind.INTERFACEDECLARATION,i=null;if(e.skip(o.Token.AT)){do{var s=this.parseDecorator(e);if(!s)break;i?i.push(s):i=[s]}while(e.skip(o.Token.AT));i&&n&&this.error(c.DiagnosticCode.Decorators_are_not_valid_here,o.Range.join(i[0].range,i[i.length-1].range))}var l=t.flags&a.CommonFlags.AMBIENT;n&&(l|=a.CommonFlags.VIRTUAL);var p=0,_=0;e.skip(o.Token.PUBLIC)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"public"),l|=a.CommonFlags.PUBLIC,p=e.tokenPos,_=e.pos):e.skip(o.Token.PRIVATE)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"private"),l|=a.CommonFlags.PRIVATE,p=e.tokenPos,_=e.pos):e.skip(o.Token.PROTECTED)&&(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"protected"),l|=a.CommonFlags.PROTECTED,p=e.tokenPos,_=e.pos);var h=0,d=0,y=0,m=0;e.skip(o.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(o.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 f=0,T=0;e.skip(o.Token.READONLY)&&(l|=a.CommonFlags.READONLY,f=e.tokenPos,T=e.pos);var g,E=e.mark(),v=!1,b=!1,I=!1,x=0,A=0;if(n||(e.skip(o.Token.GET)?e.peek(!0,o.IdentifierHandling.PREFER)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine?e.reset(E):(l|=a.CommonFlags.GET,b=!0,x=e.tokenPos,A=e.pos,l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(f,T),"readonly")):e.skip(o.Token.SET)?e.peek(!0,o.IdentifierHandling.PREFER)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine?e.reset(E):(l|=a.CommonFlags.SET,I=!0,x=e.tokenPos,A=e.pos,l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(f,T),"readonly")):e.skip(o.Token.CONSTRUCTOR)&&(v=!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(f,T),"readonly"))),v)g=u.Node.createConstructorExpression(e.range());else{if(!b&&!I&&e.skip(o.Token.OPENBRACKET)){l&a.CommonFlags.PUBLIC?this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(p,_),"public"):l&a.CommonFlags.PROTECTED?this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(p,_),"protected"):l&a.CommonFlags.PRIVATE&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(p,_),"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(f,T),"readonly");var N=this.parseIndexSignatureDeclaration(e,i);return N?(e.skip(o.Token.SEMICOLON),N):null}if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;g=u.Node.createIdentifierExpression(e.readIdentifier(),e.range())}var S=null;if(e.skip(o.Token.LESSTHAN)){var O=e.tokenPos;if(!(S=this.parseTypeParameters(e)))return null;v?this.error(c.DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration,e.range(O,e.pos)):b||I?this.error(c.DiagnosticCode.An_accessor_cannot_have_type_parameters,e.range(O,e.pos)):l|=a.CommonFlags.GENERIC}if(e.skip(o.Token.OPENPAREN)){var C=e.tokenPos,k=this.parseParameters(e,v);if(!k)return null;var R=this.parseParametersThis;if(v)for(var L=0,F=k.length;L<F;++L){var B=k[L];if(B.isAny(a.CommonFlags.PUBLIC|a.CommonFlags.PROTECTED|a.CommonFlags.PRIVATE|a.CommonFlags.READONLY)){var D=u.Node.createFieldDeclaration(B.name,B.type,null,null,B.flags|a.CommonFlags.INSTANCE,B.range);D.parameterIndex=L,B.implicitFieldDeclaration=D,t.members.push(D)}}else b?k.length&&this.error(c.DiagnosticCode.A_get_accessor_cannot_have_parameters,g.range):I&&(1!=k.length&&this.error(c.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,g.range),k.length&&k[0].initializer&&this.error(c.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,g.range));var P=null;if(e.skip(o.Token.COLON)){if(g.kind==u.NodeKind.CONSTRUCTOR?this.error(c.DiagnosticCode.Type_annotation_cannot_appear_on_a_constructor_declaration,e.range()):I&&this.error(c.DiagnosticCode.A_set_accessor_cannot_have_a_return_type_annotation,e.range()),!(P=this.parseType(e,g.kind==u.NodeKind.CONSTRUCTOR||I)))return null}else P=u.Node.createOmittedType(e.range(e.pos)),I||g.kind==u.NodeKind.CONSTRUCTOR||this.error(c.DiagnosticCode.Type_expected,P.range);var w=u.Node.createSignature(k,P,R,!1,e.range(C,e.pos)),U=null;if(e.skip(o.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(),g.text),!(U=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=u.Node.createMethodDeclaration(g,S,w,U,i,l,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),M}if(v)this.error(c.DiagnosticCode.Constructor_implementation_is_missing,g.range);else{if(!b&&!I){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(x,A),"set");var V=null;if(e.skip(o.Token.QUESTION)&&this.error(c.DiagnosticCode.Optional_properties_are_not_supported,e.range(r,e.pos)),e.skip(o.Token.EXCLAMATION)&&(l|=a.CommonFlags.DEFINITE_ASSIGNMENT),e.skip(o.Token.COLON)){if(!(V=this.parseType(e)))return null}else this.error(c.DiagnosticCode.Type_expected,e.range());var G=null;if(e.skip(o.Token.EQUALS)&&!(G=this.parseExpression(e)))return null;var K=e.range(r,e.pos);l&a.CommonFlags.DEFINITE_ASSIGNMENT&&(l&a.CommonFlags.STATIC||n||G)&&this.error(c.DiagnosticCode.A_definite_assignment_assertion_is_not_permitted_in_this_context,K);var z=u.Node.createFieldDeclaration(g,V,G,i,l,K);return e.skip(o.Token.SEMICOLON),z}this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,g.range)}return null},t.prototype.parseIndexSignatureDeclaration=function(e,t){t&&t.length&&this.error(c.DiagnosticCode.Decorators_are_not_valid_here,o.Range.join(t[0].range,t[t.length-1].range));var r=e.tokenPos;if(e.skipIdentifier())if("key"==e.readIdentifier())if(e.skip(o.Token.COLON)){var n=this.parseType(e);if(!n)return null;if(n.kind!=u.NodeKind.TYPE)return this.error(c.DiagnosticCode.Type_expected,e.range()),null;if(e.skip(o.Token.CLOSEBRACKET)){if(e.skip(o.Token.COLON)){var i=this.parseType(e);return i?u.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=u.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(o.Token.OPENBRACE)){for(var a=new Array,s=u.Node.createNamespaceDeclaration(i,a,r,t,e.range(n,e.pos));!e.skip(o.Token.CLOSEBRACE);){var l=this.parseTopLevelStatement(e,s);if(l)a.push(l);else if(this.skipStatement(e),e.skip(o.Token.ENDOFFILE))return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}return s.range.end=e.pos,e.skip(o.Token.SEMICOLON),s}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(o.Token.OPENBRACE)){for(var i=new Array;!e.skip(o.Token.CLOSEBRACE);){var a=this.parseExportMember(e);if(!a)return null;if(i.push(a),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}if(e.skip(o.Token.FROM)){if(!e.skip(o.Token.STRINGLITERAL))return this.error(c.DiagnosticCode.String_literal_expected,e.range()),null;n=u.Node.createStringLiteralExpression(e.readString(),e.range())}return null===(l=(s=u.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(o.Token.SEMICOLON),s}if(e.skip(o.Token.ASTERISK))if(e.skip(o.Token.FROM)){if(e.skip(o.Token.STRINGLITERAL)){n=u.Node.createStringLiteralExpression(e.readString(),e.range());var s=u.Node.createExportStatement(null,n,r,e.range(t,e.pos)),l=assert(s.internalPath),p=e.source;return p.exportPaths||(p.exportPaths=new Set),p.exportPaths.add(l),this.seenlog.has(l)||(this.backlog.push(l),this.seenlog.add(l)),e.skip(o.Token.SEMICOLON),s}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=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(o.Token.AS)){if(!e.skipIdentifier(o.IdentifierHandling.ALWAYS))return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;r=u.Node.createIdentifierExpression(e.readIdentifier(),e.range())}return u.Node.createExportMember(t,r,r?o.Range.join(t.range,r.range):t.range)}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseExportDefaultAlias=function(e,t,r,n){var i=e.readIdentifier(),a=e.range(),s=u.Node.createExportStatement([u.Node.createExportMember(u.Node.createIdentifierExpression(i,a),u.Node.createIdentifierExpression("default",e.range(r,n)),a)],null,!1,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),s},t.prototype.parseImport=function(e){var t=e.tokenPos,r=null,n=null,i=!1;if(e.skip(o.Token.OPENBRACE))for(r=new Array;!e.skip(o.Token.CLOSEBRACE);){var a=this.parseImportDeclaration(e);if(!a)return null;if(r.push(a),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}else if(e.skip(o.Token.ASTERISK)){if(!e.skip(o.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=u.Node.createIdentifierExpression(e.readIdentifier(),e.range())}else if(e.skip(o.Token.IDENTIFIER,o.IdentifierHandling.PREFER)){var s=e.readIdentifier(),l=e.range();if(r=[u.Node.createImportDeclaration(u.Node.createIdentifierExpression("default",l),u.Node.createIdentifierExpression(s,l),l)],e.skip(o.Token.COMMA))return this.error(c.DiagnosticCode.Operation_not_supported,e.range()),null}else i=!0;if(i||e.skip(o.Token.FROM)){if(e.skip(o.Token.STRINGLITERAL)){var p=u.Node.createStringLiteralExpression(e.readString(),e.range()),_=void 0;n?(assert(!r),_=u.Node.createImportStatementWithWildcard(n,p,e.range(t,e.pos))):_=u.Node.createImportStatement(r,p,e.range(t,e.pos));var h=_.internalPath;return this.seenlog.has(h)||(this.backlog.push(h),this.seenlog.add(h)),e.skip(o.Token.SEMICOLON),_}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(o.IdentifierHandling.ALWAYS)){var t=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(o.Token.AS)){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;r=u.Node.createIdentifierExpression(e.readIdentifier(),e.range())}return u.Node.createImportDeclaration(t,r,r?o.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=u.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(o.Token.EQUALS)){if(e.skipIdentifier()){var n=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),i=u.Node.createExportImportStatement(n,r,e.range(t,e.pos));return e.skip(o.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 o.Token.BREAK:n=this.parseBreak(e);break;case o.Token.CONST:n=this.parseVariable(e,a.CommonFlags.CONST,null,e.tokenPos);break;case o.Token.CONTINUE:n=this.parseContinue(e);break;case o.Token.DO:n=this.parseDoStatement(e);break;case o.Token.FOR:n=this.parseForStatement(e);break;case o.Token.IF:n=this.parseIfStatement(e);break;case o.Token.LET:n=this.parseVariable(e,a.CommonFlags.LET,null,e.tokenPos);break;case o.Token.VAR:n=this.parseVariable(e,a.CommonFlags.NONE,null,e.tokenPos);break;case o.Token.OPENBRACE:n=this.parseBlockStatement(e,t);break;case o.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 o.Token.SEMICOLON:return u.Node.createEmptyStatement(e.range(e.tokenPos));case o.Token.SWITCH:n=this.parseSwitchStatement(e);break;case o.Token.THROW:n=this.parseThrowStatement(e);break;case o.Token.TRY:n=this.parseTryStatement(e);break;case o.Token.VOID:n=this.parseVoidStatement(e);break;case o.Token.WHILE:n=this.parseWhileStatement(e);break;case o.Token.TYPE:if(e.peek(!1,o.IdentifierHandling.PREFER)==o.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(o.Token.CLOSEBRACE);){var i=e.mark(),a=this.parseStatement(e,t);if(a)e.discard(i),n.push(a);else{if(e.token==o.Token.ENDOFFILE)return null;e.reset(i),this.skipStatement(e)}}var s=u.Node.createBlockStatement(n,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),s},t.prototype.parseBreak=function(e){var t=null;e.peek(!0)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine||(e.next(o.IdentifierHandling.PREFER),t=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()));var r=u.Node.createBreakStatement(t,e.range());return e.skip(o.Token.SEMICOLON),r},t.prototype.parseContinue=function(e){var t=null;e.peek(!0)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine||(e.next(o.IdentifierHandling.PREFER),t=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()));var r=u.Node.createContinueStatement(t,e.range());return e.skip(o.Token.SEMICOLON),r},t.prototype.parseDoStatement=function(e){var t=e.tokenPos,r=this.parseStatement(e);if(!r)return null;if(e.skip(o.Token.WHILE))if(e.skip(o.Token.OPENPAREN)){var n=this.parseExpression(e);if(!n)return null;if(e.skip(o.Token.CLOSEPAREN)){var i=u.Node.createDoStatement(r,n,e.range(t,e.pos));return e.skip(o.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=u.Node.createExpressionStatement(t);return e.skip(o.Token.SEMICOLON),r},t.prototype.parseForStatement=function(e){var t=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var r=null;if(e.skip(o.Token.CONST))r=this.parseVariable(e,a.CommonFlags.CONST,null,e.tokenPos);else if(e.skip(o.Token.LET))r=this.parseVariable(e,a.CommonFlags.LET,null,e.tokenPos);else if(e.skip(o.Token.VAR))r=this.parseVariable(e,a.CommonFlags.NONE,null,e.tokenPos);else if(!e.skip(o.Token.SEMICOLON)&&!(r=this.parseExpressionStatement(e)))return null;if(e.token==o.Token.SEMICOLON){var n=null;if(!e.skip(o.Token.SEMICOLON)&&!(n=this.parseExpressionStatement(e)))return null;if(e.token==o.Token.SEMICOLON){var i=null;if(!e.skip(o.Token.CLOSEPAREN)){if(!(i=this.parseExpression(e)))return null;if(!e.skip(o.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null}var s=this.parseStatement(e);return s?u.Node.createForStatement(r,n?n.expression:null,i,s,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(o.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(o.Token.CLOSEPAREN)){var n=this.parseStatement(e);if(!n)return null;var i=null;return e.skip(o.Token.ELSE)&&!(i=this.parseStatement(e))?null:u.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(o.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(o.Token.CLOSEPAREN)){if(e.skip(o.Token.OPENBRACE)){for(var n=new Array;!e.skip(o.Token.CLOSEBRACE);){var i=this.parseSwitchCase(e);if(!i)return null;n.push(i)}var a=u.Node.createSwitchStatement(r,n,e.range(t,e.pos));return e.skip(o.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(o.Token.CASE)){var i=this.parseExpression(e);if(!i)return null;if(e.skip(o.Token.COLON)){for(t=new Array;e.peek()!=o.Token.CASE&&e.nextToken!=o.Token.DEFAULT&&e.nextToken!=o.Token.CLOSEBRACE;){if(!(r=this.parseStatement(e)))return null;t.push(r)}return u.Node.createSwitchCase(i,t,e.range(n,e.pos))}this.error(c.DiagnosticCode._0_expected,e.range(),":")}else if(e.skip(o.Token.DEFAULT)){if(e.skip(o.Token.COLON)){for(t=new Array;e.peek()!=o.Token.CASE&&e.nextToken!=o.Token.DEFAULT&&e.nextToken!=o.Token.CLOSEBRACE;){if(!(r=this.parseStatement(e)))return null;t.push(r)}return u.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=u.Node.createThrowStatement(r,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),n},t.prototype.parseTryStatement=function(e){var t,r=e.tokenPos;if(e.skip(o.Token.OPENBRACE)){for(var n=new Array;!e.skip(o.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;n.push(t)}var i=null,a=null,s=null;if(e.skip(o.Token.CATCH)){if(!e.skip(o.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=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),!e.skip(o.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null;if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(a=[];!e.skip(o.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;a.push(t)}}if(e.skip(o.Token.FINALLY)){if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(s=[];!e.skip(o.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;s.push(t)}}if(!a&&!s)return this.error(c.DiagnosticCode._0_expected,e.range(),"catch"),null;var l=u.Node.createTryStatement(n,i,a,s,e.range(r,e.pos));return e.skip(o.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=u.Node.createIdentifierExpression(e.readIdentifier(),e.range()),s=null;if(e.skip(o.Token.LESSTHAN)){if(!(s=this.parseTypeParameters(e)))return null;t|=a.CommonFlags.GENERIC}if(e.skip(o.Token.EQUALS)){var l=this.parseType(e);if(!l)return null;var p=u.Node.createTypeDeclaration(i,s,l,r,t,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),p}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=u.Node.createVoidStatement(r,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),n},t.prototype.parseWhileStatement=function(e){var t=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(o.Token.CLOSEPAREN)){var n=this.parseStatement(e);if(!n)return null;var i=u.Node.createWhileStatement(r,n,e.range(t,e.pos));return e.skip(o.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(o.IdentifierHandling.PREFER),r=e.tokenPos,n=function(e){switch(e){case o.Token.DOT_DOT_DOT:return 2;case o.Token.YIELD:return 3;case o.Token.EXCLAMATION:case o.Token.TILDE:case o.Token.PLUS:case o.Token.MINUS:case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:case o.Token.TYPEOF:case o.Token.VOID:case o.Token.DELETE:return 17;case o.Token.NEW:return 20}return 0}(t);if(0!=n){var i=void 0;return t==o.Token.NEW?(i=this.parseExpression(e,19))?i.kind==u.NodeKind.CALL?u.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!=o.Token.PLUS_PLUS&&t!=o.Token.MINUS_MINUS||i.kind!=u.NodeKind.IDENTIFIER&&i.kind!=u.NodeKind.ELEMENTACCESS&&i.kind!=u.NodeKind.PROPERTYACCESS&&this.error(c.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,i.range),u.Node.createUnaryPrefixExpression(t,i,e.range(r,e.pos))):null}var a=null;switch(t){case o.Token.NULL:return u.Node.createNullExpression(e.range());case o.Token.TRUE:return u.Node.createTrueExpression(e.range());case o.Token.FALSE:return u.Node.createFalseExpression(e.range());case o.Token.OPENPAREN:if(e.skip(o.Token.CLOSEPAREN))return this.parseFunctionExpressionCommon(e,u.Node.createEmptyIdentifierExpression(e.range(r)),[],1);var s=e.mark(),l=!0;do{switch(e.next(o.IdentifierHandling.PREFER)){case o.Token.DOT_DOT_DOT:return e.reset(s),this.parseFunctionExpression(e);case o.Token.IDENTIFIER:switch(e.readIdentifier(),e.next()){case o.Token.CLOSEPAREN:if(!e.skip(o.Token.COLON)&&!e.skip(o.Token.EQUALS_GREATERTHAN)){l=!1;break}case o.Token.COLON:return e.reset(s),this.parseFunctionExpression(e);case o.Token.QUESTION:if(e.skip(o.Token.COLON)||e.skip(o.Token.COMMA)||e.skip(o.Token.CLOSEPAREN))return e.reset(s),this.parseFunctionExpression(e);l=!1;break;case o.Token.COMMA:break;default:l=!1}break;default:l=!1}}while(l);return e.reset(s),(a=this.parseExpression(e))?e.skip(o.Token.CLOSEPAREN)?u.Node.createParenthesizedExpression(a,e.range(r,e.pos)):(this.error(c.DiagnosticCode._0_expected,e.range(),")"),null):null;case o.Token.OPENBRACKET:for(var p=new Array;!e.skip(o.Token.CLOSEBRACKET);){if(e.peek()==o.Token.COMMA)a=null;else if(!(a=this.parseExpression(e,2)))return null;if(p.push(a),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACKET))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null}}return u.Node.createArrayLiteralExpression(p,e.range(r,e.pos));case o.Token.OPENBRACE:for(var _=e.tokenPos,h=new Array,d=new Array,y=void 0;!e.skip(o.Token.CLOSEBRACE);){if(e.skipIdentifier())y=u.Node.createIdentifierExpression(e.readIdentifier(),e.range());else{if(!e.skip(o.Token.STRINGLITERAL))return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;(y=u.Node.createIdentifierExpression(e.readString(),e.range())).isQuoted=!0}if(h.push(y),e.skip(o.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(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}return u.Node.createObjectLiteralExpression(h,d,e.range(_,e.pos));case o.Token.LESSTHAN:var f=this.parseType(e);return f?e.skip(o.Token.GREATERTHAN)?(a=this.parseExpression(e,19))?u.Node.createAssertionExpression(u.AssertionKind.PREFIX,a,f,e.range(r,e.pos)):null:(this.error(c.DiagnosticCode._0_expected,e.range(),">"),null):null;case o.Token.IDENTIFIER:var T=u.Node.createIdentifierExpression(e.readIdentifier(),e.range(r,e.pos));return e.peek(!0)!=o.Token.EQUALS_GREATERTHAN||e.nextTokenOnNewLine?T:this.parseFunctionExpressionCommon(e,u.Node.createEmptyIdentifierExpression(e.range(r)),[u.Node.createParameter(T,u.Node.createOmittedType(T.range.atEnd),null,u.ParameterKind.DEFAULT,T.range)],2,r);case o.Token.THIS:return u.Node.createThisExpression(e.range(r,e.pos));case o.Token.CONSTRUCTOR:return u.Node.createConstructorExpression(e.range(r,e.pos));case o.Token.SUPER:return e.peek()!=o.Token.DOT&&e.nextToken!=o.Token.OPENPAREN&&this.error(c.DiagnosticCode._super_must_be_followed_by_an_argument_list_or_member_access,e.range()),u.Node.createSuperExpression(e.range(r,e.pos));case o.Token.STRINGLITERAL:return u.Node.createStringLiteralExpression(e.readString(),e.range(r,e.pos));case o.Token.INTEGERLITERAL:return u.Node.createIntegerLiteralExpression(e.readInteger(),e.range(r,e.pos));case o.Token.FLOATLITERAL:return u.Node.createFloatLiteralExpression(e.readFloat(),e.range(r,e.pos));case o.Token.SLASH:var g=e.readRegexpPattern();return e.skip(o.Token.SLASH)?u.Node.createRegexpLiteralExpression(g,e.readRegexpFlags(),e.range(r,e.pos)):(this.error(c.DiagnosticCode._0_expected,e.range(),"/"),null);case o.Token.FUNCTION:return this.parseFunctionExpression(e);case o.Token.CLASS:return this.parseClassExpression(e);default:return t==o.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(o.Token.LESSTHAN))return null;var r=null;do{if(e.peek()===o.Token.GREATERTHAN)break;var n=this.parseType(e,!0,!0);if(!n)return e.reset(t),null;r?r.push(n):r=[n]}while(e.skip(o.Token.COMMA));return e.skip(o.Token.GREATERTHAN)&&e.skip(o.Token.OPENPAREN)?r:(e.reset(t),null)},t.prototype.parseArguments=function(e){for(var t=new Array;!e.skip(o.Token.CLOSEPAREN);){var r=this.parseExpression(e,2);if(!r)return null;if(t.push(r),!e.skip(o.Token.COMMA)){if(e.skip(o.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,s=null;(i=_(n=e.peek()))>=t;){switch(e.next(),n){case o.Token.AS:var l=this.parseType(e);if(!l)return null;r=u.Node.createAssertionExpression(u.AssertionKind.AS,r,l,e.range(a,e.pos));break;case o.Token.EXCLAMATION:r=u.Node.createAssertionExpression(u.AssertionKind.NONNULL,r,null,e.range(a,e.pos));break;case o.Token.INSTANCEOF:var p=this.parseType(e);if(!p)return null;r=u.Node.createInstanceOfExpression(r,p,e.range(a,e.pos));break;case o.Token.OPENBRACKET:if(!(s=this.parseExpression(e)))return null;if(!e.skip(o.Token.CLOSEBRACKET))return this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null;r=u.Node.createElementAccessExpression(r,s,e.range(a,e.pos));break;case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:r.kind!=u.NodeKind.IDENTIFIER&&r.kind!=u.NodeKind.ELEMENTACCESS&&r.kind!=u.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=u.Node.createUnaryPostfixExpression(n,r,e.range(a,e.pos));break;case o.Token.QUESTION:var d=this.parseExpression(e);if(!d)return null;if(!e.skip(o.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=u.Node.createTernaryExpression(r,d,y,e.range(a,e.pos));break;case o.Token.COMMA:var m=[r];do{if(!(r=this.parseExpression(e,2)))return null;m.push(r)}while(e.skip(o.Token.COMMA));r=u.Node.createCommaExpression(m,e.range(a,e.pos));break;default:if(n==o.Token.DOT){if(e.skipIdentifier())s=u.Node.createIdentifierExpression(e.readIdentifier(),e.range());else if(!(s=this.parseExpression(e,h(n)?i:i+1)))return null;if(s.kind==u.NodeKind.IDENTIFIER)r=u.Node.createPropertyAccessExpression(r,s,e.range(a,e.pos));else{if(s.kind!=u.NodeKind.CALL)return this.error(c.DiagnosticCode.Identifier_expected,s.range),null;if(!(r=this.joinPropertyCall(e,a,r,s)))return null}}else{if(!(s=this.parseExpression(e,h(n)?i:i+1)))return null;r=u.Node.createBinaryExpression(n,r,s,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 u.NodeKind.IDENTIFIER:n.expression=u.Node.createPropertyAccessExpression(r,i,e.range(t,e.pos));break;case u.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(u.nodeIsCallable(t.kind))for(var r=null;e.skip(o.Token.OPENPAREN)||u.nodeIsGenericCallable(t.kind)&&null!==(r=this.tryParseTypeArgumentsBeforeArguments(e));){var n=this.parseArguments(e);if(!n)break;t=u.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==o.Token.ENDOFFILE||t==o.Token.SEMICOLON){e.next();break}if(e.nextTokenOnNewLine)break;switch(e.next()){case o.Token.IDENTIFIER:e.readIdentifier();break;case o.Token.STRINGLITERAL:e.readString();break;case o.Token.INTEGERLITERAL:e.readInteger();break;case o.Token.FLOATLITERAL:e.readFloat();break;case o.Token.OPENBRACE:this.skipBlock(e)}}},t.prototype.skipBlock=function(e){var t=1,r=!0;do{switch(e.next()){case o.Token.ENDOFFILE:this.error(c.DiagnosticCode._0_expected,e.range(),"}"),r=!1;break;case o.Token.OPENBRACE:++t;break;case o.Token.CLOSEBRACE:--t||(r=!1);break;case o.Token.IDENTIFIER:e.readIdentifier();break;case o.Token.STRINGLITERAL:e.readString();break;case o.Token.INTEGERLITERAL:e.readInteger();break;case o.Token.FLOATLITERAL:e.readFloat()}}while(r)},t}(c.DiagnosticEmitter);function _(e){switch(e){case o.Token.COMMA:return 1;case o.Token.EQUALS:case o.Token.PLUS_EQUALS:case o.Token.MINUS_EQUALS:case o.Token.ASTERISK_ASTERISK_EQUALS:case o.Token.ASTERISK_EQUALS:case o.Token.SLASH_EQUALS:case o.Token.PERCENT_EQUALS:case o.Token.LESSTHAN_LESSTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.AMPERSAND_EQUALS:case o.Token.CARET_EQUALS:case o.Token.BAR_EQUALS:return 4;case o.Token.QUESTION:return 5;case o.Token.BAR_BAR:return 6;case o.Token.AMPERSAND_AMPERSAND:return 7;case o.Token.BAR:return 8;case o.Token.CARET:return 9;case o.Token.AMPERSAND:return 10;case o.Token.EQUALS_EQUALS:case o.Token.EXCLAMATION_EQUALS:case o.Token.EQUALS_EQUALS_EQUALS:case o.Token.EXCLAMATION_EQUALS_EQUALS:return 11;case o.Token.AS:case o.Token.IN:case o.Token.INSTANCEOF:case o.Token.LESSTHAN:case o.Token.GREATERTHAN:case o.Token.LESSTHAN_EQUALS:case o.Token.GREATERTHAN_EQUALS:return 12;case o.Token.LESSTHAN_LESSTHAN:case o.Token.GREATERTHAN_GREATERTHAN:case o.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:return 13;case o.Token.PLUS:case o.Token.MINUS:return 14;case o.Token.ASTERISK:case o.Token.SLASH:case o.Token.PERCENT:return 15;case o.Token.ASTERISK_ASTERISK:return 16;case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:return 18;case o.Token.DOT:case o.Token.NEW:case o.Token.OPENBRACKET:case o.Token.EXCLAMATION:return 20}return 0}function h(e){switch(e){case o.Token.EQUALS:case o.Token.PLUS_EQUALS:case o.Token.MINUS_EQUALS:case o.Token.ASTERISK_ASTERISK_EQUALS:case o.Token.ASTERISK_EQUALS:case o.Token.SLASH_EQUALS:case o.Token.PERCENT_EQUALS:case o.Token.LESSTHAN_LESSTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.AMPERSAND_EQUALS:case o.Token.CARET_EQUALS:case o.Token.BAR_EQUALS:case o.Token.QUESTION:case o.Token.ASTERISK_ASTERISK:return!0;default:return!1}}t.Parser=p,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(18),e.exports=r(28)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(19),r(21),r(22),r(23);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(20);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=2,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.isNullable=function(e){return!0},t.isReference=function(e){return"object"==typeof e||"string"==typeof e},t.isFunction=function(e){return"function"==typeof e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isArray=Array.isArray,t.isArrayLike=function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&Math.trunc(e.length)===e.length},Array.create=function(e){var t=new Array(e);return t.length=0,t},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,Object.defineProperties(t.JSMath,{sincos_sin:{value:0,writable:!0},sincos_cos:{value:0,writable:!0},signbit:{value:function(e){return r[0]=e,Boolean(n[1]>>>31&e==e)}},sincos:{value:function(e){this.sincos_sin=Math.sin(e),this.sincos_cos=Math.cos(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)]},t.unmanaged=function(){}}).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(24);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),s=t.fromNumber(f64.MAX_SAFE_INTEGER);e.i64_is_f64=function(e){return e.gte(a)&&e.lte(s)},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={},s={};function o(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(r=l(e,(0|e)<0?-1:0,!0),i&&(s[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:f;if(t){if(e<0)return T;if(e>=d)return I}else{if(e<=-y)return x;if(e+1>=y)return b}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=o,n.fromNumber=c,n.fromBits=l;var u=Math.pow;function p(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;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 p(e.substring(1),t,r).neg();for(var i=c(u(r,8)),a=f,s=0;s<e.length;s+=8){var o=Math.min(8,e.length-s),l=parseInt(e.substring(s,s+o),r);if(o<8){var _=c(u(r,o));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?p(e,t):l(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=p,n.fromValue=_;var h=4294967296,d=h*h,y=d/2,m=o(1<<24),f=o(0);n.ZERO=f;var T=o(0,!0);n.UZERO=T;var g=o(1);n.ONE=g;var E=o(1,!0);n.UONE=E;var v=o(-1);n.NEG_ONE=v;var b=l(-1,2147483647,!1);n.MAX_VALUE=b;var I=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=I;var x=l(0,-2147483648,!1);n.MIN_VALUE=x;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(x)){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(u(e,6),this.unsigned),a=this,s="";;){var o=a.div(i),l=(a.sub(o.mul(i)).toInt()>>>0).toString(e);if((a=o).isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}},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(x)?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(x)?x:this.not().add(g)},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,s=e.high>>>16,o=65535&e.high,c=e.low>>>16,u=0,p=0,h=0,d=0;return h+=(d+=a+(65535&e.low))>>>16,p+=(h+=n+c)>>>16,u+=(p+=r+o)>>>16,u+=t+s,l((h&=65535)<<16|(d&=65535),(u&=65535)<<16|(p&=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 f;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 f;if(this.eq(x))return e.isOdd()?x:f;if(e.eq(x))return this.isOdd()?x:f;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,s=65535&this.low,o=e.high>>>16,u=65535&e.high,p=e.low>>>16,h=65535&e.low,d=0,y=0,T=0,g=0;return T+=(g+=s*h)>>>16,y+=(T+=a*h)>>>16,T&=65535,y+=(T+=s*p)>>>16,d+=(y+=n*h)>>>16,y&=65535,d+=(y+=a*p)>>>16,y&=65535,d+=(y+=s*u)>>>16,d+=t*h+n*p+a*u+s*o,l((T&=65535)<<16|(g&=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:f;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(x))return e.eq(g)||e.eq(v)?x:e.eq(x)?g:(t=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?g:v:(n=this.sub(e.mul(t)),a=t.add(n.div(e)));if(e.eq(x))return this.unsigned?T:f;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=f}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(t)/Math.LN2),o=s<=48?1:u(2,s-48),p=c(t),h=p.mul(e);h.isNegative()||h.gt(n);)h=(p=c(t-=o,this.unsigned)).mul(e);p.isZero()&&(p=g),a=a.add(p),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";Object.defineProperty(t,"__esModule",{value:!0}),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,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.WASM32=0]="WASM32",e[e.WASM64=1]="WASM64",e[e.JS=2]="JS"}(t.Target||(t.Target={}))},function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e=n([unmanaged],e)}();t.Typeinfo=i,function(e){e[e.NONE=0]="NONE",e[e.ARRAYBUFFERVIEW=1]="ARRAYBUFFERVIEW",e[e.ARRAY=2]="ARRAY",e[e.SET=4]="SET",e[e.MAP=8]="MAP",e[e.ACYCLIC=16]="ACYCLIC",e[e.VALUE_ALIGN_0=32]="VALUE_ALIGN_0",e[e.VALUE_ALIGN_1=64]="VALUE_ALIGN_1",e[e.VALUE_ALIGN_2=128]="VALUE_ALIGN_2",e[e.VALUE_ALIGN_3=256]="VALUE_ALIGN_3",e[e.VALUE_ALIGN_4=512]="VALUE_ALIGN_4",e[e.VALUE_SIGNED=1024]="VALUE_SIGNED",e[e.VALUE_FLOAT=2048]="VALUE_FLOAT",e[e.VALUE_NULLABLE=4096]="VALUE_NULLABLE",e[e.VALUE_MANAGED=8192]="VALUE_MANAGED",e[e.KEY_ALIGN_0=16384]="KEY_ALIGN_0",e[e.KEY_ALIGN_1=32768]="KEY_ALIGN_1",e[e.KEY_ALIGN_2=65536]="KEY_ALIGN_2",e[e.KEY_ALIGN_3=131072]="KEY_ALIGN_3",e[e.KEY_ALIGN_4=262144]="KEY_ALIGN_4",e[e.KEY_SIGNED=524288]="KEY_SIGNED",e[e.KEY_FLOAT=1048576]="KEY_FLOAT",e[e.KEY_NULLABLE=2097152]="KEY_NULLABLE",e[e.KEY_MANAGED=4194304]="KEY_MANAGED"}(t.TypeinfoFlags||(t.TypeinfoFlags={}))},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}}}};function i(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0});var a=r(11),s=r(14),o=r(15),c=r(2);t.formatDiagnostic=c.formatDiagnosticMessage;var l=r(16);t.parseFile=function(e,t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=null),n||(n=new l.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==c.DiagnosticCategory.INFO},t.isWarning=function(e){return e.category==c.DiagnosticCategory.WARNING},t.isError=function(e){return e.category==c.DiagnosticCategory.ERROR},t.createOptions=function(){return new a.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.setExplicitStart=function(e,t){e.explicitStart=t},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 a.Compiler(e,t).compile()},t.decompileModule=function(e){var t=new s.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)},t.buildRTTI=function(e){var t,r,i,a,s,o,c=new Array;c.push('{\n "names": [\n');try{for(var l=n(e.managedClasses.values()),u=l.next();!u.done;u=l.next()){var p=u.value;c.push(' "'),c.push(p.internalName),c.push('",\n')}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}c.push(' ],\n "base": [\n');try{for(var _=n(e.managedClasses.values()),h=_.next();!h.done;h=_.next()){var d=(p=h.value).base;c.push(" "),c.push(d?d.id.toString():"0"),c.push(",\n")}}catch(e){i={error:e}}finally{try{h&&!h.done&&(a=_.return)&&a.call(_)}finally{if(i)throw i.error}}c.push(' ],\n "flags": [\n');try{for(var y=n(e.managedClasses.values()),m=y.next();!m.done;m=y.next())p=m.value,c.push(" "),c.push(p.rttiFlags.toString()),c.push(",\n")}catch(e){s={error:e}}finally{try{m&&!m.done&&(o=y.return)&&o.call(y)}finally{if(s)throw s.error}}return c.push(" ]\n}\n"),c.join("")};var u=r(0);t.LIBRARY_PREFIX=u.LIBRARY_PREFIX,i(r(5)),i(r(0)),i(r(11)),i(r(14)),i(r(15)),i(r(12)),i(r(2)),i(r(10)),i(r(4)),i(r(16)),i(r(3)),i(r(9)),i(r(7)),i(r(6)),i(r(1))},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>=97&&e<=122||e>=65&&e<=90||95==e||36==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>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||95==e||36==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,i=0,a=t.length;i+1<a;){if(r=i+(a-i>>1),(n=t[r-=1&r])<=e&&e<=t[r+1])return!0;e<n?a=r:i=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),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.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 s};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),s=a.next();!s.done;s=a.next()){var o=s.value;i.add(o)}}catch(e){t={error:e}}finally{try{s&&!s.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,s,o,c,l;void 0===e&&(e=null),void 0===t&&(t=null);var u=new Map;if(e){try{for(var p=n(e),_=p.next();!_.done;_=p.next()){var h=i(_.value,2),d=h[0],y=h[1];u.set(d,y)}}catch(e){r={error:e}}finally{try{_&&!_.done&&(a=p.return)&&a.call(p)}finally{if(r)throw r.error}}if(t)try{for(var m=n(t),f=m.next();!f.done;f=m.next()){var T=i(f.value,2);d=T[0],y=T[1],u.set(d,y)}}catch(e){s={error:e}}finally{try{f&&!f.done&&(o=m.return)&&o.call(m)}finally{if(s)throw s.error}}}else if(t)try{for(var g=n(t),E=g.next();!E.done;E=g.next()){var v=i(E.value,2);d=v[0],y=v[1],u.set(d,y)}}catch(e){c={error:e}}finally{try{E&&!E.done&&(l=g.return)&&l.call(g)}finally{if(c)throw c.error}}return u}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),i=47;function a(e){for(var t,r=0,n=e.length;r+1<n&&46==e.charCodeAt(r)&&e.charCodeAt(r+1)==i;)r+=2;for((r>0||n<e.length)&&(e=e.substring(r,n),n-=r,r=0);r+1<n;){if(t=!1,e.charCodeAt(r)==i&&46==e.charCodeAt(r+1)){if((t=r+2==n)||r+2<n&&e.charCodeAt(r+2)==i){e=t?e.substring(0,r):e.substring(0,r)+e.substring(r+2),n-=2;continue}if((t=r+3==n)&&46==e.charCodeAt(r+2)||r+3<n&&46==e.charCodeAt(r+2)&&e.charCodeAt(r+3)==i){for(var a=r;--a>=0;)if(e.charCodeAt(a)==i){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),n-=r+3-a,r=a-1);break}if(a<0&&r>0&&(2!=r||46!=e.charCodeAt(0)||46!=e.charCodeAt(1))){n=(e=e.substring(r+4)).length;continue}}}r++}return n>0?e:"."}function s(e){var t=e.length;if(t<=1){if(0==t)return".";if(e.charCodeAt(0)==i)return e}for(;--t>0;)if(e.charCodeAt(t)==i)return e.substring(0,t);return"."}t.normalizePath=a,t.resolvePath=function(e,t){return e.startsWith("std/")?e:a(s(t)+n.PATH_DELIMITER+e)},t.dirname=s},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)}}])});
//# sourceMappingURL=assemblyscript.js.map