vzcode 1.58.0 → 1.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -175,7 +175,7 @@ Additionally, handling the error in the 'buildEnd' hook caused the following err
175
175
  }
176
176
  `};class Po{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(e){this.nameManager=e,Po.prototype.__init.call(this),Po.prototype.__init2.call(this)}getHelperName(e){let n=this.helperNames[e];return n||(n=this.nameManager.claimFreeName(`_${e}`),this.helperNames[e]=n,n)}emitHelpers(){let e="";this.helperNames.optionalChainDelete&&this.getHelperName("optionalChain"),this.helperNames.asyncOptionalChainDelete&&this.getHelperName("asyncOptionalChain");for(const[n,s]of Object.entries(qx)){const r=this.helperNames[n];let i=s;n==="optionalChainDelete"?i=i.replace("OPTIONAL_CHAIN_NAME",this.helperNames.optionalChain):n==="asyncOptionalChainDelete"?i=i.replace("ASYNC_OPTIONAL_CHAIN_NAME",this.helperNames.asyncOptionalChain):n==="require"&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName("_createRequire")),i=i.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),r&&(e+=" ",e+=i.replace(n,r).replace(/\s+/g," ").trim())}return e}}function F1(t,e,n){Hx(t,n)&&Gx(t,e,n)}function Hx(t,e){for(const n of t.tokens)if(n.type===o.name&&!n.isType&&Xb(n)&&e.has(t.identifierNameForToken(n)))return!0;return!1}function Gx(t,e,n){const s=[];let r=e.length-1;for(let i=t.tokens.length-1;;i--){for(;s.length>0&&s[s.length-1].startTokenIndex===i+1;)s.pop();for(;r>=0&&e[r].endTokenIndex===i+1;)s.push(e[r]),r--;if(i<0)break;const a=t.tokens[i],l=t.identifierNameForToken(a);if(s.length>1&&!a.isType&&a.type===o.name&&n.has(l)){if(Kb(a))B1(s[s.length-1],t,l);else if(Jb(a)){let c=s.length-1;for(;c>0&&!s[c].isFunctionScope;)c--;if(c<0)throw new Error("Did not find parent function scope.");B1(s[c],t,l)}}}if(s.length>0)throw new Error("Expected empty scope stack after processing file.")}function B1(t,e,n){for(let s=t.startTokenIndex;s<t.endTokenIndex;s++){const r=e.tokens[s];(r.type===o.name||r.type===o.jsxName)&&e.identifierNameForToken(r)===n&&(r.shadowsGlobal=!0)}}function Wx(t,e){const n=[];for(const s of e)s.type===o.name&&n.push(t.slice(s.start,s.end));return n}class ql{__init(){this.usedNames=new Set}constructor(e,n){ql.prototype.__init.call(this),this.usedNames=new Set(Wx(e,n))}claimFreeName(e){const n=this.findFreeName(e);return this.usedNames.add(n),n}findFreeName(e){if(!this.usedNames.has(e))return e;let n=2;for(;this.usedNames.has(e+String(n));)n++;return e+String(n)}}var Lr={},Mr={},Ut={},j1;function Hl(){if(j1)return Ut;j1=1;var t=Ut&&Ut.__extends||function(){var i=function(a,l){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)u.hasOwnProperty(d)&&(c[d]=u[d])},i(a,l)};return function(a,l){i(a,l);function c(){this.constructor=a}a.prototype=l===null?Object.create(l):(c.prototype=l.prototype,new c)}}();Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.DetailContext=Ut.NoopContext=Ut.VError=void 0;var e=function(i){t(a,i);function a(l,c){var u=i.call(this,c)||this;return u.path=l,Object.setPrototypeOf(u,a.prototype),u}return a}(Error);Ut.VError=e;var n=function(){function i(){}return i.prototype.fail=function(a,l,c){return!1},i.prototype.unionResolver=function(){return this},i.prototype.createContext=function(){return this},i.prototype.resolveUnion=function(a){},i}();Ut.NoopContext=n;var s=function(){function i(){this._propNames=[""],this._messages=[null],this._score=0}return i.prototype.fail=function(a,l,c){return this._propNames.push(a),this._messages.push(l),this._score+=c,!1},i.prototype.unionResolver=function(){return new r},i.prototype.resolveUnion=function(a){for(var l,c,u=a,d=null,m=0,f=u.contexts;m<f.length;m++){var g=f[m];(!d||g._score>=d._score)&&(d=g)}d&&d._score>0&&((l=this._propNames).push.apply(l,d._propNames),(c=this._messages).push.apply(c,d._messages))},i.prototype.getError=function(a){for(var l=[],c=this._propNames.length-1;c>=0;c--){var u=this._propNames[c];a+=typeof u=="number"?"["+u+"]":u?"."+u:"";var d=this._messages[c];d&&l.push(a+" "+d)}return new e(a,l.join("; "))},i.prototype.getErrorDetail=function(a){for(var l=[],c=this._propNames.length-1;c>=0;c--){var u=this._propNames[c];a+=typeof u=="number"?"["+u+"]":u?"."+u:"";var d=this._messages[c];d&&l.push({path:a,message:d})}for(var m=null,c=l.length-1;c>=0;c--)m&&(l[c].nested=[m]),m=l[c];return m},i}();Ut.DetailContext=s;var r=function(){function i(){this.contexts=[]}return i.prototype.createContext=function(){var a=new s;return this.contexts.push(a),a},i}();return Ut}var z1;function V1(){return z1||(z1=1,function(t){var e=Mr&&Mr.__extends||function(){var x=function(F,B){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,ee){J.__proto__=ee}||function(J,ee){for(var ie in ee)ee.hasOwnProperty(ie)&&(J[ie]=ee[ie])},x(F,B)};return function(F,B){x(F,B);function J(){this.constructor=F}F.prototype=B===null?Object.create(B):(J.prototype=B.prototype,new J)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.basicTypes=t.BasicType=t.TParamList=t.TParam=t.param=t.TFunc=t.func=t.TProp=t.TOptional=t.opt=t.TIface=t.iface=t.TEnumLiteral=t.enumlit=t.TEnumType=t.enumtype=t.TIntersection=t.intersection=t.TUnion=t.union=t.TTuple=t.tuple=t.TArray=t.array=t.TLiteral=t.lit=t.TName=t.name=t.TType=void 0;var n=Hl(),s=function(){function x(){}return x}();t.TType=s;function r(x){return typeof x=="string"?a(x):x}function i(x,F){var B=x[F];if(!B)throw new Error("Unknown type "+F);return B}function a(x){return new l(x)}t.name=a;var l=function(x){e(F,x);function F(B){var J=x.call(this)||this;return J.name=B,J._failMsg="is not a "+B,J}return F.prototype.getChecker=function(B,J,ee){var ie=this,se=i(B,this.name),ke=se.getChecker(B,J,ee);return se instanceof X||se instanceof F?ke:function(ye,be){return ke(ye,be)?!0:be.fail(null,ie._failMsg,0)}},F}(s);t.TName=l;function c(x){return new u(x)}t.lit=c;var u=function(x){e(F,x);function F(B){var J=x.call(this)||this;return J.value=B,J.name=JSON.stringify(B),J._failMsg="is not "+J.name,J}return F.prototype.getChecker=function(B,J){var ee=this;return function(ie,se){return ie===ee.value?!0:se.fail(null,ee._failMsg,-1)}},F}(s);t.TLiteral=u;function d(x){return new m(r(x))}t.array=d;var m=function(x){e(F,x);function F(B){var J=x.call(this)||this;return J.ttype=B,J}return F.prototype.getChecker=function(B,J){var ee=this.ttype.getChecker(B,J);return function(ie,se){if(!Array.isArray(ie))return se.fail(null,"is not an array",0);for(var ke=0;ke<ie.length;ke++){var ye=ee(ie[ke],se);if(!ye)return se.fail(ke,null,1)}return!0}},F}(s);t.TArray=m;function f(){for(var x=[],F=0;F<arguments.length;F++)x[F]=arguments[F];return new g(x.map(function(B){return r(B)}))}t.tuple=f;var g=function(x){e(F,x);function F(B){var J=x.call(this)||this;return J.ttypes=B,J}return F.prototype.getChecker=function(B,J){var ee=this.ttypes.map(function(se){return se.getChecker(B,J)}),ie=function(se,ke){if(!Array.isArray(se))return ke.fail(null,"is not an array",0);for(var ye=0;ye<ee.length;ye++){var be=ee[ye](se[ye],ke);if(!be)return ke.fail(ye,null,1)}return!0};return J?function(se,ke){return ie(se,ke)?se.length<=ee.length?!0:ke.fail(ee.length,"is extraneous",2):!1}:ie},F}(s);t.TTuple=g;function w(){for(var x=[],F=0;F<arguments.length;F++)x[F]=arguments[F];return new k(x.map(function(B){return r(B)}))}t.union=w;var k=function(x){e(F,x);function F(B){var J=x.call(this)||this;J.ttypes=B;var ee=B.map(function(se){return se instanceof l||se instanceof u?se.name:null}).filter(function(se){return se}),ie=B.length-ee.length;return ee.length?(ie>0&&ee.push(ie+" more"),J._failMsg="is none of "+ee.join(", ")):J._failMsg="is none of "+ie+" types",J}return F.prototype.getChecker=function(B,J){var ee=this,ie=this.ttypes.map(function(se){return se.getChecker(B,J)});return function(se,ke){for(var ye=ke.unionResolver(),be=0;be<ie.length;be++){var fe=ie[be](se,ye.createContext());if(fe)return!0}return ke.resolveUnion(ye),ke.fail(null,ee._failMsg,0)}},F}(s);t.TUnion=k;function I(){for(var x=[],F=0;F<arguments.length;F++)x[F]=arguments[F];return new E(x.map(function(B){return r(B)}))}t.intersection=I;var E=function(x){e(F,x);function F(B){var J=x.call(this)||this;return J.ttypes=B,J}return F.prototype.getChecker=function(B,J){var ee=new Set,ie=this.ttypes.map(function(se){return se.getChecker(B,J,ee)});return function(se,ke){var ye=ie.every(function(be){return be(se,ke)});return ye?!0:ke.fail(null,null,0)}},F}(s);t.TIntersection=E;function b(x){return new A(x)}t.enumtype=b;var A=function(x){e(F,x);function F(B){var J=x.call(this)||this;return J.members=B,J.validValues=new Set,J._failMsg="is not a valid enum value",J.validValues=new Set(Object.keys(B).map(function(ee){return B[ee]})),J}return F.prototype.getChecker=function(B,J){var ee=this;return function(ie,se){return ee.validValues.has(ie)?!0:se.fail(null,ee._failMsg,0)}},F}(s);t.TEnumType=A;function v(x,F){return new $(x,F)}t.enumlit=v;var $=function(x){e(F,x);function F(B,J){var ee=x.call(this)||this;return ee.enumName=B,ee.prop=J,ee._failMsg="is not "+B+"."+J,ee}return F.prototype.getChecker=function(B,J){var ee=this,ie=i(B,this.enumName);if(!(ie instanceof A))throw new Error("Type "+this.enumName+" used in enumlit is not an enum type");var se=ie.members[this.prop];if(!ie.members.hasOwnProperty(this.prop))throw new Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(ke,ye){return ke===se?!0:ye.fail(null,ee._failMsg,-1)}},F}(s);t.TEnumLiteral=$;function D(x){return Object.keys(x).map(function(F){return j(F,x[F])})}function j(x,F){return F instanceof _?new N(x,F.ttype,!0):new N(x,r(F),!1)}function V(x,F){return new U(x,D(F))}t.iface=V;var U=function(x){e(F,x);function F(B,J){var ee=x.call(this)||this;return ee.bases=B,ee.props=J,ee.propSet=new Set(J.map(function(ie){return ie.name})),ee}return F.prototype.getChecker=function(B,J,ee){var ie=this,se=this.bases.map(function(qe){return i(B,qe).getChecker(B,J)}),ke=this.props.map(function(qe){return qe.ttype.getChecker(B,J)}),ye=new n.NoopContext,be=this.props.map(function(qe,ne){return!qe.isOpt&&!ke[ne](void 0,ye)}),fe=function(qe,ne){if(typeof qe!="object"||qe===null)return ne.fail(null,"is not an object",0);for(var we=0;we<se.length;we++)if(!se[we](qe,ne))return!1;for(var we=0;we<ke.length;we++){var Z=ie.props[we].name,Se=qe[Z];if(Se===void 0){if(be[we])return ne.fail(Z,"is missing",1)}else{var Xe=ke[we](Se,ne);if(!Xe)return ne.fail(Z,null,1)}}return!0};if(!J)return fe;var Oe=this.propSet;return ee&&(this.propSet.forEach(function(qe){return ee.add(qe)}),Oe=ee),function(qe,ne){if(!fe(qe,ne))return!1;for(var we in qe)if(!Oe.has(we))return ne.fail(we,"is extraneous",2);return!0}},F}(s);t.TIface=U;function O(x){return new _(r(x))}t.opt=O;var _=function(x){e(F,x);function F(B){var J=x.call(this)||this;return J.ttype=B,J}return F.prototype.getChecker=function(B,J){var ee=this.ttype.getChecker(B,J);return function(ie,se){return ie===void 0||ee(ie,se)}},F}(s);t.TOptional=_;var N=function(){function x(F,B,J){this.name=F,this.ttype=B,this.isOpt=J}return x}();t.TProp=N;function C(x){for(var F=[],B=1;B<arguments.length;B++)F[B-1]=arguments[B];return new R(new K(F),r(x))}t.func=C;var R=function(x){e(F,x);function F(B,J){var ee=x.call(this)||this;return ee.paramList=B,ee.result=J,ee}return F.prototype.getChecker=function(B,J){return function(ee,ie){return typeof ee=="function"?!0:ie.fail(null,"is not a function",0)}},F}(s);t.TFunc=R;function M(x,F,B){return new q(x,r(F),!!B)}t.param=M;var q=function(){function x(F,B,J){this.name=F,this.ttype=B,this.isOpt=J}return x}();t.TParam=q;var K=function(x){e(F,x);function F(B){var J=x.call(this)||this;return J.params=B,J}return F.prototype.getChecker=function(B,J){var ee=this,ie=this.params.map(function(be){return be.ttype.getChecker(B,J)}),se=new n.NoopContext,ke=this.params.map(function(be,fe){return!be.isOpt&&!ie[fe](void 0,se)}),ye=function(be,fe){if(!Array.isArray(be))return fe.fail(null,"is not an array",0);for(var Oe=0;Oe<ie.length;Oe++){var qe=ee.params[Oe];if(be[Oe]===void 0){if(ke[Oe])return fe.fail(qe.name,"is missing",1)}else{var ne=ie[Oe](be[Oe],fe);if(!ne)return fe.fail(qe.name,null,1)}}return!0};return J?function(be,fe){return ye(be,fe)?be.length<=ie.length?!0:fe.fail(ie.length,"is extraneous",2):!1}:ye},F}(s);t.TParamList=K;var X=function(x){e(F,x);function F(B,J){var ee=x.call(this)||this;return ee.validator=B,ee.message=J,ee}return F.prototype.getChecker=function(B,J){var ee=this;return function(ie,se){return ee.validator(ie)?!0:se.fail(null,ee.message,0)}},F}(s);t.BasicType=X,t.basicTypes={any:new X(function(x){return!0},"is invalid"),number:new X(function(x){return typeof x=="number"},"is not a number"),object:new X(function(x){return typeof x=="object"&&x},"is not an object"),boolean:new X(function(x){return typeof x=="boolean"},"is not a boolean"),string:new X(function(x){return typeof x=="string"},"is not a string"),symbol:new X(function(x){return typeof x=="symbol"},"is not a symbol"),void:new X(function(x){return x==null},"is not void"),undefined:new X(function(x){return x===void 0},"is not undefined"),null:new X(function(x){return x===null},"is not null"),never:new X(function(x){return!1},"is unexpected"),Date:new X(T("[object Date]"),"is not a Date"),RegExp:new X(T("[object RegExp]"),"is not a RegExp")};var ae=Object.prototype.toString;function T(x){return function(F){return typeof F=="object"&&F&&ae.call(F)===x}}typeof Buffer<"u"&&(t.basicTypes.Buffer=new X(function(x){return Buffer.isBuffer(x)},"is not a Buffer"));for(var de=function(x){t.basicTypes[x.name]=new X(function(F){return F instanceof x},"is not a "+x.name)},he=0,ce=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];he<ce.length;he++){var L=ce[he];de(L)}}(Mr)),Mr}var U1;function Xx(){return U1||(U1=1,function(t){var e=Lr&&Lr.__spreadArrays||function(){for(var c=0,u=0,d=arguments.length;u<d;u++)c+=arguments[u].length;for(var m=Array(c),f=0,u=0;u<d;u++)for(var g=arguments[u],w=0,k=g.length;w<k;w++,f++)m[f]=g[w];return m};Object.defineProperty(t,"__esModule",{value:!0}),t.Checker=t.createCheckers=void 0;var n=V1(),s=Hl(),r=V1();Object.defineProperty(t,"TArray",{enumerable:!0,get:function(){return r.TArray}}),Object.defineProperty(t,"TEnumType",{enumerable:!0,get:function(){return r.TEnumType}}),Object.defineProperty(t,"TEnumLiteral",{enumerable:!0,get:function(){return r.TEnumLiteral}}),Object.defineProperty(t,"TFunc",{enumerable:!0,get:function(){return r.TFunc}}),Object.defineProperty(t,"TIface",{enumerable:!0,get:function(){return r.TIface}}),Object.defineProperty(t,"TLiteral",{enumerable:!0,get:function(){return r.TLiteral}}),Object.defineProperty(t,"TName",{enumerable:!0,get:function(){return r.TName}}),Object.defineProperty(t,"TOptional",{enumerable:!0,get:function(){return r.TOptional}}),Object.defineProperty(t,"TParam",{enumerable:!0,get:function(){return r.TParam}}),Object.defineProperty(t,"TParamList",{enumerable:!0,get:function(){return r.TParamList}}),Object.defineProperty(t,"TProp",{enumerable:!0,get:function(){return r.TProp}}),Object.defineProperty(t,"TTuple",{enumerable:!0,get:function(){return r.TTuple}}),Object.defineProperty(t,"TType",{enumerable:!0,get:function(){return r.TType}}),Object.defineProperty(t,"TUnion",{enumerable:!0,get:function(){return r.TUnion}}),Object.defineProperty(t,"TIntersection",{enumerable:!0,get:function(){return r.TIntersection}}),Object.defineProperty(t,"array",{enumerable:!0,get:function(){return r.array}}),Object.defineProperty(t,"enumlit",{enumerable:!0,get:function(){return r.enumlit}}),Object.defineProperty(t,"enumtype",{enumerable:!0,get:function(){return r.enumtype}}),Object.defineProperty(t,"func",{enumerable:!0,get:function(){return r.func}}),Object.defineProperty(t,"iface",{enumerable:!0,get:function(){return r.iface}}),Object.defineProperty(t,"lit",{enumerable:!0,get:function(){return r.lit}}),Object.defineProperty(t,"name",{enumerable:!0,get:function(){return r.name}}),Object.defineProperty(t,"opt",{enumerable:!0,get:function(){return r.opt}}),Object.defineProperty(t,"param",{enumerable:!0,get:function(){return r.param}}),Object.defineProperty(t,"tuple",{enumerable:!0,get:function(){return r.tuple}}),Object.defineProperty(t,"union",{enumerable:!0,get:function(){return r.union}}),Object.defineProperty(t,"intersection",{enumerable:!0,get:function(){return r.intersection}}),Object.defineProperty(t,"BasicType",{enumerable:!0,get:function(){return r.BasicType}});var i=Hl();Object.defineProperty(t,"VError",{enumerable:!0,get:function(){return i.VError}});function a(){for(var c=[],u=0;u<arguments.length;u++)c[u]=arguments[u];for(var d=Object.assign.apply(Object,e([{},n.basicTypes],c)),m={},f=0,g=c;f<g.length;f++)for(var w=g[f],k=0,I=Object.keys(w);k<I.length;k++){var E=I[k];m[E]=new l(d,w[E])}return m}t.createCheckers=a;var l=function(){function c(u,d,m){if(m===void 0&&(m="value"),this.suite=u,this.ttype=d,this._path=m,this.props=new Map,d instanceof n.TIface)for(var f=0,g=d.props;f<g.length;f++){var w=g[f];this.props.set(w.name,w.ttype)}this.checkerPlain=this.ttype.getChecker(u,!1),this.checkerStrict=this.ttype.getChecker(u,!0)}return c.prototype.setReportedPath=function(u){this._path=u},c.prototype.check=function(u){return this._doCheck(this.checkerPlain,u)},c.prototype.test=function(u){return this.checkerPlain(u,new s.NoopContext)},c.prototype.validate=function(u){return this._doValidate(this.checkerPlain,u)},c.prototype.strictCheck=function(u){return this._doCheck(this.checkerStrict,u)},c.prototype.strictTest=function(u){return this.checkerStrict(u,new s.NoopContext)},c.prototype.strictValidate=function(u){return this._doValidate(this.checkerStrict,u)},c.prototype.getProp=function(u){var d=this.props.get(u);if(!d)throw new Error("Type has no property "+u);return new c(this.suite,d,this._path+"."+u)},c.prototype.methodArgs=function(u){var d=this._getMethod(u);return new c(this.suite,d.paramList)},c.prototype.methodResult=function(u){var d=this._getMethod(u);return new c(this.suite,d.result)},c.prototype.getArgs=function(){if(!(this.ttype instanceof n.TFunc))throw new Error("getArgs() applied to non-function");return new c(this.suite,this.ttype.paramList)},c.prototype.getResult=function(){if(!(this.ttype instanceof n.TFunc))throw new Error("getResult() applied to non-function");return new c(this.suite,this.ttype.result)},c.prototype.getType=function(){return this.ttype},c.prototype._doCheck=function(u,d){var m=new s.NoopContext;if(!u(d,m)){var f=new s.DetailContext;throw u(d,f),f.getError(this._path)}},c.prototype._doValidate=function(u,d){var m=new s.NoopContext;if(u(d,m))return null;var f=new s.DetailContext;return u(d,f),f.getErrorDetail(this._path)},c.prototype._getMethod=function(u){var d=this.props.get(u);if(!d)throw new Error("Type has no property "+u);if(!(d instanceof n.TFunc))throw new Error("Property "+u+" is not a method");return d},c}();t.Checker=l}(Lr)),Lr}var We=Xx();const Kx=We.union(We.lit("jsx"),We.lit("typescript"),We.lit("flow"),We.lit("imports"),We.lit("react-hot-loader"),We.lit("jest")),Jx=We.iface([],{compiledFilename:"string"}),Yx=We.iface([],{transforms:We.array("Transform"),disableESTransforms:We.opt("boolean"),jsxRuntime:We.opt(We.union(We.lit("classic"),We.lit("automatic"),We.lit("preserve"))),production:We.opt("boolean"),jsxImportSource:We.opt("string"),jsxPragma:We.opt("string"),jsxFragmentPragma:We.opt("string"),keepUnusedImports:We.opt("boolean"),preserveDynamicImport:We.opt("boolean"),injectCreateRequireForImportRequire:We.opt("boolean"),enableLegacyTypeScriptModuleInterop:We.opt("boolean"),enableLegacyBabel5ModuleInterop:We.opt("boolean"),sourceMapOptions:We.opt("SourceMapOptions"),filePath:We.opt("string")}),Qx={Transform:Kx,SourceMapOptions:Jx,Options:Yx},{Options:Zx}=We.createCheckers(Qx);function ek(t){Zx.strictCheck(t)}function q1(){G(),gt(!1)}function H1(t){G(),No(t)}function $n(t){xe(),Gl(t)}function $o(){xe(),h.tokens[h.tokens.length-1].identifierRole=ge.ImportDeclaration}function Gl(t){let e;h.scopeDepth===0?e=ge.TopLevelDeclaration:t?e=ge.BlockScopedDeclaration:e=ge.FunctionScopedDeclaration,h.tokens[h.tokens.length-1].identifierRole=e}function No(t){switch(h.type){case o._this:{const e=Ne(0);G(),$e(e);return}case o._yield:case o.name:{h.type=o.name,$n(t);return}case o.bracketL:{G(),Wl(o.bracketR,t,!0);return}case o.braceL:hc(!0,t);return;default:Ie()}}function Wl(t,e,n=!1,s=!1,r=0){let i=!0,a=!1;const l=h.tokens.length;for(;!z(t)&&!h.error;)if(i?i=!1:(H(o.comma),h.tokens[h.tokens.length-1].contextId=r,!a&&h.tokens[l].isType&&(h.tokens[h.tokens.length-1].isType=!0,a=!0)),!(n&&y(o.comma))){if(z(t))break;if(y(o.ellipsis)){H1(e),G1(),z(o.comma),H(t);break}else tk(s,e)}}function tk(t,e){t&&Kl([S._public,S._protected,S._private,S._readonly,S._override]),Co(e),G1(),Co(e,!0)}function G1(){Be?xA():De&&cE()}function Co(t,e=!1){if(e||No(t),!z(o.eq))return;const n=h.tokens.length-1;gt(),h.tokens[n].rhsEndIndex=h.tokens.length}function Xl(){return y(o.name)}function nk(){return y(o.name)||!!(h.type&o.IS_KEYWORD)||y(o.string)||y(o.num)||y(o.bigint)||y(o.decimal)}function W1(){const t=h.snapshot();return G(),(y(o.bracketL)||y(o.braceL)||y(o.star)||y(o.ellipsis)||y(o.hash)||nk())&&!Et()?!0:(h.restoreFromSnapshot(t),!1)}function Kl(t){for(;X1(t)!==null;);}function X1(t){if(!y(o.name))return null;const e=h.contextualKeyword;if(t.indexOf(e)!==-1&&W1()){switch(e){case S._readonly:h.tokens[h.tokens.length-1].type=o._readonly;break;case S._abstract:h.tokens[h.tokens.length-1].type=o._abstract;break;case S._static:h.tokens[h.tokens.length-1].type=o._static;break;case S._public:h.tokens[h.tokens.length-1].type=o._public;break;case S._private:h.tokens[h.tokens.length-1].type=o._private;break;case S._protected:h.tokens[h.tokens.length-1].type=o._protected;break;case S._override:h.tokens[h.tokens.length-1].type=o._override;break;case S._declare:h.tokens[h.tokens.length-1].type=o._declare;break}return e}return null}function Fr(){for(xe();z(o.dot);)xe()}function sk(){Fr(),!Et()&&y(o.lessThan)&&Bs()}function rk(){G(),jr()}function ik(){G()}function ok(){H(o._typeof),y(o._import)?K1():Fr(),!Et()&&y(o.lessThan)&&Bs()}function K1(){H(o._import),H(o.parenL),H(o.string),H(o.parenR),z(o.dot)&&Fr(),y(o.lessThan)&&Bs()}function ak(){z(o._const);const t=z(o._in),e=ut(S._out);z(o._const),(t||e)&&!y(o.name)?h.tokens[h.tokens.length-1].type=o.name:xe(),z(o._extends)&&tt(),z(o.eq)&&tt()}function os(){y(o.lessThan)&&To()}function To(){const t=Ne(0);for(y(o.lessThan)||y(o.typeParameterStart)?G():Ie();!z(o.greaterThan)&&!h.error;)ak(),z(o.comma);$e(t)}function Jl(t){const e=t===o.arrow;os(),H(o.parenL),h.scopeDepth++,lk(!1),h.scopeDepth--,(e||y(t))&&Br(t)}function lk(t){Wl(o.parenR,t)}function Ro(){z(o.comma)||Je()}function J1(){Jl(o.colon),Ro()}function ck(){const t=h.snapshot();G();const e=z(o.name)&&y(o.colon);return h.restoreFromSnapshot(t),e}function Y1(){if(!(y(o.bracketL)&&ck()))return!1;const t=Ne(0);return H(o.bracketL),xe(),jr(),H(o.bracketR),Ms(),Ro(),$e(t),!0}function Q1(t){z(o.question),!t&&(y(o.parenL)||y(o.lessThan))?(Jl(o.colon),Ro()):(Ms(),Ro())}function uk(){if(y(o.parenL)||y(o.lessThan)){J1();return}if(y(o._new)){G(),y(o.parenL)||y(o.lessThan)?J1():Q1(!1);return}const t=!!X1([S._readonly]);Y1()||((me(S._get)||me(S._set))&&W1(),Vr(-1),Q1(t))}function hk(){Z1()}function Z1(){for(H(o.braceL);!z(o.braceR)&&!h.error;)uk()}function dk(){const t=h.snapshot(),e=pk();return h.restoreFromSnapshot(t),e}function pk(){return G(),z(o.plus)||z(o.minus)?me(S._readonly):(me(S._readonly)&&G(),!y(o.bracketL)||(G(),!Xl())?!1:(G(),y(o._in)))}function fk(){xe(),H(o._in),tt()}function mk(){H(o.braceL),y(o.plus)||y(o.minus)?(G(),rt(S._readonly)):ut(S._readonly),H(o.bracketL),fk(),ut(S._as)&&tt(),H(o.bracketR),y(o.plus)||y(o.minus)?(G(),H(o.question)):z(o.question),$k(),Je(),H(o.braceR)}function gk(){for(H(o.bracketL);!z(o.bracketR)&&!h.error;)yk(),z(o.comma)}function yk(){z(o.ellipsis)?tt():(tt(),z(o.question)),z(o.colon)&&tt()}function bk(){H(o.parenL),tt(),H(o.parenR)}function xk(){for(Pn(),Pn();!y(o.backQuote)&&!h.error;)H(o.dollarBraceL),tt(),Pn(),Pn();G()}var Nn;(function(t){t[t.TSFunctionType=0]="TSFunctionType";const n=1;t[t.TSConstructorType=n]="TSConstructorType";const s=n+1;t[t.TSAbstractConstructorType=s]="TSAbstractConstructorType"})(Nn||(Nn={}));function Yl(t){t===Nn.TSAbstractConstructorType&&rt(S._abstract),(t===Nn.TSConstructorType||t===Nn.TSAbstractConstructorType)&&H(o._new);const e=h.inDisallowConditionalTypesContext;h.inDisallowConditionalTypesContext=!1,Jl(o.arrow),h.inDisallowConditionalTypesContext=e}function kk(){switch(h.type){case o.name:sk();return;case o._void:case o._null:G();return;case o.string:case o.num:case o.bigint:case o.decimal:case o._true:case o._false:zs();return;case o.minus:G(),zs();return;case o._this:{ik(),me(S._is)&&!Et()&&rk();return}case o._typeof:ok();return;case o._import:K1();return;case o.braceL:dk()?mk():hk();return;case o.bracketL:gk();return;case o.parenL:bk();return;case o.backQuote:xk();return;default:if(h.type&o.IS_KEYWORD){G(),h.tokens[h.tokens.length-1].type=o.name;return}break}Ie()}function Ek(){for(kk();!Et()&&z(o.bracketL);)z(o.bracketR)||(tt(),H(o.bracketR))}function Ak(){if(rt(S._infer),xe(),y(o._extends)){const t=h.snapshot();H(o._extends);const e=h.inDisallowConditionalTypesContext;h.inDisallowConditionalTypesContext=!0,tt(),h.inDisallowConditionalTypesContext=e,(h.error||!h.inDisallowConditionalTypesContext&&y(o.question))&&h.restoreFromSnapshot(t)}}function Ql(){if(me(S._keyof)||me(S._unique)||me(S._readonly))G(),Ql();else if(me(S._infer))Ak();else{const t=h.inDisallowConditionalTypesContext;h.inDisallowConditionalTypesContext=!1,Ek(),h.inDisallowConditionalTypesContext=t}}function ef(){if(z(o.bitwiseAND),Ql(),y(o.bitwiseAND))for(;z(o.bitwiseAND);)Ql()}function wk(){if(z(o.bitwiseOR),ef(),y(o.bitwiseOR))for(;z(o.bitwiseOR);)ef()}function Sk(){return y(o.lessThan)?!0:y(o.parenL)&&vk()}function Ik(){if(y(o.name)||y(o._this))return G(),!0;if(y(o.braceL)||y(o.bracketL)){let t=1;for(G();t>0&&!h.error;)y(o.braceL)||y(o.bracketL)?t++:(y(o.braceR)||y(o.bracketR))&&t--,G();return!0}return!1}function vk(){const t=h.snapshot(),e=_k();return h.restoreFromSnapshot(t),e}function _k(){return G(),!!(y(o.parenR)||y(o.ellipsis)||Ik()&&(y(o.colon)||y(o.comma)||y(o.question)||y(o.eq)||y(o.parenR)&&(G(),y(o.arrow))))}function Br(t){const e=Ne(0);H(t),Nk()||tt(),$e(e)}function Pk(){y(o.colon)&&Br(o.colon)}function Ms(){y(o.colon)&&jr()}function $k(){z(o.colon)&&tt()}function Nk(){const t=h.snapshot();return me(S._asserts)?(G(),ut(S._is)?(tt(),!0):Xl()||y(o._this)?(G(),ut(S._is)&&tt(),!0):(h.restoreFromSnapshot(t),!1)):Xl()||y(o._this)?(G(),me(S._is)&&!Et()?(G(),tt(),!0):(h.restoreFromSnapshot(t),!1)):!1}function jr(){const t=Ne(0);H(o.colon),tt(),$e(t)}function tt(){if(tf(),h.inDisallowConditionalTypesContext||Et()||!z(o._extends))return;const t=h.inDisallowConditionalTypesContext;h.inDisallowConditionalTypesContext=!0,tf(),h.inDisallowConditionalTypesContext=t,H(o.question),tt(),H(o.colon),tt()}function Ck(){return me(S._abstract)&&et()===o._new}function tf(){if(Sk()){Yl(Nn.TSFunctionType);return}if(y(o._new)){Yl(Nn.TSConstructorType);return}else if(Ck()){Yl(Nn.TSAbstractConstructorType);return}wk()}function Tk(){const t=Ne(1);tt(),H(o.greaterThan),$e(t),zr()}function Rk(){if(z(o.jsxTagStart)){h.tokens[h.tokens.length-1].type=o.typeParameterStart;const t=Ne(1);for(;!y(o.greaterThan)&&!h.error;)tt(),z(o.comma);Ot(),$e(t)}}function nf(){for(;!y(o.braceL)&&!h.error;)Dk(),z(o.comma)}function Dk(){Fr(),y(o.lessThan)&&Bs()}function Ok(){$n(!1),os(),z(o._extends)&&nf(),Z1()}function Lk(){$n(!1),os(),H(o.eq),tt(),Je()}function Mk(){if(y(o.string)?zs():xe(),z(o.eq)){const t=h.tokens.length-1;gt(),h.tokens[t].rhsEndIndex=h.tokens.length}}function Zl(){for($n(!1),H(o.braceL);!z(o.braceR)&&!h.error;)Mk(),z(o.comma)}function ec(){H(o.braceL),Uo(o.braceR)}function tc(){$n(!1),z(o.dot)?tc():ec()}function sf(){me(S._global)?xe():y(o.string)?yn():Ie(),y(o.braceL)?ec():Je()}function nc(){$o(),H(o.eq),Bk(),Je()}function Fk(){return me(S._require)&&et()===o.parenL}function Bk(){Fk()?jk():Fr()}function jk(){rt(S._require),H(o.parenL),y(o.string)||Ie(),zs(),H(o.parenR)}function zk(){if(tn())return!1;switch(h.type){case o._function:{const t=Ne(1);G();const e=h.start;return cs(e,!0),$e(t),!0}case o._class:{const t=Ne(1);return us(!0,!1),$e(t),!0}case o._const:if(y(o._const)&&Bl(S._enum)){const t=Ne(1);return H(o._const),rt(S._enum),h.tokens[h.tokens.length-1].type=o._enum,Zl(),$e(t),!0}case o._var:case o._let:{const t=Ne(1);return Vo(h.type!==o._var),$e(t),!0}case o.name:{const t=Ne(1),e=h.contextualKeyword;let n=!1;return e===S._global?(sf(),n=!0):n=Do(e,!0),$e(t),n}default:return!1}}function rf(){return Do(h.contextualKeyword,!0)}function Vk(t){switch(t){case S._declare:{const e=h.tokens.length-1;if(zk())return h.tokens[e].type=o._declare,!0;break}case S._global:if(y(o.braceL))return ec(),!0;break;default:return Do(t,!1)}return!1}function Do(t,e){switch(t){case S._abstract:if(Fs(e)&&y(o._class))return h.tokens[h.tokens.length-1].type=o._abstract,us(!0,!1),!0;break;case S._enum:if(Fs(e)&&y(o.name))return h.tokens[h.tokens.length-1].type=o._enum,Zl(),!0;break;case S._interface:if(Fs(e)&&y(o.name)){const n=Ne(e?2:1);return Ok(),$e(n),!0}break;case S._module:if(Fs(e)){if(y(o.string)){const n=Ne(e?2:1);return sf(),$e(n),!0}else if(y(o.name)){const n=Ne(e?2:1);return tc(),$e(n),!0}}break;case S._namespace:if(Fs(e)&&y(o.name)){const n=Ne(e?2:1);return tc(),$e(n),!0}break;case S._type:if(Fs(e)&&y(o.name)){const n=Ne(e?2:1);return Lk(),$e(n),!0}break}return!1}function Fs(t){return t?(G(),!0):!tn()}function Uk(){const t=h.snapshot();return To(),Vs(),Pk(),H(o.arrow),h.error?(h.restoreFromSnapshot(t),!1):(qr(!0),!0)}function sc(){h.type===o.bitShiftL&&(h.pos-=1,ve(o.lessThan)),Bs()}function Bs(){const t=Ne(0);for(H(o.lessThan);!y(o.greaterThan)&&!h.error;)tt(),z(o.comma);t?(H(o.greaterThan),$e(t)):($e(t),I1(),H(o.greaterThan),h.tokens[h.tokens.length-1].isType=!0)}function of(){if(y(o.name))switch(h.contextualKeyword){case S._abstract:case S._declare:case S._enum:case S._interface:case S._module:case S._namespace:case S._type:return!0}return!1}function qk(t,e){if(y(o.colon)&&Br(o.colon),!y(o.braceL)&&tn()){let n=h.tokens.length-1;for(;n>=0&&(h.tokens[n].start>=t||h.tokens[n].type===o._default||h.tokens[n].type===o._export);)h.tokens[n].isType=!0,n--;return}qr(!1,e)}function Hk(t,e,n){if(!Et()&&z(o.bang)){h.tokens[h.tokens.length-1].type=o.nonNullAssertion;return}if(y(o.lessThan)||y(o.bitShiftL)){const s=h.snapshot();if(!e&&ff()&&Uk())return;if(sc(),!e&&z(o.parenL)?(h.tokens[h.tokens.length-1].subscriptStartIndex=t,Cn()):y(o.backQuote)?uc():(h.type===o.greaterThan||h.type!==o.parenL&&h.type&o.IS_EXPRESSION_START&&!Et())&&Ie(),h.error)h.restoreFromSnapshot(s);else return}else!e&&y(o.questionDot)&&et()===o.lessThan&&(G(),h.tokens[t].isOptionalChainStart=!0,h.tokens[h.tokens.length-1].subscriptStartIndex=t,Bs(),H(o.parenL),Cn());oc(t,e,n)}function Gk(){if(z(o._import))return me(S._type)&&et()!==o.eq&&rt(S._type),nc(),!0;if(z(o.eq))return mt(),Je(),!0;if(ut(S._as))return rt(S._namespace),xe(),Je(),!0;if(me(S._type)){const t=et();(t===o.braceL||t===o.star)&&G()}return!1}function Wk(){if(xe(),y(o.comma)||y(o.braceR)){h.tokens[h.tokens.length-1].identifierRole=ge.ImportDeclaration;return}if(xe(),y(o.comma)||y(o.braceR)){h.tokens[h.tokens.length-1].identifierRole=ge.ImportDeclaration,h.tokens[h.tokens.length-2].isType=!0,h.tokens[h.tokens.length-1].isType=!0;return}if(xe(),y(o.comma)||y(o.braceR)){h.tokens[h.tokens.length-3].identifierRole=ge.ImportAccess,h.tokens[h.tokens.length-1].identifierRole=ge.ImportDeclaration;return}xe(),h.tokens[h.tokens.length-3].identifierRole=ge.ImportAccess,h.tokens[h.tokens.length-1].identifierRole=ge.ImportDeclaration,h.tokens[h.tokens.length-4].isType=!0,h.tokens[h.tokens.length-3].isType=!0,h.tokens[h.tokens.length-2].isType=!0,h.tokens[h.tokens.length-1].isType=!0}function Xk(){if(xe(),y(o.comma)||y(o.braceR)){h.tokens[h.tokens.length-1].identifierRole=ge.ExportAccess;return}if(xe(),y(o.comma)||y(o.braceR)){h.tokens[h.tokens.length-1].identifierRole=ge.ExportAccess,h.tokens[h.tokens.length-2].isType=!0,h.tokens[h.tokens.length-1].isType=!0;return}if(xe(),y(o.comma)||y(o.braceR)){h.tokens[h.tokens.length-3].identifierRole=ge.ExportAccess;return}xe(),h.tokens[h.tokens.length-3].identifierRole=ge.ExportAccess,h.tokens[h.tokens.length-4].isType=!0,h.tokens[h.tokens.length-3].isType=!0,h.tokens[h.tokens.length-2].isType=!0,h.tokens[h.tokens.length-1].isType=!0}function Kk(){if(me(S._abstract)&&et()===o._class)return h.type=o._abstract,G(),us(!0,!0),!0;if(me(S._interface)){const t=Ne(2);return Do(S._interface,!0),$e(t),!0}return!1}function Jk(){if(h.type===o._const){const t=Rr();if(t.type===o.name&&t.contextualKeyword===S._enum)return H(o._const),rt(S._enum),h.tokens[h.tokens.length-1].type=o._enum,Zl(),!0}return!1}function Yk(t){const e=h.tokens.length;Kl([S._abstract,S._readonly,S._declare,S._static,S._override]);const n=h.tokens.length;if(Y1()){const r=t?e-1:e;for(let i=r;i<n;i++)h.tokens[i].isType=!0;return!0}return!1}function Qk(t){Vk(t)||Je()}function Zk(){const t=ut(S._declare);t&&(h.tokens[h.tokens.length-1].type=o._declare);let e=!1;if(y(o.name))if(t){const n=Ne(2);e=rf(),$e(n)}else e=rf();if(!e)if(t){const n=Ne(2);Tt(!0),$e(n)}else Tt(!0)}function eE(t){if(t&&(y(o.lessThan)||y(o.bitShiftL))&&sc(),ut(S._implements)){h.tokens[h.tokens.length-1].type=o._implements;const e=Ne(1);nf(),$e(e)}}function tE(){os()}function nE(){os()}function sE(){const t=Ne(0);Et()||z(o.bang),Ms(),$e(t)}function rE(){y(o.colon)&&jr()}function iE(t,e){return So?oE(t,e):aE(t,e)}function oE(t,e){if(!y(o.lessThan))return nn(t,e);const n=h.snapshot();let s=nn(t,e);if(h.error)h.restoreFromSnapshot(n);else return s;return h.type=o.typeParameterStart,To(),s=nn(t,e),s||Ie(),s}function aE(t,e){if(!y(o.lessThan))return nn(t,e);const n=h.snapshot();To();const s=nn(t,e);if(s||Ie(),h.error)h.restoreFromSnapshot(n);else return s;return nn(t,e)}function lE(){if(y(o.colon)){const t=h.snapshot();Br(o.colon),Ct()&&Ie(),y(o.arrow)||Ie(),h.error&&h.restoreFromSnapshot(t)}return z(o.arrow)}function cE(){const t=Ne(0);z(o.question),Ms(),$e(t)}function uE(){(y(o.lessThan)||y(o.bitShiftL))&&sc(),$f()}function hE(){let t=!1,e=!1;for(;;){if(h.pos>=re.length){Ie("Unterminated JSX contents");return}const n=re.charCodeAt(h.pos);if(n===P.lessThan||n===P.leftCurlyBrace){if(h.pos===h.start){if(n===P.lessThan){h.pos++,ve(o.jsxTagStart);return}v1(n);return}ve(t&&!e?o.jsxEmptyText:o.jsxText);return}n===P.lineFeed?t=!0:n!==P.space&&n!==P.carriageReturn&&n!==P.tab&&(e=!0),h.pos++}}function dE(t){for(h.pos++;;){if(h.pos>=re.length){Ie("Unterminated string constant");return}if(re.charCodeAt(h.pos)===t){h.pos++;break}h.pos++}ve(o.string)}function pE(){let t;do{if(h.pos>re.length){Ie("Unexpectedly reached the end of input.");return}t=re.charCodeAt(++h.pos)}while(jt[t]||t===P.dash);ve(o.jsxName)}function rc(){Ot()}function af(t){if(rc(),!z(o.colon)){h.tokens[h.tokens.length-1].identifierRole=t;return}rc()}function lf(){const t=h.tokens.length;af(ge.Access);let e=!1;for(;y(o.dot);)e=!0,Ot(),rc();if(!e){const n=h.tokens[t],s=re.charCodeAt(n.start);s>=P.lowercaseA&&s<=P.lowercaseZ&&(n.identifierRole=null)}}function fE(){switch(h.type){case o.braceL:G(),mt(),Ot();return;case o.jsxTagStart:uf(),Ot();return;case o.string:Ot();return;default:Ie("JSX value should be either an expression or a quoted JSX text")}}function mE(){H(o.ellipsis),mt()}function gE(t){if(y(o.jsxTagEnd))return!1;lf(),De&&Rk();let e=!1;for(;!y(o.slash)&&!y(o.jsxTagEnd)&&!h.error;){if(z(o.braceL)){e=!0,H(o.ellipsis),gt(),Ot();continue}e&&h.end-h.start===3&&re.charCodeAt(h.start)===P.lowercaseK&&re.charCodeAt(h.start+1)===P.lowercaseE&&re.charCodeAt(h.start+2)===P.lowercaseY&&(h.tokens[t].jsxRole=zt.KeyAfterPropSpread),af(ge.ObjectKey),y(o.eq)&&(Ot(),fE())}const n=y(o.slash);return n&&Ot(),n}function yE(){y(o.jsxTagEnd)||lf()}function cf(){const t=h.tokens.length-1;h.tokens[t].jsxRole=zt.NoChildren;let e=0;if(!gE(t))for(js();;)switch(h.type){case o.jsxTagStart:if(Ot(),y(o.slash)){Ot(),yE(),h.tokens[t].jsxRole!==zt.KeyAfterPropSpread&&(e===1?h.tokens[t].jsxRole=zt.OneChild:e>1&&(h.tokens[t].jsxRole=zt.StaticChildren));return}e++,cf(),js();break;case o.jsxText:e++,js();break;case o.jsxEmptyText:js();break;case o.braceL:G(),y(o.ellipsis)?(mE(),js(),e+=2):(y(o.braceR)||(e++,mt()),js());break;default:Ie();return}}function uf(){Ot(),cf()}function Ot(){h.tokens.push(new Io),w1(),h.start=h.pos;const t=re.charCodeAt(h.pos);if(Tr[t])pE();else if(t===P.quotationMark||t===P.apostrophe)dE(t);else switch(++h.pos,t){case P.greaterThan:ve(o.jsxTagEnd);break;case P.lessThan:ve(o.jsxTagStart);break;case P.slash:ve(o.slash);break;case P.equalsTo:ve(o.eq);break;case P.leftCurlyBrace:ve(o.braceL);break;case P.dot:ve(o.dot);break;case P.colon:ve(o.colon);break;default:Ie()}}function js(){h.tokens.push(new Io),h.start=h.pos,hE()}function bE(t){if(y(o.question)){const e=et();if(e===o.colon||e===o.comma||e===o.parenR)return}hf(t)}function xE(){b1(o.question),y(o.colon)&&(De?jr():Be&&ls())}class kE{constructor(e){this.stop=e}}function mt(t=!1){if(gt(t),y(o.comma))for(;z(o.comma);)gt(t)}function gt(t=!1,e=!1){return De?iE(t,e):Be?IA(t,e):nn(t,e)}function nn(t,e){if(y(o._yield))return LE(),!1;(y(o.parenL)||y(o.name)||y(o._yield))&&(h.potentialArrowAt=h.start);const n=EE(t);return e&&cc(),h.type&o.IS_ASSIGN?(G(),gt(t),!1):n}function EE(t){return wE(t)?!0:(AE(t),!1)}function AE(t){De||Be?bE(t):hf(t)}function hf(t){z(o.question)&&(gt(),H(o.colon),gt(t))}function wE(t){const e=h.tokens.length;return zr()?!0:(Oo(e,-1,t),!1)}function Oo(t,e,n){if(De&&(o._in&o.PRECEDENCE_MASK)>e&&!Et()&&(ut(S._as)||ut(S._satisfies))){const r=Ne(1);tt(),$e(r),I1(),Oo(t,e,n);return}const s=h.type&o.PRECEDENCE_MASK;if(s>0&&(!n||!y(o._in))&&s>e){const r=h.type;G(),r===o.nullishCoalescing&&(h.tokens[h.tokens.length-1].nullishStartIndex=t);const i=h.tokens.length;zr(),Oo(i,r&o.IS_RIGHT_ASSOCIATIVE?s-1:s,n),r===o.nullishCoalescing&&(h.tokens[t].numNullishCoalesceStarts++,h.tokens[h.tokens.length-1].numNullishCoalesceEnds++),Oo(t,e,n)}}function zr(){if(De&&!So&&z(o.lessThan))return Tk(),!1;if(me(S._module)&&k1()===P.leftCurlyBrace&&!h1())return ME(),!1;if(h.type&o.IS_PREFIX)return G(),zr(),!1;if(df())return!0;for(;h.type&o.IS_POSTFIX&&!Ct();)h.type===o.preIncDec&&(h.type=o.postIncDec),G();return!1}function df(){const t=h.tokens.length;return yn()?!0:(ic(t),h.tokens.length>t&&h.tokens[t].isOptionalChainStart&&(h.tokens[h.tokens.length-1].isOptionalChainEnd=!0),!1)}function ic(t,e=!1){Be?_A(t,e):pf(t,e)}function pf(t,e=!1){const n=new kE(!1);do SE(t,e,n);while(!n.stop&&!h.error)}function SE(t,e,n){De?Hk(t,e,n):Be?aA(t,e,n):oc(t,e,n)}function oc(t,e,n){if(!e&&z(o.doubleColon))ac(),n.stop=!0,ic(t,e);else if(y(o.questionDot)){if(h.tokens[t].isOptionalChainStart=!0,e&&et()===o.parenL){n.stop=!0;return}G(),h.tokens[h.tokens.length-1].subscriptStartIndex=t,z(o.bracketL)?(mt(),H(o.bracketR)):z(o.parenL)?Cn():Lo()}else if(z(o.dot))h.tokens[h.tokens.length-1].subscriptStartIndex=t,Lo();else if(z(o.bracketL))h.tokens[h.tokens.length-1].subscriptStartIndex=t,mt(),H(o.bracketR);else if(!e&&y(o.parenL))if(ff()){const s=h.snapshot(),r=h.tokens.length;G(),h.tokens[h.tokens.length-1].subscriptStartIndex=t;const i=Cr();h.tokens[h.tokens.length-1].contextId=i,Cn(),h.tokens[h.tokens.length-1].contextId=i,IE()&&(h.restoreFromSnapshot(s),n.stop=!0,h.scopeDepth++,Vs(),vE(r))}else{G(),h.tokens[h.tokens.length-1].subscriptStartIndex=t;const s=Cr();h.tokens[h.tokens.length-1].contextId=s,Cn(),h.tokens[h.tokens.length-1].contextId=s}else y(o.backQuote)?uc():n.stop=!0}function ff(){return h.tokens[h.tokens.length-1].contextualKeyword===S._async&&!Ct()}function Cn(){let t=!0;for(;!z(o.parenR)&&!h.error;){if(t)t=!1;else if(H(o.comma),z(o.parenR))break;bf(!1)}}function IE(){return y(o.colon)||y(o.arrow)}function vE(t){De?rE():Be&&SA(),H(o.arrow),Ur(t)}function ac(){const t=h.tokens.length;yn(),ic(t,!0)}function yn(){if(z(o.modulo))return xe(),!1;if(y(o.jsxText)||y(o.jsxEmptyText))return zs(),!1;if(y(o.lessThan)&&So)return h.type=o.jsxTagStart,uf(),G(),!1;const t=h.potentialArrowAt===h.start;switch(h.type){case o.slash:case o.assign:Qb();case o._super:case o._this:case o.regexp:case o.num:case o.bigint:case o.decimal:case o.string:case o._null:case o._true:case o._false:return G(),!1;case o._import:return G(),y(o.dot)&&(h.tokens[h.tokens.length-1].type=o.name,G(),xe()),!1;case o.name:{const e=h.tokens.length,n=h.start,s=h.contextualKeyword;return xe(),s===S._await?(OE(),!1):s===S._async&&y(o._function)&&!Ct()?(G(),cs(n,!1),!1):t&&s===S._async&&!Ct()&&y(o.name)?(h.scopeDepth++,$n(!1),H(o.arrow),Ur(e),!0):y(o._do)&&!Ct()?(G(),Tn(),!1):t&&!Ct()&&y(o.arrow)?(h.scopeDepth++,Gl(!1),H(o.arrow),Ur(e),!0):(h.tokens[h.tokens.length-1].identifierRole=ge.Access,!1)}case o._do:return G(),Tn(),!1;case o.parenL:return mf(t);case o.bracketL:return G(),yf(o.bracketR,!0),!1;case o.braceL:return hc(!1,!1),!1;case o._function:return _E(),!1;case o.at:wc();case o._class:return us(!1),!1;case o._new:return $E(),!1;case o.backQuote:return uc(),!1;case o.doubleColon:return G(),ac(),!1;case o.hash:{const e=k1();return Tr[e]||e===P.backslash?Lo():G(),!1}default:return Ie(),!1}}function Lo(){z(o.hash),xe()}function _E(){const t=h.start;xe(),z(o.dot)&&xe(),cs(t,!1)}function zs(){G()}function Mo(){H(o.parenL),mt(),H(o.parenR)}function mf(t){const e=h.snapshot(),n=h.tokens.length;H(o.parenL);let s=!0;for(;!y(o.parenR)&&!h.error;){if(s)s=!1;else if(H(o.comma),y(o.parenR))break;if(y(o.ellipsis)){H1(!1),cc();break}else gt(!1,!0)}return H(o.parenR),t&&PE()&&lc()?(h.restoreFromSnapshot(e),h.scopeDepth++,Vs(),lc(),Ur(n),h.error?(h.restoreFromSnapshot(e),mf(!1),!1):!0):!1}function PE(){return y(o.colon)||!Ct()}function lc(){return De?lE():Be?vA():z(o.arrow)}function cc(){(De||Be)&&xE()}function $E(){if(H(o._new),z(o.dot)){xe();return}NE(),Be&&lA(),z(o.parenL)&&yf(o.parenR)}function NE(){ac(),z(o.questionDot)}function uc(){for(Pn(),Pn();!y(o.backQuote)&&!h.error;)H(o.dollarBraceL),mt(),Pn(),Pn();G()}function hc(t,e){const n=Cr();let s=!0;for(G(),h.tokens[h.tokens.length-1].contextId=n;!z(o.braceR)&&!h.error;){if(s)s=!1;else if(H(o.comma),z(o.braceR))break;let r=!1;if(y(o.ellipsis)){const i=h.tokens.length;if(q1(),t&&(h.tokens.length===i+2&&Gl(e),z(o.braceR)))break;continue}t||(r=z(o.star)),!t&&me(S._async)?(r&&Ie(),xe(),y(o.colon)||y(o.parenL)||y(o.braceR)||y(o.eq)||y(o.comma)||(y(o.star)&&(G(),r=!0),Vr(n))):Vr(n),DE(t,e,n)}h.tokens[h.tokens.length-1].contextId=n}function CE(t){return!t&&(y(o.string)||y(o.num)||y(o.bracketL)||y(o.name)||!!(h.type&o.IS_KEYWORD))}function TE(t,e){const n=h.start;return y(o.parenL)?(t&&Ie(),dc(n,!1),!0):CE(t)?(Vr(e),dc(n,!1),!0):!1}function RE(t,e){if(z(o.colon)){t?Co(e):gt(!1);return}let n;t?h.scopeDepth===0?n=ge.ObjectShorthandTopLevelDeclaration:e?n=ge.ObjectShorthandBlockScopedDeclaration:n=ge.ObjectShorthandFunctionScopedDeclaration:n=ge.ObjectShorthand,h.tokens[h.tokens.length-1].identifierRole=n,Co(e,!0)}function DE(t,e,n){De?tE():Be&&bA(),TE(t,n)||RE(t,e)}function Vr(t){Be&&Ac(),z(o.bracketL)?(h.tokens[h.tokens.length-1].contextId=t,gt(),H(o.bracketR),h.tokens[h.tokens.length-1].contextId=t):(y(o.num)||y(o.string)||y(o.bigint)||y(o.decimal)?yn():Lo(),h.tokens[h.tokens.length-1].identifierRole=ge.ObjectKey,h.tokens[h.tokens.length-1].contextId=t)}function dc(t,e){const n=Cr();h.scopeDepth++;const s=h.tokens.length;Vs(e,n),gf(t,n);const i=h.tokens.length;h.scopes.push(new en(s,i,!0)),h.scopeDepth--}function Ur(t){qr(!0);const e=h.tokens.length;h.scopes.push(new en(t,e,!0)),h.scopeDepth--}function gf(t,e=0){De?qk(t,e):Be?oA(e):qr(!1,e)}function qr(t,e=0){t&&!y(o.braceL)?gt():Tn(!0,e)}function yf(t,e=!1){let n=!0;for(;!z(t)&&!h.error;){if(n)n=!1;else if(H(o.comma),z(t))break;bf(e)}}function bf(t){t&&y(o.comma)||(y(o.ellipsis)?(q1(),cc()):y(o.question)?G():gt(!1,!0))}function xe(){G(),h.tokens[h.tokens.length-1].type=o.name}function OE(){zr()}function LE(){G(),!y(o.semi)&&!Ct()&&(z(o.star),gt())}function ME(){rt(S._module),H(o.braceL),Uo(o.braceR)}function FE(t){return(t.type===o.name||!!(t.type&o.IS_KEYWORD))&&t.contextualKeyword!==S._from}function sn(t){const e=Ne(0);H(t||o.colon),_t(),$e(e)}function xf(){H(o.modulo),rt(S._checks),z(o.parenL)&&(mt(),H(o.parenR))}function pc(){const t=Ne(0);H(o.colon),y(o.modulo)?xf():(_t(),y(o.modulo)&&xf()),$e(t)}function BE(){G(),mc(!0)}function jE(){G(),xe(),y(o.lessThan)&&qt(),H(o.parenL),Ec(),H(o.parenR),pc(),Je()}function fc(){y(o._class)?BE():y(o._function)?jE():y(o._var)?zE():ut(S._module)?z(o.dot)?qE():VE():me(S._type)?HE():me(S._opaque)?GE():me(S._interface)?WE():y(o._export)?UE():Ie()}function zE(){G(),If(),Je()}function VE(){for(y(o.string)?yn():xe(),H(o.braceL);!y(o.braceR)&&!h.error;)y(o._import)?(G(),Mf()):Ie();H(o.braceR)}function UE(){H(o._export),z(o._default)?y(o._function)||y(o._class)?fc():(_t(),Je()):y(o._var)||y(o._function)||y(o._class)||me(S._opaque)?fc():y(o.star)||y(o.braceL)||me(S._interface)||me(S._type)||me(S._opaque)?Of():Ie()}function qE(){rt(S._exports),ls(),Je()}function HE(){G(),yc()}function GE(){G(),bc(!0)}function WE(){G(),mc()}function mc(t=!1){if(Bo(),y(o.lessThan)&&qt(),z(o._extends))do Fo();while(!t&&z(o.comma));if(me(S._mixins)){G();do Fo();while(z(o.comma))}if(me(S._implements)){G();do Fo();while(z(o.comma))}jo(t,!1,t)}function Fo(){kf(!1),y(o.lessThan)&&as()}function gc(){mc()}function Bo(){xe()}function yc(){Bo(),y(o.lessThan)&&qt(),sn(o.eq),Je()}function bc(t){rt(S._type),Bo(),y(o.lessThan)&&qt(),y(o.colon)&&sn(o.colon),t||sn(o.eq),Je()}function XE(){Ac(),If(),z(o.eq)&&_t()}function qt(){const t=Ne(0);y(o.lessThan)||y(o.typeParameterStart)?G():Ie();do XE(),y(o.greaterThan)||H(o.comma);while(!y(o.greaterThan)&&!h.error);H(o.greaterThan),$e(t)}function as(){const t=Ne(0);for(H(o.lessThan);!y(o.greaterThan)&&!h.error;)_t(),y(o.greaterThan)||H(o.comma);H(o.greaterThan),$e(t)}function KE(){if(rt(S._interface),z(o._extends))do Fo();while(z(o.comma));jo(!1,!1,!1)}function xc(){y(o.num)||y(o.string)?yn():xe()}function JE(){et()===o.colon?(xc(),sn()):_t(),H(o.bracketR),sn()}function YE(){xc(),H(o.bracketR),H(o.bracketR),y(o.lessThan)||y(o.parenL)?kc():(z(o.question),sn())}function kc(){for(y(o.lessThan)&&qt(),H(o.parenL);!y(o.parenR)&&!y(o.ellipsis)&&!h.error;)zo(),y(o.parenR)||H(o.comma);z(o.ellipsis)&&zo(),H(o.parenR),sn()}function QE(){kc()}function jo(t,e,n){let s;for(e&&y(o.braceBarL)?(H(o.braceBarL),s=o.braceBarR):(H(o.braceL),s=o.braceR);!y(s)&&!h.error;){if(n&&me(S._proto)){const r=et();r!==o.colon&&r!==o.question&&(G(),t=!1)}if(t&&me(S._static)){const r=et();r!==o.colon&&r!==o.question&&G()}if(Ac(),z(o.bracketL))z(o.bracketL)?YE():JE();else if(y(o.parenL)||y(o.lessThan))QE();else{if(me(S._get)||me(S._set)){const r=et();(r===o.name||r===o.string||r===o.num)&&G()}ZE()}eA()}H(s)}function ZE(){if(y(o.ellipsis)){if(H(o.ellipsis),z(o.comma)||z(o.semi),y(o.braceR))return;_t()}else xc(),y(o.lessThan)||y(o.parenL)?kc():(z(o.question),sn())}function eA(){!z(o.semi)&&!z(o.comma)&&!y(o.braceR)&&!y(o.braceBarR)&&Ie()}function kf(t){for(t||xe();z(o.dot);)xe()}function tA(){kf(!0),y(o.lessThan)&&as()}function nA(){H(o._typeof),Ef()}function sA(){for(H(o.bracketL);h.pos<re.length&&!y(o.bracketR)&&(_t(),!y(o.bracketR));)H(o.comma);H(o.bracketR)}function zo(){const t=et();t===o.colon||t===o.question?(xe(),z(o.question),sn()):_t()}function Ec(){for(;!y(o.parenR)&&!y(o.ellipsis)&&!h.error;)zo(),y(o.parenR)||H(o.comma);z(o.ellipsis)&&zo()}function Ef(){let t=!1;const e=h.noAnonFunctionType;switch(h.type){case o.name:{if(me(S._interface)){KE();return}xe(),tA();return}case o.braceL:jo(!1,!1,!1);return;case o.braceBarL:jo(!1,!0,!1);return;case o.bracketL:sA();return;case o.lessThan:qt(),H(o.parenL),Ec(),H(o.parenR),H(o.arrow),_t();return;case o.parenL:if(G(),!y(o.parenR)&&!y(o.ellipsis))if(y(o.name)){const n=et();t=n!==o.question&&n!==o.colon}else t=!0;if(t)if(h.noAnonFunctionType=!1,_t(),h.noAnonFunctionType=e,h.noAnonFunctionType||!(y(o.comma)||y(o.parenR)&&et()===o.arrow)){H(o.parenR);return}else z(o.comma);Ec(),H(o.parenR),H(o.arrow),_t();return;case o.minus:G(),zs();return;case o.string:case o.num:case o._true:case o._false:case o._null:case o._this:case o._void:case o.star:G();return;default:if(h.type===o._typeof){nA();return}else if(h.type&o.IS_KEYWORD){G(),h.tokens[h.tokens.length-1].type=o.name;return}}Ie()}function rA(){for(Ef();!Ct()&&(y(o.bracketL)||y(o.questionDot));)z(o.questionDot),H(o.bracketL),z(o.bracketR)||(_t(),H(o.bracketR))}function Af(){z(o.question)?Af():rA()}function wf(){Af(),!h.noAnonFunctionType&&z(o.arrow)&&_t()}function Sf(){for(z(o.bitwiseAND),wf();z(o.bitwiseAND);)wf()}function iA(){for(z(o.bitwiseOR),Sf();z(o.bitwiseOR);)Sf()}function _t(){iA()}function ls(){sn()}function If(){xe(),y(o.colon)&&ls()}function Ac(){(y(o.plus)||y(o.minus))&&(G(),h.tokens[h.tokens.length-1].isType=!0)}function oA(t){y(o.colon)&&pc(),qr(!1,t)}function aA(t,e,n){if(y(o.questionDot)&&et()===o.lessThan){if(e){n.stop=!0;return}G(),as(),H(o.parenL),Cn();return}else if(!e&&y(o.lessThan)){const s=h.snapshot();if(as(),H(o.parenL),Cn(),h.error)h.restoreFromSnapshot(s);else return}oc(t,e,n)}function lA(){if(y(o.lessThan)){const t=h.snapshot();as(),h.error&&h.restoreFromSnapshot(t)}}function cA(){if(y(o.name)&&h.contextualKeyword===S._interface){const t=Ne(0);return G(),gc(),$e(t),!0}else if(me(S._enum))return vf(),!0;return!1}function uA(){return me(S._enum)?(vf(),!0):!1}function hA(t){if(t===S._declare){if(y(o._class)||y(o.name)||y(o._function)||y(o._var)||y(o._export)){const e=Ne(1);fc(),$e(e)}}else if(y(o.name)){if(t===S._interface){const e=Ne(1);gc(),$e(e)}else if(t===S._type){const e=Ne(1);yc(),$e(e)}else if(t===S._opaque){const e=Ne(1);bc(!1),$e(e)}}Je()}function dA(){return me(S._type)||me(S._interface)||me(S._opaque)||me(S._enum)}function pA(){return y(o.name)&&(h.contextualKeyword===S._type||h.contextualKeyword===S._interface||h.contextualKeyword===S._opaque||h.contextualKeyword===S._enum)}function fA(){if(me(S._type)){const t=Ne(1);G(),y(o.braceL)?(vc(),Wr()):yc(),$e(t)}else if(me(S._opaque)){const t=Ne(1);G(),bc(!1),$e(t)}else if(me(S._interface)){const t=Ne(1);G(),gc(),$e(t)}else Tt(!0)}function mA(){return y(o.star)||me(S._type)&&et()===o.star}function gA(){if(ut(S._type)){const t=Ne(2);Ic(),$e(t)}else Ic()}function yA(t){if(t&&y(o.lessThan)&&as(),me(S._implements)){const e=Ne(0);G(),h.tokens[h.tokens.length-1].type=o._implements;do Bo(),y(o.lessThan)&&as();while(z(o.comma));$e(e)}}function bA(){y(o.lessThan)&&(qt(),y(o.parenL)||Ie())}function xA(){const t=Ne(0);z(o.question),y(o.colon)&&ls(),$e(t)}function kA(){if(y(o._typeof)||me(S._type)){const t=Rr();(FE(t)||t.type===o.braceL||t.type===o.star)&&G()}}function EA(){const t=h.contextualKeyword===S._type||h.type===o._typeof;t?G():xe(),me(S._as)&&!Bl(S._as)?(xe(),t&&!y(o.name)&&!(h.type&o.IS_KEYWORD)||xe()):(t&&(y(o.name)||h.type&o.IS_KEYWORD)&&xe(),ut(S._as)&&xe())}function AA(){if(y(o.lessThan)){const t=Ne(0);qt(),$e(t)}}function wA(){y(o.colon)&&ls()}function SA(){if(y(o.colon)){const t=h.noAnonFunctionType;h.noAnonFunctionType=!0,ls(),h.noAnonFunctionType=t}}function IA(t,e){if(y(o.lessThan)){const n=h.snapshot();let s=nn(t,e);if(h.error)h.restoreFromSnapshot(n),h.type=o.typeParameterStart;else return s;const r=Ne(0);if(qt(),$e(r),s=nn(t,e),s)return!0;Ie()}return nn(t,e)}function vA(){if(y(o.colon)){const t=Ne(0),e=h.snapshot(),n=h.noAnonFunctionType;h.noAnonFunctionType=!0,pc(),h.noAnonFunctionType=n,Ct()&&Ie(),y(o.arrow)||Ie(),h.error&&h.restoreFromSnapshot(e),$e(t)}return z(o.arrow)}function _A(t,e=!1){if(h.tokens[h.tokens.length-1].contextualKeyword===S._async&&y(o.lessThan)){const n=h.snapshot();if(PA()&&!h.error)return;h.restoreFromSnapshot(n)}pf(t,e)}function PA(){h.scopeDepth++;const t=h.tokens.length;return Vs(),lc()?(Ur(t),!0):!1}function vf(){rt(S._enum),h.tokens[h.tokens.length-1].type=o._enum,xe(),$A()}function $A(){ut(S._of)&&G(),H(o.braceL),NA(),H(o.braceR)}function NA(){for(;!y(o.braceR)&&!h.error&&!z(o.ellipsis);)CA(),y(o.braceR)||H(o.comma)}function CA(){xe(),z(o.eq)&&G()}function TA(){if(Uo(o.eof),h.scopes.push(new en(0,h.tokens.length,!0)),h.scopeDepth!==0)throw new Error(`Invalid scope depth at end of file: ${h.scopeDepth}`);return new bw(h.tokens,h.scopes)}function Tt(t){Be&&cA()||(y(o.at)&&wc(),RA(t))}function RA(t){if(De&&Jk())return;const e=h.type;switch(e){case o._break:case o._continue:OA();return;case o._debugger:LA();return;case o._do:MA();return;case o._for:FA();return;case o._function:if(et()===o.dot)break;t||Ie(),zA();return;case o._class:t||Ie(),us(!0);return;case o._if:VA();return;case o._return:UA();return;case o._switch:qA();return;case o._throw:HA();return;case o._try:WA();return;case o._let:case o._const:t||Ie();case o._var:Vo(e!==o._var);return;case o._while:XA();return;case o.braceL:Tn();return;case o.semi:KA();return;case o._export:case o._import:{const r=et();if(r===o.parenL||r===o.dot)break;G(),e===o._import?Mf():Of();return}case o.name:if(h.contextualKeyword===S._async){const r=h.start,i=h.snapshot();if(G(),y(o._function)&&!Ct()){H(o._function),cs(r,!0);return}else h.restoreFromSnapshot(i)}else if(h.contextualKeyword===S._using&&!h1()&&et()===o.name){Vo(!0);return}else if(_f()){rt(S._await),Vo(!0);return}}const n=h.tokens.length;mt();let s=null;if(h.tokens.length===n+1){const r=h.tokens[h.tokens.length-1];r.type===o.name&&(s=r.contextualKeyword)}if(s==null){Je();return}z(o.colon)?JA():YA(s)}function _f(){if(!me(S._await))return!1;const t=h.snapshot();return G(),!me(S._using)||Et()||(G(),!y(o.name)||Et())?(h.restoreFromSnapshot(t),!1):(h.restoreFromSnapshot(t),!0)}function wc(){for(;y(o.at);)Pf()}function Pf(){if(G(),z(o.parenL))mt(),H(o.parenR);else{for(xe();z(o.dot);)xe();DA()}}function DA(){De?uE():$f()}function $f(){z(o.parenL)&&Cn()}function OA(){G(),tn()||(xe(),Je())}function LA(){G(),Je()}function MA(){G(),Tt(!1),H(o._while),Mo(),z(o.semi)}function FA(){h.scopeDepth++;const t=h.tokens.length;jA();const e=h.tokens.length;h.scopes.push(new en(t,e,!1)),h.scopeDepth--}function BA(){return!(!me(S._using)||Bl(S._of))}function jA(){G();let t=!1;if(me(S._await)&&(t=!0,G()),H(o.parenL),y(o.semi)){t&&Ie(),Sc();return}const e=_f();if(e||y(o._var)||y(o._let)||y(o._const)||BA()){if(e&&rt(S._await),G(),Cf(!0,h.type!==o._var),y(o._in)||me(S._of)){Nf(t);return}Sc();return}if(mt(!0),y(o._in)||me(S._of)){Nf(t);return}t&&Ie(),Sc()}function zA(){const t=h.start;G(),cs(t,!0)}function VA(){G(),Mo(),Tt(!1),z(o._else)&&Tt(!1)}function UA(){G(),tn()||(mt(),Je())}function qA(){G(),Mo(),h.scopeDepth++;const t=h.tokens.length;for(H(o.braceL);!y(o.braceR)&&!h.error;)if(y(o._case)||y(o._default)){const n=y(o._case);G(),n&&mt(),H(o.colon)}else Tt(!0);G();const e=h.tokens.length;h.scopes.push(new en(t,e,!1)),h.scopeDepth--}function HA(){G(),mt(),Je()}function GA(){No(!0),De&&Ms()}function WA(){if(G(),Tn(),y(o._catch)){G();let t=null;if(y(o.parenL)&&(h.scopeDepth++,t=h.tokens.length,H(o.parenL),GA(),H(o.parenR)),Tn(),t!=null){const e=h.tokens.length;h.scopes.push(new en(t,e,!1)),h.scopeDepth--}}z(o._finally)&&Tn()}function Vo(t){G(),Cf(!1,t),Je()}function XA(){G(),Mo(),Tt(!1)}function KA(){G()}function JA(){Tt(!0)}function YA(t){De?Qk(t):Be?hA(t):Je()}function Tn(t=!1,e=0){const n=h.tokens.length;h.scopeDepth++,H(o.braceL),e&&(h.tokens[h.tokens.length-1].contextId=e),Uo(o.braceR),e&&(h.tokens[h.tokens.length-1].contextId=e);const s=h.tokens.length;h.scopes.push(new en(n,s,t)),h.scopeDepth--}function Uo(t){for(;!z(t)&&!h.error;)Tt(!0)}function Sc(){H(o.semi),y(o.semi)||mt(),H(o.semi),y(o.parenR)||mt(),H(o.parenR),Tt(!1)}function Nf(t){t?ut(S._of):G(),mt(),H(o.parenR),Tt(!1)}function Cf(t,e){for(;;){if(QA(e),z(o.eq)){const n=h.tokens.length-1;gt(t),h.tokens[n].rhsEndIndex=h.tokens.length}if(!z(o.comma))break}}function QA(t){No(t),De?sE():Be&&wA()}function cs(t,e,n=!1){y(o.star)&&G(),e&&!n&&!y(o.name)&&!y(o._yield)&&Ie();let s=null;y(o.name)&&(e||(s=h.tokens.length,h.scopeDepth++),$n(!1));const r=h.tokens.length;h.scopeDepth++,Vs(),gf(t);const i=h.tokens.length;h.scopes.push(new en(r,i,!0)),h.scopeDepth--,s!==null&&(h.scopes.push(new en(s,i,!0)),h.scopeDepth--)}function Vs(t=!1,e=0){De?nE():Be&&AA(),H(o.parenL),e&&(h.tokens[h.tokens.length-1].contextId=e),Wl(o.parenR,!1,!1,t,e),e&&(h.tokens[h.tokens.length-1].contextId=e)}function us(t,e=!1){const n=Cr();G(),h.tokens[h.tokens.length-1].contextId=n,h.tokens[h.tokens.length-1].isExpression=!t;let s=null;t||(s=h.tokens.length,h.scopeDepth++),nw(t,e),sw();const r=h.tokens.length;if(ZA(n),!h.error&&(h.tokens[r].contextId=n,h.tokens[h.tokens.length-1].contextId=n,s!==null)){const i=h.tokens.length;h.scopes.push(new en(s,i,!1)),h.scopeDepth--}}function Tf(){return y(o.eq)||y(o.semi)||y(o.braceR)||y(o.bang)||y(o.colon)}function Rf(){return y(o.parenL)||y(o.lessThan)}function ZA(t){for(H(o.braceL);!z(o.braceR)&&!h.error;){if(z(o.semi))continue;if(y(o.at)){Pf();continue}const e=h.start;ew(e,t)}}function ew(t,e){De&&Kl([S._declare,S._public,S._protected,S._private,S._override]);let n=!1;if(y(o.name)&&h.contextualKeyword===S._static){if(xe(),Rf()){Hr(t,!1);return}else if(Tf()){qo();return}if(h.tokens[h.tokens.length-1].type=o._static,n=!0,y(o.braceL)){h.tokens[h.tokens.length-1].contextId=e,Tn();return}}tw(t,n,e)}function tw(t,e,n){if(De&&Yk(e))return;if(z(o.star)){Gr(n),Hr(t,!1);return}Gr(n);let s=!1;const r=h.tokens[h.tokens.length-1];r.contextualKeyword===S._constructor&&(s=!0),Df(),Rf()?Hr(t,s):Tf()?qo():r.contextualKeyword===S._async&&!tn()?(h.tokens[h.tokens.length-1].type=o._async,y(o.star)&&G(),Gr(n),Df(),Hr(t,!1)):(r.contextualKeyword===S._get||r.contextualKeyword===S._set)&&!(tn()&&y(o.star))?(r.contextualKeyword===S._get?h.tokens[h.tokens.length-1].type=o._get:h.tokens[h.tokens.length-1].type=o._set,Gr(n),Hr(t,!1)):r.contextualKeyword===S._accessor&&!tn()?(Gr(n),qo()):tn()?qo():Ie()}function Hr(t,e){De?os():Be&&y(o.lessThan)&&qt(),dc(t,e)}function Gr(t){Vr(t)}function Df(){if(De){const t=Ne(0);z(o.question),$e(t)}}function qo(){if(De?(b1(o.bang),Ms()):Be&&y(o.colon)&&ls(),y(o.eq)){const t=h.tokens.length;G(),gt(),h.tokens[t].rhsEndIndex=h.tokens.length}Je()}function nw(t,e=!1){De&&(!t||e)&&me(S._implements)||(y(o.name)&&$n(!0),De?os():Be&&y(o.lessThan)&&qt())}function sw(){let t=!1;z(o._extends)?(df(),t=!0):t=!1,De?eE(t):Be&&yA(t)}function Of(){const t=h.tokens.length-1;De&&Gk()||(aw()?lw():ow()?(xe(),y(o.comma)&&et()===o.star?(H(o.comma),H(o.star),rt(S._as),xe()):Lf(),Wr()):z(o._default)?rw():uw()?iw():(vc(),Wr()),h.tokens[t].rhsEndIndex=h.tokens.length)}function rw(){if(De&&Kk()||Be&&uA())return;const t=h.start;z(o._function)?cs(t,!0,!0):me(S._async)&&et()===o._function?(ut(S._async),z(o._function),cs(t,!0,!0)):y(o._class)?us(!0,!0):y(o.at)?(wc(),us(!0,!0)):(gt(),Je())}function iw(){De?Zk():Be?fA():Tt(!0)}function ow(){if(De&&of())return!1;if(Be&&pA())return!1;if(y(o.name))return h.contextualKeyword!==S._async;if(!y(o._default))return!1;const t=jl(),e=Rr(),n=e.type===o.name&&e.contextualKeyword===S._from;if(e.type===o.comma)return!0;if(n){const s=re.charCodeAt(x1(t+4));return s===P.quotationMark||s===P.apostrophe}return!1}function Lf(){z(o.comma)&&vc()}function Wr(){ut(S._from)&&(yn(),Bf()),Je()}function aw(){return Be?mA():y(o.star)}function lw(){Be?gA():Ic()}function Ic(){H(o.star),me(S._as)?cw():Wr()}function cw(){G(),h.tokens[h.tokens.length-1].type=o._as,xe(),Lf(),Wr()}function uw(){return De&&of()||Be&&dA()||h.type===o._var||h.type===o._const||h.type===o._let||h.type===o._function||h.type===o._class||me(S._async)||y(o.at)}function vc(){let t=!0;for(H(o.braceL);!z(o.braceR)&&!h.error;){if(t)t=!1;else if(H(o.comma),z(o.braceR))break;hw()}}function hw(){if(De){Xk();return}xe(),h.tokens[h.tokens.length-1].identifierRole=ge.ExportAccess,ut(S._as)&&xe()}function dw(){const t=h.snapshot();return rt(S._module),ut(S._from)?me(S._from)?(h.restoreFromSnapshot(t),!0):(h.restoreFromSnapshot(t),!1):y(o.comma)?(h.restoreFromSnapshot(t),!1):(h.restoreFromSnapshot(t),!0)}function pw(){me(S._module)&&dw()&&G()}function Mf(){if(De&&y(o.name)&&et()===o.eq){nc();return}if(De&&me(S._type)){const t=Rr();if(t.type===o.name&&t.contextualKeyword!==S._from){if(rt(S._type),et()===o.eq){nc();return}}else(t.type===o.star||t.type===o.braceL)&&rt(S._type)}y(o.string)||(pw(),mw(),rt(S._from)),yn(),Bf(),Je()}function fw(){return y(o.name)}function Ff(){$o()}function mw(){Be&&kA();let t=!0;if(!(fw()&&(Ff(),!z(o.comma)))){if(y(o.star)){G(),rt(S._as),Ff();return}for(H(o.braceL);!z(o.braceR)&&!h.error;){if(t)t=!1;else if(z(o.colon)&&Ie("ES2015 named imports do not destructure. Use another statement for destructuring after the import."),H(o.comma),z(o.braceR))break;gw()}}}function gw(){if(De){Wk();return}if(Be){EA();return}$o(),me(S._as)&&(h.tokens[h.tokens.length-1].identifierRole=ge.ImportAccess,G(),$o())}function Bf(){(y(o._with)||me(S._assert)&&!Et())&&(G(),hc(!1,!1))}function yw(){return h.pos===0&&re.charCodeAt(0)===P.numberSign&&re.charCodeAt(1)===P.exclamationMark&&A1(2),E1(),TA()}class bw{constructor(e,n){this.tokens=e,this.scopes=n}}function xw(t,e,n,s){if(s&&n)throw new Error("Cannot combine flow and typescript plugins.");Hb(t,e,n,s);const r=yw();if(h.error)throw Vb(h.error);return r}function kw(t){let e=t.currentIndex(),n=0;const s=t.currentToken();do{const r=t.tokens[e];if(r.isOptionalChainStart&&n++,r.isOptionalChainEnd&&n--,n+=r.numNullishCoalesceStarts,n-=r.numNullishCoalesceEnds,r.contextualKeyword===S._await&&r.identifierRole==null&&r.scopeDepth===s.scopeDepth)return!0;e+=1}while(n>0&&e<t.tokens.length);return!1}class Xr{__init(){this.resultCode=""}__init2(){this.resultMappings=new Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(e,n,s,r,i){this.code=e,this.tokens=n,this.isFlowEnabled=s,this.disableESTransforms=r,this.helperManager=i,Xr.prototype.__init.call(this),Xr.prototype.__init2.call(this),Xr.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(e){this.resultCode=e.resultCode,this.tokenIndex=e.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(e){const n=this.resultCode.slice(e.resultCode.length);return this.resultCode=e.resultCode,n}reset(){this.resultCode="",this.resultMappings=new Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(e,n){return this.matches1AtIndex(e,o.name)&&this.tokens[e].contextualKeyword===n}identifierNameAtIndex(e){return this.identifierNameForToken(this.tokens[e])}identifierNameAtRelativeIndex(e){return this.identifierNameForToken(this.tokenAtRelativeIndex(e))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(e){return this.code.slice(e.start,e.end)}rawCodeForToken(e){return this.code.slice(e.start,e.end)}stringValueAtIndex(e){return this.stringValueForToken(this.tokens[e])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(e){return this.code.slice(e.start+1,e.end-1)}matches1AtIndex(e,n){return this.tokens[e].type===n}matches2AtIndex(e,n,s){return this.tokens[e].type===n&&this.tokens[e+1].type===s}matches3AtIndex(e,n,s,r){return this.tokens[e].type===n&&this.tokens[e+1].type===s&&this.tokens[e+2].type===r}matches1(e){return this.tokens[this.tokenIndex].type===e}matches2(e,n){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===n}matches3(e,n,s){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===n&&this.tokens[this.tokenIndex+2].type===s}matches4(e,n,s,r){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===n&&this.tokens[this.tokenIndex+2].type===s&&this.tokens[this.tokenIndex+3].type===r}matches5(e,n,s,r,i){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===n&&this.tokens[this.tokenIndex+2].type===s&&this.tokens[this.tokenIndex+3].type===r&&this.tokens[this.tokenIndex+4].type===i}matchesContextual(e){return this.matchesContextualAtIndex(this.tokenIndex,e)}matchesContextIdAndLabel(e,n){return this.matches1(e)&&this.currentToken().contextId===n}previousWhitespaceAndComments(){let e=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(e=e.replace(/@flow/g,"")),e}replaceToken(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(e){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,""),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken("")}removeToken(){this.replaceTokenTrimmingLeftWhitespace("")}removeBalancedCode(){let e=0;for(;!this.isAtEnd();){if(this.matches1(o.braceL))e++;else if(this.matches1(o.braceR)){if(e===0)return;e--}this.removeToken()}}copyExpectedToken(e){if(this.tokens[this.tokenIndex].type!==e)throw new Error(`Expected token ${e}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=e,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){const e=this.currentToken();if((e.numNullishCoalesceStarts||e.isOptionalChainStart)&&(e.isAsyncOperation=kw(this)),!this.disableESTransforms){if(e.numNullishCoalesceStarts)for(let n=0;n<e.numNullishCoalesceStarts;n++)e.isAsyncOperation?(this.resultCode+="await ",this.resultCode+=this.helperManager.getHelperName("asyncNullishCoalesce")):this.resultCode+=this.helperManager.getHelperName("nullishCoalesce"),this.resultCode+="(";e.isOptionalChainStart&&(e.isAsyncOperation&&(this.resultCode+="await "),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===o._delete?e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChainDelete"):this.resultCode+=this.helperManager.getHelperName("optionalChainDelete"):e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChain"):this.resultCode+=this.helperManager.getHelperName("optionalChain"),this.resultCode+="([")}}appendTokenSuffix(){const e=this.currentToken();if(e.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+="])"),e.numNullishCoalesceEnds&&!this.disableESTransforms)for(let n=0;n<e.numNullishCoalesceEnds;n++)this.resultCode+="))"}appendCode(e){this.resultCode+=e}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){const e=this.currentToken();return this.code.slice(e.start,e.end)}tokenAtRelativeIndex(e){return this.tokens[this.tokenIndex+e]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw new Error("Unexpectedly reached end of input.");this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw new Error("Tried to finish processing tokens before reaching the end.");return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}function Ew(t,e,n,s){const r=e.snapshot(),i=Aw(e);let a=[];const l=[],c=[];let u=null;const d=[],m=[],f=e.currentToken().contextId;if(f==null)throw new Error("Expected non-null class context ID on class open-brace.");for(e.nextToken();!e.matchesContextIdAndLabel(o.braceR,f);)if(e.matchesContextual(S._constructor)&&!e.currentToken().isType)({constructorInitializerStatements:a,constructorInsertPos:u}=jf(e));else if(e.matches1(o.semi))s||m.push({start:e.currentIndex(),end:e.currentIndex()+1}),e.nextToken();else if(e.currentToken().isType)e.nextToken();else{const g=e.currentIndex();let w=!1,k=!1,I=!1;for(;Ho(e.currentToken());)e.matches1(o._static)&&(w=!0),e.matches1(o.hash)&&(k=!0),(e.matches1(o._declare)||e.matches1(o._abstract))&&(I=!0),e.nextToken();if(w&&e.matches1(o.braceL)){_c(e,f);continue}if(k){_c(e,f);continue}if(e.matchesContextual(S._constructor)&&!e.currentToken().isType){({constructorInitializerStatements:a,constructorInsertPos:u}=jf(e));continue}const E=e.currentIndex();if(ww(e),e.matches1(o.lessThan)||e.matches1(o.parenL)){_c(e,f);continue}for(;e.currentToken().isType;)e.nextToken();if(e.matches1(o.eq)){const b=e.currentIndex(),A=e.currentToken().rhsEndIndex;if(A==null)throw new Error("Expected rhsEndIndex on class field assignment.");for(e.nextToken();e.currentIndex()<A;)t.processToken();let v;w?(v=n.claimFreeName("__initStatic"),c.push(v)):(v=n.claimFreeName("__init"),l.push(v)),d.push({initializerName:v,equalsIndex:b,start:E,end:e.currentIndex()})}else(!s||I)&&m.push({start:g,end:e.currentIndex()})}return e.restoreToSnapshot(r),s?{headerInfo:i,constructorInitializerStatements:a,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:u,fields:[],rangesToRemove:m}:{headerInfo:i,constructorInitializerStatements:a,instanceInitializerNames:l,staticInitializerNames:c,constructorInsertPos:u,fields:d,rangesToRemove:m}}function _c(t,e){for(t.nextToken();t.currentToken().contextId!==e;)t.nextToken();for(;Ho(t.tokenAtRelativeIndex(-1));)t.previousToken()}function Aw(t){const e=t.currentToken(),n=e.contextId;if(n==null)throw new Error("Expected context ID on class token.");const s=e.isExpression;if(s==null)throw new Error("Expected isExpression on class token.");let r=null,i=!1;for(t.nextToken(),t.matches1(o.name)&&(r=t.identifierName());!t.matchesContextIdAndLabel(o.braceL,n);)t.matches1(o._extends)&&!t.currentToken().isType&&(i=!0),t.nextToken();return{isExpression:s,className:r,hasSuperclass:i}}function jf(t){const e=[];t.nextToken();const n=t.currentToken().contextId;if(n==null)throw new Error("Expected context ID on open-paren starting constructor params.");for(;!t.matchesContextIdAndLabel(o.parenR,n);)if(t.currentToken().contextId===n){if(t.nextToken(),Ho(t.currentToken())){for(t.nextToken();Ho(t.currentToken());)t.nextToken();const i=t.currentToken();if(i.type!==o.name)throw new Error("Expected identifier after access modifiers in constructor arg.");const a=t.identifierNameForToken(i);e.push(`this.${a} = ${a}`)}}else t.nextToken();for(t.nextToken();t.currentToken().isType;)t.nextToken();let s=t.currentIndex(),r=!1;for(;!t.matchesContextIdAndLabel(o.braceR,n);){if(!r&&t.matches2(o._super,o.parenL)){t.nextToken();const i=t.currentToken().contextId;if(i==null)throw new Error("Expected a context ID on the super call");for(;!t.matchesContextIdAndLabel(o.parenR,i);)t.nextToken();s=t.currentIndex(),r=!0}t.nextToken()}return t.nextToken(),{constructorInitializerStatements:e,constructorInsertPos:s}}function Ho(t){return[o._async,o._get,o._set,o.plus,o.minus,o._readonly,o._static,o._public,o._private,o._protected,o._override,o._abstract,o.star,o._declare,o.hash].includes(t.type)}function ww(t){if(t.matches1(o.bracketL)){const n=t.currentToken().contextId;if(n==null)throw new Error("Expected class context ID on computed name open bracket.");for(;!t.matchesContextIdAndLabel(o.bracketR,n);)t.nextToken();t.nextToken()}else t.nextToken()}function zf(t){if(t.removeInitialToken(),t.removeToken(),t.removeToken(),t.removeToken(),t.matches1(o.parenL))t.removeToken(),t.removeToken(),t.removeToken();else for(;t.matches1(o.dot);)t.removeToken(),t.removeToken()}const Vf={typeDeclarations:new Set,valueDeclarations:new Set};function Uf(t){const e=new Set,n=new Set;for(let s=0;s<t.tokens.length;s++){const r=t.tokens[s];r.type===o.name&&y1(r)&&(r.isType?e.add(t.identifierNameForToken(r)):n.add(t.identifierNameForToken(r)))}return{typeDeclarations:e,valueDeclarations:n}}function qf(t){let e=t.currentIndex();for(;!t.matches1AtIndex(e,o.braceR);)e++;return t.matchesContextualAtIndex(e+1,S._from)&&t.matches1AtIndex(e+2,o.string)}function hs(t){(t.matches2(o._with,o.braceL)||t.matches2(o.name,o.braceL)&&t.matchesContextual(S._assert))&&(t.removeToken(),t.removeToken(),t.removeBalancedCode(),t.removeToken())}function Hf(t,e,n,s){if(!t||e)return!1;const r=n.currentToken();if(r.rhsEndIndex==null)throw new Error("Expected non-null rhsEndIndex on export token.");const i=r.rhsEndIndex-n.currentIndex();if(i!==3&&!(i===4&&n.matches1AtIndex(r.rhsEndIndex-1,o.semi)))return!1;const a=n.tokenAtRelativeIndex(2);if(a.type!==o.name)return!1;const l=n.identifierNameForToken(a);return s.typeDeclarations.has(l)&&!s.valueDeclarations.has(l)}class Kr extends Vt{__init(){this.hadExport=!1}__init2(){this.hadNamedExport=!1}__init3(){this.hadDefaultExport=!1}constructor(e,n,s,r,i,a,l,c,u,d,m,f){super(),this.rootTransformer=e,this.tokens=n,this.importProcessor=s,this.nameManager=r,this.helperManager=i,this.reactHotLoaderTransformer=a,this.enableLegacyBabel5ModuleInterop=l,this.enableLegacyTypeScriptModuleInterop=c,this.isTypeScriptTransformEnabled=u,this.isFlowTransformEnabled=d,this.preserveDynamicImport=m,this.keepUnusedImports=f,Kr.prototype.__init.call(this),Kr.prototype.__init2.call(this),Kr.prototype.__init3.call(this),this.declarationInfo=u?Uf(n):Vf}getPrefixCode(){let e="";return this.hadExport&&(e+='Object.defineProperty(exports, "__esModule", {value: true});'),e}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
177
177
  module.exports = exports.default;
178
- `:""}process(){return this.tokens.matches3(o._import,o.name,o.eq)?this.processImportEquals():this.tokens.matches1(o._import)?(this.processImport(),!0):this.tokens.matches2(o._export,o.eq)?(this.tokens.replaceToken("module.exports"),!0):this.tokens.matches1(o._export)&&!this.tokens.currentToken().isType?(this.hadExport=!0,this.processExport()):this.tokens.matches2(o.name,o.postIncDec)&&this.processPostIncDec()?!0:this.tokens.matches1(o.name)||this.tokens.matches1(o.jsxName)?this.processIdentifier():this.tokens.matches1(o.eq)?this.processAssignment():this.tokens.matches1(o.assign)?this.processComplexAssignment():this.tokens.matches1(o.preIncDec)?this.processPreIncDec():!1}processImportEquals(){const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(e)?zf(this.tokens):this.tokens.replaceToken("const"),!0}processImport(){if(this.tokens.matches2(o._import,o.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}const n=this.enableLegacyTypeScriptModuleInterop?"":`${this.helperManager.getHelperName("interopRequireWildcard")}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${n}require`);const s=this.tokens.currentToken().contextId;if(s==null)throw new Error("Expected context ID on dynamic import invocation.");for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(o.parenR,s);)this.rootTransformer.processToken();this.tokens.replaceToken(n?")))":"))");return}if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{const n=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(n)),this.tokens.appendCode(this.importProcessor.claimImportCode(n))}hs(this.tokens),this.tokens.matches1(o.semi)&&this.tokens.removeToken()}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(S._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,o.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._from))return this.removeRemainingImport(),!0;if(this.tokens.matches1(o.name)||this.tokens.matches1(o.star))return this.removeRemainingImport(),!1;if(this.tokens.matches1(o.string))return!1;let e=!1,n=!1;for(;!this.tokens.matches1(o.string);)(!e&&this.tokens.matches1(o.braceL)||this.tokens.matches1(o.comma))&&(this.tokens.removeToken(),this.tokens.matches1(o.braceR)||(n=!0),(this.tokens.matches2(o.name,o.comma)||this.tokens.matches2(o.name,o.braceR)||this.tokens.matches4(o.name,o.name,o.name,o.comma)||this.tokens.matches4(o.name,o.name,o.name,o.braceR))&&(e=!0)),this.tokens.removeToken();return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?n&&!e:!1}removeRemainingImport(){for(;!this.tokens.matches1(o.string);)this.tokens.removeToken()}processIdentifier(){const e=this.tokens.currentToken();if(e.shadowsGlobal)return!1;if(e.identifierRole===ge.ObjectShorthand)return this.processObjectShorthand();if(e.identifierRole!==ge.Access)return!1;const n=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(e));if(!n)return!1;let s=this.tokens.currentIndex()+1;for(;s<this.tokens.tokens.length&&this.tokens.tokens[s].type===o.parenR;)s++;return this.tokens.tokens[s].type===o.parenL?this.tokens.tokenAtRelativeIndex(1).type===o.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==o._new?(this.tokens.replaceToken(`${n}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR)):this.tokens.replaceToken(`(0, ${n})`):this.tokens.replaceToken(n),!0}processObjectShorthand(){const e=this.tokens.identifierName(),n=this.importProcessor.getIdentifierReplacement(e);return n?(this.tokens.replaceToken(`${e}: ${n}`),!0):!1}processExport(){if(this.tokens.matches2(o._export,o._enum)||this.tokens.matches3(o._export,o._const,o._enum))return this.hadNamedExport=!0,!1;if(this.tokens.matches2(o._export,o._default))return this.tokens.matches3(o._export,o._default,o._enum)?(this.hadDefaultExport=!0,!1):(this.processExportDefault(),!0);if(this.tokens.matches2(o._export,o.braceL))return this.processExportBindings(),!0;if(this.tokens.matches2(o._export,o.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(o.braceL)){for(;!this.tokens.matches1(o.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(o._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(S._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,o.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),hs(this.tokens)),!0}if(this.hadNamedExport=!0,this.tokens.matches2(o._export,o._var)||this.tokens.matches2(o._export,o._let)||this.tokens.matches2(o._export,o._const))return this.processExportVar(),!0;if(this.tokens.matches2(o._export,o._function)||this.tokens.matches3(o._export,o.name,o._function))return this.processExportFunction(),!0;if(this.tokens.matches2(o._export,o._class)||this.tokens.matches3(o._export,o._abstract,o._class)||this.tokens.matches2(o._export,o.at))return this.processExportClass(),!0;if(this.tokens.matches2(o._export,o.star))return this.processExportStar(),!0;throw new Error("Unrecognized export syntax.")}processAssignment(){const e=this.tokens.currentIndex(),n=this.tokens.tokens[e-1];if(n.isType||n.type!==o.name||n.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,o.dot)||e>=2&&[o._var,o._let,o._const].includes(this.tokens.tokens[e-2].type))return!1;const s=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(n));return s?(this.tokens.copyToken(),this.tokens.appendCode(` ${s} =`),!0):!1}processComplexAssignment(){const e=this.tokens.currentIndex(),n=this.tokens.tokens[e-1];if(n.type!==o.name||n.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,o.dot))return!1;const s=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(n));return s?(this.tokens.appendCode(` = ${s}`),this.tokens.copyToken(),!0):!1}processPreIncDec(){const e=this.tokens.currentIndex(),n=this.tokens.tokens[e+1];if(n.type!==o.name||n.shadowsGlobal||e+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(e+2,o.dot)||this.tokens.matches1AtIndex(e+2,o.bracketL)||this.tokens.matches1AtIndex(e+2,o.parenL)))return!1;const s=this.tokens.identifierNameForToken(n),r=this.importProcessor.resolveExportBinding(s);return r?(this.tokens.appendCode(`${r} = `),this.tokens.copyToken(),!0):!1}processPostIncDec(){const e=this.tokens.currentIndex(),n=this.tokens.tokens[e],s=this.tokens.tokens[e+1];if(n.type!==o.name||n.shadowsGlobal||e>=1&&this.tokens.matches1AtIndex(e-1,o.dot))return!1;const r=this.tokens.identifierNameForToken(n),i=this.importProcessor.resolveExportBinding(r);if(!i)return!1;const a=this.tokens.rawCodeForToken(s),l=this.importProcessor.getIdentifierReplacement(r)||r;if(a==="++")this.tokens.replaceToken(`(${l} = ${i} = ${l} + 1, ${l} - 1)`);else if(a==="--")this.tokens.replaceToken(`(${l} = ${i} = ${l} - 1, ${l} + 1)`);else throw new Error(`Unexpected operator: ${a}`);return this.tokens.removeToken(),!0}processExportDefault(){let e=!0;if(this.tokens.matches4(o._export,o._default,o._function,o.name)||this.tokens.matches5(o._export,o._default,o.name,o._function,o.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,S._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();const n=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${n};`)}else if(this.tokens.matches4(o._export,o._default,o._class,o.name)||this.tokens.matches5(o._export,o._default,o._abstract,o._class,o.name)||this.tokens.matches3(o._export,o._default,o.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(o._abstract)&&this.tokens.removeToken();const n=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${n};`)}else if(Hf(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))e=!1,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){const n=this.nameManager.claimFreeName("_default");this.tokens.replaceToken(`let ${n}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${n} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(n)}else this.tokens.replaceToken("exports."),this.tokens.copyToken(),this.tokens.appendCode(" =");e&&(this.hadDefaultExport=!0)}copyDecorators(){for(;this.tokens.matches1(o.at);)if(this.tokens.copyToken(),this.tokens.matches1(o.parenL))this.tokens.copyExpectedToken(o.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR);else{for(this.tokens.copyExpectedToken(o.name);this.tokens.matches1(o.dot);)this.tokens.copyExpectedToken(o.dot),this.tokens.copyExpectedToken(o.name);this.tokens.matches1(o.parenL)&&(this.tokens.copyExpectedToken(o.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let e=this.tokens.currentIndex();if(e++,e++,!this.tokens.matches1AtIndex(e,o.name))return!1;for(e++;e<this.tokens.tokens.length&&this.tokens.tokens[e].isType;)e++;return!!this.tokens.matches1AtIndex(e,o.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();const e=this.tokens.identifierName();for(;!this.tokens.matches1(o.eq);)this.rootTransformer.processToken();const n=this.tokens.currentToken().rhsEndIndex;if(n==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<n;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${e} = ${e}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=this.tokens.matches1(o.braceL);e&&this.tokens.appendCode("(");let n=0;for(;;)if(this.tokens.matches1(o.braceL)||this.tokens.matches1(o.dollarBraceL)||this.tokens.matches1(o.bracketL))n++,this.tokens.copyToken();else if(this.tokens.matches1(o.braceR)||this.tokens.matches1(o.bracketR))n--,this.tokens.copyToken();else{if(n===0&&!this.tokens.matches1(o.name)&&!this.tokens.currentToken().isType)break;if(this.tokens.matches1(o.eq)){const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken()}else{const s=this.tokens.currentToken();if(g1(s)){const r=this.tokens.identifierName();let i=this.importProcessor.getIdentifierReplacement(r);if(i===null)throw new Error(`Expected a replacement for ${r} in \`export var\` syntax.`);Yb(s)&&(i=`${r}: ${i}`),this.tokens.replaceToken(i)}else this.rootTransformer.processToken()}}if(e){const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken();this.tokens.appendCode(")")}}processExportFunction(){this.tokens.replaceToken("");const e=this.processNamedFunction();this.tokens.appendCode(` exports.${e} = ${e};`)}processNamedFunction(){if(this.tokens.matches1(o._function))this.tokens.copyToken();else if(this.tokens.matches2(o.name,o._function)){if(!this.tokens.matchesContextual(S._async))throw new Error("Expected async keyword in function export.");this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(o.star)&&this.tokens.copyToken(),!this.tokens.matches1(o.name))throw new Error("Expected identifier for exported function name.");const e=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(o.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(o.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.braceR),e}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(o._abstract)&&this.tokens.removeToken();const e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${e} = ${e};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=qf(this.tokens),n=[];for(;;){if(this.tokens.matches1(o.braceR)){this.tokens.removeToken();break}const s=Dr(this.tokens);for(;this.tokens.currentIndex()<s.endIndex;)this.tokens.removeToken();if(!(s.isType||!e&&this.shouldElideExportedIdentifier(s.leftName))){const i=s.rightName;i==="default"?this.hadDefaultExport=!0:this.hadNamedExport=!0;const a=s.leftName,l=this.importProcessor.getIdentifierReplacement(a);n.push(`exports.${i} = ${l||a};`)}if(this.tokens.matches1(o.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(o.comma,o.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}else if(this.tokens.matches1(o.comma))this.tokens.removeToken();else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(S._from)){this.tokens.removeToken();const s=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(s)),hs(this.tokens)}else this.tokens.appendCode(n.join(" "));this.tokens.matches1(o.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(o.string);)this.tokens.removeToken();const e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),hs(this.tokens),this.tokens.matches1(o.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(e)}}class Sw extends Vt{constructor(e,n,s,r,i,a,l,c){super(),this.tokens=e,this.nameManager=n,this.helperManager=s,this.reactHotLoaderTransformer=r,this.isTypeScriptTransformEnabled=i,this.isFlowTransformEnabled=a,this.keepUnusedImports=l,this.nonTypeIdentifiers=i&&!l?R1(e,c):new Set,this.declarationInfo=i&&!l?Uf(e):Vf,this.injectCreateRequireForImportRequire=!!c.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(o._import,o.name,o.eq))return this.processImportEquals();if(this.tokens.matches4(o._import,o.name,o.name,o.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._type)){this.tokens.removeInitialToken();for(let e=0;e<7;e++)this.tokens.removeToken();return!0}if(this.tokens.matches2(o._export,o.eq))return this.tokens.replaceToken("module.exports"),!0;if(this.tokens.matches5(o._export,o._import,o.name,o.name,o.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,S._type)){this.tokens.removeInitialToken();for(let e=0;e<8;e++)this.tokens.removeToken();return!0}if(this.tokens.matches1(o._import))return this.processImport();if(this.tokens.matches2(o._export,o._default))return this.processExportDefault();if(this.tokens.matches2(o._export,o.braceL))return this.processNamedExports();if(this.tokens.matches2(o._export,o.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(o.braceL)){for(;!this.tokens.matches1(o.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(o._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(S._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,o.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),hs(this.tokens)),!0}return!1}processImportEquals(){const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(e)?zf(this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken("const"),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName("require"))):this.tokens.replaceToken("const"),!0}processImport(){if(this.tokens.matches2(o._import,o.parenL))return!1;const e=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(e);!this.tokens.matches1(o.string);)this.tokens.removeToken();this.tokens.removeToken(),hs(this.tokens),this.tokens.matches1(o.semi)&&this.tokens.removeToken()}return!0}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(o._import),this.tokens.matchesContextual(S._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,o.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._from))return!0;if(this.tokens.matches1(o.string))return this.tokens.copyToken(),!1;this.tokens.matchesContextual(S._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,S._from)&&this.tokens.copyToken();let e=!1,n=!1,s=!1;if(this.tokens.matches1(o.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(o.comma)&&this.tokens.removeToken()):(e=!0,this.tokens.copyToken(),this.tokens.matches1(o.comma)&&(s=!0,this.tokens.removeToken()))),this.tokens.matches1(o.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(s&&this.tokens.appendCode(","),e=!0,this.tokens.copyExpectedToken(o.star),this.tokens.copyExpectedToken(o.name),this.tokens.copyExpectedToken(o.name));else if(this.tokens.matches1(o.braceL)){for(s&&this.tokens.appendCode(","),this.tokens.copyToken();!this.tokens.matches1(o.braceR);){n=!0;const r=Dr(this.tokens);if(r.isType||this.shouldAutomaticallyElideImportedName(r.rightName)){for(;this.tokens.currentIndex()<r.endIndex;)this.tokens.removeToken();this.tokens.matches1(o.comma)&&this.tokens.removeToken()}else{for(e=!0;this.tokens.currentIndex()<r.endIndex;)this.tokens.copyToken();this.tokens.matches1(o.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(o.braceR)}return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?n&&!e:!1}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}processExportDefault(){if(Hf(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),!0;if(!(this.tokens.matches4(o._export,o._default,o._function,o.name)||this.tokens.matches5(o._export,o._default,o.name,o._function,o.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,S._async)||this.tokens.matches4(o._export,o._default,o._class,o.name)||this.tokens.matches5(o._export,o._default,o._abstract,o._class,o.name))&&this.reactHotLoaderTransformer){const n=this.nameManager.claimFreeName("_default");return this.tokens.replaceToken(`let ${n}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${n} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(n),!0}return!1}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return!1;this.tokens.copyExpectedToken(o._export),this.tokens.copyExpectedToken(o.braceL);const e=qf(this.tokens);let n=!1;for(;!this.tokens.matches1(o.braceR);){const s=Dr(this.tokens);if(s.isType||!e&&this.shouldElideExportedName(s.leftName)){for(;this.tokens.currentIndex()<s.endIndex;)this.tokens.removeToken();this.tokens.matches1(o.comma)&&this.tokens.removeToken()}else{for(n=!0;this.tokens.currentIndex()<s.endIndex;)this.tokens.copyToken();this.tokens.matches1(o.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(o.braceR),!this.keepUnusedImports&&e&&!n&&(this.tokens.removeToken(),this.tokens.removeToken(),hs(this.tokens)),!0}shouldElideExportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(e)&&!this.declarationInfo.valueDeclarations.has(e)}}class Iw extends Vt{constructor(e,n,s){super(),this.rootTransformer=e,this.tokens=n,this.isImportsTransformEnabled=s}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?!0:this.tokens.matches1(o._enum)?(this.processEnum(),!0):this.tokens.matches2(o._export,o._enum)?(this.processNamedExportEnum(),!0):this.tokens.matches3(o._export,o._default,o._enum)?(this.processDefaultExportEnum(),!0):!1}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();const e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${e} = ${e};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${e};`):this.tokens.appendCode(` export default ${e};`)}processEnum(){this.tokens.replaceToken("const"),this.tokens.copyExpectedToken(o.name);let e=!1;this.tokens.matchesContextual(S._of)&&(this.tokens.removeToken(),e=this.tokens.matchesContextual(S._symbol),this.tokens.removeToken());const n=this.tokens.matches3(o.braceL,o.name,o.eq);this.tokens.appendCode(' = require("flow-enums-runtime")');const s=!e&&!n;for(this.tokens.replaceTokenTrimmingLeftWhitespace(s?".Mirrored([":"({");!this.tokens.matches1(o.braceR);){if(this.tokens.matches1(o.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(e,n),this.tokens.matches1(o.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(s?"]);":"});")}processEnumElement(e,n){if(e){const s=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${s}")`)}else n?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(":"),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}function vw(t){let e,n=t[0],s=1;for(;s<t.length;){const r=t[s],i=t[s+1];if(s+=2,(r==="optionalAccess"||r==="optionalCall")&&n==null)return;r==="access"||r==="optionalAccess"?(e=n,n=i(n)):(r==="call"||r==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}const Go="jest",_w=["mock","unmock","enableAutomock","disableAutomock"];class Pc extends Vt{__init(){this.hoistedFunctionNames=[]}constructor(e,n,s,r){super(),this.rootTransformer=e,this.tokens=n,this.nameManager=s,this.importProcessor=r,Pc.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(o.name,o.dot,o.name,o.parenL)&&this.tokens.identifierName()===Go?vw([this,"access",e=>e.importProcessor,"optionalAccess",e=>e.getGlobalNames,"call",e=>e(),"optionalAccess",e=>e.has,"call",e=>e(Go)])?!1:this.extractHoistedCalls():!1}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(e=>`${e}();`).join(""):""}extractHoistedCalls(){this.tokens.removeToken();let e=!1;for(;this.tokens.matches3(o.dot,o.name,o.parenL);){const n=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(_w.includes(n)){const r=this.nameManager.claimFreeName("__jestHoist");this.hoistedFunctionNames.push(r),this.tokens.replaceToken(`function ${r}(){${Go}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR),this.tokens.appendCode(";}"),e=!1}else e?this.tokens.copyToken():this.tokens.replaceToken(`${Go}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR),e=!0}return!0}}class Pw extends Vt{constructor(e){super(),this.tokens=e}process(){if(this.tokens.matches1(o.num)){const e=this.tokens.currentTokenCode();if(e.includes("_"))return this.tokens.replaceToken(e.replace(/_/g,"")),!0}return!1}}class $w extends Vt{constructor(e,n){super(),this.tokens=e,this.nameManager=n}process(){return this.tokens.matches2(o._catch,o.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`),!0):!1}}class Nw extends Vt{constructor(e,n){super(),this.tokens=e,this.nameManager=n}process(){if(this.tokens.matches1(o.nullishCoalescing)){const s=this.tokens.currentToken();return this.tokens.tokens[s.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("):this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("),!0}if(this.tokens.matches1(o._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),!0;const n=this.tokens.currentToken().subscriptStartIndex;if(n!=null&&this.tokens.tokens[n].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==o._super){const s=this.nameManager.claimFreeName("_");let r;if(n>0&&this.tokens.matches1AtIndex(n-1,o._delete)&&this.isLastSubscriptInChain()?r=`${s} => delete ${s}`:r=`${s} => ${s}`,this.tokens.tokens[n].isAsyncOperation&&(r=`async ${r}`),this.tokens.matches2(o.questionDot,o.parenL)||this.tokens.matches2(o.questionDot,o.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${r}`);else if(this.tokens.matches2(o.questionDot,o.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}`);else if(this.tokens.matches1(o.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}.`);else if(this.tokens.matches1(o.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}.`);else if(this.tokens.matches1(o.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}[`);else if(this.tokens.matches1(o.parenL))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${r}(`);else throw new Error("Unexpected subscript operator in optional chain.");return!0}return!1}isLastSubscriptInChain(){let e=0;for(let n=this.tokens.currentIndex()+1;;n++){if(n>=this.tokens.tokens.length)throw new Error("Reached the end of the code while finding the end of the access chain.");if(this.tokens.tokens[n].isOptionalChainStart?e++:this.tokens.tokens[n].isOptionalChainEnd&&e--,e<0)return!0;if(e===0&&this.tokens.tokens[n].subscriptStartIndex!=null)return!1}}justSkippedSuper(){let e=0,n=this.tokens.currentIndex()-1;for(;;){if(n<0)throw new Error("Reached the start of the code while finding the start of the access chain.");if(this.tokens.tokens[n].isOptionalChainStart?e--:this.tokens.tokens[n].isOptionalChainEnd&&e++,e<0)return!1;if(e===0&&this.tokens.tokens[n].subscriptStartIndex!=null)return this.tokens.tokens[n-1].type===o._super;n--}}}class Cw extends Vt{constructor(e,n,s,r){super(),this.rootTransformer=e,this.tokens=n,this.importProcessor=s,this.options=r}process(){const e=this.tokens.currentIndex();if(this.tokens.identifierName()==="createReactClass"){const n=this.importProcessor&&this.importProcessor.getIdentifierReplacement("createReactClass");return n?this.tokens.replaceToken(`(0, ${n})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(e),!0}if(this.tokens.matches3(o.name,o.dot,o.name)&&this.tokens.identifierName()==="React"&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)==="createClass"){const n=this.importProcessor&&this.importProcessor.getIdentifierReplacement("React")||"React";return n?(this.tokens.replaceToken(n),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(e),!0}return!1}tryProcessCreateClassCall(e){const n=this.findDisplayName(e);n&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(o.parenL),this.tokens.copyExpectedToken(o.braceL),this.tokens.appendCode(`displayName: '${n}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.braceR),this.tokens.copyExpectedToken(o.parenR))}findDisplayName(e){return e<2?null:this.tokens.matches2AtIndex(e-2,o.name,o.eq)?this.tokens.identifierNameAtIndex(e-2):e>=2&&this.tokens.tokens[e-2].identifierRole===ge.ObjectKey?this.tokens.identifierNameAtIndex(e-2):this.tokens.matches2AtIndex(e-2,o._export,o._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){const n=(this.options.filePath||"unknown").split("/"),s=n[n.length-1],r=s.lastIndexOf("."),i=r===-1?s:s.slice(0,r);return i==="index"&&n[n.length-2]?n[n.length-2]:i}classNeedsDisplayName(){let e=this.tokens.currentIndex();if(!this.tokens.matches2(o.parenL,o.braceL))return!1;const n=e+1,s=this.tokens.tokens[n].contextId;if(s==null)throw new Error("Expected non-null context ID on object open-brace.");for(;e<this.tokens.tokens.length;e++){const r=this.tokens.tokens[e];if(r.type===o.braceR&&r.contextId===s){e++;break}if(this.tokens.identifierNameAtIndex(e)==="displayName"&&this.tokens.tokens[e].identifierRole===ge.ObjectKey&&r.contextId===s)return!1}if(e===this.tokens.tokens.length)throw new Error("Unexpected end of input when processing React class.");return this.tokens.matches1AtIndex(e,o.parenR)||this.tokens.matches2AtIndex(e,o.comma,o.parenR)}}class $c extends Vt{__init(){this.extractedDefaultExportName=null}constructor(e,n){super(),this.tokens=e,this.filePath=n,$c.prototype.__init.call(this)}setExtractedDefaultExportName(e){this.extractedDefaultExportName=e}getPrefixCode(){return`
178
+ `:""}process(){return this.tokens.matches3(o._import,o.name,o.eq)?this.processImportEquals():this.tokens.matches1(o._import)?(this.processImport(),!0):this.tokens.matches2(o._export,o.eq)?(this.tokens.replaceToken("module.exports"),!0):this.tokens.matches1(o._export)&&!this.tokens.currentToken().isType?(this.hadExport=!0,this.processExport()):this.tokens.matches2(o.name,o.postIncDec)&&this.processPostIncDec()?!0:this.tokens.matches1(o.name)||this.tokens.matches1(o.jsxName)?this.processIdentifier():this.tokens.matches1(o.eq)?this.processAssignment():this.tokens.matches1(o.assign)?this.processComplexAssignment():this.tokens.matches1(o.preIncDec)?this.processPreIncDec():!1}processImportEquals(){const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(e)?zf(this.tokens):this.tokens.replaceToken("const"),!0}processImport(){if(this.tokens.matches2(o._import,o.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}const n=this.enableLegacyTypeScriptModuleInterop?"":`${this.helperManager.getHelperName("interopRequireWildcard")}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${n}require`);const s=this.tokens.currentToken().contextId;if(s==null)throw new Error("Expected context ID on dynamic import invocation.");for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(o.parenR,s);)this.rootTransformer.processToken();this.tokens.replaceToken(n?")))":"))");return}if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{const n=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(n)),this.tokens.appendCode(this.importProcessor.claimImportCode(n))}hs(this.tokens),this.tokens.matches1(o.semi)&&this.tokens.removeToken()}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(S._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,o.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._from))return this.removeRemainingImport(),!0;if(this.tokens.matches1(o.name)||this.tokens.matches1(o.star))return this.removeRemainingImport(),!1;if(this.tokens.matches1(o.string))return!1;let e=!1,n=!1;for(;!this.tokens.matches1(o.string);)(!e&&this.tokens.matches1(o.braceL)||this.tokens.matches1(o.comma))&&(this.tokens.removeToken(),this.tokens.matches1(o.braceR)||(n=!0),(this.tokens.matches2(o.name,o.comma)||this.tokens.matches2(o.name,o.braceR)||this.tokens.matches4(o.name,o.name,o.name,o.comma)||this.tokens.matches4(o.name,o.name,o.name,o.braceR))&&(e=!0)),this.tokens.removeToken();return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?n&&!e:!1}removeRemainingImport(){for(;!this.tokens.matches1(o.string);)this.tokens.removeToken()}processIdentifier(){const e=this.tokens.currentToken();if(e.shadowsGlobal)return!1;if(e.identifierRole===ge.ObjectShorthand)return this.processObjectShorthand();if(e.identifierRole!==ge.Access)return!1;const n=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(e));if(!n)return!1;let s=this.tokens.currentIndex()+1;for(;s<this.tokens.tokens.length&&this.tokens.tokens[s].type===o.parenR;)s++;return this.tokens.tokens[s].type===o.parenL?this.tokens.tokenAtRelativeIndex(1).type===o.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==o._new?(this.tokens.replaceToken(`${n}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR)):this.tokens.replaceToken(`(0, ${n})`):this.tokens.replaceToken(n),!0}processObjectShorthand(){const e=this.tokens.identifierName(),n=this.importProcessor.getIdentifierReplacement(e);return n?(this.tokens.replaceToken(`${e}: ${n}`),!0):!1}processExport(){if(this.tokens.matches2(o._export,o._enum)||this.tokens.matches3(o._export,o._const,o._enum))return this.hadNamedExport=!0,!1;if(this.tokens.matches2(o._export,o._default))return this.tokens.matches3(o._export,o._default,o._enum)?(this.hadDefaultExport=!0,!1):(this.processExportDefault(),!0);if(this.tokens.matches2(o._export,o.braceL))return this.processExportBindings(),!0;if(this.tokens.matches2(o._export,o.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(o.braceL)){for(;!this.tokens.matches1(o.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(o._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(S._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,o.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),hs(this.tokens)),!0}if(this.hadNamedExport=!0,this.tokens.matches2(o._export,o._var)||this.tokens.matches2(o._export,o._let)||this.tokens.matches2(o._export,o._const))return this.processExportVar(),!0;if(this.tokens.matches2(o._export,o._function)||this.tokens.matches3(o._export,o.name,o._function))return this.processExportFunction(),!0;if(this.tokens.matches2(o._export,o._class)||this.tokens.matches3(o._export,o._abstract,o._class)||this.tokens.matches2(o._export,o.at))return this.processExportClass(),!0;if(this.tokens.matches2(o._export,o.star))return this.processExportStar(),!0;throw new Error("Unrecognized export syntax.")}processAssignment(){const e=this.tokens.currentIndex(),n=this.tokens.tokens[e-1];if(n.isType||n.type!==o.name||n.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,o.dot)||e>=2&&[o._var,o._let,o._const].includes(this.tokens.tokens[e-2].type))return!1;const s=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(n));return s?(this.tokens.copyToken(),this.tokens.appendCode(` ${s} =`),!0):!1}processComplexAssignment(){const e=this.tokens.currentIndex(),n=this.tokens.tokens[e-1];if(n.type!==o.name||n.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,o.dot))return!1;const s=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(n));return s?(this.tokens.appendCode(` = ${s}`),this.tokens.copyToken(),!0):!1}processPreIncDec(){const e=this.tokens.currentIndex(),n=this.tokens.tokens[e+1];if(n.type!==o.name||n.shadowsGlobal||e+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(e+2,o.dot)||this.tokens.matches1AtIndex(e+2,o.bracketL)||this.tokens.matches1AtIndex(e+2,o.parenL)))return!1;const s=this.tokens.identifierNameForToken(n),r=this.importProcessor.resolveExportBinding(s);return r?(this.tokens.appendCode(`${r} = `),this.tokens.copyToken(),!0):!1}processPostIncDec(){const e=this.tokens.currentIndex(),n=this.tokens.tokens[e],s=this.tokens.tokens[e+1];if(n.type!==o.name||n.shadowsGlobal||e>=1&&this.tokens.matches1AtIndex(e-1,o.dot))return!1;const r=this.tokens.identifierNameForToken(n),i=this.importProcessor.resolveExportBinding(r);if(!i)return!1;const a=this.tokens.rawCodeForToken(s),l=this.importProcessor.getIdentifierReplacement(r)||r;if(a==="++")this.tokens.replaceToken(`(${l} = ${i} = ${l} + 1, ${l} - 1)`);else if(a==="--")this.tokens.replaceToken(`(${l} = ${i} = ${l} - 1, ${l} + 1)`);else throw new Error(`Unexpected operator: ${a}`);return this.tokens.removeToken(),!0}processExportDefault(){let e=!0;if(this.tokens.matches4(o._export,o._default,o._function,o.name)||this.tokens.matches5(o._export,o._default,o.name,o._function,o.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,S._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();const n=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${n};`)}else if(this.tokens.matches4(o._export,o._default,o._class,o.name)||this.tokens.matches5(o._export,o._default,o._abstract,o._class,o.name)||this.tokens.matches3(o._export,o._default,o.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(o._abstract)&&this.tokens.removeToken();const n=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${n};`)}else if(Hf(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))e=!1,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){const n=this.nameManager.claimFreeName("_default");this.tokens.replaceToken(`let ${n}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${n} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(n)}else this.tokens.replaceToken("exports."),this.tokens.copyToken(),this.tokens.appendCode(" =");e&&(this.hadDefaultExport=!0)}copyDecorators(){for(;this.tokens.matches1(o.at);)if(this.tokens.copyToken(),this.tokens.matches1(o.parenL))this.tokens.copyExpectedToken(o.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR);else{for(this.tokens.copyExpectedToken(o.name);this.tokens.matches1(o.dot);)this.tokens.copyExpectedToken(o.dot),this.tokens.copyExpectedToken(o.name);this.tokens.matches1(o.parenL)&&(this.tokens.copyExpectedToken(o.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let e=this.tokens.currentIndex();if(e++,e++,!this.tokens.matches1AtIndex(e,o.name))return!1;for(e++;e<this.tokens.tokens.length&&this.tokens.tokens[e].isType;)e++;return!!this.tokens.matches1AtIndex(e,o.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();const e=this.tokens.identifierName();for(;!this.tokens.matches1(o.eq);)this.rootTransformer.processToken();const n=this.tokens.currentToken().rhsEndIndex;if(n==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<n;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${e} = ${e}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=this.tokens.matches1(o.braceL);e&&this.tokens.appendCode("(");let n=0;for(;;)if(this.tokens.matches1(o.braceL)||this.tokens.matches1(o.dollarBraceL)||this.tokens.matches1(o.bracketL))n++,this.tokens.copyToken();else if(this.tokens.matches1(o.braceR)||this.tokens.matches1(o.bracketR))n--,this.tokens.copyToken();else{if(n===0&&!this.tokens.matches1(o.name)&&!this.tokens.currentToken().isType)break;if(this.tokens.matches1(o.eq)){const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken()}else{const s=this.tokens.currentToken();if(g1(s)){const r=this.tokens.identifierName();let i=this.importProcessor.getIdentifierReplacement(r);if(i===null)throw new Error(`Expected a replacement for ${r} in \`export var\` syntax.`);Yb(s)&&(i=`${r}: ${i}`),this.tokens.replaceToken(i)}else this.rootTransformer.processToken()}}if(e){const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken();this.tokens.appendCode(")")}}processExportFunction(){this.tokens.replaceToken("");const e=this.processNamedFunction();this.tokens.appendCode(` exports.${e} = ${e};`)}processNamedFunction(){if(this.tokens.matches1(o._function))this.tokens.copyToken();else if(this.tokens.matches2(o.name,o._function)){if(!this.tokens.matchesContextual(S._async))throw new Error("Expected async keyword in function export.");this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(o.star)&&this.tokens.copyToken(),!this.tokens.matches1(o.name))throw new Error("Expected identifier for exported function name.");const e=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(o.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(o.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.braceR),e}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(o._abstract)&&this.tokens.removeToken();const e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${e} = ${e};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=qf(this.tokens),n=[];for(;;){if(this.tokens.matches1(o.braceR)){this.tokens.removeToken();break}const s=Dr(this.tokens);for(;this.tokens.currentIndex()<s.endIndex;)this.tokens.removeToken();if(!(s.isType||!e&&this.shouldElideExportedIdentifier(s.leftName))){const i=s.rightName;i==="default"?this.hadDefaultExport=!0:this.hadNamedExport=!0;const a=s.leftName,l=this.importProcessor.getIdentifierReplacement(a);n.push(`exports.${i} = ${l||a};`)}if(this.tokens.matches1(o.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(o.comma,o.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}else if(this.tokens.matches1(o.comma))this.tokens.removeToken();else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(S._from)){this.tokens.removeToken();const s=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(s)),hs(this.tokens)}else this.tokens.appendCode(n.join(" "));this.tokens.matches1(o.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(o.string);)this.tokens.removeToken();const e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),hs(this.tokens),this.tokens.matches1(o.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(e)}}class Sw extends Vt{constructor(e,n,s,r,i,a,l,c){super(),this.tokens=e,this.nameManager=n,this.helperManager=s,this.reactHotLoaderTransformer=r,this.isTypeScriptTransformEnabled=i,this.isFlowTransformEnabled=a,this.keepUnusedImports=l,this.nonTypeIdentifiers=i&&!l?R1(e,c):new Set,this.declarationInfo=i&&!l?Uf(e):Vf,this.injectCreateRequireForImportRequire=!!c.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(o._import,o.name,o.eq))return this.processImportEquals();if(this.tokens.matches4(o._import,o.name,o.name,o.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._type)){this.tokens.removeInitialToken();for(let e=0;e<7;e++)this.tokens.removeToken();return!0}if(this.tokens.matches2(o._export,o.eq))return this.tokens.replaceToken("module.exports"),!0;if(this.tokens.matches5(o._export,o._import,o.name,o.name,o.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,S._type)){this.tokens.removeInitialToken();for(let e=0;e<8;e++)this.tokens.removeToken();return!0}if(this.tokens.matches1(o._import))return this.processImport();if(this.tokens.matches2(o._export,o._default))return this.processExportDefault();if(this.tokens.matches2(o._export,o.braceL))return this.processNamedExports();if(this.tokens.matches2(o._export,o.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(o.braceL)){for(;!this.tokens.matches1(o.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(o._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(S._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,o.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),hs(this.tokens)),!0}return!1}processImportEquals(){const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(e)?zf(this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken("const"),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName("require"))):this.tokens.replaceToken("const"),!0}processImport(){if(this.tokens.matches2(o._import,o.parenL))return!1;const e=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(e);!this.tokens.matches1(o.string);)this.tokens.removeToken();this.tokens.removeToken(),hs(this.tokens),this.tokens.matches1(o.semi)&&this.tokens.removeToken()}return!0}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(o._import),this.tokens.matchesContextual(S._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,o.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,S._from))return!0;if(this.tokens.matches1(o.string))return this.tokens.copyToken(),!1;this.tokens.matchesContextual(S._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,S._from)&&this.tokens.copyToken();let e=!1,n=!1,s=!1;if(this.tokens.matches1(o.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(o.comma)&&this.tokens.removeToken()):(e=!0,this.tokens.copyToken(),this.tokens.matches1(o.comma)&&(s=!0,this.tokens.removeToken()))),this.tokens.matches1(o.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(s&&this.tokens.appendCode(","),e=!0,this.tokens.copyExpectedToken(o.star),this.tokens.copyExpectedToken(o.name),this.tokens.copyExpectedToken(o.name));else if(this.tokens.matches1(o.braceL)){for(s&&this.tokens.appendCode(","),this.tokens.copyToken();!this.tokens.matches1(o.braceR);){n=!0;const r=Dr(this.tokens);if(r.isType||this.shouldAutomaticallyElideImportedName(r.rightName)){for(;this.tokens.currentIndex()<r.endIndex;)this.tokens.removeToken();this.tokens.matches1(o.comma)&&this.tokens.removeToken()}else{for(e=!0;this.tokens.currentIndex()<r.endIndex;)this.tokens.copyToken();this.tokens.matches1(o.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(o.braceR)}return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?n&&!e:!1}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}processExportDefault(){if(Hf(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),!0;if(!(this.tokens.matches4(o._export,o._default,o._function,o.name)||this.tokens.matches5(o._export,o._default,o.name,o._function,o.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,S._async)||this.tokens.matches4(o._export,o._default,o._class,o.name)||this.tokens.matches5(o._export,o._default,o._abstract,o._class,o.name))&&this.reactHotLoaderTransformer){const n=this.nameManager.claimFreeName("_default");return this.tokens.replaceToken(`let ${n}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${n} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(n),!0}return!1}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return!1;this.tokens.copyExpectedToken(o._export),this.tokens.copyExpectedToken(o.braceL);const e=qf(this.tokens);let n=!1;for(;!this.tokens.matches1(o.braceR);){const s=Dr(this.tokens);if(s.isType||!e&&this.shouldElideExportedName(s.leftName)){for(;this.tokens.currentIndex()<s.endIndex;)this.tokens.removeToken();this.tokens.matches1(o.comma)&&this.tokens.removeToken()}else{for(n=!0;this.tokens.currentIndex()<s.endIndex;)this.tokens.copyToken();this.tokens.matches1(o.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(o.braceR),!this.keepUnusedImports&&e&&!n&&(this.tokens.removeToken(),this.tokens.removeToken(),hs(this.tokens)),!0}shouldElideExportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(e)&&!this.declarationInfo.valueDeclarations.has(e)}}class Iw extends Vt{constructor(e,n,s){super(),this.rootTransformer=e,this.tokens=n,this.isImportsTransformEnabled=s}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?!0:this.tokens.matches1(o._enum)?(this.processEnum(),!0):this.tokens.matches2(o._export,o._enum)?(this.processNamedExportEnum(),!0):this.tokens.matches3(o._export,o._default,o._enum)?(this.processDefaultExportEnum(),!0):!1}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();const e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${e} = ${e};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${e};`):this.tokens.appendCode(` export default ${e};`)}processEnum(){this.tokens.replaceToken("const"),this.tokens.copyExpectedToken(o.name);let e=!1;this.tokens.matchesContextual(S._of)&&(this.tokens.removeToken(),e=this.tokens.matchesContextual(S._symbol),this.tokens.removeToken());const n=this.tokens.matches3(o.braceL,o.name,o.eq);this.tokens.appendCode(' = require("flow-enums-runtime")');const s=!e&&!n;for(this.tokens.replaceTokenTrimmingLeftWhitespace(s?".Mirrored([":"({");!this.tokens.matches1(o.braceR);){if(this.tokens.matches1(o.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(e,n),this.tokens.matches1(o.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(s?"]);":"});")}processEnumElement(e,n){if(e){const s=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${s}")`)}else n?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(":"),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}function vw(t){let e,n=t[0],s=1;for(;s<t.length;){const r=t[s],i=t[s+1];if(s+=2,(r==="optionalAccess"||r==="optionalCall")&&n==null)return;r==="access"||r==="optionalAccess"?(e=n,n=i(n)):(r==="call"||r==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}const Go="jest",_w=["mock","unmock","enableAutomock","disableAutomock"];class Pc extends Vt{__init(){this.hoistedFunctionNames=[]}constructor(e,n,s,r){super(),this.rootTransformer=e,this.tokens=n,this.nameManager=s,this.importProcessor=r,Pc.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(o.name,o.dot,o.name,o.parenL)&&this.tokens.identifierName()===Go?vw([this,"access",e=>e.importProcessor,"optionalAccess",e=>e.getGlobalNames,"call",e=>e(),"optionalAccess",e=>e.has,"call",e=>e(Go)])?!1:this.extractHoistedCalls():!1}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(e=>`${e}();`).join(""):""}extractHoistedCalls(){this.tokens.removeToken();let e=!1;for(;this.tokens.matches3(o.dot,o.name,o.parenL);){const n=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(_w.includes(n)){const r=this.nameManager.claimFreeName("__jestHoist");this.hoistedFunctionNames.push(r),this.tokens.replaceToken(`function ${r}(){${Go}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR),this.tokens.appendCode(";}"),e=!1}else e?this.tokens.copyToken():this.tokens.replaceToken(`${Go}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.parenR),e=!0}return!0}}class Pw extends Vt{constructor(e){super(),this.tokens=e}process(){if(this.tokens.matches1(o.num)){const e=this.tokens.currentTokenCode();if(e.includes("_"))return this.tokens.replaceToken(e.replace(/_/g,"")),!0}return!1}}class $w extends Vt{constructor(e,n){super(),this.tokens=e,this.nameManager=n}process(){return this.tokens.matches2(o._catch,o.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`),!0):!1}}class Nw extends Vt{constructor(e,n){super(),this.tokens=e,this.nameManager=n}process(){if(this.tokens.matches1(o.nullishCoalescing)){const s=this.tokens.currentToken();return this.tokens.tokens[s.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("):this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("),!0}if(this.tokens.matches1(o._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),!0;const n=this.tokens.currentToken().subscriptStartIndex;if(n!=null&&this.tokens.tokens[n].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==o._super){const s=this.nameManager.claimFreeName("_");let r;if(n>0&&this.tokens.matches1AtIndex(n-1,o._delete)&&this.isLastSubscriptInChain()?r=`${s} => delete ${s}`:r=`${s} => ${s}`,this.tokens.tokens[n].isAsyncOperation&&(r=`async ${r}`),this.tokens.matches2(o.questionDot,o.parenL)||this.tokens.matches2(o.questionDot,o.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${r}`);else if(this.tokens.matches2(o.questionDot,o.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}`);else if(this.tokens.matches1(o.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}.`);else if(this.tokens.matches1(o.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}.`);else if(this.tokens.matches1(o.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}[`);else if(this.tokens.matches1(o.parenL))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${r}(`);else throw new Error("Unexpected subscript operator in optional chain.");return!0}return!1}isLastSubscriptInChain(){let e=0;for(let n=this.tokens.currentIndex()+1;;n++){if(n>=this.tokens.tokens.length)throw new Error("Reached the end of the code while finding the end of the access chain.");if(this.tokens.tokens[n].isOptionalChainStart?e++:this.tokens.tokens[n].isOptionalChainEnd&&e--,e<0)return!0;if(e===0&&this.tokens.tokens[n].subscriptStartIndex!=null)return!1}}justSkippedSuper(){let e=0,n=this.tokens.currentIndex()-1;for(;;){if(n<0)throw new Error("Reached the start of the code while finding the start of the access chain.");if(this.tokens.tokens[n].isOptionalChainStart?e--:this.tokens.tokens[n].isOptionalChainEnd&&e++,e<0)return!1;if(e===0&&this.tokens.tokens[n].subscriptStartIndex!=null)return this.tokens.tokens[n-1].type===o._super;n--}}}class Cw extends Vt{constructor(e,n,s,r){super(),this.rootTransformer=e,this.tokens=n,this.importProcessor=s,this.options=r}process(){const e=this.tokens.currentIndex();if(this.tokens.identifierName()==="createReactClass"){const n=this.importProcessor&&this.importProcessor.getIdentifierReplacement("createReactClass");return n?this.tokens.replaceToken(`(0, ${n})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(e),!0}if(this.tokens.matches3(o.name,o.dot,o.name)&&this.tokens.identifierName()==="React"&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)==="createClass"){const n=this.importProcessor&&this.importProcessor.getIdentifierReplacement("React")||"React";return this.tokens.replaceToken(n),this.tokens.copyToken(),this.tokens.copyToken(),this.tryProcessCreateClassCall(e),!0}return!1}tryProcessCreateClassCall(e){const n=this.findDisplayName(e);n&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(o.parenL),this.tokens.copyExpectedToken(o.braceL),this.tokens.appendCode(`displayName: '${n}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(o.braceR),this.tokens.copyExpectedToken(o.parenR))}findDisplayName(e){return e<2?null:this.tokens.matches2AtIndex(e-2,o.name,o.eq)?this.tokens.identifierNameAtIndex(e-2):e>=2&&this.tokens.tokens[e-2].identifierRole===ge.ObjectKey?this.tokens.identifierNameAtIndex(e-2):this.tokens.matches2AtIndex(e-2,o._export,o._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){const n=(this.options.filePath||"unknown").split("/"),s=n[n.length-1],r=s.lastIndexOf("."),i=r===-1?s:s.slice(0,r);return i==="index"&&n[n.length-2]?n[n.length-2]:i}classNeedsDisplayName(){let e=this.tokens.currentIndex();if(!this.tokens.matches2(o.parenL,o.braceL))return!1;const n=e+1,s=this.tokens.tokens[n].contextId;if(s==null)throw new Error("Expected non-null context ID on object open-brace.");for(;e<this.tokens.tokens.length;e++){const r=this.tokens.tokens[e];if(r.type===o.braceR&&r.contextId===s){e++;break}if(this.tokens.identifierNameAtIndex(e)==="displayName"&&this.tokens.tokens[e].identifierRole===ge.ObjectKey&&r.contextId===s)return!1}if(e===this.tokens.tokens.length)throw new Error("Unexpected end of input when processing React class.");return this.tokens.matches1AtIndex(e,o.parenR)||this.tokens.matches2AtIndex(e,o.comma,o.parenR)}}class $c extends Vt{__init(){this.extractedDefaultExportName=null}constructor(e,n){super(),this.tokens=e,this.filePath=n,$c.prototype.__init.call(this)}setExtractedDefaultExportName(e){this.extractedDefaultExportName=e}getPrefixCode(){return`
179
179
  (function () {
180
180
  var enterModule = require('react-hot-loader').enterModule;
181
181
  enterModule && enterModule(module);