!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=15)}([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(24)),n(r(25)),n(r(26)),n(r(27)),n(r(28)),n(r(29))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.NONE=0]="NONE",e[e.IMPORT=1]="IMPORT",e[e.EXPORT=2]="EXPORT",e[e.DECLARE=4]="DECLARE",e[e.CONST=8]="CONST",e[e.LET=16]="LET",e[e.STATIC=32]="STATIC",e[e.READONLY=64]="READONLY",e[e.ABSTRACT=128]="ABSTRACT",e[e.PUBLIC=256]="PUBLIC",e[e.PRIVATE=512]="PRIVATE",e[e.PROTECTED=1024]="PROTECTED",e[e.GET=2048]="GET",e[e.SET=4096]="SET",e[e.DEFINITE_ASSIGNMENT=8192]="DEFINITE_ASSIGNMENT",e[e.AMBIENT=16384]="AMBIENT",e[e.GENERIC=32768]="GENERIC",e[e.GENERIC_CONTEXT=65536]="GENERIC_CONTEXT",e[e.INSTANCE=131072]="INSTANCE",e[e.CONSTRUCTOR=262144]="CONSTRUCTOR",e[e.ARROW=524288]="ARROW",e[e.MODULE_EXPORT=1048576]="MODULE_EXPORT",e[e.MODULE_IMPORT=2097152]="MODULE_IMPORT",e[e.RESOLVED=4194304]="RESOLVED",e[e.COMPILED=8388608]="COMPILED",e[e.INLINED=16777216]="INLINED",e[e.SCOPED=33554432]="SCOPED",e[e.TRAMPOLINE=67108864]="TRAMPOLINE",e[e.VIRTUAL=134217728]="VIRTUAL",e[e.MAIN=268435456]="MAIN",e[e.QUOTED=536870912]="QUOTED"}(t.CommonFlags||(t.CommonFlags={})),t.PATH_DELIMITER="/",t.PARENT_SUBST="..",t.GETTER_PREFIX="get:",t.SETTER_PREFIX="set:",t.INSTANCE_DELIMITER="#",t.STATIC_DELIMITER=".",t.INNER_DELIMITER="~",t.LIBRARY_SUBST="~lib",t.LIBRARY_PREFIX=t.LIBRARY_SUBST+t.PATH_DELIMITER,t.FILESPACE_PREFIX="file:"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(10),a=r(0),s=r(10);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.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.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 p(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=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};Object.defineProperty(t,"__esModule",{value:!0});var i,a,s=r(9);!function(e){e[e.None=_BinaryenTypeNone()]="None",e[e.I32=_BinaryenTypeInt32()]="I32",e[e.I64=_BinaryenTypeInt64()]="I64",e[e.F32=_BinaryenTypeFloat32()]="F32",e[e.F64=_BinaryenTypeFloat64()]="F64",e[e.V128=_BinaryenTypeVec128()]="V128",e[e.Unreachable=_BinaryenTypeUnreachable()]="Unreachable",e[e.Auto=_BinaryenTypeAuto()]="Auto"}(i=t.NativeType||(t.NativeType={})),function(e){e[e.Invalid=_BinaryenInvalidId()]="Invalid",e[e.Block=_BinaryenBlockId()]="Block",e[e.If=_BinaryenIfId()]="If",e[e.Loop=_BinaryenLoopId()]="Loop",e[e.Break=_BinaryenBreakId()]="Break",e[e.Switch=_BinaryenSwitchId()]="Switch",e[e.Call=_BinaryenCallId()]="Call",e[e.CallIndirect=_BinaryenCallIndirectId()]="CallIndirect",e[e.GetLocal=_BinaryenGetLocalId()]="GetLocal",e[e.SetLocal=_BinaryenSetLocalId()]="SetLocal",e[e.GetGlobal=_BinaryenGetGlobalId()]="GetGlobal",e[e.SetGlobal=_BinaryenSetGlobalId()]="SetGlobal",e[e.Load=_BinaryenLoadId()]="Load",e[e.Store=_BinaryenStoreId()]="Store",e[e.Const=_BinaryenConstId()]="Const",e[e.Unary=_BinaryenUnaryId()]="Unary",e[e.Binary=_BinaryenBinaryId()]="Binary",e[e.Select=_BinaryenSelectId()]="Select",e[e.Drop=_BinaryenDropId()]="Drop",e[e.Return=_BinaryenReturnId()]="Return",e[e.Host=_BinaryenHostId()]="Host",e[e.Nop=_BinaryenNopId()]="Nop",e[e.Unreachable=_BinaryenUnreachableId()]="Unreachable",e[e.AtomicCmpxchg=_BinaryenAtomicCmpxchgId()]="AtomicCmpxchg",e[e.AtomicRMW=_BinaryenAtomicRMWId()]="AtomicRMW",e[e.AtomicWait=_BinaryenAtomicWaitId()]="AtomicWait",e[e.AtomicWake=_BinaryenAtomicWakeId()]="AtomicWake",e[e.SIMDExtract=_BinaryenSIMDExtractId()]="SIMDExtract",e[e.SIMDReplace=_BinaryenSIMDReplaceId()]="SIMDReplace",e[e.SIMDShuffle=_BinaryenSIMDShuffleId()]="SIMDShuffle",e[e.SIMDBitselect=_BinaryenSIMDBitselectId()]="SIMDBitselect",e[e.SIMDShift=_BinaryenSIMDShiftId()]="SIMDShift",e[e.MemoryInit=_BinaryenMemoryInitId()]="MemoryInit",e[e.DataDrop=_BinaryenDataDropId()]="DataDrop",e[e.MemoryCopy=_BinaryenMemoryCopyId()]="MemoryCopy",e[e.MemoryFill=_BinaryenMemoryFillId()]="MemoryFill"}(a=t.ExpressionId||(t.ExpressionId={})),function(e){e[e.ClzI32=_BinaryenClzInt32()]="ClzI32",e[e.CtzI32=_BinaryenCtzInt32()]="CtzI32",e[e.PopcntI32=_BinaryenPopcntInt32()]="PopcntI32",e[e.NegF32=_BinaryenNegFloat32()]="NegF32",e[e.AbsF32=_BinaryenAbsFloat32()]="AbsF32",e[e.CeilF32=_BinaryenCeilFloat32()]="CeilF32",e[e.FloorF32=_BinaryenFloorFloat32()]="FloorF32",e[e.TruncF32=_BinaryenTruncFloat32()]="TruncF32",e[e.NearestF32=_BinaryenNearestFloat32()]="NearestF32",e[e.SqrtF32=_BinaryenSqrtFloat32()]="SqrtF32",e[e.EqzI32=_BinaryenEqZInt32()]="EqzI32",e[e.ClzI64=_BinaryenClzInt64()]="ClzI64",e[e.CtzI64=_BinaryenCtzInt64()]="CtzI64",e[e.PopcntI64=_BinaryenPopcntInt64()]="PopcntI64",e[e.NegF64=_BinaryenNegFloat64()]="NegF64",e[e.AbsF64=_BinaryenAbsFloat64()]="AbsF64",e[e.CeilF64=_BinaryenCeilFloat64()]="CeilF64",e[e.FloorF64=_BinaryenFloorFloat64()]="FloorF64",e[e.TruncF64=_BinaryenTruncFloat64()]="TruncF64",e[e.NearestF64=_BinaryenNearestFloat64()]="NearestF64",e[e.SqrtF64=_BinaryenSqrtFloat64()]="SqrtF64",e[e.EqzI64=_BinaryenEqZInt64()]="EqzI64",e[e.ExtendI32=_BinaryenExtendSInt32()]="ExtendI32",e[e.ExtendU32=_BinaryenExtendUInt32()]="ExtendU32",e[e.WrapI64=_BinaryenWrapInt64()]="WrapI64",e[e.TruncF32ToI32=_BinaryenTruncSFloat32ToInt32()]="TruncF32ToI32",e[e.TruncF32ToI64=_BinaryenTruncSFloat32ToInt64()]="TruncF32ToI64",e[e.TruncF32ToU32=_BinaryenTruncUFloat32ToInt32()]="TruncF32ToU32",e[e.TruncF32ToU64=_BinaryenTruncUFloat32ToInt64()]="TruncF32ToU64",e[e.TruncF64ToI32=_BinaryenTruncSFloat64ToInt32()]="TruncF64ToI32",e[e.TruncF64ToI64=_BinaryenTruncSFloat64ToInt64()]="TruncF64ToI64",e[e.TruncF64ToU32=_BinaryenTruncUFloat64ToInt32()]="TruncF64ToU32",e[e.TruncF64ToU64=_BinaryenTruncUFloat64ToInt64()]="TruncF64ToU64",e[e.ReinterpretF32=_BinaryenReinterpretFloat32()]="ReinterpretF32",e[e.ReinterpretF64=_BinaryenReinterpretFloat64()]="ReinterpretF64",e[e.ConvertI32ToF32=_BinaryenConvertSInt32ToFloat32()]="ConvertI32ToF32",e[e.ConvertI32ToF64=_BinaryenConvertSInt32ToFloat64()]="ConvertI32ToF64",e[e.ConvertU32ToF32=_BinaryenConvertUInt32ToFloat32()]="ConvertU32ToF32",e[e.ConvertU32ToF64=_BinaryenConvertUInt32ToFloat64()]="ConvertU32ToF64",e[e.ConvertI64ToF32=_BinaryenConvertSInt64ToFloat32()]="ConvertI64ToF32",e[e.ConvertI64ToF64=_BinaryenConvertSInt64ToFloat64()]="ConvertI64ToF64",e[e.ConvertU64ToF32=_BinaryenConvertUInt64ToFloat32()]="ConvertU64ToF32",e[e.ConvertU64ToF64=_BinaryenConvertUInt64ToFloat64()]="ConvertU64ToF64",e[e.PromoteF32=_BinaryenPromoteFloat32()]="PromoteF32",e[e.DemoteF64=_BinaryenDemoteFloat64()]="DemoteF64",e[e.ReinterpretI32=_BinaryenReinterpretInt32()]="ReinterpretI32",e[e.ReinterpretI64=_BinaryenReinterpretInt64()]="ReinterpretI64",e[e.ExtendI8ToI32=_BinaryenExtendS8Int32()]="ExtendI8ToI32",e[e.ExtendI16ToI32=_BinaryenExtendS16Int32()]="ExtendI16ToI32",e[e.ExtendI8ToI64=_BinaryenExtendS8Int64()]="ExtendI8ToI64",e[e.ExtendI16ToI64=_BinaryenExtendS16Int64()]="ExtendI16ToI64",e[e.ExtendI32ToI64=_BinaryenExtendS32Int64()]="ExtendI32ToI64"}(t.UnaryOp||(t.UnaryOp={})),function(e){e[e.AddI32=_BinaryenAddInt32()]="AddI32",e[e.SubI32=_BinaryenSubInt32()]="SubI32",e[e.MulI32=_BinaryenMulInt32()]="MulI32",e[e.DivI32=_BinaryenDivSInt32()]="DivI32",e[e.DivU32=_BinaryenDivUInt32()]="DivU32",e[e.RemI32=_BinaryenRemSInt32()]="RemI32",e[e.RemU32=_BinaryenRemUInt32()]="RemU32",e[e.AndI32=_BinaryenAndInt32()]="AndI32",e[e.OrI32=_BinaryenOrInt32()]="OrI32",e[e.XorI32=_BinaryenXorInt32()]="XorI32",e[e.ShlI32=_BinaryenShlInt32()]="ShlI32",e[e.ShrU32=_BinaryenShrUInt32()]="ShrU32",e[e.ShrI32=_BinaryenShrSInt32()]="ShrI32",e[e.RotlI32=_BinaryenRotLInt32()]="RotlI32",e[e.RotrI32=_BinaryenRotRInt32()]="RotrI32",e[e.EqI32=_BinaryenEqInt32()]="EqI32",e[e.NeI32=_BinaryenNeInt32()]="NeI32",e[e.LtI32=_BinaryenLtSInt32()]="LtI32",e[e.LtU32=_BinaryenLtUInt32()]="LtU32",e[e.LeI32=_BinaryenLeSInt32()]="LeI32",e[e.LeU32=_BinaryenLeUInt32()]="LeU32",e[e.GtI32=_BinaryenGtSInt32()]="GtI32",e[e.GtU32=_BinaryenGtUInt32()]="GtU32",e[e.GeI32=_BinaryenGeSInt32()]="GeI32",e[e.GeU32=_BinaryenGeUInt32()]="GeU32",e[e.AddI64=_BinaryenAddInt64()]="AddI64",e[e.SubI64=_BinaryenSubInt64()]="SubI64",e[e.MulI64=_BinaryenMulInt64()]="MulI64",e[e.DivI64=_BinaryenDivSInt64()]="DivI64",e[e.DivU64=_BinaryenDivUInt64()]="DivU64",e[e.RemI64=_BinaryenRemSInt64()]="RemI64",e[e.RemU64=_BinaryenRemUInt64()]="RemU64",e[e.AndI64=_BinaryenAndInt64()]="AndI64",e[e.OrI64=_BinaryenOrInt64()]="OrI64",e[e.XorI64=_BinaryenXorInt64()]="XorI64",e[e.ShlI64=_BinaryenShlInt64()]="ShlI64",e[e.ShrU64=_BinaryenShrUInt64()]="ShrU64",e[e.ShrI64=_BinaryenShrSInt64()]="ShrI64",e[e.RotlI64=_BinaryenRotLInt64()]="RotlI64",e[e.RotrI64=_BinaryenRotRInt64()]="RotrI64",e[e.EqI64=_BinaryenEqInt64()]="EqI64",e[e.NeI64=_BinaryenNeInt64()]="NeI64",e[e.LtI64=_BinaryenLtSInt64()]="LtI64",e[e.LtU64=_BinaryenLtUInt64()]="LtU64",e[e.LeI64=_BinaryenLeSInt64()]="LeI64",e[e.LeU64=_BinaryenLeUInt64()]="LeU64",e[e.GtI64=_BinaryenGtSInt64()]="GtI64",e[e.GtU64=_BinaryenGtUInt64()]="GtU64",e[e.GeI64=_BinaryenGeSInt64()]="GeI64",e[e.GeU64=_BinaryenGeUInt64()]="GeU64",e[e.AddF32=_BinaryenAddFloat32()]="AddF32",e[e.SubF32=_BinaryenSubFloat32()]="SubF32",e[e.MulF32=_BinaryenMulFloat32()]="MulF32",e[e.DivF32=_BinaryenDivFloat32()]="DivF32",e[e.CopysignF32=_BinaryenCopySignFloat32()]="CopysignF32",e[e.MinF32=_BinaryenMinFloat32()]="MinF32",e[e.MaxF32=_BinaryenMaxFloat32()]="MaxF32",e[e.EqF32=_BinaryenEqFloat32()]="EqF32",e[e.NeF32=_BinaryenNeFloat32()]="NeF32",e[e.LtF32=_BinaryenLtFloat32()]="LtF32",e[e.LeF32=_BinaryenLeFloat32()]="LeF32",e[e.GtF32=_BinaryenGtFloat32()]="GtF32",e[e.GeF32=_BinaryenGeFloat32()]="GeF32",e[e.AddF64=_BinaryenAddFloat64()]="AddF64",e[e.SubF64=_BinaryenSubFloat64()]="SubF64",e[e.MulF64=_BinaryenMulFloat64()]="MulF64",e[e.DivF64=_BinaryenDivFloat64()]="DivF64",e[e.CopysignF64=_BinaryenCopySignFloat64()]="CopysignF64",e[e.MinF64=_BinaryenMinFloat64()]="MinF64",e[e.MaxF64=_BinaryenMaxFloat64()]="MaxF64",e[e.EqF64=_BinaryenEqFloat64()]="EqF64",e[e.NeF64=_BinaryenNeFloat64()]="NeF64",e[e.LtF64=_BinaryenLtFloat64()]="LtF64",e[e.LeF64=_BinaryenLeFloat64()]="LeF64",e[e.GtF64=_BinaryenGtFloat64()]="GtF64",e[e.GeF64=_BinaryenGeFloat64()]="GeF64"}(t.BinaryOp||(t.BinaryOp={})),function(e){e[e.CurrentMemory=_BinaryenCurrentMemory()]="CurrentMemory",e[e.GrowMemory=_BinaryenGrowMemory()]="GrowMemory"}(t.HostOp||(t.HostOp={})),function(e){e[e.Add=_BinaryenAtomicRMWAdd()]="Add",e[e.Sub=_BinaryenAtomicRMWSub()]="Sub",e[e.And=_BinaryenAtomicRMWAnd()]="And",e[e.Or=_BinaryenAtomicRMWOr()]="Or",e[e.Xor=_BinaryenAtomicRMWXor()]="Xor",e[e.Xchg=_BinaryenAtomicRMWXchg()]="Xchg"}(t.AtomicRMWOp||(t.AtomicRMWOp={})),function(e){e[e.SplatVecI8x16=_BinaryenSplatVecI8x16()]="SplatVecI8x16",e[e.SplatVecI16x8=_BinaryenSplatVecI16x8()]="SplatVecI16x8",e[e.SplatVecI32x4=_BinaryenSplatVecI32x4()]="SplatVecI32x4",e[e.SplatVecI64x2=_BinaryenSplatVecI64x2()]="SplatVecI64x2",e[e.SplatVecF32x4=_BinaryenSplatVecF32x4()]="SplatVecF32x4",e[e.SplatVecF64x2=_BinaryenSplatVecF64x2()]="SplatVecF64x2",e[e.NotVec128=_BinaryenNotVec128()]="NotVec128",e[e.NegVecI8x16=_BinaryenNegVecI8x16()]="NegVecI8x16",e[e.AnyTrueVecI8x16=_BinaryenAnyTrueVecI8x16()]="AnyTrueVecI8x16",e[e.AllTrueVecI8x16=_BinaryenAllTrueVecI8x16()]="AllTrueVecI8x16",e[e.NegVecI16x8=_BinaryenNegVecI16x8()]="NegVecI16x8",e[e.AnyTrueVecI16x8=_BinaryenAnyTrueVecI16x8()]="AnyTrueVecI16x8",e[e.AllTrueVecI16x8=_BinaryenAllTrueVecI16x8()]="AllTrueVecI16x8",e[e.NegVecI32x4=_BinaryenNegVecI32x4()]="NegVecI32x4",e[e.AnyTrueVecI32x4=_BinaryenAnyTrueVecI32x4()]="AnyTrueVecI32x4",e[e.AllTrueVecI32x4=_BinaryenAllTrueVecI32x4()]="AllTrueVecI32x4",e[e.NegVecI64x2=_BinaryenNegVecI64x2()]="NegVecI64x2",e[e.AnyTrueVecI64x2=_BinaryenAnyTrueVecI64x2()]="AnyTrueVecI64x2",e[e.AllTrueVecI64x2=_BinaryenAllTrueVecI64x2()]="AllTrueVecI64x2",e[e.AbsVecF32x4=_BinaryenAbsVecF32x4()]="AbsVecF32x4",e[e.NegVecF32x4=_BinaryenNegVecF32x4()]="NegVecF32x4",e[e.SqrtVecF32x4=_BinaryenSqrtVecF32x4()]="SqrtVecF32x4",e[e.AbsVecF64x2=_BinaryenAbsVecF64x2()]="AbsVecF64x2",e[e.NegVecF64x2=_BinaryenNegVecF64x2()]="NegVecF64x2",e[e.SqrtVecF64x2=_BinaryenSqrtVecF64x2()]="SqrtVecF64x2",e[e.TruncSatSVecF32x4ToVecI32x4=_BinaryenTruncSatSVecF32x4ToVecI32x4()]="TruncSatSVecF32x4ToVecI32x4",e[e.TruncSatUVecF32x4ToVecI32x4=_BinaryenTruncSatUVecF32x4ToVecI32x4()]="TruncSatUVecF32x4ToVecI32x4",e[e.TruncSatSVecF64x2ToVecI64x2=_BinaryenTruncSatSVecF64x2ToVecI64x2()]="TruncSatSVecF64x2ToVecI64x2",e[e.TruncSatUVecF64x2ToVecI64x2=_BinaryenTruncSatUVecF64x2ToVecI64x2()]="TruncSatUVecF64x2ToVecI64x2",e[e.ConvertSVecI32x4ToVecF32x4=_BinaryenConvertSVecI32x4ToVecF32x4()]="ConvertSVecI32x4ToVecF32x4",e[e.ConvertUVecI32x4ToVecF32x4=_BinaryenConvertUVecI32x4ToVecF32x4()]="ConvertUVecI32x4ToVecF32x4",e[e.ConvertSVecI64x2ToVecF64x2=_BinaryenConvertSVecI64x2ToVecF64x2()]="ConvertSVecI64x2ToVecF64x2",e[e.ConvertUVecI64x2ToVecF64x2=_BinaryenConvertUVecI64x2ToVecF64x2()]="ConvertUVecI64x2ToVecF64x2",e[e.EqVecI8x16=_BinaryenEqVecI8x16()]="EqVecI8x16",e[e.NeVecI8x16=_BinaryenNeVecI8x16()]="NeVecI8x16",e[e.LtSVecI8x16=_BinaryenLtSVecI8x16()]="LtSVecI8x16",e[e.LtUVecI8x16=_BinaryenLtUVecI8x16()]="LtUVecI8x16",e[e.LeSVecI8x16=_BinaryenLeSVecI8x16()]="LeSVecI8x16",e[e.LeUVecI8x16=_BinaryenLeUVecI8x16()]="LeUVecI8x16",e[e.GtSVecI8x16=_BinaryenGtSVecI8x16()]="GtSVecI8x16",e[e.GtUVecI8x16=_BinaryenGtUVecI8x16()]="GtUVecI8x16",e[e.GeSVecI8x16=_BinaryenGeSVecI8x16()]="GeSVecI8x16",e[e.GeUVecI8x16=_BinaryenGeUVecI8x16()]="GeUVecI8x16",e[e.EqVecI16x8=_BinaryenEqVecI16x8()]="EqVecI16x8",e[e.NeVecI16x8=_BinaryenNeVecI16x8()]="NeVecI16x8",e[e.LtSVecI16x8=_BinaryenLtSVecI16x8()]="LtSVecI16x8",e[e.LtUVecI16x8=_BinaryenLtUVecI16x8()]="LtUVecI16x8",e[e.LeSVecI16x8=_BinaryenLeSVecI16x8()]="LeSVecI16x8",e[e.LeUVecI16x8=_BinaryenLeUVecI16x8()]="LeUVecI16x8",e[e.GtSVecI16x8=_BinaryenGtSVecI16x8()]="GtSVecI16x8",e[e.GtUVecI16x8=_BinaryenGtUVecI16x8()]="GtUVecI16x8",e[e.GeSVecI16x8=_BinaryenGeSVecI16x8()]="GeSVecI16x8",e[e.GeUVecI16x8=_BinaryenGeUVecI16x8()]="GeUVecI16x8",e[e.EqVecI32x4=_BinaryenEqVecI32x4()]="EqVecI32x4",e[e.NeVecI32x4=_BinaryenNeVecI32x4()]="NeVecI32x4",e[e.LtSVecI32x4=_BinaryenLtSVecI32x4()]="LtSVecI32x4",e[e.LtUVecI32x4=_BinaryenLtUVecI32x4()]="LtUVecI32x4",e[e.LeSVecI32x4=_BinaryenLeSVecI32x4()]="LeSVecI32x4",e[e.LeUVecI32x4=_BinaryenLeUVecI32x4()]="LeUVecI32x4",e[e.GtSVecI32x4=_BinaryenGtSVecI32x4()]="GtSVecI32x4",e[e.GtUVecI32x4=_BinaryenGtUVecI32x4()]="GtUVecI32x4",e[e.GeSVecI32x4=_BinaryenGeSVecI32x4()]="GeSVecI32x4",e[e.GeUVecI32x4=_BinaryenGeUVecI32x4()]="GeUVecI32x4",e[e.EqVecF32x4=_BinaryenEqVecF32x4()]="EqVecF32x4",e[e.NeVecF32x4=_BinaryenNeVecF32x4()]="NeVecF32x4",e[e.LtVecF32x4=_BinaryenLtVecF32x4()]="LtVecF32x4",e[e.LeVecF32x4=_BinaryenLeVecF32x4()]="LeVecF32x4",e[e.GtVecF32x4=_BinaryenGtVecF32x4()]="GtVecF32x4",e[e.GeVecF32x4=_BinaryenGeVecF32x4()]="GeVecF32x4",e[e.EqVecF64x2=_BinaryenEqVecF64x2()]="EqVecF64x2",e[e.NeVecF64x2=_BinaryenNeVecF64x2()]="NeVecF64x2",e[e.LtVecF64x2=_BinaryenLtVecF64x2()]="LtVecF64x2",e[e.LeVecF64x2=_BinaryenLeVecF64x2()]="LeVecF64x2",e[e.GtVecF64x2=_BinaryenGtVecF64x2()]="GtVecF64x2",e[e.GeVecF64x2=_BinaryenGeVecF64x2()]="GeVecF64x2",e[e.AndVec128=_BinaryenAndVec128()]="AndVec128",e[e.OrVec128=_BinaryenOrVec128()]="OrVec128",e[e.XorVec128=_BinaryenXorVec128()]="XorVec128",e[e.AddVecI8x16=_BinaryenAddVecI8x16()]="AddVecI8x16",e[e.AddSatSVecI8x16=_BinaryenAddSatSVecI8x16()]="AddSatSVecI8x16",e[e.AddSatUVecI8x16=_BinaryenAddSatUVecI8x16()]="AddSatUVecI8x16",e[e.SubVecI8x16=_BinaryenSubVecI8x16()]="SubVecI8x16",e[e.SubSatSVecI8x16=_BinaryenSubSatSVecI8x16()]="SubSatSVecI8x16",e[e.SubSatUVecI8x16=_BinaryenSubSatUVecI8x16()]="SubSatUVecI8x16",e[e.MulVecI8x16=_BinaryenMulVecI8x16()]="MulVecI8x16",e[e.AddVecI16x8=_BinaryenAddVecI16x8()]="AddVecI16x8",e[e.AddSatSVecI16x8=_BinaryenAddSatSVecI16x8()]="AddSatSVecI16x8",e[e.AddSatUVecI16x8=_BinaryenAddSatUVecI16x8()]="AddSatUVecI16x8",e[e.SubVecI16x8=_BinaryenSubVecI16x8()]="SubVecI16x8",e[e.SubSatSVecI16x8=_BinaryenSubSatSVecI16x8()]="SubSatSVecI16x8",e[e.SubSatUVecI16x8=_BinaryenSubSatUVecI16x8()]="SubSatUVecI16x8",e[e.MulVecI16x8=_BinaryenMulVecI16x8()]="MulVecI16x8",e[e.AddVecI32x4=_BinaryenAddVecI32x4()]="AddVecI32x4",e[e.SubVecI32x4=_BinaryenSubVecI32x4()]="SubVecI32x4",e[e.MulVecI32x4=_BinaryenMulVecI32x4()]="MulVecI32x4",e[e.AddVecI64x2=_BinaryenAddVecI64x2()]="AddVecI64x2",e[e.SubVecI64x2=_BinaryenSubVecI64x2()]="SubVecI64x2",e[e.AddVecF32x4=_BinaryenAddVecF32x4()]="AddVecF32x4",e[e.SubVecF32x4=_BinaryenSubVecF32x4()]="SubVecF32x4",e[e.MulVecF32x4=_BinaryenMulVecF32x4()]="MulVecF32x4",e[e.DivVecF32x4=_BinaryenDivVecF32x4()]="DivVecF32x4",e[e.MinVecF32x4=_BinaryenMinVecF32x4()]="MinVecF32x4",e[e.MaxVecF32x4=_BinaryenMaxVecF32x4()]="MaxVecF32x4",e[e.AddVecF64x2=_BinaryenAddVecF64x2()]="AddVecF64x2",e[e.SubVecF64x2=_BinaryenSubVecF64x2()]="SubVecF64x2",e[e.MulVecF64x2=_BinaryenMulVecF64x2()]="MulVecF64x2",e[e.DivVecF64x2=_BinaryenDivVecF64x2()]="DivVecF64x2",e[e.MinVecF64x2=_BinaryenMinVecF64x2()]="MinVecF64x2",e[e.MaxVecF64x2=_BinaryenMaxVecF64x2()]="MaxVecF64x2"}(t.SIMDOp||(t.SIMDOp={}));var 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=u(r);try{return _BinaryenAddFunctionType(this.ref,n,t,i,r?r.length:0)}finally{memory.free(i)}},e.prototype.getFunctionTypeBySignature=function(e,t){var r=u(t);try{return _BinaryenGetFunctionTypeBySignature(this.ref,e,r,t?t.length:0)}finally{memory.free(r)}},e.prototype.removeFunctionType=function(e){var t=this.allocStringCached(e);_BinaryenRemoveFunctionType(this.ref,t)},e.prototype.createI32=function(e){var t=this.lit;return _BinaryenLiteralInt32(t,e),_BinaryenConst(this.ref,t)},e.prototype.createI64=function(e,t){void 0===t&&(t=0);var r=this.lit;return _BinaryenLiteralInt64(r,e,t),_BinaryenConst(this.ref,r)},e.prototype.createF32=function(e){var t=this.lit;return _BinaryenLiteralFloat32(t,e),_BinaryenConst(this.ref,t)},e.prototype.createF64=function(e){var t=this.lit;return _BinaryenLiteralFloat64(t,e),_BinaryenConst(this.ref,t)},e.prototype.createV128=function(e){assert(16==e.length);for(var t=this.lit,r=0;r<16;++r)store(t+r,e[r]);return _BinaryenLiteralVec128(t,t),_BinaryenConst(this.ref,t)},e.prototype.createUnary=function(e,t){return _BinaryenUnary(this.ref,e,t)},e.prototype.createBinary=function(e,t,r){return _BinaryenBinary(this.ref,e,t,r)},e.prototype.createHost=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=null);var n=this.allocStringCached(t),i=h(r);try{return _BinaryenHost(this.ref,e,n,i,r?r.length:0)}finally{memory.free(i)}},e.prototype.createGetLocal=function(e,t){return _BinaryenGetLocal(this.ref,e,t)},e.prototype.createTeeLocal=function(e,t){return _BinaryenTeeLocal(this.ref,e,t)},e.prototype.createGetGlobal=function(e,t){var r=this.allocStringCached(e);return _BinaryenGetGlobal(this.ref,r,t)},e.prototype.createLoad=function(e,t,r,n,i){return void 0===i&&(i=0),_BinaryenLoad(this.ref,e,t?1:0,i,e,n,r)},e.prototype.createStore=function(e,t,r,n,i){return void 0===i&&(i=0),_BinaryenStore(this.ref,e,i,e,t,r,n)},e.prototype.createAtomicLoad=function(e,t,r,n){return void 0===n&&(n=0),_BinaryenAtomicLoad(this.ref,e,n,r,t)},e.prototype.createAtomicStore=function(e,t,r,n,i){return void 0===i&&(i=0),_BinaryenAtomicStore(this.ref,e,i,t,r,n)},e.prototype.createAtomicRMW=function(e,t,r,n,i,a){return _BinaryenAtomicRMW(this.ref,e,t,r,n,i,a)},e.prototype.createAtomicCmpxchg=function(e,t,r,n,i,a){return _BinaryenAtomicCmpxchg(this.ref,e,t,r,n,i,a)},e.prototype.createAtomicWait=function(e,t,r,n){return _BinaryenAtomicWait(this.ref,e,t,r,n)},e.prototype.createAtomicWake=function(e,t){return _BinaryenAtomicWake(this.ref,e,t)},e.prototype.createSetLocal=function(e,t){return _BinaryenSetLocal(this.ref,e,t)},e.prototype.createSetGlobal=function(e,t){var r=this.allocStringCached(e);return _BinaryenSetGlobal(this.ref,r,t)},e.prototype.createBlock=function(e,t,r){void 0===r&&(r=i.None);var n=this.allocStringCached(e),a=h(t);try{return _BinaryenBlock(this.ref,n,a,t.length,r)}finally{memory.free(a)}},e.prototype.createBreak=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0);var n=this.allocStringCached(e);return _BinaryenBreak(this.ref,n,t,r)},e.prototype.createDrop=function(e){return _BinaryenDrop(this.ref,e)},e.prototype.createLoop=function(e,t){var r=this.allocStringCached(e);return _BinaryenLoop(this.ref,r,t)},e.prototype.createIf=function(e,t,r){return void 0===r&&(r=0),_BinaryenIf(this.ref,e,t,r)},e.prototype.createNop=function(){return _BinaryenNop(this.ref)},e.prototype.createReturn=function(e){return void 0===e&&(e=0),_BinaryenReturn(this.ref,e)},e.prototype.createSelect=function(e,t,r){return _BinaryenSelect(this.ref,r,e,t)},e.prototype.createSwitch=function(e,t,r,n){void 0===n&&(n=0);for(var i=e.length,a=new Array(i),s=0;s=0;--d)memory.free(l[d])}},e.prototype.setFunctionTable=function(e,t,r){for(var n=r.length,i=new Array(n),a=0;a=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=u([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 g;return s.output=function(e,t){for(var r=new Uint8Array(t),n=0;n>8&255),store(r+2,a>>16&255),store(r+3,a>>>24),r+=4}return t}function h(e){return u(e)}t.Relooper=l;var _=new Map;function d(e){if(null==e)return 0;if(_.has(e))return _.get(e);for(var t=memory.allocate(function(e){for(var t=0,r=0,n=e.length;r=55296&&i<=57343&&r+1=55296&&a<=57343&&n+1>>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),_.set(e,t),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.readString=m;var g=function(){return function(){}}();t.BinaryModule=g,t.needsExplicitUnreachable=function e(t){switch(_BinaryenExpressionGetType(t)){case i.I32:case i.I64:case i.F32:case i.F64:return!1}switch(_BinaryenExpressionGetId(t)){case a.Unreachable:case a.Return:return!1;case a.Break:return 0!=_BinaryenBreakGetCondition(t);case a.Block:if(!_BinaryenBlockGetName(t)){var r=_BinaryenBlockGetNumChildren(t);return r>0&&e(_BinaryenBlockGetChild(t,r-1))}}return!0}},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),s=r(6);t.Token=s.Token,t.Range=s.Range;var o,c=r(0);!function(e){e[e.SOURCE=0]="SOURCE",e[e.TYPE=1]="TYPE",e[e.TYPEPARAMETER=2]="TYPEPARAMETER",e[e.PARAMETER=3]="PARAMETER",e[e.SIGNATURE=4]="SIGNATURE",e[e.IDENTIFIER=5]="IDENTIFIER",e[e.ASSERTION=6]="ASSERTION",e[e.BINARY=7]="BINARY",e[e.CALL=8]="CALL",e[e.CLASS=9]="CLASS",e[e.COMMA=10]="COMMA",e[e.ELEMENTACCESS=11]="ELEMENTACCESS",e[e.FALSE=12]="FALSE",e[e.FUNCTION=13]="FUNCTION",e[e.INSTANCEOF=14]="INSTANCEOF",e[e.LITERAL=15]="LITERAL",e[e.NEW=16]="NEW",e[e.NULL=17]="NULL",e[e.PARENTHESIZED=18]="PARENTHESIZED",e[e.PROPERTYACCESS=19]="PROPERTYACCESS",e[e.TERNARY=20]="TERNARY",e[e.SUPER=21]="SUPER",e[e.THIS=22]="THIS",e[e.TRUE=23]="TRUE",e[e.CONSTRUCTOR=24]="CONSTRUCTOR",e[e.UNARYPOSTFIX=25]="UNARYPOSTFIX",e[e.UNARYPREFIX=26]="UNARYPREFIX",e[e.BLOCK=27]="BLOCK",e[e.BREAK=28]="BREAK",e[e.CONTINUE=29]="CONTINUE",e[e.DO=30]="DO",e[e.EMPTY=31]="EMPTY",e[e.EXPORT=32]="EXPORT",e[e.EXPORTIMPORT=33]="EXPORTIMPORT",e[e.EXPRESSION=34]="EXPRESSION",e[e.FOR=35]="FOR",e[e.IF=36]="IF",e[e.IMPORT=37]="IMPORT",e[e.RETURN=38]="RETURN",e[e.SWITCH=39]="SWITCH",e[e.THROW=40]="THROW",e[e.TRY=41]="TRY",e[e.VARIABLE=42]="VARIABLE",e[e.VOID=43]="VOID",e[e.WHILE=44]="WHILE",e[e.CLASSDECLARATION=45]="CLASSDECLARATION",e[e.ENUMDECLARATION=46]="ENUMDECLARATION",e[e.ENUMVALUEDECLARATION=47]="ENUMVALUEDECLARATION",e[e.FIELDDECLARATION=48]="FIELDDECLARATION",e[e.FUNCTIONDECLARATION=49]="FUNCTIONDECLARATION",e[e.IMPORTDECLARATION=50]="IMPORTDECLARATION",e[e.INDEXSIGNATUREDECLARATION=51]="INDEXSIGNATUREDECLARATION",e[e.INTERFACEDECLARATION=52]="INTERFACEDECLARATION",e[e.METHODDECLARATION=53]="METHODDECLARATION",e[e.NAMESPACEDECLARATION=54]="NAMESPACEDECLARATION",e[e.TYPEDECLARATION=55]="TYPEDECLARATION",e[e.VARIABLEDECLARATION=56]="VARIABLEDECLARATION",e[e.DECORATOR=57]="DECORATOR",e[e.EXPORTMEMBER=58]="EXPORTMEMBER",e[e.SWITCHCASE=59]="SWITCHCASE",e[e.COMMENT=60]="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(){this.parent=null,this.flags=a.CommonFlags.NONE}return 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.createType=function(e,t,r,n){var i=new u;return i.range=n,i.name=e,e.parent=i,i.typeArguments=t,t&&De(t,i),i.isNullable=r,i},e.createOmittedType=function(t){return e.createType(e.createIdentifierExpression("",t),null,!1,t)},e.createTypeParameter=function(e,t,r,n){var i=new h;return i.range=n,i.name=e,e.parent=i,i.extendsType=t,t&&(t.parent=i),i.defaultType=r,r&&(r.parent=i),i},e.createParameter=function(e,t,r,n,i){var a=new _;return a.range=i,a.name=e,e.parent=a,a.type=t,t&&(t.parent=a),a.initializer=r,r&&(r.parent=a),a.parameterKind=n,a},e.createSignature=function(e,t,r,n,i){var a=new y;return a.range=i,a.parameters=e,De(e,a),a.returnType=t,t.parent=a,a.explicitThisType=r,r&&(r.parent=a),a.isNullable=n,a},e.createDecorator=function(e,t,r){var n=new g;return n.range=r,n.name=e,e.parent=n,n.arguments=t,t&&De(t,n),n.decoratorKind=m(e),n},e.createComment=function(e,t,r){var n=new T;return n.range=r,n.commentKind=t,n.text=e,n},e.createIdentifierExpression=function(e,t){var r=new I;return r.range=t,r.text=e,r},e.createEmptyIdentifierExpression=function(e){var t=new I;return t.range=e,t.text="",t},e.createArrayLiteralExpression=function(e,t){var r=new A;return r.range=t,r.elementExpressions=e,function(e,t){for(var r=0,n=e.length;r=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==j.ENTRY},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLibrary",{get:function(){return this.sourceKind==j.LIBRARY},enumerable:!0,configurable:!0}),t}(l);t.Source=J;var $=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.decorators=null,t.cachedProgramLevelInternalName=null,t.cachedFileLevelInternalName=null,t}return i(t,e),Object.defineProperty(t.prototype,"programLevelInternalName",{get:function(){return this.cachedProgramLevelInternalName||(this.cachedProgramLevelInternalName=Fe(this,!0)),this.cachedProgramLevelInternalName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fileLevelInternalName",{get:function(){return this.cachedFileLevelInternalName||(this.cachedFileLevelInternalName=Fe(this,!1)),this.cachedFileLevelInternalName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isTopLevel",{get:function(){var e=this.parent;return!!e&&(!(e.kind==o.VARIABLE&&!(e=e.parent))&&e.kind==o.SOURCE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isTopLevelExport",{get:function(){var e=this.parent;return!(!e||e.kind==o.VARIABLE&&!(e=e.parent))&&(e.kind==o.NAMESPACEDECLARATION?this.is(a.CommonFlags.EXPORT)&&e.isTopLevelExport:e.kind==o.CLASSDECLARATION?this.is(a.CommonFlags.STATIC)&&e.isTopLevelExport:e.kind==o.SOURCE&&this.is(a.CommonFlags.EXPORT))},enumerable:!0,configurable:!0}),t.prototype.needsExplicitExport=function(e){return e.name.text!=e.externalName.text||this.range.source!=e.range.source||!this.isTopLevelExport},t}(Z);t.DeclarationStatement=$;var ee=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.INDEXSIGNATUREDECLARATION,t}return i(t,e),t}($);t.IndexSignatureDeclaration=ee;var te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}($);t.VariableLikeDeclarationStatement=te;var re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.BLOCK,t}return i(t,e),t}(Z);t.BlockStatement=re;var ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.BREAK,t}return i(t,e),t}(Z);t.BreakStatement=ne;var ie=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}($);t.ClassDeclaration=ie;var ae=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.CONTINUE,t}return i(t,e),t}(Z);t.ContinueStatement=ae;var se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.DO,t}return i(t,e),t}(Z);t.DoStatement=se;var oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.EMPTY,t}return i(t,e),t}(Z);t.EmptyStatement=oe;var ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.ENUMDECLARATION,t}return i(t,e),t}($);t.EnumDeclaration=ce;var le=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.ENUMVALUEDECLARATION,t}return i(t,e),t}($);t.EnumValueDeclaration=le;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 ue=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=ue;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}(Z);t.ExportStatement=he;var _e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.EXPRESSION,t}return i(t,e),t}(Z);t.ExpressionStatement=_e;var de=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}(te);t.FieldDeclaration=de;var ye=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.FOR,t}return i(t,e),t}(Z);t.ForStatement=ye;var me=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}($);t.FunctionDeclaration=me;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}(Z);t.IfStatement=ge;var Te=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.IMPORTDECLARATION,t}return i(t,e),t}($);t.ImportDeclaration=Te;var Ee=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.IMPORT,t}return i(t,e),t}(Z);t.ImportStatement=Ee;var fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.INTERFACEDECLARATION,t}return i(t,e),t}(ie);t.InterfaceDeclaration=fe;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}(me);t.MethodDeclaration=Ie;var ve=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.NAMESPACEDECLARATION,t}return i(t,e),t}($);t.NamespaceDeclaration=ve;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}(Z);t.ReturnStatement=Ae;var Ce=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=Ce;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}(Z);t.SwitchStatement=Se;var Ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.THROW,t}return i(t,e),t}(Z);t.ThrowStatement=Ne;var Oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.TRY,t}return i(t,e),t}(Z);t.TryStatement=Oe;var xe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.TYPEDECLARATION,t}return i(t,e),t}($);t.TypeDeclaration=xe;var be=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.VARIABLEDECLARATION,t}return i(t,e),t}(te);t.VariableDeclaration=be;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}(Z);t.VariableStatement=Le;var ke=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.VOID,t}return i(t,e),t}(Z);t.VoidStatement=ke;var Re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=o.WHILE,t}return i(t,e),t}(Z);function Fe(e,t){void 0===t&&(t=!1);var r=e.name.text,n=e.parent;return n&&(e.kind!=o.VARIABLEDECLARATION||n.kind!=o.VARIABLE||(n=n.parent))?n.kind==o.CLASSDECLARATION?Fe(n,t)+(e.is(a.CommonFlags.STATIC)?a.STATIC_DELIMITER:a.INSTANCE_DELIMITER)+r:n.kind==o.NAMESPACEDECLARATION||n.kind==o.ENUMDECLARATION?Fe(n,t)+a.STATIC_DELIMITER+r:t?r:e.range.source.internalPath+a.PATH_DELIMITER+r:r}function Be(e){return e.endsWith(".ts")&&(e=e.substring(0,e.length-3)),e}function De(e,t){for(var r=0,n=e.length;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(1),l=r(2),p=r(7),u=r(4),h=r(3),_=r(0),d=r(11),y=function(){return function(){}}(),m=function(){return function(){}}(),g=function(){return function(){}}();function T(e,t){switch(assert(t.length),e){case u.DecoratorKind.OPERATOR:case u.DecoratorKind.OPERATOR_BINARY:switch(t.charCodeAt(0)){case 91:if("[]"==t)return 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 u.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 u.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 E,f,I=new Map,v=function(e){function t(t){void 0===t&&(t=null);var r=e.call(this,t)||this;return r.diagnosticsOffset=0,r.elementsLookup=new Map,r.instancesLookup=new Map,r.typesLookup=I,r.typeAliases=new Map,r.fileLevelExports=new Map,r.moduleLevelExports=new Map,r.basicClasses=new Map,r.arrayBufferInstance=null,r.arrayPrototype=null,r.stringInstance=null,r.mainFunction=null,r.abortInstance=null,r.memoryAllocateInstance=null,r.hasGC=!1,r.gcAllocateInstance=null,r.gcLinkInstance=null,r.gcMarkInstance=null,r.gcHeaderSize=0,r.gcHookOffset=0,r.resolver=new d.Resolver(r),r.sources=[],r}return i(t,e),t.prototype.getSource=function(e){for(var t=this.sources,r=0,n=t.length;r=0);var t,r=this.parentFunction;switch(assert(null!=e.type),e.type.toNativeType()){case h.NativeType.I32:t=r.tempI32s||(r.tempI32s=[]);break;case h.NativeType.I64:t=r.tempI64s||(r.tempI64s=[]);break;case h.NativeType.F32:t=r.tempF32s||(r.tempF32s=[]);break;case h.NativeType.F64:t=r.tempF64s||(r.tempF64s=[]);break;default:throw new Error("concrete type expected")}assert(e.index>=0),t.push(e)}},e.prototype.getAndFreeTempLocal=function(e,t){var r,n,i=this.parentFunction;switch(e.toNativeType()){case h.NativeType.I32:r=i.tempI32s||(i.tempI32s=[]);break;case h.NativeType.I64:r=i.tempI64s||(i.tempI64s=[]);break;case h.NativeType.F32:r=i.tempF32s||(i.tempF32s=[]);break;case h.NativeType.F64:r=i.tempF64s||(i.tempF64s=[]);break;default:throw new Error("concrete type expected")}return r.length?(n=r[r.length-1]).type=e:(n=i.addLocal(e),r.push(n)),e.is(36)&&this.setLocalWrapped(n.index,t),n},e.prototype.addScopedLocal=function(e,t,r,n){void 0===n&&(n=null);var i=this.getTempLocal(t,!1);if(this.scopedLocals){var a=this.scopedLocals.get(e);if(a)return n&&this.parentFunction.program.error(l.DiagnosticCode.Duplicate_identifier_0,n.range),a}else this.scopedLocals=new Map;return i.set(c.CommonFlags.SCOPED),this.scopedLocals.set(e,i),t.is(36)&&this.setLocalWrapped(i.index,r),i},e.prototype.addScopedAlias=function(e,t,r,n){if(void 0===n&&(n=null),this.scopedLocals){var i=this.scopedLocals.get(e);if(i)return n&&this.parentFunction.program.error(l.DiagnosticCode.Duplicate_identifier_0,n.range),i}else this.scopedLocals=new Map;assert(r1?e.breakLabel=t[r-2].toString(10):(e.breakLabel=null,e.breakStack=null)},e.prototype.inherit=function(e){this.flags|=4095&e.flags,this.wrappedLocals=e.wrappedLocals,this.wrappedLocalsExt=e.wrappedLocalsExt},e.prototype.inheritConditional=function(e){e.is(1)&&this.set(128),e.is(4)&&this.set(256),e.is(8)&&e.breakLabel==this.breakLabel&&this.set(512),e.is(16)&&e.continueLabel==this.continueLabel&&this.set(1024),e.is(32)&&this.set(2048)},e.prototype.inheritMutual=function(e,t){this.flags|=e.flags&t.flags&127,this.flags|=3968&e.flags,this.flags|=3968&t.flags,this.wrappedLocals=i64_and(e.wrappedLocals,t.wrappedLocals);var r=e.wrappedLocalsExt,n=t.wrappedLocalsExt;if(null!=r&&null!=n){var i=this.wrappedLocalsExt,a=min(r.length,n.length);if(a){if(i)for(;i.lengtha):this.canOverflow(h.getBinaryLeft(e),t)&&!(h.getExpressionId(r=h.getBinaryRight(e))==h.ExpressionId.Const&&h.getConstValueI32(r)>=a);case h.BinaryOp.DivU32:case h.BinaryOp.RemI32:case h.BinaryOp.RemU32:return this.canOverflow(h.getBinaryLeft(e),t)||this.canOverflow(h.getBinaryRight(e),t)}break;case h.ExpressionId.Unary:switch(h.getUnaryOp(e)){case h.UnaryOp.EqzI32:case h.UnaryOp.EqzI64:return!1;case h.UnaryOp.ClzI32:case h.UnaryOp.CtzI32:case h.UnaryOp.PopcntI32:return t.size<7}break;case h.ExpressionId.Const:var s=0;switch(h.getExpressionType(e)){case h.NativeType.I32:s=h.getConstValueI32(e);break;case h.NativeType.I64:s=h.getConstValueI64Low(e);break;case h.NativeType.F32:s=i32(h.getConstValueF32(e));break;case h.NativeType.F64:s=i32(h.getConstValueF64(e));break;default:assert(!1)}switch(t.kind){case 0:return si8.MAX_VALUE;case 1:return si16.MAX_VALUE;case 5:return s<0||s>u8.MAX_VALUE;case 6:return s<0||s>u16.MAX_VALUE;case 10:return 0!=(-2&s)}break;case h.ExpressionId.Load:var o=void 0;switch(h.getLoadBytes(e)){case 1:o=h.isLoadSigned(e)?p.Type.i8:p.Type.u8;break;case 2:o=h.isLoadSigned(e)?p.Type.i16:p.Type.u16;break;default:o=h.isLoadSigned(e)?p.Type.i32:p.Type.u32}return H(o,t);case h.ExpressionId.Block:if(!h.getBlockName(e)){var c=assert(h.getBlockChildCount(e)),l=h.getBlockChild(e,c-1);return this.canOverflow(l,t)}break;case h.ExpressionId.If:return this.canOverflow(h.getIfTrue(e),t)||this.canOverflow(assert(h.getIfFalse(e)),t);case h.ExpressionId.Select:return this.canOverflow(h.getSelectThen(e),t)||this.canOverflow(h.getSelectElse(e),t);case h.ExpressionId.Call:var u=this.parentFunction.program,_=assert(u.instancesLookup.get(assert(h.getCallTarget(e))));assert(_.kind==E.FUNCTION);var d=_.signature.returnType;return!_.flow.is(2)||H(d,t);case h.ExpressionId.Unreachable:return!1}return!0},e}();function H(e,t){return!e.is(4)||e.size>t.size||e.is(1)!=t.is(1)}t.Flow=z},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(4),l=r(0);function p(e){switch(assert(e.length),e.charCodeAt(0)){case 97:switch(e){case"abstract":return a.ABSTRACT;case"as":return a.AS;case"async":return a.ASYNC;case"await":return a.AWAIT}break;case 98:switch(e){case"break":return a.BREAK}break;case 99:switch(e){case"case":return a.CASE;case"catch":return a.CATCH;case"class":return a.CLASS;case"continue":return a.CONTINUE;case"const":return a.CONST;case"constructor":return a.CONSTRUCTOR}break;case 100:switch(e){case"debugger":return a.DEBUGGER;case"declare":return a.DECLARE;case"default":return a.DEFAULT;case"delete":return a.DELETE;case"do":return a.DO}break;case 101:switch(e){case"else":return a.ELSE;case"enum":return a.ENUM;case"export":return a.EXPORT;case"extends":return a.EXTENDS}break;case 102:switch(e){case"false":return a.FALSE;case"finally":return a.FINALLY;case"for":return a.FOR;case"from":return a.FROM;case"function":return a.FUNCTION}break;case 103:switch(e){case"get":return a.GET}break;case 105:switch(e){case"if":return a.IF;case"implements":return a.IMPLEMENTS;case"import":return a.IMPORT;case"in":return a.IN;case"instanceof":return a.INSTANCEOF;case"interface":return a.INTERFACE;case"is":return a.IS}break;case 107:switch(e){case"keyof":return a.KEYOF}break;case 108:switch(e){case"let":return a.LET}break;case 109:switch(e){case"module":return a.MODULE}break;case 110:switch(e){case"namespace":return a.NAMESPACE;case"new":return a.NEW;case"null":return a.NULL}break;case 111:switch(e){case"of":return a.OF}break;case 112:switch(e){case"package":return a.PACKAGE;case"private":return a.PRIVATE;case"protected":return a.PROTECTED;case"public":return a.PUBLIC}break;case 114:switch(e){case"readonly":return a.READONLY;case"return":return a.RETURN}break;case 115:switch(e){case"set":return a.SET;case"static":return a.STATIC;case"super":return a.SUPER;case"switch":return a.SWITCH}break;case 116:switch(e){case"this":return a.THIS;case"throw":return a.THROW;case"true":return a.TRUE;case"try":return a.TRY;case"type":return a.TYPE;case"typeof":return a.TYPEOF}break;case 118:switch(e){case"var":return a.VAR;case"void":return a.VOID}break;case 119:switch(e){case"while":return a.WHILE;case"with":return a.WITH}break;case 121:switch(e){case"yield":return a.YIELD}}return a.INVALID}function u(e){switch(e){case a.ABSTRACT:case a.AS:case a.CONSTRUCTOR:case a.DECLARE:case a.DELETE:case a.FROM:case a.FOR:case a.GET:case a.IS:case a.KEYOF:case a.MODULE:case a.NAMESPACE:case a.READONLY:case a.SET:case a.TYPE:case a.VOID:return!0;default:return!1}}!function(e){e[e.ABSTRACT=0]="ABSTRACT",e[e.AS=1]="AS",e[e.ASYNC=2]="ASYNC",e[e.AWAIT=3]="AWAIT",e[e.BREAK=4]="BREAK",e[e.CASE=5]="CASE",e[e.CATCH=6]="CATCH",e[e.CLASS=7]="CLASS",e[e.CONST=8]="CONST",e[e.CONTINUE=9]="CONTINUE",e[e.CONSTRUCTOR=10]="CONSTRUCTOR",e[e.DEBUGGER=11]="DEBUGGER",e[e.DECLARE=12]="DECLARE",e[e.DEFAULT=13]="DEFAULT",e[e.DELETE=14]="DELETE",e[e.DO=15]="DO",e[e.ELSE=16]="ELSE",e[e.ENUM=17]="ENUM",e[e.EXPORT=18]="EXPORT",e[e.EXTENDS=19]="EXTENDS",e[e.FALSE=20]="FALSE",e[e.FINALLY=21]="FINALLY",e[e.FOR=22]="FOR",e[e.FROM=23]="FROM",e[e.FUNCTION=24]="FUNCTION",e[e.GET=25]="GET",e[e.IF=26]="IF",e[e.IMPLEMENTS=27]="IMPLEMENTS",e[e.IMPORT=28]="IMPORT",e[e.IN=29]="IN",e[e.INSTANCEOF=30]="INSTANCEOF",e[e.INTERFACE=31]="INTERFACE",e[e.IS=32]="IS",e[e.KEYOF=33]="KEYOF",e[e.LET=34]="LET",e[e.MODULE=35]="MODULE",e[e.NAMESPACE=36]="NAMESPACE",e[e.NEW=37]="NEW",e[e.NULL=38]="NULL",e[e.OF=39]="OF",e[e.PACKAGE=40]="PACKAGE",e[e.PRIVATE=41]="PRIVATE",e[e.PROTECTED=42]="PROTECTED",e[e.PUBLIC=43]="PUBLIC",e[e.READONLY=44]="READONLY",e[e.RETURN=45]="RETURN",e[e.SET=46]="SET",e[e.STATIC=47]="STATIC",e[e.SUPER=48]="SUPER",e[e.SWITCH=49]="SWITCH",e[e.THIS=50]="THIS",e[e.THROW=51]="THROW",e[e.TRUE=52]="TRUE",e[e.TRY=53]="TRY",e[e.TYPE=54]="TYPE",e[e.TYPEOF=55]="TYPEOF",e[e.VAR=56]="VAR",e[e.VOID=57]="VOID",e[e.WHILE=58]="WHILE",e[e.WITH=59]="WITH",e[e.YIELD=60]="YIELD",e[e.OPENBRACE=61]="OPENBRACE",e[e.CLOSEBRACE=62]="CLOSEBRACE",e[e.OPENPAREN=63]="OPENPAREN",e[e.CLOSEPAREN=64]="CLOSEPAREN",e[e.OPENBRACKET=65]="OPENBRACKET",e[e.CLOSEBRACKET=66]="CLOSEBRACKET",e[e.DOT=67]="DOT",e[e.DOT_DOT_DOT=68]="DOT_DOT_DOT",e[e.SEMICOLON=69]="SEMICOLON",e[e.COMMA=70]="COMMA",e[e.LESSTHAN=71]="LESSTHAN",e[e.GREATERTHAN=72]="GREATERTHAN",e[e.LESSTHAN_EQUALS=73]="LESSTHAN_EQUALS",e[e.GREATERTHAN_EQUALS=74]="GREATERTHAN_EQUALS",e[e.EQUALS_EQUALS=75]="EQUALS_EQUALS",e[e.EXCLAMATION_EQUALS=76]="EXCLAMATION_EQUALS",e[e.EQUALS_EQUALS_EQUALS=77]="EQUALS_EQUALS_EQUALS",e[e.EXCLAMATION_EQUALS_EQUALS=78]="EXCLAMATION_EQUALS_EQUALS",e[e.EQUALS_GREATERTHAN=79]="EQUALS_GREATERTHAN",e[e.PLUS=80]="PLUS",e[e.MINUS=81]="MINUS",e[e.ASTERISK_ASTERISK=82]="ASTERISK_ASTERISK",e[e.ASTERISK=83]="ASTERISK",e[e.SLASH=84]="SLASH",e[e.PERCENT=85]="PERCENT",e[e.PLUS_PLUS=86]="PLUS_PLUS",e[e.MINUS_MINUS=87]="MINUS_MINUS",e[e.LESSTHAN_LESSTHAN=88]="LESSTHAN_LESSTHAN",e[e.GREATERTHAN_GREATERTHAN=89]="GREATERTHAN_GREATERTHAN",e[e.GREATERTHAN_GREATERTHAN_GREATERTHAN=90]="GREATERTHAN_GREATERTHAN_GREATERTHAN",e[e.AMPERSAND=91]="AMPERSAND",e[e.BAR=92]="BAR",e[e.CARET=93]="CARET",e[e.EXCLAMATION=94]="EXCLAMATION",e[e.TILDE=95]="TILDE",e[e.AMPERSAND_AMPERSAND=96]="AMPERSAND_AMPERSAND",e[e.BAR_BAR=97]="BAR_BAR",e[e.QUESTION=98]="QUESTION",e[e.COLON=99]="COLON",e[e.EQUALS=100]="EQUALS",e[e.PLUS_EQUALS=101]="PLUS_EQUALS",e[e.MINUS_EQUALS=102]="MINUS_EQUALS",e[e.ASTERISK_EQUALS=103]="ASTERISK_EQUALS",e[e.ASTERISK_ASTERISK_EQUALS=104]="ASTERISK_ASTERISK_EQUALS",e[e.SLASH_EQUALS=105]="SLASH_EQUALS",e[e.PERCENT_EQUALS=106]="PERCENT_EQUALS",e[e.LESSTHAN_LESSTHAN_EQUALS=107]="LESSTHAN_LESSTHAN_EQUALS",e[e.GREATERTHAN_GREATERTHAN_EQUALS=108]="GREATERTHAN_GREATERTHAN_EQUALS",e[e.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS=109]="GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS",e[e.AMPERSAND_EQUALS=110]="AMPERSAND_EQUALS",e[e.BAR_EQUALS=111]="BAR_EQUALS",e[e.CARET_EQUALS=112]="CARET_EQUALS",e[e.AT=113]="AT",e[e.IDENTIFIER=114]="IDENTIFIER",e[e.STRINGLITERAL=115]="STRINGLITERAL",e[e.INTEGERLITERAL=116]="INTEGERLITERAL",e[e.FLOATLITERAL=117]="FLOATLITERAL",e[e.INVALID=118]="INVALID",e[e.ENDOFFILE=119]="ENDOFFILE"}(a=t.Token||(t.Token={})),function(e){e[e.DEFAULT=0]="DEFAULT",e[e.PREFER=1]="PREFER",e[e.ALWAYS=2]="ALWAYS"}(s=t.IdentifierHandling||(t.IdentifierHandling={})),t.tokenFromKeyword=p,t.tokenIsAlsoIdentifier=u,t.operatorTokenToString=function(e){switch(e){case a.DELETE:return"delete";case a.IN:return"in";case a.INSTANCEOF:return"instanceof";case a.NEW:return"new";case a.TYPEOF:return"typeof";case a.VOID:return"void";case a.YIELD:return"yield";case a.DOT_DOT_DOT:return"...";case a.COMMA:return",";case a.LESSTHAN:return"<";case a.GREATERTHAN:return">";case a.LESSTHAN_EQUALS:return"<=";case a.GREATERTHAN_EQUALS:return">=";case a.EQUALS_EQUALS:return"==";case a.EXCLAMATION_EQUALS:return"!=";case a.EQUALS_EQUALS_EQUALS:return"===";case a.EXCLAMATION_EQUALS_EQUALS:return"!==";case a.PLUS:return"+";case a.MINUS:return"-";case a.ASTERISK_ASTERISK:return"**";case a.ASTERISK:return"*";case a.SLASH:return"/";case a.PERCENT:return"%";case a.PLUS_PLUS:return"++";case a.MINUS_MINUS:return"--";case a.LESSTHAN_LESSTHAN:return"<<";case a.GREATERTHAN_GREATERTHAN:return">>";case a.GREATERTHAN_GREATERTHAN_GREATERTHAN:return">>>";case a.AMPERSAND:return"&";case a.BAR:return"|";case a.CARET:return"^";case a.EXCLAMATION:return"!";case a.TILDE:return"~";case a.AMPERSAND_AMPERSAND:return"&&";case a.BAR_BAR:return"||";case a.EQUALS:return"=";case a.PLUS_EQUALS:return"+=";case a.MINUS_EQUALS:return"-=";case a.ASTERISK_EQUALS:return"*=";case a.ASTERISK_ASTERISK_EQUALS:return"**=";case a.SLASH_EQUALS:return"/=";case a.PERCENT_EQUALS:return"%=";case a.LESSTHAN_LESSTHAN_EQUALS:return"<<=";case a.GREATERTHAN_GREATERTHAN_EQUALS:return">>=";case a.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:return">>>=";case a.AMPERSAND_EQUALS:return"&=";case a.BAR_EQUALS:return"|=";case a.CARET_EQUALS:return"^=";default:return assert(!1),""}};var h=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.startr.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=h;var _=function(e){function t(t,r){void 0===r&&(r=null);var n=e.call(this,r)||this;n.end=0,n.pos=0,n.token=-1,n.tokenPos=0,n.nextToken=-1,n.nextTokenPos=0,n.nextTokenOnNewLine=!1,n.onComment=null,n.source=t,n.pos=0,n.end=t.text.length,n.diagnostics=r||new Array;var i=t.text;if(n.pos1&&this.pos2&&this.pos1&&this.pos1&&this.pos1&&this.pos2&&this.pos1&&this.pos1&&this.pos1&&this.pos2&&this.pos+11&&this.pos1&&this.pos2&&this.pos1&&this.pos2&&this.pos1&&this.pos2&&this.pos3&&this.pos1&&this.pos1&&this.pos=this.end){n+=e.substring(r,this.pos),this.error(o.DiagnosticCode.Unterminated_string_literal,this.range(r-1,this.end));break}var i=e.charCodeAt(this.pos);if(i==t){n+=e.substring(r,this.pos++);break}if(92!=i){if(l.isLineBreak(i)){n+=e.substring(r,this.pos),this.error(o.DiagnosticCode.Unterminated_string_literal,this.range(r-1,this.pos));break}++this.pos}else n+=e.substring(r,this.pos),n+=this.readEscapeSequence(),r=this.pos}return n},t.prototype.readEscapeSequence=function(){if(++this.pos>=this.end)return this.error(o.DiagnosticCode.Unexpected_end_of_text,this.range(this.end)),"";var e=this.source.text,t=e.charCodeAt(this.pos++);switch(t){case 48:return"\0";case 98:return"\b";case 116:return"\t";case 110:return"\n";case 118:return"\v";case 102:return"\f";case 114:return"\r";case 39:return"'";case 34:return'"';case 117:return this.pos=this.end){this.error(o.DiagnosticCode.Unterminated_regular_expression_literal,this.range(t,this.end));break}if(92!=e.charCodeAt(this.pos)){var n=e.charCodeAt(this.pos);if(47==n&&!r)break;if(l.isLineBreak(n)){this.error(o.DiagnosticCode.Unterminated_regular_expression_literal,this.range(t,this.pos));break}++this.pos,r=!1}else++this.pos,r=!0}return e.substring(t,this.pos)},t.prototype.readRegexpFlags=function(){for(var e=this.source.text,t=this.pos,r=0;this.pos57)&&95!=r)break;t++}return!0},t.prototype.readInteger=function(){var e=this.source.text;if(48==e.charCodeAt(this.pos)&&this.pos+2=48&&s<=57)r=i64_add(i64_mul(r,n),i64_new(s-48,0));else if(s>=65&&s<=70)r=i64_add(i64_mul(r,n),i64_new(10+s-65,0));else if(s>=97&&s<=102)r=i64_add(i64_mul(r,n),i64_new(10+s-97,0));else{if(95!=s)break;i==a&&this.error(i==t?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}this.pos=a+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=i64_new(0,0),n=i64_new(10,0),i=t;this.pos=48&&s<=57)r=i64_add(i64_mul(r,n),i64_new(s-48,0));else{if(95!=s)break;i==a&&this.error(i==t?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}this.pos=a+1}return this.pos==t?this.error(o.DiagnosticCode.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.readOctalInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0,0),n=i64_new(8,0),i=t;this.pos=48&&s<=55)r=i64_add(i64_mul(r,n),i64_new(s-48,0));else{if(95!=s)break;i==a&&this.error(i==t?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+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,0),n=i64_new(2,0),i=i64_new(1,0),a=t;this.pos=48&&n<=57)t=16*t+n-48;else if(n>=65&&n<=70)t=16*t+10+n-65;else{if(!(n>=97&&n<=102))return this.error(o.DiagnosticCode.Hexadecimal_digit_expected,this.range(this.pos-1,this.pos)),"";t=16*t+10+n-97}if(0==--e)break}return e?(this.error(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.source.text;return this.pos>=this.end?(this.error(o.DiagnosticCode.Unexpected_end_of_text,this.range(e,this.end)),n=!0):125==i.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)/1024|0),(r-65536)%1024+56320)},t.prototype.finish=function(){},t}(o.DiagnosticEmitter);t.Tokenizer=_;var d=function(){return function(){}}();t.State=d;var y=null},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),i=r(3);!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}),e.prototype.isManaged=function(e){if(e.hasGC){var t=this.classReference;return null!==t&&!t.hasDecorator(n.DecoratorFlags.UNMANAGED)}return!1},e.prototype.computeSmallIntegerShift=function(e){return e.size-this.size},e.prototype.computeSmallIntegerMask=function(e){var t=this.is(2)?this.size:this.size-1;return-1>>>e.size-t},e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.isAny=function(e){return 0!=(this.flags&e)},e.prototype.asClass=function(t){assert(9==this.kind&&!this.classReference);var r=new e(this.kind,-129&this.flags|256,this.size);return r.classReference=t,r},e.prototype.asFunction=function(t){assert(7==this.kind&&!this.signatureReference);var r=new e(this.kind,-129&this.flags|256,this.size);return r.signatureReference=t,r},e.prototype.asNullable=function(){return assert(this.is(256)),this.cachedNullableType||(assert(!this.is(512)),this.cachedNullableType=new e(this.kind,512|this.flags,this.size),this.cachedNullableType.nonNullableType=this,this.cachedNullableType.classReference=this.classReference,this.cachedNullableType.signatureReference=this.signatureReference),this.cachedNullableType},e.prototype.isAssignableTo=function(t,r){var n,i,a,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.commonCompatible=function(e,t,r){return t.isAssignableTo(e,r)?e:e.isAssignableTo(t,r)?t:null},e.prototype.toString=function(e){if(void 0===e&&(e=!1),!e&&this.is(256)){var t=this.classReference;if(t)return this.is(512)?t.toString()+" | null":t.toString();var r=this.signatureReference;if(r)return this.is(512)?"("+r.toString(!0)+") | null":r.toString(!0);assert(!1)}switch(this.kind){case 0:return"i8";case 1:return"i16";case 2:return"i32";case 3:return"i64";case 4:return"isize";case 5:return"u8";case 6:return"u16";case 7:return"u32";case 8:return"u64";case 9:return"usize";case 10:return"bool";case 11:return"f32";case 12:return"f64";case 13:return"v128";default:assert(!1);case 14:return"void"}},e.prototype.toNativeType=function(){switch(this.kind){default:return i.NativeType.I32;case 3:case 8:return i.NativeType.I64;case 4:case 9:return 64==this.size?i.NativeType.I64:i.NativeType.I32;case 11:return i.NativeType.F32;case 12:return i.NativeType.F64;case 13:return i.NativeType.V128;case 14:return i.NativeType.None}},e.prototype.toNativeZero=function(e){switch(this.kind){case 14:assert(!1);default:return e.createI32(0);case 4:case 9:if(64!=this.size)return e.createI32(0);case 3:case 8:return e.createI64(0);case 11:return e.createF32(0);case 12:return e.createF64(0);case 13:return e.createV128(a)}},e.prototype.toNativeOne=function(e){switch(this.kind){case 13:case 14:assert(!1);default:return e.createI32(1);case 4:case 9:if(64!=this.size)return e.createI32(1);case 3:case 8:return e.createI64(1);case 11:return e.createF32(1);case 12:return e.createF64(1)}},e.prototype.toNativeNegOne=function(e){switch(this.kind){case 13:case 14:assert(!1);default:return e.createI32(-1);case 4:case 9:if(64!=this.size)return e.createI32(-1);case 3:case 8:return e.createI64(-1,-1);case 11:return e.createF32(-1);case 12:return e.createF64(-1)}},e.prototype.toSignatureString=function(){switch(this.kind){default:return"i";case 3:case 8:return"I";case 4:case 9:return 64==this.size?"I":"i";case 11:return"f";case 12:return"F";case 13:return"v";case 14:return"_"}},e.i8=new e(0,165,8),e.i16=new e(1,165,16),e.i32=new e(2,133,32),e.i64=new e(3,197,64),e.isize32=new e(4,149,32),e.isize64=new e(4,213,64),e.u8=new e(5,166,8),e.u16=new e(6,166,16),e.u32=new e(7,134,32),e.u64=new e(8,198,64),e.usize32=new e(9,150,32),e.usize64=new e(9,214,64),e.bool=new e(10,166,1),e.f32=new e(11,137,32),e.f64=new e(12,201,64),e.v128=new e(13,1152,128),e.void=new e(14,0,0),e}();t.Type=s,t.typesToNativeTypes=function(e){for(var t=e.length,r=new Array(t),n=0;ne?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=c&&u!=p?t.push("?: "):t.push(": "),t.push(i[u].toString());return t.push(") => "),t.push(this.returnType.toString()),t.join("")},e}();t.Signature=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){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(23),l=r(2),p=r(3),u=r(1),h=r(5),_=r(6),d=r(4),y=r(7),m=r(0);!function(e){e[e.WASM32=0]="WASM32",e[e.WASM64=1]="WASM64"}(o=t.Target||(t.Target={}));var g=function(){function e(){this.target=o.WASM32,this.noTreeShaking=!1,this.noAssert=!1,this.importMemory=!1,this.importTable=!1,this.sourceMap=!1,this.memoryBase=0,this.globalAliases=null,this.features=0,this.optimizeLevelHint=0,this.shrinkLevelHint=0}return Object.defineProperty(e.prototype,"isWasm64",{get:function(){return this.target==o.WASM64},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usizeType",{get:function(){return this.target==o.WASM64?y.Type.usize64:y.Type.usize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isizeType",{get:function(){return this.target==o.WASM64?y.Type.isize64:y.Type.isize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nativeSizeType",{get:function(){return this.target==o.WASM64?p.NativeType.I64:p.NativeType.I32},enumerable:!0,configurable:!0}),e.prototype.hasFeature=function(e){return 0!=(this.features&e)},e}();t.Options=g,function(e){e[e.NONE=0]="NONE",e[e.SIGN_EXTENSION=1]="SIGN_EXTENSION",e[e.MUTABLE_GLOBAL=2]="MUTABLE_GLOBAL",e[e.BULK_MEMORY=4]="BULK_MEMORY",e[e.SIMD=8]="SIMD",e[e.THREADS=16]="THREADS"}(t.Feature||(t.Feature={})),function(e){e[e.NONE=0]="NONE",e[e.IMPLICIT=1]="IMPLICIT",e[e.EXPLICIT=2]="EXPLICIT"}(t.ConversionKind||(t.ConversionKind={})),function(e){e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP"}(t.WrapMode||(t.WrapMode={}));var T,E,f=function(e){function t(t,r){void 0===r&&(r=null);var n=e.call(this,t.diagnostics)||this;return n.currentInlineFunctions=[],n.currentEnum=null,n.currentType=y.Type.void,n.memorySegments=[],n.stringSegments=new Map,n.functionTable=["null"],n.argcVar=0,n.argcSet=0,n.needsIterateRoots=!1,n.f32ModInstance=null,n.f64ModInstance=null,n.f32PowInstance=null,n.f64PowInstance=null,n.program=t,n.resolver=t.resolver,r||(r=new g),n.options=r,n.memoryOffset=i64_new(max(r.memoryBase,8)),n.module=p.Module.create(),n}return i(t,e),t.compile=function(e,r){return void 0===r&&(r=null),new t(e,r).compile()},t.prototype.compile=function(){var e,t,r=this.options,n=this.module,i=this.program;i.initialize(r);var o=new h.Function(i.startFunction,"start",new y.Signature([],y.Type.void));this.startFunctionInstance=o;var l=new Array;this.startFunctionBody=l,this.currentFlow=o.flow,r.isWasm64?n.addGlobal("HEAP_BASE",p.NativeType.I64,!0,n.createI64(0,0)):n.addGlobal("HEAP_BASE",p.NativeType.I32,!1,n.createI32(0));for(var u=i.sources,_=0,d=u.length;_"),!1;e.type=this.currentType,e.set(u.CommonFlags.RESOLVED)}else assert(!1);if(e.is(u.CommonFlags.AMBIENT)&&e.hasDecorator(h.DecoratorFlags.BUILTIN))return!0;var a=e.type.toNativeType(),s=e.is(u.CommonFlags.CONST)||e.is(u.CommonFlags.STATIC|u.CommonFlags.READONLY);if(e.is(u.CommonFlags.AMBIENT))return s||this.options.hasFeature(2)?(e.set(u.CommonFlags.MODULE_IMPORT),r?I(e,r):(T="env",E=e.simpleName),t.addGlobalImport(e.internalName,T,E,a),e.set(u.CommonFlags.COMPILED),!0):(this.error(l.DiagnosticCode.Operation_not_supported,assert(r).range),!1);var o=!1;if(null!==r&&null!==r.initializer){if(n||(n=this.compileExpression(r.initializer,e.type,1,1)),p.getExpressionId(n)!=p.ExpressionId.Const&&(s?(n=t.precomputeExpression(n),p.getExpressionId(n)!=p.ExpressionId.Const&&(this.warning(l.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,r.range),o=!0)):o=!0),e.hasDecorator(h.DecoratorFlags.INLINE)&&!o){switch(assert(p.getExpressionId(n)==p.ExpressionId.Const),p.getExpressionType(n)){case p.NativeType.I32:e.constantValueKind=1,e.constantIntegerValue=i64_new(p.getConstValueI32(n),0);break;case p.NativeType.I64:e.constantValueKind=1,e.constantIntegerValue=i64_new(p.getConstValueI64Low(n),p.getConstValueI64High(n));break;case p.NativeType.F32:e.constantValueKind=2,e.constantFloatValue=p.getConstValueF32(n);break;case p.NativeType.F64:e.constantValueKind=2,e.constantFloatValue=p.getConstValueF64(n);break;default:return assert(!1),!1}e.set(u.CommonFlags.INLINED)}}else n=e.type.toNativeZero(t);var c=e.internalName;return o?(t.addGlobal(c,a,!0,e.type.toNativeZero(t)),this.startFunctionBody.push(t.createSetGlobal(c,n))):t.addGlobal(c,a,!s,n),!0},t.prototype.compileEnumDeclaration=function(e){var t=assert(this.program.elementsLookup.get(e.fileLevelInternalName));return assert(t.kind==h.ElementKind.ENUM),this.compileEnum(t)?t:null},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;if(e.members)try{for(var o=a(e.members.values()),c=o.next();!c.done;c=o.next()){var _=c.value;if(_.kind==h.ElementKind.ENUMVALUE){var d=!1,m=_,g=m.declaration;m.set(u.CommonFlags.COMPILED);var T=void 0;g.value?(T=this.compileExpression(g.value,y.Type.i32,1,0),p.getExpressionId(T)!=p.ExpressionId.Const&&(e.is(u.CommonFlags.CONST)?(T=n.precomputeExpression(T),p.getExpressionId(T)!=p.ExpressionId.Const&&(this.error(l.DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression,g.value.range),d=!0)):d=!0)):null==i?T=n.createI32(0):(s&&this.error(l.DiagnosticCode.Enum_member_must_have_initializer,g.range),T=n.createBinary(p.BinaryOp.AddI32,n.createGetGlobal(i.internalName,p.NativeType.I32),n.createI32(1)),T=n.precomputeExpression(T),p.getExpressionId(T)!=p.ExpressionId.Const&&(e.is(u.CommonFlags.CONST)&&this.error(l.DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression,g.range),d=!0)),d?(n.addGlobal(m.internalName,p.NativeType.I32,!0,n.createI32(0)),this.startFunctionBody.push(n.createSetGlobal(m.internalName,T)),s=!0):(n.addGlobal(m.internalName,p.NativeType.I32,!e.is(u.CommonFlags.CONST),T),s=!1),i=m}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return this.currentEnum=null,!0},t.prototype.compileFunctionDeclaration=function(e,t){var r=assert(this.program.elementsLookup.get(e.fileLevelInternalName));return assert(r.kind==h.ElementKind.FUNCTION_PROTOTYPE),this.compileFunctionUsingTypeArguments(r,t,m.makeMap(),null,r.declaration.name)},t.prototype.compileFunctionUsingTypeArguments=function(e,t,r,n,i){var a=this.resolver.resolveFunctionInclTypeArguments(e,t,r,i);return a?(a.outerScope=n,this.compileFunction(a)?a:null):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=0)return e.functionTableIndex;var t=this.functionTable,r=t.length;return!e.is(u.CommonFlags.TRAMPOLINE)&&e.signature.requiredParameters=0?"case"+u.toString(10):"break")+"|"+a);var d=t.createBlock("case0|"+a,c,p.NativeType.None),m=!0,g=!0,T=!0,E=!0;for(h=0;h=0&&(m&&i.set(1),g&&i.set(2),T&&i.set(4),E&&i.set(32)),d},t.prototype.compileThrowStatement=function(e){var t=this.currentFlow;return t.set(4),t.set(1),c.compileAbort(this,null,e)},t.prototype.compileTryStatement=function(e){return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},t.prototype.compileVariableStatement=function(e,t){void 0===t&&(t=!1);var r=this.program,n=e.declarations,i=n.length,a=this.currentFlow;if(t||a.parentFunction==this.startFunctionInstance&&e.parent&&e.parent.kind==d.NodeKind.SOURCE){for(var s=0;s");continue}g=this.currentType}var E=!1;if(_.is(u.CommonFlags.CONST))if(T)if(T=this.module.precomputeExpression(T),p.getExpressionId(T)==p.ExpressionId.Const){var f=new h.Local(r,m,-1,g);switch(p.getExpressionType(T)){case p.NativeType.I32:f=f.withConstantIntegerValue(i64_new(p.getConstValueI32(T),0));break;case p.NativeType.I64:f=f.withConstantIntegerValue(i64_new(p.getConstValueI64Low(T),p.getConstValueI64High(T)));break;case p.NativeType.F32:f=f.withConstantFloatValue(p.getConstValueF32(T));break;case p.NativeType.F64:f=f.withConstantFloatValue(p.getConstValueF64(T));break;default:return assert(!1),this.module.createUnreachable()}var I=a.scopedLocals;if(I){if(I.has(m))return this.error(l.DiagnosticCode.Duplicate_identifier_0,_.name.range,m),this.module.createUnreachable()}else a.scopedLocals=I=new Map;I.set(m,f),E=!0}else this.warning(l.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,_.range);else this.error(l.DiagnosticCode._const_declarations_must_be_initialized,_.range);if(!E){f=void 0;if(_.isAny(u.CommonFlags.LET|u.CommonFlags.CONST)||a.is(4096))f=a.addScopedLocal(m,g,!1,_.name);else{if(a.lookupLocal(m)){this.error(l.DiagnosticCode.Duplicate_identifier_0,_.name.range,m);continue}f=a.parentFunction.addLocal(g,m,_)}T?(o.push(this.compileAssignmentWithValue(_.name,T)),f.type.is(36)&&a.setLocalWrapped(f.index,!a.canOverflow(T,g))):f.type.is(36)&&a.setLocalWrapped(f.index,!0)}}return o.length?1==o.length?o[0]:this.module.createBlock(null,o,p.NativeType.None):0},t.prototype.compileVoidStatement=function(e){return this.compileExpression(e.expression,y.Type.void,2,0)},t.prototype.compileWhileStatement=function(e){var t=this.module,r=this.currentFlow,n=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,y.Type.bool,0),this.currentType);if(!this.options.noTreeShaking||r.actualFunction.isAny(u.CommonFlags.GENERIC|u.CommonFlags.GENERIC_CONTEXT)){var i=t.precomputeExpression(n);if(p.getExpressionId(i)==p.ExpressionId.Const&&p.getExpressionType(i)==p.NativeType.I32){if(!p.getConstValueI32(i))return t.createNop()}else n=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,y.Type.bool,0),this.currentType)}var a=r.pushBreakLabel(),s=r.fork();this.currentFlow=s;var o="break|"+a;s.breakLabel=o;var c="continue|"+a;s.continueLabel=c;var l=this.compileStatement(e.statement),h=s.isAny(29);return s.freeScopedLocals(),r.popBreakLabel(),this.currentFlow=r,s.unset(1560),r.inheritConditional(s),t.createBlock(o,[t.createLoop(c,t.createIf(n,h?l:t.createBlock(null,[l,t.createBreak(c)],p.NativeType.None)))])},t.prototype.compileInlineConstant=function(e,t,r){assert(e.is(u.CommonFlags.INLINED));var n=e.type;switch(!r&&n.is(4)&&t.is(4)&&n.size>i:0);case 5:case 6:case 10:var a=e.type.computeSmallIntegerMask(y.Type.i32);return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue)&a:0);case 2:case 7:return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue):0);case 4:case 9:if(!e.program.options.isWasm64)return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue):0);case 3:case 8:return 1==e.constantValueKind?this.module.createI64(i64_low(e.constantIntegerValue),i64_high(e.constantIntegerValue)):this.module.createI64(0);case 12:if(!e.hasDecorator(h.DecoratorFlags.BUILTIN)||t!=y.Type.f32)return this.module.createF64(e.constantFloatValue);this.currentType=y.Type.f32;case 11:return this.module.createF32(e.constantFloatValue);default:return assert(!1),this.module.createUnreachable()}},t.prototype.compileExpression=function(e,t,r,n){var i;switch(this.currentType=t,e.kind){case d.NodeKind.ASSERTION:i=this.compileAssertionExpression(e,t);break;case d.NodeKind.BINARY:i=this.compileBinaryExpression(e,t);break;case d.NodeKind.CALL:i=this.compileCallExpression(e,t);break;case d.NodeKind.COMMA:i=this.compileCommaExpression(e,t);break;case d.NodeKind.ELEMENTACCESS:i=this.compileElementAccessExpression(e,t);break;case d.NodeKind.FUNCTION:i=this.compileFunctionExpression(e,t);break;case d.NodeKind.IDENTIFIER:case d.NodeKind.FALSE:case d.NodeKind.NULL:case d.NodeKind.THIS:case d.NodeKind.SUPER:case d.NodeKind.TRUE:i=this.compileIdentifierExpression(e,t,0==r);break;case d.NodeKind.INSTANCEOF:i=this.compileInstanceOfExpression(e,t);break;case d.NodeKind.LITERAL:i=this.compileLiteralExpression(e,t);break;case d.NodeKind.NEW:i=this.compileNewExpression(e,t);break;case d.NodeKind.PARENTHESIZED:i=this.compileParenthesizedExpression(e,t);break;case d.NodeKind.PROPERTYACCESS:i=this.compilePropertyAccessExpression(e,t,0==r);break;case d.NodeKind.TERNARY:i=this.compileTernaryExpression(e,t);break;case d.NodeKind.UNARYPOSTFIX:i=this.compileUnaryPostfixExpression(e,t);break;case d.NodeKind.UNARYPREFIX:i=this.compileUnaryPrefixExpression(e,t);break;default:this.error(l.DiagnosticCode.Operation_not_supported,e.range),i=this.module.createUnreachable()}var a=this.currentType;return 0!=r&&a!=t?(i=this.convertExpression(i,a,t,r,n,e),this.currentType=t):1==n&&(i=this.ensureSmallIntegerWrap(i,a)),this.options.sourceMap&&this.addDebugLocation(i,e.range),i},t.prototype.compileExpressionRetainType=function(e,t,r){return this.compileExpression(e,t==y.Type.void?y.Type.i32:t,0,r)},t.prototype.precomputeExpression=function(e,t,r,n){return this.module.precomputeExpression(this.compileExpression(e,t,r,n))},t.prototype.convertExpression=function(e,t,r,n,i,a){assert(0!=n);var s=this.module;return 14==t.kind?(assert(14!=r.kind),this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,a.range,t.toString(),r.toString()),s.createUnreachable()):14==r.kind?s.createDrop(e):(t.isAssignableTo(r)||1==n&&this.error(l.DiagnosticCode.Conversion_from_type_0_to_1_requires_an_explicit_cast,a.range,t.toString(),r.toString()),t.is(8)?r.is(8)?11==t.kind?12==r.kind&&(e=s.createUnary(p.UnaryOp.PromoteF32,e)):11==r.kind&&(e=s.createUnary(p.UnaryOp.DemoteF64,e)):r.is(4)?11==t.kind?r==y.Type.bool?(e=s.createBinary(p.BinaryOp.NeF32,e,s.createF32(0)),i=0):e=r.is(1)?r.is(64)?s.createUnary(p.UnaryOp.TruncF32ToI64,e):s.createUnary(p.UnaryOp.TruncF32ToI32,e):r.is(64)?s.createUnary(p.UnaryOp.TruncF32ToU64,e):s.createUnary(p.UnaryOp.TruncF32ToU32,e):r==y.Type.bool?(e=s.createBinary(p.BinaryOp.NeF64,e,s.createF64(0)),i=0):e=r.is(1)?r.is(64)?s.createUnary(p.UnaryOp.TruncF64ToI64,e):s.createUnary(p.UnaryOp.TruncF64ToI32,e):r.is(64)?s.createUnary(p.UnaryOp.TruncF64ToU64,e):s.createUnary(p.UnaryOp.TruncF64ToU32,e):(assert(0==r.flags,"void type expected"),e=s.createDrop(e)):t.is(4)&&r.is(8)?e=11==r.kind?t.is(64)?s.createUnary(t.is(1)?p.UnaryOp.ConvertI64ToF32:p.UnaryOp.ConvertU64ToF32,e):s.createUnary(t.is(1)?p.UnaryOp.ConvertI32ToF32:p.UnaryOp.ConvertU32ToF32,e):t.is(64)?s.createUnary(t.is(1)?p.UnaryOp.ConvertI64ToF64:p.UnaryOp.ConvertU64ToF64,e):s.createUnary(t.is(1)?p.UnaryOp.ConvertI32ToF64:p.UnaryOp.ConvertU32ToF64,e):t.is(64)?r==y.Type.bool?(e=s.createBinary(p.BinaryOp.NeI64,e,s.createI64(0)),i=0):r.is(64)||(e=s.createUnary(p.UnaryOp.WrapI64,e)):r.is(64)?(e=s.createUnary(t.is(1)?p.UnaryOp.ExtendI32:p.UnaryOp.ExtendU32,this.ensureSmallIntegerWrap(e,t)),i=0):t.is(32)&&t.size",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=s,1,1,u),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.GtI32,r,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.GtI64:p.BinaryOp.GtI32,r,i);break;case 3:o=c.createBinary(p.BinaryOp.GtI64,r,i);break;case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.GtU32,r,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.GtU64:p.BinaryOp.GtU32,r,i);break;case 8:o=c.createBinary(p.BinaryOp.GtU64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.GtF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.GtF64,r,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=y.Type.bool;break;case _.Token.LESSTHAN_EQUALS:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.LE)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<=",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=s,1,1,u),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.LeI32,r,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.LeI64:p.BinaryOp.LeI32,r,i);break;case 3:o=c.createBinary(p.BinaryOp.LeI64,r,i);break;case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.LeU32,r,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.LeU64:p.BinaryOp.LeU32,r,i);break;case 8:o=c.createBinary(p.BinaryOp.LeU64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.LeF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.LeF64,r,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=y.Type.bool;break;case _.Token.GREATERTHAN_EQUALS:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.GE)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">=",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=s,1,1,u),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.GeI32,r,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.GeI64:p.BinaryOp.GeI32,r,i);break;case 3:o=c.createBinary(p.BinaryOp.GeI64,r,i);break;case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.GeU32,r,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.GeU64:p.BinaryOp.GeU32,r,i);break;case 8:o=c.createBinary(p.BinaryOp.GeU64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.GeF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.GeF64,r,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=y.Type.bool;break;case _.Token.EQUALS_EQUALS_EQUALS:case _.Token.EQUALS_EQUALS:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,g==_.Token.EQUALS_EQUALS&&this.currentType.is(256))if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.EQ)){o=this.compileBinaryOverload(v,u,r,d,e);break}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,_.operatorTokenToString(e.operator),n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=s,1,1,u),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.EqI32,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.EqI64:p.BinaryOp.EqI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.EqI64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.EqF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.EqF64,r,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=y.Type.bool;break;case _.Token.EXCLAMATION_EQUALS_EQUALS:case _.Token.EXCLAMATION_EQUALS:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,g==_.Token.EXCLAMATION_EQUALS&&this.currentType.is(256))if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.NE)){o=this.compileBinaryOverload(v,u,r,d,e);break}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,_.operatorTokenToString(e.operator),n.toString(),a.toString()),this.currentType=t,c.createUnreachable();switch(r=this.convertExpression(r,n,n=s,1,1,u),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.NeI32,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.NeI64:p.BinaryOp.NeI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.NeI64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.NeF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.NeF64,r,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=y.Type.bool;break;case _.Token.EQUALS:return this.compileAssignment(u,d,t);case _.Token.PLUS_EQUALS:m=!0;case _.Token.PLUS:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.ADD)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0);else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"+",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=s,1,0,u),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:o=c.createBinary(p.BinaryOp.AddI32,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.AddI64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.AddF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.AddF64,r,i);break;default:assert(!1),o=c.createUnreachable()}break;case _.Token.MINUS_EQUALS:m=!0;case _.Token.MINUS:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.SUB)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"-",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=s,1,0,u),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:o=c.createBinary(p.BinaryOp.SubI32,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.SubI64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.SubF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.SubF64,r,i);break;default:assert(!1),o=c.createUnreachable()}break;case _.Token.ASTERISK_EQUALS:m=!0;case _.Token.ASTERISK:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.MUL)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,1);else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"*",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=s,1,0,u),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:o=c.createBinary(p.BinaryOp.MulI32,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.MulI64:p.BinaryOp.MulI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.MulI64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.MulF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.MulF64,r,i);break;default:assert(!1),o=c.createUnreachable()}break;case _.Token.ASTERISK_ASTERISK_EQUALS:m=!0;case _.Token.ASTERISK_ASTERISK:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.POW)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}var T=void 0;if(11==this.currentType.kind){if(i=this.compileExpression(d,y.Type.f32,1,0),a=this.currentType,!(T=this.f32PowInstance)){if(!(E=this.program.elementsLookup.get("Mathf"))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf"),o=c.createUnreachable();break}if(!(f=E.members?E.members.get("pow"):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf.pow"),o=c.createUnreachable();break}assert(f.kind==h.ElementKind.FUNCTION_PROTOTYPE),this.f32PowInstance=T=this.resolver.resolveFunction(f,null)}}else if(r=this.convertExpression(r,this.currentType,y.Type.f64,1,0,u),n=this.currentType,i=this.compileExpression(d,y.Type.f64,1,0),a=this.currentType,!(T=this.f64PowInstance)){if(!(E=this.program.elementsLookup.get("Math"))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math"),o=c.createUnreachable();break}if(!(f=E.members?E.members.get("pow"):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math.pow"),o=c.createUnreachable();break}assert(f.kind==h.ElementKind.FUNCTION_PROTOTYPE),this.f64PowInstance=T=this.resolver.resolveFunction(f,null)}o=T&&this.compileFunction(T)?this.makeCallDirect(T,[r,i]):c.createUnreachable();break;case _.Token.SLASH_EQUALS:m=!0;case _.Token.SLASH:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.DIV)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,1),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"/",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=s,1,1,u),i=this.convertExpression(i,a,a=s,1,1,d)}switch(this.currentType.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.DivI32,r,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.DivI64:p.BinaryOp.DivI32,r,i);break;case 3:o=c.createBinary(p.BinaryOp.DivI64,r,i);break;case 5:case 6:case 10:case 7:o=c.createBinary(p.BinaryOp.DivU32,r,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.DivU64:p.BinaryOp.DivU32,r,i);break;case 8:o=c.createBinary(p.BinaryOp.DivU64,r,i);break;case 11:o=c.createBinary(p.BinaryOp.DivF32,r,i);break;case 12:o=c.createBinary(p.BinaryOp.DivF64,r,i);break;default:assert(!1),o=c.createUnreachable()}break;case _.Token.PERCENT_EQUALS:m=!0;case _.Token.PERCENT:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.REM)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,1),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"%",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=s,1,1,u),i=this.convertExpression(i,a,a=s,1,1,d)}switch(this.currentType.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.RemI32,r,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.RemI64:p.BinaryOp.RemI32,r,i);break;case 3:o=c.createBinary(p.BinaryOp.RemI64,r,i);break;case 5:case 6:case 10:case 7:o=c.createBinary(p.BinaryOp.RemU32,r,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.RemU64:p.BinaryOp.RemU32,r,i);break;case 8:o=c.createBinary(p.BinaryOp.RemU64,r,i);break;case 11:if(!(T=this.f32ModInstance)){if(!(E=this.program.elementsLookup.get("Mathf"))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf"),o=c.createUnreachable();break}if(!(f=E.members?E.members.get("mod"):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf.mod"),o=c.createUnreachable();break}assert(f.kind==h.ElementKind.FUNCTION_PROTOTYPE),this.f32ModInstance=T=this.resolver.resolveFunction(f,null)}o=T&&this.compileFunction(T)?this.makeCallDirect(T,[r,i]):c.createUnreachable();break;case 12:if(!(T=this.f64ModInstance)){var E,f;if(!(E=this.program.elementsLookup.get("Math"))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math"),o=c.createUnreachable();break}if(!(f=E.members?E.members.get("mod"):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math.mod"),o=c.createUnreachable();break}assert(f.kind==h.ElementKind.FUNCTION_PROTOTYPE),this.f64ModInstance=T=this.resolver.resolveFunction(f,null)}o=T&&this.compileFunction(T)?this.makeCallDirect(T,[r,i]):c.createUnreachable();break;default:assert(!1),o=c.createUnreachable()}break;case _.Token.LESSTHAN_LESSTHAN_EQUALS:m=!0;case _.Token.LESSTHAN_LESSTHAN:if(r=this.compileExpressionRetainType(u,t.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.BITWISE_SHL)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(i=this.compileExpression(d,n,1,0),a=this.currentType,this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:o=c.createBinary(p.BinaryOp.ShlI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.ShlI64,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.ShlI64:p.BinaryOp.ShlI32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,_.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case _.Token.GREATERTHAN_GREATERTHAN_EQUALS:m=!0;case _.Token.GREATERTHAN_GREATERTHAN:if(r=this.compileExpressionRetainType(u,t.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.BITWISE_SHR)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,1),a=this.currentType,this.currentType.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.ShrI32,r,i);break;case 3:o=c.createBinary(p.BinaryOp.ShrI64,r,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrI64:p.BinaryOp.ShrI32,r,i);break;case 5:case 6:case 10:case 7:o=c.createBinary(p.BinaryOp.ShrU32,r,i);break;case 8:o=c.createBinary(p.BinaryOp.ShrU64,r,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrU64:p.BinaryOp.ShrU32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,_.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case _.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:m=!0;case _.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:if(r=this.compileExpressionRetainType(u,t.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.BITWISE_SHR_U)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(r=this.ensureSmallIntegerWrap(r,n),i=this.compileExpression(d,n,1,0),a=this.currentType,this.currentType.kind){case 5:case 6:case 10:o=c.createBinary(p.BinaryOp.ShrU32,r,i);case 0:case 1:case 2:case 7:o=c.createBinary(p.BinaryOp.ShrU32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.ShrU64,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrU64:p.BinaryOp.ShrU32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,_.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case _.Token.AMPERSAND_EQUALS:m=!0;case _.Token.AMPERSAND:if(r=this.compileExpressionRetainType(u,t.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.BITWISE_AND)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"&",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=s,1,0,u),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 10:case 7:o=c.createBinary(p.BinaryOp.AndI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.AndI64,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.AndI64:p.BinaryOp.AndI32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,_.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case _.Token.BAR_EQUALS:m=!0;case _.Token.BAR:if(r=this.compileExpressionRetainType(u,t.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.BITWISE_OR)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"|",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=s,1,0,u),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:o=c.createBinary(p.BinaryOp.OrI32,r,i);break;case 2:case 7:o=c.createBinary(p.BinaryOp.OrI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.OrI64,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.OrI64:p.BinaryOp.OrI32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,_.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case _.Token.CARET_EQUALS:m=!0;case _.Token.CARET:if(r=this.compileExpressionRetainType(u,t.intType,0),n=this.currentType,this.currentType.is(256)){var I,v;if(I=n.classReference)if(v=I.lookupOverload(h.OperatorKind.BITWISE_XOR)){o=this.compileBinaryOverload(v,u,r,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=y.Type.commonCompatible(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"^",n.toString(),a.toString()),this.currentType=t,c.createUnreachable();r=this.convertExpression(r,n,n=s,1,0,u),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:o=c.createBinary(p.BinaryOp.XorI32,r,i);break;case 2:case 7:o=c.createBinary(p.BinaryOp.XorI32,r,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.XorI64,r,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.XorI64:p.BinaryOp.XorI32,r,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,_.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case _.Token.AMPERSAND_AMPERSAND:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,i=this.compileExpression(d,n,1,0),a=this.currentType,o=c.cloneExpression(r,!0,0))this.makeIsTrueish(r,this.currentType),o=c.createIf(this.makeIsTrueish(r,this.currentType),i,o);else{var A=(C=this.currentFlow).getAndFreeTempLocal(this.currentType,!C.canOverflow(r,this.currentType));o=c.createIf(this.makeIsTrueish(c.createTeeLocal(A.index,r),this.currentType),i,c.createGetLocal(assert(A).index,this.currentType.toNativeType()))}break;case _.Token.BAR_BAR:if(r=this.compileExpressionRetainType(u,t,0),n=this.currentType,i=this.compileExpression(d,n,1,0),a=this.currentType,o=this.module.cloneExpression(r,!0,0))o=this.module.createIf(this.makeIsTrueish(r,this.currentType),o,i);else{var C;A=(C=this.currentFlow).getAndFreeTempLocal(this.currentType,!C.canOverflow(r,this.currentType));o=c.createIf(this.makeIsTrueish(c.createTeeLocal(A.index,r),this.currentType),c.createGetLocal(assert(A).index,this.currentType.toNativeType()),i)}break;default:assert(!1),o=this.module.createUnreachable()}return m?this.compileAssignmentWithValue(u,o,t!=y.Type.void):o},t.prototype.compileUnaryOverload=function(e,t,r,n){var i,a=0;return e.is(u.CommonFlags.INSTANCE)?(a=r,i=[]):i=[t],this.compileCallDirect(e,i,n,a)},t.prototype.compileBinaryOverload=function(e,t,r,n,i){var a,s=0;if(e.is(u.CommonFlags.INSTANCE)){var o=assert(e.parent);assert(o.kind==h.ElementKind.CLASS),s=r,a=[n]}else a=[t,n];return this.compileCallDirect(e,a,i,s)},t.prototype.compileAssignment=function(e,t,r){var n,i=this.program.resolver,a=this.currentFlow,s=i.resolveExpression(e,a);if(!s)return this.module.createUnreachable();switch(s.kind){case h.ElementKind.GLOBAL:if(!this.compileGlobal(s))return this.module.createUnreachable();assert(s.type!=y.Type.void);case h.ElementKind.LOCAL:case h.ElementKind.FIELD:n=s.type;break;case h.ElementKind.PROPERTY:var o=s.setterPrototype;if(o){var c=this.resolver.resolveFunction(o,null);if(!c)return this.module.createUnreachable();assert(1==c.signature.parameterTypes.length),n=c.signature.parameterTypes[0];break}return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,s.internalName),this.module.createUnreachable();case h.ElementKind.CLASS:if(i.currentElementExpression){var p=a.is(8192),u=s.lookupOverload(h.OperatorKind.INDEXED_SET,p);if(!u)return s.lookupOverload(h.OperatorKind.INDEXED_GET,p)?this.error(l.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,e.range,s.internalName):this.error(l.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,s.internalName),this.module.createUnreachable();assert(2==u.signature.parameterTypes.length),n=u.signature.parameterTypes[1];break}default:return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}assert(n!=y.Type.void);var _=this.compileExpression(t,n,1,0);return this.compileAssignmentWithValue(e,_,r!=y.Type.void)},t.prototype.compileAssignmentWithValue=function(e,t,r){void 0===r&&(r=!1);var n=this.module,i=this.currentFlow,a=this.resolver.resolveExpression(e,i);if(!a)return n.createUnreachable();switch(a.kind){case h.ElementKind.LOCAL:var s=a.type;return assert(s!=y.Type.void),this.currentType=r?s:y.Type.void,a.is(u.CommonFlags.CONST)?(this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable()):(s.is(36)&&i.setLocalWrapped(a.index,!i.canOverflow(t,s)),r?n.createTeeLocal(a.index,t):n.createSetLocal(a.index,t));case h.ElementKind.GLOBAL:if(!this.compileGlobal(a))return n.createUnreachable();s=a.type;if(assert(s!=y.Type.void),this.currentType=r?s:y.Type.void,a.is(u.CommonFlags.CONST))return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();if(t=this.ensureSmallIntegerWrap(t,s),r){var o=s.toNativeType(),c=a.internalName;return n.createBlock(null,[n.createSetGlobal(c,t),n.createGetGlobal(c,o)],o)}return n.createSetGlobal(a.internalName,t);case h.ElementKind.FIELD:var p=a.declaration;if(a.is(u.CommonFlags.READONLY)&&!i.actualFunction.is(u.CommonFlags.CONSTRUCTOR)&&null!=p&&null==p.initializer)return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();var _=assert(this.resolver.currentThisExpression),d=this.compileExpressionRetainType(_,this.options.usizeType,0);s=a.type;this.currentType=r?s:y.Type.void;o=s.toNativeType();if(10==s.kind&&(t=this.ensureSmallIntegerWrap(t,s)),r){var m=this.currentFlow,g=m.getAndFreeTempLocal(s,!m.canOverflow(t,s)).index;return n.createBlock(null,[n.createSetLocal(g,t),n.createStore(s.byteSize,d,n.createGetLocal(g,o),o,a.memoryOffset),n.createGetLocal(g,o)],o)}return n.createStore(s.byteSize,d,t,o,a.memoryOffset);case h.ElementKind.PROPERTY:var T=a.setterPrototype;if(T){var E=this.resolver.resolveFunction(T,null);if(!E)return n.createUnreachable();if(!r){if(E.is(u.CommonFlags.INSTANCE)){_=assert(this.resolver.currentThisExpression),d=this.compileExpressionRetainType(_,this.options.usizeType,0);return this.makeCallDirect(E,[d,t])}return this.makeCallDirect(E,[t])}var f=a.getterPrototype;assert(null!=f);var I=this.resolver.resolveFunction(f,null);if(!I)return n.createUnreachable();var v=(k=I.signature.returnType).toNativeType();if(E.is(u.CommonFlags.INSTANCE)){_=assert(this.resolver.currentThisExpression),d=this.compileExpressionRetainType(_,this.options.usizeType,0),g=i.getAndFreeTempLocal(k,!1).index;return n.createBlock(null,[this.makeCallDirect(E,[n.createTeeLocal(g,d),t]),this.makeCallDirect(I,[n.createGetLocal(g,v)])],v)}return n.createBlock(null,[this.makeCallDirect(E,[t]),this.makeCallDirect(I)],v)}return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();case h.ElementKind.CLASS:var A=this.resolver.currentElementExpression;if(A){var C=i.is(8192),S=a.lookupOverload(h.OperatorKind.INDEXED_GET,C);if(!S)return this.error(l.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,a.internalName),n.createUnreachable();var N=a.lookupOverload(h.OperatorKind.INDEXED_SET,C);if(!N)return this.error(l.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,e.range,a.internalName),this.currentType=r?S.signature.returnType:y.Type.void,n.createUnreachable();var O=a.type,x=(_=assert(this.resolver.currentThisExpression),d=this.compileExpressionRetainType(_,this.options.usizeType,0),this.compileExpression(A,y.Type.i32,1,0));if(r){var b=i.getTempLocal(O,!1),L=i.getAndFreeTempLocal(this.currentType,!1),k=S.signature.returnType;return i.freeTempLocal(b),n.createBlock(null,[this.makeCallDirect(N,[n.createTeeLocal(b.index,d),n.createTeeLocal(L.index,x),t]),this.makeCallDirect(S,[n.createGetLocal(b.index,b.type.toNativeType()),n.createGetLocal(L.index,L.type.toNativeType())])],k.toNativeType())}return this.makeCallDirect(N,[d,x,t])}}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()},t.prototype.compileCallExpression=function(e,t){var r=this.module,n=this.currentFlow;if(e.expression.kind==d.NodeKind.SUPER){var i=this.currentFlow,a=i.actualFunction;if(!a.is(u.CommonFlags.CONSTRUCTOR))return this.error(l.DiagnosticCode.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors,e.range),r.createUnreachable();var s=assert(a.parent);assert(s.kind==h.ElementKind.CLASS);var o=assert(s.base),c=assert(i.lookupLocal("this")),_=this.options.nativeSizeType,g=[r.createSetLocal(c.index,this.compileCallDirect(this.ensureConstructor(o,e),e.arguments,e,r.createIf(r.createGetLocal(c.index,_),r.createGetLocal(c.index,_),this.makeAllocation(s))))];return this.makeFieldInitialization(s,g),i.isAny(2080)?(this.error(l.DiagnosticCode._super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class,e.range),r.createUnreachable()):(i.set(96),this.currentType=y.Type.void,r.createBlock(null,g))}var T,E,f=this.resolver.resolveExpression(e.expression,n);if(!f)return r.createUnreachable();switch(f.kind){case h.ElementKind.FUNCTION_PROTOTYPE:var I=f,v=e.typeArguments;if(I.hasDecorator(h.DecoratorFlags.BUILTIN))return this.compileCallExpressionBuiltin(I,e,t);var A=null;if(v){if(!I.is(u.CommonFlags.GENERIC))return this.error(l.DiagnosticCode.Type_0_is_not_generic,e.expression.range,I.internalName),r.createUnreachable();A=this.resolver.resolveFunctionInclTypeArguments(I,v,m.makeMap(n.contextualTypeArguments),e)}else{if(I.is(u.CommonFlags.GENERIC)){for(var C=new Map,S=assert(I.declaration.typeParameters),N=S.length,O=0;Os&&!i)||(this.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,s.toString(),t.toString()),!1)},t.prototype.compileCallDirect=function(e,t,r,n){void 0===n&&(n=0);var i=t.length,a=e.signature;if(!this.checkCallSignature(a,i,0!=n,r))return this.module.createUnreachable();if(e.hasDecorator(h.DecoratorFlags.INLINE)){if(assert(!e.is(u.CommonFlags.TRAMPOLINE)),!this.currentInlineFunctions.includes(e)){this.currentInlineFunctions.push(e);var s=this.compileCallInlinePrechecked(e,t,n);return this.currentInlineFunctions.pop(),s}this.warning(l.DiagnosticCode.Function_0_cannot_be_inlined_into_itself,r.range,e.internalName)}var o=n?i+1:i,c=new Array(o),p=0;n&&(c[0]=n,p=1);for(var _=a.parameterTypes,d=0;d=i);var o=this.module;if(!this.compileFunction(e))return o.createUnreachable();var c=e.signature.returnType,l=e.is(u.CommonFlags.MODULE_IMPORT);if(r=a),this.ensureFunctionType(e.parameterTypes,e.returnType,e.thisType);var c=this.module;if(n=0),this.currentType=N,this.module.createGetLocal(O,N.toNativeType());case h.ElementKind.GLOBAL:if(!this.compileGlobal(S))return this.module.createUnreachable();var x=S.type;return assert(x!=y.Type.void),S.is(u.CommonFlags.INLINED)?this.compileInlineConstant(S,t,r):(this.currentType=x,this.module.createGetGlobal(S.internalName,x.toNativeType()));case h.ElementKind.ENUMVALUE:return S.is(u.CommonFlags.COMPILED)?(this.currentType=y.Type.i32,S.is(u.CommonFlags.INLINED)?this.module.createI32(S.constantValue):this.module.createGetGlobal(S.internalName,p.NativeType.I32)):(this.error(l.DiagnosticCode.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums,e.range),this.currentType=y.Type.i32,this.module.createUnreachable());case h.ElementKind.FUNCTION_PROTOTYPE:var b=this.resolver.resolveFunction(S,null,m.makeMap(i.contextualTypeArguments));if(!b||!this.compileFunction(b))return n.createUnreachable();var L=this.ensureFunctionTableEntry(b);return this.currentType=b.signature.type,this.module.createI32(L)}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},t.prototype.compileInstanceOfExpression=function(e,t){var r=this.module,n=this.compileExpressionRetainType(e.expression,this.options.usizeType,0),i=this.currentType,a=this.resolver.resolveType(e.isType);return this.currentType=y.Type.bool,a?i.is(512)&&!a.is(512)?i.nonNullableType.isAssignableTo(a)?r.createBinary(i.is(64)?p.BinaryOp.NeI64:p.BinaryOp.NeI32,n,i.toNativeZero(r)):r.createI32(0):r.createI32(i.isAssignableTo(a,!0)?1:0):r.createUnreachable()},t.prototype.compileLiteralExpression=function(e,t,r){void 0===r&&(r=!1);var n=this.module;switch(e.literalKind){case d.LiteralKind.ARRAY:assert(!r);var i=t.classReference;return i&&i.prototype==this.program.arrayPrototype?this.compileArrayLiteral(assert(i.typeArguments)[0],e.elementExpressions,!1,e):(this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable());case d.LiteralKind.FLOAT:var a=e.value;return r&&(a=-a),t==y.Type.f32?n.createF32(a):(this.currentType=y.Type.f64,n.createF64(a));case d.LiteralKind.INTEGER:var s=e.value;r&&(s=i64_sub(i64_new(0),s));var o=this.resolver.determineIntegerLiteralType(s,t);switch(this.currentType=o,o.kind){case 4:if(!this.options.isWasm64)return n.createI32(i64_low(s));case 3:return n.createI64(i64_low(s),i64_high(s));case 9:if(!this.options.isWasm64)return n.createI32(i64_low(s));case 8:return n.createI64(i64_low(s),i64_high(s));case 11:return n.createF32(i64_to_f32(s));case 12:return n.createF64(i64_to_f64(s));default:return n.createI32(i64_low(s))}case d.LiteralKind.STRING:return assert(!r),this.compileStringLiteral(e);case d.LiteralKind.OBJECT:return assert(!r),this.compileObjectLiteral(e,t)}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.currentType=t,n.createUnreachable()},t.prototype.ensureStaticString=function(e){var t,r=this.program,n=r.hasGC,i=r.gcHeaderSize,a=assert(r.stringInstance),s=this.stringSegments;if(s.has(e))t=s.get(e);else{var o=e.length,l=a.currentMemoryOffset+1&-2,p=l+2*o,u=void 0,h=void 0;n?(u=new Uint8Array(i+p),h=i,m.writeI32(c.ensureGCHook(this,a),u,r.gcHookOffset)):(u=new Uint8Array(p),h=0),m.writeI32(o,u,h+a.offsetof("length")),h+=l;for(var _=0;_",t.toString()),r.createUnreachable();var i=n.constructorInstance;if(i){if(i.signature.requiredParameters)return this.error(l.DiagnosticCode.Constructor_of_class_0_must_not_require_any_arguments,e.range,n.toString()),r.createUnreachable();if(i.is(u.CommonFlags.PRIVATE))return this.error(l.DiagnosticCode.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration,e.range,n.toString()),r.createUnreachable();if(i.is(u.CommonFlags.PROTECTED))return this.error(l.DiagnosticCode.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration,e.range,n.toString()),r.createUnreachable()}var a=e.names,s=a.length,o=e.values,c=n.members,p=!1,_=new Array(s+2),d=this.currentFlow.getTempLocal(this.options.usizeType);assert(s==o.length);for(var y=0,m=s;yv)for(T=v;T=0);var _=this.compileExpressionRetainType(c,this.options.usizeType,0);return this.currentType=a.type,n.createLoad(a.type.byteSize,a.type.is(5),_,a.type.toNativeType(),a.memoryOffset);case h.ElementKind.PROPERTY:return this.compileGetter(a,e);case h.ElementKind.FUNCTION_PROTOTYPE:return this.error(l.DiagnosticCode.Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set,e.range,a.simpleName),n.createUnreachable()}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()},t.prototype.compileGetter=function(e,t){var r=e.getterPrototype;if(r){var n=this.resolver.resolveFunction(r,null);if(!n)return this.module.createUnreachable();var i=n.signature;if(!this.checkCallSignature(i,0,n.is(u.CommonFlags.INSTANCE),t))return this.module.createUnreachable();if(n.is(u.CommonFlags.INSTANCE)){var a=assert(n.parent);assert(a.kind==h.ElementKind.CLASS);var s=assert(this.resolver.currentThisExpression),o=this.compileExpressionRetainType(s,this.options.usizeType,0);//!!! return this.currentType=i.returnType,this.compileCallDirect(n,[],t,o)}return this.currentType=i.returnType,this.compileCallDirect(n,[],t,0)}return this.error(l.DiagnosticCode.Property_0_does_not_exist_on_type_1,t.range,e.simpleName,e.parent.toString()),this.module.createUnreachable()},t.prototype.compileTernaryExpression=function(e,t){var r=e.ifThen,n=e.ifElse,i=this.currentFlow,a=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,y.Type.bool,0),this.currentType);if(!this.options.noTreeShaking||i.actualFunction.isAny(u.CommonFlags.GENERIC|u.CommonFlags.GENERIC_CONTEXT)){var s=this.module.precomputeExpression(a);if(p.getExpressionId(s)==p.ExpressionId.Const&&p.getExpressionType(s)==p.NativeType.I32)return p.getConstValueI32(s)?this.compileExpressionRetainType(r,t,0):this.compileExpressionRetainType(n,t,0);a=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,y.Type.bool,0),this.currentType)}var o=i.fork();this.currentFlow=o;var c=this.compileExpressionRetainType(r,t,0),h=this.currentType;o.freeScopedLocals();var _=i.fork();this.currentFlow=_;var d=this.compileExpressionRetainType(n,t,0),m=this.currentType;_.freeScopedLocals(),this.currentFlow=i,i.inheritMutual(o,_);var g=y.Type.commonCompatible(h,m,!1);return g?(c=this.convertExpression(c,h,g,1,0,r),d=this.convertExpression(d,m,g,1,0,n),this.currentType=g,this.module.createIf(a,c,d)):(this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,h.toString(),m.toString()),this.currentType=t,this.module.createUnreachable())},t.prototype.compileUnaryPostfixExpression=function(e,t){var r=this.module,n=this.currentFlow,i=this.compileExpression(e.operand,t==y.Type.void?y.Type.i32:t,0,0);if(p.getExpressionId(i)==p.ExpressionId.Unreachable)return i;var a,s=this.currentType,o=null;switch(t!=y.Type.void&&(o=n.getTempLocal(s,!1),i=r.createTeeLocal(o.index,i)),e.operator){case _.Token.PLUS_PLUS:switch(s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:a=r.createBinary(p.BinaryOp.AddI32,i,r.createI32(1));break;case 9:if(this.currentType.is(256)){if(u=this.currentType.classReference)if(d=u.lookupOverload(h.OperatorKind.POSTFIX_INC)){a=this.compileUnaryOverload(d,e.operand,i,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),r.createUnreachable()}case 4:var c=this.options;a=r.createBinary(c.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,i,s.toNativeOne(r));break;case 3:case 8:a=r.createBinary(p.BinaryOp.AddI64,i,r.createI64(1));break;case 11:a=r.createBinary(p.BinaryOp.AddF32,i,r.createF32(1));break;case 12:a=r.createBinary(p.BinaryOp.AddF64,i,r.createF64(1));break;default:return assert(!1),r.createUnreachable()}break;case _.Token.MINUS_MINUS:switch(s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:a=r.createBinary(p.BinaryOp.SubI32,i,r.createI32(1));break;case 9:if(this.currentType.is(256)){var u,d;if(u=this.currentType.classReference)if(d=u.lookupOverload(h.OperatorKind.POSTFIX_DEC)){a=this.compileUnaryOverload(d,e.operand,i,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),r.createUnreachable()}case 4:c=this.options;a=r.createBinary(c.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,i,s.toNativeOne(r));break;case 3:case 8:a=r.createBinary(p.BinaryOp.SubI64,i,r.createI64(1));break;case 11:a=r.createBinary(p.BinaryOp.SubF32,i,r.createF32(1));break;case 12:a=r.createBinary(p.BinaryOp.SubF64,i,r.createF64(1));break;default:return assert(!1),r.createUnreachable()}break;default:return assert(!1),r.createUnreachable()}if(!o)return this.currentType=y.Type.void,this.compileAssignmentWithValue(e.operand,a,!1);var m=this.compileAssignmentWithValue(e.operand,a,!1);this.currentType=o.type,n.freeTempLocal(o);var g=o.type.toNativeType();return r.createBlock(null,[m,r.createGetLocal(o.index,g)],g)},t.prototype.compileUnaryPrefixExpression=function(e,t){var r,n=this.module,i=!1;switch(e.operator){case _.Token.PLUS:if(r=this.compileExpression(e.operand,t==y.Type.void?y.Type.i32:t,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(s=a.lookupOverload(h.OperatorKind.PLUS)){r=this.compileUnaryOverload(s,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}break;case _.Token.MINUS:if(e.operand.kind==d.NodeKind.LITERAL&&(e.operand.literalKind==d.LiteralKind.INTEGER||e.operand.literalKind==d.LiteralKind.FLOAT)){r=this.compileLiteralExpression(e.operand,t,!0),this.options.sourceMap&&this.addDebugLocation(r,e.range);break}if(r=this.compileExpression(e.operand,t==y.Type.void?y.Type.i32:t,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(s=a.lookupOverload(h.OperatorKind.MINUS)){r=this.compileUnaryOverload(s,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:r=n.createBinary(p.BinaryOp.SubI32,n.createI32(0),r);break;case 9:case 4:r=n.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,this.currentType.toNativeZero(n),r);break;case 3:case 8:r=n.createBinary(p.BinaryOp.SubI64,n.createI64(0),r);break;case 11:r=n.createUnary(p.UnaryOp.NegF32,r);break;case 12:r=n.createUnary(p.UnaryOp.NegF64,r);break;default:assert(!1),r=n.createUnreachable()}break;case _.Token.PLUS_PLUS:if(i=!0,r=this.compileExpression(e.operand,t==y.Type.void?y.Type.i32:t,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(s=a.lookupOverload(h.OperatorKind.PREFIX_INC)){r=this.compileUnaryOverload(s,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:r=n.createBinary(p.BinaryOp.AddI32,r,this.module.createI32(1));break;case 9:case 4:r=n.createBinary(this.options.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,r,this.currentType.toNativeOne(n));break;case 3:case 8:r=n.createBinary(p.BinaryOp.AddI64,r,n.createI64(1));break;case 11:r=n.createBinary(p.BinaryOp.AddF32,r,n.createF32(1));break;case 12:r=n.createBinary(p.BinaryOp.AddF64,r,n.createF64(1));break;default:assert(!1),r=n.createUnreachable()}break;case _.Token.MINUS_MINUS:if(i=!0,r=this.compileExpression(e.operand,t==y.Type.void?y.Type.i32:t,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(s=a.lookupOverload(h.OperatorKind.PREFIX_DEC)){r=this.compileUnaryOverload(s,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:r=n.createBinary(p.BinaryOp.SubI32,r,n.createI32(1));break;case 9:case 4:r=n.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,r,this.currentType.toNativeOne(n));break;case 3:case 8:r=n.createBinary(p.BinaryOp.SubI64,r,n.createI64(1));break;case 11:r=n.createBinary(p.BinaryOp.SubF32,r,n.createF32(1));break;case 12:r=n.createBinary(p.BinaryOp.SubF64,r,n.createF64(1));break;default:assert(!1),r=n.createUnreachable()}break;case _.Token.EXCLAMATION:if(r=this.compileExpression(e.operand,t==y.Type.void?y.Type.i32:t,0,0),this.currentType.is(256))if(a=this.currentType.classReference)if(s=a.lookupOverload(h.OperatorKind.NOT)){r=this.compileUnaryOverload(s,e.operand,r,e);break}r=this.makeIsFalseish(r,this.currentType),this.currentType=y.Type.bool;break;case _.Token.TILDE:if(r=this.compileExpression(e.operand,t==y.Type.void?y.Type.i32:t.is(8)?y.Type.i64:t,0,0),this.currentType.is(256)){var a,s;if(a=this.currentType.classReference)if(s=a.lookupOverload(h.OperatorKind.BITWISE_NOT)){r=this.compileUnaryOverload(s,e.operand,r,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(r=this.convertExpression(r,this.currentType,this.currentType.intType,1,0,e.operand),this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:r=n.createBinary(p.BinaryOp.XorI32,r,n.createI32(-1));break;case 9:case 4:r=n.createBinary(this.options.isWasm64?p.BinaryOp.XorI64:p.BinaryOp.XorI32,r,this.currentType.toNativeNegOne(n));break;case 3:case 8:r=n.createBinary(p.BinaryOp.XorI64,r,n.createI64(-1,-1));break;default:assert(!1),r=n.createUnreachable()}break;case _.Token.TYPEOF:return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable();default:return assert(!1),n.createUnreachable()}return i?this.compileAssignmentWithValue(e.operand,r,t!=y.Type.void):r},t.prototype.ensureSmallIntegerWrap=function(e,t){var r=this.module,n=this.currentFlow;switch(t.kind){case 0:n.canOverflow(e,t)&&(e=this.options.hasFeature(1)?r.createUnary(p.UnaryOp.ExtendI8ToI32,e):r.createBinary(p.BinaryOp.ShrI32,r.createBinary(p.BinaryOp.ShlI32,e,r.createI32(24)),r.createI32(24)));break;case 1:n.canOverflow(e,t)&&(e=this.options.hasFeature(1)?r.createUnary(p.UnaryOp.ExtendI16ToI32,e):r.createBinary(p.BinaryOp.ShrI32,r.createBinary(p.BinaryOp.ShlI32,e,r.createI32(16)),r.createI32(16)));break;case 5:n.canOverflow(e,t)&&(e=r.createBinary(p.BinaryOp.AndI32,e,r.createI32(255)));break;case 6:n.canOverflow(e,t)&&(e=r.createBinary(p.BinaryOp.AndI32,e,r.createI32(65535)));break;case 10:n.canOverflow(e,t)&&(e=r.createBinary(p.BinaryOp.NeI32,e,r.createI32(0)))}return e},t.prototype.makeIsFalseish=function(e,t){var r=this.module;switch(t.kind){case 0:case 1:case 5:case 6:case 10:e=this.ensureSmallIntegerWrap(e,t);case 2:case 7:return r.createUnary(p.UnaryOp.EqzI32,e);case 3:case 8:return r.createUnary(p.UnaryOp.EqzI64,e);case 9:case 4:return r.createUnary(64==t.size?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,e);case 11:return r.createBinary(p.BinaryOp.EqF32,e,r.createF32(0));case 12:return r.createBinary(p.BinaryOp.EqF64,e,r.createF64(0));default:return assert(!1),r.createI32(1)}},t.prototype.makeIsTrueish=function(e,t){var r=this.module;switch(t.kind){case 0:case 1:case 5:case 6:case 10:e=this.ensureSmallIntegerWrap(e,t);case 2:case 7:return e;case 3:case 8:return r.createBinary(p.BinaryOp.NeI64,e,r.createI64(0));case 9:case 4:return 64==t.size?r.createBinary(p.BinaryOp.NeI64,e,r.createI64(0)):e;case 11:return r.createBinary(p.BinaryOp.NeF32,e,r.createF32(0));case 12:return r.createBinary(p.BinaryOp.NeF64,e,r.createF64(0));default:return assert(!1),r.createI32(0)}},t.prototype.makeAllocation=function(e){var t=this.program;assert(e.program==t);var r=this.module,n=this.options;if(t.hasGC&&e.type.isManaged(t)){var i=assert(t.gcAllocateInstance);return this.compileFunction(i)?(this.currentType=e.type,r.createCall(i.internalName,[n.isWasm64?r.createI64(e.currentMemoryOffset):r.createI32(e.currentMemoryOffset),r.createI32(c.ensureGCHook(this,e))],n.nativeSizeType)):r.createUnreachable()}return(i=t.memoryAllocateInstance)&&this.compileFunction(i)?(this.currentType=e.type,r.createCall(i.internalName,[n.isWasm64?r.createI64(e.currentMemoryOffset):r.createI32(e.currentMemoryOffset)],n.nativeSizeType)):r.createUnreachable()},t.prototype.makeFieldInitialization=function(e,t){var r,n;void 0===t&&(t=[]);var i=e.members;if(!i)return[];var s=this.module,o=this.currentFlow,c=o.is(4096),l=c?assert(o.lookupLocal("this")).index:0,p=this.options.nativeSizeType;try{for(var _=a(i.values()),d=_.next();!d.done;d=_.next()){var y=d.value;if(y.kind==h.ElementKind.FIELD&&y.parent==e){var m=y;assert(!m.isAny(u.CommonFlags.CONST));var g=m.type,T=g.toNativeType(),E=m.prototype.declaration,f=E.initializer;if(f)t.push(s.createStore(g.byteSize,s.createGetLocal(l,p),this.compileExpression(f,g,1,0),T,m.memoryOffset));else{var I=E.parameterIndex;t.push(s.createStore(g.byteSize,s.createGetLocal(l,p),I>=0?s.createGetLocal(c?assert(o.lookupLocal(m.simpleName)).index:1+I,T):g.toNativeZero(s),T,m.memoryOffset))}}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}return t},t.prototype.addDebugLocation=function(e,t){var r=this.currentFlow.parentFunction,n=t.source;n.debugInfoIndex<0&&(n.debugInfoIndex=this.module.addDebugInfoFile(n.normalizedPath)),t.debugInfoRef=e,r.debugLocations.push(t)},t}(l.DiagnosticEmitter);function I(e,t){if(T=t.range.source.simplePath,E=t.programLevelInternalName,e.hasDecorator(h.DecoratorFlags.EXTERNAL)){var r=e.program,n=assert(d.findDecorator(d.DecoratorKind.EXTERNAL,t.decorators)),i=n.arguments;if(i&&i.length){var a=i[0];a.kind==d.NodeKind.LITERAL&&a.literalKind==d.LiteralKind.STRING?(E=a.value,i.length>=2&&((a=i[1]).kind==d.NodeKind.LITERAL&&a.literalKind==d.LiteralKind.STRING?(T=E,E=a.value,i.length>2&&r.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,"2",i.length.toString())):r.error(l.DiagnosticCode.String_literal_expected,a.range))):r.error(l.DiagnosticCode.String_literal_expected,a.range)}else r.error(l.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,n.range,"1","0")}}t.Compiler=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Operation_not_supported=100]="Operation_not_supported",e[e.Operation_is_unsafe=101]="Operation_is_unsafe",e[e.User_defined_0=102]="User_defined_0",e[e.Conversion_from_type_0_to_1_requires_an_explicit_cast=200]="Conversion_from_type_0_to_1_requires_an_explicit_cast",e[e.Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit=201]="Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit",e[e.Type_0_cannot_be_changed_to_type_1=202]="Type_0_cannot_be_changed_to_type_1",e[e.Type_0_cannot_be_reinterpreted_as_type_1=203]="Type_0_cannot_be_reinterpreted_as_type_1",e[e.Basic_type_0_cannot_be_nullable=204]="Basic_type_0_cannot_be_nullable",e[e.Cannot_export_a_mutable_global=205]="Cannot_export_a_mutable_global",e[e.Compiling_constant_with_non_constant_initializer_as_mutable=206]="Compiling_constant_with_non_constant_initializer_as_mutable",e[e.Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa=207]="Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa",e[e.Unmanaged_classes_cannot_implement_interfaces=208]="Unmanaged_classes_cannot_implement_interfaces",e[e.Invalid_regular_expression_flags=209]="Invalid_regular_expression_flags",e[e.Implementation_0_must_match_the_signature_1=210]="Implementation_0_must_match_the_signature_1",e[e.Class_0_is_sealed_and_cannot_be_extended=211]="Class_0_is_sealed_and_cannot_be_extended",e[e.Decorator_0_is_not_valid_here=212]="Decorator_0_is_not_valid_here",e[e.Duplicate_decorator=213]="Duplicate_decorator",e[e.An_allocator_must_be_declared_to_allocate_memory_Try_importing_allocator_arena_or_allocator_tlsf=214]="An_allocator_must_be_declared_to_allocate_memory_Try_importing_allocator_arena_or_allocator_tlsf",e[e.Optional_parameter_must_have_an_initializer=215]="Optional_parameter_must_have_an_initializer",e[e.Constructor_of_class_0_must_not_require_any_arguments=216]="Constructor_of_class_0_must_not_require_any_arguments",e[e.Function_0_cannot_be_inlined_into_itself=217]="Function_0_cannot_be_inlined_into_itself",e[e.Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set=218]="Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set",e[e.Optional_properties_are_not_supported=219]="Optional_properties_are_not_supported",e[e.Unterminated_string_literal=1002]="Unterminated_string_literal",e[e.Identifier_expected=1003]="Identifier_expected",e[e._0_expected=1005]="_0_expected",e[e.A_file_cannot_have_a_reference_to_itself=1006]="A_file_cannot_have_a_reference_to_itself",e[e.Trailing_comma_not_allowed=1009]="Trailing_comma_not_allowed",e[e.Unexpected_token=1012]="Unexpected_token",e[e.A_rest_parameter_must_be_last_in_a_parameter_list=1014]="A_rest_parameter_must_be_last_in_a_parameter_list",e[e.Parameter_cannot_have_question_mark_and_initializer=1015]="Parameter_cannot_have_question_mark_and_initializer",e[e.A_required_parameter_cannot_follow_an_optional_parameter=1016]="A_required_parameter_cannot_follow_an_optional_parameter",e[e.Statements_are_not_allowed_in_ambient_contexts=1036]="Statements_are_not_allowed_in_ambient_contexts",e[e.Initializers_are_not_allowed_in_ambient_contexts=1039]="Initializers_are_not_allowed_in_ambient_contexts",e[e._0_modifier_cannot_be_used_here=1042]="_0_modifier_cannot_be_used_here",e[e.A_rest_parameter_cannot_be_optional=1047]="A_rest_parameter_cannot_be_optional",e[e.A_rest_parameter_cannot_have_an_initializer=1048]="A_rest_parameter_cannot_have_an_initializer",e[e.A_set_accessor_must_have_exactly_one_parameter=1049]="A_set_accessor_must_have_exactly_one_parameter",e[e.A_set_accessor_parameter_cannot_have_an_initializer=1052]="A_set_accessor_parameter_cannot_have_an_initializer",e[e.A_get_accessor_cannot_have_parameters=1054]="A_get_accessor_cannot_have_parameters",e[e.Enum_member_must_have_initializer=1061]="Enum_member_must_have_initializer",e[e.Type_parameters_cannot_appear_on_a_constructor_declaration=1092]="Type_parameters_cannot_appear_on_a_constructor_declaration",e[e.Type_annotation_cannot_appear_on_a_constructor_declaration=1093]="Type_annotation_cannot_appear_on_a_constructor_declaration",e[e.An_accessor_cannot_have_type_parameters=1094]="An_accessor_cannot_have_type_parameters",e[e.A_set_accessor_cannot_have_a_return_type_annotation=1095]="A_set_accessor_cannot_have_a_return_type_annotation",e[e.Type_parameter_list_cannot_be_empty=1098]="Type_parameter_list_cannot_be_empty",e[e.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement=1104]="A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement",e[e.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement=1105]="A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement",e[e.A_return_statement_can_only_be_used_within_a_function_body=1108]="A_return_statement_can_only_be_used_within_a_function_body",e[e.Expression_expected=1109]="Expression_expected",e[e.Type_expected=1110]="Type_expected",e[e.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement=1113]="A_default_clause_cannot_appear_more_than_once_in_a_switch_statement",e[e.Duplicate_label_0=1114]="Duplicate_label_0",e[e.Octal_literals_are_not_allowed_in_strict_mode=1121]="Octal_literals_are_not_allowed_in_strict_mode",e[e.Digit_expected=1124]="Digit_expected",e[e.Hexadecimal_digit_expected=1125]="Hexadecimal_digit_expected",e[e.Unexpected_end_of_text=1126]="Unexpected_end_of_text",e[e.Invalid_character=1127]="Invalid_character",e[e._case_or_default_expected=1130]="_case_or_default_expected",e[e._super_must_be_followed_by_an_argument_list_or_member_access=1034]="_super_must_be_followed_by_an_argument_list_or_member_access",e[e.A_declare_modifier_cannot_be_used_in_an_already_ambient_context=1038]="A_declare_modifier_cannot_be_used_in_an_already_ambient_context",e[e.Type_argument_expected=1140]="Type_argument_expected",e[e.String_literal_expected=1141]="String_literal_expected",e[e.Line_break_not_permitted_here=1142]="Line_break_not_permitted_here",e[e.Declaration_expected=1146]="Declaration_expected",e[e._const_declarations_must_be_initialized=1155]="_const_declarations_must_be_initialized",e[e.Unterminated_regular_expression_literal=1161]="Unterminated_regular_expression_literal",e[e.Interface_declaration_cannot_have_implements_clause=1176]="Interface_declaration_cannot_have_implements_clause",e[e.Binary_digit_expected=1177]="Binary_digit_expected",e[e.Octal_digit_expected=1178]="Octal_digit_expected",e[e.An_implementation_cannot_be_declared_in_ambient_contexts=1183]="An_implementation_cannot_be_declared_in_ambient_contexts",e[e.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive=1198]="An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive",e[e.Unterminated_Unicode_escape_sequence=1199]="Unterminated_Unicode_escape_sequence",e[e.Decorators_are_not_valid_here=1206]="Decorators_are_not_valid_here",e[e._abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration=1242]="_abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration",e[e.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract=1245]="Method_0_cannot_have_an_implementation_because_it_is_marked_abstract",e[e.A_definite_assignment_assertion_is_not_permitted_in_this_context=1255]="A_definite_assignment_assertion_is_not_permitted_in_this_context",e[e.A_class_may_only_extend_another_class=1311]="A_class_may_only_extend_another_class",e[e.A_parameter_property_cannot_be_declared_using_a_rest_parameter=1317]="A_parameter_property_cannot_be_declared_using_a_rest_parameter",e[e.Duplicate_identifier_0=2300]="Duplicate_identifier_0",e[e.Cannot_find_name_0=2304]="Cannot_find_name_0",e[e.Module_0_has_no_exported_member_1=2305]="Module_0_has_no_exported_member_1",e[e.Generic_type_0_requires_1_type_argument_s=2314]="Generic_type_0_requires_1_type_argument_s",e[e.Type_0_is_not_generic=2315]="Type_0_is_not_generic",e[e.Type_0_is_not_assignable_to_type_1=2322]="Type_0_is_not_assignable_to_type_1",e[e.Index_signature_is_missing_in_type_0=2329]="Index_signature_is_missing_in_type_0",e[e._this_cannot_be_referenced_in_current_location=2332]="_this_cannot_be_referenced_in_current_location",e[e._super_can_only_be_referenced_in_a_derived_class=2335]="_super_can_only_be_referenced_in_a_derived_class",e[e.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors=2337]="Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors",e[e.Property_0_does_not_exist_on_type_1=2339]="Property_0_does_not_exist_on_type_1",e[e.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures=2349]="Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures",e[e.Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature=2351]="Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature",e[e.A_function_whose_declared_type_is_not_void_must_return_a_value=2355]="A_function_whose_declared_type_is_not_void_must_return_a_value",e[e.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access=2357]="The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access",e[e.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access=2364]="The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access",e[e.Operator_0_cannot_be_applied_to_types_1_and_2=2365]="Operator_0_cannot_be_applied_to_types_1_and_2",e[e.A_super_call_must_be_the_first_statement_in_the_constructor=2376]="A_super_call_must_be_the_first_statement_in_the_constructor",e[e.Constructors_for_derived_classes_must_contain_a_super_call=2377]="Constructors_for_derived_classes_must_contain_a_super_call",e[e._get_and_set_accessor_must_have_the_same_type=2380]="_get_and_set_accessor_must_have_the_same_type",e[e.Constructor_implementation_is_missing=2390]="Constructor_implementation_is_missing",e[e.Function_implementation_is_missing_or_not_immediately_following_the_declaration=2391]="Function_implementation_is_missing_or_not_immediately_following_the_declaration",e[e.Multiple_constructor_implementations_are_not_allowed=2392]="Multiple_constructor_implementations_are_not_allowed",e[e.Duplicate_function_implementation=2393]="Duplicate_function_implementation",e[e.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local=2395]="Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local",e[e.Type_0_has_no_property_1=2460]="Type_0_has_no_property_1",e[e.The_0_operator_cannot_be_applied_to_type_1=2469]="The_0_operator_cannot_be_applied_to_type_1",e[e.In_const_enum_declarations_member_initializer_must_be_constant_expression=2474]="In_const_enum_declarations_member_initializer_must_be_constant_expression",e[e.Export_declaration_conflicts_with_exported_declaration_of_0=2484]="Export_declaration_conflicts_with_exported_declaration_of_0",e[e.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property=2540]="Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property",e[e.The_target_of_an_assignment_must_be_a_variable_or_a_property_access=2541]="The_target_of_an_assignment_must_be_a_variable_or_a_property_access",e[e.Index_signature_in_type_0_only_permits_reading=2542]="Index_signature_in_type_0_only_permits_reading",e[e.Expected_0_arguments_but_got_1=2554]="Expected_0_arguments_but_got_1",e[e.Expected_at_least_0_arguments_but_got_1=2555]="Expected_at_least_0_arguments_but_got_1",e[e.Expected_0_type_arguments_but_got_1=2558]="Expected_0_type_arguments_but_got_1",e[e.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums=2651]="A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums",e[e.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration=2673]="Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration",e[e.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration=2674]="Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration",e[e.Namespace_0_has_no_exported_member_1=2694]="Namespace_0_has_no_exported_member_1",e[e.Required_type_parameters_may_not_follow_optional_type_parameters=2706]="Required_type_parameters_may_not_follow_optional_type_parameters",e[e.File_0_not_found=6054]="File_0_not_found",e[e.Numeric_separators_are_not_allowed_here=6188]="Numeric_separators_are_not_allowed_here",e[e.Multiple_consecutive_numeric_separators_are_not_permitted=6189]="Multiple_consecutive_numeric_separators_are_not_permitted",e[e._super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class=17009]="_super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class",e[e._super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class=17011]="_super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class"}(t.DiagnosticCode||(t.DiagnosticCode={})),t.diagnosticCodeToString=function(e){switch(e){case 100:return"Operation not supported.";case 101:return"Operation is unsafe.";case 102:return"User-defined: {0}";case 200:return"Conversion from type '{0}' to '{1}' requires an explicit cast.";case 201:return"Conversion from type '{0}' to '{1}' will require an explicit cast when switching between 32/64-bit.";case 202:return"Type '{0}' cannot be changed to type '{1}'.";case 203:return"Type '{0}' cannot be reinterpreted as type '{1}'.";case 204:return"Basic type '{0}' cannot be nullable.";case 205:return"Cannot export a mutable global.";case 206:return"Compiling constant with non-constant initializer as mutable.";case 207:return"Unmanaged classes cannot extend managed classes and vice-versa.";case 208:return"Unmanaged classes cannot implement interfaces.";case 209:return"Invalid regular expression flags.";case 210:return"Implementation '{0}' must match the signature '{1}'.";case 211:return"Class '{0}' is sealed and cannot be extended.";case 212:return"Decorator '{0}' is not valid here.";case 213:return"Duplicate decorator.";case 214:return"An allocator must be declared to allocate memory. Try importing allocator/arena or allocator/tlsf.";case 215:return"Optional parameter must have an initializer.";case 216:return"Constructor of class '{0}' must not require any arguments.";case 217:return"Function '{0}' cannot be inlined into itself.";case 218:return"Cannot access method '{0}' without calling it as it requires 'this' to be set.";case 219:return"Optional properties are not supported.";case 1002:return"Unterminated string literal.";case 1003:return"Identifier expected.";case 1005:return"'{0}' expected.";case 1006:return"A file cannot have a reference to itself.";case 1009:return"Trailing comma not allowed.";case 1012:return"Unexpected token.";case 1014:return"A rest parameter must be last in a parameter list.";case 1015:return"Parameter cannot have question mark and initializer.";case 1016:return"A required parameter cannot follow an optional parameter.";case 1036:return"Statements are not allowed in ambient contexts.";case 1039:return"Initializers are not allowed in ambient contexts.";case 1042:return"'{0}' modifier cannot be used here.";case 1047:return"A rest parameter cannot be optional.";case 1048:return"A rest parameter cannot have an initializer.";case 1049:return"A 'set' accessor must have exactly one parameter.";case 1052:return"A 'set' accessor parameter cannot have an initializer.";case 1054:return"A 'get' accessor cannot have parameters.";case 1061:return"Enum member must have initializer.";case 1092:return"Type parameters cannot appear on a constructor declaration.";case 1093:return"Type annotation cannot appear on a constructor declaration.";case 1094:return"An accessor cannot have type parameters.";case 1095:return"A 'set' accessor cannot have a return type annotation.";case 1098:return"Type parameter list cannot be empty.";case 1104:return"A 'continue' statement can only be used within an enclosing iteration statement.";case 1105:return"A 'break' statement can only be used within an enclosing iteration or switch statement.";case 1108:return"A 'return' statement can only be used within a function body.";case 1109:return"Expression expected.";case 1110:return"Type expected.";case 1113:return"A 'default' clause cannot appear more than once in a 'switch' statement.";case 1114:return"Duplicate label '{0}'.";case 1121:return"Octal literals are not allowed in strict mode.";case 1124:return"Digit expected.";case 1125:return"Hexadecimal digit expected.";case 1126:return"Unexpected end of text.";case 1127:return"Invalid character.";case 1130:return"'case' or 'default' expected.";case 1034:return"'super' must be followed by an argument list or member access.";case 1038:return"A 'declare' modifier cannot be used in an already ambient context.";case 1140:return"Type argument expected.";case 1141:return"String literal expected.";case 1142:return"Line break not permitted here.";case 1146:return"Declaration expected.";case 1155:return"'const' declarations must be initialized.";case 1161:return"Unterminated regular expression literal.";case 1176:return"Interface declaration cannot have 'implements' clause.";case 1177:return"Binary digit expected.";case 1178:return"Octal digit expected.";case 1183:return"An implementation cannot be declared in ambient contexts.";case 1198:return"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.";case 1199:return"Unterminated Unicode escape sequence.";case 1206:return"Decorators are not valid here.";case 1242:return"'abstract' modifier can only appear on a class, method, or property declaration.";case 1245:return"Method '{0}' cannot have an implementation because it is marked abstract.";case 1255:return"A definite assignment assertion '!' is not permitted in this context.";case 1311:return"A class may only extend another class.";case 1317:return"A parameter property cannot be declared using a rest parameter.";case 2300:return"Duplicate identifier '{0}'.";case 2304:return"Cannot find name '{0}'.";case 2305:return"Module '{0}' has no exported member '{1}'.";case 2314:return"Generic type '{0}' requires {1} type argument(s).";case 2315:return"Type '{0}' is not generic.";case 2322:return"Type '{0}' is not assignable to type '{1}'.";case 2329:return"Index signature is missing in type '{0}'.";case 2332:return"'this' cannot be referenced in current location.";case 2335:return"'super' can only be referenced in a derived class.";case 2337:return"Super calls are not permitted outside constructors or in nested functions inside constructors.";case 2339:return"Property '{0}' does not exist on type '{1}'.";case 2349:return"Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.";case 2351:return"Cannot use 'new' with an expression whose type lacks a construct signature.";case 2355:return"A function whose declared type is not 'void' must return a value.";case 2357:return"The operand of an increment or decrement operator must be a variable or a property access.";case 2364:return"The left-hand side of an assignment expression must be a variable or a property access.";case 2365:return"Operator '{0}' cannot be applied to types '{1}' and '{2}'.";case 2376:return"A 'super' call must be the first statement in the constructor.";case 2377:return"Constructors for derived classes must contain a 'super' call.";case 2380:return"'get' and 'set' accessor must have the same type.";case 2390:return"Constructor implementation is missing.";case 2391:return"Function implementation is missing or not immediately following the declaration.";case 2392:return"Multiple constructor implementations are not allowed.";case 2393:return"Duplicate function implementation.";case 2395:return"Individual declarations in merged declaration '{0}' must be all exported or all local.";case 2460:return"Type '{0}' has no property '{1}'.";case 2469:return"The '{0}' operator cannot be applied to type '{1}'.";case 2474:return"In 'const' enum declarations member initializer must be constant expression.";case 2484:return"Export declaration conflicts with exported declaration of '{0}'.";case 2540:return"Cannot assign to '{0}' because it is a constant or a read-only property.";case 2541:return"The target of an assignment must be a variable or a property access.";case 2542:return"Index signature in type '{0}' only permits reading.";case 2554:return"Expected {0} arguments, but got {1}.";case 2555:return"Expected at least {0} arguments, but got {1}.";case 2558:return"Expected {0} type arguments, but got {1}.";case 2651:return"A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.";case 2673:return"Constructor of class '{0}' is private and only accessible within the class declaration.";case 2674:return"Constructor of class '{0}' is protected and only accessible within the class declaration.";case 2694:return"Namespace '{0}' has no exported member '{1}'.";case 2706:return"Required type parameters may not follow optional type parameters.";case 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,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(5),p=r(4),u=r(7),h=r(1),_=r(0),d=r(6);!function(e){e[e.REPORT=0]="REPORT",e[e.SWALLOW=1]="SWALLOW"}(o=t.ReportMode||(t.ReportMode={}));var y=function(e){function t(t){var r=e.call(this,t.diagnostics)||this;return r.currentThisExpression=null,r.currentElementExpression=null,r.program=t,r}return i(t,e),t.prototype.resolveType=function(e,t,r){if(void 0===t&&(t=null),void 0===r&&(r=o.REPORT),e.kind==p.NodeKind.SIGNATURE){var n=this.resolveSignature(e,t,r);return n?e.isNullable?n.type.asNullable():n.type:null}assert(e.kind==p.NodeKind.TYPE);var i=e,a=i.name.text,s=a,d=i.range.source.internalPath+h.PATH_DELIMITER+a,y=this.program.elementsLookup,m=void 0;if((m=y.get(d))||(m=y.get(s)))switch(m.kind){case l.ElementKind.ENUM:return null!==i.typeArguments&&i.typeArguments.length?(r==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,m.internalName),null):u.Type.i32;case l.ElementKind.CLASS_PROTOTYPE:var g=this.resolveClassInclTypeArguments(m,i.typeArguments,_.makeMap(t),e);return g?e.isNullable?g.type.asNullable():g.type:null}var T=this.program.typeAliases.get(a);if(T)return this.resolveType(T.type,t,r);var E=i.typeArguments,f=null;if(E){var I=E.length;f=new Array(I);for(var v=0;v",s+="<"+C+">")}else if(t){var S=t.get(s);if(S)return S}}var N=this.program.typesLookup,O=void 0;if((O=N.get(d))||(O=N.get(s)))return!O.is(256)&&e.isNullable&&r==o.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,e.range,O.toString()),O;if("NATIVE"==a){if(!f||1!=f.length)return r==o.REPORT&&this.error(c.DiagnosticCode.Expected_0_type_arguments_but_got_1,i.range,"1",(E?E.length:1).toString(10)),null;switch(f[0].kind){case 0:case 1:case 2:return u.Type.i32;case 4:if(!this.program.options.isWasm64)return u.Type.i32;case 3:return u.Type.i64;case 5:case 6:case 7:case 10:return u.Type.u32;case 9:if(!this.program.options.isWasm64)return u.Type.u32;case 8:return u.Type.u64;case 11:return u.Type.f32;case 12:return u.Type.f64;case 13:return u.Type.v128;case 14:return u.Type.void;default:assert(!1)}}return r==o.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,i.name.range,s),null},t.prototype.resolveSignature=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=o.REPORT);var n=e.explicitThisType,i=null;if(n&&!(i=this.resolveType(n,t,r)))return null;for(var a=e.parameters,s=a.length,c=new Array(s),l=new Array(s),h=0,_=!1,d=0;ds)return this.error(c.DiagnosticCode.Expected_0_type_arguments_but_got_1,u?p.Range.join(t[0].range,t[u-1].range):assert(n).range.atEnd,(u");var w=new l.Function(e,P,U,A||T,r);return d||e.instances.set(a,d=new Map),d.set(s,w),this.program.instancesLookup.set(P,w),w},t.prototype.resolveFunctionPartially=function(e,t,r){void 0===r&&(r=o.REPORT),assert(e.is(h.CommonFlags.INSTANCE));var n=assert(e.classPrototype);if(!t||!t.length)return e;var i=e.simpleName,a=u.typesToString(t),s=new l.FunctionPrototype(this.program,i,n.internalName+"<"+a+">"+h.INSTANCE_DELIMITER+i,e.declaration,n,e.decoratorFlags);return s.flags=e.flags,s.operatorKind=e.operatorKind,s.classTypeArguments=t,s.instances=e.instances,s},t.prototype.resolveFunctionInclTypeArguments=function(e,t,r,n,i){void 0===i&&(i=o.REPORT);var a=null;if(e.is(h.CommonFlags.GENERIC)){if(e.classTypeArguments&&e.applyClassTypeArguments(r),!(a=this.resolveTypeArguments(assert(e.declaration.typeParameters),t,r,n,i)))return null}else if(null!==t&&t.length)return i==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,n.range,e.internalName),null;return this.resolveFunction(e,a,r,i)},t.prototype.resolveClass=function(e,t,r,n){var i,d,y,m,g,T;void 0===r&&(r=_.makeMap()),void 0===n&&(n=o.REPORT);var E=t?u.typesToString(t):"",f=e.instances.get(E);if(f)return f;var I=e.declaration;if(t){var v=I.typeParameters,A=v.length,C=t.length;assert(C==A);for(var S=0;S",b+="<"+E+">"),(f=new l.Class(e,x,b,t,N)).contextualTypeArguments=r,e.instances.set(E,f),this.program.instancesLookup.set(b,f);var L=0;if(N){if(N.members){f.members||(f.members=new Map);try{for(var k=a(N.members.values()),R=k.next();!R.done;R=k.next()){var F=R.value;f.members.set(F.simpleName,F)}}catch(e){i={error:e}}finally{try{R&&!R.done&&(d=k.return)&&d.call(k)}finally{if(i)throw i.error}}}L=N.currentMemoryOffset}var B=e.constructorPrototype;if(B){var D=this.resolveFunctionPartially(B,t,n);if(!D)return null;f.constructorInstance=this.resolveFunction(D,null,_.makeMap(),n)}if(e.instanceMembers)try{for(var U=a(e.instanceMembers.values()),P=U.next();!P.done;P=U.next()){var w=P.value;switch(w.kind){case l.ElementKind.FIELD_PROTOTYPE:var M=w.declaration;if(f.members){if(f.members.has(w.simpleName)){this.error(c.DiagnosticCode.Duplicate_identifier_0,M.name.range,w.simpleName);break}}else f.members=new Map;var G=null;if(M.type)G=this.resolveType(M.type,f.contextualTypeArguments,n);else{if(null!==N&&null!==N.members){var V=N.members.get(w.simpleName);V&&!V.is(h.CommonFlags.PRIVATE)&&(assert(V.kind==l.ElementKind.FIELD),G=V.type)}G||n==o.REPORT&&this.error(c.DiagnosticCode.Type_expected,M.name.range.atEnd)}if(!G)break;var K=new l.Field(w,b+h.INSTANCE_DELIMITER+w.simpleName,G,M,f);switch(G.byteSize){case 1:break;case 2:1&L&&++L;break;case 4:3&L&&(L=1+(3|L));break;case 8:7&L&&(L=1+(7|L));break;default:assert(!1)}K.memoryOffset=L,L+=G.byteSize,f.members.set(w.simpleName,K);break;case l.ElementKind.FUNCTION_PROTOTYPE:f.members||(f.members=new Map);var z=this.resolveFunctionPartially(w,t,n);if(!z)return null;z.internalName=b+h.INSTANCE_DELIMITER+z.simpleName,f.members.set(w.simpleName,z);break;case l.ElementKind.PROPERTY:f.members||(f.members=new Map);var H=assert(w.getterPrototype),X=w.setterPrototype,W=new l.Property(this.program,w.simpleName,b+h.INSTANCE_DELIMITER+w.simpleName,e),Y=this.resolveFunctionPartially(H,t,n);if(!Y)return null;if(Y.internalName=b+h.INSTANCE_DELIMITER+Y.simpleName,W.getterPrototype=Y,X){var Q=this.resolveFunctionPartially(X,t,n);if(!Q)return null;Q.internalName=b+h.INSTANCE_DELIMITER+Q.simpleName,W.setterPrototype=Q}f.members.set(w.simpleName,W);break;default:assert(!1)}}}catch(e){y={error:e}}finally{try{P&&!P.done&&(m=U.return)&&m.call(U)}finally{if(y)throw y.error}}f.currentMemoryOffset=L;try{for(var q=a(e.overloadPrototypes),j=q.next();!j.done;j=q.next()){var Z=s(j.value,2),J=Z[0],$=Z[1];assert(J!=l.OperatorKind.INVALID);var ee=void 0;if($.is(h.CommonFlags.INSTANCE)){var te=this.resolveFunctionPartially($,t,n);if(!te)continue;ee=this.resolveFunction(te,null,_.makeMap(),n)}else ee=this.resolveFunction($,null,_.makeMap(),n);if(ee){var re=f.overloads;re||(f.overloads=re=new Map),re.set(J,ee)}}}catch(e){g={error:e}}finally{try{j&&!j.done&&(T=q.return)&&T.call(q)}finally{if(g)throw g.error}}return f},t.prototype.resolveClassInclTypeArguments=function(e,t,r,n,i){void 0===i&&(i=o.REPORT);var a=null;if(e.is(h.CommonFlags.GENERIC)){if(!(a=this.resolveTypeArguments(assert(e.declaration.typeParameters),t,r,n,i)))return null}else if(null!==t&&t.length)return i==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,n.range,e.internalName),null;return this.resolveClass(e,a,r,i)},t}(c.DiagnosticEmitter);t.Resolver=y},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),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);i0&&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("),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("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CtzI32:return this.push("ctz("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.PopcntI32:return this.push("popcnt("),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("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CeilF32:return this.push("ceil("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.FloorF32:return this.push("floor("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.TruncF32:return this.push("trunc("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.NearestF32:return this.push("nearest("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.SqrtF32:return this.push("sqrt("),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("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CtzI64:return this.push("ctz("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.PopcntI64:return this.push("popcnt("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.AbsF64:return this.push("abs("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CeilF64:return this.push("ceil("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.FloorF64:return this.push("floor("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.TruncF64:return this.push("trunc("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.NearestF64:return this.push("nearest("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.SqrtF64:return this.push("sqrt("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ExtendI32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ExtendU32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.WrapI64:case n.UnaryOp.TruncF32ToI32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToI64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToU32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToU64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToI32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToI64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToU32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToU64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ReinterpretF32:return this.push("reinterpret("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ReinterpretF64:return this.push("reinterpret("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ConvertI32ToF32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI32ToF64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU32ToF32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU32ToF64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI64ToF32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI64ToF64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU64ToF32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU64ToF64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.PromoteF32:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.DemoteF64:return this.push(""),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ReinterpretI32:return this.push("reinterpret("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ReinterpretI64:return this.push("reinterpret("),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("("),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / "),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("("),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / "),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("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.RotrI32:return this.push("rotr("),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(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" < "),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(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" <= "),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(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" > "),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(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" >= "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.DivU64:return this.push(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RemU64:return this.push(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" % "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RotlI64:return this.push("rotl("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.RotrI64:return this.push("rotr("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.LtU64:return this.push(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" < "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LeU64:return this.push(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" <= "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GtU64:return this.push(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" > "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GeU64:return this.push(""),this.decompileExpression(n.getBinaryLeft(e)),this.push(" >= "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.CopysignF32:return this.push("copysign("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MinF32:return this.push("min("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MaxF32:return this.push("max("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.CopysignF64:return this.push("copysign("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MinF64:return this.push("min("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MaxF64:return this.push("max("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")")}return;case n.ExpressionId.Select:return this.push("select<"),this.push(a(c)),this.push(">("),this.decompileExpression(n.getSelectThen(e)),this.push(", "),this.decompileExpression(n.getSelectElse(e)),this.push(", "),this.decompileExpression(n.getSelectCondition(e)),void this.push(")");case n.ExpressionId.Drop:return this.decompileExpression(n.getDropValue(e)),void this.push(";\n");case n.ExpressionId.Return:return void((t=n.getReturnValue(e))?(this.push("return "),this.decompileExpression(t),this.push(";\n")):this.push("return;\n"));case n.ExpressionId.Host:switch(n.getHostOp(e)){case n.HostOp.CurrentMemory:return void this.push("memory.size()");case n.HostOp.GrowMemory:return this.push("memory.grow("),this.decompileExpression(n.getHostOperand(e,0)),void this.push(")")}break;case n.ExpressionId.Nop:return void this.push(";\n");case n.ExpressionId.Unreachable:return void this.push("unreachable()");case n.ExpressionId.AtomicCmpxchg:case n.ExpressionId.AtomicRMW:case n.ExpressionId.AtomicWait:case n.ExpressionId.AtomicWake:}throw new Error("not implemented")},e.prototype.push=function(e){this.text.push(e)},e.prototype.finish=function(){var e=this.text.join("");return this.text=[],e},e}();function a(e){switch(e){case n.NativeType.None:return"void";case n.NativeType.I32:return"i32";case n.NativeType.I64:return"i64";case n.NativeType.F32:return"f32";case n.NativeType.F64:return"f64";case n.NativeType.V128:return"v128";case n.NativeType.Unreachable:throw new Error("unreachable type");case n.NativeType.Auto:throw new Error("auto type");default:throw new Error("unexpected type")}}t.Decompiler=i},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},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(1),c=r(5),l=r(0),p=function(){function e(e,t){void 0===t&&(t=!1),this.todo=[],this.seen=new Set,this.program=e,this.includePrivate}return e.prototype.walk=function(){var e,t;try{for(var r=a(this.program.moduleLevelExports.values()),n=r.next();!n.done;n=r.next()){var i=n.value;this.visitElement(i.element)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}for(var s=this.todo;0"),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;d=!0}n=p.Node.createType(h,_,d,e.range(a,e.pos))}for(;e.skip(o.Token.OPENBRACKET);){var m=e.tokenPos;if(!e.skip(o.Token.CLOSEBRACKET))return r||this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null;var g=e.range(m,e.pos);d=!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;d=!0}if(n=p.Node.createType(p.Node.createIdentifierExpression("Array",g),[n],d,e.range(a,e.pos)),d)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=p.ParameterKind.DEFAULT;if(e.skip(o.Token.DOT_DOT_DOT)&&(s=!0,e.discard(r),l=p.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 u=this.parseType(e,!1);if(!u)return null;if(u.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,u.range),this.tryParseSignatureIsSignature=!0,null;a=u}else{if(!e.skipIdentifier())return s?this.error(c.DiagnosticCode.Identifier_expected,e.range()):e.reset(r),this.tryParseSignatureIsSignature=s,null;var h=p.Node.createIdentifierExpression(e.readIdentifier(),e.range(e.tokenPos,e.pos));if(e.skip(o.Token.QUESTION)&&(s=!0,e.discard(r),l==p.ParameterKind.REST?this.error(c.DiagnosticCode.A_rest_parameter_cannot_be_optional,e.range()):l=p.ParameterKind.OPTIONAL),e.skip(o.Token.COLON)){s=!0,e.discard(r);var _=this.parseType(e);if(!_)return this.tryParseSignatureIsSignature=s,null;var d=new p.ParameterNode;d.parameterKind=l,d.name=h,d.type=_,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,p.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=p.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=p.Node.createPropertyAccessExpression(n,p.Node.createIdentifierExpression(r,e.range()),e.range(t,e.pos))}var i=void 0;if(!e.skip(o.Token.OPENPAREN))return p.Node.createDecorator(n,null,e.range(t,e.pos));if(i=this.parseArguments(e))return p.Node.createDecorator(n,i,e.range(t,e.pos))}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseVariable=function(e,t,r,n){var i=new Array;do{var a=this.parseVariableDeclaration(e,t,r);if(!a)return null;i.push(a)}while(e.skip(o.Token.COMMA));var s=p.Node.createVariableStatement(i,r,t,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=p.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 u=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,u),p.Node.createVariableDeclaration(n,s,l,r,i,u)},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=p.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 u=p.Node.createEnumDeclaration(i,s,r,t,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),u},t.prototype.parseEnumValue=function(e,t){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),n=null;return e.skip(o.Token.EQUALS)&&!(n=this.parseExpression(e,2))?null:p.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=p.Node.createReturnStatement(t,e.range());return e.skip(o.Token.SEMICOLON),r},t.prototype.parseTypeParameters=function(e){for(var t=new Array,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.push(n),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.GREATERTHAN))break;return this.error(c.DiagnosticCode._0_expected,e.range(),">"),null}}return 0===t.length&&this.error(c.DiagnosticCode.Type_parameter_list_cannot_be_empty,e.range()),t},t.prototype.parseTypeParameter=function(e){if(e.next()==o.Token.IDENTIFIER){var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(o.Token.EXTENDS)){if(!(i=this.parseType(e)))return null;if(i.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,i.range),null;r=i}var n=null;if(e.skip(o.Token.EQUALS)){var i;if(!(i=this.parseType(e)))return null;if(i.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,i.range),null;n=i}return p.Node.createTypeParameter(t,r,n,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==p.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 p.ParameterKind.OPTIONAL:i=!0;break;case p.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 u=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),h=null;if((n=e.skip(o.Token.QUESTION))&&r&&this.error(c.DiagnosticCode.A_rest_parameter_cannot_be_optional,u.range),e.skip(o.Token.COLON)){if(!(h=this.parseType(e)))return null}else h=p.Node.createOmittedType(e.range(e.pos));var _=null;if(e.skip(o.Token.EQUALS)&&(r&&this.error(c.DiagnosticCode.A_rest_parameter_cannot_have_an_initializer,u.range),n?this.error(c.DiagnosticCode.Parameter_cannot_have_question_mark_and_initializer,u.range):n=!0,!(_=this.parseExpression(e,2))))return null;var d=p.Node.createParameter(u,h,_,r?p.ParameterKind.REST:n?p.ParameterKind.OPTIONAL:p.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=p.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 u=this.parseParameters(e);if(!u)return null;var h=this.parseParametersThis,_=0!=(t&a.CommonFlags.SET);_&&(1!=u.length&&this.error(c.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,i.range),u.length&&u[0].initializer&&this.error(c.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,i.range)),t&a.CommonFlags.GET&&u.length&&this.error(c.DiagnosticCode.A_get_accessor_cannot_have_parameters,i.range);var d=null;if(e.skip(o.Token.COLON)&&!(d=this.parseType(e,!0,_)))return null;d||(d=p.Node.createOmittedType(e.range(e.pos)),_||this.error(c.DiagnosticCode.Type_expected,d.range));var y=p.Node.createSignature(u,d,h,!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 g=p.Node.createFunctionDeclaration(i,l,y,m,r,t,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),g},t.prototype.parseFunctionExpression=function(e){var t,r=e.tokenPos,n=!1;if(e.token==o.Token.FUNCTION){if(t=e.skipIdentifier()?p.Node.createIdentifierExpression(e.readIdentifier(),e.range()):p.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=!0,assert(e.token==o.Token.OPENPAREN),t=p.Node.createEmptyIdentifierExpression(e.range(e.tokenPos));var i=e.pos,a=this.parseParameters(e);return a?this.parseFunctionExpressionCommon(e,t,a,n,r,i):null},t.prototype.parseFunctionExpressionCommon=function(e,t,r,n,i,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(e.skip(o.Token.COLON)){if(!(l=this.parseType(e)))return null}else l=p.Node.createOmittedType(e.range(e.pos)),this.error(c.DiagnosticCode.Type_expected,l.range);if(n&&!e.skip(o.Token.EQUALS_GREATERTHAN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"=>"),null;var u,h=p.Node.createSignature(r,l,null,!1,e.range(s,e.pos));if(n)u=this.parseStatement(e,!1);else{if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;u=this.parseBlockStatement(e,!1)}if(!u)return null;var _=p.Node.createFunctionDeclaration(t,null,h,u,null,n?a.CommonFlags.ARROW:a.CommonFlags.NONE,e.range(i,e.pos));return p.Node.createFunctionExpression(_)},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,l=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(o.Token.LESSTHAN)){if(!(s=this.parseTypeParameters(e)))return null;t|=a.CommonFlags.GENERIC}else s=[];var u=null;if(e.skip(o.Token.EXTENDS)){var h=this.parseType(e);if(!h)return null;if(h.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,h.range),null;u=h}var _=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||(_||(_=[]),_.push(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(!_),y=p.Node.createInterfaceDeclaration(l,s,u,m,r,t,e.range(n,e.pos))):y=p.Node.createClassDeclaration(l,s,u,_,m,r,t,e.range(n,e.pos)),!e.skip(o.Token.CLOSEBRACE))do{var g=this.parseClassMember(e,y);if(!g)return null;g.parent=y,m.push(g)}while(!e.skip(o.Token.CLOSEBRACE));return y},t.prototype.parseClassExpression=function(e){var t,r=e.tokenPos;if(t=e.skipIdentifier()?p.Node.createIdentifierExpression(e.readIdentifier(),e.range()):p.Node.createEmptyIdentifierExpression(e.range(e.pos)),!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;var n=new Array,i=p.Node.createClassDeclaration(t,[],null,null,n,null,a.CommonFlags.NONE,e.range(r,e.pos));if(!e.skip(o.Token.CLOSEBRACE))do{var s=this.parseClassMember(e,i);if(!s)return null;s.parent=i,n.push(s)}while(!e.skip(o.Token.CLOSEBRACE));return p.Node.createClassExpression(i)},t.prototype.parseClassMember=function(e,t){var r=e.pos,n=t.kind==p.NodeKind.INTERFACEDECLARATION,i=new Array;if(e.skip(o.Token.AT)){do{var s=this.parseDecorator(e);if(!s)break;i.push(s)}while(e.skip(o.Token.AT));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 u=0,h=0;e.skip(o.Token.PUBLIC)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"public"),l|=a.CommonFlags.PUBLIC,u=e.tokenPos,h=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,u=e.tokenPos,h=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,u=e.tokenPos,h=e.pos);var _=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,_=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 g=0,T=0;e.skip(o.Token.READONLY)&&(l|=a.CommonFlags.READONLY,g=e.tokenPos,T=e.pos);var E,f=e.mark(),I=!1,v=!1,A=!1,C=0,S=0;if(n||(e.skip(o.Token.GET)?e.peek(!0,o.IdentifierHandling.PREFER)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine?e.reset(f):(l|=a.CommonFlags.GET,v=!0,C=e.tokenPos,S=e.pos,l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(g,T),"readonly")):e.skip(o.Token.SET)?e.peek(!0,o.IdentifierHandling.PREFER)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine?e.reset(f):(l|=a.CommonFlags.SET,A=!0,C=e.tokenPos,S=e.pos,l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(g,T),"readonly")):e.skip(o.Token.CONSTRUCTOR)&&(I=!0,(l|=a.CommonFlags.CONSTRUCTOR)&a.CommonFlags.STATIC&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(_,d),"static"),l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(y,m),"abstract"),l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(g,T),"readonly"))),I)E=p.Node.createConstructorExpression(e.range());else{if(!v&&!A&&e.skip(o.Token.OPENBRACKET)){l&a.CommonFlags.PUBLIC?this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,h),"public"):l&a.CommonFlags.PROTECTED?this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,h),"protected"):l&a.CommonFlags.PRIVATE&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,h),"protected"),l&a.CommonFlags.STATIC&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(_,d),"static"),l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(y,m),"abstract"),l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(g,T),"readonly");var N=this.parseIndexSignatureDeclaration(e,i);return N?(e.skip(o.Token.SEMICOLON),N):null}if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;E=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}var O=null;if(e.skip(o.Token.LESSTHAN)){var x=e.tokenPos;if(!(O=this.parseTypeParameters(e)))return null;I?this.error(c.DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration,e.range(x,e.pos)):v||A?this.error(c.DiagnosticCode.An_accessor_cannot_have_type_parameters,e.range(x,e.pos)):l|=a.CommonFlags.GENERIC}if(e.skip(o.Token.OPENPAREN)){var b=e.tokenPos,L=this.parseParameters(e,I);if(!L)return null;var k=this.parseParametersThis;if(I)for(var R=0,F=L.length;R"),null):null;case o.Token.IDENTIFIER:return p.Node.createIdentifierExpression(e.readIdentifier(),e.range(r,e.pos));case o.Token.THIS:return p.Node.createThisExpression(e.range(r,e.pos));case o.Token.CONSTRUCTOR:return p.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()),p.Node.createSuperExpression(e.range(r,e.pos));case o.Token.STRINGLITERAL:return p.Node.createStringLiteralExpression(e.readString(),e.range(r,e.pos));case o.Token.INTEGERLITERAL:return p.Node.createIntegerLiteralExpression(e.readInteger(),e.range(r,e.pos));case o.Token.FLOATLITERAL:return p.Node.createFloatLiteralExpression(e.readFloat(),e.range(r,e.pos));case o.Token.SLASH:var E=e.readRegexpPattern();return e.skip(o.Token.SLASH)?p.Node.createRegexpLiteralExpression(E,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=new Array;do{if(e.peek()===o.Token.GREATERTHAN)break;var n=this.parseType(e,!0,!0);if(!n)return e.reset(t),null;r.push(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=h(n=e.peek()))>=t;){switch(e.next(),n){case o.Token.AS:var l=this.parseType(e);if(!l)return null;r=p.Node.createAssertionExpression(p.AssertionKind.AS,r,l,e.range(a,e.pos));break;case o.Token.EXCLAMATION:r=p.Node.createAssertionExpression(p.AssertionKind.NONNULL,r,null,e.range(a,e.pos));break;case o.Token.INSTANCEOF:var u=this.parseType(e);if(!u)return null;r=p.Node.createInstanceOfExpression(r,u,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=p.Node.createElementAccessExpression(r,s,e.range(a,e.pos));break;case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:r.kind!=p.NodeKind.IDENTIFIER&&r.kind!=p.NodeKind.ELEMENTACCESS&&r.kind!=p.NodeKind.PROPERTYACCESS&&this.error(c.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,r.range),r=p.Node.createUnaryPostfixExpression(n,r,e.range(a,e.pos));break;case 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=p.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=p.Node.createCommaExpression(m,e.range(a,e.pos));break;default:if(n==o.Token.DOT){if(e.skipIdentifier())s=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());else if(!(s=this.parseExpression(e,_(n)?i:i+1)))return null;if(s.kind==p.NodeKind.IDENTIFIER)r=p.Node.createPropertyAccessExpression(r,s,e.range(a,e.pos));else{if(s.kind!=p.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,_(n)?i:i+1)))return null;r=p.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 p.NodeKind.IDENTIFIER:n.expression=p.Node.createPropertyAccessExpression(r,i,e.range(t,e.pos));break;case p.NodeKind.CALL:var a=this.joinPropertyCall(e,t,r,i);if(!a)return null;n.expression=a,n.range=e.range(t,e.pos);break;default:return this.error(c.DiagnosticCode.Identifier_expected,n.range),null}return n},t.prototype.maybeParseCallExpression=function(e,t){if(p.nodeIsCallable(t.kind))for(var r=null;e.skip(o.Token.OPENPAREN)||p.nodeIsGenericCallable(t.kind)&&null!==(r=this.tryParseTypeArgumentsBeforeArguments(e));){var n=this.parseArguments(e);if(!n)break;t=p.Node.createCallExpression(t,r,n,e.range(t.range.start,e.pos))}return t},t.prototype.skipStatement=function(e){for(e.peek(!0),e.nextTokenOnNewLine&&e.next();;){var t=e.peek(!0);if(t==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()}}},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 h(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 _(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=u,function(e){e[e.NONE=0]="NONE",e[e.COMMA=1]="COMMA",e[e.SPREAD=2]="SPREAD",e[e.YIELD=3]="YIELD",e[e.ASSIGNMENT=4]="ASSIGNMENT",e[e.CONDITIONAL=5]="CONDITIONAL",e[e.LOGICAL_OR=6]="LOGICAL_OR",e[e.LOGICAL_AND=7]="LOGICAL_AND",e[e.BITWISE_OR=8]="BITWISE_OR",e[e.BITWISE_XOR=9]="BITWISE_XOR",e[e.BITWISE_AND=10]="BITWISE_AND",e[e.EQUALITY=11]="EQUALITY",e[e.RELATIONAL=12]="RELATIONAL",e[e.SHIFT=13]="SHIFT",e[e.ADDITIVE=14]="ADDITIVE",e[e.MULTIPLICATIVE=15]="MULTIPLICATIVE",e[e.EXPONENTIATED=16]="EXPONENTIATED",e[e.UNARY_PREFIX=17]="UNARY_PREFIX",e[e.UNARY_POSTFIX=18]="UNARY_POSTFIX",e[e.CALL=19]="CALL",e[e.MEMBERACCESS=20]="MEMBERACCESS",e[e.GROUPING=21]="GROUPING"}(t.Precedence||(t.Precedence={}))},function(e,t,r){r(16),e.exports=r(30)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(17),r(19),r(20),r(21);var n=r(3);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(18);for(var n in e.binaryen=t,t)(n.startsWith("_Binaryen")||n.startsWith("_Relooper"))&&(e[n]=t[n]);e.__memory_allocate=t._malloc,e.__memory_free=t._free,e.__memory_copy=t._memmove,e.__store=function(e,r){t.HEAPU8[e]=r},e.__load=function(e){return t.HEAPU8[e]}}).call(this,r(8))},function(t,r){t.exports=e},function(e,t,r){(function(e){var t="undefined"!=typeof window&&window||void 0!==e&&e||self;t.ASC_TARGET=0,t.ASC_NO_TREESHAKING=!1,t.ASC_NO_ASSERT=!1,t.ASC_MEMORY_BASE=0,t.ASC_OPTIMIZE_LEVEL=3,t.ASC_SHRINK_LEVEL=0,t.ASC_FEATURE_MUTABLE_GLOBAL=!1,t.ASC_FEATURE_SIGN_EXTENSION=!1,t.ASC_FEATURE_BULK_MEMORY=!1,t.ASC_FEATURE_SIMD=!1,t.ASC_FEATURE_THREADS=!1;var r=new Float64Array(1),n=new Uint32Array(r.buffer);function i(){Error.captureStackTrace?Error.captureStackTrace(this,i):this.stack=this.name+": "+this.message+"\n"+(new Error).stack}function a(e){this.message=e||"assertion failed",Error.captureStackTrace?Error.captureStackTrace(this,a):this.stack=this.name+": "+this.message+"\n"+(new Error).stack}Object.defineProperties(t.i8=function(e){return e<<24>>24},{MIN_VALUE:{value:-128,writable:!1},MAX_VALUE:{value:127,writable:!1}}),Object.defineProperties(t.i16=function(e){return e<<16>>16},{MIN_VALUE:{value:-32768,writable:!1},MAX_VALUE:{value:32767,writable:!1}}),Object.defineProperties(t.i32=t.isize=function(e){return 0|e},{MIN_VALUE:{value:-2147483648,writable:!1},MAX_VALUE:{value:2147483647,writable:!1}}),Object.defineProperties(t.u8=function(e){return 255&e},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:255,writable:!1}}),Object.defineProperties(t.u16=function(e){return 65535&e},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:65535,writable:!1}}),Object.defineProperties(t.u32=t.usize=function(e){return e>>>0},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:4294967295,writable:!1}}),Object.defineProperties(t.bool=function(e){return!!e},{MIN_VALUE:{value:!1,writable:!1},MAX_VALUE:{value:!0,writable:!1}}),Object.defineProperties(t.f32=function(e){return Math.fround(e)},{EPSILON:{value:Math.fround(1.1920929e-7),writable:!1},MIN_VALUE:{value:Math.fround(1.4012985e-45),writable:!1},MAX_VALUE:{value:Math.fround(3.4028235e38),writable:!1},MIN_NORMAL_VALUE:{value:Math.fround(1.17549435e-38),writable:!1},MIN_SAFE_INTEGER:{value:-16777215,writable:!1},MAX_SAFE_INTEGER:{value:16777215,writable:!1}}),Object.defineProperties(t.f64=function(e){return+e},{EPSILON:{value:2.220446049250313e-16,writable:!1},MIN_VALUE:{value:5e-324,writable:!1},MAX_VALUE:{value:1.7976931348623157e308,writable:!1},MIN_NORMAL_VALUE:{value:2.2250738585072014e-308,writable:!1},MIN_SAFE_INTEGER:{value:-9007199254740991,writable:!1},MAX_SAFE_INTEGER:{value:9007199254740991,writable:!1}}),t.clz=Math.clz32,t.ctz=function(e){var t=Math.clz32(e&-e);return e?31-t:t},t.popcnt=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},t.rotl=function(e,t){return e<<(t&=31)|e>>>32-t},t.rotr=function(e,t){return e>>>(t&=31)|e<<32-t},t.abs=Math.abs,t.max=Math.max,t.min=Math.min,t.ceil=Math.ceil,t.floor=Math.floor,t.nearest=function(e){return.5===Math.abs(e-Math.trunc(e))?2*Math.round(.5*e):Math.round(e)},t.select=function(e,t,r){return r?e:t},t.sqrt=Math.sqrt,t.trunc=Math.trunc,t.copysign=function(e,t){return Math.abs(e)*Math.sign(t)},t.bswap=function(e){var t=e>>8&16711935,r=(16711935&e)<<8;return(t=(e=t|r)>>16&65535)|(r=(65535&e)<<16)},t.bswap16=function(e){return e<<8&65280|e>>8&255|4294901760&e},i.prototype=Object.create(Error.prototype),i.prototype.name="UnreachableError",i.prototype.message="unreachable",t.unreachable=function(){throw new i},a.prototype=Object.create(Error.prototype),a.prototype.name="AssertionError",t.assert=function(e,t){if(e)return e;throw new a(t)},t.changetype=function(e){return e},t.parseI32=function(e,t){return 0|parseInt(e,void 0)},String.fromCharCodes=function(e){return String.fromCharCode.apply(String,e)},String.fromCodePoints=function(e){return String.fromCodePoint.apply(String,e)},t.isInteger=Number.isInteger,t.isFloat=function(e){return"number"==typeof e},t.isReference=function(e){return"object"==typeof e||"string"==typeof e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isArray=Array.isArray,t.isDefined=function(e){return void 0!==e},t.isConstant=function(e){return!1},t.unchecked=function(e){return e},t.fmod=function(e,t){return e%t},t.fmodf=function(e,t){return Math.fround(e%t)},t.JSMath=Math,t.JSMath.signbit=function(e){return r[0]=e,Boolean(n[1]>>>31&e==e)},t.memory=(()=>{var e=new Uint8Array(0),r=0;return{allocate:t.__memory_allocate||function(t){if(!(t>>>=0))return 0;if(r+t>e.length){var n=e;(e=new Uint8Array(Math.max(65536,e.length+t,2*e.length))).set(n)}var i=r;return 7&(r+=t)&&(r=1+(7|r)),i},fill:t.__memory_fill||function(t,r,n){e.fill(r,t,t+n)},free:t.__memory_free||function(e){},copy:t.__memory_copy||function(t,r,n){e.copyWithin(t,r,r+n)},reset:t.__memory_reset||function(){e=new Uint8Array(0),r=0}}})(),t.store=t.__store||function(e,t,r){HEAP[(0|e)+(0|r)]=t},t.load=t.__load||function(e,t){return HEAP[(0|e)+(0|t)]}}).call(this,r(8))},function(e,t,r){(function(e){const t=new Float64Array(1),r=new Float32Array(t.buffer),n=new Int32Array(t.buffer);e.f32_as_i32=function(e){return r[0]=e,n[0]},e.i32_as_f32=function(e){return n[0]=e,r[0]},e.f64_as_i64=function(e){return t[0]=e,i64_new(n[0],n[1])},e.i64_as_f64=function(e){return n[0]=i64_low(e),n[1]=i64_high(e),t[0]}}).call(this,r(8))},function(e,t,r){(function(e){const t=e.Long||r(22);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:g;if(t){if(e<0)return T;if(e>=d)return A}else{if(e<=-y)return C;if(e+1>=y)return v}return e<0?c(-e,t).neg():l(e%_|0,e/_|0,t)}function l(e,t,r){return new n(e,t,r)}n.fromInt=o,n.fromNumber=c,n.fromBits=l;var p=Math.pow;function u(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||360)throw Error("interior hyphen");if(0===n)return u(e.substring(1),t,r).neg();for(var i=c(p(r,8)),a=g,s=0;s>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*_+(this.low>>>0):this.high*_+(this.low>>>0)},S.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((a=o).isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},S.isOdd=function(){return 1==(1&this.low)},S.isEven=function(){return 0==(1&this.low)},S.equals=function(e){return i(e)||(e=h(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.ne=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.le=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.ge=S.greaterThanOrEqual,S.compare=function(e){if(i(e)||(e=h(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},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(E)},S.neg=S.negate,S.add=function(e){i(e)||(e=h(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,p=0,u=0,_=0,d=0;return _+=(d+=a+(65535&e.low))>>>16,u+=(_+=n+c)>>>16,p+=(u+=r+o)>>>16,p+=t+s,l((_&=65535)<<16|(d&=65535),(p&=65535)<<16|(u&=65535),this.unsigned)},S.subtract=function(e){return i(e)||(e=h(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){if(this.isZero())return g;if(i(e)||(e=h(e)),r)return l(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(C))return e.isOdd()?C:g;if(e.eq(C))return this.isOdd()?C:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return c(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,a=this.low>>>16,s=65535&this.low,o=e.high>>>16,p=65535&e.high,u=e.low>>>16,_=65535&e.low,d=0,y=0,T=0,E=0;return T+=(E+=s*_)>>>16,y+=(T+=a*_)>>>16,T&=65535,y+=(T+=s*u)>>>16,d+=(y+=n*_)>>>16,y&=65535,d+=(y+=a*u)>>>16,y&=65535,d+=(y+=s*p)>>>16,d+=t*_+n*u+a*p+s*o,l((T&=65535)<<16|(E&=65535),(d&=65535)<<16|(y&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(e){if(i(e)||(e=h(e)),e.isZero())throw Error("division by zero");var t,n,a;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?T:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return T;if(e.gt(this.shru(1)))return f;a=T}else{if(this.eq(C))return e.eq(E)||e.eq(I)?C:e.eq(C)?E:(t=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?E:I:(n=this.sub(e.mul(t)),a=t.add(n.div(e)));if(e.eq(C))return this.unsigned?T:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();a=g}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(t)/Math.LN2),o=s<=48?1:p(2,s-48),u=c(t),_=u.mul(e);_.isNegative()||_.gt(n);)_=(u=c(t-=o,this.unsigned)).mul(e);u.isZero()&&(u=E),a=a.add(u),n=n.sub(_)}return a},S.div=S.divide,S.modulo=function(e){return i(e)||(e=h(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))},S.mod=S.modulo,S.rem=S.modulo,S.not=function(){return l(~this.low,~this.high,this.unsigned)},S.and=function(e){return i(e)||(e=h(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return i(e)||(e=h(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return i(e)||(e=h(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},S.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<>>32-e,this.unsigned):l(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.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)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},S.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},S.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]},S.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),a=r(4),s=r(7),o=r(3),c=r(5),l=r(11),p=r(1);function u(e,t,r,n,p,u){var m,g,T,E,f=e.module;switch(t.internalName){case"isInteger":var I=_(e,r,n,u);return e.currentType=s.Type.bool,I?I.is(4)&&!I.is(256)?f.createI32(1):f.createI32(0):f.createUnreachable();case"isFloat":I=_(e,r,n,u);return e.currentType=s.Type.bool,I?I.is(8)?f.createI32(1):f.createI32(0):f.createUnreachable();case"isSigned":I=_(e,r,n,u);return e.currentType=s.Type.bool,I?I.is(1)?f.createI32(1):f.createI32(0):f.createUnreachable();case"isReference":I=_(e,r,n,u);return e.currentType=s.Type.bool,I?I.is(256)?f.createI32(1):f.createI32(0):f.createUnreachable();case"isString":I=_(e,r,n,u);if(e.currentType=s.Type.bool,!I)return f.createUnreachable();if(U=I.classReference){var v=e.program.stringInstance;if(v&&U.isAssignableTo(v))return f.createI32(1)}return f.createI32(0);case"isArray":I=_(e,r,n,u);return e.currentType=s.Type.bool,I?null!==(U=I.classReference)&&U.prototype.extends(e.program.arrayPrototype)?f.createI32(1):f.createI32(0):f.createUnreachable();case"isDefined":if(e.currentType=s.Type.bool,r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),1!=n.length)return e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();var A=e.resolver.resolveExpression(n[0],e.currentFlow,s.Type.void,l.ReportMode.SWALLOW);return f.createI32(A?1:0);case"isConstant":if(e.currentType=s.Type.bool,r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),1!=n.length)return e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();var C=e.compileExpressionRetainType(n[0],s.Type.i32,0);return e.currentType=s.Type.bool,f.createI32(o.getExpressionId(C)==o.ExpressionId.Const?1:0);case"isManaged":if(!e.program.hasGC)return e.currentType=s.Type.bool,f.createI32(0);I=_(e,r,n,u);return e.currentType=s.Type.bool,I?null===(U=I.classReference)||U.hasDecorator(c.DecoratorFlags.UNMANAGED)?f.createI32(0):f.createI32(1):f.createUnreachable();case"clz":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,1)}else m=e.compileExpression(n[0],s.Type.i32,0,1);switch(e.currentType.kind){case 0:case 1:case 5:case 6:E=f.createUnary(o.UnaryOp.ClzI32,m);break;case 10:case 2:case 7:E=f.createUnary(o.UnaryOp.ClzI32,m);break;case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}case 4:E=f.createUnary(e.options.isWasm64?o.UnaryOp.ClzI64:o.UnaryOp.ClzI32,m);break;case 3:case 8:E=f.createUnary(o.UnaryOp.ClzI64,m);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"ctz":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],0,1)}else m=e.compileExpression(n[0],s.Type.i32,0,1);switch(e.currentType.kind){case 0:case 1:case 5:case 6:E=f.createUnary(o.UnaryOp.CtzI32,m);break;case 10:case 2:case 7:E=f.createUnary(o.UnaryOp.CtzI32,m);break;case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}case 4:E=f.createUnary(e.options.isWasm64?o.UnaryOp.CtzI64:o.UnaryOp.CtzI32,m);break;case 3:case 8:E=f.createUnary(o.UnaryOp.CtzI64,m);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"popcnt":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,1)}else m=e.compileExpression(n[0],s.Type.i32,0,1);switch(e.currentType.kind){case 0:case 1:case 5:case 6:E=f.createUnary(o.UnaryOp.PopcntI32,m);break;case 10:case 2:case 7:E=f.createUnary(o.UnaryOp.PopcntI32,m);break;case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}case 4:E=f.createUnary(e.options.isWasm64?o.UnaryOp.PopcntI64:o.UnaryOp.PopcntI32,m);break;case 3:case 8:E=f.createUnary(o.UnaryOp.PopcntI64,m);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"rotl":if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"2",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,1)}else m=e.compileExpression(n[0],s.Type.i32,0,1);switch(g=e.compileExpression(n[1],e.currentType,1,0),e.currentType.kind){case 0:case 1:case 5:case 6:case 10:E=e.ensureSmallIntegerWrap(f.createBinary(o.BinaryOp.RotlI32,m,g),e.currentType);case 2:case 7:E=f.createBinary(o.BinaryOp.RotlI32,m,g);break;case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}case 4:E=f.createBinary(e.options.isWasm64?o.BinaryOp.RotlI64:o.BinaryOp.RotlI32,m,g);break;case 3:case 8:E=f.createBinary(o.BinaryOp.RotlI64,m,g);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"rotr":if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"2",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,1)}else m=e.compileExpression(n[0],s.Type.i32,0,1);switch(g=e.compileExpression(n[1],e.currentType,1,0),e.currentType.kind){case 0:case 1:case 5:case 6:case 10:E=e.ensureSmallIntegerWrap(f.createBinary(o.BinaryOp.RotrI32,m,g),e.currentType);break;case 2:case 7:E=f.createBinary(o.BinaryOp.RotrI32,m,g);break;case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}case 4:E=f.createBinary(e.options.isWasm64?o.BinaryOp.RotrI64:o.BinaryOp.RotrI32,m,g);break;case 3:case 8:E=f.createBinary(o.BinaryOp.RotrI64,m,g);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"abs":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,1)}else m=e.compileExpression(n[0],s.Type.f64,0,1);switch(e.currentType.kind){case 0:case 1:case 2:var S=(b=e.currentFlow).getTempLocal(s.Type.i32,!1),N=b.getAndFreeTempLocal(s.Type.i32,!1).index,O=S.index;E=f.createBinary(o.BinaryOp.XorI32,f.createBinary(o.BinaryOp.AddI32,f.createTeeLocal(N,f.createBinary(o.BinaryOp.ShrI32,f.createTeeLocal(O,m),f.createI32(31))),f.createGetLocal(O,o.NativeType.I32)),f.createGetLocal(N,o.NativeType.I32)),b.freeTempLocal(S);break;case 4:var x=e.options,b=e.currentFlow,L=x.isWasm64;S=b.getTempLocal(x.usizeType,!1),N=b.getAndFreeTempLocal(x.usizeType,!1).index,O=S.index;E=f.createBinary(L?o.BinaryOp.XorI64:o.BinaryOp.XorI32,f.createBinary(L?o.BinaryOp.AddI64:o.BinaryOp.AddI32,f.createTeeLocal(N,f.createBinary(L?o.BinaryOp.ShrI64:o.BinaryOp.ShrI32,f.createTeeLocal(O,m),L?f.createI64(63):f.createI32(31))),f.createGetLocal(O,x.nativeSizeType)),f.createGetLocal(N,x.nativeSizeType)),b.freeTempLocal(S);break;case 3:S=(b=e.currentFlow).getTempLocal(s.Type.i64,!1),N=b.getAndFreeTempLocal(s.Type.i64,!1).index,O=S.index;E=f.createBinary(o.BinaryOp.XorI64,f.createBinary(o.BinaryOp.AddI64,f.createTeeLocal(N,f.createBinary(o.BinaryOp.ShrI64,f.createTeeLocal(O,m),f.createI64(63))),f.createGetLocal(O,o.NativeType.I64)),f.createGetLocal(N,o.NativeType.I64)),b.freeTempLocal(S);break;case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}case 5:case 6:case 7:case 8:case 10:E=m;break;case 11:E=f.createUnary(o.UnaryOp.AbsF32,m);break;case 12:E=f.createUnary(o.UnaryOp.AbsF64,m);break;case 14:E=f.createUnreachable();break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"max":if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"2",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,1)}else m=e.compileExpression(n[0],s.Type.f64,0,1);switch(g=e.compileExpression(n[1],e.currentType,1,1),e.currentType.kind){case 0:case 1:case 2:var k=(b=e.currentFlow).getTempLocal(e.currentType,!b.canOverflow(m,e.currentType));S=b.getAndFreeTempLocal(e.currentType,!b.canOverflow(g,e.currentType));b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(o.BinaryOp.GtI32,f.createGetLocal(k.index,o.NativeType.I32),f.createGetLocal(S.index,o.NativeType.I32)));break;case 5:case 6:case 7:case 10:k=(b=e.currentFlow).getTempLocal(e.currentType,!b.canOverflow(m,e.currentType)),S=b.getAndFreeTempLocal(e.currentType,!b.canOverflow(g,e.currentType));b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(o.BinaryOp.GtU32,f.createGetLocal(k.index,o.NativeType.I32),f.createGetLocal(S.index,o.NativeType.I32)));break;case 3:k=(b=e.currentFlow).getTempLocal(s.Type.i64,!1),S=b.getAndFreeTempLocal(s.Type.i64,!1);b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(o.BinaryOp.GtI64,f.createGetLocal(k.index,o.NativeType.I64),f.createGetLocal(S.index,o.NativeType.I64)));break;case 8:k=(b=e.currentFlow).getTempLocal(s.Type.i64,!1),S=b.getAndFreeTempLocal(s.Type.i64,!1);b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(o.BinaryOp.GtU64,f.createGetLocal(k.index,o.NativeType.I64),f.createGetLocal(S.index,o.NativeType.I64)));break;case 4:k=(b=e.currentFlow).getTempLocal(e.options.usizeType,!1),S=b.getAndFreeTempLocal(e.options.usizeType,!1);b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(e.options.isWasm64?o.BinaryOp.GtI64:o.BinaryOp.GtI32,f.createGetLocal(k.index,e.options.nativeSizeType),f.createGetLocal(S.index,e.options.nativeSizeType)));break;case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}k=(b=e.currentFlow).getTempLocal(e.options.usizeType,!1),S=b.getAndFreeTempLocal(e.options.usizeType,!1);b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(e.options.isWasm64?o.BinaryOp.GtU64:o.BinaryOp.GtU32,f.createGetLocal(k.index,e.options.nativeSizeType),f.createGetLocal(S.index,e.options.nativeSizeType)));break;case 11:E=f.createBinary(o.BinaryOp.MaxF32,m,g);break;case 12:E=f.createBinary(o.BinaryOp.MaxF64,m,g);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"min":if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"2",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,1)}else m=e.compileExpression(n[0],s.Type.f64,0,1);switch(g=e.compileExpression(n[1],e.currentType,1,1),e.currentType.kind){case 0:case 1:case 2:k=(b=e.currentFlow).getTempLocal(e.currentType,!b.canOverflow(m,e.currentType)),S=b.getAndFreeTempLocal(e.currentType,!b.canOverflow(g,e.currentType));b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(o.BinaryOp.LtI32,f.createGetLocal(k.index,o.NativeType.I32),f.createGetLocal(S.index,o.NativeType.I32)));break;case 5:case 6:case 7:case 10:k=(b=e.currentFlow).getTempLocal(e.currentType,!b.canOverflow(m,e.currentType)),S=b.getAndFreeTempLocal(e.currentType,!b.canOverflow(g,e.currentType));b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(o.BinaryOp.LtU32,f.createGetLocal(k.index,o.NativeType.I32),f.createGetLocal(S.index,o.NativeType.I32)));break;case 3:k=(b=e.currentFlow).getTempLocal(s.Type.i64,!1),S=b.getAndFreeTempLocal(s.Type.i64,!1);b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(o.BinaryOp.LtI64,f.createGetLocal(k.index,o.NativeType.I64),f.createGetLocal(S.index,o.NativeType.I64)));break;case 8:k=(b=e.currentFlow).getTempLocal(s.Type.i64,!1),S=b.getAndFreeTempLocal(s.Type.i64,!1);b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(o.BinaryOp.LtU64,f.createGetLocal(k.index,o.NativeType.I64),f.createGetLocal(S.index,o.NativeType.I64)));break;case 4:k=(b=e.currentFlow).getTempLocal(e.options.usizeType,!1),S=b.getAndFreeTempLocal(e.options.usizeType,!1);b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(e.options.isWasm64?o.BinaryOp.LtI64:o.BinaryOp.LtI32,f.createGetLocal(k.index,e.options.nativeSizeType),f.createGetLocal(S.index,e.options.nativeSizeType)));break;case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}k=(b=e.currentFlow).getTempLocal(e.options.usizeType,!1),S=b.getAndFreeTempLocal(e.options.usizeType,!1);b.freeTempLocal(k),E=f.createSelect(f.createTeeLocal(k.index,m),f.createTeeLocal(S.index,g),f.createBinary(e.options.isWasm64?o.BinaryOp.LtU64:o.BinaryOp.LtU32,f.createGetLocal(k.index,e.options.nativeSizeType),f.createGetLocal(S.index,e.options.nativeSizeType)));break;case 11:E=f.createBinary(o.BinaryOp.MinF32,m,g);break;case 12:E=f.createBinary(o.BinaryOp.MinF64,m,g);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"ceil":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,0)}else m=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}default:E=m;break;case 11:E=f.createUnary(o.UnaryOp.CeilF32,m);break;case 12:E=f.createUnary(o.UnaryOp.CeilF64,m);break;case 14:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"floor":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,0)}else m=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}default:E=m;break;case 11:E=f.createUnary(o.UnaryOp.FloorF32,m);break;case 12:E=f.createUnary(o.UnaryOp.FloorF64,m);break;case 14:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"copysign":if(2!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"2",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,0)}else m=e.compileExpression(n[0],s.Type.f64,0,0);switch(g=e.compileExpression(n[1],e.currentType,1,0),e.currentType.kind){case 11:E=f.createBinary(o.BinaryOp.CopysignF32,m,g);break;case 12:E=f.createBinary(o.BinaryOp.CopysignF64,m,g);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"nearest":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,0)}else m=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}default:E=m;break;case 11:E=f.createUnary(o.UnaryOp.NearestF32,m);break;case 12:E=f.createUnary(o.UnaryOp.NearestF64,m);break;case 14:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"reinterpret":if(1!=n.length)return r&&1==r.length||(r&&r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0")),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(!r||1!=r.length)return r&&r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable();switch(r[0].kind){case 2:case 7:m=e.compileExpression(n[0],s.Type.f32,1,0),E=f.createUnary(o.UnaryOp.ReinterpretF32,m);break;case 3:case 8:m=e.compileExpression(n[0],s.Type.f64,1,0),E=f.createUnary(o.UnaryOp.ReinterpretF64,m);break;case 9:if(r[0].is(256))return e.error(i.DiagnosticCode.Operation_not_supported,u.range),e.currentType=r[0],f.createUnreachable();case 4:m=e.compileExpression(n[0],e.options.isWasm64?s.Type.f64:s.Type.f32,1,0),E=f.createUnary(e.options.isWasm64?o.UnaryOp.ReinterpretF64:o.UnaryOp.ReinterpretF32,m);break;case 11:m=e.compileExpression(n[0],s.Type.i32,1,0),E=f.createUnary(o.UnaryOp.ReinterpretI32,m);break;case 12:m=e.compileExpression(n[0],s.Type.i64,1,0),E=f.createUnary(o.UnaryOp.ReinterpretI64,m);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return e.currentType=r[0],E;case"sqrt":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,0)}else m=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 11:E=f.createUnary(o.UnaryOp.SqrtF32,m);break;case 12:E=f.createUnary(o.UnaryOp.SqrtF64,m);break;default:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"trunc":if(1!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(r&&r.length){if(e.currentType=r[0],1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,0)}else m=e.compileExpression(n[0],s.Type.f64,0,0);switch(e.currentType.kind){case 9:if(e.currentType.is(256)){e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable();break}default:E=m;break;case 11:E=f.createUnary(o.UnaryOp.TruncF32,m);break;case 12:E=f.createUnary(o.UnaryOp.TruncF64,m);break;case 14:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"load":return n.length<1||n.length>2?(r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),n.length<1?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,u.range,"1",n.length.toString(10)):e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"2",n.length.toString(10)),f.createUnreachable()):r&&1==r.length?(m=e.compileExpression(n[0],e.options.usizeType,1,0),(P=2==n.length?d(e,n[1]):0)<0?f.createUnreachable():(e.currentType=r[0],f.createLoad(r[0].byteSize,r[0].is(5),m,r[0].is(4)&&p.is(4)&&p.size>r[0].size?(e.currentType=p).toNativeType():(e.currentType=r[0]).toNativeType(),P))):(r&&r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable());case"store":if(e.currentType=s.Type.void,n.length<2||n.length>3)return r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),n.length<2?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,u.range,"2",n.length.toString(10)):e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"3",n.length.toString(10)),f.createUnreachable();if(!r||1!=r.length)return e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable();m=e.compileExpression(n[0],e.options.usizeType,1,0),g=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0);I=void 0;return r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size2?(r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),n.length<1?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,u.range,"1",n.length.toString(10)):e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"2",n.length.toString(10)),f.createUnreachable()):r&&1==r.length?(m=e.compileExpression(n[0],e.options.usizeType,1,0),(P=2==n.length?d(e,n[1]):0)<0?f.createUnreachable():(e.currentType=r[0],f.createAtomicLoad(r[0].byteSize,m,r[0].is(4)&&p.is(4)&&p.size>r[0].size?(e.currentType=p).toNativeType():(e.currentType=r[0]).toNativeType(),P))):(r&&r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable());case"atomic.store":if(!e.options.hasFeature(16))break;if(e.currentType=s.Type.void,n.length<2||n.length>3)return r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),n.length<2?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,u.range,"2",n.length.toString(10)):e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"3",n.length.toString(10)),f.createUnreachable();if(!r||1!=r.length)return e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable();m=e.compileExpression(n[0],e.options.usizeType,1,0),g=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0);I=void 0;return r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size3)return r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),n.length<2?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,u.range,"2",n.length.toString(10)):e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"3",n.length.toString(10)),f.createUnreachable();if(!r||1!=r.length)return e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable();m=e.compileExpression(n[0],e.options.usizeType,1,0),g=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0);I=void 0;if(r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size4)return r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),n.length<3?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,u.range,"2",n.length.toString(10)):e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"3",n.length.toString(10)),f.createUnreachable();if(!r||1!=r.length)return e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable();m=e.compileExpression(n[0],e.options.usizeType,1,0),g=e.compileExpression(n[1],r[0],r[0].is(4)?0:1,0),T=e.compileExpression(n[2],r[0],r[0].is(4)?0:1,0);I=void 0;return r[0].is(4)&&(!e.currentType.is(4)||e.currentType.size1)return r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();if(!r||1!=r.length)return e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable();var U;if(!(U=r[0].classReference))return e.error(i.DiagnosticCode.Operation_not_supported,u.range),f.createUnreachable();var P=void 0;if(n.length){if(n[0].kind!=a.NodeKind.LITERAL||n[0].literalKind!=a.LiteralKind.STRING)return e.error(i.DiagnosticCode.String_literal_expected,n[0].range),f.createUnreachable();var w=n[0].value,M=U.members?U.members.get(w):null;if(!M||M.kind!=c.ElementKind.FIELD)return e.error(i.DiagnosticCode.Type_0_has_no_property_1,n[0].range,U.internalName,w),f.createUnreachable();P=M.memoryOffset}else P=U.currentMemoryOffset;return e.options.isWasm64?p.is(4)&&p.size<=32?(e.currentType=s.Type.u32,f.createI32(P)):f.createI64(P):p.is(4)&&64==p.size?(e.currentType=s.Type.u64,f.createI64(P)):f.createI32(P);case"select":if(3!=n.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"3",n.length.toString(10)),f.createUnreachable();if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,0)}else m=e.compileExpressionRetainType(n[0],s.Type.i32,0);I=e.currentType;switch(g=e.compileExpression(n[1],I,1,0),T=e.makeIsTrueish(e.compileExpressionRetainType(n[2],s.Type.bool,0),e.currentType),e.currentType=I,e.currentType.kind){case 0:case 1:case 5:case 6:case 10:default:E=f.createSelect(m,g,T);break;case 14:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=f.createUnreachable()}return E;case"unreachable":return 0!=n.length&&e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"0",n.length.toString(10)),r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),f.createUnreachable();case"memory.size":return e.currentType=s.Type.i32,0!=n.length&&e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"0",n.length.toString(10)),r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),f.createHost(o.HostOp.CurrentMemory);case"memory.grow":return e.currentType=s.Type.i32,1!=n.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"0",n.length.toString(10)),m=f.createUnreachable()):m=e.compileExpression(n[0],s.Type.i32,1,0),r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),f.createHost(o.HostOp.GrowMemory,null,[m]);case"memory.copy":if(!e.options.hasFeature(4)){var G=e.resolver.resolveFunction(t,null);return e.currentType=s.Type.void,G?e.compileCallDirect(G,n,u):f.createUnreachable()}if(r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),3!=n.length)return e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"3",n.length.toString(10)),e.currentType=s.Type.void,f.createUnreachable();var V=e.options.usizeType;return m=e.compileExpression(n[0],V,1,0),g=e.compileExpression(n[1],V,1,0),T=e.compileExpression(n[2],V,1,0),e.currentType=s.Type.void,f.createMemoryCopy(m,g,T);case"memory.fill":if(!e.options.hasFeature(4)){G=e.resolver.resolveFunction(t,null);return e.currentType=s.Type.void,G?e.compileCallDirect(G,n,u):f.createUnreachable()}if(r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),3!=n.length)return e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"3",n.length.toString(10)),e.currentType=s.Type.void,f.createUnreachable();V=e.options.usizeType;return m=e.compileExpression(n[0],V,1,0),g=e.compileExpression(n[1],s.Type.u32,1,0),T=e.compileExpression(n[2],V,1,0),e.currentType=s.Type.void,f.createMemoryFill(m,g,T);case"changetype":return r&&1==r.length?1!=n.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),e.currentType=r[0],f.createUnreachable()):(m=e.compileExpressionRetainType(n[0],r[0],0),e.currentType=r[0],e.currentType.size!=r[0].size?(e.error(i.DiagnosticCode.Operation_not_supported,u.range),f.createUnreachable()):m):(r&&r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r?r.length.toString(10):"0"),f.createUnreachable());case"assert":if(n.length<1||n.length>2)return r&&(r.length&&(e.currentType=r[0].nonNullableType),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),n.length<1?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,u.range,"1",n.length.toString(10)):n.length>2&&e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"2",n.length.toString(10)),f.createUnreachable();if(r){if(r.length&&(e.currentType=r[0].nonNullableType),1!=r.length)return e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();m=e.compileExpression(n[0],r[0],1,1)}else m=e.compileExpressionRetainType(n[0],s.Type.bool,1);I=e.currentType;if(e.currentType=I.nonNullableType,e.options.noAssert)return p==s.Type.void?(e.currentType=s.Type.void,f.createNop()):m;var K=y(e,2==n.length?n[1]:null,u);if(e.currentType=I.nonNullableType,p==s.Type.void){switch(e.currentType.kind){default:E=f.createIf(f.createUnary(o.UnaryOp.EqzI32,m),K);break;case 3:case 8:E=f.createIf(f.createUnary(o.UnaryOp.EqzI64,m),K);break;case 4:case 9:E=f.createIf(f.createUnary(e.options.isWasm64?o.UnaryOp.EqzI64:o.UnaryOp.EqzI32,m),K);break;case 11:E=f.createIf(f.createBinary(o.BinaryOp.EqF32,m,f.createF32(0)),K);break;case 12:E=f.createIf(f.createBinary(o.BinaryOp.EqF64,m,f.createF64(0)),K);break;case 14:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=K}e.currentType=s.Type.void}else switch(e.currentType.kind){case 0:case 1:case 5:case 6:case 10:var z=(b=e.currentFlow).getAndFreeTempLocal(e.currentType,!b.canOverflow(m,e.currentType));E=f.createIf(f.createTeeLocal(z.index,m),f.createGetLocal(z.index,o.NativeType.I32),K);break;case 2:case 7:default:z=e.currentFlow.getAndFreeTempLocal(s.Type.i32,!1);E=f.createIf(f.createTeeLocal(z.index,m),f.createGetLocal(z.index,o.NativeType.I32),K);break;case 3:case 8:z=e.currentFlow.getAndFreeTempLocal(s.Type.i64,!1);E=f.createIf(f.createUnary(o.UnaryOp.EqzI64,f.createTeeLocal(z.index,m)),K,f.createGetLocal(z.index,o.NativeType.I64));break;case 4:case 9:z=e.currentFlow.getAndFreeTempLocal(e.options.usizeType,!1);E=f.createIf(f.createUnary(e.options.isWasm64?o.UnaryOp.EqzI64:o.UnaryOp.EqzI32,f.createTeeLocal(z.index,m)),K,f.createGetLocal(z.index,e.options.nativeSizeType));break;case 11:z=e.currentFlow.getAndFreeTempLocal(s.Type.f32,!1);E=f.createIf(f.createBinary(o.BinaryOp.EqF32,f.createTeeLocal(z.index,m),f.createF32(0)),K,f.createGetLocal(z.index,o.NativeType.F32));break;case 12:z=e.currentFlow.getAndFreeTempLocal(s.Type.f64,!1);E=f.createIf(f.createBinary(o.BinaryOp.EqF64,f.createTeeLocal(z.index,m),f.createF64(0)),K,f.createGetLocal(z.index,o.NativeType.F64));break;case 14:e.error(i.DiagnosticCode.Operation_not_supported,u.range),E=K}return E;case"unchecked":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),1!=n.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable()):((b=e.currentFlow).set(8192),E=e.compileExpressionRetainType(n[0],p,0),b.unset(8192),E);case"call_indirect":if(n.length<1)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,u.range,"1",n.length.toString(10)),f.createUnreachable();var H=void 0;if(r){if(1!=r.length)return r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,u.range,"1",r.length.toString(10)),f.createUnreachable();H=r[0]}else H=p;if(m=e.compileExpressionRetainType(n[0],s.Type.u32,0),7!=e.currentType.kind)return e.error(i.DiagnosticCode.Operation_not_supported,n[0].range),f.createUnreachable();for(var X=n.length-1,W=new Array(X),Y=new Array(X+1),Q=H.toNativeType(),q=new Array(X),j=0;j void"),f.createUnreachable())}var ne=function(e,t,r,n,i){switch(t.internalName){case"i32.clz":return h("clz",e,s.Type.i32,r,s.Type.i32,i);case"i64.clz":return h("clz",e,s.Type.i64,r,s.Type.i64,i);case"i32.ctz":return h("ctz",e,s.Type.i32,r,s.Type.i32,i);case"i64.ctz":return h("ctz",e,s.Type.i64,r,s.Type.i64,i);case"i32.popcnt":return h("popcnt",e,s.Type.i32,r,s.Type.i32,i);case"i64.popcnt":return h("popcnt",e,s.Type.i64,r,s.Type.i64,i);case"i32.rotl":return h("rotl",e,s.Type.i32,r,s.Type.i32,i);case"i64.rotl":return h("rotl",e,s.Type.i64,r,s.Type.i64,i);case"i32.rotr":return h("rotr",e,s.Type.i32,r,s.Type.i32,i);case"i64.rotr":return h("rotr",e,s.Type.i64,r,s.Type.i64,i);case"f32.abs":return h("abs",e,s.Type.f32,r,s.Type.f32,i);case"f64.abs":return h("abs",e,s.Type.f64,r,s.Type.f64,i);case"f32.max":return h("max",e,s.Type.f32,r,s.Type.f32,i);case"f64.max":return h("max",e,s.Type.f64,r,s.Type.f64,i);case"f32.min":return h("min",e,s.Type.f32,r,s.Type.f32,i);case"f64.min":return h("min",e,s.Type.f64,r,s.Type.f64,i);case"f32.ceil":return h("ceil",e,s.Type.f32,r,s.Type.f32,i);case"f64.ceil":return h("ceil",e,s.Type.f64,r,s.Type.f64,i);case"f32.floor":return h("floor",e,s.Type.f32,r,s.Type.f32,i);case"f64.floor":return h("floor",e,s.Type.f64,r,s.Type.f64,i);case"f32.copysign":return h("copysign",e,s.Type.f32,r,s.Type.f32,i);case"f64.copysign":return h("copysign",e,s.Type.f64,r,s.Type.f64,i);case"f32.nearest":return h("nearest",e,s.Type.f32,r,s.Type.f32,i);case"f64.nearest":return h("nearest",e,s.Type.f64,r,s.Type.f64,i);case"i32.reinterpret_f32":return h("reinterpret",e,s.Type.i32,r,s.Type.f32,i);case"i64.reinterpret_f64":return h("reinterpret",e,s.Type.i64,r,s.Type.f64,i);case"f32.reinterpret_i32":return h("reinterpret",e,s.Type.f32,r,s.Type.i32,i);case"f64.reinterpret_i64":return h("reinterpret",e,s.Type.f64,r,s.Type.i64,i);case"f32.sqrt":return h("sqrt",e,s.Type.f32,r,s.Type.f32,i);case"f64.sqrt":return h("sqrt",e,s.Type.f64,r,s.Type.f64,i);case"f32.trunc":return h("trunc",e,s.Type.f32,r,s.Type.f32,i);case"f64.trunc":return h("trunc",e,s.Type.f64,r,s.Type.f64,i);case"i32.load8_s":return h("load",e,s.Type.i8,r,s.Type.i32,i);case"i32.load8_u":return h("load",e,s.Type.u8,r,s.Type.u32,i);case"i32.load16_s":return h("load",e,s.Type.i16,r,s.Type.i32,i);case"i32.load16_u":return h("load",e,s.Type.u16,r,s.Type.u32,i);case"i32.load":return h("load",e,s.Type.i32,r,s.Type.i32,i);case"i64.load8_s":return h("load",e,s.Type.i8,r,s.Type.i64,i);case"i64.load8_u":return h("load",e,s.Type.u8,r,s.Type.u64,i);case"i64.load16_s":return h("load",e,s.Type.i16,r,s.Type.i64,i);case"i64.load16_u":return h("load",e,s.Type.u16,r,s.Type.u64,i);case"i64.load32_s":return h("load",e,s.Type.i32,r,s.Type.i64,i);case"i64.load32_u":return h("load",e,s.Type.u32,r,s.Type.u64,i);case"i64.load":return h("load",e,s.Type.i64,r,s.Type.i64,i);case"f32.load":return h("load",e,s.Type.f32,r,s.Type.f32,i);case"f64.load":return h("load",e,s.Type.f64,r,s.Type.f64,i);case"i32.store8":return h("store",e,s.Type.i8,r,s.Type.i32,i);case"i32.store16":return h("store",e,s.Type.i16,r,s.Type.i32,i);case"i32.store":return h("store",e,s.Type.i32,r,s.Type.i32,i);case"i64.store8":return h("store",e,s.Type.i8,r,s.Type.i64,i);case"i64.store16":return h("store",e,s.Type.i16,r,s.Type.i64,i);case"i64.store32":return h("store",e,s.Type.i32,r,s.Type.i64,i);case"i64.store":return h("store",e,s.Type.i64,r,s.Type.i64,i);case"f32.store":return h("store",e,s.Type.f32,r,s.Type.f32,i);case"f64.store":return h("store",e,s.Type.f64,r,s.Type.f64,i)}if(e.options.hasFeature(16))switch(t.internalName){case"i32.atomic.load8_u":return h("atomic.load",e,s.Type.u8,r,s.Type.u32,i);case"i32.atomic.load16_u":return h("atomic.load",e,s.Type.u16,r,s.Type.u32,i);case"i32.atomic.load":return h("atomic.load",e,s.Type.i32,r,s.Type.i32,i);case"i64.atomic.load8_u":return h("atomic.load",e,s.Type.u8,r,s.Type.u64,i);case"i64.atomic.load16_u":return h("atomic.load",e,s.Type.u16,r,s.Type.u64,i);case"i64.atomic.load32_u":return h("atomic.load",e,s.Type.u32,r,s.Type.u64,i);case"i64.atomic.load":return h("atomic.load",e,s.Type.i64,r,s.Type.i64,i);case"i32.atomic.store8":return h("atomic.store",e,s.Type.i8,r,s.Type.i32,i);case"i32.atomic.store16":return h("atomic.store",e,s.Type.i16,r,s.Type.i32,i);case"i32.atomic.store":return h("atomic.store",e,s.Type.i32,r,s.Type.i32,i);case"i64.atomic.store8":return h("atomic.store",e,s.Type.i8,r,s.Type.i64,i);case"i64.atomic.store16":return h("atomic.store",e,s.Type.i16,r,s.Type.i64,i);case"i64.atomic.store32":return h("atomic.store",e,s.Type.i32,r,s.Type.i64,i);case"i64.atomic.store":return h("atomic.store",e,s.Type.i64,r,s.Type.i64,i);case"i32.atomic.rmw8_u.add":return h("atomic.add",e,s.Type.u8,r,s.Type.u32,i);case"i32.atomic.rmw16_u.add":return h("atomic.add",e,s.Type.u16,r,s.Type.u32,i);case"i32.atomic.rmw.add":return h("atomic.add",e,s.Type.u32,r,s.Type.u32,i);case"i64.atomic.rmw8_u.add":return h("atomic.add",e,s.Type.u8,r,s.Type.u64,i);case"i64.atomic.rmw16_u.add":return h("atomic.add",e,s.Type.u16,r,s.Type.u64,i);case"i64.atomic.rmw32_u.add":return h("atomic.add",e,s.Type.u32,r,s.Type.u64,i);case"i64.atomic.rmw.add":return h("atomic.add",e,s.Type.u64,r,s.Type.u64,i);case"i32.atomic.rmw8_u.sub":return h("atomic.sub",e,s.Type.u8,r,s.Type.u32,i);case"i32.atomic.rmw16_u.sub":return h("atomic.sub",e,s.Type.u16,r,s.Type.u32,i);case"i32.atomic.rmw.sub":return h("atomic.sub",e,s.Type.u32,r,s.Type.u32,i);case"i64.atomic.rmw8_u.sub":return h("atomic.sub",e,s.Type.u8,r,s.Type.u64,i);case"i64.atomic.rmw16_u.sub":return h("atomic.sub",e,s.Type.u16,r,s.Type.u64,i);case"i64.atomic.rmw32_u.sub":return h("atomic.sub",e,s.Type.u32,r,s.Type.u64,i);case"i64.atomic.rmw.sub":return h("atomic.sub",e,s.Type.u64,r,s.Type.u64,i);case"i32.atomic.rmw8_u.and":return h("atomic.and",e,s.Type.u8,r,s.Type.u32,i);case"i32.atomic.rmw16_u.and":return h("atomic.and",e,s.Type.u16,r,s.Type.u32,i);case"i32.atomic.rmw.and":return h("atomic.and",e,s.Type.u32,r,s.Type.u32,i);case"i64.atomic.rmw8_u.and":return h("atomic.and",e,s.Type.u8,r,s.Type.u64,i);case"i64.atomic.rmw16_u.and":return h("atomic.and",e,s.Type.u16,r,s.Type.u64,i);case"i64.atomic.rmw32_u.and":return h("atomic.and",e,s.Type.u32,r,s.Type.u64,i);case"i64.atomic.rmw.and":return h("atomic.and",e,s.Type.u64,r,s.Type.u64,i);case"i32.atomic.rmw8_u.or":return h("atomic.or",e,s.Type.u8,r,s.Type.u32,i);case"i32.atomic.rmw16_u.or":return h("atomic.or",e,s.Type.u16,r,s.Type.u32,i);case"i32.atomic.rmw.or":return h("atomic.or",e,s.Type.u32,r,s.Type.u32,i);case"i64.atomic.rmw8_u.or":return h("atomic.or",e,s.Type.u8,r,s.Type.u64,i);case"i64.atomic.rmw16_u.or":return h("atomic.or",e,s.Type.u16,r,s.Type.u64,i);case"i64.atomic.rmw32_u.or":return h("atomic.or",e,s.Type.u32,r,s.Type.u64,i);case"i64.atomic.rmw.or":return h("atomic.or",e,s.Type.u64,r,s.Type.u64,i);case"i32.atomic.rmw8_u.xor":case"i32.atomic.rmw16_u.xor":case"i32.atomic.rmw.xor":return h("atomic.xor",e,s.Type.u8,r,s.Type.u32,i);case"i64.atomic.rmw8_u.xor":return h("atomic.xor",e,s.Type.u8,r,s.Type.u64,i);case"i64.atomic.rmw16_u.xor":return h("atomic.xor",e,s.Type.u16,r,s.Type.u64,i);case"i64.atomic.rmw32_u.xor":return h("atomic.xor",e,s.Type.u32,r,s.Type.u64,i);case"i64.atomic.rmw.xor":return h("atomic.xor",e,s.Type.u64,r,s.Type.u64,i);case"i32.atomic.rmw8_u.xchg":case"i32.atomic.rmw16_u.xchg":case"i32.atomic.rmw.xchg":return h("atomic.xchg",e,s.Type.u8,r,s.Type.u32,i);case"i64.atomic.rmw8_u.xchg":return h("atomic.xchg",e,s.Type.u8,r,s.Type.u64,i);case"i64.atomic.rmw16_u.xchg":return h("atomic.xchg",e,s.Type.u16,r,s.Type.u64,i);case"i64.atomic.rmw32_u.xchg":return h("atomic.xchg",e,s.Type.u32,r,s.Type.u64,i);case"i64.atomic.rmw.xchg":return h("atomic.xchg",e,s.Type.u64,r,s.Type.u64,i);case"i32.atomic.rmw8_u.cmpxchg":case"i32.atomic.rmw16_u.cmpxchg":case"i32.atomic.rmw.cmpxchg":return h("atomic.cmpxchg",e,s.Type.u8,r,s.Type.u32,i);case"i64.atomic.rmw8_u.cmpxchg":return h("atomic.cmpxchg",e,s.Type.u8,r,s.Type.u64,i);case"i64.atomic.rmw16_u.cmpxchg":return h("atomic.cmpxchg",e,s.Type.u16,r,s.Type.u64,i);case"i64.atomic.rmw32_u.cmpxchg":return h("atomic.cmpxchg",e,s.Type.u32,r,s.Type.u64,i);case"i64.atomic.rmw.cmpxchg":return h("atomic.cmpxchg",e,s.Type.u64,r,s.Type.u64,i);case"i32.wait":return h("atomic.wait",e,s.Type.i32,r,s.Type.u32,i);case"i64.wait":return h("atomic.wait",e,s.Type.i64,r,s.Type.i64,i);case"i32.notify":return h("atomic.notify",e,s.Type.i32,r,s.Type.u32,i);case"i64.notify":return h("atomic.notify",e,s.Type.i64,r,s.Type.i64,i)}return 0}(e,t,n,0,u);return ne?(r&&r.length&&e.error(i.DiagnosticCode.Type_0_is_not_generic,u.range,t.internalName),ne):(e.error(i.DiagnosticCode.Cannot_find_name_0,u.expression.range,t.internalName),f.createUnreachable())}function h(e,t,r,n,i,a){var s=e.split("."),o=assert(t.program.elementsLookup.get(s[0]));if(s.length>1)for(var l=1;l1&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.range,"1",t.length.toString(10)),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,"1",r.length.toString(10)),null}function d(e,t){var r,n;return e.options.isWasm64?(r=e.precomputeExpression(t,s.Type.usize64,1,0),(o.getExpressionId(r)!=o.ExpressionId.Const||o.getExpressionType(r)!=o.NativeType.I64||0!=o.getConstValueI64High(r)||(n=o.getConstValueI64Low(r))<0)&&(e.error(i.DiagnosticCode.Operation_not_supported,t.range),n=-1)):(r=e.precomputeExpression(t,s.Type.usize32,1,0),(o.getExpressionId(r)!=o.ExpressionId.Const||o.getExpressionType(r)!=o.NativeType.I32||(n=o.getConstValueI32(r))<0)&&(e.error(i.DiagnosticCode.Operation_not_supported,t.range),n=-1)),n}function y(e,t,r){var n=e.program,i=e.module,a=n.typesLookup.get("string");if(!a)return i.createUnreachable();var c=n.abortInstance;if(!c||!e.compileFunction(c))return i.createUnreachable();var l=null!=t?e.compileExpression(t,a,1,0):a.toNativeZero(i),p=e.ensureStaticString(r.range.source.normalizedPath);return e.currentType=s.Type.void,i.createBlock(null,[i.createCall(c.internalName,[l,p,i.createI32(r.range.line),i.createI32(r.range.column)],o.NativeType.None),i.createUnreachable()])}t.compileCall=u,t.compileAbort=y,t.compileIterateRoots=function(e){var t,r,i=e.module,a=new Array;try{for(var l=n(e.program.elementsLookup.values()),u=l.next();!u.done;u=l.next()){var h=u.value;if(h.kind==c.ElementKind.GLOBAL){var _=h,d=_.type.classReference;if(_.is(p.CommonFlags.COMPILED)&&null!==d&&!d.hasDecorator(c.DecoratorFlags.UNMANAGED))if(_.is(p.CommonFlags.INLINED)){var y=_.constantIntegerValue;a.push(i.createCallIndirect(i.createGetLocal(0,o.NativeType.I32),[e.options.isWasm64?i.createI64(i64_low(y),i64_high(y)):i.createI32(i64_low(y))],"i_"))}else a.push(i.createCallIndirect(i.createGetLocal(0,o.NativeType.I32),[i.createGetGlobal(_.internalName,e.options.nativeSizeType)],"i_"))}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}var m=e.ensureFunctionType([s.Type.i32],s.Type.void);i.addFunction("~iterateRoots",m,[],a.length?i.createBlock(null,a):i.createNop())},t.ensureGCHook=function e(t,r){var i,a,l=t.program;assert(r.type.isManaged(l));var u=r.gcHookIndex;if(-1!=u)return u;var h=r.members;if(r.prototype.declaration.range.source.isLibrary&&null!==h&&h.has("__gc")){var _=assert(h.get("__gc"));assert(_.kind==c.ElementKind.FUNCTION_PROTOTYPE);var d=assert(l.resolver.resolveFunction(_,null));assert(d.is(p.CommonFlags.PRIVATE|p.CommonFlags.INSTANCE)),assert(!d.isAny(p.CommonFlags.AMBIENT|p.CommonFlags.VIRTUAL)),assert(0==d.signature.parameterTypes.length),assert(d.signature.returnType==s.Type.void),d.internalName=r.internalName+"~gc",assert(t.compileFunction(d));var y=t.ensureFunctionTableEntry(d);return r.gcHookIndex=y,y}var m=t.module,g=t.options,T=g.nativeSizeType,E=g.usizeType.byteSize,f=new Array;f.push(m.createIf(m.createUnary(g.isWasm64?o.UnaryOp.EqzI64:o.UnaryOp.EqzI32,m.createGetLocal(0,T)),m.createReturn()));var I=t.functionTable,v=I.length;I.push(""),r.gcHookIndex=v;var A=r.base;if(A?(assert(A.type.isManaged(l)),f.push(m.createCallIndirect(m.createI32(e(t,A.type.classReference)),[m.createGetLocal(0,T)],T==o.NativeType.I64?"I_":"i_"))):f.push(m.createCall(assert(l.gcMarkInstance).internalName,[m.createGetLocal(0,T)],o.NativeType.None)),h)try{for(var C=n(h.values()),S=C.next();!S.done;S=C.next()){var N=S.value;if(N.kind==c.ElementKind.FIELD&&N.parent===r&&N.type.isManaged(l)){var O=N.memoryOffset;assert(O>=0),f.push(m.createCall(assert(l.gcMarkInstance).internalName,[m.createLoad(E,!1,m.createGetLocal(0,T),T,O)],o.NativeType.None))}}}catch(e){i={error:e}}finally{try{S&&!S.done&&(a=C.return)&&a.call(C)}finally{if(i)throw i.error}}var x=r.internalName+"~gc";return m.addFunction(x,t.ensureFunctionType(null,s.Type.void,g.usizeType),null,m.createBlock(null,f)),I[v]=x,v}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bitsetIs=function(e,t){return assert(t>=0&&t<64),i64_ne(i64_and(e,i64_shl(i64_one,i64_new(t))),i64_zero)},t.bitsetSet=function(e,t,r){return assert(t>=0&&t<64),r?i64_or(e,i64_shl(i64_one,i64_new(t))):i64_and(e,i64_not(i64_shl(i64_one,i64_new(t))))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.NULL=0]="NULL",e[e.LINEFEED=10]="LINEFEED",e[e.CARRIAGERETURN=13]="CARRIAGERETURN",e[e.LINESEPARATOR=8232]="LINESEPARATOR",e[e.PARAGRAPHSEPARATOR=8233]="PARAGRAPHSEPARATOR",e[e.NEXTLINE=133]="NEXTLINE",e[e.SPACE=32]="SPACE",e[e.NONBREAKINGSPACE=160]="NONBREAKINGSPACE",e[e.ENQUAD=8192]="ENQUAD",e[e.EMQUAD=8193]="EMQUAD",e[e.ENSPACE=8194]="ENSPACE",e[e.EMSPACE=8195]="EMSPACE",e[e.THREEPEREMSPACE=8196]="THREEPEREMSPACE",e[e.FOURPEREMSPACE=8197]="FOURPEREMSPACE",e[e.SIXPEREMSPACE=8198]="SIXPEREMSPACE",e[e.FIGURESPACE=8199]="FIGURESPACE",e[e.PUNCTUATIONSPACE=8200]="PUNCTUATIONSPACE",e[e.THINSPACE=8201]="THINSPACE",e[e.HAIRSPACE=8202]="HAIRSPACE",e[e.ZEROWIDTHSPACE=8203]="ZEROWIDTHSPACE",e[e.NARROWNOBREAKSPACE=8239]="NARROWNOBREAKSPACE",e[e.IDEOGRAPHICSPACE=12288]="IDEOGRAPHICSPACE",e[e.MATHEMATICALSPACE=8287]="MATHEMATICALSPACE",e[e.OGHAM=5760]="OGHAM",e[e._=95]="_",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.AMPERSAND=38]="AMPERSAND",e[e.ASTERISK=42]="ASTERISK",e[e.AT=64]="AT",e[e.BACKSLASH=92]="BACKSLASH",e[e.BACKTICK=96]="BACKTICK",e[e.BAR=124]="BAR",e[e.CARET=94]="CARET",e[e.CLOSEBRACE=125]="CLOSEBRACE",e[e.CLOSEBRACKET=93]="CLOSEBRACKET",e[e.CLOSEPAREN=41]="CLOSEPAREN",e[e.COLON=58]="COLON",e[e.COMMA=44]="COMMA",e[e.DOLLAR=36]="DOLLAR",e[e.DOT=46]="DOT",e[e.DOUBLEQUOTE=34]="DOUBLEQUOTE",e[e.EQUALS=61]="EQUALS",e[e.EXCLAMATION=33]="EXCLAMATION",e[e.GREATERTHAN=62]="GREATERTHAN",e[e.HASH=35]="HASH",e[e.LESSTHAN=60]="LESSTHAN",e[e.MINUS=45]="MINUS",e[e.OPENBRACE=123]="OPENBRACE",e[e.OPENBRACKET=91]="OPENBRACKET",e[e.OPENPAREN=40]="OPENPAREN",e[e.PERCENT=37]="PERCENT",e[e.PLUS=43]="PLUS",e[e.QUESTION=63]="QUESTION",e[e.SEMICOLON=59]="SEMICOLON",e[e.SINGLEQUOTE=39]="SINGLEQUOTE",e[e.SLASH=47]="SLASH",e[e.TILDE=126]="TILDE",e[e.BACKSPACE=8]="BACKSPACE",e[e.FORMFEED=12]="FORMFEED",e[e.BYTEORDERMARK=65279]="BYTEORDERMARK",e[e.TAB=9]="TAB",e[e.VERTICALTAB=11]="VERTICALTAB"}(t.CharCode||(t.CharCode={})),t.isLineBreak=function(e){switch(e){case 10:case 13:case 8232:case 8233:return!0;default:return!1}},t.isWhiteSpace=function(e){switch(e){case 32:case 9:case 11:case 12:case 160:case 133:case 5760:case 8239:case 8287:case 12288:case 65279:return!0;default:return e>=8192&&e<=8203}},t.isDecimalDigit=function(e){return e>=48&&e<=57},t.isOctalDigit=function(e){return e>=48&&e<=55},t.isIdentifierStart=function(e){return e>=65&&e<=90||e>=97&&e<=122||36==e||95==e||e>127&&!((t=e)<0||t>65535)&&a(t,n);var t},t.isKeywordCharacter=function(e){return e>=97&&e<=122},t.isIdentifierPart=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||36==e||95==e||e>127&&!((t=e)<0||t>65535)&&a(t,i);var t};var n=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1319,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2208,2208,2210,2220,2308,2361,2365,2365,2384,2384,2392,2401,2417,2423,2425,2431,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3133,3160,3161,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3424,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6263,6272,6312,6314,6314,6320,6389,6400,6428,6480,6509,6512,6516,6528,6571,6593,6599,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7401,7404,7406,7409,7413,7414,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42647,42656,42735,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43648,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],i=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1319,1329,1366,1369,1369,1377,1415,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1520,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2048,2093,2112,2139,2208,2208,2210,2220,2276,2302,2304,2403,2406,2415,2417,2423,2425,2431,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3161,3168,3171,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3330,3331,3333,3340,3342,3344,3346,3386,3389,3396,3398,3400,3402,3406,3415,3415,3424,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6263,6272,6314,6320,6389,6400,6428,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7376,7378,7380,7414,7424,7654,7676,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8204,8205,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,11823,11823,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42647,42655,42737,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43047,43072,43123,43136,43204,43216,43225,43232,43255,43259,43259,43264,43309,43312,43347,43360,43388,43392,43456,43471,43481,43520,43574,43584,43597,43600,43609,43616,43638,43642,43643,43648,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65062,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500];function a(e,t){if(e=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;r0||i=0;)if(e.charCodeAt(a)==n){r-a==3&&46==e.charCodeAt(a+1)&&46==e.charCodeAt(a+2)||(e=t?e.substring(0,a):e.substring(0,a)+e.substring(r+3),i-=r+3-a,r=a-1);break}if(a<0&&r>0&&(2!=r||46!=e.charCodeAt(0)||46!=e.charCodeAt(1))){i=(e=e.substring(r+4)).length;continue}}}r++}return i>0?e:"."}function a(e){for(var t=e.length;--t>0;)if(e.charCodeAt(t)==n)return e.substring(0,t);return"."}t.normalizePath=i,t.resolvePath=function(e,t){return e.startsWith("std/")?e:i(a(t)+String.fromCharCode(n)+e)},t.dirname=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=" ",i=" ",a=" ";t.indent=function(e,t){for(;t>=4;)e.push(a),t-=4;t>=2&&(e.push(i),t-=2),t&&e.push(n)}},function(e,t,r){"use strict";function n(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function i(e,t,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function a(e,t){var r=n(e,t),i=n(e,t+4);return i64_new(r,i)}Object.defineProperty(t,"__esModule",{value:!0}),t.readI8=function(e,t){return e[t]},t.writeI8=function(e,t,r){t[r]=e},t.readI16=function(e,t){return e[t]|e[t+1]<<8},t.writeI16=function(e,t,r){t[r]=e,t[r+1]=e>>>8},t.readI32=n,t.writeI32=i,t.readI64=a,t.writeI64=function(e,t,r){i(i64_low(e),t,r),i(i64_high(e),t,r+4)},t.readF32=function(e,t){return i32_as_f32(n(e,t))},t.writeF32=function(e,t,r){i(f32_as_i32(e),t,r)},t.readF64=function(e,t){return i64_as_f64(a(e,t))},t.writeF64=function(e,t,r){var n=f64_as_i64(e);i(i64_low(n),t,r),i(i64_high(n),t,r+4)}},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0});var i=r(9),a=r(12),s=r(13),o=r(2);t.formatDiagnostic=o.formatDiagnosticMessage;var c=r(14);t.parseFile=function(e,t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=null),n||(n=new c.Parser),n.parseFile(e,t,r),n},t.nextFile=function(e){return e.nextFile()},t.nextDiagnostic=function(e){var t=e.program;return t.diagnosticsOffset