{"version":3,"file":null,"sources":["../src/utils/flushTime.js","../src/utils/path.js","../src/utils/fs.js","../src/utils/object.js","../src/utils/promise.js","../src/utils/validateKeys.js","../src/utils/error.js","../src/utils/sourceMappingURL.js","../node_modules/sourcemap-codec/dist/sourcemap-codec.es6.js","../node_modules/vlq/src/vlq.js","../node_modules/magic-string/dist/magic-string.es6.js","../src/utils/first.js","../src/utils/array.js","../node_modules/acorn/src/identifier.js","../node_modules/acorn/src/tokentype.js","../node_modules/acorn/src/whitespace.js","../node_modules/acorn/src/util.js","../node_modules/acorn/src/locutil.js","../node_modules/acorn/src/options.js","../node_modules/acorn/src/state.js","../node_modules/acorn/src/parseutil.js","../node_modules/acorn/src/statement.js","../node_modules/acorn/src/lval.js","../node_modules/acorn/src/expression.js","../node_modules/acorn/src/location.js","../node_modules/acorn/src/node.js","../node_modules/acorn/src/tokencontext.js","../node_modules/acorn/src/tokenize.js","../node_modules/acorn/src/index.js","../node_modules/locate-character/dist/locate-character.es.js","../src/utils/makeLegalIdentifier.js","../src/utils/getCodeFrame.js","../src/utils/relativeId.js","../src/ast/values.js","../src/Declaration.js","../src/ast/utils/extractNames.js","../src/ast/Node.js","../src/ast/nodes/ArrayExpression.js","../src/ast/scopes/Scope.js","../src/ast/nodes/ArrowFunctionExpression.js","../src/ast/nodes/shared/disallowIllegalReassignment.js","../src/ast/nodes/shared/isUsedByBundle.js","../src/ast/utils/isProgramLevel.js","../src/ast/nodes/AssignmentExpression.js","../src/ast/nodes/BinaryExpression.js","../src/ast/nodes/shared/Statement.js","../src/ast/nodes/BlockStatement.js","../node_modules/is-reference/module.js","../src/ast/utils/flatten.js","../src/ast/nodes/shared/pureFunctions.js","../src/ast/nodes/shared/callHasEffects.js","../src/ast/nodes/CallExpression.js","../src/ast/nodes/ClassDeclaration.js","../src/ast/nodes/ClassExpression.js","../src/ast/nodes/ConditionalExpression.js","../src/ast/nodes/EmptyStatement.js","../src/ast/nodes/ExportAllDeclaration.js","../src/ast/nodes/ExportDefaultDeclaration.js","../src/ast/nodes/ExportNamedDeclaration.js","../src/ast/nodes/ExpressionStatement.js","../src/ast/nodes/ForStatement.js","../src/ast/nodes/shared/assignTo.js","../src/ast/nodes/ForInStatement.js","../src/ast/nodes/ForOfStatement.js","../src/ast/nodes/FunctionDeclaration.js","../src/ast/nodes/FunctionExpression.js","../src/ast/nodes/Identifier.js","../src/ast/nodes/IfStatement.js","../src/ast/nodes/ImportDeclaration.js","../src/ast/nodes/Literal.js","../src/ast/nodes/LogicalExpression.js","../src/ast/nodes/MemberExpression.js","../src/ast/nodes/NewExpression.js","../src/ast/nodes/ObjectExpression.js","../src/ast/nodes/ReturnStatement.js","../src/ast/nodes/TemplateLiteral.js","../src/ast/nodes/ThisExpression.js","../src/ast/nodes/ThrowStatement.js","../src/ast/nodes/UnaryExpression.js","../src/ast/nodes/UpdateExpression.js","../src/ast/nodes/VariableDeclarator.js","../src/ast/nodes/VariableDeclaration.js","../src/ast/nodes/index.js","../src/ast/keys.js","../src/ast/enhance.js","../src/ast/clone.js","../src/ast/scopes/ModuleScope.js","../src/Module.js","../src/ExternalModule.js","../src/utils/map-helpers.js","../src/finalisers/shared/getInteropBlock.js","../src/finalisers/shared/getExportBlock.js","../src/finalisers/shared/esModuleExport.js","../src/finalisers/shared/warnOnBuiltins.js","../src/finalisers/amd.js","../src/finalisers/cjs.js","../src/finalisers/es.js","../src/finalisers/shared/getGlobalNameMaker.js","../src/finalisers/shared/sanitize.js","../src/finalisers/shared/trimEmptyImports.js","../src/finalisers/iife.js","../src/finalisers/umd.js","../src/finalisers/index.js","../src/utils/ensureArray.js","../src/utils/defaults.js","../src/utils/getExportMode.js","../src/utils/getIndentString.js","../src/utils/transform.js","../src/utils/transformBundle.js","../src/utils/collapseSourcemaps.js","../src/utils/callIfFunction.js","../src/ast/scopes/BundleScope.js","../src/Bundle.js","../src/rollup.js"],"sourcesContent":["const DEBUG = false;\nconst map = new Map;\n\nlet timeStartHelper;\nlet timeEndHelper;\n\nif ( typeof process === 'undefined' ) {\n\ttimeStartHelper = function timeStartHelper () {\n\t\treturn window.performance.now();\n\t};\n\n\ttimeEndHelper = function timeEndHelper ( previous ) {\n\t\treturn window.performance.now() - previous;\n\t};\n} else {\n\ttimeStartHelper = function timeStartHelper () {\n\t\treturn process.hrtime();\n\t};\n\n\ttimeEndHelper = function timeEndHelper ( previous ) {\n\t\tconst hrtime = process.hrtime( previous );\n\t\treturn hrtime[0] * 1e3 + Math.floor( hrtime[1] / 1e6 );\n\t};\n}\n\nexport function timeStart ( label ) {\n\tif ( !map.has( label ) ) {\n\t\tmap.set( label, {\n\t\t\ttime: 0\n\t\t});\n\t}\n\tmap.get( label ).start = timeStartHelper();\n}\n\nexport function timeEnd ( label ) {\n\tif ( map.has( label ) ) {\n\t\tconst item = map.get( label );\n\t\titem.time += timeEndHelper( item.start );\n\t}\n}\n\nexport function flushTime ( log = defaultLog ) {\n\tfor ( const item of map.entries() ) {\n\t\tlog( item[0], item[1].time );\n\t}\n\tmap.clear();\n}\n\nfunction defaultLog ( label, time ) {\n\tif ( DEBUG ) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.info( '%dms: %s', time, label );\n\t\t/* eslint-enable no-console */\n\t}\n}\n","export const absolutePath = /^(?:\\/|(?:[A-Za-z]:)?[\\\\|\\/])/;\nexport const relativePath = /^\\.?\\.\\//;\n\nexport function isAbsolute ( path ) {\n\treturn absolutePath.test( path );\n}\n\nexport function isRelative ( path ) {\n\treturn relativePath.test( path );\n}\n\nexport function normalize ( path ) {\n\treturn path.replace( /\\\\/g, '/' );\n}\n\nexport { basename, dirname, extname, relative, resolve } from 'path';\n","import * as fs from 'fs';\nimport { dirname } from './path.js';\n\nexport * from 'fs';\n\nfunction mkdirpath ( path ) {\n\tconst dir = dirname( path );\n\ttry {\n\t\tfs.readdirSync( dir );\n\t} catch ( err ) {\n\t\tmkdirpath( dir );\n\t\tfs.mkdirSync( dir );\n\t}\n}\n\nexport function writeFile ( dest, data ) {\n\treturn new Promise( ( fulfil, reject ) => {\n\t\tmkdirpath( dest );\n\n\t\tfs.writeFile( dest, data, err => {\n\t\t\tif ( err ) {\n\t\t\t\treject( err );\n\t\t\t} else {\n\t\t\t\tfulfil();\n\t\t\t}\n\t\t});\n\t});\n}\n","export const { keys } = Object;\n\nexport function blank () {\n\treturn Object.create( null );\n}\n\nexport function forOwn ( object, func ) {\n\tObject.keys( object ).forEach( key => func( object[ key ], key ) );\n}\n\nexport function assign ( target, ...sources ) {\n\tsources.forEach( source => {\n\t\tfor ( const key in source ) {\n\t\t\tif ( source.hasOwnProperty( key ) ) target[ key ] = source[ key ];\n\t\t}\n\t});\n\n\treturn target;\n}\n","export function mapSequence ( array, fn ) {\n\tconst results = [];\n\tlet promise = Promise.resolve();\n\n\tfunction next ( member, i ) {\n\t\treturn fn( member ).then( value => results[i] = value );\n\t}\n\n\tfor ( let i = 0; i < array.length; i += 1 ) {\n\t\tpromise = promise.then( () => next( array[i], i ) );\n\t}\n\n\treturn promise.then( () => results );\n}\n","export default function validateKeys ( actualKeys, allowedKeys ) {\n\tlet i = actualKeys.length;\n\n\twhile ( i-- ) {\n\t\tconst key = actualKeys[i];\n\n\t\tif ( allowedKeys.indexOf( key ) === -1 ) {\n\t\t\treturn new Error(\n\t\t\t\t`Unexpected key '${ key }' found, expected one of: ${ allowedKeys.join( ', ' ) }`\n\t\t\t);\n\t\t}\n\t}\n}\n","export default function error ( props ) {\n\tconst err = new Error( props.message );\n\n\tObject.keys( props ).forEach( key => {\n\t\terr[ key ] = props[ key ];\n\t});\n\n\tthrow err;\n}\n","// this looks ridiculous, but it prevents sourcemap tooling from mistaking\n// this for an actual sourceMappingURL\nlet SOURCEMAPPING_URL = 'sourceMa';\nSOURCEMAPPING_URL += 'ppingURL';\n\nconst SOURCEMAPPING_URL_RE = new RegExp( `^#\\\\s+${SOURCEMAPPING_URL}=.+\\\\n?` );\n\nexport { SOURCEMAPPING_URL, SOURCEMAPPING_URL_RE };\n","var charToInteger = {};\nvar integerToChar = {};\n\n'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {\n\tcharToInteger[ char ] = i;\n\tintegerToChar[ i ] = char;\n});\n\nfunction decode$1 ( string ) {\n\tvar result = [],\n\t\tlen = string.length,\n\t\ti,\n\t\thasContinuationBit,\n\t\tshift = 0,\n\t\tvalue = 0,\n\t\tinteger,\n\t\tshouldNegate;\n\n\tfor ( i = 0; i < len; i += 1 ) {\n\t\tinteger = charToInteger[ string[i] ];\n\n\t\tif ( integer === undefined ) {\n\t\t\tthrow new Error( 'Invalid character (' + string[i] + ')' );\n\t\t}\n\n\t\thasContinuationBit = integer & 32;\n\n\t\tinteger &= 31;\n\t\tvalue += integer << shift;\n\n\t\tif ( hasContinuationBit ) {\n\t\t\tshift += 5;\n\t\t} else {\n\t\t\tshouldNegate = value & 1;\n\t\t\tvalue >>= 1;\n\n\t\t\tresult.push( shouldNegate ? -value : value );\n\n\t\t\t// reset\n\t\t\tvalue = shift = 0;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction encode$1 ( value ) {\n\tvar result, i;\n\n\tif ( typeof value === 'number' ) {\n\t\tresult = encodeInteger( value );\n\t} else {\n\t\tresult = '';\n\t\tfor ( i = 0; i < value.length; i += 1 ) {\n\t\t\tresult += encodeInteger( value[i] );\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction encodeInteger ( num ) {\n\tvar result = '', clamped;\n\n\tif ( num < 0 ) {\n\t\tnum = ( -num << 1 ) | 1;\n\t} else {\n\t\tnum <<= 1;\n\t}\n\n\tdo {\n\t\tclamped = num & 31;\n\t\tnum >>= 5;\n\n\t\tif ( num > 0 ) {\n\t\t\tclamped |= 32;\n\t\t}\n\n\t\tresult += integerToChar[ clamped ];\n\t} while ( num > 0 );\n\n\treturn result;\n}\n\nfunction decodeSegments(encodedSegments) {\n\tvar i = encodedSegments.length;\n\tvar segments = new Array(i);\n\n\twhile (i--) {\n\t\tsegments[i] = decode$1(encodedSegments[i]);\n\t}return segments;\n}\n\nfunction decode(mappings) {\n\tvar sourceFileIndex = 0; // second field\n\tvar sourceCodeLine = 0; // third field\n\tvar sourceCodeColumn = 0; // fourth field\n\tvar nameIndex = 0; // fifth field\n\n\tvar lines = mappings.split(';');\n\tvar numLines = lines.length;\n\tvar decoded = new Array(numLines);\n\n\tvar i = undefined;\n\tvar j = undefined;\n\tvar line = undefined;\n\tvar generatedCodeColumn = undefined;\n\tvar decodedLine = undefined;\n\tvar segments = undefined;\n\tvar segment = undefined;\n\tvar result = undefined;\n\n\tfor (i = 0; i < numLines; i += 1) {\n\t\tline = lines[i];\n\n\t\tgeneratedCodeColumn = 0; // first field - reset each time\n\t\tdecodedLine = [];\n\n\t\tsegments = decodeSegments(line.split(','));\n\n\t\tfor (j = 0; j < segments.length; j += 1) {\n\t\t\tsegment = segments[j];\n\n\t\t\tif (!segment.length) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tgeneratedCodeColumn += segment[0];\n\n\t\t\tresult = [generatedCodeColumn];\n\t\t\tdecodedLine.push(result);\n\n\t\t\tif (segment.length === 1) {\n\t\t\t\t// only one field!\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tsourceFileIndex += segment[1];\n\t\t\tsourceCodeLine += segment[2];\n\t\t\tsourceCodeColumn += segment[3];\n\n\t\t\tresult.push(sourceFileIndex, sourceCodeLine, sourceCodeColumn);\n\n\t\t\tif (segment.length === 5) {\n\t\t\t\tnameIndex += segment[4];\n\t\t\t\tresult.push(nameIndex);\n\t\t\t}\n\t\t}\n\n\t\tdecoded[i] = decodedLine;\n\t}\n\n\treturn decoded;\n}\n\nfunction encode(decoded) {\n\tvar offsets = {\n\t\tgeneratedCodeColumn: 0,\n\t\tsourceFileIndex: 0, // second field\n\t\tsourceCodeLine: 0, // third field\n\t\tsourceCodeColumn: 0, // fourth field\n\t\tnameIndex: 0 // fifth field\n\t};\n\n\treturn decoded.map(function (line) {\n\t\toffsets.generatedCodeColumn = 0; // first field - reset each time\n\t\treturn line.map(encodeSegment).join(',');\n\t}).join(';');\n\n\tfunction encodeSegment(segment) {\n\t\tif (!segment.length) {\n\t\t\treturn segment;\n\t\t}\n\n\t\tvar result = new Array(segment.length);\n\n\t\tresult[0] = segment[0] - offsets.generatedCodeColumn;\n\t\toffsets.generatedCodeColumn = segment[0];\n\n\t\tif (segment.length === 1) {\n\t\t\t// only one field!\n\t\t\treturn encode$1(result);\n\t\t}\n\n\t\tresult[1] = segment[1] - offsets.sourceFileIndex;\n\t\tresult[2] = segment[2] - offsets.sourceCodeLine;\n\t\tresult[3] = segment[3] - offsets.sourceCodeColumn;\n\n\t\toffsets.sourceFileIndex = segment[1];\n\t\toffsets.sourceCodeLine = segment[2];\n\t\toffsets.sourceCodeColumn = segment[3];\n\n\t\tif (segment.length === 5) {\n\t\t\tresult[4] = segment[4] - offsets.nameIndex;\n\t\t\toffsets.nameIndex = segment[4];\n\t\t}\n\n\t\treturn encode$1(result);\n\t}\n}\n\nexport { decode, encode };\n//# sourceMappingURL=sourcemap-codec.es6.js.map","var charToInteger = {};\nvar integerToChar = {};\n\n'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {\n\tcharToInteger[ char ] = i;\n\tintegerToChar[ i ] = char;\n});\n\nexport function decode ( string ) {\n\tvar result = [],\n\t\tlen = string.length,\n\t\ti,\n\t\thasContinuationBit,\n\t\tshift = 0,\n\t\tvalue = 0,\n\t\tinteger,\n\t\tshouldNegate;\n\n\tfor ( i = 0; i < len; i += 1 ) {\n\t\tinteger = charToInteger[ string[i] ];\n\n\t\tif ( integer === undefined ) {\n\t\t\tthrow new Error( 'Invalid character (' + string[i] + ')' );\n\t\t}\n\n\t\thasContinuationBit = integer & 32;\n\n\t\tinteger &= 31;\n\t\tvalue += integer << shift;\n\n\t\tif ( hasContinuationBit ) {\n\t\t\tshift += 5;\n\t\t} else {\n\t\t\tshouldNegate = value & 1;\n\t\t\tvalue >>= 1;\n\n\t\t\tresult.push( shouldNegate ? -value : value );\n\n\t\t\t// reset\n\t\t\tvalue = shift = 0;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function encode ( value ) {\n\tvar result, i;\n\n\tif ( typeof value === 'number' ) {\n\t\tresult = encodeInteger( value );\n\t} else {\n\t\tresult = '';\n\t\tfor ( i = 0; i < value.length; i += 1 ) {\n\t\t\tresult += encodeInteger( value[i] );\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction encodeInteger ( num ) {\n\tvar result = '', clamped;\n\n\tif ( num < 0 ) {\n\t\tnum = ( -num << 1 ) | 1;\n\t} else {\n\t\tnum <<= 1;\n\t}\n\n\tdo {\n\t\tclamped = num & 31;\n\t\tnum >>= 5;\n\n\t\tif ( num > 0 ) {\n\t\t\tclamped |= 32;\n\t\t}\n\n\t\tresult += integerToChar[ clamped ];\n\t} while ( num > 0 );\n\n\treturn result;\n}\n","import { encode } from 'vlq';\n\nfunction Chunk ( start, end, content ) {\n\tthis.start = start;\n\tthis.end = end;\n\tthis.original = content;\n\n\tthis.intro = '';\n\tthis.outro = '';\n\n\tthis.content = content;\n\tthis.storeName = false;\n\tthis.edited = false;\n\n\t// we make these non-enumerable, for sanity while debugging\n\tObject.defineProperties( this, {\n\t\tprevious: { writable: true, value: null },\n\t\tnext: { writable: true, value: null }\n\t});\n}\n\nChunk.prototype = {\n\tappend: function append ( content ) {\n\t\tthis.outro += content;\n\t},\n\n\tclone: function clone () {\n\t\tvar chunk = new Chunk( this.start, this.end, this.original );\n\n\t\tchunk.intro = this.intro;\n\t\tchunk.outro = this.outro;\n\t\tchunk.content = this.content;\n\t\tchunk.storeName = this.storeName;\n\t\tchunk.edited = this.edited;\n\n\t\treturn chunk;\n\t},\n\n\tcontains: function contains ( index ) {\n\t\treturn this.start < index && index < this.end;\n\t},\n\n\teachNext: function eachNext ( fn ) {\n\t\tvar chunk = this;\n\t\twhile ( chunk ) {\n\t\t\tfn( chunk );\n\t\t\tchunk = chunk.next;\n\t\t}\n\t},\n\n\teachPrevious: function eachPrevious ( fn ) {\n\t\tvar chunk = this;\n\t\twhile ( chunk ) {\n\t\t\tfn( chunk );\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t},\n\n\tedit: function edit ( content, storeName ) {\n\t\tthis.content = content;\n\t\tthis.storeName = storeName;\n\n\t\tthis.edited = true;\n\n\t\treturn this;\n\t},\n\n\tprepend: function prepend ( content ) {\n\t\tthis.intro = content + this.intro;\n\t},\n\n\tsplit: function split ( index ) {\n\t\tvar sliceIndex = index - this.start;\n\n\t\tvar originalBefore = this.original.slice( 0, sliceIndex );\n\t\tvar originalAfter = this.original.slice( sliceIndex );\n\n\t\tthis.original = originalBefore;\n\n\t\tvar newChunk = new Chunk( index, this.end, originalAfter );\n\t\tnewChunk.outro = this.outro;\n\t\tthis.outro = '';\n\n\t\tthis.end = index;\n\n\t\tif ( this.edited ) {\n\t\t\t// TODO is this block necessary?...\n\t\t\tnewChunk.edit( '', false );\n\t\t\tthis.content = '';\n\t\t} else {\n\t\t\tthis.content = originalBefore;\n\t\t}\n\n\t\tnewChunk.next = this.next;\n\t\tif ( newChunk.next ) newChunk.next.previous = newChunk;\n\t\tnewChunk.previous = this;\n\t\tthis.next = newChunk;\n\n\t\treturn newChunk;\n\t},\n\n\ttoString: function toString () {\n\t\treturn this.intro + this.content + this.outro;\n\t},\n\n\ttrimEnd: function trimEnd ( rx ) {\n\t\tthis.outro = this.outro.replace( rx, '' );\n\t\tif ( this.outro.length ) return true;\n\n\t\tvar trimmed = this.content.replace( rx, '' );\n\n\t\tif ( trimmed.length ) {\n\t\t\tif ( trimmed !== this.content ) {\n\t\t\t\tthis.split( this.start + trimmed.length ).edit( '', false );\n\t\t\t}\n\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit( '', false );\n\n\t\t\tthis.intro = this.intro.replace( rx, '' );\n\t\t\tif ( this.intro.length ) return true;\n\t\t}\n\t},\n\n\ttrimStart: function trimStart ( rx ) {\n\t\tthis.intro = this.intro.replace( rx, '' );\n\t\tif ( this.intro.length ) return true;\n\n\t\tvar trimmed = this.content.replace( rx, '' );\n\n\t\tif ( trimmed.length ) {\n\t\t\tif ( trimmed !== this.content ) {\n\t\t\t\tthis.split( this.end - trimmed.length );\n\t\t\t\tthis.edit( '', false );\n\t\t\t}\n\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit( '', false );\n\n\t\t\tthis.outro = this.outro.replace( rx, '' );\n\t\t\tif ( this.outro.length ) return true;\n\t\t}\n\t}\n};\n\nvar _btoa;\n\nif ( typeof window !== 'undefined' && typeof window.btoa === 'function' ) {\n\t_btoa = window.btoa;\n} else if ( typeof Buffer === 'function' ) {\n\t_btoa = function (str) { return new Buffer( str ).toString( 'base64' ); };\n} else {\n\t_btoa = function () {\n\t\tthrow new Error( 'Unsupported environment: `window.btoa` or `Buffer` should be supported.' );\n\t};\n}\n\nvar btoa = _btoa;\n\nfunction SourceMap ( properties ) {\n\tthis.version = 3;\n\n\tthis.file = properties.file;\n\tthis.sources = properties.sources;\n\tthis.sourcesContent = properties.sourcesContent;\n\tthis.names = properties.names;\n\tthis.mappings = properties.mappings;\n}\n\nSourceMap.prototype = {\n\ttoString: function toString () {\n\t\treturn JSON.stringify( this );\n\t},\n\n\ttoUrl: function toUrl () {\n\t\treturn 'data:application/json;charset=utf-8;base64,' + btoa( this.toString() );\n\t}\n};\n\nfunction guessIndent ( code ) {\n\tvar lines = code.split( '\\n' );\n\n\tvar tabbed = lines.filter( function (line) { return /^\\t+/.test( line ); } );\n\tvar spaced = lines.filter( function (line) { return /^ {2,}/.test( line ); } );\n\n\tif ( tabbed.length === 0 && spaced.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// More lines tabbed than spaced? Assume tabs, and\n\t// default to tabs in the case of a tie (or nothing\n\t// to go on)\n\tif ( tabbed.length >= spaced.length ) {\n\t\treturn '\\t';\n\t}\n\n\t// Otherwise, we need to guess the multiple\n\tvar min = spaced.reduce( function ( previous, current ) {\n\t\tvar numSpaces = /^ +/.exec( current )[0].length;\n\t\treturn Math.min( numSpaces, previous );\n\t}, Infinity );\n\n\treturn new Array( min + 1 ).join( ' ' );\n}\n\nfunction getLocator ( source ) {\n\tvar originalLines = source.split( '\\n' );\n\n\tvar start = 0;\n\tvar lineRanges = originalLines.map( function ( line, i ) {\n\t\tvar end = start + line.length + 1;\n\t\tvar range = { start: start, end: end, line: i };\n\n\t\tstart = end;\n\t\treturn range;\n\t});\n\n\tvar i = 0;\n\n\tfunction rangeContains ( range, index ) {\n\t\treturn range.start <= index && index < range.end;\n\t}\n\n\tfunction getLocation ( range, index ) {\n\t\treturn { line: range.line, column: index - range.start };\n\t}\n\n\treturn function locate ( index ) {\n\t\tvar range = lineRanges[i];\n\n\t\tvar d = index >= range.end ? 1 : -1;\n\n\t\twhile ( range ) {\n\t\t\tif ( rangeContains( range, index ) ) return getLocation( range, index );\n\n\t\t\ti += d;\n\t\t\trange = lineRanges[i];\n\t\t}\n\t};\n}\n\nvar nonWhitespace = /\\S/;\n\nfunction encodeMappings ( original, intro, outro, chunk, hires, sourcemapLocations, sourceIndex, offsets, names ) {\n\tvar rawLines = [];\n\n\tvar generatedCodeLine = intro.split( '\\n' ).length - 1;\n\tvar rawSegments = rawLines[ generatedCodeLine ] = [];\n\n\tvar generatedCodeColumn = 0;\n\n\tvar locate = getLocator( original );\n\n\tfunction addEdit ( content, original, loc, nameIndex, i ) {\n\t\tif ( i || ( content.length && nonWhitespace.test( content ) ) ) {\n\t\t\trawSegments.push({\n\t\t\t\tgeneratedCodeLine: generatedCodeLine,\n\t\t\t\tgeneratedCodeColumn: generatedCodeColumn,\n\t\t\t\tsourceCodeLine: loc.line,\n\t\t\t\tsourceCodeColumn: loc.column,\n\t\t\t\tsourceCodeName: nameIndex,\n\t\t\t\tsourceIndex: sourceIndex\n\t\t\t});\n\t\t}\n\n\t\tvar lines = content.split( '\\n' );\n\t\tvar lastLine = lines.pop();\n\n\t\tif ( lines.length ) {\n\t\t\tgeneratedCodeLine += lines.length;\n\t\t\trawLines[ generatedCodeLine ] = rawSegments = [];\n\t\t\tgeneratedCodeColumn = lastLine.length;\n\t\t} else {\n\t\t\tgeneratedCodeColumn += lastLine.length;\n\t\t}\n\n\t\tlines = original.split( '\\n' );\n\t\tlastLine = lines.pop();\n\n\t\tif ( lines.length ) {\n\t\t\tloc.line += lines.length;\n\t\t\tloc.column = lastLine.length;\n\t\t} else {\n\t\t\tloc.column += lastLine.length;\n\t\t}\n\t}\n\n\tfunction addUneditedChunk ( chunk, loc ) {\n\t\tvar originalCharIndex = chunk.start;\n\t\tvar first = true;\n\n\t\twhile ( originalCharIndex < chunk.end ) {\n\t\t\tif ( hires || first || sourcemapLocations[ originalCharIndex ] ) {\n\t\t\t\trawSegments.push({\n\t\t\t\t\tgeneratedCodeLine: generatedCodeLine,\n\t\t\t\t\tgeneratedCodeColumn: generatedCodeColumn,\n\t\t\t\t\tsourceCodeLine: loc.line,\n\t\t\t\t\tsourceCodeColumn: loc.column,\n\t\t\t\t\tsourceCodeName: -1,\n\t\t\t\t\tsourceIndex: sourceIndex\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif ( original[ originalCharIndex ] === '\\n' ) {\n\t\t\t\tloc.line += 1;\n\t\t\t\tloc.column = 0;\n\t\t\t\tgeneratedCodeLine += 1;\n\t\t\t\trawLines[ generatedCodeLine ] = rawSegments = [];\n\t\t\t\tgeneratedCodeColumn = 0;\n\t\t\t} else {\n\t\t\t\tloc.column += 1;\n\t\t\t\tgeneratedCodeColumn += 1;\n\t\t\t}\n\n\t\t\toriginalCharIndex += 1;\n\t\t\tfirst = false;\n\t\t}\n\t}\n\n\tvar hasContent = false;\n\n\twhile ( chunk ) {\n\t\tvar loc = locate( chunk.start );\n\n\t\tif ( chunk.intro.length ) {\n\t\t\taddEdit( chunk.intro, '', loc, -1, hasContent );\n\t\t}\n\n\t\tif ( chunk.edited ) {\n\t\t\taddEdit( chunk.content, chunk.original, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1, hasContent );\n\t\t} else {\n\t\t\taddUneditedChunk( chunk, loc );\n\t\t}\n\n\t\tif ( chunk.outro.length ) {\n\t\t\taddEdit( chunk.outro, '', loc, -1, hasContent );\n\t\t}\n\n\t\tif ( chunk.content || chunk.intro || chunk.outro ) hasContent = true;\n\n\t\tvar nextChunk = chunk.next;\n\t\tchunk = nextChunk;\n\t}\n\n\toffsets.sourceIndex = offsets.sourceIndex || 0;\n\toffsets.sourceCodeLine = offsets.sourceCodeLine || 0;\n\toffsets.sourceCodeColumn = offsets.sourceCodeColumn || 0;\n\toffsets.sourceCodeName = offsets.sourceCodeName || 0;\n\n\tvar outroSemis = outro.split( '\\n' ).map( function () { return ''; } ).join( ';' );\n\n\tvar encoded = rawLines.map( function (segments) {\n\t\tvar generatedCodeColumn = 0;\n\n\t\treturn segments.map( function (segment) {\n\t\t\tvar arr = [\n\t\t\t\tsegment.generatedCodeColumn - generatedCodeColumn,\n\t\t\t\tsegment.sourceIndex - offsets.sourceIndex,\n\t\t\t\tsegment.sourceCodeLine - offsets.sourceCodeLine,\n\t\t\t\tsegment.sourceCodeColumn - offsets.sourceCodeColumn\n\t\t\t];\n\n\t\t\tgeneratedCodeColumn = segment.generatedCodeColumn;\n\t\t\toffsets.sourceIndex = segment.sourceIndex;\n\t\t\toffsets.sourceCodeLine = segment.sourceCodeLine;\n\t\t\toffsets.sourceCodeColumn = segment.sourceCodeColumn;\n\n\t\t\tif ( ~segment.sourceCodeName ) {\n\t\t\t\tarr.push( segment.sourceCodeName - offsets.sourceCodeName );\n\t\t\t\toffsets.sourceCodeName = segment.sourceCodeName;\n\t\t\t}\n\n\t\t\treturn encode( arr );\n\t\t}).join( ',' );\n\t}).join( ';' ) + outroSemis;\n\n\treturn encoded;\n}\n\nfunction getRelativePath ( from, to ) {\n\tvar fromParts = from.split( /[\\/\\\\]/ );\n\tvar toParts = to.split( /[\\/\\\\]/ );\n\n\tfromParts.pop(); // get dirname\n\n\twhile ( fromParts[0] === toParts[0] ) {\n\t\tfromParts.shift();\n\t\ttoParts.shift();\n\t}\n\n\tif ( fromParts.length ) {\n\t\tvar i = fromParts.length;\n\t\twhile ( i-- ) fromParts[i] = '..';\n\t}\n\n\treturn fromParts.concat( toParts ).join( '/' );\n}\n\nvar toString = Object.prototype.toString;\n\nfunction isObject ( thing ) {\n\treturn toString.call( thing ) === '[object Object]';\n}\n\nfunction MagicString ( string, options ) {\n\tif ( options === void 0 ) options = {};\n\n\tvar chunk = new Chunk( 0, string.length, string );\n\n\tObject.defineProperties( this, {\n\t\toriginal: { writable: true, value: string },\n\t\toutro: { writable: true, value: '' },\n\t\tintro: { writable: true, value: '' },\n\t\tfirstChunk: { writable: true, value: chunk },\n\t\tlastChunk: { writable: true, value: chunk },\n\t\tlastSearchedChunk: { writable: true, value: chunk },\n\t\tbyStart: { writable: true, value: {} },\n\t\tbyEnd: { writable: true, value: {} },\n\t\tfilename: { writable: true, value: options.filename },\n\t\tindentExclusionRanges: { writable: true, value: options.indentExclusionRanges },\n\t\tsourcemapLocations: { writable: true, value: {} },\n\t\tstoredNames: { writable: true, value: {} },\n\t\tindentStr: { writable: true, value: guessIndent( string ) }\n\t});\n\n\tif ( false ) {}\n\n\tthis.byStart[ 0 ] = chunk;\n\tthis.byEnd[ string.length ] = chunk;\n}\n\nMagicString.prototype = {\n\taddSourcemapLocation: function addSourcemapLocation ( char ) {\n\t\tthis.sourcemapLocations[ char ] = true;\n\t},\n\n\tappend: function append ( content ) {\n\t\tif ( typeof content !== 'string' ) throw new TypeError( 'outro content must be a string' );\n\n\t\tthis.outro += content;\n\t\treturn this;\n\t},\n\n\tclone: function clone () {\n\t\tvar cloned = new MagicString( this.original, { filename: this.filename });\n\n\t\tvar originalChunk = this.firstChunk;\n\t\tvar clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();\n\n\t\twhile ( originalChunk ) {\n\t\t\tcloned.byStart[ clonedChunk.start ] = clonedChunk;\n\t\t\tcloned.byEnd[ clonedChunk.end ] = clonedChunk;\n\n\t\t\tvar nextOriginalChunk = originalChunk.next;\n\t\t\tvar nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();\n\n\t\t\tif ( nextClonedChunk ) {\n\t\t\t\tclonedChunk.next = nextClonedChunk;\n\t\t\t\tnextClonedChunk.previous = clonedChunk;\n\n\t\t\t\tclonedChunk = nextClonedChunk;\n\t\t\t}\n\n\t\t\toriginalChunk = nextOriginalChunk;\n\t\t}\n\n\t\tcloned.lastChunk = clonedChunk;\n\n\t\tif ( this.indentExclusionRanges ) {\n\t\t\tcloned.indentExclusionRanges = typeof this.indentExclusionRanges[0] === 'number' ?\n\t\t\t\t[ this.indentExclusionRanges[0], this.indentExclusionRanges[1] ] :\n\t\t\t\tthis.indentExclusionRanges.map( function (range) { return [ range.start, range.end ]; } );\n\t\t}\n\n\t\tObject.keys( this.sourcemapLocations ).forEach( function (loc) {\n\t\t\tcloned.sourcemapLocations[ loc ] = true;\n\t\t});\n\n\t\treturn cloned;\n\t},\n\n\tgenerateMap: function generateMap ( options ) {\n\t\toptions = options || {};\n\n\t\tvar names = Object.keys( this.storedNames );\n\n\t\tif ( false ) {}\n\t\tvar map = new SourceMap({\n\t\t\tfile: ( options.file ? options.file.split( /[\\/\\\\]/ ).pop() : null ),\n\t\t\tsources: [ options.source ? getRelativePath( options.file || '', options.source ) : null ],\n\t\t\tsourcesContent: options.includeContent ? [ this.original ] : [ null ],\n\t\t\tnames: names,\n\t\t\tmappings: this.getMappings( options.hires, 0, {}, names )\n\t\t});\n\t\tif ( false ) {}\n\n\t\treturn map;\n\t},\n\n\tgetIndentString: function getIndentString () {\n\t\treturn this.indentStr === null ? '\\t' : this.indentStr;\n\t},\n\n\tgetMappings: function getMappings ( hires, sourceIndex, offsets, names ) {\n\t\treturn encodeMappings( this.original, this.intro, this.outro, this.firstChunk, hires, this.sourcemapLocations, sourceIndex, offsets, names );\n\t},\n\n\tindent: function indent ( indentStr, options ) {\n\t\tvar this$1 = this;\n\n\t\tvar pattern = /^[^\\r\\n]/gm;\n\n\t\tif ( isObject( indentStr ) ) {\n\t\t\toptions = indentStr;\n\t\t\tindentStr = undefined;\n\t\t}\n\n\t\tindentStr = indentStr !== undefined ? indentStr : ( this.indentStr || '\\t' );\n\n\t\tif ( indentStr === '' ) return this; // noop\n\n\t\toptions = options || {};\n\n\t\t// Process exclusion ranges\n\t\tvar isExcluded = {};\n\n\t\tif ( options.exclude ) {\n\t\t\tvar exclusions = typeof options.exclude[0] === 'number' ? [ options.exclude ] : options.exclude;\n\t\t\texclusions.forEach( function (exclusion) {\n\t\t\t\tfor ( var i = exclusion[0]; i < exclusion[1]; i += 1 ) {\n\t\t\t\t\tisExcluded[i] = true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tvar shouldIndentNextCharacter = options.indentStart !== false;\n\t\tvar replacer = function (match) {\n\t\t\tif ( shouldIndentNextCharacter ) return (\"\" + indentStr + match);\n\t\t\tshouldIndentNextCharacter = true;\n\t\t\treturn match;\n\t\t};\n\n\t\tthis.intro = this.intro.replace( pattern, replacer );\n\n\t\tvar charIndex = 0;\n\n\t\tvar chunk = this.firstChunk;\n\n\t\twhile ( chunk ) {\n\t\t\tvar end = chunk.end;\n\n\t\t\tif ( chunk.edited ) {\n\t\t\t\tif ( !isExcluded[ charIndex ] ) {\n\t\t\t\t\tchunk.content = chunk.content.replace( pattern, replacer );\n\n\t\t\t\t\tif ( chunk.content.length ) {\n\t\t\t\t\t\tshouldIndentNextCharacter = chunk.content[ chunk.content.length - 1 ] === '\\n';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcharIndex = chunk.start;\n\n\t\t\t\twhile ( charIndex < end ) {\n\t\t\t\t\tif ( !isExcluded[ charIndex ] ) {\n\t\t\t\t\t\tvar char = this$1.original[ charIndex ];\n\n\t\t\t\t\t\tif ( char === '\\n' ) {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = true;\n\t\t\t\t\t\t} else if ( char !== '\\r' && shouldIndentNextCharacter ) {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = false;\n\n\t\t\t\t\t\t\tif ( charIndex === chunk.start ) {\n\t\t\t\t\t\t\t\tchunk.prepend( indentStr );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tvar rhs = chunk.split( charIndex );\n\t\t\t\t\t\t\t\trhs.prepend( indentStr );\n\n\t\t\t\t\t\t\t\tthis$1.byStart[ charIndex ] = rhs;\n\t\t\t\t\t\t\t\tthis$1.byEnd[ charIndex ] = chunk;\n\n\t\t\t\t\t\t\t\tchunk = rhs;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcharIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcharIndex = chunk.end;\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tthis.outro = this.outro.replace( pattern, replacer );\n\n\t\treturn this;\n\t},\n\n\tinsert: function insert () {\n\t\tthrow new Error( 'magicString.insert(...) is deprecated. Use insertRight(...) or insertLeft(...)' );\n\t},\n\n\tinsertLeft: function insertLeft ( index, content ) {\n\t\tif ( typeof content !== 'string' ) throw new TypeError( 'inserted content must be a string' );\n\n\t\tif ( false ) {}\n\n\t\tthis._split( index );\n\n\t\tvar chunk = this.byEnd[ index ];\n\n\t\tif ( chunk ) {\n\t\t\tchunk.append( content );\n\t\t} else {\n\t\t\tthis.intro += content;\n\t\t}\n\n\t\tif ( false ) {}\n\t\treturn this;\n\t},\n\n\tinsertRight: function insertRight ( index, content ) {\n\t\tif ( typeof content !== 'string' ) throw new TypeError( 'inserted content must be a string' );\n\n\t\tif ( false ) {}\n\n\t\tthis._split( index );\n\n\t\tvar chunk = this.byStart[ index ];\n\n\t\tif ( chunk ) {\n\t\t\tchunk.prepend( content );\n\t\t} else {\n\t\t\tthis.outro += content;\n\t\t}\n\n\t\tif ( false ) {}\n\t\treturn this;\n\t},\n\n\tmove: function move ( start, end, index ) {\n\t\tif ( index >= start && index <= end ) throw new Error( 'Cannot move a selection inside itself' );\n\n\t\tif ( false ) {}\n\n\t\tthis._split( start );\n\t\tthis._split( end );\n\t\tthis._split( index );\n\n\t\tvar first = this.byStart[ start ];\n\t\tvar last = this.byEnd[ end ];\n\n\t\tvar oldLeft = first.previous;\n\t\tvar oldRight = last.next;\n\n\t\tvar newRight = this.byStart[ index ];\n\t\tif ( !newRight && last === this.lastChunk ) return this;\n\t\tvar newLeft = newRight ? newRight.previous : this.lastChunk;\n\n\t\tif ( oldLeft ) oldLeft.next = oldRight;\n\t\tif ( oldRight ) oldRight.previous = oldLeft;\n\n\t\tif ( newLeft ) newLeft.next = first;\n\t\tif ( newRight ) newRight.previous = last;\n\n\t\tif ( !first.previous ) this.firstChunk = last.next;\n\t\tif ( !last.next ) {\n\t\t\tthis.lastChunk = first.previous;\n\t\t\tthis.lastChunk.next = null;\n\t\t}\n\n\t\tfirst.previous = newLeft;\n\t\tlast.next = newRight;\n\n\t\tif ( !newLeft ) this.firstChunk = first;\n\t\tif ( !newRight ) this.lastChunk = last;\n\n\t\tif ( false ) {}\n\t\treturn this;\n\t},\n\n\toverwrite: function overwrite ( start, end, content, storeName ) {\n\t\tvar this$1 = this;\n\n\t\tif ( typeof content !== 'string' ) throw new TypeError( 'replacement content must be a string' );\n\n\t\twhile ( start < 0 ) start += this$1.original.length;\n\t\twhile ( end < 0 ) end += this$1.original.length;\n\n\t\tif ( end > this.original.length ) throw new Error( 'end is out of bounds' );\n\t\tif ( start === end ) throw new Error( 'Cannot overwrite a zero-length range – use insertLeft or insertRight instead' );\n\n\t\tif ( false ) {}\n\n\t\tthis._split( start );\n\t\tthis._split( end );\n\n\t\tif ( storeName ) {\n\t\t\tvar original = this.original.slice( start, end );\n\t\t\tthis.storedNames[ original ] = true;\n\t\t}\n\n\t\tvar first = this.byStart[ start ];\n\t\tvar last = this.byEnd[ end ];\n\n\t\tif ( first ) {\n\t\t\tfirst.edit( content, storeName );\n\n\t\t\tif ( first !== last ) {\n\t\t\t\tfirst.outro = '';\n\n\t\t\t\tvar chunk = first.next;\n\t\t\t\twhile ( chunk !== last ) {\n\t\t\t\t\tchunk.edit( '', false );\n\t\t\t\t\tchunk.intro = chunk.outro = '';\n\t\t\t\t\tchunk = chunk.next;\n\t\t\t\t}\n\n\t\t\t\tchunk.edit( '', false );\n\t\t\t\tchunk.intro = '';\n\t\t\t}\n\t\t}\n\n\t\telse {\n\t\t\t// must be inserting at the end\n\t\t\tvar newChunk = new Chunk( start, end, '' ).edit( content, storeName );\n\n\t\t\t// TODO last chunk in the array may not be the last chunk, if it's moved...\n\t\t\tlast.next = newChunk;\n\t\t\tnewChunk.previous = last;\n\t\t}\n\n\t\tif ( false ) {}\n\t\treturn this;\n\t},\n\n\tprepend: function prepend ( content ) {\n\t\tif ( typeof content !== 'string' ) throw new TypeError( 'outro content must be a string' );\n\n\t\tthis.intro = content + this.intro;\n\t\treturn this;\n\t},\n\n\tremove: function remove ( start, end ) {\n\t\tvar this$1 = this;\n\n\t\twhile ( start < 0 ) start += this$1.original.length;\n\t\twhile ( end < 0 ) end += this$1.original.length;\n\n\t\tif ( start === end ) return this;\n\n\t\tif ( start < 0 || end > this.original.length ) throw new Error( 'Character is out of bounds' );\n\t\tif ( start > end ) throw new Error( 'end must be greater than start' );\n\n\t\treturn this.overwrite( start, end, '', false );\n\t},\n\n\tslice: function slice ( start, end ) {\n\t\tvar this$1 = this;\n\t\tif ( start === void 0 ) start = 0;\n\t\tif ( end === void 0 ) end = this.original.length;\n\n\t\twhile ( start < 0 ) start += this$1.original.length;\n\t\twhile ( end < 0 ) end += this$1.original.length;\n\n\t\tvar result = '';\n\n\t\t// find start chunk\n\t\tvar chunk = this.firstChunk;\n\t\twhile ( chunk && ( chunk.start > start || chunk.end <= start ) ) {\n\n\t\t\t// found end chunk before start\n\t\t\tif ( chunk.start < end && chunk.end >= end ) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tif ( chunk && chunk.edited && chunk.start !== start ) throw new Error((\"Cannot use replaced character \" + start + \" as slice start anchor.\"));\n\n\t\tvar startChunk = chunk;\n\t\twhile ( chunk ) {\n\t\t\tif ( chunk.intro && ( startChunk !== chunk || chunk.start === start ) ) {\n\t\t\t\tresult += chunk.intro;\n\t\t\t}\n\n\t\t\tvar containsEnd = chunk.start < end && chunk.end >= end;\n\t\t\tif ( containsEnd && chunk.edited && chunk.end !== end ) throw new Error((\"Cannot use replaced character \" + end + \" as slice end anchor.\"));\n\n\t\t\tvar sliceStart = startChunk === chunk ? start - chunk.start : 0;\n\t\t\tvar sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;\n\n\t\t\tresult += chunk.content.slice( sliceStart, sliceEnd );\n\n\t\t\tif ( chunk.outro && ( !containsEnd || chunk.end === end ) ) {\n\t\t\t\tresult += chunk.outro;\n\t\t\t}\n\n\t\t\tif ( containsEnd ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn result;\n\t},\n\n\t// TODO deprecate this? not really very useful\n\tsnip: function snip ( start, end ) {\n\t\tvar clone = this.clone();\n\t\tclone.remove( 0, start );\n\t\tclone.remove( end, clone.original.length );\n\n\t\treturn clone;\n\t},\n\n\t_split: function _split ( index ) {\n\t\tvar this$1 = this;\n\n\t\tif ( this.byStart[ index ] || this.byEnd[ index ] ) return;\n\n\t\tif ( false ) {}\n\n\t\tvar chunk = this.lastSearchedChunk;\n\t\tvar searchForward = index > chunk.end;\n\n\t\twhile ( true ) {\n\t\t\tif ( chunk.contains( index ) ) return this$1._splitChunk( chunk, index );\n\n\t\t\tchunk = searchForward ?\n\t\t\t\tthis$1.byStart[ chunk.end ] :\n\t\t\t\tthis$1.byEnd[ chunk.start ];\n\t\t}\n\t},\n\n\t_splitChunk: function _splitChunk ( chunk, index ) {\n\t\tif ( chunk.edited && chunk.content.length ) { // zero-length edited chunks are a special case (overlapping replacements)\n\t\t\tvar loc = getLocator( this.original )( index );\n\t\t\tthrow new Error( (\"Cannot split a chunk that has already been edited (\" + (loc.line) + \":\" + (loc.column) + \" – \\\"\" + (chunk.original) + \"\\\")\") );\n\t\t}\n\n\t\tvar newChunk = chunk.split( index );\n\n\t\tthis.byEnd[ index ] = chunk;\n\t\tthis.byStart[ index ] = newChunk;\n\t\tthis.byEnd[ newChunk.end ] = newChunk;\n\n\t\tif ( chunk === this.lastChunk ) this.lastChunk = newChunk;\n\n\t\tthis.lastSearchedChunk = chunk;\n\t\tif ( false ) {}\n\t\treturn true;\n\t},\n\n\ttoString: function toString () {\n\t\tvar str = this.intro;\n\n\t\tvar chunk = this.firstChunk;\n\t\twhile ( chunk ) {\n\t\t\tstr += chunk.toString();\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn str + this.outro;\n\t},\n\n\ttrimLines: function trimLines () {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t},\n\n\ttrim: function trim ( charType ) {\n\t\treturn this.trimStart( charType ).trimEnd( charType );\n\t},\n\n\ttrimEnd: function trimEnd ( charType ) {\n\t\tvar this$1 = this;\n\n\t\tvar rx = new RegExp( ( charType || '\\\\s' ) + '+$' );\n\n\t\tthis.outro = this.outro.replace( rx, '' );\n\t\tif ( this.outro.length ) return this;\n\n\t\tvar chunk = this.lastChunk;\n\n\t\tdo {\n\t\t\tvar end = chunk.end;\n\t\t\tvar aborted = chunk.trimEnd( rx );\n\n\t\t\t// if chunk was trimmed, we have a new lastChunk\n\t\t\tif ( chunk.end !== end ) {\n\t\t\t\tthis$1.lastChunk = chunk.next;\n\n\t\t\t\tthis$1.byEnd[ chunk.end ] = chunk;\n\t\t\t\tthis$1.byStart[ chunk.next.start ] = chunk.next;\n\t\t\t}\n\n\t\t\tif ( aborted ) return this$1;\n\t\t\tchunk = chunk.previous;\n\t\t} while ( chunk );\n\n\t\treturn this;\n\t},\n\n\ttrimStart: function trimStart ( charType ) {\n\t\tvar this$1 = this;\n\n\t\tvar rx = new RegExp( '^' + ( charType || '\\\\s' ) + '+' );\n\n\t\tthis.intro = this.intro.replace( rx, '' );\n\t\tif ( this.intro.length ) return this;\n\n\t\tvar chunk = this.firstChunk;\n\n\t\tdo {\n\t\t\tvar end = chunk.end;\n\t\t\tvar aborted = chunk.trimStart( rx );\n\n\t\t\tif ( chunk.end !== end ) {\n\t\t\t\t// special case...\n\t\t\t\tif ( chunk === this$1.lastChunk ) this$1.lastChunk = chunk.next;\n\n\t\t\t\tthis$1.byEnd[ chunk.end ] = chunk;\n\t\t\t\tthis$1.byStart[ chunk.next.start ] = chunk.next;\n\t\t\t}\n\n\t\t\tif ( aborted ) return this$1;\n\t\t\tchunk = chunk.next;\n\t\t} while ( chunk );\n\n\t\treturn this;\n\t}\n};\n\nvar hasOwnProp = Object.prototype.hasOwnProperty;\n\nfunction Bundle ( options ) {\n\tif ( options === void 0 ) options = {};\n\n\tthis.intro = options.intro || '';\n\tthis.separator = options.separator !== undefined ? options.separator : '\\n';\n\n\tthis.sources = [];\n\n\tthis.uniqueSources = [];\n\tthis.uniqueSourceIndexByFilename = {};\n}\n\nBundle.prototype = {\n\taddSource: function addSource ( source ) {\n\t\tif ( source instanceof MagicString ) {\n\t\t\treturn this.addSource({\n\t\t\t\tcontent: source,\n\t\t\t\tfilename: source.filename,\n\t\t\t\tseparator: this.separator\n\t\t\t});\n\t\t}\n\n\t\tif ( !isObject( source ) || !source.content ) {\n\t\t\tthrow new Error( 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`' );\n\t\t}\n\n\t\t[ 'filename', 'indentExclusionRanges', 'separator' ].forEach( function (option) {\n\t\t\tif ( !hasOwnProp.call( source, option ) ) source[ option ] = source.content[ option ];\n\t\t});\n\n\t\tif ( source.separator === undefined ) { // TODO there's a bunch of this sort of thing, needs cleaning up\n\t\t\tsource.separator = this.separator;\n\t\t}\n\n\t\tif ( source.filename ) {\n\t\t\tif ( !hasOwnProp.call( this.uniqueSourceIndexByFilename, source.filename ) ) {\n\t\t\t\tthis.uniqueSourceIndexByFilename[ source.filename ] = this.uniqueSources.length;\n\t\t\t\tthis.uniqueSources.push({ filename: source.filename, content: source.content.original });\n\t\t\t} else {\n\t\t\t\tvar uniqueSource = this.uniqueSources[ this.uniqueSourceIndexByFilename[ source.filename ] ];\n\t\t\t\tif ( source.content.original !== uniqueSource.content ) {\n\t\t\t\t\tthrow new Error( (\"Illegal source: same filename (\" + (source.filename) + \"), different contents\") );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.sources.push( source );\n\t\treturn this;\n\t},\n\n\tappend: function append ( str, options ) {\n\t\tthis.addSource({\n\t\t\tcontent: new MagicString( str ),\n\t\t\tseparator: ( options && options.separator ) || ''\n\t\t});\n\n\t\treturn this;\n\t},\n\n\tclone: function clone () {\n\t\tvar bundle = new Bundle({\n\t\t\tintro: this.intro,\n\t\t\tseparator: this.separator\n\t\t});\n\n\t\tthis.sources.forEach( function (source) {\n\t\t\tbundle.addSource({\n\t\t\t\tfilename: source.filename,\n\t\t\t\tcontent: source.content.clone(),\n\t\t\t\tseparator: source.separator\n\t\t\t});\n\t\t});\n\n\t\treturn bundle;\n\t},\n\n\tgenerateMap: function generateMap ( options ) {\n\t\tvar this$1 = this;\n\n\t\tvar offsets = {};\n\n\t\tvar names = [];\n\t\tthis.sources.forEach( function (source) {\n\t\t\tObject.keys( source.content.storedNames ).forEach( function (name) {\n\t\t\t\tif ( !~names.indexOf( name ) ) names.push( name );\n\t\t\t});\n\t\t});\n\n\t\tvar encoded = (\n\t\t\tgetSemis( this.intro ) +\n\t\t\tthis.sources.map( function ( source, i ) {\n\t\t\t\tvar prefix = ( i > 0 ) ? ( getSemis( source.separator ) || ',' ) : '';\n\t\t\t\tvar mappings;\n\n\t\t\t\t// we don't bother encoding sources without a filename\n\t\t\t\tif ( !source.filename ) {\n\t\t\t\t\tmappings = getSemis( source.content.toString() );\n\t\t\t\t} else {\n\t\t\t\t\tvar sourceIndex = this$1.uniqueSourceIndexByFilename[ source.filename ];\n\t\t\t\t\tmappings = source.content.getMappings( options.hires, sourceIndex, offsets, names );\n\t\t\t\t}\n\n\t\t\t\treturn prefix + mappings;\n\t\t\t}).join( '' )\n\t\t);\n\n\t\treturn new SourceMap({\n\t\t\tfile: ( options.file ? options.file.split( /[\\/\\\\]/ ).pop() : null ),\n\t\t\tsources: this.uniqueSources.map( function (source) {\n\t\t\t\treturn options.file ? getRelativePath( options.file, source.filename ) : source.filename;\n\t\t\t}),\n\t\t\tsourcesContent: this.uniqueSources.map( function (source) {\n\t\t\t\treturn options.includeContent ? source.content : null;\n\t\t\t}),\n\t\t\tnames: names,\n\t\t\tmappings: encoded\n\t\t});\n\t},\n\n\tgetIndentString: function getIndentString () {\n\t\tvar indentStringCounts = {};\n\n\t\tthis.sources.forEach( function (source) {\n\t\t\tvar indentStr = source.content.indentStr;\n\n\t\t\tif ( indentStr === null ) return;\n\n\t\t\tif ( !indentStringCounts[ indentStr ] ) indentStringCounts[ indentStr ] = 0;\n\t\t\tindentStringCounts[ indentStr ] += 1;\n\t\t});\n\n\t\treturn ( Object.keys( indentStringCounts ).sort( function ( a, b ) {\n\t\t\treturn indentStringCounts[a] - indentStringCounts[b];\n\t\t})[0] ) || '\\t';\n\t},\n\n\tindent: function indent ( indentStr ) {\n\t\tvar this$1 = this;\n\n\t\tif ( !arguments.length ) {\n\t\t\tindentStr = this.getIndentString();\n\t\t}\n\n\t\tif ( indentStr === '' ) return this; // noop\n\n\t\tvar trailingNewline = !this.intro || this.intro.slice( -1 ) === '\\n';\n\n\t\tthis.sources.forEach( function ( source, i ) {\n\t\t\tvar separator = source.separator !== undefined ? source.separator : this$1.separator;\n\t\t\tvar indentStart = trailingNewline || ( i > 0 && /\\r?\\n$/.test( separator ) );\n\n\t\t\tsource.content.indent( indentStr, {\n\t\t\t\texclude: source.indentExclusionRanges,\n\t\t\t\tindentStart: indentStart//: trailingNewline || /\\r?\\n$/.test( separator ) //true///\\r?\\n/.test( separator )\n\t\t\t});\n\n\t\t\t// TODO this is a very slow way to determine this\n\t\t\ttrailingNewline = source.content.toString().slice( 0, -1 ) === '\\n';\n\t\t});\n\n\t\tif ( this.intro ) {\n\t\t\tthis.intro = indentStr + this.intro.replace( /^[^\\n]/gm, function ( match, index ) {\n\t\t\t\treturn index > 0 ? indentStr + match : match;\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tprepend: function prepend ( str ) {\n\t\tthis.intro = str + this.intro;\n\t\treturn this;\n\t},\n\n\ttoString: function toString () {\n\t\tvar this$1 = this;\n\n\t\tvar body = this.sources.map( function ( source, i ) {\n\t\t\tvar separator = source.separator !== undefined ? source.separator : this$1.separator;\n\t\t\tvar str = ( i > 0 ? separator : '' ) + source.content.toString();\n\n\t\t\treturn str;\n\t\t}).join( '' );\n\n\t\treturn this.intro + body;\n\t},\n\n\ttrimLines: function trimLines () {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t},\n\n\ttrim: function trim ( charType ) {\n\t\treturn this.trimStart( charType ).trimEnd( charType );\n\t},\n\n\ttrimStart: function trimStart ( charType ) {\n\t\tvar this$1 = this;\n\n\t\tvar rx = new RegExp( '^' + ( charType || '\\\\s' ) + '+' );\n\t\tthis.intro = this.intro.replace( rx, '' );\n\n\t\tif ( !this.intro ) {\n\t\t\tvar source;\n\t\t\tvar i = 0;\n\n\t\t\tdo {\n\t\t\t\tsource = this$1.sources[i];\n\n\t\t\t\tif ( !source ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tsource.content.trimStart( charType );\n\t\t\t\ti += 1;\n\t\t\t} while ( source.content.toString() === '' ); // TODO faster way to determine non-empty source?\n\t\t}\n\n\t\treturn this;\n\t},\n\n\ttrimEnd: function trimEnd ( charType ) {\n\t\tvar this$1 = this;\n\n\t\tvar rx = new RegExp( ( charType || '\\\\s' ) + '+$' );\n\n\t\tvar source;\n\t\tvar i = this.sources.length - 1;\n\n\t\tdo {\n\t\t\tsource = this$1.sources[i];\n\n\t\t\tif ( !source ) {\n\t\t\t\tthis$1.intro = this$1.intro.replace( rx, '' );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tsource.content.trimEnd( charType );\n\t\t\ti -= 1;\n\t\t} while ( source.content.toString() === '' ); // TODO faster way to determine non-empty source?\n\n\t\treturn this;\n\t}\n};\n\nfunction getSemis ( str ) {\n\treturn new Array( str.split( '\\n' ).length ).join( ';' );\n}\n\nexport { Bundle };export default MagicString;\n//# sourceMappingURL=magic-string.es6.js.map","// Return the first non-falsy result from an array of\n// maybe-sync, maybe-promise-returning functions\nexport default function first ( candidates ) {\n\treturn function ( ...args ) {\n\t\treturn candidates.reduce( ( promise, candidate ) => {\n\t\t\treturn promise.then( result => result != null ?\n\t\t\t\tresult :\n\t\t\t\tPromise.resolve( candidate( ...args ) ) );\n\t\t}, Promise.resolve() );\n\t};\n}\n","export function find ( array, fn ) {\n\tfor ( let i = 0; i < array.length; i += 1 ) {\n\t\tif ( fn( array[i], i ) ) return array[i];\n\t}\n\n\treturn null;\n}\n","// Reserved word lists for various dialects of the language\n\nexport const reservedWords = {\n 3: \"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile\",\n 5: \"class enum extends super const export import\",\n 6: \"enum\",\n strict: \"implements interface let package private protected public static yield\",\n strictBind: \"eval arguments\"\n}\n\n// And the keywords\n\nvar ecma5AndLessKeywords = \"break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this\"\n\nexport const keywords = {\n 5: ecma5AndLessKeywords,\n 6: ecma5AndLessKeywords + \" const class extends export import super\"\n}\n\n// ## Character categories\n\n// Big ugly regular expressions that match characters in the\n// whitespace, identifier, and identifier-start categories. These\n// are only applied when a character is found to actually have a\n// code point above 128.\n// Generated by `bin/generate-identifier-regex.js`.\n\nlet nonASCIIidentifierStartChars = \"\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0-\\u08b4\\u08b6-\\u08bd\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0af9\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d\\u0c58-\\u0c5a\\u0c60\\u0c61\\u0c80\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d54-\\u0d56\\u0d5f-\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c88\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fd5\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7ae\\ua7b0-\\ua7b7\\ua7f7-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab65\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\"\nlet nonASCIIidentifierChars = \"\\u200c\\u200d\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u08d4-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c03\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0d01-\\u0d03\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf2-\\u1cf4\\u1cf8\\u1cf9\\u1dc0-\\u1df5\\u1dfb-\\u1dff\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua900-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\"\n\nconst nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\")\nconst nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\")\n\nnonASCIIidentifierStartChars = nonASCIIidentifierChars = null\n\n// These are a run-length and offset encoded representation of the\n// >0xffff code points that are a valid part of identifiers. The\n// offset starts at 0x10000, and each pair of numbers represents an\n// offset to the next range, and then a size of the range. They were\n// generated by bin/generate-identifier-regex.js\nconst astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541]\nconst astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239]\n\n// This has a complexity linear to the value of the code. The\n// assumption is that looking up astral identifier characters is\n// rare.\nfunction isInAstralSet(code, set) {\n let pos = 0x10000\n for (let i = 0; i < set.length; i += 2) {\n pos += set[i]\n if (pos > code) return false\n pos += set[i + 1]\n if (pos >= code) return true\n }\n}\n\n// Test whether a given character code starts an identifier.\n\nexport function isIdentifierStart(code, astral) {\n if (code < 65) return code === 36\n if (code < 91) return true\n if (code < 97) return code === 95\n if (code < 123) return true\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))\n if (astral === false) return false\n return isInAstralSet(code, astralIdentifierStartCodes)\n}\n\n// Test whether a given character is part of an identifier.\n\nexport function isIdentifierChar(code, astral) {\n if (code < 48) return code === 36\n if (code < 58) return true\n if (code < 65) return false\n if (code < 91) return true\n if (code < 97) return code === 95\n if (code < 123) return true\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code))\n if (astral === false) return false\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)\n}\n","// ## Token types\n\n// The assignment of fine-grained, information-carrying type objects\n// allows the tokenizer to store the information it has about a\n// token in a way that is very cheap for the parser to look up.\n\n// All token type variables start with an underscore, to make them\n// easy to recognize.\n\n// The `beforeExpr` property is used to disambiguate between regular\n// expressions and divisions. It is set on all token types that can\n// be followed by an expression (thus, a slash after them would be a\n// regular expression).\n//\n// The `startsExpr` property is used to check if the token ends a\n// `yield` expression. It is set on all token types that either can\n// directly start an expression (like a quotation mark) or can\n// continue an expression (like the body of a string).\n//\n// `isLoop` marks a keyword as starting a loop, which is important\n// to know when parsing a label, in order to allow or disallow\n// continue jumps to that label.\n\nexport class TokenType {\n constructor(label, conf = {}) {\n this.label = label\n this.keyword = conf.keyword\n this.beforeExpr = !!conf.beforeExpr\n this.startsExpr = !!conf.startsExpr\n this.isLoop = !!conf.isLoop\n this.isAssign = !!conf.isAssign\n this.prefix = !!conf.prefix\n this.postfix = !!conf.postfix\n this.binop = conf.binop || null\n this.updateContext = null\n }\n}\n\nfunction binop(name, prec) {\n return new TokenType(name, {beforeExpr: true, binop: prec})\n}\nconst beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true}\n\n// Map keyword names to token types.\n\nexport const keywords = {}\n\n// Succinct definitions of keyword token types\nfunction kw(name, options = {}) {\n options.keyword = name\n return keywords[name] = new TokenType(name, options)\n}\n\nexport const types = {\n num: new TokenType(\"num\", startsExpr),\n regexp: new TokenType(\"regexp\", startsExpr),\n string: new TokenType(\"string\", startsExpr),\n name: new TokenType(\"name\", startsExpr),\n eof: new TokenType(\"eof\"),\n\n // Punctuation token types.\n bracketL: new TokenType(\"[\", {beforeExpr: true, startsExpr: true}),\n bracketR: new TokenType(\"]\"),\n braceL: new TokenType(\"{\", {beforeExpr: true, startsExpr: true}),\n braceR: new TokenType(\"}\"),\n parenL: new TokenType(\"(\", {beforeExpr: true, startsExpr: true}),\n parenR: new TokenType(\")\"),\n comma: new TokenType(\",\", beforeExpr),\n semi: new TokenType(\";\", beforeExpr),\n colon: new TokenType(\":\", beforeExpr),\n dot: new TokenType(\".\"),\n question: new TokenType(\"?\", beforeExpr),\n arrow: new TokenType(\"=>\", beforeExpr),\n template: new TokenType(\"template\"),\n ellipsis: new TokenType(\"...\", beforeExpr),\n backQuote: new TokenType(\"`\", startsExpr),\n dollarBraceL: new TokenType(\"${\", {beforeExpr: true, startsExpr: true}),\n\n // Operators. These carry several kinds of properties to help the\n // parser use them properly (the presence of these properties is\n // what categorizes them as operators).\n //\n // `binop`, when present, specifies that this operator is a binary\n // operator, and will refer to its precedence.\n //\n // `prefix` and `postfix` mark the operator as a prefix or postfix\n // unary operator.\n //\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\n // binary operators with a very low precedence, that should result\n // in AssignmentExpression nodes.\n\n eq: new TokenType(\"=\", {beforeExpr: true, isAssign: true}),\n assign: new TokenType(\"_=\", {beforeExpr: true, isAssign: true}),\n incDec: new TokenType(\"++/--\", {prefix: true, postfix: true, startsExpr: true}),\n prefix: new TokenType(\"prefix\", {beforeExpr: true, prefix: true, startsExpr: true}),\n logicalOR: binop(\"||\", 1),\n logicalAND: binop(\"&&\", 2),\n bitwiseOR: binop(\"|\", 3),\n bitwiseXOR: binop(\"^\", 4),\n bitwiseAND: binop(\"&\", 5),\n equality: binop(\"==/!=\", 6),\n relational: binop(\"\", 7),\n bitShift: binop(\"<>\", 8),\n plusMin: new TokenType(\"+/-\", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),\n modulo: binop(\"%\", 10),\n star: binop(\"*\", 10),\n slash: binop(\"/\", 10),\n starstar: new TokenType(\"**\", {beforeExpr: true}),\n\n // Keyword token types.\n _break: kw(\"break\"),\n _case: kw(\"case\", beforeExpr),\n _catch: kw(\"catch\"),\n _continue: kw(\"continue\"),\n _debugger: kw(\"debugger\"),\n _default: kw(\"default\", beforeExpr),\n _do: kw(\"do\", {isLoop: true, beforeExpr: true}),\n _else: kw(\"else\", beforeExpr),\n _finally: kw(\"finally\"),\n _for: kw(\"for\", {isLoop: true}),\n _function: kw(\"function\", startsExpr),\n _if: kw(\"if\"),\n _return: kw(\"return\", beforeExpr),\n _switch: kw(\"switch\"),\n _throw: kw(\"throw\", beforeExpr),\n _try: kw(\"try\"),\n _var: kw(\"var\"),\n _const: kw(\"const\"),\n _while: kw(\"while\", {isLoop: true}),\n _with: kw(\"with\"),\n _new: kw(\"new\", {beforeExpr: true, startsExpr: true}),\n _this: kw(\"this\", startsExpr),\n _super: kw(\"super\", startsExpr),\n _class: kw(\"class\"),\n _extends: kw(\"extends\", beforeExpr),\n _export: kw(\"export\"),\n _import: kw(\"import\"),\n _null: kw(\"null\", startsExpr),\n _true: kw(\"true\", startsExpr),\n _false: kw(\"false\", startsExpr),\n _in: kw(\"in\", {beforeExpr: true, binop: 7}),\n _instanceof: kw(\"instanceof\", {beforeExpr: true, binop: 7}),\n _typeof: kw(\"typeof\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _void: kw(\"void\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _delete: kw(\"delete\", {beforeExpr: true, prefix: true, startsExpr: true})\n}\n","// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\n\nexport const lineBreak = /\\r\\n?|\\n|\\u2028|\\u2029/\nexport const lineBreakG = new RegExp(lineBreak.source, \"g\")\n\nexport function isNewLine(code) {\n return code === 10 || code === 13 || code === 0x2028 || code === 0x2029\n}\n\nexport const nonASCIIwhitespace = /[\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/\n\nexport const skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g\n","export function isArray(obj) {\n return Object.prototype.toString.call(obj) === \"[object Array]\"\n}\n\n// Checks if an object has a property.\n\nexport function has(obj, propName) {\n return Object.prototype.hasOwnProperty.call(obj, propName)\n}\n","import {lineBreakG} from \"./whitespace\"\n\n// These are used when `options.locations` is on, for the\n// `startLoc` and `endLoc` properties.\n\nexport class Position {\n constructor(line, col) {\n this.line = line\n this.column = col\n }\n\n offset(n) {\n return new Position(this.line, this.column + n)\n }\n}\n\nexport class SourceLocation {\n constructor(p, start, end) {\n this.start = start\n this.end = end\n if (p.sourceFile !== null) this.source = p.sourceFile\n }\n}\n\n// The `getLineInfo` function is mostly useful when the\n// `locations` option is off (for performance reasons) and you\n// want to find the line/column position for a given character\n// offset. `input` should be the code string that the offset refers\n// into.\n\nexport function getLineInfo(input, offset) {\n for (let line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n let match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}\n","import {has, isArray} from \"./util\"\nimport {SourceLocation} from \"./locutil\"\n\n// A second optional argument can be given to further configure\n// the parser process. These options are recognized:\n\nexport const defaultOptions = {\n // `ecmaVersion` indicates the ECMAScript version to parse. Must\n // be either 3, 5, 6 (2015), 7 (2016), or 8 (2017). This influences support\n // for strict mode, the set of reserved words, and support for\n // new syntax features. The default is 7.\n ecmaVersion: 7,\n // `sourceType` indicates the mode the code should be parsed in.\n // Can be either `\"script\"` or `\"module\"`. This influences global\n // strict mode and parsing of `import` and `export` declarations.\n sourceType: \"script\",\n // `onInsertedSemicolon` can be a callback that will be called\n // when a semicolon is automatically inserted. It will be passed\n // th position of the comma as an offset, and if `locations` is\n // enabled, it is given the location as a `{line, column}` object\n // as second argument.\n onInsertedSemicolon: null,\n // `onTrailingComma` is similar to `onInsertedSemicolon`, but for\n // trailing commas.\n onTrailingComma: null,\n // By default, reserved words are only enforced if ecmaVersion >= 5.\n // Set `allowReserved` to a boolean value to explicitly turn this on\n // an off. When this option has the value \"never\", reserved words\n // and keywords can also not be used as property names.\n allowReserved: null,\n // When enabled, a return at the top level is not considered an\n // error.\n allowReturnOutsideFunction: false,\n // When enabled, import/export statements are not constrained to\n // appearing at the top of the program.\n allowImportExportEverywhere: false,\n // When enabled, hashbang directive in the beginning of file\n // is allowed and treated as a line comment.\n allowHashBang: false,\n // When `locations` is on, `loc` properties holding objects with\n // `start` and `end` properties in `{line, column}` form (with\n // line being 1-based and column 0-based) will be attached to the\n // nodes.\n locations: false,\n // A function can be passed as `onToken` option, which will\n // cause Acorn to call that function with object in the same\n // format as tokens returned from `tokenizer().getToken()`. Note\n // that you are not allowed to call the parser from the\n // callback—that will corrupt its internal state.\n onToken: null,\n // A function can be passed as `onComment` option, which will\n // cause Acorn to call that function with `(block, text, start,\n // end)` parameters whenever a comment is skipped. `block` is a\n // boolean indicating whether this is a block (`/* */`) comment,\n // `text` is the content of the comment, and `start` and `end` are\n // character offsets that denote the start and end of the comment.\n // When the `locations` option is on, two more parameters are\n // passed, the full `{line, column}` locations of the start and\n // end of the comments. Note that you are not allowed to call the\n // parser from the callback—that will corrupt its internal state.\n onComment: null,\n // Nodes have their start and end characters offsets recorded in\n // `start` and `end` properties (directly on the node, rather than\n // the `loc` object, which holds line/column data. To also add a\n // [semi-standardized][range] `range` property holding a `[start,\n // end]` array with the same numbers, set the `ranges` option to\n // `true`.\n //\n // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\n ranges: false,\n // It is possible to parse multiple files into a single AST by\n // passing the tree produced by parsing the first file as\n // `program` option in subsequent parses. This will add the\n // toplevel forms of the parsed file to the `Program` (top) node\n // of an existing parse tree.\n program: null,\n // When `locations` is on, you can pass this to record the source\n // file in every node's `loc` object.\n sourceFile: null,\n // This value, if given, is stored in every node, whether\n // `locations` is on or off.\n directSourceFile: null,\n // When enabled, parenthesized expressions are represented by\n // (non-standard) ParenthesizedExpression nodes\n preserveParens: false,\n plugins: {}\n}\n\n// Interpret and default an options object\n\nexport function getOptions(opts) {\n let options = {}\n\n for (let opt in defaultOptions)\n options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]\n\n if (options.ecmaVersion >= 2015)\n options.ecmaVersion -= 2009\n\n if (options.allowReserved == null)\n options.allowReserved = options.ecmaVersion < 5\n\n if (isArray(options.onToken)) {\n let tokens = options.onToken\n options.onToken = (token) => tokens.push(token)\n }\n if (isArray(options.onComment))\n options.onComment = pushComment(options, options.onComment)\n\n return options\n}\n\nfunction pushComment(options, array) {\n return function (block, text, start, end, startLoc, endLoc) {\n let comment = {\n type: block ? 'Block' : 'Line',\n value: text,\n start: start,\n end: end\n }\n if (options.locations)\n comment.loc = new SourceLocation(this, startLoc, endLoc)\n if (options.ranges)\n comment.range = [start, end]\n array.push(comment)\n }\n}\n\n","import {reservedWords, keywords} from \"./identifier\"\nimport {types as tt} from \"./tokentype\"\nimport {lineBreak} from \"./whitespace\"\nimport {getOptions} from \"./options\"\n\n// Registered plugins\nexport const plugins = {}\n\nfunction keywordRegexp(words) {\n return new RegExp(\"^(\" + words.replace(/ /g, \"|\") + \")$\")\n}\n\nexport class Parser {\n constructor(options, input, startPos) {\n this.options = options = getOptions(options)\n this.sourceFile = options.sourceFile\n this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])\n let reserved = \"\"\n if (!options.allowReserved) {\n for (let v = options.ecmaVersion;; v--)\n if (reserved = reservedWords[v]) break\n if (options.sourceType == \"module\") reserved += \" await\"\n }\n this.reservedWords = keywordRegexp(reserved)\n let reservedStrict = (reserved ? reserved + \" \" : \"\") + reservedWords.strict\n this.reservedWordsStrict = keywordRegexp(reservedStrict)\n this.reservedWordsStrictBind = keywordRegexp(reservedStrict + \" \" + reservedWords.strictBind)\n this.input = String(input)\n\n // Used to signal to callers of `readWord1` whether the word\n // contained any escape sequences. This is needed because words with\n // escape sequences must not be interpreted as keywords.\n this.containsEsc = false\n\n // Load plugins\n this.loadPlugins(options.plugins)\n\n // Set up token state\n\n // The current position of the tokenizer in the input.\n if (startPos) {\n this.pos = startPos\n this.lineStart = this.input.lastIndexOf(\"\\n\", startPos - 1) + 1\n this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length\n } else {\n this.pos = this.lineStart = 0\n this.curLine = 1\n }\n\n // Properties of the current token:\n // Its type\n this.type = tt.eof\n // For tokens that include more information than their type, the value\n this.value = null\n // Its start and end offset\n this.start = this.end = this.pos\n // And, if locations are used, the {line, column} object\n // corresponding to those offsets\n this.startLoc = this.endLoc = this.curPosition()\n\n // Position information for the previous token\n this.lastTokEndLoc = this.lastTokStartLoc = null\n this.lastTokStart = this.lastTokEnd = this.pos\n\n // The context stack is used to superficially track syntactic\n // context to predict whether a regular expression is allowed in a\n // given position.\n this.context = this.initialContext()\n this.exprAllowed = true\n\n // Figure out if it's a module code.\n this.strict = this.inModule = options.sourceType === \"module\"\n\n // Used to signify the start of a potential arrow function\n this.potentialArrowAt = -1\n\n // Flags to track whether we are in a function, a generator, an async function.\n this.inFunction = this.inGenerator = this.inAsync = false\n // Positions to delayed-check that yield/await does not exist in default parameters.\n this.yieldPos = this.awaitPos = 0\n // Labels in scope.\n this.labels = []\n\n // If enabled, skip leading hashbang line.\n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === '#!')\n this.skipLineComment(2)\n }\n\n // DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses them\n isKeyword(word) { return this.keywords.test(word) }\n isReservedWord(word) { return this.reservedWords.test(word) }\n\n extend(name, f) {\n this[name] = f(this[name])\n }\n\n loadPlugins(pluginConfigs) {\n for (let name in pluginConfigs) {\n let plugin = plugins[name]\n if (!plugin) throw new Error(\"Plugin '\" + name + \"' not found\")\n plugin(this, pluginConfigs[name])\n }\n }\n\n parse() {\n let node = this.options.program || this.startNode()\n this.nextToken()\n return this.parseTopLevel(node)\n }\n}\n","import {types as tt} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {lineBreak} from \"./whitespace\"\n\nconst pp = Parser.prototype\n\n// ## Parser utilities\n\n// Test whether a statement node is the string literal `\"use strict\"`.\n\npp.isUseStrict = function(stmt) {\n return this.options.ecmaVersion >= 5 && stmt.type === \"ExpressionStatement\" &&\n stmt.expression.type === \"Literal\" &&\n stmt.expression.raw.slice(1, -1) === \"use strict\"\n}\n\n// Predicate that tests whether the next token is of the given\n// type, and if yes, consumes it as a side effect.\n\npp.eat = function(type) {\n if (this.type === type) {\n this.next()\n return true\n } else {\n return false\n }\n}\n\n// Tests whether parsed token is a contextual keyword.\n\npp.isContextual = function(name) {\n return this.type === tt.name && this.value === name\n}\n\n// Consumes contextual keyword if possible.\n\npp.eatContextual = function(name) {\n return this.value === name && this.eat(tt.name)\n}\n\n// Asserts that following token is given contextual keyword.\n\npp.expectContextual = function(name) {\n if (!this.eatContextual(name)) this.unexpected()\n}\n\n// Test whether a semicolon can be inserted at the current position.\n\npp.canInsertSemicolon = function() {\n return this.type === tt.eof ||\n this.type === tt.braceR ||\n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n}\n\npp.insertSemicolon = function() {\n if (this.canInsertSemicolon()) {\n if (this.options.onInsertedSemicolon)\n this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)\n return true\n }\n}\n\n// Consume a semicolon, or, failing that, see if we are allowed to\n// pretend that there is a semicolon at this position.\n\npp.semicolon = function() {\n if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()\n}\n\npp.afterTrailingComma = function(tokType, notNext) {\n if (this.type == tokType) {\n if (this.options.onTrailingComma)\n this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)\n if (!notNext)\n this.next()\n return true\n }\n}\n\n// Expect a token of a given type. If found, consume it, otherwise,\n// raise an unexpected token error.\n\npp.expect = function(type) {\n this.eat(type) || this.unexpected()\n}\n\n// Raise an unexpected token error.\n\npp.unexpected = function(pos) {\n this.raise(pos != null ? pos : this.start, \"Unexpected token\")\n}\n\nexport class DestructuringErrors {\n constructor() {\n this.shorthandAssign = 0\n this.trailingComma = 0\n }\n}\n\npp.checkPatternErrors = function(refDestructuringErrors, andThrow) {\n let trailing = refDestructuringErrors && refDestructuringErrors.trailingComma\n if (!andThrow) return !!trailing\n if (trailing) this.raise(trailing, \"Comma is not permitted after the rest element\")\n}\n\npp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {\n let pos = refDestructuringErrors && refDestructuringErrors.shorthandAssign\n if (!andThrow) return !!pos\n if (pos) this.raise(pos, \"Shorthand property assignments are valid only in destructuring patterns\")\n}\n\npp.checkYieldAwaitInDefaultParams = function() {\n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))\n this.raise(this.yieldPos, \"Yield expression cannot be a default value\")\n if (this.awaitPos)\n this.raise(this.awaitPos, \"Await expression cannot be a default value\")\n}\n","import {types as tt} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {lineBreak, skipWhiteSpace} from \"./whitespace\"\nimport {isIdentifierStart, isIdentifierChar} from \"./identifier\"\nimport {DestructuringErrors} from \"./parseutil\"\n\nconst pp = Parser.prototype\n\n// ### Statement parsing\n\n// Parse a program. Initializes the parser, reads any number of\n// statements, and wraps them in a Program node. Optionally takes a\n// `program` argument. If present, the statements will be appended\n// to its body instead of creating a new node.\n\npp.parseTopLevel = function(node) {\n let first = true, exports = {}\n if (!node.body) node.body = []\n while (this.type !== tt.eof) {\n let stmt = this.parseStatement(true, true, exports)\n node.body.push(stmt)\n if (first) {\n if (this.isUseStrict(stmt)) this.setStrict(true)\n first = false\n }\n }\n this.next()\n if (this.options.ecmaVersion >= 6) {\n node.sourceType = this.options.sourceType\n }\n return this.finishNode(node, \"Program\")\n}\n\nconst loopLabel = {kind: \"loop\"}, switchLabel = {kind: \"switch\"}\n\npp.isLet = function() {\n if (this.type !== tt.name || this.options.ecmaVersion < 6 || this.value != \"let\") return false\n skipWhiteSpace.lastIndex = this.pos\n let skip = skipWhiteSpace.exec(this.input)\n let next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next)\n if (nextCh === 91 || nextCh == 123) return true // '{' and '['\n if (isIdentifierStart(nextCh, true)) {\n for (var pos = next + 1; isIdentifierChar(this.input.charCodeAt(pos), true); ++pos) {}\n let ident = this.input.slice(next, pos)\n if (!this.isKeyword(ident)) return true\n }\n return false\n}\n\n// check 'async [no LineTerminator here] function'\n// - 'async /*foo*/ function' is OK.\n// - 'async /*\\n*/ function' is invalid.\npp.isAsyncFunction = function() {\n if (this.type !== tt.name || this.options.ecmaVersion < 8 || this.value != \"async\")\n return false\n\n skipWhiteSpace.lastIndex = this.pos\n let skip = skipWhiteSpace.exec(this.input)\n let next = this.pos + skip[0].length\n return !lineBreak.test(this.input.slice(this.pos, next)) &&\n this.input.slice(next, next + 8) === \"function\" &&\n (next + 8 == this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))\n}\n\n// Parse a single statement.\n//\n// If expecting a statement and finding a slash operator, parse a\n// regular expression literal. This is to handle cases like\n// `if (foo) /blah/.exec(foo)`, where looking at the previous token\n// does not help.\n\npp.parseStatement = function(declaration, topLevel, exports) {\n let starttype = this.type, node = this.startNode(), kind\n\n if (this.isLet()) {\n starttype = tt._var\n kind = \"let\"\n }\n\n // Most types of statements are recognized by the keyword they\n // start with. Many are trivial to parse, some require a bit of\n // complexity.\n\n switch (starttype) {\n case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)\n case tt._debugger: return this.parseDebuggerStatement(node)\n case tt._do: return this.parseDoStatement(node)\n case tt._for: return this.parseForStatement(node)\n case tt._function:\n if (!declaration && this.options.ecmaVersion >= 6) this.unexpected()\n return this.parseFunctionStatement(node, false)\n case tt._class:\n if (!declaration) this.unexpected()\n return this.parseClass(node, true)\n case tt._if: return this.parseIfStatement(node)\n case tt._return: return this.parseReturnStatement(node)\n case tt._switch: return this.parseSwitchStatement(node)\n case tt._throw: return this.parseThrowStatement(node)\n case tt._try: return this.parseTryStatement(node)\n case tt._const: case tt._var:\n kind = kind || this.value\n if (!declaration && kind != \"var\") this.unexpected()\n return this.parseVarStatement(node, kind)\n case tt._while: return this.parseWhileStatement(node)\n case tt._with: return this.parseWithStatement(node)\n case tt.braceL: return this.parseBlock()\n case tt.semi: return this.parseEmptyStatement(node)\n case tt._export:\n case tt._import:\n if (!this.options.allowImportExportEverywhere) {\n if (!topLevel)\n this.raise(this.start, \"'import' and 'export' may only appear at the top level\")\n if (!this.inModule)\n this.raise(this.start, \"'import' and 'export' may appear only with 'sourceType: module'\")\n }\n return starttype === tt._import ? this.parseImport(node) : this.parseExport(node, exports)\n\n // If the statement does not start with a statement keyword or a\n // brace, it's an ExpressionStatement or LabeledStatement. We\n // simply start parsing an expression, and afterwards, if the\n // next token is a colon and the expression was a simple\n // Identifier node, we switch to interpreting it as a label.\n default:\n if (this.isAsyncFunction() && declaration) {\n this.next()\n return this.parseFunctionStatement(node, true)\n }\n\n let maybeName = this.value, expr = this.parseExpression()\n if (starttype === tt.name && expr.type === \"Identifier\" && this.eat(tt.colon))\n return this.parseLabeledStatement(node, maybeName, expr)\n else return this.parseExpressionStatement(node, expr)\n }\n}\n\npp.parseBreakContinueStatement = function(node, keyword) {\n let isBreak = keyword == \"break\"\n this.next()\n if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null\n else if (this.type !== tt.name) this.unexpected()\n else {\n node.label = this.parseIdent()\n this.semicolon()\n }\n\n // Verify that there is an actual destination to break or\n // continue to.\n for (var i = 0; i < this.labels.length; ++i) {\n let lab = this.labels[i]\n if (node.label == null || lab.name === node.label.name) {\n if (lab.kind != null && (isBreak || lab.kind === \"loop\")) break\n if (node.label && isBreak) break\n }\n }\n if (i === this.labels.length) this.raise(node.start, \"Unsyntactic \" + keyword)\n return this.finishNode(node, isBreak ? \"BreakStatement\" : \"ContinueStatement\")\n}\n\npp.parseDebuggerStatement = function(node) {\n this.next()\n this.semicolon()\n return this.finishNode(node, \"DebuggerStatement\")\n}\n\npp.parseDoStatement = function(node) {\n this.next()\n this.labels.push(loopLabel)\n node.body = this.parseStatement(false)\n this.labels.pop()\n this.expect(tt._while)\n node.test = this.parseParenExpression()\n if (this.options.ecmaVersion >= 6)\n this.eat(tt.semi)\n else\n this.semicolon()\n return this.finishNode(node, \"DoWhileStatement\")\n}\n\n// Disambiguating between a `for` and a `for`/`in` or `for`/`of`\n// loop is non-trivial. Basically, we have to parse the init `var`\n// statement or expression, disallowing the `in` operator (see\n// the second parameter to `parseExpression`), and then check\n// whether the next token is `in` or `of`. When there is no init\n// part (semicolon immediately after the opening parenthesis), it\n// is a regular `for` loop.\n\npp.parseForStatement = function(node) {\n this.next()\n this.labels.push(loopLabel)\n this.expect(tt.parenL)\n if (this.type === tt.semi) return this.parseFor(node, null)\n let isLet = this.isLet()\n if (this.type === tt._var || this.type === tt._const || isLet) {\n let init = this.startNode(), kind = isLet ? \"let\" : this.value\n this.next()\n this.parseVar(init, true, kind)\n this.finishNode(init, \"VariableDeclaration\")\n if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) && init.declarations.length === 1 &&\n !(kind !== \"var\" && init.declarations[0].init))\n return this.parseForIn(node, init)\n return this.parseFor(node, init)\n }\n let refDestructuringErrors = new DestructuringErrors\n let init = this.parseExpression(true, refDestructuringErrors)\n if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) {\n this.checkPatternErrors(refDestructuringErrors, true)\n this.toAssignable(init)\n this.checkLVal(init)\n return this.parseForIn(node, init)\n } else {\n this.checkExpressionErrors(refDestructuringErrors, true)\n }\n return this.parseFor(node, init)\n}\n\npp.parseFunctionStatement = function(node, isAsync) {\n this.next()\n return this.parseFunction(node, true, false, isAsync)\n}\n\npp.isFunction = function() {\n return this.type === tt._function || this.isAsyncFunction()\n}\n\npp.parseIfStatement = function(node) {\n this.next()\n node.test = this.parseParenExpression()\n // allow function declarations in branches, but only in non-strict mode\n node.consequent = this.parseStatement(!this.strict && this.isFunction())\n node.alternate = this.eat(tt._else) ? this.parseStatement(!this.strict && this.isFunction()) : null\n return this.finishNode(node, \"IfStatement\")\n}\n\npp.parseReturnStatement = function(node) {\n if (!this.inFunction && !this.options.allowReturnOutsideFunction)\n this.raise(this.start, \"'return' outside of function\")\n this.next()\n\n // In `return` (and `break`/`continue`), the keywords with\n // optional arguments, we eagerly look for a semicolon or the\n // possibility to insert one.\n\n if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null\n else { node.argument = this.parseExpression(); this.semicolon() }\n return this.finishNode(node, \"ReturnStatement\")\n}\n\npp.parseSwitchStatement = function(node) {\n this.next()\n node.discriminant = this.parseParenExpression()\n node.cases = []\n this.expect(tt.braceL)\n this.labels.push(switchLabel)\n\n // Statements under must be grouped (by label) in SwitchCase\n // nodes. `cur` is used to keep the node that we are currently\n // adding statements to.\n\n for (var cur, sawDefault = false; this.type != tt.braceR;) {\n if (this.type === tt._case || this.type === tt._default) {\n let isCase = this.type === tt._case\n if (cur) this.finishNode(cur, \"SwitchCase\")\n node.cases.push(cur = this.startNode())\n cur.consequent = []\n this.next()\n if (isCase) {\n cur.test = this.parseExpression()\n } else {\n if (sawDefault) this.raiseRecoverable(this.lastTokStart, \"Multiple default clauses\")\n sawDefault = true\n cur.test = null\n }\n this.expect(tt.colon)\n } else {\n if (!cur) this.unexpected()\n cur.consequent.push(this.parseStatement(true))\n }\n }\n if (cur) this.finishNode(cur, \"SwitchCase\")\n this.next() // Closing brace\n this.labels.pop()\n return this.finishNode(node, \"SwitchStatement\")\n}\n\npp.parseThrowStatement = function(node) {\n this.next()\n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))\n this.raise(this.lastTokEnd, \"Illegal newline after throw\")\n node.argument = this.parseExpression()\n this.semicolon()\n return this.finishNode(node, \"ThrowStatement\")\n}\n\n// Reused empty array added for node fields that are always empty.\n\nconst empty = []\n\npp.parseTryStatement = function(node) {\n this.next()\n node.block = this.parseBlock()\n node.handler = null\n if (this.type === tt._catch) {\n let clause = this.startNode()\n this.next()\n this.expect(tt.parenL)\n clause.param = this.parseBindingAtom()\n this.checkLVal(clause.param, true)\n this.expect(tt.parenR)\n clause.body = this.parseBlock()\n node.handler = this.finishNode(clause, \"CatchClause\")\n }\n node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null\n if (!node.handler && !node.finalizer)\n this.raise(node.start, \"Missing catch or finally clause\")\n return this.finishNode(node, \"TryStatement\")\n}\n\npp.parseVarStatement = function(node, kind) {\n this.next()\n this.parseVar(node, false, kind)\n this.semicolon()\n return this.finishNode(node, \"VariableDeclaration\")\n}\n\npp.parseWhileStatement = function(node) {\n this.next()\n node.test = this.parseParenExpression()\n this.labels.push(loopLabel)\n node.body = this.parseStatement(false)\n this.labels.pop()\n return this.finishNode(node, \"WhileStatement\")\n}\n\npp.parseWithStatement = function(node) {\n if (this.strict) this.raise(this.start, \"'with' in strict mode\")\n this.next()\n node.object = this.parseParenExpression()\n node.body = this.parseStatement(false)\n return this.finishNode(node, \"WithStatement\")\n}\n\npp.parseEmptyStatement = function(node) {\n this.next()\n return this.finishNode(node, \"EmptyStatement\")\n}\n\npp.parseLabeledStatement = function(node, maybeName, expr) {\n for (let i = 0; i < this.labels.length; ++i)\n if (this.labels[i].name === maybeName) this.raise(expr.start, \"Label '\" + maybeName + \"' is already declared\")\n let kind = this.type.isLoop ? \"loop\" : this.type === tt._switch ? \"switch\" : null\n for (let i = this.labels.length - 1; i >= 0; i--) {\n let label = this.labels[i]\n if (label.statementStart == node.start) {\n label.statementStart = this.start\n label.kind = kind\n } else break\n }\n this.labels.push({name: maybeName, kind: kind, statementStart: this.start})\n node.body = this.parseStatement(true)\n this.labels.pop()\n node.label = expr\n return this.finishNode(node, \"LabeledStatement\")\n}\n\npp.parseExpressionStatement = function(node, expr) {\n node.expression = expr\n this.semicolon()\n return this.finishNode(node, \"ExpressionStatement\")\n}\n\n// Parse a semicolon-enclosed block of statements, handling `\"use\n// strict\"` declarations when `allowStrict` is true (used for\n// function bodies).\n\npp.parseBlock = function(allowStrict) {\n let node = this.startNode(), first = true, oldStrict\n node.body = []\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n let stmt = this.parseStatement(true)\n node.body.push(stmt)\n if (first && allowStrict && this.isUseStrict(stmt)) {\n oldStrict = this.strict\n this.setStrict(this.strict = true)\n }\n first = false\n }\n if (oldStrict === false) this.setStrict(false)\n return this.finishNode(node, \"BlockStatement\")\n}\n\n// Parse a regular `for` loop. The disambiguation code in\n// `parseStatement` will already have parsed the init statement or\n// expression.\n\npp.parseFor = function(node, init) {\n node.init = init\n this.expect(tt.semi)\n node.test = this.type === tt.semi ? null : this.parseExpression()\n this.expect(tt.semi)\n node.update = this.type === tt.parenR ? null : this.parseExpression()\n this.expect(tt.parenR)\n node.body = this.parseStatement(false)\n this.labels.pop()\n return this.finishNode(node, \"ForStatement\")\n}\n\n// Parse a `for`/`in` and `for`/`of` loop, which are almost\n// same from parser's perspective.\n\npp.parseForIn = function(node, init) {\n let type = this.type === tt._in ? \"ForInStatement\" : \"ForOfStatement\"\n this.next()\n node.left = init\n node.right = this.parseExpression()\n this.expect(tt.parenR)\n node.body = this.parseStatement(false)\n this.labels.pop()\n return this.finishNode(node, type)\n}\n\n// Parse a list of variable declarations.\n\npp.parseVar = function(node, isFor, kind) {\n node.declarations = []\n node.kind = kind\n for (;;) {\n let decl = this.startNode()\n this.parseVarId(decl)\n if (this.eat(tt.eq)) {\n decl.init = this.parseMaybeAssign(isFor)\n } else if (kind === \"const\" && !(this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\")))) {\n this.unexpected()\n } else if (decl.id.type != \"Identifier\" && !(isFor && (this.type === tt._in || this.isContextual(\"of\")))) {\n this.raise(this.lastTokEnd, \"Complex binding patterns require an initialization value\")\n } else {\n decl.init = null\n }\n node.declarations.push(this.finishNode(decl, \"VariableDeclarator\"))\n if (!this.eat(tt.comma)) break\n }\n return node\n}\n\npp.parseVarId = function(decl) {\n decl.id = this.parseBindingAtom()\n this.checkLVal(decl.id, true)\n}\n\n// Parse a function declaration or literal (depending on the\n// `isStatement` parameter).\n\npp.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {\n this.initFunction(node)\n if (this.options.ecmaVersion >= 6 && !isAsync)\n node.generator = this.eat(tt.star)\n if (this.options.ecmaVersion >= 8)\n node.async = !!isAsync\n\n if (isStatement)\n node.id = this.parseIdent()\n\n let oldInGen = this.inGenerator, oldInAsync = this.inAsync, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos\n this.inGenerator = node.generator\n this.inAsync = node.async\n this.yieldPos = 0\n this.awaitPos = 0\n\n if (!isStatement && this.type === tt.name)\n node.id = this.parseIdent()\n this.parseFunctionParams(node)\n this.parseFunctionBody(node, allowExpressionBody)\n\n this.inGenerator = oldInGen\n this.inAsync = oldInAsync\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.finishNode(node, isStatement ? \"FunctionDeclaration\" : \"FunctionExpression\")\n}\n\npp.parseFunctionParams = function(node) {\n this.expect(tt.parenL)\n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8, true)\n this.checkYieldAwaitInDefaultParams()\n}\n\n// Parse a class declaration or literal (depending on the\n// `isStatement` parameter).\n\npp.parseClass = function(node, isStatement) {\n this.next()\n this.parseClassId(node, isStatement)\n this.parseClassSuper(node)\n let classBody = this.startNode()\n let hadConstructor = false\n classBody.body = []\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n if (this.eat(tt.semi)) continue\n let method = this.startNode()\n let isGenerator = this.eat(tt.star)\n let isAsync = false\n let isMaybeStatic = this.type === tt.name && this.value === \"static\"\n this.parsePropertyName(method)\n method.static = isMaybeStatic && this.type !== tt.parenL\n if (method.static) {\n if (isGenerator) this.unexpected()\n isGenerator = this.eat(tt.star)\n this.parsePropertyName(method)\n }\n if (this.options.ecmaVersion >= 8 && !isGenerator && !method.computed &&\n method.key.type === \"Identifier\" && method.key.name === \"async\" && this.type !== tt.parenL &&\n !this.canInsertSemicolon()) {\n isAsync = true\n this.parsePropertyName(method)\n }\n method.kind = \"method\"\n let isGetSet = false\n if (!method.computed) {\n let {key} = method\n if (!isGenerator && !isAsync && key.type === \"Identifier\" && this.type !== tt.parenL && (key.name === \"get\" || key.name === \"set\")) {\n isGetSet = true\n method.kind = key.name\n key = this.parsePropertyName(method)\n }\n if (!method.static && (key.type === \"Identifier\" && key.name === \"constructor\" ||\n key.type === \"Literal\" && key.value === \"constructor\")) {\n if (hadConstructor) this.raise(key.start, \"Duplicate constructor in the same class\")\n if (isGetSet) this.raise(key.start, \"Constructor can't have get/set modifier\")\n if (isGenerator) this.raise(key.start, \"Constructor can't be a generator\")\n if (isAsync) this.raise(key.start, \"Constructor can't be an async method\")\n method.kind = \"constructor\"\n hadConstructor = true\n }\n }\n this.parseClassMethod(classBody, method, isGenerator, isAsync)\n if (isGetSet) {\n let paramCount = method.kind === \"get\" ? 0 : 1\n if (method.value.params.length !== paramCount) {\n let start = method.value.start\n if (method.kind === \"get\")\n this.raiseRecoverable(start, \"getter should have no params\")\n else\n this.raiseRecoverable(start, \"setter should have exactly one param\")\n } else {\n if (method.kind === \"set\" && method.value.params[0].type === \"RestElement\")\n this.raiseRecoverable(method.value.params[0].start, \"Setter cannot use rest params\")\n }\n }\n }\n node.body = this.finishNode(classBody, \"ClassBody\")\n return this.finishNode(node, isStatement ? \"ClassDeclaration\" : \"ClassExpression\")\n}\n\npp.parseClassMethod = function(classBody, method, isGenerator, isAsync) {\n method.value = this.parseMethod(isGenerator, isAsync)\n classBody.body.push(this.finishNode(method, \"MethodDefinition\"))\n}\n\npp.parseClassId = function(node, isStatement) {\n node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null\n}\n\npp.parseClassSuper = function(node) {\n node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null\n}\n\n// Parses module export declaration.\n\npp.parseExport = function(node, exports) {\n this.next()\n // export * from '...'\n if (this.eat(tt.star)) {\n this.expectContextual(\"from\")\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\n this.semicolon()\n return this.finishNode(node, \"ExportAllDeclaration\")\n }\n if (this.eat(tt._default)) { // export default ...\n this.checkExport(exports, \"default\", this.lastTokStart)\n let parens = this.type == tt.parenL\n let expr = this.parseMaybeAssign()\n let needsSemi = true\n if (!parens && (expr.type == \"FunctionExpression\" ||\n expr.type == \"ClassExpression\")) {\n needsSemi = false\n if (expr.id) {\n expr.type = expr.type == \"FunctionExpression\"\n ? \"FunctionDeclaration\"\n : \"ClassDeclaration\"\n }\n }\n node.declaration = expr\n if (needsSemi) this.semicolon()\n return this.finishNode(node, \"ExportDefaultDeclaration\")\n }\n // export var|const|let|function|class ...\n if (this.shouldParseExportStatement()) {\n node.declaration = this.parseStatement(true)\n if (node.declaration.type === \"VariableDeclaration\")\n this.checkVariableExport(exports, node.declaration.declarations)\n else\n this.checkExport(exports, node.declaration.id.name, node.declaration.id.start)\n node.specifiers = []\n node.source = null\n } else { // export { x, y as z } [from '...']\n node.declaration = null\n node.specifiers = this.parseExportSpecifiers(exports)\n if (this.eatContextual(\"from\")) {\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\n } else {\n // check for keywords used as local names\n for (let i = 0; i < node.specifiers.length; i++) {\n if (this.keywords.test(node.specifiers[i].local.name) || this.reservedWords.test(node.specifiers[i].local.name)) {\n this.unexpected(node.specifiers[i].local.start)\n }\n }\n\n node.source = null\n }\n this.semicolon()\n }\n return this.finishNode(node, \"ExportNamedDeclaration\")\n}\n\npp.checkExport = function(exports, name, pos) {\n if (!exports) return\n if (Object.prototype.hasOwnProperty.call(exports, name))\n this.raiseRecoverable(pos, \"Duplicate export '\" + name + \"'\")\n exports[name] = true\n}\n\npp.checkPatternExport = function(exports, pat) {\n let type = pat.type\n if (type == \"Identifier\")\n this.checkExport(exports, pat.name, pat.start)\n else if (type == \"ObjectPattern\")\n for (let i = 0; i < pat.properties.length; ++i)\n this.checkPatternExport(exports, pat.properties[i].value)\n else if (type == \"ArrayPattern\")\n for (let i = 0; i < pat.elements.length; ++i) {\n let elt = pat.elements[i]\n if (elt) this.checkPatternExport(exports, elt)\n }\n else if (type == \"AssignmentPattern\")\n this.checkPatternExport(exports, pat.left)\n else if (type == \"ParenthesizedExpression\")\n this.checkPatternExport(exports, pat.expression)\n}\n\npp.checkVariableExport = function(exports, decls) {\n if (!exports) return\n for (let i = 0; i < decls.length; i++)\n this.checkPatternExport(exports, decls[i].id)\n}\n\npp.shouldParseExportStatement = function() {\n return this.type.keyword === \"var\"\n || this.type.keyword === \"const\"\n || this.type.keyword === \"class\"\n || this.type.keyword === \"function\"\n || this.isLet()\n || this.isAsyncFunction()\n}\n\n// Parses a comma-separated list of module exports.\n\npp.parseExportSpecifiers = function(exports) {\n let nodes = [], first = true\n // export { x, y as z } [from '...']\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this.expect(tt.comma)\n if (this.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n let node = this.startNode()\n node.local = this.parseIdent(this.type === tt._default)\n node.exported = this.eatContextual(\"as\") ? this.parseIdent(true) : node.local\n this.checkExport(exports, node.exported.name, node.exported.start)\n nodes.push(this.finishNode(node, \"ExportSpecifier\"))\n }\n return nodes\n}\n\n// Parses import declaration.\n\npp.parseImport = function(node) {\n this.next()\n // import '...'\n if (this.type === tt.string) {\n node.specifiers = empty\n node.source = this.parseExprAtom()\n } else {\n node.specifiers = this.parseImportSpecifiers()\n this.expectContextual(\"from\")\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\n }\n this.semicolon()\n return this.finishNode(node, \"ImportDeclaration\")\n}\n\n// Parses a comma-separated list of module imports.\n\npp.parseImportSpecifiers = function() {\n let nodes = [], first = true\n if (this.type === tt.name) {\n // import defaultObj, { x, y as z } from '...'\n let node = this.startNode()\n node.local = this.parseIdent()\n this.checkLVal(node.local, true)\n nodes.push(this.finishNode(node, \"ImportDefaultSpecifier\"))\n if (!this.eat(tt.comma)) return nodes\n }\n if (this.type === tt.star) {\n let node = this.startNode()\n this.next()\n this.expectContextual(\"as\")\n node.local = this.parseIdent()\n this.checkLVal(node.local, true)\n nodes.push(this.finishNode(node, \"ImportNamespaceSpecifier\"))\n return nodes\n }\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this.expect(tt.comma)\n if (this.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n let node = this.startNode()\n node.imported = this.parseIdent(true)\n if (this.eatContextual(\"as\")) {\n node.local = this.parseIdent()\n } else {\n node.local = node.imported\n if (this.isKeyword(node.local.name)) this.unexpected(node.local.start)\n if (this.reservedWordsStrict.test(node.local.name)) this.raiseRecoverable(node.local.start, \"The keyword '\" + node.local.name + \"' is reserved\")\n }\n this.checkLVal(node.local, true)\n nodes.push(this.finishNode(node, \"ImportSpecifier\"))\n }\n return nodes\n}\n","import {types as tt} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {has} from \"./util\"\n\nconst pp = Parser.prototype\n\n// Convert existing expression atom to assignable pattern\n// if possible.\n\npp.toAssignable = function(node, isBinding) {\n if (this.options.ecmaVersion >= 6 && node) {\n switch (node.type) {\n case \"Identifier\":\n if (this.inAsync && node.name === \"await\")\n this.raise(node.start, \"Can not use 'await' as identifier inside an async function\")\n break\n\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n break\n\n case \"ObjectExpression\":\n node.type = \"ObjectPattern\"\n for (let i = 0; i < node.properties.length; i++) {\n let prop = node.properties[i]\n if (prop.kind !== \"init\") this.raise(prop.key.start, \"Object pattern can't contain getter or setter\")\n this.toAssignable(prop.value, isBinding)\n }\n break\n\n case \"ArrayExpression\":\n node.type = \"ArrayPattern\"\n this.toAssignableList(node.elements, isBinding)\n break\n\n case \"AssignmentExpression\":\n if (node.operator === \"=\") {\n node.type = \"AssignmentPattern\"\n delete node.operator\n this.toAssignable(node.left, isBinding)\n // falls through to AssignmentPattern\n } else {\n this.raise(node.left.end, \"Only '=' operator can be used for specifying default value.\")\n break\n }\n\n case \"AssignmentPattern\":\n break\n\n case \"ParenthesizedExpression\":\n node.expression = this.toAssignable(node.expression, isBinding)\n break\n\n case \"MemberExpression\":\n if (!isBinding) break\n\n default:\n this.raise(node.start, \"Assigning to rvalue\")\n }\n }\n return node\n}\n\n// Convert list of expression atoms to binding list.\n\npp.toAssignableList = function(exprList, isBinding) {\n let end = exprList.length\n if (end) {\n let last = exprList[end - 1]\n if (last && last.type == \"RestElement\") {\n --end\n } else if (last && last.type == \"SpreadElement\") {\n last.type = \"RestElement\"\n let arg = last.argument\n this.toAssignable(arg, isBinding)\n if (arg.type !== \"Identifier\" && arg.type !== \"MemberExpression\" && arg.type !== \"ArrayPattern\")\n this.unexpected(arg.start)\n --end\n }\n\n if (isBinding && last && last.type === \"RestElement\" && last.argument.type !== \"Identifier\")\n this.unexpected(last.argument.start)\n }\n for (let i = 0; i < end; i++) {\n let elt = exprList[i]\n if (elt) this.toAssignable(elt, isBinding)\n }\n return exprList\n}\n\n// Parses spread element.\n\npp.parseSpread = function(refDestructuringErrors) {\n let node = this.startNode()\n this.next()\n node.argument = this.parseMaybeAssign(false, refDestructuringErrors)\n return this.finishNode(node, \"SpreadElement\")\n}\n\npp.parseRest = function(allowNonIdent) {\n let node = this.startNode()\n this.next()\n\n // RestElement inside of a function parameter must be an identifier\n if (allowNonIdent) node.argument = this.type === tt.name ? this.parseIdent() : this.unexpected()\n else node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected()\n\n return this.finishNode(node, \"RestElement\")\n}\n\n// Parses lvalue (assignable) atom.\n\npp.parseBindingAtom = function() {\n if (this.options.ecmaVersion < 6) return this.parseIdent()\n switch (this.type) {\n case tt.name:\n return this.parseIdent()\n\n case tt.bracketL:\n let node = this.startNode()\n this.next()\n node.elements = this.parseBindingList(tt.bracketR, true, true)\n return this.finishNode(node, \"ArrayPattern\")\n\n case tt.braceL:\n return this.parseObj(true)\n\n default:\n this.unexpected()\n }\n}\n\npp.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowNonIdent) {\n let elts = [], first = true\n while (!this.eat(close)) {\n if (first) first = false\n else this.expect(tt.comma)\n if (allowEmpty && this.type === tt.comma) {\n elts.push(null)\n } else if (allowTrailingComma && this.afterTrailingComma(close)) {\n break\n } else if (this.type === tt.ellipsis) {\n let rest = this.parseRest(allowNonIdent)\n this.parseBindingListItem(rest)\n elts.push(rest)\n if (this.type === tt.comma) this.raise(this.start, \"Comma is not permitted after the rest element\")\n this.expect(close)\n break\n } else {\n let elem = this.parseMaybeDefault(this.start, this.startLoc)\n this.parseBindingListItem(elem)\n elts.push(elem)\n }\n }\n return elts\n}\n\npp.parseBindingListItem = function(param) {\n return param\n}\n\n// Parses assignment pattern around given atom if possible.\n\npp.parseMaybeDefault = function(startPos, startLoc, left) {\n left = left || this.parseBindingAtom()\n if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left\n let node = this.startNodeAt(startPos, startLoc)\n node.left = left\n node.right = this.parseMaybeAssign()\n return this.finishNode(node, \"AssignmentPattern\")\n}\n\n// Verify that a node is an lval — something that can be assigned\n// to.\n\npp.checkLVal = function(expr, isBinding, checkClashes) {\n switch (expr.type) {\n case \"Identifier\":\n if (this.strict && this.reservedWordsStrictBind.test(expr.name))\n this.raiseRecoverable(expr.start, (isBinding ? \"Binding \" : \"Assigning to \") + expr.name + \" in strict mode\")\n if (checkClashes) {\n if (has(checkClashes, expr.name))\n this.raiseRecoverable(expr.start, \"Argument name clash\")\n checkClashes[expr.name] = true\n }\n break\n\n case \"MemberExpression\":\n if (isBinding) this.raiseRecoverable(expr.start, (isBinding ? \"Binding\" : \"Assigning to\") + \" member expression\")\n break\n\n case \"ObjectPattern\":\n for (let i = 0; i < expr.properties.length; i++)\n this.checkLVal(expr.properties[i].value, isBinding, checkClashes)\n break\n\n case \"ArrayPattern\":\n for (let i = 0; i < expr.elements.length; i++) {\n let elem = expr.elements[i]\n if (elem) this.checkLVal(elem, isBinding, checkClashes)\n }\n break\n\n case \"AssignmentPattern\":\n this.checkLVal(expr.left, isBinding, checkClashes)\n break\n\n case \"RestElement\":\n this.checkLVal(expr.argument, isBinding, checkClashes)\n break\n\n case \"ParenthesizedExpression\":\n this.checkLVal(expr.expression, isBinding, checkClashes)\n break\n\n default:\n this.raise(expr.start, (isBinding ? \"Binding\" : \"Assigning to\") + \" rvalue\")\n }\n}\n","// A recursive descent parser operates by defining functions for all\n// syntactic elements, and recursively calling those, each function\n// advancing the input stream and returning an AST node. Precedence\n// of constructs (for example, the fact that `!x[1]` means `!(x[1])`\n// instead of `(!x)[1]` is handled by the fact that the parser\n// function that parses unary prefix operators is called first, and\n// in turn calls the function that parses `[]` subscripts — that\n// way, it'll receive the node for `x[1]` already parsed, and wraps\n// *that* in the unary operator node.\n//\n// Acorn uses an [operator precedence parser][opp] to handle binary\n// operator precedence, because it is much more compact than using\n// the technique outlined above, which uses different, nesting\n// functions to specify precedence, for all of the ten binary\n// precedence levels that JavaScript defines.\n//\n// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser\n\nimport {types as tt} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {DestructuringErrors} from \"./parseutil\"\n\nconst pp = Parser.prototype\n\n// Check if property name clashes with already added.\n// Object/class getters and setters are not allowed to clash —\n// either with each other or with an init property — and in\n// strict mode, init properties are also not allowed to be repeated.\n\npp.checkPropClash = function(prop, propHash) {\n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))\n return\n let {key} = prop, name\n switch (key.type) {\n case \"Identifier\": name = key.name; break\n case \"Literal\": name = String(key.value); break\n default: return\n }\n let {kind} = prop\n if (this.options.ecmaVersion >= 6) {\n if (name === \"__proto__\" && kind === \"init\") {\n if (propHash.proto) this.raiseRecoverable(key.start, \"Redefinition of __proto__ property\")\n propHash.proto = true\n }\n return\n }\n name = \"$\" + name\n let other = propHash[name]\n if (other) {\n let isGetSet = kind !== \"init\"\n if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init))\n this.raiseRecoverable(key.start, \"Redefinition of property\")\n } else {\n other = propHash[name] = {\n init: false,\n get: false,\n set: false\n }\n }\n other[kind] = true\n}\n\n// ### Expression parsing\n\n// These nest, from the most general expression type at the top to\n// 'atomic', nondivisible expression types at the bottom. Most of\n// the functions will simply let the function(s) below them parse,\n// and, *if* the syntactic construct they handle is present, wrap\n// the AST node that the inner parser gave them in another node.\n\n// Parse a full expression. The optional arguments are used to\n// forbid the `in` operator (in for loops initalization expressions)\n// and provide reference for storing '=' operator inside shorthand\n// property assignment in contexts where both object expression\n// and object pattern might appear (so it's possible to raise\n// delayed syntax error at correct position).\n\npp.parseExpression = function(noIn, refDestructuringErrors) {\n let startPos = this.start, startLoc = this.startLoc\n let expr = this.parseMaybeAssign(noIn, refDestructuringErrors)\n if (this.type === tt.comma) {\n let node = this.startNodeAt(startPos, startLoc)\n node.expressions = [expr]\n while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors))\n return this.finishNode(node, \"SequenceExpression\")\n }\n return expr\n}\n\n// Parse an assignment expression. This includes applications of\n// operators like `+=`.\n\npp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {\n if (this.inGenerator && this.isContextual(\"yield\")) return this.parseYield()\n\n let ownDestructuringErrors = false\n if (!refDestructuringErrors) {\n refDestructuringErrors = new DestructuringErrors\n ownDestructuringErrors = true\n }\n let startPos = this.start, startLoc = this.startLoc\n if (this.type == tt.parenL || this.type == tt.name)\n this.potentialArrowAt = this.start\n let left = this.parseMaybeConditional(noIn, refDestructuringErrors)\n if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)\n if (this.type.isAssign) {\n this.checkPatternErrors(refDestructuringErrors, true)\n if (!ownDestructuringErrors) DestructuringErrors.call(refDestructuringErrors)\n let node = this.startNodeAt(startPos, startLoc)\n node.operator = this.value\n node.left = this.type === tt.eq ? this.toAssignable(left) : left\n refDestructuringErrors.shorthandAssign = 0 // reset because shorthand default was used correctly\n this.checkLVal(left)\n this.next()\n node.right = this.parseMaybeAssign(noIn)\n return this.finishNode(node, \"AssignmentExpression\")\n } else {\n if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true)\n }\n return left\n}\n\n// Parse a ternary conditional (`?:`) operator.\n\npp.parseMaybeConditional = function(noIn, refDestructuringErrors) {\n let startPos = this.start, startLoc = this.startLoc\n let expr = this.parseExprOps(noIn, refDestructuringErrors)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n if (this.eat(tt.question)) {\n let node = this.startNodeAt(startPos, startLoc)\n node.test = expr\n node.consequent = this.parseMaybeAssign()\n this.expect(tt.colon)\n node.alternate = this.parseMaybeAssign(noIn)\n return this.finishNode(node, \"ConditionalExpression\")\n }\n return expr\n}\n\n// Start the precedence parser.\n\npp.parseExprOps = function(noIn, refDestructuringErrors) {\n let startPos = this.start, startLoc = this.startLoc\n let expr = this.parseMaybeUnary(refDestructuringErrors, false)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n return this.parseExprOp(expr, startPos, startLoc, -1, noIn)\n}\n\n// Parse binary operators with the operator precedence parsing\n// algorithm. `left` is the left-hand side of the operator.\n// `minPrec` provides context that allows the function to stop and\n// defer further parser to one of its callers when it encounters an\n// operator that has a lower precedence than the set it is parsing.\n\npp.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {\n let prec = this.type.binop\n if (prec != null && (!noIn || this.type !== tt._in)) {\n if (prec > minPrec) {\n let logical = this.type === tt.logicalOR || this.type === tt.logicalAND\n let op = this.value\n this.next()\n let startPos = this.start, startLoc = this.startLoc\n let right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn)\n let node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical)\n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)\n }\n }\n return left\n}\n\npp.buildBinary = function(startPos, startLoc, left, right, op, logical) {\n let node = this.startNodeAt(startPos, startLoc)\n node.left = left\n node.operator = op\n node.right = right\n return this.finishNode(node, logical ? \"LogicalExpression\" : \"BinaryExpression\")\n}\n\n// Parse unary operators, both prefix and postfix.\n\npp.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {\n let startPos = this.start, startLoc = this.startLoc, expr\n if (this.inAsync && this.isContextual(\"await\")) {\n expr = this.parseAwait(refDestructuringErrors)\n sawUnary = true\n } else if (this.type.prefix) {\n let node = this.startNode(), update = this.type === tt.incDec\n node.operator = this.value\n node.prefix = true\n this.next()\n node.argument = this.parseMaybeUnary(null, true)\n this.checkExpressionErrors(refDestructuringErrors, true)\n if (update) this.checkLVal(node.argument)\n else if (this.strict && node.operator === \"delete\" &&\n node.argument.type === \"Identifier\")\n this.raiseRecoverable(node.start, \"Deleting local variable in strict mode\")\n else sawUnary = true\n expr = this.finishNode(node, update ? \"UpdateExpression\" : \"UnaryExpression\")\n } else {\n expr = this.parseExprSubscripts(refDestructuringErrors)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n while (this.type.postfix && !this.canInsertSemicolon()) {\n let node = this.startNodeAt(startPos, startLoc)\n node.operator = this.value\n node.prefix = false\n node.argument = expr\n this.checkLVal(expr)\n this.next()\n expr = this.finishNode(node, \"UpdateExpression\")\n }\n }\n\n if (!sawUnary && this.eat(tt.starstar))\n return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), \"**\", false)\n else\n return expr\n}\n\n// Parse call, dot, and `[]`-subscript expressions.\n\npp.parseExprSubscripts = function(refDestructuringErrors) {\n let startPos = this.start, startLoc = this.startLoc\n let expr = this.parseExprAtom(refDestructuringErrors)\n let skipArrowSubscripts = expr.type === \"ArrowFunctionExpression\" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== \")\"\n if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr\n return this.parseSubscripts(expr, startPos, startLoc)\n}\n\npp.parseSubscripts = function(base, startPos, startLoc, noCalls) {\n for (;;) {\n let maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === \"Identifier\" && base.name === \"async\" && !this.canInsertSemicolon()\n if (this.eat(tt.dot)) {\n let node = this.startNodeAt(startPos, startLoc)\n node.object = base\n node.property = this.parseIdent(true)\n node.computed = false\n base = this.finishNode(node, \"MemberExpression\")\n } else if (this.eat(tt.bracketL)) {\n let node = this.startNodeAt(startPos, startLoc)\n node.object = base\n node.property = this.parseExpression()\n node.computed = true\n this.expect(tt.bracketR)\n base = this.finishNode(node, \"MemberExpression\")\n } else if (!noCalls && this.eat(tt.parenL)) {\n let refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos\n this.yieldPos = 0\n this.awaitPos = 0\n let exprList = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors)\n if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, true)\n this.checkYieldAwaitInDefaultParams()\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)\n }\n this.checkExpressionErrors(refDestructuringErrors, true)\n this.yieldPos = oldYieldPos || this.yieldPos\n this.awaitPos = oldAwaitPos || this.awaitPos\n let node = this.startNodeAt(startPos, startLoc)\n node.callee = base\n node.arguments = exprList\n base = this.finishNode(node, \"CallExpression\")\n } else if (this.type === tt.backQuote) {\n let node = this.startNodeAt(startPos, startLoc)\n node.tag = base\n node.quasi = this.parseTemplate()\n base = this.finishNode(node, \"TaggedTemplateExpression\")\n } else {\n return base\n }\n }\n}\n\n// Parse an atomic expression — either a single token that is an\n// expression, an expression started by a keyword like `function` or\n// `new`, or an expression wrapped in punctuation like `()`, `[]`,\n// or `{}`.\n\npp.parseExprAtom = function(refDestructuringErrors) {\n let node, canBeArrow = this.potentialArrowAt == this.start\n switch (this.type) {\n case tt._super:\n if (!this.inFunction)\n this.raise(this.start, \"'super' outside of function or class\")\n\n case tt._this:\n let type = this.type === tt._this ? \"ThisExpression\" : \"Super\"\n node = this.startNode()\n this.next()\n return this.finishNode(node, type)\n\n case tt.name:\n let startPos = this.start, startLoc = this.startLoc\n let id = this.parseIdent(this.type !== tt.name)\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && !this.canInsertSemicolon() && this.eat(tt._function))\n return this.parseFunction(this.startNodeAt(startPos, startLoc), false, false, true)\n if (canBeArrow && !this.canInsertSemicolon()) {\n if (this.eat(tt.arrow))\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false)\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && this.type === tt.name) {\n id = this.parseIdent()\n if (this.canInsertSemicolon() || !this.eat(tt.arrow))\n this.unexpected()\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)\n }\n }\n return id\n\n case tt.regexp:\n let value = this.value\n node = this.parseLiteral(value.value)\n node.regex = {pattern: value.pattern, flags: value.flags}\n return node\n\n case tt.num: case tt.string:\n return this.parseLiteral(this.value)\n\n case tt._null: case tt._true: case tt._false:\n node = this.startNode()\n node.value = this.type === tt._null ? null : this.type === tt._true\n node.raw = this.type.keyword\n this.next()\n return this.finishNode(node, \"Literal\")\n\n case tt.parenL:\n return this.parseParenAndDistinguishExpression(canBeArrow)\n\n case tt.bracketL:\n node = this.startNode()\n this.next()\n node.elements = this.parseExprList(tt.bracketR, true, true, refDestructuringErrors)\n return this.finishNode(node, \"ArrayExpression\")\n\n case tt.braceL:\n return this.parseObj(false, refDestructuringErrors)\n\n case tt._function:\n node = this.startNode()\n this.next()\n return this.parseFunction(node, false)\n\n case tt._class:\n return this.parseClass(this.startNode(), false)\n\n case tt._new:\n return this.parseNew()\n\n case tt.backQuote:\n return this.parseTemplate()\n\n default:\n this.unexpected()\n }\n}\n\npp.parseLiteral = function(value) {\n let node = this.startNode()\n node.value = value\n node.raw = this.input.slice(this.start, this.end)\n this.next()\n return this.finishNode(node, \"Literal\")\n}\n\npp.parseParenExpression = function() {\n this.expect(tt.parenL)\n let val = this.parseExpression()\n this.expect(tt.parenR)\n return val\n}\n\npp.parseParenAndDistinguishExpression = function(canBeArrow) {\n let startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8\n if (this.options.ecmaVersion >= 6) {\n this.next()\n\n let innerStartPos = this.start, innerStartLoc = this.startLoc\n let exprList = [], first = true, lastIsComma = false\n let refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart, innerParenStart\n this.yieldPos = 0\n this.awaitPos = 0\n while (this.type !== tt.parenR) {\n first ? first = false : this.expect(tt.comma)\n if (allowTrailingComma && this.afterTrailingComma(tt.parenR, true)) {\n lastIsComma = true\n break\n } else if (this.type === tt.ellipsis) {\n spreadStart = this.start\n exprList.push(this.parseParenItem(this.parseRest()))\n if (this.type === tt.comma) this.raise(this.start, \"Comma is not permitted after the rest element\")\n break\n } else {\n if (this.type === tt.parenL && !innerParenStart) {\n innerParenStart = this.start\n }\n exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem))\n }\n }\n let innerEndPos = this.start, innerEndLoc = this.startLoc\n this.expect(tt.parenR)\n\n if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, true)\n this.checkYieldAwaitInDefaultParams()\n if (innerParenStart) this.unexpected(innerParenStart)\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.parseParenArrowList(startPos, startLoc, exprList)\n }\n\n if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart)\n if (spreadStart) this.unexpected(spreadStart)\n this.checkExpressionErrors(refDestructuringErrors, true)\n this.yieldPos = oldYieldPos || this.yieldPos\n this.awaitPos = oldAwaitPos || this.awaitPos\n\n if (exprList.length > 1) {\n val = this.startNodeAt(innerStartPos, innerStartLoc)\n val.expressions = exprList\n this.finishNodeAt(val, \"SequenceExpression\", innerEndPos, innerEndLoc)\n } else {\n val = exprList[0]\n }\n } else {\n val = this.parseParenExpression()\n }\n\n if (this.options.preserveParens) {\n let par = this.startNodeAt(startPos, startLoc)\n par.expression = val\n return this.finishNode(par, \"ParenthesizedExpression\")\n } else {\n return val\n }\n}\n\npp.parseParenItem = function(item) {\n return item\n}\n\npp.parseParenArrowList = function(startPos, startLoc, exprList) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)\n}\n\n// New's precedence is slightly tricky. It must allow its argument to\n// be a `[]` or dot subscript expression, but not a call — at least,\n// not without wrapping it in parentheses. Thus, it uses the noCalls\n// argument to parseSubscripts to prevent it from consuming the\n// argument list.\n\nconst empty = []\n\npp.parseNew = function() {\n let node = this.startNode()\n let meta = this.parseIdent(true)\n if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {\n node.meta = meta\n node.property = this.parseIdent(true)\n if (node.property.name !== \"target\")\n this.raiseRecoverable(node.property.start, \"The only valid meta property for new is new.target\")\n if (!this.inFunction)\n this.raiseRecoverable(node.start, \"new.target can only be used in functions\")\n return this.finishNode(node, \"MetaProperty\")\n }\n let startPos = this.start, startLoc = this.startLoc\n node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true)\n if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false)\n else node.arguments = empty\n return this.finishNode(node, \"NewExpression\")\n}\n\n// Parse template expression.\n\npp.parseTemplateElement = function() {\n let elem = this.startNode()\n elem.value = {\n raw: this.input.slice(this.start, this.end).replace(/\\r\\n?/g, '\\n'),\n cooked: this.value\n }\n this.next()\n elem.tail = this.type === tt.backQuote\n return this.finishNode(elem, \"TemplateElement\")\n}\n\npp.parseTemplate = function() {\n let node = this.startNode()\n this.next()\n node.expressions = []\n let curElt = this.parseTemplateElement()\n node.quasis = [curElt]\n while (!curElt.tail) {\n this.expect(tt.dollarBraceL)\n node.expressions.push(this.parseExpression())\n this.expect(tt.braceR)\n node.quasis.push(curElt = this.parseTemplateElement())\n }\n this.next()\n return this.finishNode(node, \"TemplateLiteral\")\n}\n\n// Parse an object literal or binding pattern.\n\npp.parseObj = function(isPattern, refDestructuringErrors) {\n let node = this.startNode(), first = true, propHash = {}\n node.properties = []\n this.next()\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this.expect(tt.comma)\n if (this.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n let prop = this.startNode(), isGenerator, isAsync, startPos, startLoc\n if (this.options.ecmaVersion >= 6) {\n prop.method = false\n prop.shorthand = false\n if (isPattern || refDestructuringErrors) {\n startPos = this.start\n startLoc = this.startLoc\n }\n if (!isPattern)\n isGenerator = this.eat(tt.star)\n }\n this.parsePropertyName(prop)\n if (!isPattern && this.options.ecmaVersion >= 8 && !isGenerator && !prop.computed &&\n prop.key.type === \"Identifier\" && prop.key.name === \"async\" && this.type !== tt.parenL &&\n this.type !== tt.colon && !this.canInsertSemicolon()) {\n isAsync = true\n this.parsePropertyName(prop, refDestructuringErrors)\n } else {\n isAsync = false\n }\n this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors)\n this.checkPropClash(prop, propHash)\n node.properties.push(this.finishNode(prop, \"Property\"))\n }\n return this.finishNode(node, isPattern ? \"ObjectPattern\" : \"ObjectExpression\")\n}\n\npp.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) {\n if ((isGenerator || isAsync) && this.type === tt.colon)\n this.unexpected()\n\n if (this.eat(tt.colon)) {\n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors)\n prop.kind = \"init\"\n } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {\n if (isPattern) this.unexpected()\n prop.kind = \"init\"\n prop.method = true\n prop.value = this.parseMethod(isGenerator, isAsync)\n } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === \"Identifier\" &&\n (prop.key.name === \"get\" || prop.key.name === \"set\") &&\n (this.type != tt.comma && this.type != tt.braceR)) {\n if (isGenerator || isAsync || isPattern) this.unexpected()\n prop.kind = prop.key.name\n this.parsePropertyName(prop)\n prop.value = this.parseMethod(false)\n let paramCount = prop.kind === \"get\" ? 0 : 1\n if (prop.value.params.length !== paramCount) {\n let start = prop.value.start\n if (prop.kind === \"get\")\n this.raiseRecoverable(start, \"getter should have no params\")\n else\n this.raiseRecoverable(start, \"setter should have exactly one param\")\n } else {\n if (prop.kind === \"set\" && prop.value.params[0].type === \"RestElement\")\n this.raiseRecoverable(prop.value.params[0].start, \"Setter cannot use rest params\")\n }\n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === \"Identifier\") {\n if (this.keywords.test(prop.key.name) ||\n (this.strict ? this.reservedWordsStrict : this.reservedWords).test(prop.key.name) ||\n (this.inGenerator && prop.key.name == \"yield\") ||\n (this.inAsync && prop.key.name == \"await\"))\n this.raiseRecoverable(prop.key.start, \"'\" + prop.key.name + \"' can not be used as shorthand property\")\n prop.kind = \"init\"\n if (isPattern) {\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)\n } else if (this.type === tt.eq && refDestructuringErrors) {\n if (!refDestructuringErrors.shorthandAssign)\n refDestructuringErrors.shorthandAssign = this.start\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)\n } else {\n prop.value = prop.key\n }\n prop.shorthand = true\n } else this.unexpected()\n}\n\npp.parsePropertyName = function(prop) {\n if (this.options.ecmaVersion >= 6) {\n if (this.eat(tt.bracketL)) {\n prop.computed = true\n prop.key = this.parseMaybeAssign()\n this.expect(tt.bracketR)\n return prop.key\n } else {\n prop.computed = false\n }\n }\n return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true)\n}\n\n// Initialize empty function node.\n\npp.initFunction = function(node) {\n node.id = null\n if (this.options.ecmaVersion >= 6) {\n node.generator = false\n node.expression = false\n }\n if (this.options.ecmaVersion >= 8)\n node.async = false\n}\n\n// Parse object or class method.\n\npp.parseMethod = function(isGenerator, isAsync) {\n let node = this.startNode(), oldInGen = this.inGenerator, oldInAsync = this.inAsync, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos\n\n this.initFunction(node)\n if (this.options.ecmaVersion >= 6)\n node.generator = isGenerator\n if (this.options.ecmaVersion >= 8)\n node.async = !!isAsync\n\n this.inGenerator = node.generator\n this.inAsync = node.async\n this.yieldPos = 0\n this.awaitPos = 0\n\n this.expect(tt.parenL)\n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8)\n this.checkYieldAwaitInDefaultParams()\n this.parseFunctionBody(node, false)\n\n this.inGenerator = oldInGen\n this.inAsync = oldInAsync\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.finishNode(node, \"FunctionExpression\")\n}\n\n// Parse arrow function expression with given parameters.\n\npp.parseArrowExpression = function(node, params, isAsync) {\n let oldInGen = this.inGenerator, oldInAsync = this.inAsync, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos\n\n this.initFunction(node)\n if (this.options.ecmaVersion >= 8)\n node.async = !!isAsync\n\n this.inGenerator = false\n this.inAsync = node.async\n this.yieldPos = 0\n this.awaitPos = 0\n\n node.params = this.toAssignableList(params, true)\n this.parseFunctionBody(node, true)\n\n this.inGenerator = oldInGen\n this.inAsync = oldInAsync\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.finishNode(node, \"ArrowFunctionExpression\")\n}\n\n// Parse function body and check parameters.\n\npp.parseFunctionBody = function(node, isArrowFunction) {\n let isExpression = isArrowFunction && this.type !== tt.braceL\n\n if (isExpression) {\n node.body = this.parseMaybeAssign()\n node.expression = true\n } else {\n // Start a new scope with regard to labels and the `inFunction`\n // flag (restore them to their old value afterwards).\n let oldInFunc = this.inFunction, oldLabels = this.labels\n this.inFunction = true; this.labels = []\n node.body = this.parseBlock(true)\n node.expression = false\n this.inFunction = oldInFunc; this.labels = oldLabels\n }\n\n // If this is a strict mode function, verify that argument names\n // are not repeated, and it does not try to bind the words `eval`\n // or `arguments`.\n let useStrict = (!isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) ? node.body.body[0] : null\n if (useStrict && this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params))\n this.raiseRecoverable(useStrict.start, \"Illegal 'use strict' directive in function with non-simple parameter list\")\n\n if (this.strict || useStrict) {\n let oldStrict = this.strict\n this.strict = true\n if (node.id)\n this.checkLVal(node.id, true)\n this.checkParams(node)\n this.strict = oldStrict\n } else if (isArrowFunction || !this.isSimpleParamList(node.params)) {\n this.checkParams(node)\n }\n}\n\npp.isSimpleParamList = function(params) {\n for (let i = 0; i < params.length; i++)\n if (params[i].type !== \"Identifier\") return false\n return true\n}\n\n// Checks function params for various disallowed patterns such as using \"eval\"\n// or \"arguments\" and duplicate parameters.\n\npp.checkParams = function(node) {\n let nameHash = {}\n for (let i = 0; i < node.params.length; i++) this.checkLVal(node.params[i], true, nameHash)\n}\n\n// Parses a comma-separated list of expressions, and returns them as\n// an array. `close` is the token type that ends the list, and\n// `allowEmpty` can be turned on to allow subsequent commas with\n// nothing in between them to be parsed as `null` (which is needed\n// for array literals).\n\npp.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {\n let elts = [], first = true\n while (!this.eat(close)) {\n if (!first) {\n this.expect(tt.comma)\n if (allowTrailingComma && this.afterTrailingComma(close)) break\n } else first = false\n\n let elt\n if (allowEmpty && this.type === tt.comma)\n elt = null\n else if (this.type === tt.ellipsis) {\n elt = this.parseSpread(refDestructuringErrors)\n if (this.type === tt.comma && refDestructuringErrors && !refDestructuringErrors.trailingComma) {\n refDestructuringErrors.trailingComma = this.start\n }\n } else\n elt = this.parseMaybeAssign(false, refDestructuringErrors)\n elts.push(elt)\n }\n return elts\n}\n\n// Parse the next token as an identifier. If `liberal` is true (used\n// when parsing properties), it will also convert keywords into\n// identifiers.\n\npp.parseIdent = function(liberal) {\n let node = this.startNode()\n if (liberal && this.options.allowReserved == \"never\") liberal = false\n if (this.type === tt.name) {\n if (!liberal && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(this.value) &&\n (this.options.ecmaVersion >= 6 ||\n this.input.slice(this.start, this.end).indexOf(\"\\\\\") == -1))\n this.raiseRecoverable(this.start, \"The keyword '\" + this.value + \"' is reserved\")\n if (this.inGenerator && this.value === \"yield\")\n this.raiseRecoverable(this.start, \"Can not use 'yield' as identifier inside a generator\")\n if (this.inAsync && this.value === \"await\")\n this.raiseRecoverable(this.start, \"Can not use 'await' as identifier inside an async function\")\n node.name = this.value\n } else if (liberal && this.type.keyword) {\n node.name = this.type.keyword\n } else {\n this.unexpected()\n }\n this.next()\n return this.finishNode(node, \"Identifier\")\n}\n\n// Parses yield expression inside generator.\n\npp.parseYield = function() {\n if (!this.yieldPos) this.yieldPos = this.start\n\n let node = this.startNode()\n this.next()\n if (this.type == tt.semi || this.canInsertSemicolon() || (this.type != tt.star && !this.type.startsExpr)) {\n node.delegate = false\n node.argument = null\n } else {\n node.delegate = this.eat(tt.star)\n node.argument = this.parseMaybeAssign()\n }\n return this.finishNode(node, \"YieldExpression\")\n}\n\npp.parseAwait = function() {\n if (!this.awaitPos) this.awaitPos = this.start\n\n let node = this.startNode()\n this.next()\n node.argument = this.parseMaybeUnary(null, true)\n return this.finishNode(node, \"AwaitExpression\")\n}\n","import {Parser} from \"./state\"\nimport {Position, getLineInfo} from \"./locutil\"\n\nconst pp = Parser.prototype\n\n// This function is used to raise exceptions on parse errors. It\n// takes an offset integer (into the current `input`) to indicate\n// the location of the error, attaches the position to the end\n// of the error message, and then raises a `SyntaxError` with that\n// message.\n\npp.raise = function(pos, message) {\n let loc = getLineInfo(this.input, pos)\n message += \" (\" + loc.line + \":\" + loc.column + \")\"\n let err = new SyntaxError(message)\n err.pos = pos; err.loc = loc; err.raisedAt = this.pos\n throw err\n}\n\npp.raiseRecoverable = pp.raise\n\npp.curPosition = function() {\n if (this.options.locations) {\n return new Position(this.curLine, this.pos - this.lineStart)\n }\n}\n","import {Parser} from \"./state\"\nimport {SourceLocation} from \"./locutil\"\n\nexport class Node {\n constructor(parser, pos, loc) {\n this.type = \"\"\n this.start = pos\n this.end = 0\n if (parser.options.locations)\n this.loc = new SourceLocation(parser, loc)\n if (parser.options.directSourceFile)\n this.sourceFile = parser.options.directSourceFile\n if (parser.options.ranges)\n this.range = [pos, 0]\n }\n}\n\n// Start an AST node, attaching a start offset.\n\nconst pp = Parser.prototype\n\npp.startNode = function() {\n return new Node(this, this.start, this.startLoc)\n}\n\npp.startNodeAt = function(pos, loc) {\n return new Node(this, pos, loc)\n}\n\n// Finish an AST node, adding `type` and `end` properties.\n\nfunction finishNodeAt(node, type, pos, loc) {\n node.type = type\n node.end = pos\n if (this.options.locations)\n node.loc.end = loc\n if (this.options.ranges)\n node.range[1] = pos\n return node\n}\n\npp.finishNode = function(node, type) {\n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)\n}\n\n// Finish node at given position\n\npp.finishNodeAt = function(node, type, pos, loc) {\n return finishNodeAt.call(this, node, type, pos, loc)\n}\n","// The algorithm used to determine whether a regexp can appear at a\n// given point in the program is loosely based on sweet.js' approach.\n// See https://github.com/mozilla/sweet.js/wiki/design\n\nimport {Parser} from \"./state\"\nimport {types as tt} from \"./tokentype\"\nimport {lineBreak} from \"./whitespace\"\n\nexport class TokContext {\n constructor(token, isExpr, preserveSpace, override) {\n this.token = token\n this.isExpr = !!isExpr\n this.preserveSpace = !!preserveSpace\n this.override = override\n }\n}\n\nexport const types = {\n b_stat: new TokContext(\"{\", false),\n b_expr: new TokContext(\"{\", true),\n b_tmpl: new TokContext(\"${\", true),\n p_stat: new TokContext(\"(\", false),\n p_expr: new TokContext(\"(\", true),\n q_tmpl: new TokContext(\"`\", true, true, p => p.readTmplToken()),\n f_expr: new TokContext(\"function\", true)\n}\n\nconst pp = Parser.prototype\n\npp.initialContext = function() {\n return [types.b_stat]\n}\n\npp.braceIsBlock = function(prevType) {\n if (prevType === tt.colon) {\n let parent = this.curContext()\n if (parent === types.b_stat || parent === types.b_expr)\n return !parent.isExpr\n }\n if (prevType === tt._return)\n return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR)\n return true\n if (prevType == tt.braceL)\n return this.curContext() === types.b_stat\n return !this.exprAllowed\n}\n\npp.updateContext = function(prevType) {\n let update, type = this.type\n if (type.keyword && prevType == tt.dot)\n this.exprAllowed = false\n else if (update = type.updateContext)\n update.call(this, prevType)\n else\n this.exprAllowed = type.beforeExpr\n}\n\n// Token-specific context update code\n\ntt.parenR.updateContext = tt.braceR.updateContext = function() {\n if (this.context.length == 1) {\n this.exprAllowed = true\n return\n }\n let out = this.context.pop()\n if (out === types.b_stat && this.curContext() === types.f_expr) {\n this.context.pop()\n this.exprAllowed = false\n } else if (out === types.b_tmpl) {\n this.exprAllowed = true\n } else {\n this.exprAllowed = !out.isExpr\n }\n}\n\ntt.braceL.updateContext = function(prevType) {\n this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)\n this.exprAllowed = true\n}\n\ntt.dollarBraceL.updateContext = function() {\n this.context.push(types.b_tmpl)\n this.exprAllowed = true\n}\n\ntt.parenL.updateContext = function(prevType) {\n let statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while\n this.context.push(statementParens ? types.p_stat : types.p_expr)\n this.exprAllowed = true\n}\n\ntt.incDec.updateContext = function() {\n // tokExprAllowed stays unchanged\n}\n\ntt._function.updateContext = function(prevType) {\n if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&\n !((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat))\n this.context.push(types.f_expr)\n this.exprAllowed = false\n}\n\ntt.backQuote.updateContext = function() {\n if (this.curContext() === types.q_tmpl)\n this.context.pop()\n else\n this.context.push(types.q_tmpl)\n this.exprAllowed = false\n}\n","import {isIdentifierStart, isIdentifierChar} from \"./identifier\"\nimport {types as tt, keywords as keywordTypes} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {SourceLocation} from \"./locutil\"\nimport {lineBreak, lineBreakG, isNewLine, nonASCIIwhitespace} from \"./whitespace\"\n\n// Object type used to represent tokens. Note that normally, tokens\n// simply exist as properties on the parser object. This is only\n// used for the onToken callback and the external tokenizer.\n\nexport class Token {\n constructor(p) {\n this.type = p.type\n this.value = p.value\n this.start = p.start\n this.end = p.end\n if (p.options.locations)\n this.loc = new SourceLocation(p, p.startLoc, p.endLoc)\n if (p.options.ranges)\n this.range = [p.start, p.end]\n }\n}\n\n// ## Tokenizer\n\nconst pp = Parser.prototype\n\n// Are we running under Rhino?\nconst isRhino = typeof Packages == \"object\" && Object.prototype.toString.call(Packages) == \"[object JavaPackage]\"\n\n// Move to the next token\n\npp.next = function() {\n if (this.options.onToken)\n this.options.onToken(new Token(this))\n\n this.lastTokEnd = this.end\n this.lastTokStart = this.start\n this.lastTokEndLoc = this.endLoc\n this.lastTokStartLoc = this.startLoc\n this.nextToken()\n}\n\npp.getToken = function() {\n this.next()\n return new Token(this)\n}\n\n// If we're in an ES6 environment, make parsers iterable\nif (typeof Symbol !== \"undefined\")\n pp[Symbol.iterator] = function () {\n let self = this\n return {next: function () {\n let token = self.getToken()\n return {\n done: token.type === tt.eof,\n value: token\n }\n }}\n }\n\n// Toggle strict mode. Re-reads the next number or string to please\n// pedantic tests (`\"use strict\"; 010;` should fail).\n\npp.setStrict = function(strict) {\n this.strict = strict\n if (this.type !== tt.num && this.type !== tt.string) return\n this.pos = this.start\n if (this.options.locations) {\n while (this.pos < this.lineStart) {\n this.lineStart = this.input.lastIndexOf(\"\\n\", this.lineStart - 2) + 1\n --this.curLine\n }\n }\n this.nextToken()\n}\n\npp.curContext = function() {\n return this.context[this.context.length - 1]\n}\n\n// Read a single token, updating the parser object's token-related\n// properties.\n\npp.nextToken = function() {\n let curContext = this.curContext()\n if (!curContext || !curContext.preserveSpace) this.skipSpace()\n\n this.start = this.pos\n if (this.options.locations) this.startLoc = this.curPosition()\n if (this.pos >= this.input.length) return this.finishToken(tt.eof)\n\n if (curContext.override) return curContext.override(this)\n else this.readToken(this.fullCharCodeAtPos())\n}\n\npp.readToken = function(code) {\n // Identifier or keyword. '\\uXXXX' sequences are allowed in\n // identifiers, so '\\' also dispatches to that.\n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\\' */)\n return this.readWord()\n\n return this.getTokenFromCode(code)\n}\n\npp.fullCharCodeAtPos = function() {\n let code = this.input.charCodeAt(this.pos)\n if (code <= 0xd7ff || code >= 0xe000) return code\n let next = this.input.charCodeAt(this.pos + 1)\n return (code << 10) + next - 0x35fdc00\n}\n\npp.skipBlockComment = function() {\n let startLoc = this.options.onComment && this.curPosition()\n let start = this.pos, end = this.input.indexOf(\"*/\", this.pos += 2)\n if (end === -1) this.raise(this.pos - 2, \"Unterminated comment\")\n this.pos = end + 2\n if (this.options.locations) {\n lineBreakG.lastIndex = start\n let match\n while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {\n ++this.curLine\n this.lineStart = match.index + match[0].length\n }\n }\n if (this.options.onComment)\n this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,\n startLoc, this.curPosition())\n}\n\npp.skipLineComment = function(startSkip) {\n let start = this.pos\n let startLoc = this.options.onComment && this.curPosition()\n let ch = this.input.charCodeAt(this.pos+=startSkip)\n while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {\n ++this.pos\n ch = this.input.charCodeAt(this.pos)\n }\n if (this.options.onComment)\n this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,\n startLoc, this.curPosition())\n}\n\n// Called at the start of the parse and after every token. Skips\n// whitespace and comments, and.\n\npp.skipSpace = function() {\n loop: while (this.pos < this.input.length) {\n let ch = this.input.charCodeAt(this.pos)\n switch (ch) {\n case 32: case 160: // ' '\n ++this.pos\n break\n case 13:\n if (this.input.charCodeAt(this.pos + 1) === 10) {\n ++this.pos\n }\n case 10: case 8232: case 8233:\n ++this.pos\n if (this.options.locations) {\n ++this.curLine\n this.lineStart = this.pos\n }\n break\n case 47: // '/'\n switch (this.input.charCodeAt(this.pos + 1)) {\n case 42: // '*'\n this.skipBlockComment()\n break\n case 47:\n this.skipLineComment(2)\n break\n default:\n break loop\n }\n break\n default:\n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {\n ++this.pos\n } else {\n break loop\n }\n }\n }\n}\n\n// Called at the end of every token. Sets `end`, `val`, and\n// maintains `context` and `exprAllowed`, and skips the space after\n// the token, so that the next one's `start` will point at the\n// right position.\n\npp.finishToken = function(type, val) {\n this.end = this.pos\n if (this.options.locations) this.endLoc = this.curPosition()\n let prevType = this.type\n this.type = type\n this.value = val\n\n this.updateContext(prevType)\n}\n\n// ### Token reading\n\n// This is the function that is called to fetch the next token. It\n// is somewhat obscure, because it works in character codes rather\n// than characters, and because operator parsing has been inlined\n// into it.\n//\n// All in the name of speed.\n//\npp.readToken_dot = function() {\n let next = this.input.charCodeAt(this.pos + 1)\n if (next >= 48 && next <= 57) return this.readNumber(true)\n let next2 = this.input.charCodeAt(this.pos + 2)\n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'\n this.pos += 3\n return this.finishToken(tt.ellipsis)\n } else {\n ++this.pos\n return this.finishToken(tt.dot)\n }\n}\n\npp.readToken_slash = function() { // '/'\n let next = this.input.charCodeAt(this.pos + 1)\n if (this.exprAllowed) {++this.pos; return this.readRegexp()}\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.slash, 1)\n}\n\npp.readToken_mult_modulo_exp = function(code) { // '%*'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n let tokentype = code === 42 ? tt.star : tt.modulo\n\n // exponentiation operator ** and **=\n if (this.options.ecmaVersion >= 7 && next === 42) {\n ++size\n tokentype = tt.starstar\n next = this.input.charCodeAt(this.pos + 2)\n }\n\n if (next === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tokentype, size)\n}\n\npp.readToken_pipe_amp = function(code) { // '|&'\n let next = this.input.charCodeAt(this.pos + 1)\n if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2)\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1)\n}\n\npp.readToken_caret = function() { // '^'\n let next = this.input.charCodeAt(this.pos + 1)\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.bitwiseXOR, 1)\n}\n\npp.readToken_plus_min = function(code) { // '+-'\n let next = this.input.charCodeAt(this.pos + 1)\n if (next === code) {\n if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 &&\n lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {\n // A `-->` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 &&\n this.input.charCodeAt(this.pos + 3) == 45) {\n if (this.inModule) this.unexpected()\n // `