UNPKG

gogoast

Version:

The simplest tool to parse/transform/generate code by ast

1 lines 570 kB
"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function s(e,t){return e(t={exports:{}},t.exports),t.exports}var r={},i=s((function(t,s){var r,i=e&&e.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])})(e,t)},function(e,t){function s(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)});Object.defineProperty(s,"__esModule",{value:!0});var n=Object.prototype,a=n.toString,o=n.hasOwnProperty,l=function(){function e(){}return e.prototype.assert=function(e,t){if(!this.check(e,t)){var s=y(e);throw new Error(s+" does not match type "+this)}return!0},e.prototype.arrayOf=function(){return new c(this)},e}(),c=function(e){function t(t){var s=e.call(this)||this;return s.elemType=t,s.kind="ArrayType",s}return i(t,e),t.prototype.toString=function(){return"["+this.elemType+"]"},t.prototype.check=function(e,t){var s=this;return Array.isArray(e)&&e.every((function(e){return s.elemType.check(e,t)}))},t}(l),h=function(e){function t(t){var s=e.call(this)||this;return s.value=t,s.kind="IdentityType",s}return i(t,e),t.prototype.toString=function(){return String(this.value)},t.prototype.check=function(e,t){var s=e===this.value;return s||"function"!=typeof t||t(this,e),s},t}(l),u=function(e){function t(t){var s=e.call(this)||this;return s.fields=t,s.kind="ObjectType",s}return i(t,e),t.prototype.toString=function(){return"{ "+this.fields.join(", ")+" }"},t.prototype.check=function(e,t){return a.call(e)===a.call({})&&this.fields.every((function(s){return s.type.check(e[s.name],t)}))},t}(l),p=function(e){function t(t){var s=e.call(this)||this;return s.types=t,s.kind="OrType",s}return i(t,e),t.prototype.toString=function(){return this.types.join(" | ")},t.prototype.check=function(e,t){return this.types.some((function(s){return s.check(e,t)}))},t}(l),d=function(e){function t(t,s){var r=e.call(this)||this;return r.name=t,r.predicate=s,r.kind="PredicateType",r}return i(t,e),t.prototype.toString=function(){return this.name},t.prototype.check=function(e,t){var s=this.predicate(e,t);return s||"function"!=typeof t||t(this,e),s},t}(l),f=function(){function e(e,t){this.type=e,this.typeName=t,this.baseNames=[],this.ownFields=Object.create(null),this.allSupertypes=Object.create(null),this.supertypeList=[],this.allFields=Object.create(null),this.fieldNames=[],this.finalized=!1,this.buildable=!1,this.buildParams=[]}return e.prototype.isSupertypeOf=function(t){if(t instanceof e){if(!0!==this.finalized||!0!==t.finalized)throw new Error("");return o.call(t.allSupertypes,this.typeName)}throw new Error(t+" is not a Def")},e.prototype.checkAllFields=function(e,t){var s=this.allFields;if(!0!==this.finalized)throw new Error(""+this.typeName);return null!==e&&"object"==typeof e&&Object.keys(s).every((function(r){var i=s[r],n=i.type,a=i.getValue(e);return n.check(a,t)}))},e.prototype.bases=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var s=this.baseNames;if(this.finalized){if(e.length!==s.length)throw new Error("");for(var r=0;r<e.length;r++)if(e[r]!==s[r])throw new Error("");return this}return e.forEach((function(e){s.indexOf(e)<0&&s.push(e)})),this},e}();s.Def=f;var m=function(){function e(e,t,s,r){this.name=e,this.type=t,this.defaultFn=s,this.hidden=!!r}return e.prototype.toString=function(){return JSON.stringify(this.name)+": "+this.type},e.prototype.getValue=function(e){var t=e[this.name];return void 0!==t||"function"==typeof this.defaultFn&&(t=this.defaultFn.call(e)),t},e}();function y(e){return Array.isArray(e)?"["+e.map(y).join(", ")+"]":e&&"object"==typeof e?"{ "+Object.keys(e).map((function(t){return t+": "+e[t]})).join(", ")+" }":JSON.stringify(e)}s.default=function(e){var t={or:function(){for(var e=[],s=0;s<arguments.length;s++)e[s]=arguments[s];return new p(e.map((function(e){return t.from(e)})))},from:function(e,i){if(e instanceof c||e instanceof h||e instanceof u||e instanceof p||e instanceof d)return e;if(e instanceof f)return e.type;if(g.check(e)){if(1!==e.length)throw new Error("only one element type is permitted for typed arrays");return new c(t.from(e[0]))}if(b.check(e))return new u(Object.keys(e).map((function(s){return new m(s,t.from(e[s],s))})));if("function"==typeof e){var n=s.indexOf(e);if(n>=0)return r[n];if("string"!=typeof i)throw new Error("missing name");return new d(i,e)}return new h(e)},def:function(e){return o.call(v,e)?v[e]:v[e]=new A(e)},hasDef:function(e){return o.call(v,e)}},s=[],r=[],n={};function l(e,t){var i=a.call(e),o=new d(t,(function(e){return a.call(e)===i}));return n[t]=o,e&&"function"==typeof e.constructor&&(s.push(e.constructor),r.push(o)),o}l("truthy","string");var x=l((function(){}),"function"),g=l([],"array"),b=l({},"object"),E=(l(/./,"RegExp"),l(new Date,"Date"),l(3,"number"),l(!0,"boolean"),l(null,"null"),l(void 0,"undefined")),v=Object.create(null);function S(e){if(e&&"object"==typeof e){var t=e.type;if("string"==typeof t&&o.call(v,t)){var s=v[t];if(s.finalized)return s}}return null}var A=function(e){function s(t){var s=e.call(this,new d(t,(function(e,t){return s.check(e,t)})),t)||this;return s}return i(s,e),s.prototype.check=function(e,t){if(!0!==this.finalized)throw new Error("prematurely checking unfinalized type "+this.typeName);if(null===e||"object"!=typeof e)return!1;var s=S(e);return s?t&&s===this?this.checkAllFields(e,t):!!this.isSupertypeOf(s)&&(!t||s.checkAllFields(e,t)&&this.checkAllFields(e,!1)):("SourceLocation"===this.typeName||"Position"===this.typeName)&&this.checkAllFields(e,t)},s.prototype.build=function(){for(var e=this,t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];if(this.buildParams=t,this.buildable)return this;this.field("type",String,(function(){return e.typeName})),this.buildable=!0;var r=function(t,s,r,i){if(!o.call(t,s)){var n=e.allFields;if(!o.call(n,s))throw new Error(""+s);var a,l=n[s],c=l.type;if(i)a=r;else{if(!l.defaultFn){var h="no value or default function given for field "+JSON.stringify(s)+" of "+e.typeName+"("+e.buildParams.map((function(e){return n[e]})).join(", ")+")";throw new Error(h)}a=l.defaultFn.call(t)}if(!c.check(a))throw new Error(y(a)+" does not match field "+l+" of type "+e.typeName);t[s]=a}},i=function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];var i=t.length;if(!e.finalized)throw new Error("attempting to instantiate unfinalized type "+e.typeName);var n=Object.create(w);if(e.buildParams.forEach((function(e,s){s<i?r(n,e,t[s],!0):r(n,e,null,!1)})),Object.keys(e.allFields).forEach((function(e){r(n,e,null,!1)})),n.type!==e.typeName)throw new Error("");return n};return i.from=function(t){if(!e.finalized)throw new Error("attempting to instantiate unfinalized type "+e.typeName);var s=Object.create(w);if(Object.keys(e.allFields).forEach((function(e){o.call(t,e)?r(s,e,t[e],!0):r(s,e,null,!1)})),s.type!==e.typeName)throw new Error("");return s},Object.defineProperty(T,P(this.typeName),{enumerable:!0,value:i}),this},s.prototype.field=function(e,s,r,i){return this.finalized?(console.error("Ignoring attempt to redefine field "+JSON.stringify(e)+" of finalized type "+JSON.stringify(this.typeName)),this):(this.ownFields[e]=new m(e,t.from(s),r,i),this)},s.prototype.finalize=function(){var e=this;if(!this.finalized){var t=this.allFields,s=this.allSupertypes;for(var r in this.baseNames.forEach((function(r){var i=v[r];if(!(i instanceof f)){var n="unknown supertype name "+JSON.stringify(r)+" for subtype "+JSON.stringify(e.typeName);throw new Error(n)}i.finalize(),F(t,i.allFields),F(s,i.allSupertypes)})),F(t,this.ownFields),s[this.typeName]=this,this.fieldNames.length=0,t)o.call(t,r)&&!t[r].hidden&&this.fieldNames.push(r);Object.defineProperty(C,this.typeName,{enumerable:!0,value:this.type}),this.finalized=!0,function(e,t){t.length=0,t.push(e);for(var s=Object.create(null),r=0;r<t.length;++r){e=t[r];var i=v[e];if(!0!==i.finalized)throw new Error("");o.call(s,e)&&delete t[s[e]],s[e]=r,t.push.apply(t,i.baseNames)}for(var n=0,a=n,l=t.length;a<l;++a)o.call(t,a)&&(t[n++]=t[a]);t.length=n}(this.typeName,this.supertypeList),this.buildable&&this.supertypeList.lastIndexOf("Expression")>=0&&function(e){var t=D(e);if(T[t])return;var s=T[P(e)];if(!s)return;var r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return T.expressionStatement(s.apply(T,e))};r.from=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return T.expressionStatement(s.from.apply(T,e))},T[t]=r}(this.typeName)}},s}(f),T=Object.create(null),w={};function P(e){return e.replace(/^[A-Z]+/,(function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}}))}function D(e){return(e=P(e)).replace(/(Expression)?$/,"Statement")}var C={};function k(e){var t=S(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw new Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function N(e,t){var s=S(e);if(s){var r=s.allFields[t];if(r)return r.getValue(e)}return e&&e[t]}function F(e,t){return Object.keys(t).forEach((function(s){e[s]=t[s]})),e}return{Type:t,builtInTypes:n,getSupertypeNames:function(e){if(!o.call(v,e))throw new Error("");var t=v[e];if(!0!==t.finalized)throw new Error("");return t.supertypeList.slice(1)},computeSupertypeLookupTable:function(e){for(var t={},s=Object.keys(v),r=s.length,i=0;i<r;++i){var n=s[i],a=v[n];if(!0!==a.finalized)throw new Error(""+n);for(var l=0;l<a.supertypeList.length;++l){var c=a.supertypeList[l];if(o.call(e,c)){t[n]=c;break}}}return t},builders:T,defineMethod:function(e,t){var s=w[e];return E.check(t)?delete w[e]:(x.assert(t),Object.defineProperty(w,e,{enumerable:!0,configurable:!0,value:t})),s},getBuilderName:P,getStatementBuilderName:D,namedTypes:C,getFieldNames:k,getFieldValue:N,eachField:function(e,t,s){k(e).forEach((function(s){t.call(this,s,N(e,s))}),s)},someField:function(e,t,s){return k(e).some((function(s){return t.call(this,s,N(e,s))}),s)},finalize:function(){Object.keys(v).forEach((function(e){v[e].finalize()}))}}}}));t(i);i.Def;var n=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(i),a=Object.prototype.hasOwnProperty;s.default=function(e){var t=e.use(n.default),s=t.builtInTypes.array,r=t.builtInTypes.number,i=function e(t,s,r){if(!(this instanceof e))throw new Error("Path constructor cannot be invoked without 'new'");if(s){if(!(s instanceof e))throw new Error("")}else s=null,r=null;this.value=t,this.parentPath=s,this.name=r,this.__childCache=null},o=i.prototype;function l(e){return e.__childCache||(e.__childCache=Object.create(null))}function c(e,t){var s=l(e),r=e.getValueProperty(t),i=s[t];return a.call(s,t)&&i.value===r||(i=s[t]=new e.constructor(r,e,t)),i}function h(){}function u(e,t,i,n){if(s.assert(e.value),0===t)return h;var o=e.value.length;if(o<1)return h;var c=arguments.length;2===c?(i=0,n=o):3===c?(i=Math.max(i,0),n=o):(i=Math.max(i,0),n=Math.min(n,o)),r.assert(i),r.assert(n);for(var u=Object.create(null),p=l(e),d=i;d<n;++d)if(a.call(e.value,d)){var f=e.get(d);if(f.name!==d)throw new Error("");var m=d+t;f.name=m,u[m]=f,delete p[d]}return delete p.length,function(){for(var t in u){var s=u[t];if(s.name!==+t)throw new Error("");p[t]=s,e.value[t]=s.value}}}function p(e){if(!(e instanceof i))throw new Error("");var t=e.parentPath;if(!t)return e;var r=t.value,n=l(t);if(r[e.name]===e.value)n[e.name]=e;else if(s.check(r)){var a=r.indexOf(e.value);a>=0&&(n[e.name=a]=e)}else r[e.name]=e.value,n[e.name]=e;if(r[e.name]!==e.value)throw new Error("");if(e.parentPath.get(e.name)!==e)throw new Error("");return e}return o.getValueProperty=function(e){return this.value[e]},o.get=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var s=this,r=e.length,i=0;i<r;++i)s=c(s,e[i]);return s},o.each=function(e,t){var s=[],r=this.value.length,i=0;for(i=0;i<r;++i)a.call(this.value,i)&&(s[i]=this.get(i));for(t=t||this,i=0;i<r;++i)a.call(s,i)&&e.call(t,s[i])},o.map=function(e,t){var s=[];return this.each((function(t){s.push(e.call(this,t))}),t),s},o.filter=function(e,t){var s=[];return this.each((function(t){e.call(this,t)&&s.push(t)}),t),s},o.shift=function(){var e=u(this,-1),t=this.value.shift();return e(),t},o.unshift=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var s=u(this,e.length),r=this.value.unshift.apply(this.value,e);return s(),r},o.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.assert(this.value),delete l(this).length,this.value.push.apply(this.value,e)},o.pop=function(){s.assert(this.value);var e=l(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},o.insertAt=function(e){var t=arguments.length,s=u(this,t-1,e);if(s===h&&t<=1)return this;e=Math.max(e,0);for(var r=1;r<t;++r)this.value[e+r-1]=arguments[r];return s(),this},o.insertBefore=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var s=this.parentPath,r=e.length,i=[this.name],n=0;n<r;++n)i.push(e[n]);return s.insertAt.apply(s,i)},o.insertAfter=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var s=this.parentPath,r=e.length,i=[this.name+1],n=0;n<r;++n)i.push(e[n]);return s.insertAt.apply(s,i)},o.replace=function(e){var t=[],r=this.parentPath.value,i=l(this.parentPath),n=arguments.length;if(p(this),s.check(r)){for(var a=r.length,o=u(this.parentPath,n-1,this.name+1),c=[this.name,1],h=0;h<n;++h)c.push(arguments[h]);var d=r.splice.apply(r,c);if(d[0]!==this.value)throw new Error("");if(r.length!==a-1+n)throw new Error("");if(o(),0===n)delete this.value,delete i[this.name],this.__childCache=null;else{if(r[this.name]!==e)throw new Error("");for(this.value!==e&&(this.value=e,this.__childCache=null),h=0;h<n;++h)t.push(this.parentPath.get(this.name+h));if(t[0]!==this)throw new Error("")}}else if(1===n)this.value!==e&&(this.__childCache=null),this.value=r[this.name]=e,t.push(this);else{if(0!==n)throw new Error("Could not replace path");delete r[this.name],delete this.value,this.__childCache=null}return t},i},t.exports=s.default}));t(n);var a=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(i),a=Object.prototype.hasOwnProperty;s.default=function(e){var t=e.use(n.default),s=t.Type,r=t.namedTypes,i=r.Node,o=r.Expression,l=t.builtInTypes.array,c=t.builders,h=function e(t,s){if(!(this instanceof e))throw new Error("Scope constructor cannot be invoked without 'new'");var r;if(p.assert(t.value),s){if(!(s instanceof e))throw new Error("");r=s.depth+1}else s=null,r=0;Object.defineProperties(this,{path:{value:t},node:{value:t.value},isGlobal:{value:!s,enumerable:!0},depth:{value:r},parent:{value:s},bindings:{value:{}},types:{value:{}}})},u=[r.Program,r.Function,r.CatchClause],p=s.or.apply(s,u);h.isEstablishedBy=function(e){return p.check(e)};var d=h.prototype;function f(e,s,n){var c=e.value;e.parent&&r.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&y(e.parent.get("id"),s),c&&(l.check(c)?e.each((function(e){m(e,s,n)})):r.Function.check(c)?(e.get("params").each((function(e){y(e,s)})),m(e.get("body"),s,n)):r.TypeAlias&&r.TypeAlias.check(c)||r.InterfaceDeclaration&&r.InterfaceDeclaration.check(c)||r.TSTypeAliasDeclaration&&r.TSTypeAliasDeclaration.check(c)||r.TSInterfaceDeclaration&&r.TSInterfaceDeclaration.check(c)?function(e,t){var s=e.value;r.Pattern.assert(s),r.Identifier.check(s)&&(a.call(t,s.name)?t[s.name].push(e):t[s.name]=[e])}(e.get("id"),n):r.VariableDeclarator.check(c)?(y(e.get("id"),s),m(e.get("init"),s,n)):"ImportSpecifier"===c.type||"ImportNamespaceSpecifier"===c.type||"ImportDefaultSpecifier"===c.type?y(e.get(c.local?"local":c.name?"name":"id"),s):i.check(c)&&!o.check(c)&&t.eachField(c,(function(t,r){var i=e.get(t);if(!function(e,t){if(e.value===t)return!0;if(Array.isArray(e.value)&&0===e.value.length&&Array.isArray(t)&&0===t.length)return!0;return!1}(i,r))throw new Error("");m(i,s,n)})))}function m(e,t,s){var i=e.value;if(!i||o.check(i));else if(r.FunctionDeclaration.check(i)&&null!==i.id)y(e.get("id"),t);else if(r.ClassDeclaration&&r.ClassDeclaration.check(i))y(e.get("id"),t);else if(p.check(i)){if(r.CatchClause.check(i)&&r.Identifier.check(i.param)){var n=i.param.name,l=a.call(t,n);f(e.get("body"),t,s),l||delete t[n]}}else f(e,t,s)}function y(e,t){var s=e.value;r.Pattern.assert(s),r.Identifier.check(s)?a.call(t,s.name)?t[s.name].push(e):t[s.name]=[e]:r.AssignmentPattern&&r.AssignmentPattern.check(s)?y(e.get("left"),t):r.ObjectPattern&&r.ObjectPattern.check(s)?e.get("properties").each((function(e){var s=e.value;r.Pattern.check(s)?y(e,t):r.Property.check(s)?y(e.get("value"),t):r.SpreadProperty&&r.SpreadProperty.check(s)&&y(e.get("argument"),t)})):r.ArrayPattern&&r.ArrayPattern.check(s)?e.get("elements").each((function(e){var s=e.value;r.Pattern.check(s)?y(e,t):r.SpreadElement&&r.SpreadElement.check(s)&&y(e.get("argument"),t)})):r.PropertyPattern&&r.PropertyPattern.check(s)?y(e.get("pattern"),t):(r.SpreadElementPattern&&r.SpreadElementPattern.check(s)||r.SpreadPropertyPattern&&r.SpreadPropertyPattern.check(s))&&y(e.get("argument"),t)}return d.didScan=!1,d.declares=function(e){return this.scan(),a.call(this.bindings,e)},d.declaresType=function(e){return this.scan(),a.call(this.types,e)},d.declareTemporary=function(e){if(e){if(!/^[a-z$_]/i.test(e))throw new Error("")}else e="t$";e+=this.depth.toString(36)+"$",this.scan();for(var s=0;this.declares(e+s);)++s;var r=e+s;return this.bindings[r]=t.builders.identifier(r)},d.injectTemporary=function(e,t){e||(e=this.declareTemporary());var s=this.path.get("body");return r.BlockStatement.check(s.value)&&(s=s.get("body")),s.unshift(c.variableDeclaration("var",[c.variableDeclarator(e,t||null)])),e},d.scan=function(e){if(e||!this.didScan){for(var t in this.bindings)delete this.bindings[t];!function(e,t,s){var i=e.value;p.assert(i),r.CatchClause.check(i)?y(e.get("param"),t):f(e,t,s)}(this.path,this.bindings,this.types),this.didScan=!0}},d.getBindings=function(){return this.scan(),this.bindings},d.getTypes=function(){return this.scan(),this.types},d.lookup=function(e){for(var t=this;t&&!t.declares(e);t=t.parent);return t},d.lookupType=function(e){for(var t=this;t&&!t.declaresType(e);t=t.parent);return t},d.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},h},t.exports=s.default}));t(a);var o=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=r(i),l=r(n),c=r(a);s.default=function(e){var t=e.use(o.default),s=t.namedTypes,r=t.builders,i=t.builtInTypes.number,n=t.builtInTypes.array,a=e.use(l.default),h=e.use(c.default),u=function e(t,s,r){if(!(this instanceof e))throw new Error("NodePath constructor cannot be invoked without 'new'");a.call(this,t,s,r)},p=u.prototype=Object.create(a.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}});function d(e){return s.BinaryExpression.check(e)||s.LogicalExpression.check(e)}Object.defineProperties(p,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),p.replace=function(){return delete this.node,delete this.parent,delete this.scope,a.prototype.replace.apply(this,arguments)},p.prune=function(){var e=this.parent;return this.replace(),function(e){if(s.VariableDeclaration.check(e.node)){var t=e.get("declarations").value;if(!t||0===t.length)return e.prune()}else if(s.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else s.IfStatement.check(e.node)&&function(e){var t=e.get("test").value,i=e.get("alternate").value,n=e.get("consequent").value;if(n||i){if(!n&&i){var a=r.unaryExpression("!",t,!0);s.UnaryExpression.check(t)&&"!"===t.operator&&(a=t.argument),e.get("test").replace(a),e.get("consequent").replace(i),e.get("alternate").replace()}}else{var o=r.expressionStatement(t);e.replace(o)}}(e);return e}(e)},p._computeNode=function(){var e=this.value;if(s.Node.check(e))return e;var t=this.parentPath;return t&&t.node||null},p._computeParent=function(){var e=this.value,t=this.parentPath;if(!s.Node.check(e)){for(;t&&!s.Node.check(t.value);)t=t.parentPath;t&&(t=t.parentPath)}for(;t&&!s.Node.check(t.value);)t=t.parentPath;return t||null},p._computeScope=function(){var e=this.value,t=this.parentPath,r=t&&t.scope;return s.Node.check(e)&&h.isEstablishedBy(e)&&(r=new h(this,r)),r||null},p.getValueProperty=function(e){return t.getFieldValue(this.value,e)},p.needsParens=function(e){var t=this.parentPath;if(!t)return!1;var r=this.value;if(!s.Expression.check(r))return!1;if("Identifier"===r.type)return!1;for(;!s.Node.check(t.value);)if(!(t=t.parentPath))return!1;var n=t.value;switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===n.type&&"object"===this.name&&n.object===r;case"BinaryExpression":case"LogicalExpression":switch(n.type){case"CallExpression":return"callee"===this.name&&n.callee===r;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&n.object===r;case"BinaryExpression":case"LogicalExpression":var a=r,o=n.operator,l=f[o],c=a.operator,h=f[c];if(l>h)return!0;if(l===h&&"right"===this.name){if(n.right!==a)throw new Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(n.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(n.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===n.type&&i.check(r.value)&&"object"===this.name&&n.object===r;case"AssignmentExpression":case"ConditionalExpression":switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&n.callee===r;case"ConditionalExpression":return"test"===this.name&&n.test===r;case"MemberExpression":return"object"===this.name&&n.object===r;default:return!1}default:if("NewExpression"===n.type&&"callee"===this.name&&n.callee===r)return m(r)}return!(!0===e||this.canBeFirstInStatement()||!this.firstInStatement())};var f={};function m(e){return!!s.CallExpression.check(e)||(n.check(e)?e.some(m):!!s.Node.check(e)&&t.someField(e,(function(e,t){return m(t)})))}return[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach((function(e,t){e.forEach((function(e){f[e]=t}))})),p.canBeFirstInStatement=function(){var e=this.node;return!s.FunctionExpression.check(e)&&!s.ObjectExpression.check(e)},p.firstInStatement=function(){return function(e){for(var t,r;e.parent;e=e.parent){if(t=e.node,r=e.parent.node,s.BlockStatement.check(r)&&"body"===e.parent.name&&0===e.name){if(r.body[0]!==t)throw new Error("Nodes must be equal");return!0}if(s.ExpressionStatement.check(r)&&"expression"===e.name){if(r.expression!==t)throw new Error("Nodes must be equal");return!0}if(s.SequenceExpression.check(r)&&"expressions"===e.parent.name&&0===e.name){if(r.expressions[0]!==t)throw new Error("Nodes must be equal")}else if(s.CallExpression.check(r)&&"callee"===e.name){if(r.callee!==t)throw new Error("Nodes must be equal")}else if(s.MemberExpression.check(r)&&"object"===e.name){if(r.object!==t)throw new Error("Nodes must be equal")}else if(s.ConditionalExpression.check(r)&&"test"===e.name){if(r.test!==t)throw new Error("Nodes must be equal")}else if(d(r)&&"left"===e.name){if(r.left!==t)throw new Error("Nodes must be equal")}else{if(!s.UnaryExpression.check(r)||r.prefix||"argument"!==e.name)return!1;if(r.argument!==t)throw new Error("Nodes must be equal")}}return!0}(this)},u},t.exports=s.default}));t(o);var l=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(i),a=r(o),l=Object.prototype.hasOwnProperty;s.default=function(e){var t=e.use(n.default),s=e.use(a.default),r=t.builtInTypes.array,i=t.builtInTypes.object,o=t.builtInTypes.function,c=function e(){if(!(this instanceof e))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=function(e){var s=Object.create(null);for(var r in e)/^visit[A-Z]/.test(r)&&(s[r.slice("visit".length)]=!0);for(var i=t.computeSupertypeLookupTable(s),n=Object.create(null),a=Object.keys(i),l=a.length,c=0;c<l;++c){var h=a[c];r="visit"+i[h],o.check(e[r])&&(n[h]=r)}return n}(this),this._shouldVisitComments=l.call(this._methodNameTable,"Block")||l.call(this._methodNameTable,"Line"),this.Context=d(this),this._visiting=!1,this._changeReported=!1};function h(e,t){for(var s in t)l.call(t,s)&&(e[s]=t[s]);return e}c.fromMethodsObject=function(e){if(e instanceof c)return e;if(!i.check(e))return new c;var t=function e(){if(!(this instanceof e))throw new Error("Visitor constructor cannot be invoked without 'new'");c.call(this)},s=t.prototype=Object.create(u);return s.constructor=t,h(s,e),h(t,c),o.assert(t.fromMethodsObject),o.assert(t.visit),new t},c.visit=function(e,t){return c.fromMethodsObject(t).visit(e)};var u=c.prototype;function p(e,n){if(!(e instanceof s))throw new Error("");if(!(n instanceof c))throw new Error("");var a=e.value;if(r.check(a))e.each(n.visitWithoutReset,n);else if(i.check(a)){var o=t.getFieldNames(a);n._shouldVisitComments&&a.comments&&o.indexOf("comments")<0&&o.push("comments");for(var h=o.length,u=[],p=0;p<h;++p){var d=o[p];l.call(a,d)||(a[d]=t.getFieldValue(a,d)),u.push(e.get(d))}for(p=0;p<h;++p)n.visitWithoutReset(u[p])}else;return e.value}function d(e){function t(r){if(!(this instanceof t))throw new Error("");if(!(this instanceof c))throw new Error("");if(!(r instanceof s))throw new Error("");Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=r,this.needToCallTraverse=!0,Object.seal(this)}if(!(e instanceof c))throw new Error("");var r=t.prototype=Object.create(e);return r.constructor=t,h(r,f),t}u.visit=function(){if(this._visiting)throw new Error("Recursively calling visitor.visit(path) resets visitor state. Try this.visit(path) or this.traverse(path) instead.");this._visiting=!0,this._changeReported=!1,this._abortRequested=!1;for(var e,t=arguments.length,r=new Array(t),i=0;i<t;++i)r[i]=arguments[i];r[0]instanceof s||(r[0]=new s({root:r[0]}).get("root")),this.reset.apply(this,r);try{var n=this.visitWithoutReset(r[0]);e=!0}finally{if(this._visiting=!1,!e&&this._abortRequested)return r[0].value}return n},u.AbortRequest=function(){},u.abort=function(){var e=this;e._abortRequested=!0;var t=new e.AbortRequest;throw t.cancel=function(){e._abortRequested=!1},t},u.reset=function(e){},u.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);if(!(e instanceof s))throw new Error("");var t=e.value,r=t&&"object"==typeof t&&"string"==typeof t.type&&this._methodNameTable[t.type];if(!r)return p(e,this);var i=this.acquireContext(e);try{return i.invokeVisitorMethod(r)}finally{this.releaseContext(i)}},u.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},u.releaseContext=function(e){if(!(e instanceof this.Context))throw new Error("");this._reusableContextStack.push(e),e.currentPath=null},u.reportChanged=function(){this._changeReported=!0},u.wasChangeReported=function(){return this._changeReported};var f=Object.create(null);return f.reset=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof s))throw new Error("");return this.currentPath=e,this.needToCallTraverse=!0,this},f.invokeVisitorMethod=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(this.currentPath instanceof s))throw new Error("");var t=this.visitor[e].call(this,this.currentPath);if(!1===t?this.needToCallTraverse=!1:void 0!==t&&(this.currentPath=this.currentPath.replace(t)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),!1!==this.needToCallTraverse)throw new Error("Must either call this.traverse or return false in "+e);var r=this.currentPath;return r&&r.value},f.traverse=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof s))throw new Error("");if(!(this.currentPath instanceof s))throw new Error("");return this.needToCallTraverse=!1,p(e,c.fromMethodsObject(t||this.visitor))},f.visit=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof s))throw new Error("");if(!(this.currentPath instanceof s))throw new Error("");return this.needToCallTraverse=!1,c.fromMethodsObject(t||this.visitor).visitWithoutReset(e)},f.reportChanged=function(){this.visitor.reportChanged()},f.abort=function(){this.needToCallTraverse=!1,this.visitor.abort()},c},t.exports=s.default}));t(l);var c=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(i);s.default=function(e){var t=e.use(n.default),s=t.getFieldNames,r=t.getFieldValue,i=t.builtInTypes.array,a=t.builtInTypes.object,o=t.builtInTypes.Date,l=t.builtInTypes.RegExp,c=Object.prototype.hasOwnProperty;function h(e,t,s){return i.check(s)?s.length=0:s=null,p(e,t,s)}function u(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function p(e,t,n){return e===t||(i.check(e)?function(e,t,s){i.assert(e);var r=e.length;if(!i.check(t)||t.length!==r)return s&&s.push("length"),!1;for(var n=0;n<r;++n){if(s&&s.push(n),n in e!=n in t)return!1;if(!p(e[n],t[n],s))return!1;if(s){var a=s.pop();if(a!==n)throw new Error(""+a)}}return!0}(e,t,n):a.check(e)?function(e,t,i){if(a.assert(e),!a.check(t))return!1;if(e.type!==t.type)return i&&i.push("type"),!1;var n=s(e),o=n.length,l=s(t),h=l.length;if(o===h){for(var u=0;u<o;++u){var d=n[u],f=r(e,d),m=r(t,d);if(i&&i.push(d),!p(f,m,i))return!1;if(i){var y=i.pop();if(y!==d)throw new Error(""+y)}}return!0}if(!i)return!1;var x=Object.create(null);for(u=0;u<o;++u)x[n[u]]=!0;for(u=0;u<h;++u){if(d=l[u],!c.call(x,d))return i.push(d),!1;delete x[d]}for(d in x){i.push(d);break}return!1}(e,t,n):o.check(e)?o.check(t)&&+e==+t:l.check(e)?l.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t)}return h.assert=function(e,t){var s=[];if(!h(e,t,s)){if(0!==s.length)throw new Error("Nodes differ in the following path: "+s.map(u).join(""));if(e!==t)throw new Error("Nodes must be equal")}},h},t.exports=s.default}));t(c);var h=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var a=r(i),h=r(l),u=r(c),p=r(n),d=r(o);s.default=function(e){var t=function(){var e=[],t=[];var s={use:function(r){var i=e.indexOf(r);return-1===i&&(i=e.length,e.push(r),t[i]=r(s)),t[i]}};return s}(),s=t.use(a.default);e.forEach(t.use),s.finalize();var r=t.use(h.default);return{Type:s.Type,builtInTypes:s.builtInTypes,namedTypes:s.namedTypes,builders:s.builders,defineMethod:s.defineMethod,getFieldNames:s.getFieldNames,getFieldValue:s.getFieldValue,eachField:s.eachField,someField:s.someField,getSupertypeNames:s.getSupertypeNames,getBuilderName:s.getBuilderName,astNodesAreEquivalent:t.use(u.default),finalize:s.finalize,Path:t.use(p.default),NodePath:t.use(d.default),PathVisitor:r,use:t.use,visit:r.visit}},t.exports=s.default}));t(h);var u=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(i);s.default=function(e){var t=e.use(n.default),s=t.Type,r=t.builtInTypes,i=r.number,a=s.or(r.string,r.number,r.boolean,r.null,r.undefined);return{geq:function(e){return s.from((function(t){return i.check(t)&&t>=e}),i+" >= "+e)},defaults:{null:function(){return null},emptyArray:function(){return[]},false:function(){return!1},true:function(){return!0},undefined:function(){},"use strict":function(){return"use strict"}},isPrimitive:s.from((function(e){if(null===e)return!0;var t=typeof e;return"object"!==t&&"function"!==t}),a.toString())}},t.exports=s.default}));t(u);var p=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(i),a=r(u);s.default=function(e){var t=e.use(n.default).Type,s=t.def,r=t.or,i=e.use(a.default),o=i.defaults,l=i.geq;s("Printable").field("loc",r(s("SourceLocation"),null),o.null,!0),s("Node").bases("Printable").field("type",String).field("comments",r([s("Comment")],null),o.null,!0),s("SourceLocation").field("start",s("Position")).field("end",s("Position")).field("source",r(String,null),o.null),s("Position").field("line",l(1)).field("column",l(0)),s("File").bases("Node").build("program","name").field("program",s("Program")).field("name",r(String,null),o.null),s("Program").bases("Node").build("body").field("body",[s("Statement")]),s("Function").bases("Node").field("id",r(s("Identifier"),null),o.null).field("params",[s("Pattern")]).field("body",s("BlockStatement")).field("generator",Boolean,o.false).field("async",Boolean,o.false),s("Statement").bases("Node"),s("EmptyStatement").bases("Statement").build(),s("BlockStatement").bases("Statement").build("body").field("body",[s("Statement")]),s("ExpressionStatement").bases("Statement").build("expression").field("expression",s("Expression")),s("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",s("Expression")).field("consequent",s("Statement")).field("alternate",r(s("Statement"),null),o.null),s("LabeledStatement").bases("Statement").build("label","body").field("label",s("Identifier")).field("body",s("Statement")),s("BreakStatement").bases("Statement").build("label").field("label",r(s("Identifier"),null),o.null),s("ContinueStatement").bases("Statement").build("label").field("label",r(s("Identifier"),null),o.null),s("WithStatement").bases("Statement").build("object","body").field("object",s("Expression")).field("body",s("Statement")),s("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",s("Expression")).field("cases",[s("SwitchCase")]).field("lexical",Boolean,o.false),s("ReturnStatement").bases("Statement").build("argument").field("argument",r(s("Expression"),null)),s("ThrowStatement").bases("Statement").build("argument").field("argument",s("Expression")),s("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",s("BlockStatement")).field("handler",r(s("CatchClause"),null),(function(){return this.handlers&&this.handlers[0]||null})).field("handlers",[s("CatchClause")],(function(){return this.handler?[this.handler]:[]}),!0).field("guardedHandlers",[s("CatchClause")],o.emptyArray).field("finalizer",r(s("BlockStatement"),null),o.null),s("CatchClause").bases("Node").build("param","guard","body").field("param",r(s("Pattern"),null),o.null).field("guard",r(s("Expression"),null),o.null).field("body",s("BlockStatement")),s("WhileStatement").bases("Statement").build("test","body").field("test",s("Expression")).field("body",s("Statement")),s("DoWhileStatement").bases("Statement").build("body","test").field("body",s("Statement")).field("test",s("Expression")),s("ForStatement").bases("Statement").build("init","test","update","body").field("init",r(s("VariableDeclaration"),s("Expression"),null)).field("test",r(s("Expression"),null)).field("update",r(s("Expression"),null)).field("body",s("Statement")),s("ForInStatement").bases("Statement").build("left","right","body").field("left",r(s("VariableDeclaration"),s("Expression"))).field("right",s("Expression")).field("body",s("Statement")),s("DebuggerStatement").bases("Statement").build(),s("Declaration").bases("Statement"),s("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",s("Identifier")),s("FunctionExpression").bases("Function","Expression").build("id","params","body"),s("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",r("var","let","const")).field("declarations",[s("VariableDeclarator")]),s("VariableDeclarator").bases("Node").build("id","init").field("id",s("Pattern")).field("init",r(s("Expression"),null),o.null),s("Expression").bases("Node"),s("ThisExpression").bases("Expression").build(),s("ArrayExpression").bases("Expression").build("elements").field("elements",[r(s("Expression"),null)]),s("ObjectExpression").bases("Expression").build("properties").field("properties",[s("Property")]),s("Property").bases("Node").build("kind","key","value").field("kind",r("init","get","set")).field("key",r(s("Literal"),s("Identifier"))).field("value",s("Expression")),s("SequenceExpression").bases("Expression").build("expressions").field("expressions",[s("Expression")]);var c=r("-","+","!","~","typeof","void","delete");s("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",c).field("argument",s("Expression")).field("prefix",Boolean,o.true);var h=r("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","**","&","|","^","in","instanceof");s("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",s("Expression")).field("right",s("Expression"));var u=r("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");s("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",u).field("left",r(s("Pattern"),s("MemberExpression"))).field("right",s("Expression"));var p=r("++","--");s("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",p).field("argument",s("Expression")).field("prefix",Boolean);var d=r("||","&&");s("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",d).field("left",s("Expression")).field("right",s("Expression")),s("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",s("Expression")).field("consequent",s("Expression")).field("alternate",s("Expression")),s("NewExpression").bases("Expression").build("callee","arguments").field("callee",s("Expression")).field("arguments",[s("Expression")]),s("CallExpression").bases("Expression").build("callee","arguments").field("callee",s("Expression")).field("arguments",[s("Expression")]),s("MemberExpression").bases("Expression").build("object","property","computed").field("object",s("Expression")).field("property",r(s("Identifier"),s("Expression"))).field("computed",Boolean,(function(){var e=this.property.type;return"Literal"===e||"MemberExpression"===e||"BinaryExpression"===e})),s("Pattern").bases("Node"),s("SwitchCase").bases("Node").build("test","consequent").field("test",r(s("Expression"),null)).field("consequent",[s("Statement")]),s("Identifier").bases("Expression","Pattern").build("name").field("name",String).field("optional",Boolean,o.false),s("Literal").bases("Expression").build("value").field("value",r(String,Boolean,null,Number,RegExp)).field("regex",r({pattern:String,flags:String},null),(function(){if(this.value instanceof RegExp){var e="";return this.value.ignoreCase&&(e+="i"),this.value.multiline&&(e+="m"),this.value.global&&(e+="g"),{pattern:this.value.source,flags:e}}return null})),s("Comment").bases("Printable").field("value",String).field("leading",Boolean,o.true).field("trailing",Boolean,o.false)},t.exports=s.default}));t(p);var d=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(p),a=r(i),o=r(u);s.default=function(e){e.use(n.default);var t=e.use(a.default),s=t.Type.def,r=t.Type.or,i=e.use(o.default).defaults;s("Function").field("generator",Boolean,i.false).field("expression",Boolean,i.false).field("defaults",[r(s("Expression"),null)],i.emptyArray).field("rest",r(s("Identifier"),null),i.null),s("RestElement").bases("Pattern").build("argument").field("argument",s("Pattern")).field("typeAnnotation",r(s("TypeAnnotation"),s("TSTypeAnnotation"),null),i.null),s("SpreadElementPattern").bases("Pattern").build("argument").field("argument",s("Pattern")),s("FunctionDeclaration").build("id","params","body","generator","expression"),s("FunctionExpression").build("id","params","body","generator","expression"),s("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,i.null).field("body",r(s("BlockStatement"),s("Expression"))).field("generator",!1,i.false),s("ForOfStatement").bases("Statement").build("left","right","body").field("left",r(s("VariableDeclaration"),s("Pattern"))).field("right",s("Expression")).field("body",s("Statement")),s("YieldExpression").bases("Expression").build("argument","delegate").field("argument",r(s("Expression"),null)).field("delegate",Boolean,i.false),s("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",s("Expression")).field("blocks",[s("ComprehensionBlock")]).field("filter",r(s("Expression"),null)),s("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",s("Expression")).field("blocks",[s("ComprehensionBlock")]).field("filter",r(s("Expression"),null)),s("ComprehensionBlock").bases("Node").build("left","right","each").field("left",s("Pattern")).field("right",s("Expression")).field("each",Boolean),s("Property").field("key",r(s("Literal"),s("Identifier"),s("Expression"))).field("value",r(s("Expression"),s("Pattern"))).field("method",Boolean,i.false).field("shorthand",Boolean,i.false).field("computed",Boolean,i.false),s("ObjectProperty").field("shorthand",Boolean,i.false),s("PropertyPattern").bases("Pattern").build("key","pattern").field("key",r(s("Literal"),s("Identifier"),s("Expression"))).field("pattern",s("Pattern")).field("computed",Boolean,i.false),s("ObjectPattern").bases("Pattern").build("properties").field("properties",[r(s("PropertyPattern"),s("Property"))]),s("ArrayPattern").bases("Pattern").build("elements").field("elements",[r(s("Pattern"),null)]),s("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",r("constructor","method","get","set")).field("key",s("Expression")).field("value",s("Function")).field("computed",Boolean,i.false).field("static",Boolean,i.false),s("SpreadElement").bases("Node").build("argument").field("argument",s("Expression")),s("ArrayExpression").field("elements",[r(s("Expression"),s("SpreadElement"),s("RestElement"),null)]),s("NewExpression").field("arguments",[r(s("Expression"),s("SpreadElement"))]),s("CallExpression").field("arguments",[r(s("Expression"),s("SpreadElement"))]),s("AssignmentPattern").bases("Pattern").build("left","right").field("left",s("Pattern")).field("right",s("Expression"));var l=r(s("MethodDefinition"),s("VariableDeclarator"),s("ClassPropertyDefinition"),s("ClassProperty"));s("ClassProperty").bases("Declaration").build("key").field("key",r(s("Literal"),s("Identifier"),s("Expression"))).field("computed",Boolean,i.false),s("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",l),s("ClassBody").bases("Declaration").build("body").field("body",[l]),s("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",r(s("Identifier"),null)).field("body",s("ClassBody")).field("superClass",r(s("Expression"),null),i.null),s("ClassExpression").bases("Expression").build("id","body","superClass").field("id",r(s("Identifier"),null),i.null).field("body",s("ClassBody")).field("superClass",r(s("Expression"),null),i.null),s("Specifier").bases("Node"),s("ModuleSpecifier").bases("Specifier").field("local",r(s("Identifier"),null),i.null).field("id",r(s("Identifier"),null),i.null).field("name",r(s("Identifier"),null),i.null),s("ImportSpecifier").bases("ModuleSpecifier").build("id","name"),s("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("id"),s("ImportDefaultSpecifier").bases("ModuleSpecifier").build("id"),s("ImportDeclaration").bases("Declaration").build("specifiers","source","importKind").field("specifiers",[r(s("ImportSpecifier"),s("ImportNamespaceSpecifier"),s("ImportDefaultSpecifier"))],i.emptyArray).field("source",s("Literal")).field("importKind",r("value","type"),(function(){return"value"})),s("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",s("Expression")).field("quasi",s("TemplateLiteral")),s("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[s("TemplateElement")]).field("expressions",[s("Expression")]),s("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean)},t.exports=s.default}));t(d);var f=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(d),a=r(i),o=r(u);s.default=function(e){e.use(n.default);var t=e.use(a.default),s=t.Type.def,r=t.Type.or,i=e.use(o.default).defaults;s("Function").field("async",Boolean,i.false),s("SpreadProperty").bases("Node").build("argument").field("argument",s("Expression")),s("ObjectExpression").field("properties",[r(s("Property"),s("SpreadProperty"),s("SpreadElement"))]),s("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",s("Pattern")),s("ObjectPattern").field("properties",[r(s("Property"),s("PropertyPattern"),s("SpreadPropertyPattern"))]),s("AwaitExpression").bases("Expression").build("argument","all").field("argument",r(s("Expression"),null)).field("all",Boolean,i.false)},t.exports=s.default}));t(f);var m=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(f),a=r(i),o=r(u);s.default=function(e){e.use(n.default);var t=e.use(a.default),s=t.Type.def,r=t.Type.or,i=e.use(o.default).defaults;s("JSXAttribute").bases("Node").build("name","value").field("name",r(s("JSXIdentifier"),s("JSXNamespacedName"))).field("value",r(s("Literal"),s("JSXExpressionContainer"),null),i.null),s("JSXIdentifier").bases("Identifier").build("name").field("name",String),s("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",s("JSXIdentifier")).field("name",s("JSXIdentifier")),s("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",r(s("JSXIdentifier"),s("JSXMemberExpression"))).field("property",s("JSXIdentifier")).field("computed",Boolean,i.false);var l=r(s("JSXIdentifier"),s("JSXNamespacedName"),s("JSXMemberExpression"));s("JSXSpreadAttribute").bases("Node").build("argument").field("argument",s("Expression"));var c=[r(s("JSXAttribute"),s("JSXSpreadAttribute"))];s("JSXExpressionContainer").bases("Expression").build("expression").field("expression",s("Expression")),s("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",s("JSXOpeningElement")).field("closingElement",r(s("JSXClosingElement"),null),i.null).field("children",[r(s("JSXElement"),s("JSXExpressionContainer"),s("JSXFragment"),s("JSXText"),s("Literal"))],i.emptyArray).field("name",l,(function(){return this.openingElement.name}),!0).field("selfClosing",Boolean,(function(){return this.openingElement.selfClosing}),!0).field("attributes",c,(function(){return this.openingElement.attributes}),!0),s("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",l).field("attributes",c,i.emptyArray).field("selfClosing",Boolean,i.false),s("JSXClosingElement").bases("Node").build("name").field("name",l),s("JSXFragment").bases("Expression").build("openingElement","closingElement","children").field("openingElement",s("JSXOpeningFragment")).field("closingElement",s("JSXClosingFragment")).field("children",[r(s("JSXElement"),s("JSXExpressionContainer"),s("JSXFragment"),s("JSXText"),s("Literal"))],i.emptyArray),s("JSXOpeningFragment").bases("Node").build(),s("JSXClosingFragment").bases("Node").build(),s("JSXText").bases("Literal").build("value").field("value",String),s("JSXEmptyExpression").bases("Expression").build(),s("JSXSpreadChild").bases("Expression").build("expression").field("expression",s("Expression"))},t.exports=s.default}));t(m);var y=s((function(t,s){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var n=r(i),a=r(u);s.default=function(e){var t=e.use(n.default),s=t.Type.def,r=t.Type.or,i=e.use(a.default).defaults,o=r(s("TypeAnnotation"),s("TSTypeAnnotation"),null),l=r(s("TypeParameterDeclaration"),s("TSTypeParameterDeclaration"),null);s("Identifier").field("typeAnnotation",o,i.null),s("ObjectPattern").field("typeAnnotation",o,i.null),s("Function").field("returnType",o,i.null).field("typeParameters",l,i.null),s("ClassProperty").build("key","value","typeAnnotation","static").field("value",r(s("Expression"),null)).field("static",Boolean,i.false).field("typeAnnotation",o,i.null),["ClassDeclaration","ClassExpression"].forEach((function(e){s(e).field("typeParameters",l,i.null).field("superTypeParameters",r(s("TypePara