Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tmpvar
Created May 16, 2015 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmpvar/74fae59b8d5ac54288d7 to your computer and use it in GitHub Desktop.
Save tmpvar/74fae59b8d5ac54288d7 to your computer and use it in GitHub Desktop.
requirebin sketch
var esprima = require('esprima');
var estraverse = require('estraverse');
var escodegen = require('escodegen');
var simpleAddition = [
'"use rat"',
'var a = 1/2 + 1/2'
].join('\n');
var ast = esprima.parse(simpleAddition);
// locate 'use rat'
var path = [];
var locations = [];
estraverse.traverse(ast, {
enter: function(node, parent) {
if (node.type === 'ExpressionStatement' && node.expression.value === 'use rat') {
locations.push(parent);
return estraverse.VisitorOption.REMOVE;
}
},
exit : function(node, parent) {
path.pop(node);
}
});
var used = {};
var useMap = {
'/' : function(left, right) {
if (left.type === 'Literal' && right.type === 'Literal') {
return 'rat_frac'
} else {
return 'rat_div'
}
},
'*' : function() { return 'rat_mul' },
'+' : function() { return 'rat_add' },
'-' : function() { return 'rat_sub }' }
}
function buildBinaryFunction(op, node) {
node.type = 'CallExpression';
node.callee = {
type: 'Identifier',
name: op(node.left, node.right)
};
node.arguments = [
node.left,
node.right
];
delete node.left;
delete node.right
}
locations.forEach(function(location) {
var binaryExpressions = [];
estraverse.traverse(location, {
enter: function(node, parent) {
if (node.type === 'BinaryExpression') {
binaryExpressions.push(node);
}
},
exit : function(node, parent) {
path.pop(node);
}
})
binaryExpressions.reverse().forEach(function(expr) {
var ratOp = useMap[expr.operator];
used[ratOp] = true;
buildBinaryFunction(ratOp, expr);
})
});
var r = escodegen.generate(ast);
document.write(r);
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({esprima:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.esprima={})}})(this,function(exports){"use strict";var Token,TokenName,FnExprTokens,Syntax,PlaceHolders,Messages,Regex,source,strict,sourceType,index,lineNumber,lineStart,hasLineTerminator,lastIndex,lastLineNumber,lastLineStart,startIndex,startLineNumber,startLineStart,scanning,length,lookahead,state,extra,isBindingElement,isAssignmentTarget,firstCoverInitializedNameError;Token={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9,Template:10};TokenName={};TokenName[Token.BooleanLiteral]="Boolean";TokenName[Token.EOF]="<end>";TokenName[Token.Identifier]="Identifier";TokenName[Token.Keyword]="Keyword";TokenName[Token.NullLiteral]="Null";TokenName[Token.NumericLiteral]="Numeric";TokenName[Token.Punctuator]="Punctuator";TokenName[Token.StringLiteral]="String";TokenName[Token.RegularExpression]="RegularExpression";TokenName[Token.Template]="Template";FnExprTokens=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="];Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement"};PlaceHolders={ArrowParameterPlaceHolder:"ArrowParameterPlaceHolder"};Messages={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",DefaultRestParameter:"Unexpected token =",ObjectPatternAsRestParameter:"Unexpected token {",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ConstructorSpecialMethod:"Class constructor may not be an accessor",DuplicateConstructor:"A class may only have one constructor",StaticPrototype:"Classes may not have static property named prototype",MissingFromClause:"Unexpected token",NoAsAfterImportNamespace:"Unexpected token",InvalidModuleSpecifier:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalExportDeclaration:"Unexpected token"};Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function assert(condition,message){if(!condition){throw new Error("ASSERT: "+message)}}function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return"0123456789abcdefABCDEF".indexOf(ch)>=0}function isOctalDigit(ch){return"01234567".indexOf(ch)>=0}function octalToDecimal(ch){var octal=ch!=="0",code="01234567".indexOf(ch);if(index<length&&isOctalDigit(source[index])){octal=true;code=code*8+"01234567".indexOf(source[index++]);if("0123".indexOf(ch)>=0&&index<length&&isOctalDigit(source[index])){code=code*8+"01234567".indexOf(source[index++])}}return{code:code,octal:octal}}function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(ch)>=0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}function isFutureReservedWord(id){switch(id){case"enum":case"export":case"import":case"super":return true;default:return false}}function isStrictModeReservedWord(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return true;default:return false}}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isKeyword(id){switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try"||id==="let";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="yield"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function addComment(type,value,start,end,loc){var comment;assert(typeof start==="number","Comment must have valid position");state.lastCommentStart=start;comment={type:type,value:value};if(extra.range){comment.range=[start,end]}if(extra.loc){comment.loc=loc}extra.comments.push(comment);if(extra.attachComment){extra.leadingComments.push(comment);extra.trailingComments.push(comment)}}function skipSingleLineComment(offset){var start,loc,ch,comment;start=index-offset;loc={start:{line:lineNumber,column:index-lineStart-offset}};while(index<length){ch=source.charCodeAt(index);++index;if(isLineTerminator(ch)){hasLineTerminator=true;if(extra.comments){comment=source.slice(start+offset,index-1);loc.end={line:lineNumber,column:index-lineStart-1};addComment("Line",comment,start,index-1,loc)}if(ch===13&&source.charCodeAt(index)===10){++index}++lineNumber;lineStart=index;return}}if(extra.comments){comment=source.slice(start+offset,index);loc.end={line:lineNumber,column:index-lineStart};addComment("Line",comment,start,index,loc)}}function skipMultiLineComment(){var start,loc,ch,comment;if(extra.comments){start=index-2;loc={start:{line:lineNumber,column:index-lineStart-2}}}while(index<length){ch=source.charCodeAt(index);if(isLineTerminator(ch)){if(ch===13&&source.charCodeAt(index+1)===10){++index}hasLineTerminator=true;++lineNumber;++index;lineStart=index}else if(ch===42){if(source.charCodeAt(index+1)===47){++index;++index;if(extra.comments){comment=source.slice(start+2,index-2);loc.end={line:lineNumber,column:index-lineStart};addComment("Block",comment,start,index,loc)}return}++index}else{++index}}if(extra.comments){loc.end={line:lineNumber,column:index-lineStart};comment=source.slice(start+2,index);addComment("Block",comment,start,index,loc)}tolerateUnexpectedToken()}function skipComment(){var ch,start;hasLineTerminator=false;start=index===0;while(index<length){ch=source.charCodeAt(index);if(isWhiteSpace(ch)){++index}else if(isLineTerminator(ch)){hasLineTerminator=true;++index;if(ch===13&&source.charCodeAt(index)===10){++index}++lineNumber;lineStart=index;start=true}else if(ch===47){ch=source.charCodeAt(index+1);if(ch===47){++index;++index;skipSingleLineComment(2);start=true}else if(ch===42){++index;++index;skipMultiLineComment()}else{break}}else if(start&&ch===45){if(source.charCodeAt(index+1)===45&&source.charCodeAt(index+2)===62){index+=3;skipSingleLineComment(3)}else{break}}else if(ch===60){if(source.slice(index+1,index+4)==="!--"){++index;++index;++index;++index;skipSingleLineComment(4)}else{break}}else{break}}}function scanHexEscape(prefix){var i,len,ch,code=0;len=prefix==="u"?4:2;for(i=0;i<len;++i){if(index<length&&isHexDigit(source[index])){ch=source[index++];code=code*16+"0123456789abcdef".indexOf(ch.toLowerCase())}else{return""}}return String.fromCharCode(code)}function scanUnicodeCodePointEscape(){var ch,code,cu1,cu2;ch=source[index];code=0;if(ch==="}"){throwUnexpectedToken()}while(index<length){ch=source[index++];if(!isHexDigit(ch)){break}code=code*16+"0123456789abcdef".indexOf(ch.toLowerCase())}if(code>1114111||ch!=="}"){throwUnexpectedToken()}if(code<=65535){return String.fromCharCode(code)}cu1=(code-65536>>10)+55296;cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}function getEscapedIdentifier(){var ch,id;ch=source.charCodeAt(index++);id=String.fromCharCode(ch);if(ch===92){if(source.charCodeAt(index)!==117){throwUnexpectedToken()}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierStart(ch.charCodeAt(0))){throwUnexpectedToken()}id=ch}while(index<length){ch=source.charCodeAt(index);if(!isIdentifierPart(ch)){break}++index;id+=String.fromCharCode(ch);if(ch===92){id=id.substr(0,id.length-1);if(source.charCodeAt(index)!==117){throwUnexpectedToken()}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierPart(ch.charCodeAt(0))){throwUnexpectedToken()}id+=ch}}return id}function getIdentifier(){var start,ch;start=index++;while(index<length){ch=source.charCodeAt(index);if(ch===92){index=start;return getEscapedIdentifier()}if(isIdentifierPart(ch)){++index}else{break}}return source.slice(start,index)}function scanIdentifier(){var start,id,type;start=index;id=source.charCodeAt(index)===92?getEscapedIdentifier():getIdentifier();if(id.length===1){type=Token.Identifier}else if(isKeyword(id)){type=Token.Keyword}else if(id==="null"){type=Token.NullLiteral}else if(id==="true"||id==="false"){type=Token.BooleanLiteral}else{type=Token.Identifier}return{type:type,value:id,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanPunctuator(){var token,str;token={type:Token.Punctuator,value:"",lineNumber:lineNumber,lineStart:lineStart,start:index,end:index};str=source[index];switch(str){case"(":if(extra.tokenize){extra.openParenToken=extra.tokens.length}++index;break;case"{":if(extra.tokenize){extra.openCurlyToken=extra.tokens.length}state.curlyStack.push("{");++index;break;case".":++index;if(source[index]==="."&&source[index+1]==="."){index+=2;str="..."}break;case"}":++index;state.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++index;break;default:str=source.substr(index,4);if(str===">>>="){index+=4}else{str=str.substr(0,3);if(str==="==="||str==="!=="||str===">>>"||str==="<<="||str===">>="){index+=3}else{str=str.substr(0,2);if(str==="&&"||str==="||"||str==="=="||str==="!="||str==="+="||str==="-="||str==="*="||str==="/="||str==="++"||str==="--"||str==="<<"||str===">>"||str==="&="||str==="|="||str==="^="||str==="%="||str==="<="||str===">="||str==="=>"){index+=2}else{str=source[index];if("<>=!+-*%&|^/".indexOf(str)>=0){++index}}}}}if(index===token.start){throwUnexpectedToken()}token.end=index;token.value=str;return token}function scanHexLiteral(start){var number="";while(index<length){if(!isHexDigit(source[index])){break}number+=source[index++]}if(number.length===0){throwUnexpectedToken()}if(isIdentifierStart(source.charCodeAt(index))){throwUnexpectedToken()}return{type:Token.NumericLiteral,value:parseInt("0x"+number,16),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanBinaryLiteral(start){var ch,number;number="";while(index<length){ch=source[index];if(ch!=="0"&&ch!=="1"){break}number+=source[index++]}if(number.length===0){throwUnexpectedToken()}if(index<length){ch=source.charCodeAt(index);if(isIdentifierStart(ch)||isDecimalDigit(ch)){throwUnexpectedToken()}}return{type:Token.NumericLiteral,value:parseInt(number,2),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanOctalLiteral(prefix,start){var number,octal;if(isOctalDigit(prefix)){octal=true;number="0"+source[index++]}else{octal=false;++index;number=""}while(index<length){if(!isOctalDigit(source[index])){break}number+=source[index++]}if(!octal&&number.length===0){throwUnexpectedToken()}if(isIdentifierStart(source.charCodeAt(index))||isDecimalDigit(source.charCodeAt(index))){throwUnexpectedToken()}return{type:Token.NumericLiteral,value:parseInt(number,8),octal:octal,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function isImplicitOctalLiteral(){var i,ch;for(i=index+1;i<length;++i){ch=source[i];if(ch==="8"||ch==="9"){return false}if(!isOctalDigit(ch)){return true}}return true}function scanNumericLiteral(){var number,start,ch;ch=source[index];assert(isDecimalDigit(ch.charCodeAt(0))||ch===".","Numeric literal must start with a decimal digit or a decimal point");start=index;number="";if(ch!=="."){number=source[index++];ch=source[index];if(number==="0"){if(ch==="x"||ch==="X"){++index;return scanHexLiteral(start)}if(ch==="b"||ch==="B"){++index;return scanBinaryLiteral(start)}if(ch==="o"||ch==="O"){return scanOctalLiteral(ch,start)}if(isOctalDigit(ch)){if(isImplicitOctalLiteral()){return scanOctalLiteral(ch,start)}}}while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}ch=source[index]}if(ch==="."){number+=source[index++];while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}ch=source[index]}if(ch==="e"||ch==="E"){number+=source[index++];ch=source[index];if(ch==="+"||ch==="-"){number+=source[index++]}if(isDecimalDigit(source.charCodeAt(index))){while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}}else{throwUnexpectedToken()}}if(isIdentifierStart(source.charCodeAt(index))){throwUnexpectedToken()}return{type:Token.NumericLiteral,value:parseFloat(number),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanStringLiteral(){var str="",quote,start,ch,unescaped,octToDec,octal=false;quote=source[index];assert(quote==="'"||quote==='"',"String literal must starts with a quote");start=index;++index;while(index<length){ch=source[index++];if(ch===quote){quote="";break}else if(ch==="\\"){ch=source[index++];if(!ch||!isLineTerminator(ch.charCodeAt(0))){switch(ch){case"u":case"x":if(source[index]==="{"){++index;str+=scanUnicodeCodePointEscape()}else{unescaped=scanHexEscape(ch);if(!unescaped){throw throwUnexpectedToken()}str+=unescaped}break;case"n":str+="\n";break;case"r":str+="\r";break;case"t":str+=" ";break;case"b":str+="\b";break;case"f":str+="\f";break;case"v":str+=" ";break;case"8":case"9":throw throwUnexpectedToken();default:if(isOctalDigit(ch)){octToDec=octalToDecimal(ch);octal=octToDec.octal||octal;str+=String.fromCharCode(octToDec.code)}else{str+=ch}break}}else{++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index}}else if(isLineTerminator(ch.charCodeAt(0))){break}else{str+=ch}}if(quote!==""){throwUnexpectedToken()}return{type:Token.StringLiteral,value:str,octal:octal,lineNumber:startLineNumber,lineStart:startLineStart,start:start,end:index}}function scanTemplate(){var cooked="",ch,start,rawOffset,terminated,head,tail,restore,unescaped;terminated=false;tail=false;start=index;head=source[index]==="`";rawOffset=2;++index;while(index<length){ch=source[index++];if(ch==="`"){rawOffset=1;tail=true;terminated=true;break}else if(ch==="$"){if(source[index]==="{"){state.curlyStack.push("${");++index;terminated=true;break}cooked+=ch}else if(ch==="\\"){ch=source[index++];if(!isLineTerminator(ch.charCodeAt(0))){switch(ch){case"n":cooked+="\n";break;case"r":cooked+="\r";break;case"t":cooked+=" ";break;case"u":case"x":if(source[index]==="{"){++index;cooked+=scanUnicodeCodePointEscape()}else{restore=index;unescaped=scanHexEscape(ch);if(unescaped){cooked+=unescaped}else{index=restore;cooked+=ch}}break;case"b":cooked+="\b";break;case"f":cooked+="\f";break;case"v":cooked+=" ";break;default:if(ch==="0"){if(isDecimalDigit(source.charCodeAt(index))){throwError(Messages.TemplateOctalLiteral)}cooked+="\x00"}else if(isOctalDigit(ch)){throwError(Messages.TemplateOctalLiteral)}else{cooked+=ch}break}}else{++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index}}else if(isLineTerminator(ch.charCodeAt(0))){++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index;cooked+="\n"}else{cooked+=ch}}if(!terminated){throwUnexpectedToken()}if(!head){state.curlyStack.pop()}return{type:Token.Template,value:{cooked:cooked,raw:source.slice(start+1,index-rawOffset)},head:head,tail:tail,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function testRegExp(pattern,flags){var tmp=pattern;if(flags.indexOf("u")>=0){tmp=tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g,function($0,$1){if(parseInt($1,16)<=1114111){return"x"}throwUnexpectedToken(null,Messages.InvalidRegExp)}).replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}try{RegExp(tmp)}catch(e){throwUnexpectedToken(null,Messages.InvalidRegExp)}try{return new RegExp(pattern,flags)}catch(exception){return null}}function scanRegExpBody(){var ch,str,classMarker,terminated,body;ch=source[index];assert(ch==="/","Regular expression literal must start with a slash");str=source[index++];classMarker=false;terminated=false;while(index<length){ch=source[index++];str+=ch;if(ch==="\\"){ch=source[index++];if(isLineTerminator(ch.charCodeAt(0))){throwUnexpectedToken(null,Messages.UnterminatedRegExp)}str+=ch}else if(isLineTerminator(ch.charCodeAt(0))){throwUnexpectedToken(null,Messages.UnterminatedRegExp)}else if(classMarker){if(ch==="]"){classMarker=false}}else{if(ch==="/"){terminated=true;break}else if(ch==="["){classMarker=true}}}if(!terminated){throwUnexpectedToken(null,Messages.UnterminatedRegExp)}body=str.substr(1,str.length-2);return{value:body,literal:str}}function scanRegExpFlags(){var ch,str,flags,restore;str="";flags="";while(index<length){ch=source[index];if(!isIdentifierPart(ch.charCodeAt(0))){break}++index;if(ch==="\\"&&index<length){ch=source[index];if(ch==="u"){++index;restore=index;ch=scanHexEscape("u");if(ch){flags+=ch;for(str+="\\u";restore<index;++restore){str+=source[restore]}}else{index=restore;flags+="u";str+="\\u"}tolerateUnexpectedToken()}else{str+="\\";tolerateUnexpectedToken()}}else{flags+=ch;str+=ch}}return{value:flags,literal:str}}function scanRegExp(){scanning=true;var start,body,flags,value;lookahead=null;skipComment();start=index;body=scanRegExpBody();flags=scanRegExpFlags();value=testRegExp(body.value,flags.value);scanning=false;if(extra.tokenize){return{type:Token.RegularExpression,value:value,regex:{pattern:body.value,flags:flags.value},lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}return{literal:body.literal+flags.literal,value:value,regex:{pattern:body.value,flags:flags.value},start:start,end:index}}function collectRegex(){var pos,loc,regex,token;skipComment();pos=index;loc={start:{line:lineNumber,column:index-lineStart}};regex=scanRegExp();loc.end={line:lineNumber,column:index-lineStart};if(!extra.tokenize){if(extra.tokens.length>0){token=extra.tokens[extra.tokens.length-1];if(token.range[0]===pos&&token.type==="Punctuator"){if(token.value==="/"||token.value==="/="){extra.tokens.pop()}}}extra.tokens.push({type:"RegularExpression",value:regex.literal,regex:regex.regex,range:[pos,index],loc:loc})}return regex}function isIdentifierName(token){return token.type===Token.Identifier||token.type===Token.Keyword||token.type===Token.BooleanLiteral||token.type===Token.NullLiteral}function advanceSlash(){var prevToken,checkToken;prevToken=extra.tokens[extra.tokens.length-1];if(!prevToken){return collectRegex()}if(prevToken.type==="Punctuator"){if(prevToken.value==="]"){return scanPunctuator()}if(prevToken.value===")"){checkToken=extra.tokens[extra.openParenToken-1];if(checkToken&&checkToken.type==="Keyword"&&(checkToken.value==="if"||checkToken.value==="while"||checkToken.value==="for"||checkToken.value==="with")){return collectRegex()}return scanPunctuator()}if(prevToken.value==="}"){if(extra.tokens[extra.openCurlyToken-3]&&extra.tokens[extra.openCurlyToken-3].type==="Keyword"){checkToken=extra.tokens[extra.openCurlyToken-4];if(!checkToken){return scanPunctuator()}}else if(extra.tokens[extra.openCurlyToken-4]&&extra.tokens[extra.openCurlyToken-4].type==="Keyword"){checkToken=extra.tokens[extra.openCurlyToken-5];if(!checkToken){return collectRegex()}}else{return scanPunctuator()}if(FnExprTokens.indexOf(checkToken.value)>=0){return scanPunctuator()}return collectRegex()}return collectRegex()}if(prevToken.type==="Keyword"&&prevToken.value!=="this"){return collectRegex()}return scanPunctuator()}function advance(){var ch,token;if(index>=length){return{type:Token.EOF,lineNumber:lineNumber,lineStart:lineStart,start:index,end:index}}ch=source.charCodeAt(index);if(isIdentifierStart(ch)){token=scanIdentifier();if(strict&&isStrictModeReservedWord(token.value)){token.type=Token.Keyword}return token}if(ch===40||ch===41||ch===59){return scanPunctuator()}if(ch===39||ch===34){return scanStringLiteral()}if(ch===46){if(isDecimalDigit(source.charCodeAt(index+1))){return scanNumericLiteral()}return scanPunctuator()}if(isDecimalDigit(ch)){return scanNumericLiteral()}if(extra.tokenize&&ch===47){return advanceSlash()}if(ch===96||ch===125&&state.curlyStack[state.curlyStack.length-1]==="${"){return scanTemplate()}return scanPunctuator()}function collectToken(){var loc,token,value,entry;loc={start:{line:lineNumber,column:index-lineStart}};token=advance();loc.end={line:lineNumber,column:index-lineStart};if(token.type!==Token.EOF){value=source.slice(token.start,token.end);entry={type:TokenName[token.type],value:value,range:[token.start,token.end],loc:loc};if(token.regex){entry.regex={pattern:token.regex.pattern,flags:token.regex.flags}}extra.tokens.push(entry)}return token}function lex(){var token;scanning=true;lastIndex=index;lastLineNumber=lineNumber;lastLineStart=lineStart;skipComment();token=lookahead;startIndex=index;startLineNumber=lineNumber;startLineStart=lineStart;lookahead=typeof extra.tokens!=="undefined"?collectToken():advance();scanning=false;return token}function peek(){scanning=true;skipComment();lastIndex=index;lastLineNumber=lineNumber;lastLineStart=lineStart;startIndex=index;startLineNumber=lineNumber;startLineStart=lineStart;lookahead=typeof extra.tokens!=="undefined"?collectToken():advance();scanning=false}function Position(){this.line=startLineNumber;this.column=startIndex-startLineStart}function SourceLocation(){this.start=new Position;this.end=null}function WrappingSourceLocation(startToken){this.start={line:startToken.lineNumber,column:startToken.start-startToken.lineStart};this.end=null}function Node(){if(extra.range){this.range=[startIndex,0]}if(extra.loc){this.loc=new SourceLocation}}function WrappingNode(startToken){if(extra.range){this.range=[startToken.start,0]}if(extra.loc){this.loc=new WrappingSourceLocation(startToken)}}WrappingNode.prototype=Node.prototype={processComment:function(){var lastChild,leadingComments,trailingComments,bottomRight=extra.bottomRightStack,i,comment,last=bottomRight[bottomRight.length-1];if(this.type===Syntax.Program){if(this.body.length>0){return}}if(extra.trailingComments.length>0){trailingComments=[];for(i=extra.trailingComments.length-1;i>=0;--i){comment=extra.trailingComments[i];if(comment.range[0]>=this.range[1]){trailingComments.unshift(comment);extra.trailingComments.splice(i,1)}}extra.trailingComments=[]}else{if(last&&last.trailingComments&&last.trailingComments[0].range[0]>=this.range[1]){trailingComments=last.trailingComments;delete last.trailingComments}}if(last){while(last&&last.range[0]>=this.range[0]){lastChild=last;last=bottomRight.pop()}}if(lastChild){if(lastChild.leadingComments&&lastChild.leadingComments[lastChild.leadingComments.length-1].range[1]<=this.range[0]){this.leadingComments=lastChild.leadingComments;lastChild.leadingComments=undefined}}else if(extra.leadingComments.length>0){leadingComments=[];for(i=extra.leadingComments.length-1;i>=0;--i){comment=extra.leadingComments[i];if(comment.range[1]<=this.range[0]){leadingComments.unshift(comment);extra.leadingComments.splice(i,1)}}}if(leadingComments&&leadingComments.length>0){this.leadingComments=leadingComments}if(trailingComments&&trailingComments.length>0){this.trailingComments=trailingComments}bottomRight.push(this)},finish:function(){if(extra.range){this.range[1]=lastIndex}if(extra.loc){this.loc.end={line:lastLineNumber,column:lastIndex-lastLineStart};if(extra.source){this.loc.source=extra.source}}if(extra.attachComment){this.processComment()}},finishArrayExpression:function(elements){this.type=Syntax.ArrayExpression;this.elements=elements;this.finish();return this},finishArrayPattern:function(elements){this.type=Syntax.ArrayPattern;this.elements=elements;this.finish();return this},finishArrowFunctionExpression:function(params,defaults,body,expression){this.type=Syntax.ArrowFunctionExpression;this.id=null;this.params=params;this.defaults=defaults;this.body=body;this.generator=false;this.expression=expression;this.finish();return this},finishAssignmentExpression:function(operator,left,right){this.type=Syntax.AssignmentExpression;this.operator=operator;this.left=left;this.right=right;this.finish();return this},finishAssignmentPattern:function(left,right){this.type=Syntax.AssignmentPattern;this.left=left;this.right=right;this.finish();return this},finishBinaryExpression:function(operator,left,right){this.type=operator==="||"||operator==="&&"?Syntax.LogicalExpression:Syntax.BinaryExpression;this.operator=operator;this.left=left;this.right=right;this.finish();return this},finishBlockStatement:function(body){this.type=Syntax.BlockStatement;this.body=body;this.finish();return this},finishBreakStatement:function(label){this.type=Syntax.BreakStatement;this.label=label;this.finish();return this},finishCallExpression:function(callee,args){this.type=Syntax.CallExpression;this.callee=callee;this.arguments=args;this.finish();return this},finishCatchClause:function(param,body){this.type=Syntax.CatchClause;this.param=param;this.body=body;this.finish();return this},finishClassBody:function(body){this.type=Syntax.ClassBody;this.body=body;this.finish();return this},finishClassDeclaration:function(id,superClass,body){this.type=Syntax.ClassDeclaration;this.id=id;this.superClass=superClass;this.body=body;this.finish();return this},finishClassExpression:function(id,superClass,body){
this.type=Syntax.ClassExpression;this.id=id;this.superClass=superClass;this.body=body;this.finish();return this},finishConditionalExpression:function(test,consequent,alternate){this.type=Syntax.ConditionalExpression;this.test=test;this.consequent=consequent;this.alternate=alternate;this.finish();return this},finishContinueStatement:function(label){this.type=Syntax.ContinueStatement;this.label=label;this.finish();return this},finishDebuggerStatement:function(){this.type=Syntax.DebuggerStatement;this.finish();return this},finishDoWhileStatement:function(body,test){this.type=Syntax.DoWhileStatement;this.body=body;this.test=test;this.finish();return this},finishEmptyStatement:function(){this.type=Syntax.EmptyStatement;this.finish();return this},finishExpressionStatement:function(expression){this.type=Syntax.ExpressionStatement;this.expression=expression;this.finish();return this},finishForStatement:function(init,test,update,body){this.type=Syntax.ForStatement;this.init=init;this.test=test;this.update=update;this.body=body;this.finish();return this},finishForInStatement:function(left,right,body){this.type=Syntax.ForInStatement;this.left=left;this.right=right;this.body=body;this.each=false;this.finish();return this},finishFunctionDeclaration:function(id,params,defaults,body){this.type=Syntax.FunctionDeclaration;this.id=id;this.params=params;this.defaults=defaults;this.body=body;this.generator=false;this.expression=false;this.finish();return this},finishFunctionExpression:function(id,params,defaults,body){this.type=Syntax.FunctionExpression;this.id=id;this.params=params;this.defaults=defaults;this.body=body;this.generator=false;this.expression=false;this.finish();return this},finishIdentifier:function(name){this.type=Syntax.Identifier;this.name=name;this.finish();return this},finishIfStatement:function(test,consequent,alternate){this.type=Syntax.IfStatement;this.test=test;this.consequent=consequent;this.alternate=alternate;this.finish();return this},finishLabeledStatement:function(label,body){this.type=Syntax.LabeledStatement;this.label=label;this.body=body;this.finish();return this},finishLiteral:function(token){this.type=Syntax.Literal;this.value=token.value;this.raw=source.slice(token.start,token.end);if(token.regex){this.regex=token.regex}this.finish();return this},finishMemberExpression:function(accessor,object,property){this.type=Syntax.MemberExpression;this.computed=accessor==="[";this.object=object;this.property=property;this.finish();return this},finishNewExpression:function(callee,args){this.type=Syntax.NewExpression;this.callee=callee;this.arguments=args;this.finish();return this},finishObjectExpression:function(properties){this.type=Syntax.ObjectExpression;this.properties=properties;this.finish();return this},finishObjectPattern:function(properties){this.type=Syntax.ObjectPattern;this.properties=properties;this.finish();return this},finishPostfixExpression:function(operator,argument){this.type=Syntax.UpdateExpression;this.operator=operator;this.argument=argument;this.prefix=false;this.finish();return this},finishProgram:function(body){this.type=Syntax.Program;this.body=body;if(sourceType==="module"){this.sourceType=sourceType}this.finish();return this},finishProperty:function(kind,key,computed,value,method,shorthand){this.type=Syntax.Property;this.key=key;this.computed=computed;this.value=value;this.kind=kind;this.method=method;this.shorthand=shorthand;this.finish();return this},finishRestElement:function(argument){this.type=Syntax.RestElement;this.argument=argument;this.finish();return this},finishReturnStatement:function(argument){this.type=Syntax.ReturnStatement;this.argument=argument;this.finish();return this},finishSequenceExpression:function(expressions){this.type=Syntax.SequenceExpression;this.expressions=expressions;this.finish();return this},finishSpreadElement:function(argument){this.type=Syntax.SpreadElement;this.argument=argument;this.finish();return this},finishSwitchCase:function(test,consequent){this.type=Syntax.SwitchCase;this.test=test;this.consequent=consequent;this.finish();return this},finishSuper:function(){this.type=Syntax.Super;this.finish();return this},finishSwitchStatement:function(discriminant,cases){this.type=Syntax.SwitchStatement;this.discriminant=discriminant;this.cases=cases;this.finish();return this},finishTaggedTemplateExpression:function(tag,quasi){this.type=Syntax.TaggedTemplateExpression;this.tag=tag;this.quasi=quasi;this.finish();return this},finishTemplateElement:function(value,tail){this.type=Syntax.TemplateElement;this.value=value;this.tail=tail;this.finish();return this},finishTemplateLiteral:function(quasis,expressions){this.type=Syntax.TemplateLiteral;this.quasis=quasis;this.expressions=expressions;this.finish();return this},finishThisExpression:function(){this.type=Syntax.ThisExpression;this.finish();return this},finishThrowStatement:function(argument){this.type=Syntax.ThrowStatement;this.argument=argument;this.finish();return this},finishTryStatement:function(block,handler,finalizer){this.type=Syntax.TryStatement;this.block=block;this.guardedHandlers=[];this.handlers=handler?[handler]:[];this.handler=handler;this.finalizer=finalizer;this.finish();return this},finishUnaryExpression:function(operator,argument){this.type=operator==="++"||operator==="--"?Syntax.UpdateExpression:Syntax.UnaryExpression;this.operator=operator;this.argument=argument;this.prefix=true;this.finish();return this},finishVariableDeclaration:function(declarations){this.type=Syntax.VariableDeclaration;this.declarations=declarations;this.kind="var";this.finish();return this},finishLexicalDeclaration:function(declarations,kind){this.type=Syntax.VariableDeclaration;this.declarations=declarations;this.kind=kind;this.finish();return this},finishVariableDeclarator:function(id,init){this.type=Syntax.VariableDeclarator;this.id=id;this.init=init;this.finish();return this},finishWhileStatement:function(test,body){this.type=Syntax.WhileStatement;this.test=test;this.body=body;this.finish();return this},finishWithStatement:function(object,body){this.type=Syntax.WithStatement;this.object=object;this.body=body;this.finish();return this},finishExportSpecifier:function(local,exported){this.type=Syntax.ExportSpecifier;this.exported=exported||local;this.local=local;this.finish();return this},finishImportDefaultSpecifier:function(local){this.type=Syntax.ImportDefaultSpecifier;this.local=local;this.finish();return this},finishImportNamespaceSpecifier:function(local){this.type=Syntax.ImportNamespaceSpecifier;this.local=local;this.finish();return this},finishExportNamedDeclaration:function(declaration,specifiers,src){this.type=Syntax.ExportNamedDeclaration;this.declaration=declaration;this.specifiers=specifiers;this.source=src;this.finish();return this},finishExportDefaultDeclaration:function(declaration){this.type=Syntax.ExportDefaultDeclaration;this.declaration=declaration;this.finish();return this},finishExportAllDeclaration:function(src){this.type=Syntax.ExportAllDeclaration;this.source=src;this.finish();return this},finishImportSpecifier:function(local,imported){this.type=Syntax.ImportSpecifier;this.local=local||imported;this.imported=imported;this.finish();return this},finishImportDeclaration:function(specifiers,src){this.type=Syntax.ImportDeclaration;this.specifiers=specifiers;this.source=src;this.finish();return this}};function recordError(error){var e,existing;for(e=0;e<extra.errors.length;e++){existing=extra.errors[e];if(existing.index===error.index&&existing.message===error.message){return}}extra.errors.push(error)}function createError(line,pos,description){var error=new Error("Line "+line+": "+description);error.index=pos;error.lineNumber=line;error.column=pos-(scanning?lineStart:lastLineStart)+1;error.description=description;return error}function throwError(messageFormat){var args,msg;args=Array.prototype.slice.call(arguments,1);msg=messageFormat.replace(/%(\d)/g,function(whole,idx){assert(idx<args.length,"Message reference must be in range");return args[idx]});throw createError(lastLineNumber,lastIndex,msg)}function tolerateError(messageFormat){var args,msg,error;args=Array.prototype.slice.call(arguments,1);msg=messageFormat.replace(/%(\d)/g,function(whole,idx){assert(idx<args.length,"Message reference must be in range");return args[idx]});error=createError(lineNumber,lastIndex,msg);if(extra.errors){recordError(error)}else{throw error}}function unexpectedTokenError(token,message){var value,msg=message||Messages.UnexpectedToken;if(token){if(!message){msg=token.type===Token.EOF?Messages.UnexpectedEOS:token.type===Token.Identifier?Messages.UnexpectedIdentifier:token.type===Token.NumericLiteral?Messages.UnexpectedNumber:token.type===Token.StringLiteral?Messages.UnexpectedString:token.type===Token.Template?Messages.UnexpectedTemplate:Messages.UnexpectedToken;if(token.type===Token.Keyword){if(isFutureReservedWord(token.value)){msg=Messages.UnexpectedReserved}else if(strict&&isStrictModeReservedWord(token.value)){msg=Messages.StrictReservedWord}}}value=token.type===Token.Template?token.value.raw:token.value}else{value="ILLEGAL"}msg=msg.replace("%0",value);return token&&typeof token.lineNumber==="number"?createError(token.lineNumber,token.start,msg):createError(scanning?lineNumber:lastLineNumber,scanning?index:lastIndex,msg)}function throwUnexpectedToken(token,message){throw unexpectedTokenError(token,message)}function tolerateUnexpectedToken(token,message){var error=unexpectedTokenError(token,message);if(extra.errors){recordError(error)}else{throw error}}function expect(value){var token=lex();if(token.type!==Token.Punctuator||token.value!==value){throwUnexpectedToken(token)}}function expectCommaSeparator(){var token;if(extra.errors){token=lookahead;if(token.type===Token.Punctuator&&token.value===","){lex()}else if(token.type===Token.Punctuator&&token.value===";"){lex();tolerateUnexpectedToken(token)}else{tolerateUnexpectedToken(token,Messages.UnexpectedToken)}}else{expect(",")}}function expectKeyword(keyword){var token=lex();if(token.type!==Token.Keyword||token.value!==keyword){throwUnexpectedToken(token)}}function match(value){return lookahead.type===Token.Punctuator&&lookahead.value===value}function matchKeyword(keyword){return lookahead.type===Token.Keyword&&lookahead.value===keyword}function matchContextualKeyword(keyword){return lookahead.type===Token.Identifier&&lookahead.value===keyword}function matchAssign(){var op;if(lookahead.type!==Token.Punctuator){return false}op=lookahead.value;return op==="="||op==="*="||op==="/="||op==="%="||op==="+="||op==="-="||op==="<<="||op===">>="||op===">>>="||op==="&="||op==="^="||op==="|="}function consumeSemicolon(){if(source.charCodeAt(startIndex)===59||match(";")){lex();return}if(hasLineTerminator){return}lastIndex=startIndex;lastLineNumber=startLineNumber;lastLineStart=startLineStart;if(lookahead.type!==Token.EOF&&!match("}")){throwUnexpectedToken(lookahead)}}function isolateCoverGrammar(parser){var oldIsBindingElement=isBindingElement,oldIsAssignmentTarget=isAssignmentTarget,oldFirstCoverInitializedNameError=firstCoverInitializedNameError,result;isBindingElement=true;isAssignmentTarget=true;firstCoverInitializedNameError=null;result=parser();if(firstCoverInitializedNameError!==null){throwUnexpectedToken(firstCoverInitializedNameError)}isBindingElement=oldIsBindingElement;isAssignmentTarget=oldIsAssignmentTarget;firstCoverInitializedNameError=oldFirstCoverInitializedNameError;return result}function inheritCoverGrammar(parser){var oldIsBindingElement=isBindingElement,oldIsAssignmentTarget=isAssignmentTarget,oldFirstCoverInitializedNameError=firstCoverInitializedNameError,result;isBindingElement=true;isAssignmentTarget=true;firstCoverInitializedNameError=null;result=parser();isBindingElement=isBindingElement&&oldIsBindingElement;isAssignmentTarget=isAssignmentTarget&&oldIsAssignmentTarget;firstCoverInitializedNameError=oldFirstCoverInitializedNameError||firstCoverInitializedNameError;return result}function parseArrayPattern(){var node=new Node,elements=[],rest,restNode;expect("[");while(!match("]")){if(match(",")){lex();elements.push(null)}else{if(match("...")){restNode=new Node;lex();rest=parseVariableIdentifier();elements.push(restNode.finishRestElement(rest));break}else{elements.push(parsePatternWithDefault())}if(!match("]")){expect(",")}}}expect("]");return node.finishArrayPattern(elements)}function parsePropertyPattern(){var node=new Node,key,computed=match("["),init;if(lookahead.type===Token.Identifier){key=parseVariableIdentifier();if(match("=")){lex();init=parseAssignmentExpression();return node.finishProperty("init",key,false,new WrappingNode(key).finishAssignmentPattern(key,init),false,false)}else if(!match(":")){return node.finishProperty("init",key,false,key,false,true)}}else{key=parseObjectPropertyKey()}expect(":");init=parsePatternWithDefault();return node.finishProperty("init",key,computed,init,false,false)}function parseObjectPattern(){var node=new Node,properties=[];expect("{");while(!match("}")){properties.push(parsePropertyPattern());if(!match("}")){expect(",")}}lex();return node.finishObjectPattern(properties)}function parsePattern(){if(lookahead.type===Token.Identifier){return parseVariableIdentifier()}else if(match("[")){return parseArrayPattern()}else if(match("{")){return parseObjectPattern()}throwUnexpectedToken(lookahead)}function parsePatternWithDefault(){var startToken=lookahead,pattern,right;pattern=parsePattern();if(match("=")){lex();right=isolateCoverGrammar(parseAssignmentExpression);pattern=new WrappingNode(startToken).finishAssignmentPattern(pattern,right)}return pattern}function parseArrayInitialiser(){var elements=[],node=new Node,restSpread;expect("[");while(!match("]")){if(match(",")){lex();elements.push(null)}else if(match("...")){restSpread=new Node;lex();restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression));if(!match("]")){isAssignmentTarget=isBindingElement=false;expect(",")}elements.push(restSpread)}else{elements.push(inheritCoverGrammar(parseAssignmentExpression));if(!match("]")){expect(",")}}}lex();return node.finishArrayExpression(elements)}function parsePropertyFunction(node,paramInfo){var previousStrict,body;isAssignmentTarget=isBindingElement=false;previousStrict=strict;body=isolateCoverGrammar(parseFunctionSourceElements);if(strict&&paramInfo.firstRestricted){tolerateUnexpectedToken(paramInfo.firstRestricted,paramInfo.message)}if(strict&&paramInfo.stricted){tolerateUnexpectedToken(paramInfo.stricted,paramInfo.message)}strict=previousStrict;return node.finishFunctionExpression(null,paramInfo.params,paramInfo.defaults,body)}function parsePropertyMethodFunction(){var params,method,node=new Node;params=parseParams();method=parsePropertyFunction(node,params);return method}function parseObjectPropertyKey(){var token,node=new Node,expr;token=lex();switch(token.type){case Token.StringLiteral:case Token.NumericLiteral:if(strict&&token.octal){tolerateUnexpectedToken(token,Messages.StrictOctalLiteral)}return node.finishLiteral(token);case Token.Identifier:case Token.BooleanLiteral:case Token.NullLiteral:case Token.Keyword:return node.finishIdentifier(token.value);case Token.Punctuator:if(token.value==="["){expr=isolateCoverGrammar(parseAssignmentExpression);expect("]");return expr}break}throwUnexpectedToken(token)}function lookaheadPropertyName(){switch(lookahead.type){case Token.Identifier:case Token.StringLiteral:case Token.BooleanLiteral:case Token.NullLiteral:case Token.NumericLiteral:case Token.Keyword:return true;case Token.Punctuator:return lookahead.value==="["}return false}function tryParseMethodDefinition(token,key,computed,node){var value,options,methodNode;if(token.type===Token.Identifier){if(token.value==="get"&&lookaheadPropertyName()){computed=match("[");key=parseObjectPropertyKey();methodNode=new Node;expect("(");expect(")");value=parsePropertyFunction(methodNode,{params:[],defaults:[],stricted:null,firstRestricted:null,message:null});return node.finishProperty("get",key,computed,value,false,false)}else if(token.value==="set"&&lookaheadPropertyName()){computed=match("[");key=parseObjectPropertyKey();methodNode=new Node;expect("(");options={params:[],defaultCount:0,defaults:[],firstRestricted:null,paramSet:{}};if(match(")")){tolerateUnexpectedToken(lookahead)}else{parseParam(options);if(options.defaultCount===0){options.defaults=[]}}expect(")");value=parsePropertyFunction(methodNode,options);return node.finishProperty("set",key,computed,value,false,false)}}if(match("(")){value=parsePropertyMethodFunction();return node.finishProperty("init",key,computed,value,true,false)}return null}function checkProto(key,computed,hasProto){if(computed===false&&(key.type===Syntax.Identifier&&key.name==="__proto__"||key.type===Syntax.Literal&&key.value==="__proto__")){if(hasProto.value){tolerateError(Messages.DuplicateProtoProperty)}else{hasProto.value=true}}}function parseObjectProperty(hasProto){var token=lookahead,node=new Node,computed,key,maybeMethod,value;computed=match("[");key=parseObjectPropertyKey();maybeMethod=tryParseMethodDefinition(token,key,computed,node);if(maybeMethod){checkProto(maybeMethod.key,maybeMethod.computed,hasProto);return maybeMethod}checkProto(key,computed,hasProto);if(match(":")){lex();value=inheritCoverGrammar(parseAssignmentExpression);return node.finishProperty("init",key,computed,value,false,false)}if(token.type===Token.Identifier){if(match("=")){firstCoverInitializedNameError=lookahead;lex();value=isolateCoverGrammar(parseAssignmentExpression);return node.finishProperty("init",key,computed,new WrappingNode(token).finishAssignmentPattern(key,value),false,true)}return node.finishProperty("init",key,computed,key,false,true)}throwUnexpectedToken(lookahead)}function parseObjectInitialiser(){var properties=[],hasProto={value:false},node=new Node;expect("{");while(!match("}")){properties.push(parseObjectProperty(hasProto));if(!match("}")){expectCommaSeparator()}}expect("}");return node.finishObjectExpression(properties)}function reinterpretExpressionAsPattern(expr){var i;switch(expr.type){case Syntax.Identifier:case Syntax.MemberExpression:case Syntax.RestElement:case Syntax.AssignmentPattern:break;case Syntax.SpreadElement:expr.type=Syntax.RestElement;reinterpretExpressionAsPattern(expr.argument);break;case Syntax.ArrayExpression:expr.type=Syntax.ArrayPattern;for(i=0;i<expr.elements.length;i++){if(expr.elements[i]!==null){reinterpretExpressionAsPattern(expr.elements[i])}}break;case Syntax.ObjectExpression:expr.type=Syntax.ObjectPattern;for(i=0;i<expr.properties.length;i++){reinterpretExpressionAsPattern(expr.properties[i].value)}break;case Syntax.AssignmentExpression:expr.type=Syntax.AssignmentPattern;reinterpretExpressionAsPattern(expr.left);break;default:break}}function parseTemplateElement(option){var node,token;if(lookahead.type!==Token.Template||option.head&&!lookahead.head){throwUnexpectedToken()}node=new Node;token=lex();return node.finishTemplateElement({raw:token.value.raw,cooked:token.value.cooked},token.tail)}function parseTemplateLiteral(){var quasi,quasis,expressions,node=new Node;quasi=parseTemplateElement({head:true});quasis=[quasi];expressions=[];while(!quasi.tail){expressions.push(parseExpression());quasi=parseTemplateElement({head:false});quasis.push(quasi)}return node.finishTemplateLiteral(quasis,expressions)}function parseGroupExpression(){var expr,expressions,startToken,i;expect("(");if(match(")")){lex();if(!match("=>")){expect("=>")}return{type:PlaceHolders.ArrowParameterPlaceHolder,params:[]}}startToken=lookahead;if(match("...")){expr=parseRestElement();expect(")");if(!match("=>")){expect("=>")}return{type:PlaceHolders.ArrowParameterPlaceHolder,params:[expr]}}isBindingElement=true;expr=inheritCoverGrammar(parseAssignmentExpression);if(match(",")){isAssignmentTarget=false;expressions=[expr];while(startIndex<length){if(!match(",")){break}lex();if(match("...")){if(!isBindingElement){throwUnexpectedToken(lookahead)}expressions.push(parseRestElement());expect(")");if(!match("=>")){expect("=>")}isBindingElement=false;for(i=0;i<expressions.length;i++){reinterpretExpressionAsPattern(expressions[i])}return{type:PlaceHolders.ArrowParameterPlaceHolder,params:expressions}}expressions.push(inheritCoverGrammar(parseAssignmentExpression))}expr=new WrappingNode(startToken).finishSequenceExpression(expressions)}expect(")");if(match("=>")){if(!isBindingElement){throwUnexpectedToken(lookahead)}if(expr.type===Syntax.SequenceExpression){for(i=0;i<expr.expressions.length;i++){reinterpretExpressionAsPattern(expr.expressions[i])}}else{reinterpretExpressionAsPattern(expr)}expr={type:PlaceHolders.ArrowParameterPlaceHolder,params:expr.type===Syntax.SequenceExpression?expr.expressions:[expr]}}isBindingElement=false;return expr}function parsePrimaryExpression(){var type,token,expr,node;if(match("(")){isBindingElement=false;return inheritCoverGrammar(parseGroupExpression)}if(match("[")){return inheritCoverGrammar(parseArrayInitialiser)}if(match("{")){return inheritCoverGrammar(parseObjectInitialiser)}type=lookahead.type;node=new Node;if(type===Token.Identifier){expr=node.finishIdentifier(lex().value)}else if(type===Token.StringLiteral||type===Token.NumericLiteral){isAssignmentTarget=isBindingElement=false;if(strict&&lookahead.octal){tolerateUnexpectedToken(lookahead,Messages.StrictOctalLiteral)}expr=node.finishLiteral(lex())}else if(type===Token.Keyword){isAssignmentTarget=isBindingElement=false;if(matchKeyword("function")){return parseFunctionExpression()}if(matchKeyword("this")){lex();return node.finishThisExpression()}if(matchKeyword("class")){return parseClassExpression()}throwUnexpectedToken(lex())}else if(type===Token.BooleanLiteral){isAssignmentTarget=isBindingElement=false;token=lex();token.value=token.value==="true";expr=node.finishLiteral(token)}else if(type===Token.NullLiteral){isAssignmentTarget=isBindingElement=false;token=lex();token.value=null;expr=node.finishLiteral(token)}else if(match("/")||match("/=")){isAssignmentTarget=isBindingElement=false;index=startIndex;if(typeof extra.tokens!=="undefined"){token=collectRegex()}else{token=scanRegExp()}lex();expr=node.finishLiteral(token)}else if(type===Token.Template){expr=parseTemplateLiteral()}else{throwUnexpectedToken(lex())}return expr}function parseArguments(){var args=[];expect("(");if(!match(")")){while(startIndex<length){args.push(isolateCoverGrammar(parseAssignmentExpression));if(match(")")){break}expectCommaSeparator()}}expect(")");return args}function parseNonComputedProperty(){var token,node=new Node;token=lex();if(!isIdentifierName(token)){throwUnexpectedToken(token)}return node.finishIdentifier(token.value)}function parseNonComputedMember(){expect(".");return parseNonComputedProperty()}function parseComputedMember(){var expr;expect("[");expr=isolateCoverGrammar(parseExpression);expect("]");return expr}function parseNewExpression(){var callee,args,node=new Node;expectKeyword("new");callee=isolateCoverGrammar(parseLeftHandSideExpression);args=match("(")?parseArguments():[];isAssignmentTarget=isBindingElement=false;return node.finishNewExpression(callee,args)}function parseLeftHandSideExpressionAllowCall(){var quasi,expr,args,property,startToken,previousAllowIn=state.allowIn;startToken=lookahead;state.allowIn=true;if(matchKeyword("super")&&state.inFunctionBody){expr=new Node;lex();expr=expr.finishSuper();if(!match("(")&&!match(".")&&!match("[")){throwUnexpectedToken(lookahead)}}else{expr=inheritCoverGrammar(matchKeyword("new")?parseNewExpression:parsePrimaryExpression)}for(;;){if(match(".")){isBindingElement=false;isAssignmentTarget=true;property=parseNonComputedMember();expr=new WrappingNode(startToken).finishMemberExpression(".",expr,property)}else if(match("(")){isBindingElement=false;isAssignmentTarget=false;args=parseArguments();expr=new WrappingNode(startToken).finishCallExpression(expr,args)}else if(match("[")){isBindingElement=false;isAssignmentTarget=true;property=parseComputedMember();expr=new WrappingNode(startToken).finishMemberExpression("[",expr,property)}else if(lookahead.type===Token.Template&&lookahead.head){quasi=parseTemplateLiteral();expr=new WrappingNode(startToken).finishTaggedTemplateExpression(expr,quasi)}else{break}}state.allowIn=previousAllowIn;return expr}function parseLeftHandSideExpression(){var quasi,expr,property,startToken;assert(state.allowIn,"callee of new expression always allow in keyword.");startToken=lookahead;if(matchKeyword("super")&&state.inFunctionBody){expr=new Node;lex();expr=expr.finishSuper();if(!match("[")&&!match(".")){throwUnexpectedToken(lookahead)}}else{expr=inheritCoverGrammar(matchKeyword("new")?parseNewExpression:parsePrimaryExpression)}for(;;){if(match("[")){isBindingElement=false;isAssignmentTarget=true;property=parseComputedMember();expr=new WrappingNode(startToken).finishMemberExpression("[",expr,property)}else if(match(".")){isBindingElement=false;isAssignmentTarget=true;property=parseNonComputedMember();expr=new WrappingNode(startToken).finishMemberExpression(".",expr,property)}else if(lookahead.type===Token.Template&&lookahead.head){quasi=parseTemplateLiteral();expr=new WrappingNode(startToken).finishTaggedTemplateExpression(expr,quasi)}else{break}}return expr}function parsePostfixExpression(){var expr,token,startToken=lookahead;expr=inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);if(!hasLineTerminator&&lookahead.type===Token.Punctuator){if(match("++")||match("--")){if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){tolerateError(Messages.StrictLHSPostfix)}if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInAssignment)}isAssignmentTarget=isBindingElement=false;token=lex();expr=new WrappingNode(startToken).finishPostfixExpression(token.value,expr)}}return expr}function parseUnaryExpression(){var token,expr,startToken;if(lookahead.type!==Token.Punctuator&&lookahead.type!==Token.Keyword){expr=parsePostfixExpression()}else if(match("++")||match("--")){startToken=lookahead;token=lex();expr=inheritCoverGrammar(parseUnaryExpression);if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){tolerateError(Messages.StrictLHSPrefix)}if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInAssignment)}expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr);isAssignmentTarget=isBindingElement=false}else if(match("+")||match("-")||match("~")||match("!")){startToken=lookahead;token=lex();expr=inheritCoverGrammar(parseUnaryExpression);expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr);isAssignmentTarget=isBindingElement=false}else if(matchKeyword("delete")||matchKeyword("void")||matchKeyword("typeof")){startToken=lookahead;token=lex();expr=inheritCoverGrammar(parseUnaryExpression);expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr);if(strict&&expr.operator==="delete"&&expr.argument.type===Syntax.Identifier){tolerateError(Messages.StrictDelete)}isAssignmentTarget=isBindingElement=false}else{expr=parsePostfixExpression()}return expr}function binaryPrecedence(token,allowIn){var prec=0;if(token.type!==Token.Punctuator&&token.type!==Token.Keyword){return 0}switch(token.value){case"||":prec=1;break;case"&&":prec=2;break;case"|":prec=3;break;case"^":prec=4;break;case"&":prec=5;break;case"==":case"!=":case"===":case"!==":prec=6;break;case"<":case">":case"<=":case">=":case"instanceof":prec=7;break;case"in":prec=allowIn?7:0;break;case"<<":case">>":case">>>":prec=8;break;case"+":case"-":prec=9;break;case"*":case"/":case"%":prec=11;break;default:break}return prec}function parseBinaryExpression(){var marker,markers,expr,token,prec,stack,right,operator,left,i;marker=lookahead;left=inheritCoverGrammar(parseUnaryExpression);token=lookahead;prec=binaryPrecedence(token,state.allowIn);if(prec===0){return left}isAssignmentTarget=isBindingElement=false;token.prec=prec;lex();markers=[marker,lookahead];right=isolateCoverGrammar(parseUnaryExpression);stack=[left,token,right];while((prec=binaryPrecedence(lookahead,state.allowIn))>0){while(stack.length>2&&prec<=stack[stack.length-2].prec){right=stack.pop();operator=stack.pop().value;left=stack.pop();markers.pop();expr=new WrappingNode(markers[markers.length-1]).finishBinaryExpression(operator,left,right);stack.push(expr)}token=lex();token.prec=prec;stack.push(token);markers.push(lookahead);expr=isolateCoverGrammar(parseUnaryExpression);stack.push(expr)}i=stack.length-1;expr=stack[i];markers.pop();while(i>1){expr=new WrappingNode(markers.pop()).finishBinaryExpression(stack[i-1].value,stack[i-2],expr);i-=2}return expr}function parseConditionalExpression(){var expr,previousAllowIn,consequent,alternate,startToken;startToken=lookahead;expr=inheritCoverGrammar(parseBinaryExpression);if(match("?")){lex();previousAllowIn=state.allowIn;state.allowIn=true;consequent=isolateCoverGrammar(parseAssignmentExpression);state.allowIn=previousAllowIn;expect(":");alternate=isolateCoverGrammar(parseAssignmentExpression);expr=new WrappingNode(startToken).finishConditionalExpression(expr,consequent,alternate);isAssignmentTarget=isBindingElement=false}return expr}function parseConciseBody(){if(match("{")){return parseFunctionSourceElements()}return isolateCoverGrammar(parseAssignmentExpression)}function checkPatternParam(options,param){var i;switch(param.type){case Syntax.Identifier:validateParam(options,param,param.name);break;case Syntax.RestElement:checkPatternParam(options,param.argument);break;case Syntax.AssignmentPattern:checkPatternParam(options,param.left);break;case Syntax.ArrayPattern:for(i=0;i<param.elements.length;i++){if(param.elements[i]!==null){checkPatternParam(options,param.elements[i])}}break;default:assert(param.type===Syntax.ObjectPattern,"Invalid type");for(i=0;i<param.properties.length;i++){checkPatternParam(options,param.properties[i].value)}break}}function reinterpretAsCoverFormalsList(expr){var i,len,param,params,defaults,defaultCount,options,token;defaults=[];defaultCount=0;params=[expr];switch(expr.type){case Syntax.Identifier:break;case PlaceHolders.ArrowParameterPlaceHolder:params=expr.params;break;default:return null}options={paramSet:{}};for(i=0,len=params.length;i<len;i+=1){param=params[i];switch(param.type){case Syntax.AssignmentPattern:params[i]=param.left;defaults.push(param.right);++defaultCount;checkPatternParam(options,param.left);break;default:checkPatternParam(options,param);params[i]=param;defaults.push(null);break}}if(options.message===Messages.StrictParamDupe){token=strict?options.stricted:options.firstRestricted;throwUnexpectedToken(token,options.message)}if(defaultCount===0){defaults=[]}return{params:params,defaults:defaults,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message}}function parseArrowFunctionExpression(options,node){var previousStrict,body;if(hasLineTerminator){tolerateUnexpectedToken(lookahead)}expect("=>");previousStrict=strict;body=parseConciseBody();if(strict&&options.firstRestricted){throwUnexpectedToken(options.firstRestricted,options.message)}if(strict&&options.stricted){tolerateUnexpectedToken(options.stricted,options.message)}strict=previousStrict;return node.finishArrowFunctionExpression(options.params,options.defaults,body,body.type!==Syntax.BlockStatement)}function parseAssignmentExpression(){var token,expr,right,list,startToken;startToken=lookahead;token=lookahead;expr=parseConditionalExpression();if(expr.type===PlaceHolders.ArrowParameterPlaceHolder||match("=>")){isAssignmentTarget=isBindingElement=false;list=reinterpretAsCoverFormalsList(expr);if(list){firstCoverInitializedNameError=null;return parseArrowFunctionExpression(list,new WrappingNode(startToken))}return expr}if(matchAssign()){if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInAssignment)}if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){tolerateUnexpectedToken(token,Messages.StrictLHSAssignment)}if(!match("=")){isAssignmentTarget=isBindingElement=false}else{reinterpretExpressionAsPattern(expr)}token=lex();right=isolateCoverGrammar(parseAssignmentExpression);
expr=new WrappingNode(startToken).finishAssignmentExpression(token.value,expr,right);firstCoverInitializedNameError=null}return expr}function parseExpression(){var expr,startToken=lookahead,expressions;expr=isolateCoverGrammar(parseAssignmentExpression);if(match(",")){expressions=[expr];while(startIndex<length){if(!match(",")){break}lex();expressions.push(isolateCoverGrammar(parseAssignmentExpression))}expr=new WrappingNode(startToken).finishSequenceExpression(expressions)}return expr}function parseStatementListItem(){if(lookahead.type===Token.Keyword){switch(lookahead.value){case"export":if(sourceType!=="module"){tolerateUnexpectedToken(lookahead,Messages.IllegalExportDeclaration)}return parseExportDeclaration();case"import":if(sourceType!=="module"){tolerateUnexpectedToken(lookahead,Messages.IllegalImportDeclaration)}return parseImportDeclaration();case"const":case"let":return parseLexicalDeclaration({inFor:false});case"function":return parseFunctionDeclaration(new Node);case"class":return parseClassDeclaration()}}return parseStatement()}function parseStatementList(){var list=[];while(startIndex<length){if(match("}")){break}list.push(parseStatementListItem())}return list}function parseBlock(){var block,node=new Node;expect("{");block=parseStatementList();expect("}");return node.finishBlockStatement(block)}function parseVariableIdentifier(){var token,node=new Node;token=lex();if(token.type!==Token.Identifier){if(strict&&token.type===Token.Keyword&&isStrictModeReservedWord(token.value)){tolerateUnexpectedToken(token,Messages.StrictReservedWord)}else{throwUnexpectedToken(token)}}return node.finishIdentifier(token.value)}function parseVariableDeclaration(){var init=null,id,node=new Node;id=parsePattern();if(strict&&isRestrictedWord(id.name)){tolerateError(Messages.StrictVarName)}if(match("=")){lex();init=isolateCoverGrammar(parseAssignmentExpression)}else if(id.type!==Syntax.Identifier){expect("=")}return node.finishVariableDeclarator(id,init)}function parseVariableDeclarationList(){var list=[];do{list.push(parseVariableDeclaration());if(!match(",")){break}lex()}while(startIndex<length);return list}function parseVariableStatement(node){var declarations;expectKeyword("var");declarations=parseVariableDeclarationList();consumeSemicolon();return node.finishVariableDeclaration(declarations)}function parseLexicalBinding(kind,options){var init=null,id,node=new Node;id=parsePattern();if(strict&&id.type===Syntax.Identifier&&isRestrictedWord(id.name)){tolerateError(Messages.StrictVarName)}if(kind==="const"){if(!matchKeyword("in")){expect("=");init=isolateCoverGrammar(parseAssignmentExpression)}}else if(!options.inFor&&id.type!==Syntax.Identifier||match("=")){expect("=");init=isolateCoverGrammar(parseAssignmentExpression)}return node.finishVariableDeclarator(id,init)}function parseBindingList(kind,options){var list=[];do{list.push(parseLexicalBinding(kind,options));if(!match(",")){break}lex()}while(startIndex<length);return list}function parseLexicalDeclaration(options){var kind,declarations,node=new Node;kind=lex().value;assert(kind==="let"||kind==="const","Lexical declaration must be either let or const");declarations=parseBindingList(kind,options);consumeSemicolon();return node.finishLexicalDeclaration(declarations,kind)}function parseRestElement(){var param,node=new Node;lex();if(match("{")){throwError(Messages.ObjectPatternAsRestParameter)}param=parseVariableIdentifier();if(match("=")){throwError(Messages.DefaultRestParameter)}if(!match(")")){throwError(Messages.ParameterAfterRestParameter)}return node.finishRestElement(param)}function parseEmptyStatement(node){expect(";");return node.finishEmptyStatement()}function parseExpressionStatement(node){var expr=parseExpression();consumeSemicolon();return node.finishExpressionStatement(expr)}function parseIfStatement(node){var test,consequent,alternate;expectKeyword("if");expect("(");test=parseExpression();expect(")");consequent=parseStatement();if(matchKeyword("else")){lex();alternate=parseStatement()}else{alternate=null}return node.finishIfStatement(test,consequent,alternate)}function parseDoWhileStatement(node){var body,test,oldInIteration;expectKeyword("do");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;expectKeyword("while");expect("(");test=parseExpression();expect(")");if(match(";")){lex()}return node.finishDoWhileStatement(body,test)}function parseWhileStatement(node){var test,body,oldInIteration;expectKeyword("while");expect("(");test=parseExpression();expect(")");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;return node.finishWhileStatement(test,body)}function parseForStatement(node){var init,initSeq,initStartToken,test,update,left,right,kind,declarations,body,oldInIteration,previousAllowIn=state.allowIn;init=test=update=null;expectKeyword("for");expect("(");if(match(";")){lex()}else{if(matchKeyword("var")){init=new Node;lex();state.allowIn=false;init=init.finishVariableDeclaration(parseVariableDeclarationList());state.allowIn=previousAllowIn;if(init.declarations.length===1&&matchKeyword("in")){lex();left=init;right=parseExpression();init=null}else{expect(";")}}else if(matchKeyword("const")||matchKeyword("let")){init=new Node;kind=lex().value;state.allowIn=false;declarations=parseBindingList(kind,{inFor:true});state.allowIn=previousAllowIn;if(declarations.length===1&&declarations[0].init===null&&matchKeyword("in")){init=init.finishLexicalDeclaration(declarations,kind);lex();left=init;right=parseExpression();init=null}else{consumeSemicolon();init=init.finishLexicalDeclaration(declarations,kind)}}else{initStartToken=lookahead;state.allowIn=false;init=inheritCoverGrammar(parseAssignmentExpression);state.allowIn=previousAllowIn;if(matchKeyword("in")){if(!isAssignmentTarget){tolerateError(Messages.InvalidLHSInForIn)}lex();reinterpretExpressionAsPattern(init);left=init;right=parseExpression();init=null}else{if(match(",")){initSeq=[init];while(match(",")){lex();initSeq.push(isolateCoverGrammar(parseAssignmentExpression))}init=new WrappingNode(initStartToken).finishSequenceExpression(initSeq)}expect(";")}}}if(typeof left==="undefined"){if(!match(";")){test=parseExpression()}expect(";");if(!match(")")){update=parseExpression()}}expect(")");oldInIteration=state.inIteration;state.inIteration=true;body=isolateCoverGrammar(parseStatement);state.inIteration=oldInIteration;return typeof left==="undefined"?node.finishForStatement(init,test,update,body):node.finishForInStatement(left,right,body)}function parseContinueStatement(node){var label=null,key;expectKeyword("continue");if(source.charCodeAt(startIndex)===59){lex();if(!state.inIteration){throwError(Messages.IllegalContinue)}return node.finishContinueStatement(null)}if(hasLineTerminator){if(!state.inIteration){throwError(Messages.IllegalContinue)}return node.finishContinueStatement(null)}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();key="$"+label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError(Messages.UnknownLabel,label.name)}}consumeSemicolon();if(label===null&&!state.inIteration){throwError(Messages.IllegalContinue)}return node.finishContinueStatement(label)}function parseBreakStatement(node){var label=null,key;expectKeyword("break");if(source.charCodeAt(lastIndex)===59){lex();if(!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak)}return node.finishBreakStatement(null)}if(hasLineTerminator){if(!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak)}return node.finishBreakStatement(null)}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();key="$"+label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError(Messages.UnknownLabel,label.name)}}consumeSemicolon();if(label===null&&!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak)}return node.finishBreakStatement(label)}function parseReturnStatement(node){var argument=null;expectKeyword("return");if(!state.inFunctionBody){tolerateError(Messages.IllegalReturn)}if(source.charCodeAt(lastIndex)===32){if(isIdentifierStart(source.charCodeAt(lastIndex+1))){argument=parseExpression();consumeSemicolon();return node.finishReturnStatement(argument)}}if(hasLineTerminator){return node.finishReturnStatement(null)}if(!match(";")){if(!match("}")&&lookahead.type!==Token.EOF){argument=parseExpression()}}consumeSemicolon();return node.finishReturnStatement(argument)}function parseWithStatement(node){var object,body;if(strict){tolerateError(Messages.StrictModeWith)}expectKeyword("with");expect("(");object=parseExpression();expect(")");body=parseStatement();return node.finishWithStatement(object,body)}function parseSwitchCase(){var test,consequent=[],statement,node=new Node;if(matchKeyword("default")){lex();test=null}else{expectKeyword("case");test=parseExpression()}expect(":");while(startIndex<length){if(match("}")||matchKeyword("default")||matchKeyword("case")){break}statement=parseStatementListItem();consequent.push(statement)}return node.finishSwitchCase(test,consequent)}function parseSwitchStatement(node){var discriminant,cases,clause,oldInSwitch,defaultFound;expectKeyword("switch");expect("(");discriminant=parseExpression();expect(")");expect("{");cases=[];if(match("}")){lex();return node.finishSwitchStatement(discriminant,cases)}oldInSwitch=state.inSwitch;state.inSwitch=true;defaultFound=false;while(startIndex<length){if(match("}")){break}clause=parseSwitchCase();if(clause.test===null){if(defaultFound){throwError(Messages.MultipleDefaultsInSwitch)}defaultFound=true}cases.push(clause)}state.inSwitch=oldInSwitch;expect("}");return node.finishSwitchStatement(discriminant,cases)}function parseThrowStatement(node){var argument;expectKeyword("throw");if(hasLineTerminator){throwError(Messages.NewlineAfterThrow)}argument=parseExpression();consumeSemicolon();return node.finishThrowStatement(argument)}function parseCatchClause(){var param,body,node=new Node;expectKeyword("catch");expect("(");if(match(")")){throwUnexpectedToken(lookahead)}param=parsePattern();if(strict&&isRestrictedWord(param.name)){tolerateError(Messages.StrictCatchVariable)}expect(")");body=parseBlock();return node.finishCatchClause(param,body)}function parseTryStatement(node){var block,handler=null,finalizer=null;expectKeyword("try");block=parseBlock();if(matchKeyword("catch")){handler=parseCatchClause()}if(matchKeyword("finally")){lex();finalizer=parseBlock()}if(!handler&&!finalizer){throwError(Messages.NoCatchOrFinally)}return node.finishTryStatement(block,handler,finalizer)}function parseDebuggerStatement(node){expectKeyword("debugger");consumeSemicolon();return node.finishDebuggerStatement()}function parseStatement(){var type=lookahead.type,expr,labeledBody,key,node;if(type===Token.EOF){throwUnexpectedToken(lookahead)}if(type===Token.Punctuator&&lookahead.value==="{"){return parseBlock()}isAssignmentTarget=isBindingElement=true;node=new Node;if(type===Token.Punctuator){switch(lookahead.value){case";":return parseEmptyStatement(node);case"(":return parseExpressionStatement(node);default:break}}else if(type===Token.Keyword){switch(lookahead.value){case"break":return parseBreakStatement(node);case"continue":return parseContinueStatement(node);case"debugger":return parseDebuggerStatement(node);case"do":return parseDoWhileStatement(node);case"for":return parseForStatement(node);case"function":return parseFunctionDeclaration(node);case"if":return parseIfStatement(node);case"return":return parseReturnStatement(node);case"switch":return parseSwitchStatement(node);case"throw":return parseThrowStatement(node);case"try":return parseTryStatement(node);case"var":return parseVariableStatement(node);case"while":return parseWhileStatement(node);case"with":return parseWithStatement(node);default:break}}expr=parseExpression();if(expr.type===Syntax.Identifier&&match(":")){lex();key="$"+expr.name;if(Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError(Messages.Redeclaration,"Label",expr.name)}state.labelSet[key]=true;labeledBody=parseStatement();delete state.labelSet[key];return node.finishLabeledStatement(expr,labeledBody)}consumeSemicolon();return node.finishExpressionStatement(expr)}function parseFunctionSourceElements(){var statement,body=[],token,directive,firstRestricted,oldLabelSet,oldInIteration,oldInSwitch,oldInFunctionBody,oldParenthesisCount,node=new Node;expect("{");while(startIndex<length){if(lookahead.type!==Token.StringLiteral){break}token=lookahead;statement=parseStatementListItem();body.push(statement);if(statement.expression.type!==Syntax.Literal){break}directive=source.slice(token.start+1,token.end-1);if(directive==="use strict"){strict=true;if(firstRestricted){tolerateUnexpectedToken(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}oldLabelSet=state.labelSet;oldInIteration=state.inIteration;oldInSwitch=state.inSwitch;oldInFunctionBody=state.inFunctionBody;oldParenthesisCount=state.parenthesizedCount;state.labelSet={};state.inIteration=false;state.inSwitch=false;state.inFunctionBody=true;state.parenthesizedCount=0;while(startIndex<length){if(match("}")){break}body.push(parseStatementListItem())}expect("}");state.labelSet=oldLabelSet;state.inIteration=oldInIteration;state.inSwitch=oldInSwitch;state.inFunctionBody=oldInFunctionBody;state.parenthesizedCount=oldParenthesisCount;return node.finishBlockStatement(body)}function validateParam(options,param,name){var key="$"+name;if(strict){if(isRestrictedWord(name)){options.stricted=param;options.message=Messages.StrictParamName}if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.stricted=param;options.message=Messages.StrictParamDupe}}else if(!options.firstRestricted){if(isRestrictedWord(name)){options.firstRestricted=param;options.message=Messages.StrictParamName}else if(isStrictModeReservedWord(name)){options.firstRestricted=param;options.message=Messages.StrictReservedWord}else if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.firstRestricted=param;options.message=Messages.StrictParamDupe}}options.paramSet[key]=true}function parseParam(options){var token,param,def;token=lookahead;if(token.value==="..."){param=parseRestElement();validateParam(options,param.argument,param.argument.name);options.params.push(param);options.defaults.push(null);return false}param=parsePatternWithDefault();validateParam(options,token,token.value);if(param.type===Syntax.AssignmentPattern){def=param.right;param=param.left;++options.defaultCount}options.params.push(param);options.defaults.push(def);return!match(")")}function parseParams(firstRestricted){var options;options={params:[],defaultCount:0,defaults:[],firstRestricted:firstRestricted};expect("(");if(!match(")")){options.paramSet={};while(startIndex<length){if(!parseParam(options)){break}expect(",")}}expect(")");if(options.defaultCount===0){options.defaults=[]}return{params:options.params,defaults:options.defaults,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message}}function parseFunctionDeclaration(node,identifierIsOptional){var id=null,params=[],defaults=[],body,token,stricted,tmp,firstRestricted,message,previousStrict;expectKeyword("function");if(!identifierIsOptional||!match("(")){token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){tolerateUnexpectedToken(token,Messages.StrictFunctionName)}}else{if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictFunctionName}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord}}}tmp=parseParams(firstRestricted);params=tmp.params;defaults=tmp.defaults;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwUnexpectedToken(firstRestricted,message)}if(strict&&stricted){tolerateUnexpectedToken(stricted,message)}strict=previousStrict;return node.finishFunctionDeclaration(id,params,defaults,body)}function parseFunctionExpression(){var token,id=null,stricted,firstRestricted,message,tmp,params=[],defaults=[],body,previousStrict,node=new Node;expectKeyword("function");if(!match("(")){token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){tolerateUnexpectedToken(token,Messages.StrictFunctionName)}}else{if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictFunctionName}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord}}}tmp=parseParams(firstRestricted);params=tmp.params;defaults=tmp.defaults;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwUnexpectedToken(firstRestricted,message)}if(strict&&stricted){tolerateUnexpectedToken(stricted,message)}strict=previousStrict;return node.finishFunctionExpression(id,params,defaults,body)}function parseClassBody(){var classBody,token,isStatic,hasConstructor=false,body,method,computed,key;classBody=new Node;expect("{");body=[];while(!match("}")){if(match(";")){lex()}else{method=new Node;token=lookahead;isStatic=false;computed=match("[");key=parseObjectPropertyKey();if(key.name==="static"&&lookaheadPropertyName()){token=lookahead;isStatic=true;computed=match("[");key=parseObjectPropertyKey()}method=tryParseMethodDefinition(token,key,computed,method);if(method){method["static"]=isStatic;if(method.kind==="init"){method.kind="method"}if(!isStatic){if(!method.computed&&(method.key.name||method.key.value.toString())==="constructor"){if(method.kind!=="method"||!method.method||method.value.generator){throwUnexpectedToken(token,Messages.ConstructorSpecialMethod)}if(hasConstructor){throwUnexpectedToken(token,Messages.DuplicateConstructor)}else{hasConstructor=true}method.kind="constructor"}}else{if(!method.computed&&(method.key.name||method.key.value.toString())==="prototype"){throwUnexpectedToken(token,Messages.StaticPrototype)}}method.type=Syntax.MethodDefinition;delete method.method;delete method.shorthand;body.push(method)}else{throwUnexpectedToken(lookahead)}}}lex();return classBody.finishClassBody(body)}function parseClassDeclaration(identifierIsOptional){var id=null,superClass=null,classNode=new Node,classBody,previousStrict=strict;strict=true;expectKeyword("class");if(!identifierIsOptional||lookahead.type===Token.Identifier){id=parseVariableIdentifier()}if(matchKeyword("extends")){lex();superClass=isolateCoverGrammar(parseLeftHandSideExpressionAllowCall)}classBody=parseClassBody();strict=previousStrict;return classNode.finishClassDeclaration(id,superClass,classBody)}function parseClassExpression(){var id=null,superClass=null,classNode=new Node,classBody,previousStrict=strict;strict=true;expectKeyword("class");if(lookahead.type===Token.Identifier){id=parseVariableIdentifier()}if(matchKeyword("extends")){lex();superClass=isolateCoverGrammar(parseLeftHandSideExpressionAllowCall)}classBody=parseClassBody();strict=previousStrict;return classNode.finishClassExpression(id,superClass,classBody)}function parseModuleSpecifier(){var node=new Node;if(lookahead.type!==Token.StringLiteral){throwError(Messages.InvalidModuleSpecifier)}return node.finishLiteral(lex())}function parseExportSpecifier(){var exported,local,node=new Node,def;if(matchKeyword("default")){def=new Node;lex();local=def.finishIdentifier("default")}else{local=parseVariableIdentifier()}if(matchContextualKeyword("as")){lex();exported=parseNonComputedProperty()}return node.finishExportSpecifier(local,exported)}function parseExportNamedDeclaration(node){var declaration=null,isExportFromIdentifier,src=null,specifiers=[];if(lookahead.type===Token.Keyword){switch(lookahead.value){case"let":case"const":case"var":case"class":case"function":declaration=parseStatementListItem();return node.finishExportNamedDeclaration(declaration,specifiers,null)}}expect("{");if(!match("}")){do{isExportFromIdentifier=isExportFromIdentifier||matchKeyword("default");specifiers.push(parseExportSpecifier())}while(match(",")&&lex())}expect("}");if(matchContextualKeyword("from")){lex();src=parseModuleSpecifier();consumeSemicolon()}else if(isExportFromIdentifier){throwError(lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}else{consumeSemicolon()}return node.finishExportNamedDeclaration(declaration,specifiers,src)}function parseExportDefaultDeclaration(node){var declaration=null,expression=null;expectKeyword("default");if(matchKeyword("function")){declaration=parseFunctionDeclaration(new Node,true);return node.finishExportDefaultDeclaration(declaration)}if(matchKeyword("class")){declaration=parseClassDeclaration(true);return node.finishExportDefaultDeclaration(declaration)}if(matchContextualKeyword("from")){throwError(Messages.UnexpectedToken,lookahead.value)}if(match("{")){expression=parseObjectInitialiser()}else if(match("[")){expression=parseArrayInitialiser()}else{expression=parseAssignmentExpression()}consumeSemicolon();return node.finishExportDefaultDeclaration(expression)}function parseExportAllDeclaration(node){var src;expect("*");if(!matchContextualKeyword("from")){throwError(lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}lex();src=parseModuleSpecifier();consumeSemicolon();return node.finishExportAllDeclaration(src)}function parseExportDeclaration(){var node=new Node;if(state.inFunctionBody){throwError(Messages.IllegalExportDeclaration)}expectKeyword("export");if(matchKeyword("default")){return parseExportDefaultDeclaration(node)}if(match("*")){return parseExportAllDeclaration(node)}return parseExportNamedDeclaration(node)}function parseImportSpecifier(){var local,imported,node=new Node;imported=parseNonComputedProperty();if(matchContextualKeyword("as")){lex();local=parseVariableIdentifier()}return node.finishImportSpecifier(local,imported)}function parseNamedImports(){var specifiers=[];expect("{");if(!match("}")){do{specifiers.push(parseImportSpecifier())}while(match(",")&&lex())}expect("}");return specifiers}function parseImportDefaultSpecifier(){var local,node=new Node;local=parseNonComputedProperty();return node.finishImportDefaultSpecifier(local)}function parseImportNamespaceSpecifier(){var local,node=new Node;expect("*");if(!matchContextualKeyword("as")){throwError(Messages.NoAsAfterImportNamespace)}lex();local=parseNonComputedProperty();return node.finishImportNamespaceSpecifier(local)}function parseImportDeclaration(){var specifiers,src,node=new Node;if(state.inFunctionBody){throwError(Messages.IllegalImportDeclaration)}expectKeyword("import");specifiers=[];if(lookahead.type===Token.StringLiteral){src=parseModuleSpecifier();consumeSemicolon();return node.finishImportDeclaration(specifiers,src)}if(!matchKeyword("default")&&isIdentifierName(lookahead)){specifiers.push(parseImportDefaultSpecifier());if(match(",")){lex()}}if(match("*")){specifiers.push(parseImportNamespaceSpecifier())}else if(match("{")){specifiers=specifiers.concat(parseNamedImports())}if(!matchContextualKeyword("from")){throwError(lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}lex();src=parseModuleSpecifier();consumeSemicolon();return node.finishImportDeclaration(specifiers,src)}function parseScriptBody(){var statement,body=[],token,directive,firstRestricted;while(startIndex<length){token=lookahead;if(token.type!==Token.StringLiteral){break}statement=parseStatementListItem();body.push(statement);if(statement.expression.type!==Syntax.Literal){break}directive=source.slice(token.start+1,token.end-1);if(directive==="use strict"){strict=true;if(firstRestricted){tolerateUnexpectedToken(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}while(startIndex<length){statement=parseStatementListItem();if(typeof statement==="undefined"){break}body.push(statement)}return body}function parseProgram(){var body,node;peek();node=new Node;body=parseScriptBody();return node.finishProgram(body)}function filterTokenLocation(){var i,entry,token,tokens=[];for(i=0;i<extra.tokens.length;++i){entry=extra.tokens[i];token={type:entry.type,value:entry.value};if(entry.regex){token.regex={pattern:entry.regex.pattern,flags:entry.regex.flags}}if(extra.range){token.range=entry.range}if(extra.loc){token.loc=entry.loc}tokens.push(token)}extra.tokens=tokens}function tokenize(code,options){var toString,tokens;toString=String;if(typeof code!=="string"&&!(code instanceof String)){code=toString(code)}source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;startIndex=index;startLineNumber=lineNumber;startLineStart=lineStart;length=source.length;lookahead=null;state={allowIn:true,labelSet:{},inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1,curlyStack:[]};extra={};options=options||{};options.tokens=true;extra.tokens=[];extra.tokenize=true;extra.openParenToken=-1;extra.openCurlyToken=-1;extra.range=typeof options.range==="boolean"&&options.range;extra.loc=typeof options.loc==="boolean"&&options.loc;if(typeof options.comment==="boolean"&&options.comment){extra.comments=[]}if(typeof options.tolerant==="boolean"&&options.tolerant){extra.errors=[]}try{peek();if(lookahead.type===Token.EOF){return extra.tokens}lex();while(lookahead.type!==Token.EOF){try{lex()}catch(lexError){if(extra.errors){recordError(lexError);break}else{throw lexError}}}filterTokenLocation();tokens=extra.tokens;if(typeof extra.comments!=="undefined"){tokens.comments=extra.comments}if(typeof extra.errors!=="undefined"){tokens.errors=extra.errors}}catch(e){throw e}finally{extra={}}return tokens}function parse(code,options){var program,toString;toString=String;if(typeof code!=="string"&&!(code instanceof String)){code=toString(code)}source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;startIndex=index;startLineNumber=lineNumber;startLineStart=lineStart;length=source.length;lookahead=null;state={allowIn:true,labelSet:{},inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1,curlyStack:[]};sourceType="script";strict=false;extra={};if(typeof options!=="undefined"){extra.range=typeof options.range==="boolean"&&options.range;extra.loc=typeof options.loc==="boolean"&&options.loc;extra.attachComment=typeof options.attachComment==="boolean"&&options.attachComment;if(extra.loc&&options.source!==null&&options.source!==undefined){extra.source=toString(options.source)}if(typeof options.tokens==="boolean"&&options.tokens){extra.tokens=[]}if(typeof options.comment==="boolean"&&options.comment){extra.comments=[]}if(typeof options.tolerant==="boolean"&&options.tolerant){extra.errors=[]}if(extra.attachComment){extra.range=true;extra.comments=[];extra.bottomRightStack=[];extra.trailingComments=[];extra.leadingComments=[]}if(options.sourceType==="module"){sourceType=options.sourceType;strict=true}}try{program=parseProgram();if(typeof extra.comments!=="undefined"){program.comments=extra.comments}if(typeof extra.tokens!=="undefined"){filterTokenLocation();program.tokens=extra.tokens}if(typeof extra.errors!=="undefined"){program.errors=extra.errors}}catch(e){throw e}finally{extra={}}return program}exports.version="2.2.0";exports.tokenize=tokenize;exports.parse=parse;exports.Syntax=function(){var name,types={};if(typeof Object.create==="function"){types=Object.create(null)}for(name in Syntax){if(Syntax.hasOwnProperty(name)){types[name]=Syntax[name]}}if(typeof Object.freeze==="function"){Object.freeze(types)}return types}()})},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){module.exports={name:"estraverse",description:"ECMAScript JS AST traversal functions",homepage:"https://github.com/estools/estraverse",main:"estraverse.js",version:"4.1.0",engines:{node:">=0.10.0"},maintainers:[{name:"Yusuke Suzuki",email:"utatane.tea@gmail.com",web:"http://github.com/Constellation"}],repository:{type:"git",url:"http://github.com/estools/estraverse.git"},devDependencies:{chai:"^2.1.1","coffee-script":"^1.8.0",espree:"^1.11.0",gulp:"^3.8.10","gulp-bump":"^0.2.2","gulp-filter":"^2.0.0","gulp-git":"^1.0.1","gulp-tag-version":"^1.2.1",jshint:"^2.5.6",mocha:"^2.1.0"},licenses:[{type:"BSD",url:"http://github.com/estools/estraverse/raw/master/LICENSE.BSD"}],scripts:{},readme:"### Estraverse [![Build Status](https://secure.travis-ci.org/estools/estraverse.png)](http://travis-ci.org/estools/estraverse)\n\nEstraverse ([estraverse](http://github.com/estools/estraverse)) is\n[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)\ntraversal functions from [esmangle project](http://github.com/estools/esmangle).\n\n### Documentation\n\nYou can find usage docs at [wiki page](https://github.com/estools/estraverse/wiki/Usage).\n\n### Example Usage\n\nThe following code will output all variables declared at the root of a file.\n\n```javascript\nestraverse.traverse(ast, {\n enter: function (node, parent) {\n if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration')\n return estraverse.VisitorOption.Skip;\n },\n leave: function (node, parent) {\n if (node.type == 'VariableDeclarator')\n console.log(node.id.name);\n }\n});\n```\n\nWe can use `this.skip`, `this.remove` and `this.break` functions instead of using Skip, Remove and Break.\n\n```javascript\nestraverse.traverse(ast, {\n enter: function (node) {\n this.break();\n }\n});\n```\n\nAnd estraverse provides `estraverse.replace` function. When returning node from `enter`/`leave`, current node is replaced with it.\n\n```javascript\nresult = estraverse.replace(tree, {\n enter: function (node) {\n // Replace it with replaced.\n if (node.type === 'Literal')\n return replaced;\n }\n});\n```\n\nBy passing `visitor.keys` mapping, we can extend estraverse traversing functionality.\n\n```javascript\n// This tree contains a user-defined `TestExpression` node.\nvar tree = {\n type: 'TestExpression',\n\n // This 'argument' is the property containing the other **node**.\n argument: {\n type: 'Literal',\n value: 20\n },\n\n // This 'extended' is the property not containing the other **node**.\n extended: true\n};\nestraverse.traverse(tree, {\n enter: function (node) { },\n\n // Extending the exising traversing rules.\n keys: {\n // TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ]\n TestExpression: ['argument']\n }\n});\n```\n\nBy passing `visitor.fallback` option, we can control the behavior when encountering unknown nodes.\n```javascript\n// This tree contains a user-defined `TestExpression` node.\nvar tree = {\n type: 'TestExpression',\n\n // This 'argument' is the property containing the other **node**.\n argument: {\n type: 'Literal',\n value: 20\n },\n\n // This 'extended' is the property not containing the other **node**.\n extended: true\n};\nestraverse.traverse(tree, {\n enter: function (node) { },\n\n // Iterating the child **nodes** of unknown nodes.\n fallback: 'iteration'\n});\n```\n\n### License\n\nCopyright (C) 2012-2013 [Yusuke Suzuki](http://github.com/Constellation)\n (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n",
readmeFilename:"package/README.md"}},{}],estraverse:[function(require,module,exports){(function clone(exports){"use strict";var Syntax,isArray,VisitorOption,VisitorKeys,objectCreate,objectKeys,BREAK,SKIP,REMOVE;function ignoreJSHintError(){}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==="object"&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function shallowCopy(obj){var ret={},key;for(key in obj){if(obj.hasOwnProperty(key)){ret[key]=obj[key]}}return ret}ignoreJSHintError(shallowCopy);function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}function lowerBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){i=current+1;len-=diff+1}else{len=diff}}return i}ignoreJSHintError(lowerBound);objectCreate=Object.create||function(){function F(){}return function(o){F.prototype=o;return new F}}();objectKeys=Object.keys||function(o){var keys=[],key;for(key in o){keys.push(key)}return keys};function extend(to,from){var keys=objectKeys(from),key,i,len;for(i=0,len=keys.length;i<len;i+=1){key=keys[i];to[key]=from[key]}return to}Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};VisitorKeys={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.type=function(){var node=this.current();return node.type||this.__current.wrap};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype["break"]=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=visitor.fallback==="iteration";this.__keys=VisitorKeys;if(visitor.keys){this.__keys=extend(objectCreate(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==="object"&&typeof node.type==="string"}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&"properties"===key}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){function removeElem(element){var i,key,nextElem,parent;if(element.ref.remove()){key=element.ref.key;parent=element.ref.parent;i=worklist.length;while(i--){nextElem=worklist[i];if(nextElem.ref&&nextElem.ref.parent===parent){if(nextElem.ref.key<key){break}--nextElem.ref.key}}}}var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,"root"));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem(element)}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem(element);element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error("attachComments needs range information")}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.version=require("./package.json").version;exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller;exports.cloneEnvironment=function(){return clone({})};return exports})(exports)},{"./package.json":1}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:2}],2:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],3:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.estraverse={})}})(this,function clone(exports){"use strict";var Syntax,isArray,VisitorOption,VisitorKeys,objectCreate,objectKeys,BREAK,SKIP,REMOVE;function ignoreJSHintError(){}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==="object"&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function shallowCopy(obj){var ret={},key;for(key in obj){if(obj.hasOwnProperty(key)){ret[key]=obj[key]}}return ret}ignoreJSHintError(shallowCopy);function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}function lowerBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){i=current+1;len-=diff+1}else{len=diff}}return i}ignoreJSHintError(lowerBound);objectCreate=Object.create||function(){function F(){}return function(o){F.prototype=o;return new F}}();objectKeys=Object.keys||function(o){var keys=[],key;for(key in o){keys.push(key)}return keys};function extend(to,from){var keys=objectKeys(from),key,i,len;for(i=0,len=keys.length;i<len;i+=1){key=keys[i];to[key]=from[key]}return to}Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};VisitorKeys={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["id"],ImportNamespaceSpecifier:["id"],ImportSpecifier:["id","name"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.type=function(){var node=this.current();return node.type||this.__current.wrap};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype["break"]=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=visitor.fallback==="iteration";this.__keys=VisitorKeys;if(visitor.keys){this.__keys=extend(objectCreate(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==="object"&&typeof node.type==="string"}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&"properties"===key}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){function removeElem(element){var i,key,nextElem,parent;if(element.ref.remove()){key=element.ref.key;parent=element.ref.parent;i=worklist.length;while(i--){nextElem=worklist[i];if(nextElem.ref&&nextElem.ref.parent===parent){if(nextElem.ref.key<key){break}--nextElem.ref.key}}}}var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,"root"));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem(element)}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem(element);element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){
element=new Element(candidate[current2],[key,current2],"Property",new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error("attachComments needs range information")}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.version="1.8.1-dev";exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller;exports.cloneEnvironment=function(){return clone({})};return exports})},{}],4:[function(require,module,exports){(function(){"use strict";function isExpression(node){if(node==null){return false}switch(node.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return true}return false}function isIterationStatement(node){if(node==null){return false}switch(node.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return true}return false}function isStatement(node){if(node==null){return false}switch(node.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return true}return false}function isSourceElement(node){return isStatement(node)||node!=null&&node.type==="FunctionDeclaration"}function trailingStatement(node){switch(node.type){case"IfStatement":if(node.alternate!=null){return node.alternate}return node.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return node.body}return null}function isProblematicIfStatement(node){var current;if(node.type!=="IfStatement"){return false}if(node.alternate==null){return false}current=node.consequent;do{if(current.type==="IfStatement"){if(current.alternate==null){return true}}current=trailingStatement(current)}while(current);return false}module.exports={isExpression:isExpression,isStatement:isStatement,isIterationStatement:isIterationStatement,isSourceElement:isSourceElement,isProblematicIfStatement:isProblematicIfStatement,trailingStatement:trailingStatement}})()},{}],5:[function(require,module,exports){(function(){"use strict";var Regex,NON_ASCII_WHITESPACES;Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return isDecimalDigit(ch)||97<=ch&&ch<=102||65<=ch&&ch<=70}function isOctalDigit(ch){return ch>=48&&ch<=55}NON_ASCII_WHITESPACES=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&NON_ASCII_WHITESPACES.indexOf(ch)>=0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch>=97&&ch<=122||ch>=65&&ch<=90||ch===36||ch===95||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch>=97&&ch<=122||ch>=65&&ch<=90||ch>=48&&ch<=57||ch===36||ch===95||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}module.exports={isDecimalDigit:isDecimalDigit,isHexDigit:isHexDigit,isOctalDigit:isOctalDigit,isWhiteSpace:isWhiteSpace,isLineTerminator:isLineTerminator,isIdentifierStart:isIdentifierStart,isIdentifierPart:isIdentifierPart}})()},{}],6:[function(require,module,exports){(function(){"use strict";var code=require("./code");function isStrictModeReservedWordES6(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return true;default:return false}}function isKeywordES5(id,strict){if(!strict&&id==="yield"){return false}return isKeywordES6(id,strict)}function isKeywordES6(id,strict){if(strict&&isStrictModeReservedWordES6(id)){return true}switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="yield"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function isReservedWordES5(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES5(id,strict)}function isReservedWordES6(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES6(id,strict)}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isIdentifierName(id){var i,iz,ch;if(id.length===0){return false}ch=id.charCodeAt(0);if(!code.isIdentifierStart(ch)||ch===92){return false}for(i=1,iz=id.length;i<iz;++i){ch=id.charCodeAt(i);if(!code.isIdentifierPart(ch)||ch===92){return false}}return true}function isIdentifierES5(id,strict){return isIdentifierName(id)&&!isReservedWordES5(id,strict)}function isIdentifierES6(id,strict){return isIdentifierName(id)&&!isReservedWordES6(id,strict)}module.exports={isKeywordES5:isKeywordES5,isKeywordES6:isKeywordES6,isReservedWordES5:isReservedWordES5,isReservedWordES6:isReservedWordES6,isRestrictedWord:isRestrictedWord,isIdentifierName:isIdentifierName,isIdentifierES5:isIdentifierES5,isIdentifierES6:isIdentifierES6}})()},{"./code":5}],7:[function(require,module,exports){(function(){"use strict";exports.ast=require("./ast");exports.code=require("./code");exports.keyword=require("./keyword")})()},{"./ast":4,"./code":5,"./keyword":6}],8:[function(require,module,exports){exports.SourceMapGenerator=require("./source-map/source-map-generator").SourceMapGenerator;exports.SourceMapConsumer=require("./source-map/source-map-consumer").SourceMapConsumer;exports.SourceNode=require("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":14,"./source-map/source-map-generator":15,"./source-map/source-node":16}],9:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");function ArraySet(){this._array=[];this._set={}}ArraySet.fromArray=function ArraySet_fromArray(aArray,aAllowDuplicates){var set=new ArraySet;for(var i=0,len=aArray.length;i<len;i++){set.add(aArray[i],aAllowDuplicates)}return set};ArraySet.prototype.add=function ArraySet_add(aStr,aAllowDuplicates){var isDuplicate=this.has(aStr);var idx=this._array.length;if(!isDuplicate||aAllowDuplicates){this._array.push(aStr)}if(!isDuplicate){this._set[util.toSetString(aStr)]=idx}};ArraySet.prototype.has=function ArraySet_has(aStr){return Object.prototype.hasOwnProperty.call(this._set,util.toSetString(aStr))};ArraySet.prototype.indexOf=function ArraySet_indexOf(aStr){if(this.has(aStr)){return this._set[util.toSetString(aStr)]}throw new Error('"'+aStr+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(aIdx){if(aIdx>=0&&aIdx<this._array.length){return this._array[aIdx]}throw new Error("No element indexed by "+aIdx)};ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice()};exports.ArraySet=ArraySet})},{"./util":17,amdefine:18}],10:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64=require("./base64");var VLQ_BASE_SHIFT=5;var VLQ_BASE=1<<VLQ_BASE_SHIFT;var VLQ_BASE_MASK=VLQ_BASE-1;var VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(aValue){return aValue<0?(-aValue<<1)+1:(aValue<<1)+0}function fromVLQSigned(aValue){var isNegative=(aValue&1)===1;var shifted=aValue>>1;return isNegative?-shifted:shifted}exports.encode=function base64VLQ_encode(aValue){var encoded="";var digit;var vlq=toVLQSigned(aValue);do{digit=vlq&VLQ_BASE_MASK;vlq>>>=VLQ_BASE_SHIFT;if(vlq>0){digit|=VLQ_CONTINUATION_BIT}encoded+=base64.encode(digit)}while(vlq>0);return encoded};exports.decode=function base64VLQ_decode(aStr,aOutParam){var i=0;var strLen=aStr.length;var result=0;var shift=0;var continuation,digit;do{if(i>=strLen){throw new Error("Expected more digits in base 64 VLQ value.")}digit=base64.decode(aStr.charAt(i++));continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<<shift);shift+=VLQ_BASE_SHIFT}while(continuation);aOutParam.value=fromVLQSigned(result);aOutParam.rest=aStr.slice(i)}})},{"./base64":11,amdefine:18}],11:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var charToIntMap={};var intToCharMap={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(ch,index){charToIntMap[ch]=index;intToCharMap[index]=ch});exports.encode=function base64_encode(aNumber){if(aNumber in intToCharMap){return intToCharMap[aNumber]}throw new TypeError("Must be between 0 and 63: "+aNumber)};exports.decode=function base64_decode(aChar){if(aChar in charToIntMap){return charToIntMap[aChar]}throw new TypeError("Not a valid base 64 digit: "+aChar)}})},{amdefine:18}],12:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function recursiveSearch(aLow,aHigh,aNeedle,aHaystack,aCompare){var mid=Math.floor((aHigh-aLow)/2)+aLow;var cmp=aCompare(aNeedle,aHaystack[mid],true);if(cmp===0){return mid}else if(cmp>0){if(aHigh-mid>1){return recursiveSearch(mid,aHigh,aNeedle,aHaystack,aCompare)}return mid}else{if(mid-aLow>1){return recursiveSearch(aLow,mid,aNeedle,aHaystack,aCompare)}return aLow<0?-1:aLow}}exports.search=function search(aNeedle,aHaystack,aCompare){if(aHaystack.length===0){return-1}return recursiveSearch(-1,aHaystack.length,aNeedle,aHaystack,aCompare)}})},{amdefine:18}],13:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");function generatedPositionAfter(mappingA,mappingB){var lineA=mappingA.generatedLine;var lineB=mappingB.generatedLine;var columnA=mappingA.generatedColumn;var columnB=mappingB.generatedColumn;return lineB>lineA||lineB==lineA&&columnB>=columnA||util.compareByGeneratedPositions(mappingA,mappingB)<=0}function MappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(aCallback,aThisArg){this._array.forEach(aCallback,aThisArg)};MappingList.prototype.add=function MappingList_add(aMapping){var mapping;if(generatedPositionAfter(this._last,aMapping)){this._last=aMapping;this._array.push(aMapping)}else{this._sorted=false;this._array.push(aMapping)}};MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(util.compareByGeneratedPositions);this._sorted=true}return this._array};exports.MappingList=MappingList})},{"./util":17,amdefine:18}],14:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");var binarySearch=require("./binary-search");var ArraySet=require("./array-set").ArraySet;var base64VLQ=require("./base64-vlq");function SourceMapConsumer(aSourceMap){var sourceMap=aSourceMap;if(typeof aSourceMap==="string"){sourceMap=JSON.parse(aSourceMap.replace(/^\)\]\}'/,""))}var version=util.getArg(sourceMap,"version");var sources=util.getArg(sourceMap,"sources");var names=util.getArg(sourceMap,"names",[]);var sourceRoot=util.getArg(sourceMap,"sourceRoot",null);var sourcesContent=util.getArg(sourceMap,"sourcesContent",null);var mappings=util.getArg(sourceMap,"mappings");var file=util.getArg(sourceMap,"file",null);if(version!=this._version){throw new Error("Unsupported version: "+version)}sources=sources.map(util.normalize);this._names=ArraySet.fromArray(names,true);this._sources=ArraySet.fromArray(sources,true);this.sourceRoot=sourceRoot;this.sourcesContent=sourcesContent;this._mappings=mappings;this.file=file}SourceMapConsumer.fromSourceMap=function SourceMapConsumer_fromSourceMap(aSourceMap){var smc=Object.create(SourceMapConsumer.prototype);smc._names=ArraySet.fromArray(aSourceMap._names.toArray(),true);smc._sources=ArraySet.fromArray(aSourceMap._sources.toArray(),true);smc.sourceRoot=aSourceMap._sourceRoot;smc.sourcesContent=aSourceMap._generateSourcesContent(smc._sources.toArray(),smc.sourceRoot);smc.file=aSourceMap._file;smc.__generatedMappings=aSourceMap._mappings.toArray().slice();smc.__originalMappings=aSourceMap._mappings.toArray().slice().sort(util.compareByOriginalPositions);return smc};SourceMapConsumer.prototype._version=3;Object.defineProperty(SourceMapConsumer.prototype,"sources",{get:function(){return this._sources.toArray().map(function(s){return this.sourceRoot!=null?util.join(this.sourceRoot,s):s},this)}});SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{get:function(){if(!this.__generatedMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{get:function(){if(!this.__originalMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._nextCharIsMappingSeparator=function SourceMapConsumer_nextCharIsMappingSeparator(aStr){var c=aStr.charAt(0);return c===";"||c===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(aStr,aSourceRoot){var generatedLine=1;var previousGeneratedColumn=0;var previousOriginalLine=0;var previousOriginalColumn=0;var previousSource=0;var previousName=0;var str=aStr;var temp={};var mapping;while(str.length>0){if(str.charAt(0)===";"){generatedLine++;str=str.slice(1);previousGeneratedColumn=0}else if(str.charAt(0)===","){str=str.slice(1)}else{mapping={};mapping.generatedLine=generatedLine;base64VLQ.decode(str,temp);mapping.generatedColumn=previousGeneratedColumn+temp.value;previousGeneratedColumn=mapping.generatedColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.source=this._sources.at(previousSource+temp.value);previousSource+=temp.value;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source, but no line and column")}base64VLQ.decode(str,temp);mapping.originalLine=previousOriginalLine+temp.value;previousOriginalLine=mapping.originalLine;mapping.originalLine+=1;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source and line, but no column")}base64VLQ.decode(str,temp);mapping.originalColumn=previousOriginalColumn+temp.value;previousOriginalColumn=mapping.originalColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.name=this._names.at(previousName+temp.value);previousName+=temp.value;str=temp.rest}}this.__generatedMappings.push(mapping);if(typeof mapping.originalLine==="number"){this.__originalMappings.push(mapping)}}}this.__generatedMappings.sort(util.compareByGeneratedPositions);this.__originalMappings.sort(util.compareByOriginalPositions)};SourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(aNeedle,aMappings,aLineName,aColumnName,aComparator){if(aNeedle[aLineName]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+aNeedle[aLineName])}if(aNeedle[aColumnName]<0){throw new TypeError("Column must be greater than or equal to 0, got "+aNeedle[aColumnName])}return binarySearch.search(aNeedle,aMappings,aComparator)};SourceMapConsumer.prototype.computeColumnSpans=function SourceMapConsumer_computeColumnSpans(){for(var index=0;index<this._generatedMappings.length;++index){var mapping=this._generatedMappings[index];if(index+1<this._generatedMappings.length){var nextMapping=this._generatedMappings[index+1];if(mapping.generatedLine===nextMapping.generatedLine){mapping.lastGeneratedColumn=nextMapping.generatedColumn-1;continue}}mapping.lastGeneratedColumn=Infinity}};SourceMapConsumer.prototype.originalPositionFor=function SourceMapConsumer_originalPositionFor(aArgs){var needle={generatedLine:util.getArg(aArgs,"line"),generatedColumn:util.getArg(aArgs,"column")};var index=this._findMapping(needle,this._generatedMappings,"generatedLine","generatedColumn",util.compareByGeneratedPositions);if(index>=0){var mapping=this._generatedMappings[index];if(mapping.generatedLine===needle.generatedLine){var source=util.getArg(mapping,"source",null);if(source!=null&&this.sourceRoot!=null){source=util.join(this.sourceRoot,source)}return{source:source,line:util.getArg(mapping,"originalLine",null),column:util.getArg(mapping,"originalColumn",null),name:util.getArg(mapping,"name",null)}}}return{source:null,line:null,column:null,name:null}};SourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(aSource){if(!this.sourcesContent){return null}if(this.sourceRoot!=null){aSource=util.relative(this.sourceRoot,aSource)}if(this._sources.has(aSource)){return this.sourcesContent[this._sources.indexOf(aSource)]}var url;if(this.sourceRoot!=null&&(url=util.urlParse(this.sourceRoot))){var fileUriAbsPath=aSource.replace(/^file:\/\//,"");if(url.scheme=="file"&&this._sources.has(fileUriAbsPath)){return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]}if((!url.path||url.path=="/")&&this._sources.has("/"+aSource)){return this.sourcesContent[this._sources.indexOf("/"+aSource)]}}throw new Error('"'+aSource+'" is not in the SourceMap.')};SourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(aArgs){var needle={source:util.getArg(aArgs,"source"),originalLine:util.getArg(aArgs,"line"),originalColumn:util.getArg(aArgs,"column")};if(this.sourceRoot!=null){needle.source=util.relative(this.sourceRoot,needle.source)}var index=this._findMapping(needle,this._originalMappings,"originalLine","originalColumn",util.compareByOriginalPositions);if(index>=0){var mapping=this._originalMappings[index];return{line:util.getArg(mapping,"generatedLine",null),column:util.getArg(mapping,"generatedColumn",null),lastColumn:util.getArg(mapping,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};SourceMapConsumer.prototype.allGeneratedPositionsFor=function SourceMapConsumer_allGeneratedPositionsFor(aArgs){var needle={source:util.getArg(aArgs,"source"),originalLine:util.getArg(aArgs,"line"),originalColumn:Infinity};if(this.sourceRoot!=null){needle.source=util.relative(this.sourceRoot,needle.source)}var mappings=[];var index=this._findMapping(needle,this._originalMappings,"originalLine","originalColumn",util.compareByOriginalPositions);if(index>=0){var mapping=this._originalMappings[index];while(mapping&&mapping.originalLine===needle.originalLine){mappings.push({line:util.getArg(mapping,"generatedLine",null),column:util.getArg(mapping,"generatedColumn",null),lastColumn:util.getArg(mapping,"lastGeneratedColumn",null)});mapping=this._originalMappings[--index]}}return mappings.reverse()};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(aCallback,aContext,aOrder){var context=aContext||null;var order=aOrder||SourceMapConsumer.GENERATED_ORDER;var mappings;switch(order){case SourceMapConsumer.GENERATED_ORDER:mappings=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:mappings=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var sourceRoot=this.sourceRoot;mappings.map(function(mapping){var source=mapping.source;if(source!=null&&sourceRoot!=null){source=util.join(sourceRoot,source)}return{source:source,generatedLine:mapping.generatedLine,generatedColumn:mapping.generatedColumn,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:mapping.name}}).forEach(aCallback,context)};exports.SourceMapConsumer=SourceMapConsumer})},{"./array-set":9,"./base64-vlq":10,"./binary-search":12,"./util":17,amdefine:18}],15:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64VLQ=require("./base64-vlq");var util=require("./util");var ArraySet=require("./array-set").ArraySet;var MappingList=require("./mapping-list").MappingList;function SourceMapGenerator(aArgs){if(!aArgs){aArgs={}}this._file=util.getArg(aArgs,"file",null);this._sourceRoot=util.getArg(aArgs,"sourceRoot",null);this._skipValidation=util.getArg(aArgs,"skipValidation",false);this._sources=new ArraySet;this._names=new ArraySet;this._mappings=new MappingList;this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(aSourceMapConsumer){var sourceRoot=aSourceMapConsumer.sourceRoot;var generator=new SourceMapGenerator({file:aSourceMapConsumer.file,sourceRoot:sourceRoot});aSourceMapConsumer.eachMapping(function(mapping){var newMapping={generated:{line:mapping.generatedLine,column:mapping.generatedColumn}};if(mapping.source!=null){newMapping.source=mapping.source;if(sourceRoot!=null){newMapping.source=util.relative(sourceRoot,newMapping.source)}newMapping.original={line:mapping.originalLine,column:mapping.originalColumn};if(mapping.name!=null){newMapping.name=mapping.name}}generator.addMapping(newMapping)});aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){generator.setSourceContent(sourceFile,content)}});return generator};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(aArgs){var generated=util.getArg(aArgs,"generated");var original=util.getArg(aArgs,"original",null);var source=util.getArg(aArgs,"source",null);var name=util.getArg(aArgs,"name",null);if(!this._skipValidation){this._validateMapping(generated,original,source,name)}if(source!=null&&!this._sources.has(source)){this._sources.add(source)}if(name!=null&&!this._names.has(name)){this._names.add(name)}this._mappings.add({generatedLine:generated.line,generatedColumn:generated.column,originalLine:original!=null&&original.line,originalColumn:original!=null&&original.column,source:source,name:name})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(aSourceFile,aSourceContent){var source=aSourceFile;if(this._sourceRoot!=null){source=util.relative(this._sourceRoot,source)}if(aSourceContent!=null){if(!this._sourcesContents){this._sourcesContents={}}this._sourcesContents[util.toSetString(source)]=aSourceContent}else if(this._sourcesContents){delete this._sourcesContents[util.toSetString(source)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath){var sourceFile=aSourceFile;if(aSourceFile==null){if(aSourceMapConsumer.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}sourceFile=aSourceMapConsumer.file}var sourceRoot=this._sourceRoot;if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}var newSources=new ArraySet;var newNames=new ArraySet;this._mappings.unsortedForEach(function(mapping){if(mapping.source===sourceFile&&mapping.originalLine!=null){var original=aSourceMapConsumer.originalPositionFor({line:mapping.originalLine,column:mapping.originalColumn});if(original.source!=null){mapping.source=original.source;if(aSourceMapPath!=null){mapping.source=util.join(aSourceMapPath,mapping.source)}if(sourceRoot!=null){mapping.source=util.relative(sourceRoot,mapping.source)}mapping.originalLine=original.line;mapping.originalColumn=original.column;if(original.name!=null){mapping.name=original.name}}}var source=mapping.source;if(source!=null&&!newSources.has(source)){newSources.add(source)}var name=mapping.name;if(name!=null&&!newNames.has(name)){newNames.add(name)}},this);this._sources=newSources;this._names=newNames;aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aSourceMapPath!=null){sourceFile=util.join(aSourceMapPath,sourceFile)}if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}this.setSourceContent(sourceFile,content)}},this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(aGenerated,aOriginal,aSource,aName){if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aGenerated.line>0&&aGenerated.column>=0&&!aOriginal&&!aSource&&!aName){return}else if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aOriginal&&"line"in aOriginal&&"column"in aOriginal&&aGenerated.line>0&&aGenerated.column>=0&&aOriginal.line>0&&aOriginal.column>=0&&aSource){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:aGenerated,source:aSource,original:aOriginal,name:aName}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var previousGeneratedColumn=0;var previousGeneratedLine=1;var previousOriginalColumn=0;var previousOriginalLine=0;var previousName=0;var previousSource=0;var result="";var mapping;var mappings=this._mappings.toArray();for(var i=0,len=mappings.length;i<len;i++){mapping=mappings[i];if(mapping.generatedLine!==previousGeneratedLine){previousGeneratedColumn=0;while(mapping.generatedLine!==previousGeneratedLine){result+=";";previousGeneratedLine++}}else{if(i>0){if(!util.compareByGeneratedPositions(mapping,mappings[i-1])){continue}result+=","}}result+=base64VLQ.encode(mapping.generatedColumn-previousGeneratedColumn);previousGeneratedColumn=mapping.generatedColumn;if(mapping.source!=null){result+=base64VLQ.encode(this._sources.indexOf(mapping.source)-previousSource);previousSource=this._sources.indexOf(mapping.source);result+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOriginalLine=mapping.originalLine-1;result+=base64VLQ.encode(mapping.originalColumn-previousOriginalColumn);previousOriginalColumn=mapping.originalColumn;if(mapping.name!=null){result+=base64VLQ.encode(this._names.indexOf(mapping.name)-previousName);previousName=this._names.indexOf(mapping.name)}}}return result};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(aSources,aSourceRoot){return aSources.map(function(source){if(!this._sourcesContents){return null}if(aSourceRoot!=null){source=util.relative(aSourceRoot,source)}var key=util.toSetString(source);return Object.prototype.hasOwnProperty.call(this._sourcesContents,key)?this._sourcesContents[key]:null;
},this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot)}return map};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this)};exports.SourceMapGenerator=SourceMapGenerator})},{"./array-set":9,"./base64-vlq":10,"./mapping-list":13,"./util":17,amdefine:18}],16:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var SourceMapGenerator=require("./source-map-generator").SourceMapGenerator;var util=require("./util");var REGEX_NEWLINE=/(\r?\n)/;var NEWLINE_CODE=10;var isSourceNode="$$$isSourceNode$$$";function SourceNode(aLine,aColumn,aSource,aChunks,aName){this.children=[];this.sourceContents={};this.line=aLine==null?null:aLine;this.column=aColumn==null?null:aColumn;this.source=aSource==null?null:aSource;this.name=aName==null?null:aName;this[isSourceNode]=true;if(aChunks!=null)this.add(aChunks)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath){var node=new SourceNode;var remainingLines=aGeneratedCode.split(REGEX_NEWLINE);var shiftNextLine=function(){var lineContents=remainingLines.shift();var newLine=remainingLines.shift()||"";return lineContents+newLine};var lastGeneratedLine=1,lastGeneratedColumn=0;var lastMapping=null;aSourceMapConsumer.eachMapping(function(mapping){if(lastMapping!==null){if(lastGeneratedLine<mapping.generatedLine){var code="";addMappingWithCode(lastMapping,shiftNextLine());lastGeneratedLine++;lastGeneratedColumn=0}else{var nextLine=remainingLines[0];var code=nextLine.substr(0,mapping.generatedColumn-lastGeneratedColumn);remainingLines[0]=nextLine.substr(mapping.generatedColumn-lastGeneratedColumn);lastGeneratedColumn=mapping.generatedColumn;addMappingWithCode(lastMapping,code);lastMapping=mapping;return}}while(lastGeneratedLine<mapping.generatedLine){node.add(shiftNextLine());lastGeneratedLine++}if(lastGeneratedColumn<mapping.generatedColumn){var nextLine=remainingLines[0];node.add(nextLine.substr(0,mapping.generatedColumn));remainingLines[0]=nextLine.substr(mapping.generatedColumn);lastGeneratedColumn=mapping.generatedColumn}lastMapping=mapping},this);if(remainingLines.length>0){if(lastMapping){addMappingWithCode(lastMapping,shiftNextLine())}node.add(remainingLines.join(""))}aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aRelativePath!=null){sourceFile=util.join(aRelativePath,sourceFile)}node.setSourceContent(sourceFile,content)}});return node;function addMappingWithCode(mapping,code){if(mapping===null||mapping.source===undefined){node.add(code)}else{var source=aRelativePath?util.join(aRelativePath,mapping.source):mapping.source;node.add(new SourceNode(mapping.originalLine,mapping.originalColumn,source,code,mapping.name))}}};SourceNode.prototype.add=function SourceNode_add(aChunk){if(Array.isArray(aChunk)){aChunk.forEach(function(chunk){this.add(chunk)},this)}else if(aChunk[isSourceNode]||typeof aChunk==="string"){if(aChunk){this.children.push(aChunk)}}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.prepend=function SourceNode_prepend(aChunk){if(Array.isArray(aChunk)){for(var i=aChunk.length-1;i>=0;i--){this.prepend(aChunk[i])}}else if(aChunk[isSourceNode]||typeof aChunk==="string"){this.children.unshift(aChunk)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.walk=function SourceNode_walk(aFn){var chunk;for(var i=0,len=this.children.length;i<len;i++){chunk=this.children[i];if(chunk[isSourceNode]){chunk.walk(aFn)}else{if(chunk!==""){aFn(chunk,{source:this.source,line:this.line,column:this.column,name:this.name})}}}};SourceNode.prototype.join=function SourceNode_join(aSep){var newChildren;var i;var len=this.children.length;if(len>0){newChildren=[];for(i=0;i<len-1;i++){newChildren.push(this.children[i]);newChildren.push(aSep)}newChildren.push(this.children[i]);this.children=newChildren}return this};SourceNode.prototype.replaceRight=function SourceNode_replaceRight(aPattern,aReplacement){var lastChild=this.children[this.children.length-1];if(lastChild[isSourceNode]){lastChild.replaceRight(aPattern,aReplacement)}else if(typeof lastChild==="string"){this.children[this.children.length-1]=lastChild.replace(aPattern,aReplacement)}else{this.children.push("".replace(aPattern,aReplacement))}return this};SourceNode.prototype.setSourceContent=function SourceNode_setSourceContent(aSourceFile,aSourceContent){this.sourceContents[util.toSetString(aSourceFile)]=aSourceContent};SourceNode.prototype.walkSourceContents=function SourceNode_walkSourceContents(aFn){for(var i=0,len=this.children.length;i<len;i++){if(this.children[i][isSourceNode]){this.children[i].walkSourceContents(aFn)}}var sources=Object.keys(this.sourceContents);for(var i=0,len=sources.length;i<len;i++){aFn(util.fromSetString(sources[i]),this.sourceContents[sources[i]])}};SourceNode.prototype.toString=function SourceNode_toString(){var str="";this.walk(function(chunk){str+=chunk});return str};SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false}for(var idx=0,length=chunk.length;idx<length;idx++){if(chunk.charCodeAt(idx)===NEWLINE_CODE){generated.line++;generated.column=0;if(idx+1===length){lastOriginalSource=null;sourceMappingActive=false}else if(sourceMappingActive){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}}else{generated.column++}}});this.walkSourceContents(function(sourceFile,sourceContent){map.setSourceContent(sourceFile,sourceContent)});return{code:generated.code,map:map}};exports.SourceNode=SourceNode})},{"./source-map-generator":15,"./util":17,amdefine:18}],17:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function getArg(aArgs,aName,aDefaultValue){if(aName in aArgs){return aArgs[aName]}else if(arguments.length===3){return aDefaultValue}else{throw new Error('"'+aName+'" is a required argument.')}}exports.getArg=getArg;var urlRegexp=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;var dataUrlRegexp=/^data:.+\,.+$/;function urlParse(aUrl){var match=aUrl.match(urlRegexp);if(!match){return null}return{scheme:match[1],auth:match[2],host:match[3],port:match[4],path:match[5]}}exports.urlParse=urlParse;function urlGenerate(aParsedUrl){var url="";if(aParsedUrl.scheme){url+=aParsedUrl.scheme+":"}url+="//";if(aParsedUrl.auth){url+=aParsedUrl.auth+"@"}if(aParsedUrl.host){url+=aParsedUrl.host}if(aParsedUrl.port){url+=":"+aParsedUrl.port}if(aParsedUrl.path){url+=aParsedUrl.path}return url}exports.urlGenerate=urlGenerate;function normalize(aPath){var path=aPath;var url=urlParse(aPath);if(url){if(!url.path){return aPath}path=url.path}var isAbsolute=path.charAt(0)==="/";var parts=path.split(/\/+/);for(var part,up=0,i=parts.length-1;i>=0;i--){part=parts[i];if(part==="."){parts.splice(i,1)}else if(part===".."){up++}else if(up>0){if(part===""){parts.splice(i+1,up);up=0}else{parts.splice(i,2);up--}}}path=parts.join("/");if(path===""){path=isAbsolute?"/":"."}if(url){url.path=path;return urlGenerate(url)}return path}exports.normalize=normalize;function join(aRoot,aPath){if(aRoot===""){aRoot="."}if(aPath===""){aPath="."}var aPathUrl=urlParse(aPath);var aRootUrl=urlParse(aRoot);if(aRootUrl){aRoot=aRootUrl.path||"/"}if(aPathUrl&&!aPathUrl.scheme){if(aRootUrl){aPathUrl.scheme=aRootUrl.scheme}return urlGenerate(aPathUrl)}if(aPathUrl||aPath.match(dataUrlRegexp)){return aPath}if(aRootUrl&&!aRootUrl.host&&!aRootUrl.path){aRootUrl.host=aPath;return urlGenerate(aRootUrl)}var joined=aPath.charAt(0)==="/"?aPath:normalize(aRoot.replace(/\/+$/,"")+"/"+aPath);if(aRootUrl){aRootUrl.path=joined;return urlGenerate(aRootUrl)}return joined}exports.join=join;function relative(aRoot,aPath){if(aRoot===""){aRoot="."}aRoot=aRoot.replace(/\/$/,"");var url=urlParse(aRoot);if(aPath.charAt(0)=="/"&&url&&url.path=="/"){return aPath.slice(1)}return aPath.indexOf(aRoot+"/")===0?aPath.substr(aRoot.length+1):aPath}exports.relative=relative;function toSetString(aStr){return"$"+aStr}exports.toSetString=toSetString;function fromSetString(aStr){return aStr.substr(1)}exports.fromSetString=fromSetString;function strcmp(aStr1,aStr2){var s1=aStr1||"";var s2=aStr2||"";return(s1>s2)-(s1<s2)}function compareByOriginalPositions(mappingA,mappingB,onlyCompareOriginal){var cmp;cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp||onlyCompareOriginal){return cmp}cmp=strcmp(mappingA.name,mappingB.name);if(cmp){return cmp}cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}return mappingA.generatedColumn-mappingB.generatedColumn}exports.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositions(mappingA,mappingB,onlyCompareGenerated){var cmp;cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp||onlyCompareGenerated){return cmp}cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp){return cmp}return strcmp(mappingA.name,mappingB.name)}exports.compareByGeneratedPositions=compareByGeneratedPositions})},{amdefine:18}],18:[function(require,module,exports){(function(process,__filename){"use strict";function amdefine(module,requireFn){"use strict";var defineCache={},loaderCache={},alreadyCalled=false,path=require("path"),makeRequire,stringRequire;function trimDots(ary){var i,part;for(i=0;ary[i];i+=1){part=ary[i];if(part==="."){ary.splice(i,1);i-=1}else if(part===".."){if(i===1&&(ary[2]===".."||ary[0]==="..")){break}else if(i>0){ary.splice(i-1,2);i-=2}}}}function normalize(name,baseName){var baseParts;if(name&&name.charAt(0)==="."){if(baseName){baseParts=baseName.split("/");baseParts=baseParts.slice(0,baseParts.length-1);baseParts=baseParts.concat(name.split("/"));trimDots(baseParts);name=baseParts.join("/")}}return name}function makeNormalize(relName){return function(name){return normalize(name,relName)}}function makeLoad(id){function load(value){loaderCache[id]=value}load.fromText=function(id,text){throw new Error("amdefine does not implement load.fromText")};return load}makeRequire=function(systemRequire,exports,module,relId){function amdRequire(deps,callback){if(typeof deps==="string"){return stringRequire(systemRequire,exports,module,deps,relId)}else{deps=deps.map(function(depName){return stringRequire(systemRequire,exports,module,depName,relId)});process.nextTick(function(){callback.apply(null,deps)})}}amdRequire.toUrl=function(filePath){if(filePath.indexOf(".")===0){return normalize(filePath,path.dirname(module.filename))}else{return filePath}};return amdRequire};requireFn=requireFn||function req(){return module.require.apply(module,arguments)};function runFactory(id,deps,factory){var r,e,m,result;if(id){e=loaderCache[id]={};m={id:id,uri:__filename,exports:e};r=makeRequire(requireFn,e,m,id)}else{if(alreadyCalled){throw new Error("amdefine with no module ID cannot be called more than once per file.")}alreadyCalled=true;e=module.exports;m=module;r=makeRequire(requireFn,e,m,module.id)}if(deps){deps=deps.map(function(depName){return r(depName)})}if(typeof factory==="function"){result=factory.apply(m.exports,deps)}else{result=factory}if(result!==undefined){m.exports=result;if(id){loaderCache[id]=m.exports}}}stringRequire=function(systemRequire,exports,module,id,relId){var index=id.indexOf("!"),originalId=id,prefix,plugin;if(index===-1){id=normalize(id,relId);if(id==="require"){return makeRequire(systemRequire,exports,module,relId)}else if(id==="exports"){return exports}else if(id==="module"){return module}else if(loaderCache.hasOwnProperty(id)){return loaderCache[id]}else if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}else{if(systemRequire){return systemRequire(originalId)}else{throw new Error("No module with ID: "+id)}}}else{prefix=id.substring(0,index);id=id.substring(index+1,id.length);plugin=stringRequire(systemRequire,exports,module,prefix,relId);if(plugin.normalize){id=plugin.normalize(id,makeNormalize(relId))}else{id=normalize(id,relId)}if(loaderCache[id]){return loaderCache[id]}else{plugin.load(id,makeRequire(systemRequire,exports,module,relId),makeLoad(id),{});return loaderCache[id]}}};function define(id,deps,factory){if(Array.isArray(id)){factory=deps;deps=id;id=undefined}else if(typeof id!=="string"){factory=id;id=deps=undefined}if(deps&&!Array.isArray(deps)){factory=deps;deps=undefined}if(!deps){deps=["require","exports","module"]}if(id){defineCache[id]=[id,deps,factory]}else{runFactory(id,deps,factory)}}define.require=function(id){if(loaderCache[id]){return loaderCache[id]}if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}};define.amd={};return define}module.exports=amdefine}).call(this,require("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:2,path:1}],19:[function(require,module,exports){module.exports={name:"escodegen",description:"ECMAScript code generator",homepage:"http://github.com/estools/escodegen",main:"escodegen.js",bin:{esgenerate:"./bin/esgenerate.js",escodegen:"./bin/escodegen.js"},files:["LICENSE.BSD","LICENSE.source-map","README.md","bin","escodegen.js","package.json"],version:"1.6.1",engines:{node:">=0.10.0"},maintainers:[{name:"Yusuke Suzuki",email:"utatane.tea@gmail.com",web:"http://github.com/Constellation"}],repository:{type:"git",url:"http://github.com/estools/escodegen.git"},dependencies:{estraverse:"^1.9.1",esutils:"^1.1.6",esprima:"^1.2.2",optionator:"^0.5.0"},optionalDependencies:{"source-map":"~0.1.40"},devDependencies:{"acorn-6to5":"^0.11.1-25",bluebird:"^2.3.11","bower-registry-client":"^0.2.1",chai:"^1.10.0","commonjs-everywhere":"^0.9.7","esprima-moz":"*",gulp:"^3.8.10","gulp-eslint":"^0.2.0","gulp-mocha":"^2.0.0",semver:"^4.1.0"},licenses:[{type:"BSD",url:"http://github.com/estools/escodegen/raw/master/LICENSE.BSD"}],scripts:{},readme:"## Escodegen\n[![npm version](https://badge.fury.io/js/escodegen.svg)](http://badge.fury.io/js/escodegen)\n[![Build Status](https://secure.travis-ci.org/estools/escodegen.svg)](http://travis-ci.org/estools/escodegen)\n[![Dependency Status](https://david-dm.org/estools/escodegen.svg)](https://david-dm.org/estools/escodegen)\n[![devDependency Status](https://david-dm.org/estools/escodegen/dev-status.svg)](https://david-dm.org/estools/escodegen#info=devDependencies)\n\nEscodegen ([escodegen](http://github.com/estools/escodegen)) is an\n[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)\n(also popularly known as [JavaScript](http://en.wikipedia.org/wiki/JavaScript))\ncode generator from [Mozilla's Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)\nAST. See the [online generator](https://estools.github.io/escodegen/demo/index.html)\nfor a demo.\n\n\n### Install\n\nEscodegen can be used in a web browser:\n\n <script src=\"escodegen.browser.js\"></script>\n\nescodegen.browser.js can be found in tagged revisions on GitHub.\n\nOr in a Node.js application via npm:\n\n npm install escodegen\n\n### Usage\n\nA simple example: the program\n\n escodegen.generate({\n type: 'BinaryExpression',\n operator: '+',\n left: { type: 'Literal', value: 40 },\n right: { type: 'Literal', value: 2 }\n });\n\nproduces the string `'40 + 2'`.\n\nSee the [API page](https://github.com/estools/escodegen/wiki/API) for\noptions. To run the tests, execute `npm test` in the root directory.\n\n### Building browser bundle / minified browser bundle\n\nAt first, execute `npm install` to install the all dev dependencies.\nAfter that,\n\n npm run-script build\n\nwill generate `escodegen.browser.js`, which can be used in browser environments.\n\nAnd,\n\n npm run-script build-min\n\nwill generate the minified file `escodegen.browser.min.js`.\n\n### License\n\n#### Escodegen\n\nCopyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)\n (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n#### source-map\n\nSourceNodeMocks has a limited interface of mozilla/source-map SourceNode implementations.\n\nCopyright (c) 2009-2011, Mozilla Foundation and contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the names of the Mozilla Foundation nor the names of project\n contributors may be used to endorse or promote products derived from this\n software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n",readmeFilename:"package/README.md"}},{}],escodegen:[function(require,module,exports){(function(global){(function(){"use strict";var Syntax,Precedence,BinaryPrecedence,SourceNode,estraverse,esutils,isArray,base,indent,json,renumber,hexadecimal,quotes,escapeless,newline,space,parentheses,semicolons,safeConcatenation,directive,extra,parse,sourceMap,sourceCode,preserveBlankLines,FORMAT_MINIFY,FORMAT_DEFAULTS;estraverse=require("estraverse");esutils=require("esutils");Syntax=estraverse.Syntax;function isExpression(node){return CodeGenerator.Expression.hasOwnProperty(node.type)}function isStatement(node){return CodeGenerator.Statement.hasOwnProperty(node.type)}Precedence={Sequence:0,Yield:1,Await:1,Assignment:1,Conditional:2,ArrowFunction:2,LogicalOR:3,LogicalAND:4,BitwiseOR:5,BitwiseXOR:6,BitwiseAND:7,Equality:8,Relational:9,BitwiseSHIFT:10,Additive:11,Multiplicative:12,Unary:13,Postfix:14,Call:15,New:16,TaggedTemplate:17,Member:18,Primary:19};BinaryPrecedence={"||":Precedence.LogicalOR,"&&":Precedence.LogicalAND,"|":Precedence.BitwiseOR,"^":Precedence.BitwiseXOR,"&":Precedence.BitwiseAND,"==":Precedence.Equality,"!=":Precedence.Equality,"===":Precedence.Equality,"!==":Precedence.Equality,is:Precedence.Equality,isnt:Precedence.Equality,"<":Precedence.Relational,">":Precedence.Relational,"<=":Precedence.Relational,">=":Precedence.Relational,"in":Precedence.Relational,"instanceof":Precedence.Relational,"<<":Precedence.BitwiseSHIFT,">>":Precedence.BitwiseSHIFT,">>>":Precedence.BitwiseSHIFT,"+":Precedence.Additive,"-":Precedence.Additive,"*":Precedence.Multiplicative,"%":Precedence.Multiplicative,"/":Precedence.Multiplicative};var F_ALLOW_IN=1,F_ALLOW_CALL=1<<1,F_ALLOW_UNPARATH_NEW=1<<2,F_FUNC_BODY=1<<3,F_DIRECTIVE_CTX=1<<4,F_SEMICOLON_OPT=1<<5;var E_FTT=F_ALLOW_CALL|F_ALLOW_UNPARATH_NEW,E_TTF=F_ALLOW_IN|F_ALLOW_CALL,E_TTT=F_ALLOW_IN|F_ALLOW_CALL|F_ALLOW_UNPARATH_NEW,E_TFF=F_ALLOW_IN,E_FFT=F_ALLOW_UNPARATH_NEW,E_TFT=F_ALLOW_IN|F_ALLOW_UNPARATH_NEW;var S_TFFF=F_ALLOW_IN,S_TFFT=F_ALLOW_IN|F_SEMICOLON_OPT,S_FFFF=0,S_TFTF=F_ALLOW_IN|F_DIRECTIVE_CTX,S_TTFF=F_ALLOW_IN|F_FUNC_BODY;function getDefaultOptions(){return{indent:null,base:null,parse:null,comment:false,format:{indent:{style:" ",base:0,adjustMultilineComment:false},newline:"\n",space:" ",json:false,renumber:false,hexadecimal:false,quotes:"single",escapeless:false,compact:false,parentheses:true,semicolons:true,safeConcatenation:false,preserveBlankLines:false},moz:{comprehensionExpressionStartsWithAssignment:false,starlessGenerator:false},sourceMap:null,sourceMapRoot:null,sourceMapWithCode:false,directive:false,raw:true,verbatim:null,sourceCode:null}}function stringRepeat(str,num){var result="";for(num|=0;num>0;num>>>=1,str+=str){if(num&1){result+=str}}return result}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function hasLineTerminator(str){return/[\r\n]/g.test(str)}function endsWithLineTerminator(str){var len=str.length;return len&&esutils.code.isLineTerminator(str.charCodeAt(len-1))}function merge(target,override){var key;for(key in override){if(override.hasOwnProperty(key)){target[key]=override[key]}}return target}function updateDeeply(target,override){var key,val;function isHashObject(target){return typeof target==="object"&&target instanceof Object&&!(target instanceof RegExp)}for(key in override){if(override.hasOwnProperty(key)){val=override[key];if(isHashObject(val)){if(isHashObject(target[key])){updateDeeply(target[key],val)}else{target[key]=updateDeeply({},val)}}else{target[key]=val}}}return target}function generateNumber(value){var result,point,temp,exponent,pos;if(value!==value){throw new Error("Numeric literal whose value is NaN")}if(value<0||value===0&&1/value<0){throw new Error("Numeric literal whose value is negative")}if(value===1/0){return json?"null":renumber?"1e400":"1e+400"}result=""+value;if(!renumber||result.length<3){return result}point=result.indexOf(".");if(!json&&result.charCodeAt(0)===48&&point===1){point=0;result=result.slice(1)}temp=result;result=result.replace("e+","e");exponent=0;if((pos=temp.indexOf("e"))>0){exponent=+temp.slice(pos+1);temp=temp.slice(0,pos)}if(point>=0){exponent-=temp.length-point-1;temp=+(temp.slice(0,point)+temp.slice(point+1))+""}pos=0;while(temp.charCodeAt(temp.length+pos-1)===48){--pos}if(pos!==0){exponent-=pos;temp=temp.slice(0,pos)}if(exponent!==0){temp+="e"+exponent}if((temp.length<result.length||hexadecimal&&value>1e12&&Math.floor(value)===value&&(temp="0x"+value.toString(16)).length<result.length)&&+temp===value){result=temp}return result}function escapeRegExpCharacter(ch,previousIsBackslash){if((ch&~1)===8232){return(previousIsBackslash?"u":"\\u")+(ch===8232?"2028":"2029")}else if(ch===10||ch===13){return(previousIsBackslash?"":"\\")+(ch===10?"n":"r")}return String.fromCharCode(ch)}function generateRegExp(reg){var match,result,flags,i,iz,ch,characterInBrack,previousIsBackslash;result=reg.toString();if(reg.source){match=result.match(/\/([^\/]*)$/);if(!match){return result}flags=match[1];result="";characterInBrack=false;previousIsBackslash=false;for(i=0,iz=reg.source.length;i<iz;++i){ch=reg.source.charCodeAt(i);if(!previousIsBackslash){if(characterInBrack){if(ch===93){characterInBrack=false}}else{if(ch===47){result+="\\"}else if(ch===91){characterInBrack=true}}result+=escapeRegExpCharacter(ch,previousIsBackslash);previousIsBackslash=ch===92}else{result+=escapeRegExpCharacter(ch,previousIsBackslash);previousIsBackslash=false}}return"/"+result+"/"+flags}return result}function escapeAllowedCharacter(code,next){var hex;if(code===8){return"\\b"}if(code===12){return"\\f"}if(code===9){return"\\t"}hex=code.toString(16).toUpperCase();if(json||code>255){return"\\u"+"0000".slice(hex.length)+hex}else if(code===0&&!esutils.code.isDecimalDigit(next)){return"\\0"}else if(code===11){return"\\x0B"}else{return"\\x"+"00".slice(hex.length)+hex}}function escapeDisallowedCharacter(code){if(code===92){return"\\\\"}if(code===10){return"\\n"}if(code===13){return"\\r"}if(code===8232){return"\\u2028"}if(code===8233){return"\\u2029"}throw new Error("Incorrectly classified character")}function escapeDirective(str){var i,iz,code,quote;quote=quotes==="double"?'"':"'";for(i=0,iz=str.length;i<iz;++i){code=str.charCodeAt(i);if(code===39){quote='"';break}else if(code===34){quote="'";break}else if(code===92){++i}}return quote+str+quote}function escapeString(str){var result="",i,len,code,singleQuotes=0,doubleQuotes=0,single,quote;for(i=0,len=str.length;i<len;++i){code=str.charCodeAt(i);if(code===39){++singleQuotes}else if(code===34){++doubleQuotes}else if(code===47&&json){result+="\\"}else if(esutils.code.isLineTerminator(code)||code===92){result+=escapeDisallowedCharacter(code);continue}else if(json&&code<32||!(json||escapeless||code>=32&&code<=126)){result+=escapeAllowedCharacter(code,str.charCodeAt(i+1));continue}result+=String.fromCharCode(code)}single=!(quotes==="double"||quotes==="auto"&&doubleQuotes<singleQuotes);quote=single?"'":'"';if(!(single?singleQuotes:doubleQuotes)){return quote+result+quote}str=result;result=quote;for(i=0,len=str.length;i<len;++i){code=str.charCodeAt(i);if(code===39&&single||code===34&&!single){result+="\\"}result+=String.fromCharCode(code)}return result+quote}function flattenToString(arr){var i,iz,elem,result="";for(i=0,iz=arr.length;i<iz;++i){elem=arr[i];result+=isArray(elem)?flattenToString(elem):elem}return result}function toSourceNodeWhenNeeded(generated,node){if(!sourceMap){if(isArray(generated)){return flattenToString(generated)}else{return generated}}if(node==null){if(generated instanceof SourceNode){return generated}else{node={}}}if(node.loc==null){return new SourceNode(null,null,sourceMap,generated,node.name||null)}return new SourceNode(node.loc.start.line,node.loc.start.column,sourceMap===true?node.loc.source||null:sourceMap,generated,node.name||null)}function noEmptySpace(){return space?space:" "}function join(left,right){var leftSource,rightSource,leftCharCode,rightCharCode;leftSource=toSourceNodeWhenNeeded(left).toString();if(leftSource.length===0){return[right]}rightSource=toSourceNodeWhenNeeded(right).toString();if(rightSource.length===0){return[left]}leftCharCode=leftSource.charCodeAt(leftSource.length-1);rightCharCode=rightSource.charCodeAt(0);if((leftCharCode===43||leftCharCode===45)&&leftCharCode===rightCharCode||esutils.code.isIdentifierPart(leftCharCode)&&esutils.code.isIdentifierPart(rightCharCode)||leftCharCode===47&&rightCharCode===105){return[left,noEmptySpace(),right]}else if(esutils.code.isWhiteSpace(leftCharCode)||esutils.code.isLineTerminator(leftCharCode)||esutils.code.isWhiteSpace(rightCharCode)||esutils.code.isLineTerminator(rightCharCode)){return[left,right]}return[left,space,right]}function addIndent(stmt){return[base,stmt]}function withIndent(fn){var previousBase;previousBase=base;base+=indent;fn(base);base=previousBase}function calculateSpaces(str){var i;for(i=str.length-1;i>=0;--i){if(esutils.code.isLineTerminator(str.charCodeAt(i))){break}}return str.length-1-i}function adjustMultilineComment(value,specialBase){var array,i,len,line,j,spaces,previousBase,sn;array=value.split(/\r\n|[\r\n]/);spaces=Number.MAX_VALUE;for(i=1,len=array.length;i<len;++i){line=array[i];j=0;while(j<line.length&&esutils.code.isWhiteSpace(line.charCodeAt(j))){++j}if(spaces>j){spaces=j}}if(typeof specialBase!=="undefined"){previousBase=base;if(array[1][spaces]==="*"){specialBase+=" "}base=specialBase}else{if(spaces&1){--spaces}previousBase=base}for(i=1,len=array.length;i<len;++i){sn=toSourceNodeWhenNeeded(addIndent(array[i].slice(spaces)));array[i]=sourceMap?sn.join(""):sn}base=previousBase;return array.join("\n")}function generateComment(comment,specialBase){if(comment.type==="Line"){if(endsWithLineTerminator(comment.value)){return"//"+comment.value}else{var result="//"+comment.value;if(!preserveBlankLines){result+="\n"}return result}}if(extra.format.indent.adjustMultilineComment&&/[\n\r]/.test(comment.value)){return adjustMultilineComment("/*"+comment.value+"*/",specialBase)}return"/*"+comment.value+"*/"}function addComments(stmt,result){var i,len,comment,save,tailingToStatement,specialBase,fragment,extRange,range,prevRange,prefix,infix,suffix,count;if(stmt.leadingComments&&stmt.leadingComments.length>0){save=result;if(preserveBlankLines){comment=stmt.leadingComments[0];result=[];extRange=comment.extendedRange;range=comment.range;prefix=sourceCode.substring(extRange[0],range[0]);count=(prefix.match(/\n/g)||[]).length;if(count>0){result.push(stringRepeat("\n",count));result.push(addIndent(generateComment(comment)))}else{result.push(prefix);result.push(generateComment(comment))}prevRange=range;for(i=1,len=stmt.leadingComments.length;i<len;i++){comment=stmt.leadingComments[i];range=comment.range;infix=sourceCode.substring(prevRange[1],range[0]);count=(infix.match(/\n/g)||[]).length;result.push(stringRepeat("\n",count));result.push(addIndent(generateComment(comment)));prevRange=range}suffix=sourceCode.substring(range[1],extRange[1]);count=(suffix.match(/\n/g)||[]).length;result.push(stringRepeat("\n",count));
}else{comment=stmt.leadingComments[0];result=[];if(safeConcatenation&&stmt.type===Syntax.Program&&stmt.body.length===0){result.push("\n")}result.push(generateComment(comment));if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push("\n")}for(i=1,len=stmt.leadingComments.length;i<len;++i){comment=stmt.leadingComments[i];fragment=[generateComment(comment)];if(!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){fragment.push("\n")}result.push(addIndent(fragment))}}result.push(addIndent(save))}if(stmt.trailingComments){if(preserveBlankLines){comment=stmt.trailingComments[0];extRange=comment.extendedRange;range=comment.range;prefix=sourceCode.substring(extRange[0],range[0]);count=(prefix.match(/\n/g)||[]).length;if(count>0){result.push(stringRepeat("\n",count));result.push(addIndent(generateComment(comment)))}else{result.push(prefix);result.push(generateComment(comment))}}else{tailingToStatement=!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString());specialBase=stringRepeat(" ",calculateSpaces(toSourceNodeWhenNeeded([base,result,indent]).toString()));for(i=0,len=stmt.trailingComments.length;i<len;++i){comment=stmt.trailingComments[i];if(tailingToStatement){if(i===0){result=[result,indent]}else{result=[result,specialBase]}result.push(generateComment(comment,specialBase))}else{result=[result,addIndent(generateComment(comment))]}if(i!==len-1&&!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result=[result,"\n"]}}}}return result}function generateBlankLines(start,end,result){var j,newlineCount=0;for(j=start;j<end;j++){if(sourceCode[j]==="\n"){newlineCount++}}for(j=1;j<newlineCount;j++){result.push(newline)}}function parenthesize(text,current,should){if(current<should){return["(",text,")"]}return text}function generateVerbatimString(string){var i,iz,result;result=string.split(/\r\n|\n/);for(i=1,iz=result.length;i<iz;i++){result[i]=newline+base+result[i]}return result}function generateVerbatim(expr,precedence){var verbatim,result,prec;verbatim=expr[extra.verbatim];if(typeof verbatim==="string"){result=parenthesize(generateVerbatimString(verbatim),Precedence.Sequence,precedence)}else{result=generateVerbatimString(verbatim.content);prec=verbatim.precedence!=null?verbatim.precedence:Precedence.Sequence;result=parenthesize(result,prec,precedence)}return toSourceNodeWhenNeeded(result,expr)}function CodeGenerator(){}CodeGenerator.prototype.maybeBlock=function(stmt,flags){var result,noLeadingComment,that=this;noLeadingComment=!extra.comment||!stmt.leadingComments;if(stmt.type===Syntax.BlockStatement&&noLeadingComment){return[space,this.generateStatement(stmt,flags)]}if(stmt.type===Syntax.EmptyStatement&&noLeadingComment){return";"}withIndent(function(){result=[newline,addIndent(that.generateStatement(stmt,flags))]});return result};CodeGenerator.prototype.maybeBlockSuffix=function(stmt,result){var ends=endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString());if(stmt.type===Syntax.BlockStatement&&(!extra.comment||!stmt.leadingComments)&&!ends){return[result,space]}if(ends){return[result,base]}return[result,newline,base]};function generateIdentifier(node){return toSourceNodeWhenNeeded(node.name,node)}function generateAsyncPrefix(node,spaceRequired){return node.async?"async"+(spaceRequired?noEmptySpace():space):""}function generateStarSuffix(node){var isGenerator=node.generator&&!extra.moz.starlessGenerator;return isGenerator?"*"+space:""}function generateMethodPrefix(prop){var func=prop.value;if(func.async){return generateAsyncPrefix(func,!prop.computed)}else{return generateStarSuffix(func)?"*":""}}CodeGenerator.prototype.generatePattern=function(node,precedence,flags){if(node.type===Syntax.Identifier){return generateIdentifier(node)}return this.generateExpression(node,precedence,flags)};CodeGenerator.prototype.generateFunctionParams=function(node){var i,iz,result,hasDefault;hasDefault=false;if(node.type===Syntax.ArrowFunctionExpression&&!node.rest&&(!node.defaults||node.defaults.length===0)&&node.params.length===1&&node.params[0].type===Syntax.Identifier){result=[generateAsyncPrefix(node,true),generateIdentifier(node.params[0])]}else{result=node.type===Syntax.ArrowFunctionExpression?[generateAsyncPrefix(node,false)]:[];result.push("(");if(node.defaults){hasDefault=true}for(i=0,iz=node.params.length;i<iz;++i){if(hasDefault&&node.defaults[i]){result.push(this.generateAssignment(node.params[i],node.defaults[i],"=",Precedence.Assignment,E_TTT))}else{result.push(this.generatePattern(node.params[i],Precedence.Assignment,E_TTT))}if(i+1<iz){result.push(","+space)}}if(node.rest){if(node.params.length){result.push(","+space)}result.push("...");result.push(generateIdentifier(node.rest))}result.push(")")}return result};CodeGenerator.prototype.generateFunctionBody=function(node){var result,expr;result=this.generateFunctionParams(node);if(node.type===Syntax.ArrowFunctionExpression){result.push(space);result.push("=>")}if(node.expression){result.push(space);expr=this.generateExpression(node.body,Precedence.Assignment,E_TTT);if(expr.toString().charAt(0)==="{"){expr=["(",expr,")"]}result.push(expr)}else{result.push(this.maybeBlock(node.body,S_TTFF))}return result};CodeGenerator.prototype.generateIterationForStatement=function(operator,stmt,flags){var result=["for"+space+"("],that=this;withIndent(function(){if(stmt.left.type===Syntax.VariableDeclaration){withIndent(function(){result.push(stmt.left.kind+noEmptySpace());result.push(that.generateStatement(stmt.left.declarations[0],S_FFFF))})}else{result.push(that.generateExpression(stmt.left,Precedence.Call,E_TTT))}result=join(result,operator);result=[join(result,that.generateExpression(stmt.right,Precedence.Sequence,E_TTT)),")"]});result.push(this.maybeBlock(stmt.body,flags));return result};CodeGenerator.prototype.generatePropertyKey=function(expr,computed){var result=[];if(computed){result.push("[")}result.push(this.generateExpression(expr,Precedence.Sequence,E_TTT));if(computed){result.push("]")}return result};CodeGenerator.prototype.generateAssignment=function(left,right,operator,precedence,flags){if(Precedence.Assignment<precedence){flags|=F_ALLOW_IN}return parenthesize([this.generateExpression(left,Precedence.Call,flags),space+operator+space,this.generateExpression(right,Precedence.Assignment,flags)],Precedence.Assignment,precedence)};CodeGenerator.prototype.semicolon=function(flags){if(!semicolons&&flags&F_SEMICOLON_OPT){return""}return";"};CodeGenerator.Statement={BlockStatement:function(stmt,flags){var range,content,result=["{",newline],that=this;withIndent(function(){if(stmt.body.length===0&&preserveBlankLines){range=stmt.range;if(range[1]-range[0]>2){content=sourceCode.substring(range[0]+1,range[1]-1);if(content[0]==="\n"){result=["{"]}result.push(content)}}var i,iz,fragment,bodyFlags;bodyFlags=S_TFFF;if(flags&F_FUNC_BODY){bodyFlags|=F_DIRECTIVE_CTX}for(i=0,iz=stmt.body.length;i<iz;++i){if(preserveBlankLines){if(i===0){if(stmt.body[0].leadingComments){range=stmt.body[0].leadingComments[0].extendedRange;content=sourceCode.substring(range[0],range[1]);if(content[0]==="\n"){result=["{"]}}if(!stmt.body[0].leadingComments){generateBlankLines(stmt.range[0],stmt.body[0].range[0],result)}}if(i>0){if(!stmt.body[i-1].trailingComments&&!stmt.body[i].leadingComments){generateBlankLines(stmt.body[i-1].range[1],stmt.body[i].range[0],result)}}}if(i===iz-1){bodyFlags|=F_SEMICOLON_OPT}if(stmt.body[i].leadingComments&&preserveBlankLines){fragment=that.generateStatement(stmt.body[i],bodyFlags)}else{fragment=addIndent(that.generateStatement(stmt.body[i],bodyFlags))}result.push(fragment);if(!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){if(preserveBlankLines&&i<iz-1){if(!stmt.body[i+1].leadingComments){result.push(newline)}}else{result.push(newline)}}if(preserveBlankLines){if(i===iz-1){if(!stmt.body[i].trailingComments){generateBlankLines(stmt.body[i].range[1],stmt.range[1],result)}}}}});result.push(addIndent("}"));return result},BreakStatement:function(stmt,flags){if(stmt.label){return"break "+stmt.label.name+this.semicolon(flags)}return"break"+this.semicolon(flags)},ContinueStatement:function(stmt,flags){if(stmt.label){return"continue "+stmt.label.name+this.semicolon(flags)}return"continue"+this.semicolon(flags)},ClassBody:function(stmt,flags){var result=["{",newline],that=this;withIndent(function(indent){var i,iz;for(i=0,iz=stmt.body.length;i<iz;++i){result.push(indent);result.push(that.generateExpression(stmt.body[i],Precedence.Sequence,E_TTT));if(i+1<iz){result.push(newline)}}});if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(base);result.push("}");return result},ClassDeclaration:function(stmt,flags){var result,fragment;result=["class "+stmt.id.name];if(stmt.superClass){fragment=join("extends",this.generateExpression(stmt.superClass,Precedence.Assignment,E_TTT));result=join(result,fragment)}result.push(space);result.push(this.generateStatement(stmt.body,S_TFFT));return result},DirectiveStatement:function(stmt,flags){if(extra.raw&&stmt.raw){return stmt.raw+this.semicolon(flags)}return escapeDirective(stmt.directive)+this.semicolon(flags)},DoWhileStatement:function(stmt,flags){var result=join("do",this.maybeBlock(stmt.body,S_TFFF));result=this.maybeBlockSuffix(stmt.body,result);return join(result,["while"+space+"(",this.generateExpression(stmt.test,Precedence.Sequence,E_TTT),")"+this.semicolon(flags)])},CatchClause:function(stmt,flags){var result,that=this;withIndent(function(){var guard;result=["catch"+space+"(",that.generateExpression(stmt.param,Precedence.Sequence,E_TTT),")"];if(stmt.guard){guard=that.generateExpression(stmt.guard,Precedence.Sequence,E_TTT);result.splice(2,0," if ",guard)}});result.push(this.maybeBlock(stmt.body,S_TFFF));return result},DebuggerStatement:function(stmt,flags){return"debugger"+this.semicolon(flags)},EmptyStatement:function(stmt,flags){return";"},ExportDeclaration:function(stmt,flags){var result=["export"],bodyFlags,that=this;bodyFlags=flags&F_SEMICOLON_OPT?S_TFFT:S_TFFF;if(stmt["default"]){result=join(result,"default");if(isStatement(stmt.declaration)){result=join(result,this.generateStatement(stmt.declaration,bodyFlags))}else{result=join(result,this.generateExpression(stmt.declaration,Precedence.Assignment,E_TTT)+this.semicolon(flags))}return result}if(stmt.declaration){return join(result,this.generateStatement(stmt.declaration,bodyFlags))}if(stmt.specifiers){if(stmt.specifiers.length===0){result=join(result,"{"+space+"}")}else if(stmt.specifiers[0].type===Syntax.ExportBatchSpecifier){result=join(result,this.generateExpression(stmt.specifiers[0],Precedence.Sequence,E_TTT))}else{result=join(result,"{");withIndent(function(indent){var i,iz;result.push(newline);for(i=0,iz=stmt.specifiers.length;i<iz;++i){result.push(indent);result.push(that.generateExpression(stmt.specifiers[i],Precedence.Sequence,E_TTT));if(i+1<iz){result.push(","+newline)}}});if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(base+"}")}if(stmt.source){result=join(result,["from"+space,this.generateExpression(stmt.source,Precedence.Sequence,E_TTT),this.semicolon(flags)])}else{result.push(this.semicolon(flags))}}return result},ExpressionStatement:function(stmt,flags){var result,fragment;function isClassPrefixed(fragment){var code;if(fragment.slice(0,5)!=="class"){return false}code=fragment.charCodeAt(5);return code===123||esutils.code.isWhiteSpace(code)||esutils.code.isLineTerminator(code)}function isFunctionPrefixed(fragment){var code;if(fragment.slice(0,8)!=="function"){return false}code=fragment.charCodeAt(8);return code===40||esutils.code.isWhiteSpace(code)||code===42||esutils.code.isLineTerminator(code)}function isAsyncPrefixed(fragment){var code,i,iz;if(fragment.slice(0,5)!=="async"){return false}if(!esutils.code.isWhiteSpace(fragment.charCodeAt(5))){return false}for(i=6,iz=fragment.length;i<iz;++i){if(!esutils.code.isWhiteSpace(fragment.charCodeAt(i))){break}}if(i===iz){return false}if(fragment.slice(i,i+8)!=="function"){return false}code=fragment.charCodeAt(i+8);return code===40||esutils.code.isWhiteSpace(code)||code===42||esutils.code.isLineTerminator(code)}result=[this.generateExpression(stmt.expression,Precedence.Sequence,E_TTT)];fragment=toSourceNodeWhenNeeded(result).toString();if(fragment.charCodeAt(0)===123||isClassPrefixed(fragment)||isFunctionPrefixed(fragment)||isAsyncPrefixed(fragment)||directive&&flags&F_DIRECTIVE_CTX&&stmt.expression.type===Syntax.Literal&&typeof stmt.expression.value==="string"){result=["(",result,")"+this.semicolon(flags)]}else{result.push(this.semicolon(flags))}return result},ImportDeclaration:function(stmt,flags){var result,cursor,that=this;if(stmt.specifiers.length===0){return["import",space,this.generateExpression(stmt.source,Precedence.Sequence,E_TTT),this.semicolon(flags)]}result=["import"];cursor=0;if(stmt.specifiers[cursor].type===Syntax.ImportDefaultSpecifier){result=join(result,[this.generateExpression(stmt.specifiers[cursor],Precedence.Sequence,E_TTT)]);++cursor}if(stmt.specifiers[cursor]){if(cursor!==0){result.push(",")}if(stmt.specifiers[cursor].type===Syntax.ImportNamespaceSpecifier){result=join(result,[space,this.generateExpression(stmt.specifiers[cursor],Precedence.Sequence,E_TTT)])}else{result.push(space+"{");if(stmt.specifiers.length-cursor===1){result.push(space);result.push(this.generateExpression(stmt.specifiers[cursor],Precedence.Sequence,E_TTT));result.push(space+"}"+space)}else{withIndent(function(indent){var i,iz;result.push(newline);for(i=cursor,iz=stmt.specifiers.length;i<iz;++i){result.push(indent);result.push(that.generateExpression(stmt.specifiers[i],Precedence.Sequence,E_TTT));if(i+1<iz){result.push(","+newline)}}});if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(base+"}"+space)}}}result=join(result,["from"+space,this.generateExpression(stmt.source,Precedence.Sequence,E_TTT),this.semicolon(flags)]);return result},VariableDeclarator:function(stmt,flags){var itemFlags=flags&F_ALLOW_IN?E_TTT:E_FTT;if(stmt.init){return[this.generateExpression(stmt.id,Precedence.Assignment,itemFlags),space,"=",space,this.generateExpression(stmt.init,Precedence.Assignment,itemFlags)]}return this.generatePattern(stmt.id,Precedence.Assignment,itemFlags)},VariableDeclaration:function(stmt,flags){var result,i,iz,node,bodyFlags,that=this;result=[stmt.kind];bodyFlags=flags&F_ALLOW_IN?S_TFFF:S_FFFF;function block(){node=stmt.declarations[0];if(extra.comment&&node.leadingComments){result.push("\n");result.push(addIndent(that.generateStatement(node,bodyFlags)))}else{result.push(noEmptySpace());result.push(that.generateStatement(node,bodyFlags))}for(i=1,iz=stmt.declarations.length;i<iz;++i){node=stmt.declarations[i];if(extra.comment&&node.leadingComments){result.push(","+newline);result.push(addIndent(that.generateStatement(node,bodyFlags)))}else{result.push(","+space);result.push(that.generateStatement(node,bodyFlags))}}}if(stmt.declarations.length>1){withIndent(block)}else{block()}result.push(this.semicolon(flags));return result},ThrowStatement:function(stmt,flags){return[join("throw",this.generateExpression(stmt.argument,Precedence.Sequence,E_TTT)),this.semicolon(flags)]},TryStatement:function(stmt,flags){var result,i,iz,guardedHandlers;result=["try",this.maybeBlock(stmt.block,S_TFFF)];result=this.maybeBlockSuffix(stmt.block,result);if(stmt.handlers){for(i=0,iz=stmt.handlers.length;i<iz;++i){result=join(result,this.generateStatement(stmt.handlers[i],S_TFFF));if(stmt.finalizer||i+1!==iz){result=this.maybeBlockSuffix(stmt.handlers[i].body,result)}}}else{guardedHandlers=stmt.guardedHandlers||[];for(i=0,iz=guardedHandlers.length;i<iz;++i){result=join(result,this.generateStatement(guardedHandlers[i],S_TFFF));if(stmt.finalizer||i+1!==iz){result=this.maybeBlockSuffix(guardedHandlers[i].body,result)}}if(stmt.handler){if(isArray(stmt.handler)){for(i=0,iz=stmt.handler.length;i<iz;++i){result=join(result,this.generateStatement(stmt.handler[i],S_TFFF));if(stmt.finalizer||i+1!==iz){result=this.maybeBlockSuffix(stmt.handler[i].body,result)}}}else{result=join(result,this.generateStatement(stmt.handler,S_TFFF));if(stmt.finalizer){result=this.maybeBlockSuffix(stmt.handler.body,result)}}}}if(stmt.finalizer){result=join(result,["finally",this.maybeBlock(stmt.finalizer,S_TFFF)])}return result},SwitchStatement:function(stmt,flags){var result,fragment,i,iz,bodyFlags,that=this;withIndent(function(){result=["switch"+space+"(",that.generateExpression(stmt.discriminant,Precedence.Sequence,E_TTT),")"+space+"{"+newline]});if(stmt.cases){bodyFlags=S_TFFF;for(i=0,iz=stmt.cases.length;i<iz;++i){if(i===iz-1){bodyFlags|=F_SEMICOLON_OPT}fragment=addIndent(this.generateStatement(stmt.cases[i],bodyFlags));result.push(fragment);if(!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){result.push(newline)}}}result.push(addIndent("}"));return result},SwitchCase:function(stmt,flags){var result,fragment,i,iz,bodyFlags,that=this;withIndent(function(){if(stmt.test){result=[join("case",that.generateExpression(stmt.test,Precedence.Sequence,E_TTT)),":"]}else{result=["default:"]}i=0;iz=stmt.consequent.length;if(iz&&stmt.consequent[0].type===Syntax.BlockStatement){fragment=that.maybeBlock(stmt.consequent[0],S_TFFF);result.push(fragment);i=1}if(i!==iz&&!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}bodyFlags=S_TFFF;for(;i<iz;++i){if(i===iz-1&&flags&F_SEMICOLON_OPT){bodyFlags|=F_SEMICOLON_OPT}fragment=addIndent(that.generateStatement(stmt.consequent[i],bodyFlags));result.push(fragment);if(i+1!==iz&&!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){result.push(newline)}}});return result},IfStatement:function(stmt,flags){var result,bodyFlags,semicolonOptional,that=this;withIndent(function(){result=["if"+space+"(",that.generateExpression(stmt.test,Precedence.Sequence,E_TTT),")"]});semicolonOptional=flags&F_SEMICOLON_OPT;bodyFlags=S_TFFF;if(semicolonOptional){bodyFlags|=F_SEMICOLON_OPT}if(stmt.alternate){result.push(this.maybeBlock(stmt.consequent,S_TFFF));result=this.maybeBlockSuffix(stmt.consequent,result);if(stmt.alternate.type===Syntax.IfStatement){result=join(result,["else ",this.generateStatement(stmt.alternate,bodyFlags)])}else{result=join(result,join("else",this.maybeBlock(stmt.alternate,bodyFlags)))}}else{result.push(this.maybeBlock(stmt.consequent,bodyFlags))}return result},ForStatement:function(stmt,flags){var result,that=this;withIndent(function(){result=["for"+space+"("];if(stmt.init){if(stmt.init.type===Syntax.VariableDeclaration){result.push(that.generateStatement(stmt.init,S_FFFF))}else{result.push(that.generateExpression(stmt.init,Precedence.Sequence,E_FTT));result.push(";")}}else{result.push(";")}if(stmt.test){result.push(space);result.push(that.generateExpression(stmt.test,Precedence.Sequence,E_TTT));result.push(";")}else{result.push(";")}if(stmt.update){result.push(space);result.push(that.generateExpression(stmt.update,Precedence.Sequence,E_TTT));result.push(")")}else{result.push(")")}});result.push(this.maybeBlock(stmt.body,flags&F_SEMICOLON_OPT?S_TFFT:S_TFFF));return result},ForInStatement:function(stmt,flags){return this.generateIterationForStatement("in",stmt,flags&F_SEMICOLON_OPT?S_TFFT:S_TFFF)},ForOfStatement:function(stmt,flags){return this.generateIterationForStatement("of",stmt,flags&F_SEMICOLON_OPT?S_TFFT:S_TFFF)},LabeledStatement:function(stmt,flags){return[stmt.label.name+":",this.maybeBlock(stmt.body,flags&F_SEMICOLON_OPT?S_TFFT:S_TFFF)]},Program:function(stmt,flags){var result,fragment,i,iz,bodyFlags;iz=stmt.body.length;result=[safeConcatenation&&iz>0?"\n":""];bodyFlags=S_TFTF;for(i=0;i<iz;++i){if(!safeConcatenation&&i===iz-1){bodyFlags|=F_SEMICOLON_OPT}if(preserveBlankLines){if(i===0){if(!stmt.body[0].leadingComments){generateBlankLines(stmt.range[0],stmt.body[i].range[0],result)}}if(i>0){if(!stmt.body[i-1].trailingComments&&!stmt.body[i].leadingComments){generateBlankLines(stmt.body[i-1].range[1],stmt.body[i].range[0],result)}}}fragment=addIndent(this.generateStatement(stmt.body[i],bodyFlags));result.push(fragment);if(i+1<iz&&!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){if(preserveBlankLines){if(!stmt.body[i+1].leadingComments){result.push(newline)}}else{result.push(newline)}}if(preserveBlankLines){if(i===iz-1){if(!stmt.body[i].trailingComments){generateBlankLines(stmt.body[i].range[1],stmt.range[1],result)}}}}return result},FunctionDeclaration:function(stmt,flags){return[generateAsyncPrefix(stmt,true),"function",generateStarSuffix(stmt)||noEmptySpace(),generateIdentifier(stmt.id),this.generateFunctionBody(stmt)]},ReturnStatement:function(stmt,flags){if(stmt.argument){return[join("return",this.generateExpression(stmt.argument,Precedence.Sequence,E_TTT)),this.semicolon(flags)]}return["return"+this.semicolon(flags)]},WhileStatement:function(stmt,flags){var result,that=this;withIndent(function(){result=["while"+space+"(",that.generateExpression(stmt.test,Precedence.Sequence,E_TTT),")"]});result.push(this.maybeBlock(stmt.body,flags&F_SEMICOLON_OPT?S_TFFT:S_TFFF));return result},WithStatement:function(stmt,flags){var result,that=this;withIndent(function(){result=["with"+space+"(",that.generateExpression(stmt.object,Precedence.Sequence,E_TTT),")"]});result.push(this.maybeBlock(stmt.body,flags&F_SEMICOLON_OPT?S_TFFT:S_TFFF));return result}};merge(CodeGenerator.prototype,CodeGenerator.Statement);CodeGenerator.Expression={SequenceExpression:function(expr,precedence,flags){var result,i,iz;if(Precedence.Sequence<precedence){flags|=F_ALLOW_IN}result=[];for(i=0,iz=expr.expressions.length;i<iz;++i){result.push(this.generateExpression(expr.expressions[i],Precedence.Assignment,flags));if(i+1<iz){result.push(","+space)}}return parenthesize(result,Precedence.Sequence,precedence)},AssignmentExpression:function(expr,precedence,flags){return this.generateAssignment(expr.left,expr.right,expr.operator,precedence,flags)},ArrowFunctionExpression:function(expr,precedence,flags){return parenthesize(this.generateFunctionBody(expr),Precedence.ArrowFunction,precedence)},ConditionalExpression:function(expr,precedence,flags){if(Precedence.Conditional<precedence){flags|=F_ALLOW_IN}return parenthesize([this.generateExpression(expr.test,Precedence.LogicalOR,flags),space+"?"+space,this.generateExpression(expr.consequent,Precedence.Assignment,flags),space+":"+space,this.generateExpression(expr.alternate,Precedence.Assignment,flags)],Precedence.Conditional,precedence)},LogicalExpression:function(expr,precedence,flags){return this.BinaryExpression(expr,precedence,flags)},BinaryExpression:function(expr,precedence,flags){var result,currentPrecedence,fragment,leftSource;currentPrecedence=BinaryPrecedence[expr.operator];if(currentPrecedence<precedence){flags|=F_ALLOW_IN}fragment=this.generateExpression(expr.left,currentPrecedence,flags);leftSource=fragment.toString();if(leftSource.charCodeAt(leftSource.length-1)===47&&esutils.code.isIdentifierPart(expr.operator.charCodeAt(0))){result=[fragment,noEmptySpace(),expr.operator]}else{result=join(fragment,expr.operator)}fragment=this.generateExpression(expr.right,currentPrecedence+1,flags);if(expr.operator==="/"&&fragment.toString().charAt(0)==="/"||expr.operator.slice(-1)==="<"&&fragment.toString().slice(0,3)==="!--"){result.push(noEmptySpace());result.push(fragment)}else{result=join(result,fragment)}if(expr.operator==="in"&&!(flags&F_ALLOW_IN)){return["(",result,")"]}return parenthesize(result,currentPrecedence,precedence)},CallExpression:function(expr,precedence,flags){var result,i,iz;result=[this.generateExpression(expr.callee,Precedence.Call,E_TTF)];result.push("(");for(i=0,iz=expr["arguments"].length;i<iz;++i){result.push(this.generateExpression(expr["arguments"][i],Precedence.Assignment,E_TTT));if(i+1<iz){result.push(","+space)}}result.push(")");if(!(flags&F_ALLOW_CALL)){return["(",result,")"]}return parenthesize(result,Precedence.Call,precedence)},NewExpression:function(expr,precedence,flags){var result,length,i,iz,itemFlags;length=expr["arguments"].length;itemFlags=flags&F_ALLOW_UNPARATH_NEW&&!parentheses&&length===0?E_TFT:E_TFF;result=join("new",this.generateExpression(expr.callee,Precedence.New,itemFlags));if(!(flags&F_ALLOW_UNPARATH_NEW)||parentheses||length>0){result.push("(");for(i=0,iz=length;i<iz;++i){result.push(this.generateExpression(expr["arguments"][i],Precedence.Assignment,E_TTT));if(i+1<iz){result.push(","+space)}}result.push(")")}return parenthesize(result,Precedence.New,precedence)},MemberExpression:function(expr,precedence,flags){var result,fragment;result=[this.generateExpression(expr.object,Precedence.Call,flags&F_ALLOW_CALL?E_TTF:E_TFF)];if(expr.computed){result.push("[");result.push(this.generateExpression(expr.property,Precedence.Sequence,flags&F_ALLOW_CALL?E_TTT:E_TFT));result.push("]")}else{if(expr.object.type===Syntax.Literal&&typeof expr.object.value==="number"){fragment=toSourceNodeWhenNeeded(result).toString();if(fragment.indexOf(".")<0&&!/[eExX]/.test(fragment)&&esutils.code.isDecimalDigit(fragment.charCodeAt(fragment.length-1))&&!(fragment.length>=2&&fragment.charCodeAt(0)===48)){result.push(".")}}result.push(".");result.push(generateIdentifier(expr.property))}return parenthesize(result,Precedence.Member,precedence)},UnaryExpression:function(expr,precedence,flags){var result,fragment,rightCharCode,leftSource,leftCharCode;fragment=this.generateExpression(expr.argument,Precedence.Unary,E_TTT);if(space===""){result=join(expr.operator,fragment)}else{result=[expr.operator];if(expr.operator.length>2){result=join(result,fragment)}else{leftSource=toSourceNodeWhenNeeded(result).toString();leftCharCode=leftSource.charCodeAt(leftSource.length-1);rightCharCode=fragment.toString().charCodeAt(0);if((leftCharCode===43||leftCharCode===45)&&leftCharCode===rightCharCode||esutils.code.isIdentifierPart(leftCharCode)&&esutils.code.isIdentifierPart(rightCharCode)){result.push(noEmptySpace());result.push(fragment)}else{result.push(fragment)}}}return parenthesize(result,Precedence.Unary,precedence)},YieldExpression:function(expr,precedence,flags){var result;if(expr.delegate){result="yield*"}else{result="yield"}if(expr.argument){result=join(result,this.generateExpression(expr.argument,Precedence.Yield,E_TTT))}return parenthesize(result,Precedence.Yield,precedence)},AwaitExpression:function(expr,precedence,flags){var result=join(expr.delegate?"await*":"await",this.generateExpression(expr.argument,Precedence.Await,E_TTT));return parenthesize(result,Precedence.Await,precedence)},UpdateExpression:function(expr,precedence,flags){if(expr.prefix){return parenthesize([expr.operator,this.generateExpression(expr.argument,Precedence.Unary,E_TTT)],Precedence.Unary,precedence)}return parenthesize([this.generateExpression(expr.argument,Precedence.Postfix,E_TTT),expr.operator],Precedence.Postfix,precedence)},FunctionExpression:function(expr,precedence,flags){var result=[generateAsyncPrefix(expr,true),"function"];if(expr.id){result.push(generateStarSuffix(expr)||noEmptySpace());result.push(generateIdentifier(expr.id))}else{result.push(generateStarSuffix(expr)||space)}result.push(this.generateFunctionBody(expr));return result},ExportBatchSpecifier:function(expr,precedence,flags){return"*"},ArrayPattern:function(expr,precedence,flags){return this.ArrayExpression(expr,precedence,flags)},ArrayExpression:function(expr,precedence,flags){var result,multiline,that=this;if(!expr.elements.length){return"[]"}multiline=expr.elements.length>1;result=["[",multiline?newline:""];withIndent(function(indent){var i,iz;for(i=0,iz=expr.elements.length;i<iz;++i){if(!expr.elements[i]){if(multiline){result.push(indent)}if(i+1===iz){result.push(",")}}else{result.push(multiline?indent:"");result.push(that.generateExpression(expr.elements[i],Precedence.Assignment,E_TTT))}if(i+1<iz){result.push(","+(multiline?newline:space))}}});if(multiline&&!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(multiline?base:"");result.push("]");return result},ClassExpression:function(expr,precedence,flags){var result,fragment;result=["class"];if(expr.id){result=join(result,this.generateExpression(expr.id,Precedence.Sequence,E_TTT))}if(expr.superClass){fragment=join("extends",this.generateExpression(expr.superClass,Precedence.Assignment,E_TTT));result=join(result,fragment)}result.push(space);result.push(this.generateStatement(expr.body,S_TFFT));return result},MethodDefinition:function(expr,precedence,flags){var result,fragment;if(expr["static"]){result=["static"+space]}else{result=[]}if(expr.kind==="get"||expr.kind==="set"){fragment=[join(expr.kind,this.generatePropertyKey(expr.key,expr.computed)),this.generateFunctionBody(expr.value)]}else{fragment=[generateMethodPrefix(expr),this.generatePropertyKey(expr.key,expr.computed),this.generateFunctionBody(expr.value)]}return join(result,fragment)},Property:function(expr,precedence,flags){if(expr.kind==="get"||expr.kind==="set"){return[expr.kind,noEmptySpace(),this.generatePropertyKey(expr.key,expr.computed),this.generateFunctionBody(expr.value)]}if(expr.shorthand){return this.generatePropertyKey(expr.key,expr.computed)}if(expr.method){return[generateMethodPrefix(expr),this.generatePropertyKey(expr.key,expr.computed),this.generateFunctionBody(expr.value)]}return[this.generatePropertyKey(expr.key,expr.computed),":"+space,this.generateExpression(expr.value,Precedence.Assignment,E_TTT)]},ObjectExpression:function(expr,precedence,flags){var multiline,result,fragment,that=this;if(!expr.properties.length){return"{}"}multiline=expr.properties.length>1;withIndent(function(){fragment=that.generateExpression(expr.properties[0],Precedence.Sequence,E_TTT)});if(!multiline){if(!hasLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){return["{",space,fragment,space,"}"]}}withIndent(function(indent){var i,iz;result=["{",newline,indent,fragment];if(multiline){result.push(","+newline);for(i=1,iz=expr.properties.length;i<iz;++i){result.push(indent);result.push(that.generateExpression(expr.properties[i],Precedence.Sequence,E_TTT));if(i+1<iz){result.push(","+newline)}}}});if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(base);result.push("}");return result},ObjectPattern:function(expr,precedence,flags){var result,i,iz,multiline,property,that=this;if(!expr.properties.length){return"{}"}multiline=false;if(expr.properties.length===1){property=expr.properties[0];if(property.value.type!==Syntax.Identifier){multiline=true}}else{for(i=0,iz=expr.properties.length;i<iz;++i){property=expr.properties[i];if(!property.shorthand){multiline=true;break}}}result=["{",multiline?newline:""];withIndent(function(indent){var i,iz;for(i=0,iz=expr.properties.length;i<iz;++i){result.push(multiline?indent:"");result.push(that.generateExpression(expr.properties[i],Precedence.Sequence,E_TTT));if(i+1<iz){result.push(","+(multiline?newline:space))}}});if(multiline&&!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(multiline?base:"");result.push("}");return result},ThisExpression:function(expr,precedence,flags){return"this"},Identifier:function(expr,precedence,flags){return generateIdentifier(expr)},ImportDefaultSpecifier:function(expr,precedence,flags){return generateIdentifier(expr.id)},ImportNamespaceSpecifier:function(expr,precedence,flags){var result=["*"];if(expr.id){result.push(space+"as"+noEmptySpace()+generateIdentifier(expr.id))}return result},ImportSpecifier:function(expr,precedence,flags){return this.ExportSpecifier(expr,precedence,flags)},ExportSpecifier:function(expr,precedence,flags){var result=[expr.id.name];if(expr.name){result.push(noEmptySpace()+"as"+noEmptySpace()+generateIdentifier(expr.name))}return result},Literal:function(expr,precedence,flags){var raw;if(expr.hasOwnProperty("raw")&&parse&&extra.raw){try{raw=parse(expr.raw).body[0].expression;if(raw.type===Syntax.Literal){
if(raw.value===expr.value){return expr.raw}}}catch(e){}}if(expr.value===null){return"null"}if(typeof expr.value==="string"){return escapeString(expr.value)}if(typeof expr.value==="number"){return generateNumber(expr.value)}if(typeof expr.value==="boolean"){return expr.value?"true":"false"}return generateRegExp(expr.value)},GeneratorExpression:function(expr,precedence,flags){return this.ComprehensionExpression(expr,precedence,flags)},ComprehensionExpression:function(expr,precedence,flags){var result,i,iz,fragment,that=this;result=expr.type===Syntax.GeneratorExpression?["("]:["["];if(extra.moz.comprehensionExpressionStartsWithAssignment){fragment=this.generateExpression(expr.body,Precedence.Assignment,E_TTT);result.push(fragment)}if(expr.blocks){withIndent(function(){for(i=0,iz=expr.blocks.length;i<iz;++i){fragment=that.generateExpression(expr.blocks[i],Precedence.Sequence,E_TTT);if(i>0||extra.moz.comprehensionExpressionStartsWithAssignment){result=join(result,fragment)}else{result.push(fragment)}}})}if(expr.filter){result=join(result,"if"+space);fragment=this.generateExpression(expr.filter,Precedence.Sequence,E_TTT);result=join(result,["(",fragment,")"])}if(!extra.moz.comprehensionExpressionStartsWithAssignment){fragment=this.generateExpression(expr.body,Precedence.Assignment,E_TTT);result=join(result,fragment)}result.push(expr.type===Syntax.GeneratorExpression?")":"]");return result},ComprehensionBlock:function(expr,precedence,flags){var fragment;if(expr.left.type===Syntax.VariableDeclaration){fragment=[expr.left.kind,noEmptySpace(),this.generateStatement(expr.left.declarations[0],S_FFFF)]}else{fragment=this.generateExpression(expr.left,Precedence.Call,E_TTT)}fragment=join(fragment,expr.of?"of":"in");fragment=join(fragment,this.generateExpression(expr.right,Precedence.Sequence,E_TTT));return["for"+space+"(",fragment,")"]},SpreadElement:function(expr,precedence,flags){return["...",this.generateExpression(expr.argument,Precedence.Assignment,E_TTT)]},TaggedTemplateExpression:function(expr,precedence,flags){var itemFlags=E_TTF;if(!(flags&F_ALLOW_CALL)){itemFlags=E_TFF}var result=[this.generateExpression(expr.tag,Precedence.Call,itemFlags),this.generateExpression(expr.quasi,Precedence.Primary,E_FFT)];return parenthesize(result,Precedence.TaggedTemplate,precedence)},TemplateElement:function(expr,precedence,flags){return expr.value.raw},TemplateLiteral:function(expr,precedence,flags){var result,i,iz;result=["`"];for(i=0,iz=expr.quasis.length;i<iz;++i){result.push(this.generateExpression(expr.quasis[i],Precedence.Primary,E_TTT));if(i+1<iz){result.push("${"+space);result.push(this.generateExpression(expr.expressions[i],Precedence.Sequence,E_TTT));result.push(space+"}")}}result.push("`");return result},ModuleSpecifier:function(expr,precedence,flags){return this.Literal(expr,precedence,flags)}};merge(CodeGenerator.prototype,CodeGenerator.Expression);CodeGenerator.prototype.generateExpression=function(expr,precedence,flags){var result,type;type=expr.type||Syntax.Property;if(extra.verbatim&&expr.hasOwnProperty(extra.verbatim)){return generateVerbatim(expr,precedence)}result=this[type](expr,precedence,flags);if(extra.comment){result=addComments(expr,result)}return toSourceNodeWhenNeeded(result,expr)};CodeGenerator.prototype.generateStatement=function(stmt,flags){var result,fragment;result=this[stmt.type](stmt,flags);if(extra.comment){result=addComments(stmt,result)}fragment=toSourceNodeWhenNeeded(result).toString();if(stmt.type===Syntax.Program&&!safeConcatenation&&newline===""&&fragment.charAt(fragment.length-1)==="\n"){result=sourceMap?toSourceNodeWhenNeeded(result).replaceRight(/\s+$/,""):fragment.replace(/\s+$/,"")}return toSourceNodeWhenNeeded(result,stmt)};function generateInternal(node){var codegen;codegen=new CodeGenerator;if(isStatement(node)){return codegen.generateStatement(node,S_TFFF)}if(isExpression(node)){return codegen.generateExpression(node,Precedence.Sequence,E_TTT)}throw new Error("Unknown node type: "+node.type)}function generate(node,options){var defaultOptions=getDefaultOptions(),result,pair;if(options!=null){if(typeof options.indent==="string"){defaultOptions.format.indent.style=options.indent}if(typeof options.base==="number"){defaultOptions.format.indent.base=options.base}options=updateDeeply(defaultOptions,options);indent=options.format.indent.style;if(typeof options.base==="string"){base=options.base}else{base=stringRepeat(indent,options.format.indent.base)}}else{options=defaultOptions;indent=options.format.indent.style;base=stringRepeat(indent,options.format.indent.base)}json=options.format.json;renumber=options.format.renumber;hexadecimal=json?false:options.format.hexadecimal;quotes=json?"double":options.format.quotes;escapeless=options.format.escapeless;newline=options.format.newline;space=options.format.space;if(options.format.compact){newline=space=indent=base=""}parentheses=options.format.parentheses;semicolons=options.format.semicolons;safeConcatenation=options.format.safeConcatenation;directive=options.directive;parse=json?null:options.parse;sourceMap=options.sourceMap;sourceCode=options.sourceCode;preserveBlankLines=options.format.preserveBlankLines&&sourceCode!==null;extra=options;if(sourceMap){if(!exports.browser){SourceNode=require("source-map").SourceNode}else{SourceNode=global.sourceMap.SourceNode}}result=generateInternal(node);if(!sourceMap){pair={code:result.toString(),map:null};return options.sourceMapWithCode?pair:pair.code}pair=result.toStringWithSourceMap({file:options.file,sourceRoot:options.sourceMapRoot});if(options.sourceContent){pair.map.setSourceContent(options.sourceMap,options.sourceContent)}if(options.sourceMapWithCode){return pair}return pair.map.toString()}FORMAT_MINIFY={indent:{style:"",base:0},renumber:true,hexadecimal:true,quotes:"auto",escapeless:true,compact:true,parentheses:false,semicolons:false};FORMAT_DEFAULTS=getDefaultOptions().format;exports.version=require("./package.json").version;exports.generate=generate;exports.attachComments=estraverse.attachComments;exports.Precedence=updateDeeply({},Precedence);exports.browser=false;exports.FORMAT_MINIFY=FORMAT_MINIFY;exports.FORMAT_DEFAULTS=FORMAT_DEFAULTS})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./package.json":19,estraverse:3,esutils:7,"source-map":8}]},{},[]);var esprima=require("esprima");var estraverse=require("estraverse");var escodegen=require("escodegen");var simpleAddition=['"use rat"',"var a = 1/2 + 1/2"].join("\n");var ast=esprima.parse(simpleAddition);var path=[];var locations=[];estraverse.traverse(ast,{enter:function(node,parent){if(node.type==="ExpressionStatement"&&node.expression.value==="use rat"){locations.push(parent);return estraverse.VisitorOption.REMOVE}},exit:function(node,parent){path.pop(node)}});var used={};var useMap={"/":function(left,right){if(left.type==="Literal"&&right.type==="Literal"){return"rat_frac"}else{return"rat_div"}},"*":function(){return"rat_mul"},"+":function(){return"rat_add"},"-":function(){return"rat_sub }"}};function buildBinaryFunction(op,node){node.type="CallExpression";node.callee={type:"Identifier",name:op(node.left,node.right)};node.arguments=[node.left,node.right];delete node.left;delete node.right}locations.forEach(function(location){var binaryExpressions=[];estraverse.traverse(location,{enter:function(node,parent){if(node.type==="BinaryExpression"){binaryExpressions.push(node)}},exit:function(node,parent){path.pop(node)}});binaryExpressions.reverse().forEach(function(expr){var ratOp=useMap[expr.operator];used[ratOp]=true;buildBinaryFunction(ratOp,expr)})});var r=escodegen.generate(ast);document.write(r);
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"esprima": "2.2.0",
"estraverse": "4.1.0",
"escodegen": "1.6.1"
}
}
<!-- contents of this file will be placed inside the <body> -->
<!-- contents of this file will be placed inside the <head> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment