mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
2 lines
334 KiB
JavaScript
2 lines
334 KiB
JavaScript
!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,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},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=21)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(10),a=r(9),o=r(10);function s(e){switch(e){case n.INFO:return"INFO";case n.WARNING:return"WARNING";case n.ERROR:return"ERROR";default:return""}}t.DiagnosticCode=o.DiagnosticCode,t.diagnosticCodeToString=o.diagnosticCodeToString,function(e){e[e.INFO=0]="INFO",e[e.WARNING=1]="WARNING",e[e.ERROR=2]="ERROR"}(n=t.DiagnosticCategory||(t.DiagnosticCategory={})),t.diagnosticCategoryToString=s;var c="[93m",p="[93m",u="[91m",l="[0m";function h(e){switch(e){case n.INFO:return c;case n.WARNING:return p;case n.ERROR:return u;default:return""}}t.diagnosticCategoryToColor=h;var d=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,o){void 0===n&&(n=null),void 0===a&&(a=null),void 0===o&&(o=null);var s=i.diagnosticCodeToString(t);return null!=n&&(s=s.replace("{0}",n)),null!=a&&(s=s.replace("{1}",a)),null!=o&&(s=s.replace("{2}",o)),new e(t,r,s)},e.createInfo=function(t,r,i){return void 0===r&&(r=null),void 0===i&&(i=null),e.create(t,n.INFO,r,i)},e.createWarning=function(t,r,i){return void 0===r&&(r=null),void 0===i&&(i=null),e.create(t,n.WARNING,r,i)},e.createError=function(t,r,i){return void 0===r&&(r=null),void 0===i&&(i=null),e.create(t,n.ERROR,r,i)},e.prototype.withRange=function(e){return this.range=e,this},e.prototype.toString=function(){return this.range?s(this.category)+" "+this.code.toString(10)+': "'+this.message+'" in '+this.range.source.normalizedPath+" @ "+this.range.start.toString(10)+","+this.range.end.toString(10):s(this.category)+" "+this.code.toString(10)+": "+this.message},e}();function _(e,t){void 0===t&&(t=!1);for(var r=e.source.text,n=r.length,i=e.start,o=e.end;i>0&&!a.isLineBreak(r.charCodeAt(i-1));)i--;for(;o<n&&!a.isLineBreak(r.charCodeAt(o));)o++;for(var s=["\n ",r.substring(i,o),"\n "];i<e.start;)s.push(" "),i++;if(t&&s.push(u),e.start==e.end)s.push("^");else for(;i++<e.end;)s.push("~");return t&&s.push(l),s.join("")}t.DiagnosticMessage=d,t.formatDiagnosticMessage=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!1);var n="";e.range&&r&&(n=_(e.range,t));var i=[];if(t&&i.push(h(e.category)),i.push(s(e.category)),t&&i.push(l),i.push(e.code<1e3?" AS":" TS"),i.push(e.code.toString(10)),i.push(": "),i.push(e.message),e.range){var a=e.range;r&&(i.push("\n"),i.push(n)),i.push("\n"),i.push(" in "),i.push(a.source.normalizedPath),i.push("("),i.push(a.line.toString(10)),i.push(","),i.push(a.column.toString(10)),i.push(")")}return i.join("")},t.formatDiagnosticContext=_;var y=function(){function e(e){void 0===e&&(e=null),this.diagnostics=e||new Array}return e.prototype.emitDiagnostic=function(e,t,r,n,i,a){void 0===n&&(n=null),void 0===i&&(i=null),void 0===a&&(a=null);var o=d.create(e,t,n,i,a).withRange(r);this.diagnostics.push(o)},e.prototype.error=function(e,t,r,i,a){void 0===r&&(r=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.ERROR,t,r,i,a)},e.prototype.info=function(e,t,r,i,a){void 0===r&&(r=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.INFO,t,r,i,a)},e.prototype.warning=function(e,t,r,i,a){void 0===r&&(r=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.WARNING,t,r,i,a)},e}();t.DiagnosticEmitter=y},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i,a=r(6);!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.Unreachable=_BinaryenTypeUnreachable()]="Unreachable",e[e.Auto=_BinaryenTypeAuto()]="Auto"}(n=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.CallImport=_BinaryenCallImportId()]="CallImport",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"}(i=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"}(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.PageSize=_BinaryenPageSize()]="PageSize",e[e.CurrentMemory=_BinaryenCurrentMemory()]="CurrentMemory",e[e.GrowMemory=_BinaryenGrowMemory()]="GrowMemory",e[e.HasFeature=_BinaryenHasFeature()]="HasFeature"}(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={}));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 s=function(){function e(){}return e.create=function(){var t=new e;return t.ref=_BinaryenModuleCreate(),t.out=allocate_memory(16),t},e.createFrom=function(t){var r=p(t);try{var n=new e;return n.ref=_BinaryenModuleRead(r,t.length),n.out=allocate_memory(24),n}finally{free_memory(changetype(r))}},e.prototype.addFunctionType=function(e,t,r){var n=l(e),i=u(r);try{return _BinaryenAddFunctionType(this.ref,n,t,i,r?r.length:0)}finally{free_memory(i),free_memory(n)}},e.prototype.getFunctionTypeBySignature=function(e,t){var r=u(t);try{return _BinaryenGetFunctionTypeBySignature(this.ref,e,r,t?t.length:0)}finally{free_memory(r)}},e.prototype.createI32=function(e){var t=this.out;return _BinaryenLiteralInt32(t,e),_BinaryenConst(this.ref,t)},e.prototype.createI64=function(e,t){void 0===t&&(t=0);var r=this.out;return _BinaryenLiteralInt64(r,e,t),_BinaryenConst(this.ref,r)},e.prototype.createF32=function(e){var t=this.out;return _BinaryenLiteralFloat32(t,e),_BinaryenConst(this.ref,t)},e.prototype.createF64=function(e){var t=this.out;return _BinaryenLiteralFloat64(t,e),_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=l(t),i=u(r);try{return _BinaryenHost(this.ref,e,n,i,r?r.length:0)}finally{free_memory(i),free_memory(n)}},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=l(e);try{return _BinaryenGetGlobal(this.ref,r,t)}finally{free_memory(r)}},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=l(e);try{return _BinaryenSetGlobal(this.ref,r,t)}finally{free_memory(r)}},e.prototype.createBlock=function(e,t,r){void 0===r&&(r=n.None);var i=l(e),a=u(t);try{return _BinaryenBlock(this.ref,i,a,t.length,r)}finally{free_memory(a),free_memory(i)}},e.prototype.createBreak=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0);var n=l(e);try{return _BinaryenBreak(this.ref,n,t,r)}finally{free_memory(n)}},e.prototype.createDrop=function(e){return _BinaryenDrop(this.ref,e)},e.prototype.createLoop=function(e,t){var r=l(e);try{return _BinaryenLoop(this.ref,r,t)}finally{free_memory(r)}},e.prototype.createIf=function(e,t,r){return void 0===r&&(r=0),_BinaryenIf(this.ref,e,t,r)},e.prototype.createNop=function(){return _BinaryenNop(this.ref)},e.prototype.createReturn=function(e){return void 0===e&&(e=0),_BinaryenReturn(this.ref,e)},e.prototype.createSelect=function(e,t,r){return _BinaryenSelect(this.ref,r,e,t)},e.prototype.createSwitch=function(e,t,r,n){void 0===n&&(n=0);for(var i=e.length,a=new Array(i),o=0;o<i;++o)a[o]=l(e[o]);var s=u(a),c=l(t);try{return _BinaryenSwitch(this.ref,s,i,c,r,n)}finally{free_memory(c),free_memory(s);for(o=i-1;o>=0;--o)free_memory(a[o])}},e.prototype.createCall=function(e,t,r){var n=l(e),i=u(t);try{return _BinaryenCall(this.ref,n,i,t&&t.length||0,r)}finally{free_memory(i),free_memory(n)}},e.prototype.createCallImport=function(e,t,r){var n=l(e),i=u(t);try{return _BinaryenCallImport(this.ref,n,i,t&&t.length||0,r)}finally{free_memory(i),free_memory(n)}},e.prototype.createCallIndirect=function(e,t,r){var n=u(t),i=l(r);try{return _BinaryenCallIndirect(this.ref,e,n,t&&t.length||0,i)}finally{free_memory(i),free_memory(n)}},e.prototype.createUnreachable=function(){return _BinaryenUnreachable(this.ref)},e.prototype.addGlobal=function(e,t,r,n){var i=l(e);try{return _BinaryenAddGlobal(this.ref,i,t,r?1:0,n)}finally{free_memory(i)}},e.prototype.addFunction=function(e,t,r,n){var i=l(e),a=u(r);try{return _BinaryenAddFunction(this.ref,i,t,a,r?r.length:0,n)}finally{free_memory(a),free_memory(i)}},e.prototype.removeFunction=function(e){var t=l(e);try{_BinaryenRemoveFunction(this.ref,t)}finally{free_memory(t)}},e.prototype.addFunctionExport=function(e,t){var r=l(e),n=l(t);try{return _BinaryenAddFunctionExport(this.ref,r,n)}finally{free_memory(n),free_memory(r)}},e.prototype.addTableExport=function(e,t){var r=l(e),n=l(t);try{return _BinaryenAddTableExport(this.ref,r,n)}finally{free_memory(n),free_memory(r)}},e.prototype.addMemoryExport=function(e,t){var r=l(e),n=l(t);try{return _BinaryenAddMemoryExport(this.ref,r,n)}finally{free_memory(n),free_memory(r)}},e.prototype.addGlobalExport=function(e,t){var r=l(e),n=l(t);try{return _BinaryenAddGlobalExport(this.ref,r,n)}finally{free_memory(n),free_memory(r)}},e.prototype.removeExport=function(e){var t=l(e);try{_BinaryenRemoveExport(this.ref,t)}finally{free_memory(t)}},e.prototype.addFunctionImport=function(e,t,r,n){var i=l(e),a=l(t),o=l(r);try{return _BinaryenAddFunctionImport(this.ref,i,a,o,n)}finally{free_memory(o),free_memory(a),free_memory(i)}},e.prototype.addTableImport=function(e,t,r){var n=l(e),i=l(t),a=l(r);try{return _BinaryenAddTableImport(this.ref,n,i,a)}finally{free_memory(a),free_memory(i),free_memory(n)}},e.prototype.addMemoryImport=function(e,t,r){var n=l(e),i=l(t),a=l(r);try{return _BinaryenAddMemoryImport(this.ref,n,i,a)}finally{free_memory(a),free_memory(i),free_memory(n)}},e.prototype.addGlobalImport=function(e,t,r,n){var i=l(e),a=l(t),o=l(r);try{return _BinaryenAddGlobalImport(this.ref,i,a,o,n)}finally{free_memory(o),free_memory(a),free_memory(i)}},e.prototype.removeImport=function(e){var t=l(e);try{_BinaryenRemoveImport(this.ref,t)}finally{free_memory(t)}},e.prototype.setMemory=function(e,t,r,n,i){void 0===i&&(i=null);for(var o=l(i),s=r.length,c=new Array(s),h=new Array(s),d=new Array(s),_=0;_<s;++_){var y=r[_].buffer,g=r[_].offset;c[_]=p(y),h[_]=n==a.Target.WASM64?this.createI64(i64_low(g),i64_high(g)):this.createI32(i64_low(g)),d[_]=y.length}var m=u(c),f=u(h),E=u(d);try{_BinaryenSetMemory(this.ref,e,t,o,m,f,E,s)}finally{free_memory(E),free_memory(f),free_memory(m);for(_=s-1;_>=0;--_)free_memory(c[_]);free_memory(o)}},e.prototype.setFunctionTable=function(e){var t=u(e);try{_BinaryenSetFunctionTable(this.ref,t,e.length)}finally{free_memory(t)}},e.prototype.setStart=function(e){_BinaryenSetStart(this.ref,e)},e.prototype.setOptimizeLevel=function(e){void 0===e&&(e=2),_BinaryenSetOptimizeLevel(e)},e.prototype.setShrinkLevel=function(e){void 0===e&&(e=1),_BinaryenSetShrinkLevel(e)},e.prototype.setDebugInfo=function(e){void 0===e&&(e=!1),_BinaryenSetDebugInfo(e)},e.prototype.optimize=function(e){void 0===e&&(e=0),e?_BinaryenFunctionOptimize(e,this.ref):_BinaryenModuleOptimize(this.ref)},e.prototype.runPasses=function(e,t){void 0===t&&(t=0);for(var r=e.length,n=new Array(r),i=0;i<r;++i)n[i]=l(e[i]);var a=u(n);try{t?_BinaryenFunctionRunPasses(t,this.ref,a,r):_BinaryenModuleRunPasses(this.ref,a,r)}finally{free_memory(a);for(i=r;i>=0;--i)free_memory(n[i])}},e.prototype.validate=function(){return 1==_BinaryenModuleValidate(this.ref)},e.prototype.interpret=function(){_BinaryenModuleInterpret(this.ref)},e.prototype.toBinary=function(e){var t=this.out,r=l(e),n=0,i=0;try{_BinaryenModuleAllocateAndWrite(t,this.ref,r),n=h(t);var a=h(t+4);i=h(t+8);var o=new y;return o.output=d(n,a),o.sourceMap=_(i),o}finally{r&&free_memory(r),n&&free_memory(n),i&&free_memory(i)}},e.prototype.toText=function(){throw new Error("not implemented")},e.prototype.toAsmjs=function(){throw new Error("not implemented")},e.prototype.dispose=function(){this.ref&&(_BinaryenModuleDispose(this.ref),free_memory(this.out))},e.prototype.createRelooper=function(){return c.create(this)},e.prototype.cloneExpression=function(e,t,r){if(void 0===t&&(t=!1),void 0===r&&(r=i32.MAX_VALUE),r<0)return 0;var a,o;switch(r-=1,_BinaryenExpressionGetId(e)){case i.Const:switch(_BinaryenExpressionGetType(e)){case n.I32:return this.createI32(_BinaryenConstGetValueI32(e));case n.I64:return this.createI64(_BinaryenConstGetValueI64Low(e),_BinaryenConstGetValueI64High(e));case n.F32:return this.createF32(_BinaryenConstGetValueF32(e));case n.F64:return this.createF64(_BinaryenConstGetValueF64(e));default:throw new Error("concrete type expected")}case i.GetLocal:return _BinaryenGetLocal(this.ref,_BinaryenGetLocalGetIndex(e),_BinaryenExpressionGetType(e));case i.GetGlobal:var s=_BinaryenGetGlobalGetName(e);if(!s)break;return _BinaryenGetGlobal(this.ref,s,_BinaryenExpressionGetType(e));case i.Load:if(!(a=this.cloneExpression(_BinaryenLoadGetPtr(e),t,r)))break;return _BinaryenLoadIsAtomic(e)?_BinaryenAtomicLoad(this.ref,_BinaryenLoadGetBytes(e),_BinaryenLoadGetOffset(e),_BinaryenExpressionGetType(e),a):_BinaryenLoad(this.ref,_BinaryenLoadGetBytes(e),_BinaryenLoadIsSigned(e)?1:0,_BinaryenLoadGetOffset(e),_BinaryenLoadGetAlign(e),_BinaryenExpressionGetType(e),a);case i.Unary:if(!(a=this.cloneExpression(_BinaryenUnaryGetValue(e),t,r)))break;return _BinaryenUnary(this.ref,_BinaryenUnaryGetOp(e),a);case i.Binary:if(!(a=this.cloneExpression(_BinaryenBinaryGetLeft(e),t,r)))break;if(!(o=this.cloneExpression(_BinaryenBinaryGetRight(e),t,r)))break;return _BinaryenBinary(this.ref,_BinaryenBinaryGetOp(e),a,o)}return 0},e.prototype.addDebugInfoFile=function(e){var t=l(e);try{return _BinaryenModuleAddDebugInfoFileName(this.ref,t)}finally{free_memory(t)}},e.prototype.getDebugInfoFile=function(e){return _(_BinaryenModuleGetDebugInfoFileName(this.ref,e))},e.prototype.setDebugLocation=function(e,t,r,n,i){_BinaryenFunctionSetDebugLocation(e,t,r,n,i)},e.MAX_MEMORY_WASM32=65535,e}();t.Module=s;var c=function(){function e(){}return e.create=function(t){var r=new e;return r.module=t,r.ref=_RelooperCreate(),r},e.createStub=function(t){var r=new e;return r.module=t,r.ref=0,r},e.prototype.addBlock=function(e){return _RelooperAddBlock(this.ref,e)},e.prototype.addBranch=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0),_RelooperAddBranch(e,t,r,n)},e.prototype.addBlockWithSwitch=function(e,t){return _RelooperAddBlockWithSwitch(this.ref,e,t)},e.prototype.addBranchForSwitch=function(e,t,r,n){void 0===n&&(n=0);var i=u(r);try{_RelooperAddBranchForSwitch(e,t,i,r.length,n)}finally{free_memory(i)}},e.prototype.renderAndDispose=function(e,t){return _RelooperRenderAndDispose(this.ref,e,t,this.module.ref)},e}();function p(e){if(!e)return 0;for(var t=e.length,r=allocate_memory(t),n=r,i=0;i<t;++i)store(n++,e[i]);return r}function u(e){if(!e)return 0;for(var t=allocate_memory(e.length<<2),r=t,n=0,i=e.length;n<i;++n){var a=e[n];store(r,255&a),store(r+1,a>>8&255),store(r+2,a>>16&255),store(r+3,a>>>24),r+=4}return t}function l(e){if(null==e)return 0;for(var t=allocate_memory(function(e){for(var t=0,r=0,n=e.length;r<n;++r){var i=e.charCodeAt(r);i>=55296&&i<=57343&&r+1<n&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++r)),i<=127?++t:t+=i<=2047?2:i<=65535?3:i<=2097151?4:i<=67108863?5:6}return t}(e)+1),r=t,n=0,i=e.length;n<i;++n){var a=e.charCodeAt(n);a>=55296&&a<=57343&&n+1<i&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++n)),a<=127?store(r++,a):a<=2047?(store(r++,192|a>>>6),store(r++,128|63&a)):a<=65535?(store(r++,224|a>>>12),store(r++,128|a>>>6&63),store(r++,128|63&a)):a<=2097151?(store(r++,240|a>>>18),store(r++,128|a>>>12&63),store(r++,128|a>>>6&63),store(r++,128|63&a)):a<=67108863?(store(r++,248|a>>>24),store(r++,128|a>>>18&63),store(r++,128|a>>>12&63),store(r++,128|a>>>6&63),store(r++,128|63&a)):(store(r++,252|a>>>30),store(r++,128|a>>>24&63),store(r++,128|a>>>18&63),store(r++,128|a>>>12&63),store(r++,128|a>>>6&63),store(r++,128|63&a))}return store(r,0),t}function h(e){return load(e)|load(e+1)<<8|load(e+2)<<16|load(e+3)<<24}function d(e,t){for(var r=new Uint8Array(t),n=0;n<t;++n)r[n]=load(e+n);return r}function _(e){if(!e)return null;for(var t,r,n,i,a,o=new Array;t=load(e++);)128&t?(r=63&load(e++),192!=(224&t)?(n=63&load(e++),224==(240&t)?t=(15&t)<<12|r<<6|n:(i=63&load(e++),240==(248&t)?t=(7&t)<<18|r<<12|n<<6|i:(a=63&load(e++),t=248==(252&t)?(3&t)<<24|r<<18|n<<12|i<<6|a:(1&t)<<30|r<<24|n<<18|i<<12|a<<6|63&load(e++)))):o.push((31&t)<<6|r)):o.push(t);return String.fromCodePoints(o)}t.Relooper=c,t.readInt=h,t.readBuffer=d,t.readString=_;var y=function(){return function(){}}()},function(e,t,r){"use strict";var n,i=this&&this.__extends||(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])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__values||function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0});var s=r(0),c=r(5),p=r(4),u=r(1);t.PATH_DELIMITER="/",t.PARENT_SUBST="..",t.GETTER_PREFIX="get:",t.SETTER_PREFIX="set:",t.INSTANCE_DELIMITER="#",t.STATIC_DELIMITER=".",t.LIBRARY_SUBST="(lib)",t.LIBRARY_PREFIX=t.LIBRARY_SUBST+t.PATH_DELIMITER;var l=function(){return function(){}}(),h=function(){return function(){}}(),d=function(){return function(){}}(),_=new Map,y=function(e){function r(t){void 0===t&&(t=null);var r=e.call(this,t)||this;return r.diagnosticsOffset=0,r.elements=new Map,r.types=_,r.typeAliases=new Map,r.exports=new Map,r.sources=[],r}return i(r,e),r.prototype.initialize=function(e){this.options=e,this.types=new Map([["i8",c.Type.i8],["i16",c.Type.i16],["i32",c.Type.i32],["i64",c.Type.i64],["isize",e.isizeType],["u8",c.Type.u8],["u16",c.Type.u16],["u32",c.Type.u32],["u64",c.Type.u64],["usize",e.usizeType],["bool",c.Type.bool],["f32",c.Type.f32],["f64",c.Type.f64],["void",c.Type.void],["number",c.Type.f64],["boolean",c.Type.bool]]);for(var t,r,n=new Map,i=new Array,u=new Array,l=0,h=this.sources.length;l<h;++l)for(var d=this.sources[l].statements,_=0,y=d.length;_<y;++_){var g=d[_];switch(g.kind){case p.NodeKind.CLASSDECLARATION:this.initializeClass(g,u);break;case p.NodeKind.ENUMDECLARATION:this.initializeEnum(g);break;case p.NodeKind.EXPORT:this.initializeExports(g,n);break;case p.NodeKind.FUNCTIONDECLARATION:this.initializeFunction(g);break;case p.NodeKind.IMPORT:this.initializeImports(g,n,i);break;case p.NodeKind.INTERFACEDECLARATION:this.initializeInterface(g);break;case p.NodeKind.NAMESPACEDECLARATION:this.initializeNamespace(g,u);break;case p.NodeKind.TYPEDECLARATION:this.initializeTypeAlias(g);break;case p.NodeKind.VARIABLE:this.initializeVariables(g)}}for(l=0;l<i.length;){var f=i[l];(S=this.tryResolveImport(f.referencedName,n))?(this.elements.set(f.internalName,S),i.splice(l,1)):(S=this.tryResolveImport(f.referencedNameAlt,n))?(this.elements.set(f.internalName,S),i.splice(l,1)):(this.error(s.DiagnosticCode.Module_0_has_no_exported_member_1,f.declaration.range,f.declaration.parent.path.value,f.declaration.externalName.text),++l)}try{for(var E=a(n),T=E.next();!T.done;T=E.next()){var A=o(T.value,2),I=A[0],v=A[1],N=v,S=void 0;do{if(!N.isReExport){(S=this.elements.get(N.referencedName))||(S=this.elements.get(N.member.name.text))?this.setExportAndCheckLibrary(I,S,N.member.externalName):this.error(s.DiagnosticCode.Cannot_find_name_0,v.member.range,v.member.name.text);break}if(S=this.exports.get(N.referencedName)){this.setExportAndCheckLibrary(I,S,N.member.externalName);break}(N=n.get(N.referencedName))||this.error(s.DiagnosticCode.Module_0_has_no_exported_member_1,v.member.externalName.range,v.member.parent.path.value,v.member.externalName.text)}while(N)}}catch(e){t={error:e}}finally{try{T&&!T.done&&(r=E.return)&&r.call(E)}finally{if(t)throw t.error}}for(l=0,h=u.length;l<h;++l){var C=u[l].declaration,b=assert(C.extendsType),O=this.resolveIdentifier(b.name,null);if(O){if(O.element.kind!=m.CLASS_PROTOTYPE){this.error(s.DiagnosticCode.A_class_may_only_extend_another_class,b.range);continue}u[l].basePrototype=O.element}}},r.prototype.tryResolveImport=function(e,t){for(var r;;){if(r=this.exports.get(e))return r;var n=t.get(e);if(!n)return null;if(!n.isReExport)return this.elements.get(n.referencedName);e=n.referencedName}},r.prototype.checkInternalDecorators=function(e,t){var r=p.hasDecorator("builtin",t.decorators);r&&e.set(f.BUILTIN),(p.hasDecorator("global",t.decorators)||t.range.source.isLibrary&&e.is(f.EXPORTED)&&(assert(t.parent).kind==p.NodeKind.SOURCE||t.parent.kind==p.NodeKind.VARIABLE&&assert(t.parent.parent).kind==p.NodeKind.SOURCE))&&(e.set(f.GLOBAL),this.elements.has(t.name.text)?this.error(s.DiagnosticCode.Duplicate_identifier_0,t.name.range,e.internalName):(this.elements.set(t.name.text,e),this.exports.set(t.name.text,e),r&&(e.internalName=t.name.text)))},r.prototype.initializeClass=function(e,t,r){void 0===r&&(r=null);var n=e.fileLevelInternalName;if(this.elements.has(n))this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n);else{var i=new U(this,e.name.text,n,e);if(i.namespace=r,this.elements.set(n,i),this.checkInternalDecorators(i,e),p.hasDecorator("unmanaged",e.decorators))i.isUnmanaged=!0,e.implementsTypes&&e.implementsTypes.length&&this.error(s.DiagnosticCode.Structs_cannot_implement_interfaces,p.Range.join(e.name.range,e.implementsTypes[e.implementsTypes.length-1].range));else if(e.implementsTypes.length)throw new Error("not implemented");if(e.extendsType&&t.push(i),r){if(r.members){if(r.members.has(e.name.text))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n)}else r.members=new Map;r.members.set(e.name.text,i)}else if(i.is(f.EXPORTED)){if(this.exports.has(n))return void this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.name.range,n);this.exports.set(n,i)}for(var a=e.members,o=0,c=a.length;o<c;++o){var u=a[o];switch(u.kind){case p.NodeKind.FIELDDECLARATION:this.initializeField(u,i);break;case p.NodeKind.METHODDECLARATION:var l=p.hasModifier(p.ModifierKind.GET,u.modifiers);l||p.hasModifier(p.ModifierKind.SET,u.modifiers)?this.initializeAccessor(u,i,l):this.initializeMethod(u,i);break;default:throw new Error("class member expected")}}if(i.is(f.GLOBAL)&&"String"==e.name.text)if(this.types.has("string"))this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,e.programLevelInternalName);else{var h=i.resolve(null);h&&this.types.set("string",h.type)}}},r.prototype.initializeField=function(e,t){var r=e.name.text,n=e.fileLevelInternalName;if(p.hasModifier(p.ModifierKind.STATIC,e.modifiers)){if(this.elements.has(n))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n);if(t.members){if(t.members.has(r))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n)}else t.members=new Map;var i=new S(this,r,n,e,c.Type.void);t.members.set(r,i),this.elements.set(n,i)}else{if(t.instanceMembers){if(t.instanceMembers.has(r))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n)}else t.instanceMembers=new Map;var a=new L(t,r,n,e);t.instanceMembers.set(r,a)}},r.prototype.initializeMethod=function(e,t){var r=e.name.text,n=e.fileLevelInternalName,i=null;if(p.hasModifier(p.ModifierKind.STATIC,e.modifiers)){if(assert(e.name.kind!=p.NodeKind.CONSTRUCTOR),this.elements.has(n))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n);if(t.members){if(t.members.has(r))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n)}else t.members=new Map;i=new O(this,r,n,e,null),t.members.set(r,i),this.elements.set(n,i)}else{if(t.instanceMembers){if(t.instanceMembers.has(r))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n)}else t.instanceMembers=new Map;i=new O(this,r,n,e,t),e.name.kind==p.NodeKind.CONSTRUCTOR?t.constructorPrototype?this.error(s.DiagnosticCode.Multiple_constructor_implementations_are_not_allowed,e.name.range):(i.set(f.CONSTRUCTOR),t.constructorPrototype=i):t.instanceMembers.set(r,i)}this.checkOperators(e.decorators,i,t)},r.prototype.checkOperators=function(e,t,r){if(e)for(var n=0,i=e.length;n<i;++n){var a=e[n];if(2==a.decoratorKind){if(!t){this.error(s.DiagnosticCode.Operation_not_supported,a.range);continue}var o=a.arguments&&a.arguments.length||0;if(1==o){var c=a.arguments[0];if(c.kind==p.NodeKind.LITERAL&&2==c.literalKind)switch(c.value){case"[]":r.fnIndexedGet=t.simpleName;break;case"[]=":r.fnIndexedSet=t.simpleName;break;case"+":r.fnConcat=t.simpleName;break;case"==":r.fnEquals=t.simpleName;break;default:this.error(s.DiagnosticCode.Operation_not_supported,c.range)}else this.error(s.DiagnosticCode.String_literal_expected,c.range)}else this.error(s.DiagnosticCode.Expected_0_arguments_but_got_1,a.range,"1",o.toString(0))}else 0!=a.decoratorKind&&this.error(s.DiagnosticCode.Operation_not_supported,a.range)}},r.prototype.initializeAccessor=function(e,r,n){var i=e.name.text,a=e.fileLevelInternalName,o=this.elements.get(a);if(o){if(o.kind!=m.PROPERTY||(n?o.getterPrototype:o.setterPrototype))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,a)}else o=new B(this,i,a,r);var c=(n?t.GETTER_PREFIX:t.SETTER_PREFIX)+i;if(p.hasModifier(p.ModifierKind.STATIC,e.modifiers)){var u=r.internalName+t.STATIC_DELIMITER+c;if(this.elements.has(u))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,u);var l=new O(this,c,u,e,null);n?o.getterPrototype=l:o.setterPrototype=l,r.members||(r.members=new Map),r.members.set(i,o),this.elements.set(a,o)}else{var h=r.internalName+t.INSTANCE_DELIMITER+c;if(r.instanceMembers){if(r.instanceMembers.has(c))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,a)}else r.instanceMembers=new Map;var d=new O(this,c,h,e,r);n?o.getterPrototype=d:o.setterPrototype=d,r.instanceMembers.set(c,o),this.elements.set(a,o)}},r.prototype.initializeEnum=function(e,t){void 0===t&&(t=null);var r=e.fileLevelInternalName;if(this.elements.has(r))this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,r);else{var n=new I(this,e.name.text,r,e);if(n.namespace=t,this.elements.set(r,n),this.checkInternalDecorators(n,e),t){if(t.members){if(t.members.has(e.name.text))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,r)}else t.members=new Map;t.members.set(e.name.text,n)}else if(n.is(f.EXPORTED)){if(this.exports.has(r))return void this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.name.range,r);this.exports.set(r,n)}for(var i=e.values,a=0,o=i.length;a<o;++a)this.initializeEnumValue(i[a],n)}},r.prototype.initializeEnumValue=function(e,t){var r=e.name.text,n=e.fileLevelInternalName;if(t.members){if(t.members.has(r))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n)}else t.members=new Map;var i=new v(t,this,r,n,e);t.members.set(r,i)},r.prototype.initializeExports=function(e,t){for(var r=e.members,n=0,i=r.length;n<i;++n)this.initializeExport(r[n],e.internalPath,t)},r.prototype.setExportAndCheckLibrary=function(e,t,r){this.exports.set(e,t),r.range.source.isLibrary&&(this.elements.has(r.text)?this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,r.range,r.text):(t.internalName=r.text,this.elements.set(r.text,t)))},r.prototype.initializeExport=function(e,r,n){var i,a,o,c=e.range.source.internalPath+t.PATH_DELIMITER+e.externalName.text;if(this.exports.has(c))this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.externalName.range,c);else if(null==r){if(i=e.range.source.internalPath+t.PATH_DELIMITER+e.name.text,a=this.elements.get(i))return void this.setExportAndCheckLibrary(c,a,e.externalName);if(n.has(c))return void this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.externalName.range,c);(o=new l).isReExport=!1,o.referencedName=i,o.member=e,n.set(c,o)}else{if(i=r+t.PATH_DELIMITER+e.name.text,a=this.elements.get(i))return void this.setExportAndCheckLibrary(c,a,e.externalName);for(var p=new Set;o=n.get(i);){if(!o.isReExport){if(a=this.elements.get(o.referencedName))return void this.setExportAndCheckLibrary(c,a,e.externalName);break}if(a=this.exports.get(o.referencedName))return void this.setExportAndCheckLibrary(c,a,e.externalName);if(i=o.referencedName,p.has(o))break;p.add(o)}if(n.has(c))return void this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.externalName.range,c);(o=new l).isReExport=!0,o.referencedName=i,o.member=e,n.set(c,o)}},r.prototype.initializeFunction=function(e,t){void 0===t&&(t=null);var r=e.fileLevelInternalName;if(this.elements.has(r))this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,r);else{var n=new O(this,e.name.text,r,e,null);if(n.namespace=t,this.elements.set(r,n),this.checkInternalDecorators(n,e),t){if(t.members){if(t.members.has(e.name.text))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,r)}else t.members=new Map;t.members.set(e.name.text,n)}else if(n.is(f.EXPORTED)){if(this.exports.has(r))return void this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.name.range,r);this.exports.set(r,n)}}},r.prototype.initializeImports=function(e,r,n){var i=e.declarations;if(i)for(var a=0,o=i.length;a<o;++a)this.initializeImport(i[a],e.internalPath,r,n);else if(e.namespaceName){var c=e.range.source.internalPath+t.PATH_DELIMITER+e.namespaceName.text;if(this.elements.has(c))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.namespaceName.range,c);this.error(s.DiagnosticCode.Operation_not_supported,e.range)}},r.prototype.initializeImport=function(e,r,n,i){var a=e.fileLevelInternalName;if(this.elements.has(a))this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,a);else{var o,c=r+t.PATH_DELIMITER+e.externalName.text;if(o=this.exports.get(c))this.elements.set(a,o);else{var p=t.PATH_DELIMITER+"index",u=new h;u.internalName=a,r.endsWith(p)?(u.referencedName=c,u.referencedNameAlt=r.substring(0,r.length-p.length+1)+e.externalName.text):(u.referencedName=c,u.referencedNameAlt=r+p+t.PATH_DELIMITER+e.externalName.text),u.declaration=e,i.push(u)}}},r.prototype.initializeInterface=function(e,t){void 0===t&&(t=null);var r=e.fileLevelInternalName;if(this.elements.has(r))this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,r);else{var n=new F(this,e.name.text,r,e);if(n.namespace=t,this.elements.set(r,n),this.checkInternalDecorators(n,e),t){if(t.members){if(t.members.has(n.internalName))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,r)}else t.members=new Map;t.members.set(n.internalName,n)}else if(n.is(f.EXPORTED)){if(this.exports.has(r))return void this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.name.range,r);this.exports.set(r,n)}for(var i=e.members,a=0,o=i.length;a<o;++a){var c=i[a];switch(c.kind){case p.NodeKind.FIELDDECLARATION:this.initializeField(c,n);break;case p.NodeKind.METHODDECLARATION:var u=p.hasModifier(p.ModifierKind.GET,c.modifiers);u||p.hasModifier(p.ModifierKind.SET,c.modifiers)?this.initializeAccessor(c,n,u):this.initializeMethod(c,n);break;default:throw new Error("interface member expected")}}}},r.prototype.initializeNamespace=function(e,t,r){void 0===r&&(r=null);var n=e.fileLevelInternalName,i=this.elements.get(n);if(i||((i=new A(this,e.name.text,n,e)).namespace=r,this.elements.set(n,i),this.checkInternalDecorators(i,e)),r){if(r.members){if(r.members.has(e.name.text))return void this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,n)}else r.members=new Map;r.members.set(e.name.text,i)}else if(i.is(f.EXPORTED)){if(this.exports.has(n))return void this.error(s.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.name.range,n);this.exports.set(n,i)}for(var a=e.members,o=0,c=a.length;o<c;++o)switch(a[o].kind){case p.NodeKind.CLASSDECLARATION:this.initializeClass(a[o],t,i);break;case p.NodeKind.ENUMDECLARATION:this.initializeEnum(a[o],i);break;case p.NodeKind.FUNCTIONDECLARATION:this.initializeFunction(a[o],i);break;case p.NodeKind.INTERFACEDECLARATION:this.initializeInterface(a[o],i);break;case p.NodeKind.NAMESPACEDECLARATION:this.initializeNamespace(a[o],t,i);break;case p.NodeKind.TYPEDECLARATION:this.error(s.DiagnosticCode.Operation_not_supported,a[o].range);break;case p.NodeKind.VARIABLE:this.initializeVariables(a[o],i);break;default:throw new Error("namespace member expected")}},r.prototype.initializeTypeAlias=function(e,t){void 0===t&&(t=null);var r=e.name.text;if(this.types.has(r)||this.typeAliases.has(r))this.error(s.DiagnosticCode.Duplicate_identifier_0,e.name.range,r);else{var n=new d;n.typeParameters=e.typeParameters,n.type=e.type,this.typeAliases.set(r,n)}},r.prototype.initializeVariables=function(e,t){void 0===t&&(t=null);for(var r=e.declarations,n=0,i=r.length;n<i;++n){var a=r[n],o=a.fileLevelInternalName;if(this.elements.has(o))this.error(s.DiagnosticCode.Duplicate_identifier_0,a.name.range,o);else{var p=new S(this,a.name.text,o,a,c.Type.void);if(p.namespace=t,this.elements.set(o,p),this.checkInternalDecorators(p,a),t){if(t.members){if(t.members.has(a.name.text)){this.error(s.DiagnosticCode.Duplicate_identifier_0,a.name.range,o);continue}}else t.members=new Map;t.members.set(a.name.text,p)}else p.is(f.EXPORTED)&&(this.exports.has(o)?this.error(s.DiagnosticCode.Duplicate_identifier_0,a.name.range,o):this.exports.set(o,p))}}},r.prototype.resolveSignature=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!0);var n=e.explicitThisType,i=null;if(n&&!(i=this.resolveType(n,t,r)))return null;for(var a=e.parameterTypes,o=a.length,s=new Array(o),u=new Array(o),l=0,h=!1,d=0;d<o;++d){var _=a[d];switch(_.parameterKind){case p.ParameterKind.DEFAULT:l=d+1;break;case p.ParameterKind.REST:assert(d==o),h=!0}var y=this.resolveType(assert(_.type),t,r);if(!y)return null;s[d]=y,u[d]=_.name.text}var g,m=e.returnType;if(m){if(!(g=this.resolveType(m,t,r)))return null}else g=c.Type.void;var f=new c.Signature(s,g,i);return f.parameterNames=u,f.requiredParameters=l,f.hasRest=h,f},r.prototype.resolveType=function(e,r,n){if(void 0===r&&(r=null),void 0===n&&(n=!0),e.kind==p.NodeKind.SIGNATURE){var i=this.resolveSignature(e,r,n);return i?c.Type.u32.asFunction(i):null}var a,o=e,u=o.name.text,l=u,h=o.range.source.internalPath+t.PATH_DELIMITER+u;if((a=this.elements.get(h))||(a=this.elements.get(l)))switch(a.kind){case m.CLASS_PROTOTYPE:var d=a.resolveUsingTypeArguments(o.typeArguments,r,null);return d?d.type:null}var _,y=this.typeAliases.get(u);if(y)return this.resolveType(y.type,r,n);if(o.typeArguments){for(var g=o.typeArguments.length,f=new Array(g),E=0;E<g;++E){var T=this.resolveType(o.typeArguments[E],r,n);if(!T)return null;f[E]=T}if(g){var A=c.typesToString(f);A.length&&(h+="<"+A+">",l+="<"+A+">")}else if(r){var I=r.get(l);if(I)return I}}return(_=this.types.get(h))||(_=this.types.get(l))?_:(n&&this.error(s.DiagnosticCode.Cannot_find_name_0,o.name.range,l),null)},r.prototype.resolveTypeArguments=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var i=e.length,a=t?t.length:0;if(i!=a)return a?this.error(s.DiagnosticCode.Expected_0_type_arguments_but_got_1,p.Range.join(t[0].range,t[a-1].range),i.toString(10),a.toString(10)):n&&this.error(s.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.range.atEnd,i.toString(10),"0"),null;for(var o=new Array(i),c=0;c<i;++c){var u=this.resolveType(t[c],r,!0);if(!u)return null;o[c]=u}return o},r.prototype.resolveIdentifier=function(e,r,n){void 0===n&&(n=null);var i,a,o=e.text;if(n){if(n.members&&(i=n.members.get(o))&&i.kind==m.ENUMVALUE)return g||(g=new E),g.set(i)}else if(r){if(i=r.flow.getScopedLocal(o))return g||(g=new E),g.set(i);if(a=r.prototype.namespace)do{if(i=this.elements.get(a.internalName+t.STATIC_DELIMITER+o))return g||(g=new E),g.set(i)}while(a=a.namespace)}return(i=this.elements.get(e.range.source.internalPath+t.PATH_DELIMITER+o))?(g||(g=new E),g.set(i)):(i=this.elements.get(o))?(g||(g=new E),g.set(i)):(this.error(s.DiagnosticCode.Cannot_find_name_0,e.range,o),null)},r.prototype.resolvePropertyAccess=function(e,t){var r=e.expression;if(!(g=this.resolveExpression(r,t)))return null;var n,i,a=g.element,o=e.property.text;switch(a.kind){case m.GLOBAL:case m.LOCAL:case m.FIELD:if(!(n=a.type).classType)return this.error(s.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,o,n.toString()),null;a=n.classType;break;case m.PROPERTY:var c=assert(a.getterPrototype).resolve();if(!c)return null;if(!(n=c.signature.returnType).classType)return this.error(s.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,o,n.toString()),null;a=n.classType}switch(a.kind){case m.CLASS_PROTOTYPE:case m.CLASS:for(;;){if(a.members&&(i=a.members.get(o)))return g.set(i).withTarget(a,r);if(a.kind==m.CLASS_PROTOTYPE){if(!a.basePrototype)break;a=a.basePrototype}else{if(a.kind!=m.CLASS)break;if(!a.base)break;a=a.base}}break;default:if(a.members&&(i=a.members.get(o)))return g.set(i).withTarget(a,r)}return this.error(s.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,o,a.internalName),null},r.prototype.resolveElementAccess=function(e,t){var r=e.expression;if(!(g=this.resolveExpression(r,t)))return null;var n=g.element;switch(n.kind){case m.GLOBAL:case m.LOCAL:case m.FIELD:var i=n.type;if(i.classType){var a=(n=i.classType).prototype.fnIndexedGet,o=void 0;if(null!=a&&n.members&&(o=n.members.get(a))&&o.kind==m.FUNCTION_PROTOTYPE)return g.set(o).withTarget(i.classType,r)}}return this.error(s.DiagnosticCode.Index_signature_is_missing_in_type_0,r.range,n.internalName),null},r.prototype.resolveExpression=function(e,t){for(;e.kind==p.NodeKind.PARENTHESIZED;)e=e.expression;switch(e.kind){case p.NodeKind.ASSERTION:var r=this.resolveType(e.toType);if(r)if(o=r.classType)return g||(g=new E),g.set(o);return null;case p.NodeKind.BINARY:throw new Error("not implemented");case p.NodeKind.THIS:return(o=t.instanceMethodOf)?(g||(g=new E),g.set(o)):(this.error(s.DiagnosticCode._this_cannot_be_referenced_in_current_location,e.range),null);case p.NodeKind.SUPER:return(o=t.instanceMethodOf)&&(o=o.base)?(g||(g=new E),g.set(o)):(this.error(s.DiagnosticCode._super_can_only_be_referenced_in_a_derived_class,e.range),null);case p.NodeKind.IDENTIFIER:return this.resolveIdentifier(e,t);case p.NodeKind.PROPERTYACCESS:return this.resolvePropertyAccess(e,t);case p.NodeKind.ELEMENTACCESS:return this.resolveElementAccess(e,t);case p.NodeKind.CALL:var n=this.resolveExpression(e.expression,t);if(n){var i=n.element;if(i&&i.kind==m.FUNCTION_PROTOTYPE){var a=i.resolveUsingTypeArguments(e.typeArguments,null,e);if(a){var o,c=a.signature.returnType;if(o=c.classType)return g||(g=new E),g.set(o);var u=c.functionType;if(u){var l=u.cachedFunctionTarget;return l||(l=new x(this,u),u.cachedFunctionTarget=l),g||(g=new E),g.set(l)}}}}}return this.error(s.DiagnosticCode.Operation_not_supported,e.range),null},r}(s.DiagnosticEmitter);t.Program=y;var g,m,f,E=function(){function e(){}return e.prototype.set=function(e){return this.target=null,this.targetExpression=null,this.element=e,this},e.prototype.withTarget=function(e,t){return this.target=e,this.targetExpression=t,this},Object.defineProperty(e.prototype,"isInstanceTarget",{get:function(){return null!=this.target&&this.target.kind==m.CLASS&&null!=this.targetExpression},enumerable:!0,configurable:!0}),e}();t.ResolvedElement=E,function(e){e[e.GLOBAL=0]="GLOBAL",e[e.LOCAL=1]="LOCAL",e[e.ENUM=2]="ENUM",e[e.ENUMVALUE=3]="ENUMVALUE",e[e.FUNCTION_PROTOTYPE=4]="FUNCTION_PROTOTYPE",e[e.FUNCTION=5]="FUNCTION",e[e.FUNCTION_TARGET=6]="FUNCTION_TARGET",e[e.CLASS_PROTOTYPE=7]="CLASS_PROTOTYPE",e[e.CLASS=8]="CLASS",e[e.INTERFACE_PROTOTYPE=9]="INTERFACE_PROTOTYPE",e[e.INTERFACE=10]="INTERFACE",e[e.FIELD_PROTOTYPE=11]="FIELD_PROTOTYPE",e[e.FIELD=12]="FIELD",e[e.PROPERTY=13]="PROPERTY",e[e.NAMESPACE=14]="NAMESPACE"}(m=t.ElementKind||(t.ElementKind={})),function(e){e[e.NONE=0]="NONE",e[e.COMPILED=1]="COMPILED",e[e.IMPORTED=2]="IMPORTED",e[e.EXPORTED=4]="EXPORTED",e[e.BUILTIN=8]="BUILTIN",e[e.DECLARED=16]="DECLARED",e[e.GENERIC=32]="GENERIC",e[e.CONSTANT=64]="CONSTANT",e[e.INLINED=128]="INLINED",e[e.INSTANCE=256]="INSTANCE",e[e.GETTER=512]="GETTER",e[e.SETTER=1024]="SETTER",e[e.GLOBAL=2048]="GLOBAL",e[e.READONLY=4096]="READONLY",e[e.PUBLIC=8192]="PUBLIC",e[e.PROTECTED=16384]="PROTECTED",e[e.PRIVATE=32768]="PRIVATE",e[e.ABSTRACT=65536]="ABSTRACT",e[e.CONSTRUCTOR=131072]="CONSTRUCTOR",e[e.UNMANAGED=262144]="UNMANAGED",e[e.SCOPED=524288]="SCOPED",e[e.START=1048576]="START"}(f=t.ElementFlags||(t.ElementFlags={}));var T=function(){function e(e,t,r){this.flags=f.NONE,this.members=null,this.namespace=null,this.program=e,this.simpleName=t,this.internalName=r}return e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.set=function(e){this.flags|=e},e}();t.Element=T;var A=function(e){function t(t,r,n,i){var a=e.call(this,t,r,n)||this;a.kind=m.NAMESPACE,a.declaration=i;var o=i.modifiers;if(o)for(var s=0,c=o.length;s<c;++s)switch(o[s].modifierKind){case p.ModifierKind.IMPORT:a.set(f.IMPORTED);break;case p.ModifierKind.EXPORT:a.set(f.EXPORTED);break;case p.ModifierKind.DECLARE:a.set(f.DECLARED);break;default:throw new Error("unexpected modifier")}return a}return i(t,e),t}(T);t.Namespace=A;var I=function(e){function t(t,r,n,i){var a=e.call(this,t,r,n)||this;a.kind=m.ENUM,a.declaration=i;var o=i.modifiers;if(o)for(var s=0,c=o.length;s<c;++s)switch(o[s].modifierKind){case p.ModifierKind.EXPORT:a.set(f.EXPORTED);break;case p.ModifierKind.IMPORT:a.set(f.IMPORTED);break;case p.ModifierKind.DECLARE:a.set(f.DECLARED);break;case p.ModifierKind.CONST:a.set(f.CONSTANT);break;default:throw new Error("unexpected modifier")}return a}return i(t,e),t}(T);t.Enum=I;var v=function(e){function t(t,r,n,i,a){var o=e.call(this,r,n,i)||this;return o.kind=m.ENUMVALUE,o.constantValue=0,o.enum=t,o.declaration=a,o}return i(t,e),t}(T);t.EnumValue=v,function(e){e[e.NONE=0]="NONE",e[e.INTEGER=1]="INTEGER",e[e.FLOAT=2]="FLOAT"}(t.ConstantValueKind||(t.ConstantValueKind={}));var N=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.constantValueKind=0,t}return i(t,e),t.prototype.withConstantIntegerValue=function(e,t){return this.constantValueKind=1,this.constantIntegerValue=i64_new(e,t),this.set(f.CONSTANT|f.INLINED),this},t.prototype.withConstantFloatValue=function(e){return this.constantValueKind=2,this.constantFloatValue=e,this.set(f.CONSTANT|f.INLINED),this},t}(T);t.VariableLikeElement=N;var S=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n)||this;o.kind=m.GLOBAL,o.declaration=i;var s=i.modifiers;if(s)for(var c=0,u=s.length;c<u;++c)switch(s[c].modifierKind){case p.ModifierKind.IMPORT:o.set(f.IMPORTED);break;case p.ModifierKind.EXPORT:o.set(f.EXPORTED);break;case p.ModifierKind.CONST:o.set(f.CONSTANT);break;case p.ModifierKind.LET:o.set(f.SCOPED);break;case p.ModifierKind.DECLARE:o.set(f.DECLARED);break;case p.ModifierKind.READONLY:o.set(o.declaration.initializer?f.CONSTANT|f.READONLY:f.READONLY);break;case p.ModifierKind.PUBLIC:case p.ModifierKind.PRIVATE:case p.ModifierKind.PROTECTED:case p.ModifierKind.STATIC:break;default:throw new Error("unexpected modifier")}return o.type=a,o}return i(t,e),t}(N);t.Global=S;var C=function(){return function(e,t,r){void 0===r&&(r=null),this.name=e,this.type=t,this.initializer=r}}();t.Parameter=C;var b=function(e){function t(t,r,n,i){var a=e.call(this,t,r,r)||this;return a.kind=m.LOCAL,a.index=n,a.type=i,a}return i(t,e),t}(N);t.Local=b;var O=function(e){function t(t,r,n,i,a){void 0===a&&(a=null);var o=e.call(this,t,r,n)||this;o.kind=m.FUNCTION_PROTOTYPE,o.instances=new Map,o.classTypeArguments=null,o.declaration=i;var s=i.modifiers;if(s)for(var c=0,u=s.length;c<u;++c)switch(s[c].modifierKind){case p.ModifierKind.IMPORT:o.set(f.IMPORTED);break;case p.ModifierKind.EXPORT:o.set(f.EXPORTED);break;case p.ModifierKind.DECLARE:o.set(f.DECLARED);break;case p.ModifierKind.GET:o.set(f.GETTER);break;case p.ModifierKind.SET:o.set(f.SETTER);break;case p.ModifierKind.STATIC:case p.ModifierKind.ABSTRACT:case p.ModifierKind.PRIVATE:case p.ModifierKind.PROTECTED:case p.ModifierKind.PUBLIC:break;default:throw new Error("unexpected modifier")}return o.declaration.isGeneric&&o.set(f.GENERIC),(o.classPrototype=a)&&o.set(f.INSTANCE),o}return i(t,e),t.prototype.resolve=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null);var r=e?c.typesToString(e):"",n=this.instances.get(r);if(n)return n;var i=this.declaration,s=this.is(f.INSTANCE),u=t;if(t=new Map,u)try{for(var l=a(u),h=l.next();!h.done;h=l.next()){var d=o(h.value,2),_=d[0],y=d[1];t.set(_,y)}}catch(e){w={error:e}}finally{try{h&&!h.done&&(M=l.return)&&M.call(l)}finally{if(w)throw w.error}}var g=this.classTypeArguments;if(g){var m=assert(this.classPrototype).declaration.typeParameters,E=m.length;assert(E==g.length);for(var T=0;T<E;++T)t.set(m[T].name.text,g[T])}else assert(!g);var A,I=i.signature,v=i.typeParameters;if(e&&(A=e.length)){assert(v&&A==v.length);for(T=0;T<A;++T)t.set(v[T].name.text,e[T])}else assert(!v||0==v.length);var N=null,S=null;if(s){if(!(N=assert(this.classPrototype).resolve(g,t)))return null;S=N.type}else assert(!this.classPrototype);var C,b=I.parameterTypes,O=b.length,x=new Array(O),L=new Array(O),R=0;for(T=0;T<O;++T){var B=b[T];B.parameterKind==p.ParameterKind.DEFAULT&&(R=T+1);var U=assert(B.type),D=this.program.resolveType(U,t,!0);if(!D)return null;x[T]=D,L[T]=B.name.text}if(this.is(f.SETTER)||this.is(f.CONSTRUCTOR))C=c.Type.void;else{U=assert(I.returnType);var F=this.program.resolveType(U,t,!0);if(!F)return null;C=F}var P=new c.Signature(x,C,S);P.parameterNames=L,P.requiredParameters=R;var w,M,G=this.internalName;return r.length&&(G+="<"+r+">"),(n=new k(this,G,P,N)).contextualTypeArguments=t,this.instances.set(r,n),n},t.prototype.resolvePartial=function(e){if(!this.classPrototype)throw new Error("partially resolved instance method must reference its class prototype");if(e&&e.length){var r=new t(this.program,this.simpleName,this.internalName,this.declaration,this.classPrototype);return r.flags=this.flags,r.classTypeArguments=e,r}return this},t.prototype.resolveUsingTypeArguments=function(e,t,r){var n=null;return!this.is(f.GENERIC)||(assert(null!=e&&0!=e.length),n=this.program.resolveTypeArguments(assert(this.declaration.typeParameters),e,t,r))?this.resolve(n,t):null},t.prototype.resolveBuiltinTypeArguments=function(e,t){assert(this.is(f.BUILTIN));var r=null;if(e){var n=e.length;r=new Array(n);for(var i=0;i<n;++i){var a=this.program.resolveType(e[i],t,!0);if(!a)return null;r[i]=a}}return r},t.prototype.toString=function(){return this.simpleName},t}(T);t.FunctionPrototype=O;var k=function(e){function t(t,r,n,i){void 0===i&&(i=null);var s,c,p=e.call(this,t.program,t.simpleName,r)||this;if(p.kind=m.FUNCTION,p.locals=new Map,p.additionalLocals=[],p.breakContext=null,p.debugLocations=null,p.ref=0,p.functionTableIndex=-1,p.trampoline=null,p.nextBreakId=0,p.breakStack=null,p.tempI32s=null,p.tempI64s=null,p.tempF32s=null,p.tempF64s=null,p.prototype=t,p.signature=n,p.instanceMethodOf=i,p.flags=t.flags,!t.is(f.BUILTIN)&&!t.is(f.DECLARED)){var u=0;if(i){if(assert(p.is(f.INSTANCE)),p.locals.set("this",new b(t.program,"this",u++,assert(n.thisType))),i.contextualTypeArguments){p.contextualTypeArguments||(p.contextualTypeArguments=new Map);try{for(var l=a(i.contextualTypeArguments),h=l.next();!h.done;h=l.next()){var d=o(h.value,2),_=d[0],y=d[1];p.contextualTypeArguments.set(_,y)}}catch(e){s={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(s)throw s.error}}}}else assert(!p.is(f.INSTANCE));for(var g=n.parameterTypes,E=0,T=g.length;E<T;++E){var A=g[E],I=n.getParameterName(E);p.locals.set(I,new b(t.program,I,u++,A))}}return p.flow=w.create(p),p}return i(t,e),t.prototype.addLocal=function(e,t){void 0===t&&(t=null);var r=this.signature.parameterTypes.length+this.additionalLocals.length;this.is(f.INSTANCE)&&++r;var n=new b(this.prototype.program,t||"var$"+r.toString(10),r,e);if(t){if(this.locals.has(t))throw new Error("duplicate local name");this.locals.set(t,n)}return this.additionalLocals.push(e),n},t.prototype.getTempLocal=function(e){var t;switch(e.toNativeType()){case u.NativeType.I32:t=this.tempI32s;break;case u.NativeType.I64:t=this.tempI64s;break;case u.NativeType.F32:t=this.tempF32s;break;case u.NativeType.F64:t=this.tempF64s;break;default:throw new Error("concrete type expected")}if(t&&t.length){var r=t.pop();return r.type=e,r}return this.addLocal(e)},t.prototype.freeTempLocal=function(e){var t;switch(assert(null!=e.type),e.type.toNativeType()){case u.NativeType.I32:t=this.tempI32s||(this.tempI32s=[]);break;case u.NativeType.I64:t=this.tempI64s||(this.tempI64s=[]);break;case u.NativeType.F32:t=this.tempF32s||(this.tempF32s=[]);break;case u.NativeType.F64:t=this.tempF64s||(this.tempF64s=[]);break;default:throw new Error("concrete type expected")}t.push(e)},t.prototype.getAndFreeTempLocal=function(e){var t;switch(e.toNativeType()){case u.NativeType.I32:t=this.tempI32s||(this.tempI32s=[]);break;case u.NativeType.I64:t=this.tempI64s||(this.tempI64s=[]);break;case u.NativeType.F32:t=this.tempF32s||(this.tempF32s=[]);break;case u.NativeType.F64:t=this.tempF64s||(this.tempF64s=[]);break;default:throw new Error("concrete type expected")}if(t.length>0)return t[t.length-1];var r=this.addLocal(e);return t.push(r),r},t.prototype.enterBreakContext=function(){var e=this.nextBreakId++;return this.breakStack?this.breakStack.push(e):this.breakStack=[e],this.breakContext=e.toString(10)},t.prototype.leaveBreakContext=function(){assert(null!=this.breakStack);var e=this.breakStack.length;assert(e>0),this.breakStack.pop(),e>1?this.breakContext=this.breakStack[e-2].toString(10):(this.breakContext=null,this.breakStack=null)},t.prototype.finalize=function(e,t){if(this.ref=t,assert(!this.breakStack||!this.breakStack.length),this.breakStack=null,this.breakContext=null,this.tempI32s=this.tempI64s=this.tempF32s=this.tempF64s=null,this.program.options.sourceMap){var r=this.debugLocations;if(r)for(var n=0,i=r.length;n<i;++n){var a=r[n];e.setDebugLocation(t,a.debugInfoRef,a.source.debugInfoIndex,a.line,a.column)}}this.debugLocations=null},t.prototype.toString=function(){return this.prototype.simpleName},t}(T);t.Function=k;var x=function(e){function t(t,r){var n=e.call(this,t,"","")||this;n.kind=m.FUNCTION_TARGET;var i=r.toSignatureString();return n.simpleName=i,n.internalName=i,n.signature=r,n.type=c.Type.u32.asFunction(r),n}return i(t,e),t}(T);t.FunctionTarget=x;var L=function(e){function t(t,r,n,i){var a=e.call(this,t.program,r,n)||this;a.kind=m.FIELD_PROTOTYPE,a.classPrototype=t,a.declaration=i;var o=i.modifiers;if(o)for(var s=0,c=o.length;s<c;++s)switch(o[s].modifierKind){case p.ModifierKind.EXPORT:a.set(f.EXPORTED);break;case p.ModifierKind.READONLY:a.set(f.READONLY);break;case p.ModifierKind.PRIVATE:case p.ModifierKind.PROTECTED:case p.ModifierKind.PUBLIC:case p.ModifierKind.STATIC:break;default:throw new Error("unexpected modifier")}return a}return i(t,e),Object.defineProperty(t.prototype,"isReadonly",{get:function(){return 0!=(this.flags&f.READONLY)},set:function(e){e?this.flags|=f.READONLY:this.flags&=~f.READONLY},enumerable:!0,configurable:!0}),t}(T);t.FieldPrototype=L;var R=function(e){function t(t,r,n){var i=e.call(this,t.program,t.simpleName,r)||this;return i.kind=m.FIELD,i.memoryOffset=-1,i.prototype=t,i.flags=t.flags,i.type=n,i}return i(t,e),t}(N);t.Field=R;var B=function(e){function t(t,r,n,i){var a=e.call(this,t,r,n)||this;return a.kind=m.PROPERTY,a.getterPrototype=null,a.setterPrototype=null,a.parent=i,a}return i(t,e),t}(T);t.Property=B;var U=function(e){function t(t,r,n,i){var a=e.call(this,t,r,n)||this;a.kind=m.CLASS_PROTOTYPE,a.instances=new Map,a.instanceMembers=null,a.basePrototype=null,a.constructorPrototype=null,a.fnIndexedGet=null,a.fnIndexedSet=null,a.fnConcat=null,a.fnEquals=null,a.declaration=i;var o=i.modifiers;if(o)for(var s=0,c=o.length;s<c;++s)switch(o[s].modifierKind){case p.ModifierKind.IMPORT:a.set(f.IMPORTED);break;case p.ModifierKind.EXPORT:a.set(f.EXPORTED);break;case p.ModifierKind.DECLARE:a.set(f.DECLARED);break;default:throw new Error("unexpected modifier")}return i.typeParameters.length&&a.set(f.GENERIC),a}return i(t,e),Object.defineProperty(t.prototype,"isUnmanaged",{get:function(){return 0!=(this.flags&f.UNMANAGED)},set:function(e){e?this.flags|=f.UNMANAGED:this.flags&=~f.UNMANAGED},enumerable:!0,configurable:!0}),t.prototype.resolve=function(e,t){void 0===t&&(t=null);var r=e?c.typesToString(e):"",n=this.instances.get(r);if(n)return n;var i=t;if(t=new Map,i)try{for(var u=a(i),l=u.next();!l.done;l=u.next()){var h=o(l.value,2),d=h[0],_=h[1];t.set(d,_)}}catch(e){I={error:e}}finally{try{l&&!l.done&&(v=u.return)&&v.call(u)}finally{if(I)throw I.error}}var y,g,f=this.declaration,E=null;if(f.extendsType){var T=this.program.resolveType(f.extendsType,null);if(!T)return null;if(!(E=T.classType))return this.program.error(s.DiagnosticCode.A_class_may_only_extend_another_class,f.extendsType.range),null;if(E.prototype.isUnmanaged!=this.isUnmanaged)return this.program.error(s.DiagnosticCode.Structs_cannot_extend_classes_and_vice_versa,p.Range.join(f.name.range,f.extendsType.range)),null}if(e){if((g=e.length)!=f.typeParameters.length)throw new Error("type argument count mismatch");for(y=0;y<g;++y)t.set(f.typeParameters[y].name.text,e[y])}else if(f.typeParameters.length)throw new Error("type argument count mismatch");var A=this.internalName;r.length&&(A+="<"+r+">"),(n=new D(this,A,e,E)).contextualTypeArguments=t,this.instances.set(r,n);var I,v,N,S,C,b,O=0;if(E&&(O=E.currentMemoryOffset,E.members)){n.members||(n.members=new Map);try{for(var k=a(E.members.values()),x=k.next();!x.done;x=k.next()){var L=x.value;n.members.set(L.simpleName,L)}}catch(e){N={error:e}}finally{try{x&&!x.done&&(S=k.return)&&S.call(k)}finally{if(N)throw N.error}}}if(this.constructorPrototype){var U=this.constructorPrototype.resolvePartial(e);U&&(n.constructorInstance=U.resolve())}if(this.instanceMembers)try{for(var F=a(this.instanceMembers.values()),P=F.next();!P.done;P=F.next()){var w=P.value;switch(w.kind){case m.FIELD_PROTOTYPE:n.members||(n.members=new Map);var M=w.declaration;if(!M.type)throw new Error("type expected");var G=this.program.resolveType(M.type,n.contextualTypeArguments);if(G){var K=new R(w,w.internalName,G);switch(G.byteSize){case 1:break;case 2:1&O&&++O;break;case 4:3&O&&(O=1+(3|O));break;case 8:7&O&&(O=1+(7|O));break;default:assert(!1)}K.memoryOffset=O,O+=G.byteSize,n.members.set(w.simpleName,K)}break;case m.FUNCTION_PROTOTYPE:n.members||(n.members=new Map);var z=w.resolvePartial(e);z&&n.members.set(w.simpleName,z);break;case m.PROPERTY:n.members||(n.members=new Map),assert(w.getterPrototype);var H=new B(this.program,w.simpleName,w.internalName,this);H.getterPrototype=w.getterPrototype.resolvePartial(e),w.setterPrototype&&(H.setterPrototype=w.setterPrototype.resolvePartial(e)),n.members.set(w.simpleName,H);break;default:throw new Error("instance member expected")}}}catch(e){C={error:e}}finally{try{P&&!P.done&&(b=F.return)&&b.call(F)}finally{if(C)throw C.error}}return n.currentMemoryOffset=O,n},t.prototype.resolveUsingTypeArguments=function(e,t,r){var n=null;if(this.is(f.GENERIC)){if(assert(null!=e&&0!=e.length),!(n=this.program.resolveTypeArguments(this.declaration.typeParameters,e,t,r)))return null}else assert(null==e||!e.length);return this.resolve(n,t)},t.prototype.toString=function(){return this.simpleName},t}(T);t.ClassPrototype=U;var D=function(e){function t(t,r,n,i){void 0===n&&(n=null),void 0===i&&(i=null);var s=e.call(this,t.program,t.simpleName,r)||this;if(s.kind=m.CLASS,s.contextualTypeArguments=null,s.currentMemoryOffset=0,s.constructorInstance=null,s.prototype=t,s.flags=t.flags,s.typeArguments=n,s.type=t.program.options.usizeType.asClass(s),s.base=i,i&&i.contextualTypeArguments){s.contextualTypeArguments||(s.contextualTypeArguments=new Map);try{for(var c=a(i.contextualTypeArguments),p=c.next();!p.done;p=c.next()){var u=o(p.value,2),l=u[0],h=u[1];s.contextualTypeArguments.set(l,h)}}catch(e){y={error:e}}finally{try{p&&!p.done&&(g=c.return)&&g.call(c)}finally{if(y)throw y.error}}}var d,_,y,g,f=s.prototype.declaration;if(f){var E=f.typeParameters;if(n){if((_=n.length)!=E.length)throw new Error("type argument count mismatch");if(_)for(s.contextualTypeArguments||(s.contextualTypeArguments=new Map),d=0;d<_;++d)s.contextualTypeArguments.set(E[d].name.text,n[d])}else if(E.length)throw new Error("type argument count mismatch")}return s}return i(t,e),t.prototype.isAssignableTo=function(e){var t=this;do{if(t==e)return!0}while(t=t.base);return!1},t.prototype.toString=function(){return this.prototype.simpleName},t}(T);t.Class=D;var F=function(e){function t(t,r,n,i){var a=e.call(this,t,r,n,i)||this;return a.kind=m.INTERFACE_PROTOTYPE,a}return i(t,e),t}(U);t.InterfacePrototype=F;var P=function(e){function t(t,r,n,i){void 0===n&&(n=[]),void 0===i&&(i=null);var a=e.call(this,t,r,n,i)||this;return a.kind=m.INTERFACE,a}return i(t,e),t}(D);t.Interface=P,function(e){e[e.NONE=0]="NONE",e[e.RETURNS=1]="RETURNS",e[e.POSSIBLY_THROWS=2]="POSSIBLY_THROWS",e[e.POSSIBLY_BREAKS=4]="POSSIBLY_BREAKS",e[e.POSSIBLY_CONTINUES=8]="POSSIBLY_CONTINUES"}(t.FlowFlags||(t.FlowFlags={}));var w=function(){function e(){this.scopedLocals=null}return e.create=function(t){var r=new e;return r.parent=null,r.flags=0,r.currentFunction=t,r.continueLabel=null,r.breakLabel=null,r},e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.set=function(e){this.flags|=e},e.prototype.enterBranchOrScope=function(){var t=new e;return t.parent=this,t.flags=this.flags,t.currentFunction=this.currentFunction,t.continueLabel=this.continueLabel,t.breakLabel=this.breakLabel,t},e.prototype.leaveBranchOrScope=function(){var e,t,r=assert(this.parent);if(this.scopedLocals){try{for(var n=a(this.scopedLocals.values()),i=n.next();!i.done;i=n.next()){var o=i.value;this.currentFunction.freeTempLocal(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.scopedLocals=null}return this.is(2)&&r.set(2),this.is(4)&&r.breakLabel==this.breakLabel&&r.set(4),this.is(8)&&r.continueLabel==this.continueLabel&&r.set(8),r},e.prototype.addScopedLocal=function(e,t,r){var n=this.currentFunction.getTempLocal(t);if(this.scopedLocals){if(this.scopedLocals.has(e))return void this.currentFunction.program.error(s.DiagnosticCode.Duplicate_identifier_0,r.range)}else this.scopedLocals=new Map;this.scopedLocals.set(e,n)},e.prototype.getScopedLocal=function(e){var t,r=this;do{if(r.scopedLocals&&(t=r.scopedLocals.get(e)))return t}while(r=r.parent);return this.currentFunction.locals.get(e)},e.prototype.finalize=function(){return assert(null==this.parent,"must be the topmost parent flow"),this.continueLabel=null,this.breakLabel=null,this.is(1)},e}();t.Flow=w},function(e,t,r){"use strict";var n,i=this&&this.__extends||(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])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a,o=r(0),s=r(9);!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.fromKeyword=function(t){switch(t){case"abstract":return e.ABSTRACT;case"as":return e.AS;case"async":return e.ASYNC;case"await":return e.AWAIT;case"break":return e.BREAK;case"case":return e.CASE;case"catch":return e.CATCH;case"class":return e.CLASS;case"continue":return e.CONTINUE;case"const":return e.CONST;case"constructor":return e.CONSTRUCTOR;case"debugger":return e.DEBUGGER;case"declare":return e.DECLARE;case"default":return e.DEFAULT;case"delete":return e.DELETE;case"do":return e.DO;case"else":return e.ELSE;case"enum":return e.ENUM;case"export":return e.EXPORT;case"extends":return e.EXTENDS;case"false":return e.FALSE;case"finally":return e.FINALLY;case"for":return e.FOR;case"from":return e.FROM;case"function":return e.FUNCTION;case"get":return e.GET;case"if":return e.IF;case"implements":return e.IMPLEMENTS;case"import":return e.IMPORT;case"in":return e.IN;case"instanceof":return e.INSTANCEOF;case"interface":return e.INTERFACE;case"is":return e.IS;case"keyof":return e.KEYOF;case"let":return e.LET;case"module":return e.MODULE;case"namespace":return e.NAMESPACE;case"new":return e.NEW;case"null":return e.NULL;case"of":return e.OF;case"package":return e.PACKAGE;case"private":return e.PRIVATE;case"protected":return e.PROTECTED;case"public":return e.PUBLIC;case"readonly":return e.READONLY;case"return":return e.RETURN;case"set":return e.SET;case"static":return e.STATIC;case"super":return e.SUPER;case"switch":return e.SWITCH;case"this":return e.THIS;case"throw":return e.THROW;case"true":return e.TRUE;case"try":return e.TRY;case"type":return e.TYPE;case"typeof":return e.TYPEOF;case"var":return e.VAR;case"void":return e.VOID;case"while":return e.WHILE;case"with":return e.WITH;case"yield":return e.YIELD;default:return e.INVALID}},e.isAlsoIdentifier=function(t){switch(t){case e.ABSTRACT:case e.AS:case e.CONSTRUCTOR:case e.DECLARE:case e.DELETE:case e.FROM:case e.GET:case e.IS:case e.KEYOF:case e.MODULE:case e.NAMESPACE:case e.READONLY:case e.SET:case e.TYPE:return!0;default:return!1}},e.operatorToString=function(t){switch(t){case e.DELETE:return"delete";case e.IN:return"in";case e.INSTANCEOF:return"instanceof";case e.NEW:return"new";case e.TYPEOF:return"typeof";case e.VOID:return"void";case e.YIELD:return"yield";case e.DOT_DOT_DOT:return"...";case e.COMMA:return",";case e.LESSTHAN:return"<";case e.GREATERTHAN:return">";case e.LESSTHAN_EQUALS:return"<=";case e.GREATERTHAN_EQUALS:return">=";case e.EQUALS_EQUALS:return"==";case e.EXCLAMATION_EQUALS:return"!=";case e.EQUALS_EQUALS_EQUALS:return"===";case e.EXCLAMATION_EQUALS_EQUALS:return"!==";case e.PLUS:return"+";case e.MINUS:return"-";case e.ASTERISK_ASTERISK:return"**";case e.ASTERISK:return"*";case e.SLASH:return"/";case e.PERCENT:return"%";case e.PLUS_PLUS:return"++";case e.MINUS_MINUS:return"--";case e.LESSTHAN_LESSTHAN:return"<<";case e.GREATERTHAN_GREATERTHAN:return">>";case e.GREATERTHAN_GREATERTHAN_GREATERTHAN:return">>>";case e.AMPERSAND:return"&";case e.BAR:return"|";case e.CARET:return"^";case e.EXCLAMATION:return"!";case e.TILDE:return"~";case e.AMPERSAND_AMPERSAND:return"&&";case e.BAR_BAR:return"||";case e.EQUALS:return"=";case e.PLUS_EQUALS:return"+=";case e.MINUS_EQUALS:return"-=";case e.ASTERISK_EQUALS:return"*=";case e.ASTERISK_ASTERISK_EQUALS:return"**=";case e.SLASH_EQUALS:return"/=";case e.PERCENT_EQUALS:return"%=";case e.LESSTHAN_LESSTHAN_EQUALS:return"<<=";case e.GREATERTHAN_GREATERTHAN_EQUALS:return">>=";case e.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:return">>>=";case e.AMPERSAND_EQUALS:return"&=";case e.BAR_EQUALS:return"|=";case e.CARET_EQUALS:return"^=";default:return assert(!1),""}}}(a=t.Token||(t.Token={}));var c=function(){function e(e,t,r){this.debugInfoRef=0,this.source=e,this.start=t,this.end=r}return e.join=function(t,r){if(t.source!=r.source)throw new Error("source mismatch");return new e(t.source,t.start<r.start?t.start:r.start,t.end>r.end?t.end:r.end)},Object.defineProperty(e.prototype,"atStart",{get:function(){return new e(this.source,this.start,this.start)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"atEnd",{get:function(){return new e(this.source,this.end,this.end)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){for(var e=this.source.text,t=this.start,r=1;t-- >0;)10==e.charCodeAt(t)&&r++;return r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"column",{get:function(){for(var e=this.source.text,t=this.start,r=0;t-- >0&&10!=e.charCodeAt(t);)r++;return r},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return this.source.text.substring(this.start,this.end)},e}();t.Range=c;var p=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.nextTokenOnNewLine=!1,n.source=t,n.pos=0,n.end=t.text.length,n.diagnostics=r||new Array;var i=t.text;if(n.pos<n.end&&65279==i.charCodeAt(n.pos)&&++n.pos,n.pos+1<n.end&&35==i.charCodeAt(n.pos)&&33==i.charCodeAt(n.pos+1))for(n.pos+=2;n.pos<n.end&&10!=i.charCodeAt(n.pos);)++n.pos;return n}return i(t,e),t.prototype.next=function(e){return void 0===e&&(e=!1),this.nextToken=-1,this.token=this.unsafeNext(e)},t.prototype.unsafeNext=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=i32.MAX_VALUE);for(var r=this.source.text;this.pos<this.end;){this.tokenPos=this.pos;var n=r.charCodeAt(this.pos);switch(n){case 13:++this.pos<this.end&&10==r.charCodeAt(this.pos)&&++this.pos;break;case 10:case 9:case 11:case 12:case 32:++this.pos;break;case 33:return++this.pos,t>1&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,t>2&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.EXCLAMATION_EQUALS_EQUALS):a.EXCLAMATION_EQUALS):a.EXCLAMATION;case 34:case 39:case 96:return a.STRINGLITERAL;case 37:return++this.pos,t>1&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.PERCENT_EQUALS):a.PERCENT;case 38:if(++this.pos,t>1&&this.pos<this.end){if(38==r.charCodeAt(this.pos))return++this.pos,a.AMPERSAND_AMPERSAND;if(61==r.charCodeAt(this.pos))return++this.pos,a.AMPERSAND_EQUALS}return a.AMPERSAND;case 40:return++this.pos,a.OPENPAREN;case 41:return++this.pos,a.CLOSEPAREN;case 42:if(++this.pos,t>1&&this.pos<this.end){if(61==r.charCodeAt(this.pos))return++this.pos,a.ASTERISK_EQUALS;if(42==r.charCodeAt(this.pos))return++this.pos,t>2&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.ASTERISK_ASTERISK_EQUALS):a.ASTERISK_ASTERISK}return a.ASTERISK;case 43:if(++this.pos,t>1&&this.pos<this.end){if(43==r.charCodeAt(this.pos))return++this.pos,a.PLUS_PLUS;if(61==r.charCodeAt(this.pos))return++this.pos,a.PLUS_EQUALS}return a.PLUS;case 44:return++this.pos,a.COMMA;case 45:if(++this.pos,t>1&&this.pos<this.end){if(45==r.charCodeAt(this.pos))return++this.pos,a.MINUS_MINUS;if(61==r.charCodeAt(this.pos))return++this.pos,a.MINUS_EQUALS}return a.MINUS;case 46:if(++this.pos,t>1&&this.pos<this.end){if(s.isDecimalDigit(r.charCodeAt(this.pos)))return--this.pos,a.FLOATLITERAL;if(t>2&&this.pos+1<this.end&&46==r.charCodeAt(this.pos)&&46==r.charCodeAt(this.pos+1))return this.pos+=2,a.DOT_DOT_DOT}return a.DOT;case 47:if(++this.pos,t>1&&this.pos<this.end){if(47==r.charCodeAt(this.pos)){for(;++this.pos<this.end&&!s.isLineBreak(r.charCodeAt(this.pos)););continue}if(42==r.charCodeAt(this.pos)){for(var i=!1;++this.pos<this.end;)if(42==(n=r.charCodeAt(this.pos))&&this.pos+1<this.end&&47==r.charCodeAt(this.pos+1)){this.pos+=2,i=!0;break}i||this.error(o.DiagnosticCode._0_expected,this.range(this.pos),"*/");continue}if(61==r.charCodeAt(this.pos))return++this.pos,a.SLASH_EQUALS}return a.SLASH;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.testInteger()?a.INTEGERLITERAL:a.FLOATLITERAL;case 58:return++this.pos,a.COLON;case 59:return++this.pos,a.SEMICOLON;case 60:if(++this.pos,t>1&&this.pos<this.end){if(60==r.charCodeAt(this.pos))return++this.pos,t>2&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.LESSTHAN_LESSTHAN_EQUALS):a.LESSTHAN_LESSTHAN;if(61==r.charCodeAt(this.pos))return++this.pos,a.LESSTHAN_EQUALS}return a.LESSTHAN;case 61:if(++this.pos,t>1&&this.pos<this.end){if(61==r.charCodeAt(this.pos))return++this.pos,t>2&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.EQUALS_EQUALS_EQUALS):a.EQUALS_EQUALS;if(62==r.charCodeAt(this.pos))return++this.pos,a.EQUALS_GREATERTHAN}return a.EQUALS;case 62:if(++this.pos,t>1&&this.pos<this.end){if(62==r.charCodeAt(this.pos)){if(++this.pos,t>2&&this.pos<this.end){if(62==r.charCodeAt(this.pos))return++this.pos,t>3&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS):a.GREATERTHAN_GREATERTHAN_GREATERTHAN;if(61==r.charCodeAt(this.pos))return++this.pos,a.GREATERTHAN_GREATERTHAN_EQUALS}return a.GREATERTHAN_GREATERTHAN}if(61==r.charCodeAt(this.pos))return++this.pos,a.GREATERTHAN_EQUALS}return a.GREATERTHAN;case 63:return++this.pos,a.QUESTION;case 91:return++this.pos,a.OPENBRACKET;case 93:return++this.pos,a.CLOSEBRACKET;case 94:return++this.pos,t>1&&this.pos<this.end&&61==r.charCodeAt(this.pos)?(++this.pos,a.CARET_EQUALS):a.CARET;case 123:return++this.pos,a.OPENBRACE;case 124:if(++this.pos,t>1&&this.pos<this.end){if(124==r.charCodeAt(this.pos))return++this.pos,a.BAR_BAR;if(61==r.charCodeAt(this.pos))return++this.pos,a.BAR_EQUALS}return a.BAR;case 125:return++this.pos,a.CLOSEBRACE;case 126:return++this.pos,a.TILDE;case 64:return++this.pos,a.AT;default:if(s.isIdentifierStart(n)){if(s.isKeywordCharacter(n)){for(var c=this.pos;++this.pos<this.end&&s.isIdentifierPart(n=r.charCodeAt(this.pos));)if(!s.isKeywordCharacter(n))return this.pos=c,a.IDENTIFIER;var p=r.substring(c,this.pos),u=a.fromKeyword(p);if(!(u==a.INVALID||e&&a.isAlsoIdentifier(u)))return u;this.pos=c}return a.IDENTIFIER}if(s.isWhiteSpace(n)){++this.pos;break}return this.error(o.DiagnosticCode.Invalid_character,this.range(this.pos,this.pos+1)),++this.pos,a.INVALID}}return a.ENDOFFILE},t.prototype.peek=function(e,t,r){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===r&&(r=i32.MAX_VALUE);var n=this.source.text;if(this.nextToken<0){var i=this.pos,a=this.token,o=this.tokenPos;if(this.nextToken=this.unsafeNext(t,r),e)for(this.nextTokenOnNewLine=!1;--this.tokenPos>i;)if(s.isLineBreak(n.charCodeAt(this.tokenPos))){this.nextTokenOnNewLine=!0;break}this.pos=i,this.token=a,this.tokenPos=o}return this.nextToken},t.prototype.skip=function(e){var t=this.pos,r=this.token,n=this.tokenPos,i=i32.MAX_VALUE;switch(e){case a.GREATERTHAN:i=1}return this.token=this.unsafeNext(e==a.IDENTIFIER,i),this.token==e?(this.nextToken=-1,!0):(this.pos=t,this.token=r,this.tokenPos=n,!1)},t.prototype.mark=function(){var e;return l?(e=l,l=null):e=new u,e.pos=this.pos,e.token=this.token,e.tokenPos=this.tokenPos,e},t.prototype.discard=function(e){l=e},t.prototype.reset=function(e){this.pos=e.pos,this.token=e.token,this.tokenPos=e.tokenPos,this.nextToken=-1,l=e},t.prototype.range=function(e,t){return void 0===e&&(e=-1),void 0===t&&(t=-1),e<0?(e=this.tokenPos,t=this.pos):t<0&&(t=e),new c(this.source,e,t)},t.prototype.readIdentifier=function(){for(var e=this.source.text,t=this.pos;++this.pos<this.end&&s.isIdentifierPart(e.charCodeAt(this.pos)););return e.substring(t,this.pos)},t.prototype.readString=function(){for(var e=this.source.text,t=e.charCodeAt(this.pos++),r=this.pos,n="";;){if(this.pos>=this.end){n+=e.substring(r,this.pos),this.error(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(s.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&&123==e.charCodeAt(this.pos)?(++this.pos,this.readExtendedUnicodeEscape()):this.readUnicodeEscape();case 13:this.pos<this.end&&10==e.charCodeAt(this.pos)&&++this.pos;case 10:case 8232:case 8233:return"";default:return String.fromCharCode(t)}},t.prototype.readRegexpPattern=function(){for(var e=this.source.text,t=this.pos,r=!1;;){if(this.pos>=this.end){this.error(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(s.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.pos<this.end;){var n=e.charCodeAt(this.pos);if(!s.isIdentifierPart(n))break;switch(++this.pos,n){case 103:r|=1&r?-1:1;break;case 105:r|=2&r?-1:2;break;case 109:r|=4&r?-1:4;break;default:r=-1}}return-1==r&&this.error(o.DiagnosticCode.Invalid_regular_expression_flags,this.range(t,this.pos)),e.substring(t,this.pos)},t.prototype.testInteger=function(){var e=this.source.text;if(48==e.charCodeAt(this.pos)&&this.pos+1<this.end)switch(e.charCodeAt(this.pos+2)){case 88:case 120:case 66:case 98:case 79:case 111:return!0}for(var t=this.pos;t<this.end;){var r=e.charCodeAt(t);if(46==r||69==r||101==r)return!1;if(r<48||r>57)break;t++}return!0},t.prototype.readInteger=function(){var e=this.source.text;if(48==e.charCodeAt(this.pos)&&this.pos+2<this.end){switch(e.charCodeAt(this.pos+1)){case 88:case 120:return this.pos+=2,this.readHexInteger();case 66:case 98:return this.pos+=2,this.readBinaryInteger();case 79:case 111:return this.pos+=2,this.readOctalInteger()}if(s.isOctalDigit(e.charCodeAt(this.pos+1))){var t=this.pos;++this.pos;var r=this.readOctalInteger();return this.error(o.DiagnosticCode.Octal_literals_are_not_allowed_in_strict_mode,this.range(t,this.pos)),r}}return this.readDecimalInteger()},t.prototype.readHexInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0,0),n=i64_new(16,0);this.pos<this.end;){var i=e.charCodeAt(this.pos);if(i>=48&&i<=57)r=i64_add(i64_mul(r,n),i64_new(i-48,0));else if(i>=65&&i<=70)r=i64_add(i64_mul(r,n),i64_new(10+i-65,0));else{if(!(i>=97&&i<=102))break;r=i64_add(i64_mul(r,n),i64_new(10+i-97,0))}++this.pos}return this.pos==t&&this.error(o.DiagnosticCode.Hexadecimal_digit_expected,this.range(t)),r},t.prototype.readDecimalInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0,0),n=i64_new(10,0);this.pos<this.end;){var i=e.charCodeAt(this.pos);if(!(i>=48&&i<=57))break;r=i64_add(i64_mul(r,n),i64_new(i-48,0)),++this.pos}return this.pos==t&&this.error(o.DiagnosticCode.Digit_expected,this.range(t)),r},t.prototype.readOctalInteger=function(){for(var e=this.source.text,t=this.pos,r=i64_new(0,0),n=i64_new(8,0);this.pos<this.end;){var i=e.charCodeAt(this.pos);if(!(i>=48&&i<=55))break;r=i64_add(i64_mul(r,n),i64_new(i-48,0)),++this.pos}return this.pos==t&&this.error(o.DiagnosticCode.Octal_digit_expected,this.range(t)),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);this.pos<this.end;){var a=e.charCodeAt(this.pos);if(48==a)r=i64_mul(r,n);else{if(49!=a)break;r=i64_add(i64_mul(r,n),i)}++this.pos}return this.pos==t&&this.error(o.DiagnosticCode.Binary_digit_expected,this.range(t)),r},t.prototype.readFloat=function(){for(var e=this.pos,t=this.source.text;this.pos<this.end&&s.isDecimalDigit(t.charCodeAt(this.pos));)++this.pos;if(this.pos<this.end&&46==t.charCodeAt(this.pos))for(++this.pos;this.pos<this.end&&s.isDecimalDigit(t.charCodeAt(this.pos));)++this.pos;if(this.pos<this.end){var r=t.charCodeAt(this.pos);if(69==r||101==r)for(++this.pos<this.end&&(45==t.charCodeAt(this.pos)||43==t.charCodeAt(this.pos))&&s.isDecimalDigit(t.charCodeAt(this.pos+1))&&++this.pos;this.pos<this.end&&s.isDecimalDigit(t.charCodeAt(this.pos));)++this.pos}return parseFloat(t.substring(e,this.pos))},t.prototype.readUnicodeEscape=function(){for(var e=4,t=0,r=this.source.text;this.pos<this.end;){var n=r.charCodeAt(this.pos++);if(n>=48&&n<=57)t=16*t+n-48;else if(n>=65&&n<=70)t=16*t+10+n-65;else{if(!(n>=97&&n<=102))return this.error(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=p;var u=function(){return function(){}}();t.State=u;var l=null},function(e,t,r){"use strict";var n,i=this&&this.__extends||(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])},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(2),o=r(3);t.Token=o.Token,t.Range=o.Range;var s,c=r(8);!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.COMMA=9]="COMMA",e[e.ELEMENTACCESS=10]="ELEMENTACCESS",e[e.FALSE=11]="FALSE",e[e.FUNCTION=12]="FUNCTION",e[e.FUNCTIONARROW=13]="FUNCTIONARROW",e[e.LITERAL=14]="LITERAL",e[e.NEW=15]="NEW",e[e.NULL=16]="NULL",e[e.PARENTHESIZED=17]="PARENTHESIZED",e[e.PROPERTYACCESS=18]="PROPERTYACCESS",e[e.TERNARY=19]="TERNARY",e[e.SUPER=20]="SUPER",e[e.THIS=21]="THIS",e[e.TRUE=22]="TRUE",e[e.CONSTRUCTOR=23]="CONSTRUCTOR",e[e.UNARYPOSTFIX=24]="UNARYPOSTFIX",e[e.UNARYPREFIX=25]="UNARYPREFIX",e[e.BLOCK=26]="BLOCK",e[e.BREAK=27]="BREAK",e[e.CONTINUE=28]="CONTINUE",e[e.DO=29]="DO",e[e.EMPTY=30]="EMPTY",e[e.EXPORT=31]="EXPORT",e[e.EXPORTIMPORT=32]="EXPORTIMPORT",e[e.EXPRESSION=33]="EXPRESSION",e[e.FOR=34]="FOR",e[e.IF=35]="IF",e[e.IMPORT=36]="IMPORT",e[e.RETURN=37]="RETURN",e[e.SWITCH=38]="SWITCH",e[e.THROW=39]="THROW",e[e.TRY=40]="TRY",e[e.VARIABLE=41]="VARIABLE",e[e.VOID=42]="VOID",e[e.WHILE=43]="WHILE",e[e.CLASSDECLARATION=44]="CLASSDECLARATION",e[e.ENUMDECLARATION=45]="ENUMDECLARATION",e[e.ENUMVALUEDECLARATION=46]="ENUMVALUEDECLARATION",e[e.FIELDDECLARATION=47]="FIELDDECLARATION",e[e.FUNCTIONDECLARATION=48]="FUNCTIONDECLARATION",e[e.IMPORTDECLARATION=49]="IMPORTDECLARATION",e[e.INTERFACEDECLARATION=50]="INTERFACEDECLARATION",e[e.METHODDECLARATION=51]="METHODDECLARATION",e[e.NAMESPACEDECLARATION=52]="NAMESPACEDECLARATION",e[e.TYPEDECLARATION=53]="TYPEDECLARATION",e[e.VARIABLEDECLARATION=54]="VARIABLEDECLARATION",e[e.DECORATOR=55]="DECORATOR",e[e.MODIFIER=56]="MODIFIER",e[e.EXPORTMEMBER=57]="EXPORTMEMBER",e[e.SWITCHCASE=58]="SWITCHCASE"}(s=t.NodeKind||(t.NodeKind={}));var p=function(){function e(){this.parent=null}return e.createType=function(e,t,r,n){var i=new l;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){var n=new h;return n.range=r,n.name=e,e.parent=n,n.extendsType=t,t&&(t.parent=n),n},e.createParameter=function(e,t,r,n,i){var a=new d;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 _;return a.range=i,a.parameterTypes=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;if(n.range=r,n.name=e,e.parent=n,n.arguments=t,t&&De(t,n),e.kind==s.IDENTIFIER)switch(e.text){case"global":n.decoratorKind=1;break;case"operator":n.decoratorKind=2;break;case"unmanaged":n.decoratorKind=3;break;case"offset":n.decoratorKind=4;break;default:n.decoratorKind=0}else n.decoratorKind=0;return n},e.createModifier=function(e,t){var r=new m;return r.range=t,r.modifierKind=e,r},e.createIdentifierExpression=function(e,t){var r=new E;return r.range=t,r.text=e,r},e.createEmptyIdentifierExpression=function(e){var t=new E;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<n;++r){var i=e[r];i&&(i.parent=t)}}(e,r),r},e.createAssertionExpression=function(e,t,r,n){var i=new I;return i.range=n,i.assertionKind=e,i.expression=t,t.parent=i,i.toType=r,r.parent=i,i},e.createBinaryExpression=function(e,t,r,n){var i=new v;return i.range=n,i.operator=e,i.left=t,t.parent=i,i.right=r,r.parent=i,i},e.createCallExpression=function(e,t,r,n){var i=new N;return i.range=n,i.expression=e,e.parent=i,i.typeArguments=t,t&&De(t,i),i.arguments=r,De(r,i),i},e.createCommaExpression=function(e,t){var r=new S;return r.range=t,r.expressions=e,De(e,r),r},e.createConstructorExpression=function(e){var t=new C;return t.range=e,t},e.createElementAccessExpression=function(e,t,r){var n=new b;return n.range=r,n.expression=e,e.parent=n,n.elementExpression=t,t.parent=n,n},e.createFalseExpression=function(e){var t=new z;return t.range=e,t},e.createFloatLiteralExpression=function(e,t){var r=new O;return r.range=t,r.value=e,r},e.createFunctionExpression=function(e,t){void 0===t&&(t=!1);var r=t?new x:new k;return r.range=e.range,r.declaration=e,r},e.createIntegerLiteralExpression=function(e,t){var r=new L;return r.range=t,r.value=e,r},e.createNewExpression=function(e,t,r,n){var i=new R;return i.range=n,i.expression=e,e.parent=i,i.typeArguments=t,t&&De(t,i),i.arguments=r,De(r,i),i},e.createNullExpression=function(e){var t=new B;return t.range=e,t},e.createParenthesizedExpression=function(e,t){var r=new U;return r.range=t,r.expression=e,e.parent=r,r},e.createPropertyAccessExpression=function(e,t,r){var n=new D;return n.range=r,n.expression=e,e.parent=n,n.property=t,t.parent=n,n},e.createRegexpLiteralExpression=function(e,t,r){var n=new F;return n.range=r,n.pattern=e,n.patternFlags=t,n},e.createTernaryExpression=function(e,t,r,n){var i=new P;return i.range=n,i.condition=e,e.parent=i,i.ifThen=t,t.parent=i,i.ifElse=r,r.parent=i,i},e.createStringLiteralExpression=function(e,t){var r=new w;return r.range=t,r.value=e,r},e.createSuperExpression=function(e){var t=new M;return t.range=e,t},e.createThisExpression=function(e){var t=new G;return t.range=e,t},e.createTrueExpression=function(e){var t=new K;return t.range=e,t},e.createUnaryPostfixExpression=function(e,t,r){var n=new V;return n.range=r,n.operator=e,n.operand=t,t.parent=n,n},e.createUnaryPrefixExpression=function(e,t,r){var n=new W;return n.range=r,n.operator=e,n.operand=t,t.parent=n,n},e.createBlockStatement=function(e,t){var r=new Z;return r.range=t,r.statements=e,De(e,r),r},e.createBreakStatement=function(e,t){var r=new $;return r.range=t,r.label=e,e&&(e.parent=r),r},e.createClassDeclaration=function(e,t,r,n,i,a,o,s){var c=new J;return c.range=s,c.name=e,e.parent=c,c.typeParameters=t,De(t,c),c.extendsType=r,r&&(r.parent=c),c.implementsTypes=n,De(n,c),c.members=i,De(i,c),c.modifiers=a,a&&De(a,c),c.decorators=o,o&&De(o,c),c},e.createContinueStatement=function(e,t){var r=new ee;return r.range=t,r.label=e,e&&(e.parent=r),r},e.createDoStatement=function(e,t,r){var n=new te;return n.range=r,n.statement=e,e.parent=n,n.condition=t,t.parent=n,n},e.createEmptyStatement=function(e){var t=new re;return t.range=e,t},e.createEnumDeclaration=function(e,t,r,n,i){var a=new ne;return a.range=i,a.name=e,e.parent=a,a.values=t,De(t,a),a.modifiers=r,r&&De(r,a),a.decorators=n,n&&De(n,a),a},e.createEnumValueDeclaration=function(e,t,r){var n=new ie;return n.range=r,n.name=e,e.parent=n,n.value=t,t&&(t.parent=n),n},e.createExportStatement=function(e,t,r,n){var i=new se;if(i.range=n,i.members=e,De(e,i),i.path=t,t){var a=c.normalize(t.value);t.value.startsWith(".")?i.normalizedPath=c.resolve(a,n.source.normalizedPath):i.normalizedPath=a,i.internalPath=Ue(i.normalizedPath)}else i.normalizedPath=null,i.internalPath=null;return i.modifiers=r,r&&De(r,i),i},e.createExportImportStatement=function(e,t,r){var n=new ae;return n.range=r,n.name=e,e.parent=n,n.externalName=t,t.parent=n,n},e.createExportMember=function(e,t,r){var n=new oe;return n.range=r,n.name=e,e.parent=n,t?t.parent=n:t=e,n.externalName=t,n},e.createExpressionStatement=function(e){var t=new ce;return t.range=e.range,t.expression=e,e.parent=t,t},e.createIfStatement=function(e,t,r,n){var i=new he;return i.range=n,i.condition=e,e.parent=i,i.ifTrue=t,t.parent=i,i.ifFalse=r,r&&(r.parent=i),i},e.createImportStatement=function(e,t,r){var n=new _e;n.range=r,n.declarations=e,e&&De(e,n),n.namespaceName=null,n.path=t;var i=c.normalize(t.value);return t.value.startsWith(".")?n.normalizedPath=c.resolve(i,r.source.normalizedPath):n.normalizedPath=i,n.internalPath=Ue(n.normalizedPath),n},e.createImportStatementWithWildcard=function(e,t,r){var n=new _e;return n.range=r,n.declarations=null,n.namespaceName=e,n.path=t,n.normalizedPath=c.resolve(c.normalize(t.value),r.source.normalizedPath),n.internalPath=Ue(n.normalizedPath),n},e.createImportDeclaration=function(e,t,r){var n=new de;return n.range=r,n.externalName=e,e.parent=n,t?t.parent=n:t=e,n.name=t,n},e.createInterfaceDeclaration=function(e,t,r,n,i){var a=new ye;return a.range=i,a.name=e,e.parent=a,a.extendsType=t,t&&(t.parent=a),a.members=r,De(r,a),a.modifiers=n,n&&De(n,a),a},e.createFieldDeclaration=function(e,t,r,n,i,a){var o=new pe;return o.range=a,o.name=e,e.parent=o,o.type=t,t&&(t.parent=o),o.initializer=r,r&&(r.parent=o),o.modifiers=n,n&&De(n,o),o.decorators=i,i&&De(i,o),o},e.createForStatement=function(e,t,r,n,i){var a=new ue;return a.range=i,a.initializer=e,e&&(e.parent=a),a.condition=t,t&&(t.parent=a),a.incrementor=r,r&&(r.parent=a),a.statement=n,n.parent=a,a},e.createFunctionDeclaration=function(e,t,r,n,i,a,o){var s=new le;return s.range=o,s.name=e,e.parent=s,s.typeParameters=t,t&&De(t,s),s.signature=r,r.parent=s,s.body=n,n&&(n.parent=s),s.modifiers=i,i&&De(i,s),s.decorators=a,a&&De(a,s),s},e.createMethodDeclaration=function(e,t,r,n,i,a,o){var s=new ge;return s.range=o,s.name=e,e.parent=s,s.typeParameters=t,t&&De(t,s),s.signature=r,r.parent=s,s.body=n,n&&(n.parent=s),s.modifiers=i,i&&De(i,s),s.decorators=a,a&&De(a,s),s},e.createNamespaceDeclaration=function(e,t,r,n,i){var a=new me;return a.range=i,a.name=e,e.parent=a,a.members=t,De(t,a),a.modifiers=r,r&&De(r,a),a.decorators=n,n&&De(n,a),a},e.createReturnStatement=function(e,t){var r=new fe;return r.range=t,r.value=e,e&&(e.parent=r),r},e.createSwitchStatement=function(e,t,r){var n=new Te;return n.range=r,n.condition=e,e.parent=n,n.cases=t,De(t,n),n},e.createSwitchCase=function(e,t,r){var n=new Ee;return n.range=r,n.label=e,e&&(e.parent=n),n.statements=t,De(t,n),n},e.createThrowStatement=function(e,t){var r=new Ae;return r.range=t,r.value=e,e.parent=r,r},e.createTryStatement=function(e,t,r,n,i){var a=new Ie;return a.range=i,a.statements=e,De(e,a),a.catchVariable=t,t&&(t.parent=a),a.catchStatements=r,r&&De(r,a),a.finallyStatements=n,n&&De(n,a),a},e.createTypeDeclaration=function(e,t,r,n,i,a){var o=new ve;return o.range=a,o.name=e,e.parent=o,o.typeParameters=t,t&&De(t,o),o.type=r,r.parent=o,o.modifiers=n,n&&De(n,o),o.decorators=i,i&&De(i,o),o},e.createVariableStatement=function(e,t,r,n){var i=new Se;return i.range=n,i.declarations=e,De(e,i),i.modifiers=t,t&&De(t,i),i.decorators=r,r&&De(r,i),i},e.createVariableDeclaration=function(e,t,r,n,i,a){var o=new Ne;return o.range=a,o.name=e,e.parent=o,o.type=t,t&&(t.parent=o),o.initializer=r,r&&(r.parent=o),o.modifiers=n,o.decorators=i,o},e.createVoidStatement=function(e,t){var r=new Ce;return r.range=t,r.expression=e,r},e.createWhileStatement=function(e,t,r){var n=new be;return n.range=r,n.condition=e,e.parent=n,n.statement=t,t.parent=n,n},e}();t.Node=p;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(p);t.CommonTypeNode=u;var l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TYPE,t}return i(t,e),t}(u);t.TypeNode=l;var h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TYPEPARAMETER,t}return i(t,e),t}(p);t.TypeParameterNode=h,function(e){e[e.DEFAULT=0]="DEFAULT",e[e.OPTIONAL=1]="OPTIONAL",e[e.REST=2]="REST"}(t.ParameterKind||(t.ParameterKind={}));var d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.PARAMETER,t}return i(t,e),t}(p);t.ParameterNode=d;var _=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.SIGNATURE,t}return i(t,e),t}(u);t.SignatureNode=_,function(e){e[e.CUSTOM=0]="CUSTOM",e[e.GLOBAL=1]="GLOBAL",e[e.OPERATOR=2]="OPERATOR",e[e.UNMANAGED=3]="UNMANAGED",e[e.OFFSET=4]="OFFSET"}(t.DecoratorKind||(t.DecoratorKind={}));var y,g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.DECORATOR,t}return i(t,e),t}(p);t.DecoratorNode=g,function(e){e[e.ASYNC=0]="ASYNC",e[e.CONST=1]="CONST",e[e.LET=2]="LET",e[e.DECLARE=3]="DECLARE",e[e.EXPORT=4]="EXPORT",e[e.IMPORT=5]="IMPORT",e[e.STATIC=6]="STATIC",e[e.ABSTRACT=7]="ABSTRACT",e[e.PUBLIC=8]="PUBLIC",e[e.PRIVATE=9]="PRIVATE",e[e.PROTECTED=10]="PROTECTED",e[e.READONLY=11]="READONLY",e[e.GET=12]="GET",e[e.SET=13]="SET"}(y=t.ModifierKind||(t.ModifierKind={}));var m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.MODIFIER,t}return i(t,e),t}(p);t.ModifierNode=m;var f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(p);t.Expression=f;var E=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.IDENTIFIER,t}return i(t,e),t}(f);t.IdentifierExpression=E,function(e){e[e.FLOAT=0]="FLOAT",e[e.INTEGER=1]="INTEGER",e[e.STRING=2]="STRING",e[e.REGEXP=3]="REGEXP",e[e.ARRAY=4]="ARRAY",e[e.OBJECT=5]="OBJECT"}(t.LiteralKind||(t.LiteralKind={}));var T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.LITERAL,t}return i(t,e),t}(f);t.LiteralExpression=T;var A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=4,t}return i(t,e),t}(T);t.ArrayLiteralExpression=A,function(e){e[e.PREFIX=0]="PREFIX",e[e.AS=1]="AS"}(t.AssertionKind||(t.AssertionKind={}));var I=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.ASSERTION,t}return i(t,e),t}(f);t.AssertionExpression=I;var v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.BINARY,t}return i(t,e),t}(f);t.BinaryExpression=v;var N=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CALL,t}return i(t,e),t}(f);t.CallExpression=N;var S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.COMMA,t}return i(t,e),t}(f);t.CommaExpression=S;var C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CONSTRUCTOR,t.text="constructor",t}return i(t,e),t}(E);t.ConstructorExpression=C;var b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.ELEMENTACCESS,t}return i(t,e),t}(f);t.ElementAccessExpression=b;var O=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=0,t}return i(t,e),t}(T);t.FloatLiteralExpression=O;var k=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FUNCTION,t}return i(t,e),t}(f);t.FunctionExpression=k;var x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FUNCTIONARROW,t}return i(t,e),t}(k);t.FunctionArrowExpression=x;var L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=1,t}return i(t,e),t}(T);t.IntegerLiteralExpression=L;var R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.NEW,t}return i(t,e),t}(N);t.NewExpression=R;var B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.NULL,t.text="null",t}return i(t,e),t}(E);t.NullExpression=B;var U=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.PARENTHESIZED,t}return i(t,e),t}(f);t.ParenthesizedExpression=U;var D=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.PROPERTYACCESS,t}return i(t,e),t}(f);t.PropertyAccessExpression=D;var F=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=3,t}return i(t,e),t}(T);t.RegexpLiteralExpression=F;var P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TERNARY,t}return i(t,e),t}(f);t.TernaryExpression=P;var w=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.literalKind=2,t}return i(t,e),t}(T);t.StringLiteralExpression=w;var M=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.SUPER,t.text="super",t}return i(t,e),t}(E);t.SuperExpression=M;var G=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.THIS,t.text="this",t}return i(t,e),t}(E);t.ThisExpression=G;var K=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TRUE,t.text="true",t}return i(t,e),t}(E);t.TrueExpression=K;var z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FALSE,t.text="false",t}return i(t,e),t}(E);t.FalseExpression=z;var H=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(f);t.UnaryExpression=H;var V=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.UNARYPOSTFIX,t}return i(t,e),t}(H);t.UnaryPostfixExpression=V;var W=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.UNARYPREFIX,t}return i(t,e),t}(H);t.UnaryPrefixExpression=W;var Q,Y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(p);t.Statement=Y,function(e){e[e.DEFAULT=0]="DEFAULT",e[e.ENTRY=1]="ENTRY",e[e.LIBRARY=2]="LIBRARY"}(Q=t.SourceKind||(t.SourceKind={}));var X=function(e){function t(t,r,n){var i=e.call(this)||this;return i.kind=s.SOURCE,i.parent=null,i.tokenizer=null,i.debugInfoIndex=-1,i.sourceKind=n,i.normalizedPath=t,i.internalPath=Ue(i.normalizedPath),i.statements=new Array,i.range=new o.Range(i,0,r.length),i.text=r,i}return i(t,e),Object.defineProperty(t.prototype,"isEntry",{get:function(){return this.sourceKind==Q.ENTRY},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLibrary",{get:function(){return this.sourceKind==Q.LIBRARY},enumerable:!0,configurable:!0}),t}(p);t.Source=X;var q=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=Be(this,!0)),this.cachedProgramLevelInternalName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fileLevelInternalName",{get:function(){return this.cachedFileLevelInternalName||(this.cachedFileLevelInternalName=Be(this,!1)),this.cachedFileLevelInternalName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isTopLevel",{get:function(){var e=this.parent;return!!e&&(!(e.kind==s.VARIABLE&&!(e=e.parent))&&e.kind==s.SOURCE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isTopLevelExport",{get:function(){var e=this.parent;return!(!e||e.kind==s.VARIABLE&&!(e=e.parent))&&(e.kind==s.NAMESPACEDECLARATION?Le(y.EXPORT,this.modifiers)&&e.isTopLevelExport:e.kind==s.CLASSDECLARATION?Le(y.STATIC,this.modifiers)&&e.isTopLevelExport:e.kind==s.SOURCE&&Le(y.EXPORT,this.modifiers))},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}(Y);t.DeclarationStatement=q;var j=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(q);t.VariableLikeDeclarationStatement=j;var Z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.BLOCK,t}return i(t,e),t}(Y);t.BlockStatement=Z;var $=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.BREAK,t}return i(t,e),t}(Y);t.BreakStatement=$;var J=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CLASSDECLARATION,t}return i(t,e),Object.defineProperty(t.prototype,"isGeneric",{get:function(){var e=this.typeParameters;return null!=e&&e.length>0},enumerable:!0,configurable:!0}),t}(q);t.ClassDeclaration=J;var ee=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.CONTINUE,t}return i(t,e),t}(Y);t.ContinueStatement=ee;var te=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.DO,t}return i(t,e),t}(Y);t.DoStatement=te;var re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EMPTY,t}return i(t,e),t}(Y);t.EmptyStatement=re;var ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.ENUMDECLARATION,t}return i(t,e),t}(q);t.EnumDeclaration=ne;var ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.ENUMVALUEDECLARATION,t.modifiers=null,t}return i(t,e),t}(q);t.EnumValueDeclaration=ie;var ae=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EXPORTIMPORT,t}return i(t,e),t}(p);t.ExportImportStatement=ae;var oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EXPORTMEMBER,t}return i(t,e),t}(p);t.ExportMember=oe;var se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EXPORT,t}return i(t,e),t}(Y);t.ExportStatement=se;var ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.EXPRESSION,t}return i(t,e),t}(Y);t.ExpressionStatement=ce;var pe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FIELDDECLARATION,t}return i(t,e),t}(j);t.FieldDeclaration=pe;var ue=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FOR,t}return i(t,e),t}(Y);t.ForStatement=ue;var le=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.FUNCTIONDECLARATION,t}return i(t,e),Object.defineProperty(t.prototype,"isGeneric",{get:function(){var e=this.typeParameters;return null!=e&&e.length>0},enumerable:!0,configurable:!0}),t}(q);t.FunctionDeclaration=le;var he=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.IF,t}return i(t,e),t}(Y);t.IfStatement=he;var de=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.IMPORTDECLARATION,t.modifiers=null,t}return i(t,e),t}(q);t.ImportDeclaration=de;var _e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.IMPORT,t}return i(t,e),t}(Y);t.ImportStatement=_e;var ye=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.INTERFACEDECLARATION,t}return i(t,e),t}(J);t.InterfaceDeclaration=ye;var ge=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.METHODDECLARATION,t}return i(t,e),t}(le);t.MethodDeclaration=ge;var me=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.NAMESPACEDECLARATION,t}return i(t,e),t}(q);t.NamespaceDeclaration=me;var fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.RETURN,t}return i(t,e),t}(Y);t.ReturnStatement=fe;var Ee=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.SWITCHCASE,t}return i(t,e),t}(p);t.SwitchCase=Ee;var Te=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.SWITCH,t}return i(t,e),t}(Y);t.SwitchStatement=Te;var Ae=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.THROW,t}return i(t,e),t}(Y);t.ThrowStatement=Ae;var Ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TRY,t}return i(t,e),t}(Y);t.TryStatement=Ie;var ve=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.TYPEDECLARATION,t}return i(t,e),t}(q);t.TypeDeclaration=ve;var Ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.VARIABLEDECLARATION,t}return i(t,e),t}(j);t.VariableDeclaration=Ne;var Se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.VARIABLE,t}return i(t,e),t}(Y);t.VariableStatement=Se;var Ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.VOID,t}return i(t,e),t}(Y);t.VoidStatement=Ce;var be=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.kind=s.WHILE,t}return i(t,e),t}(Y);t.WhileStatement=be;var Oe=null;function ke(){var e;return null!=Oe?(e=Oe,Oe=null):e=[],e.length=0,e}function xe(e,t){if(t)for(var r=0,n=t.length;r<n;++r)if(t[r].modifierKind==e)return t[r];return null}function Le(e,t){return null!=xe(e,t)}function Re(e,t){if(t)for(var r=0,n=t.length;r<n;++r){var i=t[r],a=i.name;if(a.kind==s.IDENTIFIER&&a.text==e)return i}return null}function Be(e,t){void 0===t&&(t=!1);var r=e.name.text,n=e.parent;return n&&(e.kind!=s.VARIABLEDECLARATION||n.kind!=s.VARIABLE||(n=n.parent))?n.kind==s.CLASSDECLARATION?Be(n,t)+(Le(y.STATIC,e.modifiers)?a.STATIC_DELIMITER:a.INSTANCE_DELIMITER)+r:n.kind==s.NAMESPACEDECLARATION||n.kind==s.ENUMDECLARATION?Be(n,t)+a.STATIC_DELIMITER+r:t?r:e.range.source.internalPath+a.PATH_DELIMITER+r:r}function Ue(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<n;++r)e[r].parent=t}t.setReusableModifiers=function(e){Oe=e},t.createModifiers=ke,t.addModifier=function(e,t){return null==t&&(t=ke()),t.push(e),t},t.getModifier=xe,t.hasModifier=Le,t.getFirstDecorator=Re,t.hasDecorator=function(e,t){return null!=Re(e,t)},t.mangleInternalName=Be,t.mangleInternalPath=Ue},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);!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.VOID=13]="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.SIZE=16]="SIZE",e[e.SMALL=32]="SMALL",e[e.LONG=64]="LONG",e[e.VALUE=128]="VALUE",e[e.REFERENCE=256]="REFERENCE",e[e.NULLABLE=512]="NULLABLE"}(t.TypeFlags||(t.TypeFlags={}));var i=function(){function e(e,t,r){this.nullableType=null,this.kind=e,this.flags=t,this.size=r,this.byteSize=ceil(r/8),this.classType=null,this.nonNullableType=this}return e.prototype.computeSmallIntegerShift=function(e){return e.size-this.size},e.prototype.computeSmallIntegerMask=function(e){return-1>>>e.size-this.size},e.prototype.is=function(e){return(this.flags&e)==e},Object.defineProperty(e.prototype,"isClass",{get:function(){return null!=this.classType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isFunction",{get:function(){return null!=this.functionType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isReference",{get:function(){return null!=this.classType||null!=this.functionType},enumerable:!0,configurable:!0}),e.prototype.asClass=function(t){assert(9==this.kind&&!this.classType);var r=new e(this.kind,-129&this.flags|256,this.size);return r.classType=t,r},e.prototype.asFunction=function(t){assert(7==this.kind&&!this.functionType);var r=new e(this.kind,-129&this.flags|256,this.size);return r.functionType=t,r},e.prototype.asNullable=function(){return assert(this.isReference),this.nullableType||(assert(!this.is(512)),this.nullableType=new e(this.kind,512|this.flags,this.size),this.nullableType.classType=this.classType,this.nullableType.functionType=this.functionType),this.nullableType},e.prototype.isAssignableTo=function(e,t){var r,n,i,a;if(void 0===t&&(t=!1),this.isReference){if(e.isReference)if(r=this.classType){if(n=e.classType)return r.isAssignableTo(n)}else if((i=this.functionType)&&(a=e.functionType))return i.isAssignableTo(a)}else if(!e.isReference)if(this.is(4))if(e.is(4)){if(!t||this.is(1)==e.is(1))return this.size<=e.size}else{if(11==e.kind)return this.size<=23;if(12==e.kind)return this.size<=52}else if(this.is(8)&&e.is(8))return this.size<=e.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){switch(void 0===e&&(e=!1),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:var t=this.functionType;return e||!t?"u32":t.toString(!0);case 8:return"u64";case 9:var r=this.classType;return e||!r?"usize":r.toString();case 10:return"bool";case 11:return"f32";case 12:return"f64";case 13:return"void";default:return assert(!1),""}},e.prototype.toNativeType=function(){switch(this.kind){default:return n.NativeType.I32;case 3:case 8:return n.NativeType.I64;case 4:case 9:return 64==this.size?n.NativeType.I64:n.NativeType.I32;case 11:return n.NativeType.F32;case 12:return n.NativeType.F64;case 13:return n.NativeType.None}},e.prototype.toNativeZero=function(e){switch(this.kind){case 13: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)}},e.prototype.toNativeOne=function(e){switch(this.kind){case 13: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: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"}},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.void=new e(13,0,0),e}();t.Type=i,t.typesToNativeTypes=function(e){for(var t=e.length,r=new Array(t),n=0;n<t;++n)r[n]=e[n].toNativeType();return r},t.typesToString=function(e){var t=e.length;if(!t)return"";for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n].toString();return r.join(", ")};var a=function(){function e(e,t,r){void 0===e&&(e=null),void 0===t&&(t=null),void 0===r&&(r=null),this.cachedFunctionTarget=null,this.parameterTypes=e||[],this.parameterNames=null,this.requiredParameters=0,this.returnType=t||i.void,this.thisType=r,this.hasRest=!1}return e.prototype.getParameterName=function(e){var t=this.parameterNames;return t&&t.length>e?t[e]:s(e)},e.prototype.isAssignableTo=function(e){var t=this.thisType,r=e.thisType;if(t){if(!r||!t.isAssignableTo(r))return!1}else if(r)return!1;if(this.hasRest!=e.hasRest)return!1;var n=this.parameterTypes,i=e.parameterTypes,a=n.length;if(a!=i.length)return!1;for(var o=0;o<a;++o){var s=n[o],c=i[o];if(!s.isAssignableTo(c))return!1}return this.returnType.isAssignableTo(e.returnType)},e.prototype.toSignatureString=function(){var e=[],t=this.thisType;t&&e.push(t.toSignatureString());for(var r=this.parameterTypes,n=0,i=r.length;n<i;++n)e.push(r[n].toSignatureString());return e.push(this.returnType.toSignatureString()),e.join("")},e.prototype.toString=function(e){void 0===e&&(e=!1);var t=new Array;t.push("(");var r=0,n=this.thisType;n&&e&&(t.push("this: "),t.push(n.toString()),r=1);var i=this.parameterTypes,a=i.length;if(a)for(var o=this.parameterNames,c=o?o.length:0,p=this.requiredParameters,u=this.hasRest?a-1:-1,l=0;l<a;++l,++r)r&&t.push(", "),l==u&&t.push("..."),l<c?t.push(o[l]):t.push(s(l)),l>=p&&l!=u?t.push("?: "):t.push(": "),t.push(i[l].toString());return t.push(") => "),t.push(this.returnType.toString()),t.join("")},e}();t.Signature=a;var o=null;function s(e){o||(o=[]);for(var t=o.length;t<=e;++t)o.push("arg$"+t.toString(10));return o[e-1]}t.getGenericParameterName=s},function(e,t,r){"use strict";var n,i=this&&this.__extends||(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])},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}}}};Object.defineProperty(t,"__esModule",{value:!0});var o,s=r(16),c=r(0),p=r(1),u=r(2),l=r(3),h=r(4),d=r(5);!function(e){e[e.WASM32=0]="WASM32",e[e.WASM64=1]="WASM64"}(o=t.Target||(t.Target={}));var _=function(){function e(){this.target=o.WASM32,this.noTreeShaking=!1,this.noAssert=!1,this.noMemory=!1,this.importMemory=!1,this.memoryBase=0,this.allocateImpl="allocate_memory",this.freeImpl="free_memory",this.sourceMap=!1}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?d.Type.usize64:d.Type.usize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isizeType",{get:function(){return this.target==o.WASM64?d.Type.isize64:d.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}();t.Options=_,function(e){e[e.NONE=0]="NONE",e[e.IMPLICIT=1]="IMPLICIT",e[e.EXPLICIT=2]="EXPLICIT"}(t.ConversionKind||(t.ConversionKind={}));var y=function(e){function t(t,r){void 0===r&&(r=null);var n=e.call(this,t.diagnostics)||this;return n.startFunctionBody=[],n.currentEnum=null,n.currentType=d.Type.void,n.memorySegments=new Array,n.stringSegments=new Map,n.functionTable=new Array,n.files=new Set,n.program=t,r||(r=new _),n.options=r,n.memoryOffset=i64_new(max(r.memoryBase,r.usizeType.byteSize)),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=this.options,t=this.module,r=this.program;r.initialize(e);var n=assert(r.elements.get("start"));assert(n.kind==u.ElementKind.FUNCTION_PROTOTYPE);var i=new u.Function(n,n.internalName,new d.Signature([],d.Type.void));i.set(u.ElementFlags.START),this.startFunction=i,this.currentFunction=i;for(var a=r.sources,o=0,s=a.length;o<s;++o)a[o].isEntry&&this.compileSource(a[o]);var c=this.startFunctionBody;if(c.length){var l,h=this.ensureFunctionType(i.signature);t.setStart(l=t.addFunction(i.internalName,h,d.typesToNativeTypes(i.additionalLocals),t.createBlock(null,c))),i.finalize(t,l)}if(!e.noMemory){var _=this.memoryOffset;_=i64_align(_,e.usizeType.byteSize),this.memoryOffset=_,e.isWasm64?t.addGlobal("HEAP_BASE",p.NativeType.I64,!1,t.createI64(i64_low(_),i64_high(_))):t.addGlobal("HEAP_BASE",p.NativeType.I32,!1,t.createI32(i64_low(_)));var y=i64_shr_u(i64_align(_,65536),i64_new(16,0));t.setMemory(i64_low(y),p.Module.MAX_MEMORY_WASM32,this.memorySegments,e.target,"memory")}e.importMemory&&t.addMemoryImport("0","env","memory");var g=this.functionTable,m=g.length;if(m){var f=new Array(m);for(o=0;o<m;++o)f[o]=g[o].ref;t.setFunctionTable(f)}return t},t.prototype.compileSourceByPath=function(e,t){for(var r=this.program.sources,n=e+".ts",i=0,a=r.length;i<a;++i){if((o=r[i]).normalizedPath==n)return void this.compileSource(o)}n=e+"/index.ts";for(i=0,a=r.length;i<a;++i){if((o=r[i]).normalizedPath==n)return void this.compileSource(o)}n=u.LIBRARY_PREFIX+e+".ts";for(i=0,a=r.length;i<a;++i){var o;if((o=r[i]).normalizedPath==n)return void this.compileSource(o)}this.error(c.DiagnosticCode.File_0_not_found,t.range,e)},t.prototype.compileSource=function(e){var t=this.files,r=e.normalizedPath;if(!t.has(r)){t.add(r);for(var n=this.options.noTreeShaking,i=e.isEntry,a=this.startFunction,o=this.startFunctionBody,s=e.statements,c=0,p=s.length;c<p;++c){var u=s[c];switch(u.kind){case h.NodeKind.CLASSDECLARATION:(n||i&&h.hasModifier(h.ModifierKind.EXPORT,u.modifiers))&&!u.isGeneric&&this.compileClassDeclaration(u,[]);break;case h.NodeKind.ENUMDECLARATION:(n||i&&h.hasModifier(h.ModifierKind.EXPORT,u.modifiers))&&this.compileEnumDeclaration(u);break;case h.NodeKind.FUNCTIONDECLARATION:(n||i&&h.hasModifier(h.ModifierKind.EXPORT,u.modifiers))&&!u.isGeneric&&this.compileFunctionDeclaration(u,[]);break;case h.NodeKind.IMPORT:this.compileSourceByPath(u.normalizedPath,u.path);break;case h.NodeKind.NAMESPACEDECLARATION:(n||i&&h.hasModifier(h.ModifierKind.EXPORT,u.modifiers))&&this.compileNamespaceDeclaration(u);break;case h.NodeKind.VARIABLE:var l=this.compileVariableStatement(u);l&&o.push(l);break;case h.NodeKind.EXPORT:null!=u.normalizedPath&&this.compileSourceByPath(u.normalizedPath,u.path),(n||i)&&this.compileExportStatement(u);break;default:var d=this.currentFunction;this.currentFunction=a,o.push(this.compileStatement(u)),this.currentFunction=d}}}},t.prototype.compileGlobalDeclaration=function(e){var t=assert(this.program.elements.get(e.fileLevelInternalName));return assert(t.kind==u.ElementKind.GLOBAL),this.compileGlobal(t)?t:null},t.prototype.compileGlobal=function(e){if(e.is(u.ElementFlags.COMPILED)||e.is(u.ElementFlags.BUILTIN))return!0;e.set(u.ElementFlags.COMPILED);var t=this.module,r=e.declaration,n=0;if(e.type==d.Type.void)if(r.type){var i=this.program.resolveType(r.type);if(!i)return!1;if(i==d.Type.void)return this.error(c.DiagnosticCode.Type_expected,r.type.range),!1;e.type=i}else{if(!r.initializer)return this.error(c.DiagnosticCode.Type_expected,r.name.range.atEnd),!1;if(n=this.compileExpression(r.initializer,d.Type.void,0),this.currentType==d.Type.void)return this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,r.initializer.range,this.currentType.toString(),"<auto>"),!1;e.type=this.currentType}var a=e.type.toNativeType();if(e.is(u.ElementFlags.DECLARED))return e.is(u.ElementFlags.CONSTANT)?(t.addGlobalImport(e.internalName,e.namespace?e.namespace.simpleName:"env",e.simpleName,a),e.set(u.ElementFlags.COMPILED),!0):(this.error(c.DiagnosticCode.Operation_not_supported,r.range),!1);var o=!1;e.is(u.ElementFlags.INLINED)?n=this.compileInlineConstant(e,e.type,!0):r.initializer?(n||(n=this.compileExpression(r.initializer,e.type)),_BinaryenExpressionGetId(n)!=p.ExpressionId.Const&&(e.is(u.ElementFlags.CONSTANT)?(n=this.precomputeExpressionRef(n),_BinaryenExpressionGetId(n)!=p.ExpressionId.Const&&(this.warning(c.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,r.range),o=!0)):o=!0)):n=e.type.toNativeZero(t);var s=e.internalName;if(o)t.addGlobal(s,a,!0,e.type.toNativeZero(t)),this.startFunctionBody.push(t.createSetGlobal(s,n));else if(e.is(u.ElementFlags.CONSTANT)){switch(_BinaryenExpressionGetType(n)){case p.NativeType.I32:e.constantValueKind=1,e.constantIntegerValue=i64_new(_BinaryenConstGetValueI32(n),0);break;case p.NativeType.I64:e.constantValueKind=1,e.constantIntegerValue=i64_new(_BinaryenConstGetValueI64Low(n),_BinaryenConstGetValueI64High(n));break;case p.NativeType.F32:e.constantValueKind=2,e.constantFloatValue=_BinaryenConstGetValueF32(n);break;case p.NativeType.F64:e.constantValueKind=2,e.constantFloatValue=_BinaryenConstGetValueF64(n);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.declaration.range),e.constantValueKind=1,e.constantIntegerValue=i64_new(0)}e.set(u.ElementFlags.INLINED),r.isTopLevel&&t.addGlobal(s,a,!1,n),r.range.source.isEntry&&r.isTopLevelExport&&t.addGlobalExport(e.internalName,r.programLevelInternalName)}else t.addGlobal(s,a,!e.is(u.ElementFlags.CONSTANT),n);return!0},t.prototype.compileEnumDeclaration=function(e){var t=assert(this.program.elements.get(e.fileLevelInternalName));return assert(t.kind==u.ElementKind.ENUM),this.compileEnum(t)?t:null},t.prototype.compileEnum=function(e){if(e.is(u.ElementFlags.COMPILED))return!0;e.set(u.ElementFlags.COMPILED);var t=this.module;this.currentEnum=e;var r,n,i=null;if(e.members)try{for(var o=a(e.members.values()),s=o.next();!s.done;s=o.next()){var l=s.value;if(l.kind==u.ElementKind.ENUMVALUE){var h=!1,_=l,y=_.declaration;if(_.set(u.ElementFlags.COMPILED),_.is(u.ElementFlags.INLINED))e.declaration.isTopLevelExport&&t.addGlobal(_.internalName,p.NativeType.I32,!1,t.createI32(_.constantValue));else{var g=void 0;y.value?(g=this.compileExpression(y.value,d.Type.i32),_BinaryenExpressionGetId(g)!=p.ExpressionId.Const&&(g=this.precomputeExpressionRef(g),_BinaryenExpressionGetId(g)!=p.ExpressionId.Const&&(e.is(u.ElementFlags.CONSTANT)&&this.warning(c.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,y.range),h=!0))):null==i?g=t.createI32(0):i.is(u.ElementFlags.INLINED)?g=t.createI32(i.constantValue+1):(g=t.createBinary(p.BinaryOp.AddI32,t.createGetGlobal(i.internalName,p.NativeType.I32),t.createI32(1)),e.is(u.ElementFlags.CONSTANT)&&this.warning(c.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,y.range),h=!0),h?(t.addGlobal(_.internalName,p.NativeType.I32,!0,t.createI32(0)),this.startFunctionBody.push(t.createSetGlobal(_.internalName,g))):(t.addGlobal(_.internalName,p.NativeType.I32,!1,g),_BinaryenExpressionGetType(g)==p.NativeType.I32?(_.constantValue=_BinaryenConstGetValueI32(g),_.set(u.ElementFlags.INLINED)):(assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,y.range),_.constantValue=0))}i=_,e.declaration.range.source.isEntry&&e.declaration.isTopLevelExport&&(l.is(u.ElementFlags.INLINED)?t.addGlobalExport(l.internalName,l.internalName):y&&this.warning(c.DiagnosticCode.Cannot_export_a_mutable_global,y.range))}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return this.currentEnum=null,!0},t.prototype.compileFunctionDeclaration=function(e,t,r){void 0===r&&(r=null);var n=assert(this.program.elements.get(e.fileLevelInternalName));return assert(n.kind==u.ElementKind.FUNCTION_PROTOTYPE),this.compileFunctionUsingTypeArguments(n,t,r,n.declaration.name)},t.prototype.compileFunctionUsingTypeArguments=function(e,t,r,n){var i=e.resolveUsingTypeArguments(t,r,n);return i&&this.compileFunction(i)?i:null},t.prototype.ensureFunctionType=function(e){var t,r=e.parameterTypes.length,n=e.thisType,i=0;n?((t=new Array(1+r))[0]=n.toNativeType(),i=1):t=new Array(r);for(var a=0;a<r;++a,++i)t[i]=e.parameterTypes[a].toNativeType();var o=e.returnType.toNativeType(),s=this.module,c=s.getFunctionTypeBySignature(o,t);return c||(c=s.addFunctionType(e.toSignatureString(),o,t)),c},t.prototype.compileFunction=function(e){if(e.is(u.ElementFlags.COMPILED))return!0;assert(!e.is(u.ElementFlags.BUILTIN)||"abort"==e.simpleName),e.set(u.ElementFlags.COMPILED);var t,r=e.prototype.declaration,n=r.body;n?e.is(u.ElementFlags.DECLARED)&&this.error(c.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,r.name.range):e.is(u.ElementFlags.DECLARED)||this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,r.name.range);var i=this.ensureFunctionType(e.signature),a=this.module;if(n){var o=this.currentFunction;this.currentFunction=e;var s=this.compileStatement(n),p=e.flow.finalize();e.signature.returnType==d.Type.void||p||this.error(c.DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value,assert(r.signature.returnType,"return type expected").range),this.currentFunction=o,t=a.addFunction(e.internalName,i,d.typesToNativeTypes(e.additionalLocals),s)}else{e.set(u.ElementFlags.IMPORTED);var l=e.prototype.namespace;t=a.addFunctionImport(e.internalName,l?l.simpleName:"env",e.simpleName,i)}return r.range.source.isEntry&&r.isTopLevelExport&&a.addFunctionExport(e.internalName,r.name.text),e.finalize(a,t),!0},t.prototype.compileNamespaceDeclaration=function(e){for(var t=e.members,r=this.options.noTreeShaking,n=0,i=t.length;n<i;++n){var a=t[n];switch(a.kind){case h.NodeKind.CLASSDECLARATION:!r&&!h.hasModifier(h.ModifierKind.EXPORT,a.modifiers)||a.isGeneric||this.compileClassDeclaration(a,[]);break;case h.NodeKind.INTERFACEDECLARATION:!r&&!h.hasModifier(h.ModifierKind.EXPORT,a.modifiers)||a.isGeneric||this.compileInterfaceDeclaration(a,[]);break;case h.NodeKind.ENUMDECLARATION:(r||h.hasModifier(h.ModifierKind.EXPORT,a.modifiers))&&this.compileEnumDeclaration(a);break;case h.NodeKind.FUNCTIONDECLARATION:!r&&!h.hasModifier(h.ModifierKind.EXPORT,a.modifiers)||a.isGeneric||this.compileFunctionDeclaration(a,[]);break;case h.NodeKind.NAMESPACEDECLARATION:(r||h.hasModifier(h.ModifierKind.EXPORT,a.modifiers))&&this.compileNamespaceDeclaration(a);break;case h.NodeKind.VARIABLE:if(r||h.hasModifier(h.ModifierKind.EXPORT,a.modifiers)){var o=this.compileVariableStatement(a,!0);o&&this.startFunctionBody.push(o)}break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,a.range)}}},t.prototype.compileNamespace=function(e){if(e.members){var t,r,n=this.options.noTreeShaking;try{for(var i=a(e.members.values()),o=i.next();!o.done;o=i.next()){var s=o.value;switch(s.kind){case u.ElementKind.CLASS_PROTOTYPE:!n&&!s.is(u.ElementFlags.EXPORTED)||s.is(u.ElementFlags.GENERIC)||this.compileClassUsingTypeArguments(s,[]);break;case u.ElementKind.ENUM:this.compileEnum(s);break;case u.ElementKind.FUNCTION_PROTOTYPE:!n&&!s.is(u.ElementFlags.EXPORTED)||s.is(u.ElementFlags.GENERIC)||this.compileFunctionUsingTypeArguments(s,[],null,s.declaration.name);break;case u.ElementKind.GLOBAL:this.compileGlobal(s);break;case u.ElementKind.NAMESPACE:this.compileNamespace(s)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}},t.prototype.compileExportStatement=function(e){for(var t=this.module,r=this.program.exports,n=e.members,i=0,a=n.length;i<a;++i){var o=n[i],s=e.range.source.internalPath+u.PATH_DELIMITER+o.externalName.text,p=r.get(s);if(p)switch(p.kind){case u.ElementKind.CLASS_PROTOTYPE:p.is(u.ElementFlags.GENERIC)||this.compileClassUsingTypeArguments(p,[]);break;case u.ElementKind.ENUM:this.compileEnum(p);break;case u.ElementKind.FUNCTION_PROTOTYPE:if(!p.is(u.ElementFlags.GENERIC)&&e.range.source.isEntry){var l=this.compileFunctionUsingTypeArguments(p,[],null,p.declaration.name);if(l){var h=l.prototype.declaration;h&&h.needsExplicitExport(o)&&t.addFunctionExport(l.internalName,o.externalName.text)}}break;case u.ElementKind.GLOBAL:if(this.compileGlobal(p)&&e.range.source.isEntry){var d=p.declaration;d&&d.needsExplicitExport(o)&&(p.is(u.ElementFlags.INLINED)?t.addGlobalExport(p.internalName,o.externalName.text):this.warning(c.DiagnosticCode.Cannot_export_a_mutable_global,o.range))}break;case u.ElementKind.NAMESPACE:this.compileNamespace(p)}}},t.prototype.compileClassDeclaration=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var i=assert(this.program.elements.get(e.fileLevelInternalName));assert(i.kind==u.ElementKind.CLASS_PROTOTYPE),this.compileClassUsingTypeArguments(i,t,r,n)},t.prototype.compileClassUsingTypeArguments=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var i=e.resolveUsingTypeArguments(t,r,n);i&&this.compileClass(i)},t.prototype.compileClass=function(e){return!!e.is(u.ElementFlags.COMPILED)||(e.set(u.ElementFlags.COMPILED),!0)},t.prototype.compileInterfaceDeclaration=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=null),this.error(c.DiagnosticCode.Operation_not_supported,e.range)},t.prototype.addMemorySegment=function(e,t){void 0===t&&(t=8);var r=i64_align(this.memoryOffset,t),n=p.MemorySegment.create(e,r);return this.memorySegments.push(n),this.memoryOffset=i64_add(r,i64_new(e.length,0)),n},t.prototype.ensureFunctionTableEntry=function(e){if(assert(e.is(u.ElementFlags.COMPILED)),e.functionTableIndex>=0)return e.functionTableIndex;var t=this.functionTable,r=t.length;return t.push(e),e.functionTableIndex=r,r},t.prototype.compileStatement=function(e){var t,r=this.module;switch(e.kind){case h.NodeKind.BLOCK:t=this.compileBlockStatement(e);break;case h.NodeKind.BREAK:t=this.compileBreakStatement(e);break;case h.NodeKind.CONTINUE:t=this.compileContinueStatement(e);break;case h.NodeKind.DO:t=this.compileDoStatement(e);break;case h.NodeKind.EMPTY:t=this.compileEmptyStatement(e);break;case h.NodeKind.EXPRESSION:t=this.compileExpressionStatement(e);break;case h.NodeKind.FOR:t=this.compileForStatement(e);break;case h.NodeKind.IF:t=this.compileIfStatement(e);break;case h.NodeKind.RETURN:t=this.compileReturnStatement(e);break;case h.NodeKind.SWITCH:t=this.compileSwitchStatement(e);break;case h.NodeKind.THROW:t=this.compileThrowStatement(e);break;case h.NodeKind.TRY:t=this.compileTryStatement(e);break;case h.NodeKind.VARIABLE:(t=this.compileVariableStatement(e))||(t=r.createNop());break;case h.NodeKind.VOID:t=this.compileVoidStatement(e);break;case h.NodeKind.WHILE:t=this.compileWhileStatement(e);break;case h.NodeKind.TYPEDECLARATION:if(this.currentFunction==this.startFunction)return r.createNop();default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),t=r.createUnreachable()}return this.options.sourceMap&&g(t,e.range,r,this.currentFunction),t},t.prototype.compileStatements=function(e){for(var t=e.length,r=new Array(t),n=0;n<t;++n)r[n]=this.compileStatement(e[n]);return r},t.prototype.compileBlockStatement=function(e){var t=e.statements,r=this.currentFunction.flow.enterBranchOrScope();this.currentFunction.flow=r;var n=this.module.createBlock(null,this.compileStatements(t),p.NativeType.None),i=r.is(1);return r=r.leaveBranchOrScope(),this.currentFunction.flow=r,i&&r.set(1),n},t.prototype.compileBreakStatement=function(e){var t=this.module;if(e.label)return this.error(c.DiagnosticCode.Operation_not_supported,e.label.range),t.createUnreachable();var r=this.currentFunction.flow,n=r.breakLabel;return null==n?(this.error(c.DiagnosticCode.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement,e.range),t.createUnreachable()):(r.set(4),t.createBreak(n))},t.prototype.compileContinueStatement=function(e){var t=this.module,r=e.label;if(r)return this.error(c.DiagnosticCode.Operation_not_supported,r.range),t.createUnreachable();var n=this.currentFunction.flow,i=n.continueLabel;return null==i?(this.error(c.DiagnosticCode.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement,e.range),t.createUnreachable()):(n.set(8),t.createBreak(i))},t.prototype.compileDoStatement=function(e){var t=this.currentFunction,r=t.enterBreakContext(),n=t.flow,i=n.breakLabel,a=n.continueLabel,o="break|"+r;n.breakLabel=o;var s="continue|"+r;n.continueLabel=s;var c=this.compileStatement(e.statement);n.breakLabel=i,n.continueLabel=a;var u=this.module,l=E(this.compileExpression(e.condition,d.Type.i32,0),this.currentType,u);return this.currentFunction.leaveBreakContext(),u.createBlock(o,[u.createLoop(s,u.createBlock(null,[c,u.createBreak(s,l)],p.NativeType.None))],p.NativeType.None)},t.prototype.compileEmptyStatement=function(e){return this.module.createNop()},t.prototype.compileExpressionStatement=function(e){var t=this.compileExpression(e.expression,d.Type.void,0);return this.currentType!=d.Type.void&&(t=this.module.createDrop(t),this.currentType=d.Type.void),t},t.prototype.compileForStatement=function(e){var t=this.currentFunction,r=t.enterBreakContext(),n=t.flow.enterBranchOrScope();t.flow=n;var i=n.breakLabel="break|"+r;n.breakLabel=i;var a="continue|"+r;n.continueLabel=a;var o=this.module,s=e.initializer?this.compileStatement(e.initializer):o.createNop(),c=e.condition?this.compileExpression(e.condition,d.Type.i32):o.createI32(1),u=e.incrementor?this.compileExpression(e.incrementor,d.Type.void):o.createNop(),l=this.compileStatement(e.statement),h=!e.condition&&n.is(1);n=n.leaveBranchOrScope(),t.flow=n,t.leaveBreakContext();var _=o.createBlock(i,[s,o.createLoop(a,o.createBlock(null,[o.createIf(c,o.createBlock(null,[l,u,o.createBreak(a)],p.NativeType.None))],p.NativeType.None))],p.NativeType.None);return h&&(n.set(1),_=o.createBlock(null,[_,o.createUnreachable()])),_},t.prototype.compileIfStatement=function(e){var t=this.module,r=E(this.compileExpression(e.condition,d.Type.i32,0),this.currentType,t),n=this.currentFunction,i=n.flow.enterBranchOrScope();n.flow=i;var a=this.compileStatement(e.ifTrue),o=i.is(1);i=i.leaveBranchOrScope(),n.flow=i;var s=0,c=!1,p=e.ifFalse;return p&&(i=i.enterBranchOrScope(),n.flow=i,s=this.compileStatement(p),c=i.is(1),i=i.leaveBranchOrScope(),n.flow=i),o&&c&&i.set(1),t.createIf(r,a,s)},t.prototype.compileReturnStatement=function(e){var t=this.currentFunction,r=0;return e.value&&(r=this.compileExpression(e.value,t.signature.returnType)),t.flow.set(1),this.module.createReturn(r)},t.prototype.compileSwitchStatement=function(e){var t=this.module,r=this.currentFunction,n=r.enterBreakContext(),i=r.getTempLocal(d.Type.u32),a=i.index,o=e.cases,s=o.length,c=new Array(1+s);c[0]=t.createSetLocal(a,this.compileExpression(e.condition,d.Type.u32));for(var u=1,l=-1,h=0;h<s;++h){var _=o[h].label;_?c[u++]=t.createBreak("case"+h.toString(10)+"|"+n,t.createBinary(p.BinaryOp.EqI32,t.createGetLocal(a,p.NativeType.I32),this.compileExpression(_,d.Type.i32))):l=h}r.freeTempLocal(i),c[u]=t.createBreak((l>=0?"case"+l.toString(10):"break")+"|"+n);var y=t.createBlock("case0|"+n,c,p.NativeType.None),g=!0;for(h=0;h<s;++h){var m=o[h].statements,f=m.length,E=new Array(1+f);E[0]=y;var T=r.flow.enterBranchOrScope();r.flow=T;var A="break|"+n;T.breakLabel=A;for(var I=h!=s-1,v=I?"case"+(h+1).toString(10)+"|"+n:A,N=0;N<f;++N)E[N+1]=this.compileStatement(m[N]);I||T.is(1)||(g=!1),r.flow=T.leaveBranchOrScope(),y=t.createBlock(v,E,p.NativeType.None)}return r.leaveBreakContext(),l>=0&&g&&r.flow.set(1),y},t.prototype.compileThrowStatement=function(e){var t=this.currentFunction.flow;return t.set(2),t.set(1),this.module.createUnreachable()},t.prototype.compileTryStatement=function(e){return this.error(c.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=this.currentFunction,i=e.declarations,a=i.length;if(t||n==this.startFunction&&e.parent&&e.parent.kind==h.NodeKind.SOURCE){for(var o=0;o<a;++o)this.compileGlobalDeclaration(i[o]);return 0}var s=new Array;for(o=0;o<a;++o){var l=i[o],_=l.name.text,y=null,g=0;if(l.type){if(!(y=r.resolveType(l.type,n.contextualTypeArguments)))continue;l.initializer&&(g=this.compileExpression(l.initializer,y))}else{if(!l.initializer){this.error(c.DiagnosticCode.Type_expected,l.name.range.atEnd);continue}if(g=this.compileExpression(l.initializer,d.Type.void,0),this.currentType==d.Type.void){this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,l.range,this.currentType.toString(),"<auto>");continue}y=this.currentType}if(h.hasModifier(h.ModifierKind.CONST,l.modifiers))if(g){if(g=this.precomputeExpressionRef(g),_BinaryenExpressionGetId(g)==p.ExpressionId.Const){var m=new u.Local(r,_,-1,y);switch(_BinaryenExpressionGetType(g)){case p.NativeType.I32:m=m.withConstantIntegerValue(_BinaryenConstGetValueI32(g),0);break;case p.NativeType.I64:m=m.withConstantIntegerValue(_BinaryenConstGetValueI64Low(g),_BinaryenConstGetValueI64High(g));break;case p.NativeType.F32:m=m.withConstantFloatValue(_BinaryenConstGetValueF32(g));break;case p.NativeType.F64:m=m.withConstantFloatValue(_BinaryenConstGetValueF64(g));break;default:return assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,l.range),this.module.createUnreachable()}var f=n.flow.scopedLocals;if(f){if(f.has(_))return this.error(c.DiagnosticCode.Duplicate_identifier_0,l.name.range,_),0}else n.flow.scopedLocals=f=new Map;return f.set(_,m),0}this.warning(c.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,l.range)}else this.error(c.DiagnosticCode._const_declarations_must_be_initialized,l.range);h.hasModifier(h.ModifierKind.LET,l.modifiers)?n.flow.addScopedLocal(_,y,l.name):n.addLocal(y,_),g&&s.push(this.compileAssignmentWithValue(l.name,g))}return s.length?1==s.length?s[0]:this.module.createBlock(null,s,p.NativeType.None):0},t.prototype.compileVoidStatement=function(e){return this.compileExpression(e.expression,d.Type.void,2,!1)},t.prototype.compileWhileStatement=function(e){var t=this.module,r=E(this.compileExpression(e.condition,d.Type.i32,0),this.currentType,t),n=this.currentFunction,i=n.enterBreakContext(),a=n.flow.enterBranchOrScope();n.flow=a;var o="break|"+i;a.breakLabel=o;var s="continue|"+i;a.continueLabel=s;var c=this.compileStatement(e.statement);n.flow=a.leaveBranchOrScope(),n.leaveBreakContext();var u=t.createBlock(o,[t.createLoop(s,t.createIf(r,t.createBlock(null,[c,t.createBreak(s)],p.NativeType.None)))],p.NativeType.None);return u},t.prototype.compileInlineConstant=function(e,t,r){assert(e.is(u.ElementFlags.INLINED));var n=e.type;switch(!r&&n.is(4)&&t.is(4)&&n.size<t.size?(this.currentType=t).kind:(this.currentType=n).kind){case 0:case 1:var i=n.computeSmallIntegerShift(d.Type.i32);return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue)<<i>>i:0);case 5:case 6:case 10:var a=e.type.computeSmallIntegerMask(d.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 11:return this.module.createF32(e.constantFloatValue);case 12:return this.module.createF64(e.constantFloatValue);default:return assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.declaration.range),this.module.createUnreachable()}},t.prototype.compileExpression=function(e,t,r,n){var i;switch(void 0===r&&(r=1),void 0===n&&(n=!0),this.currentType=t,e.kind){case h.NodeKind.ASSERTION:i=this.compileAssertionExpression(e,t);break;case h.NodeKind.BINARY:i=this.compileBinaryExpression(e,t,n);break;case h.NodeKind.CALL:i=this.compileCallExpression(e,t);break;case h.NodeKind.COMMA:i=this.compileCommaExpression(e,t);break;case h.NodeKind.ELEMENTACCESS:i=this.compileElementAccessExpression(e,t);break;case h.NodeKind.FUNCTION:case h.NodeKind.FUNCTIONARROW:i=this.compileFunctionExpression(e,t);break;case h.NodeKind.IDENTIFIER:case h.NodeKind.FALSE:case h.NodeKind.NULL:case h.NodeKind.THIS:case h.NodeKind.TRUE:i=this.compileIdentifierExpression(e,t,0==r);break;case h.NodeKind.LITERAL:i=this.compileLiteralExpression(e,t);break;case h.NodeKind.NEW:i=this.compileNewExpression(e,t);break;case h.NodeKind.PARENTHESIZED:i=this.compileParenthesizedExpression(e,t,n);break;case h.NodeKind.PROPERTYACCESS:i=this.compilePropertyAccessExpression(e,t,0==r);break;case h.NodeKind.TERNARY:i=this.compileTernaryExpression(e,t);break;case h.NodeKind.UNARYPOSTFIX:i=this.compileUnaryPostfixExpression(e,t);break;case h.NodeKind.UNARYPREFIX:i=this.compileUnaryPrefixExpression(e,t,n);break;default:assert(!1),this.error(c.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,e),this.currentType=t),this.options.sourceMap&&g(i,e.range,this.module,this.currentFunction),i},t.prototype.compileExpressionRetainType=function(e,t,r){return void 0===r&&(r=!0),this.compileExpression(e,t==d.Type.void?d.Type.i32:t,0,r)},t.prototype.precomputeExpression=function(e,t,r){return void 0===r&&(r=1),this.precomputeExpressionRef(this.compileExpression(e,t,r))},t.prototype.precomputeExpressionRef=function(e){var t=this.module,r=this.currentType,n=r.toNativeType(),i=t.getFunctionTypeBySignature(n,null);i||(i=t.addFunctionType(r.toSignatureString(),n,null));var a=t.addFunction("__precompute",i,null,e);t.runPasses(["precompute"],a);var o=_BinaryenFunctionGetBody(a);return t.removeFunction("__precompute"),o},t.prototype.convertExpression=function(e,t,r,n,i){assert(0!=n);var a=this.module;return 13==t.kind?(this.error(c.DiagnosticCode.Type_0_is_not_assignable_to_type_1,i.range,t.toString(),r.toString()),a.createUnreachable()):13==r.kind?a.createDrop(e):(1!=n||t.isAssignableTo(r)||this.error(c.DiagnosticCode.Conversion_from_type_0_to_1_requires_an_explicit_cast,i.range,t.toString(),r.toString()),t.is(8)?r.is(8)?11==t.kind?12==r.kind&&(e=a.createUnary(p.UnaryOp.PromoteF32,e)):11==r.kind&&(e=a.createUnary(p.UnaryOp.DemoteF64,e)):r.is(4)?11==t.kind?r.is(1)?r.is(64)?e=a.createUnary(p.UnaryOp.TruncF32ToI64,e):(e=a.createUnary(p.UnaryOp.TruncF32ToI32,e),r.is(32)&&(e=m(e,r,a))):r.is(64)?e=a.createUnary(p.UnaryOp.TruncF32ToU64,e):(e=a.createUnary(p.UnaryOp.TruncF32ToU32,e),r.is(32)&&(e=m(e,r,a))):r.is(1)?r.is(64)?e=a.createUnary(p.UnaryOp.TruncF64ToI64,e):(e=a.createUnary(p.UnaryOp.TruncF64ToI32,e),r.is(32)&&(e=m(e,r,a))):r.is(64)?e=a.createUnary(p.UnaryOp.TruncF64ToU64,e):(e=a.createUnary(p.UnaryOp.TruncF64ToU32,e),r.is(32)&&(e=m(e,r,a))):(assert(0==r.flags,"void type expected"),e=a.createDrop(e)):t.is(4)&&r.is(8)?e=11==r.kind?t.is(64)?a.createUnary(t.is(1)?p.UnaryOp.ConvertI64ToF32:p.UnaryOp.ConvertU64ToF32,e):a.createUnary(t.is(1)?p.UnaryOp.ConvertI32ToF32:p.UnaryOp.ConvertU32ToF32,e):t.is(64)?a.createUnary(t.is(1)?p.UnaryOp.ConvertI64ToF64:p.UnaryOp.ConvertU64ToF64,e):a.createUnary(t.is(1)?p.UnaryOp.ConvertI32ToF64:p.UnaryOp.ConvertU32ToF64,e):t.is(64)?r.is(64)||(e=a.createUnary(p.UnaryOp.WrapI64,e),r.is(32)&&(e=m(e,r,a))):r.is(64)?e=a.createUnary(r.is(1)?p.UnaryOp.ExtendI32:p.UnaryOp.ExtendU32,e):r.is(32)&&(t.size>r.size||t.size==r.size&&t.is(1)!=r.is(1))&&(e=m(e,r,a)),this.currentType=r,e)},t.prototype.compileAssertionExpression=function(e,t){var r=this.program.resolveType(e.toType,this.currentFunction.contextualTypeArguments);return r?this.compileExpression(e.expression,r,2):this.module.createUnreachable()},t.prototype.compileBinaryExpression=function(e,t,r){void 0===r&&(r=!0);var n,i,a,o,s,u,h,_=this.module,y=e.left,g=e.right,f=!1,T=!1,A=null;switch(e.operator){case l.Token.LESSTHAN:if(n=this.compileExpressionRetainType(y,t),i=this.currentType,a=this.compileExpressionRetainType(g,i),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!0)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();switch(n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g),s.kind){case 0:case 1:case 2:h=_.createBinary(p.BinaryOp.LtI32,n,a);break;case 3:h=_.createBinary(p.BinaryOp.LtI64,n,a);break;case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.LtI64:p.BinaryOp.LtI32,n,a);break;case 5:case 6:case 7:case 10:h=_.createBinary(p.BinaryOp.LtU32,n,a);break;case 9:h=_.createBinary(this.options.isWasm64?p.BinaryOp.LtU64:p.BinaryOp.LtU32,n,a);break;case 8:h=_.createBinary(p.BinaryOp.LtU64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.LtF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.LtF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}this.currentType=d.Type.bool;break;case l.Token.GREATERTHAN:if(n=this.compileExpressionRetainType(y,t),i=this.currentType,a=this.compileExpressionRetainType(g,i),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!0)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();switch(n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g),s.kind){case 0:case 1:case 2:h=_.createBinary(p.BinaryOp.GtI32,n,a);break;case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.GtI64:p.BinaryOp.GtI32,n,a);break;case 3:h=_.createBinary(p.BinaryOp.GtI64,n,a);break;case 5:case 6:case 7:case 10:h=_.createBinary(p.BinaryOp.GtU32,n,a);break;case 9:h=_.createBinary(this.options.isWasm64?p.BinaryOp.GtU64:p.BinaryOp.GtU32,n,a);break;case 8:h=_.createBinary(p.BinaryOp.GtU64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.GtF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.GtF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}this.currentType=d.Type.bool;break;case l.Token.LESSTHAN_EQUALS:if(n=this.compileExpressionRetainType(y,t),i=this.currentType,a=this.compileExpressionRetainType(g,i),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!0)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<=",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();switch(n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g),s.kind){case 0:case 1:case 2:h=_.createBinary(p.BinaryOp.LeI32,n,a);break;case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.LeI64:p.BinaryOp.LeI32,n,a);break;case 3:h=_.createBinary(p.BinaryOp.LeI64,n,a);break;case 5:case 6:case 7:case 10:h=_.createBinary(p.BinaryOp.LeU32,n,a);break;case 9:h=_.createBinary(this.options.isWasm64?p.BinaryOp.LeU64:p.BinaryOp.LeU32,n,a);break;case 8:h=_.createBinary(p.BinaryOp.LeU64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.LeF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.LeF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}this.currentType=d.Type.bool;break;case l.Token.GREATERTHAN_EQUALS:if(n=this.compileExpressionRetainType(y,t),i=this.currentType,a=this.compileExpressionRetainType(g,i),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!0)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">=",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();switch(n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g),s.kind){case 0:case 1:case 2:h=_.createBinary(p.BinaryOp.GeI32,n,a);break;case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.GeI64:p.BinaryOp.GeI32,n,a);break;case 3:h=_.createBinary(p.BinaryOp.GeI64,n,a);break;case 5:case 6:case 7:case 10:h=_.createBinary(p.BinaryOp.GeU32,n,a);break;case 9:h=_.createBinary(this.options.isWasm64?p.BinaryOp.GeU64:p.BinaryOp.GeU32,n,a);break;case 8:h=_.createBinary(p.BinaryOp.GeU64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.GeF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.GeF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}this.currentType=d.Type.bool;break;case l.Token.EQUALS_EQUALS_EQUALS:case l.Token.EQUALS_EQUALS:if(n=this.compileExpressionRetainType(y,t),i=this.currentType,a=this.compileExpressionRetainType(g,i),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,l.Token.operatorToString(e.operator),i.toString(),o.toString()),this.currentType=t,_.createUnreachable();switch(n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g),s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:h=_.createBinary(p.BinaryOp.EqI32,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.EqI64:p.BinaryOp.EqI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.EqI64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.EqF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.EqF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}this.currentType=d.Type.bool;break;case l.Token.EXCLAMATION_EQUALS_EQUALS:case l.Token.EXCLAMATION_EQUALS:if(n=this.compileExpressionRetainType(y,t),i=this.currentType,a=this.compileExpressionRetainType(g,i),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,l.Token.operatorToString(e.operator),i.toString(),o.toString()),this.currentType=t,_.createUnreachable();switch(n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g),s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:h=_.createBinary(p.BinaryOp.NeI32,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.NeI64:p.BinaryOp.NeI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.NeI64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.NeF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.NeF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}this.currentType=d.Type.bool;break;case l.Token.EQUALS:return this.compileAssignment(y,g,t);case l.Token.PLUS_EQUALS:f=!0;case l.Token.PLUS:if(n=this.compileExpressionRetainType(y,t,!1),f)a=this.compileExpression(g,this.currentType,1,!1);else{if(i=this.currentType,a=this.compileExpressionRetainType(g,i,!1),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"+",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:T=!0;case 2:case 7:h=_.createBinary(p.BinaryOp.AddI32,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.AddI64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.AddF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.AddF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.MINUS_EQUALS:f=!0;case l.Token.MINUS:if(n=this.compileExpressionRetainType(y,t,!1),f)a=this.compileExpression(g,this.currentType,1,!1);else{if(i=this.currentType,a=this.compileExpressionRetainType(g,i,!1),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"-",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:T=!0;case 2:case 7:h=_.createBinary(p.BinaryOp.SubI32,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.SubI64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.SubF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.SubF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.ASTERISK_EQUALS:f=!0;case l.Token.ASTERISK:if(n=this.compileExpressionRetainType(y,t,!1),f)a=this.compileExpression(g,this.currentType,1,!1);else{if(i=this.currentType,a=this.compileExpressionRetainType(g,i,!1),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"*",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:T=!0;case 2:case 7:h=_.createBinary(p.BinaryOp.MulI32,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.MulI64:p.BinaryOp.MulI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.MulI64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.MulF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.MulF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.SLASH_EQUALS:f=!0;case l.Token.SLASH:if(n=this.compileExpressionRetainType(y,t,!0),f)a=this.compileExpression(g,this.currentType,1,!1);else{if(i=this.currentType,a=this.compileExpressionRetainType(g,i,!1),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"/",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g)}switch(this.currentType.kind){case 0:case 1:T=!0;case 2:h=_.createBinary(p.BinaryOp.DivI32,n,a);break;case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.DivI64:p.BinaryOp.DivI32,n,a);break;case 3:h=_.createBinary(p.BinaryOp.DivI64,n,a);break;case 5:case 6:case 10:T=!0;case 7:h=_.createBinary(p.BinaryOp.DivU32,n,a);break;case 9:h=_.createBinary(this.options.isWasm64?p.BinaryOp.DivU64:p.BinaryOp.DivU32,n,a);break;case 8:h=_.createBinary(p.BinaryOp.DivU64,n,a);break;case 11:h=_.createBinary(p.BinaryOp.DivF32,n,a);break;case 12:h=_.createBinary(p.BinaryOp.DivF64,n,a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.PERCENT_EQUALS:f=!0;case l.Token.PERCENT:if(n=this.compileExpressionRetainType(y,t,!0),f)a=this.compileExpression(g,this.currentType,1,!1);else{if(i=this.currentType,a=this.compileExpressionRetainType(g,i,!1),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"%",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g)}switch(this.currentType.kind){case 0:case 1:case 2:h=_.createBinary(p.BinaryOp.RemI32,n,a);break;case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.RemI64:p.BinaryOp.RemI32,n,a);break;case 3:h=_.createBinary(p.BinaryOp.RemI64,n,a);break;case 5:case 6:case 7:case 10:h=_.createBinary(p.BinaryOp.RemU32,n,a);break;case 9:h=_.createBinary(this.options.isWasm64?p.BinaryOp.RemU64:p.BinaryOp.RemU32,n,a);break;case 8:h=_.createBinary(p.BinaryOp.RemU64,n,a);break;case 11:case 12:this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable();break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.LESSTHAN_LESSTHAN_EQUALS:f=!0;case l.Token.LESSTHAN_LESSTHAN:switch(n=this.compileExpressionRetainType(y,t,!1),a=this.compileExpression(g,this.currentType,1,!1),this.currentType.kind){case 0:case 1:case 5:case 6:case 10:T=!0;default:h=_.createBinary(p.BinaryOp.ShlI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.ShlI64,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.ShlI64:p.BinaryOp.ShlI32,n,a);break;case 11:case 12:return this.error(c.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,l.Token.operatorToString(e.operator),this.currentType.toString()),_.createUnreachable();case 13:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.GREATERTHAN_GREATERTHAN_EQUALS:f=!0;case l.Token.GREATERTHAN_GREATERTHAN:switch(n=this.compileExpressionRetainType(y,t,!0),a=this.compileExpression(g,this.currentType,1,!0),this.currentType.kind){default:h=_.createBinary(p.BinaryOp.ShrI32,n,a);break;case 3:h=_.createBinary(p.BinaryOp.ShrI64,n,a);break;case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.ShrI64:p.BinaryOp.ShrI32,n,a);break;case 5:case 6:case 10:case 7:h=_.createBinary(p.BinaryOp.ShrU32,n,a);break;case 8:h=_.createBinary(p.BinaryOp.ShrU64,n,a);break;case 9:h=_.createBinary(this.options.isWasm64?p.BinaryOp.ShrU64:p.BinaryOp.ShrU32,n,a);break;case 11:case 12:return this.error(c.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,l.Token.operatorToString(e.operator),this.currentType.toString()),_.createUnreachable();case 13:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:f=!0;case l.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:switch(n=this.compileExpressionRetainType(y,t,!0),a=this.compileExpression(g,this.currentType,1,!0),this.currentType.kind){case 0:case 1:T=!0;default:h=_.createBinary(p.BinaryOp.ShrU32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.ShrU64,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.ShrU64:p.BinaryOp.ShrU32,n,a);break;case 13:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.AMPERSAND_EQUALS:f=!0;case l.Token.AMPERSAND:if(n=this.compileExpressionRetainType(y,t,!1),f)a=this.compileExpression(g,this.currentType,1,!1);else{if(i=this.currentType,a=this.compileExpressionRetainType(g,i,!1),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"&",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:T=!0;default:h=_.createBinary(p.BinaryOp.AndI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.AndI64,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.AndI64:p.BinaryOp.AndI32,n,a);break;case 13:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.BAR_EQUALS:f=!0;case l.Token.BAR:if(n=this.compileExpressionRetainType(y,t,!1),f)a=this.compileExpression(g,this.currentType,1,!1);else{if(i=this.currentType,a=this.compileExpressionRetainType(g,i,!1),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"|",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:T=!0;default:h=_.createBinary(p.BinaryOp.OrI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.OrI64,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.OrI64:p.BinaryOp.OrI32,n,a);break;case 13:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.CARET_EQUALS:f=!0;case l.Token.CARET:if(n=this.compileExpressionRetainType(y,t,!1),f)a=this.compileExpression(g,this.currentType,1,!1);else{if(i=this.currentType,a=this.compileExpressionRetainType(g,i,!1),o=this.currentType,!(s=d.Type.commonCompatible(i,o,!1)))return this.error(c.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"^",i.toString(),o.toString()),this.currentType=t,_.createUnreachable();n=this.convertExpression(n,i,s,1,y),a=this.convertExpression(a,o,s,1,g)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:T=!0;default:h=_.createBinary(p.BinaryOp.XorI32,n,a);break;case 3:case 8:h=_.createBinary(p.BinaryOp.XorI64,n,a);break;case 9:case 4:h=_.createBinary(this.options.isWasm64?p.BinaryOp.XorI64:p.BinaryOp.XorI32,n,a);break;case 13:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=_.createUnreachable()}break;case l.Token.AMPERSAND_AMPERSAND:n=this.compileExpressionRetainType(y,t),a=this.compileExpression(g,this.currentType,1,!1),(h=_.cloneExpression(n,!0,0))||(A=this.currentFunction.getAndFreeTempLocal(this.currentType),n=_.createTeeLocal(A.index,n)),T=this.currentType.is(36),u=E(n,this.currentType,_),h=h?_.createIf(u,a,h):_.createIf(u,a,_.createGetLocal(assert(A).index,this.currentType.toNativeType()));break;case l.Token.BAR_BAR:n=this.compileExpressionRetainType(y,t),a=this.compileExpression(g,this.currentType,1,!1),(h=this.module.cloneExpression(n,!0,0))||(A=this.currentFunction.getAndFreeTempLocal(this.currentType),n=_.createTeeLocal(A.index,n)),T=this.currentType.is(36),u=E(n,this.currentType,_),h=h?this.module.createIf(u,h,a):_.createIf(u,_.createGetLocal(assert(A).index,this.currentType.toNativeType()),a);break;default:assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),h=this.module.createUnreachable()}return T&&r&&(assert(this.currentType.is(36)),h=m(h,this.currentType,_)),f?this.compileAssignmentWithValue(y,h,t!=d.Type.void):h},t.prototype.compileAssignment=function(e,t,r){var n=this.currentFunction,i=this.program.resolveExpression(e,n);if(!i)return this.module.createUnreachable();var a,o=i.element;switch(o.kind){case u.ElementKind.GLOBAL:if(!this.compileGlobal(o))return this.module.createUnreachable();assert(o.type!=d.Type.void,"concrete type expected");case u.ElementKind.LOCAL:case u.ElementKind.FIELD:a=o.type;break;case u.ElementKind.PROPERTY:var s=o.setterPrototype;if(s){var p=s.resolve();if(!p)return this.module.createUnreachable();assert(1==p.signature.parameterTypes.length),a=p.signature.parameterTypes[0];break}return this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,o.internalName),this.module.createUnreachable();case u.ElementKind.FUNCTION_PROTOTYPE:if(e.kind==h.NodeKind.ELEMENTACCESS&&i.target&&i.target.kind==u.ElementKind.CLASS){if(o.simpleName!=i.target.prototype.fnIndexedGet)return this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,i.target.toString()),this.module.createUnreachable();var l=o.resolve(null);if(l){a=l.signature.returnType;break}}default:return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}var _=this.compileExpression(t,a);return this.compileAssignmentWithValue(e,_,r!=d.Type.void)},t.prototype.compileAssignmentWithValue=function(e,t,r){void 0===r&&(r=!1);var n=this.module,i=this.program.resolveExpression(e,this.currentFunction);if(!i)return n.createUnreachable();var a=i.element;switch(a.kind){case u.ElementKind.LOCAL:return this.currentType=r?a.type:d.Type.void,a.is(u.ElementFlags.CONSTANT)?(this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable()):r?n.createTeeLocal(a.index,t):n.createSetLocal(a.index,t);case u.ElementKind.GLOBAL:if(!this.compileGlobal(a))return n.createUnreachable();var o=a.type;if(assert(o!=d.Type.void),this.currentType=r?o:d.Type.void,a.is(u.ElementFlags.CONSTANT))return this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();if(r){var s=o.toNativeType(),p=a.internalName;return n.createBlock(null,[n.createSetGlobal(p,t),n.createGetGlobal(p,s)],s)}return n.createSetGlobal(a.internalName,t);case u.ElementKind.FIELD:if(a.prototype.isReadonly)return this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();assert(i.isInstanceTarget);var l=this.compileExpression(i.targetExpression,i.target.type);o=a.type;this.currentType=r?o:d.Type.void;s=o.toNativeType();if(r){var _=this.currentFunction.getAndFreeTempLocal(o).index;return n.createBlock(null,[n.createSetLocal(_,t),n.createStore(o.size>>3,l,n.createGetLocal(_,s),s,a.memoryOffset),n.createGetLocal(_,s)],s)}return n.createStore(o.size>>3,l,t,s,a.memoryOffset);case u.ElementKind.PROPERTY:var y=a.setterPrototype;if(y){if(!(I=y.resolve()))return n.createUnreachable();if(!r){if(I.is(u.ElementFlags.INSTANCE)){assert(i.isInstanceTarget);var g=this.compileExpression(i.targetExpression,i.target.type);return this.makeCallDirect(I,[g,t])}return this.makeCallDirect(I,[t])}var m=a.getterPrototype;if(assert(null!=m),!(E=m.resolve()))return n.createUnreachable();var f=(b=E.signature.returnType).toNativeType();if(I.is(u.ElementFlags.INSTANCE)){assert(i.isInstanceTarget);g=this.compileExpression(i.targetExpression,i.target.type),_=this.currentFunction.getAndFreeTempLocal(b).index;return n.createBlock(null,[this.makeCallDirect(I,[n.createTeeLocal(_,g),t]),this.makeCallDirect(E,[n.createGetLocal(_,f)])],f)}return n.createBlock(null,[this.makeCallDirect(I,[t]),this.makeCallDirect(E)],f)}return this.error(c.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();case u.ElementKind.FUNCTION_PROTOTYPE:if(e.kind==h.NodeKind.ELEMENTACCESS){var E;if(assert(i.isInstanceTarget),!(E=a.resolve()))return n.createUnreachable();var T=i.target.prototype.fnIndexedSet,A=void 0;if(null!=T&&i.target.members&&(A=i.target.members.get(T))&&A.kind==u.ElementKind.FUNCTION_PROTOTYPE){var I;if(!(I=A.resolve()))return n.createUnreachable();var v=i.target.type,N=(l=this.compileExpression(i.targetExpression,v),this.compileExpression(e.elementExpression,d.Type.i32));if(r){var S=this.currentFunction.getTempLocal(v),C=this.currentFunction.getAndFreeTempLocal(this.currentType),b=E.signature.returnType;return this.currentFunction.freeTempLocal(S),n.createBlock(null,[this.makeCallDirect(I,[n.createTeeLocal(S.index,l),n.createTeeLocal(C.index,N),t]),this.makeCallDirect(E,[n.createGetLocal(S.index,S.type.toNativeType()),n.createGetLocal(C.index,C.type.toNativeType())])],b.toNativeType())}return this.makeCallDirect(I,[l,N,t])}return this.error(c.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,e.range,i.target.internalName),n.createUnreachable()}}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()},t.prototype.compileCallExpression=function(e,t){var r=this.module,n=this.currentFunction,i=this.program.resolveExpression(e.expression,n);if(!i)return r.createUnreachable();var a,o,l=i.element;switch(l.kind){case u.ElementKind.FUNCTION_PROTOTYPE:var h=l;if(h.is(u.ElementFlags.BUILTIN)){var d=s.compileCall(this,h,h.resolveBuiltinTypeArguments(e.typeArguments,n.contextualTypeArguments),e.arguments,t,e);return d||(this.error(c.DiagnosticCode.Operation_not_supported,e.range),r.createUnreachable())}var _=h.resolveUsingTypeArguments(e.typeArguments,n.contextualTypeArguments,e);if(!_)return r.createUnreachable();var y=0;if(_.is(u.ElementFlags.INSTANCE)){if(assert(i.isInstanceTarget),!(y=this.compileExpression(i.targetExpression,i.target.type)))return r.createUnreachable()}else assert(!i.isInstanceTarget);return this.compileCallDirect(_,e.arguments,e,y);case u.ElementKind.LOCAL:if(a=l.type.functionType){o=r.createGetLocal(l.index,p.NativeType.I32);break}return this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,l.type.toString()),r.createUnreachable();case u.ElementKind.GLOBAL:if(a=l.type.functionType){o=r.createGetGlobal(l.internalName,l.type.toNativeType());break}return this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,l.type.toString()),r.createUnreachable();case u.ElementKind.FIELD:var g=l.type;if(a=g.functionType){var m=this.compileExpression(assert(i.targetExpression),g);o=r.createLoad(4,!1,m,p.NativeType.I32,l.memoryOffset);break}return this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,l.type.toString()),r.createUnreachable();case u.ElementKind.FUNCTION_TARGET:a=l.signature,o=this.compileExpression(e.expression,l.type);break;case u.ElementKind.PROPERTY:default:return this.error(c.DiagnosticCode.Operation_not_supported,e.range),r.createUnreachable()}return this.compileCallIndirect(a,o,e.arguments,e)},t.prototype.checkCallSignature=function(e,t,r,n){if(r!=(null!=e.thisType))return this.error(c.DiagnosticCode.Operation_not_supported,n.range),!1;var i=e.hasRest;if(i)return this.error(c.DiagnosticCode.Operation_not_supported,n.range),!1;var a=e.requiredParameters,o=e.parameterTypes.length;return t<a?(this.error(a<o?c.DiagnosticCode.Expected_at_least_0_arguments_but_got_1:c.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,a.toString(),t.toString()),!1):!(t>o&&!i)||(this.error(c.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,o.toString(),t.toString()),!1)},t.prototype.compileCallDirect=function(e,t,r,n){void 0===n&&(n=0);var i=t.length,a=e.signature;if(!this.checkCallSignature(a,i,0!=n,r))return this.module.createUnreachable();var o=n?i+1:i,s=new Array(o),c=0;n&&(s[0]=n,c=1);for(var p=a.parameterTypes,u=0;u<i;++u,++c)s[c]=this.compileExpression(t[u],p[u]);return assert(c==o),this.makeCallDirect(e,s)},t.prototype.ensureTrampoline=function(e){var t=e.trampoline;if(t)return t;var r=e.signature,n=e.internalName,i=r.parameterTypes,a=e.prototype.declaration.signature.parameterTypes,o=r.returnType,s=r.thisType,c=e.is(u.ElementFlags.INSTANCE),l=r.requiredParameters,h=l,_=i.length,y=_;c&&(++h,++y);var g=y-h;assert(g);var m=new Array(h),f=0,E=this.module;c&&(m[0]=E.createGetLocal(0,this.options.nativeSizeType),f=1);for(var T=0;T<l;++T,++f)m[f]=E.createGetLocal(f,i[T].toNativeType());assert(f==h);var A=new Array(_+1);for(T=0;T<_;++T)A[T]=i[T];A[_]=d.Type.i32;var I=new d.Signature(A,o,s),v=n+"|trampoline";I.requiredParameters=_+1,(t=new u.Function(e.prototype,v,I,e.instanceMethodOf)).flags=e.flags|u.ElementFlags.COMPILED,e.trampoline=t;var N=this.currentFunction;this.currentFunction=t;var S=g+1,C=new Array(S);for(T=0;T<S;++T){var b="N="+T.toString();C[T]=b}var O=E.createBlock(C[0],[E.createBlock("N=invalid",[E.createSwitch(C,"N=invalid",E.createGetLocal(y,p.NativeType.I32))]),E.createUnreachable()]);for(T=0;T<g;++T,++f){var k=i[l+T];O=E.createBlock(C[T+1],[O,E.createSetLocal(f,this.compileExpression(assert(a[l+T].initializer),k))]),m[f]=E.createGetLocal(f,k.toNativeType())}this.currentFunction=N,assert(f==y);var x=this.ensureFunctionType(I),L=E.addFunction(v,x,d.typesToNativeTypes(t.additionalLocals),E.createBlock(null,[O,E.createCall(n,m,o.toNativeType())],o.toNativeType()));return t.finalize(E,L),t},t.prototype.makeCallDirect=function(e,t){void 0===t&&(t=null);var r=t?t.length:0,n=r,i=e.signature.requiredParameters,a=e.signature.parameterTypes.length,o=a;e.is(u.ElementFlags.INSTANCE)&&(++i,++o,--n),assert(r>=i);var s=this.module;if(!this.compileFunction(e))return s.createUnreachable();if(r<o){if(e=this.ensureTrampoline(e),!this.compileFunction(e))return s.createUnreachable();t||((t=new Array(o+1)).length=0);for(var c=n;c<a;++c)t.push(e.signature.parameterTypes[c].toNativeZero(s));t.push(s.createI32(r-i))}var p=e.signature.returnType;return this.currentType=p,e.is(u.ElementFlags.IMPORTED)?s.createCallImport(e.internalName,t,p.toNativeType()):s.createCall(e.internalName,t,p.toNativeType())},t.prototype.compileCallIndirect=function(e,t,r,n,i){void 0===i&&(i=0);var a=r.length;if(!this.checkCallSignature(e,a,0!=i,n))return this.module.createUnreachable();var o=i?a+1:a,s=new Array(o),c=0;i&&(s[0]=i,c=1);for(var p=e.parameterTypes,u=0;u<a;++u,++c)s[c]=this.compileExpression(r[u],p[u]);return assert(c==o),this.makeCallIndirect(e,t,s)},t.prototype.makeCallIndirect=function(e,t,r){var n=e.returnType;return this.currentType=n,this.ensureFunctionType(e),this.module.createCallIndirect(t,r,e.toSignatureString())},t.prototype.compileCommaExpression=function(e,t){for(var r=e.expressions,n=r.length,i=new Array(n--),a=0;a<n;++a)i[a]=this.compileExpression(r[a],d.Type.void);return i[n]=this.compileExpression(r[n],t),this.module.createBlock(null,i,this.currentType.toNativeType())},t.prototype.compileElementAccessExpression=function(e,t){var r=this.program.resolveElementAccess(e,this.currentFunction);if(!r)return this.module.createUnreachable();assert(r.element.kind==u.ElementKind.FUNCTION_PROTOTYPE&&r.target&&r.target.kind==u.ElementKind.CLASS);var n=r.target,i=r.element.resolve(null,n.contextualTypeArguments);if(!i)return this.module.createUnreachable();var a=this.compileExpression(e.expression,n.type);return this.compileCallDirect(i,[e.elementExpression],e,a)},t.prototype.compileFunctionExpression=function(e,t){var r=e.declaration,n=r.name,i=(n.text.length?n.text:"anonymous")+"|"+this.functionTable.length.toString(10),a=this.currentFunction,o=new u.FunctionPrototype(this.program,i,a.internalName+"~"+i,r),s=this.compileFunctionUsingTypeArguments(o,[],a.contextualTypeArguments,r);if(!s)return this.module.createUnreachable();this.currentType=d.Type.u32.asFunction(s.signature);var c=this.ensureFunctionTableEntry(s);return c<0?this.module.createUnreachable():this.module.createI32(c)},t.prototype.compileIdentifierExpression=function(e,t,r){var n=this.module;switch(e.kind){case h.NodeKind.NULL:var i=this.options;return t.classType||(this.currentType=i.usizeType),i.isWasm64?n.createI64(0):n.createI32(0);case h.NodeKind.TRUE:return this.currentType=d.Type.bool,n.createI32(1);case h.NodeKind.FALSE:return this.currentType=d.Type.bool,n.createI32(0);case h.NodeKind.THIS:if((o=this.currentFunction).is(u.ElementFlags.INSTANCE)){var a=assert(o.instanceMethodOf).type;return this.currentType=a,n.createGetLocal(0,a.toNativeType())}return this.error(c.DiagnosticCode._this_cannot_be_referenced_in_current_location,e.range),this.currentType=this.options.usizeType,n.createUnreachable();case h.NodeKind.SUPER:var o;if((o=this.currentFunction).is(u.ElementFlags.INSTANCE)){var l=assert(o.instanceMethodOf).base;if(l){var _=l.type;return this.currentType=_,n.createGetLocal(0,_.toNativeType())}}return this.error(c.DiagnosticCode._super_can_only_be_referenced_in_a_derived_class,e.range),this.currentType=this.options.usizeType,n.createUnreachable()}var y=this.program.resolveIdentifier(e,this.currentFunction,this.currentEnum);if(!y)return n.createUnreachable();var g=y.element;switch(g.kind){case u.ElementKind.LOCAL:if(g.is(u.ElementFlags.INLINED))return this.compileInlineConstant(g,t,r);var m=g.type,f=g.index;return assert(f>=0),this.currentType=m,this.module.createGetLocal(f,m.toNativeType());case u.ElementKind.GLOBAL:if(g.is(u.ElementFlags.BUILTIN))return s.compileGetConstant(this,g,e);if(!this.compileGlobal(g))return this.module.createUnreachable();var E=g.type;return assert(E!=d.Type.void),g.is(u.ElementFlags.INLINED)?this.compileInlineConstant(g,t,r):(this.currentType=E,this.module.createGetGlobal(g.internalName,E.toNativeType()));case u.ElementKind.ENUMVALUE:return g.is(u.ElementFlags.COMPILED)?(this.currentType=d.Type.i32,g.is(u.ElementFlags.INLINED)?this.module.createI32(g.constantValue):this.module.createGetGlobal(g.internalName,p.NativeType.I32)):(this.error(c.DiagnosticCode.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums,e.range),this.currentType=d.Type.i32,this.module.createUnreachable())}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},t.prototype.compileLiteralExpression=function(e,t,r){void 0===r&&(r=!1);var n=this.module;switch(e.literalKind){case 4:assert(!r);var i=t.classType;return i&&i==this.program.elements.get("Array")&&i.typeArguments&&1==i.typeArguments.length?this.compileStaticArray(i.typeArguments[0],e.elementExpressions,e):(this.error(c.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable());case 0:var a=e.value;return r&&(a=-a),t==d.Type.f32?n.createF32(a):(this.currentType=d.Type.f64,n.createF64(a));case 1:var o=e.value;switch(r&&(o=i64_sub(i64_new(0),o)),t.kind){case 0:if(i64_is_i8(o))return n.createI32(i64_low(o));break;case 1:if(i64_is_i16(o))return n.createI32(i64_low(o));break;case 2:if(i64_is_i32(o))return n.createI32(i64_low(o));break;case 5:if(i64_is_u8(o))return n.createI32(i64_low(o));break;case 6:if(i64_is_u16(o))return n.createI32(i64_low(o));break;case 7:if(i64_is_u32(o))return n.createI32(i64_low(o));break;case 10:if(i64_is_bool(o))return n.createI32(i64_low(o));break;case 4:case 9:if(!this.options.isWasm64){if(i64_is_u32(o))return n.createI32(i64_low(o));break}return n.createI64(i64_low(o),i64_high(o));case 3:case 8:return n.createI64(i64_low(o),i64_high(o));case 11:if(i64_is_f32(o))return n.createF32(i64_to_f32(o));break;case 12:if(i64_is_f64(o))return n.createF64(i64_to_f64(o));break;case 13:break;default:return assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}return i64_is_i32(o)?(this.currentType=d.Type.i32,n.createI32(i64_low(o))):(this.currentType=d.Type.i64,n.createI64(i64_low(o),i64_high(o)));case 2:return assert(!r),this.compileStaticString(e.value)}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),this.currentType=t,n.createUnreachable()},t.prototype.compileStaticString=function(e){var t=this.module,r=this.options,n=this.stringSegments,i=n.get(e);if(!i){var a=e.length,o=new Uint8Array(4+2*a);o[0]=255&a,o[1]=a>>>8&255,o[2]=a>>>16&255,o[3]=a>>>24&255;for(var s=0;s<a;++s)o[4+2*s]=255&e.charCodeAt(s),o[5+2*s]=e.charCodeAt(s)>>>8&255;i=this.addMemorySegment(o,r.usizeType.byteSize),n.set(e,i)}var c=i.offset,p=this.program.types.get("string");return this.currentType=p||r.usizeType,r.isWasm64?t.createI64(i64_low(c),i64_high(c)):(assert(i64_is_i32(c)),t.createI32(i64_low(c)))},t.prototype.compileStaticArray=function(e,t,r){var n,i=!0,a=t.length,o=this.module,s=e.toNativeType();switch(s){case p.NativeType.I32:n=changetype(new Int32Array(a));break;case p.NativeType.I64:n=changetype(new Array(a));break;case p.NativeType.F32:n=changetype(new Float32Array(a));break;case p.NativeType.F64:n=changetype(new Float64Array(a));break;default:return assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,r.range),o.createUnreachable()}for(var u,l=new Array(a),h=0;h<a;++h)if(l[h]=t[h]?this.compileExpression(t[h],e):e.toNativeZero(o),i)if(u=this.precomputeExpressionRef(l[h]),_BinaryenExpressionGetId(u)==p.ExpressionId.Const)switch(assert(_BinaryenExpressionGetType(u)==s),s){case p.NativeType.I32:changetype(n)[h]=_BinaryenConstGetValueI32(u);break;case p.NativeType.I64:changetype(n)[h]=i64_new(_BinaryenConstGetValueI64Low(u),_BinaryenConstGetValueI64High(u));break;case p.NativeType.F32:changetype(n)[h]=_BinaryenConstGetValueF32(u);break;case p.NativeType.F64:changetype(n)[h]=_BinaryenConstGetValueF64(u);break;default:assert(!1)}else i=!1;throw new Error("not implemented")},t.prototype.compileNewExpression=function(e,t){var r,n,i=this.module,o=this.options,p=this.currentFunction,l=this.program.resolveExpression(e.expression,p);if(l)if(l.element.kind==u.ElementKind.CLASS_PROTOTYPE){var h=l.element.resolveUsingTypeArguments(e.typeArguments,null,e);if(h){var d=s.compileAllocate(this,h,e),_=new Array,y=p.getTempLocal(o.usizeType);if(_.push(i.createSetLocal(y.index,d)),h.members)try{for(var g=a(h.members.values()),m=g.next();!m.done;m=g.next()){var f=m.value;if(f.kind==u.ElementKind.FIELD){var E=f,T=E.prototype.declaration;E.is(u.ElementFlags.CONSTANT)?assert(!1):T&&T.initializer&&_.push(i.createStore(E.type.byteSize,i.createGetLocal(y.index,o.nativeSizeType),this.compileExpression(T.initializer,E.type),E.type.toNativeType(),E.memoryOffset))}}}catch(e){r={error:e}}finally{try{m&&!m.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}var A=h.constructorInstance;return A&&_.push(this.compileCallDirect(A,e.arguments,e,i.createGetLocal(y.index,o.nativeSizeType))),_.push(i.createGetLocal(y.index,o.nativeSizeType)),p.freeTempLocal(y),d=i.createBlock(null,_,o.nativeSizeType),this.currentType=h.type,d}}else this.error(c.DiagnosticCode.Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature,e.expression.range);return i.createUnreachable()},t.prototype.compileParenthesizedExpression=function(e,t,r){return void 0===r&&(r=!0),this.compileExpression(e.expression,t,0,r)},t.prototype.compilePropertyAccessExpression=function(e,t,r){var n=this.program,i=this.module,a=n.resolvePropertyAccess(e,this.currentFunction);if(!a)return i.createUnreachable();var o,l=a.element;switch(l.kind){case u.ElementKind.GLOBAL:if(l.is(u.ElementFlags.BUILTIN))return s.compileGetConstant(this,l,e);if(!this.compileGlobal(l))return i.createUnreachable();var h=l.type;return assert(h!=d.Type.void),l.is(u.ElementFlags.INLINED)?this.compileInlineConstant(l,t,r):(this.currentType=h,i.createGetGlobal(l.internalName,h.toNativeType()));case u.ElementKind.ENUMVALUE:return this.compileEnum(l.enum)?(this.currentType=d.Type.i32,l.is(u.ElementFlags.INLINED)?i.createI32(l.constantValue):i.createGetGlobal(l.internalName,p.NativeType.I32)):this.module.createUnreachable();case u.ElementKind.FIELD:return assert(a.isInstanceTarget),assert(l.memoryOffset>=0),o=this.compileExpression(a.targetExpression,this.options.usizeType,0),this.currentType=l.type,i.createLoad(l.type.size>>3,l.type.is(5),o,l.type.toNativeType(),l.memoryOffset);case u.ElementKind.PROPERTY:var _=l.getterPrototype;if(_){var y=_.resolve(null);if(!y)return i.createUnreachable();var g=y.signature;return this.checkCallSignature(g,0,y.is(u.ElementFlags.INSTANCE),e)?y.instanceMethodOf?(o=this.compileExpression(a.targetExpression,y.instanceMethodOf.type),this.currentType=g.returnType,this.compileCallDirect(y,[],e,o)):(this.currentType=g.returnType,this.compileCallDirect(y,[],e)):i.createUnreachable()}return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.range,l.simpleName,l.parent.toString()),i.createUnreachable()}return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable()},t.prototype.compileTernaryExpression=function(e,t){var r=E(this.compileExpression(e.condition,d.Type.u32,0),this.currentType,this.module),n=this.compileExpression(e.ifThen,t),i=this.compileExpression(e.ifElse,t);return this.module.createIf(r,n,i)},t.prototype.compileUnaryPostfixExpression=function(e,t){var r,n,i,a,o=this.module,s=this.currentFunction,u=this.compileExpression(e.operand,t==d.Type.void?d.Type.i32:t,0,!1),h=this.currentType,_=!1;switch(e.operator){case l.Token.PLUS_PLUS:if(h.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),o.createUnreachable();switch(h.kind){case 0:case 1:case 5:case 6:case 10:_=!0;default:r=p.BinaryOp.AddI32,n=p.NativeType.I32,i=o.createI32(1);break;case 9:case 4:r=(y=this.options).isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,n=y.nativeSizeType,i=h.toNativeOne(o);break;case 3:case 8:r=p.BinaryOp.AddI64,n=p.NativeType.I64,i=o.createI64(1);break;case 11:r=p.BinaryOp.AddF32,n=p.NativeType.F32,i=o.createF32(1);break;case 12:r=p.BinaryOp.AddF64,n=p.NativeType.F64,i=o.createF64(1);break;case 13:return assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),o.createUnreachable()}break;case l.Token.MINUS_MINUS:if(h.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),o.createUnreachable();switch(h.kind){case 0:case 1:case 5:case 6:case 10:_=!0;default:r=p.BinaryOp.SubI32,n=p.NativeType.I32,i=o.createI32(1);break;case 9:case 4:var y;r=(y=this.options).isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,n=y.nativeSizeType,i=h.toNativeOne(o);break;case 3:case 8:r=p.BinaryOp.SubI64,n=p.NativeType.I64,i=o.createI64(1);break;case 11:r=p.BinaryOp.SubF32,n=p.NativeType.F32,i=o.createF32(1);break;case 12:r=p.BinaryOp.SubF64,n=p.NativeType.F64,i=o.createF64(1);break;case 13:return assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),o.createUnreachable()}break;default:return assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),o.createUnreachable()}var g=null;if(t==d.Type.void?a=o.createBinary(r,u,i):(g=s.getTempLocal(h),a=o.createBinary(r,this.module.createGetLocal(g.index,n),i)),_&&(assert(h.is(36)),a=m(a,h,o)),a=this.compileAssignmentWithValue(e.operand,a,!1),t==d.Type.void)return assert(!g),a;this.currentType=assert(g).type,s.freeTempLocal(g);var f=g.index;return o.createBlock(null,[o.createSetLocal(f,u),a,o.createGetLocal(f,n)],n)},t.prototype.compileUnaryPrefixExpression=function(e,t,r){void 0===r&&(r=!0);var n,i=this.module,a=this.currentType,o=!1,s=!1;switch(e.operator){case l.Token.PLUS:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();n=this.compileExpression(e.operand,t==d.Type.void?d.Type.i32:t,0,!1),o=(a=this.currentType).is(36);break;case l.Token.MINUS:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();if(e.operand.kind!=h.NodeKind.LITERAL||1!=e.operand.literalKind&&0!=e.operand.literalKind)switch(n=this.compileExpression(e.operand,t==d.Type.void?d.Type.i32:t,0,!1),(a=this.currentType).kind){case 0:case 1:case 5:case 6:case 10:o=!0;default:n=i.createBinary(p.BinaryOp.SubI32,i.createI32(0),n);break;case 9:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();case 4:n=i.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,a.toNativeZero(i),n);break;case 3:case 8:n=i.createBinary(p.BinaryOp.SubI64,i.createI64(0),n);break;case 11:n=i.createUnary(p.UnaryOp.NegF32,n);break;case 12:n=i.createUnary(p.UnaryOp.NegF64,n)}else n=this.compileLiteralExpression(e.operand,t,!0),this.options.sourceMap&&g(n,e.range,i,this.currentFunction),a=this.currentType;break;case l.Token.PLUS_PLUS:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();switch(s=!0,n=this.compileExpression(e.operand,t==d.Type.void?d.Type.i32:t,0,!1),(a=this.currentType).kind){case 0:case 1:case 5:case 6:case 10:o=!0;default:n=i.createBinary(p.BinaryOp.AddI32,n,this.module.createI32(1));break;case 9:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();case 4:n=i.createBinary(this.options.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,n,a.toNativeOne(i));break;case 3:case 8:n=i.createBinary(p.BinaryOp.AddI64,n,i.createI64(1));break;case 11:n=i.createBinary(p.BinaryOp.AddF32,n,i.createF32(1));break;case 12:n=i.createBinary(p.BinaryOp.AddF64,n,i.createF64(1))}break;case l.Token.MINUS_MINUS:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();switch(s=!0,n=this.compileExpression(e.operand,t==d.Type.void?d.Type.i32:t,0,!1),(a=this.currentType).kind){case 0:case 1:case 5:case 6:case 10:o=!0;default:n=i.createBinary(p.BinaryOp.SubI32,n,i.createI32(1));break;case 9:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();case 4:n=i.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,n,a.toNativeOne(i));break;case 3:case 8:n=i.createBinary(p.BinaryOp.SubI64,n,i.createI64(1));break;case 11:n=i.createBinary(p.BinaryOp.SubF32,n,i.createF32(1));break;case 12:n=i.createBinary(p.BinaryOp.SubF64,n,i.createF64(1))}break;case l.Token.EXCLAMATION:n=f(n=this.compileExpression(e.operand,t==d.Type.void?d.Type.i32:t,0,!0),this.currentType,i),this.currentType=d.Type.bool;break;case l.Token.TILDE:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();switch(n=this.compileExpression(e.operand,t==d.Type.void?d.Type.i32:t.is(8)?d.Type.i64:t,t==d.Type.void?0:1,!1),(a=this.currentType).kind){case 0:case 1:case 5:case 6:case 10:o=!0;default:n=i.createBinary(p.BinaryOp.XorI32,n,i.createI32(-1));break;case 9:if(a.isReference)return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();case 4:n=i.createBinary(this.options.isWasm64?p.BinaryOp.XorI64:p.BinaryOp.XorI32,n,a.toNativeNegOne(i));break;case 3:case 8:n=i.createBinary(p.BinaryOp.XorI64,n,i.createI64(-1,-1))}break;case l.Token.TYPEOF:return this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable();default:return assert(!1),this.error(c.DiagnosticCode.Operation_not_supported,e.range),i.createUnreachable()}return o&&r&&(assert(a.is(36)),n=m(n,a,i)),s?this.compileAssignmentWithValue(e.operand,n,t!=d.Type.void):n},t}(c.DiagnosticEmitter);function g(e,t,r,n){var i=t.source;i.debugInfoIndex<0&&(i.debugInfoIndex=r.addDebugInfoFile(i.normalizedPath)),t.debugInfoRef=e,n.debugLocations||(n.debugLocations=[]),n.debugLocations.push(t)}function m(e,t,r){switch(t.kind){case 0:return r.createBinary(p.BinaryOp.ShrI32,r.createBinary(p.BinaryOp.ShlI32,e,r.createI32(24)),r.createI32(24));case 1:return r.createBinary(p.BinaryOp.ShrI32,r.createBinary(p.BinaryOp.ShlI32,e,r.createI32(16)),r.createI32(16));case 5:return r.createBinary(p.BinaryOp.AndI32,e,r.createI32(255));case 6:return r.createBinary(p.BinaryOp.AndI32,e,r.createI32(65535));case 10:return r.createBinary(p.BinaryOp.AndI32,e,r.createI32(1));default:return assert(!1),e}}function f(e,t,r){switch(t.kind){default: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));case 13:return assert(!1),r.createI32(1)}}function E(e,t,r){switch(t.kind){default: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));case 13:return assert(!1),r.createI32(0)}}t.Compiler=y,t.makeSmallIntegerWrap=m,t.makeIsFalseish=f,t.makeIsTrueish=E},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=47;function i(e){for(var t,r=0,i=e.length;r+1<i&&46==e.charCodeAt(r)&&e.charCodeAt(r+1)==n;)r+=2;for((r>0||i<e.length)&&(e=e.substring(r,i),i-=r,r=0);r+1<i;){if(t=!1,e.charCodeAt(r)==n&&46==e.charCodeAt(r+1)){if((t=r+2==i)||r+2<i&&e.charCodeAt(r+2)==n){e=t?e.substring(0,r):e.substring(0,r)+e.substring(r+2),i-=2;continue}if((t=r+3==i)&&46==e.charCodeAt(r+2)||r+3<i&&46==e.charCodeAt(r+2)&&e.charCodeAt(r+3)==n){for(var a=r;--a>=0;)if(e.charCodeAt(a)==n){r-a==3&&46==e.charCodeAt(a+1)&&46==e.charCodeAt(a+2)||(e=t?e.substring(0,a):e.substring(0,a)+e.substring(r+3),i-=r+3-a,r=a-1);break}if(a<0&&r>0&&(2!=r||46!=e.charCodeAt(0)||46!=e.charCodeAt(1))){i=(e=e.substring(r+4)).length;continue}}}r++}return i>0?e:"."}function a(e){for(var t=e.length;--t>0;)if(e.charCodeAt(t)==n)return e.substring(0,t);return"."}t.normalize=i,t.resolve=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}),function(e){e[e.NULL=0]="NULL",e[e.LINEFEED=10]="LINEFEED",e[e.CARRIAGERETURN=13]="CARRIAGERETURN",e[e.LINESEPARATOR=8232]="LINESEPARATOR",e[e.PARAGRAPHSEPARATOR=8233]="PARAGRAPHSEPARATOR",e[e.NEXTLINE=133]="NEXTLINE",e[e.SPACE=32]="SPACE",e[e.NONBREAKINGSPACE=160]="NONBREAKINGSPACE",e[e.ENQUAD=8192]="ENQUAD",e[e.EMQUAD=8193]="EMQUAD",e[e.ENSPACE=8194]="ENSPACE",e[e.EMSPACE=8195]="EMSPACE",e[e.THREEPEREMSPACE=8196]="THREEPEREMSPACE",e[e.FOURPEREMSPACE=8197]="FOURPEREMSPACE",e[e.SIXPEREMSPACE=8198]="SIXPEREMSPACE",e[e.FIGURESPACE=8199]="FIGURESPACE",e[e.PUNCTUATIONSPACE=8200]="PUNCTUATIONSPACE",e[e.THINSPACE=8201]="THINSPACE",e[e.HAIRSPACE=8202]="HAIRSPACE",e[e.ZEROWIDTHSPACE=8203]="ZEROWIDTHSPACE",e[e.NARROWNOBREAKSPACE=8239]="NARROWNOBREAKSPACE",e[e.IDEOGRAPHICSPACE=12288]="IDEOGRAPHICSPACE",e[e.MATHEMATICALSPACE=8287]="MATHEMATICALSPACE",e[e.OGHAM=5760]="OGHAM",e[e._=95]="_",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.AMPERSAND=38]="AMPERSAND",e[e.ASTERISK=42]="ASTERISK",e[e.AT=64]="AT",e[e.BACKSLASH=92]="BACKSLASH",e[e.BACKTICK=96]="BACKTICK",e[e.BAR=124]="BAR",e[e.CARET=94]="CARET",e[e.CLOSEBRACE=125]="CLOSEBRACE",e[e.CLOSEBRACKET=93]="CLOSEBRACKET",e[e.CLOSEPAREN=41]="CLOSEPAREN",e[e.COLON=58]="COLON",e[e.COMMA=44]="COMMA",e[e.DOLLAR=36]="DOLLAR",e[e.DOT=46]="DOT",e[e.DOUBLEQUOTE=34]="DOUBLEQUOTE",e[e.EQUALS=61]="EQUALS",e[e.EXCLAMATION=33]="EXCLAMATION",e[e.GREATERTHAN=62]="GREATERTHAN",e[e.HASH=35]="HASH",e[e.LESSTHAN=60]="LESSTHAN",e[e.MINUS=45]="MINUS",e[e.OPENBRACE=123]="OPENBRACE",e[e.OPENBRACKET=91]="OPENBRACKET",e[e.OPENPAREN=40]="OPENPAREN",e[e.PERCENT=37]="PERCENT",e[e.PLUS=43]="PLUS",e[e.QUESTION=63]="QUESTION",e[e.SEMICOLON=59]="SEMICOLON",e[e.SINGLEQUOTE=39]="SINGLEQUOTE",e[e.SLASH=47]="SLASH",e[e.TILDE=126]="TILDE",e[e.BACKSPACE=8]="BACKSPACE",e[e.FORMFEED=12]="FORMFEED",e[e.BYTEORDERMARK=65279]="BYTEORDERMARK",e[e.TAB=9]="TAB",e[e.VERTICALTAB=11]="VERTICALTAB"}(t.CharCode||(t.CharCode={})),t.isLineBreak=function(e){switch(e){case 10:case 13:case 8232:case 8233:return!0;default:return!1}},t.isWhiteSpace=function(e){switch(e){case 32:case 9:case 11:case 12:case 160:case 133:case 5760:case 8239:case 8287:case 12288:case 65279:return!0;default:return e>=8192&&e<=8203}},t.isDecimalDigit=function(e){return e>=48&&e<=57},t.isOctalDigit=function(e){return e>=48&&e<=55},t.isIdentifierStart=function(e){return e>=65&&e<=90||e>=97&&e<=122||36==e||95==e||e>127&&!((t=e)<0||t>65535)&&a(t,n);var t},t.isKeywordCharacter=function(e){return e>=97&&e<=122},t.isIdentifierPart=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||36==e||95==e||e>127&&!((t=e)<0||t>65535)&&a(t,i);var t};var n=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1319,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2208,2208,2210,2220,2308,2361,2365,2365,2384,2384,2392,2401,2417,2423,2425,2431,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3133,3160,3161,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3424,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6263,6272,6312,6314,6314,6320,6389,6400,6428,6480,6509,6512,6516,6528,6571,6593,6599,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7401,7404,7406,7409,7413,7414,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42647,42656,42735,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43648,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],i=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1319,1329,1366,1369,1369,1377,1415,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1520,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2048,2093,2112,2139,2208,2208,2210,2220,2276,2302,2304,2403,2406,2415,2417,2423,2425,2431,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3161,3168,3171,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3330,3331,3333,3340,3342,3344,3346,3386,3389,3396,3398,3400,3402,3406,3415,3415,3424,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6263,6272,6314,6320,6389,6400,6428,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7376,7378,7380,7414,7424,7654,7676,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8204,8205,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,11823,11823,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42647,42655,42737,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43047,43072,43123,43136,43204,43216,43225,43232,43255,43259,43259,43264,43309,43312,43347,43360,43388,43392,43456,43471,43481,43520,43574,43584,43597,43600,43609,43616,43638,43642,43643,43648,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65062,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500];function a(e,t){if(e<t[0])return!1;for(var r,n=0,i=t.length;n+1<i;){if(r=n+(i-n)/2,t[r-=r%2]<=e&&e<=t[r+1])return!0;e<t[r]?i=r:n=r+2}return!1}},function(e,t,r){"use strict";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.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.Structs_cannot_extend_classes_and_vice_versa=207]="Structs_cannot_extend_classes_and_vice_versa",e[e.Structs_cannot_implement_interfaces=208]="Structs_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.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.Enum_member_must_have_initializer=1061]="Enum_member_must_have_initializer",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.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.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.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.A_class_may_only_extend_another_class=1311]="A_class_may_only_extend_another_class",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.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._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.The_0_operator_cannot_be_applied_to_type_1=2469]="The_0_operator_cannot_be_applied_to_type_1",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.Namespace_0_has_no_exported_member_1=2694]="Namespace_0_has_no_exported_member_1",e[e.File_0_not_found=6054]="File_0_not_found"}(t.DiagnosticCode||(t.DiagnosticCode={})),t.diagnosticCodeToString=function(e){switch(e){case 100:return"Operation not supported.";case 101:return"Operation is unsafe.";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"Structs cannot extend classes and vice-versa.";case 208:return"Structs cannot implement interfaces.";case 209:return"Invalid regular expression flags.";case 210:return"Implementation '{0}' must match the signature '{1}'.";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 1061:return"Enum member must have initializer.";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 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 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 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 1311:return"A class may only extend another class.";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 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 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 2469:return"The '{0}' operator cannot be applied to type '{1}'.";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 2694:return"Namespace '{0}' has no exported member '{1}'.";case 6054:return"File '{0}' not found.";default:return""}}},function(e,t,r){"use strict";var n,i=this&&this.__extends||(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])},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(2),o=r(3),s=r(0),c=r(8),p=r(4),u=function(e){function t(){var t=e.call(this)||this;return t.backlog=new Array,t.seenlog=new Set,t.tryParseSignatureIsSignature=!1,t.program=new a.Program(t.diagnostics),t}return i(t,e),t.prototype.parseFile=function(e,t,r){for(var n=this.program,i=c.normalize(t),s=n.sources,u=0,l=s.length;u<l;++u)if(s[u].normalizedPath==i)return;this.seenlog.add(i);var h=new p.Source(i,e,r?p.SourceKind.ENTRY:t.startsWith(a.LIBRARY_PREFIX)&&t.indexOf(a.PATH_DELIMITER,a.LIBRARY_PREFIX.length)<0?p.SourceKind.LIBRARY:p.SourceKind.DEFAULT);s.push(h);var d=new o.Tokenizer(h,n.diagnostics);for(h.tokenizer=d;!d.skip(o.Token.ENDOFFILE);){var _=this.parseTopLevelStatement(d);_&&(_.parent=h,h.statements.push(_))}d.finish()},t.prototype.parseTopLevelStatement=function(e,t){void 0===t&&(t=!1);for(var r=null;e.skip(o.Token.AT);){var n=this.parseDecorator(e);if(!n)break;r||(r=[]),r.push(n)}var i=null;e.skip(o.Token.EXPORT)&&(i=p.addModifier(p.Node.createModifier(p.ModifierKind.EXPORT,e.range()),i)),e.skip(o.Token.DECLARE)&&(i=p.addModifier(p.Node.createModifier(p.ModifierKind.DECLARE,e.range()),i),e.peek(!0),e.nextTokenOnNewLine&&this.error(s.DiagnosticCode.Line_break_not_permitted_here,e.range(e.pos)));var a,c=null;switch(e.peek()){case o.Token.CONST:if(e.next(),i=p.addModifier(p.Node.createModifier(p.ModifierKind.CONST,e.range()),i),e.skip(o.Token.ENUM)){c=this.parseEnum(e,i,r);break}c=this.parseVariable(e,i,r),r=null;break;case o.Token.LET:i=p.addModifier(p.Node.createModifier(p.ModifierKind.LET,e.range()),i);case o.Token.VAR:e.next(),c=this.parseVariable(e,i,r),r=null;break;case o.Token.ENUM:e.next(),c=this.parseEnum(e,i,r),r=null;break;case o.Token.FUNCTION:e.next(),c=this.parseFunction(e,i,r),r=null;break;case o.Token.ABSTRACT:if(e.next(),!e.skip(o.Token.CLASS)){this.error(s.DiagnosticCode._0_expected,e.range(e.pos),"class");break}i=p.addModifier(p.Node.createModifier(p.ModifierKind.ABSTRACT,e.range()),i);case o.Token.CLASS:e.next(),c=this.parseClass(e,i,r),r=null;break;case o.Token.NAMESPACE:e.next(),c=this.parseNamespace(e,i,r),r=null;break;case o.Token.IMPORT:e.next(),c=(a=p.getModifier(p.ModifierKind.EXPORT,i))?this.parseExportImport(e,a.range):this.parseImport(e),i&&p.setReusableModifiers(i);break;case o.Token.TYPE:e.next(),c=this.parseTypeDeclaration(e,i,r),r=null;break;default:p.hasModifier(p.ModifierKind.EXPORT,i)?c=this.parseExport(e,i):(i&&((a=p.getModifier(p.ModifierKind.DECLARE,i))&&this.error(s.DiagnosticCode._0_modifier_cannot_be_used_here,a.range,"declare"),p.setReusableModifiers(i)),t||(c=this.parseStatement(e,!0)))}if(r)for(var u=0,l=r.length;u<l;++u)this.error(s.DiagnosticCode.Decorators_are_not_valid_here,r[u].range);return c},t.prototype.nextFile=function(){var e=this.backlog;return e.length?e.shift():null},t.prototype.finish=function(){if(this.backlog.length)throw new Error("backlog is not empty");return this.backlog=[],this.seenlog.clear(),this.program},t.prototype.parseType=function(e,t,r){void 0===t&&(t=!0),void 0===r&&(r=!1);var n,i=e.next(),a=e.tokenPos;if(i==o.Token.VOID)return p.Node.createType(p.Node.createIdentifierExpression("void",e.range()),[],!1,e.range(a,e.pos));if(i==o.Token.OPENPAREN){var c=e.skip(o.Token.OPENPAREN),u=this.tryParseSignature(e);if(u){if(c){if(!e.skip(o.Token.CLOSEPAREN))return this.error(s.DiagnosticCode._0_expected,e.range(),")"),null;if(!e.skip(o.Token.BAR))return this.error(s.DiagnosticCode._0_expected,e.range(),"|"),null;e.skip(o.Token.NULL)||this.error(s.DiagnosticCode._0_expected,e.range(),"null"),u.isNullable=!0}return u}if(c||this.tryParseSignatureIsSignature)return this.error(s.DiagnosticCode.Unexpected_token,e.range()),null;if(!t)return this.error(s.DiagnosticCode.Unexpected_token,e.range()),null;var l=this.parseType(e,!1,r);if(!l)return null;if(!e.skip(o.Token.CLOSEPAREN))return r||this.error(s.DiagnosticCode._0_expected,e.range(e.pos),"}"),null;(n=l).range.start=a,n.range.end=e.pos}else if(i==o.Token.THIS)n=p.Node.createType(p.Node.createThisExpression(e.range()),[],!1,e.range(a,e.pos));else if(i==o.Token.TRUE||i==o.Token.FALSE)n=p.Node.createType(p.Node.createIdentifierExpression("bool",e.range()),[],!1,e.range(a,e.pos));else if(i==o.Token.STRINGLITERAL)e.readString(),n=p.Node.createType(p.Node.createIdentifierExpression("string",e.range()),[],!1,e.range(a,e.pos));else{if(i!=o.Token.IDENTIFIER)return r||this.error(s.DiagnosticCode.Identifier_expected,e.range()),null;var h=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),d=new Array,_=!1;if(e.skip(o.Token.LESSTHAN)){do{var y=this.parseType(e,!0,r);if(!y)return null;d.push(y)}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.GREATERTHAN))return r||this.error(s.DiagnosticCode._0_expected,e.range(e.pos),">"),null}if(e.skip(o.Token.BAR)){if(!e.skip(o.Token.NULL))return r||this.error(s.DiagnosticCode._0_expected,e.range(e.pos),"null"),null;_=!0}n=p.Node.createType(h,d,_,e.range(a,e.pos))}for(;e.skip(o.Token.OPENBRACKET);){var g=e.tokenPos;if(!e.skip(o.Token.CLOSEBRACKET))return r||this.error(s.DiagnosticCode._0_expected,e.range(),"]"),null;var m=e.range(g,e.pos);_=!1;if(e.skip(o.Token.BAR)){if(!e.skip(o.Token.NULL))return r||this.error(s.DiagnosticCode._0_expected,e.range(),"null"),null;_=!0}if(n=p.Node.createType(p.Node.createIdentifierExpression("Array",m),[n],_,e.range(a,e.pos)),_)break}return n},t.prototype.tryParseSignature=function(e){var t,r=e.mark(),n=e.tokenPos,i=null,a=null,c=!1;if(e.skip(o.Token.CLOSEPAREN))c=!0,e.discard(r),i=[];else{c=!1;do{var u=p.ParameterKind.DEFAULT;if(e.skip(o.Token.DOT_DOT_DOT)&&(c=!0,e.discard(r),u=p.ParameterKind.REST),e.skip(o.Token.THIS)){if(!e.skip(o.Token.COLON))return e.reset(r),this.tryParseSignatureIsSignature=!1,null;c=!0,e.discard(r);var l=this.parseType(e,!1);if(!l)return null;if(l.kind!=p.NodeKind.TYPE)return this.error(s.DiagnosticCode.Operation_not_supported,l.range),this.tryParseSignatureIsSignature=!0,null;a=l}else{if(!e.skip(o.Token.IDENTIFIER))return c?this.error(s.DiagnosticCode.Identifier_expected,e.range()):e.reset(r),this.tryParseSignatureIsSignature=c,null;var h=p.Node.createIdentifierExpression(e.readIdentifier(),e.range(e.tokenPos,e.pos));if(e.skip(o.Token.QUESTION)&&(c=!0,e.discard(r),u==p.ParameterKind.REST?this.error(s.DiagnosticCode.A_rest_parameter_cannot_be_optional,e.range()):u=p.ParameterKind.OPTIONAL),e.skip(o.Token.COLON)){c=!0,e.discard(r);var d=this.parseType(e);if(!d)return this.tryParseSignatureIsSignature=c,null;var _=new p.ParameterNode;_.parameterKind=u,_.name=h,_.type=d,i?i.push(_):i=[_]}else c&&this.error(s.DiagnosticCode.Type_expected,e.range())}}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.CLOSEPAREN))return this.error(s.DiagnosticCode._0_expected,e.range(),")"),this.tryParseSignatureIsSignature=c,null}return e.skip(o.Token.EQUALS_GREATERTHAN)?(c=!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=c,null)):(c?this.error(s.DiagnosticCode._0_expected,e.range(),"=>"):e.reset(r),this.tryParseSignatureIsSignature=c,null)},t.prototype.parseDecorator=function(e){var t=e.tokenPos;if(e.skip(o.Token.IDENTIFIER)){for(var r=e.readIdentifier(),n=p.Node.createIdentifierExpression(r,e.range(t,e.pos));e.skip(o.Token.DOT);){if(!e.skip(o.Token.IDENTIFIER))return this.error(s.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(s.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseVariable=function(e,t,r){var n=t&&t.length?t[0].range.start:e.tokenPos,i=new Array,a=p.hasModifier(p.ModifierKind.DECLARE,t);do{var s=this.parseVariableDeclaration(e,a,t,r);if(!s)return null;i.push(s)}while(e.skip(o.Token.COMMA));var c=p.Node.createVariableStatement(i,t,r,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),c},t.prototype.parseVariableDeclaration=function(e,t,r,n){if(void 0===t&&(t=!1),!e.skip(o.Token.IDENTIFIER))return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null;var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),a=null;e.skip(o.Token.COLON)&&(a=this.parseType(e));var c=null;if(e.skip(o.Token.EQUALS)){if(t&&this.error(s.DiagnosticCode.Initializers_are_not_allowed_in_ambient_contexts,e.range()),!(c=this.parseExpression(e,1)))return null}else p.hasModifier(p.ModifierKind.CONST,r)?p.hasModifier(p.ModifierKind.DECLARE,r)||this.error(s.DiagnosticCode._const_declarations_must_be_initialized,i.range):a||this.error(s.DiagnosticCode.Type_expected,e.range(e.pos));return p.Node.createVariableDeclaration(i,a,c,r,n,o.Range.join(i.range,e.range()))},t.prototype.parseEnum=function(e,t,r){var n=t&&t.length?t[0].range.start:e.tokenPos;if(e.next()!=o.Token.IDENTIFIER)return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null;var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.next()!=o.Token.OPENBRACE)return this.error(s.DiagnosticCode._0_expected,e.range(),"{"),null;var a=new Array;if(!e.skip(o.Token.CLOSEBRACE)){do{var c=this.parseEnumValue(e);if(!c)return null;a.push(c)}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.CLOSEBRACE))return this.error(s.DiagnosticCode._0_expected,e.range(),"}"),null}var u=p.Node.createEnumDeclaration(i,a,t,r,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),u},t.prototype.parseEnumValue=function(e){if(!e.skip(o.Token.IDENTIFIER))return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null;var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;return e.skip(o.Token.EQUALS)&&!(r=this.parseExpression(e,1))?null:p.Node.createEnumValueDeclaration(t,r,o.Range.join(t.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){var t=new Array;if(e.skip(o.Token.GREATERTHAN))this.error(s.DiagnosticCode.Type_parameter_list_cannot_be_empty,e.range());else{do{var r=this.parseTypeParameter(e);if(!r)return null;t.push(r)}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.GREATERTHAN))return this.error(s.DiagnosticCode._0_expected,e.range(),">"),null}return 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)){var n=this.parseType(e);if(!n)return null;if(n.kind!=p.NodeKind.TYPE)return this.error(s.DiagnosticCode.Operation_not_supported,n.range),null;r=n}return p.Node.createTypeParameter(t,r,o.Range.join(t.range,e.range()))}return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseParameters=function(e){var t=new Array,r=null,n=!1,i=!1;if(e.peek()!=o.Token.CLOSEPAREN)do{var a=this.parseParameter(e);if(!a)return null;switch(r&&!i&&(this.error(s.DiagnosticCode.A_rest_parameter_must_be_last_in_a_parameter_list,r.name.range),i=!0),a.parameterKind){default:n&&this.error(s.DiagnosticCode.A_required_parameter_cannot_follow_an_optional_parameter,a.name.range);break;case p.ParameterKind.OPTIONAL:n=!0;break;case p.ParameterKind.REST:r=a}t.push(a)}while(e.skip(o.Token.COMMA));return e.skip(o.Token.CLOSEPAREN)?t:(this.error(s.DiagnosticCode._0_expected,e.range(),")"),null)},t.prototype.parseParameter=function(e,t){void 0===t&&(t=!1);var r=!1,n=!1,i=null;if(e.skip(o.Token.DOT_DOT_DOT)&&(r=!0,i=e.range()),e.skip(o.Token.IDENTIFIER)){r||(i=e.range());var a=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),c=null;if((n=e.skip(o.Token.QUESTION))&&r&&this.error(s.DiagnosticCode.A_rest_parameter_cannot_be_optional,a.range),e.skip(o.Token.COLON)&&!(c=this.parseType(e)))return null;var u=null;return!e.skip(o.Token.EQUALS)||(r&&this.error(s.DiagnosticCode.A_rest_parameter_cannot_have_an_initializer,a.range),n?this.error(s.DiagnosticCode.Parameter_cannot_have_question_mark_and_initializer,a.range):n=!0,u=this.parseExpression(e,1))?p.Node.createParameter(a,c,u,r?p.ParameterKind.REST:n?p.ParameterKind.OPTIONAL:p.ParameterKind.DEFAULT,o.Range.join(i,e.range())):null}return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseFunction=function(e,t,r){var n=t&&t.length?t[0].range.start:e.tokenPos;if(!e.skip(o.Token.IDENTIFIER))return this.error(s.DiagnosticCode.Identifier_expected,e.range(e.pos)),null;var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),a=-1,c=null;if(e.skip(o.Token.LESSTHAN)&&(a=e.tokenPos,!(c=this.parseTypeParameters(e))))return null;if(!e.skip(o.Token.OPENPAREN))return this.error(s.DiagnosticCode._0_expected,e.range(e.pos),"("),null;a<0&&(a=e.tokenPos);var u=this.parseParameters(e);if(!u)return null;var l=p.hasModifier(p.ModifierKind.SET,t);l&&(1!=u.length&&this.error(s.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,i.range),u.length&&u[0].initializer&&this.error(s.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,i.range)),p.hasModifier(p.ModifierKind.GET,t)&&u.length&&this.error(s.DiagnosticCode.A_get_accessor_cannot_have_parameters,i.range);var h=null;if(e.skip(o.Token.COLON)&&!(h=this.parseType(e,l)))return null;h||(h=p.Node.createOmittedType(e.range(e.pos)),l||this.error(s.DiagnosticCode.Type_expected,h.range));var d=p.Node.createSignature(u,h,null,!1,e.range(a,e.pos)),_=p.hasModifier(p.ModifierKind.DECLARE,t),y=null;if(e.skip(o.Token.OPENBRACE)){if(_&&this.error(s.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.range()),!(y=this.parseBlockStatement(e,!1)))return null}else _||this.error(s.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.range(e.pos));var g=p.Node.createFunctionDeclaration(i,c,d,y,t,r,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.skip(o.Token.IDENTIFIER)?p.Node.createIdentifierExpression(e.readIdentifier(),e.range()):p.Node.createEmptyIdentifierExpression(e.range(e.pos)),!e.skip(o.Token.OPENPAREN))return this.error(s.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,a){void 0===i&&(i=-1),void 0===a&&(a=-1),i<0&&(i=t.range.start),a<0&&(a=i);var c=null;if(e.skip(o.Token.COLON)){if(!(c=this.parseType(e)))return null}else c=p.Node.createOmittedType(e.range(e.pos)),this.error(s.DiagnosticCode.Type_expected,c.range);if(n&&!e.skip(o.Token.EQUALS_GREATERTHAN))return this.error(s.DiagnosticCode._0_expected,e.range(e.pos),"=>"),null;var u,l=p.Node.createSignature(r,c,null,!1,e.range(a,e.pos));if(n)u=this.parseStatement(e,!1);else{if(!e.skip(o.Token.OPENBRACE))return this.error(s.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;u=this.parseBlockStatement(e,!1)}if(!u)return null;var h=p.Node.createFunctionDeclaration(t,null,l,u,null,null,e.range(i,e.pos));return p.Node.createFunctionExpression(h,n)},t.prototype.parseClass=function(e,t,r){var n=r&&r.length?r[0].range.start:t&&t.length?t[0].range.start:e.tokenPos;if(e.skip(o.Token.IDENTIFIER)){var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),a=void 0;if(e.skip(o.Token.LESSTHAN)){if(!(a=this.parseTypeParameters(e)))return null}else a=[];var c=null;if(e.skip(o.Token.EXTENDS)){var u=this.parseType(e);if(!u)return null;if(u.kind!=p.NodeKind.TYPE)return this.error(s.DiagnosticCode.Operation_not_supported,u.range),null;c=u}var l=new Array;if(e.skip(o.Token.IMPLEMENTS))do{var h=this.parseType(e);if(!h)return null;l.push(h)}while(e.skip(o.Token.COMMA));if(e.skip(o.Token.OPENBRACE)){var d=new Array;if(!e.skip(o.Token.CLOSEBRACE)){var _=p.hasModifier(p.ModifierKind.DECLARE,t);do{var y=this.parseClassMember(e,_);if(!y)return null;d.push(y)}while(!e.skip(o.Token.CLOSEBRACE))}return p.Node.createClassDeclaration(i,a,c,l,d,t,r,e.range(n,e.pos))}this.error(s.DiagnosticCode._0_expected,e.range(),"{")}else this.error(s.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseClassMember=function(e,t){for(var r=e.pos,n=new Array;e.skip(o.Token.AT);){var i=this.parseDecorator(e);if(!i)break;n.push(i)}var a=null;e.skip(o.Token.PUBLIC)?a=p.addModifier(p.Node.createModifier(p.ModifierKind.PUBLIC,e.range()),a):e.skip(o.Token.PRIVATE)?a=p.addModifier(p.Node.createModifier(p.ModifierKind.PRIVATE,e.range()),a):e.skip(o.Token.PROTECTED)&&(a=p.addModifier(p.Node.createModifier(p.ModifierKind.PROTECTED,e.range()),a)),e.skip(o.Token.STATIC)?a=p.addModifier(p.Node.createModifier(p.ModifierKind.STATIC,e.range()),a):e.skip(o.Token.ABSTRACT)&&(a=p.addModifier(p.Node.createModifier(p.ModifierKind.ABSTRACT,e.range()),a)),e.skip(o.Token.READONLY)&&(a=p.addModifier(p.Node.createModifier(p.ModifierKind.READONLY,e.range()),a));var c=e.mark(),u=!1,l=!1;(u=e.skip(o.Token.GET))?e.peek(!0,!0)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine?(e.reset(c),u=!1):a=p.addModifier(p.Node.createModifier(p.ModifierKind.GET,e.range()),a):(l=e.skip(o.Token.SET))&&(e.peek(!0,!0)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine?(e.reset(c),l=!1):a=p.addModifier(p.Node.createModifier(p.ModifierKind.SET,e.range()),a));var h=e.skip(o.Token.CONSTRUCTOR);if(h||e.skip(o.Token.IDENTIFIER)){var d=h?p.Node.createConstructorExpression(e.range()):p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),_=null;if(e.skip(o.Token.LESSTHAN)&&(h&&this.error(s.DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration,e.range()),!(_=this.parseTypeParameters(e))))return null;if(e.skip(o.Token.OPENPAREN)){var y=e.tokenPos,g=this.parseParameters(e);if(!g)return null;u&&g.length&&this.error(s.DiagnosticCode.A_get_accessor_cannot_have_parameters,d.range),l&&(1!=g.length&&this.error(s.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,d.range),g.length&&g[0].initializer&&this.error(s.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,d.range));var m=null;if(e.skip(o.Token.COLON)){if(d.kind==p.NodeKind.CONSTRUCTOR?this.error(s.DiagnosticCode.Type_annotation_cannot_appear_on_a_constructor_declaration,e.range()):l&&this.error(s.DiagnosticCode.A_set_accessor_cannot_have_a_return_type_annotation,e.range()),!(m=this.parseType(e,d.kind==p.NodeKind.CONSTRUCTOR||l)))return null}else m=p.Node.createOmittedType(e.range(e.pos)),l||d.kind==p.NodeKind.CONSTRUCTOR||this.error(s.DiagnosticCode.Type_expected,m.range);var f=p.Node.createSignature(g,m,null,!1,e.range(y,e.pos)),E=null;if(e.skip(o.Token.OPENBRACE)){if(t&&this.error(s.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.range()),!(E=this.parseBlockStatement(e,!1)))return null}else t||this.error(s.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.range());var T=p.Node.createMethodDeclaration(d,_,f,E,a,n,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),T}if(h)this.error(s.DiagnosticCode.Constructor_implementation_is_missing,d.range);else{if(!u&&!l){var A=void 0;(A=p.getModifier(p.ModifierKind.ABSTRACT,a))&&this.error(s.DiagnosticCode._0_modifier_cannot_be_used_here,A.range,"abstract"),(A=p.getModifier(p.ModifierKind.GET,a))&&this.error(s.DiagnosticCode._0_modifier_cannot_be_used_here,A.range,"get"),(A=p.getModifier(p.ModifierKind.SET,a))&&this.error(s.DiagnosticCode._0_modifier_cannot_be_used_here,A.range,"set");var I=null;if(e.skip(o.Token.COLON)){if(!(I=this.parseType(e)))return null}else this.error(s.DiagnosticCode.Type_expected,e.range());var v=null;if(e.skip(o.Token.EQUALS)&&!(v=this.parseExpression(e)))return null;var N=p.Node.createFieldDeclaration(d,I,v,a,n,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),N}this.error(s.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,d.range)}}else this.error(s.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseNamespace=function(e,t,r){var n=t&&t.length?t[0].range.start:e.tokenPos;if(e.skip(o.Token.IDENTIFIER)){var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(o.Token.OPENBRACE)){for(var a=new Array;!e.skip(o.Token.CLOSEBRACE);){var c=this.parseTopLevelStatement(e,!0);if(!c)return null;a.push(c)}var u=p.Node.createNamespaceDeclaration(i,a,t,r,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),u}this.error(s.DiagnosticCode._0_expected,e.range(),"{")}else this.error(s.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseExport=function(e,t){var r=t&&t.length?t[0].range.start:e.tokenPos;if(e.skip(o.Token.OPENBRACE)){var n=new Array;if(!e.skip(o.Token.CLOSEBRACE)){do{var i=this.parseExportMember(e);if(!i)return null;n.push(i)}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.CLOSEBRACE))return this.error(s.DiagnosticCode._0_expected,e.range(),"}"),null}var a=null;if(e.skip(o.Token.FROM)){if(!e.skip(o.Token.STRINGLITERAL))return this.error(s.DiagnosticCode.String_literal_expected,e.range()),null;a=p.Node.createStringLiteralExpression(e.readString(),e.range())}var c=p.Node.createExportStatement(n,a,t,e.range(r,e.pos));return c.normalizedPath&&!this.seenlog.has(c.normalizedPath)&&(this.backlog.push(c.normalizedPath),this.seenlog.add(c.normalizedPath)),e.skip(o.Token.SEMICOLON),c}return this.error(s.DiagnosticCode._0_expected,e.range(),"{"),null},t.prototype.parseExportMember=function(e){if(e.skip(o.Token.IDENTIFIER)){var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(o.Token.AS)){if(!e.skip(o.Token.IDENTIFIER))return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null;r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}return p.Node.createExportMember(t,r,r?o.Range.join(t.range,r.range):t.range)}return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseImport=function(e){var t=e.tokenPos,r=null,n=null,i=!1;if(e.skip(o.Token.OPENBRACE)){if(r=new Array,!e.skip(o.Token.CLOSEBRACE)){do{var a=this.parseImportDeclaration(e);if(!a)return null;r.push(a)}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.CLOSEBRACE))return this.error(s.DiagnosticCode._0_expected,e.range(),"}"),null}}else if(e.skip(o.Token.ASTERISK)){if(!e.skip(o.Token.AS))return this.error(s.DiagnosticCode._0_expected,e.range(),"as"),null;if(!e.skip(o.Token.IDENTIFIER))return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null;n=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}else i=!0;if(i||e.skip(o.Token.FROM)){if(e.skip(o.Token.STRINGLITERAL)){var c=p.Node.createStringLiteralExpression(e.readString(),e.range()),u=void 0;return n?(assert(!r),u=p.Node.createImportStatementWithWildcard(n,c,e.range(t,e.pos))):u=p.Node.createImportStatement(r,c,e.range(t,e.pos)),this.seenlog.has(u.normalizedPath)||(this.backlog.push(u.normalizedPath),this.seenlog.add(u.normalizedPath)),e.skip(o.Token.SEMICOLON),u}this.error(s.DiagnosticCode.String_literal_expected,e.range())}else this.error(s.DiagnosticCode._0_expected,e.range(),"from");return null},t.prototype.parseImportDeclaration=function(e){if(e.skip(o.Token.IDENTIFIER)){var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),r=null;if(e.skip(o.Token.AS)){if(!e.skip(o.Token.IDENTIFIER))return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null;r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}return p.Node.createImportDeclaration(t,r,r?o.Range.join(t.range,r.range):t.range)}return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null},t.prototype.parseExportImport=function(e,t){if(e.skip(o.Token.IDENTIFIER)){var r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(o.Token.EQUALS)){if(e.skip(o.Token.IDENTIFIER)){var n=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),i=p.Node.createExportImportStatement(n,r,o.Range.join(t,e.range()));return e.skip(o.Token.SEMICOLON),i}this.error(s.DiagnosticCode.Identifier_expected,e.range())}else this.error(s.DiagnosticCode._0_expected,e.range(),"=")}else this.error(s.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseStatement=function(e,t){void 0===t&&(t=!1);var r=e.mark();switch(e.next()){case o.Token.BREAK:return this.parseBreak(e);case o.Token.CONST:return this.parseVariable(e,[p.Node.createModifier(p.ModifierKind.CONST,e.range())],null);case o.Token.CONTINUE:return this.parseContinue(e);case o.Token.DO:return this.parseDoStatement(e);case o.Token.FOR:return this.parseForStatement(e);case o.Token.IF:return this.parseIfStatement(e);case o.Token.LET:return this.parseVariable(e,[p.Node.createModifier(p.ModifierKind.LET,e.range())],null);case o.Token.VAR:return this.parseVariable(e,null,null);case o.Token.OPENBRACE:return this.parseBlockStatement(e,t);case o.Token.RETURN:return t&&this.error(s.DiagnosticCode.A_return_statement_can_only_be_used_within_a_function_body,e.range()),this.parseReturn(e);case o.Token.SEMICOLON:return p.Node.createEmptyStatement(e.range(e.tokenPos));case o.Token.SWITCH:return this.parseSwitchStatement(e);case o.Token.THROW:return this.parseThrowStatement(e);case o.Token.TRY:return this.parseTryStatement(e);case o.Token.TYPE:return this.parseTypeDeclaration(e);case o.Token.VOID:return this.parseVoidStatement(e);case o.Token.WHILE:return this.parseWhileStatement(e);default:return e.reset(r),this.parseExpressionStatement(e)}},t.prototype.parseBlockStatement=function(e,t){for(var r=e.tokenPos,n=new Array;!e.skip(o.Token.CLOSEBRACE);){var i=this.parseStatement(e,t);if(!i)return null;n.push(i)}var a=p.Node.createBlockStatement(n,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),a},t.prototype.parseBreak=function(e){var t=null;e.peek(!0)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine||(e.next(!0),t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()));var r=p.Node.createBreakStatement(t,e.range());return e.skip(o.Token.SEMICOLON),r},t.prototype.parseContinue=function(e){var t=null;e.peek(!0)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine||(e.next(!0),t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()));var r=p.Node.createContinueStatement(t,e.range());return e.skip(o.Token.SEMICOLON),r},t.prototype.parseDoStatement=function(e){var t=e.tokenPos,r=this.parseStatement(e);if(!r)return null;if(e.skip(o.Token.WHILE))if(e.skip(o.Token.OPENPAREN)){var n=this.parseExpression(e);if(!n)return null;if(e.skip(o.Token.CLOSEPAREN)){var i=p.Node.createDoStatement(r,n,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),i}this.error(s.DiagnosticCode._0_expected,e.range(),")")}else this.error(s.DiagnosticCode._0_expected,e.range(),"(");else this.error(s.DiagnosticCode._0_expected,e.range(),"while");return null},t.prototype.parseExpressionStatement=function(e){var t=this.parseExpression(e);if(!t)return null;var r=p.Node.createExpressionStatement(t);return e.skip(o.Token.SEMICOLON),r},t.prototype.parseForStatement=function(e){var t=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var r=null;if(e.skip(o.Token.LET)||e.skip(o.Token.CONST)||e.skip(o.Token.VAR))r=this.parseVariable(e,null,null);else if(!e.skip(o.Token.SEMICOLON)&&!(r=this.parseExpressionStatement(e)))return null;if(e.token==o.Token.SEMICOLON){var n=null;if(!e.skip(o.Token.SEMICOLON)&&!(n=this.parseExpressionStatement(e)))return null;if(e.token==o.Token.SEMICOLON){var i=null;if(!e.skip(o.Token.CLOSEPAREN)){if(!(i=this.parseExpression(e)))return null;if(!e.skip(o.Token.CLOSEPAREN))return this.error(s.DiagnosticCode._0_expected,e.range(),")"),null}var a=this.parseStatement(e);return a?p.Node.createForStatement(r,n?n.expression:null,i,a,e.range(t,e.pos)):null}this.error(s.DiagnosticCode._0_expected,e.range(),";")}else this.error(s.DiagnosticCode._0_expected,e.range(),";")}else this.error(s.DiagnosticCode._0_expected,e.range(),"(");return null},t.prototype.parseIfStatement=function(e){var t=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(o.Token.CLOSEPAREN)){var n=this.parseStatement(e);if(!n)return null;var i=null;return e.skip(o.Token.ELSE)&&!(i=this.parseStatement(e))?null:p.Node.createIfStatement(r,n,i,e.range(t,e.pos))}this.error(s.DiagnosticCode._0_expected,e.range(),")")}else this.error(s.DiagnosticCode._0_expected,e.range(),"(");return null},t.prototype.parseSwitchStatement=function(e){var t=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(o.Token.CLOSEPAREN)){if(e.skip(o.Token.OPENBRACE)){for(var n=new Array;!e.skip(o.Token.CLOSEBRACE);){var i=this.parseSwitchCase(e);if(!i)return null;n.push(i)}var a=p.Node.createSwitchStatement(r,n,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),a}this.error(s.DiagnosticCode._0_expected,e.range(),"{")}else this.error(s.DiagnosticCode._0_expected,e.range(),")")}else this.error(s.DiagnosticCode._0_expected,e.range(),"(");return null},t.prototype.parseSwitchCase=function(e){var t,r,n=e.tokenPos;if(e.skip(o.Token.CASE)){var i=this.parseExpression(e);if(!i)return null;if(e.skip(o.Token.COLON)){for(t=new Array;e.peek()!=o.Token.CASE&&e.nextToken!=o.Token.DEFAULT&&e.nextToken!=o.Token.CLOSEBRACE;){if(!(r=this.parseStatement(e)))return null;t.push(r)}return p.Node.createSwitchCase(i,t,e.range(n,e.pos))}this.error(s.DiagnosticCode._0_expected,e.range(),":")}else if(e.skip(o.Token.DEFAULT)){if(e.skip(o.Token.COLON)){for(t=new Array;e.peek()!=o.Token.CASE&&e.nextToken!=o.Token.DEFAULT&&e.nextToken!=o.Token.CLOSEBRACE;){if(!(r=this.parseStatement(e)))return null;t.push(r)}return p.Node.createSwitchCase(null,t,e.range(n,e.pos))}this.error(s.DiagnosticCode._0_expected,e.range(),":")}else this.error(s.DiagnosticCode._case_or_default_expected,e.range());return null},t.prototype.parseThrowStatement=function(e){var t=e.tokenPos,r=this.parseExpression(e);if(!r)return null;var n=p.Node.createThrowStatement(r,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),n},t.prototype.parseTryStatement=function(e){var t,r=e.tokenPos;if(e.skip(o.Token.OPENBRACE)){for(var n=new Array;!e.skip(o.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;n.push(t)}var i=null,a=null,c=null;if(e.skip(o.Token.CATCH)){if(!e.skip(o.Token.OPENPAREN))return this.error(s.DiagnosticCode._0_expected,e.range(),"("),null;if(!e.skip(o.Token.IDENTIFIER))return this.error(s.DiagnosticCode.Identifier_expected,e.range()),null;if(i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),!e.skip(o.Token.CLOSEPAREN))return this.error(s.DiagnosticCode._0_expected,e.range(),")"),null;if(!e.skip(o.Token.OPENBRACE))return this.error(s.DiagnosticCode._0_expected,e.range(),"{"),null;for(a=[];!e.skip(o.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;a.push(t)}}if(e.skip(o.Token.FINALLY)){if(!e.skip(o.Token.OPENBRACE))return this.error(s.DiagnosticCode._0_expected,e.range(),"{"),null;for(c=[];!e.skip(o.Token.CLOSEBRACE);){if(!(t=this.parseStatement(e)))return null;c.push(t)}}if(!a&&!c)return this.error(s.DiagnosticCode._0_expected,e.range(),"catch"),null;var u=p.Node.createTryStatement(n,i,a,c,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),u}return this.error(s.DiagnosticCode._0_expected,e.range(),"{"),null},t.prototype.parseTypeDeclaration=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=null);var n=r&&r.length?r[0].range.start:t&&t.length?t[0].range.start:e.tokenPos;if(e.skip(o.Token.IDENTIFIER)){var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),a=null;if(e.skip(o.Token.LESSTHAN)&&!(a=this.parseTypeParameters(e)))return null;if(e.skip(o.Token.EQUALS)){var c=this.parseType(e);if(!c)return null;var u=p.Node.createTypeDeclaration(i,a,c,t,r,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),u}this.error(s.DiagnosticCode._0_expected,e.range(),"=")}else this.error(s.DiagnosticCode.Identifier_expected,e.range());return null},t.prototype.parseVoidStatement=function(e){var t=e.tokenPos,r=this.parseExpression(e,20);if(!r)return null;var n=p.Node.createVoidStatement(r,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),n},t.prototype.parseWhileStatement=function(e){var t=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var r=this.parseExpression(e);if(!r)return null;if(e.skip(o.Token.CLOSEPAREN)){var n=this.parseStatement(e);if(!n)return null;var i=p.Node.createWhileStatement(r,n,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),i}this.error(s.DiagnosticCode._0_expected,e.range(),")")}else this.error(s.DiagnosticCode._0_expected,e.range(),"(");return null},t.prototype.parseExpressionStart=function(e){var t=e.next(!0),r=e.tokenPos,n=null;if(t==o.Token.NULL)return p.Node.createNullExpression(e.range());if(t==o.Token.TRUE)return p.Node.createTrueExpression(e.range());if(t==o.Token.FALSE)return p.Node.createFalseExpression(e.range());var i=function(e){switch(e){case o.Token.DOT_DOT_DOT:return 1;case o.Token.YIELD:return 2;case o.Token.EXCLAMATION:case o.Token.TILDE:case o.Token.PLUS:case o.Token.MINUS:case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:case o.Token.TYPEOF:case o.Token.VOID:case o.Token.DELETE:return 16;case o.Token.NEW:return 19;default:return-1}}(t);if(-1!=i){var a=void 0;return t==o.Token.NEW?(a=this.parseExpression(e,18))?a.kind==p.NodeKind.CALL?p.Node.createNewExpression(a.expression,a.typeArguments,a.arguments,e.range(r,e.pos)):(this.error(s.DiagnosticCode.Operation_not_supported,e.range()),null):null:(a=this.parseExpression(e,i))?(t!=o.Token.PLUS_PLUS&&t!=o.Token.MINUS_MINUS||a.kind!=p.NodeKind.IDENTIFIER&&a.kind!=p.NodeKind.ELEMENTACCESS&&a.kind!=p.NodeKind.PROPERTYACCESS&&this.error(s.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,a.range),p.Node.createUnaryPrefixExpression(t,a,e.range(r,e.pos))):null}switch(t){case o.Token.OPENPAREN:if(e.skip(o.Token.CLOSEPAREN))return this.parseFunctionExpressionCommon(e,p.Node.createEmptyIdentifierExpression(e.range(r)),[],!0);var c=e.mark(),u=!0;do{switch(e.next(!0)){case o.Token.DOT_DOT_DOT:return e.reset(c),this.parseFunctionExpression(e);case o.Token.IDENTIFIER:switch(e.readIdentifier(),e.next()){case o.Token.CLOSEPAREN:if(!e.skip(o.Token.EQUALS_GREATERTHAN)){u=!1;break}case o.Token.QUESTION:case o.Token.COLON:return e.reset(c),this.parseFunctionExpression(e);case o.Token.COMMA:break;default:u=!1}break;default:u=!1}}while(u);return e.reset(c),(n=this.parseExpression(e))?e.skip(o.Token.CLOSEPAREN)?p.Node.createParenthesizedExpression(n,e.range(r,e.pos)):(this.error(s.DiagnosticCode._0_expected,e.range(),")"),null):null;case o.Token.OPENBRACKET:var l=new Array;if(!e.skip(o.Token.CLOSEBRACKET)){do{if(e.peek()==o.Token.COMMA)n=null;else if(!(n=this.parseExpression(e,1)))return null;if(l.push(n),e.peek()==o.Token.CLOSEBRACKET)break}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.CLOSEBRACKET))return this.error(s.DiagnosticCode._0_expected,e.range(),"]"),null}return p.Node.createArrayLiteralExpression(l,e.range(r,e.pos));case o.Token.LESSTHAN:var h=this.parseType(e);return h?e.skip(o.Token.GREATERTHAN)?(n=this.parseExpression(e,18))?p.Node.createAssertionExpression(0,n,h,e.range(r,e.pos)):null:(this.error(s.DiagnosticCode._0_expected,e.range(),">"),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 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 d=e.readRegexpPattern();return e.skip(o.Token.SLASH)?p.Node.createRegexpLiteralExpression(d,e.readRegexpFlags(),e.range(r,e.pos)):(this.error(s.DiagnosticCode._0_expected,e.range(),"/"),null);case o.Token.FUNCTION:return this.parseFunctionExpression(e);default:return this.error(s.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{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){var t=new Array;if(!e.skip(o.Token.CLOSEPAREN)){do{var r=this.parseExpression(e,1);if(!r)return null;t.push(r)}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.CLOSEPAREN))return this.error(s.DiagnosticCode._0_expected,e.range(),")"),null}return t},t.prototype.parseExpression=function(e,t){void 0===t&&(t=0);var r=this.parseExpressionStart(e);if(!r)return null;for(var n,i,a=r.range.start;(n=this.tryParseTypeArgumentsBeforeArguments(e))||e.skip(o.Token.OPENPAREN);){var c=this.parseArguments(e);if(!c)return null;r=p.Node.createCallExpression(r,n,c,e.range(a,e.pos))}for(var u,d=null;(u=l(i=e.peek()))>=t;)switch(e.next(),i){case o.Token.AS:var _=this.parseType(e);if(!_)return null;r=p.Node.createAssertionExpression(1,r,_,e.range(a,e.pos));break;case o.Token.OPENBRACKET:if(!(d=this.parseExpression(e)))return null;if(!e.skip(o.Token.CLOSEBRACKET))return this.error(s.DiagnosticCode._0_expected,e.range(),"]"),null;r=p.Node.createElementAccessExpression(r,d,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(s.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,r.range),r=p.Node.createUnaryPostfixExpression(i,r,e.range(a,e.pos));break;case o.Token.QUESTION:var y=this.parseExpression(e);if(!y)return null;if(!e.skip(o.Token.COLON))return this.error(s.DiagnosticCode._0_expected,e.range(),":"),null;var g=this.parseExpression(e);if(!g)return null;r=p.Node.createTernaryExpression(r,y,g,e.range(a,e.pos));break;case o.Token.COMMA:var m=[r];do{if(!(r=this.parseExpression(e,1)))return null;m.push(r)}while(e.skip(o.Token.COMMA));r=p.Node.createCommaExpression(m,e.range(a,e.pos));break;default:if(!(d=this.parseExpression(e,h(i)?u:u+1)))return null;if(i==o.Token.DOT)if(d.kind==p.NodeKind.IDENTIFIER)r=p.Node.createPropertyAccessExpression(r,d,e.range(a,e.pos));else{if(d.kind!=p.NodeKind.CALL)return this.error(s.DiagnosticCode.Identifier_expected,d.range),null;var f=d;if(f.expression.kind!=p.NodeKind.IDENTIFIER)return this.error(s.DiagnosticCode.Identifier_expected,f.expression.range),null;f.expression=p.Node.createPropertyAccessExpression(r,f.expression,e.range(a,e.pos)),r=f}else r=p.Node.createBinaryExpression(i,r,d,e.range(a,e.pos))}return r},t}(s.DiagnosticEmitter);function l(e){switch(e){case o.Token.COMMA:return 0;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 3;case o.Token.QUESTION:return 4;case o.Token.BAR_BAR:return 5;case o.Token.AMPERSAND_AMPERSAND:return 6;case o.Token.BAR:return 7;case o.Token.CARET:return 8;case o.Token.AMPERSAND:return 9;case o.Token.EQUALS_EQUALS:case o.Token.EXCLAMATION_EQUALS:case o.Token.EQUALS_EQUALS_EQUALS:case o.Token.EXCLAMATION_EQUALS_EQUALS:return 10;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 11;case o.Token.LESSTHAN_LESSTHAN:case o.Token.GREATERTHAN_GREATERTHAN:case o.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:return 12;case o.Token.PLUS:case o.Token.MINUS:return 13;case o.Token.ASTERISK:case o.Token.SLASH:case o.Token.PERCENT:return 14;case o.Token.ASTERISK_ASTERISK:return 15;case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:return 17;case o.Token.DOT:case o.Token.NEW:case o.Token.OPENBRACKET:return 19;default:return-1}}function h(e){switch(e){case o.Token.EQUALS:case o.Token.PLUS_EQUALS:case o.Token.MINUS_EQUALS:case o.Token.ASTERISK_ASTERISK_EQUALS:case o.Token.ASTERISK_EQUALS:case o.Token.SLASH_EQUALS:case o.Token.PERCENT_EQUALS:case o.Token.LESSTHAN_LESSTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.AMPERSAND_EQUALS:case o.Token.CARET_EQUALS:case o.Token.BAR_EQUALS:case o.Token.QUESTION:case o.Token.ASTERISK_ASTERISK:return!0;default:return!1}}t.Parser=u,function(e){e[e.COMMA=0]="COMMA",e[e.SPREAD=1]="SPREAD",e[e.YIELD=2]="YIELD",e[e.ASSIGNMENT=3]="ASSIGNMENT",e[e.CONDITIONAL=4]="CONDITIONAL",e[e.LOGICAL_OR=5]="LOGICAL_OR",e[e.LOGICAL_AND=6]="LOGICAL_AND",e[e.BITWISE_OR=7]="BITWISE_OR",e[e.BITWISE_XOR=8]="BITWISE_XOR",e[e.BITWISE_AND=9]="BITWISE_AND",e[e.EQUALITY=10]="EQUALITY",e[e.RELATIONAL=11]="RELATIONAL",e[e.SHIFT=12]="SHIFT",e[e.ADDITIVE=13]="ADDITIVE",e[e.MULTIPLICATIVE=14]="MULTIPLICATIVE",e[e.EXPONENTIATED=15]="EXPONENTIATED",e[e.UNARY_PREFIX=16]="UNARY_PREFIX",e[e.UNARY_POSTFIX=17]="UNARY_POSTFIX",e[e.CALL=18]="CALL",e[e.MEMBERACCESS=19]="MEMBERACCESS",e[e.GROUPING=20]="GROUPING",e[e.INVALID=-1]="INVALID"}(t.Precedence||(t.Precedence={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),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.readString(_BinaryenFunctionGetName(e))||"$"+this.functionId.toString(10),r=_BinaryenFunctionGetBody(e);this.push("function "),this.push(t),this.push("(");for(var i=0,o=_BinaryenFunctionGetNumParams(e);i<o;++i)i>0&&this.push(", "),this.push("$"),this.push(i.toString(10)),this.push(": "),this.push(a(_BinaryenFunctionGetParam(e,i)));this.push("): "),this.push(a(_BinaryenFunctionGetResult(e))),this.push(" "),_BinaryenExpressionGetId(r)!=n.ExpressionId.Block&&this.push("{\n"),this.decompileExpression(r),_BinaryenExpressionGetId(r)!=n.ExpressionId.Block&&this.push("\n}\n"),++this.functionId},e.prototype.decompileExpression=function(e){var t,r,i,o,s=_BinaryenExpressionGetId(e),c=_BinaryenExpressionGetType(e);switch(s){case n.ExpressionId.Block:for(null!=(r=n.readString(_BinaryenBlockGetName(e)))&&(this.push(r),this.push(": ")),this.push("{\n"),o=_BinaryenBlockGetNumChildren(e),i=0;i<o;++i)this.decompileExpression(_BinaryenBlockGetChild(e,i));return void this.push("}\n");case n.ExpressionId.If:return void(c==n.NativeType.None?(this.push("if ("),this.decompileExpression(_BinaryenIfGetCondition(e)),this.push(") "),this.decompileExpression(_BinaryenIfGetIfTrue(e)),(t=_BinaryenIfGetIfFalse(e))&&(this.push(" else "),this.decompileExpression(t))):(this.decompileExpression(_BinaryenIfGetCondition(e)),this.push(" ? "),this.decompileExpression(_BinaryenIfGetIfTrue(e)),this.push(" : "),this.decompileExpression(_BinaryenIfGetIfFalse(e))));case n.ExpressionId.Loop:null!=(r=n.readString(_BinaryenLoopGetName(e)))&&(this.push(r),this.push(": ")),this.push("do "),this.decompileExpression(_BinaryenLoopGetBody(e)),this.push("while (0);\n");case n.ExpressionId.Break:return(t=_BinaryenBreakGetCondition(e))&&(this.push("if ("),this.decompileExpression(t),this.push(") ")),void(null!=(r=n.readString(_BinaryenBreakGetName(e)))?(this.push("break "),this.push(r),this.push(";\n")):this.push("break;\n"));case n.ExpressionId.Switch:case n.ExpressionId.Call:case n.ExpressionId.CallImport:case n.ExpressionId.CallIndirect:throw new Error("not implemented");case n.ExpressionId.GetLocal:return this.push("$"),void this.push(_BinaryenGetLocalGetIndex(e).toString(10));case n.ExpressionId.SetLocal:return this.push("$"),this.push(_BinaryenSetLocalGetIndex(e).toString(10)),this.push(" = "),void this.decompileExpression(_BinaryenSetLocalGetValue(e));case n.ExpressionId.GetGlobal:case n.ExpressionId.SetGlobal:throw new Error("not implemented");case n.ExpressionId.Load:return this.push("load<"),this.push(a(c)),this.push(">("),this.push(_BinaryenLoadGetOffset(e).toString(10)),this.push(" + "),this.decompileExpression(_BinaryenLoadGetPtr(e)),void this.push(")");case n.ExpressionId.Store:return this.push("store<"),this.push(a(c)),this.push(">("),this.push(_BinaryenStoreGetOffset(e).toString(10)),this.push(" + "),this.decompileExpression(_BinaryenStoreGetPtr(e)),this.push(", "),this.decompileExpression(_BinaryenStoreGetValue(e)),void this.push(")");case n.ExpressionId.Const:switch(c){case n.NativeType.I32:return void this.push(_BinaryenConstGetValueI32(e).toString(10));case n.NativeType.I64:return void this.push(i64_to_string(i64_new(_BinaryenConstGetValueI64Low(e),_BinaryenConstGetValueI64High(e))));case n.NativeType.F32:return void this.push(_BinaryenConstGetValueF32(e).toString(10));case n.NativeType.F64:return void this.push(_BinaryenConstGetValueF64(e).toString(10))}break;case n.ExpressionId.Unary:switch(_BinaryenUnaryGetOp(e)){case n.UnaryOp.ClzI32:return this.push("clz<i32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.CtzI32:return this.push("ctz<i32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.PopcntI32:return this.push("popcnt<i32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.NegF32:case n.UnaryOp.NegF64:return this.push("-"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.AbsF32:return this.push("abs<f32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.CeilF32:return this.push("ceil<f32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.FloorF32:return this.push("floor<f32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.TruncF32:return this.push("trunc<f32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.NearestF32:return this.push("nearest<i32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.SqrtF32:return this.push("sqrt<f32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.EqzI32:case n.UnaryOp.EqzI64:return this.push("!"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ClzI64:return this.push("clz<i64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.CtzI64:return this.push("ctz<i64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.PopcntI64:return this.push("popcnt<i64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.AbsF64:return this.push("abs<f64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.CeilF64:return this.push("ceil<f64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.FloorF64:return this.push("floor<f64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.TruncF64:return this.push("trunc<f64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.NearestF64:return this.push("nearest<f64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.SqrtF64:return this.push("sqrt<f64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.ExtendI32:return this.push("<i64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ExtendU32:return this.push("<i64><u64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.WrapI64:case n.UnaryOp.TruncF32ToI32:return this.push("<i32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.TruncF32ToI64:return this.push("<i64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.TruncF32ToU32:return this.push("<i32><u32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.TruncF32ToU64:return this.push("<i64><u64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.TruncF64ToI32:return this.push("<i32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.TruncF64ToI64:return this.push("<i64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.TruncF64ToU32:return this.push("<i32><u32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.TruncF64ToU64:return this.push("<i64><u64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ReinterpretF32:return this.push("reinterpret<f32,i32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.ReinterpretF64:return this.push("reinterpret<f64,i64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.ConvertI32ToF32:return this.push("<f32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ConvertI32ToF64:return this.push("<f64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ConvertU32ToF32:return this.push("<f32><u32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ConvertU32ToF64:return this.push("<f64><u32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ConvertI64ToF32:return this.push("<f32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ConvertI64ToF64:return this.push("<f64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ConvertU64ToF32:return this.push("<f32><u64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ConvertU64ToF64:return this.push("<f64><u64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.PromoteF32:return this.push("<f64>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.DemoteF64:return this.push("<f32>"),void this.decompileExpression(_BinaryenUnaryGetValue(e));case n.UnaryOp.ReinterpretI32:return this.push("reinterpret<i32,f32>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")");case n.UnaryOp.ReinterpretI64:return this.push("reinterpret<i64,f64>("),this.decompileExpression(_BinaryenUnaryGetValue(e)),void this.push(")")}break;case n.ExpressionId.Binary:switch(_BinaryenBinaryGetOp(e)){case n.BinaryOp.AddI32:case n.BinaryOp.AddI64:case n.BinaryOp.AddF32:case n.BinaryOp.AddF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" + "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.SubI32:case n.BinaryOp.SubI64:case n.BinaryOp.SubF32:case n.BinaryOp.SubF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" - "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.MulI32:case n.BinaryOp.MulI64:case n.BinaryOp.MulF32:case n.BinaryOp.MulF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" * "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.DivI32:case n.BinaryOp.DivI64:case n.BinaryOp.DivF32:case n.BinaryOp.DivF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" / "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.DivU32:return this.push("<i32>(<u32>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" / <u32>"),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.RemI32:case n.BinaryOp.RemI64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" % "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.RemU32:return this.push("<i32>(<u32>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" / <u32>"),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.AndI32:case n.BinaryOp.AndI64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" & "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.OrI32:case n.BinaryOp.OrI64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" | "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.XorI32:case n.BinaryOp.XorI64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" ^ "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.ShlI32:case n.BinaryOp.ShlI64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" << "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.ShrU32:case n.BinaryOp.ShrU64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" >>> "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.ShrI32:case n.BinaryOp.ShrI64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" >> "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.RotlI32:return this.push("rotl<i32>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.RotrI32:return this.push("rotr<i32>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.EqI32:case n.BinaryOp.EqI64:case n.BinaryOp.EqF32:case n.BinaryOp.EqF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" == "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.NeI32:case n.BinaryOp.NeI64:case n.BinaryOp.NeF32:case n.BinaryOp.NeF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" != "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.LtI32:case n.BinaryOp.LtI64:case n.BinaryOp.LtF32:case n.BinaryOp.LtF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" < "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.LtU32:return this.push("<u32>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" < <u32>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.LeI32:case n.BinaryOp.LeI64:case n.BinaryOp.LeF32:case n.BinaryOp.LeF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" <= "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.LeU32:return this.push("<u32>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" <= <u32>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.GtI32:case n.BinaryOp.GtI64:case n.BinaryOp.GtF32:case n.BinaryOp.GtF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" > "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.GtU32:return this.push("<u32>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" > <u32>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.GeI32:case n.BinaryOp.GeI64:case n.BinaryOp.GeF32:case n.BinaryOp.GeF64:return this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" >= "),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.GeU32:return this.push("<u32>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" >= <u32>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.DivU64:return this.push("<u64>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" / <u64>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.RemU64:return this.push("<u64>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" % <u64>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.RotlI64:return this.push("rotl<i64>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.RotrI64:return this.push("rotr<i64>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.LtU64:return this.push("<u64>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" < <u64>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.LeU64:return this.push("<u64>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" <= <u64>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.GtU64:return this.push("<u64>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" > <u64>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.GeU64:return this.push("<u64>"),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(" >= <u64>"),void this.decompileExpression(_BinaryenBinaryGetRight(e));case n.BinaryOp.CopysignF32:return this.push("copysign<f32>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.MinF32:return this.push("min<f32>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.MaxF32:return this.push("max<f32>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.CopysignF64:return this.push("copysign<f64>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.MinF64:return this.push("min<f64>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")");case n.BinaryOp.MaxF64:return this.push("max<f64>("),this.decompileExpression(_BinaryenBinaryGetLeft(e)),this.push(", "),this.decompileExpression(_BinaryenBinaryGetRight(e)),void this.push(")")}return;case n.ExpressionId.Select:return this.push("select<"),this.push(a(c)),this.push(">("),this.decompileExpression(_BinaryenSelectGetIfTrue(e)),this.push(", "),this.decompileExpression(_BinaryenSelectGetIfFalse(e)),this.push(", "),this.decompileExpression(_BinaryenSelectGetCondition(e)),void this.push(")");case n.ExpressionId.Drop:return this.decompileExpression(_BinaryenDropGetValue(e)),void this.push(";\n");case n.ExpressionId.Return:return void((t=_BinaryenReturnGetValue(e))?(this.push("return "),this.decompileExpression(t),this.push(";\n")):this.push("return;\n"));case n.ExpressionId.Host:switch(_BinaryenHostGetOp(e)){case n.HostOp.CurrentMemory:return void this.push("current_memory()");case n.HostOp.GrowMemory:return this.push("grow_memory("),this.decompileExpression(_BinaryenHostGetOperand(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.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";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6),i=r(12),a=r(0);t.formatDiagnostic=a.formatDiagnosticMessage;var o=r(11);t.parseFile=function(e,t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=null),n||(n=new o.Parser,r=!0),n.parseFile(e,t,r),n},t.nextFile=function(e){return e.nextFile()},t.nextDiagnostic=function(e){var t=e.program;return t.diagnosticsOffset<t.diagnostics.length?t.diagnostics[t.diagnosticsOffset++]:null},t.isInfo=function(e){return e.category==a.DiagnosticCategory.INFO},t.isWarning=function(e){return e.category==a.DiagnosticCategory.WARNING},t.isError=function(e){return e.category==a.DiagnosticCategory.ERROR},t.createOptions=function(){return new n.Options},t.setTarget=function(e,t){e.target=t},t.setNoTreeShaking=function(e,t){e.noTreeShaking=t},t.setNoAssert=function(e,t){e.noAssert=t},t.setNoMemory=function(e,t){e.noMemory=t},t.setImportMemory=function(e,t){e.importMemory=t},t.setSourceMap=function(e,t){e.sourceMap=t},t.setMemoryBase=function(e,t){e.memoryBase=t},t.compile=function(e,t){void 0===t&&(t=null);var r=e.finish();return new n.Compiler(r,t).compile()},t.decompile=function(e){var t=new i.Decompiler;return t.decompile(e),t.finish()};var s=r(2);t.LIBRARY_PREFIX=s.LIBRARY_PREFIX},function(e,t){e.exports=n;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var a={},o={};function s(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=o[e])?n:(r=p(e,(0|e)<0?-1:0,!0),i&&(o[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=a[e])?n:(r=p(e,e<0?-1:0,!1),i&&(a[e]=r),r)}function c(e,t){if(isNaN(e))return t?f:m;if(t){if(e<0)return f;if(e>=_)return v}else{if(e<=-y)return N;if(e+1>=y)return I}return e<0?c(-e,t).neg():p(e%d|0,e/d|0,t)}function p(e,t,r){return new n(e,t,r)}n.fromInt=s,n.fromNumber=c,n.fromBits=p;var u=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var i=c(u(r,8)),a=m,o=0;o<e.length;o+=8){var s=Math.min(8,e.length-o),p=parseInt(e.substring(o,o+s),r);if(s<8){var h=c(u(r,s));a=a.mul(h).add(c(p))}else a=(a=a.mul(i)).add(c(p))}return a.unsigned=t,a}function h(e,t){return"number"==typeof e?c(e,t):"string"==typeof e?l(e,t):p(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=l,n.fromValue=h;var d=4294967296,_=d*d,y=_/2,g=s(1<<24),m=s(0);n.ZERO=m;var f=s(0,!0);n.UZERO=f;var E=s(1);n.ONE=E;var T=s(1,!0);n.UONE=T;var A=s(-1);n.NEG_ONE=A;var I=p(-1,2147483647,!1);n.MAX_VALUE=I;var v=p(-1,-1,!0);n.MAX_UNSIGNED_VALUE=v;var N=p(0,-2147483648,!1);n.MIN_VALUE=N;var S=n.prototype;S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},S.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(N)){var t=c(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=c(u(e,6),this.unsigned),a=this,o="";;){var s=a.div(i),p=(a.sub(s.mul(i)).toInt()>>>0).toString(e);if((a=s).isZero())return p+o;for(;p.length<6;)p="0"+p;o=""+p+o}},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(N)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},S.isZero=function(){return 0===this.high&&0===this.low},S.eqz=S.isZero,S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=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(N)?N: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,o=e.high>>>16,s=65535&e.high,c=e.low>>>16,u=0,l=0,d=0,_=0;return d+=(_+=a+(65535&e.low))>>>16,l+=(d+=n+c)>>>16,u+=(l+=r+s)>>>16,u+=t+o,p((d&=65535)<<16|(_&=65535),(u&=65535)<<16|(l&=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 m;if(i(e)||(e=h(e)),r)return p(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return m;if(this.eq(N))return e.isOdd()?N:m;if(e.eq(N))return this.isOdd()?N:m;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(g)&&e.lt(g))return c(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,a=this.low>>>16,o=65535&this.low,s=e.high>>>16,u=65535&e.high,l=e.low>>>16,d=65535&e.low,_=0,y=0,f=0,E=0;return f+=(E+=o*d)>>>16,y+=(f+=a*d)>>>16,f&=65535,y+=(f+=o*l)>>>16,_+=(y+=n*d)>>>16,y&=65535,_+=(y+=a*l)>>>16,y&=65535,_+=(y+=o*u)>>>16,_+=t*d+n*l+a*u+o*s,p((f&=65535)<<16|(E&=65535),(_&=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?p((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?f:m;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return f;if(e.gt(this.shru(1)))return T;a=f}else{if(this.eq(N))return e.eq(E)||e.eq(A)?N:e.eq(N)?E:(t=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?E:A:(n=this.sub(e.mul(t)),a=t.add(n.div(e)));else if(e.eq(N))return this.unsigned?f:m;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=m}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),s=o<=48?1:u(2,o-48),l=c(t),d=l.mul(e);d.isNegative()||d.gt(n);)d=(l=c(t-=s,this.unsigned)).mul(e);l.isZero()&&(l=E),a=a.add(l),n=n.sub(d)}return a},S.div=S.divide,S.modulo=function(e){return i(e)||(e=h(e)),r?p((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 p(~this.low,~this.high,this.unsigned)},S.and=function(e){return i(e)||(e=h(e)),p(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return i(e)||(e=h(e)),p(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return i(e)||(e=h(e)),p(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?p(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):p(0,this.low<<e-32,this.unsigned)},S.shl=S.shiftLeft,S.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?p(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):p(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?p(this.low>>>e|t<<32-e,t>>>e,this.unsigned):p(32===e?t:t>>>e-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?p(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:p(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){(function(e){const t=e.Long||r(14);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_align=function(e,r){assert(r&&0==(r&r-1));var n=t.fromInt(r-1);return e.add(n).and(n.not())},e.i64_is_i8=function(e){return 0===e.high&&e.low>=0&&e.low<=i8.MAX_VALUE||-1===e.high&&e.low>=i8.MIN_VALUE&&e.low<0},e.i64_is_i16=function(e){return 0===e.high&&e.low>=0&&e.low<=i16.MAX_VALUE||-1===e.high&&e.low>=i16.MIN_VALUE&&e.low<0},e.i64_is_i32=function(e){return 0===e.high&&e.low>=0||-1===e.high&&e.low<0},e.i64_is_u8=function(e){return 0===e.high&&e.low>=0&&e.low<=u8.MAX_VALUE},e.i64_is_u16=function(e){return 0===e.high&&e.low>=0&&e.low<=u16.MAX_VALUE},e.i64_is_u32=function(e){return 0===e.high},e.i64_is_bool=function(e){return 0===e.high&&(0===e.low||1===e.low)};const n=t.fromNumber(f32.MIN_SAFE_INTEGER),i=t.fromNumber(f32.MAX_SAFE_INTEGER);e.i64_is_f32=function(e){return e.gte(n)&&e.lte(i)};const a=t.fromNumber(f64.MIN_SAFE_INTEGER),o=t.fromNumber(f64.MAX_SAFE_INTEGER);e.i64_is_f64=function(e){return e.gte(a)&&e.lte(o)},e.i64_to_f32=function(t){return e.Math.fround(t.toNumber())},e.i64_to_f64=function(e){return e.toNumber()},e.i64_to_string=function(e,t){return(t?e.toUnsigned():e).toString(10)}}).call(this,r(7))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6),i=r(0),a=r(5),o=r(1),s=r(2);function c(e,t){var r,n;return e.options.isWasm64?(r=e.precomputeExpression(t,a.Type.usize64),(_BinaryenExpressionGetId(r)!=o.ExpressionId.Const||_BinaryenExpressionGetType(r)!=o.NativeType.I64||0!=_BinaryenConstGetValueI64High(r)||(n=_BinaryenConstGetValueI64Low(r))<0)&&(e.error(i.DiagnosticCode.Operation_not_supported,t.range),n=-1)):(r=e.precomputeExpression(t,a.Type.usize32),(_BinaryenExpressionGetId(r)!=o.ExpressionId.Const||_BinaryenExpressionGetType(r)!=o.NativeType.I32||(n=_BinaryenConstGetValueI32(r))<0)&&(e.error(i.DiagnosticCode.Operation_not_supported,t.range),n=-1)),n}function p(e,t,r){var n=e.program,i=e.module,c=n.types.get("string");if(!c)return i.createUnreachable();var p=n.elements.get("abort");if(!p||p.kind!=s.ElementKind.FUNCTION_PROTOTYPE)return i.createUnreachable();var u=p.resolve();if(!u||!e.compileFunction(u))return i.createUnreachable();var l=null!=t?e.compileExpression(t,c):c.toNativeZero(i),h=e.compileStaticString(r.range.source.normalizedPath);return e.currentType=a.Type.void,i.createBlock(null,[i.createCallImport(u.internalName,[l,h,i.createI32(r.range.line),i.createI32(r.range.column)],o.NativeType.None),i.createUnreachable()])}t.compileGetConstant=function(e,t,r){switch(t.internalName){case"NaN":return e.currentType==a.Type.f32?e.module.createF32(NaN):(e.currentType=a.Type.f64,e.module.createF64(NaN));case"Infinity":return e.currentType==a.Type.f32?e.module.createF32(1/0):(e.currentType=a.Type.f64,e.module.createF64(1/0));case"HEAP_BASE":return e.currentType=e.options.usizeType,e.module.createGetGlobal("HEAP_BASE",e.currentType.toNativeType())}return e.error(i.DiagnosticCode.Operation_not_supported,r.range),e.module.createUnreachable()},t.compileCall=function(e,t,r,s,u,l){var h,d,_,y,g,m,f,E,T=e.module;switch(t.internalName){case"isNaN":if(e.currentType=a.Type.bool,1!=s.length)return r&&1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10)),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.createUnreachable();if(r){if(1!=r.length)return e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(e.currentType.kind){case 11:g=e.currentFunction.getAndFreeTempLocal(a.Type.f32),y=T.createBinary(o.BinaryOp.NeF32,T.createTeeLocal(g.index,h),T.createGetLocal(g.index,o.NativeType.F32));break;case 12:g=e.currentFunction.getAndFreeTempLocal(a.Type.f64),y=T.createBinary(o.BinaryOp.NeF64,T.createTeeLocal(g.index,h),T.createGetLocal(g.index,o.NativeType.F64));break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break;default:y=T.createI32(0)}return e.currentType=a.Type.bool,y;case"isFinite":if(e.currentType=a.Type.bool,1!=s.length)return r&&1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10)),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.createUnreachable();if(r){if(1!=r.length)return e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(e.currentType.kind){case 11:g=e.currentFunction.getAndFreeTempLocal(a.Type.f32),y=T.createSelect(T.createBinary(o.BinaryOp.NeF32,T.createUnary(o.UnaryOp.AbsF32,T.createTeeLocal(g.index,h)),T.createF32(1/0)),T.createI32(0),T.createBinary(o.BinaryOp.EqF32,T.createGetLocal(g.index,o.NativeType.F32),T.createGetLocal(g.index,o.NativeType.F32)));break;case 12:g=e.currentFunction.getAndFreeTempLocal(a.Type.f64),y=T.createSelect(T.createBinary(o.BinaryOp.NeF64,T.createUnary(o.UnaryOp.AbsF64,T.createTeeLocal(g.index,h)),T.createF64(1/0)),T.createI32(0),T.createBinary(o.BinaryOp.EqF64,T.createGetLocal(g.index,o.NativeType.F64),T.createGetLocal(g.index,o.NativeType.F64)));break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break;default:y=T.createI32(1)}return e.currentType=a.Type.bool,y;case"clz":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.i32,0);switch(e.currentType.kind){default:y=T.createUnary(o.UnaryOp.ClzI32,h);break;case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}case 4:y=T.createUnary(e.options.isWasm64?o.UnaryOp.ClzI64:o.UnaryOp.ClzI32,h);break;case 3:case 8:y=T.createUnary(o.UnaryOp.ClzI64,h);break;case 11:case 12:case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"ctz":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.i32,0);switch(e.currentType.kind){default:y=T.createUnary(o.UnaryOp.CtzI32,h);break;case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}case 4:y=T.createUnary(e.options.isWasm64?o.UnaryOp.CtzI64:o.UnaryOp.CtzI32,h);break;case 3:case 8:y=T.createUnary(o.UnaryOp.CtzI64,h);break;case 11:case 12:case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"popcnt":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.i32,0);switch(e.currentType.kind){default:y=T.createUnary(o.UnaryOp.PopcntI32,h);break;case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}case 4:y=T.createUnary(e.options.isWasm64?o.UnaryOp.PopcntI64:o.UnaryOp.PopcntI32,h);break;case 3:case 8:y=T.createUnary(o.UnaryOp.PopcntI64,h);break;case 11:case 12:case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"rotl":if(2!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"2",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.i32,0);switch(d=e.compileExpression(s[1],e.currentType),e.currentType.kind){case 0:case 1:case 5:case 6:case 10:y=n.makeSmallIntegerWrap(T.createBinary(o.BinaryOp.RotlI32,h,d),e.currentType,T);case 2:case 7:y=T.createBinary(o.BinaryOp.RotlI32,h,d);break;case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}case 4:y=T.createBinary(e.options.isWasm64?o.BinaryOp.RotlI64:o.BinaryOp.RotlI32,h,d);break;case 3:case 8:y=T.createBinary(o.BinaryOp.RotlI64,h,d);break;default:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"rotr":if(2!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"2",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.i32,0);switch(d=e.compileExpression(s[1],e.currentType),e.currentType.kind){case 0:case 1:case 5:case 6:case 10:y=n.makeSmallIntegerWrap(T.createBinary(o.BinaryOp.RotrI32,h,d),e.currentType,T);break;case 2:case 7:y=T.createBinary(o.BinaryOp.RotrI32,h,d);break;case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}case 4:y=T.createBinary(e.options.isWasm64?o.BinaryOp.RotrI64:o.BinaryOp.RotrI32,h,d);break;case 3:case 8:y=T.createBinary(o.BinaryOp.RotrI64,h,d);break;default:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"abs":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(e.currentType.kind){case 0:case 1:case 2:g=e.currentFunction.getAndFreeTempLocal(a.Type.i32),y=T.createSelect(T.createTeeLocal(g.index,h),T.createBinary(o.BinaryOp.SubI32,T.createI32(0),T.createGetLocal(g.index,o.NativeType.I32)),T.createBinary(o.BinaryOp.GtI32,T.createGetLocal(g.index,o.NativeType.I32),T.createI32(0)));break;case 4:g=e.currentFunction.getAndFreeTempLocal(e.options.usizeType),y=T.createSelect(T.createTeeLocal(g.index,h),T.createBinary(e.options.isWasm64?o.BinaryOp.SubI64:o.BinaryOp.SubI32,e.options.usizeType.toNativeZero(T),T.createGetLocal(g.index,e.options.nativeSizeType)),T.createBinary(e.options.isWasm64?o.BinaryOp.GtI64:o.BinaryOp.GtI32,T.createGetLocal(g.index,e.options.nativeSizeType),e.options.usizeType.toNativeZero(T)));break;case 3:g=e.currentFunction.getAndFreeTempLocal(a.Type.i64),y=T.createSelect(T.createTeeLocal(g.index,h),T.createBinary(o.BinaryOp.SubI64,T.createI64(0,0),T.createGetLocal(g.index,o.NativeType.I64)),T.createBinary(o.BinaryOp.GtI64,T.createGetLocal(g.index,o.NativeType.I64),T.createI64(0,0)));break;case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}case 5:case 6:case 7:case 8:case 10:y=h;break;case 11:y=T.createUnary(o.UnaryOp.AbsF32,h);break;case 12:y=T.createUnary(o.UnaryOp.AbsF64,h);break;case 13:y=T.createUnreachable();break;default:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"max":if(2!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"2",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(d=e.compileExpression(s[1],e.currentType),e.currentType.kind){case 0:case 1:case 2:g=e.currentFunction.getTempLocal(a.Type.i32),m=e.currentFunction.getAndFreeTempLocal(a.Type.i32),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(o.BinaryOp.GtI32,T.createGetLocal(g.index,o.NativeType.I32),T.createGetLocal(m.index,o.NativeType.I32)));break;case 5:case 6:case 7:case 10:g=e.currentFunction.getTempLocal(a.Type.i32),m=e.currentFunction.getAndFreeTempLocal(a.Type.i32),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(o.BinaryOp.GtU32,T.createGetLocal(g.index,o.NativeType.I32),T.createGetLocal(m.index,o.NativeType.I32)));break;case 3:g=e.currentFunction.getTempLocal(a.Type.i64),m=e.currentFunction.getAndFreeTempLocal(a.Type.i64),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(o.BinaryOp.GtI64,T.createGetLocal(g.index,o.NativeType.I64),T.createGetLocal(m.index,o.NativeType.I64)));break;case 8:g=e.currentFunction.getTempLocal(a.Type.i64),m=e.currentFunction.getAndFreeTempLocal(a.Type.i64),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(o.BinaryOp.GtU64,T.createGetLocal(g.index,o.NativeType.I64),T.createGetLocal(m.index,o.NativeType.I64)));break;case 4:g=e.currentFunction.getTempLocal(e.options.usizeType),m=e.currentFunction.getAndFreeTempLocal(e.options.usizeType),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(e.options.isWasm64?o.BinaryOp.GtI64:o.BinaryOp.GtI32,T.createGetLocal(g.index,e.options.nativeSizeType),T.createGetLocal(m.index,e.options.nativeSizeType)));break;case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}g=e.currentFunction.getTempLocal(e.options.usizeType),m=e.currentFunction.getAndFreeTempLocal(e.options.usizeType),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(e.options.isWasm64?o.BinaryOp.GtU64:o.BinaryOp.GtU32,T.createGetLocal(g.index,e.options.nativeSizeType),T.createGetLocal(m.index,e.options.nativeSizeType)));break;case 11:y=T.createBinary(o.BinaryOp.MaxF32,h,d);break;case 12:y=T.createBinary(o.BinaryOp.MaxF64,h,d);break;default:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"min":if(2!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"2",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(d=e.compileExpression(s[1],e.currentType),e.currentType.kind){case 0:case 1:case 2:g=e.currentFunction.getTempLocal(a.Type.i32),m=e.currentFunction.getAndFreeTempLocal(a.Type.i32),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(o.BinaryOp.LtI32,T.createGetLocal(g.index,o.NativeType.I32),T.createGetLocal(m.index,o.NativeType.I32)));break;case 5:case 6:case 7:case 10:g=e.currentFunction.getTempLocal(a.Type.i32),m=e.currentFunction.getAndFreeTempLocal(a.Type.i32),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(o.BinaryOp.LtU32,T.createGetLocal(g.index,o.NativeType.I32),T.createGetLocal(m.index,o.NativeType.I32)));break;case 3:g=e.currentFunction.getTempLocal(a.Type.i64),m=e.currentFunction.getAndFreeTempLocal(a.Type.i64),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(o.BinaryOp.LtI64,T.createGetLocal(g.index,o.NativeType.I64),T.createGetLocal(m.index,o.NativeType.I64)));break;case 8:g=e.currentFunction.getTempLocal(a.Type.i64),m=e.currentFunction.getAndFreeTempLocal(a.Type.i64),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(o.BinaryOp.LtU64,T.createGetLocal(g.index,o.NativeType.I64),T.createGetLocal(m.index,o.NativeType.I64)));break;case 4:g=e.currentFunction.getTempLocal(e.options.usizeType),m=e.currentFunction.getAndFreeTempLocal(e.options.usizeType),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(e.options.isWasm64?o.BinaryOp.LtI64:o.BinaryOp.LtI32,T.createGetLocal(g.index,e.options.nativeSizeType),T.createGetLocal(m.index,e.options.nativeSizeType)));break;case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}g=e.currentFunction.getTempLocal(e.options.usizeType),m=e.currentFunction.getAndFreeTempLocal(e.options.usizeType),e.currentFunction.freeTempLocal(g),y=T.createSelect(T.createTeeLocal(g.index,h),T.createTeeLocal(m.index,d),T.createBinary(e.options.isWasm64?o.BinaryOp.LtU64:o.BinaryOp.LtU32,T.createGetLocal(g.index,e.options.nativeSizeType),T.createGetLocal(m.index,e.options.nativeSizeType)));break;case 11:y=T.createBinary(o.BinaryOp.MinF32,h,d);break;case 12:y=T.createBinary(o.BinaryOp.MinF64,h,d);break;default:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"ceil":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(e.currentType.kind){case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}default:y=h;break;case 11:y=T.createUnary(o.UnaryOp.CeilF32,h);break;case 12:y=T.createUnary(o.UnaryOp.CeilF64,h);break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"floor":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(e.currentType.kind){case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}default:y=h;break;case 11:y=T.createUnary(o.UnaryOp.FloorF32,h);break;case 12:y=T.createUnary(o.UnaryOp.FloorF64,h);break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"copysign":if(2!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"2",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(d=e.compileExpression(s[1],e.currentType),e.currentType.kind){case 11:y=T.createBinary(o.BinaryOp.CopysignF32,h,d);break;case 12:y=T.createBinary(o.BinaryOp.CopysignF64,h,d);break;default:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"nearest":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(e.currentType.kind){case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}default:y=h;break;case 11:y=T.createUnary(o.UnaryOp.NearestF32,h);break;case 12:y=T.createUnary(o.UnaryOp.NearestF64,h);break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"reinterpret":if(1!=s.length)return r&&1==r.length||(r&&r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r?r.length.toString(10):"0")),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r?r.length.toString(10):"0"),T.createUnreachable();switch(r[0].kind){case 2:case 7:h=e.compileExpression(s[0],a.Type.f32),y=T.createUnary(o.UnaryOp.ReinterpretF32,h);break;case 3:case 8:h=e.compileExpression(s[0],a.Type.f64),y=T.createUnary(o.UnaryOp.ReinterpretF64,h);break;case 9:if(r[0].isReference)return e.error(i.DiagnosticCode.Operation_not_supported,l.range),e.currentType=r[0],T.createUnreachable();case 4:h=e.compileExpression(s[0],e.options.isWasm64?a.Type.f64:a.Type.f32),y=T.createUnary(e.options.isWasm64?o.UnaryOp.ReinterpretF64:o.UnaryOp.ReinterpretF32,h);break;case 11:h=e.compileExpression(s[0],a.Type.u32),y=T.createUnary(o.UnaryOp.ReinterpretI32,h);break;case 12:h=e.compileExpression(s[0],a.Type.u64),y=T.createUnary(o.UnaryOp.ReinterpretI64,h);break;default:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return e.currentType=r[0],y;case"sqrt":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(e.currentType.kind){case 11:y=T.createUnary(o.UnaryOp.SqrtF32,h);break;case 12:y=T.createUnary(o.UnaryOp.SqrtF64,h);break;default:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"trunc":if(1!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.f64,0);switch(e.currentType.kind){case 9:if(e.currentType.isReference){e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable();break}default:y=h;break;case 11:y=T.createUnary(o.UnaryOp.TruncF32,h);break;case 12:y=T.createUnary(o.UnaryOp.TruncF64,h);break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"load":return s.length<1||s.length>2?(r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r?r.length.toString(10):"0"),s.length<1?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,l.range,"1",s.length.toString(10)):e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"2",s.length.toString(10)),T.createUnreachable()):r&&1==r.length?(h=e.compileExpression(s[0],e.options.usizeType),(E=2==s.length?c(e,s[1]):0)<0?T.createUnreachable():(e.currentType=r[0],T.createLoad(r[0].byteSize,r[0].is(5),h,r[0].is(4)&&u.is(4)&&u.size>r[0].size?(e.currentType=u).toNativeType():(e.currentType=r[0]).toNativeType(),E))):(r&&r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r?r.length.toString(10):"0"),T.createUnreachable());case"store":return e.currentType=a.Type.void,s.length<2||s.length>3?(r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r?r.length.toString(10):"0"),s.length<2?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,l.range,"2",s.length.toString(10)):e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"3",s.length.toString(10)),T.createUnreachable()):r&&1==r.length?(h=e.compileExpression(s[0],e.options.usizeType),d=e.compileExpression(s[1],r[0],r[0].is(4)?0:1),e.currentType.is(4)&&r[0].is(4)&&r[0].size>e.currentType.size?(d=e.convertExpression(d,e.currentType,r[0],1,s[1]),f=r[0]):f=e.currentType,(E=3==s.length?c(e,s[2]):0)<0?T.createUnreachable():(e.currentType=a.Type.void,T.createStore(r[0].byteSize,h,d,f.toNativeType(),E))):(e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r?r.length.toString(10):"0"),T.createUnreachable());case"sizeof":return e.currentType=e.options.usizeType,0!=s.length?(r&&1==r.length||e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r?r.length.toString(10):"0"),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"0",s.length.toString(10)),T.createUnreachable()):r?1!=r.length?(e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10)),T.createUnreachable()):y=e.options.isWasm64?T.createI64(r[0].byteSize,0):T.createI32(r[0].byteSize):(e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1","0"),T.createUnreachable());case"select":if(3!=s.length)return r&&(r.length&&(e.currentType=r[0]),1!=r.length&&e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r.length.toString(10))),e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"3",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpression(s[0],a.Type.i32,0);switch(d=e.compileExpression(s[1],f=e.currentType),_=e.compileExpression(s[2],a.Type.bool),e.currentType=f,e.currentType.kind){default:y=T.createSelect(h,d,_);break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=T.createUnreachable()}return y;case"unreachable":return 0!=s.length&&e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"0",s.length.toString(10)),r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),T.createUnreachable();case"current_memory":return e.currentType=a.Type.i32,0!=s.length&&e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"0",s.length.toString(10)),r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),T.createHost(o.HostOp.CurrentMemory);case"grow_memory":return e.currentType=a.Type.i32,1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"0",s.length.toString(10)),h=T.createUnreachable()):h=e.compileExpression(s[0],a.Type.i32),r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),T.createHost(o.HostOp.GrowMemory,null,[h]);case"move_memory":if(r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),3!=s.length)return e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"3",s.length.toString(10)),e.currentType=a.Type.void,T.createUnreachable();throw h=e.compileExpression(s[0],e.options.usizeType),d=e.compileExpression(s[1],e.options.usizeType),_=e.compileExpression(s[2],e.options.usizeType),e.currentType=a.Type.void,new Error("not implemented");case"set_memory":if(r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),3!=s.length)return e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"3",s.length.toString(10)),e.currentType=a.Type.void,T.createUnreachable();throw h=e.compileExpression(s[0],e.options.usizeType),d=e.compileExpression(s[1],a.Type.u32),_=e.compileExpression(s[2],e.options.usizeType),e.currentType=a.Type.void,new Error("not implemented");case"changetype":return r&&1==r.length?9!=r[0].kind?(e.error(i.DiagnosticCode.Operation_not_supported,l.range),e.currentType=r[0],T.createUnreachable()):1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=r[0],T.createUnreachable()):(h=e.compileExpression(s[0],e.options.usizeType,0),e.currentType=r[0],9!=e.currentType.kind?(e.error(i.DiagnosticCode.Operation_not_supported,l.range),T.createUnreachable()):h):(r&&r.length&&(e.currentType=r[0]),e.error(i.DiagnosticCode.Expected_0_type_arguments_but_got_1,l.range,"1",r?r.length.toString(10):"0"),T.createUnreachable());case"assert":if(s.length<1||s.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,l.range,"1",r.length.toString(10))),s.length<1?e.error(i.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,l.range,"1",s.length.toString(10)):s.length>2&&e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"2",s.length.toString(10)),T.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,l.range,"1",r.length.toString(10)),T.createUnreachable();h=e.compileExpression(s[0],r[0])}else h=e.compileExpressionRetainType(s[0],a.Type.i32);if(f=e.currentType,e.currentType=f.nonNullableType,e.options.noAssert)return u==a.Type.void?(e.currentType=a.Type.void,T.createNop()):h;var A=p(e,2==s.length?s[1]:null,l);if(e.currentType=f.nonNullableType,u==a.Type.void){switch(e.currentType.kind){default:y=T.createIf(T.createUnary(o.UnaryOp.EqzI32,h),A);break;case 3:case 8:y=T.createIf(T.createUnary(o.UnaryOp.EqzI64,h),A);break;case 4:case 9:y=T.createIf(T.createUnary(e.options.isWasm64?o.UnaryOp.EqzI64:o.UnaryOp.EqzI32,h),A);break;case 11:y=T.createIf(T.createBinary(o.BinaryOp.EqF32,h,T.createF32(0)),A);break;case 12:y=T.createIf(T.createBinary(o.BinaryOp.EqF64,h,T.createF64(0)),A);break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=A}e.currentType=a.Type.void}else switch(e.currentType.kind){default:g=e.currentFunction.getAndFreeTempLocal(a.Type.i32),y=T.createIf(T.createUnary(o.UnaryOp.EqzI32,T.createTeeLocal(g.index,h)),A,T.createGetLocal(g.index,o.NativeType.I32));break;case 3:case 8:g=e.currentFunction.getAndFreeTempLocal(a.Type.i64),y=T.createIf(T.createUnary(o.UnaryOp.EqzI64,T.createTeeLocal(g.index,h)),A,T.createGetLocal(g.index,o.NativeType.I64));break;case 4:case 9:g=e.currentFunction.getAndFreeTempLocal(e.options.usizeType),y=T.createIf(T.createUnary(e.options.isWasm64?o.UnaryOp.EqzI64:o.UnaryOp.EqzI32,T.createTeeLocal(g.index,h)),A,T.createGetLocal(g.index,e.options.nativeSizeType));break;case 11:g=e.currentFunction.getAndFreeTempLocal(a.Type.f32),y=T.createIf(T.createBinary(o.BinaryOp.EqF32,T.createTeeLocal(g.index,h),T.createF32(0)),A,T.createGetLocal(g.index,o.NativeType.F32));break;case 12:g=e.currentFunction.getAndFreeTempLocal(a.Type.f64),y=T.createIf(T.createBinary(o.BinaryOp.EqF64,T.createTeeLocal(g.index,h),T.createF64(0)),A,T.createGetLocal(g.index,o.NativeType.F64));break;case 13:e.error(i.DiagnosticCode.Operation_not_supported,l.range),y=A}return y;case"i8":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.i8,T.createUnreachable()):e.compileExpression(s[0],a.Type.i8,2);case"i16":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.i16,T.createUnreachable()):e.compileExpression(s[0],a.Type.i16,2);case"i32":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.i32,T.createUnreachable()):e.compileExpression(s[0],a.Type.i32,2);case"i64":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.i64,T.createUnreachable()):e.compileExpression(s[0],a.Type.i64,2);case"isize":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=e.options.isWasm64?a.Type.isize64:a.Type.isize32,T.createUnreachable()):e.compileExpression(s[0],e.options.isWasm64?a.Type.isize64:a.Type.isize32,2);case"u8":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.u8,T.createUnreachable()):e.compileExpression(s[0],a.Type.u8,2);case"u16":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.u16,T.createUnreachable()):e.compileExpression(s[0],a.Type.u16,2);case"u32":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.u32,T.createUnreachable()):e.compileExpression(s[0],a.Type.u32,2);case"u64":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.u64,T.createUnreachable()):e.compileExpression(s[0],a.Type.u64,2);case"usize":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=e.options.usizeType,T.createUnreachable()):e.compileExpression(s[0],e.options.usizeType,2);case"bool":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.bool,T.createUnreachable()):e.compileExpression(s[0],a.Type.bool,2);case"f32":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.f32,T.createUnreachable()):e.compileExpression(s[0],a.Type.f32,2);case"f64":return r&&e.error(i.DiagnosticCode.Type_0_is_not_generic,l.range,t.internalName),1!=s.length?(e.error(i.DiagnosticCode.Expected_0_arguments_but_got_1,l.range,"1",s.length.toString(10)),e.currentType=a.Type.f64,T.createUnreachable()):e.compileExpression(s[0],a.Type.f64,2)}return e.error(i.DiagnosticCode.Operation_not_supported,l.range),T.createUnreachable()},t.compileAllocate=function(e,t,r){var n=e.program;assert(t.program==n);var a=e.module,o=e.options,c=n.elements.get(o.allocateImpl);if(!c)return n.error(i.DiagnosticCode.Cannot_find_name_0,r.range,o.allocateImpl),a.createUnreachable();if(c.kind!=s.ElementKind.FUNCTION_PROTOTYPE)return n.error(i.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,r.range,c.internalName),a.createUnreachable();var p=c.resolve();return p&&e.compileFunction(p)?(e.currentType=t.type,a.createCall(p.internalName,[o.isWasm64?a.createI64(t.currentMemoryOffset):a.createI32(t.currentMemoryOffset)],o.nativeSizeType)):a.createUnreachable()},t.compileAbort=p},function(t,r){t.exports=e},function(e,t,r){(function(e){const t=e.Binaryen||r(17);for(var n in t)(n.startsWith("_Binaryen")||n.startsWith("_Relooper"))&&(e[n]=t[n]);e.allocate_memory=function(e){return e?t._malloc(e):0},e.free_memory=function(e){e&&t._free(e)},e.move_memory=function(e,r,n){return t._memmove(e,r,n)},e.store=function(e,r){t.HEAPU8[e]=r},e.load=function(e){return t.HEAPU8[e]};const i=r(1).Module;i.prototype.toText=function(){var e=t.print,r="";return t.print=function(e){r+=e+"\n"},_BinaryenModulePrint(this.ref),t.print=e,r},i.prototype.toAsmjs=function(){var e=t.print,r="";return t.print=function(e){r+=e+"\n"},_BinaryenModulePrintAsmjs(this.ref),t.print=e,r}}).call(this,r(7))},function(e,t,r){(function(e){var t="undefined"!=typeof window&&window||void 0!==e&&e||self;function r(){Error.captureStackTrace?Error.captureStackTrace(this,r):this.stack=this.name+": "+this.message+"\n"+(new Error).stack}function n(e){this.message=e||"assertion failed",Error.captureStackTrace?Error.captureStackTrace(this,n):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:0,writable:!1},MAX_VALUE:{value:1,writable:!1}}),Object.defineProperties(t.f32=function(e){return Math.fround(e)},{MIN_VALUE:{value:Math.fround(-3.40282347e38),writable:!1},MAX_VALUE:{value:Math.fround(3.40282347e38),writable:!1},MIN_SAFE_INTEGER:{value:-16777215,writable:!1},MAX_SAFE_INTEGER:{value:16777215,writable:!1},EPSILON:{value:Math.fround(1.1920929e-7),writable:!1}}),Object.defineProperties(t.f64=function(e){return+e},{MIN_VALUE:{value:-1.7976931348623157e308,writable:!1},MAX_VALUE:{value:1.7976931348623157e308,writable:!1},MIN_SAFE_INTEGER:{value:-9007199254740991,writable:!1},MAX_SAFE_INTEGER:{value:9007199254740991,writable:!1},EPSILON:{value:2.220446049250313e-16,writable:!1}}),t.clz=Math.clz32,t.abs=Math.abs,t.max=Math.max,t.min=Math.min,t.ceil=Math.ceil,t.floor=Math.floor,t.select=function(e,t,r){return r?e:t},t.sqrt=Math.sqrt,t.trunc=Math.trunc,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},r.prototype=Object.create(Error.prototype),r.prototype.name="UnreachableError",r.prototype.message="unreachable",t.unreachable=function(){throw new r},n.prototype=Object.create(Error.prototype),n.prototype.name="AssertionError",t.assert=function(e,t){if(e)return e;throw new n(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)}}).call(this,r(7))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(19),r(18),r(15)},function(e,t,r){r(20),e.exports=r(13)}])});
|
||
//# sourceMappingURL=assemblyscript.js.map
|