/* Riot Compiler, @license MIT */
(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.compiler = {}));
})(this, (function (exports) { 'use strict';

  var global = window;

  const TAG_LOGIC_PROPERTY = 'exports';
  const TAG_CSS_PROPERTY = 'css';
  const TAG_TEMPLATE_PROPERTY = 'template';
  const TAG_NAME_PROPERTY = 'name';
  const RIOT_MODULE_ID = 'riot';
  const RIOT_INTERFACE_WRAPPER_NAME = 'RiotComponentWrapper';
  const RIOT_TAG_INTERFACE_NAME = 'RiotComponent';

  const JAVASCRIPT_OUTPUT_NAME = 'javascript';
  const CSS_OUTPUT_NAME = 'css';
  const TEMPLATE_OUTPUT_NAME = 'template';

  // Tag names
  const JAVASCRIPT_TAG = 'script';
  const STYLE_TAG = 'style';
  const TEXTAREA_TAG = 'textarea';

  // Boolean attributes
  const IS_RAW = 'isRaw';
  const IS_SELF_CLOSING = 'isSelfClosing';
  const IS_VOID = 'isVoid';
  const IS_BOOLEAN = 'isBoolean';
  const IS_CUSTOM = 'isCustom';
  const IS_SPREAD = 'isSpread';

  var c = /*#__PURE__*/Object.freeze({
    __proto__: null,
    JAVASCRIPT_OUTPUT_NAME: JAVASCRIPT_OUTPUT_NAME,
    CSS_OUTPUT_NAME: CSS_OUTPUT_NAME,
    TEMPLATE_OUTPUT_NAME: TEMPLATE_OUTPUT_NAME,
    JAVASCRIPT_TAG: JAVASCRIPT_TAG,
    STYLE_TAG: STYLE_TAG,
    TEXTAREA_TAG: TEXTAREA_TAG,
    IS_RAW: IS_RAW,
    IS_SELF_CLOSING: IS_SELF_CLOSING,
    IS_VOID: IS_VOID,
    IS_BOOLEAN: IS_BOOLEAN,
    IS_CUSTOM: IS_CUSTOM,
    IS_SPREAD: IS_SPREAD
  });

  /**
   * Not all the types are handled in this module.
   *
   * @enum {number}
   * @readonly
   */
  const TAG = 1; /* TAG */
  const ATTR = 2; /* ATTR */
  const TEXT = 3; /* TEXT */
  const CDATA = 4; /* CDATA */
  const COMMENT = 8; /* COMMENT */
  const DOCUMENT = 9; /* DOCUMENT */
  const DOCTYPE = 10; /* DOCTYPE */
  const DOCUMENT_FRAGMENT = 11; /* DOCUMENT_FRAGMENT */

  var types$3 = /*#__PURE__*/Object.freeze({
    __proto__: null,
    TAG: TAG,
    ATTR: ATTR,
    TEXT: TEXT,
    CDATA: CDATA,
    COMMENT: COMMENT,
    DOCUMENT: DOCUMENT,
    DOCTYPE: DOCTYPE,
    DOCUMENT_FRAGMENT: DOCUMENT_FRAGMENT
  });

  const rootTagNotFound = 'Root tag not found.';
  const unclosedTemplateLiteral = 'Unclosed ES6 template literal.';
  const unexpectedEndOfFile = 'Unexpected end of file.';
  const unclosedComment = 'Unclosed comment.';
  const unclosedNamedBlock = 'Unclosed "%1" block.';
  const duplicatedNamedTag = 'Multiple inline "<%1>" tags are not supported.';
  const unexpectedCharInExpression = 'Unexpected character %1.';
  const unclosedExpression = 'Unclosed expression.';

  /**
   * Matches the start of valid tags names; used with the first 2 chars after the `'<'`.
   * @const
   * @private
   */
  const TAG_2C = /^(?:\/[a-zA-Z]|[a-zA-Z][^\s>/]?)/;
  /**
   * Matches valid tags names AFTER the validation with `TAG_2C`.
   * $1: tag name including any `'/'`, $2: non self-closing brace (`>`) w/o attributes.
   * @const
   * @private
   */
  const TAG_NAME = /(\/?[^\s>/]+)\s*(>)?/g;
  /**
   * Matches an attribute name-value pair (both can be empty).
   * $1: attribute name, $2: value including any quotes.
   * @const
   * @private
   */
  const ATTR_START = /(\S[^>/=\s]*)(?:\s*=\s*([^>/])?)?/g;

  /**
   * Matches the spread operator
   * it will be used for the spread attributes
   * @type {RegExp}
   */
  const SPREAD_OPERATOR = /\.\.\./;
  /**
   * Matches the closing tag of a `script` and `style` block.
   * Used by parseText fo find the end of the block.
   * @const
   * @private
   */
  const RE_SCRYLE = {
    script: /<\/script\s*>/gi,
    style: /<\/style\s*>/gi,
    textarea: /<\/textarea\s*>/gi
  };

  // Do not touch text content inside this tags
  const RAW_TAGS = /^\/?(?:pre|textarea)$/;

  /**
   * Add an item into a collection, if the collection is not an array
   * we create one and add the item to it
   * @param   {Array} collection - target collection
   * @param   {*} item - item to add to the collection
   * @returns {Array} array containing the new item added to it
   */
  function addToCollection(collection = [], item) {
    collection.push(item);
    return collection
  }

  /**
   * Run RegExp.exec starting from a specific position
   * @param   {RegExp} re - regex
   * @param   {number} pos - last index position
   * @param   {string} string - regex target
   * @returns {Array} regex result
   */
  function execFromPos(re, pos, string) {
    re.lastIndex = pos;
    return re.exec(string)
  }

  /**
   * Escape special characters in a given string, in preparation to create a regex.
   *
   * @param   {string} str - Raw string
   * @returns {string} Escaped string.
   */
  var escapeStr = (str) => str.replace(/(?=[-[\](){^*+?.$|\\])/g, '\\');

  function formatError$1(data, message, pos) {
    if (!pos) {
      pos = data.length;
    }
    // count unix/mac/win eols
    const line = (data.slice(0, pos).match(/\r\n?|\n/g) || '').length + 1;
    let col = 0;
    while (--pos >= 0 && !/[\r\n]/.test(data[pos])) {
      ++col;
    }
    return `[${line},${col}]: ${message}`
  }

  const $_ES6_BQ = '`';

  /**
   * Searches the next backquote that signals the end of the ES6 Template Literal
   * or the "${" sequence that starts a JS expression, skipping any escaped
   * character.
   *
   * @param   {string}    code  - Whole code
   * @param   {number}    pos   - The start position of the template
   * @param   {string[]}  stack - To save nested ES6 TL count
   * @returns {number}    The end of the string (-1 if not found)
   */
  function skipES6TL(code, pos, stack) {
    // we are in the char following the backquote (`),
    // find the next unescaped backquote or the sequence "${"
    const re = /[`$\\]/g;
    let c;
    while (re.lastIndex = pos, re.exec(code)) {
      pos = re.lastIndex;
      c = code[pos - 1];
      if (c === '`') {
        return pos
      }
      if (c === '$' && code[pos++] === '{') {
        stack.push($_ES6_BQ, '}');
        return pos
      }
      // else this is an escaped char
    }
    throw formatError$1(code, unclosedTemplateLiteral, pos)
  }

  /**
   * Custom error handler can be implemented replacing this method.
   * The `state` object includes the buffer (`data`)
   * The error position (`loc`) contains line (base 1) and col (base 0).
   * @param {string} data - string containing the error
   * @param {string} msg - Error message
   * @param {number} pos - Position of the error
   * @returns {undefined} throw an exception error
   */
  function panic$1(data, msg, pos) {
    const message = formatError$1(data, msg, pos);
    throw new Error(message)
  }

  // forked from https://github.com/aMarCruz/skip-regex

  // safe characters to precced a regex (including `=>`, `**`, and `...`)
  const beforeReChars = '[{(,;:?=|&!^~>%*/';
  const beforeReSign = `${beforeReChars}+-`;

  // keyword that can preceed a regex (`in` is handled as special case)
  const beforeReWords = [
    'case',
    'default',
    'do',
    'else',
    'in',
    'instanceof',
    'prefix',
    'return',
    'typeof',
    'void',
    'yield'
  ];

  // Last chars of all the beforeReWords elements to speed up the process.
  const wordsEndChar = beforeReWords.reduce((s, w) => s + w.slice(-1), '');

  // Matches literal regex from the start of the buffer.
  // The buffer to search must not include line-endings.
  const RE_LIT_REGEX = /^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/;

  // Valid characters for JavaScript variable names and literal numbers.
  const RE_JS_VCHAR = /[$\w]/;

  // Match dot characters that could be part of tricky regex
  const RE_DOT_CHAR = /.*/g;

  /**
   * Searches the position of the previous non-blank character inside `code`,
   * starting with `pos - 1`.
   *
   * @param   {string} code - Buffer to search
   * @param   {number} pos  - Starting position
   * @returns {number} Position of the first non-blank character to the left.
   * @private
   */
  function _prev(code, pos) {
    while (--pos >= 0 && /\s/.test(code[pos]));
    return pos
  }



  /**
   * Check if the character in the `start` position within `code` can be a regex
   * and returns the position following this regex or `start+1` if this is not
   * one.
   *
   * NOTE: Ensure `start` points to a slash (this is not checked).
   *
   * @function skipRegex
   * @param   {string} code  - Buffer to test in
   * @param   {number} start - Position the first slash inside `code`
   * @returns {number} Position of the char following the regex.
   *
   */
  /* istanbul ignore next */
  function skipRegex(code, start) {
    let pos = RE_DOT_CHAR.lastIndex = start++;

    // `exec()` will extract from the slash to the end of the line
    //   and the chained `match()` will match the possible regex.
    const match = (RE_DOT_CHAR.exec(code) || ' ')[0].match(RE_LIT_REGEX);

    if (match) {
      const next = pos + match[0].length;      // result comes from `re.match`

      pos = _prev(code, pos);
      let c = code[pos];

      // start of buffer or safe prefix?
      if (pos < 0 || beforeReChars.includes(c)) {
        return next
      }

      // from here, `pos` is >= 0 and `c` is code[pos]
      if (c === '.') {
        // can be `...` or something silly like 5./2
        if (code[pos - 1] === '.') {
          start = next;
        }

      } else {

        if (c === '+' || c === '-') {
          // tricky case
          if (code[--pos] !== c ||            // if have a single operator or
               (pos = _prev(code, pos)) < 0 ||  // ...have `++` and no previous token
               beforeReSign.includes(c = code[pos])) {
            return next                       // ...this is a regex
          }
        }

        if (wordsEndChar.includes(c)) {  // looks like a keyword?
          const end = pos + 1;

          // get the complete (previous) keyword
          while (--pos >= 0 && RE_JS_VCHAR.test(code[pos]));

          // it is in the allowed keywords list?
          if (beforeReWords.includes(code.slice(pos + 1, end))) {
            start = next;
          }
        }
      }
    }

    return start
  }

  /*
   * Mini-parser for expressions.
   * The main pourpose of this module is to find the end of an expression
   * and return its text without the enclosing brackets.
   * Does not works with comments, but supports ES6 template strings.
   */
  /**
   * @exports exprExtr
   */
  const S_SQ_STR = /'[^'\n\r\\]*(?:\\(?:\r\n?|[\S\s])[^'\n\r\\]*)*'/.source;
  /**
   * Matches double quoted JS strings taking care about nested quotes
   * and EOLs (escaped EOLs are Ok).
   *
   * @const
   * @private
   */
  const S_STRING = `${S_SQ_STR}|${S_SQ_STR.replace(/'/g, '"')}`;
  /**
   * Regex cache
   *
   * @type {Object.<string, RegExp>}
   * @const
   * @private
   */
  const reBr = {};
  /**
   * Makes an optimal regex that matches quoted strings, brackets, backquotes
   * and the closing brackets of an expression.
   *
   * @param   {string} b - Closing brackets
   * @returns {RegExp} - optimized regex
   */
  function _regex(b) {
    let re = reBr[b];
    if (!re) {
      let s = escapeStr(b);
      if (b.length > 1) {
        s = `${s}|[`;
      } else {
        s = /[{}[\]()]/.test(b) ? '[' : `[${s}`;
      }
      reBr[b] = re = new RegExp(`${S_STRING}|${s}\`/\\{}[\\]()]`, 'g');
    }
    return re
  }

  /**
   * Update the scopes stack removing or adding closures to it
   * @param   {Array} stack - array stacking the expression closures
   * @param   {string} char - current char to add or remove from the stack
   * @param   {string} idx  - matching index
   * @param   {string} code - expression code
   * @returns {Object} result
   * @returns {Object} result.char - either the char received or the closing braces
   * @returns {Object} result.index - either a new index to skip part of the source code,
   *                                  or 0 to keep from parsing from the old position
   */
  function updateStack(stack, char, idx, code) {
    let index = 0;

    switch (char) {
    case '[':
    case '(':
    case '{':
      stack.push(char === '[' ? ']' : char === '(' ? ')' : '}');
      break
    case ')':
    case ']':
    case '}':
      if (char !== stack.pop()) {
        panic$1(code, unexpectedCharInExpression.replace('%1', char), index);
      }

      if (char === '}' && stack[stack.length - 1] === $_ES6_BQ) {
        char = stack.pop();
      }

      index = idx + 1;
      break
    case '/':
      index = skipRegex(code, idx);
    }

    return { char, index }
  }

  /**
     * Parses the code string searching the end of the expression.
     * It skips braces, quoted strings, regexes, and ES6 template literals.
     *
     * @function exprExtr
     * @param   {string}  code  - Buffer to parse
     * @param   {number}  start - Position of the opening brace
     * @param   {[string,string]} bp - Brackets pair
     * @returns {Object} Expression's end (after the closing brace) or -1
     *                            if it is not an expr.
     */
  function exprExtr(code, start, bp) {
    const [openingBraces, closingBraces] = bp;
    const offset = start + openingBraces.length; // skips the opening brace
    const stack = []; // expected closing braces ('`' for ES6 TL)
    const re = _regex(closingBraces);

    re.lastIndex = offset; // begining of the expression

    let end;
    let match;

    while (match = re.exec(code)) { // eslint-disable-line
      const idx = match.index;
      const str = match[0];
      end = re.lastIndex;

      // end the iteration
      if (str === closingBraces && !stack.length) {
        return {
          text: code.slice(offset, idx),
          start,
          end
        }
      }

      const { char, index } = updateStack(stack, str[0], idx, code);
      // update the end value depending on the new index received
      end = index || end;
      // update the regex last index
      re.lastIndex = char === $_ES6_BQ ? skipES6TL(code, end, stack) : end;
    }

    if (stack.length) {
      panic$1(code, unclosedExpression, end);
    }
  }

  /**
   * Outputs the last parsed node. Can be used with a builder too.
   *
   * @param   {ParserStore} store - Parsing store
   * @returns {undefined} void function
   * @private
   */
  function flush(store) {
    const last = store.last;
    store.last = null;
    if (last && store.root) {
      store.builder.push(last);
    }
  }

  /**
   * Get the code chunks from start and end range
   * @param   {string}  source  - source code
   * @param   {number}  start   - Start position of the chunk we want to extract
   * @param   {number}  end     - Ending position of the chunk we need
   * @returns {string}  chunk of code extracted from the source code received
   * @private
   */
  function getChunk(source, start, end) {
    return source.slice(start, end)
  }

  /**
   * states text in the last text node, or creates a new one if needed.
   *
   * @param {ParserState}   state   - Current parser state
   * @param {number}  start   - Start position of the tag
   * @param {number}  end     - Ending position (last char of the tag)
   * @param {Object}  extra   - extra properties to add to the text node
   * @param {RawExpr[]} extra.expressions  - Found expressions
   * @param {string}    extra.unescape     - Brackets to unescape
   * @returns {undefined} - void function
   * @private
   */
  function pushText(state, start, end, extra = {}) {
    const text = getChunk(state.data, start, end);
    const expressions = extra.expressions;
    const unescape = extra.unescape;

    let q = state.last;
    state.pos = end;

    if (q && q.type === TEXT) {
      q.text += text;
      q.end = end;
    } else {
      flush(state);
      state.last = q = { type: TEXT, text, start, end };
    }

    if (expressions && expressions.length) {
      q.expressions = (q.expressions || []).concat(expressions);
    }

    if (unescape) {
      q.unescape = unescape;
    }

    return TEXT
  }

  /**
   * Find the end of the attribute value or text node
   * Extract expressions.
   * Detect if value have escaped brackets.
   *
   * @param   {ParserState} state  - Parser state
   * @param   {HasExpr} node       - Node if attr, info if text
   * @param   {string} endingChars - Ends the value or text
   * @param   {number} start       - Starting position
   * @returns {number} Ending position
   * @private
   */
  function expr(state, node, endingChars, start) {
    const re = b0re(state, endingChars);

    re.lastIndex = start; // reset re position

    const { unescape, expressions, end } = parseExpressions(state, re);

    if (node) {
      if (unescape) {
        node.unescape = unescape;
      }
      if (expressions.length) {
        node.expressions = expressions;
      }
    } else {
      pushText(state, start, end, {expressions, unescape});
    }

    return end
  }

  /**
   * Parse a text chunk finding all the expressions in it
   * @param   {ParserState} state  - Parser state
   * @param   {RegExp} re - regex to match the expressions contents
   * @returns {Object} result containing the expression found, the string to unescape and the end position
   */
  function parseExpressions(state, re) {
    const { data, options } = state;
    const { brackets } = options;
    const expressions = [];
    let unescape, pos, match;

    // Anything captured in $1 (closing quote or character) ends the loop...
    while ((match = re.exec(data)) && !match[1]) {
      // ...else, we have an opening bracket and maybe an expression.
      pos = match.index;
      if (data[pos - 1] === '\\') {
        unescape = match[0]; // it is an escaped opening brace
      } else {
        const tmpExpr = exprExtr(data, pos, brackets);
        if (tmpExpr) {
          expressions.push(tmpExpr);
          re.lastIndex = tmpExpr.end;
        }
      }
    }

    // Even for text, the parser needs match a closing char
    if (!match) {
      panic$1(data, unexpectedEndOfFile, pos);
    }

    return {
      unescape,
      expressions,
      end: match.index
    }
  }



  /**
   * Creates a regex for the given string and the left bracket.
   * The string is captured in $1.
   *
   * @param   {ParserState} state  - Parser state
   * @param   {string} str - String to search
   * @returns {RegExp} Resulting regex.
   * @private
   */
  function b0re(state, str) {
    const { brackets } = state.options;
    const re = state.regexCache[str];

    if (re) return re

    const b0 = escapeStr(brackets[0]);
    // cache the regex extending the regexCache object
    Object.assign(state.regexCache, { [str]: new RegExp(`(${str})|${b0}`, 'g') });

    return state.regexCache[str]
  }

  // similar to _.uniq
  const uniq = l => l.filter((x, i, a) => a.indexOf(x) === i);

  /**
   * SVG void elements that cannot be auto-closed and shouldn't contain child nodes.
   * @const {Array}
   */
  const VOID_SVG_TAGS_LIST = [
    'circle',
    'ellipse',
    'line',
    'path',
    'polygon',
    'polyline',
    'rect',
    'stop',
    'use'
  ];

  /**
   * List of html elements where the value attribute is allowed
   * @type {Array}
   */
  const HTML_ELEMENTS_HAVING_VALUE_ATTRIBUTE_LIST = [
    'button',
    'data',
    'input',
    'select',
    'li',
    'meter',
    'option',
    'output',
    'progress',
    'textarea',
    'param'
  ];

  /**
   * List of all the available svg tags
   * @const {Array}
   * @see {@link https://github.com/wooorm/svg-tag-names}
   */
  const SVG_TAGS_LIST = uniq([
    'a',
    'altGlyph',
    'altGlyphDef',
    'altGlyphItem',
    'animate',
    'animateColor',
    'animateMotion',
    'animateTransform',
    'animation',
    'audio',
    'canvas',
    'clipPath',
    'color-profile',
    'cursor',
    'defs',
    'desc',
    'discard',
    'feBlend',
    'feColorMatrix',
    'feComponentTransfer',
    'feComposite',
    'feConvolveMatrix',
    'feDiffuseLighting',
    'feDisplacementMap',
    'feDistantLight',
    'feDropShadow',
    'feFlood',
    'feFuncA',
    'feFuncB',
    'feFuncG',
    'feFuncR',
    'feGaussianBlur',
    'feImage',
    'feMerge',
    'feMergeNode',
    'feMorphology',
    'feOffset',
    'fePointLight',
    'feSpecularLighting',
    'feSpotLight',
    'feTile',
    'feTurbulence',
    'filter',
    'font',
    'font-face',
    'font-face-format',
    'font-face-name',
    'font-face-src',
    'font-face-uri',
    'foreignObject',
    'g',
    'glyph',
    'glyphRef',
    'handler',
    'hatch',
    'hatchpath',
    'hkern',
    'iframe',
    'image',
    'linearGradient',
    'listener',
    'marker',
    'mask',
    'mesh',
    'meshgradient',
    'meshpatch',
    'meshrow',
    'metadata',
    'missing-glyph',
    'mpath',
    'pattern',
    'prefetch',
    'radialGradient',
    'script',
    'set',
    'solidColor',
    'solidcolor',
    'style',
    'svg',
    'switch',
    'symbol',
    'tbreak',
    'text',
    'textArea',
    'textPath',
    'title',
    'tref',
    'tspan',
    'unknown',
    'video',
    'view',
    'vkern'
  ].concat(VOID_SVG_TAGS_LIST)).sort();

  /**
   * HTML void elements that cannot be auto-closed and shouldn't contain child nodes.
   * @type {Array}
   * @see   {@link http://www.w3.org/TR/html-markup/syntax.html#syntax-elements}
   * @see   {@link http://www.w3.org/TR/html5/syntax.html#void-elements}
   */
  const VOID_HTML_TAGS_LIST = [
    'area',
    'base',
    'br',
    'col',
    'embed',
    'hr',
    'img',
    'input',
    'keygen',
    'link',
    'menuitem',
    'meta',
    'param',
    'source',
    'track',
    'wbr'
  ];

  /**
   * List of all the html tags
   * @const {Array}
   * @see {@link https://github.com/sindresorhus/html-tags}
   */
  const HTML_TAGS_LIST = uniq([
    'a',
    'abbr',
    'address',
    'article',
    'aside',
    'audio',
    'b',
    'bdi',
    'bdo',
    'blockquote',
    'body',
    'canvas',
    'caption',
    'cite',
    'code',
    'colgroup',
    'datalist',
    'dd',
    'del',
    'details',
    'dfn',
    'dialog',
    'div',
    'dl',
    'dt',
    'em',
    'fieldset',
    'figcaption',
    'figure',
    'footer',
    'form',
    'h1',
    'h2',
    'h3',
    'h4',
    'h5',
    'h6',
    'head',
    'header',
    'hgroup',
    'html',
    'i',
    'iframe',
    'ins',
    'kbd',
    'label',
    'legend',
    'main',
    'map',
    'mark',
    'math',
    'menu',
    'nav',
    'noscript',
    'object',
    'ol',
    'optgroup',
    'p',
    'picture',
    'pre',
    'q',
    'rb',
    'rp',
    'rt',
    'rtc',
    'ruby',
    's',
    'samp',
    'script',
    'section',
    'select',
    'slot',
    'small',
    'span',
    'strong',
    'style',
    'sub',
    'summary',
    'sup',
    'svg',
    'table',
    'tbody',
    'td',
    'template',
    'tfoot',
    'th',
    'thead',
    'time',
    'title',
    'tr',
    'u',
    'ul',
    'var',
    'video'
  ]
    .concat(VOID_HTML_TAGS_LIST)
    .concat(HTML_ELEMENTS_HAVING_VALUE_ATTRIBUTE_LIST)
  ).sort();

  /**
   * List of all boolean HTML attributes
   * @const {RegExp}
   * @see {@link https://www.w3.org/TR/html5/infrastructure.html#sec-boolean-attributes}
   */
  const BOOLEAN_ATTRIBUTES_LIST = [
    'disabled',
    'visible',
    'checked',
    'readonly',
    'required',
    'allowfullscreen',
    'autofocus',
    'autoplay',
    'compact',
    'controls',
    'default',
    'formnovalidate',
    'hidden',
    'ismap',
    'itemscope',
    'loop',
    'multiple',
    'muted',
    'noresize',
    'noshade',
    'novalidate',
    'nowrap',
    'open',
    'reversed',
    'seamless',
    'selected',
    'sortable',
    'truespeed',
    'typemustmatch'
  ];

  /**
   * Join a list of items with the pipe symbol (usefull for regex list concatenation)
   * @private
   * @param   {Array} list - list of strings
   * @returns {string} the list received joined with pipes
   */
  function joinWithPipe(list) {
    return list.join('|')
  }

  /**
   * Convert list of strings to regex in order to test against it ignoring the cases
   * @private
   * @param   {...Array} lists - array of strings
   * @returns {RegExp} regex that will match all the strings in the array received ignoring the cases
   */
  function listsToRegex(...lists) {
    return new RegExp(`^/?(?:${joinWithPipe(lists.map(joinWithPipe))})$`, 'i')
  }

  /**
   * Regex matching all the html tags ignoring the cases
   * @const {RegExp}
   */
  const HTML_TAGS_RE = listsToRegex(HTML_TAGS_LIST);

  /**
   * Regex matching all the svg tags ignoring the cases
   * @const {RegExp}
   */
  const SVG_TAGS_RE = listsToRegex(SVG_TAGS_LIST);

  /**
   * Regex matching all the void html tags ignoring the cases
   * @const {RegExp}
   */
  const VOID_HTML_TAGS_RE =  listsToRegex(VOID_HTML_TAGS_LIST);

  /**
   * Regex matching all the void svg tags ignoring the cases
   * @const {RegExp}
   */
  const VOID_SVG_TAGS_RE =  listsToRegex(VOID_SVG_TAGS_LIST);

  /**
   * Regex matching all the html tags where the value tag is allowed
   * @const {RegExp}
   */
  const HTML_ELEMENTS_HAVING_VALUE_ATTRIBUTE_RE = listsToRegex(HTML_ELEMENTS_HAVING_VALUE_ATTRIBUTE_LIST);

  /**
   * Regex matching all the boolean attributes
   * @const {RegExp}
   */
  const BOOLEAN_ATTRIBUTES_RE =  listsToRegex(BOOLEAN_ATTRIBUTES_LIST);

  /**
   * True if it's a self closing tag
   * @param   {string}  tag - test tag
   * @returns {boolean} true if void
   * @example
   * isVoid('meta') // true
   * isVoid('circle') // true
   * isVoid('IMG') // true
   * isVoid('div') // false
   * isVoid('mask') // false
   */
  function isVoid(tag) {
    return [
      VOID_HTML_TAGS_RE,
      VOID_SVG_TAGS_RE
    ].some(r => r.test(tag))
  }

  /**
   * True if it's not SVG nor a HTML known tag
   * @param   {string}  tag - test tag
   * @returns {boolean} true if custom element
   * @example
   * isCustom('my-component') // true
   * isCustom('div') // false
   */
  function isCustom(tag) {
    return [
      HTML_TAGS_RE,
      SVG_TAGS_RE
    ].every(l => !l.test(tag))
  }

  /**
   * True if the value attribute is allowed on this tag
   * @param   {string}  tag - test tag
   * @returns {boolean} true if the value attribute is allowed
   * @example
   * hasValueAttribute('input') // true
   * hasValueAttribute('div') // false
   */
  function hasValueAttribute(tag) {
    return HTML_ELEMENTS_HAVING_VALUE_ATTRIBUTE_RE.test(tag)
  }

  /**
   * True if it's a boolean attribute
   * @param   {string} attribute - test attribute
   * @returns {boolean} true if the attribute is a boolean type
   * @example
   * isBoolAttribute('selected') // true
   * isBoolAttribute('class') // false
   */
  function isBoolAttribute(attribute) {
    return BOOLEAN_ATTRIBUTES_RE.test(attribute)
  }

  /**
   * Memoization function
   * @param   {Function} fn - function to memoize
   * @returns {*} return of the function to memoize
   */
  function memoize(fn) {
    const cache = new WeakMap();

    return (...args) => {
      if (cache.has(args[0])) return cache.get(args[0])

      const ret = fn(...args);

      cache.set(args[0], ret);

      return ret
    }
  }

  const expressionsContentRe = memoize(brackets => RegExp(`(${brackets[0]}[^${brackets[1]}]*?${brackets[1]})`, 'g'));
  const isSpreadAttribute$1 = name => SPREAD_OPERATOR.test(name);
  const isAttributeExpression = (name, brackets) => name[0] === brackets[0];
  const getAttributeEnd = (state, attr) => expr(state, attr, '[>/\\s]', attr.start);

  /**
   * The more complex parsing is for attributes as it can contain quoted or
   * unquoted values or expressions.
   *
   * @param   {ParserStore} state  - Parser state
   * @returns {number} New parser mode.
   * @private
   */
  function attr(state) {
    const { data, last, pos, root } = state;
    const tag = last; // the last (current) tag in the output
    const _CH = /\S/g; // matches the first non-space char
    const ch = execFromPos(_CH, pos, data);

    switch (true) {
    case !ch:
      state.pos = data.length; // reaching the end of the buffer with
      // NodeTypes.ATTR will generate error
      break
    case ch[0] === '>':
      // closing char found. If this is a self-closing tag with the name of the
      // Root tag, we need decrement the counter as we are changing mode.
      state.pos = tag.end = _CH.lastIndex;
      if (tag[IS_SELF_CLOSING]) {
        state.scryle = null; // allow selfClosing script/style tags
        if (root && root.name === tag.name) {
          state.count--; // "pop" root tag
        }
      }
      return TEXT
    case ch[0] === '/':
      state.pos = _CH.lastIndex; // maybe. delegate the validation
      tag[IS_SELF_CLOSING] = true; // the next loop
      break
    default:
      delete tag[IS_SELF_CLOSING]; // ensure unmark as selfclosing tag
      setAttribute(state, ch.index, tag);
    }

    return ATTR
  }

  /**
   * Parses an attribute and its expressions.
   *
   * @param   {ParserStore}  state  - Parser state
   * @param   {number} pos    - Starting position of the attribute
   * @param   {Object} tag    - Current parent tag
   * @returns {undefined} void function
   * @private
   */
  function setAttribute(state, pos, tag) {
    const { data } = state;
    const expressionContent = expressionsContentRe(state.options.brackets);
    const re = ATTR_START; // (\S[^>/=\s]*)(?:\s*=\s*([^>/])?)? g
    const start = re.lastIndex = expressionContent.lastIndex = pos; // first non-whitespace
    const attrMatches = re.exec(data);
    const isExpressionName = isAttributeExpression(attrMatches[1], state.options.brackets);
    const match = isExpressionName ? [null, expressionContent.exec(data)[1], null] : attrMatches;

    if (match) {
      const end = re.lastIndex;
      const attr = parseAttribute(state, match, start, end, isExpressionName);

      //assert(q && q.type === Mode.TAG, 'no previous tag for the attr!')
      // Pushes the attribute and shifts the `end` position of the tag (`last`).
      state.pos = tag.end = attr.end;
      tag.attributes = addToCollection(tag.attributes, attr);
    }
  }

  function parseNomalAttribute(state, attr, quote) {
    const { data } = state;
    let { end } = attr;

    if (isBoolAttribute(attr.name)) {
      attr[IS_BOOLEAN] = true;
    }

    // parse the whole value (if any) and get any expressions on it
    if (quote) {
      // Usually, the value's first char (`quote`) is a quote and the lastIndex
      // (`end`) is the start of the value.
      let valueStart = end;
      // If it not, this is an unquoted value and we need adjust the start.
      if (quote !== '"' && quote !== '\'') {
        quote = ''; // first char of value is not a quote
        valueStart--; // adjust the starting position
      }

      end = expr(state, attr, quote || '[>/\\s]', valueStart);

      // adjust the bounds of the value and save its content
      return Object.assign(attr, {
        value: getChunk(data, valueStart, end),
        valueStart,
        end: quote ? ++end : end
      })
    }

    return attr
  }


  /**
   * Parse expression names <a {href}>
   * @param   {ParserStore}  state  - Parser state
   * @param   {Object} attr - attribute object parsed
   * @returns {Object} normalized attribute object
   */
  function parseSpreadAttribute(state, attr) {
    const end = getAttributeEnd(state, attr);

    return {
      [IS_SPREAD]: true,
      start: attr.start,
      expressions: attr.expressions.map(expr => Object.assign(expr, {
        text: expr.text.replace(SPREAD_OPERATOR, '').trim()
      })),
      end: end
    }
  }

  /**
   * Parse expression names <a {href}>
   * @param   {ParserStore}  state  - Parser state
   * @param   {Object} attr - attribute object parsed
   * @returns {Object} normalized attribute object
   */
  function parseExpressionNameAttribute(state, attr) {
    const end = getAttributeEnd(state, attr);

    return {
      start: attr.start,
      name: attr.expressions[0].text.trim(),
      expressions: attr.expressions,
      end: end
    }
  }

  /**
   * Parse the attribute values normalising the quotes
   * @param   {ParserStore}  state  - Parser state
   * @param   {Array} match - results of the attributes regex
   * @param   {number} start - attribute start position
   * @param   {number} end - attribute end position
   * @param   {boolean} isExpressionName - true if the attribute name is an expression
   * @returns {Object} attribute object
   */
  function parseAttribute(state, match, start, end, isExpressionName) {
    const attr = {
      name: match[1],
      value: '',
      start,
      end
    };

    const quote = match[2]; // first letter of value or nothing

    switch (true) {
    case isSpreadAttribute$1(attr.name):
      return parseSpreadAttribute(state, attr)
    case isExpressionName === true:
      return parseExpressionNameAttribute(state, attr)
    default:
      return parseNomalAttribute(state, attr, quote)
    }
  }

  /**
   * Function to curry any javascript method
   * @param   {Function}  fn - the target function we want to curry
   * @param   {...[args]} acc - initial arguments
   * @returns {Function|*} it will return a function until the target function
   *                       will receive all of its arguments
   */
  function curry(fn, ...acc) {
    return (...args) => {
      args = [...acc, ...args];

      return args.length < fn.length ?
        curry(fn, ...args) :
        fn(...args)
    }
  }

  /**
   * Parses comments in long or short form
   * (any DOCTYPE & CDATA blocks are parsed as comments).
   *
   * @param   {ParserState} state  - Parser state
   * @param   {string} data       - Buffer to parse
   * @param   {number} start      - Position of the '<!' sequence
   * @returns {number} node type id
   * @private
   */
  function comment(state, data, start) {
    const pos = start + 2; // skip '<!'
    const isLongComment = data.substr(pos, 2) === '--';
    const str = isLongComment ? '-->' : '>';
    const end = data.indexOf(str, pos);

    if (end < 0) {
      panic$1(data, unclosedComment, start);
    }

    pushComment(
      state,
      start,
      end + str.length,
      data.substring(start, end + str.length)
    );

    return TEXT
  }

  /**
   * Parse a comment.
   *
   * @param   {ParserState}  state - Current parser state
   * @param   {number}  start - Start position of the tag
   * @param   {number}  end   - Ending position (last char of the tag)
   * @param   {string}  text  - Comment content
   * @returns {undefined} void function
   * @private
   */
  function pushComment(state, start, end, text) {
    state.pos = end;
    if (state.options.comments === true) {
      flush(state);
      state.last = {
        type: COMMENT,
        start,
        end,
        text
      };
    }
  }

  /**
   * Pushes a new *tag* and set `last` to this, so any attributes
   * will be included on this and shifts the `end`.
   *
   * @param   {ParserState} state  - Current parser state
   * @param   {string}  name      - Name of the node including any slash
   * @param   {number}  start     - Start position of the tag
   * @param   {number}  end       - Ending position (last char of the tag + 1)
   * @returns {undefined} - void function
   * @private
   */
  function pushTag(state, name, start, end) {
    const root = state.root;
    const last = { type: TAG, name, start, end };

    if (isCustom(name)) {
      last[IS_CUSTOM] = true;
    }

    if (isVoid(name)) {
      last[IS_VOID] = true;
    }

    state.pos = end;

    if (root) {
      if (name === root.name) {
        state.count++;
      } else if (name === root.close) {
        state.count--;
      }
      flush(state);
    } else {
      // start with root (keep ref to output)
      state.root = { name: last.name, close: `/${name}` };
      state.count = 1;
    }

    state.last = last;
  }

  /**
   * Parse the tag following a '<' character, or delegate to other parser
   * if an invalid tag name is found.
   *
   * @param   {ParserState} state  - Parser state
   * @returns {number} New parser mode
   * @private
   */
  function tag(state) {
    const { pos, data } = state; // pos of the char following '<'
    const start = pos - 1; // pos of '<'
    const str = data.substr(pos, 2); // first two chars following '<'

    switch (true) {
    case str[0] === '!':
      return comment(state, data, start)
    case TAG_2C.test(str):
      return parseTag(state, start)
    default:
      return pushText(state, start, pos) // pushes the '<' as text
    }
  }

  function parseTag(state, start) {
    const { data, pos } = state;
    const re = TAG_NAME; // (\/?[^\s>/]+)\s*(>)? g
    const match = execFromPos(re, pos, data);
    const end = re.lastIndex;
    const name = match[1].toLowerCase(); // $1: tag name including any '/'
    // script/style block is parsed as another tag to extract attributes
    if (name in RE_SCRYLE) {
      state.scryle = name; // used by parseText
    }

    pushTag(state, name, start, end);
    // only '>' can ends the tag here, the '/' is handled in parseAttribute
    if (!match[2]) {
      return ATTR
    }

    return TEXT
  }

  /**
   * Parses regular text and script/style blocks ...scryle for short :-)
   * (the content of script and style is text as well)
   *
   * @param   {ParserState} state - Parser state
   * @returns {number} New parser mode.
   * @private
   */
  function text(state) {
    const { pos, data, scryle } = state;

    switch (true) {
    case typeof scryle === 'string': {
      const name = scryle;
      const re = RE_SCRYLE[name];
      const match = execFromPos(re, pos, data);

      if (!match) {
        panic$1(data, unclosedNamedBlock.replace('%1', name), pos - 1);
      }

      const start = match.index;
      const end = re.lastIndex;
      state.scryle = null; // reset the script/style flag now
      // write the tag content, if any
      if (start > pos) {
        parseSpecialTagsContent(state, name, match);
      }
      // now the closing tag, either </script> or </style>
      pushTag(state, `/${name}`, start, end);
      break
    }
    case data[pos] === '<':
      state.pos++;
      return TAG
    default:
      expr(state, null, '<', pos);
    }

    return TEXT
  }

  /**
   * Parse the text content depending on the name
   * @param   {ParserState} state - Parser state
   * @param   {string} name  - one of the tags matched by the RE_SCRYLE regex
   * @param   {Array}  match - result of the regex matching the content of the parsed tag
   * @returns {undefined} void function
   */
  function parseSpecialTagsContent(state, name, match) {
    const { pos } = state;
    const start = match.index;

    if (name === TEXTAREA_TAG) {
      expr(state, null, match[0], pos);
    } else {
      pushText(state, pos, start);
    }
  }

  /*---------------------------------------------------------------------
   * Tree builder for the riot tag parser.
   *
   * The output has a root property and separate arrays for `html`, `css`,
   * and `js` tags.
   *
   * The root tag is included as first element in the `html` array.
   * Script tags marked with "defer" are included in `html` instead `js`.
   *
   * - Mark SVG tags
   * - Mark raw tags
   * - Mark void tags
   * - Split prefixes from expressions
   * - Unescape escaped brackets and escape EOLs and backslashes
   * - Compact whitespace (option `compact`) for non-raw tags
   * - Create an array `parts` for text nodes and attributes
   *
   * Throws on unclosed tags or closing tags without start tag.
   * Selfclosing and void tags has no nodes[] property.
   */

  /**
   * Escape the carriage return and the line feed from a string
   * @param   {string} string - input string
   * @returns {string} output string escaped
   */
  function escapeReturn(string) {
    return string
      .replace(/\r/g, '\\r')
      .replace(/\n/g, '\\n')
  }

  // check whether a tag has the 'src' attribute set like for example `<script src="">`
  const hasSrcAttribute = node => (node.attributes || []).some(attr => attr.name === 'src');

  /**
   * Escape double slashes in a string
   * @param   {string} string - input string
   * @returns {string} output string escaped
   */
  function escapeSlashes(string) {
    return string.replace(/\\/g, '\\\\')
  }

  /**
   * Replace the multiple spaces with only one
   * @param   {string} string - input string
   * @returns {string} string without trailing spaces
   */
  function cleanSpaces(string) {
    return string.replace(/\s+/g, ' ')
  }

  const TREE_BUILDER_STRUCT = Object.seal({
    get() {
      const store = this.store;
      // The real root tag is in store.root.nodes[0]
      return {
        [TEMPLATE_OUTPUT_NAME]: store.root.nodes[0],
        [CSS_OUTPUT_NAME]: store[STYLE_TAG],
        [JAVASCRIPT_OUTPUT_NAME]: store[JAVASCRIPT_TAG]
      }
    },

    /**
    * Process the current tag or text.
    * @param {Object} node - Raw pseudo-node from the parser
    * @returns {undefined} void function
    */
    push(node) {
      const store = this.store;

      switch (node.type) {
      case COMMENT:
        this.pushComment(store, node);
        break
      case TEXT:
        this.pushText(store, node);
        break
      case TAG: {
        const name = node.name;
        const closingTagChar = '/';
        const [firstChar] = name;

        if (firstChar === closingTagChar && !node.isVoid) {
          this.closeTag(store, node, name);
        } else if (firstChar !== closingTagChar) {
          this.openTag(store, node);
        }
        break
      }
      }
    },
    pushComment(store, node) {
      const parent = store.last;

      parent.nodes.push(node);
    },
    closeTag(store, node) {
      const last = store.scryle || store.last;

      last.end = node.end;

      // update always the root node end position
      if (store.root.nodes[0]) store.root.nodes[0].end = node.end;

      if (store.scryle) {
        store.scryle = null;
      } else {
        store.last = store.stack.pop();
      }
    },

    openTag(store, node) {
      const name = node.name;
      const attrs = node.attributes;
      const isCoreTag = (JAVASCRIPT_TAG === name && !hasSrcAttribute(node) || name === STYLE_TAG);

      if (isCoreTag) {
        // Only accept one of each
        if (store[name]) {
          panic$1(this.store.data, duplicatedNamedTag.replace('%1', name), node.start);
        }

        store[name] = node;
        store.scryle = store[name];
      } else {
        // store.last holds the last tag pushed in the stack and this are
        // non-void, non-empty tags, so we are sure the `lastTag` here
        // have a `nodes` property.
        const lastTag = store.last;
        const newNode = node;

        lastTag.nodes.push(newNode);

        if (lastTag[IS_RAW] || RAW_TAGS.test(name)) {
          node[IS_RAW] = true;
        }

        if (!node[IS_SELF_CLOSING] && !node[IS_VOID]) {
          store.stack.push(lastTag);
          newNode.nodes = [];
          store.last = newNode;
        }
      }

      if (attrs) {
        this.attrs(attrs);
      }
    },
    attrs(attributes) {
      attributes.forEach(attr => {
        if (attr.value) {
          this.split(attr, attr.value, attr.valueStart, true);
        }
      });
    },
    pushText(store, node) {
      const text = node.text;
      const empty = !/\S/.test(text);
      const scryle = store.scryle;
      if (!scryle) {
        // store.last always have a nodes property
        const parent = store.last;

        const pack = this.compact && !parent[IS_RAW];
        if (pack && empty) {
          return
        }
        this.split(node, text, node.start, pack);
        parent.nodes.push(node);
      } else if (!empty) {
        scryle.text = node;
      }
    },
    split(node, source, start, pack) {
      const expressions = node.expressions;
      const parts = [];

      if (expressions) {
        let pos = 0;

        expressions.forEach(expr => {
          const text = source.slice(pos, expr.start - start);
          const code = expr.text;
          parts.push(this.sanitise(node, text, pack), escapeReturn(escapeSlashes(code).trim()));
          pos = expr.end - start;
        });

        if (pos < node.end) {
          parts.push(this.sanitise(node, source.slice(pos), pack));
        }
      } else {
        parts[0] = this.sanitise(node, source, pack);
      }

      node.parts = parts.filter(p => p); // remove the empty strings
    },
    // unescape escaped brackets and split prefixes of expressions
    sanitise(node, text, pack) {
      let rep = node.unescape;
      if (rep) {
        let idx = 0;
        rep = `\\${rep}`;
        while ((idx = text.indexOf(rep, idx)) !== -1) {
          text = text.substr(0, idx) + text.substr(idx + 1);
          idx++;
        }
      }

      text = escapeSlashes(text);

      return pack ? cleanSpaces(text) : escapeReturn(text)
    }
  });

  function createTreeBuilder(data, options) {
    const root = {
      type: TAG,
      name: '',
      start: 0,
      end: 0,
      nodes: []
    };

    return Object.assign(Object.create(TREE_BUILDER_STRUCT), {
      compact: options.compact !== false,
      store: {
        last: root,
        stack: [],
        scryle: null,
        root,
        style: null,
        script: null,
        data
      }
    })
  }

  /**
   * Factory for the Parser class, exposing only the `parse` method.
   * The export adds the Parser class as property.
   *
   * @param   {Object}   options - User Options
   * @param   {Function} customBuilder - Tree builder factory
   * @returns {Function} Public Parser implementation.
   */
  function parser$1(options, customBuilder) {
    const state = curry(createParserState)(options, customBuilder || createTreeBuilder);
    return {
      parse: (data) => parse$1(state(data))
    }
  }

  /**
   * Create a new state object
   * @param   {Object} userOptions - parser options
   * @param   {Function} builder - Tree builder factory
   * @param   {string} data - data to parse
   * @returns {ParserState} it represents the current parser state
   */
  function createParserState(userOptions, builder, data) {
    const options = Object.assign({
      brackets: ['{', '}']
    }, userOptions);

    return {
      options,
      regexCache: {},
      pos: 0,
      count: -1,
      root: null,
      last: null,
      scryle: null,
      builder: builder(data, options),
      data
    }
  }

  /**
   * It creates a raw output of pseudo-nodes with one of three different types,
   * all of them having a start/end position:
   *
   * - TAG     -- Opening or closing tags
   * - TEXT    -- Raw text
   * - COMMENT -- Comments
   *
   * @param   {ParserState}  state - Current parser state
   * @returns {ParserResult} Result, contains data and output properties.
   */
  function parse$1(state) {
    const { data } = state;

    walk(state);
    flush(state);

    if (state.count) {
      panic$1(data, state.count > 0 ? unexpectedEndOfFile : rootTagNotFound, state.pos);
    }

    return {
      data,
      output: state.builder.get()
    }
  }

  /**
   * Parser walking recursive function
   * @param {ParserState}  state - Current parser state
   * @param {string} type - current parsing context
   * @returns {undefined} void function
   */
  function walk(state, type) {
    const { data } = state;
    // extend the state adding the tree builder instance and the initial data
    const length = data.length;

    // The "count" property is set to 1 when the first tag is found.
    // This becomes the root and precedent text or comments are discarded.
    // So, at the end of the parsing count must be zero.
    if (state.pos < length && state.count) {
      walk(state, eat(state, type));
    }
  }

  /**
   * Function to help iterating on the current parser state
   * @param {ParserState}  state - Current parser state
   * @param   {string} type - current parsing context
   * @returns {string} parsing context
   */
  function eat(state, type) {
    switch (type) {
    case TAG:
      return tag(state)
    case ATTR:
      return attr(state)
    default:
      return text(state)
    }
  }

  /**
   * Expose the internal constants
   */
  const constants = c;

  /**
   * The nodeTypes definition
   */
  const nodeTypes = types$3;

  const BINDING_TYPES = 'bindingTypes';
  const EACH_BINDING_TYPE = 'EACH';
  const IF_BINDING_TYPE = 'IF';
  const TAG_BINDING_TYPE = 'TAG';
  const SLOT_BINDING_TYPE = 'SLOT';


  const EXPRESSION_TYPES = 'expressionTypes';
  const ATTRIBUTE_EXPRESSION_TYPE = 'ATTRIBUTE';
  const VALUE_EXPRESSION_TYPE = 'VALUE';
  const TEXT_EXPRESSION_TYPE = 'TEXT';
  const EVENT_EXPRESSION_TYPE = 'EVENT';

  const TEMPLATE_FN = 'template';
  const SCOPE = '_scope';
  const GET_COMPONENT_FN = 'getComponent';

  // keys needed to create the DOM bindings
  const BINDING_SELECTOR_KEY = 'selector';
  const BINDING_GET_COMPONENT_KEY = 'getComponent';
  const BINDING_TEMPLATE_KEY = 'template';
  const BINDING_TYPE_KEY = 'type';
  const BINDING_REDUNDANT_ATTRIBUTE_KEY = 'redundantAttribute';
  const BINDING_CONDITION_KEY = 'condition';
  const BINDING_ITEM_NAME_KEY = 'itemName';
  const BINDING_GET_KEY_KEY = 'getKey';
  const BINDING_INDEX_NAME_KEY = 'indexName';
  const BINDING_EVALUATE_KEY = 'evaluate';
  const BINDING_NAME_KEY = 'name';
  const BINDING_SLOTS_KEY = 'slots';
  const BINDING_EXPRESSIONS_KEY = 'expressions';
  const BINDING_CHILD_NODE_INDEX_KEY = 'childNodeIndex';
  // slots keys
  const BINDING_BINDINGS_KEY = 'bindings';
  const BINDING_ID_KEY = 'id';
  const BINDING_HTML_KEY = 'html';
  const BINDING_ATTRIBUTES_KEY = 'attributes';

  // DOM directives
  const IF_DIRECTIVE = 'if';
  const EACH_DIRECTIVE = 'each';
  const KEY_ATTRIBUTE = 'key';
  const SLOT_ATTRIBUTE = 'slot';
  const NAME_ATTRIBUTE = 'name';
  const IS_DIRECTIVE = 'is';

  // Misc
  const DEFAULT_SLOT_NAME = 'default';
  const TEXT_NODE_EXPRESSION_PLACEHOLDER = ' ';
  const BINDING_SELECTOR_PREFIX = 'expr';
  const SLOT_TAG_NODE_NAME = 'slot';
  const PROGRESS_TAG_NODE_NAME = 'progress';
  const TEMPLATE_TAG_NODE_NAME = 'template';

  // Riot Parser constants
  constants.IS_RAW;
  const IS_VOID_NODE = constants.IS_VOID;
  const IS_CUSTOM_NODE = constants.IS_CUSTOM;
  const IS_BOOLEAN_ATTRIBUTE = constants.IS_BOOLEAN;
  const IS_SPREAD_ATTRIBUTE = constants.IS_SPREAD;

  function getAugmentedNamespace(n) {
    var f = n.default;
  	if (typeof f == "function") {
  		var a = function () {
  			return f.apply(this, arguments);
  		};
  		a.prototype = f.prototype;
    } else a = {};
    Object.defineProperty(a, '__esModule', {value: true});
  	Object.keys(n).forEach(function (k) {
  		var d = Object.getOwnPropertyDescriptor(n, k);
  		Object.defineProperty(a, k, d.get ? d : {
  			enumerable: true,
  			get: function () {
  				return n[k];
  			}
  		});
  	});
  	return a;
  }

  var main$1 = {};

  /******************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
  /* global Reflect, Promise */

  var extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
      return extendStatics(d, b);
  };

  function __extends(d, b) {
      if (typeof b !== "function" && b !== null)
          throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
      extendStatics(d, b);
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  }

  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      };
      return __assign.apply(this, arguments);
  };

  function __rest(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  }

  function __decorate(decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  }

  function __param(paramIndex, decorator) {
      return function (target, key) { decorator(target, key, paramIndex); }
  }

  function __metadata(metadataKey, metadataValue) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  }

  function __awaiter(thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  }

  function __generator(thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  }

  var __createBinding = Object.create ? (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
          desc = { enumerable: true, get: function() { return m[k]; } };
      }
      Object.defineProperty(o, k2, desc);
  }) : (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      o[k2] = m[k];
  });

  function __exportStar(m, o) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
  }

  function __values(o) {
      var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
      if (m) return m.call(o);
      if (o && typeof o.length === "number") return {
          next: function () {
              if (o && i >= o.length) o = void 0;
              return { value: o && o[i++], done: !o };
          }
      };
      throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }

  function __read(o, n) {
      var m = typeof Symbol === "function" && o[Symbol.iterator];
      if (!m) return o;
      var i = m.call(o), r, ar = [], e;
      try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
      }
      catch (error) { e = { error: error }; }
      finally {
          try {
              if (r && !r.done && (m = i["return"])) m.call(i);
          }
          finally { if (e) throw e.error; }
      }
      return ar;
  }

  /** @deprecated */
  function __spread() {
      for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read(arguments[i]));
      return ar;
  }

  /** @deprecated */
  function __spreadArrays() {
      for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
      for (var r = Array(s), k = 0, i = 0; i < il; i++)
          for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
              r[k] = a[j];
      return r;
  }

  function __spreadArray(to, from, pack) {
      if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
          if (ar || !(i in from)) {
              if (!ar) ar = Array.prototype.slice.call(from, 0, i);
              ar[i] = from[i];
          }
      }
      return to.concat(ar || Array.prototype.slice.call(from));
  }

  function __await(v) {
      return this instanceof __await ? (this.v = v, this) : new __await(v);
  }

  function __asyncGenerator(thisArg, _arguments, generator) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var g = generator.apply(thisArg, _arguments || []), i, q = [];
      return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
      function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
      function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
      function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
      function fulfill(value) { resume("next", value); }
      function reject(value) { resume("throw", value); }
      function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  }

  function __asyncDelegator(o) {
      var i, p;
      return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
      function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  }

  function __asyncValues(o) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var m = o[Symbol.asyncIterator], i;
      return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
      function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
      function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  }

  function __makeTemplateObject(cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  }
  var __setModuleDefault = Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
  }) : function(o, v) {
      o["default"] = v;
  };

  function __importStar(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      __setModuleDefault(result, mod);
      return result;
  }

  function __importDefault(mod) {
      return (mod && mod.__esModule) ? mod : { default: mod };
  }

  function __classPrivateFieldGet(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
  }

  function __classPrivateFieldSet(receiver, state, value, kind, f) {
      if (kind === "m") throw new TypeError("Private method is not writable");
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
      return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
  }

  function __classPrivateFieldIn(state, receiver) {
      if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
      return typeof state === "function" ? receiver === state : state.has(receiver);
  }

  var tslib_es6 = /*#__PURE__*/Object.freeze({
    __proto__: null,
    __extends: __extends,
    get __assign () { return __assign; },
    __rest: __rest,
    __decorate: __decorate,
    __param: __param,
    __metadata: __metadata,
    __awaiter: __awaiter,
    __generator: __generator,
    __createBinding: __createBinding,
    __exportStar: __exportStar,
    __values: __values,
    __read: __read,
    __spread: __spread,
    __spreadArrays: __spreadArrays,
    __spreadArray: __spreadArray,
    __await: __await,
    __asyncGenerator: __asyncGenerator,
    __asyncDelegator: __asyncDelegator,
    __asyncValues: __asyncValues,
    __makeTemplateObject: __makeTemplateObject,
    __importStar: __importStar,
    __importDefault: __importDefault,
    __classPrivateFieldGet: __classPrivateFieldGet,
    __classPrivateFieldSet: __classPrivateFieldSet,
    __classPrivateFieldIn: __classPrivateFieldIn
  });

  var require$$0 = /*@__PURE__*/getAugmentedNamespace(tslib_es6);

  var main = {};

  var fork = {exports: {}};

  var types$2 = {};

  var hasRequiredTypes;

  function requireTypes () {
  	if (hasRequiredTypes) return types$2;
  	hasRequiredTypes = 1;
  	Object.defineProperty(types$2, "__esModule", { value: true });
  	types$2.Def = void 0;
  	var tslib_1 = require$$0;
  	var Op = Object.prototype;
  	var objToStr = Op.toString;
  	var hasOwn = Op.hasOwnProperty;
  	var BaseType = /** @class */ (function () {
  	    function BaseType() {
  	    }
  	    BaseType.prototype.assert = function (value, deep) {
  	        if (!this.check(value, deep)) {
  	            var str = shallowStringify(value);
  	            throw new Error(str + " does not match type " + this);
  	        }
  	        return true;
  	    };
  	    BaseType.prototype.arrayOf = function () {
  	        var elemType = this;
  	        return new ArrayType(elemType);
  	    };
  	    return BaseType;
  	}());
  	var ArrayType = /** @class */ (function (_super) {
  	    tslib_1.__extends(ArrayType, _super);
  	    function ArrayType(elemType) {
  	        var _this = _super.call(this) || this;
  	        _this.elemType = elemType;
  	        _this.kind = "ArrayType";
  	        return _this;
  	    }
  	    ArrayType.prototype.toString = function () {
  	        return "[" + this.elemType + "]";
  	    };
  	    ArrayType.prototype.check = function (value, deep) {
  	        var _this = this;
  	        return Array.isArray(value) && value.every(function (elem) { return _this.elemType.check(elem, deep); });
  	    };
  	    return ArrayType;
  	}(BaseType));
  	var IdentityType = /** @class */ (function (_super) {
  	    tslib_1.__extends(IdentityType, _super);
  	    function IdentityType(value) {
  	        var _this = _super.call(this) || this;
  	        _this.value = value;
  	        _this.kind = "IdentityType";
  	        return _this;
  	    }
  	    IdentityType.prototype.toString = function () {
  	        return String(this.value);
  	    };
  	    IdentityType.prototype.check = function (value, deep) {
  	        var result = value === this.value;
  	        if (!result && typeof deep === "function") {
  	            deep(this, value);
  	        }
  	        return result;
  	    };
  	    return IdentityType;
  	}(BaseType));
  	var ObjectType = /** @class */ (function (_super) {
  	    tslib_1.__extends(ObjectType, _super);
  	    function ObjectType(fields) {
  	        var _this = _super.call(this) || this;
  	        _this.fields = fields;
  	        _this.kind = "ObjectType";
  	        return _this;
  	    }
  	    ObjectType.prototype.toString = function () {
  	        return "{ " + this.fields.join(", ") + " }";
  	    };
  	    ObjectType.prototype.check = function (value, deep) {
  	        return (objToStr.call(value) === objToStr.call({}) &&
  	            this.fields.every(function (field) {
  	                return field.type.check(value[field.name], deep);
  	            }));
  	    };
  	    return ObjectType;
  	}(BaseType));
  	var OrType = /** @class */ (function (_super) {
  	    tslib_1.__extends(OrType, _super);
  	    function OrType(types) {
  	        var _this = _super.call(this) || this;
  	        _this.types = types;
  	        _this.kind = "OrType";
  	        return _this;
  	    }
  	    OrType.prototype.toString = function () {
  	        return this.types.join(" | ");
  	    };
  	    OrType.prototype.check = function (value, deep) {
  	        return this.types.some(function (type) {
  	            return type.check(value, deep);
  	        });
  	    };
  	    return OrType;
  	}(BaseType));
  	var PredicateType = /** @class */ (function (_super) {
  	    tslib_1.__extends(PredicateType, _super);
  	    function PredicateType(name, predicate) {
  	        var _this = _super.call(this) || this;
  	        _this.name = name;
  	        _this.predicate = predicate;
  	        _this.kind = "PredicateType";
  	        return _this;
  	    }
  	    PredicateType.prototype.toString = function () {
  	        return this.name;
  	    };
  	    PredicateType.prototype.check = function (value, deep) {
  	        var result = this.predicate(value, deep);
  	        if (!result && typeof deep === "function") {
  	            deep(this, value);
  	        }
  	        return result;
  	    };
  	    return PredicateType;
  	}(BaseType));
  	var Def = /** @class */ (function () {
  	    function Def(type, typeName) {
  	        this.type = type;
  	        this.typeName = typeName;
  	        this.baseNames = [];
  	        this.ownFields = Object.create(null);
  	        // Includes own typeName. Populated during finalization.
  	        this.allSupertypes = Object.create(null);
  	        // Linear inheritance hierarchy. Populated during finalization.
  	        this.supertypeList = [];
  	        // Includes inherited fields.
  	        this.allFields = Object.create(null);
  	        // Non-hidden keys of allFields.
  	        this.fieldNames = [];
  	        // This property will be overridden as true by individual Def instances
  	        // when they are finalized.
  	        this.finalized = false;
  	        // False by default until .build(...) is called on an instance.
  	        this.buildable = false;
  	        this.buildParams = [];
  	    }
  	    Def.prototype.isSupertypeOf = function (that) {
  	        if (that instanceof Def) {
  	            if (this.finalized !== true ||
  	                that.finalized !== true) {
  	                throw new Error("");
  	            }
  	            return hasOwn.call(that.allSupertypes, this.typeName);
  	        }
  	        else {
  	            throw new Error(that + " is not a Def");
  	        }
  	    };
  	    Def.prototype.checkAllFields = function (value, deep) {
  	        var allFields = this.allFields;
  	        if (this.finalized !== true) {
  	            throw new Error("" + this.typeName);
  	        }
  	        function checkFieldByName(name) {
  	            var field = allFields[name];
  	            var type = field.type;
  	            var child = field.getValue(value);
  	            return type.check(child, deep);
  	        }
  	        return value !== null &&
  	            typeof value === "object" &&
  	            Object.keys(allFields).every(checkFieldByName);
  	    };
  	    Def.prototype.bases = function () {
  	        var supertypeNames = [];
  	        for (var _i = 0; _i < arguments.length; _i++) {
  	            supertypeNames[_i] = arguments[_i];
  	        }
  	        var bases = this.baseNames;
  	        if (this.finalized) {
  	            if (supertypeNames.length !== bases.length) {
  	                throw new Error("");
  	            }
  	            for (var i = 0; i < supertypeNames.length; i++) {
  	                if (supertypeNames[i] !== bases[i]) {
  	                    throw new Error("");
  	                }
  	            }
  	            return this;
  	        }
  	        supertypeNames.forEach(function (baseName) {
  	            // This indexOf lookup may be O(n), but the typical number of base
  	            // names is very small, and indexOf is a native Array method.
  	            if (bases.indexOf(baseName) < 0) {
  	                bases.push(baseName);
  	            }
  	        });
  	        return this; // For chaining.
  	    };
  	    return Def;
  	}());
  	types$2.Def = Def;
  	var Field = /** @class */ (function () {
  	    function Field(name, type, defaultFn, hidden) {
  	        this.name = name;
  	        this.type = type;
  	        this.defaultFn = defaultFn;
  	        this.hidden = !!hidden;
  	    }
  	    Field.prototype.toString = function () {
  	        return JSON.stringify(this.name) + ": " + this.type;
  	    };
  	    Field.prototype.getValue = function (obj) {
  	        var value = obj[this.name];
  	        if (typeof value !== "undefined") {
  	            return value;
  	        }
  	        if (typeof this.defaultFn === "function") {
  	            value = this.defaultFn.call(obj);
  	        }
  	        return value;
  	    };
  	    return Field;
  	}());
  	function shallowStringify(value) {
  	    if (Array.isArray(value)) {
  	        return "[" + value.map(shallowStringify).join(", ") + "]";
  	    }
  	    if (value && typeof value === "object") {
  	        return "{ " + Object.keys(value).map(function (key) {
  	            return key + ": " + value[key];
  	        }).join(", ") + " }";
  	    }
  	    return JSON.stringify(value);
  	}
  	function typesPlugin(_fork) {
  	    var Type = {
  	        or: function () {
  	            var types = [];
  	            for (var _i = 0; _i < arguments.length; _i++) {
  	                types[_i] = arguments[_i];
  	            }
  	            return new OrType(types.map(function (type) { return Type.from(type); }));
  	        },
  	        from: function (value, name) {
  	            if (value instanceof ArrayType ||
  	                value instanceof IdentityType ||
  	                value instanceof ObjectType ||
  	                value instanceof OrType ||
  	                value instanceof PredicateType) {
  	                return value;
  	            }
  	            // The Def type is used as a helper for constructing compound
  	            // interface types for AST nodes.
  	            if (value instanceof Def) {
  	                return value.type;
  	            }
  	            // Support [ElemType] syntax.
  	            if (isArray.check(value)) {
  	                if (value.length !== 1) {
  	                    throw new Error("only one element type is permitted for typed arrays");
  	                }
  	                return new ArrayType(Type.from(value[0]));
  	            }
  	            // Support { someField: FieldType, ... } syntax.
  	            if (isObject.check(value)) {
  	                return new ObjectType(Object.keys(value).map(function (name) {
  	                    return new Field(name, Type.from(value[name], name));
  	                }));
  	            }
  	            if (typeof value === "function") {
  	                var bicfIndex = builtInCtorFns.indexOf(value);
  	                if (bicfIndex >= 0) {
  	                    return builtInCtorTypes[bicfIndex];
  	                }
  	                if (typeof name !== "string") {
  	                    throw new Error("missing name");
  	                }
  	                return new PredicateType(name, value);
  	            }
  	            // As a last resort, toType returns a type that matches any value that
  	            // is === from. This is primarily useful for literal values like
  	            // toType(null), but it has the additional advantage of allowing
  	            // toType to be a total function.
  	            return new IdentityType(value);
  	        },
  	        // Define a type whose name is registered in a namespace (the defCache) so
  	        // that future definitions will return the same type given the same name.
  	        // In particular, this system allows for circular and forward definitions.
  	        // The Def object d returned from Type.def may be used to configure the
  	        // type d.type by calling methods such as d.bases, d.build, and d.field.
  	        def: function (typeName) {
  	            return hasOwn.call(defCache, typeName)
  	                ? defCache[typeName]
  	                : defCache[typeName] = new DefImpl(typeName);
  	        },
  	        hasDef: function (typeName) {
  	            return hasOwn.call(defCache, typeName);
  	        }
  	    };
  	    var builtInCtorFns = [];
  	    var builtInCtorTypes = [];
  	    function defBuiltInType(name, example) {
  	        var objStr = objToStr.call(example);
  	        var type = new PredicateType(name, function (value) { return objToStr.call(value) === objStr; });
  	        if (example && typeof example.constructor === "function") {
  	            builtInCtorFns.push(example.constructor);
  	            builtInCtorTypes.push(type);
  	        }
  	        return type;
  	    }
  	    // These types check the underlying [[Class]] attribute of the given
  	    // value, rather than using the problematic typeof operator. Note however
  	    // that no subtyping is considered; so, for instance, isObject.check
  	    // returns false for [], /./, new Date, and null.
  	    var isString = defBuiltInType("string", "truthy");
  	    var isFunction = defBuiltInType("function", function () { });
  	    var isArray = defBuiltInType("array", []);
  	    var isObject = defBuiltInType("object", {});
  	    var isRegExp = defBuiltInType("RegExp", /./);
  	    var isDate = defBuiltInType("Date", new Date());
  	    var isNumber = defBuiltInType("number", 3);
  	    var isBoolean = defBuiltInType("boolean", true);
  	    var isNull = defBuiltInType("null", null);
  	    var isUndefined = defBuiltInType("undefined", undefined);
  	    var builtInTypes = {
  	        string: isString,
  	        function: isFunction,
  	        array: isArray,
  	        object: isObject,
  	        RegExp: isRegExp,
  	        Date: isDate,
  	        number: isNumber,
  	        boolean: isBoolean,
  	        null: isNull,
  	        undefined: isUndefined,
  	    };
  	    // In order to return the same Def instance every time Type.def is called
  	    // with a particular name, those instances need to be stored in a cache.
  	    var defCache = Object.create(null);
  	    function defFromValue(value) {
  	        if (value && typeof value === "object") {
  	            var type = value.type;
  	            if (typeof type === "string" &&
  	                hasOwn.call(defCache, type)) {
  	                var d = defCache[type];
  	                if (d.finalized) {
  	                    return d;
  	                }
  	            }
  	        }
  	        return null;
  	    }
  	    var DefImpl = /** @class */ (function (_super) {
  	        tslib_1.__extends(DefImpl, _super);
  	        function DefImpl(typeName) {
  	            var _this = _super.call(this, new PredicateType(typeName, function (value, deep) { return _this.check(value, deep); }), typeName) || this;
  	            return _this;
  	        }
  	        DefImpl.prototype.check = function (value, deep) {
  	            if (this.finalized !== true) {
  	                throw new Error("prematurely checking unfinalized type " + this.typeName);
  	            }
  	            // A Def type can only match an object value.
  	            if (value === null || typeof value !== "object") {
  	                return false;
  	            }
  	            var vDef = defFromValue(value);
  	            if (!vDef) {
  	                // If we couldn't infer the Def associated with the given value,
  	                // and we expected it to be a SourceLocation or a Position, it was
  	                // probably just missing a "type" field (because Esprima does not
  	                // assign a type property to such nodes). Be optimistic and let
  	                // this.checkAllFields make the final decision.
  	                if (this.typeName === "SourceLocation" ||
  	                    this.typeName === "Position") {
  	                    return this.checkAllFields(value, deep);
  	                }
  	                // Calling this.checkAllFields for any other type of node is both
  	                // bad for performance and way too forgiving.
  	                return false;
  	            }
  	            // If checking deeply and vDef === this, then we only need to call
  	            // checkAllFields once. Calling checkAllFields is too strict when deep
  	            // is false, because then we only care about this.isSupertypeOf(vDef).
  	            if (deep && vDef === this) {
  	                return this.checkAllFields(value, deep);
  	            }
  	            // In most cases we rely exclusively on isSupertypeOf to make O(1)
  	            // subtyping determinations. This suffices in most situations outside
  	            // of unit tests, since interface conformance is checked whenever new
  	            // instances are created using builder functions.
  	            if (!this.isSupertypeOf(vDef)) {
  	                return false;
  	            }
  	            // The exception is when deep is true; then, we recursively check all
  	            // fields.
  	            if (!deep) {
  	                return true;
  	            }
  	            // Use the more specific Def (vDef) to perform the deep check, but
  	            // shallow-check fields defined by the less specific Def (this).
  	            return vDef.checkAllFields(value, deep)
  	                && this.checkAllFields(value, false);
  	        };
  	        DefImpl.prototype.build = function () {
  	            var _this = this;
  	            var buildParams = [];
  	            for (var _i = 0; _i < arguments.length; _i++) {
  	                buildParams[_i] = arguments[_i];
  	            }
  	            // Calling Def.prototype.build multiple times has the effect of merely
  	            // redefining this property.
  	            this.buildParams = buildParams;
  	            if (this.buildable) {
  	                // If this Def is already buildable, update self.buildParams and
  	                // continue using the old builder function.
  	                return this;
  	            }
  	            // Every buildable type will have its "type" field filled in
  	            // automatically. This includes types that are not subtypes of Node,
  	            // like SourceLocation, but that seems harmless (TODO?).
  	            this.field("type", String, function () { return _this.typeName; });
  	            // Override Dp.buildable for this Def instance.
  	            this.buildable = true;
  	            var addParam = function (built, param, arg, isArgAvailable) {
  	                if (hasOwn.call(built, param))
  	                    return;
  	                var all = _this.allFields;
  	                if (!hasOwn.call(all, param)) {
  	                    throw new Error("" + param);
  	                }
  	                var field = all[param];
  	                var type = field.type;
  	                var value;
  	                if (isArgAvailable) {
  	                    value = arg;
  	                }
  	                else if (field.defaultFn) {
  	                    // Expose the partially-built object to the default
  	                    // function as its `this` object.
  	                    value = field.defaultFn.call(built);
  	                }
  	                else {
  	                    var message = "no value or default function given for field " +
  	                        JSON.stringify(param) + " of " + _this.typeName + "(" +
  	                        _this.buildParams.map(function (name) {
  	                            return all[name];
  	                        }).join(", ") + ")";
  	                    throw new Error(message);
  	                }
  	                if (!type.check(value)) {
  	                    throw new Error(shallowStringify(value) +
  	                        " does not match field " + field +
  	                        " of type " + _this.typeName);
  	                }
  	                built[param] = value;
  	            };
  	            // Calling the builder function will construct an instance of the Def,
  	            // with positional arguments mapped to the fields original passed to .build.
  	            // If not enough arguments are provided, the default value for the remaining fields
  	            // will be used.
  	            var builder = function () {
  	                var args = [];
  	                for (var _i = 0; _i < arguments.length; _i++) {
  	                    args[_i] = arguments[_i];
  	                }
  	                var argc = args.length;
  	                if (!_this.finalized) {
  	                    throw new Error("attempting to instantiate unfinalized type " +
  	                        _this.typeName);
  	                }
  	                var built = Object.create(nodePrototype);
  	                _this.buildParams.forEach(function (param, i) {
  	                    if (i < argc) {
  	                        addParam(built, param, args[i], true);
  	                    }
  	                    else {
  	                        addParam(built, param, null, false);
  	                    }
  	                });
  	                Object.keys(_this.allFields).forEach(function (param) {
  	                    // Use the default value.
  	                    addParam(built, param, null, false);
  	                });
  	                // Make sure that the "type" field was filled automatically.
  	                if (built.type !== _this.typeName) {
  	                    throw new Error("");
  	                }
  	                return built;
  	            };
  	            // Calling .from on the builder function will construct an instance of the Def,
  	            // using field values from the passed object. For fields missing from the passed object,
  	            // their default value will be used.
  	            builder.from = function (obj) {
  	                if (!_this.finalized) {
  	                    throw new Error("attempting to instantiate unfinalized type " +
  	                        _this.typeName);
  	                }
  	                var built = Object.create(nodePrototype);
  	                Object.keys(_this.allFields).forEach(function (param) {
  	                    if (hasOwn.call(obj, param)) {
  	                        addParam(built, param, obj[param], true);
  	                    }
  	                    else {
  	                        addParam(built, param, null, false);
  	                    }
  	                });
  	                // Make sure that the "type" field was filled automatically.
  	                if (built.type !== _this.typeName) {
  	                    throw new Error("");
  	                }
  	                return built;
  	            };
  	            Object.defineProperty(builders, getBuilderName(this.typeName), {
  	                enumerable: true,
  	                value: builder
  	            });
  	            return this;
  	        };
  	        // The reason fields are specified using .field(...) instead of an object
  	        // literal syntax is somewhat subtle: the object literal syntax would
  	        // support only one key and one value, but with .field(...) we can pass
  	        // any number of arguments to specify the field.
  	        DefImpl.prototype.field = function (name, type, defaultFn, hidden) {
  	            if (this.finalized) {
  	                console.error("Ignoring attempt to redefine field " +
  	                    JSON.stringify(name) + " of finalized type " +
  	                    JSON.stringify(this.typeName));
  	                return this;
  	            }
  	            this.ownFields[name] = new Field(name, Type.from(type), defaultFn, hidden);
  	            return this; // For chaining.
  	        };
  	        DefImpl.prototype.finalize = function () {
  	            var _this = this;
  	            // It's not an error to finalize a type more than once, but only the
  	            // first call to .finalize does anything.
  	            if (!this.finalized) {
  	                var allFields = this.allFields;
  	                var allSupertypes = this.allSupertypes;
  	                this.baseNames.forEach(function (name) {
  	                    var def = defCache[name];
  	                    if (def instanceof Def) {
  	                        def.finalize();
  	                        extend(allFields, def.allFields);
  	                        extend(allSupertypes, def.allSupertypes);
  	                    }
  	                    else {
  	                        var message = "unknown supertype name " +
  	                            JSON.stringify(name) +
  	                            " for subtype " +
  	                            JSON.stringify(_this.typeName);
  	                        throw new Error(message);
  	                    }
  	                });
  	                // TODO Warn if fields are overridden with incompatible types.
  	                extend(allFields, this.ownFields);
  	                allSupertypes[this.typeName] = this;
  	                this.fieldNames.length = 0;
  	                for (var fieldName in allFields) {
  	                    if (hasOwn.call(allFields, fieldName) &&
  	                        !allFields[fieldName].hidden) {
  	                        this.fieldNames.push(fieldName);
  	                    }
  	                }
  	                // Types are exported only once they have been finalized.
  	                Object.defineProperty(namedTypes, this.typeName, {
  	                    enumerable: true,
  	                    value: this.type
  	                });
  	                this.finalized = true;
  	                // A linearization of the inheritance hierarchy.
  	                populateSupertypeList(this.typeName, this.supertypeList);
  	                if (this.buildable &&
  	                    this.supertypeList.lastIndexOf("Expression") >= 0) {
  	                    wrapExpressionBuilderWithStatement(this.typeName);
  	                }
  	            }
  	        };
  	        return DefImpl;
  	    }(Def));
  	    // Note that the list returned by this function is a copy of the internal
  	    // supertypeList, *without* the typeName itself as the first element.
  	    function getSupertypeNames(typeName) {
  	        if (!hasOwn.call(defCache, typeName)) {
  	            throw new Error("");
  	        }
  	        var d = defCache[typeName];
  	        if (d.finalized !== true) {
  	            throw new Error("");
  	        }
  	        return d.supertypeList.slice(1);
  	    }
  	    // Returns an object mapping from every known type in the defCache to the
  	    // most specific supertype whose name is an own property of the candidates
  	    // object.
  	    function computeSupertypeLookupTable(candidates) {
  	        var table = {};
  	        var typeNames = Object.keys(defCache);
  	        var typeNameCount = typeNames.length;
  	        for (var i = 0; i < typeNameCount; ++i) {
  	            var typeName = typeNames[i];
  	            var d = defCache[typeName];
  	            if (d.finalized !== true) {
  	                throw new Error("" + typeName);
  	            }
  	            for (var j = 0; j < d.supertypeList.length; ++j) {
  	                var superTypeName = d.supertypeList[j];
  	                if (hasOwn.call(candidates, superTypeName)) {
  	                    table[typeName] = superTypeName;
  	                    break;
  	                }
  	            }
  	        }
  	        return table;
  	    }
  	    var builders = Object.create(null);
  	    // This object is used as prototype for any node created by a builder.
  	    var nodePrototype = {};
  	    // Call this function to define a new method to be shared by all AST
  	    // nodes. The replaced method (if any) is returned for easy wrapping.
  	    function defineMethod(name, func) {
  	        var old = nodePrototype[name];
  	        // Pass undefined as func to delete nodePrototype[name].
  	        if (isUndefined.check(func)) {
  	            delete nodePrototype[name];
  	        }
  	        else {
  	            isFunction.assert(func);
  	            Object.defineProperty(nodePrototype, name, {
  	                enumerable: true,
  	                configurable: true,
  	                value: func
  	            });
  	        }
  	        return old;
  	    }
  	    function getBuilderName(typeName) {
  	        return typeName.replace(/^[A-Z]+/, function (upperCasePrefix) {
  	            var len = upperCasePrefix.length;
  	            switch (len) {
  	                case 0: return "";
  	                // If there's only one initial capital letter, just lower-case it.
  	                case 1: return upperCasePrefix.toLowerCase();
  	                default:
  	                    // If there's more than one initial capital letter, lower-case
  	                    // all but the last one, so that XMLDefaultDeclaration (for
  	                    // example) becomes xmlDefaultDeclaration.
  	                    return upperCasePrefix.slice(0, len - 1).toLowerCase() +
  	                        upperCasePrefix.charAt(len - 1);
  	            }
  	        });
  	    }
  	    function getStatementBuilderName(typeName) {
  	        typeName = getBuilderName(typeName);
  	        return typeName.replace(/(Expression)?$/, "Statement");
  	    }
  	    var namedTypes = {};
  	    // Like Object.keys, but aware of what fields each AST type should have.
  	    function getFieldNames(object) {
  	        var d = defFromValue(object);
  	        if (d) {
  	            return d.fieldNames.slice(0);
  	        }
  	        if ("type" in object) {
  	            throw new Error("did not recognize object of type " +
  	                JSON.stringify(object.type));
  	        }
  	        return Object.keys(object);
  	    }
  	    // Get the value of an object property, taking object.type and default
  	    // functions into account.
  	    function getFieldValue(object, fieldName) {
  	        var d = defFromValue(object);
  	        if (d) {
  	            var field = d.allFields[fieldName];
  	            if (field) {
  	                return field.getValue(object);
  	            }
  	        }
  	        return object && object[fieldName];
  	    }
  	    // Iterate over all defined fields of an object, including those missing
  	    // or undefined, passing each field name and effective value (as returned
  	    // by getFieldValue) to the callback. If the object has no corresponding
  	    // Def, the callback will never be called.
  	    function eachField(object, callback, context) {
  	        getFieldNames(object).forEach(function (name) {
  	            callback.call(this, name, getFieldValue(object, name));
  	        }, context);
  	    }
  	    // Similar to eachField, except that iteration stops as soon as the
  	    // callback returns a truthy value. Like Array.prototype.some, the final
  	    // result is either true or false to indicates whether the callback
  	    // returned true for any element or not.
  	    function someField(object, callback, context) {
  	        return getFieldNames(object).some(function (name) {
  	            return callback.call(this, name, getFieldValue(object, name));
  	        }, context);
  	    }
  	    // Adds an additional builder for Expression subtypes
  	    // that wraps the built Expression in an ExpressionStatements.
  	    function wrapExpressionBuilderWithStatement(typeName) {
  	        var wrapperName = getStatementBuilderName(typeName);
  	        // skip if the builder already exists
  	        if (builders[wrapperName])
  	            return;
  	        // the builder function to wrap with builders.ExpressionStatement
  	        var wrapped = builders[getBuilderName(typeName)];
  	        // skip if there is nothing to wrap
  	        if (!wrapped)
  	            return;
  	        var builder = function () {
  	            var args = [];
  	            for (var _i = 0; _i < arguments.length; _i++) {
  	                args[_i] = arguments[_i];
  	            }
  	            return builders.expressionStatement(wrapped.apply(builders, args));
  	        };
  	        builder.from = function () {
  	            var args = [];
  	            for (var _i = 0; _i < arguments.length; _i++) {
  	                args[_i] = arguments[_i];
  	            }
  	            return builders.expressionStatement(wrapped.from.apply(builders, args));
  	        };
  	        builders[wrapperName] = builder;
  	    }
  	    function populateSupertypeList(typeName, list) {
  	        list.length = 0;
  	        list.push(typeName);
  	        var lastSeen = Object.create(null);
  	        for (var pos = 0; pos < list.length; ++pos) {
  	            typeName = list[pos];
  	            var d = defCache[typeName];
  	            if (d.finalized !== true) {
  	                throw new Error("");
  	            }
  	            // If we saw typeName earlier in the breadth-first traversal,
  	            // delete the last-seen occurrence.
  	            if (hasOwn.call(lastSeen, typeName)) {
  	                delete list[lastSeen[typeName]];
  	            }
  	            // Record the new index of the last-seen occurrence of typeName.
  	            lastSeen[typeName] = pos;
  	            // Enqueue the base names of this type.
  	            list.push.apply(list, d.baseNames);
  	        }
  	        // Compaction loop to remove array holes.
  	        for (var to = 0, from = to, len = list.length; from < len; ++from) {
  	            if (hasOwn.call(list, from)) {
  	                list[to++] = list[from];
  	            }
  	        }
  	        list.length = to;
  	    }
  	    function extend(into, from) {
  	        Object.keys(from).forEach(function (name) {
  	            into[name] = from[name];
  	        });
  	        return into;
  	    }
  	    function finalize() {
  	        Object.keys(defCache).forEach(function (name) {
  	            defCache[name].finalize();
  	        });
  	    }
  	    return {
  	        Type: Type,
  	        builtInTypes: builtInTypes,
  	        getSupertypeNames: getSupertypeNames,
  	        computeSupertypeLookupTable: computeSupertypeLookupTable,
  	        builders: builders,
  	        defineMethod: defineMethod,
  	        getBuilderName: getBuilderName,
  	        getStatementBuilderName: getStatementBuilderName,
  	        namedTypes: namedTypes,
  	        getFieldNames: getFieldNames,
  	        getFieldValue: getFieldValue,
  	        eachField: eachField,
  	        someField: someField,
  	        finalize: finalize,
  	    };
  	}
  	types$2.default = typesPlugin;
  	return types$2;
  }

  var pathVisitor = {exports: {}};

  var nodePath = {exports: {}};

  var path = {exports: {}};

  var hasRequiredPath;

  function requirePath () {
  	if (hasRequiredPath) return path.exports;
  	hasRequiredPath = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var Op = Object.prototype;
  		var hasOwn = Op.hasOwnProperty;
  		function pathPlugin(fork) {
  		    var types = fork.use(types_1.default);
  		    var isArray = types.builtInTypes.array;
  		    var isNumber = types.builtInTypes.number;
  		    var Path = function Path(value, parentPath, name) {
  		        if (!(this instanceof Path)) {
  		            throw new Error("Path constructor cannot be invoked without 'new'");
  		        }
  		        if (parentPath) {
  		            if (!(parentPath instanceof Path)) {
  		                throw new Error("");
  		            }
  		        }
  		        else {
  		            parentPath = null;
  		            name = null;
  		        }
  		        // The value encapsulated by this Path, generally equal to
  		        // parentPath.value[name] if we have a parentPath.
  		        this.value = value;
  		        // The immediate parent Path of this Path.
  		        this.parentPath = parentPath;
  		        // The name of the property of parentPath.value through which this
  		        // Path's value was reached.
  		        this.name = name;
  		        // Calling path.get("child") multiple times always returns the same
  		        // child Path object, for both performance and consistency reasons.
  		        this.__childCache = null;
  		    };
  		    var Pp = Path.prototype;
  		    function getChildCache(path) {
  		        // Lazily create the child cache. This also cheapens cache
  		        // invalidation, since you can just reset path.__childCache to null.
  		        return path.__childCache || (path.__childCache = Object.create(null));
  		    }
  		    function getChildPath(path, name) {
  		        var cache = getChildCache(path);
  		        var actualChildValue = path.getValueProperty(name);
  		        var childPath = cache[name];
  		        if (!hasOwn.call(cache, name) ||
  		            // Ensure consistency between cache and reality.
  		            childPath.value !== actualChildValue) {
  		            childPath = cache[name] = new path.constructor(actualChildValue, path, name);
  		        }
  		        return childPath;
  		    }
  		    // This method is designed to be overridden by subclasses that need to
  		    // handle missing properties, etc.
  		    Pp.getValueProperty = function getValueProperty(name) {
  		        return this.value[name];
  		    };
  		    Pp.get = function get() {
  		        var names = [];
  		        for (var _i = 0; _i < arguments.length; _i++) {
  		            names[_i] = arguments[_i];
  		        }
  		        var path = this;
  		        var count = names.length;
  		        for (var i = 0; i < count; ++i) {
  		            path = getChildPath(path, names[i]);
  		        }
  		        return path;
  		    };
  		    Pp.each = function each(callback, context) {
  		        var childPaths = [];
  		        var len = this.value.length;
  		        var i = 0;
  		        // Collect all the original child paths before invoking the callback.
  		        for (var i = 0; i < len; ++i) {
  		            if (hasOwn.call(this.value, i)) {
  		                childPaths[i] = this.get(i);
  		            }
  		        }
  		        // Invoke the callback on just the original child paths, regardless of
  		        // any modifications made to the array by the callback. I chose these
  		        // semantics over cleverly invoking the callback on new elements because
  		        // this way is much easier to reason about.
  		        context = context || this;
  		        for (i = 0; i < len; ++i) {
  		            if (hasOwn.call(childPaths, i)) {
  		                callback.call(context, childPaths[i]);
  		            }
  		        }
  		    };
  		    Pp.map = function map(callback, context) {
  		        var result = [];
  		        this.each(function (childPath) {
  		            result.push(callback.call(this, childPath));
  		        }, context);
  		        return result;
  		    };
  		    Pp.filter = function filter(callback, context) {
  		        var result = [];
  		        this.each(function (childPath) {
  		            if (callback.call(this, childPath)) {
  		                result.push(childPath);
  		            }
  		        }, context);
  		        return result;
  		    };
  		    function emptyMoves() { }
  		    function getMoves(path, offset, start, end) {
  		        isArray.assert(path.value);
  		        if (offset === 0) {
  		            return emptyMoves;
  		        }
  		        var length = path.value.length;
  		        if (length < 1) {
  		            return emptyMoves;
  		        }
  		        var argc = arguments.length;
  		        if (argc === 2) {
  		            start = 0;
  		            end = length;
  		        }
  		        else if (argc === 3) {
  		            start = Math.max(start, 0);
  		            end = length;
  		        }
  		        else {
  		            start = Math.max(start, 0);
  		            end = Math.min(end, length);
  		        }
  		        isNumber.assert(start);
  		        isNumber.assert(end);
  		        var moves = Object.create(null);
  		        var cache = getChildCache(path);
  		        for (var i = start; i < end; ++i) {
  		            if (hasOwn.call(path.value, i)) {
  		                var childPath = path.get(i);
  		                if (childPath.name !== i) {
  		                    throw new Error("");
  		                }
  		                var newIndex = i + offset;
  		                childPath.name = newIndex;
  		                moves[newIndex] = childPath;
  		                delete cache[i];
  		            }
  		        }
  		        delete cache.length;
  		        return function () {
  		            for (var newIndex in moves) {
  		                var childPath = moves[newIndex];
  		                if (childPath.name !== +newIndex) {
  		                    throw new Error("");
  		                }
  		                cache[newIndex] = childPath;
  		                path.value[newIndex] = childPath.value;
  		            }
  		        };
  		    }
  		    Pp.shift = function shift() {
  		        var move = getMoves(this, -1);
  		        var result = this.value.shift();
  		        move();
  		        return result;
  		    };
  		    Pp.unshift = function unshift() {
  		        var args = [];
  		        for (var _i = 0; _i < arguments.length; _i++) {
  		            args[_i] = arguments[_i];
  		        }
  		        var move = getMoves(this, args.length);
  		        var result = this.value.unshift.apply(this.value, args);
  		        move();
  		        return result;
  		    };
  		    Pp.push = function push() {
  		        var args = [];
  		        for (var _i = 0; _i < arguments.length; _i++) {
  		            args[_i] = arguments[_i];
  		        }
  		        isArray.assert(this.value);
  		        delete getChildCache(this).length;
  		        return this.value.push.apply(this.value, args);
  		    };
  		    Pp.pop = function pop() {
  		        isArray.assert(this.value);
  		        var cache = getChildCache(this);
  		        delete cache[this.value.length - 1];
  		        delete cache.length;
  		        return this.value.pop();
  		    };
  		    Pp.insertAt = function insertAt(index) {
  		        var argc = arguments.length;
  		        var move = getMoves(this, argc - 1, index);
  		        if (move === emptyMoves && argc <= 1) {
  		            return this;
  		        }
  		        index = Math.max(index, 0);
  		        for (var i = 1; i < argc; ++i) {
  		            this.value[index + i - 1] = arguments[i];
  		        }
  		        move();
  		        return this;
  		    };
  		    Pp.insertBefore = function insertBefore() {
  		        var args = [];
  		        for (var _i = 0; _i < arguments.length; _i++) {
  		            args[_i] = arguments[_i];
  		        }
  		        var pp = this.parentPath;
  		        var argc = args.length;
  		        var insertAtArgs = [this.name];
  		        for (var i = 0; i < argc; ++i) {
  		            insertAtArgs.push(args[i]);
  		        }
  		        return pp.insertAt.apply(pp, insertAtArgs);
  		    };
  		    Pp.insertAfter = function insertAfter() {
  		        var args = [];
  		        for (var _i = 0; _i < arguments.length; _i++) {
  		            args[_i] = arguments[_i];
  		        }
  		        var pp = this.parentPath;
  		        var argc = args.length;
  		        var insertAtArgs = [this.name + 1];
  		        for (var i = 0; i < argc; ++i) {
  		            insertAtArgs.push(args[i]);
  		        }
  		        return pp.insertAt.apply(pp, insertAtArgs);
  		    };
  		    function repairRelationshipWithParent(path) {
  		        if (!(path instanceof Path)) {
  		            throw new Error("");
  		        }
  		        var pp = path.parentPath;
  		        if (!pp) {
  		            // Orphan paths have no relationship to repair.
  		            return path;
  		        }
  		        var parentValue = pp.value;
  		        var parentCache = getChildCache(pp);
  		        // Make sure parentCache[path.name] is populated.
  		        if (parentValue[path.name] === path.value) {
  		            parentCache[path.name] = path;
  		        }
  		        else if (isArray.check(parentValue)) {
  		            // Something caused path.name to become out of date, so attempt to
  		            // recover by searching for path.value in parentValue.
  		            var i = parentValue.indexOf(path.value);
  		            if (i >= 0) {
  		                parentCache[path.name = i] = path;
  		            }
  		        }
  		        else {
  		            // If path.value disagrees with parentValue[path.name], and
  		            // path.name is not an array index, let path.value become the new
  		            // parentValue[path.name] and update parentCache accordingly.
  		            parentValue[path.name] = path.value;
  		            parentCache[path.name] = path;
  		        }
  		        if (parentValue[path.name] !== path.value) {
  		            throw new Error("");
  		        }
  		        if (path.parentPath.get(path.name) !== path) {
  		            throw new Error("");
  		        }
  		        return path;
  		    }
  		    Pp.replace = function replace(replacement) {
  		        var results = [];
  		        var parentValue = this.parentPath.value;
  		        var parentCache = getChildCache(this.parentPath);
  		        var count = arguments.length;
  		        repairRelationshipWithParent(this);
  		        if (isArray.check(parentValue)) {
  		            var originalLength = parentValue.length;
  		            var move = getMoves(this.parentPath, count - 1, this.name + 1);
  		            var spliceArgs = [this.name, 1];
  		            for (var i = 0; i < count; ++i) {
  		                spliceArgs.push(arguments[i]);
  		            }
  		            var splicedOut = parentValue.splice.apply(parentValue, spliceArgs);
  		            if (splicedOut[0] !== this.value) {
  		                throw new Error("");
  		            }
  		            if (parentValue.length !== (originalLength - 1 + count)) {
  		                throw new Error("");
  		            }
  		            move();
  		            if (count === 0) {
  		                delete this.value;
  		                delete parentCache[this.name];
  		                this.__childCache = null;
  		            }
  		            else {
  		                if (parentValue[this.name] !== replacement) {
  		                    throw new Error("");
  		                }
  		                if (this.value !== replacement) {
  		                    this.value = replacement;
  		                    this.__childCache = null;
  		                }
  		                for (i = 0; i < count; ++i) {
  		                    results.push(this.parentPath.get(this.name + i));
  		                }
  		                if (results[0] !== this) {
  		                    throw new Error("");
  		                }
  		            }
  		        }
  		        else if (count === 1) {
  		            if (this.value !== replacement) {
  		                this.__childCache = null;
  		            }
  		            this.value = parentValue[this.name] = replacement;
  		            results.push(this);
  		        }
  		        else if (count === 0) {
  		            delete parentValue[this.name];
  		            delete this.value;
  		            this.__childCache = null;
  		            // Leave this path cached as parentCache[this.name], even though
  		            // it no longer has a value defined.
  		        }
  		        else {
  		            throw new Error("Could not replace path");
  		        }
  		        return results;
  		    };
  		    return Path;
  		}
  		exports.default = pathPlugin;
  		module.exports = exports["default"];
  } (path, path.exports));
  	return path.exports;
  }

  var scope$1 = {exports: {}};

  var hasRequiredScope;

  function requireScope () {
  	if (hasRequiredScope) return scope$1.exports;
  	hasRequiredScope = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var hasOwn = Object.prototype.hasOwnProperty;
  		function scopePlugin(fork) {
  		    var types = fork.use(types_1.default);
  		    var Type = types.Type;
  		    var namedTypes = types.namedTypes;
  		    var Node = namedTypes.Node;
  		    var Expression = namedTypes.Expression;
  		    var isArray = types.builtInTypes.array;
  		    var b = types.builders;
  		    var Scope = function Scope(path, parentScope) {
  		        if (!(this instanceof Scope)) {
  		            throw new Error("Scope constructor cannot be invoked without 'new'");
  		        }
  		        ScopeType.assert(path.value);
  		        var depth;
  		        if (parentScope) {
  		            if (!(parentScope instanceof Scope)) {
  		                throw new Error("");
  		            }
  		            depth = parentScope.depth + 1;
  		        }
  		        else {
  		            parentScope = null;
  		            depth = 0;
  		        }
  		        Object.defineProperties(this, {
  		            path: { value: path },
  		            node: { value: path.value },
  		            isGlobal: { value: !parentScope, enumerable: true },
  		            depth: { value: depth },
  		            parent: { value: parentScope },
  		            bindings: { value: {} },
  		            types: { value: {} },
  		        });
  		    };
  		    var scopeTypes = [
  		        // Program nodes introduce global scopes.
  		        namedTypes.Program,
  		        // Function is the supertype of FunctionExpression,
  		        // FunctionDeclaration, ArrowExpression, etc.
  		        namedTypes.Function,
  		        // In case you didn't know, the caught parameter shadows any variable
  		        // of the same name in an outer scope.
  		        namedTypes.CatchClause
  		    ];
  		    var ScopeType = Type.or.apply(Type, scopeTypes);
  		    Scope.isEstablishedBy = function (node) {
  		        return ScopeType.check(node);
  		    };
  		    var Sp = Scope.prototype;
  		    // Will be overridden after an instance lazily calls scanScope.
  		    Sp.didScan = false;
  		    Sp.declares = function (name) {
  		        this.scan();
  		        return hasOwn.call(this.bindings, name);
  		    };
  		    Sp.declaresType = function (name) {
  		        this.scan();
  		        return hasOwn.call(this.types, name);
  		    };
  		    Sp.declareTemporary = function (prefix) {
  		        if (prefix) {
  		            if (!/^[a-z$_]/i.test(prefix)) {
  		                throw new Error("");
  		            }
  		        }
  		        else {
  		            prefix = "t$";
  		        }
  		        // Include this.depth in the name to make sure the name does not
  		        // collide with any variables in nested/enclosing scopes.
  		        prefix += this.depth.toString(36) + "$";
  		        this.scan();
  		        var index = 0;
  		        while (this.declares(prefix + index)) {
  		            ++index;
  		        }
  		        var name = prefix + index;
  		        return this.bindings[name] = types.builders.identifier(name);
  		    };
  		    Sp.injectTemporary = function (identifier, init) {
  		        identifier || (identifier = this.declareTemporary());
  		        var bodyPath = this.path.get("body");
  		        if (namedTypes.BlockStatement.check(bodyPath.value)) {
  		            bodyPath = bodyPath.get("body");
  		        }
  		        bodyPath.unshift(b.variableDeclaration("var", [b.variableDeclarator(identifier, init || null)]));
  		        return identifier;
  		    };
  		    Sp.scan = function (force) {
  		        if (force || !this.didScan) {
  		            for (var name in this.bindings) {
  		                // Empty out this.bindings, just in cases.
  		                delete this.bindings[name];
  		            }
  		            scanScope(this.path, this.bindings, this.types);
  		            this.didScan = true;
  		        }
  		    };
  		    Sp.getBindings = function () {
  		        this.scan();
  		        return this.bindings;
  		    };
  		    Sp.getTypes = function () {
  		        this.scan();
  		        return this.types;
  		    };
  		    function scanScope(path, bindings, scopeTypes) {
  		        var node = path.value;
  		        ScopeType.assert(node);
  		        if (namedTypes.CatchClause.check(node)) {
  		            // A catch clause establishes a new scope but the only variable
  		            // bound in that scope is the catch parameter. Any other
  		            // declarations create bindings in the outer scope.
  		            var param = path.get("param");
  		            if (param.value) {
  		                addPattern(param, bindings);
  		            }
  		        }
  		        else {
  		            recursiveScanScope(path, bindings, scopeTypes);
  		        }
  		    }
  		    function recursiveScanScope(path, bindings, scopeTypes) {
  		        var node = path.value;
  		        if (path.parent &&
  		            namedTypes.FunctionExpression.check(path.parent.node) &&
  		            path.parent.node.id) {
  		            addPattern(path.parent.get("id"), bindings);
  		        }
  		        if (!node) ;
  		        else if (isArray.check(node)) {
  		            path.each(function (childPath) {
  		                recursiveScanChild(childPath, bindings, scopeTypes);
  		            });
  		        }
  		        else if (namedTypes.Function.check(node)) {
  		            path.get("params").each(function (paramPath) {
  		                addPattern(paramPath, bindings);
  		            });
  		            recursiveScanChild(path.get("body"), bindings, scopeTypes);
  		        }
  		        else if ((namedTypes.TypeAlias && namedTypes.TypeAlias.check(node)) ||
  		            (namedTypes.InterfaceDeclaration && namedTypes.InterfaceDeclaration.check(node)) ||
  		            (namedTypes.TSTypeAliasDeclaration && namedTypes.TSTypeAliasDeclaration.check(node)) ||
  		            (namedTypes.TSInterfaceDeclaration && namedTypes.TSInterfaceDeclaration.check(node))) {
  		            addTypePattern(path.get("id"), scopeTypes);
  		        }
  		        else if (namedTypes.VariableDeclarator.check(node)) {
  		            addPattern(path.get("id"), bindings);
  		            recursiveScanChild(path.get("init"), bindings, scopeTypes);
  		        }
  		        else if (node.type === "ImportSpecifier" ||
  		            node.type === "ImportNamespaceSpecifier" ||
  		            node.type === "ImportDefaultSpecifier") {
  		            addPattern(
  		            // Esprima used to use the .name field to refer to the local
  		            // binding identifier for ImportSpecifier nodes, but .id for
  		            // ImportNamespaceSpecifier and ImportDefaultSpecifier nodes.
  		            // ESTree/Acorn/ESpree use .local for all three node types.
  		            path.get(node.local ? "local" :
  		                node.name ? "name" : "id"), bindings);
  		        }
  		        else if (Node.check(node) && !Expression.check(node)) {
  		            types.eachField(node, function (name, child) {
  		                var childPath = path.get(name);
  		                if (!pathHasValue(childPath, child)) {
  		                    throw new Error("");
  		                }
  		                recursiveScanChild(childPath, bindings, scopeTypes);
  		            });
  		        }
  		    }
  		    function pathHasValue(path, value) {
  		        if (path.value === value) {
  		            return true;
  		        }
  		        // Empty arrays are probably produced by defaults.emptyArray, in which
  		        // case is makes sense to regard them as equivalent, if not ===.
  		        if (Array.isArray(path.value) &&
  		            path.value.length === 0 &&
  		            Array.isArray(value) &&
  		            value.length === 0) {
  		            return true;
  		        }
  		        return false;
  		    }
  		    function recursiveScanChild(path, bindings, scopeTypes) {
  		        var node = path.value;
  		        if (!node || Expression.check(node)) ;
  		        else if (namedTypes.FunctionDeclaration.check(node) &&
  		            node.id !== null) {
  		            addPattern(path.get("id"), bindings);
  		        }
  		        else if (namedTypes.ClassDeclaration &&
  		            namedTypes.ClassDeclaration.check(node)) {
  		            addPattern(path.get("id"), bindings);
  		        }
  		        else if (ScopeType.check(node)) {
  		            if (namedTypes.CatchClause.check(node) &&
  		                // TODO Broaden this to accept any pattern.
  		                namedTypes.Identifier.check(node.param)) {
  		                var catchParamName = node.param.name;
  		                var hadBinding = hasOwn.call(bindings, catchParamName);
  		                // Any declarations that occur inside the catch body that do
  		                // not have the same name as the catch parameter should count
  		                // as bindings in the outer scope.
  		                recursiveScanScope(path.get("body"), bindings, scopeTypes);
  		                // If a new binding matching the catch parameter name was
  		                // created while scanning the catch body, ignore it because it
  		                // actually refers to the catch parameter and not the outer
  		                // scope that we're currently scanning.
  		                if (!hadBinding) {
  		                    delete bindings[catchParamName];
  		                }
  		            }
  		        }
  		        else {
  		            recursiveScanScope(path, bindings, scopeTypes);
  		        }
  		    }
  		    function addPattern(patternPath, bindings) {
  		        var pattern = patternPath.value;
  		        namedTypes.Pattern.assert(pattern);
  		        if (namedTypes.Identifier.check(pattern)) {
  		            if (hasOwn.call(bindings, pattern.name)) {
  		                bindings[pattern.name].push(patternPath);
  		            }
  		            else {
  		                bindings[pattern.name] = [patternPath];
  		            }
  		        }
  		        else if (namedTypes.AssignmentPattern &&
  		            namedTypes.AssignmentPattern.check(pattern)) {
  		            addPattern(patternPath.get('left'), bindings);
  		        }
  		        else if (namedTypes.ObjectPattern &&
  		            namedTypes.ObjectPattern.check(pattern)) {
  		            patternPath.get('properties').each(function (propertyPath) {
  		                var property = propertyPath.value;
  		                if (namedTypes.Pattern.check(property)) {
  		                    addPattern(propertyPath, bindings);
  		                }
  		                else if (namedTypes.Property.check(property)) {
  		                    addPattern(propertyPath.get('value'), bindings);
  		                }
  		                else if (namedTypes.SpreadProperty &&
  		                    namedTypes.SpreadProperty.check(property)) {
  		                    addPattern(propertyPath.get('argument'), bindings);
  		                }
  		            });
  		        }
  		        else if (namedTypes.ArrayPattern &&
  		            namedTypes.ArrayPattern.check(pattern)) {
  		            patternPath.get('elements').each(function (elementPath) {
  		                var element = elementPath.value;
  		                if (namedTypes.Pattern.check(element)) {
  		                    addPattern(elementPath, bindings);
  		                }
  		                else if (namedTypes.SpreadElement &&
  		                    namedTypes.SpreadElement.check(element)) {
  		                    addPattern(elementPath.get("argument"), bindings);
  		                }
  		            });
  		        }
  		        else if (namedTypes.PropertyPattern &&
  		            namedTypes.PropertyPattern.check(pattern)) {
  		            addPattern(patternPath.get('pattern'), bindings);
  		        }
  		        else if ((namedTypes.SpreadElementPattern &&
  		            namedTypes.SpreadElementPattern.check(pattern)) ||
  		            (namedTypes.RestElement &&
  		                namedTypes.RestElement.check(pattern)) ||
  		            (namedTypes.SpreadPropertyPattern &&
  		                namedTypes.SpreadPropertyPattern.check(pattern))) {
  		            addPattern(patternPath.get('argument'), bindings);
  		        }
  		    }
  		    function addTypePattern(patternPath, types) {
  		        var pattern = patternPath.value;
  		        namedTypes.Pattern.assert(pattern);
  		        if (namedTypes.Identifier.check(pattern)) {
  		            if (hasOwn.call(types, pattern.name)) {
  		                types[pattern.name].push(patternPath);
  		            }
  		            else {
  		                types[pattern.name] = [patternPath];
  		            }
  		        }
  		    }
  		    Sp.lookup = function (name) {
  		        for (var scope = this; scope; scope = scope.parent)
  		            if (scope.declares(name))
  		                break;
  		        return scope;
  		    };
  		    Sp.lookupType = function (name) {
  		        for (var scope = this; scope; scope = scope.parent)
  		            if (scope.declaresType(name))
  		                break;
  		        return scope;
  		    };
  		    Sp.getGlobalScope = function () {
  		        var scope = this;
  		        while (!scope.isGlobal)
  		            scope = scope.parent;
  		        return scope;
  		    };
  		    return Scope;
  		}
  		exports.default = scopePlugin;
  		module.exports = exports["default"];
  } (scope$1, scope$1.exports));
  	return scope$1.exports;
  }

  var hasRequiredNodePath;

  function requireNodePath () {
  	if (hasRequiredNodePath) return nodePath.exports;
  	hasRequiredNodePath = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var path_1 = tslib_1.__importDefault(requirePath());
  		var scope_1 = tslib_1.__importDefault(requireScope());
  		function nodePathPlugin(fork) {
  		    var types = fork.use(types_1.default);
  		    var n = types.namedTypes;
  		    var b = types.builders;
  		    var isNumber = types.builtInTypes.number;
  		    var isArray = types.builtInTypes.array;
  		    var Path = fork.use(path_1.default);
  		    var Scope = fork.use(scope_1.default);
  		    var NodePath = function NodePath(value, parentPath, name) {
  		        if (!(this instanceof NodePath)) {
  		            throw new Error("NodePath constructor cannot be invoked without 'new'");
  		        }
  		        Path.call(this, value, parentPath, name);
  		    };
  		    var NPp = NodePath.prototype = Object.create(Path.prototype, {
  		        constructor: {
  		            value: NodePath,
  		            enumerable: false,
  		            writable: true,
  		            configurable: true
  		        }
  		    });
  		    Object.defineProperties(NPp, {
  		        node: {
  		            get: function () {
  		                Object.defineProperty(this, "node", {
  		                    configurable: true,
  		                    value: this._computeNode()
  		                });
  		                return this.node;
  		            }
  		        },
  		        parent: {
  		            get: function () {
  		                Object.defineProperty(this, "parent", {
  		                    configurable: true,
  		                    value: this._computeParent()
  		                });
  		                return this.parent;
  		            }
  		        },
  		        scope: {
  		            get: function () {
  		                Object.defineProperty(this, "scope", {
  		                    configurable: true,
  		                    value: this._computeScope()
  		                });
  		                return this.scope;
  		            }
  		        }
  		    });
  		    NPp.replace = function () {
  		        delete this.node;
  		        delete this.parent;
  		        delete this.scope;
  		        return Path.prototype.replace.apply(this, arguments);
  		    };
  		    NPp.prune = function () {
  		        var remainingNodePath = this.parent;
  		        this.replace();
  		        return cleanUpNodesAfterPrune(remainingNodePath);
  		    };
  		    // The value of the first ancestor Path whose value is a Node.
  		    NPp._computeNode = function () {
  		        var value = this.value;
  		        if (n.Node.check(value)) {
  		            return value;
  		        }
  		        var pp = this.parentPath;
  		        return pp && pp.node || null;
  		    };
  		    // The first ancestor Path whose value is a Node distinct from this.node.
  		    NPp._computeParent = function () {
  		        var value = this.value;
  		        var pp = this.parentPath;
  		        if (!n.Node.check(value)) {
  		            while (pp && !n.Node.check(pp.value)) {
  		                pp = pp.parentPath;
  		            }
  		            if (pp) {
  		                pp = pp.parentPath;
  		            }
  		        }
  		        while (pp && !n.Node.check(pp.value)) {
  		            pp = pp.parentPath;
  		        }
  		        return pp || null;
  		    };
  		    // The closest enclosing scope that governs this node.
  		    NPp._computeScope = function () {
  		        var value = this.value;
  		        var pp = this.parentPath;
  		        var scope = pp && pp.scope;
  		        if (n.Node.check(value) &&
  		            Scope.isEstablishedBy(value)) {
  		            scope = new Scope(this, scope);
  		        }
  		        return scope || null;
  		    };
  		    NPp.getValueProperty = function (name) {
  		        return types.getFieldValue(this.value, name);
  		    };
  		    /**
  		     * Determine whether this.node needs to be wrapped in parentheses in order
  		     * for a parser to reproduce the same local AST structure.
  		     *
  		     * For instance, in the expression `(1 + 2) * 3`, the BinaryExpression
  		     * whose operator is "+" needs parentheses, because `1 + 2 * 3` would
  		     * parse differently.
  		     *
  		     * If assumeExpressionContext === true, we don't worry about edge cases
  		     * like an anonymous FunctionExpression appearing lexically first in its
  		     * enclosing statement and thus needing parentheses to avoid being parsed
  		     * as a FunctionDeclaration with a missing name.
  		     */
  		    NPp.needsParens = function (assumeExpressionContext) {
  		        var pp = this.parentPath;
  		        if (!pp) {
  		            return false;
  		        }
  		        var node = this.value;
  		        // Only expressions need parentheses.
  		        if (!n.Expression.check(node)) {
  		            return false;
  		        }
  		        // Identifiers never need parentheses.
  		        if (node.type === "Identifier") {
  		            return false;
  		        }
  		        while (!n.Node.check(pp.value)) {
  		            pp = pp.parentPath;
  		            if (!pp) {
  		                return false;
  		            }
  		        }
  		        var parent = pp.value;
  		        switch (node.type) {
  		            case "UnaryExpression":
  		            case "SpreadElement":
  		            case "SpreadProperty":
  		                return parent.type === "MemberExpression"
  		                    && this.name === "object"
  		                    && parent.object === node;
  		            case "BinaryExpression":
  		            case "LogicalExpression":
  		                switch (parent.type) {
  		                    case "CallExpression":
  		                        return this.name === "callee"
  		                            && parent.callee === node;
  		                    case "UnaryExpression":
  		                    case "SpreadElement":
  		                    case "SpreadProperty":
  		                        return true;
  		                    case "MemberExpression":
  		                        return this.name === "object"
  		                            && parent.object === node;
  		                    case "BinaryExpression":
  		                    case "LogicalExpression": {
  		                        var n_1 = node;
  		                        var po = parent.operator;
  		                        var pp_1 = PRECEDENCE[po];
  		                        var no = n_1.operator;
  		                        var np = PRECEDENCE[no];
  		                        if (pp_1 > np) {
  		                            return true;
  		                        }
  		                        if (pp_1 === np && this.name === "right") {
  		                            if (parent.right !== n_1) {
  		                                throw new Error("Nodes must be equal");
  		                            }
  		                            return true;
  		                        }
  		                    }
  		                    default:
  		                        return false;
  		                }
  		            case "SequenceExpression":
  		                switch (parent.type) {
  		                    case "ForStatement":
  		                        // Although parentheses wouldn't hurt around sequence
  		                        // expressions in the head of for loops, traditional style
  		                        // dictates that e.g. i++, j++ should not be wrapped with
  		                        // parentheses.
  		                        return false;
  		                    case "ExpressionStatement":
  		                        return this.name !== "expression";
  		                    default:
  		                        // Otherwise err on the side of overparenthesization, adding
  		                        // explicit exceptions above if this proves overzealous.
  		                        return true;
  		                }
  		            case "YieldExpression":
  		                switch (parent.type) {
  		                    case "BinaryExpression":
  		                    case "LogicalExpression":
  		                    case "UnaryExpression":
  		                    case "SpreadElement":
  		                    case "SpreadProperty":
  		                    case "CallExpression":
  		                    case "MemberExpression":
  		                    case "NewExpression":
  		                    case "ConditionalExpression":
  		                    case "YieldExpression":
  		                        return true;
  		                    default:
  		                        return false;
  		                }
  		            case "Literal":
  		                return parent.type === "MemberExpression"
  		                    && isNumber.check(node.value)
  		                    && this.name === "object"
  		                    && parent.object === node;
  		            case "AssignmentExpression":
  		            case "ConditionalExpression":
  		                switch (parent.type) {
  		                    case "UnaryExpression":
  		                    case "SpreadElement":
  		                    case "SpreadProperty":
  		                    case "BinaryExpression":
  		                    case "LogicalExpression":
  		                        return true;
  		                    case "CallExpression":
  		                        return this.name === "callee"
  		                            && parent.callee === node;
  		                    case "ConditionalExpression":
  		                        return this.name === "test"
  		                            && parent.test === node;
  		                    case "MemberExpression":
  		                        return this.name === "object"
  		                            && parent.object === node;
  		                    default:
  		                        return false;
  		                }
  		            default:
  		                if (parent.type === "NewExpression" &&
  		                    this.name === "callee" &&
  		                    parent.callee === node) {
  		                    return containsCallExpression(node);
  		                }
  		        }
  		        if (assumeExpressionContext !== true &&
  		            !this.canBeFirstInStatement() &&
  		            this.firstInStatement())
  		            return true;
  		        return false;
  		    };
  		    function isBinary(node) {
  		        return n.BinaryExpression.check(node)
  		            || n.LogicalExpression.check(node);
  		    }
  		    var PRECEDENCE = {};
  		    [["||"],
  		        ["&&"],
  		        ["|"],
  		        ["^"],
  		        ["&"],
  		        ["==", "===", "!=", "!=="],
  		        ["<", ">", "<=", ">=", "in", "instanceof"],
  		        [">>", "<<", ">>>"],
  		        ["+", "-"],
  		        ["*", "/", "%"]
  		    ].forEach(function (tier, i) {
  		        tier.forEach(function (op) {
  		            PRECEDENCE[op] = i;
  		        });
  		    });
  		    function containsCallExpression(node) {
  		        if (n.CallExpression.check(node)) {
  		            return true;
  		        }
  		        if (isArray.check(node)) {
  		            return node.some(containsCallExpression);
  		        }
  		        if (n.Node.check(node)) {
  		            return types.someField(node, function (_name, child) {
  		                return containsCallExpression(child);
  		            });
  		        }
  		        return false;
  		    }
  		    NPp.canBeFirstInStatement = function () {
  		        var node = this.node;
  		        return !n.FunctionExpression.check(node)
  		            && !n.ObjectExpression.check(node);
  		    };
  		    NPp.firstInStatement = function () {
  		        return firstInStatement(this);
  		    };
  		    function firstInStatement(path) {
  		        for (var node, parent; path.parent; path = path.parent) {
  		            node = path.node;
  		            parent = path.parent.node;
  		            if (n.BlockStatement.check(parent) &&
  		                path.parent.name === "body" &&
  		                path.name === 0) {
  		                if (parent.body[0] !== node) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		                return true;
  		            }
  		            if (n.ExpressionStatement.check(parent) &&
  		                path.name === "expression") {
  		                if (parent.expression !== node) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		                return true;
  		            }
  		            if (n.SequenceExpression.check(parent) &&
  		                path.parent.name === "expressions" &&
  		                path.name === 0) {
  		                if (parent.expressions[0] !== node) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		                continue;
  		            }
  		            if (n.CallExpression.check(parent) &&
  		                path.name === "callee") {
  		                if (parent.callee !== node) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		                continue;
  		            }
  		            if (n.MemberExpression.check(parent) &&
  		                path.name === "object") {
  		                if (parent.object !== node) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		                continue;
  		            }
  		            if (n.ConditionalExpression.check(parent) &&
  		                path.name === "test") {
  		                if (parent.test !== node) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		                continue;
  		            }
  		            if (isBinary(parent) &&
  		                path.name === "left") {
  		                if (parent.left !== node) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		                continue;
  		            }
  		            if (n.UnaryExpression.check(parent) &&
  		                !parent.prefix &&
  		                path.name === "argument") {
  		                if (parent.argument !== node) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		                continue;
  		            }
  		            return false;
  		        }
  		        return true;
  		    }
  		    /**
  		     * Pruning certain nodes will result in empty or incomplete nodes, here we clean those nodes up.
  		     */
  		    function cleanUpNodesAfterPrune(remainingNodePath) {
  		        if (n.VariableDeclaration.check(remainingNodePath.node)) {
  		            var declarations = remainingNodePath.get('declarations').value;
  		            if (!declarations || declarations.length === 0) {
  		                return remainingNodePath.prune();
  		            }
  		        }
  		        else if (n.ExpressionStatement.check(remainingNodePath.node)) {
  		            if (!remainingNodePath.get('expression').value) {
  		                return remainingNodePath.prune();
  		            }
  		        }
  		        else if (n.IfStatement.check(remainingNodePath.node)) {
  		            cleanUpIfStatementAfterPrune(remainingNodePath);
  		        }
  		        return remainingNodePath;
  		    }
  		    function cleanUpIfStatementAfterPrune(ifStatement) {
  		        var testExpression = ifStatement.get('test').value;
  		        var alternate = ifStatement.get('alternate').value;
  		        var consequent = ifStatement.get('consequent').value;
  		        if (!consequent && !alternate) {
  		            var testExpressionStatement = b.expressionStatement(testExpression);
  		            ifStatement.replace(testExpressionStatement);
  		        }
  		        else if (!consequent && alternate) {
  		            var negatedTestExpression = b.unaryExpression('!', testExpression, true);
  		            if (n.UnaryExpression.check(testExpression) && testExpression.operator === '!') {
  		                negatedTestExpression = testExpression.argument;
  		            }
  		            ifStatement.get("test").replace(negatedTestExpression);
  		            ifStatement.get("consequent").replace(alternate);
  		            ifStatement.get("alternate").replace();
  		        }
  		    }
  		    return NodePath;
  		}
  		exports.default = nodePathPlugin;
  		module.exports = exports["default"];
  } (nodePath, nodePath.exports));
  	return nodePath.exports;
  }

  var hasRequiredPathVisitor;

  function requirePathVisitor () {
  	if (hasRequiredPathVisitor) return pathVisitor.exports;
  	hasRequiredPathVisitor = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var node_path_1 = tslib_1.__importDefault(requireNodePath());
  		var hasOwn = Object.prototype.hasOwnProperty;
  		function pathVisitorPlugin(fork) {
  		    var types = fork.use(types_1.default);
  		    var NodePath = fork.use(node_path_1.default);
  		    var isArray = types.builtInTypes.array;
  		    var isObject = types.builtInTypes.object;
  		    var isFunction = types.builtInTypes.function;
  		    var undefined$1;
  		    var PathVisitor = function PathVisitor() {
  		        if (!(this instanceof PathVisitor)) {
  		            throw new Error("PathVisitor constructor cannot be invoked without 'new'");
  		        }
  		        // Permanent state.
  		        this._reusableContextStack = [];
  		        this._methodNameTable = computeMethodNameTable(this);
  		        this._shouldVisitComments =
  		            hasOwn.call(this._methodNameTable, "Block") ||
  		                hasOwn.call(this._methodNameTable, "Line");
  		        this.Context = makeContextConstructor(this);
  		        // State reset every time PathVisitor.prototype.visit is called.
  		        this._visiting = false;
  		        this._changeReported = false;
  		    };
  		    function computeMethodNameTable(visitor) {
  		        var typeNames = Object.create(null);
  		        for (var methodName in visitor) {
  		            if (/^visit[A-Z]/.test(methodName)) {
  		                typeNames[methodName.slice("visit".length)] = true;
  		            }
  		        }
  		        var supertypeTable = types.computeSupertypeLookupTable(typeNames);
  		        var methodNameTable = Object.create(null);
  		        var typeNameKeys = Object.keys(supertypeTable);
  		        var typeNameCount = typeNameKeys.length;
  		        for (var i = 0; i < typeNameCount; ++i) {
  		            var typeName = typeNameKeys[i];
  		            methodName = "visit" + supertypeTable[typeName];
  		            if (isFunction.check(visitor[methodName])) {
  		                methodNameTable[typeName] = methodName;
  		            }
  		        }
  		        return methodNameTable;
  		    }
  		    PathVisitor.fromMethodsObject = function fromMethodsObject(methods) {
  		        if (methods instanceof PathVisitor) {
  		            return methods;
  		        }
  		        if (!isObject.check(methods)) {
  		            // An empty visitor?
  		            return new PathVisitor;
  		        }
  		        var Visitor = function Visitor() {
  		            if (!(this instanceof Visitor)) {
  		                throw new Error("Visitor constructor cannot be invoked without 'new'");
  		            }
  		            PathVisitor.call(this);
  		        };
  		        var Vp = Visitor.prototype = Object.create(PVp);
  		        Vp.constructor = Visitor;
  		        extend(Vp, methods);
  		        extend(Visitor, PathVisitor);
  		        isFunction.assert(Visitor.fromMethodsObject);
  		        isFunction.assert(Visitor.visit);
  		        return new Visitor;
  		    };
  		    function extend(target, source) {
  		        for (var property in source) {
  		            if (hasOwn.call(source, property)) {
  		                target[property] = source[property];
  		            }
  		        }
  		        return target;
  		    }
  		    PathVisitor.visit = function visit(node, methods) {
  		        return PathVisitor.fromMethodsObject(methods).visit(node);
  		    };
  		    var PVp = PathVisitor.prototype;
  		    PVp.visit = function () {
  		        if (this._visiting) {
  		            throw new Error("Recursively calling visitor.visit(path) resets visitor state. " +
  		                "Try this.visit(path) or this.traverse(path) instead.");
  		        }
  		        // Private state that needs to be reset before every traversal.
  		        this._visiting = true;
  		        this._changeReported = false;
  		        this._abortRequested = false;
  		        var argc = arguments.length;
  		        var args = new Array(argc);
  		        for (var i = 0; i < argc; ++i) {
  		            args[i] = arguments[i];
  		        }
  		        if (!(args[0] instanceof NodePath)) {
  		            args[0] = new NodePath({ root: args[0] }).get("root");
  		        }
  		        // Called with the same arguments as .visit.
  		        this.reset.apply(this, args);
  		        var didNotThrow;
  		        try {
  		            var root = this.visitWithoutReset(args[0]);
  		            didNotThrow = true;
  		        }
  		        finally {
  		            this._visiting = false;
  		            if (!didNotThrow && this._abortRequested) {
  		                // If this.visitWithoutReset threw an exception and
  		                // this._abortRequested was set to true, return the root of
  		                // the AST instead of letting the exception propagate, so that
  		                // client code does not have to provide a try-catch block to
  		                // intercept the AbortRequest exception.  Other kinds of
  		                // exceptions will propagate without being intercepted and
  		                // rethrown by a catch block, so their stacks will accurately
  		                // reflect the original throwing context.
  		                return args[0].value;
  		            }
  		        }
  		        return root;
  		    };
  		    PVp.AbortRequest = function AbortRequest() { };
  		    PVp.abort = function () {
  		        var visitor = this;
  		        visitor._abortRequested = true;
  		        var request = new visitor.AbortRequest();
  		        // If you decide to catch this exception and stop it from propagating,
  		        // make sure to call its cancel method to avoid silencing other
  		        // exceptions that might be thrown later in the traversal.
  		        request.cancel = function () {
  		            visitor._abortRequested = false;
  		        };
  		        throw request;
  		    };
  		    PVp.reset = function (_path /*, additional arguments */) {
  		        // Empty stub; may be reassigned or overridden by subclasses.
  		    };
  		    PVp.visitWithoutReset = function (path) {
  		        if (this instanceof this.Context) {
  		            // Since this.Context.prototype === this, there's a chance we
  		            // might accidentally call context.visitWithoutReset. If that
  		            // happens, re-invoke the method against context.visitor.
  		            return this.visitor.visitWithoutReset(path);
  		        }
  		        if (!(path instanceof NodePath)) {
  		            throw new Error("");
  		        }
  		        var value = path.value;
  		        var methodName = value &&
  		            typeof value === "object" &&
  		            typeof value.type === "string" &&
  		            this._methodNameTable[value.type];
  		        if (methodName) {
  		            var context = this.acquireContext(path);
  		            try {
  		                return context.invokeVisitorMethod(methodName);
  		            }
  		            finally {
  		                this.releaseContext(context);
  		            }
  		        }
  		        else {
  		            // If there was no visitor method to call, visit the children of
  		            // this node generically.
  		            return visitChildren(path, this);
  		        }
  		    };
  		    function visitChildren(path, visitor) {
  		        if (!(path instanceof NodePath)) {
  		            throw new Error("");
  		        }
  		        if (!(visitor instanceof PathVisitor)) {
  		            throw new Error("");
  		        }
  		        var value = path.value;
  		        if (isArray.check(value)) {
  		            path.each(visitor.visitWithoutReset, visitor);
  		        }
  		        else if (!isObject.check(value)) ;
  		        else {
  		            var childNames = types.getFieldNames(value);
  		            // The .comments field of the Node type is hidden, so we only
  		            // visit it if the visitor defines visitBlock or visitLine, and
  		            // value.comments is defined.
  		            if (visitor._shouldVisitComments &&
  		                value.comments &&
  		                childNames.indexOf("comments") < 0) {
  		                childNames.push("comments");
  		            }
  		            var childCount = childNames.length;
  		            var childPaths = [];
  		            for (var i = 0; i < childCount; ++i) {
  		                var childName = childNames[i];
  		                if (!hasOwn.call(value, childName)) {
  		                    value[childName] = types.getFieldValue(value, childName);
  		                }
  		                childPaths.push(path.get(childName));
  		            }
  		            for (var i = 0; i < childCount; ++i) {
  		                visitor.visitWithoutReset(childPaths[i]);
  		            }
  		        }
  		        return path.value;
  		    }
  		    PVp.acquireContext = function (path) {
  		        if (this._reusableContextStack.length === 0) {
  		            return new this.Context(path);
  		        }
  		        return this._reusableContextStack.pop().reset(path);
  		    };
  		    PVp.releaseContext = function (context) {
  		        if (!(context instanceof this.Context)) {
  		            throw new Error("");
  		        }
  		        this._reusableContextStack.push(context);
  		        context.currentPath = null;
  		    };
  		    PVp.reportChanged = function () {
  		        this._changeReported = true;
  		    };
  		    PVp.wasChangeReported = function () {
  		        return this._changeReported;
  		    };
  		    function makeContextConstructor(visitor) {
  		        function Context(path) {
  		            if (!(this instanceof Context)) {
  		                throw new Error("");
  		            }
  		            if (!(this instanceof PathVisitor)) {
  		                throw new Error("");
  		            }
  		            if (!(path instanceof NodePath)) {
  		                throw new Error("");
  		            }
  		            Object.defineProperty(this, "visitor", {
  		                value: visitor,
  		                writable: false,
  		                enumerable: true,
  		                configurable: false
  		            });
  		            this.currentPath = path;
  		            this.needToCallTraverse = true;
  		            Object.seal(this);
  		        }
  		        if (!(visitor instanceof PathVisitor)) {
  		            throw new Error("");
  		        }
  		        // Note that the visitor object is the prototype of Context.prototype,
  		        // so all visitor methods are inherited by context objects.
  		        var Cp = Context.prototype = Object.create(visitor);
  		        Cp.constructor = Context;
  		        extend(Cp, sharedContextProtoMethods);
  		        return Context;
  		    }
  		    // Every PathVisitor has a different this.Context constructor and
  		    // this.Context.prototype object, but those prototypes can all use the
  		    // same reset, invokeVisitorMethod, and traverse function objects.
  		    var sharedContextProtoMethods = Object.create(null);
  		    sharedContextProtoMethods.reset =
  		        function reset(path) {
  		            if (!(this instanceof this.Context)) {
  		                throw new Error("");
  		            }
  		            if (!(path instanceof NodePath)) {
  		                throw new Error("");
  		            }
  		            this.currentPath = path;
  		            this.needToCallTraverse = true;
  		            return this;
  		        };
  		    sharedContextProtoMethods.invokeVisitorMethod =
  		        function invokeVisitorMethod(methodName) {
  		            if (!(this instanceof this.Context)) {
  		                throw new Error("");
  		            }
  		            if (!(this.currentPath instanceof NodePath)) {
  		                throw new Error("");
  		            }
  		            var result = this.visitor[methodName].call(this, this.currentPath);
  		            if (result === false) {
  		                // Visitor methods return false to indicate that they have handled
  		                // their own traversal needs, and we should not complain if
  		                // this.needToCallTraverse is still true.
  		                this.needToCallTraverse = false;
  		            }
  		            else if (result !== undefined$1) {
  		                // Any other non-undefined value returned from the visitor method
  		                // is interpreted as a replacement value.
  		                this.currentPath = this.currentPath.replace(result)[0];
  		                if (this.needToCallTraverse) {
  		                    // If this.traverse still hasn't been called, visit the
  		                    // children of the replacement node.
  		                    this.traverse(this.currentPath);
  		                }
  		            }
  		            if (this.needToCallTraverse !== false) {
  		                throw new Error("Must either call this.traverse or return false in " + methodName);
  		            }
  		            var path = this.currentPath;
  		            return path && path.value;
  		        };
  		    sharedContextProtoMethods.traverse =
  		        function traverse(path, newVisitor) {
  		            if (!(this instanceof this.Context)) {
  		                throw new Error("");
  		            }
  		            if (!(path instanceof NodePath)) {
  		                throw new Error("");
  		            }
  		            if (!(this.currentPath instanceof NodePath)) {
  		                throw new Error("");
  		            }
  		            this.needToCallTraverse = false;
  		            return visitChildren(path, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
  		        };
  		    sharedContextProtoMethods.visit =
  		        function visit(path, newVisitor) {
  		            if (!(this instanceof this.Context)) {
  		                throw new Error("");
  		            }
  		            if (!(path instanceof NodePath)) {
  		                throw new Error("");
  		            }
  		            if (!(this.currentPath instanceof NodePath)) {
  		                throw new Error("");
  		            }
  		            this.needToCallTraverse = false;
  		            return PathVisitor.fromMethodsObject(newVisitor || this.visitor).visitWithoutReset(path);
  		        };
  		    sharedContextProtoMethods.reportChanged = function reportChanged() {
  		        this.visitor.reportChanged();
  		    };
  		    sharedContextProtoMethods.abort = function abort() {
  		        this.needToCallTraverse = false;
  		        this.visitor.abort();
  		    };
  		    return PathVisitor;
  		}
  		exports.default = pathVisitorPlugin;
  		module.exports = exports["default"];
  } (pathVisitor, pathVisitor.exports));
  	return pathVisitor.exports;
  }

  var equiv$1 = {exports: {}};

  var hasRequiredEquiv;

  function requireEquiv () {
  	if (hasRequiredEquiv) return equiv$1.exports;
  	hasRequiredEquiv = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		function default_1(fork) {
  		    var types = fork.use(types_1.default);
  		    var getFieldNames = types.getFieldNames;
  		    var getFieldValue = types.getFieldValue;
  		    var isArray = types.builtInTypes.array;
  		    var isObject = types.builtInTypes.object;
  		    var isDate = types.builtInTypes.Date;
  		    var isRegExp = types.builtInTypes.RegExp;
  		    var hasOwn = Object.prototype.hasOwnProperty;
  		    function astNodesAreEquivalent(a, b, problemPath) {
  		        if (isArray.check(problemPath)) {
  		            problemPath.length = 0;
  		        }
  		        else {
  		            problemPath = null;
  		        }
  		        return areEquivalent(a, b, problemPath);
  		    }
  		    astNodesAreEquivalent.assert = function (a, b) {
  		        var problemPath = [];
  		        if (!astNodesAreEquivalent(a, b, problemPath)) {
  		            if (problemPath.length === 0) {
  		                if (a !== b) {
  		                    throw new Error("Nodes must be equal");
  		                }
  		            }
  		            else {
  		                throw new Error("Nodes differ in the following path: " +
  		                    problemPath.map(subscriptForProperty).join(""));
  		            }
  		        }
  		    };
  		    function subscriptForProperty(property) {
  		        if (/[_$a-z][_$a-z0-9]*/i.test(property)) {
  		            return "." + property;
  		        }
  		        return "[" + JSON.stringify(property) + "]";
  		    }
  		    function areEquivalent(a, b, problemPath) {
  		        if (a === b) {
  		            return true;
  		        }
  		        if (isArray.check(a)) {
  		            return arraysAreEquivalent(a, b, problemPath);
  		        }
  		        if (isObject.check(a)) {
  		            return objectsAreEquivalent(a, b, problemPath);
  		        }
  		        if (isDate.check(a)) {
  		            return isDate.check(b) && (+a === +b);
  		        }
  		        if (isRegExp.check(a)) {
  		            return isRegExp.check(b) && (a.source === b.source &&
  		                a.global === b.global &&
  		                a.multiline === b.multiline &&
  		                a.ignoreCase === b.ignoreCase);
  		        }
  		        return a == b;
  		    }
  		    function arraysAreEquivalent(a, b, problemPath) {
  		        isArray.assert(a);
  		        var aLength = a.length;
  		        if (!isArray.check(b) || b.length !== aLength) {
  		            if (problemPath) {
  		                problemPath.push("length");
  		            }
  		            return false;
  		        }
  		        for (var i = 0; i < aLength; ++i) {
  		            if (problemPath) {
  		                problemPath.push(i);
  		            }
  		            if (i in a !== i in b) {
  		                return false;
  		            }
  		            if (!areEquivalent(a[i], b[i], problemPath)) {
  		                return false;
  		            }
  		            if (problemPath) {
  		                var problemPathTail = problemPath.pop();
  		                if (problemPathTail !== i) {
  		                    throw new Error("" + problemPathTail);
  		                }
  		            }
  		        }
  		        return true;
  		    }
  		    function objectsAreEquivalent(a, b, problemPath) {
  		        isObject.assert(a);
  		        if (!isObject.check(b)) {
  		            return false;
  		        }
  		        // Fast path for a common property of AST nodes.
  		        if (a.type !== b.type) {
  		            if (problemPath) {
  		                problemPath.push("type");
  		            }
  		            return false;
  		        }
  		        var aNames = getFieldNames(a);
  		        var aNameCount = aNames.length;
  		        var bNames = getFieldNames(b);
  		        var bNameCount = bNames.length;
  		        if (aNameCount === bNameCount) {
  		            for (var i = 0; i < aNameCount; ++i) {
  		                var name = aNames[i];
  		                var aChild = getFieldValue(a, name);
  		                var bChild = getFieldValue(b, name);
  		                if (problemPath) {
  		                    problemPath.push(name);
  		                }
  		                if (!areEquivalent(aChild, bChild, problemPath)) {
  		                    return false;
  		                }
  		                if (problemPath) {
  		                    var problemPathTail = problemPath.pop();
  		                    if (problemPathTail !== name) {
  		                        throw new Error("" + problemPathTail);
  		                    }
  		                }
  		            }
  		            return true;
  		        }
  		        if (!problemPath) {
  		            return false;
  		        }
  		        // Since aNameCount !== bNameCount, we need to find some name that's
  		        // missing in aNames but present in bNames, or vice-versa.
  		        var seenNames = Object.create(null);
  		        for (i = 0; i < aNameCount; ++i) {
  		            seenNames[aNames[i]] = true;
  		        }
  		        for (i = 0; i < bNameCount; ++i) {
  		            name = bNames[i];
  		            if (!hasOwn.call(seenNames, name)) {
  		                problemPath.push(name);
  		                return false;
  		            }
  		            delete seenNames[name];
  		        }
  		        for (name in seenNames) {
  		            problemPath.push(name);
  		            break;
  		        }
  		        return false;
  		    }
  		    return astNodesAreEquivalent;
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (equiv$1, equiv$1.exports));
  	return equiv$1.exports;
  }

  var hasRequiredFork;

  function requireFork () {
  	if (hasRequiredFork) return fork.exports;
  	hasRequiredFork = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var path_visitor_1 = tslib_1.__importDefault(requirePathVisitor());
  		var equiv_1 = tslib_1.__importDefault(requireEquiv());
  		var path_1 = tslib_1.__importDefault(requirePath());
  		var node_path_1 = tslib_1.__importDefault(requireNodePath());
  		function default_1(defs) {
  		    var fork = createFork();
  		    var types = fork.use(types_1.default);
  		    defs.forEach(fork.use);
  		    types.finalize();
  		    var PathVisitor = fork.use(path_visitor_1.default);
  		    return {
  		        Type: types.Type,
  		        builtInTypes: types.builtInTypes,
  		        namedTypes: types.namedTypes,
  		        builders: types.builders,
  		        defineMethod: types.defineMethod,
  		        getFieldNames: types.getFieldNames,
  		        getFieldValue: types.getFieldValue,
  		        eachField: types.eachField,
  		        someField: types.someField,
  		        getSupertypeNames: types.getSupertypeNames,
  		        getBuilderName: types.getBuilderName,
  		        astNodesAreEquivalent: fork.use(equiv_1.default),
  		        finalize: types.finalize,
  		        Path: fork.use(path_1.default),
  		        NodePath: fork.use(node_path_1.default),
  		        PathVisitor: PathVisitor,
  		        use: fork.use,
  		        visit: PathVisitor.visit,
  		    };
  		}
  		exports.default = default_1;
  		function createFork() {
  		    var used = [];
  		    var usedResult = [];
  		    function use(plugin) {
  		        var idx = used.indexOf(plugin);
  		        if (idx === -1) {
  		            idx = used.length;
  		            used.push(plugin);
  		            usedResult[idx] = plugin(fork);
  		        }
  		        return usedResult[idx];
  		    }
  		    var fork = { use: use };
  		    return fork;
  		}
  		module.exports = exports["default"];
  } (fork, fork.exports));
  	return fork.exports;
  }

  var core = {exports: {}};

  var coreOperators = {};

  var hasRequiredCoreOperators;

  function requireCoreOperators () {
  	if (hasRequiredCoreOperators) return coreOperators;
  	hasRequiredCoreOperators = 1;
  	Object.defineProperty(coreOperators, "__esModule", { value: true });
  	coreOperators.LogicalOperators = coreOperators.AssignmentOperators = coreOperators.BinaryOperators = void 0;
  	coreOperators.BinaryOperators = [
  	    "==", "!=", "===", "!==",
  	    "<", "<=", ">", ">=",
  	    "<<", ">>", ">>>",
  	    "+", "-", "*", "/", "%",
  	    "&",
  	    "|", "^", "in",
  	    "instanceof",
  	];
  	coreOperators.AssignmentOperators = [
  	    "=", "+=", "-=", "*=", "/=", "%=",
  	    "<<=", ">>=", ">>>=",
  	    "|=", "^=", "&=",
  	];
  	coreOperators.LogicalOperators = [
  	    "||", "&&",
  	];
  	return coreOperators;
  }

  var shared = {exports: {}};

  var hasRequiredShared;

  function requireShared () {
  	if (hasRequiredShared) return shared.exports;
  	hasRequiredShared = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		function default_1(fork) {
  		    var types = fork.use(types_1.default);
  		    var Type = types.Type;
  		    var builtin = types.builtInTypes;
  		    var isNumber = builtin.number;
  		    // An example of constructing a new type with arbitrary constraints from
  		    // an existing type.
  		    function geq(than) {
  		        return Type.from(function (value) { return isNumber.check(value) && value >= than; }, isNumber + " >= " + than);
  		    }
  		    // Default value-returning functions that may optionally be passed as a
  		    // third argument to Def.prototype.field.
  		    var defaults = {
  		        // Functions were used because (among other reasons) that's the most
  		        // elegant way to allow for the emptyArray one always to give a new
  		        // array instance.
  		        "null": function () { return null; },
  		        "emptyArray": function () { return []; },
  		        "false": function () { return false; },
  		        "true": function () { return true; },
  		        "undefined": function () { },
  		        "use strict": function () { return "use strict"; }
  		    };
  		    var naiveIsPrimitive = Type.or(builtin.string, builtin.number, builtin.boolean, builtin.null, builtin.undefined);
  		    var isPrimitive = Type.from(function (value) {
  		        if (value === null)
  		            return true;
  		        var type = typeof value;
  		        if (type === "object" ||
  		            type === "function") {
  		            return false;
  		        }
  		        return true;
  		    }, naiveIsPrimitive.toString());
  		    return {
  		        geq: geq,
  		        defaults: defaults,
  		        isPrimitive: isPrimitive,
  		    };
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (shared, shared.exports));
  	return shared.exports;
  }

  var hasRequiredCore;

  function requireCore () {
  	if (hasRequiredCore) return core.exports;
  	hasRequiredCore = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var core_operators_1 = requireCoreOperators();
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    var types = fork.use(types_1.default);
  		    var Type = types.Type;
  		    var def = Type.def;
  		    var or = Type.or;
  		    var shared = fork.use(shared_1.default);
  		    var defaults = shared.defaults;
  		    var geq = shared.geq;
  		    // Abstract supertype of all syntactic entities that are allowed to have a
  		    // .loc field.
  		    def("Printable")
  		        .field("loc", or(def("SourceLocation"), null), defaults["null"], true);
  		    def("Node")
  		        .bases("Printable")
  		        .field("type", String)
  		        .field("comments", or([def("Comment")], null), defaults["null"], true);
  		    def("SourceLocation")
  		        .field("start", def("Position"))
  		        .field("end", def("Position"))
  		        .field("source", or(String, null), defaults["null"]);
  		    def("Position")
  		        .field("line", geq(1))
  		        .field("column", geq(0));
  		    def("File")
  		        .bases("Node")
  		        .build("program", "name")
  		        .field("program", def("Program"))
  		        .field("name", or(String, null), defaults["null"]);
  		    def("Program")
  		        .bases("Node")
  		        .build("body")
  		        .field("body", [def("Statement")]);
  		    def("Function")
  		        .bases("Node")
  		        .field("id", or(def("Identifier"), null), defaults["null"])
  		        .field("params", [def("Pattern")])
  		        .field("body", def("BlockStatement"))
  		        .field("generator", Boolean, defaults["false"])
  		        .field("async", Boolean, defaults["false"]);
  		    def("Statement").bases("Node");
  		    // The empty .build() here means that an EmptyStatement can be constructed
  		    // (i.e. it's not abstract) but that it needs no arguments.
  		    def("EmptyStatement").bases("Statement").build();
  		    def("BlockStatement")
  		        .bases("Statement")
  		        .build("body")
  		        .field("body", [def("Statement")]);
  		    // TODO Figure out how to silently coerce Expressions to
  		    // ExpressionStatements where a Statement was expected.
  		    def("ExpressionStatement")
  		        .bases("Statement")
  		        .build("expression")
  		        .field("expression", def("Expression"));
  		    def("IfStatement")
  		        .bases("Statement")
  		        .build("test", "consequent", "alternate")
  		        .field("test", def("Expression"))
  		        .field("consequent", def("Statement"))
  		        .field("alternate", or(def("Statement"), null), defaults["null"]);
  		    def("LabeledStatement")
  		        .bases("Statement")
  		        .build("label", "body")
  		        .field("label", def("Identifier"))
  		        .field("body", def("Statement"));
  		    def("BreakStatement")
  		        .bases("Statement")
  		        .build("label")
  		        .field("label", or(def("Identifier"), null), defaults["null"]);
  		    def("ContinueStatement")
  		        .bases("Statement")
  		        .build("label")
  		        .field("label", or(def("Identifier"), null), defaults["null"]);
  		    def("WithStatement")
  		        .bases("Statement")
  		        .build("object", "body")
  		        .field("object", def("Expression"))
  		        .field("body", def("Statement"));
  		    def("SwitchStatement")
  		        .bases("Statement")
  		        .build("discriminant", "cases", "lexical")
  		        .field("discriminant", def("Expression"))
  		        .field("cases", [def("SwitchCase")])
  		        .field("lexical", Boolean, defaults["false"]);
  		    def("ReturnStatement")
  		        .bases("Statement")
  		        .build("argument")
  		        .field("argument", or(def("Expression"), null));
  		    def("ThrowStatement")
  		        .bases("Statement")
  		        .build("argument")
  		        .field("argument", def("Expression"));
  		    def("TryStatement")
  		        .bases("Statement")
  		        .build("block", "handler", "finalizer")
  		        .field("block", def("BlockStatement"))
  		        .field("handler", or(def("CatchClause"), null), function () {
  		        return this.handlers && this.handlers[0] || null;
  		    })
  		        .field("handlers", [def("CatchClause")], function () {
  		        return this.handler ? [this.handler] : [];
  		    }, true) // Indicates this field is hidden from eachField iteration.
  		        .field("guardedHandlers", [def("CatchClause")], defaults.emptyArray)
  		        .field("finalizer", or(def("BlockStatement"), null), defaults["null"]);
  		    def("CatchClause")
  		        .bases("Node")
  		        .build("param", "guard", "body")
  		        .field("param", def("Pattern"))
  		        .field("guard", or(def("Expression"), null), defaults["null"])
  		        .field("body", def("BlockStatement"));
  		    def("WhileStatement")
  		        .bases("Statement")
  		        .build("test", "body")
  		        .field("test", def("Expression"))
  		        .field("body", def("Statement"));
  		    def("DoWhileStatement")
  		        .bases("Statement")
  		        .build("body", "test")
  		        .field("body", def("Statement"))
  		        .field("test", def("Expression"));
  		    def("ForStatement")
  		        .bases("Statement")
  		        .build("init", "test", "update", "body")
  		        .field("init", or(def("VariableDeclaration"), def("Expression"), null))
  		        .field("test", or(def("Expression"), null))
  		        .field("update", or(def("Expression"), null))
  		        .field("body", def("Statement"));
  		    def("ForInStatement")
  		        .bases("Statement")
  		        .build("left", "right", "body")
  		        .field("left", or(def("VariableDeclaration"), def("Expression")))
  		        .field("right", def("Expression"))
  		        .field("body", def("Statement"));
  		    def("DebuggerStatement").bases("Statement").build();
  		    def("Declaration").bases("Statement");
  		    def("FunctionDeclaration")
  		        .bases("Function", "Declaration")
  		        .build("id", "params", "body")
  		        .field("id", def("Identifier"));
  		    def("FunctionExpression")
  		        .bases("Function", "Expression")
  		        .build("id", "params", "body");
  		    def("VariableDeclaration")
  		        .bases("Declaration")
  		        .build("kind", "declarations")
  		        .field("kind", or("var", "let", "const"))
  		        .field("declarations", [def("VariableDeclarator")]);
  		    def("VariableDeclarator")
  		        .bases("Node")
  		        .build("id", "init")
  		        .field("id", def("Pattern"))
  		        .field("init", or(def("Expression"), null), defaults["null"]);
  		    def("Expression").bases("Node");
  		    def("ThisExpression").bases("Expression").build();
  		    def("ArrayExpression")
  		        .bases("Expression")
  		        .build("elements")
  		        .field("elements", [or(def("Expression"), null)]);
  		    def("ObjectExpression")
  		        .bases("Expression")
  		        .build("properties")
  		        .field("properties", [def("Property")]);
  		    // TODO Not in the Mozilla Parser API, but used by Esprima.
  		    def("Property")
  		        .bases("Node") // Want to be able to visit Property Nodes.
  		        .build("kind", "key", "value")
  		        .field("kind", or("init", "get", "set"))
  		        .field("key", or(def("Literal"), def("Identifier")))
  		        .field("value", def("Expression"));
  		    def("SequenceExpression")
  		        .bases("Expression")
  		        .build("expressions")
  		        .field("expressions", [def("Expression")]);
  		    var UnaryOperator = or("-", "+", "!", "~", "typeof", "void", "delete");
  		    def("UnaryExpression")
  		        .bases("Expression")
  		        .build("operator", "argument", "prefix")
  		        .field("operator", UnaryOperator)
  		        .field("argument", def("Expression"))
  		        // Esprima doesn't bother with this field, presumably because it's
  		        // always true for unary operators.
  		        .field("prefix", Boolean, defaults["true"]);
  		    var BinaryOperator = or.apply(void 0, core_operators_1.BinaryOperators);
  		    def("BinaryExpression")
  		        .bases("Expression")
  		        .build("operator", "left", "right")
  		        .field("operator", BinaryOperator)
  		        .field("left", def("Expression"))
  		        .field("right", def("Expression"));
  		    var AssignmentOperator = or.apply(void 0, core_operators_1.AssignmentOperators);
  		    def("AssignmentExpression")
  		        .bases("Expression")
  		        .build("operator", "left", "right")
  		        .field("operator", AssignmentOperator)
  		        .field("left", or(def("Pattern"), def("MemberExpression")))
  		        .field("right", def("Expression"));
  		    var UpdateOperator = or("++", "--");
  		    def("UpdateExpression")
  		        .bases("Expression")
  		        .build("operator", "argument", "prefix")
  		        .field("operator", UpdateOperator)
  		        .field("argument", def("Expression"))
  		        .field("prefix", Boolean);
  		    var LogicalOperator = or.apply(void 0, core_operators_1.LogicalOperators);
  		    def("LogicalExpression")
  		        .bases("Expression")
  		        .build("operator", "left", "right")
  		        .field("operator", LogicalOperator)
  		        .field("left", def("Expression"))
  		        .field("right", def("Expression"));
  		    def("ConditionalExpression")
  		        .bases("Expression")
  		        .build("test", "consequent", "alternate")
  		        .field("test", def("Expression"))
  		        .field("consequent", def("Expression"))
  		        .field("alternate", def("Expression"));
  		    def("NewExpression")
  		        .bases("Expression")
  		        .build("callee", "arguments")
  		        .field("callee", def("Expression"))
  		        // The Mozilla Parser API gives this type as [or(def("Expression"),
  		        // null)], but null values don't really make sense at the call site.
  		        // TODO Report this nonsense.
  		        .field("arguments", [def("Expression")]);
  		    def("CallExpression")
  		        .bases("Expression")
  		        .build("callee", "arguments")
  		        .field("callee", def("Expression"))
  		        // See comment for NewExpression above.
  		        .field("arguments", [def("Expression")]);
  		    def("MemberExpression")
  		        .bases("Expression")
  		        .build("object", "property", "computed")
  		        .field("object", def("Expression"))
  		        .field("property", or(def("Identifier"), def("Expression")))
  		        .field("computed", Boolean, function () {
  		        var type = this.property.type;
  		        if (type === 'Literal' ||
  		            type === 'MemberExpression' ||
  		            type === 'BinaryExpression') {
  		            return true;
  		        }
  		        return false;
  		    });
  		    def("Pattern").bases("Node");
  		    def("SwitchCase")
  		        .bases("Node")
  		        .build("test", "consequent")
  		        .field("test", or(def("Expression"), null))
  		        .field("consequent", [def("Statement")]);
  		    def("Identifier")
  		        .bases("Expression", "Pattern")
  		        .build("name")
  		        .field("name", String)
  		        .field("optional", Boolean, defaults["false"]);
  		    def("Literal")
  		        .bases("Expression")
  		        .build("value")
  		        .field("value", or(String, Boolean, null, Number, RegExp))
  		        .field("regex", or({
  		        pattern: String,
  		        flags: String
  		    }, null), function () {
  		        if (this.value instanceof RegExp) {
  		            var flags = "";
  		            if (this.value.ignoreCase)
  		                flags += "i";
  		            if (this.value.multiline)
  		                flags += "m";
  		            if (this.value.global)
  		                flags += "g";
  		            return {
  		                pattern: this.value.source,
  		                flags: flags
  		            };
  		        }
  		        return null;
  		    });
  		    // Abstract (non-buildable) comment supertype. Not a Node.
  		    def("Comment")
  		        .bases("Printable")
  		        .field("value", String)
  		        // A .leading comment comes before the node, whereas a .trailing
  		        // comment comes after it. These two fields should not both be true,
  		        // but they might both be false when the comment falls inside a node
  		        // and the node has no children for the comment to lead or trail,
  		        // e.g. { /*dangling*/ }.
  		        .field("leading", Boolean, defaults["true"])
  		        .field("trailing", Boolean, defaults["false"]);
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (core, core.exports));
  	return core.exports;
  }

  var es6 = {exports: {}};

  var hasRequiredEs6;

  function requireEs6 () {
  	if (hasRequiredEs6) return es6.exports;
  	hasRequiredEs6 = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var core_1 = tslib_1.__importDefault(requireCore());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(core_1.default);
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var defaults = fork.use(shared_1.default).defaults;
  		    def("Function")
  		        .field("generator", Boolean, defaults["false"])
  		        .field("expression", Boolean, defaults["false"])
  		        .field("defaults", [or(def("Expression"), null)], defaults.emptyArray)
  		        // Legacy
  		        .field("rest", or(def("Identifier"), null), defaults["null"]);
  		    // The ESTree way of representing a ...rest parameter.
  		    def("RestElement")
  		        .bases("Pattern")
  		        .build("argument")
  		        .field("argument", def("Pattern"))
  		        .field("typeAnnotation", // for Babylon. Flow parser puts it on the identifier
  		    or(def("TypeAnnotation"), def("TSTypeAnnotation"), null), defaults["null"]);
  		    def("SpreadElementPattern")
  		        .bases("Pattern")
  		        .build("argument")
  		        .field("argument", def("Pattern"));
  		    def("FunctionDeclaration")
  		        .build("id", "params", "body", "generator", "expression")
  		        // May be `null` in the context of `export default function () {}`
  		        .field("id", or(def("Identifier"), null));
  		    def("FunctionExpression")
  		        .build("id", "params", "body", "generator", "expression");
  		    def("ArrowFunctionExpression")
  		        .bases("Function", "Expression")
  		        .build("params", "body", "expression")
  		        // The forced null value here is compatible with the overridden
  		        // definition of the "id" field in the Function interface.
  		        .field("id", null, defaults["null"])
  		        // Arrow function bodies are allowed to be expressions.
  		        .field("body", or(def("BlockStatement"), def("Expression")))
  		        // The current spec forbids arrow generators, so I have taken the
  		        // liberty of enforcing that. TODO Report this.
  		        .field("generator", false, defaults["false"]);
  		    def("ForOfStatement")
  		        .bases("Statement")
  		        .build("left", "right", "body")
  		        .field("left", or(def("VariableDeclaration"), def("Pattern")))
  		        .field("right", def("Expression"))
  		        .field("body", def("Statement"));
  		    def("YieldExpression")
  		        .bases("Expression")
  		        .build("argument", "delegate")
  		        .field("argument", or(def("Expression"), null))
  		        .field("delegate", Boolean, defaults["false"]);
  		    def("GeneratorExpression")
  		        .bases("Expression")
  		        .build("body", "blocks", "filter")
  		        .field("body", def("Expression"))
  		        .field("blocks", [def("ComprehensionBlock")])
  		        .field("filter", or(def("Expression"), null));
  		    def("ComprehensionExpression")
  		        .bases("Expression")
  		        .build("body", "blocks", "filter")
  		        .field("body", def("Expression"))
  		        .field("blocks", [def("ComprehensionBlock")])
  		        .field("filter", or(def("Expression"), null));
  		    def("ComprehensionBlock")
  		        .bases("Node")
  		        .build("left", "right", "each")
  		        .field("left", def("Pattern"))
  		        .field("right", def("Expression"))
  		        .field("each", Boolean);
  		    def("Property")
  		        .field("key", or(def("Literal"), def("Identifier"), def("Expression")))
  		        .field("value", or(def("Expression"), def("Pattern")))
  		        .field("method", Boolean, defaults["false"])
  		        .field("shorthand", Boolean, defaults["false"])
  		        .field("computed", Boolean, defaults["false"]);
  		    def("ObjectProperty")
  		        .field("shorthand", Boolean, defaults["false"]);
  		    def("PropertyPattern")
  		        .bases("Pattern")
  		        .build("key", "pattern")
  		        .field("key", or(def("Literal"), def("Identifier"), def("Expression")))
  		        .field("pattern", def("Pattern"))
  		        .field("computed", Boolean, defaults["false"]);
  		    def("ObjectPattern")
  		        .bases("Pattern")
  		        .build("properties")
  		        .field("properties", [or(def("PropertyPattern"), def("Property"))]);
  		    def("ArrayPattern")
  		        .bases("Pattern")
  		        .build("elements")
  		        .field("elements", [or(def("Pattern"), null)]);
  		    def("SpreadElement")
  		        .bases("Node")
  		        .build("argument")
  		        .field("argument", def("Expression"));
  		    def("ArrayExpression")
  		        .field("elements", [or(def("Expression"), def("SpreadElement"), def("RestElement"), null)]);
  		    def("NewExpression")
  		        .field("arguments", [or(def("Expression"), def("SpreadElement"))]);
  		    def("CallExpression")
  		        .field("arguments", [or(def("Expression"), def("SpreadElement"))]);
  		    // Note: this node type is *not* an AssignmentExpression with a Pattern on
  		    // the left-hand side! The existing AssignmentExpression type already
  		    // supports destructuring assignments. AssignmentPattern nodes may appear
  		    // wherever a Pattern is allowed, and the right-hand side represents a
  		    // default value to be destructured against the left-hand side, if no
  		    // value is otherwise provided. For example: default parameter values.
  		    def("AssignmentPattern")
  		        .bases("Pattern")
  		        .build("left", "right")
  		        .field("left", def("Pattern"))
  		        .field("right", def("Expression"));
  		    def("MethodDefinition")
  		        .bases("Declaration")
  		        .build("kind", "key", "value", "static")
  		        .field("kind", or("constructor", "method", "get", "set"))
  		        .field("key", def("Expression"))
  		        .field("value", def("Function"))
  		        .field("computed", Boolean, defaults["false"])
  		        .field("static", Boolean, defaults["false"]);
  		    var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"));
  		    def("ClassProperty")
  		        .bases("Declaration")
  		        .build("key")
  		        .field("key", or(def("Literal"), def("Identifier"), def("Expression")))
  		        .field("computed", Boolean, defaults["false"]);
  		    def("ClassPropertyDefinition") // static property
  		        .bases("Declaration")
  		        .build("definition")
  		        // Yes, Virginia, circular definitions are permitted.
  		        .field("definition", ClassBodyElement);
  		    def("ClassBody")
  		        .bases("Declaration")
  		        .build("body")
  		        .field("body", [ClassBodyElement]);
  		    def("ClassDeclaration")
  		        .bases("Declaration")
  		        .build("id", "body", "superClass")
  		        .field("id", or(def("Identifier"), null))
  		        .field("body", def("ClassBody"))
  		        .field("superClass", or(def("Expression"), null), defaults["null"]);
  		    def("ClassExpression")
  		        .bases("Expression")
  		        .build("id", "body", "superClass")
  		        .field("id", or(def("Identifier"), null), defaults["null"])
  		        .field("body", def("ClassBody"))
  		        .field("superClass", or(def("Expression"), null), defaults["null"]);
  		    def("Super")
  		        .bases("Expression")
  		        .build();
  		    // Specifier and ModuleSpecifier are abstract non-standard types
  		    // introduced for definitional convenience.
  		    def("Specifier").bases("Node");
  		    // This supertype is shared/abused by both def/babel.js and
  		    // def/esprima.js. In the future, it will be possible to load only one set
  		    // of definitions appropriate for a given parser, but until then we must
  		    // rely on default functions to reconcile the conflicting AST formats.
  		    def("ModuleSpecifier")
  		        .bases("Specifier")
  		        // This local field is used by Babel/Acorn. It should not technically
  		        // be optional in the Babel/Acorn AST format, but it must be optional
  		        // in the Esprima AST format.
  		        .field("local", or(def("Identifier"), null), defaults["null"])
  		        // The id and name fields are used by Esprima. The id field should not
  		        // technically be optional in the Esprima AST format, but it must be
  		        // optional in the Babel/Acorn AST format.
  		        .field("id", or(def("Identifier"), null), defaults["null"])
  		        .field("name", or(def("Identifier"), null), defaults["null"]);
  		    // import {<id [as name]>} from ...;
  		    def("ImportSpecifier")
  		        .bases("ModuleSpecifier")
  		        .build("imported", "local")
  		        .field("imported", def("Identifier"));
  		    // import <id> from ...;
  		    def("ImportDefaultSpecifier")
  		        .bases("ModuleSpecifier")
  		        .build("local");
  		    // import <* as id> from ...;
  		    def("ImportNamespaceSpecifier")
  		        .bases("ModuleSpecifier")
  		        .build("local");
  		    def("ImportDeclaration")
  		        .bases("Declaration")
  		        .build("specifiers", "source", "importKind")
  		        .field("specifiers", [or(def("ImportSpecifier"), def("ImportNamespaceSpecifier"), def("ImportDefaultSpecifier"))], defaults.emptyArray)
  		        .field("source", def("Literal"))
  		        .field("importKind", or("value", "type"), function () {
  		        return "value";
  		    });
  		    def("ExportNamedDeclaration")
  		        .bases("Declaration")
  		        .build("declaration", "specifiers", "source")
  		        .field("declaration", or(def("Declaration"), null))
  		        .field("specifiers", [def("ExportSpecifier")], defaults.emptyArray)
  		        .field("source", or(def("Literal"), null), defaults["null"]);
  		    def("ExportSpecifier")
  		        .bases("ModuleSpecifier")
  		        .build("local", "exported")
  		        .field("exported", def("Identifier"));
  		    def("ExportDefaultDeclaration")
  		        .bases("Declaration")
  		        .build("declaration")
  		        .field("declaration", or(def("Declaration"), def("Expression")));
  		    def("ExportAllDeclaration")
  		        .bases("Declaration")
  		        .build("source")
  		        .field("source", def("Literal"));
  		    def("TaggedTemplateExpression")
  		        .bases("Expression")
  		        .build("tag", "quasi")
  		        .field("tag", def("Expression"))
  		        .field("quasi", def("TemplateLiteral"));
  		    def("TemplateLiteral")
  		        .bases("Expression")
  		        .build("quasis", "expressions")
  		        .field("quasis", [def("TemplateElement")])
  		        .field("expressions", [def("Expression")]);
  		    def("TemplateElement")
  		        .bases("Node")
  		        .build("value", "tail")
  		        .field("value", { "cooked": String, "raw": String })
  		        .field("tail", Boolean);
  		    def("MetaProperty")
  		        .bases("Expression")
  		        .build("meta", "property")
  		        .field("meta", def("Identifier"))
  		        .field("property", def("Identifier"));
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (es6, es6.exports));
  	return es6.exports;
  }

  var es2016 = {exports: {}};

  var hasRequiredEs2016;

  function requireEs2016 () {
  	if (hasRequiredEs2016) return es2016.exports;
  	hasRequiredEs2016 = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var core_operators_1 = requireCoreOperators();
  		var es6_1 = tslib_1.__importDefault(requireEs6());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		function default_1(fork) {
  		    fork.use(es6_1.default);
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var BinaryOperator = or.apply(void 0, tslib_1.__spreadArrays(core_operators_1.BinaryOperators, ["**"]));
  		    def("BinaryExpression")
  		        .field("operator", BinaryOperator);
  		    var AssignmentOperator = or.apply(void 0, tslib_1.__spreadArrays(core_operators_1.AssignmentOperators, ["**="]));
  		    def("AssignmentExpression")
  		        .field("operator", AssignmentOperator);
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (es2016, es2016.exports));
  	return es2016.exports;
  }

  var es2017 = {exports: {}};

  var hasRequiredEs2017;

  function requireEs2017 () {
  	if (hasRequiredEs2017) return es2017.exports;
  	hasRequiredEs2017 = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var es2016_1 = tslib_1.__importDefault(requireEs2016());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(es2016_1.default);
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var defaults = fork.use(shared_1.default).defaults;
  		    def("Function")
  		        .field("async", Boolean, defaults["false"]);
  		    def("AwaitExpression")
  		        .bases("Expression")
  		        .build("argument")
  		        .field("argument", def("Expression"));
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (es2017, es2017.exports));
  	return es2017.exports;
  }

  var es2018 = {exports: {}};

  var hasRequiredEs2018;

  function requireEs2018 () {
  	if (hasRequiredEs2018) return es2018.exports;
  	hasRequiredEs2018 = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var es2017_1 = tslib_1.__importDefault(requireEs2017());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(es2017_1.default);
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var defaults = fork.use(shared_1.default).defaults;
  		    def("ForOfStatement")
  		        .field("await", Boolean, defaults["false"]);
  		    // Legacy
  		    def("SpreadProperty")
  		        .bases("Node")
  		        .build("argument")
  		        .field("argument", def("Expression"));
  		    def("ObjectExpression")
  		        .field("properties", [or(def("Property"), def("SpreadProperty"), // Legacy
  		        def("SpreadElement"))]);
  		    def("TemplateElement")
  		        .field("value", { "cooked": or(String, null), "raw": String });
  		    // Legacy
  		    def("SpreadPropertyPattern")
  		        .bases("Pattern")
  		        .build("argument")
  		        .field("argument", def("Pattern"));
  		    def("ObjectPattern")
  		        .field("properties", [or(def("PropertyPattern"), def("Property"), def("RestElement"), def("SpreadPropertyPattern"))]);
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (es2018, es2018.exports));
  	return es2018.exports;
  }

  var es2019 = {exports: {}};

  var hasRequiredEs2019;

  function requireEs2019 () {
  	if (hasRequiredEs2019) return es2019.exports;
  	hasRequiredEs2019 = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var es2018_1 = tslib_1.__importDefault(requireEs2018());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(es2018_1.default);
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var defaults = fork.use(shared_1.default).defaults;
  		    def("CatchClause")
  		        .field("param", or(def("Pattern"), null), defaults["null"]);
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (es2019, es2019.exports));
  	return es2019.exports;
  }

  var es2020 = {exports: {}};

  var hasRequiredEs2020;

  function requireEs2020 () {
  	if (hasRequiredEs2020) return es2020.exports;
  	hasRequiredEs2020 = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var core_operators_1 = requireCoreOperators();
  		var es2019_1 = tslib_1.__importDefault(requireEs2019());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(es2019_1.default);
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var shared = fork.use(shared_1.default);
  		    var defaults = shared.defaults;
  		    def("ImportExpression")
  		        .bases("Expression")
  		        .build("source")
  		        .field("source", def("Expression"));
  		    def("ExportAllDeclaration")
  		        .build("source", "exported")
  		        .field("source", def("Literal"))
  		        .field("exported", or(def("Identifier"), null));
  		    // Optional chaining
  		    def("ChainElement")
  		        .bases("Node")
  		        .field("optional", Boolean, defaults["false"]);
  		    def("CallExpression")
  		        .bases("Expression", "ChainElement");
  		    def("MemberExpression")
  		        .bases("Expression", "ChainElement");
  		    def("ChainExpression")
  		        .bases("Expression")
  		        .build("expression")
  		        .field("expression", def("ChainElement"));
  		    def("OptionalCallExpression")
  		        .bases("CallExpression")
  		        .build("callee", "arguments", "optional")
  		        .field("optional", Boolean, defaults["true"]);
  		    // Deprecated optional chaining type, doesn't work with babelParser@7.11.0 or newer
  		    def("OptionalMemberExpression")
  		        .bases("MemberExpression")
  		        .build("object", "property", "computed", "optional")
  		        .field("optional", Boolean, defaults["true"]);
  		    // Nullish coalescing
  		    var LogicalOperator = or.apply(void 0, tslib_1.__spreadArrays(core_operators_1.LogicalOperators, ["??"]));
  		    def("LogicalExpression")
  		        .field("operator", LogicalOperator);
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (es2020, es2020.exports));
  	return es2020.exports;
  }

  var jsx = {exports: {}};

  var hasRequiredJsx;

  function requireJsx () {
  	if (hasRequiredJsx) return jsx.exports;
  	hasRequiredJsx = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var es2020_1 = tslib_1.__importDefault(requireEs2020());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(es2020_1.default);
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var defaults = fork.use(shared_1.default).defaults;
  		    def("JSXAttribute")
  		        .bases("Node")
  		        .build("name", "value")
  		        .field("name", or(def("JSXIdentifier"), def("JSXNamespacedName")))
  		        .field("value", or(def("Literal"), // attr="value"
  		    def("JSXExpressionContainer"), // attr={value}
  		    def("JSXElement"), // attr=<div />
  		    def("JSXFragment"), // attr=<></>
  		    null // attr= or just attr
  		    ), defaults["null"]);
  		    def("JSXIdentifier")
  		        .bases("Identifier")
  		        .build("name")
  		        .field("name", String);
  		    def("JSXNamespacedName")
  		        .bases("Node")
  		        .build("namespace", "name")
  		        .field("namespace", def("JSXIdentifier"))
  		        .field("name", def("JSXIdentifier"));
  		    def("JSXMemberExpression")
  		        .bases("MemberExpression")
  		        .build("object", "property")
  		        .field("object", or(def("JSXIdentifier"), def("JSXMemberExpression")))
  		        .field("property", def("JSXIdentifier"))
  		        .field("computed", Boolean, defaults.false);
  		    var JSXElementName = or(def("JSXIdentifier"), def("JSXNamespacedName"), def("JSXMemberExpression"));
  		    def("JSXSpreadAttribute")
  		        .bases("Node")
  		        .build("argument")
  		        .field("argument", def("Expression"));
  		    var JSXAttributes = [or(def("JSXAttribute"), def("JSXSpreadAttribute"))];
  		    def("JSXExpressionContainer")
  		        .bases("Expression")
  		        .build("expression")
  		        .field("expression", or(def("Expression"), def("JSXEmptyExpression")));
  		    var JSXChildren = [or(def("JSXText"), def("JSXExpressionContainer"), def("JSXSpreadChild"), def("JSXElement"), def("JSXFragment"), def("Literal") // Legacy: Esprima should return JSXText instead.
  		        )];
  		    def("JSXElement")
  		        .bases("Expression")
  		        .build("openingElement", "closingElement", "children")
  		        .field("openingElement", def("JSXOpeningElement"))
  		        .field("closingElement", or(def("JSXClosingElement"), null), defaults["null"])
  		        .field("children", JSXChildren, defaults.emptyArray)
  		        .field("name", JSXElementName, function () {
  		        // Little-known fact: the `this` object inside a default function
  		        // is none other than the partially-built object itself, and any
  		        // fields initialized directly from builder function arguments
  		        // (like openingElement, closingElement, and children) are
  		        // guaranteed to be available.
  		        return this.openingElement.name;
  		    }, true) // hidden from traversal
  		        .field("selfClosing", Boolean, function () {
  		        return this.openingElement.selfClosing;
  		    }, true) // hidden from traversal
  		        .field("attributes", JSXAttributes, function () {
  		        return this.openingElement.attributes;
  		    }, true); // hidden from traversal
  		    def("JSXOpeningElement")
  		        .bases("Node")
  		        .build("name", "attributes", "selfClosing")
  		        .field("name", JSXElementName)
  		        .field("attributes", JSXAttributes, defaults.emptyArray)
  		        .field("selfClosing", Boolean, defaults["false"]);
  		    def("JSXClosingElement")
  		        .bases("Node")
  		        .build("name")
  		        .field("name", JSXElementName);
  		    def("JSXFragment")
  		        .bases("Expression")
  		        .build("openingFragment", "closingFragment", "children")
  		        .field("openingFragment", def("JSXOpeningFragment"))
  		        .field("closingFragment", def("JSXClosingFragment"))
  		        .field("children", JSXChildren, defaults.emptyArray);
  		    def("JSXOpeningFragment")
  		        .bases("Node")
  		        .build();
  		    def("JSXClosingFragment")
  		        .bases("Node")
  		        .build();
  		    def("JSXText")
  		        .bases("Literal")
  		        .build("value", "raw")
  		        .field("value", String)
  		        .field("raw", String, function () {
  		        return this.value;
  		    });
  		    def("JSXEmptyExpression")
  		        .bases("Node")
  		        .build();
  		    def("JSXSpreadChild")
  		        .bases("Node")
  		        .build("expression")
  		        .field("expression", def("Expression"));
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (jsx, jsx.exports));
  	return jsx.exports;
  }

  var flow = {exports: {}};

  var esProposals = {exports: {}};

  var hasRequiredEsProposals;

  function requireEsProposals () {
  	if (hasRequiredEsProposals) return esProposals.exports;
  	hasRequiredEsProposals = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		var es2020_1 = tslib_1.__importDefault(requireEs2020());
  		function default_1(fork) {
  		    fork.use(es2020_1.default);
  		    var types = fork.use(types_1.default);
  		    var Type = types.Type;
  		    var def = types.Type.def;
  		    var or = Type.or;
  		    var shared = fork.use(shared_1.default);
  		    var defaults = shared.defaults;
  		    def("AwaitExpression")
  		        .build("argument", "all")
  		        .field("argument", or(def("Expression"), null))
  		        .field("all", Boolean, defaults["false"]);
  		    // Decorators
  		    def("Decorator")
  		        .bases("Node")
  		        .build("expression")
  		        .field("expression", def("Expression"));
  		    def("Property")
  		        .field("decorators", or([def("Decorator")], null), defaults["null"]);
  		    def("MethodDefinition")
  		        .field("decorators", or([def("Decorator")], null), defaults["null"]);
  		    // Private names
  		    def("PrivateName")
  		        .bases("Expression", "Pattern")
  		        .build("id")
  		        .field("id", def("Identifier"));
  		    def("ClassPrivateProperty")
  		        .bases("ClassProperty")
  		        .build("key", "value")
  		        .field("key", def("PrivateName"))
  		        .field("value", or(def("Expression"), null), defaults["null"]);
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (esProposals, esProposals.exports));
  	return esProposals.exports;
  }

  var typeAnnotations = {exports: {}};

  var hasRequiredTypeAnnotations;

  function requireTypeAnnotations () {
  	if (hasRequiredTypeAnnotations) return typeAnnotations.exports;
  	hasRequiredTypeAnnotations = 1;
  	(function (module, exports) {
  		/**
  		 * Type annotation defs shared between Flow and TypeScript.
  		 * These defs could not be defined in ./flow.ts or ./typescript.ts directly
  		 * because they use the same name.
  		 */
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var defaults = fork.use(shared_1.default).defaults;
  		    var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
  		    var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
  		    def("Identifier")
  		        .field("typeAnnotation", TypeAnnotation, defaults["null"]);
  		    def("ObjectPattern")
  		        .field("typeAnnotation", TypeAnnotation, defaults["null"]);
  		    def("Function")
  		        .field("returnType", TypeAnnotation, defaults["null"])
  		        .field("typeParameters", TypeParamDecl, defaults["null"]);
  		    def("ClassProperty")
  		        .build("key", "value", "typeAnnotation", "static")
  		        .field("value", or(def("Expression"), null))
  		        .field("static", Boolean, defaults["false"])
  		        .field("typeAnnotation", TypeAnnotation, defaults["null"]);
  		    ["ClassDeclaration",
  		        "ClassExpression",
  		    ].forEach(function (typeName) {
  		        def(typeName)
  		            .field("typeParameters", TypeParamDecl, defaults["null"])
  		            .field("superTypeParameters", or(def("TypeParameterInstantiation"), def("TSTypeParameterInstantiation"), null), defaults["null"])
  		            .field("implements", or([def("ClassImplements")], [def("TSExpressionWithTypeArguments")]), defaults.emptyArray);
  		    });
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (typeAnnotations, typeAnnotations.exports));
  	return typeAnnotations.exports;
  }

  var hasRequiredFlow;

  function requireFlow () {
  	if (hasRequiredFlow) return flow.exports;
  	hasRequiredFlow = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var es_proposals_1 = tslib_1.__importDefault(requireEsProposals());
  		var type_annotations_1 = tslib_1.__importDefault(requireTypeAnnotations());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(es_proposals_1.default);
  		    fork.use(type_annotations_1.default);
  		    var types = fork.use(types_1.default);
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var defaults = fork.use(shared_1.default).defaults;
  		    // Base types
  		    def("Flow").bases("Node");
  		    def("FlowType").bases("Flow");
  		    // Type annotations
  		    def("AnyTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("EmptyTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("MixedTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("VoidTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("SymbolTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("NumberTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("BigIntTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("NumberLiteralTypeAnnotation")
  		        .bases("FlowType")
  		        .build("value", "raw")
  		        .field("value", Number)
  		        .field("raw", String);
  		    // Babylon 6 differs in AST from Flow
  		    // same as NumberLiteralTypeAnnotation
  		    def("NumericLiteralTypeAnnotation")
  		        .bases("FlowType")
  		        .build("value", "raw")
  		        .field("value", Number)
  		        .field("raw", String);
  		    def("BigIntLiteralTypeAnnotation")
  		        .bases("FlowType")
  		        .build("value", "raw")
  		        .field("value", null)
  		        .field("raw", String);
  		    def("StringTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("StringLiteralTypeAnnotation")
  		        .bases("FlowType")
  		        .build("value", "raw")
  		        .field("value", String)
  		        .field("raw", String);
  		    def("BooleanTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("BooleanLiteralTypeAnnotation")
  		        .bases("FlowType")
  		        .build("value", "raw")
  		        .field("value", Boolean)
  		        .field("raw", String);
  		    def("TypeAnnotation")
  		        .bases("Node")
  		        .build("typeAnnotation")
  		        .field("typeAnnotation", def("FlowType"));
  		    def("NullableTypeAnnotation")
  		        .bases("FlowType")
  		        .build("typeAnnotation")
  		        .field("typeAnnotation", def("FlowType"));
  		    def("NullLiteralTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("NullTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("ThisTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("ExistsTypeAnnotation")
  		        .bases("FlowType")
  		        .build();
  		    def("ExistentialTypeParam")
  		        .bases("FlowType")
  		        .build();
  		    def("FunctionTypeAnnotation")
  		        .bases("FlowType")
  		        .build("params", "returnType", "rest", "typeParameters")
  		        .field("params", [def("FunctionTypeParam")])
  		        .field("returnType", def("FlowType"))
  		        .field("rest", or(def("FunctionTypeParam"), null))
  		        .field("typeParameters", or(def("TypeParameterDeclaration"), null));
  		    def("FunctionTypeParam")
  		        .bases("Node")
  		        .build("name", "typeAnnotation", "optional")
  		        .field("name", or(def("Identifier"), null))
  		        .field("typeAnnotation", def("FlowType"))
  		        .field("optional", Boolean);
  		    def("ArrayTypeAnnotation")
  		        .bases("FlowType")
  		        .build("elementType")
  		        .field("elementType", def("FlowType"));
  		    def("ObjectTypeAnnotation")
  		        .bases("FlowType")
  		        .build("properties", "indexers", "callProperties")
  		        .field("properties", [
  		        or(def("ObjectTypeProperty"), def("ObjectTypeSpreadProperty"))
  		    ])
  		        .field("indexers", [def("ObjectTypeIndexer")], defaults.emptyArray)
  		        .field("callProperties", [def("ObjectTypeCallProperty")], defaults.emptyArray)
  		        .field("inexact", or(Boolean, void 0), defaults["undefined"])
  		        .field("exact", Boolean, defaults["false"])
  		        .field("internalSlots", [def("ObjectTypeInternalSlot")], defaults.emptyArray);
  		    def("Variance")
  		        .bases("Node")
  		        .build("kind")
  		        .field("kind", or("plus", "minus"));
  		    var LegacyVariance = or(def("Variance"), "plus", "minus", null);
  		    def("ObjectTypeProperty")
  		        .bases("Node")
  		        .build("key", "value", "optional")
  		        .field("key", or(def("Literal"), def("Identifier")))
  		        .field("value", def("FlowType"))
  		        .field("optional", Boolean)
  		        .field("variance", LegacyVariance, defaults["null"]);
  		    def("ObjectTypeIndexer")
  		        .bases("Node")
  		        .build("id", "key", "value")
  		        .field("id", def("Identifier"))
  		        .field("key", def("FlowType"))
  		        .field("value", def("FlowType"))
  		        .field("variance", LegacyVariance, defaults["null"])
  		        .field("static", Boolean, defaults["false"]);
  		    def("ObjectTypeCallProperty")
  		        .bases("Node")
  		        .build("value")
  		        .field("value", def("FunctionTypeAnnotation"))
  		        .field("static", Boolean, defaults["false"]);
  		    def("QualifiedTypeIdentifier")
  		        .bases("Node")
  		        .build("qualification", "id")
  		        .field("qualification", or(def("Identifier"), def("QualifiedTypeIdentifier")))
  		        .field("id", def("Identifier"));
  		    def("GenericTypeAnnotation")
  		        .bases("FlowType")
  		        .build("id", "typeParameters")
  		        .field("id", or(def("Identifier"), def("QualifiedTypeIdentifier")))
  		        .field("typeParameters", or(def("TypeParameterInstantiation"), null));
  		    def("MemberTypeAnnotation")
  		        .bases("FlowType")
  		        .build("object", "property")
  		        .field("object", def("Identifier"))
  		        .field("property", or(def("MemberTypeAnnotation"), def("GenericTypeAnnotation")));
  		    def("UnionTypeAnnotation")
  		        .bases("FlowType")
  		        .build("types")
  		        .field("types", [def("FlowType")]);
  		    def("IntersectionTypeAnnotation")
  		        .bases("FlowType")
  		        .build("types")
  		        .field("types", [def("FlowType")]);
  		    def("TypeofTypeAnnotation")
  		        .bases("FlowType")
  		        .build("argument")
  		        .field("argument", def("FlowType"));
  		    def("ObjectTypeSpreadProperty")
  		        .bases("Node")
  		        .build("argument")
  		        .field("argument", def("FlowType"));
  		    def("ObjectTypeInternalSlot")
  		        .bases("Node")
  		        .build("id", "value", "optional", "static", "method")
  		        .field("id", def("Identifier"))
  		        .field("value", def("FlowType"))
  		        .field("optional", Boolean)
  		        .field("static", Boolean)
  		        .field("method", Boolean);
  		    def("TypeParameterDeclaration")
  		        .bases("Node")
  		        .build("params")
  		        .field("params", [def("TypeParameter")]);
  		    def("TypeParameterInstantiation")
  		        .bases("Node")
  		        .build("params")
  		        .field("params", [def("FlowType")]);
  		    def("TypeParameter")
  		        .bases("FlowType")
  		        .build("name", "variance", "bound", "default")
  		        .field("name", String)
  		        .field("variance", LegacyVariance, defaults["null"])
  		        .field("bound", or(def("TypeAnnotation"), null), defaults["null"])
  		        .field("default", or(def("FlowType"), null), defaults["null"]);
  		    def("ClassProperty")
  		        .field("variance", LegacyVariance, defaults["null"]);
  		    def("ClassImplements")
  		        .bases("Node")
  		        .build("id")
  		        .field("id", def("Identifier"))
  		        .field("superClass", or(def("Expression"), null), defaults["null"])
  		        .field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]);
  		    def("InterfaceTypeAnnotation")
  		        .bases("FlowType")
  		        .build("body", "extends")
  		        .field("body", def("ObjectTypeAnnotation"))
  		        .field("extends", or([def("InterfaceExtends")], null), defaults["null"]);
  		    def("InterfaceDeclaration")
  		        .bases("Declaration")
  		        .build("id", "body", "extends")
  		        .field("id", def("Identifier"))
  		        .field("typeParameters", or(def("TypeParameterDeclaration"), null), defaults["null"])
  		        .field("body", def("ObjectTypeAnnotation"))
  		        .field("extends", [def("InterfaceExtends")]);
  		    def("DeclareInterface")
  		        .bases("InterfaceDeclaration")
  		        .build("id", "body", "extends");
  		    def("InterfaceExtends")
  		        .bases("Node")
  		        .build("id")
  		        .field("id", def("Identifier"))
  		        .field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]);
  		    def("TypeAlias")
  		        .bases("Declaration")
  		        .build("id", "typeParameters", "right")
  		        .field("id", def("Identifier"))
  		        .field("typeParameters", or(def("TypeParameterDeclaration"), null))
  		        .field("right", def("FlowType"));
  		    def("DeclareTypeAlias")
  		        .bases("TypeAlias")
  		        .build("id", "typeParameters", "right");
  		    def("OpaqueType")
  		        .bases("Declaration")
  		        .build("id", "typeParameters", "impltype", "supertype")
  		        .field("id", def("Identifier"))
  		        .field("typeParameters", or(def("TypeParameterDeclaration"), null))
  		        .field("impltype", def("FlowType"))
  		        .field("supertype", or(def("FlowType"), null));
  		    def("DeclareOpaqueType")
  		        .bases("OpaqueType")
  		        .build("id", "typeParameters", "supertype")
  		        .field("impltype", or(def("FlowType"), null));
  		    def("TypeCastExpression")
  		        .bases("Expression")
  		        .build("expression", "typeAnnotation")
  		        .field("expression", def("Expression"))
  		        .field("typeAnnotation", def("TypeAnnotation"));
  		    def("TupleTypeAnnotation")
  		        .bases("FlowType")
  		        .build("types")
  		        .field("types", [def("FlowType")]);
  		    def("DeclareVariable")
  		        .bases("Statement")
  		        .build("id")
  		        .field("id", def("Identifier"));
  		    def("DeclareFunction")
  		        .bases("Statement")
  		        .build("id")
  		        .field("id", def("Identifier"))
  		        .field("predicate", or(def("FlowPredicate"), null), defaults["null"]);
  		    def("DeclareClass")
  		        .bases("InterfaceDeclaration")
  		        .build("id");
  		    def("DeclareModule")
  		        .bases("Statement")
  		        .build("id", "body")
  		        .field("id", or(def("Identifier"), def("Literal")))
  		        .field("body", def("BlockStatement"));
  		    def("DeclareModuleExports")
  		        .bases("Statement")
  		        .build("typeAnnotation")
  		        .field("typeAnnotation", def("TypeAnnotation"));
  		    def("DeclareExportDeclaration")
  		        .bases("Declaration")
  		        .build("default", "declaration", "specifiers", "source")
  		        .field("default", Boolean)
  		        .field("declaration", or(def("DeclareVariable"), def("DeclareFunction"), def("DeclareClass"), def("FlowType"), // Implies default.
  		    def("TypeAlias"), // Implies named type
  		    def("DeclareOpaqueType"), // Implies named opaque type
  		    def("InterfaceDeclaration"), null))
  		        .field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray)
  		        .field("source", or(def("Literal"), null), defaults["null"]);
  		    def("DeclareExportAllDeclaration")
  		        .bases("Declaration")
  		        .build("source")
  		        .field("source", or(def("Literal"), null), defaults["null"]);
  		    def("ImportDeclaration")
  		        .field("importKind", or("value", "type", "typeof"), function () { return "value"; });
  		    def("FlowPredicate").bases("Flow");
  		    def("InferredPredicate")
  		        .bases("FlowPredicate")
  		        .build();
  		    def("DeclaredPredicate")
  		        .bases("FlowPredicate")
  		        .build("value")
  		        .field("value", def("Expression"));
  		    def("Function")
  		        .field("predicate", or(def("FlowPredicate"), null), defaults["null"]);
  		    def("CallExpression")
  		        .field("typeArguments", or(null, def("TypeParameterInstantiation")), defaults["null"]);
  		    def("NewExpression")
  		        .field("typeArguments", or(null, def("TypeParameterInstantiation")), defaults["null"]);
  		    // Enums
  		    def("EnumDeclaration")
  		        .bases("Declaration")
  		        .build("id", "body")
  		        .field("id", def("Identifier"))
  		        .field("body", or(def("EnumBooleanBody"), def("EnumNumberBody"), def("EnumStringBody"), def("EnumSymbolBody")));
  		    def("EnumBooleanBody")
  		        .build("members", "explicitType")
  		        .field("members", [def("EnumBooleanMember")])
  		        .field("explicitType", Boolean);
  		    def("EnumNumberBody")
  		        .build("members", "explicitType")
  		        .field("members", [def("EnumNumberMember")])
  		        .field("explicitType", Boolean);
  		    def("EnumStringBody")
  		        .build("members", "explicitType")
  		        .field("members", or([def("EnumStringMember")], [def("EnumDefaultedMember")]))
  		        .field("explicitType", Boolean);
  		    def("EnumSymbolBody")
  		        .build("members")
  		        .field("members", [def("EnumDefaultedMember")]);
  		    def("EnumBooleanMember")
  		        .build("id", "init")
  		        .field("id", def("Identifier"))
  		        .field("init", or(def("Literal"), Boolean));
  		    def("EnumNumberMember")
  		        .build("id", "init")
  		        .field("id", def("Identifier"))
  		        .field("init", def("Literal"));
  		    def("EnumStringMember")
  		        .build("id", "init")
  		        .field("id", def("Identifier"))
  		        .field("init", def("Literal"));
  		    def("EnumDefaultedMember")
  		        .build("id")
  		        .field("id", def("Identifier"));
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (flow, flow.exports));
  	return flow.exports;
  }

  var esprima$1 = {exports: {}};

  var hasRequiredEsprima$1;

  function requireEsprima$1 () {
  	if (hasRequiredEsprima$1) return esprima$1.exports;
  	hasRequiredEsprima$1 = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var es2020_1 = tslib_1.__importDefault(requireEs2020());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(es2020_1.default);
  		    var types = fork.use(types_1.default);
  		    var defaults = fork.use(shared_1.default).defaults;
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    def("VariableDeclaration")
  		        .field("declarations", [or(def("VariableDeclarator"), def("Identifier") // Esprima deviation.
  		        )]);
  		    def("Property")
  		        .field("value", or(def("Expression"), def("Pattern") // Esprima deviation.
  		    ));
  		    def("ArrayPattern")
  		        .field("elements", [or(def("Pattern"), def("SpreadElement"), null)]);
  		    def("ObjectPattern")
  		        .field("properties", [or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty") // Used by Esprima.
  		        )]);
  		    // Like ModuleSpecifier, except type:"ExportSpecifier" and buildable.
  		    // export {<id [as name]>} [from ...];
  		    def("ExportSpecifier")
  		        .bases("ModuleSpecifier")
  		        .build("id", "name");
  		    // export <*> from ...;
  		    def("ExportBatchSpecifier")
  		        .bases("Specifier")
  		        .build();
  		    def("ExportDeclaration")
  		        .bases("Declaration")
  		        .build("default", "declaration", "specifiers", "source")
  		        .field("default", Boolean)
  		        .field("declaration", or(def("Declaration"), def("Expression"), // Implies default.
  		    null))
  		        .field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray)
  		        .field("source", or(def("Literal"), null), defaults["null"]);
  		    def("Block")
  		        .bases("Comment")
  		        .build("value", /*optional:*/ "leading", "trailing");
  		    def("Line")
  		        .bases("Comment")
  		        .build("value", /*optional:*/ "leading", "trailing");
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (esprima$1, esprima$1.exports));
  	return esprima$1.exports;
  }

  var babel$1 = {exports: {}};

  var babelCore = {exports: {}};

  var hasRequiredBabelCore;

  function requireBabelCore () {
  	if (hasRequiredBabelCore) return babelCore.exports;
  	hasRequiredBabelCore = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var es_proposals_1 = tslib_1.__importDefault(requireEsProposals());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    fork.use(es_proposals_1.default);
  		    var types = fork.use(types_1.default);
  		    var defaults = fork.use(shared_1.default).defaults;
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    def("Noop")
  		        .bases("Statement")
  		        .build();
  		    def("DoExpression")
  		        .bases("Expression")
  		        .build("body")
  		        .field("body", [def("Statement")]);
  		    def("BindExpression")
  		        .bases("Expression")
  		        .build("object", "callee")
  		        .field("object", or(def("Expression"), null))
  		        .field("callee", def("Expression"));
  		    def("ParenthesizedExpression")
  		        .bases("Expression")
  		        .build("expression")
  		        .field("expression", def("Expression"));
  		    def("ExportNamespaceSpecifier")
  		        .bases("Specifier")
  		        .build("exported")
  		        .field("exported", def("Identifier"));
  		    def("ExportDefaultSpecifier")
  		        .bases("Specifier")
  		        .build("exported")
  		        .field("exported", def("Identifier"));
  		    def("CommentBlock")
  		        .bases("Comment")
  		        .build("value", /*optional:*/ "leading", "trailing");
  		    def("CommentLine")
  		        .bases("Comment")
  		        .build("value", /*optional:*/ "leading", "trailing");
  		    def("Directive")
  		        .bases("Node")
  		        .build("value")
  		        .field("value", def("DirectiveLiteral"));
  		    def("DirectiveLiteral")
  		        .bases("Node", "Expression")
  		        .build("value")
  		        .field("value", String, defaults["use strict"]);
  		    def("InterpreterDirective")
  		        .bases("Node")
  		        .build("value")
  		        .field("value", String);
  		    def("BlockStatement")
  		        .bases("Statement")
  		        .build("body")
  		        .field("body", [def("Statement")])
  		        .field("directives", [def("Directive")], defaults.emptyArray);
  		    def("Program")
  		        .bases("Node")
  		        .build("body")
  		        .field("body", [def("Statement")])
  		        .field("directives", [def("Directive")], defaults.emptyArray)
  		        .field("interpreter", or(def("InterpreterDirective"), null), defaults["null"]);
  		    // Split Literal
  		    def("StringLiteral")
  		        .bases("Literal")
  		        .build("value")
  		        .field("value", String);
  		    def("NumericLiteral")
  		        .bases("Literal")
  		        .build("value")
  		        .field("value", Number)
  		        .field("raw", or(String, null), defaults["null"])
  		        .field("extra", {
  		        rawValue: Number,
  		        raw: String
  		    }, function getDefault() {
  		        return {
  		            rawValue: this.value,
  		            raw: this.value + ""
  		        };
  		    });
  		    def("BigIntLiteral")
  		        .bases("Literal")
  		        .build("value")
  		        // Only String really seems appropriate here, since BigInt values
  		        // often exceed the limits of JS numbers.
  		        .field("value", or(String, Number))
  		        .field("extra", {
  		        rawValue: String,
  		        raw: String
  		    }, function getDefault() {
  		        return {
  		            rawValue: String(this.value),
  		            raw: this.value + "n"
  		        };
  		    });
  		    def("NullLiteral")
  		        .bases("Literal")
  		        .build()
  		        .field("value", null, defaults["null"]);
  		    def("BooleanLiteral")
  		        .bases("Literal")
  		        .build("value")
  		        .field("value", Boolean);
  		    def("RegExpLiteral")
  		        .bases("Literal")
  		        .build("pattern", "flags")
  		        .field("pattern", String)
  		        .field("flags", String)
  		        .field("value", RegExp, function () {
  		        return new RegExp(this.pattern, this.flags);
  		    });
  		    var ObjectExpressionProperty = or(def("Property"), def("ObjectMethod"), def("ObjectProperty"), def("SpreadProperty"), def("SpreadElement"));
  		    // Split Property -> ObjectProperty and ObjectMethod
  		    def("ObjectExpression")
  		        .bases("Expression")
  		        .build("properties")
  		        .field("properties", [ObjectExpressionProperty]);
  		    // ObjectMethod hoist .value properties to own properties
  		    def("ObjectMethod")
  		        .bases("Node", "Function")
  		        .build("kind", "key", "params", "body", "computed")
  		        .field("kind", or("method", "get", "set"))
  		        .field("key", or(def("Literal"), def("Identifier"), def("Expression")))
  		        .field("params", [def("Pattern")])
  		        .field("body", def("BlockStatement"))
  		        .field("computed", Boolean, defaults["false"])
  		        .field("generator", Boolean, defaults["false"])
  		        .field("async", Boolean, defaults["false"])
  		        .field("accessibility", // TypeScript
  		    or(def("Literal"), null), defaults["null"])
  		        .field("decorators", or([def("Decorator")], null), defaults["null"]);
  		    def("ObjectProperty")
  		        .bases("Node")
  		        .build("key", "value")
  		        .field("key", or(def("Literal"), def("Identifier"), def("Expression")))
  		        .field("value", or(def("Expression"), def("Pattern")))
  		        .field("accessibility", // TypeScript
  		    or(def("Literal"), null), defaults["null"])
  		        .field("computed", Boolean, defaults["false"]);
  		    var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassMethod"), def("ClassPrivateMethod"));
  		    // MethodDefinition -> ClassMethod
  		    def("ClassBody")
  		        .bases("Declaration")
  		        .build("body")
  		        .field("body", [ClassBodyElement]);
  		    def("ClassMethod")
  		        .bases("Declaration", "Function")
  		        .build("kind", "key", "params", "body", "computed", "static")
  		        .field("key", or(def("Literal"), def("Identifier"), def("Expression")));
  		    def("ClassPrivateMethod")
  		        .bases("Declaration", "Function")
  		        .build("key", "params", "body", "kind", "computed", "static")
  		        .field("key", def("PrivateName"));
  		    ["ClassMethod",
  		        "ClassPrivateMethod",
  		    ].forEach(function (typeName) {
  		        def(typeName)
  		            .field("kind", or("get", "set", "method", "constructor"), function () { return "method"; })
  		            .field("body", def("BlockStatement"))
  		            .field("computed", Boolean, defaults["false"])
  		            .field("static", or(Boolean, null), defaults["null"])
  		            .field("abstract", or(Boolean, null), defaults["null"])
  		            .field("access", or("public", "private", "protected", null), defaults["null"])
  		            .field("accessibility", or("public", "private", "protected", null), defaults["null"])
  		            .field("decorators", or([def("Decorator")], null), defaults["null"])
  		            .field("optional", or(Boolean, null), defaults["null"]);
  		    });
  		    var ObjectPatternProperty = or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty"), // Used by Esprima
  		    def("ObjectProperty"), // Babel 6
  		    def("RestProperty") // Babel 6
  		    );
  		    // Split into RestProperty and SpreadProperty
  		    def("ObjectPattern")
  		        .bases("Pattern")
  		        .build("properties")
  		        .field("properties", [ObjectPatternProperty])
  		        .field("decorators", or([def("Decorator")], null), defaults["null"]);
  		    def("SpreadProperty")
  		        .bases("Node")
  		        .build("argument")
  		        .field("argument", def("Expression"));
  		    def("RestProperty")
  		        .bases("Node")
  		        .build("argument")
  		        .field("argument", def("Expression"));
  		    def("ForAwaitStatement")
  		        .bases("Statement")
  		        .build("left", "right", "body")
  		        .field("left", or(def("VariableDeclaration"), def("Expression")))
  		        .field("right", def("Expression"))
  		        .field("body", def("Statement"));
  		    // The callee node of a dynamic import(...) expression.
  		    def("Import")
  		        .bases("Expression")
  		        .build();
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (babelCore, babelCore.exports));
  	return babelCore.exports;
  }

  var hasRequiredBabel;

  function requireBabel () {
  	if (hasRequiredBabel) return babel$1.exports;
  	hasRequiredBabel = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var babel_core_1 = tslib_1.__importDefault(requireBabelCore());
  		var flow_1 = tslib_1.__importDefault(requireFlow());
  		function default_1(fork) {
  		    fork.use(babel_core_1.default);
  		    fork.use(flow_1.default);
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (babel$1, babel$1.exports));
  	return babel$1.exports;
  }

  var typescript$1 = {exports: {}};

  var hasRequiredTypescript;

  function requireTypescript () {
  	if (hasRequiredTypescript) return typescript$1.exports;
  	hasRequiredTypescript = 1;
  	(function (module, exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		var tslib_1 = require$$0;
  		var babel_core_1 = tslib_1.__importDefault(requireBabelCore());
  		var type_annotations_1 = tslib_1.__importDefault(requireTypeAnnotations());
  		var types_1 = tslib_1.__importDefault(requireTypes());
  		var shared_1 = tslib_1.__importDefault(requireShared());
  		function default_1(fork) {
  		    // Since TypeScript is parsed by Babylon, include the core Babylon types
  		    // but omit the Flow-related types.
  		    fork.use(babel_core_1.default);
  		    fork.use(type_annotations_1.default);
  		    var types = fork.use(types_1.default);
  		    var n = types.namedTypes;
  		    var def = types.Type.def;
  		    var or = types.Type.or;
  		    var defaults = fork.use(shared_1.default).defaults;
  		    var StringLiteral = types.Type.from(function (value, deep) {
  		        if (n.StringLiteral &&
  		            n.StringLiteral.check(value, deep)) {
  		            return true;
  		        }
  		        if (n.Literal &&
  		            n.Literal.check(value, deep) &&
  		            typeof value.value === "string") {
  		            return true;
  		        }
  		        return false;
  		    }, "StringLiteral");
  		    def("TSType")
  		        .bases("Node");
  		    var TSEntityName = or(def("Identifier"), def("TSQualifiedName"));
  		    def("TSTypeReference")
  		        .bases("TSType", "TSHasOptionalTypeParameterInstantiation")
  		        .build("typeName", "typeParameters")
  		        .field("typeName", TSEntityName);
  		    // An abstract (non-buildable) base type that provide a commonly-needed
  		    // optional .typeParameters field.
  		    def("TSHasOptionalTypeParameterInstantiation")
  		        .field("typeParameters", or(def("TSTypeParameterInstantiation"), null), defaults["null"]);
  		    // An abstract (non-buildable) base type that provide a commonly-needed
  		    // optional .typeParameters field.
  		    def("TSHasOptionalTypeParameters")
  		        .field("typeParameters", or(def("TSTypeParameterDeclaration"), null, void 0), defaults["null"]);
  		    // An abstract (non-buildable) base type that provide a commonly-needed
  		    // optional .typeAnnotation field.
  		    def("TSHasOptionalTypeAnnotation")
  		        .field("typeAnnotation", or(def("TSTypeAnnotation"), null), defaults["null"]);
  		    def("TSQualifiedName")
  		        .bases("Node")
  		        .build("left", "right")
  		        .field("left", TSEntityName)
  		        .field("right", TSEntityName);
  		    def("TSAsExpression")
  		        .bases("Expression", "Pattern")
  		        .build("expression", "typeAnnotation")
  		        .field("expression", def("Expression"))
  		        .field("typeAnnotation", def("TSType"))
  		        .field("extra", or({ parenthesized: Boolean }, null), defaults["null"]);
  		    def("TSNonNullExpression")
  		        .bases("Expression", "Pattern")
  		        .build("expression")
  		        .field("expression", def("Expression"));
  		    [
  		        "TSAnyKeyword",
  		        "TSBigIntKeyword",
  		        "TSBooleanKeyword",
  		        "TSNeverKeyword",
  		        "TSNullKeyword",
  		        "TSNumberKeyword",
  		        "TSObjectKeyword",
  		        "TSStringKeyword",
  		        "TSSymbolKeyword",
  		        "TSUndefinedKeyword",
  		        "TSUnknownKeyword",
  		        "TSVoidKeyword",
  		        "TSThisType",
  		    ].forEach(function (keywordType) {
  		        def(keywordType)
  		            .bases("TSType")
  		            .build();
  		    });
  		    def("TSArrayType")
  		        .bases("TSType")
  		        .build("elementType")
  		        .field("elementType", def("TSType"));
  		    def("TSLiteralType")
  		        .bases("TSType")
  		        .build("literal")
  		        .field("literal", or(def("NumericLiteral"), def("StringLiteral"), def("BooleanLiteral"), def("TemplateLiteral"), def("UnaryExpression")));
  		    ["TSUnionType",
  		        "TSIntersectionType",
  		    ].forEach(function (typeName) {
  		        def(typeName)
  		            .bases("TSType")
  		            .build("types")
  		            .field("types", [def("TSType")]);
  		    });
  		    def("TSConditionalType")
  		        .bases("TSType")
  		        .build("checkType", "extendsType", "trueType", "falseType")
  		        .field("checkType", def("TSType"))
  		        .field("extendsType", def("TSType"))
  		        .field("trueType", def("TSType"))
  		        .field("falseType", def("TSType"));
  		    def("TSInferType")
  		        .bases("TSType")
  		        .build("typeParameter")
  		        .field("typeParameter", def("TSTypeParameter"));
  		    def("TSParenthesizedType")
  		        .bases("TSType")
  		        .build("typeAnnotation")
  		        .field("typeAnnotation", def("TSType"));
  		    var ParametersType = [or(def("Identifier"), def("RestElement"), def("ArrayPattern"), def("ObjectPattern"))];
  		    ["TSFunctionType",
  		        "TSConstructorType",
  		    ].forEach(function (typeName) {
  		        def(typeName)
  		            .bases("TSType", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
  		            .build("parameters")
  		            .field("parameters", ParametersType);
  		    });
  		    def("TSDeclareFunction")
  		        .bases("Declaration", "TSHasOptionalTypeParameters")
  		        .build("id", "params", "returnType")
  		        .field("declare", Boolean, defaults["false"])
  		        .field("async", Boolean, defaults["false"])
  		        .field("generator", Boolean, defaults["false"])
  		        .field("id", or(def("Identifier"), null), defaults["null"])
  		        .field("params", [def("Pattern")])
  		        // tSFunctionTypeAnnotationCommon
  		        .field("returnType", or(def("TSTypeAnnotation"), def("Noop"), // Still used?
  		    null), defaults["null"]);
  		    def("TSDeclareMethod")
  		        .bases("Declaration", "TSHasOptionalTypeParameters")
  		        .build("key", "params", "returnType")
  		        .field("async", Boolean, defaults["false"])
  		        .field("generator", Boolean, defaults["false"])
  		        .field("params", [def("Pattern")])
  		        // classMethodOrPropertyCommon
  		        .field("abstract", Boolean, defaults["false"])
  		        .field("accessibility", or("public", "private", "protected", void 0), defaults["undefined"])
  		        .field("static", Boolean, defaults["false"])
  		        .field("computed", Boolean, defaults["false"])
  		        .field("optional", Boolean, defaults["false"])
  		        .field("key", or(def("Identifier"), def("StringLiteral"), def("NumericLiteral"), 
  		    // Only allowed if .computed is true.
  		    def("Expression")))
  		        // classMethodOrDeclareMethodCommon
  		        .field("kind", or("get", "set", "method", "constructor"), function getDefault() { return "method"; })
  		        .field("access", // Not "accessibility"?
  		    or("public", "private", "protected", void 0), defaults["undefined"])
  		        .field("decorators", or([def("Decorator")], null), defaults["null"])
  		        // tSFunctionTypeAnnotationCommon
  		        .field("returnType", or(def("TSTypeAnnotation"), def("Noop"), // Still used?
  		    null), defaults["null"]);
  		    def("TSMappedType")
  		        .bases("TSType")
  		        .build("typeParameter", "typeAnnotation")
  		        .field("readonly", or(Boolean, "+", "-"), defaults["false"])
  		        .field("typeParameter", def("TSTypeParameter"))
  		        .field("optional", or(Boolean, "+", "-"), defaults["false"])
  		        .field("typeAnnotation", or(def("TSType"), null), defaults["null"]);
  		    def("TSTupleType")
  		        .bases("TSType")
  		        .build("elementTypes")
  		        .field("elementTypes", [or(def("TSType"), def("TSNamedTupleMember"))]);
  		    def("TSNamedTupleMember")
  		        .bases("TSType")
  		        .build("label", "elementType", "optional")
  		        .field("label", def("Identifier"))
  		        .field("optional", Boolean, defaults["false"])
  		        .field("elementType", def("TSType"));
  		    def("TSRestType")
  		        .bases("TSType")
  		        .build("typeAnnotation")
  		        .field("typeAnnotation", def("TSType"));
  		    def("TSOptionalType")
  		        .bases("TSType")
  		        .build("typeAnnotation")
  		        .field("typeAnnotation", def("TSType"));
  		    def("TSIndexedAccessType")
  		        .bases("TSType")
  		        .build("objectType", "indexType")
  		        .field("objectType", def("TSType"))
  		        .field("indexType", def("TSType"));
  		    def("TSTypeOperator")
  		        .bases("TSType")
  		        .build("operator")
  		        .field("operator", String)
  		        .field("typeAnnotation", def("TSType"));
  		    def("TSTypeAnnotation")
  		        .bases("Node")
  		        .build("typeAnnotation")
  		        .field("typeAnnotation", or(def("TSType"), def("TSTypeAnnotation")));
  		    def("TSIndexSignature")
  		        .bases("Declaration", "TSHasOptionalTypeAnnotation")
  		        .build("parameters", "typeAnnotation")
  		        .field("parameters", [def("Identifier")]) // Length === 1
  		        .field("readonly", Boolean, defaults["false"]);
  		    def("TSPropertySignature")
  		        .bases("Declaration", "TSHasOptionalTypeAnnotation")
  		        .build("key", "typeAnnotation", "optional")
  		        .field("key", def("Expression"))
  		        .field("computed", Boolean, defaults["false"])
  		        .field("readonly", Boolean, defaults["false"])
  		        .field("optional", Boolean, defaults["false"])
  		        .field("initializer", or(def("Expression"), null), defaults["null"]);
  		    def("TSMethodSignature")
  		        .bases("Declaration", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
  		        .build("key", "parameters", "typeAnnotation")
  		        .field("key", def("Expression"))
  		        .field("computed", Boolean, defaults["false"])
  		        .field("optional", Boolean, defaults["false"])
  		        .field("parameters", ParametersType);
  		    def("TSTypePredicate")
  		        .bases("TSTypeAnnotation", "TSType")
  		        .build("parameterName", "typeAnnotation", "asserts")
  		        .field("parameterName", or(def("Identifier"), def("TSThisType")))
  		        .field("typeAnnotation", or(def("TSTypeAnnotation"), null), defaults["null"])
  		        .field("asserts", Boolean, defaults["false"]);
  		    ["TSCallSignatureDeclaration",
  		        "TSConstructSignatureDeclaration",
  		    ].forEach(function (typeName) {
  		        def(typeName)
  		            .bases("Declaration", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
  		            .build("parameters", "typeAnnotation")
  		            .field("parameters", ParametersType);
  		    });
  		    def("TSEnumMember")
  		        .bases("Node")
  		        .build("id", "initializer")
  		        .field("id", or(def("Identifier"), StringLiteral))
  		        .field("initializer", or(def("Expression"), null), defaults["null"]);
  		    def("TSTypeQuery")
  		        .bases("TSType")
  		        .build("exprName")
  		        .field("exprName", or(TSEntityName, def("TSImportType")));
  		    // Inferred from Babylon's tsParseTypeMember method.
  		    var TSTypeMember = or(def("TSCallSignatureDeclaration"), def("TSConstructSignatureDeclaration"), def("TSIndexSignature"), def("TSMethodSignature"), def("TSPropertySignature"));
  		    def("TSTypeLiteral")
  		        .bases("TSType")
  		        .build("members")
  		        .field("members", [TSTypeMember]);
  		    def("TSTypeParameter")
  		        .bases("Identifier")
  		        .build("name", "constraint", "default")
  		        .field("name", String)
  		        .field("constraint", or(def("TSType"), void 0), defaults["undefined"])
  		        .field("default", or(def("TSType"), void 0), defaults["undefined"]);
  		    def("TSTypeAssertion")
  		        .bases("Expression", "Pattern")
  		        .build("typeAnnotation", "expression")
  		        .field("typeAnnotation", def("TSType"))
  		        .field("expression", def("Expression"))
  		        .field("extra", or({ parenthesized: Boolean }, null), defaults["null"]);
  		    def("TSTypeParameterDeclaration")
  		        .bases("Declaration")
  		        .build("params")
  		        .field("params", [def("TSTypeParameter")]);
  		    def("TSTypeParameterInstantiation")
  		        .bases("Node")
  		        .build("params")
  		        .field("params", [def("TSType")]);
  		    def("TSEnumDeclaration")
  		        .bases("Declaration")
  		        .build("id", "members")
  		        .field("id", def("Identifier"))
  		        .field("const", Boolean, defaults["false"])
  		        .field("declare", Boolean, defaults["false"])
  		        .field("members", [def("TSEnumMember")])
  		        .field("initializer", or(def("Expression"), null), defaults["null"]);
  		    def("TSTypeAliasDeclaration")
  		        .bases("Declaration", "TSHasOptionalTypeParameters")
  		        .build("id", "typeAnnotation")
  		        .field("id", def("Identifier"))
  		        .field("declare", Boolean, defaults["false"])
  		        .field("typeAnnotation", def("TSType"));
  		    def("TSModuleBlock")
  		        .bases("Node")
  		        .build("body")
  		        .field("body", [def("Statement")]);
  		    def("TSModuleDeclaration")
  		        .bases("Declaration")
  		        .build("id", "body")
  		        .field("id", or(StringLiteral, TSEntityName))
  		        .field("declare", Boolean, defaults["false"])
  		        .field("global", Boolean, defaults["false"])
  		        .field("body", or(def("TSModuleBlock"), def("TSModuleDeclaration"), null), defaults["null"]);
  		    def("TSImportType")
  		        .bases("TSType", "TSHasOptionalTypeParameterInstantiation")
  		        .build("argument", "qualifier", "typeParameters")
  		        .field("argument", StringLiteral)
  		        .field("qualifier", or(TSEntityName, void 0), defaults["undefined"]);
  		    def("TSImportEqualsDeclaration")
  		        .bases("Declaration")
  		        .build("id", "moduleReference")
  		        .field("id", def("Identifier"))
  		        .field("isExport", Boolean, defaults["false"])
  		        .field("moduleReference", or(TSEntityName, def("TSExternalModuleReference")));
  		    def("TSExternalModuleReference")
  		        .bases("Declaration")
  		        .build("expression")
  		        .field("expression", StringLiteral);
  		    def("TSExportAssignment")
  		        .bases("Statement")
  		        .build("expression")
  		        .field("expression", def("Expression"));
  		    def("TSNamespaceExportDeclaration")
  		        .bases("Declaration")
  		        .build("id")
  		        .field("id", def("Identifier"));
  		    def("TSInterfaceBody")
  		        .bases("Node")
  		        .build("body")
  		        .field("body", [TSTypeMember]);
  		    def("TSExpressionWithTypeArguments")
  		        .bases("TSType", "TSHasOptionalTypeParameterInstantiation")
  		        .build("expression", "typeParameters")
  		        .field("expression", TSEntityName);
  		    def("TSInterfaceDeclaration")
  		        .bases("Declaration", "TSHasOptionalTypeParameters")
  		        .build("id", "body")
  		        .field("id", TSEntityName)
  		        .field("declare", Boolean, defaults["false"])
  		        .field("extends", or([def("TSExpressionWithTypeArguments")], null), defaults["null"])
  		        .field("body", def("TSInterfaceBody"));
  		    def("TSParameterProperty")
  		        .bases("Pattern")
  		        .build("parameter")
  		        .field("accessibility", or("public", "private", "protected", void 0), defaults["undefined"])
  		        .field("readonly", Boolean, defaults["false"])
  		        .field("parameter", or(def("Identifier"), def("AssignmentPattern")));
  		    def("ClassProperty")
  		        .field("access", // Not "accessibility"?
  		    or("public", "private", "protected", void 0), defaults["undefined"]);
  		    // Defined already in es6 and babel-core.
  		    def("ClassBody")
  		        .field("body", [or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassMethod"), def("ClassPrivateMethod"), 
  		        // Just need to add these types:
  		        def("TSDeclareMethod"), TSTypeMember)]);
  		}
  		exports.default = default_1;
  		module.exports = exports["default"];
  } (typescript$1, typescript$1.exports));
  	return typescript$1.exports;
  }

  var namedTypes$1 = {};

  var hasRequiredNamedTypes;

  function requireNamedTypes () {
  	if (hasRequiredNamedTypes) return namedTypes$1;
  	hasRequiredNamedTypes = 1;
  	(function (exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		exports.namedTypes = void 0;
  		(function (namedTypes) {
  		})(exports.namedTypes || (exports.namedTypes = {}));
  } (namedTypes$1));
  	return namedTypes$1;
  }

  var hasRequiredMain;

  function requireMain () {
  	if (hasRequiredMain) return main;
  	hasRequiredMain = 1;
  	(function (exports) {
  		Object.defineProperty(exports, "__esModule", { value: true });
  		exports.visit = exports.use = exports.Type = exports.someField = exports.PathVisitor = exports.Path = exports.NodePath = exports.namedTypes = exports.getSupertypeNames = exports.getFieldValue = exports.getFieldNames = exports.getBuilderName = exports.finalize = exports.eachField = exports.defineMethod = exports.builtInTypes = exports.builders = exports.astNodesAreEquivalent = void 0;
  		var tslib_1 = require$$0;
  		var fork_1 = tslib_1.__importDefault(requireFork());
  		var core_1 = tslib_1.__importDefault(requireCore());
  		var es6_1 = tslib_1.__importDefault(requireEs6());
  		var es2016_1 = tslib_1.__importDefault(requireEs2016());
  		var es2017_1 = tslib_1.__importDefault(requireEs2017());
  		var es2018_1 = tslib_1.__importDefault(requireEs2018());
  		var es2019_1 = tslib_1.__importDefault(requireEs2019());
  		var es2020_1 = tslib_1.__importDefault(requireEs2020());
  		var jsx_1 = tslib_1.__importDefault(requireJsx());
  		var flow_1 = tslib_1.__importDefault(requireFlow());
  		var esprima_1 = tslib_1.__importDefault(requireEsprima$1());
  		var babel_1 = tslib_1.__importDefault(requireBabel());
  		var typescript_1 = tslib_1.__importDefault(requireTypescript());
  		var es_proposals_1 = tslib_1.__importDefault(requireEsProposals());
  		var namedTypes_1 = requireNamedTypes();
  		Object.defineProperty(exports, "namedTypes", { enumerable: true, get: function () { return namedTypes_1.namedTypes; } });
  		var _a = fork_1.default([
  		    // This core module of AST types captures ES5 as it is parsed today by
  		    // git://github.com/ariya/esprima.git#master.
  		    core_1.default,
  		    // Feel free to add to or remove from this list of extension modules to
  		    // configure the precise type hierarchy that you need.
  		    es6_1.default,
  		    es2016_1.default,
  		    es2017_1.default,
  		    es2018_1.default,
  		    es2019_1.default,
  		    es2020_1.default,
  		    jsx_1.default,
  		    flow_1.default,
  		    esprima_1.default,
  		    babel_1.default,
  		    typescript_1.default,
  		    es_proposals_1.default,
  		]), astNodesAreEquivalent = _a.astNodesAreEquivalent, builders = _a.builders, builtInTypes = _a.builtInTypes, defineMethod = _a.defineMethod, eachField = _a.eachField, finalize = _a.finalize, getBuilderName = _a.getBuilderName, getFieldNames = _a.getFieldNames, getFieldValue = _a.getFieldValue, getSupertypeNames = _a.getSupertypeNames, n = _a.namedTypes, NodePath = _a.NodePath, Path = _a.Path, PathVisitor = _a.PathVisitor, someField = _a.someField, Type = _a.Type, use = _a.use, visit = _a.visit;
  		exports.astNodesAreEquivalent = astNodesAreEquivalent;
  		exports.builders = builders;
  		exports.builtInTypes = builtInTypes;
  		exports.defineMethod = defineMethod;
  		exports.eachField = eachField;
  		exports.finalize = finalize;
  		exports.getBuilderName = getBuilderName;
  		exports.getFieldNames = getFieldNames;
  		exports.getFieldValue = getFieldValue;
  		exports.getSupertypeNames = getSupertypeNames;
  		exports.NodePath = NodePath;
  		exports.Path = Path;
  		exports.PathVisitor = PathVisitor;
  		exports.someField = someField;
  		exports.Type = Type;
  		exports.use = use;
  		exports.visit = visit;
  		// Populate the exported fields of the namedTypes namespace, while still
  		// retaining its member types.
  		Object.assign(namedTypes_1.namedTypes, n);
  } (main));
  	return main;
  }

  var parser = {};

  var lookup = [];
  var revLookup = [];
  var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
  var inited = false;
  function init () {
    inited = true;
    var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    for (var i = 0, len = code.length; i < len; ++i) {
      lookup[i] = code[i];
      revLookup[code.charCodeAt(i)] = i;
    }

    revLookup['-'.charCodeAt(0)] = 62;
    revLookup['_'.charCodeAt(0)] = 63;
  }

  function toByteArray (b64) {
    if (!inited) {
      init();
    }
    var i, j, l, tmp, placeHolders, arr;
    var len = b64.length;

    if (len % 4 > 0) {
      throw new Error('Invalid string. Length must be a multiple of 4')
    }

    // the number of equal signs (place holders)
    // if there are two placeholders, than the two characters before it
    // represent one byte
    // if there is only one, then the three characters before it represent 2 bytes
    // this is just a cheap hack to not do indexOf twice
    placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;

    // base64 is 4/3 + up to two characters of the original data
    arr = new Arr(len * 3 / 4 - placeHolders);

    // if there are placeholders, only get up to the last complete 4 chars
    l = placeHolders > 0 ? len - 4 : len;

    var L = 0;

    for (i = 0, j = 0; i < l; i += 4, j += 3) {
      tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
      arr[L++] = (tmp >> 16) & 0xFF;
      arr[L++] = (tmp >> 8) & 0xFF;
      arr[L++] = tmp & 0xFF;
    }

    if (placeHolders === 2) {
      tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
      arr[L++] = tmp & 0xFF;
    } else if (placeHolders === 1) {
      tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
      arr[L++] = (tmp >> 8) & 0xFF;
      arr[L++] = tmp & 0xFF;
    }

    return arr
  }

  function tripletToBase64 (num) {
    return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
  }

  function encodeChunk (uint8, start, end) {
    var tmp;
    var output = [];
    for (var i = start; i < end; i += 3) {
      tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
      output.push(tripletToBase64(tmp));
    }
    return output.join('')
  }

  function fromByteArray (uint8) {
    if (!inited) {
      init();
    }
    var tmp;
    var len = uint8.length;
    var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
    var output = '';
    var parts = [];
    var maxChunkLength = 16383; // must be multiple of 3

    // go through the array every three bytes, we'll deal with trailing stuff later
    for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
      parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
    }

    // pad the end with zeros, but make sure to not forget the extra bytes
    if (extraBytes === 1) {
      tmp = uint8[len - 1];
      output += lookup[tmp >> 2];
      output += lookup[(tmp << 4) & 0x3F];
      output += '==';
    } else if (extraBytes === 2) {
      tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
      output += lookup[tmp >> 10];
      output += lookup[(tmp >> 4) & 0x3F];
      output += lookup[(tmp << 2) & 0x3F];
      output += '=';
    }

    parts.push(output);

    return parts.join('')
  }

  function read (buffer, offset, isLE, mLen, nBytes) {
    var e, m;
    var eLen = nBytes * 8 - mLen - 1;
    var eMax = (1 << eLen) - 1;
    var eBias = eMax >> 1;
    var nBits = -7;
    var i = isLE ? (nBytes - 1) : 0;
    var d = isLE ? -1 : 1;
    var s = buffer[offset + i];

    i += d;

    e = s & ((1 << (-nBits)) - 1);
    s >>= (-nBits);
    nBits += eLen;
    for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}

    m = e & ((1 << (-nBits)) - 1);
    e >>= (-nBits);
    nBits += mLen;
    for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}

    if (e === 0) {
      e = 1 - eBias;
    } else if (e === eMax) {
      return m ? NaN : ((s ? -1 : 1) * Infinity)
    } else {
      m = m + Math.pow(2, mLen);
      e = e - eBias;
    }
    return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  }

  function write (buffer, value, offset, isLE, mLen, nBytes) {
    var e, m, c;
    var eLen = nBytes * 8 - mLen - 1;
    var eMax = (1 << eLen) - 1;
    var eBias = eMax >> 1;
    var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
    var i = isLE ? 0 : (nBytes - 1);
    var d = isLE ? 1 : -1;
    var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;

    value = Math.abs(value);

    if (isNaN(value) || value === Infinity) {
      m = isNaN(value) ? 1 : 0;
      e = eMax;
    } else {
      e = Math.floor(Math.log(value) / Math.LN2);
      if (value * (c = Math.pow(2, -e)) < 1) {
        e--;
        c *= 2;
      }
      if (e + eBias >= 1) {
        value += rt / c;
      } else {
        value += rt * Math.pow(2, 1 - eBias);
      }
      if (value * c >= 2) {
        e++;
        c /= 2;
      }

      if (e + eBias >= eMax) {
        m = 0;
        e = eMax;
      } else if (e + eBias >= 1) {
        m = (value * c - 1) * Math.pow(2, mLen);
        e = e + eBias;
      } else {
        m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
        e = 0;
      }
    }

    for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}

    e = (e << mLen) | m;
    eLen += mLen;
    for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}

    buffer[offset + i - d] |= s * 128;
  }

  var toString = {}.toString;

  var isArray$1 = Array.isArray || function (arr) {
    return toString.call(arr) == '[object Array]';
  };

  /*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
   * @license  MIT
   */

  var INSPECT_MAX_BYTES = 50;

  /**
   * If `Buffer.TYPED_ARRAY_SUPPORT`:
   *   === true    Use Uint8Array implementation (fastest)
   *   === false   Use Object implementation (most compatible, even IE6)
   *
   * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
   * Opera 11.6+, iOS 4.2+.
   *
   * Due to various browser bugs, sometimes the Object implementation will be used even
   * when the browser supports typed arrays.
   *
   * Note:
   *
   *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
   *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
   *
   *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
   *
   *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
   *     incorrect length in some situations.

   * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
   * get the Object implementation, which is slower but behaves correctly.
   */
  Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
    ? global.TYPED_ARRAY_SUPPORT
    : true;

  /*
   * Export kMaxLength after typed array support is determined.
   */
  kMaxLength();

  function kMaxLength () {
    return Buffer.TYPED_ARRAY_SUPPORT
      ? 0x7fffffff
      : 0x3fffffff
  }

  function createBuffer (that, length) {
    if (kMaxLength() < length) {
      throw new RangeError('Invalid typed array length')
    }
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      // Return an augmented `Uint8Array` instance, for best performance
      that = new Uint8Array(length);
      that.__proto__ = Buffer.prototype;
    } else {
      // Fallback: Return an object instance of the Buffer class
      if (that === null) {
        that = new Buffer(length);
      }
      that.length = length;
    }

    return that
  }

  /**
   * The Buffer constructor returns instances of `Uint8Array` that have their
   * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
   * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
   * and the `Uint8Array` methods. Square bracket notation works as expected -- it
   * returns a single octet.
   *
   * The `Uint8Array` prototype remains unmodified.
   */

  function Buffer (arg, encodingOrOffset, length) {
    if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
      return new Buffer(arg, encodingOrOffset, length)
    }

    // Common case.
    if (typeof arg === 'number') {
      if (typeof encodingOrOffset === 'string') {
        throw new Error(
          'If encoding is specified then the first argument must be a string'
        )
      }
      return allocUnsafe(this, arg)
    }
    return from(this, arg, encodingOrOffset, length)
  }

  Buffer.poolSize = 8192; // not used by this implementation

  // TODO: Legacy, not needed anymore. Remove in next major version.
  Buffer._augment = function (arr) {
    arr.__proto__ = Buffer.prototype;
    return arr
  };

  function from (that, value, encodingOrOffset, length) {
    if (typeof value === 'number') {
      throw new TypeError('"value" argument must not be a number')
    }

    if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
      return fromArrayBuffer(that, value, encodingOrOffset, length)
    }

    if (typeof value === 'string') {
      return fromString(that, value, encodingOrOffset)
    }

    return fromObject(that, value)
  }

  /**
   * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
   * if value is a number.
   * Buffer.from(str[, encoding])
   * Buffer.from(array)
   * Buffer.from(buffer)
   * Buffer.from(arrayBuffer[, byteOffset[, length]])
   **/
  Buffer.from = function (value, encodingOrOffset, length) {
    return from(null, value, encodingOrOffset, length)
  };

  if (Buffer.TYPED_ARRAY_SUPPORT) {
    Buffer.prototype.__proto__ = Uint8Array.prototype;
    Buffer.__proto__ = Uint8Array;
    if (typeof Symbol !== 'undefined' && Symbol.species &&
        Buffer[Symbol.species] === Buffer) ;
  }

  function assertSize (size) {
    if (typeof size !== 'number') {
      throw new TypeError('"size" argument must be a number')
    } else if (size < 0) {
      throw new RangeError('"size" argument must not be negative')
    }
  }

  function alloc (that, size, fill, encoding) {
    assertSize(size);
    if (size <= 0) {
      return createBuffer(that, size)
    }
    if (fill !== undefined) {
      // Only pay attention to encoding if it's a string. This
      // prevents accidentally sending in a number that would
      // be interpretted as a start offset.
      return typeof encoding === 'string'
        ? createBuffer(that, size).fill(fill, encoding)
        : createBuffer(that, size).fill(fill)
    }
    return createBuffer(that, size)
  }

  /**
   * Creates a new filled Buffer instance.
   * alloc(size[, fill[, encoding]])
   **/
  Buffer.alloc = function (size, fill, encoding) {
    return alloc(null, size, fill, encoding)
  };

  function allocUnsafe (that, size) {
    assertSize(size);
    that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
    if (!Buffer.TYPED_ARRAY_SUPPORT) {
      for (var i = 0; i < size; ++i) {
        that[i] = 0;
      }
    }
    return that
  }

  /**
   * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
   * */
  Buffer.allocUnsafe = function (size) {
    return allocUnsafe(null, size)
  };
  /**
   * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
   */
  Buffer.allocUnsafeSlow = function (size) {
    return allocUnsafe(null, size)
  };

  function fromString (that, string, encoding) {
    if (typeof encoding !== 'string' || encoding === '') {
      encoding = 'utf8';
    }

    if (!Buffer.isEncoding(encoding)) {
      throw new TypeError('"encoding" must be a valid string encoding')
    }

    var length = byteLength(string, encoding) | 0;
    that = createBuffer(that, length);

    var actual = that.write(string, encoding);

    if (actual !== length) {
      // Writing a hex string, for example, that contains invalid characters will
      // cause everything after the first invalid character to be ignored. (e.g.
      // 'abxxcd' will be treated as 'ab')
      that = that.slice(0, actual);
    }

    return that
  }

  function fromArrayLike (that, array) {
    var length = array.length < 0 ? 0 : checked(array.length) | 0;
    that = createBuffer(that, length);
    for (var i = 0; i < length; i += 1) {
      that[i] = array[i] & 255;
    }
    return that
  }

  function fromArrayBuffer (that, array, byteOffset, length) {
    array.byteLength; // this throws if `array` is not a valid ArrayBuffer

    if (byteOffset < 0 || array.byteLength < byteOffset) {
      throw new RangeError('\'offset\' is out of bounds')
    }

    if (array.byteLength < byteOffset + (length || 0)) {
      throw new RangeError('\'length\' is out of bounds')
    }

    if (byteOffset === undefined && length === undefined) {
      array = new Uint8Array(array);
    } else if (length === undefined) {
      array = new Uint8Array(array, byteOffset);
    } else {
      array = new Uint8Array(array, byteOffset, length);
    }

    if (Buffer.TYPED_ARRAY_SUPPORT) {
      // Return an augmented `Uint8Array` instance, for best performance
      that = array;
      that.__proto__ = Buffer.prototype;
    } else {
      // Fallback: Return an object instance of the Buffer class
      that = fromArrayLike(that, array);
    }
    return that
  }

  function fromObject (that, obj) {
    if (internalIsBuffer(obj)) {
      var len = checked(obj.length) | 0;
      that = createBuffer(that, len);

      if (that.length === 0) {
        return that
      }

      obj.copy(that, 0, 0, len);
      return that
    }

    if (obj) {
      if ((typeof ArrayBuffer !== 'undefined' &&
          obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
        if (typeof obj.length !== 'number' || isnan(obj.length)) {
          return createBuffer(that, 0)
        }
        return fromArrayLike(that, obj)
      }

      if (obj.type === 'Buffer' && isArray$1(obj.data)) {
        return fromArrayLike(that, obj.data)
      }
    }

    throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  }

  function checked (length) {
    // Note: cannot use `length < kMaxLength()` here because that fails when
    // length is NaN (which is otherwise coerced to zero.)
    if (length >= kMaxLength()) {
      throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
                           'size: 0x' + kMaxLength().toString(16) + ' bytes')
    }
    return length | 0
  }
  Buffer.isBuffer = isBuffer;
  function internalIsBuffer (b) {
    return !!(b != null && b._isBuffer)
  }

  Buffer.compare = function compare (a, b) {
    if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
      throw new TypeError('Arguments must be Buffers')
    }

    if (a === b) return 0

    var x = a.length;
    var y = b.length;

    for (var i = 0, len = Math.min(x, y); i < len; ++i) {
      if (a[i] !== b[i]) {
        x = a[i];
        y = b[i];
        break
      }
    }

    if (x < y) return -1
    if (y < x) return 1
    return 0
  };

  Buffer.isEncoding = function isEncoding (encoding) {
    switch (String(encoding).toLowerCase()) {
      case 'hex':
      case 'utf8':
      case 'utf-8':
      case 'ascii':
      case 'latin1':
      case 'binary':
      case 'base64':
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return true
      default:
        return false
    }
  };

  Buffer.concat = function concat (list, length) {
    if (!isArray$1(list)) {
      throw new TypeError('"list" argument must be an Array of Buffers')
    }

    if (list.length === 0) {
      return Buffer.alloc(0)
    }

    var i;
    if (length === undefined) {
      length = 0;
      for (i = 0; i < list.length; ++i) {
        length += list[i].length;
      }
    }

    var buffer = Buffer.allocUnsafe(length);
    var pos = 0;
    for (i = 0; i < list.length; ++i) {
      var buf = list[i];
      if (!internalIsBuffer(buf)) {
        throw new TypeError('"list" argument must be an Array of Buffers')
      }
      buf.copy(buffer, pos);
      pos += buf.length;
    }
    return buffer
  };

  function byteLength (string, encoding) {
    if (internalIsBuffer(string)) {
      return string.length
    }
    if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
        (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
      return string.byteLength
    }
    if (typeof string !== 'string') {
      string = '' + string;
    }

    var len = string.length;
    if (len === 0) return 0

    // Use a for loop to avoid recursion
    var loweredCase = false;
    for (;;) {
      switch (encoding) {
        case 'ascii':
        case 'latin1':
        case 'binary':
          return len
        case 'utf8':
        case 'utf-8':
        case undefined:
          return utf8ToBytes(string).length
        case 'ucs2':
        case 'ucs-2':
        case 'utf16le':
        case 'utf-16le':
          return len * 2
        case 'hex':
          return len >>> 1
        case 'base64':
          return base64ToBytes(string).length
        default:
          if (loweredCase) return utf8ToBytes(string).length // assume utf8
          encoding = ('' + encoding).toLowerCase();
          loweredCase = true;
      }
    }
  }
  Buffer.byteLength = byteLength;

  function slowToString (encoding, start, end) {
    var loweredCase = false;

    // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
    // property of a typed array.

    // This behaves neither like String nor Uint8Array in that we set start/end
    // to their upper/lower bounds if the value passed is out of range.
    // undefined is handled specially as per ECMA-262 6th Edition,
    // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
    if (start === undefined || start < 0) {
      start = 0;
    }
    // Return early if start > this.length. Done here to prevent potential uint32
    // coercion fail below.
    if (start > this.length) {
      return ''
    }

    if (end === undefined || end > this.length) {
      end = this.length;
    }

    if (end <= 0) {
      return ''
    }

    // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
    end >>>= 0;
    start >>>= 0;

    if (end <= start) {
      return ''
    }

    if (!encoding) encoding = 'utf8';

    while (true) {
      switch (encoding) {
        case 'hex':
          return hexSlice(this, start, end)

        case 'utf8':
        case 'utf-8':
          return utf8Slice(this, start, end)

        case 'ascii':
          return asciiSlice(this, start, end)

        case 'latin1':
        case 'binary':
          return latin1Slice(this, start, end)

        case 'base64':
          return base64Slice(this, start, end)

        case 'ucs2':
        case 'ucs-2':
        case 'utf16le':
        case 'utf-16le':
          return utf16leSlice(this, start, end)

        default:
          if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
          encoding = (encoding + '').toLowerCase();
          loweredCase = true;
      }
    }
  }

  // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  // Buffer instances.
  Buffer.prototype._isBuffer = true;

  function swap (b, n, m) {
    var i = b[n];
    b[n] = b[m];
    b[m] = i;
  }

  Buffer.prototype.swap16 = function swap16 () {
    var len = this.length;
    if (len % 2 !== 0) {
      throw new RangeError('Buffer size must be a multiple of 16-bits')
    }
    for (var i = 0; i < len; i += 2) {
      swap(this, i, i + 1);
    }
    return this
  };

  Buffer.prototype.swap32 = function swap32 () {
    var len = this.length;
    if (len % 4 !== 0) {
      throw new RangeError('Buffer size must be a multiple of 32-bits')
    }
    for (var i = 0; i < len; i += 4) {
      swap(this, i, i + 3);
      swap(this, i + 1, i + 2);
    }
    return this
  };

  Buffer.prototype.swap64 = function swap64 () {
    var len = this.length;
    if (len % 8 !== 0) {
      throw new RangeError('Buffer size must be a multiple of 64-bits')
    }
    for (var i = 0; i < len; i += 8) {
      swap(this, i, i + 7);
      swap(this, i + 1, i + 6);
      swap(this, i + 2, i + 5);
      swap(this, i + 3, i + 4);
    }
    return this
  };

  Buffer.prototype.toString = function toString () {
    var length = this.length | 0;
    if (length === 0) return ''
    if (arguments.length === 0) return utf8Slice(this, 0, length)
    return slowToString.apply(this, arguments)
  };

  Buffer.prototype.equals = function equals (b) {
    if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
    if (this === b) return true
    return Buffer.compare(this, b) === 0
  };

  Buffer.prototype.inspect = function inspect () {
    var str = '';
    var max = INSPECT_MAX_BYTES;
    if (this.length > 0) {
      str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
      if (this.length > max) str += ' ... ';
    }
    return '<Buffer ' + str + '>'
  };

  Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
    if (!internalIsBuffer(target)) {
      throw new TypeError('Argument must be a Buffer')
    }

    if (start === undefined) {
      start = 0;
    }
    if (end === undefined) {
      end = target ? target.length : 0;
    }
    if (thisStart === undefined) {
      thisStart = 0;
    }
    if (thisEnd === undefined) {
      thisEnd = this.length;
    }

    if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
      throw new RangeError('out of range index')
    }

    if (thisStart >= thisEnd && start >= end) {
      return 0
    }
    if (thisStart >= thisEnd) {
      return -1
    }
    if (start >= end) {
      return 1
    }

    start >>>= 0;
    end >>>= 0;
    thisStart >>>= 0;
    thisEnd >>>= 0;

    if (this === target) return 0

    var x = thisEnd - thisStart;
    var y = end - start;
    var len = Math.min(x, y);

    var thisCopy = this.slice(thisStart, thisEnd);
    var targetCopy = target.slice(start, end);

    for (var i = 0; i < len; ++i) {
      if (thisCopy[i] !== targetCopy[i]) {
        x = thisCopy[i];
        y = targetCopy[i];
        break
      }
    }

    if (x < y) return -1
    if (y < x) return 1
    return 0
  };

  // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  //
  // Arguments:
  // - buffer - a Buffer to search
  // - val - a string, Buffer, or number
  // - byteOffset - an index into `buffer`; will be clamped to an int32
  // - encoding - an optional encoding, relevant is val is a string
  // - dir - true for indexOf, false for lastIndexOf
  function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
    // Empty buffer means no match
    if (buffer.length === 0) return -1

    // Normalize byteOffset
    if (typeof byteOffset === 'string') {
      encoding = byteOffset;
      byteOffset = 0;
    } else if (byteOffset > 0x7fffffff) {
      byteOffset = 0x7fffffff;
    } else if (byteOffset < -0x80000000) {
      byteOffset = -0x80000000;
    }
    byteOffset = +byteOffset;  // Coerce to Number.
    if (isNaN(byteOffset)) {
      // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
      byteOffset = dir ? 0 : (buffer.length - 1);
    }

    // Normalize byteOffset: negative offsets start from the end of the buffer
    if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
    if (byteOffset >= buffer.length) {
      if (dir) return -1
      else byteOffset = buffer.length - 1;
    } else if (byteOffset < 0) {
      if (dir) byteOffset = 0;
      else return -1
    }

    // Normalize val
    if (typeof val === 'string') {
      val = Buffer.from(val, encoding);
    }

    // Finally, search either indexOf (if dir is true) or lastIndexOf
    if (internalIsBuffer(val)) {
      // Special case: looking for empty string/buffer always fails
      if (val.length === 0) {
        return -1
      }
      return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
    } else if (typeof val === 'number') {
      val = val & 0xFF; // Search for a byte value [0-255]
      if (Buffer.TYPED_ARRAY_SUPPORT &&
          typeof Uint8Array.prototype.indexOf === 'function') {
        if (dir) {
          return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
        } else {
          return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
        }
      }
      return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
    }

    throw new TypeError('val must be string, number or Buffer')
  }

  function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
    var indexSize = 1;
    var arrLength = arr.length;
    var valLength = val.length;

    if (encoding !== undefined) {
      encoding = String(encoding).toLowerCase();
      if (encoding === 'ucs2' || encoding === 'ucs-2' ||
          encoding === 'utf16le' || encoding === 'utf-16le') {
        if (arr.length < 2 || val.length < 2) {
          return -1
        }
        indexSize = 2;
        arrLength /= 2;
        valLength /= 2;
        byteOffset /= 2;
      }
    }

    function read (buf, i) {
      if (indexSize === 1) {
        return buf[i]
      } else {
        return buf.readUInt16BE(i * indexSize)
      }
    }

    var i;
    if (dir) {
      var foundIndex = -1;
      for (i = byteOffset; i < arrLength; i++) {
        if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
          if (foundIndex === -1) foundIndex = i;
          if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
        } else {
          if (foundIndex !== -1) i -= i - foundIndex;
          foundIndex = -1;
        }
      }
    } else {
      if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
      for (i = byteOffset; i >= 0; i--) {
        var found = true;
        for (var j = 0; j < valLength; j++) {
          if (read(arr, i + j) !== read(val, j)) {
            found = false;
            break
          }
        }
        if (found) return i
      }
    }

    return -1
  }

  Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
    return this.indexOf(val, byteOffset, encoding) !== -1
  };

  Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
    return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  };

  Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
    return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  };

  function hexWrite (buf, string, offset, length) {
    offset = Number(offset) || 0;
    var remaining = buf.length - offset;
    if (!length) {
      length = remaining;
    } else {
      length = Number(length);
      if (length > remaining) {
        length = remaining;
      }
    }

    // must be an even number of digits
    var strLen = string.length;
    if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')

    if (length > strLen / 2) {
      length = strLen / 2;
    }
    for (var i = 0; i < length; ++i) {
      var parsed = parseInt(string.substr(i * 2, 2), 16);
      if (isNaN(parsed)) return i
      buf[offset + i] = parsed;
    }
    return i
  }

  function utf8Write (buf, string, offset, length) {
    return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  }

  function asciiWrite (buf, string, offset, length) {
    return blitBuffer(asciiToBytes(string), buf, offset, length)
  }

  function latin1Write (buf, string, offset, length) {
    return asciiWrite(buf, string, offset, length)
  }

  function base64Write (buf, string, offset, length) {
    return blitBuffer(base64ToBytes(string), buf, offset, length)
  }

  function ucs2Write (buf, string, offset, length) {
    return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  }

  Buffer.prototype.write = function write (string, offset, length, encoding) {
    // Buffer#write(string)
    if (offset === undefined) {
      encoding = 'utf8';
      length = this.length;
      offset = 0;
    // Buffer#write(string, encoding)
    } else if (length === undefined && typeof offset === 'string') {
      encoding = offset;
      length = this.length;
      offset = 0;
    // Buffer#write(string, offset[, length][, encoding])
    } else if (isFinite(offset)) {
      offset = offset | 0;
      if (isFinite(length)) {
        length = length | 0;
        if (encoding === undefined) encoding = 'utf8';
      } else {
        encoding = length;
        length = undefined;
      }
    // legacy write(string, encoding, offset, length) - remove in v0.13
    } else {
      throw new Error(
        'Buffer.write(string, encoding, offset[, length]) is no longer supported'
      )
    }

    var remaining = this.length - offset;
    if (length === undefined || length > remaining) length = remaining;

    if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
      throw new RangeError('Attempt to write outside buffer bounds')
    }

    if (!encoding) encoding = 'utf8';

    var loweredCase = false;
    for (;;) {
      switch (encoding) {
        case 'hex':
          return hexWrite(this, string, offset, length)

        case 'utf8':
        case 'utf-8':
          return utf8Write(this, string, offset, length)

        case 'ascii':
          return asciiWrite(this, string, offset, length)

        case 'latin1':
        case 'binary':
          return latin1Write(this, string, offset, length)

        case 'base64':
          // Warning: maxLength not taken into account in base64Write
          return base64Write(this, string, offset, length)

        case 'ucs2':
        case 'ucs-2':
        case 'utf16le':
        case 'utf-16le':
          return ucs2Write(this, string, offset, length)

        default:
          if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
          encoding = ('' + encoding).toLowerCase();
          loweredCase = true;
      }
    }
  };

  Buffer.prototype.toJSON = function toJSON () {
    return {
      type: 'Buffer',
      data: Array.prototype.slice.call(this._arr || this, 0)
    }
  };

  function base64Slice (buf, start, end) {
    if (start === 0 && end === buf.length) {
      return fromByteArray(buf)
    } else {
      return fromByteArray(buf.slice(start, end))
    }
  }

  function utf8Slice (buf, start, end) {
    end = Math.min(buf.length, end);
    var res = [];

    var i = start;
    while (i < end) {
      var firstByte = buf[i];
      var codePoint = null;
      var bytesPerSequence = (firstByte > 0xEF) ? 4
        : (firstByte > 0xDF) ? 3
        : (firstByte > 0xBF) ? 2
        : 1;

      if (i + bytesPerSequence <= end) {
        var secondByte, thirdByte, fourthByte, tempCodePoint;

        switch (bytesPerSequence) {
          case 1:
            if (firstByte < 0x80) {
              codePoint = firstByte;
            }
            break
          case 2:
            secondByte = buf[i + 1];
            if ((secondByte & 0xC0) === 0x80) {
              tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
              if (tempCodePoint > 0x7F) {
                codePoint = tempCodePoint;
              }
            }
            break
          case 3:
            secondByte = buf[i + 1];
            thirdByte = buf[i + 2];
            if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
              tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
              if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
                codePoint = tempCodePoint;
              }
            }
            break
          case 4:
            secondByte = buf[i + 1];
            thirdByte = buf[i + 2];
            fourthByte = buf[i + 3];
            if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
              tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
              if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
                codePoint = tempCodePoint;
              }
            }
        }
      }

      if (codePoint === null) {
        // we did not generate a valid codePoint so insert a
        // replacement char (U+FFFD) and advance only 1 byte
        codePoint = 0xFFFD;
        bytesPerSequence = 1;
      } else if (codePoint > 0xFFFF) {
        // encode to utf16 (surrogate pair dance)
        codePoint -= 0x10000;
        res.push(codePoint >>> 10 & 0x3FF | 0xD800);
        codePoint = 0xDC00 | codePoint & 0x3FF;
      }

      res.push(codePoint);
      i += bytesPerSequence;
    }

    return decodeCodePointsArray(res)
  }

  // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  // the lowest limit is Chrome, with 0x10000 args.
  // We go 1 magnitude less, for safety
  var MAX_ARGUMENTS_LENGTH = 0x1000;

  function decodeCodePointsArray (codePoints) {
    var len = codePoints.length;
    if (len <= MAX_ARGUMENTS_LENGTH) {
      return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
    }

    // Decode in chunks to avoid "call stack size exceeded".
    var res = '';
    var i = 0;
    while (i < len) {
      res += String.fromCharCode.apply(
        String,
        codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
      );
    }
    return res
  }

  function asciiSlice (buf, start, end) {
    var ret = '';
    end = Math.min(buf.length, end);

    for (var i = start; i < end; ++i) {
      ret += String.fromCharCode(buf[i] & 0x7F);
    }
    return ret
  }

  function latin1Slice (buf, start, end) {
    var ret = '';
    end = Math.min(buf.length, end);

    for (var i = start; i < end; ++i) {
      ret += String.fromCharCode(buf[i]);
    }
    return ret
  }

  function hexSlice (buf, start, end) {
    var len = buf.length;

    if (!start || start < 0) start = 0;
    if (!end || end < 0 || end > len) end = len;

    var out = '';
    for (var i = start; i < end; ++i) {
      out += toHex(buf[i]);
    }
    return out
  }

  function utf16leSlice (buf, start, end) {
    var bytes = buf.slice(start, end);
    var res = '';
    for (var i = 0; i < bytes.length; i += 2) {
      res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
    }
    return res
  }

  Buffer.prototype.slice = function slice (start, end) {
    var len = this.length;
    start = ~~start;
    end = end === undefined ? len : ~~end;

    if (start < 0) {
      start += len;
      if (start < 0) start = 0;
    } else if (start > len) {
      start = len;
    }

    if (end < 0) {
      end += len;
      if (end < 0) end = 0;
    } else if (end > len) {
      end = len;
    }

    if (end < start) end = start;

    var newBuf;
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      newBuf = this.subarray(start, end);
      newBuf.__proto__ = Buffer.prototype;
    } else {
      var sliceLen = end - start;
      newBuf = new Buffer(sliceLen, undefined);
      for (var i = 0; i < sliceLen; ++i) {
        newBuf[i] = this[i + start];
      }
    }

    return newBuf
  };

  /*
   * Need to make sure that buffer isn't trying to write out of bounds.
   */
  function checkOffset (offset, ext, length) {
    if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
    if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  }

  Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
    offset = offset | 0;
    byteLength = byteLength | 0;
    if (!noAssert) checkOffset(offset, byteLength, this.length);

    var val = this[offset];
    var mul = 1;
    var i = 0;
    while (++i < byteLength && (mul *= 0x100)) {
      val += this[offset + i] * mul;
    }

    return val
  };

  Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
    offset = offset | 0;
    byteLength = byteLength | 0;
    if (!noAssert) {
      checkOffset(offset, byteLength, this.length);
    }

    var val = this[offset + --byteLength];
    var mul = 1;
    while (byteLength > 0 && (mul *= 0x100)) {
      val += this[offset + --byteLength] * mul;
    }

    return val
  };

  Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 1, this.length);
    return this[offset]
  };

  Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 2, this.length);
    return this[offset] | (this[offset + 1] << 8)
  };

  Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 2, this.length);
    return (this[offset] << 8) | this[offset + 1]
  };

  Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 4, this.length);

    return ((this[offset]) |
        (this[offset + 1] << 8) |
        (this[offset + 2] << 16)) +
        (this[offset + 3] * 0x1000000)
  };

  Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 4, this.length);

    return (this[offset] * 0x1000000) +
      ((this[offset + 1] << 16) |
      (this[offset + 2] << 8) |
      this[offset + 3])
  };

  Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
    offset = offset | 0;
    byteLength = byteLength | 0;
    if (!noAssert) checkOffset(offset, byteLength, this.length);

    var val = this[offset];
    var mul = 1;
    var i = 0;
    while (++i < byteLength && (mul *= 0x100)) {
      val += this[offset + i] * mul;
    }
    mul *= 0x80;

    if (val >= mul) val -= Math.pow(2, 8 * byteLength);

    return val
  };

  Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
    offset = offset | 0;
    byteLength = byteLength | 0;
    if (!noAssert) checkOffset(offset, byteLength, this.length);

    var i = byteLength;
    var mul = 1;
    var val = this[offset + --i];
    while (i > 0 && (mul *= 0x100)) {
      val += this[offset + --i] * mul;
    }
    mul *= 0x80;

    if (val >= mul) val -= Math.pow(2, 8 * byteLength);

    return val
  };

  Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 1, this.length);
    if (!(this[offset] & 0x80)) return (this[offset])
    return ((0xff - this[offset] + 1) * -1)
  };

  Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 2, this.length);
    var val = this[offset] | (this[offset + 1] << 8);
    return (val & 0x8000) ? val | 0xFFFF0000 : val
  };

  Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 2, this.length);
    var val = this[offset + 1] | (this[offset] << 8);
    return (val & 0x8000) ? val | 0xFFFF0000 : val
  };

  Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 4, this.length);

    return (this[offset]) |
      (this[offset + 1] << 8) |
      (this[offset + 2] << 16) |
      (this[offset + 3] << 24)
  };

  Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 4, this.length);

    return (this[offset] << 24) |
      (this[offset + 1] << 16) |
      (this[offset + 2] << 8) |
      (this[offset + 3])
  };

  Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 4, this.length);
    return read(this, offset, true, 23, 4)
  };

  Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 4, this.length);
    return read(this, offset, false, 23, 4)
  };

  Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 8, this.length);
    return read(this, offset, true, 52, 8)
  };

  Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
    if (!noAssert) checkOffset(offset, 8, this.length);
    return read(this, offset, false, 52, 8)
  };

  function checkInt (buf, value, offset, ext, max, min) {
    if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
    if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
    if (offset + ext > buf.length) throw new RangeError('Index out of range')
  }

  Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
    value = +value;
    offset = offset | 0;
    byteLength = byteLength | 0;
    if (!noAssert) {
      var maxBytes = Math.pow(2, 8 * byteLength) - 1;
      checkInt(this, value, offset, byteLength, maxBytes, 0);
    }

    var mul = 1;
    var i = 0;
    this[offset] = value & 0xFF;
    while (++i < byteLength && (mul *= 0x100)) {
      this[offset + i] = (value / mul) & 0xFF;
    }

    return offset + byteLength
  };

  Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
    value = +value;
    offset = offset | 0;
    byteLength = byteLength | 0;
    if (!noAssert) {
      var maxBytes = Math.pow(2, 8 * byteLength) - 1;
      checkInt(this, value, offset, byteLength, maxBytes, 0);
    }

    var i = byteLength - 1;
    var mul = 1;
    this[offset + i] = value & 0xFF;
    while (--i >= 0 && (mul *= 0x100)) {
      this[offset + i] = (value / mul) & 0xFF;
    }

    return offset + byteLength
  };

  Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
    if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
    this[offset] = (value & 0xff);
    return offset + 1
  };

  function objectWriteUInt16 (buf, value, offset, littleEndian) {
    if (value < 0) value = 0xffff + value + 1;
    for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
      buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
        (littleEndian ? i : 1 - i) * 8;
    }
  }

  Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      this[offset] = (value & 0xff);
      this[offset + 1] = (value >>> 8);
    } else {
      objectWriteUInt16(this, value, offset, true);
    }
    return offset + 2
  };

  Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      this[offset] = (value >>> 8);
      this[offset + 1] = (value & 0xff);
    } else {
      objectWriteUInt16(this, value, offset, false);
    }
    return offset + 2
  };

  function objectWriteUInt32 (buf, value, offset, littleEndian) {
    if (value < 0) value = 0xffffffff + value + 1;
    for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
      buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
    }
  }

  Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      this[offset + 3] = (value >>> 24);
      this[offset + 2] = (value >>> 16);
      this[offset + 1] = (value >>> 8);
      this[offset] = (value & 0xff);
    } else {
      objectWriteUInt32(this, value, offset, true);
    }
    return offset + 4
  };

  Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      this[offset] = (value >>> 24);
      this[offset + 1] = (value >>> 16);
      this[offset + 2] = (value >>> 8);
      this[offset + 3] = (value & 0xff);
    } else {
      objectWriteUInt32(this, value, offset, false);
    }
    return offset + 4
  };

  Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) {
      var limit = Math.pow(2, 8 * byteLength - 1);

      checkInt(this, value, offset, byteLength, limit - 1, -limit);
    }

    var i = 0;
    var mul = 1;
    var sub = 0;
    this[offset] = value & 0xFF;
    while (++i < byteLength && (mul *= 0x100)) {
      if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
        sub = 1;
      }
      this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
    }

    return offset + byteLength
  };

  Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) {
      var limit = Math.pow(2, 8 * byteLength - 1);

      checkInt(this, value, offset, byteLength, limit - 1, -limit);
    }

    var i = byteLength - 1;
    var mul = 1;
    var sub = 0;
    this[offset + i] = value & 0xFF;
    while (--i >= 0 && (mul *= 0x100)) {
      if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
        sub = 1;
      }
      this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
    }

    return offset + byteLength
  };

  Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
    if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
    if (value < 0) value = 0xff + value + 1;
    this[offset] = (value & 0xff);
    return offset + 1
  };

  Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      this[offset] = (value & 0xff);
      this[offset + 1] = (value >>> 8);
    } else {
      objectWriteUInt16(this, value, offset, true);
    }
    return offset + 2
  };

  Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      this[offset] = (value >>> 8);
      this[offset + 1] = (value & 0xff);
    } else {
      objectWriteUInt16(this, value, offset, false);
    }
    return offset + 2
  };

  Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      this[offset] = (value & 0xff);
      this[offset + 1] = (value >>> 8);
      this[offset + 2] = (value >>> 16);
      this[offset + 3] = (value >>> 24);
    } else {
      objectWriteUInt32(this, value, offset, true);
    }
    return offset + 4
  };

  Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
    value = +value;
    offset = offset | 0;
    if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
    if (value < 0) value = 0xffffffff + value + 1;
    if (Buffer.TYPED_ARRAY_SUPPORT) {
      this[offset] = (value >>> 24);
      this[offset + 1] = (value >>> 16);
      this[offset + 2] = (value >>> 8);
      this[offset + 3] = (value & 0xff);
    } else {
      objectWriteUInt32(this, value, offset, false);
    }
    return offset + 4
  };

  function checkIEEE754 (buf, value, offset, ext, max, min) {
    if (offset + ext > buf.length) throw new RangeError('Index out of range')
    if (offset < 0) throw new RangeError('Index out of range')
  }

  function writeFloat (buf, value, offset, littleEndian, noAssert) {
    if (!noAssert) {
      checkIEEE754(buf, value, offset, 4);
    }
    write(buf, value, offset, littleEndian, 23, 4);
    return offset + 4
  }

  Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
    return writeFloat(this, value, offset, true, noAssert)
  };

  Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
    return writeFloat(this, value, offset, false, noAssert)
  };

  function writeDouble (buf, value, offset, littleEndian, noAssert) {
    if (!noAssert) {
      checkIEEE754(buf, value, offset, 8);
    }
    write(buf, value, offset, littleEndian, 52, 8);
    return offset + 8
  }

  Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
    return writeDouble(this, value, offset, true, noAssert)
  };

  Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
    return writeDouble(this, value, offset, false, noAssert)
  };

  // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  Buffer.prototype.copy = function copy (target, targetStart, start, end) {
    if (!start) start = 0;
    if (!end && end !== 0) end = this.length;
    if (targetStart >= target.length) targetStart = target.length;
    if (!targetStart) targetStart = 0;
    if (end > 0 && end < start) end = start;

    // Copy 0 bytes; we're done
    if (end === start) return 0
    if (target.length === 0 || this.length === 0) return 0

    // Fatal error conditions
    if (targetStart < 0) {
      throw new RangeError('targetStart out of bounds')
    }
    if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
    if (end < 0) throw new RangeError('sourceEnd out of bounds')

    // Are we oob?
    if (end > this.length) end = this.length;
    if (target.length - targetStart < end - start) {
      end = target.length - targetStart + start;
    }

    var len = end - start;
    var i;

    if (this === target && start < targetStart && targetStart < end) {
      // descending copy from end
      for (i = len - 1; i >= 0; --i) {
        target[i + targetStart] = this[i + start];
      }
    } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
      // ascending copy from start
      for (i = 0; i < len; ++i) {
        target[i + targetStart] = this[i + start];
      }
    } else {
      Uint8Array.prototype.set.call(
        target,
        this.subarray(start, start + len),
        targetStart
      );
    }

    return len
  };

  // Usage:
  //    buffer.fill(number[, offset[, end]])
  //    buffer.fill(buffer[, offset[, end]])
  //    buffer.fill(string[, offset[, end]][, encoding])
  Buffer.prototype.fill = function fill (val, start, end, encoding) {
    // Handle string cases:
    if (typeof val === 'string') {
      if (typeof start === 'string') {
        encoding = start;
        start = 0;
        end = this.length;
      } else if (typeof end === 'string') {
        encoding = end;
        end = this.length;
      }
      if (val.length === 1) {
        var code = val.charCodeAt(0);
        if (code < 256) {
          val = code;
        }
      }
      if (encoding !== undefined && typeof encoding !== 'string') {
        throw new TypeError('encoding must be a string')
      }
      if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
        throw new TypeError('Unknown encoding: ' + encoding)
      }
    } else if (typeof val === 'number') {
      val = val & 255;
    }

    // Invalid ranges are not set to a default, so can range check early.
    if (start < 0 || this.length < start || this.length < end) {
      throw new RangeError('Out of range index')
    }

    if (end <= start) {
      return this
    }

    start = start >>> 0;
    end = end === undefined ? this.length : end >>> 0;

    if (!val) val = 0;

    var i;
    if (typeof val === 'number') {
      for (i = start; i < end; ++i) {
        this[i] = val;
      }
    } else {
      var bytes = internalIsBuffer(val)
        ? val
        : utf8ToBytes(new Buffer(val, encoding).toString());
      var len = bytes.length;
      for (i = 0; i < end - start; ++i) {
        this[i + start] = bytes[i % len];
      }
    }

    return this
  };

  // HELPER FUNCTIONS
  // ================

  var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;

  function base64clean (str) {
    // Node strips out invalid characters like \n and \t from the string, base64-js does not
    str = stringtrim(str).replace(INVALID_BASE64_RE, '');
    // Node converts strings with length < 2 to ''
    if (str.length < 2) return ''
    // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
    while (str.length % 4 !== 0) {
      str = str + '=';
    }
    return str
  }

  function stringtrim (str) {
    if (str.trim) return str.trim()
    return str.replace(/^\s+|\s+$/g, '')
  }

  function toHex (n) {
    if (n < 16) return '0' + n.toString(16)
    return n.toString(16)
  }

  function utf8ToBytes (string, units) {
    units = units || Infinity;
    var codePoint;
    var length = string.length;
    var leadSurrogate = null;
    var bytes = [];

    for (var i = 0; i < length; ++i) {
      codePoint = string.charCodeAt(i);

      // is surrogate component
      if (codePoint > 0xD7FF && codePoint < 0xE000) {
        // last char was a lead
        if (!leadSurrogate) {
          // no lead yet
          if (codePoint > 0xDBFF) {
            // unexpected trail
            if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
            continue
          } else if (i + 1 === length) {
            // unpaired lead
            if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
            continue
          }

          // valid lead
          leadSurrogate = codePoint;

          continue
        }

        // 2 leads in a row
        if (codePoint < 0xDC00) {
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
          leadSurrogate = codePoint;
          continue
        }

        // valid surrogate pair
        codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
      } else if (leadSurrogate) {
        // valid bmp char, but last char was a lead
        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
      }

      leadSurrogate = null;

      // encode utf8
      if (codePoint < 0x80) {
        if ((units -= 1) < 0) break
        bytes.push(codePoint);
      } else if (codePoint < 0x800) {
        if ((units -= 2) < 0) break
        bytes.push(
          codePoint >> 0x6 | 0xC0,
          codePoint & 0x3F | 0x80
        );
      } else if (codePoint < 0x10000) {
        if ((units -= 3) < 0) break
        bytes.push(
          codePoint >> 0xC | 0xE0,
          codePoint >> 0x6 & 0x3F | 0x80,
          codePoint & 0x3F | 0x80
        );
      } else if (codePoint < 0x110000) {
        if ((units -= 4) < 0) break
        bytes.push(
          codePoint >> 0x12 | 0xF0,
          codePoint >> 0xC & 0x3F | 0x80,
          codePoint >> 0x6 & 0x3F | 0x80,
          codePoint & 0x3F | 0x80
        );
      } else {
        throw new Error('Invalid code point')
      }
    }

    return bytes
  }

  function asciiToBytes (str) {
    var byteArray = [];
    for (var i = 0; i < str.length; ++i) {
      // Node's code seems to be doing this and not & 0x7F..
      byteArray.push(str.charCodeAt(i) & 0xFF);
    }
    return byteArray
  }

  function utf16leToBytes (str, units) {
    var c, hi, lo;
    var byteArray = [];
    for (var i = 0; i < str.length; ++i) {
      if ((units -= 2) < 0) break

      c = str.charCodeAt(i);
      hi = c >> 8;
      lo = c % 256;
      byteArray.push(lo);
      byteArray.push(hi);
    }

    return byteArray
  }


  function base64ToBytes (str) {
    return toByteArray(base64clean(str))
  }

  function blitBuffer (src, dst, offset, length) {
    for (var i = 0; i < length; ++i) {
      if ((i + offset >= dst.length) || (i >= src.length)) break
      dst[i + offset] = src[i];
    }
    return i
  }

  function isnan (val) {
    return val !== val // eslint-disable-line no-self-compare
  }


  // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
  // The _isBuffer check is for Safari 5-7 support, because it's missing
  // Object.prototype.constructor. Remove this eventually
  function isBuffer(obj) {
    return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
  }

  function isFastBuffer (obj) {
    return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  }

  // For Node v0.10 support. Remove this eventually.
  function isSlowBuffer (obj) {
    return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
  }

  // shim for using process in browser

  // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
  var performance = global.performance || {};
  performance.now        ||
    performance.mozNow     ||
    performance.msNow      ||
    performance.oNow       ||
    performance.webkitNow  ||
    function(){ return (new Date()).getTime() };

  var inherits;
  if (typeof Object.create === 'function'){
    inherits = function inherits(ctor, superCtor) {
      // implementation from standard node.js 'util' module
      ctor.super_ = superCtor;
      ctor.prototype = Object.create(superCtor.prototype, {
        constructor: {
          value: ctor,
          enumerable: false,
          writable: true,
          configurable: true
        }
      });
    };
  } else {
    inherits = function inherits(ctor, superCtor) {
      ctor.super_ = superCtor;
      var TempCtor = function () {};
      TempCtor.prototype = superCtor.prototype;
      ctor.prototype = new TempCtor();
      ctor.prototype.constructor = ctor;
    };
  }
  var inherits$1 = inherits;

  // Copyright Joyent, Inc. and other Node contributors.


  /**
   * Echos the value of a value. Trys to print the value out
   * in the best way possible given the different types.
   *
   * @param {Object} obj The object to print out.
   * @param {Object} opts Optional options object that alters the output.
   */
  /* legacy: obj, showHidden, depth, colors*/
  function inspect$1(obj, opts) {
    // default options
    var ctx = {
      seen: [],
      stylize: stylizeNoColor
    };
    // legacy...
    if (arguments.length >= 3) ctx.depth = arguments[2];
    if (arguments.length >= 4) ctx.colors = arguments[3];
    if (isBoolean(opts)) {
      // legacy...
      ctx.showHidden = opts;
    } else if (opts) {
      // got an "options" object
      _extend(ctx, opts);
    }
    // set default options
    if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
    if (isUndefined(ctx.depth)) ctx.depth = 2;
    if (isUndefined(ctx.colors)) ctx.colors = false;
    if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
    if (ctx.colors) ctx.stylize = stylizeWithColor;
    return formatValue(ctx, obj, ctx.depth);
  }

  // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  inspect$1.colors = {
    'bold' : [1, 22],
    'italic' : [3, 23],
    'underline' : [4, 24],
    'inverse' : [7, 27],
    'white' : [37, 39],
    'grey' : [90, 39],
    'black' : [30, 39],
    'blue' : [34, 39],
    'cyan' : [36, 39],
    'green' : [32, 39],
    'magenta' : [35, 39],
    'red' : [31, 39],
    'yellow' : [33, 39]
  };

  // Don't use 'blue' not visible on cmd.exe
  inspect$1.styles = {
    'special': 'cyan',
    'number': 'yellow',
    'boolean': 'yellow',
    'undefined': 'grey',
    'null': 'bold',
    'string': 'green',
    'date': 'magenta',
    // "name": intentionally not styling
    'regexp': 'red'
  };


  function stylizeWithColor(str, styleType) {
    var style = inspect$1.styles[styleType];

    if (style) {
      return '\u001b[' + inspect$1.colors[style][0] + 'm' + str +
             '\u001b[' + inspect$1.colors[style][1] + 'm';
    } else {
      return str;
    }
  }


  function stylizeNoColor(str, styleType) {
    return str;
  }


  function arrayToHash(array) {
    var hash = {};

    array.forEach(function(val, idx) {
      hash[val] = true;
    });

    return hash;
  }


  function formatValue(ctx, value, recurseTimes) {
    // Provide a hook for user-specified inspect functions.
    // Check that value is an object with an inspect function on it
    if (ctx.customInspect &&
        value &&
        isFunction(value.inspect) &&
        // Filter out the util module, it's inspect function is special
        value.inspect !== inspect$1 &&
        // Also filter out any prototype objects using the circular check.
        !(value.constructor && value.constructor.prototype === value)) {
      var ret = value.inspect(recurseTimes, ctx);
      if (!isString(ret)) {
        ret = formatValue(ctx, ret, recurseTimes);
      }
      return ret;
    }

    // Primitive types cannot have properties
    var primitive = formatPrimitive(ctx, value);
    if (primitive) {
      return primitive;
    }

    // Look up the keys of the object.
    var keys = Object.keys(value);
    var visibleKeys = arrayToHash(keys);

    if (ctx.showHidden) {
      keys = Object.getOwnPropertyNames(value);
    }

    // IE doesn't make error fields non-enumerable
    // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
    if (isError(value)
        && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
      return formatError(value);
    }

    // Some type of object without properties can be shortcutted.
    if (keys.length === 0) {
      if (isFunction(value)) {
        var name = value.name ? ': ' + value.name : '';
        return ctx.stylize('[Function' + name + ']', 'special');
      }
      if (isRegExp(value)) {
        return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
      }
      if (isDate(value)) {
        return ctx.stylize(Date.prototype.toString.call(value), 'date');
      }
      if (isError(value)) {
        return formatError(value);
      }
    }

    var base = '', array = false, braces = ['{', '}'];

    // Make Array say that they are Array
    if (isArray(value)) {
      array = true;
      braces = ['[', ']'];
    }

    // Make functions say that they are functions
    if (isFunction(value)) {
      var n = value.name ? ': ' + value.name : '';
      base = ' [Function' + n + ']';
    }

    // Make RegExps say that they are RegExps
    if (isRegExp(value)) {
      base = ' ' + RegExp.prototype.toString.call(value);
    }

    // Make dates with properties first say the date
    if (isDate(value)) {
      base = ' ' + Date.prototype.toUTCString.call(value);
    }

    // Make error with message first say the error
    if (isError(value)) {
      base = ' ' + formatError(value);
    }

    if (keys.length === 0 && (!array || value.length == 0)) {
      return braces[0] + base + braces[1];
    }

    if (recurseTimes < 0) {
      if (isRegExp(value)) {
        return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
      } else {
        return ctx.stylize('[Object]', 'special');
      }
    }

    ctx.seen.push(value);

    var output;
    if (array) {
      output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
    } else {
      output = keys.map(function(key) {
        return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
      });
    }

    ctx.seen.pop();

    return reduceToSingleString(output, base, braces);
  }


  function formatPrimitive(ctx, value) {
    if (isUndefined(value))
      return ctx.stylize('undefined', 'undefined');
    if (isString(value)) {
      var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
                                               .replace(/'/g, "\\'")
                                               .replace(/\\"/g, '"') + '\'';
      return ctx.stylize(simple, 'string');
    }
    if (isNumber(value))
      return ctx.stylize('' + value, 'number');
    if (isBoolean(value))
      return ctx.stylize('' + value, 'boolean');
    // For some reason typeof null is "object", so special case here.
    if (isNull(value))
      return ctx.stylize('null', 'null');
  }


  function formatError(value) {
    return '[' + Error.prototype.toString.call(value) + ']';
  }


  function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
    var output = [];
    for (var i = 0, l = value.length; i < l; ++i) {
      if (hasOwnProperty$1(value, String(i))) {
        output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
            String(i), true));
      } else {
        output.push('');
      }
    }
    keys.forEach(function(key) {
      if (!key.match(/^\d+$/)) {
        output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
            key, true));
      }
    });
    return output;
  }


  function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
    var name, str, desc;
    desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
    if (desc.get) {
      if (desc.set) {
        str = ctx.stylize('[Getter/Setter]', 'special');
      } else {
        str = ctx.stylize('[Getter]', 'special');
      }
    } else {
      if (desc.set) {
        str = ctx.stylize('[Setter]', 'special');
      }
    }
    if (!hasOwnProperty$1(visibleKeys, key)) {
      name = '[' + key + ']';
    }
    if (!str) {
      if (ctx.seen.indexOf(desc.value) < 0) {
        if (isNull(recurseTimes)) {
          str = formatValue(ctx, desc.value, null);
        } else {
          str = formatValue(ctx, desc.value, recurseTimes - 1);
        }
        if (str.indexOf('\n') > -1) {
          if (array) {
            str = str.split('\n').map(function(line) {
              return '  ' + line;
            }).join('\n').substr(2);
          } else {
            str = '\n' + str.split('\n').map(function(line) {
              return '   ' + line;
            }).join('\n');
          }
        }
      } else {
        str = ctx.stylize('[Circular]', 'special');
      }
    }
    if (isUndefined(name)) {
      if (array && key.match(/^\d+$/)) {
        return str;
      }
      name = JSON.stringify('' + key);
      if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
        name = name.substr(1, name.length - 2);
        name = ctx.stylize(name, 'name');
      } else {
        name = name.replace(/'/g, "\\'")
                   .replace(/\\"/g, '"')
                   .replace(/(^"|"$)/g, "'");
        name = ctx.stylize(name, 'string');
      }
    }

    return name + ': ' + str;
  }


  function reduceToSingleString(output, base, braces) {
    var length = output.reduce(function(prev, cur) {
      if (cur.indexOf('\n') >= 0) ;
      return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
    }, 0);

    if (length > 60) {
      return braces[0] +
             (base === '' ? '' : base + '\n ') +
             ' ' +
             output.join(',\n  ') +
             ' ' +
             braces[1];
    }

    return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  }


  // NOTE: These type checking functions intentionally don't use `instanceof`
  // because it is fragile and can be easily faked with `Object.create()`.
  function isArray(ar) {
    return Array.isArray(ar);
  }

  function isBoolean(arg) {
    return typeof arg === 'boolean';
  }

  function isNull(arg) {
    return arg === null;
  }

  function isNumber(arg) {
    return typeof arg === 'number';
  }

  function isString(arg) {
    return typeof arg === 'string';
  }

  function isUndefined(arg) {
    return arg === void 0;
  }

  function isRegExp(re) {
    return isObject$1(re) && objectToString(re) === '[object RegExp]';
  }

  function isObject$1(arg) {
    return typeof arg === 'object' && arg !== null;
  }

  function isDate(d) {
    return isObject$1(d) && objectToString(d) === '[object Date]';
  }

  function isError(e) {
    return isObject$1(e) &&
        (objectToString(e) === '[object Error]' || e instanceof Error);
  }

  function isFunction(arg) {
    return typeof arg === 'function';
  }

  function isPrimitive(arg) {
    return arg === null ||
           typeof arg === 'boolean' ||
           typeof arg === 'number' ||
           typeof arg === 'string' ||
           typeof arg === 'symbol' ||  // ES6 symbol
           typeof arg === 'undefined';
  }

  function objectToString(o) {
    return Object.prototype.toString.call(o);
  }

  function _extend(origin, add) {
    // Don't do anything if add isn't an object
    if (!add || !isObject$1(add)) return origin;

    var keys = Object.keys(add);
    var i = keys.length;
    while (i--) {
      origin[keys[i]] = add[keys[i]];
    }
    return origin;
  }
  function hasOwnProperty$1(obj, prop) {
    return Object.prototype.hasOwnProperty.call(obj, prop);
  }

  function compare(a, b) {
    if (a === b) {
      return 0;
    }

    var x = a.length;
    var y = b.length;

    for (var i = 0, len = Math.min(x, y); i < len; ++i) {
      if (a[i] !== b[i]) {
        x = a[i];
        y = b[i];
        break;
      }
    }

    if (x < y) {
      return -1;
    }
    if (y < x) {
      return 1;
    }
    return 0;
  }
  var hasOwn$1 = Object.prototype.hasOwnProperty;

  var objectKeys = Object.keys || function (obj) {
    var keys = [];
    for (var key in obj) {
      if (hasOwn$1.call(obj, key)) keys.push(key);
    }
    return keys;
  };
  var pSlice = Array.prototype.slice;
  var _functionsHaveNames;
  function functionsHaveNames() {
    if (typeof _functionsHaveNames !== 'undefined') {
      return _functionsHaveNames;
    }
    return _functionsHaveNames = (function () {
      return function foo() {}.name === 'foo';
    }());
  }
  function pToString (obj) {
    return Object.prototype.toString.call(obj);
  }
  function isView(arrbuf) {
    if (isBuffer(arrbuf)) {
      return false;
    }
    if (typeof global.ArrayBuffer !== 'function') {
      return false;
    }
    if (typeof ArrayBuffer.isView === 'function') {
      return ArrayBuffer.isView(arrbuf);
    }
    if (!arrbuf) {
      return false;
    }
    if (arrbuf instanceof DataView) {
      return true;
    }
    if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
      return true;
    }
    return false;
  }
  // 1. The assert module provides functions that throw
  // AssertionError's when particular conditions are not met. The
  // assert module must conform to the following interface.

  function assert(value, message) {
    if (!value) fail(value, true, message, '==', ok);
  }

  // 2. The AssertionError is defined in assert.
  // new assert.AssertionError({ message: message,
  //                             actual: actual,
  //                             expected: expected })

  var regex = /\s*function\s+([^\(\s]*)\s*/;
  // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
  function getName$1(func) {
    if (!isFunction(func)) {
      return;
    }
    if (functionsHaveNames()) {
      return func.name;
    }
    var str = func.toString();
    var match = str.match(regex);
    return match && match[1];
  }
  assert.AssertionError = AssertionError;
  function AssertionError(options) {
    this.name = 'AssertionError';
    this.actual = options.actual;
    this.expected = options.expected;
    this.operator = options.operator;
    if (options.message) {
      this.message = options.message;
      this.generatedMessage = false;
    } else {
      this.message = getMessage(this);
      this.generatedMessage = true;
    }
    var stackStartFunction = options.stackStartFunction || fail;
    if (Error.captureStackTrace) {
      Error.captureStackTrace(this, stackStartFunction);
    } else {
      // non v8 browsers so we can have a stacktrace
      var err = new Error();
      if (err.stack) {
        var out = err.stack;

        // try to strip useless frames
        var fn_name = getName$1(stackStartFunction);
        var idx = out.indexOf('\n' + fn_name);
        if (idx >= 0) {
          // once we have located the function frame
          // we need to strip out everything before it (and its line)
          var next_line = out.indexOf('\n', idx + 1);
          out = out.substring(next_line + 1);
        }

        this.stack = out;
      }
    }
  }

  // assert.AssertionError instanceof Error
  inherits$1(AssertionError, Error);

  function truncate(s, n) {
    if (typeof s === 'string') {
      return s.length < n ? s : s.slice(0, n);
    } else {
      return s;
    }
  }
  function inspect(something) {
    if (functionsHaveNames() || !isFunction(something)) {
      return inspect$1(something);
    }
    var rawname = getName$1(something);
    var name = rawname ? ': ' + rawname : '';
    return '[Function' +  name + ']';
  }
  function getMessage(self) {
    return truncate(inspect(self.actual), 128) + ' ' +
           self.operator + ' ' +
           truncate(inspect(self.expected), 128);
  }

  // At present only the three keys mentioned above are used and
  // understood by the spec. Implementations or sub modules can pass
  // other keys to the AssertionError's constructor - they will be
  // ignored.

  // 3. All of the following functions must throw an AssertionError
  // when a corresponding condition is not met, with a message that
  // may be undefined if not provided.  All assertion methods provide
  // both the actual and expected values to the assertion error for
  // display purposes.

  function fail(actual, expected, message, operator, stackStartFunction) {
    throw new AssertionError({
      message: message,
      actual: actual,
      expected: expected,
      operator: operator,
      stackStartFunction: stackStartFunction
    });
  }

  // EXTENSION! allows for well behaved errors defined elsewhere.
  assert.fail = fail;

  // 4. Pure assertion tests whether a value is truthy, as determined
  // by !!guard.
  // assert.ok(guard, message_opt);
  // This statement is equivalent to assert.equal(true, !!guard,
  // message_opt);. To test strictly for the value true, use
  // assert.strictEqual(true, guard, message_opt);.

  function ok(value, message) {
    if (!value) fail(value, true, message, '==', ok);
  }
  assert.ok = ok;

  // 5. The equality assertion tests shallow, coercive equality with
  // ==.
  // assert.equal(actual, expected, message_opt);
  assert.equal = equal;
  function equal(actual, expected, message) {
    if (actual != expected) fail(actual, expected, message, '==', equal);
  }

  // 6. The non-equality assertion tests for whether two objects are not equal
  // with != assert.notEqual(actual, expected, message_opt);
  assert.notEqual = notEqual;
  function notEqual(actual, expected, message) {
    if (actual == expected) {
      fail(actual, expected, message, '!=', notEqual);
    }
  }

  // 7. The equivalence assertion tests a deep equality relation.
  // assert.deepEqual(actual, expected, message_opt);
  assert.deepEqual = deepEqual;
  function deepEqual(actual, expected, message) {
    if (!_deepEqual(actual, expected, false)) {
      fail(actual, expected, message, 'deepEqual', deepEqual);
    }
  }
  assert.deepStrictEqual = deepStrictEqual;
  function deepStrictEqual(actual, expected, message) {
    if (!_deepEqual(actual, expected, true)) {
      fail(actual, expected, message, 'deepStrictEqual', deepStrictEqual);
    }
  }

  function _deepEqual(actual, expected, strict, memos) {
    // 7.1. All identical values are equivalent, as determined by ===.
    if (actual === expected) {
      return true;
    } else if (isBuffer(actual) && isBuffer(expected)) {
      return compare(actual, expected) === 0;

    // 7.2. If the expected value is a Date object, the actual value is
    // equivalent if it is also a Date object that refers to the same time.
    } else if (isDate(actual) && isDate(expected)) {
      return actual.getTime() === expected.getTime();

    // 7.3 If the expected value is a RegExp object, the actual value is
    // equivalent if it is also a RegExp object with the same source and
    // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
    } else if (isRegExp(actual) && isRegExp(expected)) {
      return actual.source === expected.source &&
             actual.global === expected.global &&
             actual.multiline === expected.multiline &&
             actual.lastIndex === expected.lastIndex &&
             actual.ignoreCase === expected.ignoreCase;

    // 7.4. Other pairs that do not both pass typeof value == 'object',
    // equivalence is determined by ==.
    } else if ((actual === null || typeof actual !== 'object') &&
               (expected === null || typeof expected !== 'object')) {
      return strict ? actual === expected : actual == expected;

    // If both values are instances of typed arrays, wrap their underlying
    // ArrayBuffers in a Buffer each to increase performance
    // This optimization requires the arrays to have the same type as checked by
    // Object.prototype.toString (aka pToString). Never perform binary
    // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
    // bit patterns are not identical.
    } else if (isView(actual) && isView(expected) &&
               pToString(actual) === pToString(expected) &&
               !(actual instanceof Float32Array ||
                 actual instanceof Float64Array)) {
      return compare(new Uint8Array(actual.buffer),
                     new Uint8Array(expected.buffer)) === 0;

    // 7.5 For all other Object pairs, including Array objects, equivalence is
    // determined by having the same number of owned properties (as verified
    // with Object.prototype.hasOwnProperty.call), the same set of keys
    // (although not necessarily the same order), equivalent values for every
    // corresponding key, and an identical 'prototype' property. Note: this
    // accounts for both named and indexed properties on Arrays.
    } else if (isBuffer(actual) !== isBuffer(expected)) {
      return false;
    } else {
      memos = memos || {actual: [], expected: []};

      var actualIndex = memos.actual.indexOf(actual);
      if (actualIndex !== -1) {
        if (actualIndex === memos.expected.indexOf(expected)) {
          return true;
        }
      }

      memos.actual.push(actual);
      memos.expected.push(expected);

      return objEquiv(actual, expected, strict, memos);
    }
  }

  function isArguments(object) {
    return Object.prototype.toString.call(object) == '[object Arguments]';
  }

  function objEquiv(a, b, strict, actualVisitedObjects) {
    if (a === null || a === undefined || b === null || b === undefined)
      return false;
    // if one is a primitive, the other must be same
    if (isPrimitive(a) || isPrimitive(b))
      return a === b;
    if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
      return false;
    var aIsArgs = isArguments(a);
    var bIsArgs = isArguments(b);
    if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
      return false;
    if (aIsArgs) {
      a = pSlice.call(a);
      b = pSlice.call(b);
      return _deepEqual(a, b, strict);
    }
    var ka = objectKeys(a);
    var kb = objectKeys(b);
    var key, i;
    // having the same number of owned properties (keys incorporates
    // hasOwnProperty)
    if (ka.length !== kb.length)
      return false;
    //the same set of keys (although not necessarily the same order),
    ka.sort();
    kb.sort();
    //~~~cheap key test
    for (i = ka.length - 1; i >= 0; i--) {
      if (ka[i] !== kb[i])
        return false;
    }
    //equivalent values for every corresponding key, and
    //~~~possibly expensive deep test
    for (i = ka.length - 1; i >= 0; i--) {
      key = ka[i];
      if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
        return false;
    }
    return true;
  }

  // 8. The non-equivalence assertion tests for any deep inequality.
  // assert.notDeepEqual(actual, expected, message_opt);
  assert.notDeepEqual = notDeepEqual;
  function notDeepEqual(actual, expected, message) {
    if (_deepEqual(actual, expected, false)) {
      fail(actual, expected, message, 'notDeepEqual', notDeepEqual);
    }
  }

  assert.notDeepStrictEqual = notDeepStrictEqual;
  function notDeepStrictEqual(actual, expected, message) {
    if (_deepEqual(actual, expected, true)) {
      fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
    }
  }


  // 9. The strict equality assertion tests strict equality, as determined by ===.
  // assert.strictEqual(actual, expected, message_opt);
  assert.strictEqual = strictEqual;
  function strictEqual(actual, expected, message) {
    if (actual !== expected) {
      fail(actual, expected, message, '===', strictEqual);
    }
  }

  // 10. The strict non-equality assertion tests for strict inequality, as
  // determined by !==.  assert.notStrictEqual(actual, expected, message_opt);
  assert.notStrictEqual = notStrictEqual;
  function notStrictEqual(actual, expected, message) {
    if (actual === expected) {
      fail(actual, expected, message, '!==', notStrictEqual);
    }
  }

  function expectedException(actual, expected) {
    if (!actual || !expected) {
      return false;
    }

    if (Object.prototype.toString.call(expected) == '[object RegExp]') {
      return expected.test(actual);
    }

    try {
      if (actual instanceof expected) {
        return true;
      }
    } catch (e) {
      // Ignore.  The instanceof check doesn't work for arrow functions.
    }

    if (Error.isPrototypeOf(expected)) {
      return false;
    }

    return expected.call({}, actual) === true;
  }

  function _tryBlock(block) {
    var error;
    try {
      block();
    } catch (e) {
      error = e;
    }
    return error;
  }

  function _throws(shouldThrow, block, expected, message) {
    var actual;

    if (typeof block !== 'function') {
      throw new TypeError('"block" argument must be a function');
    }

    if (typeof expected === 'string') {
      message = expected;
      expected = null;
    }

    actual = _tryBlock(block);

    message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
              (message ? ' ' + message : '.');

    if (shouldThrow && !actual) {
      fail(actual, expected, 'Missing expected exception' + message);
    }

    var userProvidedMessage = typeof message === 'string';
    var isUnwantedException = !shouldThrow && isError(actual);
    var isUnexpectedException = !shouldThrow && actual && !expected;

    if ((isUnwantedException &&
        userProvidedMessage &&
        expectedException(actual, expected)) ||
        isUnexpectedException) {
      fail(actual, expected, 'Got unwanted exception' + message);
    }

    if ((shouldThrow && actual && expected &&
        !expectedException(actual, expected)) || (!shouldThrow && actual)) {
      throw actual;
    }
  }

  // 11. Expected to throw an error:
  // assert.throws(block, Error_opt, message_opt);
  assert.throws = throws;
  function throws(block, /*optional*/error, /*optional*/message) {
    _throws(true, block, error, message);
  }

  // EXTENSION! This is annoying to write outside this module.
  assert.doesNotThrow = doesNotThrow;
  function doesNotThrow(block, /*optional*/error, /*optional*/message) {
    _throws(false, block, error, message);
  }

  assert.ifError = ifError;
  function ifError(err) {
    if (err) throw err;
  }

  var assert$1 = /*#__PURE__*/Object.freeze({
    __proto__: null,
    'default': assert,
    AssertionError: AssertionError,
    fail: fail,
    ok: ok,
    assert: ok,
    equal: equal,
    notEqual: notEqual,
    deepEqual: deepEqual,
    deepStrictEqual: deepStrictEqual,
    notDeepEqual: notDeepEqual,
    notDeepStrictEqual: notDeepStrictEqual,
    strictEqual: strictEqual,
    notStrictEqual: notStrictEqual,
    throws: throws,
    doesNotThrow: doesNotThrow,
    ifError: ifError
  });

  var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(assert$1);

  var options = {};

  var esprima = {};

  var util$5 = {};

  var sourceMap = {};

  var sourceMapGenerator$1 = {};

  var base64Vlq$1 = {};

  var base64$2 = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredBase64;

  function requireBase64 () {
  	if (hasRequiredBase64) return base64$2;
  	hasRequiredBase64 = 1;
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');

  	/**
  	 * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  	 */
  	base64$2.encode = function (number) {
  	  if (0 <= number && number < intToCharMap.length) {
  	    return intToCharMap[number];
  	  }
  	  throw new TypeError("Must be between 0 and 63: " + number);
  	};

  	/**
  	 * Decode a single base 64 character code digit to an integer. Returns -1 on
  	 * failure.
  	 */
  	base64$2.decode = function (charCode) {
  	  var bigA = 65;     // 'A'
  	  var bigZ = 90;     // 'Z'

  	  var littleA = 97;  // 'a'
  	  var littleZ = 122; // 'z'

  	  var zero = 48;     // '0'
  	  var nine = 57;     // '9'

  	  var plus = 43;     // '+'
  	  var slash = 47;    // '/'

  	  var littleOffset = 26;
  	  var numberOffset = 52;

  	  // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  	  if (bigA <= charCode && charCode <= bigZ) {
  	    return (charCode - bigA);
  	  }

  	  // 26 - 51: abcdefghijklmnopqrstuvwxyz
  	  if (littleA <= charCode && charCode <= littleZ) {
  	    return (charCode - littleA + littleOffset);
  	  }

  	  // 52 - 61: 0123456789
  	  if (zero <= charCode && charCode <= nine) {
  	    return (charCode - zero + numberOffset);
  	  }

  	  // 62: +
  	  if (charCode == plus) {
  	    return 62;
  	  }

  	  // 63: /
  	  if (charCode == slash) {
  	    return 63;
  	  }

  	  // Invalid base64 digit.
  	  return -1;
  	};
  	return base64$2;
  }

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredBase64Vlq;

  function requireBase64Vlq () {
  	if (hasRequiredBase64Vlq) return base64Vlq$1;
  	hasRequiredBase64Vlq = 1;
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 *
  	 * Based on the Base 64 VLQ implementation in Closure Compiler:
  	 * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  	 *
  	 * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  	 * Redistribution and use in source and binary forms, with or without
  	 * modification, are permitted provided that the following conditions are
  	 * met:
  	 *
  	 *  * Redistributions of source code must retain the above copyright
  	 *    notice, this list of conditions and the following disclaimer.
  	 *  * Redistributions in binary form must reproduce the above
  	 *    copyright notice, this list of conditions and the following
  	 *    disclaimer in the documentation and/or other materials provided
  	 *    with the distribution.
  	 *  * Neither the name of Google Inc. nor the names of its
  	 *    contributors may be used to endorse or promote products derived
  	 *    from this software without specific prior written permission.
  	 *
  	 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  	 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  	 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  	 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  	 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  	 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  	 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  	 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  	 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  	 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  	 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  	 */

  	var base64 = requireBase64();

  	// A single base 64 digit can contain 6 bits of data. For the base 64 variable
  	// length quantities we use in the source map spec, the first bit is the sign,
  	// the next four bits are the actual value, and the 6th bit is the
  	// continuation bit. The continuation bit tells us whether there are more
  	// digits in this value following this digit.
  	//
  	//   Continuation
  	//   |    Sign
  	//   |    |
  	//   V    V
  	//   101011

  	var VLQ_BASE_SHIFT = 5;

  	// binary: 100000
  	var VLQ_BASE = 1 << VLQ_BASE_SHIFT;

  	// binary: 011111
  	var VLQ_BASE_MASK = VLQ_BASE - 1;

  	// binary: 100000
  	var VLQ_CONTINUATION_BIT = VLQ_BASE;

  	/**
  	 * Converts from a two-complement value to a value where the sign bit is
  	 * placed in the least significant bit.  For example, as decimals:
  	 *   1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  	 *   2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  	 */
  	function toVLQSigned(aValue) {
  	  return aValue < 0
  	    ? ((-aValue) << 1) + 1
  	    : (aValue << 1) + 0;
  	}

  	/**
  	 * Converts to a two-complement value from a value where the sign bit is
  	 * placed in the least significant bit.  For example, as decimals:
  	 *   2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  	 *   4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  	 */
  	function fromVLQSigned(aValue) {
  	  var isNegative = (aValue & 1) === 1;
  	  var shifted = aValue >> 1;
  	  return isNegative
  	    ? -shifted
  	    : shifted;
  	}

  	/**
  	 * Returns the base 64 VLQ encoded value.
  	 */
  	base64Vlq$1.encode = function base64VLQ_encode(aValue) {
  	  var encoded = "";
  	  var digit;

  	  var vlq = toVLQSigned(aValue);

  	  do {
  	    digit = vlq & VLQ_BASE_MASK;
  	    vlq >>>= VLQ_BASE_SHIFT;
  	    if (vlq > 0) {
  	      // There are still more digits in this value, so we must make sure the
  	      // continuation bit is marked.
  	      digit |= VLQ_CONTINUATION_BIT;
  	    }
  	    encoded += base64.encode(digit);
  	  } while (vlq > 0);

  	  return encoded;
  	};

  	/**
  	 * Decodes the next base 64 VLQ value from the given string and returns the
  	 * value and the rest of the string via the out parameter.
  	 */
  	base64Vlq$1.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  	  var strLen = aStr.length;
  	  var result = 0;
  	  var shift = 0;
  	  var continuation, digit;

  	  do {
  	    if (aIndex >= strLen) {
  	      throw new Error("Expected more digits in base 64 VLQ value.");
  	    }

  	    digit = base64.decode(aStr.charCodeAt(aIndex++));
  	    if (digit === -1) {
  	      throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  	    }

  	    continuation = !!(digit & VLQ_CONTINUATION_BIT);
  	    digit &= VLQ_BASE_MASK;
  	    result = result + (digit << shift);
  	    shift += VLQ_BASE_SHIFT;
  	  } while (continuation);

  	  aOutParam.value = fromVLQSigned(result);
  	  aOutParam.rest = aIndex;
  	};
  	return base64Vlq$1;
  }

  var util$4 = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredUtil;

  function requireUtil () {
  	if (hasRequiredUtil) return util$4;
  	hasRequiredUtil = 1;
  	(function (exports) {
  		/*
  		 * Copyright 2011 Mozilla Foundation and contributors
  		 * Licensed under the New BSD license. See LICENSE or:
  		 * http://opensource.org/licenses/BSD-3-Clause
  		 */

  		/**
  		 * This is a helper function for getting values from parameter/options
  		 * objects.
  		 *
  		 * @param args The object we are extracting values from
  		 * @param name The name of the property we are getting.
  		 * @param defaultValue An optional value to return if the property is missing
  		 * from the object. If this is not specified and the property is missing, an
  		 * error will be thrown.
  		 */
  		function getArg(aArgs, aName, aDefaultValue) {
  		  if (aName in aArgs) {
  		    return aArgs[aName];
  		  } else if (arguments.length === 3) {
  		    return aDefaultValue;
  		  } else {
  		    throw new Error('"' + aName + '" is a required argument.');
  		  }
  		}
  		exports.getArg = getArg;

  		var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  		var dataUrlRegexp = /^data:.+\,.+$/;

  		function urlParse(aUrl) {
  		  var match = aUrl.match(urlRegexp);
  		  if (!match) {
  		    return null;
  		  }
  		  return {
  		    scheme: match[1],
  		    auth: match[2],
  		    host: match[3],
  		    port: match[4],
  		    path: match[5]
  		  };
  		}
  		exports.urlParse = urlParse;

  		function urlGenerate(aParsedUrl) {
  		  var url = '';
  		  if (aParsedUrl.scheme) {
  		    url += aParsedUrl.scheme + ':';
  		  }
  		  url += '//';
  		  if (aParsedUrl.auth) {
  		    url += aParsedUrl.auth + '@';
  		  }
  		  if (aParsedUrl.host) {
  		    url += aParsedUrl.host;
  		  }
  		  if (aParsedUrl.port) {
  		    url += ":" + aParsedUrl.port;
  		  }
  		  if (aParsedUrl.path) {
  		    url += aParsedUrl.path;
  		  }
  		  return url;
  		}
  		exports.urlGenerate = urlGenerate;

  		/**
  		 * Normalizes a path, or the path portion of a URL:
  		 *
  		 * - Replaces consecutive slashes with one slash.
  		 * - Removes unnecessary '.' parts.
  		 * - Removes unnecessary '<dir>/..' parts.
  		 *
  		 * Based on code in the Node.js 'path' core module.
  		 *
  		 * @param aPath The path or url to normalize.
  		 */
  		function normalize(aPath) {
  		  var path = aPath;
  		  var url = urlParse(aPath);
  		  if (url) {
  		    if (!url.path) {
  		      return aPath;
  		    }
  		    path = url.path;
  		  }
  		  var isAbsolute = exports.isAbsolute(path);

  		  var parts = path.split(/\/+/);
  		  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  		    part = parts[i];
  		    if (part === '.') {
  		      parts.splice(i, 1);
  		    } else if (part === '..') {
  		      up++;
  		    } else if (up > 0) {
  		      if (part === '') {
  		        // The first part is blank if the path is absolute. Trying to go
  		        // above the root is a no-op. Therefore we can remove all '..' parts
  		        // directly after the root.
  		        parts.splice(i + 1, up);
  		        up = 0;
  		      } else {
  		        parts.splice(i, 2);
  		        up--;
  		      }
  		    }
  		  }
  		  path = parts.join('/');

  		  if (path === '') {
  		    path = isAbsolute ? '/' : '.';
  		  }

  		  if (url) {
  		    url.path = path;
  		    return urlGenerate(url);
  		  }
  		  return path;
  		}
  		exports.normalize = normalize;

  		/**
  		 * Joins two paths/URLs.
  		 *
  		 * @param aRoot The root path or URL.
  		 * @param aPath The path or URL to be joined with the root.
  		 *
  		 * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  		 *   scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  		 *   first.
  		 * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  		 *   is updated with the result and aRoot is returned. Otherwise the result
  		 *   is returned.
  		 *   - If aPath is absolute, the result is aPath.
  		 *   - Otherwise the two paths are joined with a slash.
  		 * - Joining for example 'http://' and 'www.example.com' is also supported.
  		 */
  		function join(aRoot, aPath) {
  		  if (aRoot === "") {
  		    aRoot = ".";
  		  }
  		  if (aPath === "") {
  		    aPath = ".";
  		  }
  		  var aPathUrl = urlParse(aPath);
  		  var aRootUrl = urlParse(aRoot);
  		  if (aRootUrl) {
  		    aRoot = aRootUrl.path || '/';
  		  }

  		  // `join(foo, '//www.example.org')`
  		  if (aPathUrl && !aPathUrl.scheme) {
  		    if (aRootUrl) {
  		      aPathUrl.scheme = aRootUrl.scheme;
  		    }
  		    return urlGenerate(aPathUrl);
  		  }

  		  if (aPathUrl || aPath.match(dataUrlRegexp)) {
  		    return aPath;
  		  }

  		  // `join('http://', 'www.example.com')`
  		  if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  		    aRootUrl.host = aPath;
  		    return urlGenerate(aRootUrl);
  		  }

  		  var joined = aPath.charAt(0) === '/'
  		    ? aPath
  		    : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);

  		  if (aRootUrl) {
  		    aRootUrl.path = joined;
  		    return urlGenerate(aRootUrl);
  		  }
  		  return joined;
  		}
  		exports.join = join;

  		exports.isAbsolute = function (aPath) {
  		  return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
  		};

  		/**
  		 * Make a path relative to a URL or another path.
  		 *
  		 * @param aRoot The root path or URL.
  		 * @param aPath The path or URL to be made relative to aRoot.
  		 */
  		function relative(aRoot, aPath) {
  		  if (aRoot === "") {
  		    aRoot = ".";
  		  }

  		  aRoot = aRoot.replace(/\/$/, '');

  		  // It is possible for the path to be above the root. In this case, simply
  		  // checking whether the root is a prefix of the path won't work. Instead, we
  		  // need to remove components from the root one by one, until either we find
  		  // a prefix that fits, or we run out of components to remove.
  		  var level = 0;
  		  while (aPath.indexOf(aRoot + '/') !== 0) {
  		    var index = aRoot.lastIndexOf("/");
  		    if (index < 0) {
  		      return aPath;
  		    }

  		    // If the only part of the root that is left is the scheme (i.e. http://,
  		    // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  		    // have exhausted all components, so the path is not relative to the root.
  		    aRoot = aRoot.slice(0, index);
  		    if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  		      return aPath;
  		    }

  		    ++level;
  		  }

  		  // Make sure we add a "../" for each component we removed from the root.
  		  return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  		}
  		exports.relative = relative;

  		var supportsNullProto = (function () {
  		  var obj = Object.create(null);
  		  return !('__proto__' in obj);
  		}());

  		function identity (s) {
  		  return s;
  		}

  		/**
  		 * Because behavior goes wacky when you set `__proto__` on objects, we
  		 * have to prefix all the strings in our set with an arbitrary character.
  		 *
  		 * See https://github.com/mozilla/source-map/pull/31 and
  		 * https://github.com/mozilla/source-map/issues/30
  		 *
  		 * @param String aStr
  		 */
  		function toSetString(aStr) {
  		  if (isProtoString(aStr)) {
  		    return '$' + aStr;
  		  }

  		  return aStr;
  		}
  		exports.toSetString = supportsNullProto ? identity : toSetString;

  		function fromSetString(aStr) {
  		  if (isProtoString(aStr)) {
  		    return aStr.slice(1);
  		  }

  		  return aStr;
  		}
  		exports.fromSetString = supportsNullProto ? identity : fromSetString;

  		function isProtoString(s) {
  		  if (!s) {
  		    return false;
  		  }

  		  var length = s.length;

  		  if (length < 9 /* "__proto__".length */) {
  		    return false;
  		  }

  		  if (s.charCodeAt(length - 1) !== 95  /* '_' */ ||
  		      s.charCodeAt(length - 2) !== 95  /* '_' */ ||
  		      s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  		      s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  		      s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  		      s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  		      s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  		      s.charCodeAt(length - 8) !== 95  /* '_' */ ||
  		      s.charCodeAt(length - 9) !== 95  /* '_' */) {
  		    return false;
  		  }

  		  for (var i = length - 10; i >= 0; i--) {
  		    if (s.charCodeAt(i) !== 36 /* '$' */) {
  		      return false;
  		    }
  		  }

  		  return true;
  		}

  		/**
  		 * Comparator between two mappings where the original positions are compared.
  		 *
  		 * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  		 * mappings with the same original source/line/column, but different generated
  		 * line and column the same. Useful when searching for a mapping with a
  		 * stubbed out mapping.
  		 */
  		function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  		  var cmp = strcmp(mappingA.source, mappingB.source);
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.originalLine - mappingB.originalLine;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.originalColumn - mappingB.originalColumn;
  		  if (cmp !== 0 || onlyCompareOriginal) {
  		    return cmp;
  		  }

  		  cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.generatedLine - mappingB.generatedLine;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  return strcmp(mappingA.name, mappingB.name);
  		}
  		exports.compareByOriginalPositions = compareByOriginalPositions;

  		/**
  		 * Comparator between two mappings with deflated source and name indices where
  		 * the generated positions are compared.
  		 *
  		 * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  		 * mappings with the same generated line and column, but different
  		 * source/name/original line and column the same. Useful when searching for a
  		 * mapping with a stubbed out mapping.
  		 */
  		function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  		  var cmp = mappingA.generatedLine - mappingB.generatedLine;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  		  if (cmp !== 0 || onlyCompareGenerated) {
  		    return cmp;
  		  }

  		  cmp = strcmp(mappingA.source, mappingB.source);
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.originalLine - mappingB.originalLine;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.originalColumn - mappingB.originalColumn;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  return strcmp(mappingA.name, mappingB.name);
  		}
  		exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;

  		function strcmp(aStr1, aStr2) {
  		  if (aStr1 === aStr2) {
  		    return 0;
  		  }

  		  if (aStr1 === null) {
  		    return 1; // aStr2 !== null
  		  }

  		  if (aStr2 === null) {
  		    return -1; // aStr1 !== null
  		  }

  		  if (aStr1 > aStr2) {
  		    return 1;
  		  }

  		  return -1;
  		}

  		/**
  		 * Comparator between two mappings with inflated source and name strings where
  		 * the generated positions are compared.
  		 */
  		function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  		  var cmp = mappingA.generatedLine - mappingB.generatedLine;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = strcmp(mappingA.source, mappingB.source);
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.originalLine - mappingB.originalLine;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  cmp = mappingA.originalColumn - mappingB.originalColumn;
  		  if (cmp !== 0) {
  		    return cmp;
  		  }

  		  return strcmp(mappingA.name, mappingB.name);
  		}
  		exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;

  		/**
  		 * Strip any JSON XSSI avoidance prefix from the string (as documented
  		 * in the source maps specification), and then parse the string as
  		 * JSON.
  		 */
  		function parseSourceMapInput(str) {
  		  return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
  		}
  		exports.parseSourceMapInput = parseSourceMapInput;

  		/**
  		 * Compute the URL of a source given the the source root, the source's
  		 * URL, and the source map's URL.
  		 */
  		function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  		  sourceURL = sourceURL || '';

  		  if (sourceRoot) {
  		    // This follows what Chrome does.
  		    if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
  		      sourceRoot += '/';
  		    }
  		    // The spec says:
  		    //   Line 4: An optional source root, useful for relocating source
  		    //   files on a server or removing repeated values in the
  		    //   “sources” entry.  This value is prepended to the individual
  		    //   entries in the “source” field.
  		    sourceURL = sourceRoot + sourceURL;
  		  }

  		  // Historically, SourceMapConsumer did not take the sourceMapURL as
  		  // a parameter.  This mode is still somewhat supported, which is why
  		  // this code block is conditional.  However, it's preferable to pass
  		  // the source map URL to SourceMapConsumer, so that this function
  		  // can implement the source URL resolution algorithm as outlined in
  		  // the spec.  This block is basically the equivalent of:
  		  //    new URL(sourceURL, sourceMapURL).toString()
  		  // ... except it avoids using URL, which wasn't available in the
  		  // older releases of node still supported by this library.
  		  //
  		  // The spec says:
  		  //   If the sources are not absolute URLs after prepending of the
  		  //   “sourceRoot”, the sources are resolved relative to the
  		  //   SourceMap (like resolving script src in a html document).
  		  if (sourceMapURL) {
  		    var parsed = urlParse(sourceMapURL);
  		    if (!parsed) {
  		      throw new Error("sourceMapURL could not be parsed");
  		    }
  		    if (parsed.path) {
  		      // Strip the last path component, but keep the "/".
  		      var index = parsed.path.lastIndexOf('/');
  		      if (index >= 0) {
  		        parsed.path = parsed.path.substring(0, index + 1);
  		      }
  		    }
  		    sourceURL = join(urlGenerate(parsed), sourceURL);
  		  }

  		  return normalize(sourceURL);
  		}
  		exports.computeSourceURL = computeSourceURL;
  } (util$4));
  	return util$4;
  }

  var arraySet$1 = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredArraySet;

  function requireArraySet () {
  	if (hasRequiredArraySet) return arraySet$1;
  	hasRequiredArraySet = 1;
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	var util = requireUtil();
  	var has = Object.prototype.hasOwnProperty;
  	var hasNativeMap = typeof Map !== "undefined";

  	/**
  	 * A data structure which is a combination of an array and a set. Adding a new
  	 * member is O(1), testing for membership is O(1), and finding the index of an
  	 * element is O(1). Removing elements from the set is not supported. Only
  	 * strings are supported for membership.
  	 */
  	function ArraySet() {
  	  this._array = [];
  	  this._set = hasNativeMap ? new Map() : Object.create(null);
  	}

  	/**
  	 * Static method for creating ArraySet instances from an existing array.
  	 */
  	ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  	  var set = new ArraySet();
  	  for (var i = 0, len = aArray.length; i < len; i++) {
  	    set.add(aArray[i], aAllowDuplicates);
  	  }
  	  return set;
  	};

  	/**
  	 * Return how many unique items are in this ArraySet. If duplicates have been
  	 * added, than those do not count towards the size.
  	 *
  	 * @returns Number
  	 */
  	ArraySet.prototype.size = function ArraySet_size() {
  	  return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  	};

  	/**
  	 * Add the given string to this set.
  	 *
  	 * @param String aStr
  	 */
  	ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  	  var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
  	  var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
  	  var idx = this._array.length;
  	  if (!isDuplicate || aAllowDuplicates) {
  	    this._array.push(aStr);
  	  }
  	  if (!isDuplicate) {
  	    if (hasNativeMap) {
  	      this._set.set(aStr, idx);
  	    } else {
  	      this._set[sStr] = idx;
  	    }
  	  }
  	};

  	/**
  	 * Is the given string a member of this set?
  	 *
  	 * @param String aStr
  	 */
  	ArraySet.prototype.has = function ArraySet_has(aStr) {
  	  if (hasNativeMap) {
  	    return this._set.has(aStr);
  	  } else {
  	    var sStr = util.toSetString(aStr);
  	    return has.call(this._set, sStr);
  	  }
  	};

  	/**
  	 * What is the index of the given string in the array?
  	 *
  	 * @param String aStr
  	 */
  	ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
  	  if (hasNativeMap) {
  	    var idx = this._set.get(aStr);
  	    if (idx >= 0) {
  	        return idx;
  	    }
  	  } else {
  	    var sStr = util.toSetString(aStr);
  	    if (has.call(this._set, sStr)) {
  	      return this._set[sStr];
  	    }
  	  }

  	  throw new Error('"' + aStr + '" is not in the set.');
  	};

  	/**
  	 * What is the element at the given index?
  	 *
  	 * @param Number aIdx
  	 */
  	ArraySet.prototype.at = function ArraySet_at(aIdx) {
  	  if (aIdx >= 0 && aIdx < this._array.length) {
  	    return this._array[aIdx];
  	  }
  	  throw new Error('No element indexed by ' + aIdx);
  	};

  	/**
  	 * Returns the array representation of this set (which has the proper indices
  	 * indicated by indexOf). Note that this is a copy of the internal array used
  	 * for storing the members so that no one can mess with internal state.
  	 */
  	ArraySet.prototype.toArray = function ArraySet_toArray() {
  	  return this._array.slice();
  	};

  	arraySet$1.ArraySet = ArraySet;
  	return arraySet$1;
  }

  var mappingList$1 = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredMappingList;

  function requireMappingList () {
  	if (hasRequiredMappingList) return mappingList$1;
  	hasRequiredMappingList = 1;
  	/*
  	 * Copyright 2014 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	var util = requireUtil();

  	/**
  	 * Determine whether mappingB is after mappingA with respect to generated
  	 * position.
  	 */
  	function generatedPositionAfter(mappingA, mappingB) {
  	  // Optimized for most common case
  	  var lineA = mappingA.generatedLine;
  	  var lineB = mappingB.generatedLine;
  	  var columnA = mappingA.generatedColumn;
  	  var columnB = mappingB.generatedColumn;
  	  return lineB > lineA || lineB == lineA && columnB >= columnA ||
  	         util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  	}

  	/**
  	 * A data structure to provide a sorted view of accumulated mappings in a
  	 * performance conscious manner. It trades a neglibable overhead in general
  	 * case for a large speedup in case of mappings being added in order.
  	 */
  	function MappingList() {
  	  this._array = [];
  	  this._sorted = true;
  	  // Serves as infimum
  	  this._last = {generatedLine: -1, generatedColumn: 0};
  	}

  	/**
  	 * Iterate through internal items. This method takes the same arguments that
  	 * `Array.prototype.forEach` takes.
  	 *
  	 * NOTE: The order of the mappings is NOT guaranteed.
  	 */
  	MappingList.prototype.unsortedForEach =
  	  function MappingList_forEach(aCallback, aThisArg) {
  	    this._array.forEach(aCallback, aThisArg);
  	  };

  	/**
  	 * Add the given source mapping.
  	 *
  	 * @param Object aMapping
  	 */
  	MappingList.prototype.add = function MappingList_add(aMapping) {
  	  if (generatedPositionAfter(this._last, aMapping)) {
  	    this._last = aMapping;
  	    this._array.push(aMapping);
  	  } else {
  	    this._sorted = false;
  	    this._array.push(aMapping);
  	  }
  	};

  	/**
  	 * Returns the flat, sorted array of mappings. The mappings are sorted by
  	 * generated position.
  	 *
  	 * WARNING: This method returns internal data without copying, for
  	 * performance. The return value must NOT be mutated, and should be treated as
  	 * an immutable borrow. If you want to take ownership, you must make your own
  	 * copy.
  	 */
  	MappingList.prototype.toArray = function MappingList_toArray() {
  	  if (!this._sorted) {
  	    this._array.sort(util.compareByGeneratedPositionsInflated);
  	    this._sorted = true;
  	  }
  	  return this._array;
  	};

  	mappingList$1.MappingList = MappingList;
  	return mappingList$1;
  }

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredSourceMapGenerator;

  function requireSourceMapGenerator () {
  	if (hasRequiredSourceMapGenerator) return sourceMapGenerator$1;
  	hasRequiredSourceMapGenerator = 1;
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	var base64VLQ = requireBase64Vlq();
  	var util = requireUtil();
  	var ArraySet = requireArraySet().ArraySet;
  	var MappingList = requireMappingList().MappingList;

  	/**
  	 * An instance of the SourceMapGenerator represents a source map which is
  	 * being built incrementally. You may pass an object with the following
  	 * properties:
  	 *
  	 *   - file: The filename of the generated source.
  	 *   - sourceRoot: A root for all relative URLs in this source map.
  	 */
  	function SourceMapGenerator(aArgs) {
  	  if (!aArgs) {
  	    aArgs = {};
  	  }
  	  this._file = util.getArg(aArgs, 'file', null);
  	  this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  	  this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  	  this._sources = new ArraySet();
  	  this._names = new ArraySet();
  	  this._mappings = new MappingList();
  	  this._sourcesContents = null;
  	}

  	SourceMapGenerator.prototype._version = 3;

  	/**
  	 * Creates a new SourceMapGenerator based on a SourceMapConsumer
  	 *
  	 * @param aSourceMapConsumer The SourceMap.
  	 */
  	SourceMapGenerator.fromSourceMap =
  	  function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  	    var sourceRoot = aSourceMapConsumer.sourceRoot;
  	    var generator = new SourceMapGenerator({
  	      file: aSourceMapConsumer.file,
  	      sourceRoot: sourceRoot
  	    });
  	    aSourceMapConsumer.eachMapping(function (mapping) {
  	      var newMapping = {
  	        generated: {
  	          line: mapping.generatedLine,
  	          column: mapping.generatedColumn
  	        }
  	      };

  	      if (mapping.source != null) {
  	        newMapping.source = mapping.source;
  	        if (sourceRoot != null) {
  	          newMapping.source = util.relative(sourceRoot, newMapping.source);
  	        }

  	        newMapping.original = {
  	          line: mapping.originalLine,
  	          column: mapping.originalColumn
  	        };

  	        if (mapping.name != null) {
  	          newMapping.name = mapping.name;
  	        }
  	      }

  	      generator.addMapping(newMapping);
  	    });
  	    aSourceMapConsumer.sources.forEach(function (sourceFile) {
  	      var sourceRelative = sourceFile;
  	      if (sourceRoot !== null) {
  	        sourceRelative = util.relative(sourceRoot, sourceFile);
  	      }

  	      if (!generator._sources.has(sourceRelative)) {
  	        generator._sources.add(sourceRelative);
  	      }

  	      var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  	      if (content != null) {
  	        generator.setSourceContent(sourceFile, content);
  	      }
  	    });
  	    return generator;
  	  };

  	/**
  	 * Add a single mapping from original source line and column to the generated
  	 * source's line and column for this source map being created. The mapping
  	 * object should have the following properties:
  	 *
  	 *   - generated: An object with the generated line and column positions.
  	 *   - original: An object with the original line and column positions.
  	 *   - source: The original source file (relative to the sourceRoot).
  	 *   - name: An optional original token name for this mapping.
  	 */
  	SourceMapGenerator.prototype.addMapping =
  	  function SourceMapGenerator_addMapping(aArgs) {
  	    var generated = util.getArg(aArgs, 'generated');
  	    var original = util.getArg(aArgs, 'original', null);
  	    var source = util.getArg(aArgs, 'source', null);
  	    var name = util.getArg(aArgs, 'name', null);

  	    if (!this._skipValidation) {
  	      this._validateMapping(generated, original, source, name);
  	    }

  	    if (source != null) {
  	      source = String(source);
  	      if (!this._sources.has(source)) {
  	        this._sources.add(source);
  	      }
  	    }

  	    if (name != null) {
  	      name = String(name);
  	      if (!this._names.has(name)) {
  	        this._names.add(name);
  	      }
  	    }

  	    this._mappings.add({
  	      generatedLine: generated.line,
  	      generatedColumn: generated.column,
  	      originalLine: original != null && original.line,
  	      originalColumn: original != null && original.column,
  	      source: source,
  	      name: name
  	    });
  	  };

  	/**
  	 * Set the source content for a source file.
  	 */
  	SourceMapGenerator.prototype.setSourceContent =
  	  function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  	    var source = aSourceFile;
  	    if (this._sourceRoot != null) {
  	      source = util.relative(this._sourceRoot, source);
  	    }

  	    if (aSourceContent != null) {
  	      // Add the source content to the _sourcesContents map.
  	      // Create a new _sourcesContents map if the property is null.
  	      if (!this._sourcesContents) {
  	        this._sourcesContents = Object.create(null);
  	      }
  	      this._sourcesContents[util.toSetString(source)] = aSourceContent;
  	    } else if (this._sourcesContents) {
  	      // Remove the source file from the _sourcesContents map.
  	      // If the _sourcesContents map is empty, set the property to null.
  	      delete this._sourcesContents[util.toSetString(source)];
  	      if (Object.keys(this._sourcesContents).length === 0) {
  	        this._sourcesContents = null;
  	      }
  	    }
  	  };

  	/**
  	 * Applies the mappings of a sub-source-map for a specific source file to the
  	 * source map being generated. Each mapping to the supplied source file is
  	 * rewritten using the supplied source map. Note: The resolution for the
  	 * resulting mappings is the minimium of this map and the supplied map.
  	 *
  	 * @param aSourceMapConsumer The source map to be applied.
  	 * @param aSourceFile Optional. The filename of the source file.
  	 *        If omitted, SourceMapConsumer's file property will be used.
  	 * @param aSourceMapPath Optional. The dirname of the path to the source map
  	 *        to be applied. If relative, it is relative to the SourceMapConsumer.
  	 *        This parameter is needed when the two source maps aren't in the same
  	 *        directory, and the source map to be applied contains relative source
  	 *        paths. If so, those relative source paths need to be rewritten
  	 *        relative to the SourceMapGenerator.
  	 */
  	SourceMapGenerator.prototype.applySourceMap =
  	  function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  	    var sourceFile = aSourceFile;
  	    // If aSourceFile is omitted, we will use the file property of the SourceMap
  	    if (aSourceFile == null) {
  	      if (aSourceMapConsumer.file == null) {
  	        throw new Error(
  	          'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  	          'or the source map\'s "file" property. Both were omitted.'
  	        );
  	      }
  	      sourceFile = aSourceMapConsumer.file;
  	    }
  	    var sourceRoot = this._sourceRoot;
  	    // Make "sourceFile" relative if an absolute Url is passed.
  	    if (sourceRoot != null) {
  	      sourceFile = util.relative(sourceRoot, sourceFile);
  	    }
  	    // Applying the SourceMap can add and remove items from the sources and
  	    // the names array.
  	    var newSources = new ArraySet();
  	    var newNames = new ArraySet();

  	    // Find mappings for the "sourceFile"
  	    this._mappings.unsortedForEach(function (mapping) {
  	      if (mapping.source === sourceFile && mapping.originalLine != null) {
  	        // Check if it can be mapped by the source map, then update the mapping.
  	        var original = aSourceMapConsumer.originalPositionFor({
  	          line: mapping.originalLine,
  	          column: mapping.originalColumn
  	        });
  	        if (original.source != null) {
  	          // Copy mapping
  	          mapping.source = original.source;
  	          if (aSourceMapPath != null) {
  	            mapping.source = util.join(aSourceMapPath, mapping.source);
  	          }
  	          if (sourceRoot != null) {
  	            mapping.source = util.relative(sourceRoot, mapping.source);
  	          }
  	          mapping.originalLine = original.line;
  	          mapping.originalColumn = original.column;
  	          if (original.name != null) {
  	            mapping.name = original.name;
  	          }
  	        }
  	      }

  	      var source = mapping.source;
  	      if (source != null && !newSources.has(source)) {
  	        newSources.add(source);
  	      }

  	      var name = mapping.name;
  	      if (name != null && !newNames.has(name)) {
  	        newNames.add(name);
  	      }

  	    }, this);
  	    this._sources = newSources;
  	    this._names = newNames;

  	    // Copy sourcesContents of applied map.
  	    aSourceMapConsumer.sources.forEach(function (sourceFile) {
  	      var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  	      if (content != null) {
  	        if (aSourceMapPath != null) {
  	          sourceFile = util.join(aSourceMapPath, sourceFile);
  	        }
  	        if (sourceRoot != null) {
  	          sourceFile = util.relative(sourceRoot, sourceFile);
  	        }
  	        this.setSourceContent(sourceFile, content);
  	      }
  	    }, this);
  	  };

  	/**
  	 * A mapping can have one of the three levels of data:
  	 *
  	 *   1. Just the generated position.
  	 *   2. The Generated position, original position, and original source.
  	 *   3. Generated and original position, original source, as well as a name
  	 *      token.
  	 *
  	 * To maintain consistency, we validate that any new mapping being added falls
  	 * in to one of these categories.
  	 */
  	SourceMapGenerator.prototype._validateMapping =
  	  function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  	                                              aName) {
  	    // When aOriginal is truthy but has empty values for .line and .column,
  	    // it is most likely a programmer error. In this case we throw a very
  	    // specific error message to try to guide them the right way.
  	    // For example: https://github.com/Polymer/polymer-bundler/pull/519
  	    if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  	        throw new Error(
  	            'original.line and original.column are not numbers -- you probably meant to omit ' +
  	            'the original mapping entirely and only map the generated position. If so, pass ' +
  	            'null for the original mapping instead of an object with empty or null values.'
  	        );
  	    }

  	    if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  	        && aGenerated.line > 0 && aGenerated.column >= 0
  	        && !aOriginal && !aSource && !aName) {
  	      // Case 1.
  	      return;
  	    }
  	    else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  	             && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  	             && aGenerated.line > 0 && aGenerated.column >= 0
  	             && aOriginal.line > 0 && aOriginal.column >= 0
  	             && aSource) {
  	      // Cases 2 and 3.
  	      return;
  	    }
  	    else {
  	      throw new Error('Invalid mapping: ' + JSON.stringify({
  	        generated: aGenerated,
  	        source: aSource,
  	        original: aOriginal,
  	        name: aName
  	      }));
  	    }
  	  };

  	/**
  	 * Serialize the accumulated mappings in to the stream of base 64 VLQs
  	 * specified by the source map format.
  	 */
  	SourceMapGenerator.prototype._serializeMappings =
  	  function SourceMapGenerator_serializeMappings() {
  	    var previousGeneratedColumn = 0;
  	    var previousGeneratedLine = 1;
  	    var previousOriginalColumn = 0;
  	    var previousOriginalLine = 0;
  	    var previousName = 0;
  	    var previousSource = 0;
  	    var result = '';
  	    var next;
  	    var mapping;
  	    var nameIdx;
  	    var sourceIdx;

  	    var mappings = this._mappings.toArray();
  	    for (var i = 0, len = mappings.length; i < len; i++) {
  	      mapping = mappings[i];
  	      next = '';

  	      if (mapping.generatedLine !== previousGeneratedLine) {
  	        previousGeneratedColumn = 0;
  	        while (mapping.generatedLine !== previousGeneratedLine) {
  	          next += ';';
  	          previousGeneratedLine++;
  	        }
  	      }
  	      else {
  	        if (i > 0) {
  	          if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  	            continue;
  	          }
  	          next += ',';
  	        }
  	      }

  	      next += base64VLQ.encode(mapping.generatedColumn
  	                                 - previousGeneratedColumn);
  	      previousGeneratedColumn = mapping.generatedColumn;

  	      if (mapping.source != null) {
  	        sourceIdx = this._sources.indexOf(mapping.source);
  	        next += base64VLQ.encode(sourceIdx - previousSource);
  	        previousSource = sourceIdx;

  	        // lines are stored 0-based in SourceMap spec version 3
  	        next += base64VLQ.encode(mapping.originalLine - 1
  	                                   - previousOriginalLine);
  	        previousOriginalLine = mapping.originalLine - 1;

  	        next += base64VLQ.encode(mapping.originalColumn
  	                                   - previousOriginalColumn);
  	        previousOriginalColumn = mapping.originalColumn;

  	        if (mapping.name != null) {
  	          nameIdx = this._names.indexOf(mapping.name);
  	          next += base64VLQ.encode(nameIdx - previousName);
  	          previousName = nameIdx;
  	        }
  	      }

  	      result += next;
  	    }

  	    return result;
  	  };

  	SourceMapGenerator.prototype._generateSourcesContent =
  	  function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  	    return aSources.map(function (source) {
  	      if (!this._sourcesContents) {
  	        return null;
  	      }
  	      if (aSourceRoot != null) {
  	        source = util.relative(aSourceRoot, source);
  	      }
  	      var key = util.toSetString(source);
  	      return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  	        ? this._sourcesContents[key]
  	        : null;
  	    }, this);
  	  };

  	/**
  	 * Externalize the source map.
  	 */
  	SourceMapGenerator.prototype.toJSON =
  	  function SourceMapGenerator_toJSON() {
  	    var map = {
  	      version: this._version,
  	      sources: this._sources.toArray(),
  	      names: this._names.toArray(),
  	      mappings: this._serializeMappings()
  	    };
  	    if (this._file != null) {
  	      map.file = this._file;
  	    }
  	    if (this._sourceRoot != null) {
  	      map.sourceRoot = this._sourceRoot;
  	    }
  	    if (this._sourcesContents) {
  	      map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  	    }

  	    return map;
  	  };

  	/**
  	 * Render the source map being generated to a string.
  	 */
  	SourceMapGenerator.prototype.toString =
  	  function SourceMapGenerator_toString() {
  	    return JSON.stringify(this.toJSON());
  	  };

  	sourceMapGenerator$1.SourceMapGenerator = SourceMapGenerator;
  	return sourceMapGenerator$1;
  }

  var sourceMapConsumer = {};

  var binarySearch$2 = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredBinarySearch;

  function requireBinarySearch () {
  	if (hasRequiredBinarySearch) return binarySearch$2;
  	hasRequiredBinarySearch = 1;
  	(function (exports) {
  		/*
  		 * Copyright 2011 Mozilla Foundation and contributors
  		 * Licensed under the New BSD license. See LICENSE or:
  		 * http://opensource.org/licenses/BSD-3-Clause
  		 */

  		exports.GREATEST_LOWER_BOUND = 1;
  		exports.LEAST_UPPER_BOUND = 2;

  		/**
  		 * Recursive implementation of binary search.
  		 *
  		 * @param aLow Indices here and lower do not contain the needle.
  		 * @param aHigh Indices here and higher do not contain the needle.
  		 * @param aNeedle The element being searched for.
  		 * @param aHaystack The non-empty array being searched.
  		 * @param aCompare Function which takes two elements and returns -1, 0, or 1.
  		 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  		 *     'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  		 *     closest element that is smaller than or greater than the one we are
  		 *     searching for, respectively, if the exact element cannot be found.
  		 */
  		function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
  		  // This function terminates when one of the following is true:
  		  //
  		  //   1. We find the exact element we are looking for.
  		  //
  		  //   2. We did not find the exact element, but we can return the index of
  		  //      the next-closest element.
  		  //
  		  //   3. We did not find the exact element, and there is no next-closest
  		  //      element than the one we are searching for, so we return -1.
  		  var mid = Math.floor((aHigh - aLow) / 2) + aLow;
  		  var cmp = aCompare(aNeedle, aHaystack[mid], true);
  		  if (cmp === 0) {
  		    // Found the element we are looking for.
  		    return mid;
  		  }
  		  else if (cmp > 0) {
  		    // Our needle is greater than aHaystack[mid].
  		    if (aHigh - mid > 1) {
  		      // The element is in the upper half.
  		      return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
  		    }

  		    // The exact needle element was not found in this haystack. Determine if
  		    // we are in termination case (3) or (2) and return the appropriate thing.
  		    if (aBias == exports.LEAST_UPPER_BOUND) {
  		      return aHigh < aHaystack.length ? aHigh : -1;
  		    } else {
  		      return mid;
  		    }
  		  }
  		  else {
  		    // Our needle is less than aHaystack[mid].
  		    if (mid - aLow > 1) {
  		      // The element is in the lower half.
  		      return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
  		    }

  		    // we are in termination case (3) or (2) and return the appropriate thing.
  		    if (aBias == exports.LEAST_UPPER_BOUND) {
  		      return mid;
  		    } else {
  		      return aLow < 0 ? -1 : aLow;
  		    }
  		  }
  		}

  		/**
  		 * This is an implementation of binary search which will always try and return
  		 * the index of the closest element if there is no exact hit. This is because
  		 * mappings between original and generated line/col pairs are single points,
  		 * and there is an implicit region between each of them, so a miss just means
  		 * that you aren't on the very start of a region.
  		 *
  		 * @param aNeedle The element you are looking for.
  		 * @param aHaystack The array that is being searched.
  		 * @param aCompare A function which takes the needle and an element in the
  		 *     array and returns -1, 0, or 1 depending on whether the needle is less
  		 *     than, equal to, or greater than the element, respectively.
  		 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  		 *     'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  		 *     closest element that is smaller than or greater than the one we are
  		 *     searching for, respectively, if the exact element cannot be found.
  		 *     Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
  		 */
  		exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
  		  if (aHaystack.length === 0) {
  		    return -1;
  		  }

  		  var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
  		                              aCompare, aBias || exports.GREATEST_LOWER_BOUND);
  		  if (index < 0) {
  		    return -1;
  		  }

  		  // We have found either the exact element, or the next-closest element than
  		  // the one we are searching for. However, there may be more than one such
  		  // element. Make sure we always return the smallest of these.
  		  while (index - 1 >= 0) {
  		    if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
  		      break;
  		    }
  		    --index;
  		  }

  		  return index;
  		};
  } (binarySearch$2));
  	return binarySearch$2;
  }

  var quickSort = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredQuickSort;

  function requireQuickSort () {
  	if (hasRequiredQuickSort) return quickSort;
  	hasRequiredQuickSort = 1;
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	// It turns out that some (most?) JavaScript engines don't self-host
  	// `Array.prototype.sort`. This makes sense because C++ will likely remain
  	// faster than JS when doing raw CPU-intensive sorting. However, when using a
  	// custom comparator function, calling back and forth between the VM's C++ and
  	// JIT'd JS is rather slow *and* loses JIT type information, resulting in
  	// worse generated code for the comparator function than would be optimal. In
  	// fact, when sorting with a comparator, these costs outweigh the benefits of
  	// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
  	// a ~3500ms mean speed-up in `bench/bench.html`.

  	/**
  	 * Swap the elements indexed by `x` and `y` in the array `ary`.
  	 *
  	 * @param {Array} ary
  	 *        The array.
  	 * @param {Number} x
  	 *        The index of the first item.
  	 * @param {Number} y
  	 *        The index of the second item.
  	 */
  	function swap(ary, x, y) {
  	  var temp = ary[x];
  	  ary[x] = ary[y];
  	  ary[y] = temp;
  	}

  	/**
  	 * Returns a random integer within the range `low .. high` inclusive.
  	 *
  	 * @param {Number} low
  	 *        The lower bound on the range.
  	 * @param {Number} high
  	 *        The upper bound on the range.
  	 */
  	function randomIntInRange(low, high) {
  	  return Math.round(low + (Math.random() * (high - low)));
  	}

  	/**
  	 * The Quick Sort algorithm.
  	 *
  	 * @param {Array} ary
  	 *        An array to sort.
  	 * @param {function} comparator
  	 *        Function to use to compare two items.
  	 * @param {Number} p
  	 *        Start index of the array
  	 * @param {Number} r
  	 *        End index of the array
  	 */
  	function doQuickSort(ary, comparator, p, r) {
  	  // If our lower bound is less than our upper bound, we (1) partition the
  	  // array into two pieces and (2) recurse on each half. If it is not, this is
  	  // the empty array and our base case.

  	  if (p < r) {
  	    // (1) Partitioning.
  	    //
  	    // The partitioning chooses a pivot between `p` and `r` and moves all
  	    // elements that are less than or equal to the pivot to the before it, and
  	    // all the elements that are greater than it after it. The effect is that
  	    // once partition is done, the pivot is in the exact place it will be when
  	    // the array is put in sorted order, and it will not need to be moved
  	    // again. This runs in O(n) time.

  	    // Always choose a random pivot so that an input array which is reverse
  	    // sorted does not cause O(n^2) running time.
  	    var pivotIndex = randomIntInRange(p, r);
  	    var i = p - 1;

  	    swap(ary, pivotIndex, r);
  	    var pivot = ary[r];

  	    // Immediately after `j` is incremented in this loop, the following hold
  	    // true:
  	    //
  	    //   * Every element in `ary[p .. i]` is less than or equal to the pivot.
  	    //
  	    //   * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
  	    for (var j = p; j < r; j++) {
  	      if (comparator(ary[j], pivot) <= 0) {
  	        i += 1;
  	        swap(ary, i, j);
  	      }
  	    }

  	    swap(ary, i + 1, j);
  	    var q = i + 1;

  	    // (2) Recurse on each half.

  	    doQuickSort(ary, comparator, p, q - 1);
  	    doQuickSort(ary, comparator, q + 1, r);
  	  }
  	}

  	/**
  	 * Sort the given array in-place with the given comparator function.
  	 *
  	 * @param {Array} ary
  	 *        An array to sort.
  	 * @param {function} comparator
  	 *        Function to use to compare two items.
  	 */
  	quickSort.quickSort = function (ary, comparator) {
  	  doQuickSort(ary, comparator, 0, ary.length - 1);
  	};
  	return quickSort;
  }

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredSourceMapConsumer;

  function requireSourceMapConsumer () {
  	if (hasRequiredSourceMapConsumer) return sourceMapConsumer;
  	hasRequiredSourceMapConsumer = 1;
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	var util = requireUtil();
  	var binarySearch = requireBinarySearch();
  	var ArraySet = requireArraySet().ArraySet;
  	var base64VLQ = requireBase64Vlq();
  	var quickSort = requireQuickSort().quickSort;

  	function SourceMapConsumer(aSourceMap, aSourceMapURL) {
  	  var sourceMap = aSourceMap;
  	  if (typeof aSourceMap === 'string') {
  	    sourceMap = util.parseSourceMapInput(aSourceMap);
  	  }

  	  return sourceMap.sections != null
  	    ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
  	    : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
  	}

  	SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
  	  return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
  	};

  	/**
  	 * The version of the source mapping spec that we are consuming.
  	 */
  	SourceMapConsumer.prototype._version = 3;

  	// `__generatedMappings` and `__originalMappings` are arrays that hold the
  	// parsed mapping coordinates from the source map's "mappings" attribute. They
  	// are lazily instantiated, accessed via the `_generatedMappings` and
  	// `_originalMappings` getters respectively, and we only parse the mappings
  	// and create these arrays once queried for a source location. We jump through
  	// these hoops because there can be many thousands of mappings, and parsing
  	// them is expensive, so we only want to do it if we must.
  	//
  	// Each object in the arrays is of the form:
  	//
  	//     {
  	//       generatedLine: The line number in the generated code,
  	//       generatedColumn: The column number in the generated code,
  	//       source: The path to the original source file that generated this
  	//               chunk of code,
  	//       originalLine: The line number in the original source that
  	//                     corresponds to this chunk of generated code,
  	//       originalColumn: The column number in the original source that
  	//                       corresponds to this chunk of generated code,
  	//       name: The name of the original symbol which generated this chunk of
  	//             code.
  	//     }
  	//
  	// All properties except for `generatedLine` and `generatedColumn` can be
  	// `null`.
  	//
  	// `_generatedMappings` is ordered by the generated positions.
  	//
  	// `_originalMappings` is ordered by the original positions.

  	SourceMapConsumer.prototype.__generatedMappings = null;
  	Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
  	  configurable: true,
  	  enumerable: true,
  	  get: function () {
  	    if (!this.__generatedMappings) {
  	      this._parseMappings(this._mappings, this.sourceRoot);
  	    }

  	    return this.__generatedMappings;
  	  }
  	});

  	SourceMapConsumer.prototype.__originalMappings = null;
  	Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
  	  configurable: true,
  	  enumerable: true,
  	  get: function () {
  	    if (!this.__originalMappings) {
  	      this._parseMappings(this._mappings, this.sourceRoot);
  	    }

  	    return this.__originalMappings;
  	  }
  	});

  	SourceMapConsumer.prototype._charIsMappingSeparator =
  	  function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
  	    var c = aStr.charAt(index);
  	    return c === ";" || c === ",";
  	  };

  	/**
  	 * Parse the mappings in a string in to a data structure which we can easily
  	 * query (the ordered arrays in the `this.__generatedMappings` and
  	 * `this.__originalMappings` properties).
  	 */
  	SourceMapConsumer.prototype._parseMappings =
  	  function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  	    throw new Error("Subclasses must implement _parseMappings");
  	  };

  	SourceMapConsumer.GENERATED_ORDER = 1;
  	SourceMapConsumer.ORIGINAL_ORDER = 2;

  	SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
  	SourceMapConsumer.LEAST_UPPER_BOUND = 2;

  	/**
  	 * Iterate over each mapping between an original source/line/column and a
  	 * generated line/column in this source map.
  	 *
  	 * @param Function aCallback
  	 *        The function that is called with each mapping.
  	 * @param Object aContext
  	 *        Optional. If specified, this object will be the value of `this` every
  	 *        time that `aCallback` is called.
  	 * @param aOrder
  	 *        Either `SourceMapConsumer.GENERATED_ORDER` or
  	 *        `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
  	 *        iterate over the mappings sorted by the generated file's line/column
  	 *        order or the original's source/line/column order, respectively. Defaults to
  	 *        `SourceMapConsumer.GENERATED_ORDER`.
  	 */
  	SourceMapConsumer.prototype.eachMapping =
  	  function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
  	    var context = aContext || null;
  	    var order = aOrder || SourceMapConsumer.GENERATED_ORDER;

  	    var mappings;
  	    switch (order) {
  	    case SourceMapConsumer.GENERATED_ORDER:
  	      mappings = this._generatedMappings;
  	      break;
  	    case SourceMapConsumer.ORIGINAL_ORDER:
  	      mappings = this._originalMappings;
  	      break;
  	    default:
  	      throw new Error("Unknown order of iteration.");
  	    }

  	    var sourceRoot = this.sourceRoot;
  	    mappings.map(function (mapping) {
  	      var source = mapping.source === null ? null : this._sources.at(mapping.source);
  	      source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
  	      return {
  	        source: source,
  	        generatedLine: mapping.generatedLine,
  	        generatedColumn: mapping.generatedColumn,
  	        originalLine: mapping.originalLine,
  	        originalColumn: mapping.originalColumn,
  	        name: mapping.name === null ? null : this._names.at(mapping.name)
  	      };
  	    }, this).forEach(aCallback, context);
  	  };

  	/**
  	 * Returns all generated line and column information for the original source,
  	 * line, and column provided. If no column is provided, returns all mappings
  	 * corresponding to a either the line we are searching for or the next
  	 * closest line that has any mappings. Otherwise, returns all mappings
  	 * corresponding to the given line and either the column we are searching for
  	 * or the next closest column that has any offsets.
  	 *
  	 * The only argument is an object with the following properties:
  	 *
  	 *   - source: The filename of the original source.
  	 *   - line: The line number in the original source.  The line number is 1-based.
  	 *   - column: Optional. the column number in the original source.
  	 *    The column number is 0-based.
  	 *
  	 * and an array of objects is returned, each with the following properties:
  	 *
  	 *   - line: The line number in the generated source, or null.  The
  	 *    line number is 1-based.
  	 *   - column: The column number in the generated source, or null.
  	 *    The column number is 0-based.
  	 */
  	SourceMapConsumer.prototype.allGeneratedPositionsFor =
  	  function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
  	    var line = util.getArg(aArgs, 'line');

  	    // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
  	    // returns the index of the closest mapping less than the needle. By
  	    // setting needle.originalColumn to 0, we thus find the last mapping for
  	    // the given line, provided such a mapping exists.
  	    var needle = {
  	      source: util.getArg(aArgs, 'source'),
  	      originalLine: line,
  	      originalColumn: util.getArg(aArgs, 'column', 0)
  	    };

  	    needle.source = this._findSourceIndex(needle.source);
  	    if (needle.source < 0) {
  	      return [];
  	    }

  	    var mappings = [];

  	    var index = this._findMapping(needle,
  	                                  this._originalMappings,
  	                                  "originalLine",
  	                                  "originalColumn",
  	                                  util.compareByOriginalPositions,
  	                                  binarySearch.LEAST_UPPER_BOUND);
  	    if (index >= 0) {
  	      var mapping = this._originalMappings[index];

  	      if (aArgs.column === undefined) {
  	        var originalLine = mapping.originalLine;

  	        // Iterate until either we run out of mappings, or we run into
  	        // a mapping for a different line than the one we found. Since
  	        // mappings are sorted, this is guaranteed to find all mappings for
  	        // the line we found.
  	        while (mapping && mapping.originalLine === originalLine) {
  	          mappings.push({
  	            line: util.getArg(mapping, 'generatedLine', null),
  	            column: util.getArg(mapping, 'generatedColumn', null),
  	            lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  	          });

  	          mapping = this._originalMappings[++index];
  	        }
  	      } else {
  	        var originalColumn = mapping.originalColumn;

  	        // Iterate until either we run out of mappings, or we run into
  	        // a mapping for a different line than the one we were searching for.
  	        // Since mappings are sorted, this is guaranteed to find all mappings for
  	        // the line we are searching for.
  	        while (mapping &&
  	               mapping.originalLine === line &&
  	               mapping.originalColumn == originalColumn) {
  	          mappings.push({
  	            line: util.getArg(mapping, 'generatedLine', null),
  	            column: util.getArg(mapping, 'generatedColumn', null),
  	            lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  	          });

  	          mapping = this._originalMappings[++index];
  	        }
  	      }
  	    }

  	    return mappings;
  	  };

  	sourceMapConsumer.SourceMapConsumer = SourceMapConsumer;

  	/**
  	 * A BasicSourceMapConsumer instance represents a parsed source map which we can
  	 * query for information about the original file positions by giving it a file
  	 * position in the generated source.
  	 *
  	 * The first parameter is the raw source map (either as a JSON string, or
  	 * already parsed to an object). According to the spec, source maps have the
  	 * following attributes:
  	 *
  	 *   - version: Which version of the source map spec this map is following.
  	 *   - sources: An array of URLs to the original source files.
  	 *   - names: An array of identifiers which can be referrenced by individual mappings.
  	 *   - sourceRoot: Optional. The URL root from which all sources are relative.
  	 *   - sourcesContent: Optional. An array of contents of the original source files.
  	 *   - mappings: A string of base64 VLQs which contain the actual mappings.
  	 *   - file: Optional. The generated file this source map is associated with.
  	 *
  	 * Here is an example source map, taken from the source map spec[0]:
  	 *
  	 *     {
  	 *       version : 3,
  	 *       file: "out.js",
  	 *       sourceRoot : "",
  	 *       sources: ["foo.js", "bar.js"],
  	 *       names: ["src", "maps", "are", "fun"],
  	 *       mappings: "AA,AB;;ABCDE;"
  	 *     }
  	 *
  	 * The second parameter, if given, is a string whose value is the URL
  	 * at which the source map was found.  This URL is used to compute the
  	 * sources array.
  	 *
  	 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
  	 */
  	function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
  	  var sourceMap = aSourceMap;
  	  if (typeof aSourceMap === 'string') {
  	    sourceMap = util.parseSourceMapInput(aSourceMap);
  	  }

  	  var version = util.getArg(sourceMap, 'version');
  	  var sources = util.getArg(sourceMap, 'sources');
  	  // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  	  // requires the array) to play nice here.
  	  var names = util.getArg(sourceMap, 'names', []);
  	  var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
  	  var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
  	  var mappings = util.getArg(sourceMap, 'mappings');
  	  var file = util.getArg(sourceMap, 'file', null);

  	  // Once again, Sass deviates from the spec and supplies the version as a
  	  // string rather than a number, so we use loose equality checking here.
  	  if (version != this._version) {
  	    throw new Error('Unsupported version: ' + version);
  	  }

  	  if (sourceRoot) {
  	    sourceRoot = util.normalize(sourceRoot);
  	  }

  	  sources = sources
  	    .map(String)
  	    // Some source maps produce relative source paths like "./foo.js" instead of
  	    // "foo.js".  Normalize these first so that future comparisons will succeed.
  	    // See bugzil.la/1090768.
  	    .map(util.normalize)
  	    // Always ensure that absolute sources are internally stored relative to
  	    // the source root, if the source root is absolute. Not doing this would
  	    // be particularly problematic when the source root is a prefix of the
  	    // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
  	    .map(function (source) {
  	      return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
  	        ? util.relative(sourceRoot, source)
  	        : source;
  	    });

  	  // Pass `true` below to allow duplicate names and sources. While source maps
  	  // are intended to be compressed and deduplicated, the TypeScript compiler
  	  // sometimes generates source maps with duplicates in them. See Github issue
  	  // #72 and bugzil.la/889492.
  	  this._names = ArraySet.fromArray(names.map(String), true);
  	  this._sources = ArraySet.fromArray(sources, true);

  	  this._absoluteSources = this._sources.toArray().map(function (s) {
  	    return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
  	  });

  	  this.sourceRoot = sourceRoot;
  	  this.sourcesContent = sourcesContent;
  	  this._mappings = mappings;
  	  this._sourceMapURL = aSourceMapURL;
  	  this.file = file;
  	}

  	BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  	BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;

  	/**
  	 * Utility function to find the index of a source.  Returns -1 if not
  	 * found.
  	 */
  	BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
  	  var relativeSource = aSource;
  	  if (this.sourceRoot != null) {
  	    relativeSource = util.relative(this.sourceRoot, relativeSource);
  	  }

  	  if (this._sources.has(relativeSource)) {
  	    return this._sources.indexOf(relativeSource);
  	  }

  	  // Maybe aSource is an absolute URL as returned by |sources|.  In
  	  // this case we can't simply undo the transform.
  	  var i;
  	  for (i = 0; i < this._absoluteSources.length; ++i) {
  	    if (this._absoluteSources[i] == aSource) {
  	      return i;
  	    }
  	  }

  	  return -1;
  	};

  	/**
  	 * Create a BasicSourceMapConsumer from a SourceMapGenerator.
  	 *
  	 * @param SourceMapGenerator aSourceMap
  	 *        The source map that will be consumed.
  	 * @param String aSourceMapURL
  	 *        The URL at which the source map can be found (optional)
  	 * @returns BasicSourceMapConsumer
  	 */
  	BasicSourceMapConsumer.fromSourceMap =
  	  function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
  	    var smc = Object.create(BasicSourceMapConsumer.prototype);

  	    var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
  	    var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
  	    smc.sourceRoot = aSourceMap._sourceRoot;
  	    smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
  	                                                            smc.sourceRoot);
  	    smc.file = aSourceMap._file;
  	    smc._sourceMapURL = aSourceMapURL;
  	    smc._absoluteSources = smc._sources.toArray().map(function (s) {
  	      return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
  	    });

  	    // Because we are modifying the entries (by converting string sources and
  	    // names to indices into the sources and names ArraySets), we have to make
  	    // a copy of the entry or else bad things happen. Shared mutable state
  	    // strikes again! See github issue #191.

  	    var generatedMappings = aSourceMap._mappings.toArray().slice();
  	    var destGeneratedMappings = smc.__generatedMappings = [];
  	    var destOriginalMappings = smc.__originalMappings = [];

  	    for (var i = 0, length = generatedMappings.length; i < length; i++) {
  	      var srcMapping = generatedMappings[i];
  	      var destMapping = new Mapping;
  	      destMapping.generatedLine = srcMapping.generatedLine;
  	      destMapping.generatedColumn = srcMapping.generatedColumn;

  	      if (srcMapping.source) {
  	        destMapping.source = sources.indexOf(srcMapping.source);
  	        destMapping.originalLine = srcMapping.originalLine;
  	        destMapping.originalColumn = srcMapping.originalColumn;

  	        if (srcMapping.name) {
  	          destMapping.name = names.indexOf(srcMapping.name);
  	        }

  	        destOriginalMappings.push(destMapping);
  	      }

  	      destGeneratedMappings.push(destMapping);
  	    }

  	    quickSort(smc.__originalMappings, util.compareByOriginalPositions);

  	    return smc;
  	  };

  	/**
  	 * The version of the source mapping spec that we are consuming.
  	 */
  	BasicSourceMapConsumer.prototype._version = 3;

  	/**
  	 * The list of original sources.
  	 */
  	Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
  	  get: function () {
  	    return this._absoluteSources.slice();
  	  }
  	});

  	/**
  	 * Provide the JIT with a nice shape / hidden class.
  	 */
  	function Mapping() {
  	  this.generatedLine = 0;
  	  this.generatedColumn = 0;
  	  this.source = null;
  	  this.originalLine = null;
  	  this.originalColumn = null;
  	  this.name = null;
  	}

  	/**
  	 * Parse the mappings in a string in to a data structure which we can easily
  	 * query (the ordered arrays in the `this.__generatedMappings` and
  	 * `this.__originalMappings` properties).
  	 */
  	BasicSourceMapConsumer.prototype._parseMappings =
  	  function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  	    var generatedLine = 1;
  	    var previousGeneratedColumn = 0;
  	    var previousOriginalLine = 0;
  	    var previousOriginalColumn = 0;
  	    var previousSource = 0;
  	    var previousName = 0;
  	    var length = aStr.length;
  	    var index = 0;
  	    var cachedSegments = {};
  	    var temp = {};
  	    var originalMappings = [];
  	    var generatedMappings = [];
  	    var mapping, str, segment, end, value;

  	    while (index < length) {
  	      if (aStr.charAt(index) === ';') {
  	        generatedLine++;
  	        index++;
  	        previousGeneratedColumn = 0;
  	      }
  	      else if (aStr.charAt(index) === ',') {
  	        index++;
  	      }
  	      else {
  	        mapping = new Mapping();
  	        mapping.generatedLine = generatedLine;

  	        // Because each offset is encoded relative to the previous one,
  	        // many segments often have the same encoding. We can exploit this
  	        // fact by caching the parsed variable length fields of each segment,
  	        // allowing us to avoid a second parse if we encounter the same
  	        // segment again.
  	        for (end = index; end < length; end++) {
  	          if (this._charIsMappingSeparator(aStr, end)) {
  	            break;
  	          }
  	        }
  	        str = aStr.slice(index, end);

  	        segment = cachedSegments[str];
  	        if (segment) {
  	          index += str.length;
  	        } else {
  	          segment = [];
  	          while (index < end) {
  	            base64VLQ.decode(aStr, index, temp);
  	            value = temp.value;
  	            index = temp.rest;
  	            segment.push(value);
  	          }

  	          if (segment.length === 2) {
  	            throw new Error('Found a source, but no line and column');
  	          }

  	          if (segment.length === 3) {
  	            throw new Error('Found a source and line, but no column');
  	          }

  	          cachedSegments[str] = segment;
  	        }

  	        // Generated column.
  	        mapping.generatedColumn = previousGeneratedColumn + segment[0];
  	        previousGeneratedColumn = mapping.generatedColumn;

  	        if (segment.length > 1) {
  	          // Original source.
  	          mapping.source = previousSource + segment[1];
  	          previousSource += segment[1];

  	          // Original line.
  	          mapping.originalLine = previousOriginalLine + segment[2];
  	          previousOriginalLine = mapping.originalLine;
  	          // Lines are stored 0-based
  	          mapping.originalLine += 1;

  	          // Original column.
  	          mapping.originalColumn = previousOriginalColumn + segment[3];
  	          previousOriginalColumn = mapping.originalColumn;

  	          if (segment.length > 4) {
  	            // Original name.
  	            mapping.name = previousName + segment[4];
  	            previousName += segment[4];
  	          }
  	        }

  	        generatedMappings.push(mapping);
  	        if (typeof mapping.originalLine === 'number') {
  	          originalMappings.push(mapping);
  	        }
  	      }
  	    }

  	    quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
  	    this.__generatedMappings = generatedMappings;

  	    quickSort(originalMappings, util.compareByOriginalPositions);
  	    this.__originalMappings = originalMappings;
  	  };

  	/**
  	 * Find the mapping that best matches the hypothetical "needle" mapping that
  	 * we are searching for in the given "haystack" of mappings.
  	 */
  	BasicSourceMapConsumer.prototype._findMapping =
  	  function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
  	                                         aColumnName, aComparator, aBias) {
  	    // To return the position we are searching for, we must first find the
  	    // mapping for the given position and then return the opposite position it
  	    // points to. Because the mappings are sorted, we can use binary search to
  	    // find the best mapping.

  	    if (aNeedle[aLineName] <= 0) {
  	      throw new TypeError('Line must be greater than or equal to 1, got '
  	                          + aNeedle[aLineName]);
  	    }
  	    if (aNeedle[aColumnName] < 0) {
  	      throw new TypeError('Column must be greater than or equal to 0, got '
  	                          + aNeedle[aColumnName]);
  	    }

  	    return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
  	  };

  	/**
  	 * Compute the last column for each generated mapping. The last column is
  	 * inclusive.
  	 */
  	BasicSourceMapConsumer.prototype.computeColumnSpans =
  	  function SourceMapConsumer_computeColumnSpans() {
  	    for (var index = 0; index < this._generatedMappings.length; ++index) {
  	      var mapping = this._generatedMappings[index];

  	      // Mappings do not contain a field for the last generated columnt. We
  	      // can come up with an optimistic estimate, however, by assuming that
  	      // mappings are contiguous (i.e. given two consecutive mappings, the
  	      // first mapping ends where the second one starts).
  	      if (index + 1 < this._generatedMappings.length) {
  	        var nextMapping = this._generatedMappings[index + 1];

  	        if (mapping.generatedLine === nextMapping.generatedLine) {
  	          mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
  	          continue;
  	        }
  	      }

  	      // The last mapping for each line spans the entire line.
  	      mapping.lastGeneratedColumn = Infinity;
  	    }
  	  };

  	/**
  	 * Returns the original source, line, and column information for the generated
  	 * source's line and column positions provided. The only argument is an object
  	 * with the following properties:
  	 *
  	 *   - line: The line number in the generated source.  The line number
  	 *     is 1-based.
  	 *   - column: The column number in the generated source.  The column
  	 *     number is 0-based.
  	 *   - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  	 *     'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  	 *     closest element that is smaller than or greater than the one we are
  	 *     searching for, respectively, if the exact element cannot be found.
  	 *     Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  	 *
  	 * and an object is returned with the following properties:
  	 *
  	 *   - source: The original source file, or null.
  	 *   - line: The line number in the original source, or null.  The
  	 *     line number is 1-based.
  	 *   - column: The column number in the original source, or null.  The
  	 *     column number is 0-based.
  	 *   - name: The original identifier, or null.
  	 */
  	BasicSourceMapConsumer.prototype.originalPositionFor =
  	  function SourceMapConsumer_originalPositionFor(aArgs) {
  	    var needle = {
  	      generatedLine: util.getArg(aArgs, 'line'),
  	      generatedColumn: util.getArg(aArgs, 'column')
  	    };

  	    var index = this._findMapping(
  	      needle,
  	      this._generatedMappings,
  	      "generatedLine",
  	      "generatedColumn",
  	      util.compareByGeneratedPositionsDeflated,
  	      util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
  	    );

  	    if (index >= 0) {
  	      var mapping = this._generatedMappings[index];

  	      if (mapping.generatedLine === needle.generatedLine) {
  	        var source = util.getArg(mapping, 'source', null);
  	        if (source !== null) {
  	          source = this._sources.at(source);
  	          source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
  	        }
  	        var name = util.getArg(mapping, 'name', null);
  	        if (name !== null) {
  	          name = this._names.at(name);
  	        }
  	        return {
  	          source: source,
  	          line: util.getArg(mapping, 'originalLine', null),
  	          column: util.getArg(mapping, 'originalColumn', null),
  	          name: name
  	        };
  	      }
  	    }

  	    return {
  	      source: null,
  	      line: null,
  	      column: null,
  	      name: null
  	    };
  	  };

  	/**
  	 * Return true if we have the source content for every source in the source
  	 * map, false otherwise.
  	 */
  	BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
  	  function BasicSourceMapConsumer_hasContentsOfAllSources() {
  	    if (!this.sourcesContent) {
  	      return false;
  	    }
  	    return this.sourcesContent.length >= this._sources.size() &&
  	      !this.sourcesContent.some(function (sc) { return sc == null; });
  	  };

  	/**
  	 * Returns the original source content. The only argument is the url of the
  	 * original source file. Returns null if no original source content is
  	 * available.
  	 */
  	BasicSourceMapConsumer.prototype.sourceContentFor =
  	  function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  	    if (!this.sourcesContent) {
  	      return null;
  	    }

  	    var index = this._findSourceIndex(aSource);
  	    if (index >= 0) {
  	      return this.sourcesContent[index];
  	    }

  	    var relativeSource = aSource;
  	    if (this.sourceRoot != null) {
  	      relativeSource = util.relative(this.sourceRoot, relativeSource);
  	    }

  	    var url;
  	    if (this.sourceRoot != null
  	        && (url = util.urlParse(this.sourceRoot))) {
  	      // XXX: file:// URIs and absolute paths lead to unexpected behavior for
  	      // many users. We can help them out when they expect file:// URIs to
  	      // behave like it would if they were running a local HTTP server. See
  	      // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
  	      var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
  	      if (url.scheme == "file"
  	          && this._sources.has(fileUriAbsPath)) {
  	        return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
  	      }

  	      if ((!url.path || url.path == "/")
  	          && this._sources.has("/" + relativeSource)) {
  	        return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
  	      }
  	    }

  	    // This function is used recursively from
  	    // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
  	    // don't want to throw if we can't find the source - we just want to
  	    // return null, so we provide a flag to exit gracefully.
  	    if (nullOnMissing) {
  	      return null;
  	    }
  	    else {
  	      throw new Error('"' + relativeSource + '" is not in the SourceMap.');
  	    }
  	  };

  	/**
  	 * Returns the generated line and column information for the original source,
  	 * line, and column positions provided. The only argument is an object with
  	 * the following properties:
  	 *
  	 *   - source: The filename of the original source.
  	 *   - line: The line number in the original source.  The line number
  	 *     is 1-based.
  	 *   - column: The column number in the original source.  The column
  	 *     number is 0-based.
  	 *   - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  	 *     'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  	 *     closest element that is smaller than or greater than the one we are
  	 *     searching for, respectively, if the exact element cannot be found.
  	 *     Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  	 *
  	 * and an object is returned with the following properties:
  	 *
  	 *   - line: The line number in the generated source, or null.  The
  	 *     line number is 1-based.
  	 *   - column: The column number in the generated source, or null.
  	 *     The column number is 0-based.
  	 */
  	BasicSourceMapConsumer.prototype.generatedPositionFor =
  	  function SourceMapConsumer_generatedPositionFor(aArgs) {
  	    var source = util.getArg(aArgs, 'source');
  	    source = this._findSourceIndex(source);
  	    if (source < 0) {
  	      return {
  	        line: null,
  	        column: null,
  	        lastColumn: null
  	      };
  	    }

  	    var needle = {
  	      source: source,
  	      originalLine: util.getArg(aArgs, 'line'),
  	      originalColumn: util.getArg(aArgs, 'column')
  	    };

  	    var index = this._findMapping(
  	      needle,
  	      this._originalMappings,
  	      "originalLine",
  	      "originalColumn",
  	      util.compareByOriginalPositions,
  	      util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
  	    );

  	    if (index >= 0) {
  	      var mapping = this._originalMappings[index];

  	      if (mapping.source === needle.source) {
  	        return {
  	          line: util.getArg(mapping, 'generatedLine', null),
  	          column: util.getArg(mapping, 'generatedColumn', null),
  	          lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  	        };
  	      }
  	    }

  	    return {
  	      line: null,
  	      column: null,
  	      lastColumn: null
  	    };
  	  };

  	sourceMapConsumer.BasicSourceMapConsumer = BasicSourceMapConsumer;

  	/**
  	 * An IndexedSourceMapConsumer instance represents a parsed source map which
  	 * we can query for information. It differs from BasicSourceMapConsumer in
  	 * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
  	 * input.
  	 *
  	 * The first parameter is a raw source map (either as a JSON string, or already
  	 * parsed to an object). According to the spec for indexed source maps, they
  	 * have the following attributes:
  	 *
  	 *   - version: Which version of the source map spec this map is following.
  	 *   - file: Optional. The generated file this source map is associated with.
  	 *   - sections: A list of section definitions.
  	 *
  	 * Each value under the "sections" field has two fields:
  	 *   - offset: The offset into the original specified at which this section
  	 *       begins to apply, defined as an object with a "line" and "column"
  	 *       field.
  	 *   - map: A source map definition. This source map could also be indexed,
  	 *       but doesn't have to be.
  	 *
  	 * Instead of the "map" field, it's also possible to have a "url" field
  	 * specifying a URL to retrieve a source map from, but that's currently
  	 * unsupported.
  	 *
  	 * Here's an example source map, taken from the source map spec[0], but
  	 * modified to omit a section which uses the "url" field.
  	 *
  	 *  {
  	 *    version : 3,
  	 *    file: "app.js",
  	 *    sections: [{
  	 *      offset: {line:100, column:10},
  	 *      map: {
  	 *        version : 3,
  	 *        file: "section.js",
  	 *        sources: ["foo.js", "bar.js"],
  	 *        names: ["src", "maps", "are", "fun"],
  	 *        mappings: "AAAA,E;;ABCDE;"
  	 *      }
  	 *    }],
  	 *  }
  	 *
  	 * The second parameter, if given, is a string whose value is the URL
  	 * at which the source map was found.  This URL is used to compute the
  	 * sources array.
  	 *
  	 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
  	 */
  	function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
  	  var sourceMap = aSourceMap;
  	  if (typeof aSourceMap === 'string') {
  	    sourceMap = util.parseSourceMapInput(aSourceMap);
  	  }

  	  var version = util.getArg(sourceMap, 'version');
  	  var sections = util.getArg(sourceMap, 'sections');

  	  if (version != this._version) {
  	    throw new Error('Unsupported version: ' + version);
  	  }

  	  this._sources = new ArraySet();
  	  this._names = new ArraySet();

  	  var lastOffset = {
  	    line: -1,
  	    column: 0
  	  };
  	  this._sections = sections.map(function (s) {
  	    if (s.url) {
  	      // The url field will require support for asynchronicity.
  	      // See https://github.com/mozilla/source-map/issues/16
  	      throw new Error('Support for url field in sections not implemented.');
  	    }
  	    var offset = util.getArg(s, 'offset');
  	    var offsetLine = util.getArg(offset, 'line');
  	    var offsetColumn = util.getArg(offset, 'column');

  	    if (offsetLine < lastOffset.line ||
  	        (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
  	      throw new Error('Section offsets must be ordered and non-overlapping.');
  	    }
  	    lastOffset = offset;

  	    return {
  	      generatedOffset: {
  	        // The offset fields are 0-based, but we use 1-based indices when
  	        // encoding/decoding from VLQ.
  	        generatedLine: offsetLine + 1,
  	        generatedColumn: offsetColumn + 1
  	      },
  	      consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
  	    }
  	  });
  	}

  	IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  	IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;

  	/**
  	 * The version of the source mapping spec that we are consuming.
  	 */
  	IndexedSourceMapConsumer.prototype._version = 3;

  	/**
  	 * The list of original sources.
  	 */
  	Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
  	  get: function () {
  	    var sources = [];
  	    for (var i = 0; i < this._sections.length; i++) {
  	      for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
  	        sources.push(this._sections[i].consumer.sources[j]);
  	      }
  	    }
  	    return sources;
  	  }
  	});

  	/**
  	 * Returns the original source, line, and column information for the generated
  	 * source's line and column positions provided. The only argument is an object
  	 * with the following properties:
  	 *
  	 *   - line: The line number in the generated source.  The line number
  	 *     is 1-based.
  	 *   - column: The column number in the generated source.  The column
  	 *     number is 0-based.
  	 *
  	 * and an object is returned with the following properties:
  	 *
  	 *   - source: The original source file, or null.
  	 *   - line: The line number in the original source, or null.  The
  	 *     line number is 1-based.
  	 *   - column: The column number in the original source, or null.  The
  	 *     column number is 0-based.
  	 *   - name: The original identifier, or null.
  	 */
  	IndexedSourceMapConsumer.prototype.originalPositionFor =
  	  function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
  	    var needle = {
  	      generatedLine: util.getArg(aArgs, 'line'),
  	      generatedColumn: util.getArg(aArgs, 'column')
  	    };

  	    // Find the section containing the generated position we're trying to map
  	    // to an original position.
  	    var sectionIndex = binarySearch.search(needle, this._sections,
  	      function(needle, section) {
  	        var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
  	        if (cmp) {
  	          return cmp;
  	        }

  	        return (needle.generatedColumn -
  	                section.generatedOffset.generatedColumn);
  	      });
  	    var section = this._sections[sectionIndex];

  	    if (!section) {
  	      return {
  	        source: null,
  	        line: null,
  	        column: null,
  	        name: null
  	      };
  	    }

  	    return section.consumer.originalPositionFor({
  	      line: needle.generatedLine -
  	        (section.generatedOffset.generatedLine - 1),
  	      column: needle.generatedColumn -
  	        (section.generatedOffset.generatedLine === needle.generatedLine
  	         ? section.generatedOffset.generatedColumn - 1
  	         : 0),
  	      bias: aArgs.bias
  	    });
  	  };

  	/**
  	 * Return true if we have the source content for every source in the source
  	 * map, false otherwise.
  	 */
  	IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
  	  function IndexedSourceMapConsumer_hasContentsOfAllSources() {
  	    return this._sections.every(function (s) {
  	      return s.consumer.hasContentsOfAllSources();
  	    });
  	  };

  	/**
  	 * Returns the original source content. The only argument is the url of the
  	 * original source file. Returns null if no original source content is
  	 * available.
  	 */
  	IndexedSourceMapConsumer.prototype.sourceContentFor =
  	  function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  	    for (var i = 0; i < this._sections.length; i++) {
  	      var section = this._sections[i];

  	      var content = section.consumer.sourceContentFor(aSource, true);
  	      if (content) {
  	        return content;
  	      }
  	    }
  	    if (nullOnMissing) {
  	      return null;
  	    }
  	    else {
  	      throw new Error('"' + aSource + '" is not in the SourceMap.');
  	    }
  	  };

  	/**
  	 * Returns the generated line and column information for the original source,
  	 * line, and column positions provided. The only argument is an object with
  	 * the following properties:
  	 *
  	 *   - source: The filename of the original source.
  	 *   - line: The line number in the original source.  The line number
  	 *     is 1-based.
  	 *   - column: The column number in the original source.  The column
  	 *     number is 0-based.
  	 *
  	 * and an object is returned with the following properties:
  	 *
  	 *   - line: The line number in the generated source, or null.  The
  	 *     line number is 1-based. 
  	 *   - column: The column number in the generated source, or null.
  	 *     The column number is 0-based.
  	 */
  	IndexedSourceMapConsumer.prototype.generatedPositionFor =
  	  function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
  	    for (var i = 0; i < this._sections.length; i++) {
  	      var section = this._sections[i];

  	      // Only consider this section if the requested source is in the list of
  	      // sources of the consumer.
  	      if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
  	        continue;
  	      }
  	      var generatedPosition = section.consumer.generatedPositionFor(aArgs);
  	      if (generatedPosition) {
  	        var ret = {
  	          line: generatedPosition.line +
  	            (section.generatedOffset.generatedLine - 1),
  	          column: generatedPosition.column +
  	            (section.generatedOffset.generatedLine === generatedPosition.line
  	             ? section.generatedOffset.generatedColumn - 1
  	             : 0)
  	        };
  	        return ret;
  	      }
  	    }

  	    return {
  	      line: null,
  	      column: null
  	    };
  	  };

  	/**
  	 * Parse the mappings in a string in to a data structure which we can easily
  	 * query (the ordered arrays in the `this.__generatedMappings` and
  	 * `this.__originalMappings` properties).
  	 */
  	IndexedSourceMapConsumer.prototype._parseMappings =
  	  function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  	    this.__generatedMappings = [];
  	    this.__originalMappings = [];
  	    for (var i = 0; i < this._sections.length; i++) {
  	      var section = this._sections[i];
  	      var sectionMappings = section.consumer._generatedMappings;
  	      for (var j = 0; j < sectionMappings.length; j++) {
  	        var mapping = sectionMappings[j];

  	        var source = section.consumer._sources.at(mapping.source);
  	        source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
  	        this._sources.add(source);
  	        source = this._sources.indexOf(source);

  	        var name = null;
  	        if (mapping.name) {
  	          name = section.consumer._names.at(mapping.name);
  	          this._names.add(name);
  	          name = this._names.indexOf(name);
  	        }

  	        // The mappings coming from the consumer for the section have
  	        // generated positions relative to the start of the section, so we
  	        // need to offset them to be relative to the start of the concatenated
  	        // generated file.
  	        var adjustedMapping = {
  	          source: source,
  	          generatedLine: mapping.generatedLine +
  	            (section.generatedOffset.generatedLine - 1),
  	          generatedColumn: mapping.generatedColumn +
  	            (section.generatedOffset.generatedLine === mapping.generatedLine
  	            ? section.generatedOffset.generatedColumn - 1
  	            : 0),
  	          originalLine: mapping.originalLine,
  	          originalColumn: mapping.originalColumn,
  	          name: name
  	        };

  	        this.__generatedMappings.push(adjustedMapping);
  	        if (typeof adjustedMapping.originalLine === 'number') {
  	          this.__originalMappings.push(adjustedMapping);
  	        }
  	      }
  	    }

  	    quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
  	    quickSort(this.__originalMappings, util.compareByOriginalPositions);
  	  };

  	sourceMapConsumer.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
  	return sourceMapConsumer;
  }

  var sourceNode = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  var hasRequiredSourceNode;

  function requireSourceNode () {
  	if (hasRequiredSourceNode) return sourceNode;
  	hasRequiredSourceNode = 1;
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	var SourceMapGenerator = requireSourceMapGenerator().SourceMapGenerator;
  	var util = requireUtil();

  	// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
  	// operating systems these days (capturing the result).
  	var REGEX_NEWLINE = /(\r?\n)/;

  	// Newline character code for charCodeAt() comparisons
  	var NEWLINE_CODE = 10;

  	// Private symbol for identifying `SourceNode`s when multiple versions of
  	// the source-map library are loaded. This MUST NOT CHANGE across
  	// versions!
  	var isSourceNode = "$$$isSourceNode$$$";

  	/**
  	 * SourceNodes provide a way to abstract over interpolating/concatenating
  	 * snippets of generated JavaScript source code while maintaining the line and
  	 * column information associated with the original source code.
  	 *
  	 * @param aLine The original line number.
  	 * @param aColumn The original column number.
  	 * @param aSource The original source's filename.
  	 * @param aChunks Optional. An array of strings which are snippets of
  	 *        generated JS, or other SourceNodes.
  	 * @param aName The original identifier.
  	 */
  	function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
  	  this.children = [];
  	  this.sourceContents = {};
  	  this.line = aLine == null ? null : aLine;
  	  this.column = aColumn == null ? null : aColumn;
  	  this.source = aSource == null ? null : aSource;
  	  this.name = aName == null ? null : aName;
  	  this[isSourceNode] = true;
  	  if (aChunks != null) this.add(aChunks);
  	}

  	/**
  	 * Creates a SourceNode from generated code and a SourceMapConsumer.
  	 *
  	 * @param aGeneratedCode The generated code
  	 * @param aSourceMapConsumer The SourceMap for the generated code
  	 * @param aRelativePath Optional. The path that relative sources in the
  	 *        SourceMapConsumer should be relative to.
  	 */
  	SourceNode.fromStringWithSourceMap =
  	  function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
  	    // The SourceNode we want to fill with the generated code
  	    // and the SourceMap
  	    var node = new SourceNode();

  	    // All even indices of this array are one line of the generated code,
  	    // while all odd indices are the newlines between two adjacent lines
  	    // (since `REGEX_NEWLINE` captures its match).
  	    // Processed fragments are accessed by calling `shiftNextLine`.
  	    var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
  	    var remainingLinesIndex = 0;
  	    var shiftNextLine = function() {
  	      var lineContents = getNextLine();
  	      // The last line of a file might not have a newline.
  	      var newLine = getNextLine() || "";
  	      return lineContents + newLine;

  	      function getNextLine() {
  	        return remainingLinesIndex < remainingLines.length ?
  	            remainingLines[remainingLinesIndex++] : undefined;
  	      }
  	    };

  	    // We need to remember the position of "remainingLines"
  	    var lastGeneratedLine = 1, lastGeneratedColumn = 0;

  	    // The generate SourceNodes we need a code range.
  	    // To extract it current and last mapping is used.
  	    // Here we store the last mapping.
  	    var lastMapping = null;

  	    aSourceMapConsumer.eachMapping(function (mapping) {
  	      if (lastMapping !== null) {
  	        // We add the code from "lastMapping" to "mapping":
  	        // First check if there is a new line in between.
  	        if (lastGeneratedLine < mapping.generatedLine) {
  	          // Associate first line with "lastMapping"
  	          addMappingWithCode(lastMapping, shiftNextLine());
  	          lastGeneratedLine++;
  	          lastGeneratedColumn = 0;
  	          // The remaining code is added without mapping
  	        } else {
  	          // There is no new line in between.
  	          // Associate the code between "lastGeneratedColumn" and
  	          // "mapping.generatedColumn" with "lastMapping"
  	          var nextLine = remainingLines[remainingLinesIndex] || '';
  	          var code = nextLine.substr(0, mapping.generatedColumn -
  	                                        lastGeneratedColumn);
  	          remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
  	                                              lastGeneratedColumn);
  	          lastGeneratedColumn = mapping.generatedColumn;
  	          addMappingWithCode(lastMapping, code);
  	          // No more remaining code, continue
  	          lastMapping = mapping;
  	          return;
  	        }
  	      }
  	      // We add the generated code until the first mapping
  	      // to the SourceNode without any mapping.
  	      // Each line is added as separate string.
  	      while (lastGeneratedLine < mapping.generatedLine) {
  	        node.add(shiftNextLine());
  	        lastGeneratedLine++;
  	      }
  	      if (lastGeneratedColumn < mapping.generatedColumn) {
  	        var nextLine = remainingLines[remainingLinesIndex] || '';
  	        node.add(nextLine.substr(0, mapping.generatedColumn));
  	        remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
  	        lastGeneratedColumn = mapping.generatedColumn;
  	      }
  	      lastMapping = mapping;
  	    }, this);
  	    // We have processed all mappings.
  	    if (remainingLinesIndex < remainingLines.length) {
  	      if (lastMapping) {
  	        // Associate the remaining code in the current line with "lastMapping"
  	        addMappingWithCode(lastMapping, shiftNextLine());
  	      }
  	      // and add the remaining lines without any mapping
  	      node.add(remainingLines.splice(remainingLinesIndex).join(""));
  	    }

  	    // Copy sourcesContent into SourceNode
  	    aSourceMapConsumer.sources.forEach(function (sourceFile) {
  	      var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  	      if (content != null) {
  	        if (aRelativePath != null) {
  	          sourceFile = util.join(aRelativePath, sourceFile);
  	        }
  	        node.setSourceContent(sourceFile, content);
  	      }
  	    });

  	    return node;

  	    function addMappingWithCode(mapping, code) {
  	      if (mapping === null || mapping.source === undefined) {
  	        node.add(code);
  	      } else {
  	        var source = aRelativePath
  	          ? util.join(aRelativePath, mapping.source)
  	          : mapping.source;
  	        node.add(new SourceNode(mapping.originalLine,
  	                                mapping.originalColumn,
  	                                source,
  	                                code,
  	                                mapping.name));
  	      }
  	    }
  	  };

  	/**
  	 * Add a chunk of generated JS to this source node.
  	 *
  	 * @param aChunk A string snippet of generated JS code, another instance of
  	 *        SourceNode, or an array where each member is one of those things.
  	 */
  	SourceNode.prototype.add = function SourceNode_add(aChunk) {
  	  if (Array.isArray(aChunk)) {
  	    aChunk.forEach(function (chunk) {
  	      this.add(chunk);
  	    }, this);
  	  }
  	  else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  	    if (aChunk) {
  	      this.children.push(aChunk);
  	    }
  	  }
  	  else {
  	    throw new TypeError(
  	      "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  	    );
  	  }
  	  return this;
  	};

  	/**
  	 * Add a chunk of generated JS to the beginning of this source node.
  	 *
  	 * @param aChunk A string snippet of generated JS code, another instance of
  	 *        SourceNode, or an array where each member is one of those things.
  	 */
  	SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
  	  if (Array.isArray(aChunk)) {
  	    for (var i = aChunk.length-1; i >= 0; i--) {
  	      this.prepend(aChunk[i]);
  	    }
  	  }
  	  else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  	    this.children.unshift(aChunk);
  	  }
  	  else {
  	    throw new TypeError(
  	      "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  	    );
  	  }
  	  return this;
  	};

  	/**
  	 * Walk over the tree of JS snippets in this node and its children. The
  	 * walking function is called once for each snippet of JS and is passed that
  	 * snippet and the its original associated source's line/column location.
  	 *
  	 * @param aFn The traversal function.
  	 */
  	SourceNode.prototype.walk = function SourceNode_walk(aFn) {
  	  var chunk;
  	  for (var i = 0, len = this.children.length; i < len; i++) {
  	    chunk = this.children[i];
  	    if (chunk[isSourceNode]) {
  	      chunk.walk(aFn);
  	    }
  	    else {
  	      if (chunk !== '') {
  	        aFn(chunk, { source: this.source,
  	                     line: this.line,
  	                     column: this.column,
  	                     name: this.name });
  	      }
  	    }
  	  }
  	};

  	/**
  	 * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
  	 * each of `this.children`.
  	 *
  	 * @param aSep The separator.
  	 */
  	SourceNode.prototype.join = function SourceNode_join(aSep) {
  	  var newChildren;
  	  var i;
  	  var len = this.children.length;
  	  if (len > 0) {
  	    newChildren = [];
  	    for (i = 0; i < len-1; i++) {
  	      newChildren.push(this.children[i]);
  	      newChildren.push(aSep);
  	    }
  	    newChildren.push(this.children[i]);
  	    this.children = newChildren;
  	  }
  	  return this;
  	};

  	/**
  	 * Call String.prototype.replace on the very right-most source snippet. Useful
  	 * for trimming whitespace from the end of a source node, etc.
  	 *
  	 * @param aPattern The pattern to replace.
  	 * @param aReplacement The thing to replace the pattern with.
  	 */
  	SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
  	  var lastChild = this.children[this.children.length - 1];
  	  if (lastChild[isSourceNode]) {
  	    lastChild.replaceRight(aPattern, aReplacement);
  	  }
  	  else if (typeof lastChild === 'string') {
  	    this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
  	  }
  	  else {
  	    this.children.push(''.replace(aPattern, aReplacement));
  	  }
  	  return this;
  	};

  	/**
  	 * Set the source content for a source file. This will be added to the SourceMapGenerator
  	 * in the sourcesContent field.
  	 *
  	 * @param aSourceFile The filename of the source file
  	 * @param aSourceContent The content of the source file
  	 */
  	SourceNode.prototype.setSourceContent =
  	  function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
  	    this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
  	  };

  	/**
  	 * Walk over the tree of SourceNodes. The walking function is called for each
  	 * source file content and is passed the filename and source content.
  	 *
  	 * @param aFn The traversal function.
  	 */
  	SourceNode.prototype.walkSourceContents =
  	  function SourceNode_walkSourceContents(aFn) {
  	    for (var i = 0, len = this.children.length; i < len; i++) {
  	      if (this.children[i][isSourceNode]) {
  	        this.children[i].walkSourceContents(aFn);
  	      }
  	    }

  	    var sources = Object.keys(this.sourceContents);
  	    for (var i = 0, len = sources.length; i < len; i++) {
  	      aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
  	    }
  	  };

  	/**
  	 * Return the string representation of this source node. Walks over the tree
  	 * and concatenates all the various snippets together to one string.
  	 */
  	SourceNode.prototype.toString = function SourceNode_toString() {
  	  var str = "";
  	  this.walk(function (chunk) {
  	    str += chunk;
  	  });
  	  return str;
  	};

  	/**
  	 * Returns the string representation of this source node along with a source
  	 * map.
  	 */
  	SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
  	  var generated = {
  	    code: "",
  	    line: 1,
  	    column: 0
  	  };
  	  var map = new SourceMapGenerator(aArgs);
  	  var sourceMappingActive = false;
  	  var lastOriginalSource = null;
  	  var lastOriginalLine = null;
  	  var lastOriginalColumn = null;
  	  var lastOriginalName = null;
  	  this.walk(function (chunk, original) {
  	    generated.code += chunk;
  	    if (original.source !== null
  	        && original.line !== null
  	        && original.column !== null) {
  	      if(lastOriginalSource !== original.source
  	         || lastOriginalLine !== original.line
  	         || lastOriginalColumn !== original.column
  	         || lastOriginalName !== original.name) {
  	        map.addMapping({
  	          source: original.source,
  	          original: {
  	            line: original.line,
  	            column: original.column
  	          },
  	          generated: {
  	            line: generated.line,
  	            column: generated.column
  	          },
  	          name: original.name
  	        });
  	      }
  	      lastOriginalSource = original.source;
  	      lastOriginalLine = original.line;
  	      lastOriginalColumn = original.column;
  	      lastOriginalName = original.name;
  	      sourceMappingActive = true;
  	    } else if (sourceMappingActive) {
  	      map.addMapping({
  	        generated: {
  	          line: generated.line,
  	          column: generated.column
  	        }
  	      });
  	      lastOriginalSource = null;
  	      sourceMappingActive = false;
  	    }
  	    for (var idx = 0, length = chunk.length; idx < length; idx++) {
  	      if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
  	        generated.line++;
  	        generated.column = 0;
  	        // Mappings end at eol
  	        if (idx + 1 === length) {
  	          lastOriginalSource = null;
  	          sourceMappingActive = false;
  	        } else if (sourceMappingActive) {
  	          map.addMapping({
  	            source: original.source,
  	            original: {
  	              line: original.line,
  	              column: original.column
  	            },
  	            generated: {
  	              line: generated.line,
  	              column: generated.column
  	            },
  	            name: original.name
  	          });
  	        }
  	      } else {
  	        generated.column++;
  	      }
  	    }
  	  });
  	  this.walkSourceContents(function (sourceFile, sourceContent) {
  	    map.setSourceContent(sourceFile, sourceContent);
  	  });

  	  return { code: generated.code, map: map };
  	};

  	sourceNode.SourceNode = SourceNode;
  	return sourceNode;
  }

  /*
   * Copyright 2009-2011 Mozilla Foundation and contributors
   * Licensed under the New BSD license. See LICENSE.txt or:
   * http://opensource.org/licenses/BSD-3-Clause
   */

  var hasRequiredSourceMap;

  function requireSourceMap () {
  	if (hasRequiredSourceMap) return sourceMap;
  	hasRequiredSourceMap = 1;
  	sourceMap.SourceMapGenerator = requireSourceMapGenerator().SourceMapGenerator;
  	sourceMap.SourceMapConsumer = requireSourceMapConsumer().SourceMapConsumer;
  	sourceMap.SourceNode = requireSourceNode().SourceNode;
  	return sourceMap;
  }

  Object.defineProperty(util$5, "__esModule", { value: true });
  util$5.isTrailingCommaEnabled = util$5.getParentExportDeclaration = util$5.isExportDeclaration = util$5.fixFaultyLocations = util$5.getTrueLoc = composeSourceMaps_1 = util$5.composeSourceMaps = util$5.copyPos = util$5.comparePos = util$5.getUnionOfKeys = util$5.getOption = void 0;
  var tslib_1$1 = require$$0;
  var assert_1 = tslib_1$1.__importDefault(require$$1$1);
  var types$1 = tslib_1$1.__importStar(requireMain());
  var n = types$1.namedTypes;
  var source_map_1 = tslib_1$1.__importDefault(requireSourceMap());
  var SourceMapConsumer$1 = source_map_1.default.SourceMapConsumer;
  var SourceMapGenerator$2 = source_map_1.default.SourceMapGenerator;
  var hasOwn = Object.prototype.hasOwnProperty;
  function getOption(options, key, defaultValue) {
      if (options && hasOwn.call(options, key)) {
          return options[key];
      }
      return defaultValue;
  }
  util$5.getOption = getOption;
  function getUnionOfKeys() {
      var args = [];
      for (var _i = 0; _i < arguments.length; _i++) {
          args[_i] = arguments[_i];
      }
      var result = {};
      var argc = args.length;
      for (var i = 0; i < argc; ++i) {
          var keys = Object.keys(args[i]);
          var keyCount = keys.length;
          for (var j = 0; j < keyCount; ++j) {
              result[keys[j]] = true;
          }
      }
      return result;
  }
  util$5.getUnionOfKeys = getUnionOfKeys;
  function comparePos(pos1, pos2) {
      return pos1.line - pos2.line || pos1.column - pos2.column;
  }
  util$5.comparePos = comparePos;
  function copyPos(pos) {
      return {
          line: pos.line,
          column: pos.column,
      };
  }
  util$5.copyPos = copyPos;
  function composeSourceMaps(formerMap, latterMap) {
      if (formerMap) {
          if (!latterMap) {
              return formerMap;
          }
      }
      else {
          return latterMap || null;
      }
      var smcFormer = new SourceMapConsumer$1(formerMap);
      var smcLatter = new SourceMapConsumer$1(latterMap);
      var smg = new SourceMapGenerator$2({
          file: latterMap.file,
          sourceRoot: latterMap.sourceRoot,
      });
      var sourcesToContents = {};
      smcLatter.eachMapping(function (mapping) {
          var origPos = smcFormer.originalPositionFor({
              line: mapping.originalLine,
              column: mapping.originalColumn,
          });
          var sourceName = origPos.source;
          if (sourceName === null) {
              return;
          }
          smg.addMapping({
              source: sourceName,
              original: copyPos(origPos),
              generated: {
                  line: mapping.generatedLine,
                  column: mapping.generatedColumn,
              },
              name: mapping.name,
          });
          var sourceContent = smcFormer.sourceContentFor(sourceName);
          if (sourceContent && !hasOwn.call(sourcesToContents, sourceName)) {
              sourcesToContents[sourceName] = sourceContent;
              smg.setSourceContent(sourceName, sourceContent);
          }
      });
      return smg.toJSON();
  }
  var composeSourceMaps_1 = util$5.composeSourceMaps = composeSourceMaps;
  function getTrueLoc(node, lines) {
      // It's possible that node is newly-created (not parsed by Esprima),
      // in which case it probably won't have a .loc property (or an
      // .original property for that matter). That's fine; we'll just
      // pretty-print it as usual.
      if (!node.loc) {
          return null;
      }
      var result = {
          start: node.loc.start,
          end: node.loc.end,
      };
      function include(node) {
          expandLoc(result, node.loc);
      }
      // If the node is an export declaration and its .declaration has any
      // decorators, their locations might contribute to the true start/end
      // positions of the export declaration node.
      if (node.declaration &&
          node.declaration.decorators &&
          isExportDeclaration(node)) {
          node.declaration.decorators.forEach(include);
      }
      if (comparePos(result.start, result.end) < 0) {
          // Trim leading whitespace.
          result.start = copyPos(result.start);
          lines.skipSpaces(result.start, false, true);
          if (comparePos(result.start, result.end) < 0) {
              // Trim trailing whitespace, if the end location is not already the
              // same as the start location.
              result.end = copyPos(result.end);
              lines.skipSpaces(result.end, true, true);
          }
      }
      // If the node has any comments, their locations might contribute to
      // the true start/end positions of the node.
      if (node.comments) {
          node.comments.forEach(include);
      }
      return result;
  }
  util$5.getTrueLoc = getTrueLoc;
  function expandLoc(parentLoc, childLoc) {
      if (parentLoc && childLoc) {
          if (comparePos(childLoc.start, parentLoc.start) < 0) {
              parentLoc.start = childLoc.start;
          }
          if (comparePos(parentLoc.end, childLoc.end) < 0) {
              parentLoc.end = childLoc.end;
          }
      }
  }
  function fixFaultyLocations(node, lines) {
      var loc = node.loc;
      if (loc) {
          if (loc.start.line < 1) {
              loc.start.line = 1;
          }
          if (loc.end.line < 1) {
              loc.end.line = 1;
          }
      }
      if (node.type === "File") {
          // Babylon returns File nodes whose .loc.{start,end} do not include
          // leading or trailing whitespace.
          loc.start = lines.firstPos();
          loc.end = lines.lastPos();
      }
      fixForLoopHead(node, lines);
      fixTemplateLiteral(node, lines);
      if (loc && node.decorators) {
          // Expand the .loc of the node responsible for printing the decorators
          // (here, the decorated node) so that it includes node.decorators.
          node.decorators.forEach(function (decorator) {
              expandLoc(loc, decorator.loc);
          });
      }
      else if (node.declaration && isExportDeclaration(node)) {
          // Nullify .loc information for the child declaration so that we never
          // try to reprint it without also reprinting the export declaration.
          node.declaration.loc = null;
          // Expand the .loc of the node responsible for printing the decorators
          // (here, the export declaration) so that it includes node.decorators.
          var decorators = node.declaration.decorators;
          if (decorators) {
              decorators.forEach(function (decorator) {
                  expandLoc(loc, decorator.loc);
              });
          }
      }
      else if ((n.MethodDefinition && n.MethodDefinition.check(node)) ||
          (n.Property.check(node) && (node.method || node.shorthand))) {
          // If the node is a MethodDefinition or a .method or .shorthand
          // Property, then the location information stored in
          // node.value.loc is very likely untrustworthy (just the {body}
          // part of a method, or nothing in the case of shorthand
          // properties), so we null out that information to prevent
          // accidental reuse of bogus source code during reprinting.
          node.value.loc = null;
          if (n.FunctionExpression.check(node.value)) {
              // FunctionExpression method values should be anonymous,
              // because their .id fields are ignored anyway.
              node.value.id = null;
          }
      }
      else if (node.type === "ObjectTypeProperty") {
          var loc_1 = node.loc;
          var end = loc_1 && loc_1.end;
          if (end) {
              end = copyPos(end);
              if (lines.prevPos(end) && lines.charAt(end) === ",") {
                  // Some parsers accidentally include trailing commas in the
                  // .loc.end information for ObjectTypeProperty nodes.
                  if ((end = lines.skipSpaces(end, true, true))) {
                      loc_1.end = end;
                  }
              }
          }
      }
  }
  util$5.fixFaultyLocations = fixFaultyLocations;
  function fixForLoopHead(node, lines) {
      if (node.type !== "ForStatement") {
          return;
      }
      function fix(child) {
          var loc = child && child.loc;
          var start = loc && loc.start;
          var end = loc && copyPos(loc.end);
          while (start && end && comparePos(start, end) < 0) {
              lines.prevPos(end);
              if (lines.charAt(end) === ";") {
                  // Update child.loc.end to *exclude* the ';' character.
                  loc.end.line = end.line;
                  loc.end.column = end.column;
              }
              else {
                  break;
              }
          }
      }
      fix(node.init);
      fix(node.test);
      fix(node.update);
  }
  function fixTemplateLiteral(node, lines) {
      if (node.type !== "TemplateLiteral") {
          return;
      }
      if (node.quasis.length === 0) {
          // If there are no quasi elements, then there is nothing to fix.
          return;
      }
      // node.loc is not present when using export default with a template literal
      if (node.loc) {
          // First we need to exclude the opening ` from the .loc of the first
          // quasi element, in case the parser accidentally decided to include it.
          var afterLeftBackTickPos = copyPos(node.loc.start);
          assert_1.default.strictEqual(lines.charAt(afterLeftBackTickPos), "`");
          assert_1.default.ok(lines.nextPos(afterLeftBackTickPos));
          var firstQuasi = node.quasis[0];
          if (comparePos(firstQuasi.loc.start, afterLeftBackTickPos) < 0) {
              firstQuasi.loc.start = afterLeftBackTickPos;
          }
          // Next we need to exclude the closing ` from the .loc of the last quasi
          // element, in case the parser accidentally decided to include it.
          var rightBackTickPos = copyPos(node.loc.end);
          assert_1.default.ok(lines.prevPos(rightBackTickPos));
          assert_1.default.strictEqual(lines.charAt(rightBackTickPos), "`");
          var lastQuasi = node.quasis[node.quasis.length - 1];
          if (comparePos(rightBackTickPos, lastQuasi.loc.end) < 0) {
              lastQuasi.loc.end = rightBackTickPos;
          }
      }
      // Now we need to exclude ${ and } characters from the .loc's of all
      // quasi elements, since some parsers accidentally include them.
      node.expressions.forEach(function (expr, i) {
          // Rewind from expr.loc.start over any whitespace and the ${ that
          // precedes the expression. The position of the $ should be the same
          // as the .loc.end of the preceding quasi element, but some parsers
          // accidentally include the ${ in the .loc of the quasi element.
          var dollarCurlyPos = lines.skipSpaces(expr.loc.start, true, false);
          if (lines.prevPos(dollarCurlyPos) &&
              lines.charAt(dollarCurlyPos) === "{" &&
              lines.prevPos(dollarCurlyPos) &&
              lines.charAt(dollarCurlyPos) === "$") {
              var quasiBefore = node.quasis[i];
              if (comparePos(dollarCurlyPos, quasiBefore.loc.end) < 0) {
                  quasiBefore.loc.end = dollarCurlyPos;
              }
          }
          // Likewise, some parsers accidentally include the } that follows
          // the expression in the .loc of the following quasi element.
          var rightCurlyPos = lines.skipSpaces(expr.loc.end, false, false);
          if (lines.charAt(rightCurlyPos) === "}") {
              assert_1.default.ok(lines.nextPos(rightCurlyPos));
              // Now rightCurlyPos is technically the position just after the }.
              var quasiAfter = node.quasis[i + 1];
              if (comparePos(quasiAfter.loc.start, rightCurlyPos) < 0) {
                  quasiAfter.loc.start = rightCurlyPos;
              }
          }
      });
  }
  function isExportDeclaration(node) {
      if (node)
          switch (node.type) {
              case "ExportDeclaration":
              case "ExportDefaultDeclaration":
              case "ExportDefaultSpecifier":
              case "DeclareExportDeclaration":
              case "ExportNamedDeclaration":
              case "ExportAllDeclaration":
                  return true;
          }
      return false;
  }
  util$5.isExportDeclaration = isExportDeclaration;
  function getParentExportDeclaration(path) {
      var parentNode = path.getParentNode();
      if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
          return parentNode;
      }
      return null;
  }
  util$5.getParentExportDeclaration = getParentExportDeclaration;
  function isTrailingCommaEnabled(options, context) {
      var trailingComma = options.trailingComma;
      if (typeof trailingComma === "object") {
          return !!trailingComma[context];
      }
      return !!trailingComma;
  }
  util$5.isTrailingCommaEnabled = isTrailingCommaEnabled;

  var hasRequiredEsprima;

  function requireEsprima () {
  	if (hasRequiredEsprima) return esprima;
  	hasRequiredEsprima = 1;
  	Object.defineProperty(esprima, "__esModule", { value: true });
  	esprima.parse = void 0;
  	// This module is suitable for passing as options.parser when calling
  	// recast.parse to process ECMAScript code with Esprima:
  	//
  	//   const ast = recast.parse(source, {
  	//     parser: require("recast/parsers/esprima")
  	//   });
  	//
  	var util_1 = util$5;
  	function parse(source, options) {
  	    var comments = [];
  	    var ast = require("esprima").parse(source, {
  	        loc: true,
  	        locations: true,
  	        comment: true,
  	        onComment: comments,
  	        range: util_1.getOption(options, "range", false),
  	        tolerant: util_1.getOption(options, "tolerant", true),
  	        tokens: true,
  	        jsx: util_1.getOption(options, "jsx", false)
  	    });
  	    if (!Array.isArray(ast.comments)) {
  	        ast.comments = comments;
  	    }
  	    return ast;
  	}
  	esprima.parse = parse;
  	return esprima;
  }

  /*
  The MIT License (MIT)

  Copyright (c) 2016 CoderPuppy

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.

  */
  var _endianness;
  function endianness() {
    if (typeof _endianness === 'undefined') {
      var a = new ArrayBuffer(2);
      var b = new Uint8Array(a);
      var c = new Uint16Array(a);
      b[0] = 1;
      b[1] = 2;
      if (c[0] === 258) {
        _endianness = 'BE';
      } else if (c[0] === 513){
        _endianness = 'LE';
      } else {
        throw new Error('unable to figure out endianess');
      }
    }
    return _endianness;
  }

  function hostname() {
    if (typeof global.location !== 'undefined') {
      return global.location.hostname
    } else return '';
  }

  function loadavg() {
    return [];
  }

  function uptime() {
    return 0;
  }

  function freemem() {
    return Number.MAX_VALUE;
  }

  function totalmem() {
    return Number.MAX_VALUE;
  }

  function cpus() {
    return [];
  }

  function type() {
    return 'Browser';
  }

  function release () {
    if (typeof global.navigator !== 'undefined') {
      return global.navigator.appVersion;
    }
    return '';
  }

  function networkInterfaces(){}
  function getNetworkInterfaces(){}

  function arch() {
    return 'javascript';
  }

  function platform() {
    return 'browser';
  }

  function tmpDir() {
    return '/tmp';
  }
  var tmpdir = tmpDir;

  var EOL = '\n';
  var os = {
    EOL: EOL,
    tmpdir: tmpdir,
    tmpDir: tmpDir,
    networkInterfaces:networkInterfaces,
    getNetworkInterfaces: getNetworkInterfaces,
    release: release,
    type: type,
    cpus: cpus,
    totalmem: totalmem,
    freemem: freemem,
    uptime: uptime,
    loadavg: loadavg,
    hostname: hostname,
    endianness: endianness,
  };

  var os$1 = /*#__PURE__*/Object.freeze({
    __proto__: null,
    endianness: endianness,
    hostname: hostname,
    loadavg: loadavg,
    uptime: uptime,
    freemem: freemem,
    totalmem: totalmem,
    cpus: cpus,
    type: type,
    release: release,
    networkInterfaces: networkInterfaces,
    getNetworkInterfaces: getNetworkInterfaces,
    arch: arch,
    platform: platform,
    tmpDir: tmpDir,
    tmpdir: tmpdir,
    EOL: EOL,
    'default': os
  });

  var require$$1 = /*@__PURE__*/getAugmentedNamespace(os$1);

  var hasRequiredOptions;

  function requireOptions () {
  	if (hasRequiredOptions) return options;
  	hasRequiredOptions = 1;
  	Object.defineProperty(options, "__esModule", { value: true });
  	options.normalize = void 0;
  	var defaults = {
  	    parser: requireEsprima(),
  	    tabWidth: 4,
  	    useTabs: false,
  	    reuseWhitespace: true,
  	    lineTerminator: require$$1.EOL || "\n",
  	    wrapColumn: 74,
  	    sourceFileName: null,
  	    sourceMapName: null,
  	    sourceRoot: null,
  	    inputSourceMap: null,
  	    range: false,
  	    tolerant: true,
  	    quote: null,
  	    trailingComma: false,
  	    arrayBracketSpacing: false,
  	    objectCurlySpacing: true,
  	    arrowParensAlways: false,
  	    flowObjectCommas: true,
  	    tokens: true,
  	};
  	var hasOwn = defaults.hasOwnProperty;
  	// Copy options and fill in default values.
  	function normalize(opts) {
  	    var options = opts || defaults;
  	    function get(key) {
  	        return hasOwn.call(options, key) ? options[key] : defaults[key];
  	    }
  	    return {
  	        tabWidth: +get("tabWidth"),
  	        useTabs: !!get("useTabs"),
  	        reuseWhitespace: !!get("reuseWhitespace"),
  	        lineTerminator: get("lineTerminator"),
  	        wrapColumn: Math.max(get("wrapColumn"), 0),
  	        sourceFileName: get("sourceFileName"),
  	        sourceMapName: get("sourceMapName"),
  	        sourceRoot: get("sourceRoot"),
  	        inputSourceMap: get("inputSourceMap"),
  	        parser: get("esprima") || get("parser"),
  	        range: get("range"),
  	        tolerant: get("tolerant"),
  	        quote: get("quote"),
  	        trailingComma: get("trailingComma"),
  	        arrayBracketSpacing: get("arrayBracketSpacing"),
  	        objectCurlySpacing: get("objectCurlySpacing"),
  	        arrowParensAlways: get("arrowParensAlways"),
  	        flowObjectCommas: get("flowObjectCommas"),
  	        tokens: !!get("tokens"),
  	    };
  	}
  	options.normalize = normalize;
  	return options;
  }

  var lines = {};

  var mapping = {};

  var hasRequiredMapping;

  function requireMapping () {
  	if (hasRequiredMapping) return mapping;
  	hasRequiredMapping = 1;
  	Object.defineProperty(mapping, "__esModule", { value: true });
  	var tslib_1 = require$$0;
  	var assert_1 = tslib_1.__importDefault(require$$1$1);
  	var util_1 = util$5;
  	var Mapping = /** @class */ (function () {
  	    function Mapping(sourceLines, sourceLoc, targetLoc) {
  	        if (targetLoc === void 0) { targetLoc = sourceLoc; }
  	        this.sourceLines = sourceLines;
  	        this.sourceLoc = sourceLoc;
  	        this.targetLoc = targetLoc;
  	    }
  	    Mapping.prototype.slice = function (lines, start, end) {
  	        if (end === void 0) { end = lines.lastPos(); }
  	        var sourceLines = this.sourceLines;
  	        var sourceLoc = this.sourceLoc;
  	        var targetLoc = this.targetLoc;
  	        function skip(name) {
  	            var sourceFromPos = sourceLoc[name];
  	            var targetFromPos = targetLoc[name];
  	            var targetToPos = start;
  	            if (name === "end") {
  	                targetToPos = end;
  	            }
  	            else {
  	                assert_1.default.strictEqual(name, "start");
  	            }
  	            return skipChars(sourceLines, sourceFromPos, lines, targetFromPos, targetToPos);
  	        }
  	        if (util_1.comparePos(start, targetLoc.start) <= 0) {
  	            if (util_1.comparePos(targetLoc.end, end) <= 0) {
  	                targetLoc = {
  	                    start: subtractPos(targetLoc.start, start.line, start.column),
  	                    end: subtractPos(targetLoc.end, start.line, start.column),
  	                };
  	                // The sourceLoc can stay the same because the contents of the
  	                // targetLoc have not changed.
  	            }
  	            else if (util_1.comparePos(end, targetLoc.start) <= 0) {
  	                return null;
  	            }
  	            else {
  	                sourceLoc = {
  	                    start: sourceLoc.start,
  	                    end: skip("end"),
  	                };
  	                targetLoc = {
  	                    start: subtractPos(targetLoc.start, start.line, start.column),
  	                    end: subtractPos(end, start.line, start.column),
  	                };
  	            }
  	        }
  	        else {
  	            if (util_1.comparePos(targetLoc.end, start) <= 0) {
  	                return null;
  	            }
  	            if (util_1.comparePos(targetLoc.end, end) <= 0) {
  	                sourceLoc = {
  	                    start: skip("start"),
  	                    end: sourceLoc.end,
  	                };
  	                targetLoc = {
  	                    // Same as subtractPos(start, start.line, start.column):
  	                    start: { line: 1, column: 0 },
  	                    end: subtractPos(targetLoc.end, start.line, start.column),
  	                };
  	            }
  	            else {
  	                sourceLoc = {
  	                    start: skip("start"),
  	                    end: skip("end"),
  	                };
  	                targetLoc = {
  	                    // Same as subtractPos(start, start.line, start.column):
  	                    start: { line: 1, column: 0 },
  	                    end: subtractPos(end, start.line, start.column),
  	                };
  	            }
  	        }
  	        return new Mapping(this.sourceLines, sourceLoc, targetLoc);
  	    };
  	    Mapping.prototype.add = function (line, column) {
  	        return new Mapping(this.sourceLines, this.sourceLoc, {
  	            start: addPos(this.targetLoc.start, line, column),
  	            end: addPos(this.targetLoc.end, line, column),
  	        });
  	    };
  	    Mapping.prototype.subtract = function (line, column) {
  	        return new Mapping(this.sourceLines, this.sourceLoc, {
  	            start: subtractPos(this.targetLoc.start, line, column),
  	            end: subtractPos(this.targetLoc.end, line, column),
  	        });
  	    };
  	    Mapping.prototype.indent = function (by, skipFirstLine, noNegativeColumns) {
  	        if (skipFirstLine === void 0) { skipFirstLine = false; }
  	        if (noNegativeColumns === void 0) { noNegativeColumns = false; }
  	        if (by === 0) {
  	            return this;
  	        }
  	        var targetLoc = this.targetLoc;
  	        var startLine = targetLoc.start.line;
  	        var endLine = targetLoc.end.line;
  	        if (skipFirstLine && startLine === 1 && endLine === 1) {
  	            return this;
  	        }
  	        targetLoc = {
  	            start: targetLoc.start,
  	            end: targetLoc.end,
  	        };
  	        if (!skipFirstLine || startLine > 1) {
  	            var startColumn = targetLoc.start.column + by;
  	            targetLoc.start = {
  	                line: startLine,
  	                column: noNegativeColumns ? Math.max(0, startColumn) : startColumn,
  	            };
  	        }
  	        if (!skipFirstLine || endLine > 1) {
  	            var endColumn = targetLoc.end.column + by;
  	            targetLoc.end = {
  	                line: endLine,
  	                column: noNegativeColumns ? Math.max(0, endColumn) : endColumn,
  	            };
  	        }
  	        return new Mapping(this.sourceLines, this.sourceLoc, targetLoc);
  	    };
  	    return Mapping;
  	}());
  	mapping.default = Mapping;
  	function addPos(toPos, line, column) {
  	    return {
  	        line: toPos.line + line - 1,
  	        column: toPos.line === 1 ? toPos.column + column : toPos.column,
  	    };
  	}
  	function subtractPos(fromPos, line, column) {
  	    return {
  	        line: fromPos.line - line + 1,
  	        column: fromPos.line === line ? fromPos.column - column : fromPos.column,
  	    };
  	}
  	function skipChars(sourceLines, sourceFromPos, targetLines, targetFromPos, targetToPos) {
  	    var targetComparison = util_1.comparePos(targetFromPos, targetToPos);
  	    if (targetComparison === 0) {
  	        // Trivial case: no characters to skip.
  	        return sourceFromPos;
  	    }
  	    var sourceCursor, targetCursor;
  	    if (targetComparison < 0) {
  	        // Skipping forward.
  	        sourceCursor =
  	            sourceLines.skipSpaces(sourceFromPos) || sourceLines.lastPos();
  	        targetCursor =
  	            targetLines.skipSpaces(targetFromPos) || targetLines.lastPos();
  	        var lineDiff = targetToPos.line - targetCursor.line;
  	        sourceCursor.line += lineDiff;
  	        targetCursor.line += lineDiff;
  	        if (lineDiff > 0) {
  	            // If jumping to later lines, reset columns to the beginnings
  	            // of those lines.
  	            sourceCursor.column = 0;
  	            targetCursor.column = 0;
  	        }
  	        else {
  	            assert_1.default.strictEqual(lineDiff, 0);
  	        }
  	        while (util_1.comparePos(targetCursor, targetToPos) < 0 &&
  	            targetLines.nextPos(targetCursor, true)) {
  	            assert_1.default.ok(sourceLines.nextPos(sourceCursor, true));
  	            assert_1.default.strictEqual(sourceLines.charAt(sourceCursor), targetLines.charAt(targetCursor));
  	        }
  	    }
  	    else {
  	        // Skipping backward.
  	        sourceCursor =
  	            sourceLines.skipSpaces(sourceFromPos, true) || sourceLines.firstPos();
  	        targetCursor =
  	            targetLines.skipSpaces(targetFromPos, true) || targetLines.firstPos();
  	        var lineDiff = targetToPos.line - targetCursor.line;
  	        sourceCursor.line += lineDiff;
  	        targetCursor.line += lineDiff;
  	        if (lineDiff < 0) {
  	            // If jumping to earlier lines, reset columns to the ends of
  	            // those lines.
  	            sourceCursor.column = sourceLines.getLineLength(sourceCursor.line);
  	            targetCursor.column = targetLines.getLineLength(targetCursor.line);
  	        }
  	        else {
  	            assert_1.default.strictEqual(lineDiff, 0);
  	        }
  	        while (util_1.comparePos(targetToPos, targetCursor) < 0 &&
  	            targetLines.prevPos(targetCursor, true)) {
  	            assert_1.default.ok(sourceLines.prevPos(sourceCursor, true));
  	            assert_1.default.strictEqual(sourceLines.charAt(sourceCursor), targetLines.charAt(targetCursor));
  	        }
  	    }
  	    return sourceCursor;
  	}
  	return mapping;
  }

  var hasRequiredLines;

  function requireLines () {
  	if (hasRequiredLines) return lines;
  	hasRequiredLines = 1;
  	Object.defineProperty(lines, "__esModule", { value: true });
  	lines.concat = lines.fromString = lines.countSpaces = lines.Lines = void 0;
  	var tslib_1 = require$$0;
  	var assert_1 = tslib_1.__importDefault(require$$1$1);
  	var source_map_1 = tslib_1.__importDefault(requireSourceMap());
  	var options_1 = requireOptions();
  	var util_1 = util$5;
  	var mapping_1 = tslib_1.__importDefault(requireMapping());
  	var Lines = /** @class */ (function () {
  	    function Lines(infos, sourceFileName) {
  	        if (sourceFileName === void 0) { sourceFileName = null; }
  	        this.infos = infos;
  	        this.mappings = [];
  	        this.cachedSourceMap = null;
  	        this.cachedTabWidth = void 0;
  	        assert_1.default.ok(infos.length > 0);
  	        this.length = infos.length;
  	        this.name = sourceFileName || null;
  	        if (this.name) {
  	            this.mappings.push(new mapping_1.default(this, {
  	                start: this.firstPos(),
  	                end: this.lastPos(),
  	            }));
  	        }
  	    }
  	    Lines.prototype.toString = function (options) {
  	        return this.sliceString(this.firstPos(), this.lastPos(), options);
  	    };
  	    Lines.prototype.getSourceMap = function (sourceMapName, sourceRoot) {
  	        if (!sourceMapName) {
  	            // Although we could make up a name or generate an anonymous
  	            // source map, instead we assume that any consumer who does not
  	            // provide a name does not actually want a source map.
  	            return null;
  	        }
  	        var targetLines = this;
  	        function updateJSON(json) {
  	            json = json || {};
  	            json.file = sourceMapName;
  	            if (sourceRoot) {
  	                json.sourceRoot = sourceRoot;
  	            }
  	            return json;
  	        }
  	        if (targetLines.cachedSourceMap) {
  	            // Since Lines objects are immutable, we can reuse any source map
  	            // that was previously generated. Nevertheless, we return a new
  	            // JSON object here to protect the cached source map from outside
  	            // modification.
  	            return updateJSON(targetLines.cachedSourceMap.toJSON());
  	        }
  	        var smg = new source_map_1.default.SourceMapGenerator(updateJSON());
  	        var sourcesToContents = {};
  	        targetLines.mappings.forEach(function (mapping) {
  	            var sourceCursor = mapping.sourceLines.skipSpaces(mapping.sourceLoc.start) ||
  	                mapping.sourceLines.lastPos();
  	            var targetCursor = targetLines.skipSpaces(mapping.targetLoc.start) ||
  	                targetLines.lastPos();
  	            while (util_1.comparePos(sourceCursor, mapping.sourceLoc.end) < 0 &&
  	                util_1.comparePos(targetCursor, mapping.targetLoc.end) < 0) {
  	                var sourceChar = mapping.sourceLines.charAt(sourceCursor);
  	                var targetChar = targetLines.charAt(targetCursor);
  	                assert_1.default.strictEqual(sourceChar, targetChar);
  	                var sourceName = mapping.sourceLines.name;
  	                // Add mappings one character at a time for maximum resolution.
  	                smg.addMapping({
  	                    source: sourceName,
  	                    original: { line: sourceCursor.line, column: sourceCursor.column },
  	                    generated: { line: targetCursor.line, column: targetCursor.column },
  	                });
  	                if (!hasOwn.call(sourcesToContents, sourceName)) {
  	                    var sourceContent = mapping.sourceLines.toString();
  	                    smg.setSourceContent(sourceName, sourceContent);
  	                    sourcesToContents[sourceName] = sourceContent;
  	                }
  	                targetLines.nextPos(targetCursor, true);
  	                mapping.sourceLines.nextPos(sourceCursor, true);
  	            }
  	        });
  	        targetLines.cachedSourceMap = smg;
  	        return smg.toJSON();
  	    };
  	    Lines.prototype.bootstrapCharAt = function (pos) {
  	        assert_1.default.strictEqual(typeof pos, "object");
  	        assert_1.default.strictEqual(typeof pos.line, "number");
  	        assert_1.default.strictEqual(typeof pos.column, "number");
  	        var line = pos.line, column = pos.column, strings = this.toString().split(lineTerminatorSeqExp), string = strings[line - 1];
  	        if (typeof string === "undefined")
  	            return "";
  	        if (column === string.length && line < strings.length)
  	            return "\n";
  	        if (column >= string.length)
  	            return "";
  	        return string.charAt(column);
  	    };
  	    Lines.prototype.charAt = function (pos) {
  	        assert_1.default.strictEqual(typeof pos, "object");
  	        assert_1.default.strictEqual(typeof pos.line, "number");
  	        assert_1.default.strictEqual(typeof pos.column, "number");
  	        var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;
  	        if (typeof info === "undefined" || c < 0)
  	            return "";
  	        var indent = this.getIndentAt(line);
  	        if (c < indent)
  	            return " ";
  	        c += info.sliceStart - indent;
  	        if (c === info.sliceEnd && line < this.length)
  	            return "\n";
  	        if (c >= info.sliceEnd)
  	            return "";
  	        return info.line.charAt(c);
  	    };
  	    Lines.prototype.stripMargin = function (width, skipFirstLine) {
  	        if (width === 0)
  	            return this;
  	        assert_1.default.ok(width > 0, "negative margin: " + width);
  	        if (skipFirstLine && this.length === 1)
  	            return this;
  	        var lines = new Lines(this.infos.map(function (info, i) {
  	            if (info.line && (i > 0 || !skipFirstLine)) {
  	                info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: Math.max(0, info.indent - width) });
  	            }
  	            return info;
  	        }));
  	        if (this.mappings.length > 0) {
  	            var newMappings_1 = lines.mappings;
  	            assert_1.default.strictEqual(newMappings_1.length, 0);
  	            this.mappings.forEach(function (mapping) {
  	                newMappings_1.push(mapping.indent(width, skipFirstLine, true));
  	            });
  	        }
  	        return lines;
  	    };
  	    Lines.prototype.indent = function (by) {
  	        if (by === 0) {
  	            return this;
  	        }
  	        var lines = new Lines(this.infos.map(function (info) {
  	            if (info.line && !info.locked) {
  	                info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
  	            }
  	            return info;
  	        }));
  	        if (this.mappings.length > 0) {
  	            var newMappings_2 = lines.mappings;
  	            assert_1.default.strictEqual(newMappings_2.length, 0);
  	            this.mappings.forEach(function (mapping) {
  	                newMappings_2.push(mapping.indent(by));
  	            });
  	        }
  	        return lines;
  	    };
  	    Lines.prototype.indentTail = function (by) {
  	        if (by === 0) {
  	            return this;
  	        }
  	        if (this.length < 2) {
  	            return this;
  	        }
  	        var lines = new Lines(this.infos.map(function (info, i) {
  	            if (i > 0 && info.line && !info.locked) {
  	                info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
  	            }
  	            return info;
  	        }));
  	        if (this.mappings.length > 0) {
  	            var newMappings_3 = lines.mappings;
  	            assert_1.default.strictEqual(newMappings_3.length, 0);
  	            this.mappings.forEach(function (mapping) {
  	                newMappings_3.push(mapping.indent(by, true));
  	            });
  	        }
  	        return lines;
  	    };
  	    Lines.prototype.lockIndentTail = function () {
  	        if (this.length < 2) {
  	            return this;
  	        }
  	        return new Lines(this.infos.map(function (info, i) { return (tslib_1.__assign(tslib_1.__assign({}, info), { locked: i > 0 })); }));
  	    };
  	    Lines.prototype.getIndentAt = function (line) {
  	        assert_1.default.ok(line >= 1, "no line " + line + " (line numbers start from 1)");
  	        return Math.max(this.infos[line - 1].indent, 0);
  	    };
  	    Lines.prototype.guessTabWidth = function () {
  	        if (typeof this.cachedTabWidth === "number") {
  	            return this.cachedTabWidth;
  	        }
  	        var counts = []; // Sparse array.
  	        var lastIndent = 0;
  	        for (var line = 1, last = this.length; line <= last; ++line) {
  	            var info = this.infos[line - 1];
  	            var sliced = info.line.slice(info.sliceStart, info.sliceEnd);
  	            // Whitespace-only lines don't tell us much about the likely tab
  	            // width of this code.
  	            if (isOnlyWhitespace(sliced)) {
  	                continue;
  	            }
  	            var diff = Math.abs(info.indent - lastIndent);
  	            counts[diff] = ~~counts[diff] + 1;
  	            lastIndent = info.indent;
  	        }
  	        var maxCount = -1;
  	        var result = 2;
  	        for (var tabWidth = 1; tabWidth < counts.length; tabWidth += 1) {
  	            if (hasOwn.call(counts, tabWidth) && counts[tabWidth] > maxCount) {
  	                maxCount = counts[tabWidth];
  	                result = tabWidth;
  	            }
  	        }
  	        return (this.cachedTabWidth = result);
  	    };
  	    // Determine if the list of lines has a first line that starts with a //
  	    // or /* comment. If this is the case, the code may need to be wrapped in
  	    // parens to avoid ASI issues.
  	    Lines.prototype.startsWithComment = function () {
  	        if (this.infos.length === 0) {
  	            return false;
  	        }
  	        var firstLineInfo = this.infos[0], sliceStart = firstLineInfo.sliceStart, sliceEnd = firstLineInfo.sliceEnd, firstLine = firstLineInfo.line.slice(sliceStart, sliceEnd).trim();
  	        return (firstLine.length === 0 ||
  	            firstLine.slice(0, 2) === "//" ||
  	            firstLine.slice(0, 2) === "/*");
  	    };
  	    Lines.prototype.isOnlyWhitespace = function () {
  	        return isOnlyWhitespace(this.toString());
  	    };
  	    Lines.prototype.isPrecededOnlyByWhitespace = function (pos) {
  	        var info = this.infos[pos.line - 1];
  	        var indent = Math.max(info.indent, 0);
  	        var diff = pos.column - indent;
  	        if (diff <= 0) {
  	            // If pos.column does not exceed the indentation amount, then
  	            // there must be only whitespace before it.
  	            return true;
  	        }
  	        var start = info.sliceStart;
  	        var end = Math.min(start + diff, info.sliceEnd);
  	        var prefix = info.line.slice(start, end);
  	        return isOnlyWhitespace(prefix);
  	    };
  	    Lines.prototype.getLineLength = function (line) {
  	        var info = this.infos[line - 1];
  	        return this.getIndentAt(line) + info.sliceEnd - info.sliceStart;
  	    };
  	    Lines.prototype.nextPos = function (pos, skipSpaces) {
  	        if (skipSpaces === void 0) { skipSpaces = false; }
  	        var l = Math.max(pos.line, 0), c = Math.max(pos.column, 0);
  	        if (c < this.getLineLength(l)) {
  	            pos.column += 1;
  	            return skipSpaces ? !!this.skipSpaces(pos, false, true) : true;
  	        }
  	        if (l < this.length) {
  	            pos.line += 1;
  	            pos.column = 0;
  	            return skipSpaces ? !!this.skipSpaces(pos, false, true) : true;
  	        }
  	        return false;
  	    };
  	    Lines.prototype.prevPos = function (pos, skipSpaces) {
  	        if (skipSpaces === void 0) { skipSpaces = false; }
  	        var l = pos.line, c = pos.column;
  	        if (c < 1) {
  	            l -= 1;
  	            if (l < 1)
  	                return false;
  	            c = this.getLineLength(l);
  	        }
  	        else {
  	            c = Math.min(c - 1, this.getLineLength(l));
  	        }
  	        pos.line = l;
  	        pos.column = c;
  	        return skipSpaces ? !!this.skipSpaces(pos, true, true) : true;
  	    };
  	    Lines.prototype.firstPos = function () {
  	        // Trivial, but provided for completeness.
  	        return { line: 1, column: 0 };
  	    };
  	    Lines.prototype.lastPos = function () {
  	        return {
  	            line: this.length,
  	            column: this.getLineLength(this.length),
  	        };
  	    };
  	    Lines.prototype.skipSpaces = function (pos, backward, modifyInPlace) {
  	        if (backward === void 0) { backward = false; }
  	        if (modifyInPlace === void 0) { modifyInPlace = false; }
  	        if (pos) {
  	            pos = modifyInPlace
  	                ? pos
  	                : {
  	                    line: pos.line,
  	                    column: pos.column,
  	                };
  	        }
  	        else if (backward) {
  	            pos = this.lastPos();
  	        }
  	        else {
  	            pos = this.firstPos();
  	        }
  	        if (backward) {
  	            while (this.prevPos(pos)) {
  	                if (!isOnlyWhitespace(this.charAt(pos)) && this.nextPos(pos)) {
  	                    return pos;
  	                }
  	            }
  	            return null;
  	        }
  	        else {
  	            while (isOnlyWhitespace(this.charAt(pos))) {
  	                if (!this.nextPos(pos)) {
  	                    return null;
  	                }
  	            }
  	            return pos;
  	        }
  	    };
  	    Lines.prototype.trimLeft = function () {
  	        var pos = this.skipSpaces(this.firstPos(), false, true);
  	        return pos ? this.slice(pos) : emptyLines;
  	    };
  	    Lines.prototype.trimRight = function () {
  	        var pos = this.skipSpaces(this.lastPos(), true, true);
  	        return pos ? this.slice(this.firstPos(), pos) : emptyLines;
  	    };
  	    Lines.prototype.trim = function () {
  	        var start = this.skipSpaces(this.firstPos(), false, true);
  	        if (start === null) {
  	            return emptyLines;
  	        }
  	        var end = this.skipSpaces(this.lastPos(), true, true);
  	        if (end === null) {
  	            return emptyLines;
  	        }
  	        return this.slice(start, end);
  	    };
  	    Lines.prototype.eachPos = function (callback, startPos, skipSpaces) {
  	        if (startPos === void 0) { startPos = this.firstPos(); }
  	        if (skipSpaces === void 0) { skipSpaces = false; }
  	        var pos = this.firstPos();
  	        if (startPos) {
  	            (pos.line = startPos.line), (pos.column = startPos.column);
  	        }
  	        if (skipSpaces && !this.skipSpaces(pos, false, true)) {
  	            return; // Encountered nothing but spaces.
  	        }
  	        do
  	            callback.call(this, pos);
  	        while (this.nextPos(pos, skipSpaces));
  	    };
  	    Lines.prototype.bootstrapSlice = function (start, end) {
  	        var strings = this.toString()
  	            .split(lineTerminatorSeqExp)
  	            .slice(start.line - 1, end.line);
  	        if (strings.length > 0) {
  	            strings.push(strings.pop().slice(0, end.column));
  	            strings[0] = strings[0].slice(start.column);
  	        }
  	        return fromString(strings.join("\n"));
  	    };
  	    Lines.prototype.slice = function (start, end) {
  	        if (!end) {
  	            if (!start) {
  	                // The client seems to want a copy of this Lines object, but
  	                // Lines objects are immutable, so it's perfectly adequate to
  	                // return the same object.
  	                return this;
  	            }
  	            // Slice to the end if no end position was provided.
  	            end = this.lastPos();
  	        }
  	        if (!start) {
  	            throw new Error("cannot slice with end but not start");
  	        }
  	        var sliced = this.infos.slice(start.line - 1, end.line);
  	        if (start.line === end.line) {
  	            sliced[0] = sliceInfo(sliced[0], start.column, end.column);
  	        }
  	        else {
  	            assert_1.default.ok(start.line < end.line);
  	            sliced[0] = sliceInfo(sliced[0], start.column);
  	            sliced.push(sliceInfo(sliced.pop(), 0, end.column));
  	        }
  	        var lines = new Lines(sliced);
  	        if (this.mappings.length > 0) {
  	            var newMappings_4 = lines.mappings;
  	            assert_1.default.strictEqual(newMappings_4.length, 0);
  	            this.mappings.forEach(function (mapping) {
  	                var sliced = mapping.slice(this, start, end);
  	                if (sliced) {
  	                    newMappings_4.push(sliced);
  	                }
  	            }, this);
  	        }
  	        return lines;
  	    };
  	    Lines.prototype.bootstrapSliceString = function (start, end, options) {
  	        return this.slice(start, end).toString(options);
  	    };
  	    Lines.prototype.sliceString = function (start, end, options) {
  	        if (start === void 0) { start = this.firstPos(); }
  	        if (end === void 0) { end = this.lastPos(); }
  	        var _a = options_1.normalize(options), tabWidth = _a.tabWidth, useTabs = _a.useTabs, reuseWhitespace = _a.reuseWhitespace, lineTerminator = _a.lineTerminator;
  	        var parts = [];
  	        for (var line = start.line; line <= end.line; ++line) {
  	            var info = this.infos[line - 1];
  	            if (line === start.line) {
  	                if (line === end.line) {
  	                    info = sliceInfo(info, start.column, end.column);
  	                }
  	                else {
  	                    info = sliceInfo(info, start.column);
  	                }
  	            }
  	            else if (line === end.line) {
  	                info = sliceInfo(info, 0, end.column);
  	            }
  	            var indent = Math.max(info.indent, 0);
  	            var before_1 = info.line.slice(0, info.sliceStart);
  	            if (reuseWhitespace &&
  	                isOnlyWhitespace(before_1) &&
  	                countSpaces(before_1, tabWidth) === indent) {
  	                // Reuse original spaces if the indentation is correct.
  	                parts.push(info.line.slice(0, info.sliceEnd));
  	                continue;
  	            }
  	            var tabs = 0;
  	            var spaces = indent;
  	            if (useTabs) {
  	                tabs = Math.floor(indent / tabWidth);
  	                spaces -= tabs * tabWidth;
  	            }
  	            var result = "";
  	            if (tabs > 0) {
  	                result += new Array(tabs + 1).join("\t");
  	            }
  	            if (spaces > 0) {
  	                result += new Array(spaces + 1).join(" ");
  	            }
  	            result += info.line.slice(info.sliceStart, info.sliceEnd);
  	            parts.push(result);
  	        }
  	        return parts.join(lineTerminator);
  	    };
  	    Lines.prototype.isEmpty = function () {
  	        return this.length < 2 && this.getLineLength(1) < 1;
  	    };
  	    Lines.prototype.join = function (elements) {
  	        var separator = this;
  	        var infos = [];
  	        var mappings = [];
  	        var prevInfo;
  	        function appendLines(linesOrNull) {
  	            if (linesOrNull === null) {
  	                return;
  	            }
  	            if (prevInfo) {
  	                var info = linesOrNull.infos[0];
  	                var indent = new Array(info.indent + 1).join(" ");
  	                var prevLine_1 = infos.length;
  	                var prevColumn_1 = Math.max(prevInfo.indent, 0) +
  	                    prevInfo.sliceEnd -
  	                    prevInfo.sliceStart;
  	                prevInfo.line =
  	                    prevInfo.line.slice(0, prevInfo.sliceEnd) +
  	                        indent +
  	                        info.line.slice(info.sliceStart, info.sliceEnd);
  	                // If any part of a line is indentation-locked, the whole line
  	                // will be indentation-locked.
  	                prevInfo.locked = prevInfo.locked || info.locked;
  	                prevInfo.sliceEnd = prevInfo.line.length;
  	                if (linesOrNull.mappings.length > 0) {
  	                    linesOrNull.mappings.forEach(function (mapping) {
  	                        mappings.push(mapping.add(prevLine_1, prevColumn_1));
  	                    });
  	                }
  	            }
  	            else if (linesOrNull.mappings.length > 0) {
  	                mappings.push.apply(mappings, linesOrNull.mappings);
  	            }
  	            linesOrNull.infos.forEach(function (info, i) {
  	                if (!prevInfo || i > 0) {
  	                    prevInfo = tslib_1.__assign({}, info);
  	                    infos.push(prevInfo);
  	                }
  	            });
  	        }
  	        function appendWithSeparator(linesOrNull, i) {
  	            if (i > 0)
  	                appendLines(separator);
  	            appendLines(linesOrNull);
  	        }
  	        elements
  	            .map(function (elem) {
  	            var lines = fromString(elem);
  	            if (lines.isEmpty())
  	                return null;
  	            return lines;
  	        })
  	            .forEach(function (linesOrNull, i) {
  	            if (separator.isEmpty()) {
  	                appendLines(linesOrNull);
  	            }
  	            else {
  	                appendWithSeparator(linesOrNull, i);
  	            }
  	        });
  	        if (infos.length < 1)
  	            return emptyLines;
  	        var lines = new Lines(infos);
  	        lines.mappings = mappings;
  	        return lines;
  	    };
  	    Lines.prototype.concat = function () {
  	        var args = [];
  	        for (var _i = 0; _i < arguments.length; _i++) {
  	            args[_i] = arguments[_i];
  	        }
  	        var list = [this];
  	        list.push.apply(list, args);
  	        assert_1.default.strictEqual(list.length, args.length + 1);
  	        return emptyLines.join(list);
  	    };
  	    return Lines;
  	}());
  	lines.Lines = Lines;
  	var fromStringCache = {};
  	var hasOwn = fromStringCache.hasOwnProperty;
  	var maxCacheKeyLen = 10;
  	function countSpaces(spaces, tabWidth) {
  	    var count = 0;
  	    var len = spaces.length;
  	    for (var i = 0; i < len; ++i) {
  	        switch (spaces.charCodeAt(i)) {
  	            case 9: {
  	                // '\t'
  	                assert_1.default.strictEqual(typeof tabWidth, "number");
  	                assert_1.default.ok(tabWidth > 0);
  	                var next = Math.ceil(count / tabWidth) * tabWidth;
  	                if (next === count) {
  	                    count += tabWidth;
  	                }
  	                else {
  	                    count = next;
  	                }
  	                break;
  	            }
  	            case 11: // '\v'
  	            case 12: // '\f'
  	            case 13: // '\r'
  	            case 0xfeff: // zero-width non-breaking space
  	                // These characters contribute nothing to indentation.
  	                break;
  	            case 32: // ' '
  	            default:
  	                // Treat all other whitespace like ' '.
  	                count += 1;
  	                break;
  	        }
  	    }
  	    return count;
  	}
  	lines.countSpaces = countSpaces;
  	var leadingSpaceExp = /^\s*/;
  	// As specified here: http://www.ecma-international.org/ecma-262/6.0/#sec-line-terminators
  	var lineTerminatorSeqExp = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/;
  	/**
  	 * @param {Object} options - Options object that configures printing.
  	 */
  	function fromString(string, options) {
  	    if (string instanceof Lines)
  	        return string;
  	    string += "";
  	    var tabWidth = options && options.tabWidth;
  	    var tabless = string.indexOf("\t") < 0;
  	    var cacheable = !options && tabless && string.length <= maxCacheKeyLen;
  	    assert_1.default.ok(tabWidth || tabless, "No tab width specified but encountered tabs in string\n" + string);
  	    if (cacheable && hasOwn.call(fromStringCache, string))
  	        return fromStringCache[string];
  	    var lines = new Lines(string.split(lineTerminatorSeqExp).map(function (line) {
  	        // TODO: handle null exec result
  	        var spaces = leadingSpaceExp.exec(line)[0];
  	        return {
  	            line: line,
  	            indent: countSpaces(spaces, tabWidth),
  	            // Boolean indicating whether this line can be reindented.
  	            locked: false,
  	            sliceStart: spaces.length,
  	            sliceEnd: line.length,
  	        };
  	    }), options_1.normalize(options).sourceFileName);
  	    if (cacheable)
  	        fromStringCache[string] = lines;
  	    return lines;
  	}
  	lines.fromString = fromString;
  	function isOnlyWhitespace(string) {
  	    return !/\S/.test(string);
  	}
  	function sliceInfo(info, startCol, endCol) {
  	    var sliceStart = info.sliceStart;
  	    var sliceEnd = info.sliceEnd;
  	    var indent = Math.max(info.indent, 0);
  	    var lineLength = indent + sliceEnd - sliceStart;
  	    if (typeof endCol === "undefined") {
  	        endCol = lineLength;
  	    }
  	    startCol = Math.max(startCol, 0);
  	    endCol = Math.min(endCol, lineLength);
  	    endCol = Math.max(endCol, startCol);
  	    if (endCol < indent) {
  	        indent = endCol;
  	        sliceEnd = sliceStart;
  	    }
  	    else {
  	        sliceEnd -= lineLength - endCol;
  	    }
  	    lineLength = endCol;
  	    lineLength -= startCol;
  	    if (startCol < indent) {
  	        indent -= startCol;
  	    }
  	    else {
  	        startCol -= indent;
  	        indent = 0;
  	        sliceStart += startCol;
  	    }
  	    assert_1.default.ok(indent >= 0);
  	    assert_1.default.ok(sliceStart <= sliceEnd);
  	    assert_1.default.strictEqual(lineLength, indent + sliceEnd - sliceStart);
  	    if (info.indent === indent &&
  	        info.sliceStart === sliceStart &&
  	        info.sliceEnd === sliceEnd) {
  	        return info;
  	    }
  	    return {
  	        line: info.line,
  	        indent: indent,
  	        // A destructive slice always unlocks indentation.
  	        locked: false,
  	        sliceStart: sliceStart,
  	        sliceEnd: sliceEnd,
  	    };
  	}
  	function concat(elements) {
  	    return emptyLines.join(elements);
  	}
  	lines.concat = concat;
  	// The emptyLines object needs to be created all the way down here so that
  	// Lines.prototype will be fully populated.
  	var emptyLines = fromString("");
  	return lines;
  }

  var comments = {};

  var hasRequiredComments;

  function requireComments () {
  	if (hasRequiredComments) return comments;
  	hasRequiredComments = 1;
  	Object.defineProperty(comments, "__esModule", { value: true });
  	comments.printComments = comments.attach = void 0;
  	var tslib_1 = require$$0;
  	var assert_1 = tslib_1.__importDefault(require$$1$1);
  	var types = tslib_1.__importStar(requireMain());
  	var n = types.namedTypes;
  	var isArray = types.builtInTypes.array;
  	var isObject = types.builtInTypes.object;
  	var lines_1 = requireLines();
  	var util_1 = util$5;
  	var childNodesCache = new WeakMap();
  	// TODO Move a non-caching implementation of this function into ast-types,
  	// and implement a caching wrapper function here.
  	function getSortedChildNodes(node, lines, resultArray) {
  	    if (!node) {
  	        return resultArray;
  	    }
  	    // The .loc checks below are sensitive to some of the problems that
  	    // are fixed by this utility function. Specifically, if it decides to
  	    // set node.loc to null, indicating that the node's .loc information
  	    // is unreliable, then we don't want to add node to the resultArray.
  	    util_1.fixFaultyLocations(node, lines);
  	    if (resultArray) {
  	        if (n.Node.check(node) && n.SourceLocation.check(node.loc)) {
  	            // This reverse insertion sort almost always takes constant
  	            // time because we almost always (maybe always?) append the
  	            // nodes in order anyway.
  	            var i = resultArray.length - 1;
  	            for (; i >= 0; --i) {
  	                var child = resultArray[i];
  	                if (child &&
  	                    child.loc &&
  	                    util_1.comparePos(child.loc.end, node.loc.start) <= 0) {
  	                    break;
  	                }
  	            }
  	            resultArray.splice(i + 1, 0, node);
  	            return resultArray;
  	        }
  	    }
  	    else {
  	        var childNodes = childNodesCache.get(node);
  	        if (childNodes) {
  	            return childNodes;
  	        }
  	    }
  	    var names;
  	    if (isArray.check(node)) {
  	        names = Object.keys(node);
  	    }
  	    else if (isObject.check(node)) {
  	        names = types.getFieldNames(node);
  	    }
  	    else {
  	        return resultArray;
  	    }
  	    if (!resultArray) {
  	        childNodesCache.set(node, (resultArray = []));
  	    }
  	    for (var i = 0, nameCount = names.length; i < nameCount; ++i) {
  	        getSortedChildNodes(node[names[i]], lines, resultArray);
  	    }
  	    return resultArray;
  	}
  	// As efficiently as possible, decorate the comment object with
  	// .precedingNode, .enclosingNode, and/or .followingNode properties, at
  	// least one of which is guaranteed to be defined.
  	function decorateComment(node, comment, lines) {
  	    var childNodes = getSortedChildNodes(node, lines);
  	    // Time to dust off the old binary search robes and wizard hat.
  	    var left = 0;
  	    var right = childNodes && childNodes.length;
  	    var precedingNode;
  	    var followingNode;
  	    while (typeof right === "number" && left < right) {
  	        var middle = (left + right) >> 1;
  	        var child = childNodes[middle];
  	        if (util_1.comparePos(child.loc.start, comment.loc.start) <= 0 &&
  	            util_1.comparePos(comment.loc.end, child.loc.end) <= 0) {
  	            // The comment is completely contained by this child node.
  	            decorateComment((comment.enclosingNode = child), comment, lines);
  	            return; // Abandon the binary search at this level.
  	        }
  	        if (util_1.comparePos(child.loc.end, comment.loc.start) <= 0) {
  	            // This child node falls completely before the comment.
  	            // Because we will never consider this node or any nodes
  	            // before it again, this node must be the closest preceding
  	            // node we have encountered so far.
  	            precedingNode = child;
  	            left = middle + 1;
  	            continue;
  	        }
  	        if (util_1.comparePos(comment.loc.end, child.loc.start) <= 0) {
  	            // This child node falls completely after the comment.
  	            // Because we will never consider this node or any nodes after
  	            // it again, this node must be the closest following node we
  	            // have encountered so far.
  	            followingNode = child;
  	            right = middle;
  	            continue;
  	        }
  	        throw new Error("Comment location overlaps with node location");
  	    }
  	    if (precedingNode) {
  	        comment.precedingNode = precedingNode;
  	    }
  	    if (followingNode) {
  	        comment.followingNode = followingNode;
  	    }
  	}
  	function attach(comments, ast, lines) {
  	    if (!isArray.check(comments)) {
  	        return;
  	    }
  	    var tiesToBreak = [];
  	    comments.forEach(function (comment) {
  	        comment.loc.lines = lines;
  	        decorateComment(ast, comment, lines);
  	        var pn = comment.precedingNode;
  	        var en = comment.enclosingNode;
  	        var fn = comment.followingNode;
  	        if (pn && fn) {
  	            var tieCount = tiesToBreak.length;
  	            if (tieCount > 0) {
  	                var lastTie = tiesToBreak[tieCount - 1];
  	                assert_1.default.strictEqual(lastTie.precedingNode === comment.precedingNode, lastTie.followingNode === comment.followingNode);
  	                if (lastTie.followingNode !== comment.followingNode) {
  	                    breakTies(tiesToBreak, lines);
  	                }
  	            }
  	            tiesToBreak.push(comment);
  	        }
  	        else if (pn) {
  	            // No contest: we have a trailing comment.
  	            breakTies(tiesToBreak, lines);
  	            addTrailingComment(pn, comment);
  	        }
  	        else if (fn) {
  	            // No contest: we have a leading comment.
  	            breakTies(tiesToBreak, lines);
  	            addLeadingComment(fn, comment);
  	        }
  	        else if (en) {
  	            // The enclosing node has no child nodes at all, so what we
  	            // have here is a dangling comment, e.g. [/* crickets */].
  	            breakTies(tiesToBreak, lines);
  	            addDanglingComment(en, comment);
  	        }
  	        else {
  	            throw new Error("AST contains no nodes at all?");
  	        }
  	    });
  	    breakTies(tiesToBreak, lines);
  	    comments.forEach(function (comment) {
  	        // These node references were useful for breaking ties, but we
  	        // don't need them anymore, and they create cycles in the AST that
  	        // may lead to infinite recursion if we don't delete them here.
  	        delete comment.precedingNode;
  	        delete comment.enclosingNode;
  	        delete comment.followingNode;
  	    });
  	}
  	comments.attach = attach;
  	function breakTies(tiesToBreak, lines) {
  	    var tieCount = tiesToBreak.length;
  	    if (tieCount === 0) {
  	        return;
  	    }
  	    var pn = tiesToBreak[0].precedingNode;
  	    var fn = tiesToBreak[0].followingNode;
  	    var gapEndPos = fn.loc.start;
  	    // Iterate backwards through tiesToBreak, examining the gaps
  	    // between the tied comments. In order to qualify as leading, a
  	    // comment must be separated from fn by an unbroken series of
  	    // whitespace-only gaps (or other comments).
  	    var indexOfFirstLeadingComment = tieCount;
  	    var comment;
  	    for (; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
  	        comment = tiesToBreak[indexOfFirstLeadingComment - 1];
  	        assert_1.default.strictEqual(comment.precedingNode, pn);
  	        assert_1.default.strictEqual(comment.followingNode, fn);
  	        var gap = lines.sliceString(comment.loc.end, gapEndPos);
  	        if (/\S/.test(gap)) {
  	            // The gap string contained something other than whitespace.
  	            break;
  	        }
  	        gapEndPos = comment.loc.start;
  	    }
  	    while (indexOfFirstLeadingComment <= tieCount &&
  	        (comment = tiesToBreak[indexOfFirstLeadingComment]) &&
  	        // If the comment is a //-style comment and indented more
  	        // deeply than the node itself, reconsider it as trailing.
  	        (comment.type === "Line" || comment.type === "CommentLine") &&
  	        comment.loc.start.column > fn.loc.start.column) {
  	        ++indexOfFirstLeadingComment;
  	    }
  	    tiesToBreak.forEach(function (comment, i) {
  	        if (i < indexOfFirstLeadingComment) {
  	            addTrailingComment(pn, comment);
  	        }
  	        else {
  	            addLeadingComment(fn, comment);
  	        }
  	    });
  	    tiesToBreak.length = 0;
  	}
  	function addCommentHelper(node, comment) {
  	    var comments = node.comments || (node.comments = []);
  	    comments.push(comment);
  	}
  	function addLeadingComment(node, comment) {
  	    comment.leading = true;
  	    comment.trailing = false;
  	    addCommentHelper(node, comment);
  	}
  	function addDanglingComment(node, comment) {
  	    comment.leading = false;
  	    comment.trailing = false;
  	    addCommentHelper(node, comment);
  	}
  	function addTrailingComment(node, comment) {
  	    comment.leading = false;
  	    comment.trailing = true;
  	    addCommentHelper(node, comment);
  	}
  	function printLeadingComment(commentPath, print) {
  	    var comment = commentPath.getValue();
  	    n.Comment.assert(comment);
  	    var loc = comment.loc;
  	    var lines = loc && loc.lines;
  	    var parts = [print(commentPath)];
  	    if (comment.trailing) {
  	        // When we print trailing comments as leading comments, we don't
  	        // want to bring any trailing spaces along.
  	        parts.push("\n");
  	    }
  	    else if (lines instanceof lines_1.Lines) {
  	        var trailingSpace = lines.slice(loc.end, lines.skipSpaces(loc.end) || lines.lastPos());
  	        if (trailingSpace.length === 1) {
  	            // If the trailing space contains no newlines, then we want to
  	            // preserve it exactly as we found it.
  	            parts.push(trailingSpace);
  	        }
  	        else {
  	            // If the trailing space contains newlines, then replace it
  	            // with just that many newlines, with all other spaces removed.
  	            parts.push(new Array(trailingSpace.length).join("\n"));
  	        }
  	    }
  	    else {
  	        parts.push("\n");
  	    }
  	    return lines_1.concat(parts);
  	}
  	function printTrailingComment(commentPath, print) {
  	    var comment = commentPath.getValue(commentPath);
  	    n.Comment.assert(comment);
  	    var loc = comment.loc;
  	    var lines = loc && loc.lines;
  	    var parts = [];
  	    if (lines instanceof lines_1.Lines) {
  	        var fromPos = lines.skipSpaces(loc.start, true) || lines.firstPos();
  	        var leadingSpace = lines.slice(fromPos, loc.start);
  	        if (leadingSpace.length === 1) {
  	            // If the leading space contains no newlines, then we want to
  	            // preserve it exactly as we found it.
  	            parts.push(leadingSpace);
  	        }
  	        else {
  	            // If the leading space contains newlines, then replace it
  	            // with just that many newlines, sans all other spaces.
  	            parts.push(new Array(leadingSpace.length).join("\n"));
  	        }
  	    }
  	    parts.push(print(commentPath));
  	    return lines_1.concat(parts);
  	}
  	function printComments(path, print) {
  	    var value = path.getValue();
  	    var innerLines = print(path);
  	    var comments = n.Node.check(value) && types.getFieldValue(value, "comments");
  	    if (!comments || comments.length === 0) {
  	        return innerLines;
  	    }
  	    var leadingParts = [];
  	    var trailingParts = [innerLines];
  	    path.each(function (commentPath) {
  	        var comment = commentPath.getValue();
  	        var leading = types.getFieldValue(comment, "leading");
  	        var trailing = types.getFieldValue(comment, "trailing");
  	        if (leading ||
  	            (trailing &&
  	                !(n.Statement.check(value) ||
  	                    comment.type === "Block" ||
  	                    comment.type === "CommentBlock"))) {
  	            leadingParts.push(printLeadingComment(commentPath, print));
  	        }
  	        else if (trailing) {
  	            trailingParts.push(printTrailingComment(commentPath, print));
  	        }
  	    }, "comments");
  	    leadingParts.push.apply(leadingParts, trailingParts);
  	    return lines_1.concat(leadingParts);
  	}
  	comments.printComments = printComments;
  	return comments;
  }

  var hasRequiredParser;

  function requireParser () {
  	if (hasRequiredParser) return parser;
  	hasRequiredParser = 1;
  	Object.defineProperty(parser, "__esModule", { value: true });
  	parser.parse = void 0;
  	var tslib_1 = require$$0;
  	var assert_1 = tslib_1.__importDefault(require$$1$1);
  	var types = tslib_1.__importStar(requireMain());
  	var b = types.builders;
  	var isObject = types.builtInTypes.object;
  	var isArray = types.builtInTypes.array;
  	var options_1 = requireOptions();
  	var lines_1 = requireLines();
  	var comments_1 = requireComments();
  	var util = tslib_1.__importStar(util$5);
  	function parse(source, options) {
  	    options = options_1.normalize(options);
  	    var lines = lines_1.fromString(source, options);
  	    var sourceWithoutTabs = lines.toString({
  	        tabWidth: options.tabWidth,
  	        reuseWhitespace: false,
  	        useTabs: false,
  	    });
  	    var comments = [];
  	    var ast = options.parser.parse(sourceWithoutTabs, {
  	        jsx: true,
  	        loc: true,
  	        locations: true,
  	        range: options.range,
  	        comment: true,
  	        onComment: comments,
  	        tolerant: util.getOption(options, "tolerant", true),
  	        ecmaVersion: 6,
  	        sourceType: util.getOption(options, "sourceType", "module"),
  	    });
  	    // Use ast.tokens if possible, and otherwise fall back to the Esprima
  	    // tokenizer. All the preconfigured ../parsers/* expose ast.tokens
  	    // automatically, but custom parsers might need additional configuration
  	    // to avoid this fallback.
  	    var tokens = Array.isArray(ast.tokens)
  	        ? ast.tokens
  	        : require("esprima").tokenize(sourceWithoutTabs, {
  	            loc: true,
  	        });
  	    // We will reattach the tokens array to the file object below.
  	    delete ast.tokens;
  	    // Make sure every token has a token.value string.
  	    tokens.forEach(function (token) {
  	        if (typeof token.value !== "string") {
  	            token.value = lines.sliceString(token.loc.start, token.loc.end);
  	        }
  	    });
  	    if (Array.isArray(ast.comments)) {
  	        comments = ast.comments;
  	        delete ast.comments;
  	    }
  	    if (ast.loc) {
  	        // If the source was empty, some parsers give loc.{start,end}.line
  	        // values of 0, instead of the minimum of 1.
  	        util.fixFaultyLocations(ast, lines);
  	    }
  	    else {
  	        ast.loc = {
  	            start: lines.firstPos(),
  	            end: lines.lastPos(),
  	        };
  	    }
  	    ast.loc.lines = lines;
  	    ast.loc.indent = 0;
  	    var file;
  	    var program;
  	    if (ast.type === "Program") {
  	        program = ast;
  	        // In order to ensure we reprint leading and trailing program
  	        // comments, wrap the original Program node with a File node. Only
  	        // ESTree parsers (Acorn and Esprima) return a Program as the root AST
  	        // node. Most other (Babylon-like) parsers return a File.
  	        file = b.file(ast, options.sourceFileName || null);
  	        file.loc = {
  	            start: lines.firstPos(),
  	            end: lines.lastPos(),
  	            lines: lines,
  	            indent: 0,
  	        };
  	    }
  	    else if (ast.type === "File") {
  	        file = ast;
  	        program = file.program;
  	    }
  	    // Expose file.tokens unless the caller passed false for options.tokens.
  	    if (options.tokens) {
  	        file.tokens = tokens;
  	    }
  	    // Expand the Program's .loc to include all comments (not just those
  	    // attached to the Program node, as its children may have comments as
  	    // well), since sometimes program.loc.{start,end} will coincide with the
  	    // .loc.{start,end} of the first and last *statements*, mistakenly
  	    // excluding comments that fall outside that region.
  	    var trueProgramLoc = util.getTrueLoc({
  	        type: program.type,
  	        loc: program.loc,
  	        body: [],
  	        comments: comments,
  	    }, lines);
  	    program.loc.start = trueProgramLoc.start;
  	    program.loc.end = trueProgramLoc.end;
  	    // Passing file.program here instead of just file means that initial
  	    // comments will be attached to program.body[0] instead of program.
  	    comments_1.attach(comments, program.body.length ? file.program : file, lines);
  	    // Return a copy of the original AST so that any changes made may be
  	    // compared to the original.
  	    return new TreeCopier(lines, tokens).copy(file);
  	}
  	parser.parse = parse;
  	var TreeCopier = function TreeCopier(lines, tokens) {
  	    assert_1.default.ok(this instanceof TreeCopier);
  	    this.lines = lines;
  	    this.tokens = tokens;
  	    this.startTokenIndex = 0;
  	    this.endTokenIndex = tokens.length;
  	    this.indent = 0;
  	    this.seen = new Map();
  	};
  	var TCp = TreeCopier.prototype;
  	TCp.copy = function (node) {
  	    if (this.seen.has(node)) {
  	        return this.seen.get(node);
  	    }
  	    if (isArray.check(node)) {
  	        var copy_1 = new Array(node.length);
  	        this.seen.set(node, copy_1);
  	        node.forEach(function (item, i) {
  	            copy_1[i] = this.copy(item);
  	        }, this);
  	        return copy_1;
  	    }
  	    if (!isObject.check(node)) {
  	        return node;
  	    }
  	    util.fixFaultyLocations(node, this.lines);
  	    var copy = Object.create(Object.getPrototypeOf(node), {
  	        original: {
  	            // Provide a link from the copy to the original.
  	            value: node,
  	            configurable: false,
  	            enumerable: false,
  	            writable: true,
  	        },
  	    });
  	    this.seen.set(node, copy);
  	    var loc = node.loc;
  	    var oldIndent = this.indent;
  	    var newIndent = oldIndent;
  	    var oldStartTokenIndex = this.startTokenIndex;
  	    var oldEndTokenIndex = this.endTokenIndex;
  	    if (loc) {
  	        // When node is a comment, we set node.loc.indent to
  	        // node.loc.start.column so that, when/if we print the comment by
  	        // itself, we can strip that much whitespace from the left margin of
  	        // the comment. This only really matters for multiline Block comments,
  	        // but it doesn't hurt for Line comments.
  	        if (node.type === "Block" ||
  	            node.type === "Line" ||
  	            node.type === "CommentBlock" ||
  	            node.type === "CommentLine" ||
  	            this.lines.isPrecededOnlyByWhitespace(loc.start)) {
  	            newIndent = this.indent = loc.start.column;
  	        }
  	        // Every node.loc has a reference to the original source lines as well
  	        // as a complete list of source tokens.
  	        loc.lines = this.lines;
  	        loc.tokens = this.tokens;
  	        loc.indent = newIndent;
  	        // Set loc.start.token and loc.end.token such that
  	        // loc.tokens.slice(loc.start.token, loc.end.token) returns a list of
  	        // all the tokens that make up this node.
  	        this.findTokenRange(loc);
  	    }
  	    var keys = Object.keys(node);
  	    var keyCount = keys.length;
  	    for (var i = 0; i < keyCount; ++i) {
  	        var key = keys[i];
  	        if (key === "loc") {
  	            copy[key] = node[key];
  	        }
  	        else if (key === "tokens" && node.type === "File") {
  	            // Preserve file.tokens (uncopied) in case client code cares about
  	            // it, even though Recast ignores it when reprinting.
  	            copy[key] = node[key];
  	        }
  	        else {
  	            copy[key] = this.copy(node[key]);
  	        }
  	    }
  	    this.indent = oldIndent;
  	    this.startTokenIndex = oldStartTokenIndex;
  	    this.endTokenIndex = oldEndTokenIndex;
  	    return copy;
  	};
  	// If we didn't have any idea where in loc.tokens to look for tokens
  	// contained by this loc, a binary search would be appropriate, but
  	// because we maintain this.startTokenIndex and this.endTokenIndex as we
  	// traverse the AST, we only need to make small (linear) adjustments to
  	// those indexes with each recursive iteration.
  	TCp.findTokenRange = function (loc) {
  	    // In the unlikely event that loc.tokens[this.startTokenIndex] starts
  	    // *after* loc.start, we need to rewind this.startTokenIndex first.
  	    while (this.startTokenIndex > 0) {
  	        var token = loc.tokens[this.startTokenIndex];
  	        if (util.comparePos(loc.start, token.loc.start) < 0) {
  	            --this.startTokenIndex;
  	        }
  	        else
  	            break;
  	    }
  	    // In the unlikely event that loc.tokens[this.endTokenIndex - 1] ends
  	    // *before* loc.end, we need to fast-forward this.endTokenIndex first.
  	    while (this.endTokenIndex < loc.tokens.length) {
  	        var token = loc.tokens[this.endTokenIndex];
  	        if (util.comparePos(token.loc.end, loc.end) < 0) {
  	            ++this.endTokenIndex;
  	        }
  	        else
  	            break;
  	    }
  	    // Increment this.startTokenIndex until we've found the first token
  	    // contained by this node.
  	    while (this.startTokenIndex < this.endTokenIndex) {
  	        var token = loc.tokens[this.startTokenIndex];
  	        if (util.comparePos(token.loc.start, loc.start) < 0) {
  	            ++this.startTokenIndex;
  	        }
  	        else
  	            break;
  	    }
  	    // Index into loc.tokens of the first token within this node.
  	    loc.start.token = this.startTokenIndex;
  	    // Decrement this.endTokenIndex until we've found the first token after
  	    // this node (not contained by the node).
  	    while (this.endTokenIndex > this.startTokenIndex) {
  	        var token = loc.tokens[this.endTokenIndex - 1];
  	        if (util.comparePos(loc.end, token.loc.end) < 0) {
  	            --this.endTokenIndex;
  	        }
  	        else
  	            break;
  	    }
  	    // Index into loc.tokens of the first token *after* this node.
  	    // If loc.start.token === loc.end.token, the node contains no tokens,
  	    // and the index is that of the next token following this node.
  	    loc.end.token = this.endTokenIndex;
  	};
  	return parser;
  }

  var printer = {};

  var patcher = {};

  var fastPath = {};

  var hasRequiredFastPath;

  function requireFastPath () {
  	if (hasRequiredFastPath) return fastPath;
  	hasRequiredFastPath = 1;
  	Object.defineProperty(fastPath, "__esModule", { value: true });
  	var tslib_1 = require$$0;
  	var assert_1 = tslib_1.__importDefault(require$$1$1);
  	var types = tslib_1.__importStar(requireMain());
  	var util = tslib_1.__importStar(util$5);
  	var n = types.namedTypes;
  	var isArray = types.builtInTypes.array;
  	var isNumber = types.builtInTypes.number;
  	var PRECEDENCE = {};
  	[
  	    ["||"],
  	    ["&&"],
  	    ["|"],
  	    ["^"],
  	    ["&"],
  	    ["==", "===", "!=", "!=="],
  	    ["<", ">", "<=", ">=", "in", "instanceof"],
  	    [">>", "<<", ">>>"],
  	    ["+", "-"],
  	    ["*", "/", "%"],
  	    ["**"],
  	].forEach(function (tier, i) {
  	    tier.forEach(function (op) {
  	        PRECEDENCE[op] = i;
  	    });
  	});
  	var FastPath = function FastPath(value) {
  	    assert_1.default.ok(this instanceof FastPath);
  	    this.stack = [value];
  	};
  	var FPp = FastPath.prototype;
  	// Static convenience function for coercing a value to a FastPath.
  	FastPath.from = function (obj) {
  	    if (obj instanceof FastPath) {
  	        // Return a defensive copy of any existing FastPath instances.
  	        return obj.copy();
  	    }
  	    if (obj instanceof types.NodePath) {
  	        // For backwards compatibility, unroll NodePath instances into
  	        // lightweight FastPath [..., name, value] stacks.
  	        var copy = Object.create(FastPath.prototype);
  	        var stack = [obj.value];
  	        for (var pp = void 0; (pp = obj.parentPath); obj = pp)
  	            stack.push(obj.name, pp.value);
  	        copy.stack = stack.reverse();
  	        return copy;
  	    }
  	    // Otherwise use obj as the value of the new FastPath instance.
  	    return new FastPath(obj);
  	};
  	FPp.copy = function copy() {
  	    var copy = Object.create(FastPath.prototype);
  	    copy.stack = this.stack.slice(0);
  	    return copy;
  	};
  	// The name of the current property is always the penultimate element of
  	// this.stack, and always a String.
  	FPp.getName = function getName() {
  	    var s = this.stack;
  	    var len = s.length;
  	    if (len > 1) {
  	        return s[len - 2];
  	    }
  	    // Since the name is always a string, null is a safe sentinel value to
  	    // return if we do not know the name of the (root) value.
  	    return null;
  	};
  	// The value of the current property is always the final element of
  	// this.stack.
  	FPp.getValue = function getValue() {
  	    var s = this.stack;
  	    return s[s.length - 1];
  	};
  	FPp.valueIsDuplicate = function () {
  	    var s = this.stack;
  	    var valueIndex = s.length - 1;
  	    return s.lastIndexOf(s[valueIndex], valueIndex - 1) >= 0;
  	};
  	function getNodeHelper(path, count) {
  	    var s = path.stack;
  	    for (var i = s.length - 1; i >= 0; i -= 2) {
  	        var value = s[i];
  	        if (n.Node.check(value) && --count < 0) {
  	            return value;
  	        }
  	    }
  	    return null;
  	}
  	FPp.getNode = function getNode(count) {
  	    if (count === void 0) { count = 0; }
  	    return getNodeHelper(this, ~~count);
  	};
  	FPp.getParentNode = function getParentNode(count) {
  	    if (count === void 0) { count = 0; }
  	    return getNodeHelper(this, ~~count + 1);
  	};
  	// The length of the stack can be either even or odd, depending on whether
  	// or not we have a name for the root value. The difference between the
  	// index of the root value and the index of the final value is always
  	// even, though, which allows us to return the root value in constant time
  	// (i.e. without iterating backwards through the stack).
  	FPp.getRootValue = function getRootValue() {
  	    var s = this.stack;
  	    if (s.length % 2 === 0) {
  	        return s[1];
  	    }
  	    return s[0];
  	};
  	// Temporarily push properties named by string arguments given after the
  	// callback function onto this.stack, then call the callback with a
  	// reference to this (modified) FastPath object. Note that the stack will
  	// be restored to its original state after the callback is finished, so it
  	// is probably a mistake to retain a reference to the path.
  	FPp.call = function call(callback /*, name1, name2, ... */) {
  	    var s = this.stack;
  	    var origLen = s.length;
  	    var value = s[origLen - 1];
  	    var argc = arguments.length;
  	    for (var i = 1; i < argc; ++i) {
  	        var name = arguments[i];
  	        value = value[name];
  	        s.push(name, value);
  	    }
  	    var result = callback(this);
  	    s.length = origLen;
  	    return result;
  	};
  	// Similar to FastPath.prototype.call, except that the value obtained by
  	// accessing this.getValue()[name1][name2]... should be array-like. The
  	// callback will be called with a reference to this path object for each
  	// element of the array.
  	FPp.each = function each(callback /*, name1, name2, ... */) {
  	    var s = this.stack;
  	    var origLen = s.length;
  	    var value = s[origLen - 1];
  	    var argc = arguments.length;
  	    for (var i = 1; i < argc; ++i) {
  	        var name = arguments[i];
  	        value = value[name];
  	        s.push(name, value);
  	    }
  	    for (var i = 0; i < value.length; ++i) {
  	        if (i in value) {
  	            s.push(i, value[i]);
  	            // If the callback needs to know the value of i, call
  	            // path.getName(), assuming path is the parameter name.
  	            callback(this);
  	            s.length -= 2;
  	        }
  	    }
  	    s.length = origLen;
  	};
  	// Similar to FastPath.prototype.each, except that the results of the
  	// callback function invocations are stored in an array and returned at
  	// the end of the iteration.
  	FPp.map = function map(callback /*, name1, name2, ... */) {
  	    var s = this.stack;
  	    var origLen = s.length;
  	    var value = s[origLen - 1];
  	    var argc = arguments.length;
  	    for (var i = 1; i < argc; ++i) {
  	        var name = arguments[i];
  	        value = value[name];
  	        s.push(name, value);
  	    }
  	    var result = new Array(value.length);
  	    for (var i = 0; i < value.length; ++i) {
  	        if (i in value) {
  	            s.push(i, value[i]);
  	            result[i] = callback(this, i);
  	            s.length -= 2;
  	        }
  	    }
  	    s.length = origLen;
  	    return result;
  	};
  	// Returns true if the node at the tip of the path is wrapped with
  	// parentheses, OR if the only reason the node needed parentheses was that
  	// it couldn't be the first expression in the enclosing statement (see
  	// FastPath#canBeFirstInStatement), and it has an opening `(` character.
  	// For example, the FunctionExpression in `(function(){}())` appears to
  	// need parentheses only because it's the first expression in the AST, but
  	// since it happens to be preceded by a `(` (which is not apparent from
  	// the AST but can be determined using FastPath#getPrevToken), there is no
  	// ambiguity about how to parse it, so it counts as having parentheses,
  	// even though it is not immediately followed by a `)`.
  	FPp.hasParens = function () {
  	    var node = this.getNode();
  	    var prevToken = this.getPrevToken(node);
  	    if (!prevToken) {
  	        return false;
  	    }
  	    var nextToken = this.getNextToken(node);
  	    if (!nextToken) {
  	        return false;
  	    }
  	    if (prevToken.value === "(") {
  	        if (nextToken.value === ")") {
  	            // If the node preceded by a `(` token and followed by a `)` token,
  	            // then of course it has parentheses.
  	            return true;
  	        }
  	        // If this is one of the few Expression types that can't come first in
  	        // the enclosing statement because of parsing ambiguities (namely,
  	        // FunctionExpression, ObjectExpression, and ClassExpression) and
  	        // this.firstInStatement() returns true, and the node would not need
  	        // parentheses in an expression context because this.needsParens(true)
  	        // returns false, then it just needs an opening parenthesis to resolve
  	        // the parsing ambiguity that made it appear to need parentheses.
  	        var justNeedsOpeningParen = !this.canBeFirstInStatement() &&
  	            this.firstInStatement() &&
  	            !this.needsParens(true);
  	        if (justNeedsOpeningParen) {
  	            return true;
  	        }
  	    }
  	    return false;
  	};
  	FPp.getPrevToken = function (node) {
  	    node = node || this.getNode();
  	    var loc = node && node.loc;
  	    var tokens = loc && loc.tokens;
  	    if (tokens && loc.start.token > 0) {
  	        var token = tokens[loc.start.token - 1];
  	        if (token) {
  	            // Do not return tokens that fall outside the root subtree.
  	            var rootLoc = this.getRootValue().loc;
  	            if (util.comparePos(rootLoc.start, token.loc.start) <= 0) {
  	                return token;
  	            }
  	        }
  	    }
  	    return null;
  	};
  	FPp.getNextToken = function (node) {
  	    node = node || this.getNode();
  	    var loc = node && node.loc;
  	    var tokens = loc && loc.tokens;
  	    if (tokens && loc.end.token < tokens.length) {
  	        var token = tokens[loc.end.token];
  	        if (token) {
  	            // Do not return tokens that fall outside the root subtree.
  	            var rootLoc = this.getRootValue().loc;
  	            if (util.comparePos(token.loc.end, rootLoc.end) <= 0) {
  	                return token;
  	            }
  	        }
  	    }
  	    return null;
  	};
  	// Inspired by require("ast-types").NodePath.prototype.needsParens, but
  	// more efficient because we're iterating backwards through a stack.
  	FPp.needsParens = function (assumeExpressionContext) {
  	    var node = this.getNode();
  	    // This needs to come before `if (!parent) { return false }` because
  	    // an object destructuring assignment requires parens for
  	    // correctness even when it's the topmost expression.
  	    if (node.type === "AssignmentExpression" &&
  	        node.left.type === "ObjectPattern") {
  	        return true;
  	    }
  	    var parent = this.getParentNode();
  	    if (!parent) {
  	        return false;
  	    }
  	    var name = this.getName();
  	    // If the value of this path is some child of a Node and not a Node
  	    // itself, then it doesn't need parentheses. Only Node objects (in fact,
  	    // only Expression nodes) need parentheses.
  	    if (this.getValue() !== node) {
  	        return false;
  	    }
  	    // Only statements don't need parentheses.
  	    if (n.Statement.check(node)) {
  	        return false;
  	    }
  	    // Identifiers never need parentheses.
  	    if (node.type === "Identifier") {
  	        return false;
  	    }
  	    if (parent.type === "ParenthesizedExpression" ||
  	        (node.extra && node.extra.parenthesized)) {
  	        return false;
  	    }
  	    switch (node.type) {
  	        case "UnaryExpression":
  	        case "SpreadElement":
  	        case "SpreadProperty":
  	            return (parent.type === "MemberExpression" &&
  	                name === "object" &&
  	                parent.object === node);
  	        case "BinaryExpression":
  	        case "LogicalExpression":
  	            switch (parent.type) {
  	                case "CallExpression":
  	                    return name === "callee" && parent.callee === node;
  	                case "UnaryExpression":
  	                case "SpreadElement":
  	                case "SpreadProperty":
  	                    return true;
  	                case "MemberExpression":
  	                    return name === "object" && parent.object === node;
  	                case "BinaryExpression":
  	                case "LogicalExpression": {
  	                    var po = parent.operator;
  	                    var pp = PRECEDENCE[po];
  	                    var no = node.operator;
  	                    var np = PRECEDENCE[no];
  	                    if (pp > np) {
  	                        return true;
  	                    }
  	                    if (pp === np && name === "right") {
  	                        assert_1.default.strictEqual(parent.right, node);
  	                        return true;
  	                    }
  	                    break;
  	                }
  	                default:
  	                    return false;
  	            }
  	            break;
  	        case "SequenceExpression":
  	            switch (parent.type) {
  	                case "ReturnStatement":
  	                    return false;
  	                case "ForStatement":
  	                    // Although parentheses wouldn't hurt around sequence expressions in
  	                    // the head of for loops, traditional style dictates that e.g. i++,
  	                    // j++ should not be wrapped with parentheses.
  	                    return false;
  	                case "ExpressionStatement":
  	                    return name !== "expression";
  	                default:
  	                    // Otherwise err on the side of overparenthesization, adding
  	                    // explicit exceptions above if this proves overzealous.
  	                    return true;
  	            }
  	        case "IntersectionTypeAnnotation":
  	        case "UnionTypeAnnotation":
  	            return parent.type === "NullableTypeAnnotation";
  	        case "Literal":
  	            return (parent.type === "MemberExpression" &&
  	                isNumber.check(node.value) &&
  	                name === "object" &&
  	                parent.object === node);
  	        // Babel 6 Literal split
  	        case "NumericLiteral":
  	            return (parent.type === "MemberExpression" &&
  	                name === "object" &&
  	                parent.object === node);
  	        case "YieldExpression":
  	        case "AwaitExpression":
  	        case "AssignmentExpression":
  	        case "ConditionalExpression":
  	            switch (parent.type) {
  	                case "UnaryExpression":
  	                case "SpreadElement":
  	                case "SpreadProperty":
  	                case "BinaryExpression":
  	                case "LogicalExpression":
  	                    return true;
  	                case "CallExpression":
  	                case "NewExpression":
  	                    return name === "callee" && parent.callee === node;
  	                case "ConditionalExpression":
  	                    return name === "test" && parent.test === node;
  	                case "MemberExpression":
  	                    return name === "object" && parent.object === node;
  	                default:
  	                    return false;
  	            }
  	        case "ArrowFunctionExpression":
  	            if (n.CallExpression.check(parent) &&
  	                name === "callee" &&
  	                parent.callee === node) {
  	                return true;
  	            }
  	            if (n.MemberExpression.check(parent) &&
  	                name === "object" &&
  	                parent.object === node) {
  	                return true;
  	            }
  	            if (n.TSAsExpression &&
  	                n.TSAsExpression.check(parent) &&
  	                name === "expression" &&
  	                parent.expression === node) {
  	                return true;
  	            }
  	            return isBinary(parent);
  	        case "ObjectExpression":
  	            if (parent.type === "ArrowFunctionExpression" &&
  	                name === "body" &&
  	                parent.body === node) {
  	                return true;
  	            }
  	            break;
  	        case "TSAsExpression":
  	            if (parent.type === "ArrowFunctionExpression" &&
  	                name === "body" &&
  	                parent.body === node &&
  	                node.expression.type === "ObjectExpression") {
  	                return true;
  	            }
  	            break;
  	        case "CallExpression":
  	            if (name === "declaration" &&
  	                n.ExportDefaultDeclaration.check(parent) &&
  	                n.FunctionExpression.check(node.callee)) {
  	                return true;
  	            }
  	    }
  	    if (parent.type === "NewExpression" &&
  	        name === "callee" &&
  	        parent.callee === node) {
  	        return containsCallExpression(node);
  	    }
  	    if (assumeExpressionContext !== true &&
  	        !this.canBeFirstInStatement() &&
  	        this.firstInStatement()) {
  	        return true;
  	    }
  	    return false;
  	};
  	function isBinary(node) {
  	    return n.BinaryExpression.check(node) || n.LogicalExpression.check(node);
  	}
  	function containsCallExpression(node) {
  	    if (n.CallExpression.check(node)) {
  	        return true;
  	    }
  	    if (isArray.check(node)) {
  	        return node.some(containsCallExpression);
  	    }
  	    if (n.Node.check(node)) {
  	        return types.someField(node, function (_name, child) {
  	            return containsCallExpression(child);
  	        });
  	    }
  	    return false;
  	}
  	FPp.canBeFirstInStatement = function () {
  	    var node = this.getNode();
  	    if (n.FunctionExpression.check(node)) {
  	        return false;
  	    }
  	    if (n.ObjectExpression.check(node)) {
  	        return false;
  	    }
  	    if (n.ClassExpression.check(node)) {
  	        return false;
  	    }
  	    return true;
  	};
  	FPp.firstInStatement = function () {
  	    var s = this.stack;
  	    var parentName, parent;
  	    var childName, child;
  	    for (var i = s.length - 1; i >= 0; i -= 2) {
  	        if (n.Node.check(s[i])) {
  	            childName = parentName;
  	            child = parent;
  	            parentName = s[i - 1];
  	            parent = s[i];
  	        }
  	        if (!parent || !child) {
  	            continue;
  	        }
  	        if (n.BlockStatement.check(parent) &&
  	            parentName === "body" &&
  	            childName === 0) {
  	            assert_1.default.strictEqual(parent.body[0], child);
  	            return true;
  	        }
  	        if (n.ExpressionStatement.check(parent) && childName === "expression") {
  	            assert_1.default.strictEqual(parent.expression, child);
  	            return true;
  	        }
  	        if (n.AssignmentExpression.check(parent) && childName === "left") {
  	            assert_1.default.strictEqual(parent.left, child);
  	            return true;
  	        }
  	        if (n.ArrowFunctionExpression.check(parent) && childName === "body") {
  	            assert_1.default.strictEqual(parent.body, child);
  	            return true;
  	        }
  	        if (n.SequenceExpression.check(parent) &&
  	            parentName === "expressions" &&
  	            childName === 0) {
  	            assert_1.default.strictEqual(parent.expressions[0], child);
  	            continue;
  	        }
  	        if (n.CallExpression.check(parent) && childName === "callee") {
  	            assert_1.default.strictEqual(parent.callee, child);
  	            continue;
  	        }
  	        if (n.MemberExpression.check(parent) && childName === "object") {
  	            assert_1.default.strictEqual(parent.object, child);
  	            continue;
  	        }
  	        if (n.ConditionalExpression.check(parent) && childName === "test") {
  	            assert_1.default.strictEqual(parent.test, child);
  	            continue;
  	        }
  	        if (isBinary(parent) && childName === "left") {
  	            assert_1.default.strictEqual(parent.left, child);
  	            continue;
  	        }
  	        if (n.UnaryExpression.check(parent) &&
  	            !parent.prefix &&
  	            childName === "argument") {
  	            assert_1.default.strictEqual(parent.argument, child);
  	            continue;
  	        }
  	        return false;
  	    }
  	    return true;
  	};
  	fastPath.default = FastPath;
  	return fastPath;
  }

  var hasRequiredPatcher;

  function requirePatcher () {
  	if (hasRequiredPatcher) return patcher;
  	hasRequiredPatcher = 1;
  	Object.defineProperty(patcher, "__esModule", { value: true });
  	patcher.getReprinter = patcher.Patcher = void 0;
  	var tslib_1 = require$$0;
  	var assert_1 = tslib_1.__importDefault(require$$1$1);
  	var linesModule = tslib_1.__importStar(requireLines());
  	var types = tslib_1.__importStar(requireMain());
  	var Printable = types.namedTypes.Printable;
  	var Expression = types.namedTypes.Expression;
  	var ReturnStatement = types.namedTypes.ReturnStatement;
  	var SourceLocation = types.namedTypes.SourceLocation;
  	var util_1 = util$5;
  	var fast_path_1 = tslib_1.__importDefault(requireFastPath());
  	var isObject = types.builtInTypes.object;
  	var isArray = types.builtInTypes.array;
  	var isString = types.builtInTypes.string;
  	var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
  	var Patcher = function Patcher(lines) {
  	    assert_1.default.ok(this instanceof Patcher);
  	    assert_1.default.ok(lines instanceof linesModule.Lines);
  	    var self = this, replacements = [];
  	    self.replace = function (loc, lines) {
  	        if (isString.check(lines))
  	            lines = linesModule.fromString(lines);
  	        replacements.push({
  	            lines: lines,
  	            start: loc.start,
  	            end: loc.end,
  	        });
  	    };
  	    self.get = function (loc) {
  	        // If no location is provided, return the complete Lines object.
  	        loc = loc || {
  	            start: { line: 1, column: 0 },
  	            end: { line: lines.length, column: lines.getLineLength(lines.length) },
  	        };
  	        var sliceFrom = loc.start, toConcat = [];
  	        function pushSlice(from, to) {
  	            assert_1.default.ok(util_1.comparePos(from, to) <= 0);
  	            toConcat.push(lines.slice(from, to));
  	        }
  	        replacements
  	            .sort(function (a, b) { return util_1.comparePos(a.start, b.start); })
  	            .forEach(function (rep) {
  	            if (util_1.comparePos(sliceFrom, rep.start) > 0) ;
  	            else {
  	                pushSlice(sliceFrom, rep.start);
  	                toConcat.push(rep.lines);
  	                sliceFrom = rep.end;
  	            }
  	        });
  	        pushSlice(sliceFrom, loc.end);
  	        return linesModule.concat(toConcat);
  	    };
  	};
  	patcher.Patcher = Patcher;
  	var Pp = Patcher.prototype;
  	Pp.tryToReprintComments = function (newNode, oldNode, print) {
  	    var patcher = this;
  	    if (!newNode.comments && !oldNode.comments) {
  	        // We were (vacuously) able to reprint all the comments!
  	        return true;
  	    }
  	    var newPath = fast_path_1.default.from(newNode);
  	    var oldPath = fast_path_1.default.from(oldNode);
  	    newPath.stack.push("comments", getSurroundingComments(newNode));
  	    oldPath.stack.push("comments", getSurroundingComments(oldNode));
  	    var reprints = [];
  	    var ableToReprintComments = findArrayReprints(newPath, oldPath, reprints);
  	    // No need to pop anything from newPath.stack or oldPath.stack, since
  	    // newPath and oldPath are fresh local variables.
  	    if (ableToReprintComments && reprints.length > 0) {
  	        reprints.forEach(function (reprint) {
  	            var oldComment = reprint.oldPath.getValue();
  	            assert_1.default.ok(oldComment.leading || oldComment.trailing);
  	            patcher.replace(oldComment.loc, 
  	            // Comments can't have .comments, so it doesn't matter whether we
  	            // print with comments or without.
  	            print(reprint.newPath).indentTail(oldComment.loc.indent));
  	        });
  	    }
  	    return ableToReprintComments;
  	};
  	// Get all comments that are either leading or trailing, ignoring any
  	// comments that occur inside node.loc. Returns an empty array for nodes
  	// with no leading or trailing comments.
  	function getSurroundingComments(node) {
  	    var result = [];
  	    if (node.comments && node.comments.length > 0) {
  	        node.comments.forEach(function (comment) {
  	            if (comment.leading || comment.trailing) {
  	                result.push(comment);
  	            }
  	        });
  	    }
  	    return result;
  	}
  	Pp.deleteComments = function (node) {
  	    if (!node.comments) {
  	        return;
  	    }
  	    var patcher = this;
  	    node.comments.forEach(function (comment) {
  	        if (comment.leading) {
  	            // Delete leading comments along with any trailing whitespace they
  	            // might have.
  	            patcher.replace({
  	                start: comment.loc.start,
  	                end: node.loc.lines.skipSpaces(comment.loc.end, false, false),
  	            }, "");
  	        }
  	        else if (comment.trailing) {
  	            // Delete trailing comments along with any leading whitespace they
  	            // might have.
  	            patcher.replace({
  	                start: node.loc.lines.skipSpaces(comment.loc.start, true, false),
  	                end: comment.loc.end,
  	            }, "");
  	        }
  	    });
  	};
  	function getReprinter(path) {
  	    assert_1.default.ok(path instanceof fast_path_1.default);
  	    // Make sure that this path refers specifically to a Node, rather than
  	    // some non-Node subproperty of a Node.
  	    var node = path.getValue();
  	    if (!Printable.check(node))
  	        return;
  	    var orig = node.original;
  	    var origLoc = orig && orig.loc;
  	    var lines = origLoc && origLoc.lines;
  	    var reprints = [];
  	    if (!lines || !findReprints(path, reprints))
  	        return;
  	    return function (print) {
  	        var patcher = new Patcher(lines);
  	        reprints.forEach(function (reprint) {
  	            var newNode = reprint.newPath.getValue();
  	            var oldNode = reprint.oldPath.getValue();
  	            SourceLocation.assert(oldNode.loc, true);
  	            var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode, print);
  	            if (needToPrintNewPathWithComments) {
  	                // Since we were not able to preserve all leading/trailing
  	                // comments, we delete oldNode's comments, print newPath with
  	                // comments, and then patch the resulting lines where oldNode used
  	                // to be.
  	                patcher.deleteComments(oldNode);
  	            }
  	            var newLines = print(reprint.newPath, {
  	                includeComments: needToPrintNewPathWithComments,
  	                // If the oldNode we're replacing already had parentheses, we may
  	                // not need to print the new node with any extra parentheses,
  	                // because the existing parentheses will suffice. However, if the
  	                // newNode has a different type than the oldNode, let the printer
  	                // decide if reprint.newPath needs parentheses, as usual.
  	                avoidRootParens: oldNode.type === newNode.type && reprint.oldPath.hasParens(),
  	            }).indentTail(oldNode.loc.indent);
  	            var nls = needsLeadingSpace(lines, oldNode.loc, newLines);
  	            var nts = needsTrailingSpace(lines, oldNode.loc, newLines);
  	            // If we try to replace the argument of a ReturnStatement like
  	            // return"asdf" with e.g. a literal null expression, we run the risk
  	            // of ending up with returnnull, so we need to add an extra leading
  	            // space in situations where that might happen. Likewise for
  	            // "asdf"in obj. See #170.
  	            if (nls || nts) {
  	                var newParts = [];
  	                nls && newParts.push(" ");
  	                newParts.push(newLines);
  	                nts && newParts.push(" ");
  	                newLines = linesModule.concat(newParts);
  	            }
  	            patcher.replace(oldNode.loc, newLines);
  	        });
  	        // Recall that origLoc is the .loc of an ancestor node that is
  	        // guaranteed to contain all the reprinted nodes and comments.
  	        var patchedLines = patcher.get(origLoc).indentTail(-orig.loc.indent);
  	        if (path.needsParens()) {
  	            return linesModule.concat(["(", patchedLines, ")"]);
  	        }
  	        return patchedLines;
  	    };
  	}
  	patcher.getReprinter = getReprinter;
  	// If the last character before oldLoc and the first character of newLines
  	// are both identifier characters, they must be separated by a space,
  	// otherwise they will most likely get fused together into a single token.
  	function needsLeadingSpace(oldLines, oldLoc, newLines) {
  	    var posBeforeOldLoc = util_1.copyPos(oldLoc.start);
  	    // The character just before the location occupied by oldNode.
  	    var charBeforeOldLoc = oldLines.prevPos(posBeforeOldLoc) && oldLines.charAt(posBeforeOldLoc);
  	    // First character of the reprinted node.
  	    var newFirstChar = newLines.charAt(newLines.firstPos());
  	    return (charBeforeOldLoc &&
  	        riskyAdjoiningCharExp.test(charBeforeOldLoc) &&
  	        newFirstChar &&
  	        riskyAdjoiningCharExp.test(newFirstChar));
  	}
  	// If the last character of newLines and the first character after oldLoc
  	// are both identifier characters, they must be separated by a space,
  	// otherwise they will most likely get fused together into a single token.
  	function needsTrailingSpace(oldLines, oldLoc, newLines) {
  	    // The character just after the location occupied by oldNode.
  	    var charAfterOldLoc = oldLines.charAt(oldLoc.end);
  	    var newLastPos = newLines.lastPos();
  	    // Last character of the reprinted node.
  	    var newLastChar = newLines.prevPos(newLastPos) && newLines.charAt(newLastPos);
  	    return (newLastChar &&
  	        riskyAdjoiningCharExp.test(newLastChar) &&
  	        charAfterOldLoc &&
  	        riskyAdjoiningCharExp.test(charAfterOldLoc));
  	}
  	function findReprints(newPath, reprints) {
  	    var newNode = newPath.getValue();
  	    Printable.assert(newNode);
  	    var oldNode = newNode.original;
  	    Printable.assert(oldNode);
  	    assert_1.default.deepEqual(reprints, []);
  	    if (newNode.type !== oldNode.type) {
  	        return false;
  	    }
  	    var oldPath = new fast_path_1.default(oldNode);
  	    var canReprint = findChildReprints(newPath, oldPath, reprints);
  	    if (!canReprint) {
  	        // Make absolutely sure the calling code does not attempt to reprint
  	        // any nodes.
  	        reprints.length = 0;
  	    }
  	    return canReprint;
  	}
  	function findAnyReprints(newPath, oldPath, reprints) {
  	    var newNode = newPath.getValue();
  	    var oldNode = oldPath.getValue();
  	    if (newNode === oldNode)
  	        return true;
  	    if (isArray.check(newNode))
  	        return findArrayReprints(newPath, oldPath, reprints);
  	    if (isObject.check(newNode))
  	        return findObjectReprints(newPath, oldPath, reprints);
  	    return false;
  	}
  	function findArrayReprints(newPath, oldPath, reprints) {
  	    var newNode = newPath.getValue();
  	    var oldNode = oldPath.getValue();
  	    if (newNode === oldNode ||
  	        newPath.valueIsDuplicate() ||
  	        oldPath.valueIsDuplicate()) {
  	        return true;
  	    }
  	    isArray.assert(newNode);
  	    var len = newNode.length;
  	    if (!(isArray.check(oldNode) && oldNode.length === len))
  	        return false;
  	    for (var i = 0; i < len; ++i) {
  	        newPath.stack.push(i, newNode[i]);
  	        oldPath.stack.push(i, oldNode[i]);
  	        var canReprint = findAnyReprints(newPath, oldPath, reprints);
  	        newPath.stack.length -= 2;
  	        oldPath.stack.length -= 2;
  	        if (!canReprint) {
  	            return false;
  	        }
  	    }
  	    return true;
  	}
  	function findObjectReprints(newPath, oldPath, reprints) {
  	    var newNode = newPath.getValue();
  	    isObject.assert(newNode);
  	    if (newNode.original === null) {
  	        // If newNode.original node was set to null, reprint the node.
  	        return false;
  	    }
  	    var oldNode = oldPath.getValue();
  	    if (!isObject.check(oldNode))
  	        return false;
  	    if (newNode === oldNode ||
  	        newPath.valueIsDuplicate() ||
  	        oldPath.valueIsDuplicate()) {
  	        return true;
  	    }
  	    if (Printable.check(newNode)) {
  	        if (!Printable.check(oldNode)) {
  	            return false;
  	        }
  	        var newParentNode = newPath.getParentNode();
  	        var oldParentNode = oldPath.getParentNode();
  	        if (oldParentNode !== null &&
  	            oldParentNode.type === "FunctionTypeAnnotation" &&
  	            newParentNode !== null &&
  	            newParentNode.type === "FunctionTypeAnnotation") {
  	            var oldNeedsParens = oldParentNode.params.length !== 1 || !!oldParentNode.params[0].name;
  	            var newNeedParens = newParentNode.params.length !== 1 || !!newParentNode.params[0].name;
  	            if (!oldNeedsParens && newNeedParens) {
  	                return false;
  	            }
  	        }
  	        // Here we need to decide whether the reprinted code for newNode is
  	        // appropriate for patching into the location of oldNode.
  	        if (newNode.type === oldNode.type) {
  	            var childReprints = [];
  	            if (findChildReprints(newPath, oldPath, childReprints)) {
  	                reprints.push.apply(reprints, childReprints);
  	            }
  	            else if (oldNode.loc) {
  	                // If we have no .loc information for oldNode, then we won't be
  	                // able to reprint it.
  	                reprints.push({
  	                    oldPath: oldPath.copy(),
  	                    newPath: newPath.copy(),
  	                });
  	            }
  	            else {
  	                return false;
  	            }
  	            return true;
  	        }
  	        if (Expression.check(newNode) &&
  	            Expression.check(oldNode) &&
  	            // If we have no .loc information for oldNode, then we won't be
  	            // able to reprint it.
  	            oldNode.loc) {
  	            // If both nodes are subtypes of Expression, then we should be able
  	            // to fill the location occupied by the old node with code printed
  	            // for the new node with no ill consequences.
  	            reprints.push({
  	                oldPath: oldPath.copy(),
  	                newPath: newPath.copy(),
  	            });
  	            return true;
  	        }
  	        // The nodes have different types, and at least one of the types is
  	        // not a subtype of the Expression type, so we cannot safely assume
  	        // the nodes are syntactically interchangeable.
  	        return false;
  	    }
  	    return findChildReprints(newPath, oldPath, reprints);
  	}
  	function findChildReprints(newPath, oldPath, reprints) {
  	    var newNode = newPath.getValue();
  	    var oldNode = oldPath.getValue();
  	    isObject.assert(newNode);
  	    isObject.assert(oldNode);
  	    if (newNode.original === null) {
  	        // If newNode.original node was set to null, reprint the node.
  	        return false;
  	    }
  	    // If this node needs parentheses and will not be wrapped with
  	    // parentheses when reprinted, then return false to skip reprinting and
  	    // let it be printed generically.
  	    if (newPath.needsParens() && !oldPath.hasParens()) {
  	        return false;
  	    }
  	    var keys = util_1.getUnionOfKeys(oldNode, newNode);
  	    if (oldNode.type === "File" || newNode.type === "File") {
  	        // Don't bother traversing file.tokens, an often very large array
  	        // returned by Babylon, and useless for our purposes.
  	        delete keys.tokens;
  	    }
  	    // Don't bother traversing .loc objects looking for reprintable nodes.
  	    delete keys.loc;
  	    var originalReprintCount = reprints.length;
  	    for (var k in keys) {
  	        if (k.charAt(0) === "_") {
  	            // Ignore "private" AST properties added by e.g. Babel plugins and
  	            // parsers like Babylon.
  	            continue;
  	        }
  	        newPath.stack.push(k, types.getFieldValue(newNode, k));
  	        oldPath.stack.push(k, types.getFieldValue(oldNode, k));
  	        var canReprint = findAnyReprints(newPath, oldPath, reprints);
  	        newPath.stack.length -= 2;
  	        oldPath.stack.length -= 2;
  	        if (!canReprint) {
  	            return false;
  	        }
  	    }
  	    // Return statements might end up running into ASI issues due to
  	    // comments inserted deep within the tree, so reprint them if anything
  	    // changed within them.
  	    if (ReturnStatement.check(newPath.getNode()) &&
  	        reprints.length > originalReprintCount) {
  	        return false;
  	    }
  	    return true;
  	}
  	return patcher;
  }

  var hasRequiredPrinter;

  function requirePrinter () {
  	if (hasRequiredPrinter) return printer;
  	hasRequiredPrinter = 1;
  	Object.defineProperty(printer, "__esModule", { value: true });
  	printer.Printer = void 0;
  	var tslib_1 = require$$0;
  	var assert_1 = tslib_1.__importDefault(require$$1$1);
  	var comments_1 = requireComments();
  	var lines_1 = requireLines();
  	var options_1 = requireOptions();
  	var patcher_1 = requirePatcher();
  	var types = tslib_1.__importStar(requireMain());
  	var namedTypes = types.namedTypes;
  	var isString = types.builtInTypes.string;
  	var isObject = types.builtInTypes.object;
  	var fast_path_1 = tslib_1.__importDefault(requireFastPath());
  	var util = tslib_1.__importStar(util$5);
  	var PrintResult = function PrintResult(code, sourceMap) {
  	    assert_1.default.ok(this instanceof PrintResult);
  	    isString.assert(code);
  	    this.code = code;
  	    if (sourceMap) {
  	        isObject.assert(sourceMap);
  	        this.map = sourceMap;
  	    }
  	};
  	var PRp = PrintResult.prototype;
  	var warnedAboutToString = false;
  	PRp.toString = function () {
  	    if (!warnedAboutToString) {
  	        console.warn("Deprecation warning: recast.print now returns an object with " +
  	            "a .code property. You appear to be treating the object as a " +
  	            "string, which might still work but is strongly discouraged.");
  	        warnedAboutToString = true;
  	    }
  	    return this.code;
  	};
  	var emptyPrintResult = new PrintResult("");
  	var Printer = function Printer(config) {
  	    assert_1.default.ok(this instanceof Printer);
  	    var explicitTabWidth = config && config.tabWidth;
  	    config = options_1.normalize(config);
  	    // It's common for client code to pass the same options into both
  	    // recast.parse and recast.print, but the Printer doesn't need (and
  	    // can be confused by) config.sourceFileName, so we null it out.
  	    config.sourceFileName = null;
  	    // Non-destructively modifies options with overrides, and returns a
  	    // new print function that uses the modified options.
  	    function makePrintFunctionWith(options, overrides) {
  	        options = Object.assign({}, options, overrides);
  	        return function (path) { return print(path, options); };
  	    }
  	    function print(path, options) {
  	        assert_1.default.ok(path instanceof fast_path_1.default);
  	        options = options || {};
  	        if (options.includeComments) {
  	            return comments_1.printComments(path, makePrintFunctionWith(options, {
  	                includeComments: false,
  	            }));
  	        }
  	        var oldTabWidth = config.tabWidth;
  	        if (!explicitTabWidth) {
  	            var loc = path.getNode().loc;
  	            if (loc && loc.lines && loc.lines.guessTabWidth) {
  	                config.tabWidth = loc.lines.guessTabWidth();
  	            }
  	        }
  	        var reprinter = patcher_1.getReprinter(path);
  	        var lines = reprinter
  	            ? // Since the print function that we pass to the reprinter will
  	                // be used to print "new" nodes, it's tempting to think we
  	                // should pass printRootGenerically instead of print, to avoid
  	                // calling maybeReprint again, but that would be a mistake
  	                // because the new nodes might not be entirely new, but merely
  	                // moved from elsewhere in the AST. The print function is the
  	                // right choice because it gives us the opportunity to reprint
  	                // such nodes using their original source.
  	                reprinter(print)
  	            : genericPrint(path, config, options, makePrintFunctionWith(options, {
  	                includeComments: true,
  	                avoidRootParens: false,
  	            }));
  	        config.tabWidth = oldTabWidth;
  	        return lines;
  	    }
  	    this.print = function (ast) {
  	        if (!ast) {
  	            return emptyPrintResult;
  	        }
  	        var lines = print(fast_path_1.default.from(ast), {
  	            includeComments: true,
  	            avoidRootParens: false,
  	        });
  	        return new PrintResult(lines.toString(config), util.composeSourceMaps(config.inputSourceMap, lines.getSourceMap(config.sourceMapName, config.sourceRoot)));
  	    };
  	    this.printGenerically = function (ast) {
  	        if (!ast) {
  	            return emptyPrintResult;
  	        }
  	        // Print the entire AST generically.
  	        function printGenerically(path) {
  	            return comments_1.printComments(path, function (path) {
  	                return genericPrint(path, config, {
  	                    includeComments: true,
  	                    avoidRootParens: false,
  	                }, printGenerically);
  	            });
  	        }
  	        var path = fast_path_1.default.from(ast);
  	        var oldReuseWhitespace = config.reuseWhitespace;
  	        // Do not reuse whitespace (or anything else, for that matter)
  	        // when printing generically.
  	        config.reuseWhitespace = false;
  	        // TODO Allow printing of comments?
  	        var pr = new PrintResult(printGenerically(path).toString(config));
  	        config.reuseWhitespace = oldReuseWhitespace;
  	        return pr;
  	    };
  	};
  	printer.Printer = Printer;
  	function genericPrint(path, config, options, printPath) {
  	    assert_1.default.ok(path instanceof fast_path_1.default);
  	    var node = path.getValue();
  	    var parts = [];
  	    var linesWithoutParens = genericPrintNoParens(path, config, printPath);
  	    if (!node || linesWithoutParens.isEmpty()) {
  	        return linesWithoutParens;
  	    }
  	    var shouldAddParens = node.extra ? node.extra.parenthesized : false;
  	    var decoratorsLines = printDecorators(path, printPath);
  	    if (decoratorsLines.isEmpty()) {
  	        // Nodes with decorators can't have parentheses, so we can avoid
  	        // computing path.needsParens() except in this case.
  	        if (!options.avoidRootParens) {
  	            shouldAddParens = shouldAddParens || path.needsParens();
  	        }
  	    }
  	    else {
  	        parts.push(decoratorsLines);
  	    }
  	    if (shouldAddParens) {
  	        parts.unshift("(");
  	    }
  	    parts.push(linesWithoutParens);
  	    if (shouldAddParens) {
  	        parts.push(")");
  	    }
  	    return lines_1.concat(parts);
  	}
  	// Note that the `options` parameter of this function is what other
  	// functions in this file call the `config` object (that is, the
  	// configuration object originally passed into the Printer constructor).
  	// Its properties are documented in lib/options.js.
  	function genericPrintNoParens(path, options, print) {
  	    var n = path.getValue();
  	    if (!n) {
  	        return lines_1.fromString("");
  	    }
  	    if (typeof n === "string") {
  	        return lines_1.fromString(n, options);
  	    }
  	    namedTypes.Printable.assert(n);
  	    var parts = [];
  	    switch (n.type) {
  	        case "File":
  	            return path.call(print, "program");
  	        case "Program":
  	            // Babel 6
  	            if (n.directives) {
  	                path.each(function (childPath) {
  	                    parts.push(print(childPath), ";\n");
  	                }, "directives");
  	            }
  	            if (n.interpreter) {
  	                parts.push(path.call(print, "interpreter"));
  	            }
  	            parts.push(path.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body"));
  	            return lines_1.concat(parts);
  	        case "Noop": // Babel extension.
  	        case "EmptyStatement":
  	            return lines_1.fromString("");
  	        case "ExpressionStatement":
  	            return lines_1.concat([path.call(print, "expression"), ";"]);
  	        case "ParenthesizedExpression": // Babel extension.
  	            return lines_1.concat(["(", path.call(print, "expression"), ")"]);
  	        case "BinaryExpression":
  	        case "LogicalExpression":
  	        case "AssignmentExpression":
  	            return lines_1.fromString(" ").join([
  	                path.call(print, "left"),
  	                n.operator,
  	                path.call(print, "right"),
  	            ]);
  	        case "AssignmentPattern":
  	            return lines_1.concat([
  	                path.call(print, "left"),
  	                " = ",
  	                path.call(print, "right"),
  	            ]);
  	        case "MemberExpression":
  	        case "OptionalMemberExpression": {
  	            parts.push(path.call(print, "object"));
  	            var property = path.call(print, "property");
  	            // Like n.optional, except with defaults applied, so optional
  	            // defaults to true for OptionalMemberExpression nodes.
  	            var optional = types.getFieldValue(n, "optional");
  	            if (n.computed) {
  	                parts.push(optional ? "?.[" : "[", property, "]");
  	            }
  	            else {
  	                parts.push(optional ? "?." : ".", property);
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "ChainExpression":
  	            return path.call(print, "expression");
  	        case "MetaProperty":
  	            return lines_1.concat([
  	                path.call(print, "meta"),
  	                ".",
  	                path.call(print, "property"),
  	            ]);
  	        case "BindExpression":
  	            if (n.object) {
  	                parts.push(path.call(print, "object"));
  	            }
  	            parts.push("::", path.call(print, "callee"));
  	            return lines_1.concat(parts);
  	        case "Path":
  	            return lines_1.fromString(".").join(n.body);
  	        case "Identifier":
  	            return lines_1.concat([
  	                lines_1.fromString(n.name, options),
  	                n.optional ? "?" : "",
  	                path.call(print, "typeAnnotation"),
  	            ]);
  	        case "SpreadElement":
  	        case "SpreadElementPattern":
  	        case "RestProperty": // Babel 6 for ObjectPattern
  	        case "SpreadProperty":
  	        case "SpreadPropertyPattern":
  	        case "ObjectTypeSpreadProperty":
  	        case "RestElement":
  	            return lines_1.concat([
  	                "...",
  	                path.call(print, "argument"),
  	                path.call(print, "typeAnnotation"),
  	            ]);
  	        case "FunctionDeclaration":
  	        case "FunctionExpression":
  	        case "TSDeclareFunction":
  	            if (n.declare) {
  	                parts.push("declare ");
  	            }
  	            if (n.async) {
  	                parts.push("async ");
  	            }
  	            parts.push("function");
  	            if (n.generator)
  	                parts.push("*");
  	            if (n.id) {
  	                parts.push(" ", path.call(print, "id"), path.call(print, "typeParameters"));
  	            }
  	            else {
  	                if (n.typeParameters) {
  	                    parts.push(path.call(print, "typeParameters"));
  	                }
  	            }
  	            parts.push("(", printFunctionParams(path, options, print), ")", path.call(print, "returnType"));
  	            if (n.body) {
  	                parts.push(" ", path.call(print, "body"));
  	            }
  	            return lines_1.concat(parts);
  	        case "ArrowFunctionExpression":
  	            if (n.async) {
  	                parts.push("async ");
  	            }
  	            if (n.typeParameters) {
  	                parts.push(path.call(print, "typeParameters"));
  	            }
  	            if (!options.arrowParensAlways &&
  	                n.params.length === 1 &&
  	                !n.rest &&
  	                n.params[0].type === "Identifier" &&
  	                !n.params[0].typeAnnotation &&
  	                !n.returnType) {
  	                parts.push(path.call(print, "params", 0));
  	            }
  	            else {
  	                parts.push("(", printFunctionParams(path, options, print), ")", path.call(print, "returnType"));
  	            }
  	            parts.push(" => ", path.call(print, "body"));
  	            return lines_1.concat(parts);
  	        case "MethodDefinition":
  	            return printMethod(path, options, print);
  	        case "YieldExpression":
  	            parts.push("yield");
  	            if (n.delegate)
  	                parts.push("*");
  	            if (n.argument)
  	                parts.push(" ", path.call(print, "argument"));
  	            return lines_1.concat(parts);
  	        case "AwaitExpression":
  	            parts.push("await");
  	            if (n.all)
  	                parts.push("*");
  	            if (n.argument)
  	                parts.push(" ", path.call(print, "argument"));
  	            return lines_1.concat(parts);
  	        case "ModuleDeclaration":
  	            parts.push("module", path.call(print, "id"));
  	            if (n.source) {
  	                assert_1.default.ok(!n.body);
  	                parts.push("from", path.call(print, "source"));
  	            }
  	            else {
  	                parts.push(path.call(print, "body"));
  	            }
  	            return lines_1.fromString(" ").join(parts);
  	        case "ImportSpecifier":
  	            if (n.importKind && n.importKind !== "value") {
  	                parts.push(n.importKind + " ");
  	            }
  	            if (n.imported) {
  	                parts.push(path.call(print, "imported"));
  	                if (n.local && n.local.name !== n.imported.name) {
  	                    parts.push(" as ", path.call(print, "local"));
  	                }
  	            }
  	            else if (n.id) {
  	                parts.push(path.call(print, "id"));
  	                if (n.name) {
  	                    parts.push(" as ", path.call(print, "name"));
  	                }
  	            }
  	            return lines_1.concat(parts);
  	        case "ExportSpecifier":
  	            if (n.local) {
  	                parts.push(path.call(print, "local"));
  	                if (n.exported && n.exported.name !== n.local.name) {
  	                    parts.push(" as ", path.call(print, "exported"));
  	                }
  	            }
  	            else if (n.id) {
  	                parts.push(path.call(print, "id"));
  	                if (n.name) {
  	                    parts.push(" as ", path.call(print, "name"));
  	                }
  	            }
  	            return lines_1.concat(parts);
  	        case "ExportBatchSpecifier":
  	            return lines_1.fromString("*");
  	        case "ImportNamespaceSpecifier":
  	            parts.push("* as ");
  	            if (n.local) {
  	                parts.push(path.call(print, "local"));
  	            }
  	            else if (n.id) {
  	                parts.push(path.call(print, "id"));
  	            }
  	            return lines_1.concat(parts);
  	        case "ImportDefaultSpecifier":
  	            if (n.local) {
  	                return path.call(print, "local");
  	            }
  	            return path.call(print, "id");
  	        case "TSExportAssignment":
  	            return lines_1.concat(["export = ", path.call(print, "expression")]);
  	        case "ExportDeclaration":
  	        case "ExportDefaultDeclaration":
  	        case "ExportNamedDeclaration":
  	            return printExportDeclaration(path, options, print);
  	        case "ExportAllDeclaration":
  	            parts.push("export *");
  	            if (n.exported) {
  	                parts.push(" as ", path.call(print, "exported"));
  	            }
  	            parts.push(" from ", path.call(print, "source"), ";");
  	            return lines_1.concat(parts);
  	        case "TSNamespaceExportDeclaration":
  	            parts.push("export as namespace ", path.call(print, "id"));
  	            return maybeAddSemicolon(lines_1.concat(parts));
  	        case "ExportNamespaceSpecifier":
  	            return lines_1.concat(["* as ", path.call(print, "exported")]);
  	        case "ExportDefaultSpecifier":
  	            return path.call(print, "exported");
  	        case "Import":
  	            return lines_1.fromString("import", options);
  	        // Recast and ast-types currently support dynamic import(...) using
  	        // either this dedicated ImportExpression type or a CallExpression
  	        // whose callee has type Import.
  	        // https://github.com/benjamn/ast-types/pull/365#issuecomment-605214486
  	        case "ImportExpression":
  	            return lines_1.concat(["import(", path.call(print, "source"), ")"]);
  	        case "ImportDeclaration": {
  	            parts.push("import ");
  	            if (n.importKind && n.importKind !== "value") {
  	                parts.push(n.importKind + " ");
  	            }
  	            if (n.specifiers && n.specifiers.length > 0) {
  	                var unbracedSpecifiers_1 = [];
  	                var bracedSpecifiers_1 = [];
  	                path.each(function (specifierPath) {
  	                    var spec = specifierPath.getValue();
  	                    if (spec.type === "ImportSpecifier") {
  	                        bracedSpecifiers_1.push(print(specifierPath));
  	                    }
  	                    else if (spec.type === "ImportDefaultSpecifier" ||
  	                        spec.type === "ImportNamespaceSpecifier") {
  	                        unbracedSpecifiers_1.push(print(specifierPath));
  	                    }
  	                }, "specifiers");
  	                unbracedSpecifiers_1.forEach(function (lines, i) {
  	                    if (i > 0) {
  	                        parts.push(", ");
  	                    }
  	                    parts.push(lines);
  	                });
  	                if (bracedSpecifiers_1.length > 0) {
  	                    var lines = lines_1.fromString(", ").join(bracedSpecifiers_1);
  	                    if (lines.getLineLength(1) > options.wrapColumn) {
  	                        lines = lines_1.concat([
  	                            lines_1.fromString(",\n").join(bracedSpecifiers_1).indent(options.tabWidth),
  	                            ",",
  	                        ]);
  	                    }
  	                    if (unbracedSpecifiers_1.length > 0) {
  	                        parts.push(", ");
  	                    }
  	                    if (lines.length > 1) {
  	                        parts.push("{\n", lines, "\n}");
  	                    }
  	                    else if (options.objectCurlySpacing) {
  	                        parts.push("{ ", lines, " }");
  	                    }
  	                    else {
  	                        parts.push("{", lines, "}");
  	                    }
  	                }
  	                parts.push(" from ");
  	            }
  	            parts.push(path.call(print, "source"), ";");
  	            return lines_1.concat(parts);
  	        }
  	        case "BlockStatement": {
  	            var naked_1 = path.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body");
  	            if (naked_1.isEmpty()) {
  	                if (!n.directives || n.directives.length === 0) {
  	                    return lines_1.fromString("{}");
  	                }
  	            }
  	            parts.push("{\n");
  	            // Babel 6
  	            if (n.directives) {
  	                path.each(function (childPath) {
  	                    parts.push(maybeAddSemicolon(print(childPath).indent(options.tabWidth)), n.directives.length > 1 || !naked_1.isEmpty() ? "\n" : "");
  	                }, "directives");
  	            }
  	            parts.push(naked_1.indent(options.tabWidth));
  	            parts.push("\n}");
  	            return lines_1.concat(parts);
  	        }
  	        case "ReturnStatement": {
  	            parts.push("return");
  	            if (n.argument) {
  	                var argLines = path.call(print, "argument");
  	                if (argLines.startsWithComment() ||
  	                    (argLines.length > 1 &&
  	                        namedTypes.JSXElement &&
  	                        namedTypes.JSXElement.check(n.argument))) {
  	                    parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
  	                }
  	                else {
  	                    parts.push(" ", argLines);
  	                }
  	            }
  	            parts.push(";");
  	            return lines_1.concat(parts);
  	        }
  	        case "CallExpression":
  	        case "OptionalCallExpression":
  	            parts.push(path.call(print, "callee"));
  	            if (n.typeParameters) {
  	                parts.push(path.call(print, "typeParameters"));
  	            }
  	            if (n.typeArguments) {
  	                parts.push(path.call(print, "typeArguments"));
  	            }
  	            // Like n.optional, but defaults to true for OptionalCallExpression
  	            // nodes that are missing an n.optional property (unusual),
  	            // according to the OptionalCallExpression definition in ast-types.
  	            if (types.getFieldValue(n, "optional")) {
  	                parts.push("?.");
  	            }
  	            parts.push(printArgumentsList(path, options, print));
  	            return lines_1.concat(parts);
  	        case "ObjectExpression":
  	        case "ObjectPattern":
  	        case "ObjectTypeAnnotation": {
  	            var isTypeAnnotation_1 = n.type === "ObjectTypeAnnotation";
  	            var separator_1 = options.flowObjectCommas
  	                ? ","
  	                : isTypeAnnotation_1
  	                    ? ";"
  	                    : ",";
  	            var fields = [];
  	            var allowBreak_1 = false;
  	            if (isTypeAnnotation_1) {
  	                fields.push("indexers", "callProperties");
  	                if (n.internalSlots != null) {
  	                    fields.push("internalSlots");
  	                }
  	            }
  	            fields.push("properties");
  	            var len_1 = 0;
  	            fields.forEach(function (field) {
  	                len_1 += n[field].length;
  	            });
  	            var oneLine_1 = (isTypeAnnotation_1 && len_1 === 1) || len_1 === 0;
  	            var leftBrace = n.exact ? "{|" : "{";
  	            var rightBrace = n.exact ? "|}" : "}";
  	            parts.push(oneLine_1 ? leftBrace : leftBrace + "\n");
  	            var leftBraceIndex = parts.length - 1;
  	            var i_1 = 0;
  	            fields.forEach(function (field) {
  	                path.each(function (childPath) {
  	                    var lines = print(childPath);
  	                    if (!oneLine_1) {
  	                        lines = lines.indent(options.tabWidth);
  	                    }
  	                    var multiLine = !isTypeAnnotation_1 && lines.length > 1;
  	                    if (multiLine && allowBreak_1) {
  	                        // Similar to the logic for BlockStatement.
  	                        parts.push("\n");
  	                    }
  	                    parts.push(lines);
  	                    if (i_1 < len_1 - 1) {
  	                        // Add an extra line break if the previous object property
  	                        // had a multi-line value.
  	                        parts.push(separator_1 + (multiLine ? "\n\n" : "\n"));
  	                        allowBreak_1 = !multiLine;
  	                    }
  	                    else if (len_1 !== 1 && isTypeAnnotation_1) {
  	                        parts.push(separator_1);
  	                    }
  	                    else if (!oneLine_1 &&
  	                        util.isTrailingCommaEnabled(options, "objects") &&
  	                        childPath.getValue().type !== "RestElement") {
  	                        parts.push(separator_1);
  	                    }
  	                    i_1++;
  	                }, field);
  	            });
  	            if (n.inexact) {
  	                var line = lines_1.fromString("...", options);
  	                if (oneLine_1) {
  	                    if (len_1 > 0) {
  	                        parts.push(separator_1, " ");
  	                    }
  	                    parts.push(line);
  	                }
  	                else {
  	                    // No trailing separator after ... to maintain parity with prettier.
  	                    parts.push("\n", line.indent(options.tabWidth));
  	                }
  	            }
  	            parts.push(oneLine_1 ? rightBrace : "\n" + rightBrace);
  	            if (i_1 !== 0 && oneLine_1 && options.objectCurlySpacing) {
  	                parts[leftBraceIndex] = leftBrace + " ";
  	                parts[parts.length - 1] = " " + rightBrace;
  	            }
  	            if (n.typeAnnotation) {
  	                parts.push(path.call(print, "typeAnnotation"));
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "PropertyPattern":
  	            return lines_1.concat([
  	                path.call(print, "key"),
  	                ": ",
  	                path.call(print, "pattern"),
  	            ]);
  	        case "ObjectProperty": // Babel 6
  	        case "Property": {
  	            // Non-standard AST node type.
  	            if (n.method || n.kind === "get" || n.kind === "set") {
  	                return printMethod(path, options, print);
  	            }
  	            if (n.shorthand && n.value.type === "AssignmentPattern") {
  	                return path.call(print, "value");
  	            }
  	            var key = path.call(print, "key");
  	            if (n.computed) {
  	                parts.push("[", key, "]");
  	            }
  	            else {
  	                parts.push(key);
  	            }
  	            if (!n.shorthand || n.key.name !== n.value.name) {
  	                parts.push(": ", path.call(print, "value"));
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "ClassMethod": // Babel 6
  	        case "ObjectMethod": // Babel 6
  	        case "ClassPrivateMethod":
  	        case "TSDeclareMethod":
  	            return printMethod(path, options, print);
  	        case "PrivateName":
  	            return lines_1.concat(["#", path.call(print, "id")]);
  	        case "Decorator":
  	            return lines_1.concat(["@", path.call(print, "expression")]);
  	        case "ArrayExpression":
  	        case "ArrayPattern": {
  	            var elems = n.elements;
  	            var len_2 = elems.length;
  	            var printed_1 = path.map(print, "elements");
  	            var joined = lines_1.fromString(", ").join(printed_1);
  	            var oneLine_2 = joined.getLineLength(1) <= options.wrapColumn;
  	            if (oneLine_2) {
  	                if (options.arrayBracketSpacing) {
  	                    parts.push("[ ");
  	                }
  	                else {
  	                    parts.push("[");
  	                }
  	            }
  	            else {
  	                parts.push("[\n");
  	            }
  	            path.each(function (elemPath) {
  	                var i = elemPath.getName();
  	                var elem = elemPath.getValue();
  	                if (!elem) {
  	                    // If the array expression ends with a hole, that hole
  	                    // will be ignored by the interpreter, but if it ends with
  	                    // two (or more) holes, we need to write out two (or more)
  	                    // commas so that the resulting code is interpreted with
  	                    // both (all) of the holes.
  	                    parts.push(",");
  	                }
  	                else {
  	                    var lines = printed_1[i];
  	                    if (oneLine_2) {
  	                        if (i > 0)
  	                            parts.push(" ");
  	                    }
  	                    else {
  	                        lines = lines.indent(options.tabWidth);
  	                    }
  	                    parts.push(lines);
  	                    if (i < len_2 - 1 ||
  	                        (!oneLine_2 && util.isTrailingCommaEnabled(options, "arrays")))
  	                        parts.push(",");
  	                    if (!oneLine_2)
  	                        parts.push("\n");
  	                }
  	            }, "elements");
  	            if (oneLine_2 && options.arrayBracketSpacing) {
  	                parts.push(" ]");
  	            }
  	            else {
  	                parts.push("]");
  	            }
  	            if (n.typeAnnotation) {
  	                parts.push(path.call(print, "typeAnnotation"));
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "SequenceExpression":
  	            return lines_1.fromString(", ").join(path.map(print, "expressions"));
  	        case "ThisExpression":
  	            return lines_1.fromString("this");
  	        case "Super":
  	            return lines_1.fromString("super");
  	        case "NullLiteral": // Babel 6 Literal split
  	            return lines_1.fromString("null");
  	        case "RegExpLiteral": // Babel 6 Literal split
  	            return lines_1.fromString(n.extra.raw);
  	        case "BigIntLiteral": // Babel 7 Literal split
  	            return lines_1.fromString(n.value + "n");
  	        case "NumericLiteral": // Babel 6 Literal Split
  	            // Keep original representation for numeric values not in base 10.
  	            if (n.extra &&
  	                typeof n.extra.raw === "string" &&
  	                Number(n.extra.raw) === n.value) {
  	                return lines_1.fromString(n.extra.raw, options);
  	            }
  	            return lines_1.fromString(n.value, options);
  	        case "BooleanLiteral": // Babel 6 Literal split
  	        case "StringLiteral": // Babel 6 Literal split
  	        case "Literal":
  	            // Numeric values may be in bases other than 10. Use their raw
  	            // representation if equivalent.
  	            if (typeof n.value === "number" &&
  	                typeof n.raw === "string" &&
  	                Number(n.raw) === n.value) {
  	                return lines_1.fromString(n.raw, options);
  	            }
  	            if (typeof n.value !== "string") {
  	                return lines_1.fromString(n.value, options);
  	            }
  	            return lines_1.fromString(nodeStr(n.value, options), options);
  	        case "Directive": // Babel 6
  	            return path.call(print, "value");
  	        case "DirectiveLiteral": // Babel 6
  	            return lines_1.fromString(nodeStr(n.value, options));
  	        case "InterpreterDirective":
  	            return lines_1.fromString("#!" + n.value + "\n", options);
  	        case "ModuleSpecifier":
  	            if (n.local) {
  	                throw new Error("The ESTree ModuleSpecifier type should be abstract");
  	            }
  	            // The Esprima ModuleSpecifier type is just a string-valued
  	            // Literal identifying the imported-from module.
  	            return lines_1.fromString(nodeStr(n.value, options), options);
  	        case "UnaryExpression":
  	            parts.push(n.operator);
  	            if (/[a-z]$/.test(n.operator))
  	                parts.push(" ");
  	            parts.push(path.call(print, "argument"));
  	            return lines_1.concat(parts);
  	        case "UpdateExpression":
  	            parts.push(path.call(print, "argument"), n.operator);
  	            if (n.prefix)
  	                parts.reverse();
  	            return lines_1.concat(parts);
  	        case "ConditionalExpression":
  	            return lines_1.concat([
  	                path.call(print, "test"),
  	                " ? ",
  	                path.call(print, "consequent"),
  	                " : ",
  	                path.call(print, "alternate"),
  	            ]);
  	        case "NewExpression": {
  	            parts.push("new ", path.call(print, "callee"));
  	            if (n.typeParameters) {
  	                parts.push(path.call(print, "typeParameters"));
  	            }
  	            if (n.typeArguments) {
  	                parts.push(path.call(print, "typeArguments"));
  	            }
  	            var args = n.arguments;
  	            if (args) {
  	                parts.push(printArgumentsList(path, options, print));
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "VariableDeclaration": {
  	            if (n.declare) {
  	                parts.push("declare ");
  	            }
  	            parts.push(n.kind, " ");
  	            var maxLen_1 = 0;
  	            var printed = path.map(function (childPath) {
  	                var lines = print(childPath);
  	                maxLen_1 = Math.max(lines.length, maxLen_1);
  	                return lines;
  	            }, "declarations");
  	            if (maxLen_1 === 1) {
  	                parts.push(lines_1.fromString(", ").join(printed));
  	            }
  	            else if (printed.length > 1) {
  	                parts.push(lines_1.fromString(",\n")
  	                    .join(printed)
  	                    .indentTail(n.kind.length + 1));
  	            }
  	            else {
  	                parts.push(printed[0]);
  	            }
  	            // We generally want to terminate all variable declarations with a
  	            // semicolon, except when they are children of for loops.
  	            var parentNode = path.getParentNode();
  	            if (!namedTypes.ForStatement.check(parentNode) &&
  	                !namedTypes.ForInStatement.check(parentNode) &&
  	                !(namedTypes.ForOfStatement &&
  	                    namedTypes.ForOfStatement.check(parentNode)) &&
  	                !(namedTypes.ForAwaitStatement &&
  	                    namedTypes.ForAwaitStatement.check(parentNode))) {
  	                parts.push(";");
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "VariableDeclarator":
  	            return n.init
  	                ? lines_1.fromString(" = ").join([
  	                    path.call(print, "id"),
  	                    path.call(print, "init"),
  	                ])
  	                : path.call(print, "id");
  	        case "WithStatement":
  	            return lines_1.concat([
  	                "with (",
  	                path.call(print, "object"),
  	                ") ",
  	                path.call(print, "body"),
  	            ]);
  	        case "IfStatement": {
  	            var con = adjustClause(path.call(print, "consequent"), options);
  	            parts.push("if (", path.call(print, "test"), ")", con);
  	            if (n.alternate)
  	                parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path.call(print, "alternate"), options));
  	            return lines_1.concat(parts);
  	        }
  	        case "ForStatement": {
  	            // TODO Get the for (;;) case right.
  	            var init = path.call(print, "init");
  	            var sep = init.length > 1 ? ";\n" : "; ";
  	            var forParen = "for (";
  	            var indented = lines_1.fromString(sep)
  	                .join([init, path.call(print, "test"), path.call(print, "update")])
  	                .indentTail(forParen.length);
  	            var head = lines_1.concat([forParen, indented, ")"]);
  	            var clause = adjustClause(path.call(print, "body"), options);
  	            parts.push(head);
  	            if (head.length > 1) {
  	                parts.push("\n");
  	                clause = clause.trimLeft();
  	            }
  	            parts.push(clause);
  	            return lines_1.concat(parts);
  	        }
  	        case "WhileStatement":
  	            return lines_1.concat([
  	                "while (",
  	                path.call(print, "test"),
  	                ")",
  	                adjustClause(path.call(print, "body"), options),
  	            ]);
  	        case "ForInStatement":
  	            // Note: esprima can't actually parse "for each (".
  	            return lines_1.concat([
  	                n.each ? "for each (" : "for (",
  	                path.call(print, "left"),
  	                " in ",
  	                path.call(print, "right"),
  	                ")",
  	                adjustClause(path.call(print, "body"), options),
  	            ]);
  	        case "ForOfStatement":
  	        case "ForAwaitStatement":
  	            parts.push("for ");
  	            if (n.await || n.type === "ForAwaitStatement") {
  	                parts.push("await ");
  	            }
  	            parts.push("(", path.call(print, "left"), " of ", path.call(print, "right"), ")", adjustClause(path.call(print, "body"), options));
  	            return lines_1.concat(parts);
  	        case "DoWhileStatement": {
  	            var doBody = lines_1.concat([
  	                "do",
  	                adjustClause(path.call(print, "body"), options),
  	            ]);
  	            parts.push(doBody);
  	            if (endsWithBrace(doBody))
  	                parts.push(" while");
  	            else
  	                parts.push("\nwhile");
  	            parts.push(" (", path.call(print, "test"), ");");
  	            return lines_1.concat(parts);
  	        }
  	        case "DoExpression": {
  	            var statements = path.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body");
  	            return lines_1.concat(["do {\n", statements.indent(options.tabWidth), "\n}"]);
  	        }
  	        case "BreakStatement":
  	            parts.push("break");
  	            if (n.label)
  	                parts.push(" ", path.call(print, "label"));
  	            parts.push(";");
  	            return lines_1.concat(parts);
  	        case "ContinueStatement":
  	            parts.push("continue");
  	            if (n.label)
  	                parts.push(" ", path.call(print, "label"));
  	            parts.push(";");
  	            return lines_1.concat(parts);
  	        case "LabeledStatement":
  	            return lines_1.concat([
  	                path.call(print, "label"),
  	                ":\n",
  	                path.call(print, "body"),
  	            ]);
  	        case "TryStatement":
  	            parts.push("try ", path.call(print, "block"));
  	            if (n.handler) {
  	                parts.push(" ", path.call(print, "handler"));
  	            }
  	            else if (n.handlers) {
  	                path.each(function (handlerPath) {
  	                    parts.push(" ", print(handlerPath));
  	                }, "handlers");
  	            }
  	            if (n.finalizer) {
  	                parts.push(" finally ", path.call(print, "finalizer"));
  	            }
  	            return lines_1.concat(parts);
  	        case "CatchClause":
  	            parts.push("catch ");
  	            if (n.param) {
  	                parts.push("(", path.call(print, "param"));
  	            }
  	            if (n.guard) {
  	                // Note: esprima does not recognize conditional catch clauses.
  	                parts.push(" if ", path.call(print, "guard"));
  	            }
  	            if (n.param) {
  	                parts.push(") ");
  	            }
  	            parts.push(path.call(print, "body"));
  	            return lines_1.concat(parts);
  	        case "ThrowStatement":
  	            return lines_1.concat(["throw ", path.call(print, "argument"), ";"]);
  	        case "SwitchStatement":
  	            return lines_1.concat([
  	                "switch (",
  	                path.call(print, "discriminant"),
  	                ") {\n",
  	                lines_1.fromString("\n").join(path.map(print, "cases")),
  	                "\n}",
  	            ]);
  	        // Note: ignoring n.lexical because it has no printing consequences.
  	        case "SwitchCase":
  	            if (n.test)
  	                parts.push("case ", path.call(print, "test"), ":");
  	            else
  	                parts.push("default:");
  	            if (n.consequent.length > 0) {
  	                parts.push("\n", path
  	                    .call(function (consequentPath) {
  	                    return printStatementSequence(consequentPath, options, print);
  	                }, "consequent")
  	                    .indent(options.tabWidth));
  	            }
  	            return lines_1.concat(parts);
  	        case "DebuggerStatement":
  	            return lines_1.fromString("debugger;");
  	        // JSX extensions below.
  	        case "JSXAttribute":
  	            parts.push(path.call(print, "name"));
  	            if (n.value)
  	                parts.push("=", path.call(print, "value"));
  	            return lines_1.concat(parts);
  	        case "JSXIdentifier":
  	            return lines_1.fromString(n.name, options);
  	        case "JSXNamespacedName":
  	            return lines_1.fromString(":").join([
  	                path.call(print, "namespace"),
  	                path.call(print, "name"),
  	            ]);
  	        case "JSXMemberExpression":
  	            return lines_1.fromString(".").join([
  	                path.call(print, "object"),
  	                path.call(print, "property"),
  	            ]);
  	        case "JSXSpreadAttribute":
  	            return lines_1.concat(["{...", path.call(print, "argument"), "}"]);
  	        case "JSXSpreadChild":
  	            return lines_1.concat(["{...", path.call(print, "expression"), "}"]);
  	        case "JSXExpressionContainer":
  	            return lines_1.concat(["{", path.call(print, "expression"), "}"]);
  	        case "JSXElement":
  	        case "JSXFragment": {
  	            var openingPropName = "opening" + (n.type === "JSXElement" ? "Element" : "Fragment");
  	            var closingPropName = "closing" + (n.type === "JSXElement" ? "Element" : "Fragment");
  	            var openingLines = path.call(print, openingPropName);
  	            if (n[openingPropName].selfClosing) {
  	                assert_1.default.ok(!n[closingPropName], "unexpected " +
  	                    closingPropName +
  	                    " element in self-closing " +
  	                    n.type);
  	                return openingLines;
  	            }
  	            var childLines = lines_1.concat(path.map(function (childPath) {
  	                var child = childPath.getValue();
  	                if (namedTypes.Literal.check(child) &&
  	                    typeof child.value === "string") {
  	                    if (/\S/.test(child.value)) {
  	                        return child.value.replace(/^\s+|\s+$/g, "");
  	                    }
  	                    else if (/\n/.test(child.value)) {
  	                        return "\n";
  	                    }
  	                }
  	                return print(childPath);
  	            }, "children")).indentTail(options.tabWidth);
  	            var closingLines = path.call(print, closingPropName);
  	            return lines_1.concat([openingLines, childLines, closingLines]);
  	        }
  	        case "JSXOpeningElement": {
  	            parts.push("<", path.call(print, "name"));
  	            var attrParts_1 = [];
  	            path.each(function (attrPath) {
  	                attrParts_1.push(" ", print(attrPath));
  	            }, "attributes");
  	            var attrLines = lines_1.concat(attrParts_1);
  	            var needLineWrap = attrLines.length > 1 || attrLines.getLineLength(1) > options.wrapColumn;
  	            if (needLineWrap) {
  	                attrParts_1.forEach(function (part, i) {
  	                    if (part === " ") {
  	                        assert_1.default.strictEqual(i % 2, 0);
  	                        attrParts_1[i] = "\n";
  	                    }
  	                });
  	                attrLines = lines_1.concat(attrParts_1).indentTail(options.tabWidth);
  	            }
  	            parts.push(attrLines, n.selfClosing ? " />" : ">");
  	            return lines_1.concat(parts);
  	        }
  	        case "JSXClosingElement":
  	            return lines_1.concat(["</", path.call(print, "name"), ">"]);
  	        case "JSXOpeningFragment":
  	            return lines_1.fromString("<>");
  	        case "JSXClosingFragment":
  	            return lines_1.fromString("</>");
  	        case "JSXText":
  	            return lines_1.fromString(n.value, options);
  	        case "JSXEmptyExpression":
  	            return lines_1.fromString("");
  	        case "TypeAnnotatedIdentifier":
  	            return lines_1.concat([
  	                path.call(print, "annotation"),
  	                " ",
  	                path.call(print, "identifier"),
  	            ]);
  	        case "ClassBody":
  	            if (n.body.length === 0) {
  	                return lines_1.fromString("{}");
  	            }
  	            return lines_1.concat([
  	                "{\n",
  	                path
  	                    .call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body")
  	                    .indent(options.tabWidth),
  	                "\n}",
  	            ]);
  	        case "ClassPropertyDefinition":
  	            parts.push("static ", path.call(print, "definition"));
  	            if (!namedTypes.MethodDefinition.check(n.definition))
  	                parts.push(";");
  	            return lines_1.concat(parts);
  	        case "ClassProperty": {
  	            if (n.declare) {
  	                parts.push("declare ");
  	            }
  	            var access = n.accessibility || n.access;
  	            if (typeof access === "string") {
  	                parts.push(access, " ");
  	            }
  	            if (n.static) {
  	                parts.push("static ");
  	            }
  	            if (n.abstract) {
  	                parts.push("abstract ");
  	            }
  	            if (n.readonly) {
  	                parts.push("readonly ");
  	            }
  	            var key = path.call(print, "key");
  	            if (n.computed) {
  	                key = lines_1.concat(["[", key, "]"]);
  	            }
  	            if (n.variance) {
  	                key = lines_1.concat([printVariance(path, print), key]);
  	            }
  	            parts.push(key);
  	            if (n.optional) {
  	                parts.push("?");
  	            }
  	            if (n.typeAnnotation) {
  	                parts.push(path.call(print, "typeAnnotation"));
  	            }
  	            if (n.value) {
  	                parts.push(" = ", path.call(print, "value"));
  	            }
  	            parts.push(";");
  	            return lines_1.concat(parts);
  	        }
  	        case "ClassPrivateProperty":
  	            if (n.static) {
  	                parts.push("static ");
  	            }
  	            parts.push(path.call(print, "key"));
  	            if (n.typeAnnotation) {
  	                parts.push(path.call(print, "typeAnnotation"));
  	            }
  	            if (n.value) {
  	                parts.push(" = ", path.call(print, "value"));
  	            }
  	            parts.push(";");
  	            return lines_1.concat(parts);
  	        case "ClassDeclaration":
  	        case "ClassExpression":
  	            if (n.declare) {
  	                parts.push("declare ");
  	            }
  	            if (n.abstract) {
  	                parts.push("abstract ");
  	            }
  	            parts.push("class");
  	            if (n.id) {
  	                parts.push(" ", path.call(print, "id"));
  	            }
  	            if (n.typeParameters) {
  	                parts.push(path.call(print, "typeParameters"));
  	            }
  	            if (n.superClass) {
  	                parts.push(" extends ", path.call(print, "superClass"), path.call(print, "superTypeParameters"));
  	            }
  	            if (n["implements"] && n["implements"].length > 0) {
  	                parts.push(" implements ", lines_1.fromString(", ").join(path.map(print, "implements")));
  	            }
  	            parts.push(" ", path.call(print, "body"));
  	            return lines_1.concat(parts);
  	        case "TemplateElement":
  	            return lines_1.fromString(n.value.raw, options).lockIndentTail();
  	        case "TemplateLiteral": {
  	            var expressions_1 = path.map(print, "expressions");
  	            parts.push("`");
  	            path.each(function (childPath) {
  	                var i = childPath.getName();
  	                parts.push(print(childPath));
  	                if (i < expressions_1.length) {
  	                    parts.push("${", expressions_1[i], "}");
  	                }
  	            }, "quasis");
  	            parts.push("`");
  	            return lines_1.concat(parts).lockIndentTail();
  	        }
  	        case "TaggedTemplateExpression":
  	            return lines_1.concat([path.call(print, "tag"), path.call(print, "quasi")]);
  	        // These types are unprintable because they serve as abstract
  	        // supertypes for other (printable) types.
  	        case "Node":
  	        case "Printable":
  	        case "SourceLocation":
  	        case "Position":
  	        case "Statement":
  	        case "Function":
  	        case "Pattern":
  	        case "Expression":
  	        case "Declaration":
  	        case "Specifier":
  	        case "NamedSpecifier":
  	        case "Comment": // Supertype of Block and Line
  	        case "Flow": // Supertype of all Flow AST node types
  	        case "FlowType": // Supertype of all Flow types
  	        case "FlowPredicate": // Supertype of InferredPredicate and DeclaredPredicate
  	        case "MemberTypeAnnotation": // Flow
  	        case "Type": // Flow
  	        case "TSHasOptionalTypeParameterInstantiation":
  	        case "TSHasOptionalTypeParameters":
  	        case "TSHasOptionalTypeAnnotation":
  	        case "ChainElement": // Supertype of MemberExpression and CallExpression
  	            throw new Error("unprintable type: " + JSON.stringify(n.type));
  	        case "CommentBlock": // Babel block comment.
  	        case "Block": // Esprima block comment.
  	            return lines_1.concat(["/*", lines_1.fromString(n.value, options), "*/"]);
  	        case "CommentLine": // Babel line comment.
  	        case "Line": // Esprima line comment.
  	            return lines_1.concat(["//", lines_1.fromString(n.value, options)]);
  	        // Type Annotations for Facebook Flow, typically stripped out or
  	        // transformed away before printing.
  	        case "TypeAnnotation":
  	            if (n.typeAnnotation) {
  	                if (n.typeAnnotation.type !== "FunctionTypeAnnotation") {
  	                    parts.push(": ");
  	                }
  	                parts.push(path.call(print, "typeAnnotation"));
  	                return lines_1.concat(parts);
  	            }
  	            return lines_1.fromString("");
  	        case "ExistentialTypeParam":
  	        case "ExistsTypeAnnotation":
  	            return lines_1.fromString("*", options);
  	        case "EmptyTypeAnnotation":
  	            return lines_1.fromString("empty", options);
  	        case "AnyTypeAnnotation":
  	            return lines_1.fromString("any", options);
  	        case "MixedTypeAnnotation":
  	            return lines_1.fromString("mixed", options);
  	        case "ArrayTypeAnnotation":
  	            return lines_1.concat([path.call(print, "elementType"), "[]"]);
  	        case "TupleTypeAnnotation": {
  	            var printed_2 = path.map(print, "types");
  	            var joined = lines_1.fromString(", ").join(printed_2);
  	            var oneLine_3 = joined.getLineLength(1) <= options.wrapColumn;
  	            if (oneLine_3) {
  	                if (options.arrayBracketSpacing) {
  	                    parts.push("[ ");
  	                }
  	                else {
  	                    parts.push("[");
  	                }
  	            }
  	            else {
  	                parts.push("[\n");
  	            }
  	            path.each(function (elemPath) {
  	                var i = elemPath.getName();
  	                var elem = elemPath.getValue();
  	                if (!elem) {
  	                    // If the array expression ends with a hole, that hole
  	                    // will be ignored by the interpreter, but if it ends with
  	                    // two (or more) holes, we need to write out two (or more)
  	                    // commas so that the resulting code is interpreted with
  	                    // both (all) of the holes.
  	                    parts.push(",");
  	                }
  	                else {
  	                    var lines = printed_2[i];
  	                    if (oneLine_3) {
  	                        if (i > 0)
  	                            parts.push(" ");
  	                    }
  	                    else {
  	                        lines = lines.indent(options.tabWidth);
  	                    }
  	                    parts.push(lines);
  	                    if (i < n.types.length - 1 ||
  	                        (!oneLine_3 && util.isTrailingCommaEnabled(options, "arrays")))
  	                        parts.push(",");
  	                    if (!oneLine_3)
  	                        parts.push("\n");
  	                }
  	            }, "types");
  	            if (oneLine_3 && options.arrayBracketSpacing) {
  	                parts.push(" ]");
  	            }
  	            else {
  	                parts.push("]");
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "BooleanTypeAnnotation":
  	            return lines_1.fromString("boolean", options);
  	        case "BooleanLiteralTypeAnnotation":
  	            assert_1.default.strictEqual(typeof n.value, "boolean");
  	            return lines_1.fromString("" + n.value, options);
  	        case "InterfaceTypeAnnotation":
  	            parts.push("interface");
  	            if (n.extends && n.extends.length > 0) {
  	                parts.push(" extends ", lines_1.fromString(", ").join(path.map(print, "extends")));
  	            }
  	            parts.push(" ", path.call(print, "body"));
  	            return lines_1.concat(parts);
  	        case "DeclareClass":
  	            return printFlowDeclaration(path, [
  	                "class ",
  	                path.call(print, "id"),
  	                " ",
  	                path.call(print, "body"),
  	            ]);
  	        case "DeclareFunction":
  	            return printFlowDeclaration(path, [
  	                "function ",
  	                path.call(print, "id"),
  	                ";",
  	            ]);
  	        case "DeclareModule":
  	            return printFlowDeclaration(path, [
  	                "module ",
  	                path.call(print, "id"),
  	                " ",
  	                path.call(print, "body"),
  	            ]);
  	        case "DeclareModuleExports":
  	            return printFlowDeclaration(path, [
  	                "module.exports",
  	                path.call(print, "typeAnnotation"),
  	            ]);
  	        case "DeclareVariable":
  	            return printFlowDeclaration(path, ["var ", path.call(print, "id"), ";"]);
  	        case "DeclareExportDeclaration":
  	        case "DeclareExportAllDeclaration":
  	            return lines_1.concat(["declare ", printExportDeclaration(path, options, print)]);
  	        case "EnumDeclaration":
  	            return lines_1.concat([
  	                "enum ",
  	                path.call(print, "id"),
  	                path.call(print, "body"),
  	            ]);
  	        case "EnumBooleanBody":
  	        case "EnumNumberBody":
  	        case "EnumStringBody":
  	        case "EnumSymbolBody": {
  	            if (n.type === "EnumSymbolBody" || n.explicitType) {
  	                parts.push(" of ", 
  	                // EnumBooleanBody => boolean, etc.
  	                n.type.slice(4, -4).toLowerCase());
  	            }
  	            parts.push(" {\n", lines_1.fromString("\n")
  	                .join(path.map(print, "members"))
  	                .indent(options.tabWidth), "\n}");
  	            return lines_1.concat(parts);
  	        }
  	        case "EnumDefaultedMember":
  	            return lines_1.concat([path.call(print, "id"), ","]);
  	        case "EnumBooleanMember":
  	        case "EnumNumberMember":
  	        case "EnumStringMember":
  	            return lines_1.concat([
  	                path.call(print, "id"),
  	                " = ",
  	                path.call(print, "init"),
  	                ",",
  	            ]);
  	        case "InferredPredicate":
  	            return lines_1.fromString("%checks", options);
  	        case "DeclaredPredicate":
  	            return lines_1.concat(["%checks(", path.call(print, "value"), ")"]);
  	        case "FunctionTypeAnnotation": {
  	            // FunctionTypeAnnotation is ambiguous:
  	            // declare function(a: B): void; OR
  	            // const A: (a: B) => void;
  	            var parent = path.getParentNode(0);
  	            var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) ||
  	                (namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method) ||
  	                namedTypes.DeclareFunction.check(path.getParentNode(2)));
  	            var needsColon = isArrowFunctionTypeAnnotation &&
  	                !namedTypes.FunctionTypeParam.check(parent) &&
  	                !namedTypes.TypeAlias.check(parent);
  	            if (needsColon) {
  	                parts.push(": ");
  	            }
  	            var hasTypeParameters = !!n.typeParameters;
  	            var needsParens = hasTypeParameters || n.params.length !== 1 || n.params[0].name;
  	            parts.push(hasTypeParameters ? path.call(print, "typeParameters") : "", needsParens ? "(" : "", printFunctionParams(path, options, print), needsParens ? ")" : "");
  	            // The returnType is not wrapped in a TypeAnnotation, so the colon
  	            // needs to be added separately.
  	            if (n.returnType) {
  	                parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path.call(print, "returnType"));
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "FunctionTypeParam": {
  	            var name = path.call(print, "name");
  	            parts.push(name);
  	            if (n.optional) {
  	                parts.push("?");
  	            }
  	            if (name.infos[0].line) {
  	                parts.push(": ");
  	            }
  	            parts.push(path.call(print, "typeAnnotation"));
  	            return lines_1.concat(parts);
  	        }
  	        case "GenericTypeAnnotation":
  	            return lines_1.concat([
  	                path.call(print, "id"),
  	                path.call(print, "typeParameters"),
  	            ]);
  	        case "DeclareInterface":
  	            parts.push("declare ");
  	        // Fall through to InterfaceDeclaration...
  	        case "InterfaceDeclaration":
  	        case "TSInterfaceDeclaration":
  	            if (n.declare) {
  	                parts.push("declare ");
  	            }
  	            parts.push("interface ", path.call(print, "id"), path.call(print, "typeParameters"), " ");
  	            if (n["extends"] && n["extends"].length > 0) {
  	                parts.push("extends ", lines_1.fromString(", ").join(path.map(print, "extends")), " ");
  	            }
  	            if (n.body) {
  	                parts.push(path.call(print, "body"));
  	            }
  	            return lines_1.concat(parts);
  	        case "ClassImplements":
  	        case "InterfaceExtends":
  	            return lines_1.concat([
  	                path.call(print, "id"),
  	                path.call(print, "typeParameters"),
  	            ]);
  	        case "IntersectionTypeAnnotation":
  	            return lines_1.fromString(" & ").join(path.map(print, "types"));
  	        case "NullableTypeAnnotation":
  	            return lines_1.concat(["?", path.call(print, "typeAnnotation")]);
  	        case "NullLiteralTypeAnnotation":
  	            return lines_1.fromString("null", options);
  	        case "ThisTypeAnnotation":
  	            return lines_1.fromString("this", options);
  	        case "NumberTypeAnnotation":
  	            return lines_1.fromString("number", options);
  	        case "ObjectTypeCallProperty":
  	            return path.call(print, "value");
  	        case "ObjectTypeIndexer":
  	            if (n.static) {
  	                parts.push("static ");
  	            }
  	            parts.push(printVariance(path, print), "[");
  	            if (n.id) {
  	                parts.push(path.call(print, "id"), ": ");
  	            }
  	            parts.push(path.call(print, "key"), "]: ", path.call(print, "value"));
  	            return lines_1.concat(parts);
  	        case "ObjectTypeProperty":
  	            return lines_1.concat([
  	                printVariance(path, print),
  	                path.call(print, "key"),
  	                n.optional ? "?" : "",
  	                ": ",
  	                path.call(print, "value"),
  	            ]);
  	        case "ObjectTypeInternalSlot":
  	            return lines_1.concat([
  	                n.static ? "static " : "",
  	                "[[",
  	                path.call(print, "id"),
  	                "]]",
  	                n.optional ? "?" : "",
  	                n.value.type !== "FunctionTypeAnnotation" ? ": " : "",
  	                path.call(print, "value"),
  	            ]);
  	        case "QualifiedTypeIdentifier":
  	            return lines_1.concat([
  	                path.call(print, "qualification"),
  	                ".",
  	                path.call(print, "id"),
  	            ]);
  	        case "StringLiteralTypeAnnotation":
  	            return lines_1.fromString(nodeStr(n.value, options), options);
  	        case "NumberLiteralTypeAnnotation":
  	        case "NumericLiteralTypeAnnotation":
  	            assert_1.default.strictEqual(typeof n.value, "number");
  	            return lines_1.fromString(JSON.stringify(n.value), options);
  	        case "BigIntLiteralTypeAnnotation":
  	            return lines_1.fromString(n.raw, options);
  	        case "StringTypeAnnotation":
  	            return lines_1.fromString("string", options);
  	        case "DeclareTypeAlias":
  	            parts.push("declare ");
  	        // Fall through to TypeAlias...
  	        case "TypeAlias":
  	            return lines_1.concat([
  	                "type ",
  	                path.call(print, "id"),
  	                path.call(print, "typeParameters"),
  	                " = ",
  	                path.call(print, "right"),
  	                ";",
  	            ]);
  	        case "DeclareOpaqueType":
  	            parts.push("declare ");
  	        // Fall through to OpaqueType...
  	        case "OpaqueType":
  	            parts.push("opaque type ", path.call(print, "id"), path.call(print, "typeParameters"));
  	            if (n["supertype"]) {
  	                parts.push(": ", path.call(print, "supertype"));
  	            }
  	            if (n["impltype"]) {
  	                parts.push(" = ", path.call(print, "impltype"));
  	            }
  	            parts.push(";");
  	            return lines_1.concat(parts);
  	        case "TypeCastExpression":
  	            return lines_1.concat([
  	                "(",
  	                path.call(print, "expression"),
  	                path.call(print, "typeAnnotation"),
  	                ")",
  	            ]);
  	        case "TypeParameterDeclaration":
  	        case "TypeParameterInstantiation":
  	            return lines_1.concat([
  	                "<",
  	                lines_1.fromString(", ").join(path.map(print, "params")),
  	                ">",
  	            ]);
  	        case "Variance":
  	            if (n.kind === "plus") {
  	                return lines_1.fromString("+");
  	            }
  	            if (n.kind === "minus") {
  	                return lines_1.fromString("-");
  	            }
  	            return lines_1.fromString("");
  	        case "TypeParameter":
  	            if (n.variance) {
  	                parts.push(printVariance(path, print));
  	            }
  	            parts.push(path.call(print, "name"));
  	            if (n.bound) {
  	                parts.push(path.call(print, "bound"));
  	            }
  	            if (n["default"]) {
  	                parts.push("=", path.call(print, "default"));
  	            }
  	            return lines_1.concat(parts);
  	        case "TypeofTypeAnnotation":
  	            return lines_1.concat([
  	                lines_1.fromString("typeof ", options),
  	                path.call(print, "argument"),
  	            ]);
  	        case "UnionTypeAnnotation":
  	            return lines_1.fromString(" | ").join(path.map(print, "types"));
  	        case "VoidTypeAnnotation":
  	            return lines_1.fromString("void", options);
  	        case "NullTypeAnnotation":
  	            return lines_1.fromString("null", options);
  	        case "SymbolTypeAnnotation":
  	            return lines_1.fromString("symbol", options);
  	        case "BigIntTypeAnnotation":
  	            return lines_1.fromString("bigint", options);
  	        // Type Annotations for TypeScript (when using Babylon as parser)
  	        case "TSType":
  	            throw new Error("unprintable type: " + JSON.stringify(n.type));
  	        case "TSNumberKeyword":
  	            return lines_1.fromString("number", options);
  	        case "TSBigIntKeyword":
  	            return lines_1.fromString("bigint", options);
  	        case "TSObjectKeyword":
  	            return lines_1.fromString("object", options);
  	        case "TSBooleanKeyword":
  	            return lines_1.fromString("boolean", options);
  	        case "TSStringKeyword":
  	            return lines_1.fromString("string", options);
  	        case "TSSymbolKeyword":
  	            return lines_1.fromString("symbol", options);
  	        case "TSAnyKeyword":
  	            return lines_1.fromString("any", options);
  	        case "TSVoidKeyword":
  	            return lines_1.fromString("void", options);
  	        case "TSThisType":
  	            return lines_1.fromString("this", options);
  	        case "TSNullKeyword":
  	            return lines_1.fromString("null", options);
  	        case "TSUndefinedKeyword":
  	            return lines_1.fromString("undefined", options);
  	        case "TSUnknownKeyword":
  	            return lines_1.fromString("unknown", options);
  	        case "TSNeverKeyword":
  	            return lines_1.fromString("never", options);
  	        case "TSArrayType":
  	            return lines_1.concat([path.call(print, "elementType"), "[]"]);
  	        case "TSLiteralType":
  	            return path.call(print, "literal");
  	        case "TSUnionType":
  	            return lines_1.fromString(" | ").join(path.map(print, "types"));
  	        case "TSIntersectionType":
  	            return lines_1.fromString(" & ").join(path.map(print, "types"));
  	        case "TSConditionalType":
  	            parts.push(path.call(print, "checkType"), " extends ", path.call(print, "extendsType"), " ? ", path.call(print, "trueType"), " : ", path.call(print, "falseType"));
  	            return lines_1.concat(parts);
  	        case "TSInferType":
  	            parts.push("infer ", path.call(print, "typeParameter"));
  	            return lines_1.concat(parts);
  	        case "TSParenthesizedType":
  	            return lines_1.concat(["(", path.call(print, "typeAnnotation"), ")"]);
  	        case "TSFunctionType":
  	            return lines_1.concat([
  	                path.call(print, "typeParameters"),
  	                "(",
  	                printFunctionParams(path, options, print),
  	                ") => ",
  	                path.call(print, "typeAnnotation", "typeAnnotation"),
  	            ]);
  	        case "TSConstructorType":
  	            return lines_1.concat([
  	                "new ",
  	                path.call(print, "typeParameters"),
  	                "(",
  	                printFunctionParams(path, options, print),
  	                ") => ",
  	                path.call(print, "typeAnnotation", "typeAnnotation"),
  	            ]);
  	        case "TSMappedType": {
  	            parts.push(n.readonly ? "readonly " : "", "[", path.call(print, "typeParameter"), "]", n.optional ? "?" : "");
  	            if (n.typeAnnotation) {
  	                parts.push(": ", path.call(print, "typeAnnotation"), ";");
  	            }
  	            return lines_1.concat(["{\n", lines_1.concat(parts).indent(options.tabWidth), "\n}"]);
  	        }
  	        case "TSTupleType":
  	            return lines_1.concat([
  	                "[",
  	                lines_1.fromString(", ").join(path.map(print, "elementTypes")),
  	                "]",
  	            ]);
  	        case "TSNamedTupleMember":
  	            parts.push(path.call(print, "label"));
  	            if (n.optional) {
  	                parts.push("?");
  	            }
  	            parts.push(": ", path.call(print, "elementType"));
  	            return lines_1.concat(parts);
  	        case "TSRestType":
  	            return lines_1.concat(["...", path.call(print, "typeAnnotation")]);
  	        case "TSOptionalType":
  	            return lines_1.concat([path.call(print, "typeAnnotation"), "?"]);
  	        case "TSIndexedAccessType":
  	            return lines_1.concat([
  	                path.call(print, "objectType"),
  	                "[",
  	                path.call(print, "indexType"),
  	                "]",
  	            ]);
  	        case "TSTypeOperator":
  	            return lines_1.concat([
  	                path.call(print, "operator"),
  	                " ",
  	                path.call(print, "typeAnnotation"),
  	            ]);
  	        case "TSTypeLiteral": {
  	            var memberLines = lines_1.fromString(",\n").join(path.map(print, "members"));
  	            if (memberLines.isEmpty()) {
  	                return lines_1.fromString("{}", options);
  	            }
  	            parts.push("{\n", memberLines.indent(options.tabWidth), "\n}");
  	            return lines_1.concat(parts);
  	        }
  	        case "TSEnumMember":
  	            parts.push(path.call(print, "id"));
  	            if (n.initializer) {
  	                parts.push(" = ", path.call(print, "initializer"));
  	            }
  	            return lines_1.concat(parts);
  	        case "TSTypeQuery":
  	            return lines_1.concat(["typeof ", path.call(print, "exprName")]);
  	        case "TSParameterProperty":
  	            if (n.accessibility) {
  	                parts.push(n.accessibility, " ");
  	            }
  	            if (n.export) {
  	                parts.push("export ");
  	            }
  	            if (n.static) {
  	                parts.push("static ");
  	            }
  	            if (n.readonly) {
  	                parts.push("readonly ");
  	            }
  	            parts.push(path.call(print, "parameter"));
  	            return lines_1.concat(parts);
  	        case "TSTypeReference":
  	            return lines_1.concat([
  	                path.call(print, "typeName"),
  	                path.call(print, "typeParameters"),
  	            ]);
  	        case "TSQualifiedName":
  	            return lines_1.concat([path.call(print, "left"), ".", path.call(print, "right")]);
  	        case "TSAsExpression": {
  	            var expression = path.call(print, "expression");
  	            parts.push(expression, lines_1.fromString(" as "), path.call(print, "typeAnnotation"));
  	            return lines_1.concat(parts);
  	        }
  	        case "TSNonNullExpression":
  	            return lines_1.concat([path.call(print, "expression"), "!"]);
  	        case "TSTypeAnnotation":
  	            return lines_1.concat([": ", path.call(print, "typeAnnotation")]);
  	        case "TSIndexSignature":
  	            return lines_1.concat([
  	                n.readonly ? "readonly " : "",
  	                "[",
  	                path.map(print, "parameters"),
  	                "]",
  	                path.call(print, "typeAnnotation"),
  	            ]);
  	        case "TSPropertySignature":
  	            parts.push(printVariance(path, print), n.readonly ? "readonly " : "");
  	            if (n.computed) {
  	                parts.push("[", path.call(print, "key"), "]");
  	            }
  	            else {
  	                parts.push(path.call(print, "key"));
  	            }
  	            parts.push(n.optional ? "?" : "", path.call(print, "typeAnnotation"));
  	            return lines_1.concat(parts);
  	        case "TSMethodSignature":
  	            if (n.computed) {
  	                parts.push("[", path.call(print, "key"), "]");
  	            }
  	            else {
  	                parts.push(path.call(print, "key"));
  	            }
  	            if (n.optional) {
  	                parts.push("?");
  	            }
  	            parts.push(path.call(print, "typeParameters"), "(", printFunctionParams(path, options, print), ")", path.call(print, "typeAnnotation"));
  	            return lines_1.concat(parts);
  	        case "TSTypePredicate":
  	            if (n.asserts) {
  	                parts.push("asserts ");
  	            }
  	            parts.push(path.call(print, "parameterName"));
  	            if (n.typeAnnotation) {
  	                parts.push(" is ", path.call(print, "typeAnnotation", "typeAnnotation"));
  	            }
  	            return lines_1.concat(parts);
  	        case "TSCallSignatureDeclaration":
  	            return lines_1.concat([
  	                path.call(print, "typeParameters"),
  	                "(",
  	                printFunctionParams(path, options, print),
  	                ")",
  	                path.call(print, "typeAnnotation"),
  	            ]);
  	        case "TSConstructSignatureDeclaration":
  	            if (n.typeParameters) {
  	                parts.push("new", path.call(print, "typeParameters"));
  	            }
  	            else {
  	                parts.push("new ");
  	            }
  	            parts.push("(", printFunctionParams(path, options, print), ")", path.call(print, "typeAnnotation"));
  	            return lines_1.concat(parts);
  	        case "TSTypeAliasDeclaration":
  	            return lines_1.concat([
  	                n.declare ? "declare " : "",
  	                "type ",
  	                path.call(print, "id"),
  	                path.call(print, "typeParameters"),
  	                " = ",
  	                path.call(print, "typeAnnotation"),
  	                ";",
  	            ]);
  	        case "TSTypeParameter": {
  	            parts.push(path.call(print, "name"));
  	            // ambiguous because of TSMappedType
  	            var parent = path.getParentNode(0);
  	            var isInMappedType = namedTypes.TSMappedType.check(parent);
  	            if (n.constraint) {
  	                parts.push(isInMappedType ? " in " : " extends ", path.call(print, "constraint"));
  	            }
  	            if (n["default"]) {
  	                parts.push(" = ", path.call(print, "default"));
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "TSTypeAssertion": {
  	            parts.push("<", path.call(print, "typeAnnotation"), "> ", path.call(print, "expression"));
  	            return lines_1.concat(parts);
  	        }
  	        case "TSTypeParameterDeclaration":
  	        case "TSTypeParameterInstantiation":
  	            return lines_1.concat([
  	                "<",
  	                lines_1.fromString(", ").join(path.map(print, "params")),
  	                ">",
  	            ]);
  	        case "TSEnumDeclaration": {
  	            parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path.call(print, "id"));
  	            var memberLines = lines_1.fromString(",\n").join(path.map(print, "members"));
  	            if (memberLines.isEmpty()) {
  	                parts.push(" {}");
  	            }
  	            else {
  	                parts.push(" {\n", memberLines.indent(options.tabWidth), "\n}");
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "TSExpressionWithTypeArguments":
  	            return lines_1.concat([
  	                path.call(print, "expression"),
  	                path.call(print, "typeParameters"),
  	            ]);
  	        case "TSInterfaceBody": {
  	            var lines = lines_1.fromString(";\n").join(path.map(print, "body"));
  	            if (lines.isEmpty()) {
  	                return lines_1.fromString("{}", options);
  	            }
  	            return lines_1.concat(["{\n", lines.indent(options.tabWidth), ";", "\n}"]);
  	        }
  	        case "TSImportType":
  	            parts.push("import(", path.call(print, "argument"), ")");
  	            if (n.qualifier) {
  	                parts.push(".", path.call(print, "qualifier"));
  	            }
  	            if (n.typeParameters) {
  	                parts.push(path.call(print, "typeParameters"));
  	            }
  	            return lines_1.concat(parts);
  	        case "TSImportEqualsDeclaration":
  	            if (n.isExport) {
  	                parts.push("export ");
  	            }
  	            parts.push("import ", path.call(print, "id"), " = ", path.call(print, "moduleReference"));
  	            return maybeAddSemicolon(lines_1.concat(parts));
  	        case "TSExternalModuleReference":
  	            return lines_1.concat(["require(", path.call(print, "expression"), ")"]);
  	        case "TSModuleDeclaration": {
  	            var parent = path.getParentNode();
  	            if (parent.type === "TSModuleDeclaration") {
  	                parts.push(".");
  	            }
  	            else {
  	                if (n.declare) {
  	                    parts.push("declare ");
  	                }
  	                if (!n.global) {
  	                    var isExternal = n.id.type === "StringLiteral" ||
  	                        (n.id.type === "Literal" && typeof n.id.value === "string");
  	                    if (isExternal) {
  	                        parts.push("module ");
  	                    }
  	                    else if (n.loc && n.loc.lines && n.id.loc) {
  	                        var prefix = n.loc.lines.sliceString(n.loc.start, n.id.loc.start);
  	                        // These keywords are fundamentally ambiguous in the
  	                        // Babylon parser, and not reflected in the AST, so
  	                        // the best we can do is to match the original code,
  	                        // when possible.
  	                        if (prefix.indexOf("module") >= 0) {
  	                            parts.push("module ");
  	                        }
  	                        else {
  	                            parts.push("namespace ");
  	                        }
  	                    }
  	                    else {
  	                        parts.push("namespace ");
  	                    }
  	                }
  	            }
  	            parts.push(path.call(print, "id"));
  	            if (n.body && n.body.type === "TSModuleDeclaration") {
  	                parts.push(path.call(print, "body"));
  	            }
  	            else if (n.body) {
  	                var bodyLines = path.call(print, "body");
  	                if (bodyLines.isEmpty()) {
  	                    parts.push(" {}");
  	                }
  	                else {
  	                    parts.push(" {\n", bodyLines.indent(options.tabWidth), "\n}");
  	                }
  	            }
  	            return lines_1.concat(parts);
  	        }
  	        case "TSModuleBlock":
  	            return path.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body");
  	        // Unhandled types below. If encountered, nodes of these types should
  	        // be either left alone or desugared into AST types that are fully
  	        // supported by the pretty-printer.
  	        case "ClassHeritage": // TODO
  	        case "ComprehensionBlock": // TODO
  	        case "ComprehensionExpression": // TODO
  	        case "Glob": // TODO
  	        case "GeneratorExpression": // TODO
  	        case "LetStatement": // TODO
  	        case "LetExpression": // TODO
  	        case "GraphExpression": // TODO
  	        case "GraphIndexExpression": // TODO
  	        case "XMLDefaultDeclaration":
  	        case "XMLAnyName":
  	        case "XMLQualifiedIdentifier":
  	        case "XMLFunctionQualifiedIdentifier":
  	        case "XMLAttributeSelector":
  	        case "XMLFilterExpression":
  	        case "XML":
  	        case "XMLElement":
  	        case "XMLList":
  	        case "XMLEscape":
  	        case "XMLText":
  	        case "XMLStartTag":
  	        case "XMLEndTag":
  	        case "XMLPointTag":
  	        case "XMLName":
  	        case "XMLAttribute":
  	        case "XMLCdata":
  	        case "XMLComment":
  	        case "XMLProcessingInstruction":
  	        default:
  	            debugger;
  	            throw new Error("unknown type: " + JSON.stringify(n.type));
  	    }
  	}
  	function printDecorators(path, printPath) {
  	    var parts = [];
  	    var node = path.getValue();
  	    if (node.decorators &&
  	        node.decorators.length > 0 &&
  	        // If the parent node is an export declaration, it will be
  	        // responsible for printing node.decorators.
  	        !util.getParentExportDeclaration(path)) {
  	        path.each(function (decoratorPath) {
  	            parts.push(printPath(decoratorPath), "\n");
  	        }, "decorators");
  	    }
  	    else if (util.isExportDeclaration(node) &&
  	        node.declaration &&
  	        node.declaration.decorators) {
  	        // Export declarations are responsible for printing any decorators
  	        // that logically apply to node.declaration.
  	        path.each(function (decoratorPath) {
  	            parts.push(printPath(decoratorPath), "\n");
  	        }, "declaration", "decorators");
  	    }
  	    return lines_1.concat(parts);
  	}
  	function printStatementSequence(path, options, print) {
  	    var filtered = [];
  	    var sawComment = false;
  	    var sawStatement = false;
  	    path.each(function (stmtPath) {
  	        var stmt = stmtPath.getValue();
  	        // Just in case the AST has been modified to contain falsy
  	        // "statements," it's safer simply to skip them.
  	        if (!stmt) {
  	            return;
  	        }
  	        // Skip printing EmptyStatement nodes to avoid leaving stray
  	        // semicolons lying around.
  	        if (stmt.type === "EmptyStatement" &&
  	            !(stmt.comments && stmt.comments.length > 0)) {
  	            return;
  	        }
  	        if (namedTypes.Comment.check(stmt)) {
  	            // The pretty printer allows a dangling Comment node to act as
  	            // a Statement when the Comment can't be attached to any other
  	            // non-Comment node in the tree.
  	            sawComment = true;
  	        }
  	        else if (namedTypes.Statement.check(stmt)) {
  	            sawStatement = true;
  	        }
  	        else {
  	            // When the pretty printer encounters a string instead of an
  	            // AST node, it just prints the string. This behavior can be
  	            // useful for fine-grained formatting decisions like inserting
  	            // blank lines.
  	            isString.assert(stmt);
  	        }
  	        // We can't hang onto stmtPath outside of this function, because
  	        // it's just a reference to a mutable FastPath object, so we have
  	        // to go ahead and print it here.
  	        filtered.push({
  	            node: stmt,
  	            printed: print(stmtPath),
  	        });
  	    });
  	    if (sawComment) {
  	        assert_1.default.strictEqual(sawStatement, false, "Comments may appear as statements in otherwise empty statement " +
  	            "lists, but may not coexist with non-Comment nodes.");
  	    }
  	    var prevTrailingSpace = null;
  	    var len = filtered.length;
  	    var parts = [];
  	    filtered.forEach(function (info, i) {
  	        var printed = info.printed;
  	        var stmt = info.node;
  	        var multiLine = printed.length > 1;
  	        var notFirst = i > 0;
  	        var notLast = i < len - 1;
  	        var leadingSpace;
  	        var trailingSpace;
  	        var lines = stmt && stmt.loc && stmt.loc.lines;
  	        var trueLoc = lines && options.reuseWhitespace && util.getTrueLoc(stmt, lines);
  	        if (notFirst) {
  	            if (trueLoc) {
  	                var beforeStart = lines.skipSpaces(trueLoc.start, true);
  	                var beforeStartLine = beforeStart ? beforeStart.line : 1;
  	                var leadingGap = trueLoc.start.line - beforeStartLine;
  	                leadingSpace = Array(leadingGap + 1).join("\n");
  	            }
  	            else {
  	                leadingSpace = multiLine ? "\n\n" : "\n";
  	            }
  	        }
  	        else {
  	            leadingSpace = "";
  	        }
  	        if (notLast) {
  	            if (trueLoc) {
  	                var afterEnd = lines.skipSpaces(trueLoc.end);
  	                var afterEndLine = afterEnd ? afterEnd.line : lines.length;
  	                var trailingGap = afterEndLine - trueLoc.end.line;
  	                trailingSpace = Array(trailingGap + 1).join("\n");
  	            }
  	            else {
  	                trailingSpace = multiLine ? "\n\n" : "\n";
  	            }
  	        }
  	        else {
  	            trailingSpace = "";
  	        }
  	        parts.push(maxSpace(prevTrailingSpace, leadingSpace), printed);
  	        if (notLast) {
  	            prevTrailingSpace = trailingSpace;
  	        }
  	        else if (trailingSpace) {
  	            parts.push(trailingSpace);
  	        }
  	    });
  	    return lines_1.concat(parts);
  	}
  	function maxSpace(s1, s2) {
  	    if (!s1 && !s2) {
  	        return lines_1.fromString("");
  	    }
  	    if (!s1) {
  	        return lines_1.fromString(s2);
  	    }
  	    if (!s2) {
  	        return lines_1.fromString(s1);
  	    }
  	    var spaceLines1 = lines_1.fromString(s1);
  	    var spaceLines2 = lines_1.fromString(s2);
  	    if (spaceLines2.length > spaceLines1.length) {
  	        return spaceLines2;
  	    }
  	    return spaceLines1;
  	}
  	function printMethod(path, options, print) {
  	    var node = path.getNode();
  	    var kind = node.kind;
  	    var parts = [];
  	    var nodeValue = node.value;
  	    if (!namedTypes.FunctionExpression.check(nodeValue)) {
  	        nodeValue = node;
  	    }
  	    var access = node.accessibility || node.access;
  	    if (typeof access === "string") {
  	        parts.push(access, " ");
  	    }
  	    if (node.static) {
  	        parts.push("static ");
  	    }
  	    if (node.abstract) {
  	        parts.push("abstract ");
  	    }
  	    if (node.readonly) {
  	        parts.push("readonly ");
  	    }
  	    if (nodeValue.async) {
  	        parts.push("async ");
  	    }
  	    if (nodeValue.generator) {
  	        parts.push("*");
  	    }
  	    if (kind === "get" || kind === "set") {
  	        parts.push(kind, " ");
  	    }
  	    var key = path.call(print, "key");
  	    if (node.computed) {
  	        key = lines_1.concat(["[", key, "]"]);
  	    }
  	    parts.push(key);
  	    if (node.optional) {
  	        parts.push("?");
  	    }
  	    if (node === nodeValue) {
  	        parts.push(path.call(print, "typeParameters"), "(", printFunctionParams(path, options, print), ")", path.call(print, "returnType"));
  	        if (node.body) {
  	            parts.push(" ", path.call(print, "body"));
  	        }
  	        else {
  	            parts.push(";");
  	        }
  	    }
  	    else {
  	        parts.push(path.call(print, "value", "typeParameters"), "(", path.call(function (valuePath) { return printFunctionParams(valuePath, options, print); }, "value"), ")", path.call(print, "value", "returnType"));
  	        if (nodeValue.body) {
  	            parts.push(" ", path.call(print, "value", "body"));
  	        }
  	        else {
  	            parts.push(";");
  	        }
  	    }
  	    return lines_1.concat(parts);
  	}
  	function printArgumentsList(path, options, print) {
  	    var printed = path.map(print, "arguments");
  	    var trailingComma = util.isTrailingCommaEnabled(options, "parameters");
  	    var joined = lines_1.fromString(", ").join(printed);
  	    if (joined.getLineLength(1) > options.wrapColumn) {
  	        joined = lines_1.fromString(",\n").join(printed);
  	        return lines_1.concat([
  	            "(\n",
  	            joined.indent(options.tabWidth),
  	            trailingComma ? ",\n)" : "\n)",
  	        ]);
  	    }
  	    return lines_1.concat(["(", joined, ")"]);
  	}
  	function printFunctionParams(path, options, print) {
  	    var fun = path.getValue();
  	    var params;
  	    var printed = [];
  	    if (fun.params) {
  	        params = fun.params;
  	        printed = path.map(print, "params");
  	    }
  	    else if (fun.parameters) {
  	        params = fun.parameters;
  	        printed = path.map(print, "parameters");
  	    }
  	    if (fun.defaults) {
  	        path.each(function (defExprPath) {
  	            var i = defExprPath.getName();
  	            var p = printed[i];
  	            if (p && defExprPath.getValue()) {
  	                printed[i] = lines_1.concat([p, " = ", print(defExprPath)]);
  	            }
  	        }, "defaults");
  	    }
  	    if (fun.rest) {
  	        printed.push(lines_1.concat(["...", path.call(print, "rest")]));
  	    }
  	    var joined = lines_1.fromString(", ").join(printed);
  	    if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
  	        joined = lines_1.fromString(",\n").join(printed);
  	        if (util.isTrailingCommaEnabled(options, "parameters") &&
  	            !fun.rest &&
  	            params[params.length - 1].type !== "RestElement") {
  	            joined = lines_1.concat([joined, ",\n"]);
  	        }
  	        else {
  	            joined = lines_1.concat([joined, "\n"]);
  	        }
  	        return lines_1.concat(["\n", joined.indent(options.tabWidth)]);
  	    }
  	    return joined;
  	}
  	function printExportDeclaration(path, options, print) {
  	    var decl = path.getValue();
  	    var parts = ["export "];
  	    if (decl.exportKind && decl.exportKind === "type") {
  	        if (!decl.declaration) {
  	            parts.push("type ");
  	        }
  	    }
  	    var shouldPrintSpaces = options.objectCurlySpacing;
  	    namedTypes.Declaration.assert(decl);
  	    if (decl["default"] || decl.type === "ExportDefaultDeclaration") {
  	        parts.push("default ");
  	    }
  	    if (decl.declaration) {
  	        parts.push(path.call(print, "declaration"));
  	    }
  	    else if (decl.specifiers) {
  	        if (decl.specifiers.length === 1 &&
  	            decl.specifiers[0].type === "ExportBatchSpecifier") {
  	            parts.push("*");
  	        }
  	        else if (decl.specifiers.length === 0) {
  	            parts.push("{}");
  	        }
  	        else if (decl.specifiers[0].type === "ExportDefaultSpecifier") {
  	            var unbracedSpecifiers_2 = [];
  	            var bracedSpecifiers_2 = [];
  	            path.each(function (specifierPath) {
  	                var spec = specifierPath.getValue();
  	                if (spec.type === "ExportDefaultSpecifier") {
  	                    unbracedSpecifiers_2.push(print(specifierPath));
  	                }
  	                else {
  	                    bracedSpecifiers_2.push(print(specifierPath));
  	                }
  	            }, "specifiers");
  	            unbracedSpecifiers_2.forEach(function (lines, i) {
  	                if (i > 0) {
  	                    parts.push(", ");
  	                }
  	                parts.push(lines);
  	            });
  	            if (bracedSpecifiers_2.length > 0) {
  	                var lines_2 = lines_1.fromString(", ").join(bracedSpecifiers_2);
  	                if (lines_2.getLineLength(1) > options.wrapColumn) {
  	                    lines_2 = lines_1.concat([
  	                        lines_1.fromString(",\n").join(bracedSpecifiers_2).indent(options.tabWidth),
  	                        ",",
  	                    ]);
  	                }
  	                if (unbracedSpecifiers_2.length > 0) {
  	                    parts.push(", ");
  	                }
  	                if (lines_2.length > 1) {
  	                    parts.push("{\n", lines_2, "\n}");
  	                }
  	                else if (options.objectCurlySpacing) {
  	                    parts.push("{ ", lines_2, " }");
  	                }
  	                else {
  	                    parts.push("{", lines_2, "}");
  	                }
  	            }
  	        }
  	        else {
  	            parts.push(shouldPrintSpaces ? "{ " : "{", lines_1.fromString(", ").join(path.map(print, "specifiers")), shouldPrintSpaces ? " }" : "}");
  	        }
  	        if (decl.source) {
  	            parts.push(" from ", path.call(print, "source"));
  	        }
  	    }
  	    var lines = lines_1.concat(parts);
  	    if (lastNonSpaceCharacter(lines) !== ";" &&
  	        !(decl.declaration &&
  	            (decl.declaration.type === "FunctionDeclaration" ||
  	                decl.declaration.type === "ClassDeclaration" ||
  	                decl.declaration.type === "TSModuleDeclaration" ||
  	                decl.declaration.type === "TSInterfaceDeclaration" ||
  	                decl.declaration.type === "TSEnumDeclaration"))) {
  	        lines = lines_1.concat([lines, ";"]);
  	    }
  	    return lines;
  	}
  	function printFlowDeclaration(path, parts) {
  	    var parentExportDecl = util.getParentExportDeclaration(path);
  	    if (parentExportDecl) {
  	        assert_1.default.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
  	    }
  	    else {
  	        // If the parent node has type DeclareExportDeclaration, then it
  	        // will be responsible for printing the "declare" token. Otherwise
  	        // it needs to be printed with this non-exported declaration node.
  	        parts.unshift("declare ");
  	    }
  	    return lines_1.concat(parts);
  	}
  	function printVariance(path, print) {
  	    return path.call(function (variancePath) {
  	        var value = variancePath.getValue();
  	        if (value) {
  	            if (value === "plus") {
  	                return lines_1.fromString("+");
  	            }
  	            if (value === "minus") {
  	                return lines_1.fromString("-");
  	            }
  	            return print(variancePath);
  	        }
  	        return lines_1.fromString("");
  	    }, "variance");
  	}
  	function adjustClause(clause, options) {
  	    if (clause.length > 1)
  	        return lines_1.concat([" ", clause]);
  	    return lines_1.concat(["\n", maybeAddSemicolon(clause).indent(options.tabWidth)]);
  	}
  	function lastNonSpaceCharacter(lines) {
  	    var pos = lines.lastPos();
  	    do {
  	        var ch = lines.charAt(pos);
  	        if (/\S/.test(ch))
  	            return ch;
  	    } while (lines.prevPos(pos));
  	}
  	function endsWithBrace(lines) {
  	    return lastNonSpaceCharacter(lines) === "}";
  	}
  	function swapQuotes(str) {
  	    return str.replace(/['"]/g, function (m) { return (m === '"' ? "'" : '"'); });
  	}
  	function nodeStr(str, options) {
  	    isString.assert(str);
  	    switch (options.quote) {
  	        case "auto": {
  	            var double = JSON.stringify(str);
  	            var single = swapQuotes(JSON.stringify(swapQuotes(str)));
  	            return double.length > single.length ? single : double;
  	        }
  	        case "single":
  	            return swapQuotes(JSON.stringify(swapQuotes(str)));
  	        case "double":
  	        default:
  	            return JSON.stringify(str);
  	    }
  	}
  	function maybeAddSemicolon(lines) {
  	    var eoc = lastNonSpaceCharacter(lines);
  	    if (!eoc || "\n};".indexOf(eoc) < 0)
  	        return lines_1.concat([lines, ";"]);
  	    return lines;
  	}
  	return printer;
  }

  (function (exports) {
  	Object.defineProperty(exports, "__esModule", { value: true });
  	exports.run = exports.prettyPrint = exports.print = exports.types = exports.parse = void 0;
  	var tslib_1 = require$$0;
  	var fs_1 = tslib_1.__importDefault(require("fs"));
  	var types = tslib_1.__importStar(requireMain());
  	exports.types = types;
  	var parser_1 = requireParser();
  	Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parser_1.parse; } });
  	var printer_1 = requirePrinter();
  	/**
  	 * Traverse and potentially modify an abstract syntax tree using a
  	 * convenient visitor syntax:
  	 *
  	 *   recast.visit(ast, {
  	 *     names: [],
  	 *     visitIdentifier: function(path) {
  	 *       var node = path.value;
  	 *       this.visitor.names.push(node.name);
  	 *       this.traverse(path);
  	 *     }
  	 *   });
  	 */
  	var ast_types_1 = requireMain();
  	Object.defineProperty(exports, "visit", { enumerable: true, get: function () { return ast_types_1.visit; } });
  	/**
  	 * Reprint a modified syntax tree using as much of the original source
  	 * code as possible.
  	 */
  	function print(node, options) {
  	    return new printer_1.Printer(options).print(node);
  	}
  	exports.print = print;
  	/**
  	 * Print without attempting to reuse any original source code.
  	 */
  	function prettyPrint(node, options) {
  	    return new printer_1.Printer(options).printGenerically(node);
  	}
  	exports.prettyPrint = prettyPrint;
  	/**
  	 * Convenient command-line interface (see e.g. example/add-braces).
  	 */
  	function run(transformer, options) {
  	    return runFile(process.argv[2], transformer, options);
  	}
  	exports.run = run;
  	function runFile(path, transformer, options) {
  	    fs_1.default.readFile(path, "utf-8", function (err, code) {
  	        if (err) {
  	            console.error(err);
  	            return;
  	        }
  	        runString(code, transformer, options);
  	    });
  	}
  	function defaultWriteback(output) {
  	    process.stdout.write(output);
  	}
  	function runString(code, transformer, options) {
  	    var writeback = options && options.writeback || defaultWriteback;
  	    transformer(parser_1.parse(code, options), function (node) {
  	        writeback(print(node, options).code);
  	    });
  	}
  } (main$1));

  const types = main$1.types;
  const builders = main$1.types.builders;
  const namedTypes = main$1.types.namedTypes;

  var builtin = {
  	AggregateError: false,
  	"Array": false,
  	"ArrayBuffer": false,
  	Atomics: false,
  	BigInt: false,
  	BigInt64Array: false,
  	BigUint64Array: false,
  	"Boolean": false,
  	constructor: false,
  	"DataView": false,
  	"Date": false,
  	"decodeURI": false,
  	"decodeURIComponent": false,
  	"encodeURI": false,
  	"encodeURIComponent": false,
  	"Error": false,
  	"escape": false,
  	"eval": false,
  	"EvalError": false,
  	FinalizationRegistry: false,
  	"Float32Array": false,
  	"Float64Array": false,
  	"Function": false,
  	globalThis: false,
  	hasOwnProperty: false,
  	"Infinity": false,
  	"Int16Array": false,
  	"Int32Array": false,
  	"Int8Array": false,
  	"isFinite": false,
  	"isNaN": false,
  	isPrototypeOf: false,
  	"JSON": false,
  	"Map": false,
  	"Math": false,
  	"NaN": false,
  	"Number": false,
  	"Object": false,
  	"parseFloat": false,
  	"parseInt": false,
  	"Promise": false,
  	propertyIsEnumerable: false,
  	"Proxy": false,
  	"RangeError": false,
  	"ReferenceError": false,
  	"Reflect": false,
  	"RegExp": false,
  	"Set": false,
  	SharedArrayBuffer: false,
  	"String": false,
  	"Symbol": false,
  	"SyntaxError": false,
  	toLocaleString: false,
  	toString: false,
  	"TypeError": false,
  	"Uint16Array": false,
  	"Uint32Array": false,
  	"Uint8Array": false,
  	"Uint8ClampedArray": false,
  	"undefined": false,
  	"unescape": false,
  	"URIError": false,
  	valueOf: false,
  	"WeakMap": false,
  	WeakRef: false,
  	"WeakSet": false
  };

  const browserAPIs = ['window', 'document', 'console'];
  const builtinAPIs = Object.keys(builtin);

  const isIdentifier = n => namedTypes.Identifier.check(n);
  const isLiteral = n => namedTypes.Literal.check(n);
  const isExpressionStatement = n => namedTypes.ExpressionStatement.check(n);
  const isThisExpression = n => namedTypes.ThisExpression.check(n);
  const isObjectExpression = n => namedTypes.ObjectExpression.check(n);
  const isThisExpressionStatement = n =>
    isExpressionStatement(n) &&
    isMemberExpression(n.expression.left) &&
    isThisExpression(n.expression.left.object);
  const isNewExpression = n => namedTypes.NewExpression.check(n);
  const isSequenceExpression = n => namedTypes.SequenceExpression.check(n);
  const isExportDefaultStatement = n => namedTypes.ExportDefaultDeclaration.check(n);
  const isMemberExpression = n => namedTypes.MemberExpression.check(n);
  const isImportDeclaration = n => namedTypes.ImportDeclaration.check(n);
  const isTypeAliasDeclaration = n => namedTypes.TSTypeAliasDeclaration.check(n);
  const isInterfaceDeclaration = n => namedTypes.TSInterfaceDeclaration.check(n);
  const isExportNamedDeclaration = n => namedTypes.ExportNamedDeclaration.check(n);

  const isBrowserAPI = ({name}) => browserAPIs.includes(name);
  const isBuiltinAPI = ({name}) => builtinAPIs.includes(name);
  const isRaw = n => n && n.raw;

  /**
   * Similar to compose but performs from left-to-right function composition.<br/>
   * {@link https://30secondsofcode.org/function#composeright see also}
   * @param   {...[function]} fns) - list of unary function
   * @returns {*} result of the computation
   */

  /**
   * Performs right-to-left function composition.<br/>
   * Use Array.prototype.reduce() to perform right-to-left function composition.<br/>
   * The last (rightmost) function can accept one or more arguments; the remaining functions must be unary.<br/>
   * {@link https://30secondsofcode.org/function#compose original source code}
   * @param   {...[function]} fns) - list of unary function
   * @returns {*} result of the computation
   */
  function compose(...fns) {
    return fns.reduce((f, g) => (...args) => f(g(...args)))
  }

  /**
   * Quick type checking
   * @param   {*} element - anything
   * @param   {string} type - type definition
   * @returns {boolean} true if the type corresponds
   */

  /**
   * Check if a value is an Object
   * @param   {*}  value - anything
   * @returns {boolean} true only for the value is an object
   */
  function isObject(value) {
    return !isNil(value) && value.constructor === Object
  }

  /**
   * Check if a value is null or undefined
   * @param   {*}  value - anything
   * @returns {boolean} true only for the 'undefined' and 'null' types
   */
  function isNil(value) {
    return value === null || value === undefined
  }

  /**
   * Detect node js environements
   * @returns {boolean} true if the runtime is node
   */
  function isNode() {
    return typeof process !== 'undefined'
  }

  /**
   * True if the node has not expression set nor bindings directives
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true only if it's a static node that doesn't need bindings or expressions
   */
  function isStaticNode(node) {
    return [
      hasExpressions,
      findEachAttribute,
      findIfAttribute,
      isCustomNode,
      isSlotNode
    ].every(test => !test(node))
  }

  /**
   * Check if a node should be rendered in the final component HTML
   * For example slot <template slot="content"> tags not using `each` or `if` directives can be removed
   * see also https://github.com/riot/riot/issues/2888
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true if we can remove this tag from the component rendered HTML
   */
  function isRemovableNode(node) {
    return isTemplateNode(node) && !isNil(findAttribute(SLOT_ATTRIBUTE, node)) && !hasEachAttribute(node) && !hasIfAttribute(node)
  }

  /**
   * Check if a node name is part of the browser or builtin javascript api or it belongs to the current scope
   * @param   { types.NodePath } path - containing the current node visited
   * @returns {boolean} true if it's a global api variable
   */
  function isGlobal({ scope, node }) {
    // recursively find the identifier of this AST path
    if (node.object) {
      return isGlobal({ node: node.object, scope })
    }

    return Boolean(
      isRaw(node) ||
      isBuiltinAPI(node) ||
      isBrowserAPI(node) ||
      isNewExpression(node) ||
      isNodeInScope(scope, node)
    )
  }

  /**
   * Checks if the identifier of a given node exists in a scope
   * @param {Scope} scope - scope where to search for the identifier
   * @param {types.Node} node - node to search for the identifier
   * @returns {boolean} true if the node identifier is defined in the given scope
   */
  function isNodeInScope(scope, node) {
    const traverse = (isInScope = false) => {
      types.visit(node, {
        visitIdentifier(path) {
          if (scope.lookup(getName(path.node))) {
            isInScope = true;
          }

          this.abort();
        }
      });

      return isInScope
    };

    return traverse()
  }

  /**
   * True if the node has the isCustom attribute set
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true if either it's a riot component or a custom element
   */
  function isCustomNode(node) {
    return !!(node[IS_CUSTOM_NODE] || hasIsAttribute(node))
  }

  /**
   * True the node is <slot>
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true if it's a slot node
   */
  function isSlotNode(node) {
    return node.name === SLOT_TAG_NODE_NAME
  }

  /**
   * True if the node has the isVoid attribute set
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true if the node is self closing
   */
  function isVoidNode(node) {
    return !!node[IS_VOID_NODE]
  }

  /**
   * True if the riot parser did find a tag node
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true only for the tag nodes
   */
  function isTagNode(node) {
    return node.type === nodeTypes.TAG
  }

  /**
   * True if the riot parser did find a text node
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true only for the text nodes
   */
  function isTextNode(node) {
    return node.type === nodeTypes.TEXT
  }

  /**
   * True if the node parsed is the root one
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true only for the root nodes
   */
  function isRootNode(node) {
    return node.isRoot
  }

  /**
   * True if the attribute parsed is of type spread one
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true if the attribute node is of type spread
   */
  function isSpreadAttribute(node) {
    return node[IS_SPREAD_ATTRIBUTE]
  }

  /**
   * True if the node is an attribute and its name is "value"
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true only for value attribute nodes
   */
  function isValueAttribute(node) {
    return node.name === 'value'
  }

  /**
   * True if the DOM node is a progress tag
   * @param   {RiotParser.Node}  node - riot parser node
   * @returns {boolean} true for the progress tags
   */
  function isProgressNode(node) {
    return node.name === PROGRESS_TAG_NODE_NAME
  }

  /**
   * True if the DOM node is a <template> tag
   * @param   {RiotParser.Node}  node - riot parser node
   * @returns {boolean} true for the progress tags
   */
  function isTemplateNode(node) {
    return node.name === TEMPLATE_TAG_NODE_NAME
  }

  /**
   * True if the node is an attribute and a DOM handler
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true only for dom listener attribute nodes
   */
  const isEventAttribute = (() => {
    const EVENT_ATTR_RE = /^on/;
    return node => EVENT_ATTR_RE.test(node.name)
  })();


  /**
   * Check if a string is an html comment
   * @param   {string}  string - test string
   * @returns {boolean} true if html comment
   */
  function isCommentString(string) {
    return string.trim().indexOf('<!') === 0
  }

  /**
   * True if the node has expressions or expression attributes
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} ditto
   */
  function hasExpressions(node) {
    return !!(
      node.expressions ||
      // has expression attributes
      (getNodeAttributes(node).some(attribute => hasExpressions(attribute))) ||
      // has child text nodes with expressions
      (node.nodes && node.nodes.some(node => isTextNode(node) && hasExpressions(node)))
    )
  }

  /**
   * True if the node is a directive having its own template
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {boolean} true only for the IF EACH and TAG bindings
   */
  function hasItsOwnTemplate(node) {
    return [
      findEachAttribute,
      findIfAttribute,
      isCustomNode
    ].some(test => test(node))
  }

  const hasIfAttribute = compose(Boolean, findIfAttribute);
  const hasEachAttribute = compose(Boolean, findEachAttribute);
  const hasIsAttribute = compose(Boolean, findIsAttribute);
  compose(Boolean, findKeyAttribute);

  /**
   * Find the attribute node
   * @param   { string } name -  name of the attribute we want to find
   * @param   { riotParser.nodeTypes.TAG } node - a tag node
   * @returns { riotParser.nodeTypes.ATTR } attribute node
   */
  function findAttribute(name, node) {
    return node.attributes && node.attributes.find(attr => getName(attr) === name)
  }

  function findIfAttribute(node) {
    return findAttribute(IF_DIRECTIVE, node)
  }

  function findEachAttribute(node) {
    return findAttribute(EACH_DIRECTIVE, node)
  }

  function findKeyAttribute(node) {
    return findAttribute(KEY_ATTRIBUTE, node)
  }

  function findIsAttribute(node) {
    return findAttribute(IS_DIRECTIVE, node)
  }

  /**
   * Find all the node attributes that are not expressions
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {Array} list of all the static attributes
   */
  function findStaticAttributes(node) {
    return getNodeAttributes(node).filter(attribute => !hasExpressions(attribute))
  }

  /**
   * Find all the node attributes that have expressions
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {Array} list of all the dynamic attributes
   */
  function findDynamicAttributes(node) {
    return getNodeAttributes(node).filter(hasExpressions)
  }

  function nullNode() {
    return builders.literal(null)
  }

  function simplePropertyNode(key, value) {
    const property = builders.property('init', builders.identifier(key), value, false);

    property.sho;
    return property
  }

  const LINES_RE = /\r\n?|\n/g;

  /**
   * Split a string into a rows array generated from its EOL matches
   * @param   { string } string [description]
   * @returns { Array } array containing all the string rows
   */
  function splitStringByEOL(string) {
    return string.split(LINES_RE)
  }

  /**
   * Get the line and the column of a source text based on its position in the string
   * @param   { string } string - target string
   * @param   { number } position - target position
   * @returns { Object } object containing the source text line and column
   */
  function getLineAndColumnByPosition(string, position) {
    const lines = splitStringByEOL(string.slice(0, position));

    return {
      line: lines.length,
      column: lines[lines.length - 1].length
    }
  }

  /**
   * Add the offset to the code that must be parsed in order to generate properly the sourcemaps
   * @param {string} input - input string
   * @param {string} source - original source code
   * @param {RiotParser.Node} node - node that we are going to transform
   * @return {string} the input string with the offset properly set
   */
  function addLineOffset(input, source, node) {
    const {column, line} = getLineAndColumnByPosition(source, node.start);
    return `${'\n'.repeat(line - 1)}${' '.repeat(column + 1)}${input}`
  }

  /**
   * Create a simple attribute expression
   * @param   {RiotParser.Node.Attr} sourceNode - the custom tag
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @returns {AST.Node} object containing the expression binding keys
   */
  function createAttributeExpression(sourceNode, sourceFile, sourceCode) {
    return builders.objectExpression([
      simplePropertyNode(BINDING_TYPE_KEY,
        builders.memberExpression(
          builders.identifier(EXPRESSION_TYPES),
          builders.identifier(ATTRIBUTE_EXPRESSION_TYPE),
          false
        )
      ),
      simplePropertyNode(BINDING_NAME_KEY, isSpreadAttribute(sourceNode) ? nullNode() : builders.literal(sourceNode.name)),
      simplePropertyNode(
        BINDING_EVALUATE_KEY,
        createAttributeEvaluationFunction(sourceNode, sourceFile, sourceCode)
      )
    ])
  }

  /**
   * Create a simple event expression
   * @param   {RiotParser.Node.Attr} sourceNode - attribute containing the event handlers
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @returns {AST.Node} object containing the expression binding keys
   */
  function createEventExpression(sourceNode, sourceFile, sourceCode) {
    return builders.objectExpression([
      simplePropertyNode(BINDING_TYPE_KEY,
        builders.memberExpression(
          builders.identifier(EXPRESSION_TYPES),
          builders.identifier(EVENT_EXPRESSION_TYPE),
          false
        )
      ),
      simplePropertyNode(BINDING_NAME_KEY, builders.literal(sourceNode.name)),
      simplePropertyNode(
        BINDING_EVALUATE_KEY,
        createAttributeEvaluationFunction(sourceNode, sourceFile, sourceCode)
      )
    ])
  }

  var quot = "\"";
  var amp = "&";
  var apos = "'";
  var lt = "<";
  var gt = ">";
  var nbsp = " ";
  var iexcl = "¡";
  var cent = "¢";
  var pound = "£";
  var curren = "¤";
  var yen = "¥";
  var brvbar = "¦";
  var sect = "§";
  var uml = "¨";
  var copy = "©";
  var ordf = "ª";
  var laquo = "«";
  var not = "¬";
  var shy = "­";
  var reg = "®";
  var macr = "¯";
  var deg = "°";
  var plusmn = "±";
  var sup2 = "²";
  var sup3 = "³";
  var acute = "´";
  var micro = "µ";
  var para = "¶";
  var middot = "·";
  var cedil = "¸";
  var sup1 = "¹";
  var ordm = "º";
  var raquo = "»";
  var frac14 = "¼";
  var frac12 = "½";
  var frac34 = "¾";
  var iquest = "¿";
  var Agrave = "À";
  var Aacute = "Á";
  var Acirc = "Â";
  var Atilde = "Ã";
  var Auml = "Ä";
  var Aring = "Å";
  var AElig = "Æ";
  var Ccedil = "Ç";
  var Egrave = "È";
  var Eacute = "É";
  var Ecirc = "Ê";
  var Euml = "Ë";
  var Igrave = "Ì";
  var Iacute = "Í";
  var Icirc = "Î";
  var Iuml = "Ï";
  var ETH = "Ð";
  var Ntilde = "Ñ";
  var Ograve = "Ò";
  var Oacute = "Ó";
  var Ocirc = "Ô";
  var Otilde = "Õ";
  var Ouml = "Ö";
  var times = "×";
  var Oslash = "Ø";
  var Ugrave = "Ù";
  var Uacute = "Ú";
  var Ucirc = "Û";
  var Uuml = "Ü";
  var Yacute = "Ý";
  var THORN = "Þ";
  var szlig = "ß";
  var agrave = "à";
  var aacute = "á";
  var acirc = "â";
  var atilde = "ã";
  var auml = "ä";
  var aring = "å";
  var aelig = "æ";
  var ccedil = "ç";
  var egrave = "è";
  var eacute = "é";
  var ecirc = "ê";
  var euml = "ë";
  var igrave = "ì";
  var iacute = "í";
  var icirc = "î";
  var iuml = "ï";
  var eth = "ð";
  var ntilde = "ñ";
  var ograve = "ò";
  var oacute = "ó";
  var ocirc = "ô";
  var otilde = "õ";
  var ouml = "ö";
  var divide = "÷";
  var oslash = "ø";
  var ugrave = "ù";
  var uacute = "ú";
  var ucirc = "û";
  var uuml = "ü";
  var yacute = "ý";
  var thorn = "þ";
  var yuml = "ÿ";
  var OElig = "Œ";
  var oelig = "œ";
  var Scaron = "Š";
  var scaron = "š";
  var Yuml = "Ÿ";
  var fnof = "ƒ";
  var circ = "ˆ";
  var tilde = "˜";
  var Alpha = "Α";
  var Beta = "Β";
  var Gamma = "Γ";
  var Delta = "Δ";
  var Epsilon = "Ε";
  var Zeta = "Ζ";
  var Eta = "Η";
  var Theta = "Θ";
  var Iota = "Ι";
  var Kappa = "Κ";
  var Lambda = "Λ";
  var Mu = "Μ";
  var Nu = "Ν";
  var Xi = "Ξ";
  var Omicron = "Ο";
  var Pi = "Π";
  var Rho = "Ρ";
  var Sigma = "Σ";
  var Tau = "Τ";
  var Upsilon = "Υ";
  var Phi = "Φ";
  var Chi = "Χ";
  var Psi = "Ψ";
  var Omega = "Ω";
  var alpha = "α";
  var beta = "β";
  var gamma = "γ";
  var delta = "δ";
  var epsilon = "ε";
  var zeta = "ζ";
  var eta = "η";
  var theta = "θ";
  var iota = "ι";
  var kappa = "κ";
  var lambda = "λ";
  var mu = "μ";
  var nu = "ν";
  var xi = "ξ";
  var omicron = "ο";
  var pi = "π";
  var rho = "ρ";
  var sigmaf = "ς";
  var sigma = "σ";
  var tau = "τ";
  var upsilon = "υ";
  var phi = "φ";
  var chi = "χ";
  var psi = "ψ";
  var omega = "ω";
  var thetasym = "ϑ";
  var upsih = "ϒ";
  var piv = "ϖ";
  var ensp = " ";
  var emsp = " ";
  var thinsp = " ";
  var zwnj = "‌";
  var zwj = "‍";
  var lrm = "‎";
  var rlm = "‏";
  var ndash = "–";
  var mdash = "—";
  var lsquo = "‘";
  var rsquo = "’";
  var sbquo = "‚";
  var ldquo = "“";
  var rdquo = "”";
  var bdquo = "„";
  var dagger = "†";
  var Dagger = "‡";
  var bull = "•";
  var hellip = "…";
  var permil = "‰";
  var prime = "′";
  var Prime = "″";
  var lsaquo = "‹";
  var rsaquo = "›";
  var oline = "‾";
  var frasl = "⁄";
  var euro = "€";
  var image = "ℑ";
  var weierp = "℘";
  var real = "ℜ";
  var trade = "™";
  var alefsym = "ℵ";
  var larr = "←";
  var uarr = "↑";
  var rarr = "→";
  var darr = "↓";
  var harr = "↔";
  var crarr = "↵";
  var lArr = "⇐";
  var uArr = "⇑";
  var rArr = "⇒";
  var dArr = "⇓";
  var hArr = "⇔";
  var forall = "∀";
  var part = "∂";
  var exist = "∃";
  var empty = "∅";
  var nabla = "∇";
  var isin = "∈";
  var notin = "∉";
  var ni = "∋";
  var prod = "∏";
  var sum = "∑";
  var minus = "−";
  var lowast = "∗";
  var radic = "√";
  var prop = "∝";
  var infin = "∞";
  var ang = "∠";
  var and = "∧";
  var or = "∨";
  var cap = "∩";
  var cup = "∪";
  var int = "∫";
  var there4 = "∴";
  var sim = "∼";
  var cong = "≅";
  var asymp = "≈";
  var ne = "≠";
  var equiv = "≡";
  var le = "≤";
  var ge = "≥";
  var sub = "⊂";
  var sup = "⊃";
  var nsub = "⊄";
  var sube = "⊆";
  var supe = "⊇";
  var oplus = "⊕";
  var otimes = "⊗";
  var perp = "⊥";
  var sdot = "⋅";
  var lceil = "⌈";
  var rceil = "⌉";
  var lfloor = "⌊";
  var rfloor = "⌋";
  var lang = "〈";
  var rang = "〉";
  var loz = "◊";
  var spades = "♠";
  var clubs = "♣";
  var hearts = "♥";
  var diams = "♦";
  var entities = {
  	quot: quot,
  	amp: amp,
  	apos: apos,
  	lt: lt,
  	gt: gt,
  	nbsp: nbsp,
  	iexcl: iexcl,
  	cent: cent,
  	pound: pound,
  	curren: curren,
  	yen: yen,
  	brvbar: brvbar,
  	sect: sect,
  	uml: uml,
  	copy: copy,
  	ordf: ordf,
  	laquo: laquo,
  	not: not,
  	shy: shy,
  	reg: reg,
  	macr: macr,
  	deg: deg,
  	plusmn: plusmn,
  	sup2: sup2,
  	sup3: sup3,
  	acute: acute,
  	micro: micro,
  	para: para,
  	middot: middot,
  	cedil: cedil,
  	sup1: sup1,
  	ordm: ordm,
  	raquo: raquo,
  	frac14: frac14,
  	frac12: frac12,
  	frac34: frac34,
  	iquest: iquest,
  	Agrave: Agrave,
  	Aacute: Aacute,
  	Acirc: Acirc,
  	Atilde: Atilde,
  	Auml: Auml,
  	Aring: Aring,
  	AElig: AElig,
  	Ccedil: Ccedil,
  	Egrave: Egrave,
  	Eacute: Eacute,
  	Ecirc: Ecirc,
  	Euml: Euml,
  	Igrave: Igrave,
  	Iacute: Iacute,
  	Icirc: Icirc,
  	Iuml: Iuml,
  	ETH: ETH,
  	Ntilde: Ntilde,
  	Ograve: Ograve,
  	Oacute: Oacute,
  	Ocirc: Ocirc,
  	Otilde: Otilde,
  	Ouml: Ouml,
  	times: times,
  	Oslash: Oslash,
  	Ugrave: Ugrave,
  	Uacute: Uacute,
  	Ucirc: Ucirc,
  	Uuml: Uuml,
  	Yacute: Yacute,
  	THORN: THORN,
  	szlig: szlig,
  	agrave: agrave,
  	aacute: aacute,
  	acirc: acirc,
  	atilde: atilde,
  	auml: auml,
  	aring: aring,
  	aelig: aelig,
  	ccedil: ccedil,
  	egrave: egrave,
  	eacute: eacute,
  	ecirc: ecirc,
  	euml: euml,
  	igrave: igrave,
  	iacute: iacute,
  	icirc: icirc,
  	iuml: iuml,
  	eth: eth,
  	ntilde: ntilde,
  	ograve: ograve,
  	oacute: oacute,
  	ocirc: ocirc,
  	otilde: otilde,
  	ouml: ouml,
  	divide: divide,
  	oslash: oslash,
  	ugrave: ugrave,
  	uacute: uacute,
  	ucirc: ucirc,
  	uuml: uuml,
  	yacute: yacute,
  	thorn: thorn,
  	yuml: yuml,
  	OElig: OElig,
  	oelig: oelig,
  	Scaron: Scaron,
  	scaron: scaron,
  	Yuml: Yuml,
  	fnof: fnof,
  	circ: circ,
  	tilde: tilde,
  	Alpha: Alpha,
  	Beta: Beta,
  	Gamma: Gamma,
  	Delta: Delta,
  	Epsilon: Epsilon,
  	Zeta: Zeta,
  	Eta: Eta,
  	Theta: Theta,
  	Iota: Iota,
  	Kappa: Kappa,
  	Lambda: Lambda,
  	Mu: Mu,
  	Nu: Nu,
  	Xi: Xi,
  	Omicron: Omicron,
  	Pi: Pi,
  	Rho: Rho,
  	Sigma: Sigma,
  	Tau: Tau,
  	Upsilon: Upsilon,
  	Phi: Phi,
  	Chi: Chi,
  	Psi: Psi,
  	Omega: Omega,
  	alpha: alpha,
  	beta: beta,
  	gamma: gamma,
  	delta: delta,
  	epsilon: epsilon,
  	zeta: zeta,
  	eta: eta,
  	theta: theta,
  	iota: iota,
  	kappa: kappa,
  	lambda: lambda,
  	mu: mu,
  	nu: nu,
  	xi: xi,
  	omicron: omicron,
  	pi: pi,
  	rho: rho,
  	sigmaf: sigmaf,
  	sigma: sigma,
  	tau: tau,
  	upsilon: upsilon,
  	phi: phi,
  	chi: chi,
  	psi: psi,
  	omega: omega,
  	thetasym: thetasym,
  	upsih: upsih,
  	piv: piv,
  	ensp: ensp,
  	emsp: emsp,
  	thinsp: thinsp,
  	zwnj: zwnj,
  	zwj: zwj,
  	lrm: lrm,
  	rlm: rlm,
  	ndash: ndash,
  	mdash: mdash,
  	lsquo: lsquo,
  	rsquo: rsquo,
  	sbquo: sbquo,
  	ldquo: ldquo,
  	rdquo: rdquo,
  	bdquo: bdquo,
  	dagger: dagger,
  	Dagger: Dagger,
  	bull: bull,
  	hellip: hellip,
  	permil: permil,
  	prime: prime,
  	Prime: Prime,
  	lsaquo: lsaquo,
  	rsaquo: rsaquo,
  	oline: oline,
  	frasl: frasl,
  	euro: euro,
  	image: image,
  	weierp: weierp,
  	real: real,
  	trade: trade,
  	alefsym: alefsym,
  	larr: larr,
  	uarr: uarr,
  	rarr: rarr,
  	darr: darr,
  	harr: harr,
  	crarr: crarr,
  	lArr: lArr,
  	uArr: uArr,
  	rArr: rArr,
  	dArr: dArr,
  	hArr: hArr,
  	forall: forall,
  	part: part,
  	exist: exist,
  	empty: empty,
  	nabla: nabla,
  	isin: isin,
  	notin: notin,
  	ni: ni,
  	prod: prod,
  	sum: sum,
  	minus: minus,
  	lowast: lowast,
  	radic: radic,
  	prop: prop,
  	infin: infin,
  	ang: ang,
  	and: and,
  	or: or,
  	cap: cap,
  	cup: cup,
  	int: int,
  	there4: there4,
  	sim: sim,
  	cong: cong,
  	asymp: asymp,
  	ne: ne,
  	equiv: equiv,
  	le: le,
  	ge: ge,
  	sub: sub,
  	sup: sup,
  	nsub: nsub,
  	sube: sube,
  	supe: supe,
  	oplus: oplus,
  	otimes: otimes,
  	perp: perp,
  	sdot: sdot,
  	lceil: lceil,
  	rceil: rceil,
  	lfloor: lfloor,
  	rfloor: rfloor,
  	lang: lang,
  	rang: rang,
  	loz: loz,
  	spades: spades,
  	clubs: clubs,
  	hearts: hearts,
  	diams: diams
  };

  const HTMLEntityRe = /&(\S+);/g;
  const HEX_NUMBER = /^[\da-fA-F]+$/;
  const DECIMAL_NUMBER = /^\d+$/;

  /**
   * Encode unicode hex html entities like for example &#x222;
   * @param   {string} string - input string
   * @returns {string} encoded string
   */
  function encodeHex(string) {
    const hex = string.substr(2);

    return HEX_NUMBER.test(hex) ?
      String.fromCodePoint(parseInt(hex, 16)) :
      string
  }

  /**
   * Encode unicode decimal html entities like for example &#222;
   * @param   {string} string - input string
   * @returns {string} encoded string
   */
  function encodeDecimal(string) {
    const nr = string.substr(1);

    return DECIMAL_NUMBER.test(nr) ?
      String.fromCodePoint(parseInt(nr, 10))
      : string
  }

  /**
   * Encode html entities in strings like &nbsp;
   * @param   {string} string - input string
   * @returns {string} encoded string
   */
  function encodeHTMLEntities(string) {
    return string.replace(HTMLEntityRe, (match, entity) => {
      const [firstChar, secondChar] = entity;

      if (firstChar === '#') {
        return secondChar === 'x' ?
          encodeHex(entity) :
          encodeDecimal(entity)
      } else {
        return entities[entity] || entity
      }
    })
  }

  /**
   * Native String.prototype.trimEnd method with fallback to String.prototype.trimRight
   * Edge doesn't support the first one
   * @param   {string} string - input string
   * @returns {string} trimmed output
   */
  function trimEnd(string) {
    return (string.trimEnd || string.trimRight).apply(string)
  }

  /**
   * Native String.prototype.trimStart method with fallback to String.prototype.trimLeft
   * Edge doesn't support the first one
   * @param   {string} string - input string
   * @returns {string} trimmed output
   */
  function trimStart(string) {
    return (string.trimStart || string.trimLeft).apply(string)
  }

  /**
   * Unescape the user escaped chars
   * @param   {string} string - input string
   * @param   {string} char - probably a '{' or anything the user want's to escape
   * @returns {string} cleaned up string
   */
  function unescapeChar(string, char) {
    return string.replace(RegExp(`\\\\${char}`, 'gm'), char)
  }

  /**
   * Generate the pure immutable string chunks from a RiotParser.Node.Text
   * @param   {RiotParser.Node.Text} node - riot parser text node
   * @param   {string} sourceCode sourceCode - source code
   * @returns {Array} array containing the immutable string chunks
   */
  function generateLiteralStringChunksFromNode(node, sourceCode) {
    return node.expressions.reduce((chunks, expression, index) => {
      const start = index ? node.expressions[index - 1].end : node.start;
      const string = encodeHTMLEntities(
        sourceCode.substring(start, expression.start)
      );

      // trimStart the first string
      chunks.push(index === 0 ? trimStart(string) : string);

      // add the tail to the string
      if (index === node.expressions.length - 1)
        chunks.push(
          encodeHTMLEntities(
            trimEnd(sourceCode.substring(expression.end, node.end))
          )
        );

      return chunks
    }, [])
      // comments are not supported here
      .filter(str => !isCommentString(str))
      .map(str => node.unescape ? unescapeChar(str, node.unescape) : str)
  }

  /**
   * Simple bindings might contain multiple expressions like for example: "{foo} and {bar}"
   * This helper aims to merge them in a template literal if it's necessary
   * @param   {RiotParser.Node} node - riot parser node
   * @param   {string} sourceFile - original tag file
   * @param   {string} sourceCode - original tag source code
   * @returns { Object } a template literal expression object
   */
  function mergeNodeExpressions(node, sourceFile, sourceCode) {
    if (node.parts.length === 1)
      return transformExpression(node.expressions[0], sourceFile, sourceCode)

    const pureStringChunks = generateLiteralStringChunksFromNode(node, sourceCode);
    const stringsArray = pureStringChunks.reduce((acc, str, index) => {
      const expr = node.expressions[index];

      return [
        ...acc,
        builders.literal(str),
        expr ? transformExpression(expr, sourceFile, sourceCode) : nullNode()
      ]
    }, [])
      // filter the empty literal expressions
      .filter(expr => !isLiteral(expr) || expr.value);

    return createArrayString(stringsArray)
  }

  /**
   * Create a text expression
   * @param   {RiotParser.Node.Text} sourceNode - text node to parse
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @param   {number} childNodeIndex - position of the child text node in its parent children nodes
   * @returns {AST.Node} object containing the expression binding keys
   */
  function createTextExpression(sourceNode, sourceFile, sourceCode, childNodeIndex) {
    return builders.objectExpression([
      simplePropertyNode(BINDING_TYPE_KEY,
        builders.memberExpression(
          builders.identifier(EXPRESSION_TYPES),
          builders.identifier(TEXT_EXPRESSION_TYPE),
          false
        )
      ),
      simplePropertyNode(
        BINDING_CHILD_NODE_INDEX_KEY,
        builders.literal(childNodeIndex)
      ),
      simplePropertyNode(
        BINDING_EVALUATE_KEY,
        wrapASTInFunctionWithScope(
          mergeNodeExpressions(sourceNode, sourceFile, sourceCode)
        )
      )
    ])
  }

  function createValueExpression(sourceNode, sourceFile, sourceCode) {
    return builders.objectExpression([
      simplePropertyNode(BINDING_TYPE_KEY,
        builders.memberExpression(
          builders.identifier(EXPRESSION_TYPES),
          builders.identifier(VALUE_EXPRESSION_TYPE),
          false
        )
      ),
      simplePropertyNode(
        BINDING_EVALUATE_KEY,
        createAttributeEvaluationFunction(sourceNode, sourceFile, sourceCode)
      )
    ])
  }

  function createExpression(sourceNode, sourceFile, sourceCode, childNodeIndex, parentNode) {
    switch (true) {
    case isTextNode(sourceNode):
      return createTextExpression(sourceNode, sourceFile, sourceCode, childNodeIndex)
    // progress nodes value attributes will be rendered as attributes
    // see https://github.com/riot/compiler/issues/122
    case isValueAttribute(sourceNode) && hasValueAttribute(parentNode.name) && !isProgressNode(parentNode):
      return createValueExpression(sourceNode, sourceFile, sourceCode)
    case isEventAttribute(sourceNode):
      return createEventExpression(sourceNode, sourceFile, sourceCode)
    default:
      return createAttributeExpression(sourceNode, sourceFile, sourceCode)
    }
  }

  /**
   * Create the attribute expressions
   * @param   {RiotParser.Node} sourceNode - any kind of node parsed via riot parser
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @returns {Array} array containing all the attribute expressions
   */
  function createAttributeExpressions(sourceNode, sourceFile, sourceCode) {
    return findDynamicAttributes(sourceNode)
      .map(attribute => createExpression(attribute, sourceFile, sourceCode, 0, sourceNode))
  }

  var typescript = {};

  var babel = {};

  var _babel_options = {};

  var hasRequired_babel_options;

  function require_babel_options () {
  	if (hasRequired_babel_options) return _babel_options;
  	hasRequired_babel_options = 1;
  	Object.defineProperty(_babel_options, "__esModule", { value: true });
  	var util_1 = util$5;
  	function getBabelOptions(options) {
  	    // The goal here is to tolerate as much syntax as possible, since Recast
  	    // is not in the business of forbidding anything. If you want your
  	    // parser to be more restrictive for some reason, you can always pass
  	    // your own parser object to recast.parse.
  	    return {
  	        sourceType: util_1.getOption(options, "sourceType", "module"),
  	        strictMode: util_1.getOption(options, "strictMode", false),
  	        allowImportExportEverywhere: true,
  	        allowReturnOutsideFunction: true,
  	        startLine: 1,
  	        tokens: true,
  	        plugins: [
  	            "asyncGenerators",
  	            "bigInt",
  	            "classPrivateMethods",
  	            "classPrivateProperties",
  	            "classProperties",
  	            "decorators-legacy",
  	            "doExpressions",
  	            "dynamicImport",
  	            "exportDefaultFrom",
  	            "exportExtensions",
  	            "exportNamespaceFrom",
  	            "functionBind",
  	            "functionSent",
  	            "importMeta",
  	            "nullishCoalescingOperator",
  	            "numericSeparator",
  	            "objectRestSpread",
  	            "optionalCatchBinding",
  	            "optionalChaining",
  	            ["pipelineOperator", { proposal: "minimal" }],
  	            "throwExpressions",
  	        ]
  	    };
  	}
  	_babel_options.default = getBabelOptions;
  	return _babel_options;
  }

  var lib = {};

  var hasRequiredLib;

  function requireLib () {
  	if (hasRequiredLib) return lib;
  	hasRequiredLib = 1;

  	Object.defineProperty(lib, '__esModule', { value: true });

  	function _objectWithoutPropertiesLoose(source, excluded) {
  	  if (source == null) return {};
  	  var target = {};
  	  var sourceKeys = Object.keys(source);
  	  var key, i;

  	  for (i = 0; i < sourceKeys.length; i++) {
  	    key = sourceKeys[i];
  	    if (excluded.indexOf(key) >= 0) continue;
  	    target[key] = source[key];
  	  }

  	  return target;
  	}

  	class Position {
  	  constructor(line, col, index) {
  	    this.line = void 0;
  	    this.column = void 0;
  	    this.index = void 0;
  	    this.line = line;
  	    this.column = col;
  	    this.index = index;
  	  }

  	}
  	class SourceLocation {
  	  constructor(start, end) {
  	    this.start = void 0;
  	    this.end = void 0;
  	    this.filename = void 0;
  	    this.identifierName = void 0;
  	    this.start = start;
  	    this.end = end;
  	  }

  	}
  	function createPositionWithColumnOffset(position, columnOffset) {
  	  const {
  	    line,
  	    column,
  	    index
  	  } = position;
  	  return new Position(line, column + columnOffset, index + columnOffset);
  	}

  	var ParseErrorCode = {
  	  SyntaxError: "BABEL_PARSER_SYNTAX_ERROR",
  	  SourceTypeModuleError: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
  	};

  	const reflect = (keys, last = keys.length - 1) => ({
  	  get() {
  	    return keys.reduce((object, key) => object[key], this);
  	  },

  	  set(value) {
  	    keys.reduce((item, key, i) => i === last ? item[key] = value : item[key], this);
  	  }

  	});

  	const instantiate = (constructor, properties, descriptors) => Object.keys(descriptors).map(key => [key, descriptors[key]]).filter(([, descriptor]) => !!descriptor).map(([key, descriptor]) => [key, typeof descriptor === "function" ? {
  	  value: descriptor,
  	  enumerable: false
  	} : typeof descriptor.reflect === "string" ? Object.assign({}, descriptor, reflect(descriptor.reflect.split("."))) : descriptor]).reduce((instance, [key, descriptor]) => Object.defineProperty(instance, key, Object.assign({
  	  configurable: true
  	}, descriptor)), Object.assign(new constructor(), properties));

  	var ModuleErrors = {
  	  ImportMetaOutsideModule: {
  	    message: `import.meta may appear only with 'sourceType: "module"'`,
  	    code: ParseErrorCode.SourceTypeModuleError
  	  },
  	  ImportOutsideModule: {
  	    message: `'import' and 'export' may appear only with 'sourceType: "module"'`,
  	    code: ParseErrorCode.SourceTypeModuleError
  	  }
  	};

  	const NodeDescriptions = {
  	  ArrayPattern: "array destructuring pattern",
  	  AssignmentExpression: "assignment expression",
  	  AssignmentPattern: "assignment expression",
  	  ArrowFunctionExpression: "arrow function expression",
  	  ConditionalExpression: "conditional expression",
  	  CatchClause: "catch clause",
  	  ForOfStatement: "for-of statement",
  	  ForInStatement: "for-in statement",
  	  ForStatement: "for-loop",
  	  FormalParameters: "function parameter list",
  	  Identifier: "identifier",
  	  ImportSpecifier: "import specifier",
  	  ImportDefaultSpecifier: "import default specifier",
  	  ImportNamespaceSpecifier: "import namespace specifier",
  	  ObjectPattern: "object destructuring pattern",
  	  ParenthesizedExpression: "parenthesized expression",
  	  RestElement: "rest element",
  	  UpdateExpression: {
  	    true: "prefix operation",
  	    false: "postfix operation"
  	  },
  	  VariableDeclarator: "variable declaration",
  	  YieldExpression: "yield expression"
  	};

  	const toNodeDescription = ({
  	  type,
  	  prefix
  	}) => type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix)] : NodeDescriptions[type];

  	var StandardErrors = {
  	  AccessorIsGenerator: ({
  	    kind
  	  }) => `A ${kind}ter cannot be a generator.`,
  	  ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
  	  AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.",
  	  AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
  	  AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
  	  AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
  	  AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
  	  AwaitNotInAsyncFunction: "'await' is only allowed within async functions.",
  	  BadGetterArity: "A 'get' accesor must not have any formal parameters.",
  	  BadSetterArity: "A 'set' accesor must have exactly one formal parameter.",
  	  BadSetterRestParameter: "A 'set' accesor function argument must not be a rest parameter.",
  	  ConstructorClassField: "Classes may not have a field named 'constructor'.",
  	  ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
  	  ConstructorIsAccessor: "Class constructor may not be an accessor.",
  	  ConstructorIsAsync: "Constructor can't be an async function.",
  	  ConstructorIsGenerator: "Constructor can't be a generator.",
  	  DeclarationMissingInitializer: ({
  	    kind
  	  }) => `Missing initializer in ${kind} declaration.`,
  	  DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax.",
  	  DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
  	  DecoratorExportClass: "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.",
  	  DecoratorSemicolon: "Decorators must not be followed by a semicolon.",
  	  DecoratorStaticBlock: "Decorators can't be used with a static block.",
  	  DeletePrivateField: "Deleting a private field is not allowed.",
  	  DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
  	  DuplicateConstructor: "Duplicate constructor in the same class.",
  	  DuplicateDefaultExport: "Only one default export allowed per module.",
  	  DuplicateExport: ({
  	    exportName
  	  }) => `\`${exportName}\` has already been exported. Exported identifiers must be unique.`,
  	  DuplicateProto: "Redefinition of __proto__ property.",
  	  DuplicateRegExpFlags: "Duplicate regular expression flag.",
  	  ElementAfterRest: "Rest element must be last element.",
  	  EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
  	  ExportBindingIsString: ({
  	    localName,
  	    exportName
  	  }) => `A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`,
  	  ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
  	  ForInOfLoopInitializer: ({
  	    type
  	  }) => `'${type === "ForInStatement" ? "for-in" : "for-of"}' loop variable declaration may not have an initializer.`,
  	  ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
  	  ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.",
  	  GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.",
  	  IllegalBreakContinue: ({
  	    type
  	  }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`,
  	  IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
  	  IllegalReturn: "'return' outside of function.",
  	  ImportBindingIsString: ({
  	    importName
  	  }) => `A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${importName}" as foo }\`?`,
  	  ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments.",
  	  ImportCallArity: ({
  	    maxArgumentCount
  	  }) => `\`import()\` requires exactly ${maxArgumentCount === 1 ? "one argument" : "one or two arguments"}.`,
  	  ImportCallNotNewExpression: "Cannot use new with import(...).",
  	  ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
  	  ImportJSONBindingNotDefault: "A JSON module can only be imported with `default`.",
  	  IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
  	  InvalidBigIntLiteral: "Invalid BigIntLiteral.",
  	  InvalidCodePoint: "Code point out of bounds.",
  	  InvalidCoverInitializedName: "Invalid shorthand property initializer.",
  	  InvalidDecimal: "Invalid decimal.",
  	  InvalidDigit: ({
  	    radix
  	  }) => `Expected number in radix ${radix}.`,
  	  InvalidEscapeSequence: "Bad character escape sequence.",
  	  InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.",
  	  InvalidEscapedReservedWord: ({
  	    reservedWord
  	  }) => `Escape sequence in keyword ${reservedWord}.`,
  	  InvalidIdentifier: ({
  	    identifierName
  	  }) => `Invalid identifier ${identifierName}.`,
  	  InvalidLhs: ({
  	    ancestor
  	  }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
  	  InvalidLhsBinding: ({
  	    ancestor
  	  }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
  	  InvalidNumber: "Invalid number.",
  	  InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
  	  InvalidOrUnexpectedToken: ({
  	    unexpected
  	  }) => `Unexpected character '${unexpected}'.`,
  	  InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
  	  InvalidPrivateFieldResolution: ({
  	    identifierName
  	  }) => `Private name #${identifierName} is not defined.`,
  	  InvalidPropertyBindingPattern: "Binding member expression.",
  	  InvalidRecordProperty: "Only properties and spread elements are allowed in record definitions.",
  	  InvalidRestAssignmentPattern: "Invalid rest operator's argument.",
  	  LabelRedeclaration: ({
  	    labelName
  	  }) => `Label '${labelName}' is already declared.`,
  	  LetInLexicalBinding: "'let' is not allowed to be used as a name in 'let' or 'const' declarations.",
  	  LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
  	  MalformedRegExpFlags: "Invalid regular expression flag.",
  	  MissingClassName: "A class name is required.",
  	  MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
  	  MissingSemicolon: "Missing semicolon.",
  	  MissingPlugin: ({
  	    missingPlugin
  	  }) => `This experimental syntax requires enabling the parser plugin: ${missingPlugin.map(name => JSON.stringify(name)).join(", ")}.`,
  	  MissingOneOfPlugins: ({
  	    missingPlugin
  	  }) => `This experimental syntax requires enabling one of the following parser plugin(s): ${missingPlugin.map(name => JSON.stringify(name)).join(", ")}.`,
  	  MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.",
  	  MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.",
  	  ModuleAttributeDifferentFromType: "The only accepted module attribute is `type`.",
  	  ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.",
  	  ModuleAttributesWithDuplicateKeys: ({
  	    key
  	  }) => `Duplicate key "${key}" is not allowed in module attributes.`,
  	  ModuleExportNameHasLoneSurrogate: ({
  	    surrogateCharCode
  	  }) => `An export name cannot include a lone surrogate, found '\\u${surrogateCharCode.toString(16)}'.`,
  	  ModuleExportUndefined: ({
  	    localName
  	  }) => `Export '${localName}' is not defined.`,
  	  MultipleDefaultsInSwitch: "Multiple default clauses.",
  	  NewlineAfterThrow: "Illegal newline after throw.",
  	  NoCatchOrFinally: "Missing catch or finally clause.",
  	  NumberIdentifier: "Identifier directly after number.",
  	  NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",
  	  ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.",
  	  OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.",
  	  OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.",
  	  OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.",
  	  ParamDupe: "Argument name clash.",
  	  PatternHasAccessor: "Object pattern can't contain getter or setter.",
  	  PatternHasMethod: "Object pattern can't contain methods.",
  	  PrivateInExpectedIn: ({
  	    identifierName
  	  }) => `Private names are only allowed in property accesses (\`obj.#${identifierName}\`) or in \`in\` expressions (\`#${identifierName} in obj\`).`,
  	  PrivateNameRedeclaration: ({
  	    identifierName
  	  }) => `Duplicate private name #${identifierName}.`,
  	  RecordExpressionBarIncorrectEndSyntaxType: "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
  	  RecordExpressionBarIncorrectStartSyntaxType: "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
  	  RecordExpressionHashIncorrectStartSyntaxType: "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",
  	  RecordNoProto: "'__proto__' is not allowed in Record expressions.",
  	  RestTrailingComma: "Unexpected trailing comma after rest element.",
  	  SloppyFunction: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",
  	  StaticPrototype: "Classes may not have static property named prototype.",
  	  SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
  	  SuperPrivateField: "Private fields can't be accessed on super.",
  	  TrailingDecorator: "Decorators must be attached to a class element.",
  	  TupleExpressionBarIncorrectEndSyntaxType: "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
  	  TupleExpressionBarIncorrectStartSyntaxType: "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
  	  TupleExpressionHashIncorrectStartSyntaxType: "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",
  	  UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.",
  	  UnexpectedAwaitAfterPipelineBody: 'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',
  	  UnexpectedDigitAfterHash: "Unexpected digit after hash token.",
  	  UnexpectedImportExport: "'import' and 'export' may only appear at the top level.",
  	  UnexpectedKeyword: ({
  	    keyword
  	  }) => `Unexpected keyword '${keyword}'.`,
  	  UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.",
  	  UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
  	  UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
  	  UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
  	  UnexpectedPrivateField: "Unexpected private name.",
  	  UnexpectedReservedWord: ({
  	    reservedWord
  	  }) => `Unexpected reserved word '${reservedWord}'.`,
  	  UnexpectedSuper: "'super' is only allowed in object methods and classes.",
  	  UnexpectedToken: ({
  	    expected,
  	    unexpected
  	  }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
  	  UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
  	  UnsupportedBind: "Binding should be performed on object property.",
  	  UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
  	  UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
  	  UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
  	  UnsupportedMetaProperty: ({
  	    target,
  	    onlyValidPropertyName
  	  }) => `The only valid meta property for ${target} is ${target}.${onlyValidPropertyName}.`,
  	  UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.",
  	  UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.",
  	  UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",
  	  UnterminatedComment: "Unterminated comment.",
  	  UnterminatedRegExp: "Unterminated regular expression.",
  	  UnterminatedString: "Unterminated string constant.",
  	  UnterminatedTemplate: "Unterminated template.",
  	  VarRedeclaration: ({
  	    identifierName
  	  }) => `Identifier '${identifierName}' has already been declared.`,
  	  YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
  	  YieldInParameter: "Yield expression is not allowed in formal parameters.",
  	  ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
  	};

  	var StrictModeErrors = {
  	  StrictDelete: "Deleting local variable in strict mode.",
  	  StrictEvalArguments: ({
  	    referenceName
  	  }) => `Assigning to '${referenceName}' in strict mode.`,
  	  StrictEvalArgumentsBinding: ({
  	    bindingName
  	  }) => `Binding '${bindingName}' in strict mode.`,
  	  StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.",
  	  StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
  	  StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
  	  StrictWith: "'with' in strict mode."
  	};

  	const UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
  	var PipelineOperatorErrors = {
  	  PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
  	  PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
  	  PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
  	  PipeTopicUnconfiguredToken: ({
  	    token
  	  }) => `Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${token}" }.`,
  	  PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
  	  PipeUnparenthesizedBody: ({
  	    type
  	  }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({
	    type
	  })}; please wrap it in parentheses.`,
  	  PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',
  	  PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.",
  	  PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.",
  	  PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.",
  	  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
  	  PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
  	};

  	const _excluded$1 = ["toMessage"],
  	      _excluded2$1 = ["message"];

  	function toParseErrorConstructor(_ref) {
  	  let {
  	    toMessage
  	  } = _ref,
  	      properties = _objectWithoutPropertiesLoose(_ref, _excluded$1);

  	  return function constructor({
  	    loc,
  	    details
  	  }) {
  	    return instantiate(SyntaxError, Object.assign({}, properties, {
  	      loc
  	    }), {
  	      clone(overrides = {}) {
  	        const loc = overrides.loc || {};
  	        return constructor({
  	          loc: new Position("line" in loc ? loc.line : this.loc.line, "column" in loc ? loc.column : this.loc.column, "index" in loc ? loc.index : this.loc.index),
  	          details: Object.assign({}, this.details, overrides.details)
  	        });
  	      },

  	      details: {
  	        value: details,
  	        enumerable: false
  	      },
  	      message: {
  	        get() {
  	          return `${toMessage(this.details)} (${this.loc.line}:${this.loc.column})`;
  	        },

  	        set(value) {
  	          Object.defineProperty(this, "message", {
  	            value
  	          });
  	        }

  	      },
  	      pos: {
  	        reflect: "loc.index",
  	        enumerable: true
  	      },
  	      missingPlugin: "missingPlugin" in details && {
  	        reflect: "details.missingPlugin",
  	        enumerable: true
  	      }
  	    });
  	  };
  	}

  	function ParseErrorEnum(argument, syntaxPlugin) {
  	  if (Array.isArray(argument)) {
  	    return parseErrorTemplates => ParseErrorEnum(parseErrorTemplates, argument[0]);
  	  }

  	  const ParseErrorConstructors = {};

  	  for (const reasonCode of Object.keys(argument)) {
  	    const template = argument[reasonCode];

  	    const _ref2 = typeof template === "string" ? {
  	      message: () => template
  	    } : typeof template === "function" ? {
  	      message: template
  	    } : template,
  	          {
  	      message
  	    } = _ref2,
  	          rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);

  	    const toMessage = typeof message === "string" ? () => message : message;
  	    ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
  	      code: ParseErrorCode.SyntaxError,
  	      reasonCode,
  	      toMessage
  	    }, syntaxPlugin ? {
  	      syntaxPlugin
  	    } : {}, rest));
  	  }

  	  return ParseErrorConstructors;
  	}
  	const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));

  	const {
  	  defineProperty
  	} = Object;

  	const toUnenumerable = (object, key) => defineProperty(object, key, {
  	  enumerable: false,
  	  value: object[key]
  	});

  	function toESTreeLocation(node) {
  	  node.loc.start && toUnenumerable(node.loc.start, "index");
  	  node.loc.end && toUnenumerable(node.loc.end, "index");
  	  return node;
  	}

  	var estree = (superClass => class extends superClass {
  	  parse() {
  	    const file = toESTreeLocation(super.parse());

  	    if (this.options.tokens) {
  	      file.tokens = file.tokens.map(toESTreeLocation);
  	    }

  	    return file;
  	  }

  	  parseRegExpLiteral({
  	    pattern,
  	    flags
  	  }) {
  	    let regex = null;

  	    try {
  	      regex = new RegExp(pattern, flags);
  	    } catch (e) {}

  	    const node = this.estreeParseLiteral(regex);
  	    node.regex = {
  	      pattern,
  	      flags
  	    };
  	    return node;
  	  }

  	  parseBigIntLiteral(value) {
  	    let bigInt;

  	    try {
  	      bigInt = BigInt(value);
  	    } catch (_unused) {
  	      bigInt = null;
  	    }

  	    const node = this.estreeParseLiteral(bigInt);
  	    node.bigint = String(node.value || value);
  	    return node;
  	  }

  	  parseDecimalLiteral(value) {
  	    const decimal = null;
  	    const node = this.estreeParseLiteral(decimal);
  	    node.decimal = String(node.value || value);
  	    return node;
  	  }

  	  estreeParseLiteral(value) {
  	    return this.parseLiteral(value, "Literal");
  	  }

  	  parseStringLiteral(value) {
  	    return this.estreeParseLiteral(value);
  	  }

  	  parseNumericLiteral(value) {
  	    return this.estreeParseLiteral(value);
  	  }

  	  parseNullLiteral() {
  	    return this.estreeParseLiteral(null);
  	  }

  	  parseBooleanLiteral(value) {
  	    return this.estreeParseLiteral(value);
  	  }

  	  directiveToStmt(directive) {
  	    const directiveLiteral = directive.value;
  	    const stmt = this.startNodeAt(directive.start, directive.loc.start);
  	    const expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start);
  	    expression.value = directiveLiteral.extra.expressionValue;
  	    expression.raw = directiveLiteral.extra.raw;
  	    stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.loc.end);
  	    stmt.directive = directiveLiteral.extra.raw.slice(1, -1);
  	    return this.finishNodeAt(stmt, "ExpressionStatement", directive.loc.end);
  	  }

  	  initFunction(node, isAsync) {
  	    super.initFunction(node, isAsync);
  	    node.expression = false;
  	  }

  	  checkDeclaration(node) {
  	    if (node != null && this.isObjectProperty(node)) {
  	      this.checkDeclaration(node.value);
  	    } else {
  	      super.checkDeclaration(node);
  	    }
  	  }

  	  getObjectOrClassMethodParams(method) {
  	    return method.value.params;
  	  }

  	  isValidDirective(stmt) {
  	    var _stmt$expression$extr;

  	    return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !((_stmt$expression$extr = stmt.expression.extra) != null && _stmt$expression$extr.parenthesized);
  	  }

  	  parseBlockBody(node, ...args) {
  	    super.parseBlockBody(node, ...args);
  	    const directiveStatements = node.directives.map(d => this.directiveToStmt(d));
  	    node.body = directiveStatements.concat(node.body);
  	    delete node.directives;
  	  }

  	  pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
  	    this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true);

  	    if (method.typeParameters) {
  	      method.value.typeParameters = method.typeParameters;
  	      delete method.typeParameters;
  	    }

  	    classBody.body.push(method);
  	  }

  	  parsePrivateName() {
  	    const node = super.parsePrivateName();
  	    {
  	      if (!this.getPluginOption("estree", "classFeatures")) {
  	        return node;
  	      }
  	    }
  	    return this.convertPrivateNameToPrivateIdentifier(node);
  	  }

  	  convertPrivateNameToPrivateIdentifier(node) {
  	    const name = super.getPrivateNameSV(node);
  	    node = node;
  	    delete node.id;
  	    node.name = name;
  	    node.type = "PrivateIdentifier";
  	    return node;
  	  }

  	  isPrivateName(node) {
  	    {
  	      if (!this.getPluginOption("estree", "classFeatures")) {
  	        return super.isPrivateName(node);
  	      }
  	    }
  	    return node.type === "PrivateIdentifier";
  	  }

  	  getPrivateNameSV(node) {
  	    {
  	      if (!this.getPluginOption("estree", "classFeatures")) {
  	        return super.getPrivateNameSV(node);
  	      }
  	    }
  	    return node.name;
  	  }

  	  parseLiteral(value, type) {
  	    const node = super.parseLiteral(value, type);
  	    node.raw = node.extra.raw;
  	    delete node.extra;
  	    return node;
  	  }

  	  parseFunctionBody(node, allowExpression, isMethod = false) {
  	    super.parseFunctionBody(node, allowExpression, isMethod);
  	    node.expression = node.body.type !== "BlockStatement";
  	  }

  	  parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
  	    let funcNode = this.startNode();
  	    funcNode.kind = node.kind;
  	    funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
  	    funcNode.type = "FunctionExpression";
  	    delete funcNode.kind;
  	    node.value = funcNode;

  	    if (type === "ClassPrivateMethod") {
  	      node.computed = false;
  	    }

  	    return this.finishNode(node, "MethodDefinition");
  	  }

  	  parseClassProperty(...args) {
  	    const propertyNode = super.parseClassProperty(...args);
  	    {
  	      if (!this.getPluginOption("estree", "classFeatures")) {
  	        return propertyNode;
  	      }
  	    }
  	    propertyNode.type = "PropertyDefinition";
  	    return propertyNode;
  	  }

  	  parseClassPrivateProperty(...args) {
  	    const propertyNode = super.parseClassPrivateProperty(...args);
  	    {
  	      if (!this.getPluginOption("estree", "classFeatures")) {
  	        return propertyNode;
  	      }
  	    }
  	    propertyNode.type = "PropertyDefinition";
  	    propertyNode.computed = false;
  	    return propertyNode;
  	  }

  	  parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
  	    const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor);

  	    if (node) {
  	      node.type = "Property";

  	      if (node.kind === "method") {
  	        node.kind = "init";
  	      }

  	      node.shorthand = false;
  	    }

  	    return node;
  	  }

  	  parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors) {
  	    const node = super.parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors);

  	    if (node) {
  	      node.kind = "init";
  	      node.type = "Property";
  	    }

  	    return node;
  	  }

  	  isValidLVal(type, isUnparenthesizedInAssign, binding) {
  	    return type === "Property" ? "value" : super.isValidLVal(type, isUnparenthesizedInAssign, binding);
  	  }

  	  isAssignable(node, isBinding) {
  	    if (node != null && this.isObjectProperty(node)) {
  	      return this.isAssignable(node.value, isBinding);
  	    }

  	    return super.isAssignable(node, isBinding);
  	  }

  	  toAssignable(node, isLHS = false) {
  	    if (node != null && this.isObjectProperty(node)) {
  	      const {
  	        key,
  	        value
  	      } = node;

  	      if (this.isPrivateName(key)) {
  	        this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
  	      }

  	      this.toAssignable(value, isLHS);
  	    } else {
  	      super.toAssignable(node, isLHS);
  	    }
  	  }

  	  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
  	    if (prop.kind === "get" || prop.kind === "set") {
  	      this.raise(Errors.PatternHasAccessor, {
  	        at: prop.key
  	      });
  	    } else if (prop.method) {
  	      this.raise(Errors.PatternHasMethod, {
  	        at: prop.key
  	      });
  	    } else {
  	      super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
  	    }
  	  }

  	  finishCallExpression(unfinished, optional) {
  	    const node = super.finishCallExpression(unfinished, optional);

  	    if (node.callee.type === "Import") {
  	      node.type = "ImportExpression";
  	      node.source = node.arguments[0];

  	      if (this.hasPlugin("importAssertions")) {
  	        var _node$arguments$;

  	        node.attributes = (_node$arguments$ = node.arguments[1]) != null ? _node$arguments$ : null;
  	      }

  	      delete node.arguments;
  	      delete node.callee;
  	    }

  	    return node;
  	  }

  	  toReferencedArguments(node) {
  	    if (node.type === "ImportExpression") {
  	      return;
  	    }

  	    super.toReferencedArguments(node);
  	  }

  	  parseExport(unfinished) {
  	    const node = super.parseExport(unfinished);

  	    switch (node.type) {
  	      case "ExportAllDeclaration":
  	        node.exported = null;
  	        break;

  	      case "ExportNamedDeclaration":
  	        if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") {
  	          node.type = "ExportAllDeclaration";
  	          node.exported = node.specifiers[0].exported;
  	          delete node.specifiers;
  	        }

  	        break;
  	    }

  	    return node;
  	  }

  	  parseSubscript(base, startPos, startLoc, noCalls, state) {
  	    const node = super.parseSubscript(base, startPos, startLoc, noCalls, state);

  	    if (state.optionalChainMember) {
  	      if (node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression") {
  	        node.type = node.type.substring(8);
  	      }

  	      if (state.stop) {
  	        const chain = this.startNodeAtNode(node);
  	        chain.expression = node;
  	        return this.finishNode(chain, "ChainExpression");
  	      }
  	    } else if (node.type === "MemberExpression" || node.type === "CallExpression") {
  	      node.optional = false;
  	    }

  	    return node;
  	  }

  	  hasPropertyAsPrivateName(node) {
  	    if (node.type === "ChainExpression") {
  	      node = node.expression;
  	    }

  	    return super.hasPropertyAsPrivateName(node);
  	  }

  	  isOptionalChain(node) {
  	    return node.type === "ChainExpression";
  	  }

  	  isObjectProperty(node) {
  	    return node.type === "Property" && node.kind === "init" && !node.method;
  	  }

  	  isObjectMethod(node) {
  	    return node.method || node.kind === "get" || node.kind === "set";
  	  }

  	  finishNodeAt(node, type, endLoc) {
  	    return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
  	  }

  	  resetStartLocation(node, start, startLoc) {
  	    super.resetStartLocation(node, start, startLoc);
  	    toESTreeLocation(node);
  	  }

  	  resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
  	    super.resetEndLocation(node, endLoc);
  	    toESTreeLocation(node);
  	  }

  	});

  	class TokContext {
  	  constructor(token, preserveSpace) {
  	    this.token = void 0;
  	    this.preserveSpace = void 0;
  	    this.token = token;
  	    this.preserveSpace = !!preserveSpace;
  	  }

  	}
  	const types = {
  	  brace: new TokContext("{"),
  	  j_oTag: new TokContext("<tag"),
  	  j_cTag: new TokContext("</tag"),
  	  j_expr: new TokContext("<tag>...</tag>", true)
  	};
  	{
  	  types.template = new TokContext("`", true);
  	}

  	const beforeExpr = true;
  	const startsExpr = true;
  	const isLoop = true;
  	const isAssign = true;
  	const prefix = true;
  	const postfix = true;
  	class ExportedTokenType {
  	  constructor(label, conf = {}) {
  	    this.label = void 0;
  	    this.keyword = void 0;
  	    this.beforeExpr = void 0;
  	    this.startsExpr = void 0;
  	    this.rightAssociative = void 0;
  	    this.isLoop = void 0;
  	    this.isAssign = void 0;
  	    this.prefix = void 0;
  	    this.postfix = void 0;
  	    this.binop = void 0;
  	    this.label = label;
  	    this.keyword = conf.keyword;
  	    this.beforeExpr = !!conf.beforeExpr;
  	    this.startsExpr = !!conf.startsExpr;
  	    this.rightAssociative = !!conf.rightAssociative;
  	    this.isLoop = !!conf.isLoop;
  	    this.isAssign = !!conf.isAssign;
  	    this.prefix = !!conf.prefix;
  	    this.postfix = !!conf.postfix;
  	    this.binop = conf.binop != null ? conf.binop : null;
  	    {
  	      this.updateContext = null;
  	    }
  	  }

  	}
  	const keywords$1 = new Map();

  	function createKeyword(name, options = {}) {
  	  options.keyword = name;
  	  const token = createToken(name, options);
  	  keywords$1.set(name, token);
  	  return token;
  	}

  	function createBinop(name, binop) {
  	  return createToken(name, {
  	    beforeExpr,
  	    binop
  	  });
  	}

  	let tokenTypeCounter = -1;
  	const tokenTypes = [];
  	const tokenLabels = [];
  	const tokenBinops = [];
  	const tokenBeforeExprs = [];
  	const tokenStartsExprs = [];
  	const tokenPrefixes = [];

  	function createToken(name, options = {}) {
  	  var _options$binop, _options$beforeExpr, _options$startsExpr, _options$prefix;

  	  ++tokenTypeCounter;
  	  tokenLabels.push(name);
  	  tokenBinops.push((_options$binop = options.binop) != null ? _options$binop : -1);
  	  tokenBeforeExprs.push((_options$beforeExpr = options.beforeExpr) != null ? _options$beforeExpr : false);
  	  tokenStartsExprs.push((_options$startsExpr = options.startsExpr) != null ? _options$startsExpr : false);
  	  tokenPrefixes.push((_options$prefix = options.prefix) != null ? _options$prefix : false);
  	  tokenTypes.push(new ExportedTokenType(name, options));
  	  return tokenTypeCounter;
  	}

  	function createKeywordLike(name, options = {}) {
  	  var _options$binop2, _options$beforeExpr2, _options$startsExpr2, _options$prefix2;

  	  ++tokenTypeCounter;
  	  keywords$1.set(name, tokenTypeCounter);
  	  tokenLabels.push(name);
  	  tokenBinops.push((_options$binop2 = options.binop) != null ? _options$binop2 : -1);
  	  tokenBeforeExprs.push((_options$beforeExpr2 = options.beforeExpr) != null ? _options$beforeExpr2 : false);
  	  tokenStartsExprs.push((_options$startsExpr2 = options.startsExpr) != null ? _options$startsExpr2 : false);
  	  tokenPrefixes.push((_options$prefix2 = options.prefix) != null ? _options$prefix2 : false);
  	  tokenTypes.push(new ExportedTokenType("name", options));
  	  return tokenTypeCounter;
  	}

  	const tt = {
  	  bracketL: createToken("[", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  bracketHashL: createToken("#[", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  bracketBarL: createToken("[|", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  bracketR: createToken("]"),
  	  bracketBarR: createToken("|]"),
  	  braceL: createToken("{", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  braceBarL: createToken("{|", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  braceHashL: createToken("#{", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  braceR: createToken("}"),
  	  braceBarR: createToken("|}"),
  	  parenL: createToken("(", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  parenR: createToken(")"),
  	  comma: createToken(",", {
  	    beforeExpr
  	  }),
  	  semi: createToken(";", {
  	    beforeExpr
  	  }),
  	  colon: createToken(":", {
  	    beforeExpr
  	  }),
  	  doubleColon: createToken("::", {
  	    beforeExpr
  	  }),
  	  dot: createToken("."),
  	  question: createToken("?", {
  	    beforeExpr
  	  }),
  	  questionDot: createToken("?."),
  	  arrow: createToken("=>", {
  	    beforeExpr
  	  }),
  	  template: createToken("template"),
  	  ellipsis: createToken("...", {
  	    beforeExpr
  	  }),
  	  backQuote: createToken("`", {
  	    startsExpr
  	  }),
  	  dollarBraceL: createToken("${", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  templateTail: createToken("...`", {
  	    startsExpr
  	  }),
  	  templateNonTail: createToken("...${", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  at: createToken("@"),
  	  hash: createToken("#", {
  	    startsExpr
  	  }),
  	  interpreterDirective: createToken("#!..."),
  	  eq: createToken("=", {
  	    beforeExpr,
  	    isAssign
  	  }),
  	  assign: createToken("_=", {
  	    beforeExpr,
  	    isAssign
  	  }),
  	  slashAssign: createToken("_=", {
  	    beforeExpr,
  	    isAssign
  	  }),
  	  xorAssign: createToken("_=", {
  	    beforeExpr,
  	    isAssign
  	  }),
  	  moduloAssign: createToken("_=", {
  	    beforeExpr,
  	    isAssign
  	  }),
  	  incDec: createToken("++/--", {
  	    prefix,
  	    postfix,
  	    startsExpr
  	  }),
  	  bang: createToken("!", {
  	    beforeExpr,
  	    prefix,
  	    startsExpr
  	  }),
  	  tilde: createToken("~", {
  	    beforeExpr,
  	    prefix,
  	    startsExpr
  	  }),
  	  doubleCaret: createToken("^^", {
  	    startsExpr
  	  }),
  	  doubleAt: createToken("@@", {
  	    startsExpr
  	  }),
  	  pipeline: createBinop("|>", 0),
  	  nullishCoalescing: createBinop("??", 1),
  	  logicalOR: createBinop("||", 1),
  	  logicalAND: createBinop("&&", 2),
  	  bitwiseOR: createBinop("|", 3),
  	  bitwiseXOR: createBinop("^", 4),
  	  bitwiseAND: createBinop("&", 5),
  	  equality: createBinop("==/!=/===/!==", 6),
  	  lt: createBinop("</>/<=/>=", 7),
  	  gt: createBinop("</>/<=/>=", 7),
  	  relational: createBinop("</>/<=/>=", 7),
  	  bitShift: createBinop("<</>>/>>>", 8),
  	  bitShiftL: createBinop("<</>>/>>>", 8),
  	  bitShiftR: createBinop("<</>>/>>>", 8),
  	  plusMin: createToken("+/-", {
  	    beforeExpr,
  	    binop: 9,
  	    prefix,
  	    startsExpr
  	  }),
  	  modulo: createToken("%", {
  	    binop: 10,
  	    startsExpr
  	  }),
  	  star: createToken("*", {
  	    binop: 10
  	  }),
  	  slash: createBinop("/", 10),
  	  exponent: createToken("**", {
  	    beforeExpr,
  	    binop: 11,
  	    rightAssociative: true
  	  }),
  	  _in: createKeyword("in", {
  	    beforeExpr,
  	    binop: 7
  	  }),
  	  _instanceof: createKeyword("instanceof", {
  	    beforeExpr,
  	    binop: 7
  	  }),
  	  _break: createKeyword("break"),
  	  _case: createKeyword("case", {
  	    beforeExpr
  	  }),
  	  _catch: createKeyword("catch"),
  	  _continue: createKeyword("continue"),
  	  _debugger: createKeyword("debugger"),
  	  _default: createKeyword("default", {
  	    beforeExpr
  	  }),
  	  _else: createKeyword("else", {
  	    beforeExpr
  	  }),
  	  _finally: createKeyword("finally"),
  	  _function: createKeyword("function", {
  	    startsExpr
  	  }),
  	  _if: createKeyword("if"),
  	  _return: createKeyword("return", {
  	    beforeExpr
  	  }),
  	  _switch: createKeyword("switch"),
  	  _throw: createKeyword("throw", {
  	    beforeExpr,
  	    prefix,
  	    startsExpr
  	  }),
  	  _try: createKeyword("try"),
  	  _var: createKeyword("var"),
  	  _const: createKeyword("const"),
  	  _with: createKeyword("with"),
  	  _new: createKeyword("new", {
  	    beforeExpr,
  	    startsExpr
  	  }),
  	  _this: createKeyword("this", {
  	    startsExpr
  	  }),
  	  _super: createKeyword("super", {
  	    startsExpr
  	  }),
  	  _class: createKeyword("class", {
  	    startsExpr
  	  }),
  	  _extends: createKeyword("extends", {
  	    beforeExpr
  	  }),
  	  _export: createKeyword("export"),
  	  _import: createKeyword("import", {
  	    startsExpr
  	  }),
  	  _null: createKeyword("null", {
  	    startsExpr
  	  }),
  	  _true: createKeyword("true", {
  	    startsExpr
  	  }),
  	  _false: createKeyword("false", {
  	    startsExpr
  	  }),
  	  _typeof: createKeyword("typeof", {
  	    beforeExpr,
  	    prefix,
  	    startsExpr
  	  }),
  	  _void: createKeyword("void", {
  	    beforeExpr,
  	    prefix,
  	    startsExpr
  	  }),
  	  _delete: createKeyword("delete", {
  	    beforeExpr,
  	    prefix,
  	    startsExpr
  	  }),
  	  _do: createKeyword("do", {
  	    isLoop,
  	    beforeExpr
  	  }),
  	  _for: createKeyword("for", {
  	    isLoop
  	  }),
  	  _while: createKeyword("while", {
  	    isLoop
  	  }),
  	  _as: createKeywordLike("as", {
  	    startsExpr
  	  }),
  	  _assert: createKeywordLike("assert", {
  	    startsExpr
  	  }),
  	  _async: createKeywordLike("async", {
  	    startsExpr
  	  }),
  	  _await: createKeywordLike("await", {
  	    startsExpr
  	  }),
  	  _from: createKeywordLike("from", {
  	    startsExpr
  	  }),
  	  _get: createKeywordLike("get", {
  	    startsExpr
  	  }),
  	  _let: createKeywordLike("let", {
  	    startsExpr
  	  }),
  	  _meta: createKeywordLike("meta", {
  	    startsExpr
  	  }),
  	  _of: createKeywordLike("of", {
  	    startsExpr
  	  }),
  	  _sent: createKeywordLike("sent", {
  	    startsExpr
  	  }),
  	  _set: createKeywordLike("set", {
  	    startsExpr
  	  }),
  	  _static: createKeywordLike("static", {
  	    startsExpr
  	  }),
  	  _yield: createKeywordLike("yield", {
  	    startsExpr
  	  }),
  	  _asserts: createKeywordLike("asserts", {
  	    startsExpr
  	  }),
  	  _checks: createKeywordLike("checks", {
  	    startsExpr
  	  }),
  	  _exports: createKeywordLike("exports", {
  	    startsExpr
  	  }),
  	  _global: createKeywordLike("global", {
  	    startsExpr
  	  }),
  	  _implements: createKeywordLike("implements", {
  	    startsExpr
  	  }),
  	  _intrinsic: createKeywordLike("intrinsic", {
  	    startsExpr
  	  }),
  	  _infer: createKeywordLike("infer", {
  	    startsExpr
  	  }),
  	  _is: createKeywordLike("is", {
  	    startsExpr
  	  }),
  	  _mixins: createKeywordLike("mixins", {
  	    startsExpr
  	  }),
  	  _proto: createKeywordLike("proto", {
  	    startsExpr
  	  }),
  	  _require: createKeywordLike("require", {
  	    startsExpr
  	  }),
  	  _keyof: createKeywordLike("keyof", {
  	    startsExpr
  	  }),
  	  _readonly: createKeywordLike("readonly", {
  	    startsExpr
  	  }),
  	  _unique: createKeywordLike("unique", {
  	    startsExpr
  	  }),
  	  _abstract: createKeywordLike("abstract", {
  	    startsExpr
  	  }),
  	  _declare: createKeywordLike("declare", {
  	    startsExpr
  	  }),
  	  _enum: createKeywordLike("enum", {
  	    startsExpr
  	  }),
  	  _module: createKeywordLike("module", {
  	    startsExpr
  	  }),
  	  _namespace: createKeywordLike("namespace", {
  	    startsExpr
  	  }),
  	  _interface: createKeywordLike("interface", {
  	    startsExpr
  	  }),
  	  _type: createKeywordLike("type", {
  	    startsExpr
  	  }),
  	  _opaque: createKeywordLike("opaque", {
  	    startsExpr
  	  }),
  	  name: createToken("name", {
  	    startsExpr
  	  }),
  	  string: createToken("string", {
  	    startsExpr
  	  }),
  	  num: createToken("num", {
  	    startsExpr
  	  }),
  	  bigint: createToken("bigint", {
  	    startsExpr
  	  }),
  	  decimal: createToken("decimal", {
  	    startsExpr
  	  }),
  	  regexp: createToken("regexp", {
  	    startsExpr
  	  }),
  	  privateName: createToken("#name", {
  	    startsExpr
  	  }),
  	  eof: createToken("eof"),
  	  jsxName: createToken("jsxName"),
  	  jsxText: createToken("jsxText", {
  	    beforeExpr: true
  	  }),
  	  jsxTagStart: createToken("jsxTagStart", {
  	    startsExpr: true
  	  }),
  	  jsxTagEnd: createToken("jsxTagEnd"),
  	  placeholder: createToken("%%", {
  	    startsExpr: true
  	  })
  	};
  	function tokenIsIdentifier(token) {
  	  return token >= 93 && token <= 128;
  	}
  	function tokenKeywordOrIdentifierIsKeyword(token) {
  	  return token <= 92;
  	}
  	function tokenIsKeywordOrIdentifier(token) {
  	  return token >= 58 && token <= 128;
  	}
  	function tokenIsLiteralPropertyName(token) {
  	  return token >= 58 && token <= 132;
  	}
  	function tokenComesBeforeExpression(token) {
  	  return tokenBeforeExprs[token];
  	}
  	function tokenCanStartExpression(token) {
  	  return tokenStartsExprs[token];
  	}
  	function tokenIsAssignment(token) {
  	  return token >= 29 && token <= 33;
  	}
  	function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
  	  return token >= 125 && token <= 127;
  	}
  	function tokenIsLoop(token) {
  	  return token >= 90 && token <= 92;
  	}
  	function tokenIsKeyword(token) {
  	  return token >= 58 && token <= 92;
  	}
  	function tokenIsOperator(token) {
  	  return token >= 39 && token <= 59;
  	}
  	function tokenIsPostfix(token) {
  	  return token === 34;
  	}
  	function tokenIsPrefix(token) {
  	  return tokenPrefixes[token];
  	}
  	function tokenIsTSTypeOperator(token) {
  	  return token >= 117 && token <= 119;
  	}
  	function tokenIsTSDeclarationStart(token) {
  	  return token >= 120 && token <= 126;
  	}
  	function tokenLabelName(token) {
  	  return tokenLabels[token];
  	}
  	function tokenOperatorPrecedence(token) {
  	  return tokenBinops[token];
  	}
  	function tokenIsRightAssociative(token) {
  	  return token === 57;
  	}
  	function tokenIsTemplate(token) {
  	  return token >= 24 && token <= 25;
  	}
  	function getExportedToken(token) {
  	  return tokenTypes[token];
  	}
  	{
  	  tokenTypes[8].updateContext = context => {
  	    context.pop();
  	  };

  	  tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = context => {
  	    context.push(types.brace);
  	  };

  	  tokenTypes[22].updateContext = context => {
  	    if (context[context.length - 1] === types.template) {
  	      context.pop();
  	    } else {
  	      context.push(types.template);
  	    }
  	  };

  	  tokenTypes[138].updateContext = context => {
  	    context.push(types.j_expr, types.j_oTag);
  	  };
  	}

  	let 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\u0560-\u0588\u05d0-\u05ea\u05ef-\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\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u09fc\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\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\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\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\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-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\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-\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-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\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-\uab69\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";
  	let 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\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\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\u09fe\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\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\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\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\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-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\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\u1cf4\u1cf7-\u1cf9\u1dc0-\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\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\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";
  	const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  	const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  	nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  	const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 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, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 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, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 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, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 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, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
  	const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 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, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];

  	function isInAstralSet(code, set) {
  	  let pos = 0x10000;

  	  for (let i = 0, length = set.length; i < length; i += 2) {
  	    pos += set[i];
  	    if (pos > code) return false;
  	    pos += set[i + 1];
  	    if (pos >= code) return true;
  	  }

  	  return false;
  	}

  	function isIdentifierStart(code) {
  	  if (code < 65) return code === 36;
  	  if (code <= 90) return true;
  	  if (code < 97) return code === 95;
  	  if (code <= 122) return true;

  	  if (code <= 0xffff) {
  	    return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
  	  }

  	  return isInAstralSet(code, astralIdentifierStartCodes);
  	}
  	function isIdentifierChar(code) {
  	  if (code < 48) return code === 36;
  	  if (code < 58) return true;
  	  if (code < 65) return false;
  	  if (code <= 90) return true;
  	  if (code < 97) return code === 95;
  	  if (code <= 122) return true;

  	  if (code <= 0xffff) {
  	    return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
  	  }

  	  return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
  	}

  	const reservedWords = {
  	  keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
  	  strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
  	  strictBind: ["eval", "arguments"]
  	};
  	const keywords = new Set(reservedWords.keyword);
  	const reservedWordsStrictSet = new Set(reservedWords.strict);
  	const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
  	function isReservedWord(word, inModule) {
  	  return inModule && word === "await" || word === "enum";
  	}
  	function isStrictReservedWord(word, inModule) {
  	  return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
  	}
  	function isStrictBindOnlyReservedWord(word) {
  	  return reservedWordsStrictBindSet.has(word);
  	}
  	function isStrictBindReservedWord(word, inModule) {
  	  return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
  	}
  	function isKeyword(word) {
  	  return keywords.has(word);
  	}

  	function isIteratorStart(current, next, next2) {
  	  return current === 64 && next === 64 && isIdentifierStart(next2);
  	}
  	const reservedWordLikeSet = new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
  	function canBeReservedWord(word) {
  	  return reservedWordLikeSet.has(word);
  	}

  	const SCOPE_OTHER = 0b000000000,
  	      SCOPE_PROGRAM = 0b000000001,
  	      SCOPE_FUNCTION = 0b000000010,
  	      SCOPE_ARROW = 0b000000100,
  	      SCOPE_SIMPLE_CATCH = 0b000001000,
  	      SCOPE_SUPER = 0b000010000,
  	      SCOPE_DIRECT_SUPER = 0b000100000,
  	      SCOPE_CLASS = 0b001000000,
  	      SCOPE_STATIC_BLOCK = 0b010000000,
  	      SCOPE_TS_MODULE = 0b100000000,
  	      SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE;
  	const BIND_KIND_VALUE = 0b000000000001,
  	      BIND_KIND_TYPE = 0b000000000010,
  	      BIND_SCOPE_VAR = 0b000000000100,
  	      BIND_SCOPE_LEXICAL = 0b000000001000,
  	      BIND_SCOPE_FUNCTION = 0b000000010000,
  	      BIND_FLAGS_NONE = 0b000001000000,
  	      BIND_FLAGS_CLASS = 0b000010000000,
  	      BIND_FLAGS_TS_ENUM = 0b000100000000,
  	      BIND_FLAGS_TS_CONST_ENUM = 0b001000000000,
  	      BIND_FLAGS_TS_EXPORT_ONLY = 0b010000000000,
  	      BIND_FLAGS_FLOW_DECLARE_FN = 0b100000000000;
  	const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS,
  	      BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0,
  	      BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0,
  	      BIND_FUNCTION = BIND_KIND_VALUE | 0 | BIND_SCOPE_FUNCTION | 0,
  	      BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS,
  	      BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0,
  	      BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM,
  	      BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
  	      BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE,
  	      BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE,
  	      BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM,
  	      BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
  	      BIND_FLOW_DECLARE_FN = BIND_FLAGS_FLOW_DECLARE_FN;
  	const CLASS_ELEMENT_FLAG_STATIC = 0b100,
  	      CLASS_ELEMENT_KIND_GETTER = 0b010,
  	      CLASS_ELEMENT_KIND_SETTER = 0b001,
  	      CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER;
  	const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC,
  	      CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC,
  	      CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER,
  	      CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER,
  	      CLASS_ELEMENT_OTHER = 0;

  	class BaseParser {
  	  constructor() {
  	    this.sawUnambiguousESM = false;
  	    this.ambiguousScriptDifferentAst = false;
  	  }

  	  hasPlugin(pluginConfig) {
  	    if (typeof pluginConfig === "string") {
  	      return this.plugins.has(pluginConfig);
  	    } else {
  	      const [pluginName, pluginOptions] = pluginConfig;

  	      if (!this.hasPlugin(pluginName)) {
  	        return false;
  	      }

  	      const actualOptions = this.plugins.get(pluginName);

  	      for (const key of Object.keys(pluginOptions)) {
  	        if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) {
  	          return false;
  	        }
  	      }

  	      return true;
  	    }
  	  }

  	  getPluginOption(plugin, name) {
  	    var _this$plugins$get;

  	    return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name];
  	  }

  	}

  	function setTrailingComments(node, comments) {
  	  if (node.trailingComments === undefined) {
  	    node.trailingComments = comments;
  	  } else {
  	    node.trailingComments.unshift(...comments);
  	  }
  	}

  	function setLeadingComments(node, comments) {
  	  if (node.leadingComments === undefined) {
  	    node.leadingComments = comments;
  	  } else {
  	    node.leadingComments.unshift(...comments);
  	  }
  	}

  	function setInnerComments(node, comments) {
  	  if (node.innerComments === undefined) {
  	    node.innerComments = comments;
  	  } else {
  	    node.innerComments.unshift(...comments);
  	  }
  	}

  	function adjustInnerComments(node, elements, commentWS) {
  	  let lastElement = null;
  	  let i = elements.length;

  	  while (lastElement === null && i > 0) {
  	    lastElement = elements[--i];
  	  }

  	  if (lastElement === null || lastElement.start > commentWS.start) {
  	    setInnerComments(node, commentWS.comments);
  	  } else {
  	    setTrailingComments(lastElement, commentWS.comments);
  	  }
  	}

  	class CommentsParser extends BaseParser {
  	  addComment(comment) {
  	    if (this.filename) comment.loc.filename = this.filename;
  	    this.state.comments.push(comment);
  	  }

  	  processComment(node) {
  	    const {
  	      commentStack
  	    } = this.state;
  	    const commentStackLength = commentStack.length;
  	    if (commentStackLength === 0) return;
  	    let i = commentStackLength - 1;
  	    const lastCommentWS = commentStack[i];

  	    if (lastCommentWS.start === node.end) {
  	      lastCommentWS.leadingNode = node;
  	      i--;
  	    }

  	    const {
  	      start: nodeStart
  	    } = node;

  	    for (; i >= 0; i--) {
  	      const commentWS = commentStack[i];
  	      const commentEnd = commentWS.end;

  	      if (commentEnd > nodeStart) {
  	        commentWS.containingNode = node;
  	        this.finalizeComment(commentWS);
  	        commentStack.splice(i, 1);
  	      } else {
  	        if (commentEnd === nodeStart) {
  	          commentWS.trailingNode = node;
  	        }

  	        break;
  	      }
  	    }
  	  }

  	  finalizeComment(commentWS) {
  	    const {
  	      comments
  	    } = commentWS;

  	    if (commentWS.leadingNode !== null || commentWS.trailingNode !== null) {
  	      if (commentWS.leadingNode !== null) {
  	        setTrailingComments(commentWS.leadingNode, comments);
  	      }

  	      if (commentWS.trailingNode !== null) {
  	        setLeadingComments(commentWS.trailingNode, comments);
  	      }
  	    } else {
  	      const {
  	        containingNode: node,
  	        start: commentStart
  	      } = commentWS;

  	      if (this.input.charCodeAt(commentStart - 1) === 44) {
  	        switch (node.type) {
  	          case "ObjectExpression":
  	          case "ObjectPattern":
  	          case "RecordExpression":
  	            adjustInnerComments(node, node.properties, commentWS);
  	            break;

  	          case "CallExpression":
  	          case "OptionalCallExpression":
  	            adjustInnerComments(node, node.arguments, commentWS);
  	            break;

  	          case "FunctionDeclaration":
  	          case "FunctionExpression":
  	          case "ArrowFunctionExpression":
  	          case "ObjectMethod":
  	          case "ClassMethod":
  	          case "ClassPrivateMethod":
  	            adjustInnerComments(node, node.params, commentWS);
  	            break;

  	          case "ArrayExpression":
  	          case "ArrayPattern":
  	          case "TupleExpression":
  	            adjustInnerComments(node, node.elements, commentWS);
  	            break;

  	          case "ExportNamedDeclaration":
  	          case "ImportDeclaration":
  	            adjustInnerComments(node, node.specifiers, commentWS);
  	            break;

  	          default:
  	            {
  	              setInnerComments(node, comments);
  	            }
  	        }
  	      } else {
  	        setInnerComments(node, comments);
  	      }
  	    }
  	  }

  	  finalizeRemainingComments() {
  	    const {
  	      commentStack
  	    } = this.state;

  	    for (let i = commentStack.length - 1; i >= 0; i--) {
  	      this.finalizeComment(commentStack[i]);
  	    }

  	    this.state.commentStack = [];
  	  }

  	  resetPreviousNodeTrailingComments(node) {
  	    const {
  	      commentStack
  	    } = this.state;
  	    const {
  	      length
  	    } = commentStack;
  	    if (length === 0) return;
  	    const commentWS = commentStack[length - 1];

  	    if (commentWS.leadingNode === node) {
  	      commentWS.leadingNode = null;
  	    }
  	  }

  	  takeSurroundingComments(node, start, end) {
  	    const {
  	      commentStack
  	    } = this.state;
  	    const commentStackLength = commentStack.length;
  	    if (commentStackLength === 0) return;
  	    let i = commentStackLength - 1;

  	    for (; i >= 0; i--) {
  	      const commentWS = commentStack[i];
  	      const commentEnd = commentWS.end;
  	      const commentStart = commentWS.start;

  	      if (commentStart === end) {
  	        commentWS.leadingNode = node;
  	      } else if (commentEnd === start) {
  	        commentWS.trailingNode = node;
  	      } else if (commentEnd < start) {
  	        break;
  	      }
  	    }
  	  }

  	}

  	const lineBreak = /\r\n?|[\n\u2028\u2029]/;
  	const lineBreakG = new RegExp(lineBreak.source, "g");
  	function isNewLine(code) {
  	  switch (code) {
  	    case 10:
  	    case 13:
  	    case 8232:
  	    case 8233:
  	      return true;

  	    default:
  	      return false;
  	  }
  	}
  	const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
  	const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/y;
  	const skipWhiteSpaceToLineBreak = new RegExp("(?=(" + skipWhiteSpaceInLine.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y");
  	function isWhitespace(code) {
  	  switch (code) {
  	    case 0x0009:
  	    case 0x000b:
  	    case 0x000c:
  	    case 32:
  	    case 160:
  	    case 5760:
  	    case 0x2000:
  	    case 0x2001:
  	    case 0x2002:
  	    case 0x2003:
  	    case 0x2004:
  	    case 0x2005:
  	    case 0x2006:
  	    case 0x2007:
  	    case 0x2008:
  	    case 0x2009:
  	    case 0x200a:
  	    case 0x202f:
  	    case 0x205f:
  	    case 0x3000:
  	    case 0xfeff:
  	      return true;

  	    default:
  	      return false;
  	  }
  	}

  	class State {
  	  constructor() {
  	    this.strict = void 0;
  	    this.curLine = void 0;
  	    this.lineStart = void 0;
  	    this.startLoc = void 0;
  	    this.endLoc = void 0;
  	    this.errors = [];
  	    this.potentialArrowAt = -1;
  	    this.noArrowAt = [];
  	    this.noArrowParamsConversionAt = [];
  	    this.maybeInArrowParameters = false;
  	    this.inType = false;
  	    this.noAnonFunctionType = false;
  	    this.hasFlowComment = false;
  	    this.isAmbientContext = false;
  	    this.inAbstractClass = false;
  	    this.inDisallowConditionalTypesContext = false;
  	    this.topicContext = {
  	      maxNumOfResolvableTopics: 0,
  	      maxTopicIndex: null
  	    };
  	    this.soloAwait = false;
  	    this.inFSharpPipelineDirectBody = false;
  	    this.labels = [];
  	    this.decoratorStack = [[]];
  	    this.comments = [];
  	    this.commentStack = [];
  	    this.pos = 0;
  	    this.type = 135;
  	    this.value = null;
  	    this.start = 0;
  	    this.end = 0;
  	    this.lastTokEndLoc = null;
  	    this.lastTokStartLoc = null;
  	    this.lastTokStart = 0;
  	    this.context = [types.brace];
  	    this.canStartJSXElement = true;
  	    this.containsEsc = false;
  	    this.strictErrors = new Map();
  	    this.tokensLength = 0;
  	  }

  	  init({
  	    strictMode,
  	    sourceType,
  	    startLine,
  	    startColumn
  	  }) {
  	    this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
  	    this.curLine = startLine;
  	    this.lineStart = -startColumn;
  	    this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
  	  }

  	  curPosition() {
  	    return new Position(this.curLine, this.pos - this.lineStart, this.pos);
  	  }

  	  clone(skipArrays) {
  	    const state = new State();
  	    const keys = Object.keys(this);

  	    for (let i = 0, length = keys.length; i < length; i++) {
  	      const key = keys[i];
  	      let val = this[key];

  	      if (!skipArrays && Array.isArray(val)) {
  	        val = val.slice();
  	      }

  	      state[key] = val;
  	    }

  	    return state;
  	  }

  	}

  	var _isDigit = function isDigit(code) {
  	  return code >= 48 && code <= 57;
  	};

  	const forbiddenNumericSeparatorSiblings = {
  	  decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
  	  hex: new Set([46, 88, 95, 120])
  	};
  	const isAllowedNumericSeparatorSibling = {
  	  bin: ch => ch === 48 || ch === 49,
  	  oct: ch => ch >= 48 && ch <= 55,
  	  dec: ch => ch >= 48 && ch <= 57,
  	  hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
  	};
  	function readStringContents(type, input, pos, lineStart, curLine, errors) {
  	  const initialPos = pos;
  	  const initialLineStart = lineStart;
  	  const initialCurLine = curLine;
  	  let out = "";
  	  let containsInvalid = false;
  	  let chunkStart = pos;
  	  const {
  	    length
  	  } = input;

  	  for (;;) {
  	    if (pos >= length) {
  	      errors.unterminated(initialPos, initialLineStart, initialCurLine);
  	      out += input.slice(chunkStart, pos);
  	      break;
  	    }

  	    const ch = input.charCodeAt(pos);

  	    if (isStringEnd(type, ch, input, pos)) {
  	      out += input.slice(chunkStart, pos);
  	      break;
  	    }

  	    if (ch === 92) {
  	      out += input.slice(chunkStart, pos);
  	      let escaped;
  	      ({
  	        ch: escaped,
  	        pos,
  	        lineStart,
  	        curLine
  	      } = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors));

  	      if (escaped === null) {
  	        containsInvalid = true;
  	      } else {
  	        out += escaped;
  	      }

  	      chunkStart = pos;
  	    } else if (ch === 8232 || ch === 8233) {
  	      ++pos;
  	      ++curLine;
  	      lineStart = pos;
  	    } else if (ch === 10 || ch === 13) {
  	      if (type === "template") {
  	        out += input.slice(chunkStart, pos) + "\n";
  	        ++pos;

  	        if (ch === 13 && input.charCodeAt(pos) === 10) {
  	          ++pos;
  	        }

  	        ++curLine;
  	        chunkStart = lineStart = pos;
  	      } else {
  	        errors.unterminated(initialPos, initialLineStart, initialCurLine);
  	      }
  	    } else {
  	      ++pos;
  	    }
  	  }

  	  return {
  	    pos,
  	    str: out,
  	    containsInvalid,
  	    lineStart,
  	    curLine
  	  };
  	}

  	function isStringEnd(type, ch, input, pos) {
  	  if (type === "template") {
  	    return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
  	  }

  	  return ch === (type === "double" ? 34 : 39);
  	}

  	function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
  	  const throwOnInvalid = !inTemplate;
  	  pos++;

  	  const res = ch => ({
  	    pos,
  	    ch,
  	    lineStart,
  	    curLine
  	  });

  	  const ch = input.charCodeAt(pos++);

  	  switch (ch) {
  	    case 110:
  	      return res("\n");

  	    case 114:
  	      return res("\r");

  	    case 120:
  	      {
  	        let code;
  	        ({
  	          code,
  	          pos
  	        } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
  	        return res(code === null ? null : String.fromCharCode(code));
  	      }

  	    case 117:
  	      {
  	        let code;
  	        ({
  	          code,
  	          pos
  	        } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
  	        return res(code === null ? null : String.fromCodePoint(code));
  	      }

  	    case 116:
  	      return res("\t");

  	    case 98:
  	      return res("\b");

  	    case 118:
  	      return res("\u000b");

  	    case 102:
  	      return res("\f");

  	    case 13:
  	      if (input.charCodeAt(pos) === 10) {
  	        ++pos;
  	      }

  	    case 10:
  	      lineStart = pos;
  	      ++curLine;

  	    case 8232:
  	    case 8233:
  	      return res("");

  	    case 56:
  	    case 57:
  	      if (inTemplate) {
  	        return res(null);
  	      } else {
  	        errors.strictNumericEscape(pos - 1, lineStart, curLine);
  	      }

  	    default:
  	      if (ch >= 48 && ch <= 55) {
  	        const startPos = pos - 1;
  	        const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
  	        let octalStr = match[0];
  	        let octal = parseInt(octalStr, 8);

  	        if (octal > 255) {
  	          octalStr = octalStr.slice(0, -1);
  	          octal = parseInt(octalStr, 8);
  	        }

  	        pos += octalStr.length - 1;
  	        const next = input.charCodeAt(pos);

  	        if (octalStr !== "0" || next === 56 || next === 57) {
  	          if (inTemplate) {
  	            return res(null);
  	          } else {
  	            errors.strictNumericEscape(startPos, lineStart, curLine);
  	          }
  	        }

  	        return res(String.fromCharCode(octal));
  	      }

  	      return res(String.fromCharCode(ch));
  	  }
  	}

  	function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
  	  const initialPos = pos;
  	  let n;
  	  ({
  	    n,
  	    pos
  	  } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors));

  	  if (n === null) {
  	    if (throwOnInvalid) {
  	      errors.invalidEscapeSequence(initialPos, lineStart, curLine);
  	    } else {
  	      pos = initialPos - 1;
  	    }
  	  }

  	  return {
  	    code: n,
  	    pos
  	  };
  	}

  	function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors) {
  	  const start = pos;
  	  const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
  	  const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
  	  let invalid = false;
  	  let total = 0;

  	  for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
  	    const code = input.charCodeAt(pos);
  	    let val;

  	    if (code === 95 && allowNumSeparator !== "bail") {
  	      const prev = input.charCodeAt(pos - 1);
  	      const next = input.charCodeAt(pos + 1);

  	      if (!allowNumSeparator) {
  	        errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
  	      } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
  	        errors.unexpectedNumericSeparator(pos, lineStart, curLine);
  	      }

  	      ++pos;
  	      continue;
  	    }

  	    if (code >= 97) {
  	      val = code - 97 + 10;
  	    } else if (code >= 65) {
  	      val = code - 65 + 10;
  	    } else if (_isDigit(code)) {
  	      val = code - 48;
  	    } else {
  	      val = Infinity;
  	    }

  	    if (val >= radix) {
  	      if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
  	        val = 0;
  	      } else if (forceLen) {
  	        val = 0;
  	        invalid = true;
  	      } else {
  	        break;
  	      }
  	    }

  	    ++pos;
  	    total = total * radix + val;
  	  }

  	  if (pos === start || len != null && pos - start !== len || invalid) {
  	    return {
  	      n: null,
  	      pos
  	    };
  	  }

  	  return {
  	    n: total,
  	    pos
  	  };
  	}
  	function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
  	  const ch = input.charCodeAt(pos);
  	  let code;

  	  if (ch === 123) {
  	    ++pos;
  	    ({
  	      code,
  	      pos
  	    } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
  	    ++pos;

  	    if (code !== null && code > 0x10ffff) {
  	      if (throwOnInvalid) {
  	        errors.invalidCodePoint(pos, lineStart, curLine);
  	      } else {
  	        return {
  	          code: null,
  	          pos
  	        };
  	      }
  	    }
  	  } else {
  	    ({
  	      code,
  	      pos
  	    } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
  	  }

  	  return {
  	    code,
  	    pos
  	  };
  	}

  	const _excluded = ["at"],
  	      _excluded2 = ["at"];

  	function buildPosition(pos, lineStart, curLine) {
  	  return new Position(curLine, pos - lineStart, pos);
  	}

  	const VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
  	class Token {
  	  constructor(state) {
  	    this.type = state.type;
  	    this.value = state.value;
  	    this.start = state.start;
  	    this.end = state.end;
  	    this.loc = new SourceLocation(state.startLoc, state.endLoc);
  	  }

  	}
  	class Tokenizer extends CommentsParser {
  	  constructor(options, input) {
  	    super();
  	    this.isLookahead = void 0;
  	    this.tokens = [];
  	    this.errorHandlers_readInt = {
  	      invalidDigit: (pos, lineStart, curLine, radix) => {
  	        if (!this.options.errorRecovery) return false;
  	        this.raise(Errors.InvalidDigit, {
  	          at: buildPosition(pos, lineStart, curLine),
  	          radix
  	        });
  	        return true;
  	      },
  	      numericSeparatorInEscapeSequence: this.errorBuilder(Errors.NumericSeparatorInEscapeSequence),
  	      unexpectedNumericSeparator: this.errorBuilder(Errors.UnexpectedNumericSeparator)
  	    };
  	    this.errorHandlers_readCodePoint = Object.assign({}, this.errorHandlers_readInt, {
  	      invalidEscapeSequence: this.errorBuilder(Errors.InvalidEscapeSequence),
  	      invalidCodePoint: this.errorBuilder(Errors.InvalidCodePoint)
  	    });
  	    this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
  	      strictNumericEscape: (pos, lineStart, curLine) => {
  	        this.recordStrictModeErrors(Errors.StrictNumericEscape, {
  	          at: buildPosition(pos, lineStart, curLine)
  	        });
  	      },
  	      unterminated: (pos, lineStart, curLine) => {
  	        throw this.raise(Errors.UnterminatedString, {
  	          at: buildPosition(pos - 1, lineStart, curLine)
  	        });
  	      }
  	    });
  	    this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
  	      strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
  	      unterminated: (pos, lineStart, curLine) => {
  	        throw this.raise(Errors.UnterminatedTemplate, {
  	          at: buildPosition(pos, lineStart, curLine)
  	        });
  	      }
  	    });
  	    this.state = new State();
  	    this.state.init(options);
  	    this.input = input;
  	    this.length = input.length;
  	    this.isLookahead = false;
  	  }

  	  pushToken(token) {
  	    this.tokens.length = this.state.tokensLength;
  	    this.tokens.push(token);
  	    ++this.state.tokensLength;
  	  }

  	  next() {
  	    this.checkKeywordEscapes();

  	    if (this.options.tokens) {
  	      this.pushToken(new Token(this.state));
  	    }

  	    this.state.lastTokStart = this.state.start;
  	    this.state.lastTokEndLoc = this.state.endLoc;
  	    this.state.lastTokStartLoc = this.state.startLoc;
  	    this.nextToken();
  	  }

  	  eat(type) {
  	    if (this.match(type)) {
  	      this.next();
  	      return true;
  	    } else {
  	      return false;
  	    }
  	  }

  	  match(type) {
  	    return this.state.type === type;
  	  }

  	  createLookaheadState(state) {
  	    return {
  	      pos: state.pos,
  	      value: null,
  	      type: state.type,
  	      start: state.start,
  	      end: state.end,
  	      context: [this.curContext()],
  	      inType: state.inType,
  	      startLoc: state.startLoc,
  	      lastTokEndLoc: state.lastTokEndLoc,
  	      curLine: state.curLine,
  	      lineStart: state.lineStart,
  	      curPosition: state.curPosition
  	    };
  	  }

  	  lookahead() {
  	    const old = this.state;
  	    this.state = this.createLookaheadState(old);
  	    this.isLookahead = true;
  	    this.nextToken();
  	    this.isLookahead = false;
  	    const curr = this.state;
  	    this.state = old;
  	    return curr;
  	  }

  	  nextTokenStart() {
  	    return this.nextTokenStartSince(this.state.pos);
  	  }

  	  nextTokenStartSince(pos) {
  	    skipWhiteSpace.lastIndex = pos;
  	    return skipWhiteSpace.test(this.input) ? skipWhiteSpace.lastIndex : pos;
  	  }

  	  lookaheadCharCode() {
  	    return this.input.charCodeAt(this.nextTokenStart());
  	  }

  	  codePointAtPos(pos) {
  	    let cp = this.input.charCodeAt(pos);

  	    if ((cp & 0xfc00) === 0xd800 && ++pos < this.input.length) {
  	      const trail = this.input.charCodeAt(pos);

  	      if ((trail & 0xfc00) === 0xdc00) {
  	        cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
  	      }
  	    }

  	    return cp;
  	  }

  	  setStrict(strict) {
  	    this.state.strict = strict;

  	    if (strict) {
  	      this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, {
  	        at
  	      }));
  	      this.state.strictErrors.clear();
  	    }
  	  }

  	  curContext() {
  	    return this.state.context[this.state.context.length - 1];
  	  }

  	  nextToken() {
  	    this.skipSpace();
  	    this.state.start = this.state.pos;
  	    if (!this.isLookahead) this.state.startLoc = this.state.curPosition();

  	    if (this.state.pos >= this.length) {
  	      this.finishToken(135);
  	      return;
  	    }

  	    this.getTokenFromCode(this.codePointAtPos(this.state.pos));
  	  }

  	  skipBlockComment() {
  	    let startLoc;
  	    if (!this.isLookahead) startLoc = this.state.curPosition();
  	    const start = this.state.pos;
  	    const end = this.input.indexOf("*/", start + 2);

  	    if (end === -1) {
  	      throw this.raise(Errors.UnterminatedComment, {
  	        at: this.state.curPosition()
  	      });
  	    }

  	    this.state.pos = end + 2;
  	    lineBreakG.lastIndex = start + 2;

  	    while (lineBreakG.test(this.input) && lineBreakG.lastIndex <= end) {
  	      ++this.state.curLine;
  	      this.state.lineStart = lineBreakG.lastIndex;
  	    }

  	    if (this.isLookahead) return;
  	    const comment = {
  	      type: "CommentBlock",
  	      value: this.input.slice(start + 2, end),
  	      start,
  	      end: end + 2,
  	      loc: new SourceLocation(startLoc, this.state.curPosition())
  	    };
  	    if (this.options.tokens) this.pushToken(comment);
  	    return comment;
  	  }

  	  skipLineComment(startSkip) {
  	    const start = this.state.pos;
  	    let startLoc;
  	    if (!this.isLookahead) startLoc = this.state.curPosition();
  	    let ch = this.input.charCodeAt(this.state.pos += startSkip);

  	    if (this.state.pos < this.length) {
  	      while (!isNewLine(ch) && ++this.state.pos < this.length) {
  	        ch = this.input.charCodeAt(this.state.pos);
  	      }
  	    }

  	    if (this.isLookahead) return;
  	    const end = this.state.pos;
  	    const value = this.input.slice(start + startSkip, end);
  	    const comment = {
  	      type: "CommentLine",
  	      value,
  	      start,
  	      end,
  	      loc: new SourceLocation(startLoc, this.state.curPosition())
  	    };
  	    if (this.options.tokens) this.pushToken(comment);
  	    return comment;
  	  }

  	  skipSpace() {
  	    const spaceStart = this.state.pos;
  	    const comments = [];

  	    loop: while (this.state.pos < this.length) {
  	      const ch = this.input.charCodeAt(this.state.pos);

  	      switch (ch) {
  	        case 32:
  	        case 160:
  	        case 9:
  	          ++this.state.pos;
  	          break;

  	        case 13:
  	          if (this.input.charCodeAt(this.state.pos + 1) === 10) {
  	            ++this.state.pos;
  	          }

  	        case 10:
  	        case 8232:
  	        case 8233:
  	          ++this.state.pos;
  	          ++this.state.curLine;
  	          this.state.lineStart = this.state.pos;
  	          break;

  	        case 47:
  	          switch (this.input.charCodeAt(this.state.pos + 1)) {
  	            case 42:
  	              {
  	                const comment = this.skipBlockComment();

  	                if (comment !== undefined) {
  	                  this.addComment(comment);
  	                  if (this.options.attachComment) comments.push(comment);
  	                }

  	                break;
  	              }

  	            case 47:
  	              {
  	                const comment = this.skipLineComment(2);

  	                if (comment !== undefined) {
  	                  this.addComment(comment);
  	                  if (this.options.attachComment) comments.push(comment);
  	                }

  	                break;
  	              }

  	            default:
  	              break loop;
  	          }

  	          break;

  	        default:
  	          if (isWhitespace(ch)) {
  	            ++this.state.pos;
  	          } else if (ch === 45 && !this.inModule) {
  	            const pos = this.state.pos;

  	            if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) {
  	              const comment = this.skipLineComment(3);

  	              if (comment !== undefined) {
  	                this.addComment(comment);
  	                if (this.options.attachComment) comments.push(comment);
  	              }
  	            } else {
  	              break loop;
  	            }
  	          } else if (ch === 60 && !this.inModule) {
  	            const pos = this.state.pos;

  	            if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) {
  	              const comment = this.skipLineComment(4);

  	              if (comment !== undefined) {
  	                this.addComment(comment);
  	                if (this.options.attachComment) comments.push(comment);
  	              }
  	            } else {
  	              break loop;
  	            }
  	          } else {
  	            break loop;
  	          }

  	      }
  	    }

  	    if (comments.length > 0) {
  	      const end = this.state.pos;
  	      const commentWhitespace = {
  	        start: spaceStart,
  	        end,
  	        comments,
  	        leadingNode: null,
  	        trailingNode: null,
  	        containingNode: null
  	      };
  	      this.state.commentStack.push(commentWhitespace);
  	    }
  	  }

  	  finishToken(type, val) {
  	    this.state.end = this.state.pos;
  	    this.state.endLoc = this.state.curPosition();
  	    const prevType = this.state.type;
  	    this.state.type = type;
  	    this.state.value = val;

  	    if (!this.isLookahead) {
  	      this.updateContext(prevType);
  	    }
  	  }

  	  replaceToken(type) {
  	    this.state.type = type;
  	    this.updateContext();
  	  }

  	  readToken_numberSign() {
  	    if (this.state.pos === 0 && this.readToken_interpreter()) {
  	      return;
  	    }

  	    const nextPos = this.state.pos + 1;
  	    const next = this.codePointAtPos(nextPos);

  	    if (next >= 48 && next <= 57) {
  	      throw this.raise(Errors.UnexpectedDigitAfterHash, {
  	        at: this.state.curPosition()
  	      });
  	    }

  	    if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
  	      this.expectPlugin("recordAndTuple");

  	      if (this.getPluginOption("recordAndTuple", "syntaxType") !== "hash") {
  	        throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, {
  	          at: this.state.curPosition()
  	        });
  	      }

  	      this.state.pos += 2;

  	      if (next === 123) {
  	        this.finishToken(7);
  	      } else {
  	        this.finishToken(1);
  	      }
  	    } else if (isIdentifierStart(next)) {
  	      ++this.state.pos;
  	      this.finishToken(134, this.readWord1(next));
  	    } else if (next === 92) {
  	      ++this.state.pos;
  	      this.finishToken(134, this.readWord1());
  	    } else {
  	      this.finishOp(27, 1);
  	    }
  	  }

  	  readToken_dot() {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (next >= 48 && next <= 57) {
  	      this.readNumber(true);
  	      return;
  	    }

  	    if (next === 46 && this.input.charCodeAt(this.state.pos + 2) === 46) {
  	      this.state.pos += 3;
  	      this.finishToken(21);
  	    } else {
  	      ++this.state.pos;
  	      this.finishToken(16);
  	    }
  	  }

  	  readToken_slash() {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (next === 61) {
  	      this.finishOp(31, 2);
  	    } else {
  	      this.finishOp(56, 1);
  	    }
  	  }

  	  readToken_interpreter() {
  	    if (this.state.pos !== 0 || this.length < 2) return false;
  	    let ch = this.input.charCodeAt(this.state.pos + 1);
  	    if (ch !== 33) return false;
  	    const start = this.state.pos;
  	    this.state.pos += 1;

  	    while (!isNewLine(ch) && ++this.state.pos < this.length) {
  	      ch = this.input.charCodeAt(this.state.pos);
  	    }

  	    const value = this.input.slice(start + 2, this.state.pos);
  	    this.finishToken(28, value);
  	    return true;
  	  }

  	  readToken_mult_modulo(code) {
  	    let type = code === 42 ? 55 : 54;
  	    let width = 1;
  	    let next = this.input.charCodeAt(this.state.pos + 1);

  	    if (code === 42 && next === 42) {
  	      width++;
  	      next = this.input.charCodeAt(this.state.pos + 2);
  	      type = 57;
  	    }

  	    if (next === 61 && !this.state.inType) {
  	      width++;
  	      type = code === 37 ? 33 : 30;
  	    }

  	    this.finishOp(type, width);
  	  }

  	  readToken_pipe_amp(code) {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (next === code) {
  	      if (this.input.charCodeAt(this.state.pos + 2) === 61) {
  	        this.finishOp(30, 3);
  	      } else {
  	        this.finishOp(code === 124 ? 41 : 42, 2);
  	      }

  	      return;
  	    }

  	    if (code === 124) {
  	      if (next === 62) {
  	        this.finishOp(39, 2);
  	        return;
  	      }

  	      if (this.hasPlugin("recordAndTuple") && next === 125) {
  	        if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
  	          throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, {
  	            at: this.state.curPosition()
  	          });
  	        }

  	        this.state.pos += 2;
  	        this.finishToken(9);
  	        return;
  	      }

  	      if (this.hasPlugin("recordAndTuple") && next === 93) {
  	        if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
  	          throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, {
  	            at: this.state.curPosition()
  	          });
  	        }

  	        this.state.pos += 2;
  	        this.finishToken(4);
  	        return;
  	      }
  	    }

  	    if (next === 61) {
  	      this.finishOp(30, 2);
  	      return;
  	    }

  	    this.finishOp(code === 124 ? 43 : 45, 1);
  	  }

  	  readToken_caret() {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (next === 61 && !this.state.inType) {
  	      this.finishOp(32, 2);
  	    } else if (next === 94 && this.hasPlugin(["pipelineOperator", {
  	      proposal: "hack",
  	      topicToken: "^^"
  	    }])) {
  	      this.finishOp(37, 2);
  	      const lookaheadCh = this.input.codePointAt(this.state.pos);

  	      if (lookaheadCh === 94) {
  	        throw this.unexpected();
  	      }
  	    } else {
  	      this.finishOp(44, 1);
  	    }
  	  }

  	  readToken_atSign() {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (next === 64 && this.hasPlugin(["pipelineOperator", {
  	      proposal: "hack",
  	      topicToken: "@@"
  	    }])) {
  	      this.finishOp(38, 2);
  	    } else {
  	      this.finishOp(26, 1);
  	    }
  	  }

  	  readToken_plus_min(code) {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (next === code) {
  	      this.finishOp(34, 2);
  	      return;
  	    }

  	    if (next === 61) {
  	      this.finishOp(30, 2);
  	    } else {
  	      this.finishOp(53, 1);
  	    }
  	  }

  	  readToken_lt() {
  	    const {
  	      pos
  	    } = this.state;
  	    const next = this.input.charCodeAt(pos + 1);

  	    if (next === 60) {
  	      if (this.input.charCodeAt(pos + 2) === 61) {
  	        this.finishOp(30, 3);
  	        return;
  	      }

  	      this.finishOp(51, 2);
  	      return;
  	    }

  	    if (next === 61) {
  	      this.finishOp(49, 2);
  	      return;
  	    }

  	    this.finishOp(47, 1);
  	  }

  	  readToken_gt() {
  	    const {
  	      pos
  	    } = this.state;
  	    const next = this.input.charCodeAt(pos + 1);

  	    if (next === 62) {
  	      const size = this.input.charCodeAt(pos + 2) === 62 ? 3 : 2;

  	      if (this.input.charCodeAt(pos + size) === 61) {
  	        this.finishOp(30, size + 1);
  	        return;
  	      }

  	      this.finishOp(52, size);
  	      return;
  	    }

  	    if (next === 61) {
  	      this.finishOp(49, 2);
  	      return;
  	    }

  	    this.finishOp(48, 1);
  	  }

  	  readToken_eq_excl(code) {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (next === 61) {
  	      this.finishOp(46, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
  	      return;
  	    }

  	    if (code === 61 && next === 62) {
  	      this.state.pos += 2;
  	      this.finishToken(19);
  	      return;
  	    }

  	    this.finishOp(code === 61 ? 29 : 35, 1);
  	  }

  	  readToken_question() {
  	    const next = this.input.charCodeAt(this.state.pos + 1);
  	    const next2 = this.input.charCodeAt(this.state.pos + 2);

  	    if (next === 63) {
  	      if (next2 === 61) {
  	        this.finishOp(30, 3);
  	      } else {
  	        this.finishOp(40, 2);
  	      }
  	    } else if (next === 46 && !(next2 >= 48 && next2 <= 57)) {
  	      this.state.pos += 2;
  	      this.finishToken(18);
  	    } else {
  	      ++this.state.pos;
  	      this.finishToken(17);
  	    }
  	  }

  	  getTokenFromCode(code) {
  	    switch (code) {
  	      case 46:
  	        this.readToken_dot();
  	        return;

  	      case 40:
  	        ++this.state.pos;
  	        this.finishToken(10);
  	        return;

  	      case 41:
  	        ++this.state.pos;
  	        this.finishToken(11);
  	        return;

  	      case 59:
  	        ++this.state.pos;
  	        this.finishToken(13);
  	        return;

  	      case 44:
  	        ++this.state.pos;
  	        this.finishToken(12);
  	        return;

  	      case 91:
  	        if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
  	          if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
  	            throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, {
  	              at: this.state.curPosition()
  	            });
  	          }

  	          this.state.pos += 2;
  	          this.finishToken(2);
  	        } else {
  	          ++this.state.pos;
  	          this.finishToken(0);
  	        }

  	        return;

  	      case 93:
  	        ++this.state.pos;
  	        this.finishToken(3);
  	        return;

  	      case 123:
  	        if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
  	          if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
  	            throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, {
  	              at: this.state.curPosition()
  	            });
  	          }

  	          this.state.pos += 2;
  	          this.finishToken(6);
  	        } else {
  	          ++this.state.pos;
  	          this.finishToken(5);
  	        }

  	        return;

  	      case 125:
  	        ++this.state.pos;
  	        this.finishToken(8);
  	        return;

  	      case 58:
  	        if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
  	          this.finishOp(15, 2);
  	        } else {
  	          ++this.state.pos;
  	          this.finishToken(14);
  	        }

  	        return;

  	      case 63:
  	        this.readToken_question();
  	        return;

  	      case 96:
  	        this.readTemplateToken();
  	        return;

  	      case 48:
  	        {
  	          const next = this.input.charCodeAt(this.state.pos + 1);

  	          if (next === 120 || next === 88) {
  	            this.readRadixNumber(16);
  	            return;
  	          }

  	          if (next === 111 || next === 79) {
  	            this.readRadixNumber(8);
  	            return;
  	          }

  	          if (next === 98 || next === 66) {
  	            this.readRadixNumber(2);
  	            return;
  	          }
  	        }

  	      case 49:
  	      case 50:
  	      case 51:
  	      case 52:
  	      case 53:
  	      case 54:
  	      case 55:
  	      case 56:
  	      case 57:
  	        this.readNumber(false);
  	        return;

  	      case 34:
  	      case 39:
  	        this.readString(code);
  	        return;

  	      case 47:
  	        this.readToken_slash();
  	        return;

  	      case 37:
  	      case 42:
  	        this.readToken_mult_modulo(code);
  	        return;

  	      case 124:
  	      case 38:
  	        this.readToken_pipe_amp(code);
  	        return;

  	      case 94:
  	        this.readToken_caret();
  	        return;

  	      case 43:
  	      case 45:
  	        this.readToken_plus_min(code);
  	        return;

  	      case 60:
  	        this.readToken_lt();
  	        return;

  	      case 62:
  	        this.readToken_gt();
  	        return;

  	      case 61:
  	      case 33:
  	        this.readToken_eq_excl(code);
  	        return;

  	      case 126:
  	        this.finishOp(36, 1);
  	        return;

  	      case 64:
  	        this.readToken_atSign();
  	        return;

  	      case 35:
  	        this.readToken_numberSign();
  	        return;

  	      case 92:
  	        this.readWord();
  	        return;

  	      default:
  	        if (isIdentifierStart(code)) {
  	          this.readWord(code);
  	          return;
  	        }

  	    }

  	    throw this.raise(Errors.InvalidOrUnexpectedToken, {
  	      at: this.state.curPosition(),
  	      unexpected: String.fromCodePoint(code)
  	    });
  	  }

  	  finishOp(type, size) {
  	    const str = this.input.slice(this.state.pos, this.state.pos + size);
  	    this.state.pos += size;
  	    this.finishToken(type, str);
  	  }

  	  readRegexp() {
  	    const startLoc = this.state.startLoc;
  	    const start = this.state.start + 1;
  	    let escaped, inClass;
  	    let {
  	      pos
  	    } = this.state;

  	    for (;; ++pos) {
  	      if (pos >= this.length) {
  	        throw this.raise(Errors.UnterminatedRegExp, {
  	          at: createPositionWithColumnOffset(startLoc, 1)
  	        });
  	      }

  	      const ch = this.input.charCodeAt(pos);

  	      if (isNewLine(ch)) {
  	        throw this.raise(Errors.UnterminatedRegExp, {
  	          at: createPositionWithColumnOffset(startLoc, 1)
  	        });
  	      }

  	      if (escaped) {
  	        escaped = false;
  	      } else {
  	        if (ch === 91) {
  	          inClass = true;
  	        } else if (ch === 93 && inClass) {
  	          inClass = false;
  	        } else if (ch === 47 && !inClass) {
  	          break;
  	        }

  	        escaped = ch === 92;
  	      }
  	    }

  	    const content = this.input.slice(start, pos);
  	    ++pos;
  	    let mods = "";

  	    const nextPos = () => createPositionWithColumnOffset(startLoc, pos + 2 - start);

  	    while (pos < this.length) {
  	      const cp = this.codePointAtPos(pos);
  	      const char = String.fromCharCode(cp);

  	      if (VALID_REGEX_FLAGS.has(cp)) {
  	        if (cp === 118) {
  	          this.expectPlugin("regexpUnicodeSets", nextPos());

  	          if (mods.includes("u")) {
  	            this.raise(Errors.IncompatibleRegExpUVFlags, {
  	              at: nextPos()
  	            });
  	          }
  	        } else if (cp === 117) {
  	          if (mods.includes("v")) {
  	            this.raise(Errors.IncompatibleRegExpUVFlags, {
  	              at: nextPos()
  	            });
  	          }
  	        }

  	        if (mods.includes(char)) {
  	          this.raise(Errors.DuplicateRegExpFlags, {
  	            at: nextPos()
  	          });
  	        }
  	      } else if (isIdentifierChar(cp) || cp === 92) {
  	        this.raise(Errors.MalformedRegExpFlags, {
  	          at: nextPos()
  	        });
  	      } else {
  	        break;
  	      }

  	      ++pos;
  	      mods += char;
  	    }

  	    this.state.pos = pos;
  	    this.finishToken(133, {
  	      pattern: content,
  	      flags: mods
  	    });
  	  }

  	  readInt(radix, len, forceLen = false, allowNumSeparator = true) {
  	    const {
  	      n,
  	      pos
  	    } = readInt(this.input, this.state.pos, this.state.lineStart, this.state.curLine, radix, len, forceLen, allowNumSeparator, this.errorHandlers_readInt);
  	    this.state.pos = pos;
  	    return n;
  	  }

  	  readRadixNumber(radix) {
  	    const startLoc = this.state.curPosition();
  	    let isBigInt = false;
  	    this.state.pos += 2;
  	    const val = this.readInt(radix);

  	    if (val == null) {
  	      this.raise(Errors.InvalidDigit, {
  	        at: createPositionWithColumnOffset(startLoc, 2),
  	        radix
  	      });
  	    }

  	    const next = this.input.charCodeAt(this.state.pos);

  	    if (next === 110) {
  	      ++this.state.pos;
  	      isBigInt = true;
  	    } else if (next === 109) {
  	      throw this.raise(Errors.InvalidDecimal, {
  	        at: startLoc
  	      });
  	    }

  	    if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
  	      throw this.raise(Errors.NumberIdentifier, {
  	        at: this.state.curPosition()
  	      });
  	    }

  	    if (isBigInt) {
  	      const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
  	      this.finishToken(131, str);
  	      return;
  	    }

  	    this.finishToken(130, val);
  	  }

  	  readNumber(startsWithDot) {
  	    const start = this.state.pos;
  	    const startLoc = this.state.curPosition();
  	    let isFloat = false;
  	    let isBigInt = false;
  	    let isDecimal = false;
  	    let hasExponent = false;
  	    let isOctal = false;

  	    if (!startsWithDot && this.readInt(10) === null) {
  	      this.raise(Errors.InvalidNumber, {
  	        at: this.state.curPosition()
  	      });
  	    }

  	    const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;

  	    if (hasLeadingZero) {
  	      const integer = this.input.slice(start, this.state.pos);
  	      this.recordStrictModeErrors(Errors.StrictOctalLiteral, {
  	        at: startLoc
  	      });

  	      if (!this.state.strict) {
  	        const underscorePos = integer.indexOf("_");

  	        if (underscorePos > 0) {
  	          this.raise(Errors.ZeroDigitNumericSeparator, {
  	            at: createPositionWithColumnOffset(startLoc, underscorePos)
  	          });
  	        }
  	      }

  	      isOctal = hasLeadingZero && !/[89]/.test(integer);
  	    }

  	    let next = this.input.charCodeAt(this.state.pos);

  	    if (next === 46 && !isOctal) {
  	      ++this.state.pos;
  	      this.readInt(10);
  	      isFloat = true;
  	      next = this.input.charCodeAt(this.state.pos);
  	    }

  	    if ((next === 69 || next === 101) && !isOctal) {
  	      next = this.input.charCodeAt(++this.state.pos);

  	      if (next === 43 || next === 45) {
  	        ++this.state.pos;
  	      }

  	      if (this.readInt(10) === null) {
  	        this.raise(Errors.InvalidOrMissingExponent, {
  	          at: startLoc
  	        });
  	      }

  	      isFloat = true;
  	      hasExponent = true;
  	      next = this.input.charCodeAt(this.state.pos);
  	    }

  	    if (next === 110) {
  	      if (isFloat || hasLeadingZero) {
  	        this.raise(Errors.InvalidBigIntLiteral, {
  	          at: startLoc
  	        });
  	      }

  	      ++this.state.pos;
  	      isBigInt = true;
  	    }

  	    if (next === 109) {
  	      this.expectPlugin("decimal", this.state.curPosition());

  	      if (hasExponent || hasLeadingZero) {
  	        this.raise(Errors.InvalidDecimal, {
  	          at: startLoc
  	        });
  	      }

  	      ++this.state.pos;
  	      isDecimal = true;
  	    }

  	    if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
  	      throw this.raise(Errors.NumberIdentifier, {
  	        at: this.state.curPosition()
  	      });
  	    }

  	    const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");

  	    if (isBigInt) {
  	      this.finishToken(131, str);
  	      return;
  	    }

  	    if (isDecimal) {
  	      this.finishToken(132, str);
  	      return;
  	    }

  	    const val = isOctal ? parseInt(str, 8) : parseFloat(str);
  	    this.finishToken(130, val);
  	  }

  	  readCodePoint(throwOnInvalid) {
  	    const {
  	      code,
  	      pos
  	    } = readCodePoint(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
  	    this.state.pos = pos;
  	    return code;
  	  }

  	  readString(quote) {
  	    const {
  	      str,
  	      pos,
  	      curLine,
  	      lineStart
  	    } = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
  	    this.state.pos = pos + 1;
  	    this.state.lineStart = lineStart;
  	    this.state.curLine = curLine;
  	    this.finishToken(129, str);
  	  }

  	  readTemplateContinuation() {
  	    if (!this.match(8)) {
  	      this.unexpected(null, 8);
  	    }

  	    this.state.pos--;
  	    this.readTemplateToken();
  	  }

  	  readTemplateToken() {
  	    const opening = this.input[this.state.pos];
  	    const {
  	      str,
  	      containsInvalid,
  	      pos,
  	      curLine,
  	      lineStart
  	    } = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
  	    this.state.pos = pos + 1;
  	    this.state.lineStart = lineStart;
  	    this.state.curLine = curLine;

  	    if (this.input.codePointAt(pos) === 96) {
  	      this.finishToken(24, containsInvalid ? null : opening + str + "`");
  	    } else {
  	      this.state.pos++;
  	      this.finishToken(25, containsInvalid ? null : opening + str + "${");
  	    }
  	  }

  	  recordStrictModeErrors(toParseError, {
  	    at
  	  }) {
  	    const index = at.index;

  	    if (this.state.strict && !this.state.strictErrors.has(index)) {
  	      this.raise(toParseError, {
  	        at
  	      });
  	    } else {
  	      this.state.strictErrors.set(index, [toParseError, at]);
  	    }
  	  }

  	  readWord1(firstCode) {
  	    this.state.containsEsc = false;
  	    let word = "";
  	    const start = this.state.pos;
  	    let chunkStart = this.state.pos;

  	    if (firstCode !== undefined) {
  	      this.state.pos += firstCode <= 0xffff ? 1 : 2;
  	    }

  	    while (this.state.pos < this.length) {
  	      const ch = this.codePointAtPos(this.state.pos);

  	      if (isIdentifierChar(ch)) {
  	        this.state.pos += ch <= 0xffff ? 1 : 2;
  	      } else if (ch === 92) {
  	        this.state.containsEsc = true;
  	        word += this.input.slice(chunkStart, this.state.pos);
  	        const escStart = this.state.curPosition();
  	        const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;

  	        if (this.input.charCodeAt(++this.state.pos) !== 117) {
  	          this.raise(Errors.MissingUnicodeEscape, {
  	            at: this.state.curPosition()
  	          });
  	          chunkStart = this.state.pos - 1;
  	          continue;
  	        }

  	        ++this.state.pos;
  	        const esc = this.readCodePoint(true);

  	        if (esc !== null) {
  	          if (!identifierCheck(esc)) {
  	            this.raise(Errors.EscapedCharNotAnIdentifier, {
  	              at: escStart
  	            });
  	          }

  	          word += String.fromCodePoint(esc);
  	        }

  	        chunkStart = this.state.pos;
  	      } else {
  	        break;
  	      }
  	    }

  	    return word + this.input.slice(chunkStart, this.state.pos);
  	  }

  	  readWord(firstCode) {
  	    const word = this.readWord1(firstCode);
  	    const type = keywords$1.get(word);

  	    if (type !== undefined) {
  	      this.finishToken(type, tokenLabelName(type));
  	    } else {
  	      this.finishToken(128, word);
  	    }
  	  }

  	  checkKeywordEscapes() {
  	    const {
  	      type
  	    } = this.state;

  	    if (tokenIsKeyword(type) && this.state.containsEsc) {
  	      this.raise(Errors.InvalidEscapedReservedWord, {
  	        at: this.state.startLoc,
  	        reservedWord: tokenLabelName(type)
  	      });
  	    }
  	  }

  	  raise(toParseError, raiseProperties) {
  	    const {
  	      at
  	    } = raiseProperties,
  	          details = _objectWithoutPropertiesLoose(raiseProperties, _excluded);

  	    const loc = at instanceof Position ? at : at.loc.start;
  	    const error = toParseError({
  	      loc,
  	      details
  	    });
  	    if (!this.options.errorRecovery) throw error;
  	    if (!this.isLookahead) this.state.errors.push(error);
  	    return error;
  	  }

  	  raiseOverwrite(toParseError, raiseProperties) {
  	    const {
  	      at
  	    } = raiseProperties,
  	          details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2);

  	    const loc = at instanceof Position ? at : at.loc.start;
  	    const pos = loc.index;
  	    const errors = this.state.errors;

  	    for (let i = errors.length - 1; i >= 0; i--) {
  	      const error = errors[i];

  	      if (error.loc.index === pos) {
  	        return errors[i] = toParseError({
  	          loc,
  	          details
  	        });
  	      }

  	      if (error.loc.index < pos) break;
  	    }

  	    return this.raise(toParseError, raiseProperties);
  	  }

  	  updateContext(prevType) {}

  	  unexpected(loc, type) {
  	    throw this.raise(Errors.UnexpectedToken, {
  	      expected: type ? tokenLabelName(type) : null,
  	      at: loc != null ? loc : this.state.startLoc
  	    });
  	  }

  	  expectPlugin(pluginName, loc) {
  	    if (this.hasPlugin(pluginName)) {
  	      return true;
  	    }

  	    throw this.raise(Errors.MissingPlugin, {
  	      at: loc != null ? loc : this.state.startLoc,
  	      missingPlugin: [pluginName]
  	    });
  	  }

  	  expectOnePlugin(pluginNames) {
  	    if (!pluginNames.some(name => this.hasPlugin(name))) {
  	      throw this.raise(Errors.MissingOneOfPlugins, {
  	        at: this.state.startLoc,
  	        missingPlugin: pluginNames
  	      });
  	    }
  	  }

  	  errorBuilder(error) {
  	    return (pos, lineStart, curLine) => {
  	      this.raise(error, {
  	        at: buildPosition(pos, lineStart, curLine)
  	      });
  	    };
  	  }

  	}

  	class Scope {
  	  constructor(flags) {
  	    this.var = new Set();
  	    this.lexical = new Set();
  	    this.functions = new Set();
  	    this.flags = flags;
  	  }

  	}
  	class ScopeHandler {
  	  constructor(parser, inModule) {
  	    this.parser = void 0;
  	    this.scopeStack = [];
  	    this.inModule = void 0;
  	    this.undefinedExports = new Map();
  	    this.parser = parser;
  	    this.inModule = inModule;
  	  }

  	  get inFunction() {
  	    return (this.currentVarScopeFlags() & SCOPE_FUNCTION) > 0;
  	  }

  	  get allowSuper() {
  	    return (this.currentThisScopeFlags() & SCOPE_SUPER) > 0;
  	  }

  	  get allowDirectSuper() {
  	    return (this.currentThisScopeFlags() & SCOPE_DIRECT_SUPER) > 0;
  	  }

  	  get inClass() {
  	    return (this.currentThisScopeFlags() & SCOPE_CLASS) > 0;
  	  }

  	  get inClassAndNotInNonArrowFunction() {
  	    const flags = this.currentThisScopeFlags();
  	    return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0;
  	  }

  	  get inStaticBlock() {
  	    for (let i = this.scopeStack.length - 1;; i--) {
  	      const {
  	        flags
  	      } = this.scopeStack[i];

  	      if (flags & SCOPE_STATIC_BLOCK) {
  	        return true;
  	      }

  	      if (flags & (SCOPE_VAR | SCOPE_CLASS)) {
  	        return false;
  	      }
  	    }
  	  }

  	  get inNonArrowFunction() {
  	    return (this.currentThisScopeFlags() & SCOPE_FUNCTION) > 0;
  	  }

  	  get treatFunctionsAsVar() {
  	    return this.treatFunctionsAsVarInScope(this.currentScope());
  	  }

  	  createScope(flags) {
  	    return new Scope(flags);
  	  }

  	  enter(flags) {
  	    this.scopeStack.push(this.createScope(flags));
  	  }

  	  exit() {
  	    this.scopeStack.pop();
  	  }

  	  treatFunctionsAsVarInScope(scope) {
  	    return !!(scope.flags & (SCOPE_FUNCTION | SCOPE_STATIC_BLOCK) || !this.parser.inModule && scope.flags & SCOPE_PROGRAM);
  	  }

  	  declareName(name, bindingType, loc) {
  	    let scope = this.currentScope();

  	    if (bindingType & BIND_SCOPE_LEXICAL || bindingType & BIND_SCOPE_FUNCTION) {
  	      this.checkRedeclarationInScope(scope, name, bindingType, loc);

  	      if (bindingType & BIND_SCOPE_FUNCTION) {
  	        scope.functions.add(name);
  	      } else {
  	        scope.lexical.add(name);
  	      }

  	      if (bindingType & BIND_SCOPE_LEXICAL) {
  	        this.maybeExportDefined(scope, name);
  	      }
  	    } else if (bindingType & BIND_SCOPE_VAR) {
  	      for (let i = this.scopeStack.length - 1; i >= 0; --i) {
  	        scope = this.scopeStack[i];
  	        this.checkRedeclarationInScope(scope, name, bindingType, loc);
  	        scope.var.add(name);
  	        this.maybeExportDefined(scope, name);
  	        if (scope.flags & SCOPE_VAR) break;
  	      }
  	    }

  	    if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
  	      this.undefinedExports.delete(name);
  	    }
  	  }

  	  maybeExportDefined(scope, name) {
  	    if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
  	      this.undefinedExports.delete(name);
  	    }
  	  }

  	  checkRedeclarationInScope(scope, name, bindingType, loc) {
  	    if (this.isRedeclaredInScope(scope, name, bindingType)) {
  	      this.parser.raise(Errors.VarRedeclaration, {
  	        at: loc,
  	        identifierName: name
  	      });
  	    }
  	  }

  	  isRedeclaredInScope(scope, name, bindingType) {
  	    if (!(bindingType & BIND_KIND_VALUE)) return false;

  	    if (bindingType & BIND_SCOPE_LEXICAL) {
  	      return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
  	    }

  	    if (bindingType & BIND_SCOPE_FUNCTION) {
  	      return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
  	    }

  	    return scope.lexical.has(name) && !(scope.flags & SCOPE_SIMPLE_CATCH && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
  	  }

  	  checkLocalExport(id) {
  	    const {
  	      name
  	    } = id;
  	    const topLevelScope = this.scopeStack[0];

  	    if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
  	      this.undefinedExports.set(name, id.loc.start);
  	    }
  	  }

  	  currentScope() {
  	    return this.scopeStack[this.scopeStack.length - 1];
  	  }

  	  currentVarScopeFlags() {
  	    for (let i = this.scopeStack.length - 1;; i--) {
  	      const {
  	        flags
  	      } = this.scopeStack[i];

  	      if (flags & SCOPE_VAR) {
  	        return flags;
  	      }
  	    }
  	  }

  	  currentThisScopeFlags() {
  	    for (let i = this.scopeStack.length - 1;; i--) {
  	      const {
  	        flags
  	      } = this.scopeStack[i];

  	      if (flags & (SCOPE_VAR | SCOPE_CLASS) && !(flags & SCOPE_ARROW)) {
  	        return flags;
  	      }
  	    }
  	  }

  	}

  	class FlowScope extends Scope {
  	  constructor(...args) {
  	    super(...args);
  	    this.declareFunctions = new Set();
  	  }

  	}

  	class FlowScopeHandler extends ScopeHandler {
  	  createScope(flags) {
  	    return new FlowScope(flags);
  	  }

  	  declareName(name, bindingType, loc) {
  	    const scope = this.currentScope();

  	    if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
  	      this.checkRedeclarationInScope(scope, name, bindingType, loc);
  	      this.maybeExportDefined(scope, name);
  	      scope.declareFunctions.add(name);
  	      return;
  	    }

  	    super.declareName(name, bindingType, loc);
  	  }

  	  isRedeclaredInScope(scope, name, bindingType) {
  	    if (super.isRedeclaredInScope(scope, name, bindingType)) return true;

  	    if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
  	      return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
  	    }

  	    return false;
  	  }

  	  checkLocalExport(id) {
  	    if (!this.scopeStack[0].declareFunctions.has(id.name)) {
  	      super.checkLocalExport(id);
  	    }
  	  }

  	}

  	class ClassScope {
  	  constructor() {
  	    this.privateNames = new Set();
  	    this.loneAccessors = new Map();
  	    this.undefinedPrivateNames = new Map();
  	  }

  	}
  	class ClassScopeHandler {
  	  constructor(parser) {
  	    this.parser = void 0;
  	    this.stack = [];
  	    this.undefinedPrivateNames = new Map();
  	    this.parser = parser;
  	  }

  	  current() {
  	    return this.stack[this.stack.length - 1];
  	  }

  	  enter() {
  	    this.stack.push(new ClassScope());
  	  }

  	  exit() {
  	    const oldClassScope = this.stack.pop();
  	    const current = this.current();

  	    for (const [name, loc] of Array.from(oldClassScope.undefinedPrivateNames)) {
  	      if (current) {
  	        if (!current.undefinedPrivateNames.has(name)) {
  	          current.undefinedPrivateNames.set(name, loc);
  	        }
  	      } else {
  	        this.parser.raise(Errors.InvalidPrivateFieldResolution, {
  	          at: loc,
  	          identifierName: name
  	        });
  	      }
  	    }
  	  }

  	  declarePrivateName(name, elementType, loc) {
  	    const {
  	      privateNames,
  	      loneAccessors,
  	      undefinedPrivateNames
  	    } = this.current();
  	    let redefined = privateNames.has(name);

  	    if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) {
  	      const accessor = redefined && loneAccessors.get(name);

  	      if (accessor) {
  	        const oldStatic = accessor & CLASS_ELEMENT_FLAG_STATIC;
  	        const newStatic = elementType & CLASS_ELEMENT_FLAG_STATIC;
  	        const oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR;
  	        const newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR;
  	        redefined = oldKind === newKind || oldStatic !== newStatic;
  	        if (!redefined) loneAccessors.delete(name);
  	      } else if (!redefined) {
  	        loneAccessors.set(name, elementType);
  	      }
  	    }

  	    if (redefined) {
  	      this.parser.raise(Errors.PrivateNameRedeclaration, {
  	        at: loc,
  	        identifierName: name
  	      });
  	    }

  	    privateNames.add(name);
  	    undefinedPrivateNames.delete(name);
  	  }

  	  usePrivateName(name, loc) {
  	    let classScope;

  	    for (classScope of this.stack) {
  	      if (classScope.privateNames.has(name)) return;
  	    }

  	    if (classScope) {
  	      classScope.undefinedPrivateNames.set(name, loc);
  	    } else {
  	      this.parser.raise(Errors.InvalidPrivateFieldResolution, {
  	        at: loc,
  	        identifierName: name
  	      });
  	    }
  	  }

  	}

  	const kExpression = 0,
  	      kMaybeArrowParameterDeclaration = 1,
  	      kMaybeAsyncArrowParameterDeclaration = 2,
  	      kParameterDeclaration = 3;

  	class ExpressionScope {
  	  constructor(type = kExpression) {
  	    this.type = void 0;
  	    this.type = type;
  	  }

  	  canBeArrowParameterDeclaration() {
  	    return this.type === kMaybeAsyncArrowParameterDeclaration || this.type === kMaybeArrowParameterDeclaration;
  	  }

  	  isCertainlyParameterDeclaration() {
  	    return this.type === kParameterDeclaration;
  	  }

  	}

  	class ArrowHeadParsingScope extends ExpressionScope {
  	  constructor(type) {
  	    super(type);
  	    this.declarationErrors = new Map();
  	  }

  	  recordDeclarationError(ParsingErrorClass, {
  	    at
  	  }) {
  	    const index = at.index;
  	    this.declarationErrors.set(index, [ParsingErrorClass, at]);
  	  }

  	  clearDeclarationError(index) {
  	    this.declarationErrors.delete(index);
  	  }

  	  iterateErrors(iterator) {
  	    this.declarationErrors.forEach(iterator);
  	  }

  	}

  	class ExpressionScopeHandler {
  	  constructor(parser) {
  	    this.parser = void 0;
  	    this.stack = [new ExpressionScope()];
  	    this.parser = parser;
  	  }

  	  enter(scope) {
  	    this.stack.push(scope);
  	  }

  	  exit() {
  	    this.stack.pop();
  	  }

  	  recordParameterInitializerError(toParseError, {
  	    at: node
  	  }) {
  	    const origin = {
  	      at: node.loc.start
  	    };
  	    const {
  	      stack
  	    } = this;
  	    let i = stack.length - 1;
  	    let scope = stack[i];

  	    while (!scope.isCertainlyParameterDeclaration()) {
  	      if (scope.canBeArrowParameterDeclaration()) {
  	        scope.recordDeclarationError(toParseError, origin);
  	      } else {
  	        return;
  	      }

  	      scope = stack[--i];
  	    }

  	    this.parser.raise(toParseError, origin);
  	  }

  	  recordArrowParemeterBindingError(error, {
  	    at: node
  	  }) {
  	    const {
  	      stack
  	    } = this;
  	    const scope = stack[stack.length - 1];
  	    const origin = {
  	      at: node.loc.start
  	    };

  	    if (scope.isCertainlyParameterDeclaration()) {
  	      this.parser.raise(error, origin);
  	    } else if (scope.canBeArrowParameterDeclaration()) {
  	      scope.recordDeclarationError(error, origin);
  	    } else {
  	      return;
  	    }
  	  }

  	  recordAsyncArrowParametersError({
  	    at
  	  }) {
  	    const {
  	      stack
  	    } = this;
  	    let i = stack.length - 1;
  	    let scope = stack[i];

  	    while (scope.canBeArrowParameterDeclaration()) {
  	      if (scope.type === kMaybeAsyncArrowParameterDeclaration) {
  	        scope.recordDeclarationError(Errors.AwaitBindingIdentifier, {
  	          at
  	        });
  	      }

  	      scope = stack[--i];
  	    }
  	  }

  	  validateAsPattern() {
  	    const {
  	      stack
  	    } = this;
  	    const currentScope = stack[stack.length - 1];
  	    if (!currentScope.canBeArrowParameterDeclaration()) return;
  	    currentScope.iterateErrors(([toParseError, loc]) => {
  	      this.parser.raise(toParseError, {
  	        at: loc
  	      });
  	      let i = stack.length - 2;
  	      let scope = stack[i];

  	      while (scope.canBeArrowParameterDeclaration()) {
  	        scope.clearDeclarationError(loc.index);
  	        scope = stack[--i];
  	      }
  	    });
  	  }

  	}
  	function newParameterDeclarationScope() {
  	  return new ExpressionScope(kParameterDeclaration);
  	}
  	function newArrowHeadScope() {
  	  return new ArrowHeadParsingScope(kMaybeArrowParameterDeclaration);
  	}
  	function newAsyncArrowScope() {
  	  return new ArrowHeadParsingScope(kMaybeAsyncArrowParameterDeclaration);
  	}
  	function newExpressionScope() {
  	  return new ExpressionScope();
  	}

  	const PARAM = 0b0000,
  	      PARAM_YIELD = 0b0001,
  	      PARAM_AWAIT = 0b0010,
  	      PARAM_RETURN = 0b0100,
  	      PARAM_IN = 0b1000;
  	class ProductionParameterHandler {
  	  constructor() {
  	    this.stacks = [];
  	  }

  	  enter(flags) {
  	    this.stacks.push(flags);
  	  }

  	  exit() {
  	    this.stacks.pop();
  	  }

  	  currentFlags() {
  	    return this.stacks[this.stacks.length - 1];
  	  }

  	  get hasAwait() {
  	    return (this.currentFlags() & PARAM_AWAIT) > 0;
  	  }

  	  get hasYield() {
  	    return (this.currentFlags() & PARAM_YIELD) > 0;
  	  }

  	  get hasReturn() {
  	    return (this.currentFlags() & PARAM_RETURN) > 0;
  	  }

  	  get hasIn() {
  	    return (this.currentFlags() & PARAM_IN) > 0;
  	  }

  	}
  	function functionFlags(isAsync, isGenerator) {
  	  return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0);
  	}

  	class UtilParser extends Tokenizer {
  	  addExtra(node, key, value, enumerable = true) {
  	    if (!node) return;
  	    const extra = node.extra = node.extra || {};

  	    if (enumerable) {
  	      extra[key] = value;
  	    } else {
  	      Object.defineProperty(extra, key, {
  	        enumerable,
  	        value
  	      });
  	    }
  	  }

  	  isContextual(token) {
  	    return this.state.type === token && !this.state.containsEsc;
  	  }

  	  isUnparsedContextual(nameStart, name) {
  	    const nameEnd = nameStart + name.length;

  	    if (this.input.slice(nameStart, nameEnd) === name) {
  	      const nextCh = this.input.charCodeAt(nameEnd);
  	      return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
  	    }

  	    return false;
  	  }

  	  isLookaheadContextual(name) {
  	    const next = this.nextTokenStart();
  	    return this.isUnparsedContextual(next, name);
  	  }

  	  eatContextual(token) {
  	    if (this.isContextual(token)) {
  	      this.next();
  	      return true;
  	    }

  	    return false;
  	  }

  	  expectContextual(token, toParseError) {
  	    if (!this.eatContextual(token)) {
  	      if (toParseError != null) {
  	        throw this.raise(toParseError, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      throw this.unexpected(null, token);
  	    }
  	  }

  	  canInsertSemicolon() {
  	    return this.match(135) || this.match(8) || this.hasPrecedingLineBreak();
  	  }

  	  hasPrecedingLineBreak() {
  	    return lineBreak.test(this.input.slice(this.state.lastTokEndLoc.index, this.state.start));
  	  }

  	  hasFollowingLineBreak() {
  	    skipWhiteSpaceToLineBreak.lastIndex = this.state.end;
  	    return skipWhiteSpaceToLineBreak.test(this.input);
  	  }

  	  isLineTerminator() {
  	    return this.eat(13) || this.canInsertSemicolon();
  	  }

  	  semicolon(allowAsi = true) {
  	    if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
  	    this.raise(Errors.MissingSemicolon, {
  	      at: this.state.lastTokEndLoc
  	    });
  	  }

  	  expect(type, loc) {
  	    this.eat(type) || this.unexpected(loc, type);
  	  }

  	  tryParse(fn, oldState = this.state.clone()) {
  	    const abortSignal = {
  	      node: null
  	    };

  	    try {
  	      const node = fn((node = null) => {
  	        abortSignal.node = node;
  	        throw abortSignal;
  	      });

  	      if (this.state.errors.length > oldState.errors.length) {
  	        const failState = this.state;
  	        this.state = oldState;
  	        this.state.tokensLength = failState.tokensLength;
  	        return {
  	          node,
  	          error: failState.errors[oldState.errors.length],
  	          thrown: false,
  	          aborted: false,
  	          failState
  	        };
  	      }

  	      return {
  	        node,
  	        error: null,
  	        thrown: false,
  	        aborted: false,
  	        failState: null
  	      };
  	    } catch (error) {
  	      const failState = this.state;
  	      this.state = oldState;

  	      if (error instanceof SyntaxError) {
  	        return {
  	          node: null,
  	          error,
  	          thrown: true,
  	          aborted: false,
  	          failState
  	        };
  	      }

  	      if (error === abortSignal) {
  	        return {
  	          node: abortSignal.node,
  	          error: null,
  	          thrown: false,
  	          aborted: true,
  	          failState
  	        };
  	      }

  	      throw error;
  	    }
  	  }

  	  checkExpressionErrors(refExpressionErrors, andThrow) {
  	    if (!refExpressionErrors) return false;
  	    const {
  	      shorthandAssignLoc,
  	      doubleProtoLoc,
  	      privateKeyLoc,
  	      optionalParametersLoc
  	    } = refExpressionErrors;
  	    const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc;

  	    if (!andThrow) {
  	      return hasErrors;
  	    }

  	    if (shorthandAssignLoc != null) {
  	      this.raise(Errors.InvalidCoverInitializedName, {
  	        at: shorthandAssignLoc
  	      });
  	    }

  	    if (doubleProtoLoc != null) {
  	      this.raise(Errors.DuplicateProto, {
  	        at: doubleProtoLoc
  	      });
  	    }

  	    if (privateKeyLoc != null) {
  	      this.raise(Errors.UnexpectedPrivateField, {
  	        at: privateKeyLoc
  	      });
  	    }

  	    if (optionalParametersLoc != null) {
  	      this.unexpected(optionalParametersLoc);
  	    }
  	  }

  	  isLiteralPropertyName() {
  	    return tokenIsLiteralPropertyName(this.state.type);
  	  }

  	  isPrivateName(node) {
  	    return node.type === "PrivateName";
  	  }

  	  getPrivateNameSV(node) {
  	    return node.id.name;
  	  }

  	  hasPropertyAsPrivateName(node) {
  	    return (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") && this.isPrivateName(node.property);
  	  }

  	  isOptionalChain(node) {
  	    return node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression";
  	  }

  	  isObjectProperty(node) {
  	    return node.type === "ObjectProperty";
  	  }

  	  isObjectMethod(node) {
  	    return node.type === "ObjectMethod";
  	  }

  	  initializeScopes(inModule = this.options.sourceType === "module") {
  	    const oldLabels = this.state.labels;
  	    this.state.labels = [];
  	    const oldExportedIdentifiers = this.exportedIdentifiers;
  	    this.exportedIdentifiers = new Set();
  	    const oldInModule = this.inModule;
  	    this.inModule = inModule;
  	    const oldScope = this.scope;
  	    const ScopeHandler = this.getScopeHandler();
  	    this.scope = new ScopeHandler(this, inModule);
  	    const oldProdParam = this.prodParam;
  	    this.prodParam = new ProductionParameterHandler();
  	    const oldClassScope = this.classScope;
  	    this.classScope = new ClassScopeHandler(this);
  	    const oldExpressionScope = this.expressionScope;
  	    this.expressionScope = new ExpressionScopeHandler(this);
  	    return () => {
  	      this.state.labels = oldLabels;
  	      this.exportedIdentifiers = oldExportedIdentifiers;
  	      this.inModule = oldInModule;
  	      this.scope = oldScope;
  	      this.prodParam = oldProdParam;
  	      this.classScope = oldClassScope;
  	      this.expressionScope = oldExpressionScope;
  	    };
  	  }

  	  enterInitialScopes() {
  	    let paramFlags = PARAM;

  	    if (this.inModule) {
  	      paramFlags |= PARAM_AWAIT;
  	    }

  	    this.scope.enter(SCOPE_PROGRAM);
  	    this.prodParam.enter(paramFlags);
  	  }

  	  checkDestructuringPrivate(refExpressionErrors) {
  	    const {
  	      privateKeyLoc
  	    } = refExpressionErrors;

  	    if (privateKeyLoc !== null) {
  	      this.expectPlugin("destructuringPrivate", privateKeyLoc);
  	    }
  	  }

  	}
  	class ExpressionErrors {
  	  constructor() {
  	    this.shorthandAssignLoc = null;
  	    this.doubleProtoLoc = null;
  	    this.privateKeyLoc = null;
  	    this.optionalParametersLoc = null;
  	  }

  	}

  	class Node {
  	  constructor(parser, pos, loc) {
  	    this.type = "";
  	    this.start = pos;
  	    this.end = 0;
  	    this.loc = new SourceLocation(loc);
  	    if (parser != null && parser.options.ranges) this.range = [pos, 0];
  	    if (parser != null && parser.filename) this.loc.filename = parser.filename;
  	  }

  	}

  	const NodePrototype = Node.prototype;
  	{
  	  NodePrototype.__clone = function () {
  	    const newNode = new Node();
  	    const keys = Object.keys(this);

  	    for (let i = 0, length = keys.length; i < length; i++) {
  	      const key = keys[i];

  	      if (key !== "leadingComments" && key !== "trailingComments" && key !== "innerComments") {
  	        newNode[key] = this[key];
  	      }
  	    }

  	    return newNode;
  	  };
  	}

  	function clonePlaceholder(node) {
  	  return cloneIdentifier(node);
  	}

  	function cloneIdentifier(node) {
  	  const {
  	    type,
  	    start,
  	    end,
  	    loc,
  	    range,
  	    extra,
  	    name
  	  } = node;
  	  const cloned = Object.create(NodePrototype);
  	  cloned.type = type;
  	  cloned.start = start;
  	  cloned.end = end;
  	  cloned.loc = loc;
  	  cloned.range = range;
  	  cloned.extra = extra;
  	  cloned.name = name;

  	  if (type === "Placeholder") {
  	    cloned.expectedNode = node.expectedNode;
  	  }

  	  return cloned;
  	}
  	function cloneStringLiteral(node) {
  	  const {
  	    type,
  	    start,
  	    end,
  	    loc,
  	    range,
  	    extra
  	  } = node;

  	  if (type === "Placeholder") {
  	    return clonePlaceholder(node);
  	  }

  	  const cloned = Object.create(NodePrototype);
  	  cloned.type = type;
  	  cloned.start = start;
  	  cloned.end = end;
  	  cloned.loc = loc;
  	  cloned.range = range;

  	  if (node.raw !== undefined) {
  	    cloned.raw = node.raw;
  	  } else {
  	    cloned.extra = extra;
  	  }

  	  cloned.value = node.value;
  	  return cloned;
  	}
  	class NodeUtils extends UtilParser {
  	  startNode() {
  	    return new Node(this, this.state.start, this.state.startLoc);
  	  }

  	  startNodeAt(pos, loc) {
  	    return new Node(this, pos, loc);
  	  }

  	  startNodeAtNode(type) {
  	    return this.startNodeAt(type.start, type.loc.start);
  	  }

  	  finishNode(node, type) {
  	    return this.finishNodeAt(node, type, this.state.lastTokEndLoc);
  	  }

  	  finishNodeAt(node, type, endLoc) {

  	    node.type = type;
  	    node.end = endLoc.index;
  	    node.loc.end = endLoc;
  	    if (this.options.ranges) node.range[1] = endLoc.index;
  	    if (this.options.attachComment) this.processComment(node);
  	    return node;
  	  }

  	  resetStartLocation(node, start, startLoc) {
  	    node.start = start;
  	    node.loc.start = startLoc;
  	    if (this.options.ranges) node.range[0] = start;
  	  }

  	  resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
  	    node.end = endLoc.index;
  	    node.loc.end = endLoc;
  	    if (this.options.ranges) node.range[1] = endLoc.index;
  	  }

  	  resetStartLocationFromNode(node, locationNode) {
  	    this.resetStartLocation(node, locationNode.start, locationNode.loc.start);
  	  }

  	}

  	const reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
  	const FlowErrors = ParseErrorEnum`flow`({
  	  AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
  	  AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
  	  AssignReservedType: ({
  	    reservedType
  	  }) => `Cannot overwrite reserved type ${reservedType}.`,
  	  DeclareClassElement: "The `declare` modifier can only appear on class fields.",
  	  DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
  	  DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.",
  	  EnumBooleanMemberNotInitialized: ({
  	    memberName,
  	    enumName
  	  }) => `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` or \`${memberName} = false,\` in enum \`${enumName}\`.`,
  	  EnumDuplicateMemberName: ({
  	    memberName,
  	    enumName
  	  }) => `Enum member names need to be unique, but the name \`${memberName}\` has already been used before in enum \`${enumName}\`.`,
  	  EnumInconsistentMemberValues: ({
  	    enumName
  	  }) => `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,
  	  EnumInvalidExplicitType: ({
  	    invalidEnumType,
  	    enumName
  	  }) => `Enum type \`${invalidEnumType}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
  	  EnumInvalidExplicitTypeUnknownSupplied: ({
  	    enumName
  	  }) => `Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
  	  EnumInvalidMemberInitializerPrimaryType: ({
  	    enumName,
  	    memberName,
  	    explicitType
  	  }) => `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of \`${memberName}\` needs to be a ${explicitType} literal.`,
  	  EnumInvalidMemberInitializerSymbolType: ({
  	    enumName,
  	    memberName
  	  }) => `Symbol enum members cannot be initialized. Use \`${memberName},\` in enum \`${enumName}\`.`,
  	  EnumInvalidMemberInitializerUnknownType: ({
  	    enumName,
  	    memberName
  	  }) => `The enum member initializer for \`${memberName}\` needs to be a literal (either a boolean, number, or string) in enum \`${enumName}\`.`,
  	  EnumInvalidMemberName: ({
  	    enumName,
  	    memberName,
  	    suggestion
  	  }) => `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`,
  	  EnumNumberMemberNotInitialized: ({
  	    enumName,
  	    memberName
  	  }) => `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`,
  	  EnumStringMemberInconsistentlyInitailized: ({
  	    enumName
  	  }) => `String enum members need to consistently either all use initializers, or use no initializers, in enum \`${enumName}\`.`,
  	  GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
  	  ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",
  	  InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.",
  	  InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.",
  	  InexactVariance: "Explicit inexact syntax cannot have variance.",
  	  InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.",
  	  MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
  	  NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.",
  	  NestedFlowComment: "Cannot have a flow comment inside another flow comment.",
  	  PatternIsOptional: Object.assign({
  	    message: "A binding pattern parameter cannot be optional in an implementation signature."
  	  }, {
  	    reasonCode: "OptionalBindingPattern"
  	  }),
  	  SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
  	  SpreadVariance: "Spread properties cannot have variance.",
  	  ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
  	  ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
  	  ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
  	  ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
  	  ThisParamNoDefault: "The `this` parameter may not have a default value.",
  	  TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
  	  TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.",
  	  UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.",
  	  UnexpectedReservedType: ({
  	    reservedType
  	  }) => `Unexpected reserved type ${reservedType}.`,
  	  UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.",
  	  UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
  	  UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.",
  	  UnexpectedSubtractionOperand: 'Unexpected token, expected "number" or "bigint".',
  	  UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.",
  	  UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",
  	  UnsupportedDeclareExportKind: ({
  	    unsupportedExportKind,
  	    suggestion
  	  }) => `\`declare export ${unsupportedExportKind}\` is not supported. Use \`${suggestion}\` instead.`,
  	  UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
  	  UnterminatedFlowComment: "Unterminated flow-comment."
  	});

  	function isEsModuleType(bodyElement) {
  	  return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
  	}

  	function hasTypeImportKind(node) {
  	  return node.importKind === "type" || node.importKind === "typeof";
  	}

  	function isMaybeDefaultImport(type) {
  	  return tokenIsKeywordOrIdentifier(type) && type !== 97;
  	}

  	const exportSuggestions = {
  	  const: "declare export var",
  	  let: "declare export var",
  	  type: "export type",
  	  interface: "export interface"
  	};

  	function partition(list, test) {
  	  const list1 = [];
  	  const list2 = [];

  	  for (let i = 0; i < list.length; i++) {
  	    (test(list[i], i, list) ? list1 : list2).push(list[i]);
  	  }

  	  return [list1, list2];
  	}

  	const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
  	var flow = (superClass => class extends superClass {
  	  constructor(...args) {
  	    super(...args);
  	    this.flowPragma = undefined;
  	  }

  	  getScopeHandler() {
  	    return FlowScopeHandler;
  	  }

  	  shouldParseTypes() {
  	    return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
  	  }

  	  shouldParseEnums() {
  	    return !!this.getPluginOption("flow", "enums");
  	  }

  	  finishToken(type, val) {
  	    if (type !== 129 && type !== 13 && type !== 28) {
  	      if (this.flowPragma === undefined) {
  	        this.flowPragma = null;
  	      }
  	    }

  	    return super.finishToken(type, val);
  	  }

  	  addComment(comment) {
  	    if (this.flowPragma === undefined) {
  	      const matches = FLOW_PRAGMA_REGEX.exec(comment.value);

  	      if (!matches) ; else if (matches[1] === "flow") {
  	        this.flowPragma = "flow";
  	      } else if (matches[1] === "noflow") {
  	        this.flowPragma = "noflow";
  	      } else {
  	        throw new Error("Unexpected flow pragma");
  	      }
  	    }

  	    return super.addComment(comment);
  	  }

  	  flowParseTypeInitialiser(tok) {
  	    const oldInType = this.state.inType;
  	    this.state.inType = true;
  	    this.expect(tok || 14);
  	    const type = this.flowParseType();
  	    this.state.inType = oldInType;
  	    return type;
  	  }

  	  flowParsePredicate() {
  	    const node = this.startNode();
  	    const moduloLoc = this.state.startLoc;
  	    this.next();
  	    this.expectContextual(107);

  	    if (this.state.lastTokStart > moduloLoc.index + 1) {
  	      this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, {
  	        at: moduloLoc
  	      });
  	    }

  	    if (this.eat(10)) {
  	      node.value = super.parseExpression();
  	      this.expect(11);
  	      return this.finishNode(node, "DeclaredPredicate");
  	    } else {
  	      return this.finishNode(node, "InferredPredicate");
  	    }
  	  }

  	  flowParseTypeAndPredicateInitialiser() {
  	    const oldInType = this.state.inType;
  	    this.state.inType = true;
  	    this.expect(14);
  	    let type = null;
  	    let predicate = null;

  	    if (this.match(54)) {
  	      this.state.inType = oldInType;
  	      predicate = this.flowParsePredicate();
  	    } else {
  	      type = this.flowParseType();
  	      this.state.inType = oldInType;

  	      if (this.match(54)) {
  	        predicate = this.flowParsePredicate();
  	      }
  	    }

  	    return [type, predicate];
  	  }

  	  flowParseDeclareClass(node) {
  	    this.next();
  	    this.flowParseInterfaceish(node, true);
  	    return this.finishNode(node, "DeclareClass");
  	  }

  	  flowParseDeclareFunction(node) {
  	    this.next();
  	    const id = node.id = this.parseIdentifier();
  	    const typeNode = this.startNode();
  	    const typeContainer = this.startNode();

  	    if (this.match(47)) {
  	      typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
  	    } else {
  	      typeNode.typeParameters = null;
  	    }

  	    this.expect(10);
  	    const tmp = this.flowParseFunctionTypeParams();
  	    typeNode.params = tmp.params;
  	    typeNode.rest = tmp.rest;
  	    typeNode.this = tmp._this;
  	    this.expect(11);
  	    [typeNode.returnType, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
  	    typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
  	    id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
  	    this.resetEndLocation(id);
  	    this.semicolon();
  	    this.scope.declareName(node.id.name, BIND_FLOW_DECLARE_FN, node.id.loc.start);
  	    return this.finishNode(node, "DeclareFunction");
  	  }

  	  flowParseDeclare(node, insideModule) {
  	    if (this.match(80)) {
  	      return this.flowParseDeclareClass(node);
  	    } else if (this.match(68)) {
  	      return this.flowParseDeclareFunction(node);
  	    } else if (this.match(74)) {
  	      return this.flowParseDeclareVariable(node);
  	    } else if (this.eatContextual(123)) {
  	      if (this.match(16)) {
  	        return this.flowParseDeclareModuleExports(node);
  	      } else {
  	        if (insideModule) {
  	          this.raise(FlowErrors.NestedDeclareModule, {
  	            at: this.state.lastTokStartLoc
  	          });
  	        }

  	        return this.flowParseDeclareModule(node);
  	      }
  	    } else if (this.isContextual(126)) {
  	      return this.flowParseDeclareTypeAlias(node);
  	    } else if (this.isContextual(127)) {
  	      return this.flowParseDeclareOpaqueType(node);
  	    } else if (this.isContextual(125)) {
  	      return this.flowParseDeclareInterface(node);
  	    } else if (this.match(82)) {
  	      return this.flowParseDeclareExportDeclaration(node, insideModule);
  	    } else {
  	      throw this.unexpected();
  	    }
  	  }

  	  flowParseDeclareVariable(node) {
  	    this.next();
  	    node.id = this.flowParseTypeAnnotatableIdentifier(true);
  	    this.scope.declareName(node.id.name, BIND_VAR, node.id.loc.start);
  	    this.semicolon();
  	    return this.finishNode(node, "DeclareVariable");
  	  }

  	  flowParseDeclareModule(node) {
  	    this.scope.enter(SCOPE_OTHER);

  	    if (this.match(129)) {
  	      node.id = super.parseExprAtom();
  	    } else {
  	      node.id = this.parseIdentifier();
  	    }

  	    const bodyNode = node.body = this.startNode();
  	    const body = bodyNode.body = [];
  	    this.expect(5);

  	    while (!this.match(8)) {
  	      let bodyNode = this.startNode();

  	      if (this.match(83)) {
  	        this.next();

  	        if (!this.isContextual(126) && !this.match(87)) {
  	          this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, {
  	            at: this.state.lastTokStartLoc
  	          });
  	        }

  	        super.parseImport(bodyNode);
  	      } else {
  	        this.expectContextual(121, FlowErrors.UnsupportedStatementInDeclareModule);
  	        bodyNode = this.flowParseDeclare(bodyNode, true);
  	      }

  	      body.push(bodyNode);
  	    }

  	    this.scope.exit();
  	    this.expect(8);
  	    this.finishNode(bodyNode, "BlockStatement");
  	    let kind = null;
  	    let hasModuleExport = false;
  	    body.forEach(bodyElement => {
  	      if (isEsModuleType(bodyElement)) {
  	        if (kind === "CommonJS") {
  	          this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
  	            at: bodyElement
  	          });
  	        }

  	        kind = "ES";
  	      } else if (bodyElement.type === "DeclareModuleExports") {
  	        if (hasModuleExport) {
  	          this.raise(FlowErrors.DuplicateDeclareModuleExports, {
  	            at: bodyElement
  	          });
  	        }

  	        if (kind === "ES") {
  	          this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
  	            at: bodyElement
  	          });
  	        }

  	        kind = "CommonJS";
  	        hasModuleExport = true;
  	      }
  	    });
  	    node.kind = kind || "CommonJS";
  	    return this.finishNode(node, "DeclareModule");
  	  }

  	  flowParseDeclareExportDeclaration(node, insideModule) {
  	    this.expect(82);

  	    if (this.eat(65)) {
  	      if (this.match(68) || this.match(80)) {
  	        node.declaration = this.flowParseDeclare(this.startNode());
  	      } else {
  	        node.declaration = this.flowParseType();
  	        this.semicolon();
  	      }

  	      node.default = true;
  	      return this.finishNode(node, "DeclareExportDeclaration");
  	    } else {
  	      if (this.match(75) || this.isLet() || (this.isContextual(126) || this.isContextual(125)) && !insideModule) {
  	        const label = this.state.value;
  	        throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
  	          at: this.state.startLoc,
  	          unsupportedExportKind: label,
  	          suggestion: exportSuggestions[label]
  	        });
  	      }

  	      if (this.match(74) || this.match(68) || this.match(80) || this.isContextual(127)) {
  	        node.declaration = this.flowParseDeclare(this.startNode());
  	        node.default = false;
  	        return this.finishNode(node, "DeclareExportDeclaration");
  	      } else if (this.match(55) || this.match(5) || this.isContextual(125) || this.isContextual(126) || this.isContextual(127)) {
  	        node = this.parseExport(node);

  	        if (node.type === "ExportNamedDeclaration") {
  	          node.type = "ExportDeclaration";
  	          node.default = false;
  	          delete node.exportKind;
  	        }

  	        node.type = "Declare" + node.type;
  	        return node;
  	      }
  	    }

  	    throw this.unexpected();
  	  }

  	  flowParseDeclareModuleExports(node) {
  	    this.next();
  	    this.expectContextual(108);
  	    node.typeAnnotation = this.flowParseTypeAnnotation();
  	    this.semicolon();
  	    return this.finishNode(node, "DeclareModuleExports");
  	  }

  	  flowParseDeclareTypeAlias(node) {
  	    this.next();
  	    const finished = this.flowParseTypeAlias(node);
  	    finished.type = "DeclareTypeAlias";
  	    return finished;
  	  }

  	  flowParseDeclareOpaqueType(node) {
  	    this.next();
  	    const finished = this.flowParseOpaqueType(node, true);
  	    finished.type = "DeclareOpaqueType";
  	    return finished;
  	  }

  	  flowParseDeclareInterface(node) {
  	    this.next();
  	    this.flowParseInterfaceish(node);
  	    return this.finishNode(node, "DeclareInterface");
  	  }

  	  flowParseInterfaceish(node, isClass = false) {
  	    node.id = this.flowParseRestrictedIdentifier(!isClass, true);
  	    this.scope.declareName(node.id.name, isClass ? BIND_FUNCTION : BIND_LEXICAL, node.id.loc.start);

  	    if (this.match(47)) {
  	      node.typeParameters = this.flowParseTypeParameterDeclaration();
  	    } else {
  	      node.typeParameters = null;
  	    }

  	    node.extends = [];
  	    node.implements = [];
  	    node.mixins = [];

  	    if (this.eat(81)) {
  	      do {
  	        node.extends.push(this.flowParseInterfaceExtends());
  	      } while (!isClass && this.eat(12));
  	    }

  	    if (this.isContextual(114)) {
  	      this.next();

  	      do {
  	        node.mixins.push(this.flowParseInterfaceExtends());
  	      } while (this.eat(12));
  	    }

  	    if (this.isContextual(110)) {
  	      this.next();

  	      do {
  	        node.implements.push(this.flowParseInterfaceExtends());
  	      } while (this.eat(12));
  	    }

  	    node.body = this.flowParseObjectType({
  	      allowStatic: isClass,
  	      allowExact: false,
  	      allowSpread: false,
  	      allowProto: isClass,
  	      allowInexact: false
  	    });
  	  }

  	  flowParseInterfaceExtends() {
  	    const node = this.startNode();
  	    node.id = this.flowParseQualifiedTypeIdentifier();

  	    if (this.match(47)) {
  	      node.typeParameters = this.flowParseTypeParameterInstantiation();
  	    } else {
  	      node.typeParameters = null;
  	    }

  	    return this.finishNode(node, "InterfaceExtends");
  	  }

  	  flowParseInterface(node) {
  	    this.flowParseInterfaceish(node);
  	    return this.finishNode(node, "InterfaceDeclaration");
  	  }

  	  checkNotUnderscore(word) {
  	    if (word === "_") {
  	      this.raise(FlowErrors.UnexpectedReservedUnderscore, {
  	        at: this.state.startLoc
  	      });
  	    }
  	  }

  	  checkReservedType(word, startLoc, declaration) {
  	    if (!reservedTypes.has(word)) return;
  	    this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, {
  	      at: startLoc,
  	      reservedType: word
  	    });
  	  }

  	  flowParseRestrictedIdentifier(liberal, declaration) {
  	    this.checkReservedType(this.state.value, this.state.startLoc, declaration);
  	    return this.parseIdentifier(liberal);
  	  }

  	  flowParseTypeAlias(node) {
  	    node.id = this.flowParseRestrictedIdentifier(false, true);
  	    this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.loc.start);

  	    if (this.match(47)) {
  	      node.typeParameters = this.flowParseTypeParameterDeclaration();
  	    } else {
  	      node.typeParameters = null;
  	    }

  	    node.right = this.flowParseTypeInitialiser(29);
  	    this.semicolon();
  	    return this.finishNode(node, "TypeAlias");
  	  }

  	  flowParseOpaqueType(node, declare) {
  	    this.expectContextual(126);
  	    node.id = this.flowParseRestrictedIdentifier(true, true);
  	    this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.loc.start);

  	    if (this.match(47)) {
  	      node.typeParameters = this.flowParseTypeParameterDeclaration();
  	    } else {
  	      node.typeParameters = null;
  	    }

  	    node.supertype = null;

  	    if (this.match(14)) {
  	      node.supertype = this.flowParseTypeInitialiser(14);
  	    }

  	    node.impltype = null;

  	    if (!declare) {
  	      node.impltype = this.flowParseTypeInitialiser(29);
  	    }

  	    this.semicolon();
  	    return this.finishNode(node, "OpaqueType");
  	  }

  	  flowParseTypeParameter(requireDefault = false) {
  	    const nodeStartLoc = this.state.startLoc;
  	    const node = this.startNode();
  	    const variance = this.flowParseVariance();
  	    const ident = this.flowParseTypeAnnotatableIdentifier();
  	    node.name = ident.name;
  	    node.variance = variance;
  	    node.bound = ident.typeAnnotation;

  	    if (this.match(29)) {
  	      this.eat(29);
  	      node.default = this.flowParseType();
  	    } else {
  	      if (requireDefault) {
  	        this.raise(FlowErrors.MissingTypeParamDefault, {
  	          at: nodeStartLoc
  	        });
  	      }
  	    }

  	    return this.finishNode(node, "TypeParameter");
  	  }

  	  flowParseTypeParameterDeclaration() {
  	    const oldInType = this.state.inType;
  	    const node = this.startNode();
  	    node.params = [];
  	    this.state.inType = true;

  	    if (this.match(47) || this.match(138)) {
  	      this.next();
  	    } else {
  	      this.unexpected();
  	    }

  	    let defaultRequired = false;

  	    do {
  	      const typeParameter = this.flowParseTypeParameter(defaultRequired);
  	      node.params.push(typeParameter);

  	      if (typeParameter.default) {
  	        defaultRequired = true;
  	      }

  	      if (!this.match(48)) {
  	        this.expect(12);
  	      }
  	    } while (!this.match(48));

  	    this.expect(48);
  	    this.state.inType = oldInType;
  	    return this.finishNode(node, "TypeParameterDeclaration");
  	  }

  	  flowParseTypeParameterInstantiation() {
  	    const node = this.startNode();
  	    const oldInType = this.state.inType;
  	    node.params = [];
  	    this.state.inType = true;
  	    this.expect(47);
  	    const oldNoAnonFunctionType = this.state.noAnonFunctionType;
  	    this.state.noAnonFunctionType = false;

  	    while (!this.match(48)) {
  	      node.params.push(this.flowParseType());

  	      if (!this.match(48)) {
  	        this.expect(12);
  	      }
  	    }

  	    this.state.noAnonFunctionType = oldNoAnonFunctionType;
  	    this.expect(48);
  	    this.state.inType = oldInType;
  	    return this.finishNode(node, "TypeParameterInstantiation");
  	  }

  	  flowParseTypeParameterInstantiationCallOrNew() {
  	    const node = this.startNode();
  	    const oldInType = this.state.inType;
  	    node.params = [];
  	    this.state.inType = true;
  	    this.expect(47);

  	    while (!this.match(48)) {
  	      node.params.push(this.flowParseTypeOrImplicitInstantiation());

  	      if (!this.match(48)) {
  	        this.expect(12);
  	      }
  	    }

  	    this.expect(48);
  	    this.state.inType = oldInType;
  	    return this.finishNode(node, "TypeParameterInstantiation");
  	  }

  	  flowParseInterfaceType() {
  	    const node = this.startNode();
  	    this.expectContextual(125);
  	    node.extends = [];

  	    if (this.eat(81)) {
  	      do {
  	        node.extends.push(this.flowParseInterfaceExtends());
  	      } while (this.eat(12));
  	    }

  	    node.body = this.flowParseObjectType({
  	      allowStatic: false,
  	      allowExact: false,
  	      allowSpread: false,
  	      allowProto: false,
  	      allowInexact: false
  	    });
  	    return this.finishNode(node, "InterfaceTypeAnnotation");
  	  }

  	  flowParseObjectPropertyKey() {
  	    return this.match(130) || this.match(129) ? super.parseExprAtom() : this.parseIdentifier(true);
  	  }

  	  flowParseObjectTypeIndexer(node, isStatic, variance) {
  	    node.static = isStatic;

  	    if (this.lookahead().type === 14) {
  	      node.id = this.flowParseObjectPropertyKey();
  	      node.key = this.flowParseTypeInitialiser();
  	    } else {
  	      node.id = null;
  	      node.key = this.flowParseType();
  	    }

  	    this.expect(3);
  	    node.value = this.flowParseTypeInitialiser();
  	    node.variance = variance;
  	    return this.finishNode(node, "ObjectTypeIndexer");
  	  }

  	  flowParseObjectTypeInternalSlot(node, isStatic) {
  	    node.static = isStatic;
  	    node.id = this.flowParseObjectPropertyKey();
  	    this.expect(3);
  	    this.expect(3);

  	    if (this.match(47) || this.match(10)) {
  	      node.method = true;
  	      node.optional = false;
  	      node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
  	    } else {
  	      node.method = false;

  	      if (this.eat(17)) {
  	        node.optional = true;
  	      }

  	      node.value = this.flowParseTypeInitialiser();
  	    }

  	    return this.finishNode(node, "ObjectTypeInternalSlot");
  	  }

  	  flowParseObjectTypeMethodish(node) {
  	    node.params = [];
  	    node.rest = null;
  	    node.typeParameters = null;
  	    node.this = null;

  	    if (this.match(47)) {
  	      node.typeParameters = this.flowParseTypeParameterDeclaration();
  	    }

  	    this.expect(10);

  	    if (this.match(78)) {
  	      node.this = this.flowParseFunctionTypeParam(true);
  	      node.this.name = null;

  	      if (!this.match(11)) {
  	        this.expect(12);
  	      }
  	    }

  	    while (!this.match(11) && !this.match(21)) {
  	      node.params.push(this.flowParseFunctionTypeParam(false));

  	      if (!this.match(11)) {
  	        this.expect(12);
  	      }
  	    }

  	    if (this.eat(21)) {
  	      node.rest = this.flowParseFunctionTypeParam(false);
  	    }

  	    this.expect(11);
  	    node.returnType = this.flowParseTypeInitialiser();
  	    return this.finishNode(node, "FunctionTypeAnnotation");
  	  }

  	  flowParseObjectTypeCallProperty(node, isStatic) {
  	    const valueNode = this.startNode();
  	    node.static = isStatic;
  	    node.value = this.flowParseObjectTypeMethodish(valueNode);
  	    return this.finishNode(node, "ObjectTypeCallProperty");
  	  }

  	  flowParseObjectType({
  	    allowStatic,
  	    allowExact,
  	    allowSpread,
  	    allowProto,
  	    allowInexact
  	  }) {
  	    const oldInType = this.state.inType;
  	    this.state.inType = true;
  	    const nodeStart = this.startNode();
  	    nodeStart.callProperties = [];
  	    nodeStart.properties = [];
  	    nodeStart.indexers = [];
  	    nodeStart.internalSlots = [];
  	    let endDelim;
  	    let exact;
  	    let inexact = false;

  	    if (allowExact && this.match(6)) {
  	      this.expect(6);
  	      endDelim = 9;
  	      exact = true;
  	    } else {
  	      this.expect(5);
  	      endDelim = 8;
  	      exact = false;
  	    }

  	    nodeStart.exact = exact;

  	    while (!this.match(endDelim)) {
  	      let isStatic = false;
  	      let protoStartLoc = null;
  	      let inexactStartLoc = null;
  	      const node = this.startNode();

  	      if (allowProto && this.isContextual(115)) {
  	        const lookahead = this.lookahead();

  	        if (lookahead.type !== 14 && lookahead.type !== 17) {
  	          this.next();
  	          protoStartLoc = this.state.startLoc;
  	          allowStatic = false;
  	        }
  	      }

  	      if (allowStatic && this.isContextual(104)) {
  	        const lookahead = this.lookahead();

  	        if (lookahead.type !== 14 && lookahead.type !== 17) {
  	          this.next();
  	          isStatic = true;
  	        }
  	      }

  	      const variance = this.flowParseVariance();

  	      if (this.eat(0)) {
  	        if (protoStartLoc != null) {
  	          this.unexpected(protoStartLoc);
  	        }

  	        if (this.eat(0)) {
  	          if (variance) {
  	            this.unexpected(variance.loc.start);
  	          }

  	          nodeStart.internalSlots.push(this.flowParseObjectTypeInternalSlot(node, isStatic));
  	        } else {
  	          nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
  	        }
  	      } else if (this.match(10) || this.match(47)) {
  	        if (protoStartLoc != null) {
  	          this.unexpected(protoStartLoc);
  	        }

  	        if (variance) {
  	          this.unexpected(variance.loc.start);
  	        }

  	        nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
  	      } else {
  	        let kind = "init";

  	        if (this.isContextual(98) || this.isContextual(103)) {
  	          const lookahead = this.lookahead();

  	          if (tokenIsLiteralPropertyName(lookahead.type)) {
  	            kind = this.state.value;
  	            this.next();
  	          }
  	        }

  	        const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact != null ? allowInexact : !exact);

  	        if (propOrInexact === null) {
  	          inexact = true;
  	          inexactStartLoc = this.state.lastTokStartLoc;
  	        } else {
  	          nodeStart.properties.push(propOrInexact);
  	        }
  	      }

  	      this.flowObjectTypeSemicolon();

  	      if (inexactStartLoc && !this.match(8) && !this.match(9)) {
  	        this.raise(FlowErrors.UnexpectedExplicitInexactInObject, {
  	          at: inexactStartLoc
  	        });
  	      }
  	    }

  	    this.expect(endDelim);

  	    if (allowSpread) {
  	      nodeStart.inexact = inexact;
  	    }

  	    const out = this.finishNode(nodeStart, "ObjectTypeAnnotation");
  	    this.state.inType = oldInType;
  	    return out;
  	  }

  	  flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact) {
  	    if (this.eat(21)) {
  	      const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);

  	      if (isInexactToken) {
  	        if (!allowSpread) {
  	          this.raise(FlowErrors.InexactInsideNonObject, {
  	            at: this.state.lastTokStartLoc
  	          });
  	        } else if (!allowInexact) {
  	          this.raise(FlowErrors.InexactInsideExact, {
  	            at: this.state.lastTokStartLoc
  	          });
  	        }

  	        if (variance) {
  	          this.raise(FlowErrors.InexactVariance, {
  	            at: variance
  	          });
  	        }

  	        return null;
  	      }

  	      if (!allowSpread) {
  	        this.raise(FlowErrors.UnexpectedSpreadType, {
  	          at: this.state.lastTokStartLoc
  	        });
  	      }

  	      if (protoStartLoc != null) {
  	        this.unexpected(protoStartLoc);
  	      }

  	      if (variance) {
  	        this.raise(FlowErrors.SpreadVariance, {
  	          at: variance
  	        });
  	      }

  	      node.argument = this.flowParseType();
  	      return this.finishNode(node, "ObjectTypeSpreadProperty");
  	    } else {
  	      node.key = this.flowParseObjectPropertyKey();
  	      node.static = isStatic;
  	      node.proto = protoStartLoc != null;
  	      node.kind = kind;
  	      let optional = false;

  	      if (this.match(47) || this.match(10)) {
  	        node.method = true;

  	        if (protoStartLoc != null) {
  	          this.unexpected(protoStartLoc);
  	        }

  	        if (variance) {
  	          this.unexpected(variance.loc.start);
  	        }

  	        node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));

  	        if (kind === "get" || kind === "set") {
  	          this.flowCheckGetterSetterParams(node);
  	        }

  	        if (!allowSpread && node.key.name === "constructor" && node.value.this) {
  	          this.raise(FlowErrors.ThisParamBannedInConstructor, {
  	            at: node.value.this
  	          });
  	        }
  	      } else {
  	        if (kind !== "init") this.unexpected();
  	        node.method = false;

  	        if (this.eat(17)) {
  	          optional = true;
  	        }

  	        node.value = this.flowParseTypeInitialiser();
  	        node.variance = variance;
  	      }

  	      node.optional = optional;
  	      return this.finishNode(node, "ObjectTypeProperty");
  	    }
  	  }

  	  flowCheckGetterSetterParams(property) {
  	    const paramCount = property.kind === "get" ? 0 : 1;
  	    const length = property.value.params.length + (property.value.rest ? 1 : 0);

  	    if (property.value.this) {
  	      this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, {
  	        at: property.value.this
  	      });
  	    }

  	    if (length !== paramCount) {
  	      this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
  	        at: property
  	      });
  	    }

  	    if (property.kind === "set" && property.value.rest) {
  	      this.raise(Errors.BadSetterRestParameter, {
  	        at: property
  	      });
  	    }
  	  }

  	  flowObjectTypeSemicolon() {
  	    if (!this.eat(13) && !this.eat(12) && !this.match(8) && !this.match(9)) {
  	      this.unexpected();
  	    }
  	  }

  	  flowParseQualifiedTypeIdentifier(startPos, startLoc, id) {
  	    startPos = startPos || this.state.start;
  	    startLoc = startLoc || this.state.startLoc;
  	    let node = id || this.flowParseRestrictedIdentifier(true);

  	    while (this.eat(16)) {
  	      const node2 = this.startNodeAt(startPos, startLoc);
  	      node2.qualification = node;
  	      node2.id = this.flowParseRestrictedIdentifier(true);
  	      node = this.finishNode(node2, "QualifiedTypeIdentifier");
  	    }

  	    return node;
  	  }

  	  flowParseGenericType(startPos, startLoc, id) {
  	    const node = this.startNodeAt(startPos, startLoc);
  	    node.typeParameters = null;
  	    node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id);

  	    if (this.match(47)) {
  	      node.typeParameters = this.flowParseTypeParameterInstantiation();
  	    }

  	    return this.finishNode(node, "GenericTypeAnnotation");
  	  }

  	  flowParseTypeofType() {
  	    const node = this.startNode();
  	    this.expect(87);
  	    node.argument = this.flowParsePrimaryType();
  	    return this.finishNode(node, "TypeofTypeAnnotation");
  	  }

  	  flowParseTupleType() {
  	    const node = this.startNode();
  	    node.types = [];
  	    this.expect(0);

  	    while (this.state.pos < this.length && !this.match(3)) {
  	      node.types.push(this.flowParseType());
  	      if (this.match(3)) break;
  	      this.expect(12);
  	    }

  	    this.expect(3);
  	    return this.finishNode(node, "TupleTypeAnnotation");
  	  }

  	  flowParseFunctionTypeParam(first) {
  	    let name = null;
  	    let optional = false;
  	    let typeAnnotation = null;
  	    const node = this.startNode();
  	    const lh = this.lookahead();
  	    const isThis = this.state.type === 78;

  	    if (lh.type === 14 || lh.type === 17) {
  	      if (isThis && !first) {
  	        this.raise(FlowErrors.ThisParamMustBeFirst, {
  	          at: node
  	        });
  	      }

  	      name = this.parseIdentifier(isThis);

  	      if (this.eat(17)) {
  	        optional = true;

  	        if (isThis) {
  	          this.raise(FlowErrors.ThisParamMayNotBeOptional, {
  	            at: node
  	          });
  	        }
  	      }

  	      typeAnnotation = this.flowParseTypeInitialiser();
  	    } else {
  	      typeAnnotation = this.flowParseType();
  	    }

  	    node.name = name;
  	    node.optional = optional;
  	    node.typeAnnotation = typeAnnotation;
  	    return this.finishNode(node, "FunctionTypeParam");
  	  }

  	  reinterpretTypeAsFunctionTypeParam(type) {
  	    const node = this.startNodeAt(type.start, type.loc.start);
  	    node.name = null;
  	    node.optional = false;
  	    node.typeAnnotation = type;
  	    return this.finishNode(node, "FunctionTypeParam");
  	  }

  	  flowParseFunctionTypeParams(params = []) {
  	    let rest = null;
  	    let _this = null;

  	    if (this.match(78)) {
  	      _this = this.flowParseFunctionTypeParam(true);
  	      _this.name = null;

  	      if (!this.match(11)) {
  	        this.expect(12);
  	      }
  	    }

  	    while (!this.match(11) && !this.match(21)) {
  	      params.push(this.flowParseFunctionTypeParam(false));

  	      if (!this.match(11)) {
  	        this.expect(12);
  	      }
  	    }

  	    if (this.eat(21)) {
  	      rest = this.flowParseFunctionTypeParam(false);
  	    }

  	    return {
  	      params,
  	      rest,
  	      _this
  	    };
  	  }

  	  flowIdentToTypeAnnotation(startPos, startLoc, node, id) {
  	    switch (id.name) {
  	      case "any":
  	        return this.finishNode(node, "AnyTypeAnnotation");

  	      case "bool":
  	      case "boolean":
  	        return this.finishNode(node, "BooleanTypeAnnotation");

  	      case "mixed":
  	        return this.finishNode(node, "MixedTypeAnnotation");

  	      case "empty":
  	        return this.finishNode(node, "EmptyTypeAnnotation");

  	      case "number":
  	        return this.finishNode(node, "NumberTypeAnnotation");

  	      case "string":
  	        return this.finishNode(node, "StringTypeAnnotation");

  	      case "symbol":
  	        return this.finishNode(node, "SymbolTypeAnnotation");

  	      default:
  	        this.checkNotUnderscore(id.name);
  	        return this.flowParseGenericType(startPos, startLoc, id);
  	    }
  	  }

  	  flowParsePrimaryType() {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    const node = this.startNode();
  	    let tmp;
  	    let type;
  	    let isGroupedType = false;
  	    const oldNoAnonFunctionType = this.state.noAnonFunctionType;

  	    switch (this.state.type) {
  	      case 5:
  	        return this.flowParseObjectType({
  	          allowStatic: false,
  	          allowExact: false,
  	          allowSpread: true,
  	          allowProto: false,
  	          allowInexact: true
  	        });

  	      case 6:
  	        return this.flowParseObjectType({
  	          allowStatic: false,
  	          allowExact: true,
  	          allowSpread: true,
  	          allowProto: false,
  	          allowInexact: false
  	        });

  	      case 0:
  	        this.state.noAnonFunctionType = false;
  	        type = this.flowParseTupleType();
  	        this.state.noAnonFunctionType = oldNoAnonFunctionType;
  	        return type;

  	      case 47:
  	        node.typeParameters = this.flowParseTypeParameterDeclaration();
  	        this.expect(10);
  	        tmp = this.flowParseFunctionTypeParams();
  	        node.params = tmp.params;
  	        node.rest = tmp.rest;
  	        node.this = tmp._this;
  	        this.expect(11);
  	        this.expect(19);
  	        node.returnType = this.flowParseType();
  	        return this.finishNode(node, "FunctionTypeAnnotation");

  	      case 10:
  	        this.next();

  	        if (!this.match(11) && !this.match(21)) {
  	          if (tokenIsIdentifier(this.state.type) || this.match(78)) {
  	            const token = this.lookahead().type;
  	            isGroupedType = token !== 17 && token !== 14;
  	          } else {
  	            isGroupedType = true;
  	          }
  	        }

  	        if (isGroupedType) {
  	          this.state.noAnonFunctionType = false;
  	          type = this.flowParseType();
  	          this.state.noAnonFunctionType = oldNoAnonFunctionType;

  	          if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
  	            this.expect(11);
  	            return type;
  	          } else {
  	            this.eat(12);
  	          }
  	        }

  	        if (type) {
  	          tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
  	        } else {
  	          tmp = this.flowParseFunctionTypeParams();
  	        }

  	        node.params = tmp.params;
  	        node.rest = tmp.rest;
  	        node.this = tmp._this;
  	        this.expect(11);
  	        this.expect(19);
  	        node.returnType = this.flowParseType();
  	        node.typeParameters = null;
  	        return this.finishNode(node, "FunctionTypeAnnotation");

  	      case 129:
  	        return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");

  	      case 85:
  	      case 86:
  	        node.value = this.match(85);
  	        this.next();
  	        return this.finishNode(node, "BooleanLiteralTypeAnnotation");

  	      case 53:
  	        if (this.state.value === "-") {
  	          this.next();

  	          if (this.match(130)) {
  	            return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
  	          }

  	          if (this.match(131)) {
  	            return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
  	          }

  	          throw this.raise(FlowErrors.UnexpectedSubtractionOperand, {
  	            at: this.state.startLoc
  	          });
  	        }

  	        throw this.unexpected();

  	      case 130:
  	        return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");

  	      case 131:
  	        return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");

  	      case 88:
  	        this.next();
  	        return this.finishNode(node, "VoidTypeAnnotation");

  	      case 84:
  	        this.next();
  	        return this.finishNode(node, "NullLiteralTypeAnnotation");

  	      case 78:
  	        this.next();
  	        return this.finishNode(node, "ThisTypeAnnotation");

  	      case 55:
  	        this.next();
  	        return this.finishNode(node, "ExistsTypeAnnotation");

  	      case 87:
  	        return this.flowParseTypeofType();

  	      default:
  	        if (tokenIsKeyword(this.state.type)) {
  	          const label = tokenLabelName(this.state.type);
  	          this.next();
  	          return super.createIdentifier(node, label);
  	        } else if (tokenIsIdentifier(this.state.type)) {
  	          if (this.isContextual(125)) {
  	            return this.flowParseInterfaceType();
  	          }

  	          return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier());
  	        }

  	    }

  	    throw this.unexpected();
  	  }

  	  flowParsePostfixType() {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    let type = this.flowParsePrimaryType();
  	    let seenOptionalIndexedAccess = false;

  	    while ((this.match(0) || this.match(18)) && !this.canInsertSemicolon()) {
  	      const node = this.startNodeAt(startPos, startLoc);
  	      const optional = this.eat(18);
  	      seenOptionalIndexedAccess = seenOptionalIndexedAccess || optional;
  	      this.expect(0);

  	      if (!optional && this.match(3)) {
  	        node.elementType = type;
  	        this.next();
  	        type = this.finishNode(node, "ArrayTypeAnnotation");
  	      } else {
  	        node.objectType = type;
  	        node.indexType = this.flowParseType();
  	        this.expect(3);

  	        if (seenOptionalIndexedAccess) {
  	          node.optional = optional;
  	          type = this.finishNode(node, "OptionalIndexedAccessType");
  	        } else {
  	          type = this.finishNode(node, "IndexedAccessType");
  	        }
  	      }
  	    }

  	    return type;
  	  }

  	  flowParsePrefixType() {
  	    const node = this.startNode();

  	    if (this.eat(17)) {
  	      node.typeAnnotation = this.flowParsePrefixType();
  	      return this.finishNode(node, "NullableTypeAnnotation");
  	    } else {
  	      return this.flowParsePostfixType();
  	    }
  	  }

  	  flowParseAnonFunctionWithoutParens() {
  	    const param = this.flowParsePrefixType();

  	    if (!this.state.noAnonFunctionType && this.eat(19)) {
  	      const node = this.startNodeAt(param.start, param.loc.start);
  	      node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
  	      node.rest = null;
  	      node.this = null;
  	      node.returnType = this.flowParseType();
  	      node.typeParameters = null;
  	      return this.finishNode(node, "FunctionTypeAnnotation");
  	    }

  	    return param;
  	  }

  	  flowParseIntersectionType() {
  	    const node = this.startNode();
  	    this.eat(45);
  	    const type = this.flowParseAnonFunctionWithoutParens();
  	    node.types = [type];

  	    while (this.eat(45)) {
  	      node.types.push(this.flowParseAnonFunctionWithoutParens());
  	    }

  	    return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
  	  }

  	  flowParseUnionType() {
  	    const node = this.startNode();
  	    this.eat(43);
  	    const type = this.flowParseIntersectionType();
  	    node.types = [type];

  	    while (this.eat(43)) {
  	      node.types.push(this.flowParseIntersectionType());
  	    }

  	    return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation");
  	  }

  	  flowParseType() {
  	    const oldInType = this.state.inType;
  	    this.state.inType = true;
  	    const type = this.flowParseUnionType();
  	    this.state.inType = oldInType;
  	    return type;
  	  }

  	  flowParseTypeOrImplicitInstantiation() {
  	    if (this.state.type === 128 && this.state.value === "_") {
  	      const startPos = this.state.start;
  	      const startLoc = this.state.startLoc;
  	      const node = this.parseIdentifier();
  	      return this.flowParseGenericType(startPos, startLoc, node);
  	    } else {
  	      return this.flowParseType();
  	    }
  	  }

  	  flowParseTypeAnnotation() {
  	    const node = this.startNode();
  	    node.typeAnnotation = this.flowParseTypeInitialiser();
  	    return this.finishNode(node, "TypeAnnotation");
  	  }

  	  flowParseTypeAnnotatableIdentifier(allowPrimitiveOverride) {
  	    const ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier();

  	    if (this.match(14)) {
  	      ident.typeAnnotation = this.flowParseTypeAnnotation();
  	      this.resetEndLocation(ident);
  	    }

  	    return ident;
  	  }

  	  typeCastToParameter(node) {
  	    node.expression.typeAnnotation = node.typeAnnotation;
  	    this.resetEndLocation(node.expression, node.typeAnnotation.loc.end);
  	    return node.expression;
  	  }

  	  flowParseVariance() {
  	    let variance = null;

  	    if (this.match(53)) {
  	      variance = this.startNode();

  	      if (this.state.value === "+") {
  	        variance.kind = "plus";
  	      } else {
  	        variance.kind = "minus";
  	      }

  	      this.next();
  	      return this.finishNode(variance, "Variance");
  	    }

  	    return variance;
  	  }

  	  parseFunctionBody(node, allowExpressionBody, isMethod = false) {
  	    if (allowExpressionBody) {
  	      return this.forwardNoArrowParamsConversionAt(node, () => super.parseFunctionBody(node, true, isMethod));
  	    }

  	    return super.parseFunctionBody(node, false, isMethod);
  	  }

  	  parseFunctionBodyAndFinish(node, type, isMethod = false) {
  	    if (this.match(14)) {
  	      const typeNode = this.startNode();
  	      [typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
  	      node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
  	    }

  	    return super.parseFunctionBodyAndFinish(node, type, isMethod);
  	  }

  	  parseStatement(context, topLevel) {
  	    if (this.state.strict && this.isContextual(125)) {
  	      const lookahead = this.lookahead();

  	      if (tokenIsKeywordOrIdentifier(lookahead.type)) {
  	        const node = this.startNode();
  	        this.next();
  	        return this.flowParseInterface(node);
  	      }
  	    } else if (this.shouldParseEnums() && this.isContextual(122)) {
  	      const node = this.startNode();
  	      this.next();
  	      return this.flowParseEnumDeclaration(node);
  	    }

  	    const stmt = super.parseStatement(context, topLevel);

  	    if (this.flowPragma === undefined && !this.isValidDirective(stmt)) {
  	      this.flowPragma = null;
  	    }

  	    return stmt;
  	  }

  	  parseExpressionStatement(node, expr) {
  	    if (expr.type === "Identifier") {
  	      if (expr.name === "declare") {
  	        if (this.match(80) || tokenIsIdentifier(this.state.type) || this.match(68) || this.match(74) || this.match(82)) {
  	          return this.flowParseDeclare(node);
  	        }
  	      } else if (tokenIsIdentifier(this.state.type)) {
  	        if (expr.name === "interface") {
  	          return this.flowParseInterface(node);
  	        } else if (expr.name === "type") {
  	          return this.flowParseTypeAlias(node);
  	        } else if (expr.name === "opaque") {
  	          return this.flowParseOpaqueType(node, false);
  	        }
  	      }
  	    }

  	    return super.parseExpressionStatement(node, expr);
  	  }

  	  shouldParseExportDeclaration() {
  	    const {
  	      type
  	    } = this.state;

  	    if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 122) {
  	      return !this.state.containsEsc;
  	    }

  	    return super.shouldParseExportDeclaration();
  	  }

  	  isExportDefaultSpecifier() {
  	    const {
  	      type
  	    } = this.state;

  	    if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 122) {
  	      return this.state.containsEsc;
  	    }

  	    return super.isExportDefaultSpecifier();
  	  }

  	  parseExportDefaultExpression() {
  	    if (this.shouldParseEnums() && this.isContextual(122)) {
  	      const node = this.startNode();
  	      this.next();
  	      return this.flowParseEnumDeclaration(node);
  	    }

  	    return super.parseExportDefaultExpression();
  	  }

  	  parseConditional(expr, startPos, startLoc, refExpressionErrors) {
  	    if (!this.match(17)) return expr;

  	    if (this.state.maybeInArrowParameters) {
  	      const nextCh = this.lookaheadCharCode();

  	      if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) {
  	        this.setOptionalParametersError(refExpressionErrors);
  	        return expr;
  	      }
  	    }

  	    this.expect(17);
  	    const state = this.state.clone();
  	    const originalNoArrowAt = this.state.noArrowAt;
  	    const node = this.startNodeAt(startPos, startLoc);
  	    let {
  	      consequent,
  	      failed
  	    } = this.tryParseConditionalConsequent();
  	    let [valid, invalid] = this.getArrowLikeExpressions(consequent);

  	    if (failed || invalid.length > 0) {
  	      const noArrowAt = [...originalNoArrowAt];

  	      if (invalid.length > 0) {
  	        this.state = state;
  	        this.state.noArrowAt = noArrowAt;

  	        for (let i = 0; i < invalid.length; i++) {
  	          noArrowAt.push(invalid[i].start);
  	        }

  	        ({
  	          consequent,
  	          failed
  	        } = this.tryParseConditionalConsequent());
  	        [valid, invalid] = this.getArrowLikeExpressions(consequent);
  	      }

  	      if (failed && valid.length > 1) {
  	        this.raise(FlowErrors.AmbiguousConditionalArrow, {
  	          at: state.startLoc
  	        });
  	      }

  	      if (failed && valid.length === 1) {
  	        this.state = state;
  	        noArrowAt.push(valid[0].start);
  	        this.state.noArrowAt = noArrowAt;
  	        ({
  	          consequent,
  	          failed
  	        } = this.tryParseConditionalConsequent());
  	      }
  	    }

  	    this.getArrowLikeExpressions(consequent, true);
  	    this.state.noArrowAt = originalNoArrowAt;
  	    this.expect(14);
  	    node.test = expr;
  	    node.consequent = consequent;
  	    node.alternate = this.forwardNoArrowParamsConversionAt(node, () => this.parseMaybeAssign(undefined, undefined));
  	    return this.finishNode(node, "ConditionalExpression");
  	  }

  	  tryParseConditionalConsequent() {
  	    this.state.noArrowParamsConversionAt.push(this.state.start);
  	    const consequent = this.parseMaybeAssignAllowIn();
  	    const failed = !this.match(14);
  	    this.state.noArrowParamsConversionAt.pop();
  	    return {
  	      consequent,
  	      failed
  	    };
  	  }

  	  getArrowLikeExpressions(node, disallowInvalid) {
  	    const stack = [node];
  	    const arrows = [];

  	    while (stack.length !== 0) {
  	      const node = stack.pop();

  	      if (node.type === "ArrowFunctionExpression") {
  	        if (node.typeParameters || !node.returnType) {
  	          this.finishArrowValidation(node);
  	        } else {
  	          arrows.push(node);
  	        }

  	        stack.push(node.body);
  	      } else if (node.type === "ConditionalExpression") {
  	        stack.push(node.consequent);
  	        stack.push(node.alternate);
  	      }
  	    }

  	    if (disallowInvalid) {
  	      arrows.forEach(node => this.finishArrowValidation(node));
  	      return [arrows, []];
  	    }

  	    return partition(arrows, node => node.params.every(param => this.isAssignable(param, true)));
  	  }

  	  finishArrowValidation(node) {
  	    var _node$extra;

  	    this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
  	    this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
  	    super.checkParams(node, false, true);
  	    this.scope.exit();
  	  }

  	  forwardNoArrowParamsConversionAt(node, parse) {
  	    let result;

  	    if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
  	      this.state.noArrowParamsConversionAt.push(this.state.start);
  	      result = parse();
  	      this.state.noArrowParamsConversionAt.pop();
  	    } else {
  	      result = parse();
  	    }

  	    return result;
  	  }

  	  parseParenItem(node, startPos, startLoc) {
  	    node = super.parseParenItem(node, startPos, startLoc);

  	    if (this.eat(17)) {
  	      node.optional = true;
  	      this.resetEndLocation(node);
  	    }

  	    if (this.match(14)) {
  	      const typeCastNode = this.startNodeAt(startPos, startLoc);
  	      typeCastNode.expression = node;
  	      typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
  	      return this.finishNode(typeCastNode, "TypeCastExpression");
  	    }

  	    return node;
  	  }

  	  assertModuleNodeAllowed(node) {
  	    if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
  	      return;
  	    }

  	    super.assertModuleNodeAllowed(node);
  	  }

  	  parseExport(node) {
  	    const decl = super.parseExport(node);

  	    if (decl.type === "ExportNamedDeclaration" || decl.type === "ExportAllDeclaration") {
  	      decl.exportKind = decl.exportKind || "value";
  	    }

  	    return decl;
  	  }

  	  parseExportDeclaration(node) {
  	    if (this.isContextual(126)) {
  	      node.exportKind = "type";
  	      const declarationNode = this.startNode();
  	      this.next();

  	      if (this.match(5)) {
  	        node.specifiers = this.parseExportSpecifiers(true);
  	        super.parseExportFrom(node);
  	        return null;
  	      } else {
  	        return this.flowParseTypeAlias(declarationNode);
  	      }
  	    } else if (this.isContextual(127)) {
  	      node.exportKind = "type";
  	      const declarationNode = this.startNode();
  	      this.next();
  	      return this.flowParseOpaqueType(declarationNode, false);
  	    } else if (this.isContextual(125)) {
  	      node.exportKind = "type";
  	      const declarationNode = this.startNode();
  	      this.next();
  	      return this.flowParseInterface(declarationNode);
  	    } else if (this.shouldParseEnums() && this.isContextual(122)) {
  	      node.exportKind = "value";
  	      const declarationNode = this.startNode();
  	      this.next();
  	      return this.flowParseEnumDeclaration(declarationNode);
  	    } else {
  	      return super.parseExportDeclaration(node);
  	    }
  	  }

  	  eatExportStar(node) {
  	    if (super.eatExportStar(node)) return true;

  	    if (this.isContextual(126) && this.lookahead().type === 55) {
  	      node.exportKind = "type";
  	      this.next();
  	      this.next();
  	      return true;
  	    }

  	    return false;
  	  }

  	  maybeParseExportNamespaceSpecifier(node) {
  	    const {
  	      startLoc
  	    } = this.state;
  	    const hasNamespace = super.maybeParseExportNamespaceSpecifier(node);

  	    if (hasNamespace && node.exportKind === "type") {
  	      this.unexpected(startLoc);
  	    }

  	    return hasNamespace;
  	  }

  	  parseClassId(node, isStatement, optionalId) {
  	    super.parseClassId(node, isStatement, optionalId);

  	    if (this.match(47)) {
  	      node.typeParameters = this.flowParseTypeParameterDeclaration();
  	    }
  	  }

  	  parseClassMember(classBody, member, state) {
  	    const {
  	      startLoc
  	    } = this.state;

  	    if (this.isContextual(121)) {
  	      if (super.parseClassMemberFromModifier(classBody, member)) {
  	        return;
  	      }

  	      member.declare = true;
  	    }

  	    super.parseClassMember(classBody, member, state);

  	    if (member.declare) {
  	      if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
  	        this.raise(FlowErrors.DeclareClassElement, {
  	          at: startLoc
  	        });
  	      } else if (member.value) {
  	        this.raise(FlowErrors.DeclareClassFieldInitializer, {
  	          at: member.value
  	        });
  	      }
  	    }
  	  }

  	  isIterator(word) {
  	    return word === "iterator" || word === "asyncIterator";
  	  }

  	  readIterator() {
  	    const word = super.readWord1();
  	    const fullWord = "@@" + word;

  	    if (!this.isIterator(word) || !this.state.inType) {
  	      this.raise(Errors.InvalidIdentifier, {
  	        at: this.state.curPosition(),
  	        identifierName: fullWord
  	      });
  	    }

  	    this.finishToken(128, fullWord);
  	  }

  	  getTokenFromCode(code) {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (code === 123 && next === 124) {
  	      return this.finishOp(6, 2);
  	    } else if (this.state.inType && (code === 62 || code === 60)) {
  	      return this.finishOp(code === 62 ? 48 : 47, 1);
  	    } else if (this.state.inType && code === 63) {
  	      if (next === 46) {
  	        return this.finishOp(18, 2);
  	      }

  	      return this.finishOp(17, 1);
  	    } else if (isIteratorStart(code, next, this.input.charCodeAt(this.state.pos + 2))) {
  	      this.state.pos += 2;
  	      return this.readIterator();
  	    } else {
  	      return super.getTokenFromCode(code);
  	    }
  	  }

  	  isAssignable(node, isBinding) {
  	    if (node.type === "TypeCastExpression") {
  	      return this.isAssignable(node.expression, isBinding);
  	    } else {
  	      return super.isAssignable(node, isBinding);
  	    }
  	  }

  	  toAssignable(node, isLHS = false) {
  	    if (!isLHS && node.type === "AssignmentExpression" && node.left.type === "TypeCastExpression") {
  	      node.left = this.typeCastToParameter(node.left);
  	    }

  	    super.toAssignable(node, isLHS);
  	  }

  	  toAssignableList(exprList, trailingCommaLoc, isLHS) {
  	    for (let i = 0; i < exprList.length; i++) {
  	      const expr = exprList[i];

  	      if ((expr == null ? void 0 : expr.type) === "TypeCastExpression") {
  	        exprList[i] = this.typeCastToParameter(expr);
  	      }
  	    }

  	    super.toAssignableList(exprList, trailingCommaLoc, isLHS);
  	  }

  	  toReferencedList(exprList, isParenthesizedExpr) {
  	    for (let i = 0; i < exprList.length; i++) {
  	      var _expr$extra;

  	      const expr = exprList[i];

  	      if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
  	        this.raise(FlowErrors.TypeCastInPattern, {
  	          at: expr.typeAnnotation
  	        });
  	      }
  	    }

  	    return exprList;
  	  }

  	  parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
  	    const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);

  	    if (canBePattern && !this.state.maybeInArrowParameters) {
  	      this.toReferencedList(node.elements);
  	    }

  	    return node;
  	  }

  	  isValidLVal(type, ...rest) {
  	    return type === "TypeCastExpression" || super.isValidLVal(type, ...rest);
  	  }

  	  parseClassProperty(node) {
  	    if (this.match(14)) {
  	      node.typeAnnotation = this.flowParseTypeAnnotation();
  	    }

  	    return super.parseClassProperty(node);
  	  }

  	  parseClassPrivateProperty(node) {
  	    if (this.match(14)) {
  	      node.typeAnnotation = this.flowParseTypeAnnotation();
  	    }

  	    return super.parseClassPrivateProperty(node);
  	  }

  	  isClassMethod() {
  	    return this.match(47) || super.isClassMethod();
  	  }

  	  isClassProperty() {
  	    return this.match(14) || super.isClassProperty();
  	  }

  	  isNonstaticConstructor(method) {
  	    return !this.match(14) && super.isNonstaticConstructor(method);
  	  }

  	  pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
  	    if (method.variance) {
  	      this.unexpected(method.variance.loc.start);
  	    }

  	    delete method.variance;

  	    if (this.match(47)) {
  	      method.typeParameters = this.flowParseTypeParameterDeclaration();
  	    }

  	    super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);

  	    if (method.params && isConstructor) {
  	      const params = method.params;

  	      if (params.length > 0 && this.isThisParam(params[0])) {
  	        this.raise(FlowErrors.ThisParamBannedInConstructor, {
  	          at: method
  	        });
  	      }
  	    } else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
  	      const params = method.value.params;

  	      if (params.length > 0 && this.isThisParam(params[0])) {
  	        this.raise(FlowErrors.ThisParamBannedInConstructor, {
  	          at: method
  	        });
  	      }
  	    }
  	  }

  	  pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
  	    if (method.variance) {
  	      this.unexpected(method.variance.loc.start);
  	    }

  	    delete method.variance;

  	    if (this.match(47)) {
  	      method.typeParameters = this.flowParseTypeParameterDeclaration();
  	    }

  	    super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
  	  }

  	  parseClassSuper(node) {
  	    super.parseClassSuper(node);

  	    if (node.superClass && this.match(47)) {
  	      node.superTypeParameters = this.flowParseTypeParameterInstantiation();
  	    }

  	    if (this.isContextual(110)) {
  	      this.next();
  	      const implemented = node.implements = [];

  	      do {
  	        const node = this.startNode();
  	        node.id = this.flowParseRestrictedIdentifier(true);

  	        if (this.match(47)) {
  	          node.typeParameters = this.flowParseTypeParameterInstantiation();
  	        } else {
  	          node.typeParameters = null;
  	        }

  	        implemented.push(this.finishNode(node, "ClassImplements"));
  	      } while (this.eat(12));
  	    }
  	  }

  	  checkGetterSetterParams(method) {
  	    super.checkGetterSetterParams(method);
  	    const params = this.getObjectOrClassMethodParams(method);

  	    if (params.length > 0) {
  	      const param = params[0];

  	      if (this.isThisParam(param) && method.kind === "get") {
  	        this.raise(FlowErrors.GetterMayNotHaveThisParam, {
  	          at: param
  	        });
  	      } else if (this.isThisParam(param)) {
  	        this.raise(FlowErrors.SetterMayNotHaveThisParam, {
  	          at: param
  	        });
  	      }
  	    }
  	  }

  	  parsePropertyNamePrefixOperator(node) {
  	    node.variance = this.flowParseVariance();
  	  }

  	  parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
  	    if (prop.variance) {
  	      this.unexpected(prop.variance.loc.start);
  	    }

  	    delete prop.variance;
  	    let typeParameters;

  	    if (this.match(47) && !isAccessor) {
  	      typeParameters = this.flowParseTypeParameterDeclaration();
  	      if (!this.match(10)) this.unexpected();
  	    }

  	    const result = super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);

  	    if (typeParameters) {
  	      (result.value || result).typeParameters = typeParameters;
  	    }

  	    return result;
  	  }

  	  parseAssignableListItemTypes(param) {
  	    if (this.eat(17)) {
  	      if (param.type !== "Identifier") {
  	        this.raise(FlowErrors.PatternIsOptional, {
  	          at: param
  	        });
  	      }

  	      if (this.isThisParam(param)) {
  	        this.raise(FlowErrors.ThisParamMayNotBeOptional, {
  	          at: param
  	        });
  	      }

  	      param.optional = true;
  	    }

  	    if (this.match(14)) {
  	      param.typeAnnotation = this.flowParseTypeAnnotation();
  	    } else if (this.isThisParam(param)) {
  	      this.raise(FlowErrors.ThisParamAnnotationRequired, {
  	        at: param
  	      });
  	    }

  	    if (this.match(29) && this.isThisParam(param)) {
  	      this.raise(FlowErrors.ThisParamNoDefault, {
  	        at: param
  	      });
  	    }

  	    this.resetEndLocation(param);
  	    return param;
  	  }

  	  parseMaybeDefault(startPos, startLoc, left) {
  	    const node = super.parseMaybeDefault(startPos, startLoc, left);

  	    if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
  	      this.raise(FlowErrors.TypeBeforeInitializer, {
  	        at: node.typeAnnotation
  	      });
  	    }

  	    return node;
  	  }

  	  shouldParseDefaultImport(node) {
  	    if (!hasTypeImportKind(node)) {
  	      return super.shouldParseDefaultImport(node);
  	    }

  	    return isMaybeDefaultImport(this.state.type);
  	  }

  	  parseImportSpecifierLocal(node, specifier, type) {
  	    specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier();
  	    node.specifiers.push(this.finishImportSpecifier(specifier, type));
  	  }

  	  maybeParseDefaultImportSpecifier(node) {
  	    node.importKind = "value";
  	    let kind = null;

  	    if (this.match(87)) {
  	      kind = "typeof";
  	    } else if (this.isContextual(126)) {
  	      kind = "type";
  	    }

  	    if (kind) {
  	      const lh = this.lookahead();
  	      const {
  	        type
  	      } = lh;

  	      if (kind === "type" && type === 55) {
  	        this.unexpected(null, lh.type);
  	      }

  	      if (isMaybeDefaultImport(type) || type === 5 || type === 55) {
  	        this.next();
  	        node.importKind = kind;
  	      }
  	    }

  	    return super.maybeParseDefaultImportSpecifier(node);
  	  }

  	  parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
  	    const firstIdent = specifier.imported;
  	    let specifierTypeKind = null;

  	    if (firstIdent.type === "Identifier") {
  	      if (firstIdent.name === "type") {
  	        specifierTypeKind = "type";
  	      } else if (firstIdent.name === "typeof") {
  	        specifierTypeKind = "typeof";
  	      }
  	    }

  	    let isBinding = false;

  	    if (this.isContextual(93) && !this.isLookaheadContextual("as")) {
  	      const as_ident = this.parseIdentifier(true);

  	      if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) {
  	        specifier.imported = as_ident;
  	        specifier.importKind = specifierTypeKind;
  	        specifier.local = cloneIdentifier(as_ident);
  	      } else {
  	        specifier.imported = firstIdent;
  	        specifier.importKind = null;
  	        specifier.local = this.parseIdentifier();
  	      }
  	    } else {
  	      if (specifierTypeKind !== null && tokenIsKeywordOrIdentifier(this.state.type)) {
  	        specifier.imported = this.parseIdentifier(true);
  	        specifier.importKind = specifierTypeKind;
  	      } else {
  	        if (importedIsString) {
  	          throw this.raise(Errors.ImportBindingIsString, {
  	            at: specifier,
  	            importName: firstIdent.value
  	          });
  	        }

  	        specifier.imported = firstIdent;
  	        specifier.importKind = null;
  	      }

  	      if (this.eatContextual(93)) {
  	        specifier.local = this.parseIdentifier();
  	      } else {
  	        isBinding = true;
  	        specifier.local = cloneIdentifier(specifier.imported);
  	      }
  	    }

  	    const specifierIsTypeImport = hasTypeImportKind(specifier);

  	    if (isInTypeOnlyImport && specifierIsTypeImport) {
  	      this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, {
  	        at: specifier
  	      });
  	    }

  	    if (isInTypeOnlyImport || specifierIsTypeImport) {
  	      this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
  	    }

  	    if (isBinding && !isInTypeOnlyImport && !specifierIsTypeImport) {
  	      this.checkReservedWord(specifier.local.name, specifier.loc.start, true, true);
  	    }

  	    return this.finishImportSpecifier(specifier, "ImportSpecifier");
  	  }

  	  parseBindingAtom() {
  	    switch (this.state.type) {
  	      case 78:
  	        return this.parseIdentifier(true);

  	      default:
  	        return super.parseBindingAtom();
  	    }
  	  }

  	  parseFunctionParams(node, allowModifiers) {
  	    const kind = node.kind;

  	    if (kind !== "get" && kind !== "set" && this.match(47)) {
  	      node.typeParameters = this.flowParseTypeParameterDeclaration();
  	    }

  	    super.parseFunctionParams(node, allowModifiers);
  	  }

  	  parseVarId(decl, kind) {
  	    super.parseVarId(decl, kind);

  	    if (this.match(14)) {
  	      decl.id.typeAnnotation = this.flowParseTypeAnnotation();
  	      this.resetEndLocation(decl.id);
  	    }
  	  }

  	  parseAsyncArrowFromCallExpression(node, call) {
  	    if (this.match(14)) {
  	      const oldNoAnonFunctionType = this.state.noAnonFunctionType;
  	      this.state.noAnonFunctionType = true;
  	      node.returnType = this.flowParseTypeAnnotation();
  	      this.state.noAnonFunctionType = oldNoAnonFunctionType;
  	    }

  	    return super.parseAsyncArrowFromCallExpression(node, call);
  	  }

  	  shouldParseAsyncArrow() {
  	    return this.match(14) || super.shouldParseAsyncArrow();
  	  }

  	  parseMaybeAssign(refExpressionErrors, afterLeftParse) {
  	    var _jsx;

  	    let state = null;
  	    let jsx;

  	    if (this.hasPlugin("jsx") && (this.match(138) || this.match(47))) {
  	      state = this.state.clone();
  	      jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
  	      if (!jsx.error) return jsx.node;
  	      const {
  	        context
  	      } = this.state;
  	      const currentContext = context[context.length - 1];

  	      if (currentContext === types.j_oTag || currentContext === types.j_expr) {
  	        context.pop();
  	      }
  	    }

  	    if ((_jsx = jsx) != null && _jsx.error || this.match(47)) {
  	      var _jsx2, _jsx3;

  	      state = state || this.state.clone();
  	      let typeParameters;
  	      const arrow = this.tryParse(abort => {
  	        var _arrowExpression$extr;

  	        typeParameters = this.flowParseTypeParameterDeclaration();
  	        const arrowExpression = this.forwardNoArrowParamsConversionAt(typeParameters, () => {
  	          const result = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
  	          this.resetStartLocationFromNode(result, typeParameters);
  	          return result;
  	        });
  	        if ((_arrowExpression$extr = arrowExpression.extra) != null && _arrowExpression$extr.parenthesized) abort();
  	        const expr = this.maybeUnwrapTypeCastExpression(arrowExpression);
  	        if (expr.type !== "ArrowFunctionExpression") abort();
  	        expr.typeParameters = typeParameters;
  	        this.resetStartLocationFromNode(expr, typeParameters);
  	        return arrowExpression;
  	      }, state);
  	      let arrowExpression = null;

  	      if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
  	        if (!arrow.error && !arrow.aborted) {
  	          if (arrow.node.async) {
  	            this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, {
  	              at: typeParameters
  	            });
  	          }

  	          return arrow.node;
  	        }

  	        arrowExpression = arrow.node;
  	      }

  	      if ((_jsx2 = jsx) != null && _jsx2.node) {
  	        this.state = jsx.failState;
  	        return jsx.node;
  	      }

  	      if (arrowExpression) {
  	        this.state = arrow.failState;
  	        return arrowExpression;
  	      }

  	      if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
  	      if (arrow.thrown) throw arrow.error;
  	      throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, {
  	        at: typeParameters
  	      });
  	    }

  	    return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
  	  }

  	  parseArrow(node) {
  	    if (this.match(14)) {
  	      const result = this.tryParse(() => {
  	        const oldNoAnonFunctionType = this.state.noAnonFunctionType;
  	        this.state.noAnonFunctionType = true;
  	        const typeNode = this.startNode();
  	        [typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
  	        this.state.noAnonFunctionType = oldNoAnonFunctionType;
  	        if (this.canInsertSemicolon()) this.unexpected();
  	        if (!this.match(19)) this.unexpected();
  	        return typeNode;
  	      });
  	      if (result.thrown) return null;
  	      if (result.error) this.state = result.failState;
  	      node.returnType = result.node.typeAnnotation ? this.finishNode(result.node, "TypeAnnotation") : null;
  	    }

  	    return super.parseArrow(node);
  	  }

  	  shouldParseArrow(params) {
  	    return this.match(14) || super.shouldParseArrow(params);
  	  }

  	  setArrowFunctionParameters(node, params) {
  	    if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
  	      node.params = params;
  	    } else {
  	      super.setArrowFunctionParameters(node, params);
  	    }
  	  }

  	  checkParams(node, allowDuplicates, isArrowFunction) {
  	    if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
  	      return;
  	    }

  	    for (let i = 0; i < node.params.length; i++) {
  	      if (this.isThisParam(node.params[i]) && i > 0) {
  	        this.raise(FlowErrors.ThisParamMustBeFirst, {
  	          at: node.params[i]
  	        });
  	      }
  	    }

  	    return super.checkParams(node, allowDuplicates, isArrowFunction);
  	  }

  	  parseParenAndDistinguishExpression(canBeArrow) {
  	    return super.parseParenAndDistinguishExpression(canBeArrow && this.state.noArrowAt.indexOf(this.state.start) === -1);
  	  }

  	  parseSubscripts(base, startPos, startLoc, noCalls) {
  	    if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.indexOf(startPos) !== -1) {
  	      this.next();
  	      const node = this.startNodeAt(startPos, startLoc);
  	      node.callee = base;
  	      node.arguments = super.parseCallExpressionArguments(11, false);
  	      base = this.finishNode(node, "CallExpression");
  	    } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
  	      const state = this.state.clone();
  	      const arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || abort(), state);
  	      if (!arrow.error && !arrow.aborted) return arrow.node;
  	      const result = this.tryParse(() => super.parseSubscripts(base, startPos, startLoc, noCalls), state);
  	      if (result.node && !result.error) return result.node;

  	      if (arrow.node) {
  	        this.state = arrow.failState;
  	        return arrow.node;
  	      }

  	      if (result.node) {
  	        this.state = result.failState;
  	        return result.node;
  	      }

  	      throw arrow.error || result.error;
  	    }

  	    return super.parseSubscripts(base, startPos, startLoc, noCalls);
  	  }

  	  parseSubscript(base, startPos, startLoc, noCalls, subscriptState) {
  	    if (this.match(18) && this.isLookaheadToken_lt()) {
  	      subscriptState.optionalChainMember = true;

  	      if (noCalls) {
  	        subscriptState.stop = true;
  	        return base;
  	      }

  	      this.next();
  	      const node = this.startNodeAt(startPos, startLoc);
  	      node.callee = base;
  	      node.typeArguments = this.flowParseTypeParameterInstantiation();
  	      this.expect(10);
  	      node.arguments = this.parseCallExpressionArguments(11, false);
  	      node.optional = true;
  	      return this.finishCallExpression(node, true);
  	    } else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
  	      const node = this.startNodeAt(startPos, startLoc);
  	      node.callee = base;
  	      const result = this.tryParse(() => {
  	        node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
  	        this.expect(10);
  	        node.arguments = super.parseCallExpressionArguments(11, false);

  	        if (subscriptState.optionalChainMember) {
  	          node.optional = false;
  	        }

  	        return this.finishCallExpression(node, subscriptState.optionalChainMember);
  	      });

  	      if (result.node) {
  	        if (result.error) this.state = result.failState;
  	        return result.node;
  	      }
  	    }

  	    return super.parseSubscript(base, startPos, startLoc, noCalls, subscriptState);
  	  }

  	  parseNewCallee(node) {
  	    super.parseNewCallee(node);
  	    let targs = null;

  	    if (this.shouldParseTypes() && this.match(47)) {
  	      targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node;
  	    }

  	    node.typeArguments = targs;
  	  }

  	  parseAsyncArrowWithTypeParameters(startPos, startLoc) {
  	    const node = this.startNodeAt(startPos, startLoc);
  	    this.parseFunctionParams(node);
  	    if (!this.parseArrow(node)) return;
  	    return super.parseArrowExpression(node, undefined, true);
  	  }

  	  readToken_mult_modulo(code) {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (code === 42 && next === 47 && this.state.hasFlowComment) {
  	      this.state.hasFlowComment = false;
  	      this.state.pos += 2;
  	      this.nextToken();
  	      return;
  	    }

  	    super.readToken_mult_modulo(code);
  	  }

  	  readToken_pipe_amp(code) {
  	    const next = this.input.charCodeAt(this.state.pos + 1);

  	    if (code === 124 && next === 125) {
  	      this.finishOp(9, 2);
  	      return;
  	    }

  	    super.readToken_pipe_amp(code);
  	  }

  	  parseTopLevel(file, program) {
  	    const fileNode = super.parseTopLevel(file, program);

  	    if (this.state.hasFlowComment) {
  	      this.raise(FlowErrors.UnterminatedFlowComment, {
  	        at: this.state.curPosition()
  	      });
  	    }

  	    return fileNode;
  	  }

  	  skipBlockComment() {
  	    if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
  	      if (this.state.hasFlowComment) {
  	        throw this.raise(FlowErrors.NestedFlowComment, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      this.hasFlowCommentCompletion();
  	      const commentSkip = this.skipFlowComment();

  	      if (commentSkip) {
  	        this.state.pos += commentSkip;
  	        this.state.hasFlowComment = true;
  	      }

  	      return;
  	    }

  	    if (this.state.hasFlowComment) {
  	      const end = this.input.indexOf("*-/", this.state.pos + 2);

  	      if (end === -1) {
  	        throw this.raise(Errors.UnterminatedComment, {
  	          at: this.state.curPosition()
  	        });
  	      }

  	      this.state.pos = end + 2 + 3;
  	      return;
  	    }

  	    return super.skipBlockComment();
  	  }

  	  skipFlowComment() {
  	    const {
  	      pos
  	    } = this.state;
  	    let shiftToFirstNonWhiteSpace = 2;

  	    while ([32, 9].includes(this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) {
  	      shiftToFirstNonWhiteSpace++;
  	    }

  	    const ch2 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos);
  	    const ch3 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos + 1);

  	    if (ch2 === 58 && ch3 === 58) {
  	      return shiftToFirstNonWhiteSpace + 2;
  	    }

  	    if (this.input.slice(shiftToFirstNonWhiteSpace + pos, shiftToFirstNonWhiteSpace + pos + 12) === "flow-include") {
  	      return shiftToFirstNonWhiteSpace + 12;
  	    }

  	    if (ch2 === 58 && ch3 !== 58) {
  	      return shiftToFirstNonWhiteSpace;
  	    }

  	    return false;
  	  }

  	  hasFlowCommentCompletion() {
  	    const end = this.input.indexOf("*/", this.state.pos);

  	    if (end === -1) {
  	      throw this.raise(Errors.UnterminatedComment, {
  	        at: this.state.curPosition()
  	      });
  	    }
  	  }

  	  flowEnumErrorBooleanMemberNotInitialized(loc, {
  	    enumName,
  	    memberName
  	  }) {
  	    this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
  	      at: loc,
  	      memberName,
  	      enumName
  	    });
  	  }

  	  flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
  	    return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, Object.assign({
  	      at: loc
  	    }, enumContext));
  	  }

  	  flowEnumErrorNumberMemberNotInitialized(loc, {
  	    enumName,
  	    memberName
  	  }) {
  	    this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
  	      at: loc,
  	      enumName,
  	      memberName
  	    });
  	  }

  	  flowEnumErrorStringMemberInconsistentlyInitailized(node, {
  	    enumName
  	  }) {
  	    this.raise(FlowErrors.EnumStringMemberInconsistentlyInitailized, {
  	      at: node,
  	      enumName
  	    });
  	  }

  	  flowEnumMemberInit() {
  	    const startLoc = this.state.startLoc;

  	    const endOfInit = () => this.match(12) || this.match(8);

  	    switch (this.state.type) {
  	      case 130:
  	        {
  	          const literal = this.parseNumericLiteral(this.state.value);

  	          if (endOfInit()) {
  	            return {
  	              type: "number",
  	              loc: literal.loc.start,
  	              value: literal
  	            };
  	          }

  	          return {
  	            type: "invalid",
  	            loc: startLoc
  	          };
  	        }

  	      case 129:
  	        {
  	          const literal = this.parseStringLiteral(this.state.value);

  	          if (endOfInit()) {
  	            return {
  	              type: "string",
  	              loc: literal.loc.start,
  	              value: literal
  	            };
  	          }

  	          return {
  	            type: "invalid",
  	            loc: startLoc
  	          };
  	        }

  	      case 85:
  	      case 86:
  	        {
  	          const literal = this.parseBooleanLiteral(this.match(85));

  	          if (endOfInit()) {
  	            return {
  	              type: "boolean",
  	              loc: literal.loc.start,
  	              value: literal
  	            };
  	          }

  	          return {
  	            type: "invalid",
  	            loc: startLoc
  	          };
  	        }

  	      default:
  	        return {
  	          type: "invalid",
  	          loc: startLoc
  	        };
  	    }
  	  }

  	  flowEnumMemberRaw() {
  	    const loc = this.state.startLoc;
  	    const id = this.parseIdentifier(true);
  	    const init = this.eat(29) ? this.flowEnumMemberInit() : {
  	      type: "none",
  	      loc
  	    };
  	    return {
  	      id,
  	      init
  	    };
  	  }

  	  flowEnumCheckExplicitTypeMismatch(loc, context, expectedType) {
  	    const {
  	      explicitType
  	    } = context;

  	    if (explicitType === null) {
  	      return;
  	    }

  	    if (explicitType !== expectedType) {
  	      this.flowEnumErrorInvalidMemberInitializer(loc, context);
  	    }
  	  }

  	  flowEnumMembers({
  	    enumName,
  	    explicitType
  	  }) {
  	    const seenNames = new Set();
  	    const members = {
  	      booleanMembers: [],
  	      numberMembers: [],
  	      stringMembers: [],
  	      defaultedMembers: []
  	    };
  	    let hasUnknownMembers = false;

  	    while (!this.match(8)) {
  	      if (this.eat(21)) {
  	        hasUnknownMembers = true;
  	        break;
  	      }

  	      const memberNode = this.startNode();
  	      const {
  	        id,
  	        init
  	      } = this.flowEnumMemberRaw();
  	      const memberName = id.name;

  	      if (memberName === "") {
  	        continue;
  	      }

  	      if (/^[a-z]/.test(memberName)) {
  	        this.raise(FlowErrors.EnumInvalidMemberName, {
  	          at: id,
  	          memberName,
  	          suggestion: memberName[0].toUpperCase() + memberName.slice(1),
  	          enumName
  	        });
  	      }

  	      if (seenNames.has(memberName)) {
  	        this.raise(FlowErrors.EnumDuplicateMemberName, {
  	          at: id,
  	          memberName,
  	          enumName
  	        });
  	      }

  	      seenNames.add(memberName);
  	      const context = {
  	        enumName,
  	        explicitType,
  	        memberName
  	      };
  	      memberNode.id = id;

  	      switch (init.type) {
  	        case "boolean":
  	          {
  	            this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "boolean");
  	            memberNode.init = init.value;
  	            members.booleanMembers.push(this.finishNode(memberNode, "EnumBooleanMember"));
  	            break;
  	          }

  	        case "number":
  	          {
  	            this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "number");
  	            memberNode.init = init.value;
  	            members.numberMembers.push(this.finishNode(memberNode, "EnumNumberMember"));
  	            break;
  	          }

  	        case "string":
  	          {
  	            this.flowEnumCheckExplicitTypeMismatch(init.loc, context, "string");
  	            memberNode.init = init.value;
  	            members.stringMembers.push(this.finishNode(memberNode, "EnumStringMember"));
  	            break;
  	          }

  	        case "invalid":
  	          {
  	            throw this.flowEnumErrorInvalidMemberInitializer(init.loc, context);
  	          }

  	        case "none":
  	          {
  	            switch (explicitType) {
  	              case "boolean":
  	                this.flowEnumErrorBooleanMemberNotInitialized(init.loc, context);
  	                break;

  	              case "number":
  	                this.flowEnumErrorNumberMemberNotInitialized(init.loc, context);
  	                break;

  	              default:
  	                members.defaultedMembers.push(this.finishNode(memberNode, "EnumDefaultedMember"));
  	            }
  	          }
  	      }

  	      if (!this.match(8)) {
  	        this.expect(12);
  	      }
  	    }

  	    return {
  	      members,
  	      hasUnknownMembers
  	    };
  	  }

  	  flowEnumStringMembers(initializedMembers, defaultedMembers, {
  	    enumName
  	  }) {
  	    if (initializedMembers.length === 0) {
  	      return defaultedMembers;
  	    } else if (defaultedMembers.length === 0) {
  	      return initializedMembers;
  	    } else if (defaultedMembers.length > initializedMembers.length) {
  	      for (const member of initializedMembers) {
  	        this.flowEnumErrorStringMemberInconsistentlyInitailized(member, {
  	          enumName
  	        });
  	      }

  	      return defaultedMembers;
  	    } else {
  	      for (const member of defaultedMembers) {
  	        this.flowEnumErrorStringMemberInconsistentlyInitailized(member, {
  	          enumName
  	        });
  	      }

  	      return initializedMembers;
  	    }
  	  }

  	  flowEnumParseExplicitType({
  	    enumName
  	  }) {
  	    if (!this.eatContextual(101)) return null;

  	    if (!tokenIsIdentifier(this.state.type)) {
  	      throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, {
  	        at: this.state.startLoc,
  	        enumName
  	      });
  	    }

  	    const {
  	      value
  	    } = this.state;
  	    this.next();

  	    if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
  	      this.raise(FlowErrors.EnumInvalidExplicitType, {
  	        at: this.state.startLoc,
  	        enumName,
  	        invalidEnumType: value
  	      });
  	    }

  	    return value;
  	  }

  	  flowEnumBody(node, id) {
  	    const enumName = id.name;
  	    const nameLoc = id.loc.start;
  	    const explicitType = this.flowEnumParseExplicitType({
  	      enumName
  	    });
  	    this.expect(5);
  	    const {
  	      members,
  	      hasUnknownMembers
  	    } = this.flowEnumMembers({
  	      enumName,
  	      explicitType
  	    });
  	    node.hasUnknownMembers = hasUnknownMembers;

  	    switch (explicitType) {
  	      case "boolean":
  	        node.explicitType = true;
  	        node.members = members.booleanMembers;
  	        this.expect(8);
  	        return this.finishNode(node, "EnumBooleanBody");

  	      case "number":
  	        node.explicitType = true;
  	        node.members = members.numberMembers;
  	        this.expect(8);
  	        return this.finishNode(node, "EnumNumberBody");

  	      case "string":
  	        node.explicitType = true;
  	        node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
  	          enumName
  	        });
  	        this.expect(8);
  	        return this.finishNode(node, "EnumStringBody");

  	      case "symbol":
  	        node.members = members.defaultedMembers;
  	        this.expect(8);
  	        return this.finishNode(node, "EnumSymbolBody");

  	      default:
  	        {
  	          const empty = () => {
  	            node.members = [];
  	            this.expect(8);
  	            return this.finishNode(node, "EnumStringBody");
  	          };

  	          node.explicitType = false;
  	          const boolsLen = members.booleanMembers.length;
  	          const numsLen = members.numberMembers.length;
  	          const strsLen = members.stringMembers.length;
  	          const defaultedLen = members.defaultedMembers.length;

  	          if (!boolsLen && !numsLen && !strsLen && !defaultedLen) {
  	            return empty();
  	          } else if (!boolsLen && !numsLen) {
  	            node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
  	              enumName
  	            });
  	            this.expect(8);
  	            return this.finishNode(node, "EnumStringBody");
  	          } else if (!numsLen && !strsLen && boolsLen >= defaultedLen) {
  	            for (const member of members.defaultedMembers) {
  	              this.flowEnumErrorBooleanMemberNotInitialized(member.loc.start, {
  	                enumName,
  	                memberName: member.id.name
  	              });
  	            }

  	            node.members = members.booleanMembers;
  	            this.expect(8);
  	            return this.finishNode(node, "EnumBooleanBody");
  	          } else if (!boolsLen && !strsLen && numsLen >= defaultedLen) {
  	            for (const member of members.defaultedMembers) {
  	              this.flowEnumErrorNumberMemberNotInitialized(member.loc.start, {
  	                enumName,
  	                memberName: member.id.name
  	              });
  	            }

  	            node.members = members.numberMembers;
  	            this.expect(8);
  	            return this.finishNode(node, "EnumNumberBody");
  	          } else {
  	            this.raise(FlowErrors.EnumInconsistentMemberValues, {
  	              at: nameLoc,
  	              enumName
  	            });
  	            return empty();
  	          }
  	        }
  	    }
  	  }

  	  flowParseEnumDeclaration(node) {
  	    const id = this.parseIdentifier();
  	    node.id = id;
  	    node.body = this.flowEnumBody(this.startNode(), id);
  	    return this.finishNode(node, "EnumDeclaration");
  	  }

  	  isLookaheadToken_lt() {
  	    const next = this.nextTokenStart();

  	    if (this.input.charCodeAt(next) === 60) {
  	      const afterNext = this.input.charCodeAt(next + 1);
  	      return afterNext !== 60 && afterNext !== 61;
  	    }

  	    return false;
  	  }

  	  maybeUnwrapTypeCastExpression(node) {
  	    return node.type === "TypeCastExpression" ? node.expression : node;
  	  }

  	});

  	const entities = {
  	  __proto__: null,
  	  quot: "\u0022",
  	  amp: "&",
  	  apos: "\u0027",
  	  lt: "<",
  	  gt: ">",
  	  nbsp: "\u00A0",
  	  iexcl: "\u00A1",
  	  cent: "\u00A2",
  	  pound: "\u00A3",
  	  curren: "\u00A4",
  	  yen: "\u00A5",
  	  brvbar: "\u00A6",
  	  sect: "\u00A7",
  	  uml: "\u00A8",
  	  copy: "\u00A9",
  	  ordf: "\u00AA",
  	  laquo: "\u00AB",
  	  not: "\u00AC",
  	  shy: "\u00AD",
  	  reg: "\u00AE",
  	  macr: "\u00AF",
  	  deg: "\u00B0",
  	  plusmn: "\u00B1",
  	  sup2: "\u00B2",
  	  sup3: "\u00B3",
  	  acute: "\u00B4",
  	  micro: "\u00B5",
  	  para: "\u00B6",
  	  middot: "\u00B7",
  	  cedil: "\u00B8",
  	  sup1: "\u00B9",
  	  ordm: "\u00BA",
  	  raquo: "\u00BB",
  	  frac14: "\u00BC",
  	  frac12: "\u00BD",
  	  frac34: "\u00BE",
  	  iquest: "\u00BF",
  	  Agrave: "\u00C0",
  	  Aacute: "\u00C1",
  	  Acirc: "\u00C2",
  	  Atilde: "\u00C3",
  	  Auml: "\u00C4",
  	  Aring: "\u00C5",
  	  AElig: "\u00C6",
  	  Ccedil: "\u00C7",
  	  Egrave: "\u00C8",
  	  Eacute: "\u00C9",
  	  Ecirc: "\u00CA",
  	  Euml: "\u00CB",
  	  Igrave: "\u00CC",
  	  Iacute: "\u00CD",
  	  Icirc: "\u00CE",
  	  Iuml: "\u00CF",
  	  ETH: "\u00D0",
  	  Ntilde: "\u00D1",
  	  Ograve: "\u00D2",
  	  Oacute: "\u00D3",
  	  Ocirc: "\u00D4",
  	  Otilde: "\u00D5",
  	  Ouml: "\u00D6",
  	  times: "\u00D7",
  	  Oslash: "\u00D8",
  	  Ugrave: "\u00D9",
  	  Uacute: "\u00DA",
  	  Ucirc: "\u00DB",
  	  Uuml: "\u00DC",
  	  Yacute: "\u00DD",
  	  THORN: "\u00DE",
  	  szlig: "\u00DF",
  	  agrave: "\u00E0",
  	  aacute: "\u00E1",
  	  acirc: "\u00E2",
  	  atilde: "\u00E3",
  	  auml: "\u00E4",
  	  aring: "\u00E5",
  	  aelig: "\u00E6",
  	  ccedil: "\u00E7",
  	  egrave: "\u00E8",
  	  eacute: "\u00E9",
  	  ecirc: "\u00EA",
  	  euml: "\u00EB",
  	  igrave: "\u00EC",
  	  iacute: "\u00ED",
  	  icirc: "\u00EE",
  	  iuml: "\u00EF",
  	  eth: "\u00F0",
  	  ntilde: "\u00F1",
  	  ograve: "\u00F2",
  	  oacute: "\u00F3",
  	  ocirc: "\u00F4",
  	  otilde: "\u00F5",
  	  ouml: "\u00F6",
  	  divide: "\u00F7",
  	  oslash: "\u00F8",
  	  ugrave: "\u00F9",
  	  uacute: "\u00FA",
  	  ucirc: "\u00FB",
  	  uuml: "\u00FC",
  	  yacute: "\u00FD",
  	  thorn: "\u00FE",
  	  yuml: "\u00FF",
  	  OElig: "\u0152",
  	  oelig: "\u0153",
  	  Scaron: "\u0160",
  	  scaron: "\u0161",
  	  Yuml: "\u0178",
  	  fnof: "\u0192",
  	  circ: "\u02C6",
  	  tilde: "\u02DC",
  	  Alpha: "\u0391",
  	  Beta: "\u0392",
  	  Gamma: "\u0393",
  	  Delta: "\u0394",
  	  Epsilon: "\u0395",
  	  Zeta: "\u0396",
  	  Eta: "\u0397",
  	  Theta: "\u0398",
  	  Iota: "\u0399",
  	  Kappa: "\u039A",
  	  Lambda: "\u039B",
  	  Mu: "\u039C",
  	  Nu: "\u039D",
  	  Xi: "\u039E",
  	  Omicron: "\u039F",
  	  Pi: "\u03A0",
  	  Rho: "\u03A1",
  	  Sigma: "\u03A3",
  	  Tau: "\u03A4",
  	  Upsilon: "\u03A5",
  	  Phi: "\u03A6",
  	  Chi: "\u03A7",
  	  Psi: "\u03A8",
  	  Omega: "\u03A9",
  	  alpha: "\u03B1",
  	  beta: "\u03B2",
  	  gamma: "\u03B3",
  	  delta: "\u03B4",
  	  epsilon: "\u03B5",
  	  zeta: "\u03B6",
  	  eta: "\u03B7",
  	  theta: "\u03B8",
  	  iota: "\u03B9",
  	  kappa: "\u03BA",
  	  lambda: "\u03BB",
  	  mu: "\u03BC",
  	  nu: "\u03BD",
  	  xi: "\u03BE",
  	  omicron: "\u03BF",
  	  pi: "\u03C0",
  	  rho: "\u03C1",
  	  sigmaf: "\u03C2",
  	  sigma: "\u03C3",
  	  tau: "\u03C4",
  	  upsilon: "\u03C5",
  	  phi: "\u03C6",
  	  chi: "\u03C7",
  	  psi: "\u03C8",
  	  omega: "\u03C9",
  	  thetasym: "\u03D1",
  	  upsih: "\u03D2",
  	  piv: "\u03D6",
  	  ensp: "\u2002",
  	  emsp: "\u2003",
  	  thinsp: "\u2009",
  	  zwnj: "\u200C",
  	  zwj: "\u200D",
  	  lrm: "\u200E",
  	  rlm: "\u200F",
  	  ndash: "\u2013",
  	  mdash: "\u2014",
  	  lsquo: "\u2018",
  	  rsquo: "\u2019",
  	  sbquo: "\u201A",
  	  ldquo: "\u201C",
  	  rdquo: "\u201D",
  	  bdquo: "\u201E",
  	  dagger: "\u2020",
  	  Dagger: "\u2021",
  	  bull: "\u2022",
  	  hellip: "\u2026",
  	  permil: "\u2030",
  	  prime: "\u2032",
  	  Prime: "\u2033",
  	  lsaquo: "\u2039",
  	  rsaquo: "\u203A",
  	  oline: "\u203E",
  	  frasl: "\u2044",
  	  euro: "\u20AC",
  	  image: "\u2111",
  	  weierp: "\u2118",
  	  real: "\u211C",
  	  trade: "\u2122",
  	  alefsym: "\u2135",
  	  larr: "\u2190",
  	  uarr: "\u2191",
  	  rarr: "\u2192",
  	  darr: "\u2193",
  	  harr: "\u2194",
  	  crarr: "\u21B5",
  	  lArr: "\u21D0",
  	  uArr: "\u21D1",
  	  rArr: "\u21D2",
  	  dArr: "\u21D3",
  	  hArr: "\u21D4",
  	  forall: "\u2200",
  	  part: "\u2202",
  	  exist: "\u2203",
  	  empty: "\u2205",
  	  nabla: "\u2207",
  	  isin: "\u2208",
  	  notin: "\u2209",
  	  ni: "\u220B",
  	  prod: "\u220F",
  	  sum: "\u2211",
  	  minus: "\u2212",
  	  lowast: "\u2217",
  	  radic: "\u221A",
  	  prop: "\u221D",
  	  infin: "\u221E",
  	  ang: "\u2220",
  	  and: "\u2227",
  	  or: "\u2228",
  	  cap: "\u2229",
  	  cup: "\u222A",
  	  int: "\u222B",
  	  there4: "\u2234",
  	  sim: "\u223C",
  	  cong: "\u2245",
  	  asymp: "\u2248",
  	  ne: "\u2260",
  	  equiv: "\u2261",
  	  le: "\u2264",
  	  ge: "\u2265",
  	  sub: "\u2282",
  	  sup: "\u2283",
  	  nsub: "\u2284",
  	  sube: "\u2286",
  	  supe: "\u2287",
  	  oplus: "\u2295",
  	  otimes: "\u2297",
  	  perp: "\u22A5",
  	  sdot: "\u22C5",
  	  lceil: "\u2308",
  	  rceil: "\u2309",
  	  lfloor: "\u230A",
  	  rfloor: "\u230B",
  	  lang: "\u2329",
  	  rang: "\u232A",
  	  loz: "\u25CA",
  	  spades: "\u2660",
  	  clubs: "\u2663",
  	  hearts: "\u2665",
  	  diams: "\u2666"
  	};

  	const JsxErrors = ParseErrorEnum`jsx`({
  	  AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
  	  MissingClosingTagElement: ({
  	    openingTagName
  	  }) => `Expected corresponding JSX closing tag for <${openingTagName}>.`,
  	  MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
  	  UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
  	  UnexpectedToken: ({
  	    unexpected,
  	    HTMLEntity
  	  }) => `Unexpected token \`${unexpected}\`. Did you mean \`${HTMLEntity}\` or \`{'${unexpected}'}\`?`,
  	  UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.",
  	  UnterminatedJsxContent: "Unterminated JSX contents.",
  	  UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
  	});

  	function isFragment(object) {
  	  return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
  	}

  	function getQualifiedJSXName(object) {
  	  if (object.type === "JSXIdentifier") {
  	    return object.name;
  	  }

  	  if (object.type === "JSXNamespacedName") {
  	    return object.namespace.name + ":" + object.name.name;
  	  }

  	  if (object.type === "JSXMemberExpression") {
  	    return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
  	  }

  	  throw new Error("Node had unexpected type: " + object.type);
  	}

  	var jsx = (superClass => class extends superClass {
  	  jsxReadToken() {
  	    let out = "";
  	    let chunkStart = this.state.pos;

  	    for (;;) {
  	      if (this.state.pos >= this.length) {
  	        throw this.raise(JsxErrors.UnterminatedJsxContent, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      const ch = this.input.charCodeAt(this.state.pos);

  	      switch (ch) {
  	        case 60:
  	        case 123:
  	          if (this.state.pos === this.state.start) {
  	            if (ch === 60 && this.state.canStartJSXElement) {
  	              ++this.state.pos;
  	              return this.finishToken(138);
  	            }

  	            return super.getTokenFromCode(ch);
  	          }

  	          out += this.input.slice(chunkStart, this.state.pos);
  	          return this.finishToken(137, out);

  	        case 38:
  	          out += this.input.slice(chunkStart, this.state.pos);
  	          out += this.jsxReadEntity();
  	          chunkStart = this.state.pos;
  	          break;

  	        case 62:
  	        case 125:

  	        default:
  	          if (isNewLine(ch)) {
  	            out += this.input.slice(chunkStart, this.state.pos);
  	            out += this.jsxReadNewLine(true);
  	            chunkStart = this.state.pos;
  	          } else {
  	            ++this.state.pos;
  	          }

  	      }
  	    }
  	  }

  	  jsxReadNewLine(normalizeCRLF) {
  	    const ch = this.input.charCodeAt(this.state.pos);
  	    let out;
  	    ++this.state.pos;

  	    if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
  	      ++this.state.pos;
  	      out = normalizeCRLF ? "\n" : "\r\n";
  	    } else {
  	      out = String.fromCharCode(ch);
  	    }

  	    ++this.state.curLine;
  	    this.state.lineStart = this.state.pos;
  	    return out;
  	  }

  	  jsxReadString(quote) {
  	    let out = "";
  	    let chunkStart = ++this.state.pos;

  	    for (;;) {
  	      if (this.state.pos >= this.length) {
  	        throw this.raise(Errors.UnterminatedString, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      const ch = this.input.charCodeAt(this.state.pos);
  	      if (ch === quote) break;

  	      if (ch === 38) {
  	        out += this.input.slice(chunkStart, this.state.pos);
  	        out += this.jsxReadEntity();
  	        chunkStart = this.state.pos;
  	      } else if (isNewLine(ch)) {
  	        out += this.input.slice(chunkStart, this.state.pos);
  	        out += this.jsxReadNewLine(false);
  	        chunkStart = this.state.pos;
  	      } else {
  	        ++this.state.pos;
  	      }
  	    }

  	    out += this.input.slice(chunkStart, this.state.pos++);
  	    return this.finishToken(129, out);
  	  }

  	  jsxReadEntity() {
  	    const startPos = ++this.state.pos;

  	    if (this.codePointAtPos(this.state.pos) === 35) {
  	      ++this.state.pos;
  	      let radix = 10;

  	      if (this.codePointAtPos(this.state.pos) === 120) {
  	        radix = 16;
  	        ++this.state.pos;
  	      }

  	      const codePoint = this.readInt(radix, undefined, false, "bail");

  	      if (codePoint !== null && this.codePointAtPos(this.state.pos) === 59) {
  	        ++this.state.pos;
  	        return String.fromCodePoint(codePoint);
  	      }
  	    } else {
  	      let count = 0;
  	      let semi = false;

  	      while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) == 59)) {
  	        ++this.state.pos;
  	      }

  	      if (semi) {
  	        const desc = this.input.slice(startPos, this.state.pos);
  	        const entity = entities[desc];
  	        ++this.state.pos;

  	        if (entity) {
  	          return entity;
  	        }
  	      }
  	    }

  	    this.state.pos = startPos;
  	    return "&";
  	  }

  	  jsxReadWord() {
  	    let ch;
  	    const start = this.state.pos;

  	    do {
  	      ch = this.input.charCodeAt(++this.state.pos);
  	    } while (isIdentifierChar(ch) || ch === 45);

  	    return this.finishToken(136, this.input.slice(start, this.state.pos));
  	  }

  	  jsxParseIdentifier() {
  	    const node = this.startNode();

  	    if (this.match(136)) {
  	      node.name = this.state.value;
  	    } else if (tokenIsKeyword(this.state.type)) {
  	      node.name = tokenLabelName(this.state.type);
  	    } else {
  	      this.unexpected();
  	    }

  	    this.next();
  	    return this.finishNode(node, "JSXIdentifier");
  	  }

  	  jsxParseNamespacedName() {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    const name = this.jsxParseIdentifier();
  	    if (!this.eat(14)) return name;
  	    const node = this.startNodeAt(startPos, startLoc);
  	    node.namespace = name;
  	    node.name = this.jsxParseIdentifier();
  	    return this.finishNode(node, "JSXNamespacedName");
  	  }

  	  jsxParseElementName() {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    let node = this.jsxParseNamespacedName();

  	    if (node.type === "JSXNamespacedName") {
  	      return node;
  	    }

  	    while (this.eat(16)) {
  	      const newNode = this.startNodeAt(startPos, startLoc);
  	      newNode.object = node;
  	      newNode.property = this.jsxParseIdentifier();
  	      node = this.finishNode(newNode, "JSXMemberExpression");
  	    }

  	    return node;
  	  }

  	  jsxParseAttributeValue() {
  	    let node;

  	    switch (this.state.type) {
  	      case 5:
  	        node = this.startNode();
  	        this.setContext(types.brace);
  	        this.next();
  	        node = this.jsxParseExpressionContainer(node, types.j_oTag);

  	        if (node.expression.type === "JSXEmptyExpression") {
  	          this.raise(JsxErrors.AttributeIsEmpty, {
  	            at: node
  	          });
  	        }

  	        return node;

  	      case 138:
  	      case 129:
  	        return this.parseExprAtom();

  	      default:
  	        throw this.raise(JsxErrors.UnsupportedJsxValue, {
  	          at: this.state.startLoc
  	        });
  	    }
  	  }

  	  jsxParseEmptyExpression() {
  	    const node = this.startNodeAt(this.state.lastTokEndLoc.index, this.state.lastTokEndLoc);
  	    return this.finishNodeAt(node, "JSXEmptyExpression", this.state.startLoc);
  	  }

  	  jsxParseSpreadChild(node) {
  	    this.next();
  	    node.expression = this.parseExpression();
  	    this.setContext(types.j_oTag);
  	    this.state.canStartJSXElement = true;
  	    this.expect(8);
  	    return this.finishNode(node, "JSXSpreadChild");
  	  }

  	  jsxParseExpressionContainer(node, previousContext) {
  	    if (this.match(8)) {
  	      node.expression = this.jsxParseEmptyExpression();
  	    } else {
  	      const expression = this.parseExpression();
  	      node.expression = expression;
  	    }

  	    this.setContext(previousContext);
  	    this.state.canStartJSXElement = true;
  	    this.expect(8);
  	    return this.finishNode(node, "JSXExpressionContainer");
  	  }

  	  jsxParseAttribute() {
  	    const node = this.startNode();

  	    if (this.match(5)) {
  	      this.setContext(types.brace);
  	      this.next();
  	      this.expect(21);
  	      node.argument = this.parseMaybeAssignAllowIn();
  	      this.setContext(types.j_oTag);
  	      this.state.canStartJSXElement = true;
  	      this.expect(8);
  	      return this.finishNode(node, "JSXSpreadAttribute");
  	    }

  	    node.name = this.jsxParseNamespacedName();
  	    node.value = this.eat(29) ? this.jsxParseAttributeValue() : null;
  	    return this.finishNode(node, "JSXAttribute");
  	  }

  	  jsxParseOpeningElementAt(startPos, startLoc) {
  	    const node = this.startNodeAt(startPos, startLoc);

  	    if (this.eat(139)) {
  	      return this.finishNode(node, "JSXOpeningFragment");
  	    }

  	    node.name = this.jsxParseElementName();
  	    return this.jsxParseOpeningElementAfterName(node);
  	  }

  	  jsxParseOpeningElementAfterName(node) {
  	    const attributes = [];

  	    while (!this.match(56) && !this.match(139)) {
  	      attributes.push(this.jsxParseAttribute());
  	    }

  	    node.attributes = attributes;
  	    node.selfClosing = this.eat(56);
  	    this.expect(139);
  	    return this.finishNode(node, "JSXOpeningElement");
  	  }

  	  jsxParseClosingElementAt(startPos, startLoc) {
  	    const node = this.startNodeAt(startPos, startLoc);

  	    if (this.eat(139)) {
  	      return this.finishNode(node, "JSXClosingFragment");
  	    }

  	    node.name = this.jsxParseElementName();
  	    this.expect(139);
  	    return this.finishNode(node, "JSXClosingElement");
  	  }

  	  jsxParseElementAt(startPos, startLoc) {
  	    const node = this.startNodeAt(startPos, startLoc);
  	    const children = [];
  	    const openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
  	    let closingElement = null;

  	    if (!openingElement.selfClosing) {
  	      contents: for (;;) {
  	        switch (this.state.type) {
  	          case 138:
  	            startPos = this.state.start;
  	            startLoc = this.state.startLoc;
  	            this.next();

  	            if (this.eat(56)) {
  	              closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
  	              break contents;
  	            }

  	            children.push(this.jsxParseElementAt(startPos, startLoc));
  	            break;

  	          case 137:
  	            children.push(this.parseExprAtom());
  	            break;

  	          case 5:
  	            {
  	              const node = this.startNode();
  	              this.setContext(types.brace);
  	              this.next();

  	              if (this.match(21)) {
  	                children.push(this.jsxParseSpreadChild(node));
  	              } else {
  	                children.push(this.jsxParseExpressionContainer(node, types.j_expr));
  	              }

  	              break;
  	            }

  	          default:
  	            throw this.unexpected();
  	        }
  	      }

  	      if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
  	        this.raise(JsxErrors.MissingClosingTagFragment, {
  	          at: closingElement
  	        });
  	      } else if (!isFragment(openingElement) && isFragment(closingElement)) {
  	        this.raise(JsxErrors.MissingClosingTagElement, {
  	          at: closingElement,
  	          openingTagName: getQualifiedJSXName(openingElement.name)
  	        });
  	      } else if (!isFragment(openingElement) && !isFragment(closingElement)) {
  	        if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
  	          this.raise(JsxErrors.MissingClosingTagElement, {
  	            at: closingElement,
  	            openingTagName: getQualifiedJSXName(openingElement.name)
  	          });
  	        }
  	      }
  	    }

  	    if (isFragment(openingElement)) {
  	      node.openingFragment = openingElement;
  	      node.closingFragment = closingElement;
  	    } else {
  	      node.openingElement = openingElement;
  	      node.closingElement = closingElement;
  	    }

  	    node.children = children;

  	    if (this.match(47)) {
  	      throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
  	  }

  	  jsxParseElement() {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    this.next();
  	    return this.jsxParseElementAt(startPos, startLoc);
  	  }

  	  setContext(newContext) {
  	    const {
  	      context
  	    } = this.state;
  	    context[context.length - 1] = newContext;
  	  }

  	  parseExprAtom(refExpressionErrors) {
  	    if (this.match(137)) {
  	      return this.parseLiteral(this.state.value, "JSXText");
  	    } else if (this.match(138)) {
  	      return this.jsxParseElement();
  	    } else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
  	      this.replaceToken(138);
  	      return this.jsxParseElement();
  	    } else {
  	      return super.parseExprAtom(refExpressionErrors);
  	    }
  	  }

  	  skipSpace() {
  	    const curContext = this.curContext();
  	    if (!curContext.preserveSpace) super.skipSpace();
  	  }

  	  getTokenFromCode(code) {
  	    const context = this.curContext();

  	    if (context === types.j_expr) {
  	      return this.jsxReadToken();
  	    }

  	    if (context === types.j_oTag || context === types.j_cTag) {
  	      if (isIdentifierStart(code)) {
  	        return this.jsxReadWord();
  	      }

  	      if (code === 62) {
  	        ++this.state.pos;
  	        return this.finishToken(139);
  	      }

  	      if ((code === 34 || code === 39) && context === types.j_oTag) {
  	        return this.jsxReadString(code);
  	      }
  	    }

  	    if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
  	      ++this.state.pos;
  	      return this.finishToken(138);
  	    }

  	    return super.getTokenFromCode(code);
  	  }

  	  updateContext(prevType) {
  	    const {
  	      context,
  	      type
  	    } = this.state;

  	    if (type === 56 && prevType === 138) {
  	      context.splice(-2, 2, types.j_cTag);
  	      this.state.canStartJSXElement = false;
  	    } else if (type === 138) {
  	      context.push(types.j_oTag);
  	    } else if (type === 139) {
  	      const out = context[context.length - 1];

  	      if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) {
  	        context.pop();
  	        this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
  	      } else {
  	        this.setContext(types.j_expr);
  	        this.state.canStartJSXElement = true;
  	      }
  	    } else {
  	      this.state.canStartJSXElement = tokenComesBeforeExpression(type);
  	    }
  	  }

  	});

  	class TypeScriptScope extends Scope {
  	  constructor(...args) {
  	    super(...args);
  	    this.types = new Set();
  	    this.enums = new Set();
  	    this.constEnums = new Set();
  	    this.classes = new Set();
  	    this.exportOnlyBindings = new Set();
  	  }

  	}

  	class TypeScriptScopeHandler extends ScopeHandler {
  	  createScope(flags) {
  	    return new TypeScriptScope(flags);
  	  }

  	  declareName(name, bindingType, loc) {
  	    const scope = this.currentScope();

  	    if (bindingType & BIND_FLAGS_TS_EXPORT_ONLY) {
  	      this.maybeExportDefined(scope, name);
  	      scope.exportOnlyBindings.add(name);
  	      return;
  	    }

  	    super.declareName(name, bindingType, loc);

  	    if (bindingType & BIND_KIND_TYPE) {
  	      if (!(bindingType & BIND_KIND_VALUE)) {
  	        this.checkRedeclarationInScope(scope, name, bindingType, loc);
  	        this.maybeExportDefined(scope, name);
  	      }

  	      scope.types.add(name);
  	    }

  	    if (bindingType & BIND_FLAGS_TS_ENUM) scope.enums.add(name);
  	    if (bindingType & BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.add(name);
  	    if (bindingType & BIND_FLAGS_CLASS) scope.classes.add(name);
  	  }

  	  isRedeclaredInScope(scope, name, bindingType) {
  	    if (scope.enums.has(name)) {
  	      if (bindingType & BIND_FLAGS_TS_ENUM) {
  	        const isConst = !!(bindingType & BIND_FLAGS_TS_CONST_ENUM);
  	        const wasConst = scope.constEnums.has(name);
  	        return isConst !== wasConst;
  	      }

  	      return true;
  	    }

  	    if (bindingType & BIND_FLAGS_CLASS && scope.classes.has(name)) {
  	      if (scope.lexical.has(name)) {
  	        return !!(bindingType & BIND_KIND_VALUE);
  	      } else {
  	        return false;
  	      }
  	    }

  	    if (bindingType & BIND_KIND_TYPE && scope.types.has(name)) {
  	      return true;
  	    }

  	    return super.isRedeclaredInScope(scope, name, bindingType);
  	  }

  	  checkLocalExport(id) {
  	    const topLevelScope = this.scopeStack[0];
  	    const {
  	      name
  	    } = id;

  	    if (!topLevelScope.types.has(name) && !topLevelScope.exportOnlyBindings.has(name)) {
  	      super.checkLocalExport(id);
  	    }
  	  }

  	}

  	const getOwn$1 = (object, key) => Object.hasOwnProperty.call(object, key) && object[key];

  	function nonNull(x) {
  	  if (x == null) {
  	    throw new Error(`Unexpected ${x} value.`);
  	  }

  	  return x;
  	}

  	function assert(x) {
  	  if (!x) {
  	    throw new Error("Assert fail");
  	  }
  	}

  	const TSErrors = ParseErrorEnum`typescript`({
  	  AbstractMethodHasImplementation: ({
  	    methodName
  	  }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`,
  	  AbstractPropertyHasInitializer: ({
  	    propertyName
  	  }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
  	  AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
  	  AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
  	  CannotFindName: ({
  	    name
  	  }) => `Cannot find name '${name}'.`,
  	  ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
  	  ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
  	  ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
  	  ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
  	  DeclareAccessor: ({
  	    kind
  	  }) => `'declare' is not allowed in ${kind}ters.`,
  	  DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
  	  DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
  	  DuplicateAccessibilityModifier: ({
  	    modifier
  	  }) => `Accessibility modifier already seen.`,
  	  DuplicateModifier: ({
  	    modifier
  	  }) => `Duplicate modifier: '${modifier}'.`,
  	  EmptyHeritageClauseType: ({
  	    token
  	  }) => `'${token}' list cannot be empty.`,
  	  EmptyTypeArguments: "Type argument list cannot be empty.",
  	  EmptyTypeParameters: "Type parameter list cannot be empty.",
  	  ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
  	  ImportAliasHasImportType: "An import alias can not use 'import type'.",
  	  IncompatibleModifiers: ({
  	    modifiers
  	  }) => `'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`,
  	  IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
  	  IndexSignatureHasAccessibility: ({
  	    modifier
  	  }) => `Index signatures cannot have an accessibility modifier ('${modifier}').`,
  	  IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
  	  IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
  	  IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
  	  InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
  	  InvalidModifierOnTypeMember: ({
  	    modifier
  	  }) => `'${modifier}' modifier cannot appear on a type member.`,
  	  InvalidModifierOnTypeParameter: ({
  	    modifier
  	  }) => `'${modifier}' modifier cannot appear on a type parameter.`,
  	  InvalidModifierOnTypeParameterPositions: ({
  	    modifier
  	  }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
  	  InvalidModifiersOrder: ({
  	    orderedModifiers
  	  }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
  	  InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. " + "You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
  	  InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
  	  MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
  	  MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.",
  	  NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
  	  NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.",
  	  OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
  	  OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
  	  PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
  	  PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
  	  PrivateElementHasAccessibility: ({
  	    modifier
  	  }) => `Private elements cannot have an accessibility modifier ('${modifier}').`,
  	  ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
  	  ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
  	  ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
  	  SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
  	  SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
  	  SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
  	  SingleTypeParameterWithoutTrailingComma: ({
  	    typeParameterName
  	  }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
  	  StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
  	  TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
  	  TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
  	  TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
  	  TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
  	  UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
  	  UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
  	  UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
  	  UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
  	  UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
  	  UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
  	  UnsupportedSignatureParameterKind: ({
  	    type
  	  }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`
  	});

  	function keywordTypeFromName(value) {
  	  switch (value) {
  	    case "any":
  	      return "TSAnyKeyword";

  	    case "boolean":
  	      return "TSBooleanKeyword";

  	    case "bigint":
  	      return "TSBigIntKeyword";

  	    case "never":
  	      return "TSNeverKeyword";

  	    case "number":
  	      return "TSNumberKeyword";

  	    case "object":
  	      return "TSObjectKeyword";

  	    case "string":
  	      return "TSStringKeyword";

  	    case "symbol":
  	      return "TSSymbolKeyword";

  	    case "undefined":
  	      return "TSUndefinedKeyword";

  	    case "unknown":
  	      return "TSUnknownKeyword";

  	    default:
  	      return undefined;
  	  }
  	}

  	function tsIsAccessModifier(modifier) {
  	  return modifier === "private" || modifier === "public" || modifier === "protected";
  	}

  	function tsIsVarianceAnnotations(modifier) {
  	  return modifier === "in" || modifier === "out";
  	}

  	var typescript = (superClass => class extends superClass {
  	  getScopeHandler() {
  	    return TypeScriptScopeHandler;
  	  }

  	  tsIsIdentifier() {
  	    return tokenIsIdentifier(this.state.type);
  	  }

  	  tsTokenCanFollowModifier() {
  	    return (this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(134) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
  	  }

  	  tsNextTokenCanFollowModifier() {
  	    this.next();
  	    return this.tsTokenCanFollowModifier();
  	  }

  	  tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
  	    if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58) {
  	      return undefined;
  	    }

  	    const modifier = this.state.value;

  	    if (allowedModifiers.indexOf(modifier) !== -1) {
  	      if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) {
  	        return undefined;
  	      }

  	      if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
  	        return modifier;
  	      }
  	    }

  	    return undefined;
  	  }

  	  tsParseModifiers({
  	    modified,
  	    allowedModifiers,
  	    disallowedModifiers,
  	    stopOnStartOfClassStaticBlock,
  	    errorTemplate = TSErrors.InvalidModifierOnTypeMember
  	  }) {
  	    const enforceOrder = (loc, modifier, before, after) => {
  	      if (modifier === before && modified[after]) {
  	        this.raise(TSErrors.InvalidModifiersOrder, {
  	          at: loc,
  	          orderedModifiers: [before, after]
  	        });
  	      }
  	    };

  	    const incompatible = (loc, modifier, mod1, mod2) => {
  	      if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
  	        this.raise(TSErrors.IncompatibleModifiers, {
  	          at: loc,
  	          modifiers: [mod1, mod2]
  	        });
  	      }
  	    };

  	    for (;;) {
  	      const {
  	        startLoc
  	      } = this.state;
  	      const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock);
  	      if (!modifier) break;

  	      if (tsIsAccessModifier(modifier)) {
  	        if (modified.accessibility) {
  	          this.raise(TSErrors.DuplicateAccessibilityModifier, {
  	            at: startLoc,
  	            modifier
  	          });
  	        } else {
  	          enforceOrder(startLoc, modifier, modifier, "override");
  	          enforceOrder(startLoc, modifier, modifier, "static");
  	          enforceOrder(startLoc, modifier, modifier, "readonly");
  	          modified.accessibility = modifier;
  	        }
  	      } else if (tsIsVarianceAnnotations(modifier)) {
  	        if (modified[modifier]) {
  	          this.raise(TSErrors.DuplicateModifier, {
  	            at: startLoc,
  	            modifier
  	          });
  	        }

  	        modified[modifier] = true;
  	        enforceOrder(startLoc, modifier, "in", "out");
  	      } else {
  	        if (Object.hasOwnProperty.call(modified, modifier)) {
  	          this.raise(TSErrors.DuplicateModifier, {
  	            at: startLoc,
  	            modifier
  	          });
  	        } else {
  	          enforceOrder(startLoc, modifier, "static", "readonly");
  	          enforceOrder(startLoc, modifier, "static", "override");
  	          enforceOrder(startLoc, modifier, "override", "readonly");
  	          enforceOrder(startLoc, modifier, "abstract", "override");
  	          incompatible(startLoc, modifier, "declare", "override");
  	          incompatible(startLoc, modifier, "static", "abstract");
  	        }

  	        modified[modifier] = true;
  	      }

  	      if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
  	        this.raise(errorTemplate, {
  	          at: startLoc,
  	          modifier
  	        });
  	      }
  	    }
  	  }

  	  tsIsListTerminator(kind) {
  	    switch (kind) {
  	      case "EnumMembers":
  	      case "TypeMembers":
  	        return this.match(8);

  	      case "HeritageClauseElement":
  	        return this.match(5);

  	      case "TupleElementTypes":
  	        return this.match(3);

  	      case "TypeParametersOrArguments":
  	        return this.match(48);
  	    }

  	    throw new Error("Unreachable");
  	  }

  	  tsParseList(kind, parseElement) {
  	    const result = [];

  	    while (!this.tsIsListTerminator(kind)) {
  	      result.push(parseElement());
  	    }

  	    return result;
  	  }

  	  tsParseDelimitedList(kind, parseElement, refTrailingCommaPos) {
  	    return nonNull(this.tsParseDelimitedListWorker(kind, parseElement, true, refTrailingCommaPos));
  	  }

  	  tsParseDelimitedListWorker(kind, parseElement, expectSuccess, refTrailingCommaPos) {
  	    const result = [];
  	    let trailingCommaPos = -1;

  	    for (;;) {
  	      if (this.tsIsListTerminator(kind)) {
  	        break;
  	      }

  	      trailingCommaPos = -1;
  	      const element = parseElement();

  	      if (element == null) {
  	        return undefined;
  	      }

  	      result.push(element);

  	      if (this.eat(12)) {
  	        trailingCommaPos = this.state.lastTokStart;
  	        continue;
  	      }

  	      if (this.tsIsListTerminator(kind)) {
  	        break;
  	      }

  	      if (expectSuccess) {
  	        this.expect(12);
  	      }

  	      return undefined;
  	    }

  	    if (refTrailingCommaPos) {
  	      refTrailingCommaPos.value = trailingCommaPos;
  	    }

  	    return result;
  	  }

  	  tsParseBracketedList(kind, parseElement, bracket, skipFirstToken, refTrailingCommaPos) {
  	    if (!skipFirstToken) {
  	      if (bracket) {
  	        this.expect(0);
  	      } else {
  	        this.expect(47);
  	      }
  	    }

  	    const result = this.tsParseDelimitedList(kind, parseElement, refTrailingCommaPos);

  	    if (bracket) {
  	      this.expect(3);
  	    } else {
  	      this.expect(48);
  	    }

  	    return result;
  	  }

  	  tsParseImportType() {
  	    const node = this.startNode();
  	    this.expect(83);
  	    this.expect(10);

  	    if (!this.match(129)) {
  	      this.raise(TSErrors.UnsupportedImportTypeArgument, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    node.argument = super.parseExprAtom();
  	    this.expect(11);

  	    if (this.eat(16)) {
  	      node.qualifier = this.tsParseEntityName();
  	    }

  	    if (this.match(47)) {
  	      node.typeParameters = this.tsParseTypeArguments();
  	    }

  	    return this.finishNode(node, "TSImportType");
  	  }

  	  tsParseEntityName(allowReservedWords = true) {
  	    let entity = this.parseIdentifier(allowReservedWords);

  	    while (this.eat(16)) {
  	      const node = this.startNodeAtNode(entity);
  	      node.left = entity;
  	      node.right = this.parseIdentifier(allowReservedWords);
  	      entity = this.finishNode(node, "TSQualifiedName");
  	    }

  	    return entity;
  	  }

  	  tsParseTypeReference() {
  	    const node = this.startNode();
  	    node.typeName = this.tsParseEntityName();

  	    if (!this.hasPrecedingLineBreak() && this.match(47)) {
  	      node.typeParameters = this.tsParseTypeArguments();
  	    }

  	    return this.finishNode(node, "TSTypeReference");
  	  }

  	  tsParseThisTypePredicate(lhs) {
  	    this.next();
  	    const node = this.startNodeAtNode(lhs);
  	    node.parameterName = lhs;
  	    node.typeAnnotation = this.tsParseTypeAnnotation(false);
  	    node.asserts = false;
  	    return this.finishNode(node, "TSTypePredicate");
  	  }

  	  tsParseThisTypeNode() {
  	    const node = this.startNode();
  	    this.next();
  	    return this.finishNode(node, "TSThisType");
  	  }

  	  tsParseTypeQuery() {
  	    const node = this.startNode();
  	    this.expect(87);

  	    if (this.match(83)) {
  	      node.exprName = this.tsParseImportType();
  	    } else {
  	      node.exprName = this.tsParseEntityName();
  	    }

  	    if (!this.hasPrecedingLineBreak() && this.match(47)) {
  	      node.typeParameters = this.tsParseTypeArguments();
  	    }

  	    return this.finishNode(node, "TSTypeQuery");
  	  }

  	  tsParseInOutModifiers(node) {
  	    this.tsParseModifiers({
  	      modified: node,
  	      allowedModifiers: ["in", "out"],
  	      disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"],
  	      errorTemplate: TSErrors.InvalidModifierOnTypeParameter
  	    });
  	  }

  	  tsParseNoneModifiers(node) {
  	    this.tsParseModifiers({
  	      modified: node,
  	      allowedModifiers: [],
  	      disallowedModifiers: ["in", "out"],
  	      errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
  	    });
  	  }

  	  tsParseTypeParameter(parseModifiers = this.tsParseNoneModifiers.bind(this)) {
  	    const node = this.startNode();
  	    parseModifiers(node);
  	    node.name = this.tsParseTypeParameterName();
  	    node.constraint = this.tsEatThenParseType(81);
  	    node.default = this.tsEatThenParseType(29);
  	    return this.finishNode(node, "TSTypeParameter");
  	  }

  	  tsTryParseTypeParameters(parseModifiers) {
  	    if (this.match(47)) {
  	      return this.tsParseTypeParameters(parseModifiers);
  	    }
  	  }

  	  tsParseTypeParameters(parseModifiers) {
  	    const node = this.startNode();

  	    if (this.match(47) || this.match(138)) {
  	      this.next();
  	    } else {
  	      this.unexpected();
  	    }

  	    const refTrailingCommaPos = {
  	      value: -1
  	    };
  	    node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);

  	    if (node.params.length === 0) {
  	      this.raise(TSErrors.EmptyTypeParameters, {
  	        at: node
  	      });
  	    }

  	    if (refTrailingCommaPos.value !== -1) {
  	      this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
  	    }

  	    return this.finishNode(node, "TSTypeParameterDeclaration");
  	  }

  	  tsTryNextParseConstantContext() {
  	    if (this.lookahead().type !== 75) return null;
  	    this.next();
  	    const typeReference = this.tsParseTypeReference();

  	    if (typeReference.typeParameters) {
  	      this.raise(TSErrors.CannotFindName, {
  	        at: typeReference.typeName,
  	        name: "const"
  	      });
  	    }

  	    return typeReference;
  	  }

  	  tsFillSignature(returnToken, signature) {
  	    const returnTokenRequired = returnToken === 19;
  	    const paramsKey = "parameters";
  	    const returnTypeKey = "typeAnnotation";
  	    signature.typeParameters = this.tsTryParseTypeParameters();
  	    this.expect(10);
  	    signature[paramsKey] = this.tsParseBindingListForSignature();

  	    if (returnTokenRequired) {
  	      signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
  	    } else if (this.match(returnToken)) {
  	      signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
  	    }
  	  }

  	  tsParseBindingListForSignature() {
  	    return super.parseBindingList(11, 41).map(pattern => {
  	      if (pattern.type !== "Identifier" && pattern.type !== "RestElement" && pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") {
  	        this.raise(TSErrors.UnsupportedSignatureParameterKind, {
  	          at: pattern,
  	          type: pattern.type
  	        });
  	      }

  	      return pattern;
  	    });
  	  }

  	  tsParseTypeMemberSemicolon() {
  	    if (!this.eat(12) && !this.isLineTerminator()) {
  	      this.expect(13);
  	    }
  	  }

  	  tsParseSignatureMember(kind, node) {
  	    this.tsFillSignature(14, node);
  	    this.tsParseTypeMemberSemicolon();
  	    return this.finishNode(node, kind);
  	  }

  	  tsIsUnambiguouslyIndexSignature() {
  	    this.next();

  	    if (tokenIsIdentifier(this.state.type)) {
  	      this.next();
  	      return this.match(14);
  	    }

  	    return false;
  	  }

  	  tsTryParseIndexSignature(node) {
  	    if (!(this.match(0) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) {
  	      return undefined;
  	    }

  	    this.expect(0);
  	    const id = this.parseIdentifier();
  	    id.typeAnnotation = this.tsParseTypeAnnotation();
  	    this.resetEndLocation(id);
  	    this.expect(3);
  	    node.parameters = [id];
  	    const type = this.tsTryParseTypeAnnotation();
  	    if (type) node.typeAnnotation = type;
  	    this.tsParseTypeMemberSemicolon();
  	    return this.finishNode(node, "TSIndexSignature");
  	  }

  	  tsParsePropertyOrMethodSignature(node, readonly) {
  	    if (this.eat(17)) node.optional = true;
  	    const nodeAny = node;

  	    if (this.match(10) || this.match(47)) {
  	      if (readonly) {
  	        this.raise(TSErrors.ReadonlyForMethodSignature, {
  	          at: node
  	        });
  	      }

  	      const method = nodeAny;

  	      if (method.kind && this.match(47)) {
  	        this.raise(TSErrors.AccesorCannotHaveTypeParameters, {
  	          at: this.state.curPosition()
  	        });
  	      }

  	      this.tsFillSignature(14, method);
  	      this.tsParseTypeMemberSemicolon();
  	      const paramsKey = "parameters";
  	      const returnTypeKey = "typeAnnotation";

  	      if (method.kind === "get") {
  	        if (method[paramsKey].length > 0) {
  	          this.raise(Errors.BadGetterArity, {
  	            at: this.state.curPosition()
  	          });

  	          if (this.isThisParam(method[paramsKey][0])) {
  	            this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
  	              at: this.state.curPosition()
  	            });
  	          }
  	        }
  	      } else if (method.kind === "set") {
  	        if (method[paramsKey].length !== 1) {
  	          this.raise(Errors.BadSetterArity, {
  	            at: this.state.curPosition()
  	          });
  	        } else {
  	          const firstParameter = method[paramsKey][0];

  	          if (this.isThisParam(firstParameter)) {
  	            this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
  	              at: this.state.curPosition()
  	            });
  	          }

  	          if (firstParameter.type === "Identifier" && firstParameter.optional) {
  	            this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, {
  	              at: this.state.curPosition()
  	            });
  	          }

  	          if (firstParameter.type === "RestElement") {
  	            this.raise(TSErrors.SetAccesorCannotHaveRestParameter, {
  	              at: this.state.curPosition()
  	            });
  	          }
  	        }

  	        if (method[returnTypeKey]) {
  	          this.raise(TSErrors.SetAccesorCannotHaveReturnType, {
  	            at: method[returnTypeKey]
  	          });
  	        }
  	      } else {
  	        method.kind = "method";
  	      }

  	      return this.finishNode(method, "TSMethodSignature");
  	    } else {
  	      const property = nodeAny;
  	      if (readonly) property.readonly = true;
  	      const type = this.tsTryParseTypeAnnotation();
  	      if (type) property.typeAnnotation = type;
  	      this.tsParseTypeMemberSemicolon();
  	      return this.finishNode(property, "TSPropertySignature");
  	    }
  	  }

  	  tsParseTypeMember() {
  	    const node = this.startNode();

  	    if (this.match(10) || this.match(47)) {
  	      return this.tsParseSignatureMember("TSCallSignatureDeclaration", node);
  	    }

  	    if (this.match(77)) {
  	      const id = this.startNode();
  	      this.next();

  	      if (this.match(10) || this.match(47)) {
  	        return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node);
  	      } else {
  	        node.key = this.createIdentifier(id, "new");
  	        return this.tsParsePropertyOrMethodSignature(node, false);
  	      }
  	    }

  	    this.tsParseModifiers({
  	      modified: node,
  	      allowedModifiers: ["readonly"],
  	      disallowedModifiers: ["declare", "abstract", "private", "protected", "public", "static", "override"]
  	    });
  	    const idx = this.tsTryParseIndexSignature(node);

  	    if (idx) {
  	      return idx;
  	    }

  	    super.parsePropertyName(node);

  	    if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) {
  	      node.kind = node.key.name;
  	      super.parsePropertyName(node);
  	    }

  	    return this.tsParsePropertyOrMethodSignature(node, !!node.readonly);
  	  }

  	  tsParseTypeLiteral() {
  	    const node = this.startNode();
  	    node.members = this.tsParseObjectTypeMembers();
  	    return this.finishNode(node, "TSTypeLiteral");
  	  }

  	  tsParseObjectTypeMembers() {
  	    this.expect(5);
  	    const members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this));
  	    this.expect(8);
  	    return members;
  	  }

  	  tsIsStartOfMappedType() {
  	    this.next();

  	    if (this.eat(53)) {
  	      return this.isContextual(118);
  	    }

  	    if (this.isContextual(118)) {
  	      this.next();
  	    }

  	    if (!this.match(0)) {
  	      return false;
  	    }

  	    this.next();

  	    if (!this.tsIsIdentifier()) {
  	      return false;
  	    }

  	    this.next();
  	    return this.match(58);
  	  }

  	  tsParseMappedTypeParameter() {
  	    const node = this.startNode();
  	    node.name = this.tsParseTypeParameterName();
  	    node.constraint = this.tsExpectThenParseType(58);
  	    return this.finishNode(node, "TSTypeParameter");
  	  }

  	  tsParseMappedType() {
  	    const node = this.startNode();
  	    this.expect(5);

  	    if (this.match(53)) {
  	      node.readonly = this.state.value;
  	      this.next();
  	      this.expectContextual(118);
  	    } else if (this.eatContextual(118)) {
  	      node.readonly = true;
  	    }

  	    this.expect(0);
  	    node.typeParameter = this.tsParseMappedTypeParameter();
  	    node.nameType = this.eatContextual(93) ? this.tsParseType() : null;
  	    this.expect(3);

  	    if (this.match(53)) {
  	      node.optional = this.state.value;
  	      this.next();
  	      this.expect(17);
  	    } else if (this.eat(17)) {
  	      node.optional = true;
  	    }

  	    node.typeAnnotation = this.tsTryParseType();
  	    this.semicolon();
  	    this.expect(8);
  	    return this.finishNode(node, "TSMappedType");
  	  }

  	  tsParseTupleType() {
  	    const node = this.startNode();
  	    node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
  	    let seenOptionalElement = false;
  	    let labeledElements = null;
  	    node.elementTypes.forEach(elementNode => {
  	      var _labeledElements;

  	      const {
  	        type
  	      } = elementNode;

  	      if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
  	        this.raise(TSErrors.OptionalTypeBeforeRequired, {
  	          at: elementNode
  	        });
  	      }

  	      seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
  	      let checkType = type;

  	      if (type === "TSRestType") {
  	        elementNode = elementNode.typeAnnotation;
  	        checkType = elementNode.type;
  	      }

  	      const isLabeled = checkType === "TSNamedTupleMember";
  	      (_labeledElements = labeledElements) != null ? _labeledElements : labeledElements = isLabeled;

  	      if (labeledElements !== isLabeled) {
  	        this.raise(TSErrors.MixedLabeledAndUnlabeledElements, {
  	          at: elementNode
  	        });
  	      }
  	    });
  	    return this.finishNode(node, "TSTupleType");
  	  }

  	  tsParseTupleElementType() {
  	    const {
  	      start: startPos,
  	      startLoc
  	    } = this.state;
  	    const rest = this.eat(21);
  	    let type = this.tsParseType();
  	    const optional = this.eat(17);
  	    const labeled = this.eat(14);

  	    if (labeled) {
  	      const labeledNode = this.startNodeAtNode(type);
  	      labeledNode.optional = optional;

  	      if (type.type === "TSTypeReference" && !type.typeParameters && type.typeName.type === "Identifier") {
  	        labeledNode.label = type.typeName;
  	      } else {
  	        this.raise(TSErrors.InvalidTupleMemberLabel, {
  	          at: type
  	        });
  	        labeledNode.label = type;
  	      }

  	      labeledNode.elementType = this.tsParseType();
  	      type = this.finishNode(labeledNode, "TSNamedTupleMember");
  	    } else if (optional) {
  	      const optionalTypeNode = this.startNodeAtNode(type);
  	      optionalTypeNode.typeAnnotation = type;
  	      type = this.finishNode(optionalTypeNode, "TSOptionalType");
  	    }

  	    if (rest) {
  	      const restNode = this.startNodeAt(startPos, startLoc);
  	      restNode.typeAnnotation = type;
  	      type = this.finishNode(restNode, "TSRestType");
  	    }

  	    return type;
  	  }

  	  tsParseParenthesizedType() {
  	    const node = this.startNode();
  	    this.expect(10);
  	    node.typeAnnotation = this.tsParseType();
  	    this.expect(11);
  	    return this.finishNode(node, "TSParenthesizedType");
  	  }

  	  tsParseFunctionOrConstructorType(type, abstract) {
  	    const node = this.startNode();

  	    if (type === "TSConstructorType") {
  	      node.abstract = !!abstract;
  	      if (abstract) this.next();
  	      this.next();
  	    }

  	    this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(19, node));
  	    return this.finishNode(node, type);
  	  }

  	  tsParseLiteralTypeNode() {
  	    const node = this.startNode();

  	    node.literal = (() => {
  	      switch (this.state.type) {
  	        case 130:
  	        case 131:
  	        case 129:
  	        case 85:
  	        case 86:
  	          return super.parseExprAtom();

  	        default:
  	          throw this.unexpected();
  	      }
  	    })();

  	    return this.finishNode(node, "TSLiteralType");
  	  }

  	  tsParseTemplateLiteralType() {
  	    const node = this.startNode();
  	    node.literal = super.parseTemplate(false);
  	    return this.finishNode(node, "TSLiteralType");
  	  }

  	  parseTemplateSubstitution() {
  	    if (this.state.inType) return this.tsParseType();
  	    return super.parseTemplateSubstitution();
  	  }

  	  tsParseThisTypeOrThisTypePredicate() {
  	    const thisKeyword = this.tsParseThisTypeNode();

  	    if (this.isContextual(113) && !this.hasPrecedingLineBreak()) {
  	      return this.tsParseThisTypePredicate(thisKeyword);
  	    } else {
  	      return thisKeyword;
  	    }
  	  }

  	  tsParseNonArrayType() {
  	    switch (this.state.type) {
  	      case 129:
  	      case 130:
  	      case 131:
  	      case 85:
  	      case 86:
  	        return this.tsParseLiteralTypeNode();

  	      case 53:
  	        if (this.state.value === "-") {
  	          const node = this.startNode();
  	          const nextToken = this.lookahead();

  	          if (nextToken.type !== 130 && nextToken.type !== 131) {
  	            throw this.unexpected();
  	          }

  	          node.literal = this.parseMaybeUnary();
  	          return this.finishNode(node, "TSLiteralType");
  	        }

  	        break;

  	      case 78:
  	        return this.tsParseThisTypeOrThisTypePredicate();

  	      case 87:
  	        return this.tsParseTypeQuery();

  	      case 83:
  	        return this.tsParseImportType();

  	      case 5:
  	        return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral();

  	      case 0:
  	        return this.tsParseTupleType();

  	      case 10:
  	        return this.tsParseParenthesizedType();

  	      case 25:
  	      case 24:
  	        return this.tsParseTemplateLiteralType();

  	      default:
  	        {
  	          const {
  	            type
  	          } = this.state;

  	          if (tokenIsIdentifier(type) || type === 88 || type === 84) {
  	            const nodeType = type === 88 ? "TSVoidKeyword" : type === 84 ? "TSNullKeyword" : keywordTypeFromName(this.state.value);

  	            if (nodeType !== undefined && this.lookaheadCharCode() !== 46) {
  	              const node = this.startNode();
  	              this.next();
  	              return this.finishNode(node, nodeType);
  	            }

  	            return this.tsParseTypeReference();
  	          }
  	        }
  	    }

  	    throw this.unexpected();
  	  }

  	  tsParseArrayTypeOrHigher() {
  	    let type = this.tsParseNonArrayType();

  	    while (!this.hasPrecedingLineBreak() && this.eat(0)) {
  	      if (this.match(3)) {
  	        const node = this.startNodeAtNode(type);
  	        node.elementType = type;
  	        this.expect(3);
  	        type = this.finishNode(node, "TSArrayType");
  	      } else {
  	        const node = this.startNodeAtNode(type);
  	        node.objectType = type;
  	        node.indexType = this.tsParseType();
  	        this.expect(3);
  	        type = this.finishNode(node, "TSIndexedAccessType");
  	      }
  	    }

  	    return type;
  	  }

  	  tsParseTypeOperator() {
  	    const node = this.startNode();
  	    const operator = this.state.value;
  	    this.next();
  	    node.operator = operator;
  	    node.typeAnnotation = this.tsParseTypeOperatorOrHigher();

  	    if (operator === "readonly") {
  	      this.tsCheckTypeAnnotationForReadOnly(node);
  	    }

  	    return this.finishNode(node, "TSTypeOperator");
  	  }

  	  tsCheckTypeAnnotationForReadOnly(node) {
  	    switch (node.typeAnnotation.type) {
  	      case "TSTupleType":
  	      case "TSArrayType":
  	        return;

  	      default:
  	        this.raise(TSErrors.UnexpectedReadonly, {
  	          at: node
  	        });
  	    }
  	  }

  	  tsParseInferType() {
  	    const node = this.startNode();
  	    this.expectContextual(112);
  	    const typeParameter = this.startNode();
  	    typeParameter.name = this.tsParseTypeParameterName();
  	    typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
  	    node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
  	    return this.finishNode(node, "TSInferType");
  	  }

  	  tsParseConstraintForInferType() {
  	    if (this.eat(81)) {
  	      const constraint = this.tsInDisallowConditionalTypesContext(() => this.tsParseType());

  	      if (this.state.inDisallowConditionalTypesContext || !this.match(17)) {
  	        return constraint;
  	      }
  	    }
  	  }

  	  tsParseTypeOperatorOrHigher() {
  	    const isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc;
  	    return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher());
  	  }

  	  tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
  	    const node = this.startNode();
  	    const hasLeadingOperator = this.eat(operator);
  	    const types = [];

  	    do {
  	      types.push(parseConstituentType());
  	    } while (this.eat(operator));

  	    if (types.length === 1 && !hasLeadingOperator) {
  	      return types[0];
  	    }

  	    node.types = types;
  	    return this.finishNode(node, kind);
  	  }

  	  tsParseIntersectionTypeOrHigher() {
  	    return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 45);
  	  }

  	  tsParseUnionTypeOrHigher() {
  	    return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 43);
  	  }

  	  tsIsStartOfFunctionType() {
  	    if (this.match(47)) {
  	      return true;
  	    }

  	    return this.match(10) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));
  	  }

  	  tsSkipParameterStart() {
  	    if (tokenIsIdentifier(this.state.type) || this.match(78)) {
  	      this.next();
  	      return true;
  	    }

  	    if (this.match(5)) {
  	      const {
  	        errors
  	      } = this.state;
  	      const previousErrorCount = errors.length;

  	      try {
  	        this.parseObjectLike(8, true);
  	        return errors.length === previousErrorCount;
  	      } catch (_unused) {
  	        return false;
  	      }
  	    }

  	    if (this.match(0)) {
  	      this.next();
  	      const {
  	        errors
  	      } = this.state;
  	      const previousErrorCount = errors.length;

  	      try {
  	        super.parseBindingList(3, 93, true);
  	        return errors.length === previousErrorCount;
  	      } catch (_unused2) {
  	        return false;
  	      }
  	    }

  	    return false;
  	  }

  	  tsIsUnambiguouslyStartOfFunctionType() {
  	    this.next();

  	    if (this.match(11) || this.match(21)) {
  	      return true;
  	    }

  	    if (this.tsSkipParameterStart()) {
  	      if (this.match(14) || this.match(12) || this.match(17) || this.match(29)) {
  	        return true;
  	      }

  	      if (this.match(11)) {
  	        this.next();

  	        if (this.match(19)) {
  	          return true;
  	        }
  	      }
  	    }

  	    return false;
  	  }

  	  tsParseTypeOrTypePredicateAnnotation(returnToken) {
  	    return this.tsInType(() => {
  	      const t = this.startNode();
  	      this.expect(returnToken);
  	      const node = this.startNode();
  	      const asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));

  	      if (asserts && this.match(78)) {
  	        let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();

  	        if (thisTypePredicate.type === "TSThisType") {
  	          node.parameterName = thisTypePredicate;
  	          node.asserts = true;
  	          node.typeAnnotation = null;
  	          thisTypePredicate = this.finishNode(node, "TSTypePredicate");
  	        } else {
  	          this.resetStartLocationFromNode(thisTypePredicate, node);
  	          thisTypePredicate.asserts = true;
  	        }

  	        t.typeAnnotation = thisTypePredicate;
  	        return this.finishNode(t, "TSTypeAnnotation");
  	      }

  	      const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));

  	      if (!typePredicateVariable) {
  	        if (!asserts) {
  	          return this.tsParseTypeAnnotation(false, t);
  	        }

  	        node.parameterName = this.parseIdentifier();
  	        node.asserts = asserts;
  	        node.typeAnnotation = null;
  	        t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
  	        return this.finishNode(t, "TSTypeAnnotation");
  	      }

  	      const type = this.tsParseTypeAnnotation(false);
  	      node.parameterName = typePredicateVariable;
  	      node.typeAnnotation = type;
  	      node.asserts = asserts;
  	      t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
  	      return this.finishNode(t, "TSTypeAnnotation");
  	    });
  	  }

  	  tsTryParseTypeOrTypePredicateAnnotation() {
  	    return this.match(14) ? this.tsParseTypeOrTypePredicateAnnotation(14) : undefined;
  	  }

  	  tsTryParseTypeAnnotation() {
  	    return this.match(14) ? this.tsParseTypeAnnotation() : undefined;
  	  }

  	  tsTryParseType() {
  	    return this.tsEatThenParseType(14);
  	  }

  	  tsParseTypePredicatePrefix() {
  	    const id = this.parseIdentifier();

  	    if (this.isContextual(113) && !this.hasPrecedingLineBreak()) {
  	      this.next();
  	      return id;
  	    }
  	  }

  	  tsParseTypePredicateAsserts() {
  	    if (this.state.type !== 106) {
  	      return false;
  	    }

  	    const containsEsc = this.state.containsEsc;
  	    this.next();

  	    if (!tokenIsIdentifier(this.state.type) && !this.match(78)) {
  	      return false;
  	    }

  	    if (containsEsc) {
  	      this.raise(Errors.InvalidEscapedReservedWord, {
  	        at: this.state.lastTokStartLoc,
  	        reservedWord: "asserts"
  	      });
  	    }

  	    return true;
  	  }

  	  tsParseTypeAnnotation(eatColon = true, t = this.startNode()) {
  	    this.tsInType(() => {
  	      if (eatColon) this.expect(14);
  	      t.typeAnnotation = this.tsParseType();
  	    });
  	    return this.finishNode(t, "TSTypeAnnotation");
  	  }

  	  tsParseType() {
  	    assert(this.state.inType);
  	    const type = this.tsParseNonConditionalType();

  	    if (this.state.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(81)) {
  	      return type;
  	    }

  	    const node = this.startNodeAtNode(type);
  	    node.checkType = type;
  	    node.extendsType = this.tsInDisallowConditionalTypesContext(() => this.tsParseNonConditionalType());
  	    this.expect(17);
  	    node.trueType = this.tsInAllowConditionalTypesContext(() => this.tsParseType());
  	    this.expect(14);
  	    node.falseType = this.tsInAllowConditionalTypesContext(() => this.tsParseType());
  	    return this.finishNode(node, "TSConditionalType");
  	  }

  	  isAbstractConstructorSignature() {
  	    return this.isContextual(120) && this.lookahead().type === 77;
  	  }

  	  tsParseNonConditionalType() {
  	    if (this.tsIsStartOfFunctionType()) {
  	      return this.tsParseFunctionOrConstructorType("TSFunctionType");
  	    }

  	    if (this.match(77)) {
  	      return this.tsParseFunctionOrConstructorType("TSConstructorType");
  	    } else if (this.isAbstractConstructorSignature()) {
  	      return this.tsParseFunctionOrConstructorType("TSConstructorType", true);
  	    }

  	    return this.tsParseUnionTypeOrHigher();
  	  }

  	  tsParseTypeAssertion() {
  	    if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
  	      this.raise(TSErrors.ReservedTypeAssertion, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    const node = this.startNode();

  	    const _const = this.tsTryNextParseConstantContext();

  	    node.typeAnnotation = _const || this.tsNextThenParseType();
  	    this.expect(48);
  	    node.expression = this.parseMaybeUnary();
  	    return this.finishNode(node, "TSTypeAssertion");
  	  }

  	  tsParseHeritageClause(token) {
  	    const originalStartLoc = this.state.startLoc;
  	    const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
  	      const node = this.startNode();
  	      node.expression = this.tsParseEntityName();

  	      if (this.match(47)) {
  	        node.typeParameters = this.tsParseTypeArguments();
  	      }

  	      return this.finishNode(node, "TSExpressionWithTypeArguments");
  	    });

  	    if (!delimitedList.length) {
  	      this.raise(TSErrors.EmptyHeritageClauseType, {
  	        at: originalStartLoc,
  	        token
  	      });
  	    }

  	    return delimitedList;
  	  }

  	  tsParseInterfaceDeclaration(node, properties = {}) {
  	    if (this.hasFollowingLineBreak()) return null;
  	    this.expectContextual(125);
  	    if (properties.declare) node.declare = true;

  	    if (tokenIsIdentifier(this.state.type)) {
  	      node.id = this.parseIdentifier();
  	      this.checkIdentifier(node.id, BIND_TS_INTERFACE);
  	    } else {
  	      node.id = null;
  	      this.raise(TSErrors.MissingInterfaceName, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));

  	    if (this.eat(81)) {
  	      node.extends = this.tsParseHeritageClause("extends");
  	    }

  	    const body = this.startNode();
  	    body.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this));
  	    node.body = this.finishNode(body, "TSInterfaceBody");
  	    return this.finishNode(node, "TSInterfaceDeclaration");
  	  }

  	  tsParseTypeAliasDeclaration(node) {
  	    node.id = this.parseIdentifier();
  	    this.checkIdentifier(node.id, BIND_TS_TYPE);
  	    node.typeAnnotation = this.tsInType(() => {
  	      node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));
  	      this.expect(29);

  	      if (this.isContextual(111) && this.lookahead().type !== 16) {
  	        const node = this.startNode();
  	        this.next();
  	        return this.finishNode(node, "TSIntrinsicKeyword");
  	      }

  	      return this.tsParseType();
  	    });
  	    this.semicolon();
  	    return this.finishNode(node, "TSTypeAliasDeclaration");
  	  }

  	  tsInNoContext(cb) {
  	    const oldContext = this.state.context;
  	    this.state.context = [oldContext[0]];

  	    try {
  	      return cb();
  	    } finally {
  	      this.state.context = oldContext;
  	    }
  	  }

  	  tsInType(cb) {
  	    const oldInType = this.state.inType;
  	    this.state.inType = true;

  	    try {
  	      return cb();
  	    } finally {
  	      this.state.inType = oldInType;
  	    }
  	  }

  	  tsInDisallowConditionalTypesContext(cb) {
  	    const oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
  	    this.state.inDisallowConditionalTypesContext = true;

  	    try {
  	      return cb();
  	    } finally {
  	      this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
  	    }
  	  }

  	  tsInAllowConditionalTypesContext(cb) {
  	    const oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
  	    this.state.inDisallowConditionalTypesContext = false;

  	    try {
  	      return cb();
  	    } finally {
  	      this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
  	    }
  	  }

  	  tsEatThenParseType(token) {
  	    return !this.match(token) ? undefined : this.tsNextThenParseType();
  	  }

  	  tsExpectThenParseType(token) {
  	    return this.tsDoThenParseType(() => this.expect(token));
  	  }

  	  tsNextThenParseType() {
  	    return this.tsDoThenParseType(() => this.next());
  	  }

  	  tsDoThenParseType(cb) {
  	    return this.tsInType(() => {
  	      cb();
  	      return this.tsParseType();
  	    });
  	  }

  	  tsParseEnumMember() {
  	    const node = this.startNode();
  	    node.id = this.match(129) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);

  	    if (this.eat(29)) {
  	      node.initializer = super.parseMaybeAssignAllowIn();
  	    }

  	    return this.finishNode(node, "TSEnumMember");
  	  }

  	  tsParseEnumDeclaration(node, properties = {}) {
  	    if (properties.const) node.const = true;
  	    if (properties.declare) node.declare = true;
  	    this.expectContextual(122);
  	    node.id = this.parseIdentifier();
  	    this.checkIdentifier(node.id, node.const ? BIND_TS_CONST_ENUM : BIND_TS_ENUM);
  	    this.expect(5);
  	    node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
  	    this.expect(8);
  	    return this.finishNode(node, "TSEnumDeclaration");
  	  }

  	  tsParseModuleBlock() {
  	    const node = this.startNode();
  	    this.scope.enter(SCOPE_OTHER);
  	    this.expect(5);
  	    super.parseBlockOrModuleBlockBody(node.body = [], undefined, true, 8);
  	    this.scope.exit();
  	    return this.finishNode(node, "TSModuleBlock");
  	  }

  	  tsParseModuleOrNamespaceDeclaration(node, nested = false) {
  	    node.id = this.parseIdentifier();

  	    if (!nested) {
  	      this.checkIdentifier(node.id, BIND_TS_NAMESPACE);
  	    }

  	    if (this.eat(16)) {
  	      const inner = this.startNode();
  	      this.tsParseModuleOrNamespaceDeclaration(inner, true);
  	      node.body = inner;
  	    } else {
  	      this.scope.enter(SCOPE_TS_MODULE);
  	      this.prodParam.enter(PARAM);
  	      node.body = this.tsParseModuleBlock();
  	      this.prodParam.exit();
  	      this.scope.exit();
  	    }

  	    return this.finishNode(node, "TSModuleDeclaration");
  	  }

  	  tsParseAmbientExternalModuleDeclaration(node) {
  	    if (this.isContextual(109)) {
  	      node.global = true;
  	      node.id = this.parseIdentifier();
  	    } else if (this.match(129)) {
  	      node.id = super.parseStringLiteral(this.state.value);
  	    } else {
  	      this.unexpected();
  	    }

  	    if (this.match(5)) {
  	      this.scope.enter(SCOPE_TS_MODULE);
  	      this.prodParam.enter(PARAM);
  	      node.body = this.tsParseModuleBlock();
  	      this.prodParam.exit();
  	      this.scope.exit();
  	    } else {
  	      this.semicolon();
  	    }

  	    return this.finishNode(node, "TSModuleDeclaration");
  	  }

  	  tsParseImportEqualsDeclaration(node, isExport) {
  	    node.isExport = isExport || false;
  	    node.id = this.parseIdentifier();
  	    this.checkIdentifier(node.id, BIND_LEXICAL);
  	    this.expect(29);
  	    const moduleReference = this.tsParseModuleReference();

  	    if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
  	      this.raise(TSErrors.ImportAliasHasImportType, {
  	        at: moduleReference
  	      });
  	    }

  	    node.moduleReference = moduleReference;
  	    this.semicolon();
  	    return this.finishNode(node, "TSImportEqualsDeclaration");
  	  }

  	  tsIsExternalModuleReference() {
  	    return this.isContextual(116) && this.lookaheadCharCode() === 40;
  	  }

  	  tsParseModuleReference() {
  	    return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(false);
  	  }

  	  tsParseExternalModuleReference() {
  	    const node = this.startNode();
  	    this.expectContextual(116);
  	    this.expect(10);

  	    if (!this.match(129)) {
  	      throw this.unexpected();
  	    }

  	    node.expression = super.parseExprAtom();
  	    this.expect(11);
  	    return this.finishNode(node, "TSExternalModuleReference");
  	  }

  	  tsLookAhead(f) {
  	    const state = this.state.clone();
  	    const res = f();
  	    this.state = state;
  	    return res;
  	  }

  	  tsTryParseAndCatch(f) {
  	    const result = this.tryParse(abort => f() || abort());
  	    if (result.aborted || !result.node) return undefined;
  	    if (result.error) this.state = result.failState;
  	    return result.node;
  	  }

  	  tsTryParse(f) {
  	    const state = this.state.clone();
  	    const result = f();

  	    if (result !== undefined && result !== false) {
  	      return result;
  	    } else {
  	      this.state = state;
  	      return undefined;
  	    }
  	  }

  	  tsTryParseDeclare(nany) {
  	    if (this.isLineTerminator()) {
  	      return;
  	    }

  	    let starttype = this.state.type;
  	    let kind;

  	    if (this.isContextual(99)) {
  	      starttype = 74;
  	      kind = "let";
  	    }

  	    return this.tsInAmbientContext(() => {
  	      if (starttype === 68) {
  	        nany.declare = true;
  	        return super.parseFunctionStatement(nany, false, true);
  	      }

  	      if (starttype === 80) {
  	        nany.declare = true;
  	        return this.parseClass(nany, true, false);
  	      }

  	      if (starttype === 122) {
  	        return this.tsParseEnumDeclaration(nany, {
  	          declare: true
  	        });
  	      }

  	      if (starttype === 109) {
  	        return this.tsParseAmbientExternalModuleDeclaration(nany);
  	      }

  	      if (starttype === 75 || starttype === 74) {
  	        if (!this.match(75) || !this.isLookaheadContextual("enum")) {
  	          nany.declare = true;
  	          return this.parseVarStatement(nany, kind || this.state.value, true);
  	        }

  	        this.expect(75);
  	        return this.tsParseEnumDeclaration(nany, {
  	          const: true,
  	          declare: true
  	        });
  	      }

  	      if (starttype === 125) {
  	        const result = this.tsParseInterfaceDeclaration(nany, {
  	          declare: true
  	        });
  	        if (result) return result;
  	      }

  	      if (tokenIsIdentifier(starttype)) {
  	        return this.tsParseDeclaration(nany, this.state.value, true);
  	      }
  	    });
  	  }

  	  tsTryParseExportDeclaration() {
  	    return this.tsParseDeclaration(this.startNode(), this.state.value, true);
  	  }

  	  tsParseExpressionStatement(node, expr) {
  	    switch (expr.name) {
  	      case "declare":
  	        {
  	          const declaration = this.tsTryParseDeclare(node);

  	          if (declaration) {
  	            declaration.declare = true;
  	            return declaration;
  	          }

  	          break;
  	        }

  	      case "global":
  	        if (this.match(5)) {
  	          this.scope.enter(SCOPE_TS_MODULE);
  	          this.prodParam.enter(PARAM);
  	          const mod = node;
  	          mod.global = true;
  	          mod.id = expr;
  	          mod.body = this.tsParseModuleBlock();
  	          this.scope.exit();
  	          this.prodParam.exit();
  	          return this.finishNode(mod, "TSModuleDeclaration");
  	        }

  	        break;

  	      default:
  	        return this.tsParseDeclaration(node, expr.name, false);
  	    }
  	  }

  	  tsParseDeclaration(node, value, next) {
  	    switch (value) {
  	      case "abstract":
  	        if (this.tsCheckLineTerminator(next) && (this.match(80) || tokenIsIdentifier(this.state.type))) {
  	          return this.tsParseAbstractDeclaration(node);
  	        }

  	        break;

  	      case "module":
  	        if (this.tsCheckLineTerminator(next)) {
  	          if (this.match(129)) {
  	            return this.tsParseAmbientExternalModuleDeclaration(node);
  	          } else if (tokenIsIdentifier(this.state.type)) {
  	            return this.tsParseModuleOrNamespaceDeclaration(node);
  	          }
  	        }

  	        break;

  	      case "namespace":
  	        if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
  	          return this.tsParseModuleOrNamespaceDeclaration(node);
  	        }

  	        break;

  	      case "type":
  	        if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
  	          return this.tsParseTypeAliasDeclaration(node);
  	        }

  	        break;
  	    }
  	  }

  	  tsCheckLineTerminator(next) {
  	    if (next) {
  	      if (this.hasFollowingLineBreak()) return false;
  	      this.next();
  	      return true;
  	    }

  	    return !this.isLineTerminator();
  	  }

  	  tsTryParseGenericAsyncArrowFunction(startPos, startLoc) {
  	    if (!this.match(47)) {
  	      return undefined;
  	    }

  	    const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
  	    this.state.maybeInArrowParameters = true;
  	    const res = this.tsTryParseAndCatch(() => {
  	      const node = this.startNodeAt(startPos, startLoc);
  	      node.typeParameters = this.tsParseTypeParameters();
  	      super.parseFunctionParams(node);
  	      node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation();
  	      this.expect(19);
  	      return node;
  	    });
  	    this.state.maybeInArrowParameters = oldMaybeInArrowParameters;

  	    if (!res) {
  	      return undefined;
  	    }

  	    return super.parseArrowExpression(res, null, true);
  	  }

  	  tsParseTypeArgumentsInExpression() {
  	    if (this.reScan_lt() !== 47) {
  	      return undefined;
  	    }

  	    return this.tsParseTypeArguments();
  	  }

  	  tsParseTypeArguments() {
  	    const node = this.startNode();
  	    node.params = this.tsInType(() => this.tsInNoContext(() => {
  	      this.expect(47);
  	      return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
  	    }));

  	    if (node.params.length === 0) {
  	      this.raise(TSErrors.EmptyTypeArguments, {
  	        at: node
  	      });
  	    }

  	    this.expect(48);
  	    return this.finishNode(node, "TSTypeParameterInstantiation");
  	  }

  	  tsIsDeclarationStart() {
  	    return tokenIsTSDeclarationStart(this.state.type);
  	  }

  	  isExportDefaultSpecifier() {
  	    if (this.tsIsDeclarationStart()) return false;
  	    return super.isExportDefaultSpecifier();
  	  }

  	  parseAssignableListItem(allowModifiers, decorators) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    let accessibility;
  	    let readonly = false;
  	    let override = false;

  	    if (allowModifiers !== undefined) {
  	      const modified = {};
  	      this.tsParseModifiers({
  	        modified,
  	        allowedModifiers: ["public", "private", "protected", "override", "readonly"]
  	      });
  	      accessibility = modified.accessibility;
  	      override = modified.override;
  	      readonly = modified.readonly;

  	      if (allowModifiers === false && (accessibility || readonly || override)) {
  	        this.raise(TSErrors.UnexpectedParameterModifier, {
  	          at: startLoc
  	        });
  	      }
  	    }

  	    const left = this.parseMaybeDefault();
  	    this.parseAssignableListItemTypes(left);
  	    const elt = this.parseMaybeDefault(left.start, left.loc.start, left);

  	    if (accessibility || readonly || override) {
  	      const pp = this.startNodeAt(startPos, startLoc);

  	      if (decorators.length) {
  	        pp.decorators = decorators;
  	      }

  	      if (accessibility) pp.accessibility = accessibility;
  	      if (readonly) pp.readonly = readonly;
  	      if (override) pp.override = override;

  	      if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
  	        this.raise(TSErrors.UnsupportedParameterPropertyKind, {
  	          at: pp
  	        });
  	      }

  	      pp.parameter = elt;
  	      return this.finishNode(pp, "TSParameterProperty");
  	    }

  	    if (decorators.length) {
  	      left.decorators = decorators;
  	    }

  	    return elt;
  	  }

  	  isSimpleParameter(node) {
  	    return node.type === "TSParameterProperty" && super.isSimpleParameter(node.parameter) || super.isSimpleParameter(node);
  	  }

  	  parseFunctionBodyAndFinish(node, type, isMethod = false) {
  	    if (this.match(14)) {
  	      node.returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
  	    }

  	    const bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" || type === "ClassPrivateMethod" ? "TSDeclareMethod" : undefined;

  	    if (bodilessType && !this.match(5) && this.isLineTerminator()) {
  	      return this.finishNode(node, bodilessType);
  	    }

  	    if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
  	      this.raise(TSErrors.DeclareFunctionHasImplementation, {
  	        at: node
  	      });

  	      if (node.declare) {
  	        return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
  	      }
  	    }

  	    return super.parseFunctionBodyAndFinish(node, type, isMethod);
  	  }

  	  registerFunctionStatementId(node) {
  	    if (!node.body && node.id) {
  	      this.checkIdentifier(node.id, BIND_TS_AMBIENT);
  	    } else {
  	      super.registerFunctionStatementId(node);
  	    }
  	  }

  	  tsCheckForInvalidTypeCasts(items) {
  	    items.forEach(node => {
  	      if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
  	        this.raise(TSErrors.UnexpectedTypeAnnotation, {
  	          at: node.typeAnnotation
  	        });
  	      }
  	    });
  	  }

  	  toReferencedList(exprList, isInParens) {
  	    this.tsCheckForInvalidTypeCasts(exprList);
  	    return exprList;
  	  }

  	  parseArrayLike(...args) {
  	    const node = super.parseArrayLike(...args);

  	    if (node.type === "ArrayExpression") {
  	      this.tsCheckForInvalidTypeCasts(node.elements);
  	    }

  	    return node;
  	  }

  	  parseSubscript(base, startPos, startLoc, noCalls, state) {
  	    if (!this.hasPrecedingLineBreak() && this.match(35)) {
  	      this.state.canStartJSXElement = false;
  	      this.next();
  	      const nonNullExpression = this.startNodeAt(startPos, startLoc);
  	      nonNullExpression.expression = base;
  	      return this.finishNode(nonNullExpression, "TSNonNullExpression");
  	    }

  	    let isOptionalCall = false;

  	    if (this.match(18) && this.lookaheadCharCode() === 60) {
  	      if (noCalls) {
  	        state.stop = true;
  	        return base;
  	      }

  	      state.optionalChainMember = isOptionalCall = true;
  	      this.next();
  	    }

  	    if (this.match(47) || this.match(51)) {
  	      let missingParenErrorLoc;
  	      const result = this.tsTryParseAndCatch(() => {
  	        if (!noCalls && this.atPossibleAsyncArrow(base)) {
  	          const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startPos, startLoc);

  	          if (asyncArrowFn) {
  	            return asyncArrowFn;
  	          }
  	        }

  	        const typeArguments = this.tsParseTypeArgumentsInExpression();
  	        if (!typeArguments) return;

  	        if (isOptionalCall && !this.match(10)) {
  	          missingParenErrorLoc = this.state.curPosition();
  	          return;
  	        }

  	        if (tokenIsTemplate(this.state.type)) {
  	          const result = super.parseTaggedTemplateExpression(base, startPos, startLoc, state);
  	          result.typeParameters = typeArguments;
  	          return result;
  	        }

  	        if (!noCalls && this.eat(10)) {
  	          const node = this.startNodeAt(startPos, startLoc);
  	          node.callee = base;
  	          node.arguments = this.parseCallExpressionArguments(11, false);
  	          this.tsCheckForInvalidTypeCasts(node.arguments);
  	          node.typeParameters = typeArguments;

  	          if (state.optionalChainMember) {
  	            node.optional = isOptionalCall;
  	          }

  	          return this.finishCallExpression(node, state.optionalChainMember);
  	        }

  	        const tokenType = this.state.type;

  	        if (tokenType === 48 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
  	          return;
  	        }

  	        const node = this.startNodeAt(startPos, startLoc);
  	        node.expression = base;
  	        node.typeParameters = typeArguments;
  	        return this.finishNode(node, "TSInstantiationExpression");
  	      });

  	      if (missingParenErrorLoc) {
  	        this.unexpected(missingParenErrorLoc, 10);
  	      }

  	      if (result) {
  	        if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
  	          this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, {
  	            at: this.state.startLoc
  	          });
  	        }

  	        return result;
  	      }
  	    }

  	    return super.parseSubscript(base, startPos, startLoc, noCalls, state);
  	  }

  	  parseNewCallee(node) {
  	    var _callee$extra;

  	    super.parseNewCallee(node);
  	    const {
  	      callee
  	    } = node;

  	    if (callee.type === "TSInstantiationExpression" && !((_callee$extra = callee.extra) != null && _callee$extra.parenthesized)) {
  	      node.typeParameters = callee.typeParameters;
  	      node.callee = callee.expression;
  	    }
  	  }

  	  parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
  	    if (tokenOperatorPrecedence(58) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual(93)) {
  	      const node = this.startNodeAt(leftStartPos, leftStartLoc);
  	      node.expression = left;

  	      const _const = this.tsTryNextParseConstantContext();

  	      if (_const) {
  	        node.typeAnnotation = _const;
  	      } else {
  	        node.typeAnnotation = this.tsNextThenParseType();
  	      }

  	      this.finishNode(node, "TSAsExpression");
  	      this.reScan_lt_gt();
  	      return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec);
  	    }

  	    return super.parseExprOp(left, leftStartPos, leftStartLoc, minPrec);
  	  }

  	  checkReservedWord(word, startLoc, checkKeywords, isBinding) {
  	    if (!this.state.isAmbientContext) {
  	      super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
  	    }
  	  }

  	  checkDuplicateExports() {}

  	  parseImport(node) {
  	    node.importKind = "value";

  	    if (tokenIsIdentifier(this.state.type) || this.match(55) || this.match(5)) {
  	      let ahead = this.lookahead();

  	      if (this.isContextual(126) && ahead.type !== 12 && ahead.type !== 97 && ahead.type !== 29) {
  	        node.importKind = "type";
  	        this.next();
  	        ahead = this.lookahead();
  	      }

  	      if (tokenIsIdentifier(this.state.type) && ahead.type === 29) {
  	        return this.tsParseImportEqualsDeclaration(node);
  	      }
  	    }

  	    const importNode = super.parseImport(node);

  	    if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
  	      this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, {
  	        at: importNode
  	      });
  	    }

  	    return importNode;
  	  }

  	  parseExport(node) {
  	    if (this.match(83)) {
  	      this.next();

  	      if (this.isContextual(126) && this.lookaheadCharCode() !== 61) {
  	        node.importKind = "type";
  	        this.next();
  	      } else {
  	        node.importKind = "value";
  	      }

  	      return this.tsParseImportEqualsDeclaration(node, true);
  	    } else if (this.eat(29)) {
  	      const assign = node;
  	      assign.expression = super.parseExpression();
  	      this.semicolon();
  	      return this.finishNode(assign, "TSExportAssignment");
  	    } else if (this.eatContextual(93)) {
  	      const decl = node;
  	      this.expectContextual(124);
  	      decl.id = this.parseIdentifier();
  	      this.semicolon();
  	      return this.finishNode(decl, "TSNamespaceExportDeclaration");
  	    } else {
  	      if (this.isContextual(126) && this.lookahead().type === 5) {
  	        this.next();
  	        node.exportKind = "type";
  	      } else {
  	        node.exportKind = "value";
  	      }

  	      return super.parseExport(node);
  	    }
  	  }

  	  isAbstractClass() {
  	    return this.isContextual(120) && this.lookahead().type === 80;
  	  }

  	  parseExportDefaultExpression() {
  	    if (this.isAbstractClass()) {
  	      const cls = this.startNode();
  	      this.next();
  	      cls.abstract = true;
  	      return this.parseClass(cls, true, true);
  	    }

  	    if (this.match(125)) {
  	      const result = this.tsParseInterfaceDeclaration(this.startNode());
  	      if (result) return result;
  	    }

  	    return super.parseExportDefaultExpression();
  	  }

  	  parseVarStatement(node, kind, allowMissingInitializer = false) {
  	    const {
  	      isAmbientContext
  	    } = this.state;
  	    const declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
  	    if (!isAmbientContext) return declaration;

  	    for (const {
  	      id,
  	      init
  	    } of declaration.declarations) {
  	      if (!init) continue;

  	      if (kind !== "const" || !!id.typeAnnotation) {
  	        this.raise(TSErrors.InitializerNotAllowedInAmbientContext, {
  	          at: init
  	        });
  	      } else if (init.type !== "StringLiteral" && init.type !== "BooleanLiteral" && init.type !== "NumericLiteral" && init.type !== "BigIntLiteral" && (init.type !== "TemplateLiteral" || init.expressions.length > 0) && !isPossiblyLiteralEnum(init)) {
  	        this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, {
  	          at: init
  	        });
  	      }
  	    }

  	    return declaration;
  	  }

  	  parseStatementContent(context, topLevel) {
  	    if (this.match(75) && this.isLookaheadContextual("enum")) {
  	      const node = this.startNode();
  	      this.expect(75);
  	      return this.tsParseEnumDeclaration(node, {
  	        const: true
  	      });
  	    }

  	    if (this.isContextual(122)) {
  	      return this.tsParseEnumDeclaration(this.startNode());
  	    }

  	    if (this.isContextual(125)) {
  	      const result = this.tsParseInterfaceDeclaration(this.startNode());
  	      if (result) return result;
  	    }

  	    return super.parseStatementContent(context, topLevel);
  	  }

  	  parseAccessModifier() {
  	    return this.tsParseModifier(["public", "protected", "private"]);
  	  }

  	  tsHasSomeModifiers(member, modifiers) {
  	    return modifiers.some(modifier => {
  	      if (tsIsAccessModifier(modifier)) {
  	        return member.accessibility === modifier;
  	      }

  	      return !!member[modifier];
  	    });
  	  }

  	  tsIsStartOfStaticBlocks() {
  	    return this.isContextual(104) && this.lookaheadCharCode() === 123;
  	  }

  	  parseClassMember(classBody, member, state) {
  	    const modifiers = ["declare", "private", "public", "protected", "override", "abstract", "readonly", "static"];
  	    this.tsParseModifiers({
  	      modified: member,
  	      allowedModifiers: modifiers,
  	      disallowedModifiers: ["in", "out"],
  	      stopOnStartOfClassStaticBlock: true,
  	      errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
  	    });

  	    const callParseClassMemberWithIsStatic = () => {
  	      if (this.tsIsStartOfStaticBlocks()) {
  	        this.next();
  	        this.next();

  	        if (this.tsHasSomeModifiers(member, modifiers)) {
  	          this.raise(TSErrors.StaticBlockCannotHaveModifier, {
  	            at: this.state.curPosition()
  	          });
  	        }

  	        super.parseClassStaticBlock(classBody, member);
  	      } else {
  	        this.parseClassMemberWithIsStatic(classBody, member, state, !!member.static);
  	      }
  	    };

  	    if (member.declare) {
  	      this.tsInAmbientContext(callParseClassMemberWithIsStatic);
  	    } else {
  	      callParseClassMemberWithIsStatic();
  	    }
  	  }

  	  parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
  	    const idx = this.tsTryParseIndexSignature(member);

  	    if (idx) {
  	      classBody.body.push(idx);

  	      if (member.abstract) {
  	        this.raise(TSErrors.IndexSignatureHasAbstract, {
  	          at: member
  	        });
  	      }

  	      if (member.accessibility) {
  	        this.raise(TSErrors.IndexSignatureHasAccessibility, {
  	          at: member,
  	          modifier: member.accessibility
  	        });
  	      }

  	      if (member.declare) {
  	        this.raise(TSErrors.IndexSignatureHasDeclare, {
  	          at: member
  	        });
  	      }

  	      if (member.override) {
  	        this.raise(TSErrors.IndexSignatureHasOverride, {
  	          at: member
  	        });
  	      }

  	      return;
  	    }

  	    if (!this.state.inAbstractClass && member.abstract) {
  	      this.raise(TSErrors.NonAbstractClassHasAbstractMethod, {
  	        at: member
  	      });
  	    }

  	    if (member.override) {
  	      if (!state.hadSuperClass) {
  	        this.raise(TSErrors.OverrideNotInSubClass, {
  	          at: member
  	        });
  	      }
  	    }

  	    super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
  	  }

  	  parsePostMemberNameModifiers(methodOrProp) {
  	    const optional = this.eat(17);
  	    if (optional) methodOrProp.optional = true;

  	    if (methodOrProp.readonly && this.match(10)) {
  	      this.raise(TSErrors.ClassMethodHasReadonly, {
  	        at: methodOrProp
  	      });
  	    }

  	    if (methodOrProp.declare && this.match(10)) {
  	      this.raise(TSErrors.ClassMethodHasDeclare, {
  	        at: methodOrProp
  	      });
  	    }
  	  }

  	  parseExpressionStatement(node, expr) {
  	    const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr) : undefined;
  	    return decl || super.parseExpressionStatement(node, expr);
  	  }

  	  shouldParseExportDeclaration() {
  	    if (this.tsIsDeclarationStart()) return true;
  	    return super.shouldParseExportDeclaration();
  	  }

  	  parseConditional(expr, startPos, startLoc, refExpressionErrors) {
  	    if (!this.state.maybeInArrowParameters || !this.match(17)) {
  	      return super.parseConditional(expr, startPos, startLoc, refExpressionErrors);
  	    }

  	    const result = this.tryParse(() => super.parseConditional(expr, startPos, startLoc));

  	    if (!result.node) {
  	      if (result.error) {
  	        super.setOptionalParametersError(refExpressionErrors, result.error);
  	      }

  	      return expr;
  	    }

  	    if (result.error) this.state = result.failState;
  	    return result.node;
  	  }

  	  parseParenItem(node, startPos, startLoc) {
  	    node = super.parseParenItem(node, startPos, startLoc);

  	    if (this.eat(17)) {
  	      node.optional = true;
  	      this.resetEndLocation(node);
  	    }

  	    if (this.match(14)) {
  	      const typeCastNode = this.startNodeAt(startPos, startLoc);
  	      typeCastNode.expression = node;
  	      typeCastNode.typeAnnotation = this.tsParseTypeAnnotation();
  	      return this.finishNode(typeCastNode, "TSTypeCastExpression");
  	    }

  	    return node;
  	  }

  	  parseExportDeclaration(node) {
  	    if (!this.state.isAmbientContext && this.isContextual(121)) {
  	      return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
  	    }

  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    const isDeclare = this.eatContextual(121);

  	    if (isDeclare && (this.isContextual(121) || !this.shouldParseExportDeclaration())) {
  	      throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    const isIdentifier = tokenIsIdentifier(this.state.type);
  	    const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
  	    if (!declaration) return null;

  	    if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) {
  	      node.exportKind = "type";
  	    }

  	    if (isDeclare) {
  	      this.resetStartLocation(declaration, startPos, startLoc);
  	      declaration.declare = true;
  	    }

  	    return declaration;
  	  }

  	  parseClassId(node, isStatement, optionalId) {
  	    if ((!isStatement || optionalId) && this.isContextual(110)) {
  	      return;
  	    }

  	    super.parseClassId(node, isStatement, optionalId, node.declare ? BIND_TS_AMBIENT : BIND_CLASS);
  	    const typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));
  	    if (typeParameters) node.typeParameters = typeParameters;
  	  }

  	  parseClassPropertyAnnotation(node) {
  	    if (!node.optional && this.eat(35)) {
  	      node.definite = true;
  	    }

  	    const type = this.tsTryParseTypeAnnotation();
  	    if (type) node.typeAnnotation = type;
  	  }

  	  parseClassProperty(node) {
  	    this.parseClassPropertyAnnotation(node);

  	    if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
  	      this.raise(TSErrors.DeclareClassFieldHasInitializer, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    if (node.abstract && this.match(29)) {
  	      const {
  	        key
  	      } = node;
  	      this.raise(TSErrors.AbstractPropertyHasInitializer, {
  	        at: this.state.startLoc,
  	        propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
  	      });
  	    }

  	    return super.parseClassProperty(node);
  	  }

  	  parseClassPrivateProperty(node) {
  	    if (node.abstract) {
  	      this.raise(TSErrors.PrivateElementHasAbstract, {
  	        at: node
  	      });
  	    }

  	    if (node.accessibility) {
  	      this.raise(TSErrors.PrivateElementHasAccessibility, {
  	        at: node,
  	        modifier: node.accessibility
  	      });
  	    }

  	    this.parseClassPropertyAnnotation(node);
  	    return super.parseClassPrivateProperty(node);
  	  }

  	  pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
  	    const typeParameters = this.tsTryParseTypeParameters();

  	    if (typeParameters && isConstructor) {
  	      this.raise(TSErrors.ConstructorHasTypeParameters, {
  	        at: typeParameters
  	      });
  	    }

  	    const {
  	      declare = false,
  	      kind
  	    } = method;

  	    if (declare && (kind === "get" || kind === "set")) {
  	      this.raise(TSErrors.DeclareAccessor, {
  	        at: method,
  	        kind
  	      });
  	    }

  	    if (typeParameters) method.typeParameters = typeParameters;
  	    super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
  	  }

  	  pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
  	    const typeParameters = this.tsTryParseTypeParameters();
  	    if (typeParameters) method.typeParameters = typeParameters;
  	    super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
  	  }

  	  declareClassPrivateMethodInScope(node, kind) {
  	    if (node.type === "TSDeclareMethod") return;
  	    if (node.type === "MethodDefinition" && !node.value.body) return;
  	    super.declareClassPrivateMethodInScope(node, kind);
  	  }

  	  parseClassSuper(node) {
  	    super.parseClassSuper(node);

  	    if (node.superClass && (this.match(47) || this.match(51))) {
  	      node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
  	    }

  	    if (this.eatContextual(110)) {
  	      node.implements = this.tsParseHeritageClause("implements");
  	    }
  	  }

  	  parseObjPropValue(prop, ...args) {
  	    const typeParameters = this.tsTryParseTypeParameters();
  	    if (typeParameters) prop.typeParameters = typeParameters;
  	    return super.parseObjPropValue(prop, ...args);
  	  }

  	  parseFunctionParams(node, allowModifiers) {
  	    const typeParameters = this.tsTryParseTypeParameters();
  	    if (typeParameters) node.typeParameters = typeParameters;
  	    super.parseFunctionParams(node, allowModifiers);
  	  }

  	  parseVarId(decl, kind) {
  	    super.parseVarId(decl, kind);

  	    if (decl.id.type === "Identifier" && !this.hasPrecedingLineBreak() && this.eat(35)) {
  	      decl.definite = true;
  	    }

  	    const type = this.tsTryParseTypeAnnotation();

  	    if (type) {
  	      decl.id.typeAnnotation = type;
  	      this.resetEndLocation(decl.id);
  	    }
  	  }

  	  parseAsyncArrowFromCallExpression(node, call) {
  	    if (this.match(14)) {
  	      node.returnType = this.tsParseTypeAnnotation();
  	    }

  	    return super.parseAsyncArrowFromCallExpression(node, call);
  	  }

  	  parseMaybeAssign(...args) {
  	    var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;

  	    let state;
  	    let jsx;
  	    let typeCast;

  	    if (this.hasPlugin("jsx") && (this.match(138) || this.match(47))) {
  	      state = this.state.clone();
  	      jsx = this.tryParse(() => super.parseMaybeAssign(...args), state);
  	      if (!jsx.error) return jsx.node;
  	      const {
  	        context
  	      } = this.state;
  	      const currentContext = context[context.length - 1];

  	      if (currentContext === types.j_oTag || currentContext === types.j_expr) {
  	        context.pop();
  	      }
  	    }

  	    if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) {
  	      return super.parseMaybeAssign(...args);
  	    }

  	    if (!state || state === this.state) state = this.state.clone();
  	    let typeParameters;
  	    const arrow = this.tryParse(abort => {
  	      var _expr$extra, _typeParameters;

  	      typeParameters = this.tsParseTypeParameters();
  	      const expr = super.parseMaybeAssign(...args);

  	      if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
  	        abort();
  	      }

  	      if (((_typeParameters = typeParameters) == null ? void 0 : _typeParameters.params.length) !== 0) {
  	        this.resetStartLocationFromNode(expr, typeParameters);
  	      }

  	      expr.typeParameters = typeParameters;
  	      return expr;
  	    }, state);

  	    if (!arrow.error && !arrow.aborted) {
  	      if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
  	      return arrow.node;
  	    }

  	    if (!jsx) {
  	      assert(!this.hasPlugin("jsx"));
  	      typeCast = this.tryParse(() => super.parseMaybeAssign(...args), state);
  	      if (!typeCast.error) return typeCast.node;
  	    }

  	    if ((_jsx2 = jsx) != null && _jsx2.node) {
  	      this.state = jsx.failState;
  	      return jsx.node;
  	    }

  	    if (arrow.node) {
  	      this.state = arrow.failState;
  	      if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
  	      return arrow.node;
  	    }

  	    if ((_typeCast = typeCast) != null && _typeCast.node) {
  	      this.state = typeCast.failState;
  	      return typeCast.node;
  	    }

  	    if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
  	    if (arrow.thrown) throw arrow.error;
  	    if ((_typeCast2 = typeCast) != null && _typeCast2.thrown) throw typeCast.error;
  	    throw ((_jsx4 = jsx) == null ? void 0 : _jsx4.error) || arrow.error || ((_typeCast3 = typeCast) == null ? void 0 : _typeCast3.error);
  	  }

  	  reportReservedArrowTypeParam(node) {
  	    var _node$extra;

  	    if (node.params.length === 1 && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
  	      this.raise(TSErrors.ReservedArrowTypeParam, {
  	        at: node
  	      });
  	    }
  	  }

  	  parseMaybeUnary(refExpressionErrors) {
  	    if (!this.hasPlugin("jsx") && this.match(47)) {
  	      return this.tsParseTypeAssertion();
  	    } else {
  	      return super.parseMaybeUnary(refExpressionErrors);
  	    }
  	  }

  	  parseArrow(node) {
  	    if (this.match(14)) {
  	      const result = this.tryParse(abort => {
  	        const returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
  	        if (this.canInsertSemicolon() || !this.match(19)) abort();
  	        return returnType;
  	      });
  	      if (result.aborted) return;

  	      if (!result.thrown) {
  	        if (result.error) this.state = result.failState;
  	        node.returnType = result.node;
  	      }
  	    }

  	    return super.parseArrow(node);
  	  }

  	  parseAssignableListItemTypes(param) {
  	    if (this.eat(17)) {
  	      if (param.type !== "Identifier" && !this.state.isAmbientContext && !this.state.inType) {
  	        this.raise(TSErrors.PatternIsOptional, {
  	          at: param
  	        });
  	      }

  	      param.optional = true;
  	    }

  	    const type = this.tsTryParseTypeAnnotation();
  	    if (type) param.typeAnnotation = type;
  	    this.resetEndLocation(param);
  	    return param;
  	  }

  	  isAssignable(node, isBinding) {
  	    switch (node.type) {
  	      case "TSTypeCastExpression":
  	        return this.isAssignable(node.expression, isBinding);

  	      case "TSParameterProperty":
  	        return true;

  	      default:
  	        return super.isAssignable(node, isBinding);
  	    }
  	  }

  	  toAssignable(node, isLHS = false) {
  	    switch (node.type) {
  	      case "ParenthesizedExpression":
  	        this.toAssignableParenthesizedExpression(node, isLHS);
  	        break;

  	      case "TSAsExpression":
  	      case "TSNonNullExpression":
  	      case "TSTypeAssertion":
  	        if (isLHS) {
  	          this.expressionScope.recordArrowParemeterBindingError(TSErrors.UnexpectedTypeCastInParameter, {
  	            at: node
  	          });
  	        } else {
  	          this.raise(TSErrors.UnexpectedTypeCastInParameter, {
  	            at: node
  	          });
  	        }

  	        this.toAssignable(node.expression, isLHS);
  	        break;

  	      case "AssignmentExpression":
  	        if (!isLHS && node.left.type === "TSTypeCastExpression") {
  	          node.left = this.typeCastToParameter(node.left);
  	        }

  	      default:
  	        super.toAssignable(node, isLHS);
  	    }
  	  }

  	  toAssignableParenthesizedExpression(node, isLHS) {
  	    switch (node.expression.type) {
  	      case "TSAsExpression":
  	      case "TSNonNullExpression":
  	      case "TSTypeAssertion":
  	      case "ParenthesizedExpression":
  	        this.toAssignable(node.expression, isLHS);
  	        break;

  	      default:
  	        super.toAssignable(node, isLHS);
  	    }
  	  }

  	  checkToRestConversion(node, allowPattern) {
  	    switch (node.type) {
  	      case "TSAsExpression":
  	      case "TSTypeAssertion":
  	      case "TSNonNullExpression":
  	        this.checkToRestConversion(node.expression, false);
  	        break;

  	      default:
  	        super.checkToRestConversion(node, allowPattern);
  	    }
  	  }

  	  isValidLVal(type, isUnparenthesizedInAssign, binding) {
  	    return getOwn$1({
  	      TSTypeCastExpression: true,
  	      TSParameterProperty: "parameter",
  	      TSNonNullExpression: "expression",
  	      TSAsExpression: (binding !== BIND_NONE || !isUnparenthesizedInAssign) && ["expression", true],
  	      TSTypeAssertion: (binding !== BIND_NONE || !isUnparenthesizedInAssign) && ["expression", true]
  	    }, type) || super.isValidLVal(type, isUnparenthesizedInAssign, binding);
  	  }

  	  parseBindingAtom() {
  	    switch (this.state.type) {
  	      case 78:
  	        return this.parseIdentifier(true);

  	      default:
  	        return super.parseBindingAtom();
  	    }
  	  }

  	  parseMaybeDecoratorArguments(expr) {
  	    if (this.match(47) || this.match(51)) {
  	      const typeArguments = this.tsParseTypeArgumentsInExpression();

  	      if (this.match(10)) {
  	        const call = super.parseMaybeDecoratorArguments(expr);
  	        call.typeParameters = typeArguments;
  	        return call;
  	      }

  	      this.unexpected(null, 10);
  	    }

  	    return super.parseMaybeDecoratorArguments(expr);
  	  }

  	  checkCommaAfterRest(close) {
  	    if (this.state.isAmbientContext && this.match(12) && this.lookaheadCharCode() === close) {
  	      this.next();
  	      return false;
  	    } else {
  	      return super.checkCommaAfterRest(close);
  	    }
  	  }

  	  isClassMethod() {
  	    return this.match(47) || super.isClassMethod();
  	  }

  	  isClassProperty() {
  	    return this.match(35) || this.match(14) || super.isClassProperty();
  	  }

  	  parseMaybeDefault(...args) {
  	    const node = super.parseMaybeDefault(...args);

  	    if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
  	      this.raise(TSErrors.TypeAnnotationAfterAssign, {
  	        at: node.typeAnnotation
  	      });
  	    }

  	    return node;
  	  }

  	  getTokenFromCode(code) {
  	    if (this.state.inType) {
  	      if (code === 62) {
  	        return this.finishOp(48, 1);
  	      }

  	      if (code === 60) {
  	        return this.finishOp(47, 1);
  	      }
  	    }

  	    return super.getTokenFromCode(code);
  	  }

  	  reScan_lt_gt() {
  	    const {
  	      type
  	    } = this.state;

  	    if (type === 47) {
  	      this.state.pos -= 1;
  	      this.readToken_lt();
  	    } else if (type === 48) {
  	      this.state.pos -= 1;
  	      this.readToken_gt();
  	    }
  	  }

  	  reScan_lt() {
  	    const {
  	      type
  	    } = this.state;

  	    if (type === 51) {
  	      this.state.pos -= 2;
  	      this.finishOp(47, 1);
  	      return 47;
  	    }

  	    return type;
  	  }

  	  toAssignableList(exprList, ...args) {
  	    for (let i = 0; i < exprList.length; i++) {
  	      const expr = exprList[i];

  	      if ((expr == null ? void 0 : expr.type) === "TSTypeCastExpression") {
  	        exprList[i] = this.typeCastToParameter(expr);
  	      }
  	    }

  	    super.toAssignableList(exprList, ...args);
  	  }

  	  typeCastToParameter(node) {
  	    node.expression.typeAnnotation = node.typeAnnotation;
  	    this.resetEndLocation(node.expression, node.typeAnnotation.loc.end);
  	    return node.expression;
  	  }

  	  shouldParseArrow(params) {
  	    if (this.match(14)) {
  	      return params.every(expr => this.isAssignable(expr, true));
  	    }

  	    return super.shouldParseArrow(params);
  	  }

  	  shouldParseAsyncArrow() {
  	    return this.match(14) || super.shouldParseAsyncArrow();
  	  }

  	  canHaveLeadingDecorator() {
  	    return super.canHaveLeadingDecorator() || this.isAbstractClass();
  	  }

  	  jsxParseOpeningElementAfterName(node) {
  	    if (this.match(47) || this.match(51)) {
  	      const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
  	      if (typeArguments) node.typeParameters = typeArguments;
  	    }

  	    return super.jsxParseOpeningElementAfterName(node);
  	  }

  	  getGetterSetterExpectedParamCount(method) {
  	    const baseCount = super.getGetterSetterExpectedParamCount(method);
  	    const params = this.getObjectOrClassMethodParams(method);
  	    const firstParam = params[0];
  	    const hasContextParam = firstParam && this.isThisParam(firstParam);
  	    return hasContextParam ? baseCount + 1 : baseCount;
  	  }

  	  parseCatchClauseParam() {
  	    const param = super.parseCatchClauseParam();
  	    const type = this.tsTryParseTypeAnnotation();

  	    if (type) {
  	      param.typeAnnotation = type;
  	      this.resetEndLocation(param);
  	    }

  	    return param;
  	  }

  	  tsInAmbientContext(cb) {
  	    const oldIsAmbientContext = this.state.isAmbientContext;
  	    this.state.isAmbientContext = true;

  	    try {
  	      return cb();
  	    } finally {
  	      this.state.isAmbientContext = oldIsAmbientContext;
  	    }
  	  }

  	  parseClass(node, ...args) {
  	    const oldInAbstractClass = this.state.inAbstractClass;
  	    this.state.inAbstractClass = !!node.abstract;

  	    try {
  	      return super.parseClass(node, ...args);
  	    } finally {
  	      this.state.inAbstractClass = oldInAbstractClass;
  	    }
  	  }

  	  tsParseAbstractDeclaration(node) {
  	    if (this.match(80)) {
  	      node.abstract = true;
  	      return this.parseClass(node, true, false);
  	    } else if (this.isContextual(125)) {
  	      if (!this.hasFollowingLineBreak()) {
  	        node.abstract = true;
  	        this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, {
  	          at: node
  	        });
  	        return this.tsParseInterfaceDeclaration(node);
  	      }
  	    } else {
  	      this.unexpected(null, 80);
  	    }
  	  }

  	  parseMethod(...args) {
  	    const method = super.parseMethod(...args);

  	    if (method.abstract) {
  	      const hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;

  	      if (hasBody) {
  	        const {
  	          key
  	        } = method;
  	        this.raise(TSErrors.AbstractMethodHasImplementation, {
  	          at: method,
  	          methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
  	        });
  	      }
  	    }

  	    return method;
  	  }

  	  tsParseTypeParameterName() {
  	    const typeName = this.parseIdentifier();
  	    return typeName.name;
  	  }

  	  shouldParseAsAmbientContext() {
  	    return !!this.getPluginOption("typescript", "dts");
  	  }

  	  parse() {
  	    if (this.shouldParseAsAmbientContext()) {
  	      this.state.isAmbientContext = true;
  	    }

  	    return super.parse();
  	  }

  	  getExpression() {
  	    if (this.shouldParseAsAmbientContext()) {
  	      this.state.isAmbientContext = true;
  	    }

  	    return super.getExpression();
  	  }

  	  parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
  	    if (!isString && isMaybeTypeOnly) {
  	      this.parseTypeOnlyImportExportSpecifier(node, false, isInTypeExport);
  	      return this.finishNode(node, "ExportSpecifier");
  	    }

  	    node.exportKind = "value";
  	    return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly);
  	  }

  	  parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
  	    if (!importedIsString && isMaybeTypeOnly) {
  	      this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport);
  	      return this.finishNode(specifier, "ImportSpecifier");
  	    }

  	    specifier.importKind = "value";
  	    return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly);
  	  }

  	  parseTypeOnlyImportExportSpecifier(node, isImport, isInTypeOnlyImportExport) {
  	    const leftOfAsKey = isImport ? "imported" : "local";
  	    const rightOfAsKey = isImport ? "local" : "exported";
  	    let leftOfAs = node[leftOfAsKey];
  	    let rightOfAs;
  	    let hasTypeSpecifier = false;
  	    let canParseAsKeyword = true;
  	    const loc = leftOfAs.loc.start;

  	    if (this.isContextual(93)) {
  	      const firstAs = this.parseIdentifier();

  	      if (this.isContextual(93)) {
  	        const secondAs = this.parseIdentifier();

  	        if (tokenIsKeywordOrIdentifier(this.state.type)) {
  	          hasTypeSpecifier = true;
  	          leftOfAs = firstAs;
  	          rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
  	          canParseAsKeyword = false;
  	        } else {
  	          rightOfAs = secondAs;
  	          canParseAsKeyword = false;
  	        }
  	      } else if (tokenIsKeywordOrIdentifier(this.state.type)) {
  	        canParseAsKeyword = false;
  	        rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
  	      } else {
  	        hasTypeSpecifier = true;
  	        leftOfAs = firstAs;
  	      }
  	    } else if (tokenIsKeywordOrIdentifier(this.state.type)) {
  	      hasTypeSpecifier = true;

  	      if (isImport) {
  	        leftOfAs = this.parseIdentifier(true);

  	        if (!this.isContextual(93)) {
  	          this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true);
  	        }
  	      } else {
  	        leftOfAs = this.parseModuleExportName();
  	      }
  	    }

  	    if (hasTypeSpecifier && isInTypeOnlyImportExport) {
  	      this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, {
  	        at: loc
  	      });
  	    }

  	    node[leftOfAsKey] = leftOfAs;
  	    node[rightOfAsKey] = rightOfAs;
  	    const kindKey = isImport ? "importKind" : "exportKind";
  	    node[kindKey] = hasTypeSpecifier ? "type" : "value";

  	    if (canParseAsKeyword && this.eatContextual(93)) {
  	      node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName();
  	    }

  	    if (!node[rightOfAsKey]) {
  	      node[rightOfAsKey] = cloneIdentifier(node[leftOfAsKey]);
  	    }

  	    if (isImport) {
  	      this.checkIdentifier(node[rightOfAsKey], BIND_LEXICAL);
  	    }
  	  }

  	});

  	function isPossiblyLiteralEnum(expression) {
  	  if (expression.type !== "MemberExpression") return false;
  	  const {
  	    computed,
  	    property
  	  } = expression;

  	  if (computed && property.type !== "StringLiteral" && (property.type !== "TemplateLiteral" || property.expressions.length > 0)) {
  	    return false;
  	  }

  	  return isUncomputedMemberExpressionChain(expression.object);
  	}

  	function isUncomputedMemberExpressionChain(expression) {
  	  if (expression.type === "Identifier") return true;
  	  if (expression.type !== "MemberExpression") return false;
  	  if (expression.computed) return false;
  	  return isUncomputedMemberExpressionChain(expression.object);
  	}

  	const PlaceholderErrors = ParseErrorEnum`placeholders`({
  	  ClassNameIsRequired: "A class name is required.",
  	  UnexpectedSpace: "Unexpected space in placeholder."
  	});
  	var placeholders = (superClass => class extends superClass {
  	  parsePlaceholder(expectedNode) {
  	    if (this.match(140)) {
  	      const node = this.startNode();
  	      this.next();
  	      this.assertNoSpace();
  	      node.name = super.parseIdentifier(true);
  	      this.assertNoSpace();
  	      this.expect(140);
  	      return this.finishPlaceholder(node, expectedNode);
  	    }
  	  }

  	  finishPlaceholder(node, expectedNode) {
  	    const isFinished = !!(node.expectedNode && node.type === "Placeholder");
  	    node.expectedNode = expectedNode;
  	    return isFinished ? node : this.finishNode(node, "Placeholder");
  	  }

  	  getTokenFromCode(code) {
  	    if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
  	      return this.finishOp(140, 2);
  	    }

  	    return super.getTokenFromCode(...arguments);
  	  }

  	  parseExprAtom() {
  	    return this.parsePlaceholder("Expression") || super.parseExprAtom(...arguments);
  	  }

  	  parseIdentifier() {
  	    return this.parsePlaceholder("Identifier") || super.parseIdentifier(...arguments);
  	  }

  	  checkReservedWord(word, startLoc, checkKeywords, isBinding) {
  	    if (word !== undefined) {
  	      super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
  	    }
  	  }

  	  parseBindingAtom() {
  	    return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
  	  }

  	  isValidLVal(type, ...rest) {
  	    return type === "Placeholder" || super.isValidLVal(type, ...rest);
  	  }

  	  toAssignable(node, isLHS) {
  	    if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
  	      node.expectedNode = "Pattern";
  	    } else {
  	      super.toAssignable(node, isLHS);
  	    }
  	  }

  	  isLet(context) {
  	    if (super.isLet(context)) {
  	      return true;
  	    }

  	    if (!this.isContextual(99)) {
  	      return false;
  	    }

  	    if (context) return false;
  	    const nextToken = this.lookahead();

  	    if (nextToken.type === 140) {
  	      return true;
  	    }

  	    return false;
  	  }

  	  verifyBreakContinue(node, isBreak) {
  	    if (node.label && node.label.type === "Placeholder") return;
  	    super.verifyBreakContinue(node, isBreak);
  	  }

  	  parseExpressionStatement(node, expr) {
  	    if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
  	      return super.parseExpressionStatement(node, expr);
  	    }

  	    if (this.match(14)) {
  	      const stmt = node;
  	      stmt.label = this.finishPlaceholder(expr, "Identifier");
  	      this.next();
  	      stmt.body = super.parseStatement("label");
  	      return this.finishNode(stmt, "LabeledStatement");
  	    }

  	    this.semicolon();
  	    node.name = expr.name;
  	    return this.finishPlaceholder(node, "Statement");
  	  }

  	  parseBlock() {
  	    return this.parsePlaceholder("BlockStatement") || super.parseBlock(...arguments);
  	  }

  	  parseFunctionId() {
  	    return this.parsePlaceholder("Identifier") || super.parseFunctionId(...arguments);
  	  }

  	  parseClass(node, isStatement, optionalId) {
  	    const type = isStatement ? "ClassDeclaration" : "ClassExpression";
  	    this.next();
  	    this.takeDecorators(node);
  	    const oldStrict = this.state.strict;
  	    const placeholder = this.parsePlaceholder("Identifier");

  	    if (placeholder) {
  	      if (this.match(81) || this.match(140) || this.match(5)) {
  	        node.id = placeholder;
  	      } else if (optionalId || !isStatement) {
  	        node.id = null;
  	        node.body = this.finishPlaceholder(placeholder, "ClassBody");
  	        return this.finishNode(node, type);
  	      } else {
  	        throw this.raise(PlaceholderErrors.ClassNameIsRequired, {
  	          at: this.state.startLoc
  	        });
  	      }
  	    } else {
  	      this.parseClassId(node, isStatement, optionalId);
  	    }

  	    super.parseClassSuper(node);
  	    node.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!node.superClass, oldStrict);
  	    return this.finishNode(node, type);
  	  }

  	  parseExport(node) {
  	    const placeholder = this.parsePlaceholder("Identifier");
  	    if (!placeholder) return super.parseExport(...arguments);

  	    if (!this.isContextual(97) && !this.match(12)) {
  	      node.specifiers = [];
  	      node.source = null;
  	      node.declaration = this.finishPlaceholder(placeholder, "Declaration");
  	      return this.finishNode(node, "ExportNamedDeclaration");
  	    }

  	    this.expectPlugin("exportDefaultFrom");
  	    const specifier = this.startNode();
  	    specifier.exported = placeholder;
  	    node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
  	    return super.parseExport(node);
  	  }

  	  isExportDefaultSpecifier() {
  	    if (this.match(65)) {
  	      const next = this.nextTokenStart();

  	      if (this.isUnparsedContextual(next, "from")) {
  	        if (this.input.startsWith(tokenLabelName(140), this.nextTokenStartSince(next + 4))) {
  	          return true;
  	        }
  	      }
  	    }

  	    return super.isExportDefaultSpecifier();
  	  }

  	  maybeParseExportDefaultSpecifier(node) {
  	    if (node.specifiers && node.specifiers.length > 0) {
  	      return true;
  	    }

  	    return super.maybeParseExportDefaultSpecifier(node);
  	  }

  	  checkExport(node) {
  	    const {
  	      specifiers
  	    } = node;

  	    if (specifiers != null && specifiers.length) {
  	      node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");
  	    }

  	    super.checkExport(node);
  	    node.specifiers = specifiers;
  	  }

  	  parseImport(node) {
  	    const placeholder = this.parsePlaceholder("Identifier");
  	    if (!placeholder) return super.parseImport(...arguments);
  	    node.specifiers = [];

  	    if (!this.isContextual(97) && !this.match(12)) {
  	      node.source = this.finishPlaceholder(placeholder, "StringLiteral");
  	      this.semicolon();
  	      return this.finishNode(node, "ImportDeclaration");
  	    }

  	    const specifier = this.startNodeAtNode(placeholder);
  	    specifier.local = placeholder;
  	    node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier"));

  	    if (this.eat(12)) {
  	      const hasStarImport = this.maybeParseStarImportSpecifier(node);
  	      if (!hasStarImport) this.parseNamedImportSpecifiers(node);
  	    }

  	    this.expectContextual(97);
  	    node.source = this.parseImportSource();
  	    this.semicolon();
  	    return this.finishNode(node, "ImportDeclaration");
  	  }

  	  parseImportSource() {
  	    return this.parsePlaceholder("StringLiteral") || super.parseImportSource(...arguments);
  	  }

  	  assertNoSpace() {
  	    if (this.state.start > this.state.lastTokEndLoc.index) {
  	      this.raise(PlaceholderErrors.UnexpectedSpace, {
  	        at: this.state.lastTokEndLoc
  	      });
  	    }
  	  }

  	});

  	var v8intrinsic = (superClass => class extends superClass {
  	  parseV8Intrinsic() {
  	    if (this.match(54)) {
  	      const v8IntrinsicStartLoc = this.state.startLoc;
  	      const node = this.startNode();
  	      this.next();

  	      if (tokenIsIdentifier(this.state.type)) {
  	        const name = this.parseIdentifierName(this.state.start);
  	        const identifier = this.createIdentifier(node, name);
  	        identifier.type = "V8IntrinsicIdentifier";

  	        if (this.match(10)) {
  	          return identifier;
  	        }
  	      }

  	      this.unexpected(v8IntrinsicStartLoc);
  	    }
  	  }

  	  parseExprAtom() {
  	    return this.parseV8Intrinsic() || super.parseExprAtom(...arguments);
  	  }

  	});

  	function hasPlugin(plugins, expectedConfig) {
  	  const [expectedName, expectedOptions] = typeof expectedConfig === "string" ? [expectedConfig, {}] : expectedConfig;
  	  const expectedKeys = Object.keys(expectedOptions);
  	  const expectedOptionsIsEmpty = expectedKeys.length === 0;
  	  return plugins.some(p => {
  	    if (typeof p === "string") {
  	      return expectedOptionsIsEmpty && p === expectedName;
  	    } else {
  	      const [pluginName, pluginOptions] = p;

  	      if (pluginName !== expectedName) {
  	        return false;
  	      }

  	      for (const key of expectedKeys) {
  	        if (pluginOptions[key] !== expectedOptions[key]) {
  	          return false;
  	        }
  	      }

  	      return true;
  	    }
  	  });
  	}
  	function getPluginOption(plugins, name, option) {
  	  const plugin = plugins.find(plugin => {
  	    if (Array.isArray(plugin)) {
  	      return plugin[0] === name;
  	    } else {
  	      return plugin === name;
  	    }
  	  });

  	  if (plugin && Array.isArray(plugin)) {
  	    return plugin[1][option];
  	  }

  	  return null;
  	}
  	const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"];
  	const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"];
  	const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
  	function validatePlugins(plugins) {
  	  if (hasPlugin(plugins, "decorators")) {
  	    if (hasPlugin(plugins, "decorators-legacy")) {
  	      throw new Error("Cannot use the decorators and decorators-legacy plugin together");
  	    }

  	    const decoratorsBeforeExport = getPluginOption(plugins, "decorators", "decoratorsBeforeExport");

  	    if (decoratorsBeforeExport == null) {
  	      throw new Error("The 'decorators' plugin requires a 'decoratorsBeforeExport' option," + " whose value must be a boolean. If you are migrating from" + " Babylon/Babel 6 or want to use the old decorators proposal, you" + " should use the 'decorators-legacy' plugin instead of 'decorators'.");
  	    } else if (typeof decoratorsBeforeExport !== "boolean") {
  	      throw new Error("'decoratorsBeforeExport' must be a boolean.");
  	    }
  	  }

  	  if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) {
  	    throw new Error("Cannot combine flow and typescript plugins.");
  	  }

  	  if (hasPlugin(plugins, "placeholders") && hasPlugin(plugins, "v8intrinsic")) {
  	    throw new Error("Cannot combine placeholders and v8intrinsic plugins.");
  	  }

  	  if (hasPlugin(plugins, "pipelineOperator")) {
  	    const proposal = getPluginOption(plugins, "pipelineOperator", "proposal");

  	    if (!PIPELINE_PROPOSALS.includes(proposal)) {
  	      const proposalList = PIPELINE_PROPOSALS.map(p => `"${p}"`).join(", ");
  	      throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);
  	    }

  	    const tupleSyntaxIsHash = hasPlugin(plugins, ["recordAndTuple", {
  	      syntaxType: "hash"
  	    }]);

  	    if (proposal === "hack") {
  	      if (hasPlugin(plugins, "placeholders")) {
  	        throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
  	      }

  	      if (hasPlugin(plugins, "v8intrinsic")) {
  	        throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");
  	      }

  	      const topicToken = getPluginOption(plugins, "pipelineOperator", "topicToken");

  	      if (!TOPIC_TOKENS.includes(topicToken)) {
  	        const tokenList = TOPIC_TOKENS.map(t => `"${t}"`).join(", ");
  	        throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
  	      }

  	      if (topicToken === "#" && tupleSyntaxIsHash) {
  	        throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "hack", topicToken: "#" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.');
  	      }
  	    } else if (proposal === "smart" && tupleSyntaxIsHash) {
  	      throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.');
  	    }
  	  }

  	  if (hasPlugin(plugins, "moduleAttributes")) {
  	    {
  	      if (hasPlugin(plugins, "importAssertions")) {
  	        throw new Error("Cannot combine importAssertions and moduleAttributes plugins.");
  	      }

  	      const moduleAttributesVersionPluginOption = getPluginOption(plugins, "moduleAttributes", "version");

  	      if (moduleAttributesVersionPluginOption !== "may-2020") {
  	        throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
  	      }
  	    }
  	  }

  	  if (hasPlugin(plugins, "recordAndTuple") && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) {
  	    throw new Error("'recordAndTuple' requires 'syntaxType' option whose value should be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
  	  }

  	  if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) {
  	    const error = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");
  	    error.missingPlugins = "doExpressions";
  	    throw error;
  	  }
  	}
  	const mixinPlugins = {
  	  estree,
  	  jsx,
  	  flow,
  	  typescript,
  	  v8intrinsic,
  	  placeholders
  	};
  	const mixinPluginNames = Object.keys(mixinPlugins);

  	const defaultOptions = {
  	  sourceType: "script",
  	  sourceFilename: undefined,
  	  startColumn: 0,
  	  startLine: 1,
  	  allowAwaitOutsideFunction: false,
  	  allowReturnOutsideFunction: false,
  	  allowImportExportEverywhere: false,
  	  allowSuperOutsideMethod: false,
  	  allowUndeclaredExports: false,
  	  plugins: [],
  	  strictMode: null,
  	  ranges: false,
  	  tokens: false,
  	  createParenthesizedExpressions: false,
  	  errorRecovery: false,
  	  attachComment: true
  	};
  	function getOptions(opts) {
  	  const options = {};

  	  for (const key of Object.keys(defaultOptions)) {
  	    options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key];
  	  }

  	  return options;
  	}

  	const getOwn = (object, key) => Object.hasOwnProperty.call(object, key) && object[key];

  	const unwrapParenthesizedExpression = node => {
  	  return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
  	};

  	class LValParser extends NodeUtils {
  	  toAssignable(node, isLHS = false) {
  	    var _node$extra, _node$extra3;

  	    let parenthesized = undefined;

  	    if (node.type === "ParenthesizedExpression" || (_node$extra = node.extra) != null && _node$extra.parenthesized) {
  	      parenthesized = unwrapParenthesizedExpression(node);

  	      if (isLHS) {
  	        if (parenthesized.type === "Identifier") {
  	          this.expressionScope.recordArrowParemeterBindingError(Errors.InvalidParenthesizedAssignment, {
  	            at: node
  	          });
  	        } else if (parenthesized.type !== "MemberExpression") {
  	          this.raise(Errors.InvalidParenthesizedAssignment, {
  	            at: node
  	          });
  	        }
  	      } else {
  	        this.raise(Errors.InvalidParenthesizedAssignment, {
  	          at: node
  	        });
  	      }
  	    }

  	    switch (node.type) {
  	      case "Identifier":
  	      case "ObjectPattern":
  	      case "ArrayPattern":
  	      case "AssignmentPattern":
  	      case "RestElement":
  	        break;

  	      case "ObjectExpression":
  	        node.type = "ObjectPattern";

  	        for (let i = 0, length = node.properties.length, last = length - 1; i < length; i++) {
  	          var _node$extra2;

  	          const prop = node.properties[i];
  	          const isLast = i === last;
  	          this.toAssignableObjectExpressionProp(prop, isLast, isLHS);

  	          if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
  	            this.raise(Errors.RestTrailingComma, {
  	              at: node.extra.trailingCommaLoc
  	            });
  	          }
  	        }

  	        break;

  	      case "ObjectProperty":
  	        {
  	          const {
  	            key,
  	            value
  	          } = node;

  	          if (this.isPrivateName(key)) {
  	            this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
  	          }

  	          this.toAssignable(value, isLHS);
  	          break;
  	        }

  	      case "SpreadElement":
  	        {
  	          throw new Error("Internal @babel/parser error (this is a bug, please report it)." + " SpreadElement should be converted by .toAssignable's caller.");
  	        }

  	      case "ArrayExpression":
  	        node.type = "ArrayPattern";
  	        this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingCommaLoc, isLHS);
  	        break;

  	      case "AssignmentExpression":
  	        if (node.operator !== "=") {
  	          this.raise(Errors.MissingEqInAssignment, {
  	            at: node.left.loc.end
  	          });
  	        }

  	        node.type = "AssignmentPattern";
  	        delete node.operator;
  	        this.toAssignable(node.left, isLHS);
  	        break;

  	      case "ParenthesizedExpression":
  	        this.toAssignable(parenthesized, isLHS);
  	        break;
  	    }
  	  }

  	  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
  	    if (prop.type === "ObjectMethod") {
  	      this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
  	        at: prop.key
  	      });
  	    } else if (prop.type === "SpreadElement") {
  	      prop.type = "RestElement";
  	      const arg = prop.argument;
  	      this.checkToRestConversion(arg, false);
  	      this.toAssignable(arg, isLHS);

  	      if (!isLast) {
  	        this.raise(Errors.RestTrailingComma, {
  	          at: prop
  	        });
  	      }
  	    } else {
  	      this.toAssignable(prop, isLHS);
  	    }
  	  }

  	  toAssignableList(exprList, trailingCommaLoc, isLHS) {
  	    const end = exprList.length - 1;

  	    for (let i = 0; i <= end; i++) {
  	      const elt = exprList[i];
  	      if (!elt) continue;

  	      if (elt.type === "SpreadElement") {
  	        elt.type = "RestElement";
  	        const arg = elt.argument;
  	        this.checkToRestConversion(arg, true);
  	        this.toAssignable(arg, isLHS);
  	      } else {
  	        this.toAssignable(elt, isLHS);
  	      }

  	      if (elt.type === "RestElement") {
  	        if (i < end) {
  	          this.raise(Errors.RestTrailingComma, {
  	            at: elt
  	          });
  	        } else if (trailingCommaLoc) {
  	          this.raise(Errors.RestTrailingComma, {
  	            at: trailingCommaLoc
  	          });
  	        }
  	      }
  	    }
  	  }

  	  isAssignable(node, isBinding) {
  	    switch (node.type) {
  	      case "Identifier":
  	      case "ObjectPattern":
  	      case "ArrayPattern":
  	      case "AssignmentPattern":
  	      case "RestElement":
  	        return true;

  	      case "ObjectExpression":
  	        {
  	          const last = node.properties.length - 1;
  	          return node.properties.every((prop, i) => {
  	            return prop.type !== "ObjectMethod" && (i === last || prop.type !== "SpreadElement") && this.isAssignable(prop);
  	          });
  	        }

  	      case "ObjectProperty":
  	        return this.isAssignable(node.value);

  	      case "SpreadElement":
  	        return this.isAssignable(node.argument);

  	      case "ArrayExpression":
  	        return node.elements.every(element => element === null || this.isAssignable(element));

  	      case "AssignmentExpression":
  	        return node.operator === "=";

  	      case "ParenthesizedExpression":
  	        return this.isAssignable(node.expression);

  	      case "MemberExpression":
  	      case "OptionalMemberExpression":
  	        return !isBinding;

  	      default:
  	        return false;
  	    }
  	  }

  	  toReferencedList(exprList, isParenthesizedExpr) {
  	    return exprList;
  	  }

  	  toReferencedListDeep(exprList, isParenthesizedExpr) {
  	    this.toReferencedList(exprList, isParenthesizedExpr);

  	    for (const expr of exprList) {
  	      if ((expr == null ? void 0 : expr.type) === "ArrayExpression") {
  	        this.toReferencedListDeep(expr.elements);
  	      }
  	    }
  	  }

  	  parseSpread(refExpressionErrors) {
  	    const node = this.startNode();
  	    this.next();
  	    node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined);
  	    return this.finishNode(node, "SpreadElement");
  	  }

  	  parseRestBinding() {
  	    const node = this.startNode();
  	    this.next();
  	    node.argument = this.parseBindingAtom();
  	    return this.finishNode(node, "RestElement");
  	  }

  	  parseBindingAtom() {
  	    switch (this.state.type) {
  	      case 0:
  	        {
  	          const node = this.startNode();
  	          this.next();
  	          node.elements = this.parseBindingList(3, 93, true);
  	          return this.finishNode(node, "ArrayPattern");
  	        }

  	      case 5:
  	        return this.parseObjectLike(8, true);
  	    }

  	    return this.parseIdentifier();
  	  }

  	  parseBindingList(close, closeCharCode, allowEmpty, allowModifiers) {
  	    const elts = [];
  	    let first = true;

  	    while (!this.eat(close)) {
  	      if (first) {
  	        first = false;
  	      } else {
  	        this.expect(12);
  	      }

  	      if (allowEmpty && this.match(12)) {
  	        elts.push(null);
  	      } else if (this.eat(close)) {
  	        break;
  	      } else if (this.match(21)) {
  	        elts.push(this.parseAssignableListItemTypes(this.parseRestBinding()));

  	        if (!this.checkCommaAfterRest(closeCharCode)) {
  	          this.expect(close);
  	          break;
  	        }
  	      } else {
  	        const decorators = [];

  	        if (this.match(26) && this.hasPlugin("decorators")) {
  	          this.raise(Errors.UnsupportedParameterDecorator, {
  	            at: this.state.startLoc
  	          });
  	        }

  	        while (this.match(26)) {
  	          decorators.push(this.parseDecorator());
  	        }

  	        elts.push(this.parseAssignableListItem(allowModifiers, decorators));
  	      }
  	    }

  	    return elts;
  	  }

  	  parseBindingRestProperty(prop) {
  	    this.next();
  	    prop.argument = this.parseIdentifier();
  	    this.checkCommaAfterRest(125);
  	    return this.finishNode(prop, "RestElement");
  	  }

  	  parseBindingProperty() {
  	    const prop = this.startNode();
  	    const {
  	      type,
  	      start: startPos,
  	      startLoc
  	    } = this.state;

  	    if (type === 21) {
  	      return this.parseBindingRestProperty(prop);
  	    } else if (type === 134) {
  	      this.expectPlugin("destructuringPrivate", startLoc);
  	      this.classScope.usePrivateName(this.state.value, startLoc);
  	      prop.key = this.parsePrivateName();
  	    } else {
  	      this.parsePropertyName(prop);
  	    }

  	    prop.method = false;
  	    return this.parseObjPropValue(prop, startPos, startLoc, false, false, true, false);
  	  }

  	  parseAssignableListItem(allowModifiers, decorators) {
  	    const left = this.parseMaybeDefault();
  	    this.parseAssignableListItemTypes(left);
  	    const elt = this.parseMaybeDefault(left.start, left.loc.start, left);

  	    if (decorators.length) {
  	      left.decorators = decorators;
  	    }

  	    return elt;
  	  }

  	  parseAssignableListItemTypes(param) {
  	    return param;
  	  }

  	  parseMaybeDefault(startPos, startLoc, left) {
  	    var _startLoc, _startPos, _left;

  	    startLoc = (_startLoc = startLoc) != null ? _startLoc : this.state.startLoc;
  	    startPos = (_startPos = startPos) != null ? _startPos : this.state.start;
  	    left = (_left = left) != null ? _left : this.parseBindingAtom();
  	    if (!this.eat(29)) return left;
  	    const node = this.startNodeAt(startPos, startLoc);
  	    node.left = left;
  	    node.right = this.parseMaybeAssignAllowIn();
  	    return this.finishNode(node, "AssignmentPattern");
  	  }

  	  isValidLVal(type, isUnparenthesizedInAssign, binding) {
  	    return getOwn({
  	      AssignmentPattern: "left",
  	      RestElement: "argument",
  	      ObjectProperty: "value",
  	      ParenthesizedExpression: "expression",
  	      ArrayPattern: "elements",
  	      ObjectPattern: "properties"
  	    }, type);
  	  }

  	  checkLVal(expression, {
  	    in: ancestor,
  	    binding = BIND_NONE,
  	    checkClashes = false,
  	    strictModeChanged = false,
  	    allowingSloppyLetBinding = !(binding & BIND_SCOPE_LEXICAL),
  	    hasParenthesizedAncestor = false
  	  }) {
  	    var _expression$extra;

  	    const type = expression.type;
  	    if (this.isObjectMethod(expression)) return;

  	    if (type === "MemberExpression") {
  	      if (binding !== BIND_NONE) {
  	        this.raise(Errors.InvalidPropertyBindingPattern, {
  	          at: expression
  	        });
  	      }

  	      return;
  	    }

  	    if (expression.type === "Identifier") {
  	      this.checkIdentifier(expression, binding, strictModeChanged, allowingSloppyLetBinding);
  	      const {
  	        name
  	      } = expression;

  	      if (checkClashes) {
  	        if (checkClashes.has(name)) {
  	          this.raise(Errors.ParamDupe, {
  	            at: expression
  	          });
  	        } else {
  	          checkClashes.add(name);
  	        }
  	      }

  	      return;
  	    }

  	    const validity = this.isValidLVal(expression.type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
  	    if (validity === true) return;

  	    if (validity === false) {
  	      const ParseErrorClass = binding === BIND_NONE ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
  	      this.raise(ParseErrorClass, {
  	        at: expression,
  	        ancestor: ancestor.type === "UpdateExpression" ? {
  	          type: "UpdateExpression",
  	          prefix: ancestor.prefix
  	        } : {
  	          type: ancestor.type
  	        }
  	      });
  	      return;
  	    }

  	    const [key, isParenthesizedExpression] = Array.isArray(validity) ? validity : [validity, type === "ParenthesizedExpression"];
  	    const nextAncestor = expression.type === "ArrayPattern" || expression.type === "ObjectPattern" || expression.type === "ParenthesizedExpression" ? expression : ancestor;

  	    for (const child of [].concat(expression[key])) {
  	      if (child) {
  	        this.checkLVal(child, {
  	          in: nextAncestor,
  	          binding,
  	          checkClashes,
  	          allowingSloppyLetBinding,
  	          strictModeChanged,
  	          hasParenthesizedAncestor: isParenthesizedExpression
  	        });
  	      }
  	    }
  	  }

  	  checkIdentifier(at, bindingType, strictModeChanged = false, allowLetBinding = !(bindingType & BIND_SCOPE_LEXICAL)) {
  	    if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
  	      if (bindingType === BIND_NONE) {
  	        this.raise(Errors.StrictEvalArguments, {
  	          at,
  	          referenceName: at.name
  	        });
  	      } else {
  	        this.raise(Errors.StrictEvalArgumentsBinding, {
  	          at,
  	          bindingName: at.name
  	        });
  	      }
  	    }

  	    if (!allowLetBinding && at.name === "let") {
  	      this.raise(Errors.LetInLexicalBinding, {
  	        at
  	      });
  	    }

  	    if (!(bindingType & BIND_NONE)) {
  	      this.declareNameFromIdentifier(at, bindingType);
  	    }
  	  }

  	  declareNameFromIdentifier(identifier, binding) {
  	    this.scope.declareName(identifier.name, binding, identifier.loc.start);
  	  }

  	  checkToRestConversion(node, allowPattern) {
  	    switch (node.type) {
  	      case "ParenthesizedExpression":
  	        this.checkToRestConversion(node.expression, allowPattern);
  	        break;

  	      case "Identifier":
  	      case "MemberExpression":
  	        break;

  	      case "ArrayExpression":
  	      case "ObjectExpression":
  	        if (allowPattern) break;

  	      default:
  	        this.raise(Errors.InvalidRestAssignmentPattern, {
  	          at: node
  	        });
  	    }
  	  }

  	  checkCommaAfterRest(close) {
  	    if (!this.match(12)) {
  	      return false;
  	    }

  	    this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, {
  	      at: this.state.startLoc
  	    });
  	    return true;
  	  }

  	}

  	class ExpressionParser extends LValParser {
  	  checkProto(prop, isRecord, protoRef, refExpressionErrors) {
  	    if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {
  	      return;
  	    }

  	    const key = prop.key;
  	    const name = key.type === "Identifier" ? key.name : key.value;

  	    if (name === "__proto__") {
  	      if (isRecord) {
  	        this.raise(Errors.RecordNoProto, {
  	          at: key
  	        });
  	        return;
  	      }

  	      if (protoRef.used) {
  	        if (refExpressionErrors) {
  	          if (refExpressionErrors.doubleProtoLoc === null) {
  	            refExpressionErrors.doubleProtoLoc = key.loc.start;
  	          }
  	        } else {
  	          this.raise(Errors.DuplicateProto, {
  	            at: key
  	          });
  	        }
  	      }

  	      protoRef.used = true;
  	    }
  	  }

  	  shouldExitDescending(expr, potentialArrowAt) {
  	    return expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt;
  	  }

  	  getExpression() {
  	    this.enterInitialScopes();
  	    this.nextToken();
  	    const expr = this.parseExpression();

  	    if (!this.match(135)) {
  	      this.unexpected();
  	    }

  	    this.finalizeRemainingComments();
  	    expr.comments = this.state.comments;
  	    expr.errors = this.state.errors;

  	    if (this.options.tokens) {
  	      expr.tokens = this.tokens;
  	    }

  	    return expr;
  	  }

  	  parseExpression(disallowIn, refExpressionErrors) {
  	    if (disallowIn) {
  	      return this.disallowInAnd(() => this.parseExpressionBase(refExpressionErrors));
  	    }

  	    return this.allowInAnd(() => this.parseExpressionBase(refExpressionErrors));
  	  }

  	  parseExpressionBase(refExpressionErrors) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    const expr = this.parseMaybeAssign(refExpressionErrors);

  	    if (this.match(12)) {
  	      const node = this.startNodeAt(startPos, startLoc);
  	      node.expressions = [expr];

  	      while (this.eat(12)) {
  	        node.expressions.push(this.parseMaybeAssign(refExpressionErrors));
  	      }

  	      this.toReferencedList(node.expressions);
  	      return this.finishNode(node, "SequenceExpression");
  	    }

  	    return expr;
  	  }

  	  parseMaybeAssignDisallowIn(refExpressionErrors, afterLeftParse) {
  	    return this.disallowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
  	  }

  	  parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) {
  	    return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
  	  }

  	  setOptionalParametersError(refExpressionErrors, resultError) {
  	    var _resultError$loc;

  	    refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError == null ? void 0 : resultError.loc) != null ? _resultError$loc : this.state.startLoc;
  	  }

  	  parseMaybeAssign(refExpressionErrors, afterLeftParse) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;

  	    if (this.isContextual(105)) {
  	      if (this.prodParam.hasYield) {
  	        let left = this.parseYield();

  	        if (afterLeftParse) {
  	          left = afterLeftParse.call(this, left, startPos, startLoc);
  	        }

  	        return left;
  	      }
  	    }

  	    let ownExpressionErrors;

  	    if (refExpressionErrors) {
  	      ownExpressionErrors = false;
  	    } else {
  	      refExpressionErrors = new ExpressionErrors();
  	      ownExpressionErrors = true;
  	    }

  	    const {
  	      type
  	    } = this.state;

  	    if (type === 10 || tokenIsIdentifier(type)) {
  	      this.state.potentialArrowAt = this.state.start;
  	    }

  	    let left = this.parseMaybeConditional(refExpressionErrors);

  	    if (afterLeftParse) {
  	      left = afterLeftParse.call(this, left, startPos, startLoc);
  	    }

  	    if (tokenIsAssignment(this.state.type)) {
  	      const node = this.startNodeAt(startPos, startLoc);
  	      const operator = this.state.value;
  	      node.operator = operator;

  	      if (this.match(29)) {
  	        this.toAssignable(left, true);
  	        node.left = left;

  	        if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startPos) {
  	          refExpressionErrors.doubleProtoLoc = null;
  	        }

  	        if (refExpressionErrors.shorthandAssignLoc != null && refExpressionErrors.shorthandAssignLoc.index >= startPos) {
  	          refExpressionErrors.shorthandAssignLoc = null;
  	        }

  	        if (refExpressionErrors.privateKeyLoc != null && refExpressionErrors.privateKeyLoc.index >= startPos) {
  	          this.checkDestructuringPrivate(refExpressionErrors);
  	          refExpressionErrors.privateKeyLoc = null;
  	        }
  	      } else {
  	        node.left = left;
  	      }

  	      this.next();
  	      node.right = this.parseMaybeAssign();
  	      this.checkLVal(left, {
  	        in: this.finishNode(node, "AssignmentExpression")
  	      });
  	      return node;
  	    } else if (ownExpressionErrors) {
  	      this.checkExpressionErrors(refExpressionErrors, true);
  	    }

  	    return left;
  	  }

  	  parseMaybeConditional(refExpressionErrors) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    const potentialArrowAt = this.state.potentialArrowAt;
  	    const expr = this.parseExprOps(refExpressionErrors);

  	    if (this.shouldExitDescending(expr, potentialArrowAt)) {
  	      return expr;
  	    }

  	    return this.parseConditional(expr, startPos, startLoc, refExpressionErrors);
  	  }

  	  parseConditional(expr, startPos, startLoc, refExpressionErrors) {
  	    if (this.eat(17)) {
  	      const node = this.startNodeAt(startPos, startLoc);
  	      node.test = expr;
  	      node.consequent = this.parseMaybeAssignAllowIn();
  	      this.expect(14);
  	      node.alternate = this.parseMaybeAssign();
  	      return this.finishNode(node, "ConditionalExpression");
  	    }

  	    return expr;
  	  }

  	  parseMaybeUnaryOrPrivate(refExpressionErrors) {
  	    return this.match(134) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
  	  }

  	  parseExprOps(refExpressionErrors) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    const potentialArrowAt = this.state.potentialArrowAt;
  	    const expr = this.parseMaybeUnaryOrPrivate(refExpressionErrors);

  	    if (this.shouldExitDescending(expr, potentialArrowAt)) {
  	      return expr;
  	    }

  	    return this.parseExprOp(expr, startPos, startLoc, -1);
  	  }

  	  parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
  	    if (this.isPrivateName(left)) {
  	      const value = this.getPrivateNameSV(left);

  	      if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
  	        this.raise(Errors.PrivateInExpectedIn, {
  	          at: left,
  	          identifierName: value
  	        });
  	      }

  	      this.classScope.usePrivateName(value, left.loc.start);
  	    }

  	    const op = this.state.type;

  	    if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(58))) {
  	      let prec = tokenOperatorPrecedence(op);

  	      if (prec > minPrec) {
  	        if (op === 39) {
  	          this.expectPlugin("pipelineOperator");

  	          if (this.state.inFSharpPipelineDirectBody) {
  	            return left;
  	          }

  	          this.checkPipelineAtInfixOperator(left, leftStartLoc);
  	        }

  	        const node = this.startNodeAt(leftStartPos, leftStartLoc);
  	        node.left = left;
  	        node.operator = this.state.value;
  	        const logical = op === 41 || op === 42;
  	        const coalesce = op === 40;

  	        if (coalesce) {
  	          prec = tokenOperatorPrecedence(42);
  	        }

  	        this.next();

  	        if (op === 39 && this.hasPlugin(["pipelineOperator", {
  	          proposal: "minimal"
  	        }])) {
  	          if (this.state.type === 96 && this.prodParam.hasAwait) {
  	            throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, {
  	              at: this.state.startLoc
  	            });
  	          }
  	        }

  	        node.right = this.parseExprOpRightExpr(op, prec);
  	        const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
  	        const nextOp = this.state.type;

  	        if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
  	          throw this.raise(Errors.MixingCoalesceWithLogical, {
  	            at: this.state.startLoc
  	          });
  	        }

  	        return this.parseExprOp(finishedNode, leftStartPos, leftStartLoc, minPrec);
  	      }
  	    }

  	    return left;
  	  }

  	  parseExprOpRightExpr(op, prec) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;

  	    switch (op) {
  	      case 39:
  	        switch (this.getPluginOption("pipelineOperator", "proposal")) {
  	          case "hack":
  	            return this.withTopicBindingContext(() => {
  	              return this.parseHackPipeBody();
  	            });

  	          case "smart":
  	            return this.withTopicBindingContext(() => {
  	              if (this.prodParam.hasYield && this.isContextual(105)) {
  	                throw this.raise(Errors.PipeBodyIsTighter, {
  	                  at: this.state.startLoc
  	                });
  	              }

  	              return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startPos, startLoc);
  	            });

  	          case "fsharp":
  	            return this.withSoloAwaitPermittingContext(() => {
  	              return this.parseFSharpPipelineBody(prec);
  	            });
  	        }

  	      default:
  	        return this.parseExprOpBaseRightExpr(op, prec);
  	    }
  	  }

  	  parseExprOpBaseRightExpr(op, prec) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startPos, startLoc, tokenIsRightAssociative(op) ? prec - 1 : prec);
  	  }

  	  parseHackPipeBody() {
  	    var _body$extra;

  	    const {
  	      startLoc
  	    } = this.state;
  	    const body = this.parseMaybeAssign();
  	    const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);

  	    if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
  	      this.raise(Errors.PipeUnparenthesizedBody, {
  	        at: startLoc,
  	        type: body.type
  	      });
  	    }

  	    if (!this.topicReferenceWasUsedInCurrentContext()) {
  	      this.raise(Errors.PipeTopicUnused, {
  	        at: startLoc
  	      });
  	    }

  	    return body;
  	  }

  	  checkExponentialAfterUnary(node) {
  	    if (this.match(57)) {
  	      this.raise(Errors.UnexpectedTokenUnaryExponentiation, {
  	        at: node.argument
  	      });
  	    }
  	  }

  	  parseMaybeUnary(refExpressionErrors, sawUnary) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    const isAwait = this.isContextual(96);

  	    if (isAwait && this.isAwaitAllowed()) {
  	      this.next();
  	      const expr = this.parseAwait(startPos, startLoc);
  	      if (!sawUnary) this.checkExponentialAfterUnary(expr);
  	      return expr;
  	    }

  	    const update = this.match(34);
  	    const node = this.startNode();

  	    if (tokenIsPrefix(this.state.type)) {
  	      node.operator = this.state.value;
  	      node.prefix = true;

  	      if (this.match(72)) {
  	        this.expectPlugin("throwExpressions");
  	      }

  	      const isDelete = this.match(89);
  	      this.next();
  	      node.argument = this.parseMaybeUnary(null, true);
  	      this.checkExpressionErrors(refExpressionErrors, true);

  	      if (this.state.strict && isDelete) {
  	        const arg = node.argument;

  	        if (arg.type === "Identifier") {
  	          this.raise(Errors.StrictDelete, {
  	            at: node
  	          });
  	        } else if (this.hasPropertyAsPrivateName(arg)) {
  	          this.raise(Errors.DeletePrivateField, {
  	            at: node
  	          });
  	        }
  	      }

  	      if (!update) {
  	        if (!sawUnary) {
  	          this.checkExponentialAfterUnary(node);
  	        }

  	        return this.finishNode(node, "UnaryExpression");
  	      }
  	    }

  	    const expr = this.parseUpdate(node, update, refExpressionErrors);

  	    if (isAwait) {
  	      const {
  	        type
  	      } = this.state;
  	      const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);

  	      if (startsExpr && !this.isAmbiguousAwait()) {
  	        this.raiseOverwrite(Errors.AwaitNotInAsyncContext, {
  	          at: startLoc
  	        });
  	        return this.parseAwait(startPos, startLoc);
  	      }
  	    }

  	    return expr;
  	  }

  	  parseUpdate(node, update, refExpressionErrors) {
  	    if (update) {
  	      const updateExpressionNode = node;
  	      this.checkLVal(updateExpressionNode.argument, {
  	        in: this.finishNode(updateExpressionNode, "UpdateExpression")
  	      });
  	      return node;
  	    }

  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    let expr = this.parseExprSubscripts(refExpressionErrors);
  	    if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;

  	    while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) {
  	      const node = this.startNodeAt(startPos, startLoc);
  	      node.operator = this.state.value;
  	      node.prefix = false;
  	      node.argument = expr;
  	      this.next();
  	      this.checkLVal(expr, {
  	        in: expr = this.finishNode(node, "UpdateExpression")
  	      });
  	    }

  	    return expr;
  	  }

  	  parseExprSubscripts(refExpressionErrors) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    const potentialArrowAt = this.state.potentialArrowAt;
  	    const expr = this.parseExprAtom(refExpressionErrors);

  	    if (this.shouldExitDescending(expr, potentialArrowAt)) {
  	      return expr;
  	    }

  	    return this.parseSubscripts(expr, startPos, startLoc);
  	  }

  	  parseSubscripts(base, startPos, startLoc, noCalls) {
  	    const state = {
  	      optionalChainMember: false,
  	      maybeAsyncArrow: this.atPossibleAsyncArrow(base),
  	      stop: false
  	    };

  	    do {
  	      base = this.parseSubscript(base, startPos, startLoc, noCalls, state);
  	      state.maybeAsyncArrow = false;
  	    } while (!state.stop);

  	    return base;
  	  }

  	  parseSubscript(base, startPos, startLoc, noCalls, state) {
  	    const {
  	      type
  	    } = this.state;

  	    if (!noCalls && type === 15) {
  	      return this.parseBind(base, startPos, startLoc, noCalls, state);
  	    } else if (tokenIsTemplate(type)) {
  	      return this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
  	    }

  	    let optional = false;

  	    if (type === 18) {
  	      if (noCalls && this.lookaheadCharCode() === 40) {
  	        state.stop = true;
  	        return base;
  	      }

  	      state.optionalChainMember = optional = true;
  	      this.next();
  	    }

  	    if (!noCalls && this.match(10)) {
  	      return this.parseCoverCallAndAsyncArrowHead(base, startPos, startLoc, state, optional);
  	    } else {
  	      const computed = this.eat(0);

  	      if (computed || optional || this.eat(16)) {
  	        return this.parseMember(base, startPos, startLoc, state, computed, optional);
  	      } else {
  	        state.stop = true;
  	        return base;
  	      }
  	    }
  	  }

  	  parseMember(base, startPos, startLoc, state, computed, optional) {
  	    const node = this.startNodeAt(startPos, startLoc);
  	    node.object = base;
  	    node.computed = computed;

  	    if (computed) {
  	      node.property = this.parseExpression();
  	      this.expect(3);
  	    } else if (this.match(134)) {
  	      if (base.type === "Super") {
  	        this.raise(Errors.SuperPrivateField, {
  	          at: startLoc
  	        });
  	      }

  	      this.classScope.usePrivateName(this.state.value, this.state.startLoc);
  	      node.property = this.parsePrivateName();
  	    } else {
  	      node.property = this.parseIdentifier(true);
  	    }

  	    if (state.optionalChainMember) {
  	      node.optional = optional;
  	      return this.finishNode(node, "OptionalMemberExpression");
  	    } else {
  	      return this.finishNode(node, "MemberExpression");
  	    }
  	  }

  	  parseBind(base, startPos, startLoc, noCalls, state) {
  	    const node = this.startNodeAt(startPos, startLoc);
  	    node.object = base;
  	    this.next();
  	    node.callee = this.parseNoCallExpr();
  	    state.stop = true;
  	    return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls);
  	  }

  	  parseCoverCallAndAsyncArrowHead(base, startPos, startLoc, state, optional) {
  	    const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
  	    let refExpressionErrors = null;
  	    this.state.maybeInArrowParameters = true;
  	    this.next();
  	    const node = this.startNodeAt(startPos, startLoc);
  	    node.callee = base;
  	    const {
  	      maybeAsyncArrow,
  	      optionalChainMember
  	    } = state;

  	    if (maybeAsyncArrow) {
  	      this.expressionScope.enter(newAsyncArrowScope());
  	      refExpressionErrors = new ExpressionErrors();
  	    }

  	    if (optionalChainMember) {
  	      node.optional = optional;
  	    }

  	    if (optional) {
  	      node.arguments = this.parseCallExpressionArguments(11);
  	    } else {
  	      node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
  	    }

  	    let finishedNode = this.finishCallExpression(node, optionalChainMember);

  	    if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
  	      state.stop = true;
  	      this.checkDestructuringPrivate(refExpressionErrors);
  	      this.expressionScope.validateAsPattern();
  	      this.expressionScope.exit();
  	      finishedNode = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), finishedNode);
  	    } else {
  	      if (maybeAsyncArrow) {
  	        this.checkExpressionErrors(refExpressionErrors, true);
  	        this.expressionScope.exit();
  	      }

  	      this.toReferencedArguments(finishedNode);
  	    }

  	    this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
  	    return finishedNode;
  	  }

  	  toReferencedArguments(node, isParenthesizedExpr) {
  	    this.toReferencedListDeep(node.arguments, isParenthesizedExpr);
  	  }

  	  parseTaggedTemplateExpression(base, startPos, startLoc, state) {
  	    const node = this.startNodeAt(startPos, startLoc);
  	    node.tag = base;
  	    node.quasi = this.parseTemplate(true);

  	    if (state.optionalChainMember) {
  	      this.raise(Errors.OptionalChainingNoTemplate, {
  	        at: startLoc
  	      });
  	    }

  	    return this.finishNode(node, "TaggedTemplateExpression");
  	  }

  	  atPossibleAsyncArrow(base) {
  	    return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.state.potentialArrowAt;
  	  }

  	  finishCallExpression(node, optional) {
  	    if (node.callee.type === "Import") {
  	      if (node.arguments.length === 2) {
  	        {
  	          if (!this.hasPlugin("moduleAttributes")) {
  	            this.expectPlugin("importAssertions");
  	          }
  	        }
  	      }

  	      if (node.arguments.length === 0 || node.arguments.length > 2) {
  	        this.raise(Errors.ImportCallArity, {
  	          at: node,
  	          maxArgumentCount: this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
  	        });
  	      } else {
  	        for (const arg of node.arguments) {
  	          if (arg.type === "SpreadElement") {
  	            this.raise(Errors.ImportCallSpreadArgument, {
  	              at: arg
  	            });
  	          }
  	        }
  	      }
  	    }

  	    return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
  	  }

  	  parseCallExpressionArguments(close, dynamicImport, allowPlaceholder, nodeForExtra, refExpressionErrors) {
  	    const elts = [];
  	    let first = true;
  	    const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
  	    this.state.inFSharpPipelineDirectBody = false;

  	    while (!this.eat(close)) {
  	      if (first) {
  	        first = false;
  	      } else {
  	        this.expect(12);

  	        if (this.match(close)) {
  	          if (dynamicImport && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
  	            this.raise(Errors.ImportCallArgumentTrailingComma, {
  	              at: this.state.lastTokStartLoc
  	            });
  	          }

  	          if (nodeForExtra) {
  	            this.addTrailingCommaExtraToNode(nodeForExtra);
  	          }

  	          this.next();
  	          break;
  	        }
  	      }

  	      elts.push(this.parseExprListItem(false, refExpressionErrors, allowPlaceholder));
  	    }

  	    this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
  	    return elts;
  	  }

  	  shouldParseAsyncArrow() {
  	    return this.match(19) && !this.canInsertSemicolon();
  	  }

  	  parseAsyncArrowFromCallExpression(node, call) {
  	    var _call$extra;

  	    this.resetPreviousNodeTrailingComments(call);
  	    this.expect(19);
  	    this.parseArrowExpression(node, call.arguments, true, (_call$extra = call.extra) == null ? void 0 : _call$extra.trailingCommaLoc);

  	    if (call.innerComments) {
  	      setInnerComments(node, call.innerComments);
  	    }

  	    if (call.callee.trailingComments) {
  	      setInnerComments(node, call.callee.trailingComments);
  	    }

  	    return node;
  	  }

  	  parseNoCallExpr() {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
  	  }

  	  parseExprAtom(refExpressionErrors) {
  	    let node;
  	    const {
  	      type
  	    } = this.state;

  	    switch (type) {
  	      case 79:
  	        return this.parseSuper();

  	      case 83:
  	        node = this.startNode();
  	        this.next();

  	        if (this.match(16)) {
  	          return this.parseImportMetaProperty(node);
  	        }

  	        if (!this.match(10)) {
  	          this.raise(Errors.UnsupportedImport, {
  	            at: this.state.lastTokStartLoc
  	          });
  	        }

  	        return this.finishNode(node, "Import");

  	      case 78:
  	        node = this.startNode();
  	        this.next();
  	        return this.finishNode(node, "ThisExpression");

  	      case 90:
  	        {
  	          return this.parseDo(this.startNode(), false);
  	        }

  	      case 56:
  	      case 31:
  	        {
  	          this.readRegexp();
  	          return this.parseRegExpLiteral(this.state.value);
  	        }

  	      case 130:
  	        return this.parseNumericLiteral(this.state.value);

  	      case 131:
  	        return this.parseBigIntLiteral(this.state.value);

  	      case 132:
  	        return this.parseDecimalLiteral(this.state.value);

  	      case 129:
  	        return this.parseStringLiteral(this.state.value);

  	      case 84:
  	        return this.parseNullLiteral();

  	      case 85:
  	        return this.parseBooleanLiteral(true);

  	      case 86:
  	        return this.parseBooleanLiteral(false);

  	      case 10:
  	        {
  	          const canBeArrow = this.state.potentialArrowAt === this.state.start;
  	          return this.parseParenAndDistinguishExpression(canBeArrow);
  	        }

  	      case 2:
  	      case 1:
  	        {
  	          return this.parseArrayLike(this.state.type === 2 ? 4 : 3, false, true);
  	        }

  	      case 0:
  	        {
  	          return this.parseArrayLike(3, true, false, refExpressionErrors);
  	        }

  	      case 6:
  	      case 7:
  	        {
  	          return this.parseObjectLike(this.state.type === 6 ? 9 : 8, false, true);
  	        }

  	      case 5:
  	        {
  	          return this.parseObjectLike(8, false, false, refExpressionErrors);
  	        }

  	      case 68:
  	        return this.parseFunctionOrFunctionSent();

  	      case 26:
  	        this.parseDecorators();

  	      case 80:
  	        node = this.startNode();
  	        this.takeDecorators(node);
  	        return this.parseClass(node, false);

  	      case 77:
  	        return this.parseNewOrNewTarget();

  	      case 25:
  	      case 24:
  	        return this.parseTemplate(false);

  	      case 15:
  	        {
  	          node = this.startNode();
  	          this.next();
  	          node.object = null;
  	          const callee = node.callee = this.parseNoCallExpr();

  	          if (callee.type === "MemberExpression") {
  	            return this.finishNode(node, "BindExpression");
  	          } else {
  	            throw this.raise(Errors.UnsupportedBind, {
  	              at: callee
  	            });
  	          }
  	        }

  	      case 134:
  	        {
  	          this.raise(Errors.PrivateInExpectedIn, {
  	            at: this.state.startLoc,
  	            identifierName: this.state.value
  	          });
  	          return this.parsePrivateName();
  	        }

  	      case 33:
  	        {
  	          return this.parseTopicReferenceThenEqualsSign(54, "%");
  	        }

  	      case 32:
  	        {
  	          return this.parseTopicReferenceThenEqualsSign(44, "^");
  	        }

  	      case 37:
  	      case 38:
  	        {
  	          return this.parseTopicReference("hack");
  	        }

  	      case 44:
  	      case 54:
  	      case 27:
  	        {
  	          const pipeProposal = this.getPluginOption("pipelineOperator", "proposal");

  	          if (pipeProposal) {
  	            return this.parseTopicReference(pipeProposal);
  	          } else {
  	            throw this.unexpected();
  	          }
  	        }

  	      case 47:
  	        {
  	          const lookaheadCh = this.input.codePointAt(this.nextTokenStart());

  	          if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) {
  	            this.expectOnePlugin(["jsx", "flow", "typescript"]);
  	            break;
  	          } else {
  	            throw this.unexpected();
  	          }
  	        }

  	      default:
  	        if (tokenIsIdentifier(type)) {
  	          if (this.isContextual(123) && this.lookaheadCharCode() === 123 && !this.hasFollowingLineBreak()) {
  	            return this.parseModuleExpression();
  	          }

  	          const canBeArrow = this.state.potentialArrowAt === this.state.start;
  	          const containsEsc = this.state.containsEsc;
  	          const id = this.parseIdentifier();

  	          if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) {
  	            const {
  	              type
  	            } = this.state;

  	            if (type === 68) {
  	              this.resetPreviousNodeTrailingComments(id);
  	              this.next();
  	              return this.parseFunction(this.startNodeAtNode(id), undefined, true);
  	            } else if (tokenIsIdentifier(type)) {
  	              if (this.lookaheadCharCode() === 61) {
  	                return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id));
  	              } else {
  	                return id;
  	              }
  	            } else if (type === 90) {
  	              this.resetPreviousNodeTrailingComments(id);
  	              return this.parseDo(this.startNodeAtNode(id), true);
  	            }
  	          }

  	          if (canBeArrow && this.match(19) && !this.canInsertSemicolon()) {
  	            this.next();
  	            return this.parseArrowExpression(this.startNodeAtNode(id), [id], false);
  	          }

  	          return id;
  	        } else {
  	          throw this.unexpected();
  	        }

  	    }
  	  }

  	  parseTopicReferenceThenEqualsSign(topicTokenType, topicTokenValue) {
  	    const pipeProposal = this.getPluginOption("pipelineOperator", "proposal");

  	    if (pipeProposal) {
  	      this.state.type = topicTokenType;
  	      this.state.value = topicTokenValue;
  	      this.state.pos--;
  	      this.state.end--;
  	      this.state.endLoc = createPositionWithColumnOffset(this.state.endLoc, -1);
  	      return this.parseTopicReference(pipeProposal);
  	    } else {
  	      throw this.unexpected();
  	    }
  	  }

  	  parseTopicReference(pipeProposal) {
  	    const node = this.startNode();
  	    const startLoc = this.state.startLoc;
  	    const tokenType = this.state.type;
  	    this.next();
  	    return this.finishTopicReference(node, startLoc, pipeProposal, tokenType);
  	  }

  	  finishTopicReference(node, startLoc, pipeProposal, tokenType) {
  	    if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
  	      const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";

  	      if (!this.topicReferenceIsAllowedInCurrentContext()) {
  	        this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, {
  	          at: startLoc
  	        });
  	      }

  	      this.registerTopicReference();
  	      return this.finishNode(node, nodeType);
  	    } else {
  	      throw this.raise(Errors.PipeTopicUnconfiguredToken, {
  	        at: startLoc,
  	        token: tokenLabelName(tokenType)
  	      });
  	    }
  	  }

  	  testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType) {
  	    switch (pipeProposal) {
  	      case "hack":
  	        {
  	          return this.hasPlugin(["pipelineOperator", {
  	            topicToken: tokenLabelName(tokenType)
  	          }]);
  	        }

  	      case "smart":
  	        return tokenType === 27;

  	      default:
  	        throw this.raise(Errors.PipeTopicRequiresHackPipes, {
  	          at: startLoc
  	        });
  	    }
  	  }

  	  parseAsyncArrowUnaryFunction(node) {
  	    this.prodParam.enter(functionFlags(true, this.prodParam.hasYield));
  	    const params = [this.parseIdentifier()];
  	    this.prodParam.exit();

  	    if (this.hasPrecedingLineBreak()) {
  	      this.raise(Errors.LineTerminatorBeforeArrow, {
  	        at: this.state.curPosition()
  	      });
  	    }

  	    this.expect(19);
  	    return this.parseArrowExpression(node, params, true);
  	  }

  	  parseDo(node, isAsync) {
  	    this.expectPlugin("doExpressions");

  	    if (isAsync) {
  	      this.expectPlugin("asyncDoExpressions");
  	    }

  	    node.async = isAsync;
  	    this.next();
  	    const oldLabels = this.state.labels;
  	    this.state.labels = [];

  	    if (isAsync) {
  	      this.prodParam.enter(PARAM_AWAIT);
  	      node.body = this.parseBlock();
  	      this.prodParam.exit();
  	    } else {
  	      node.body = this.parseBlock();
  	    }

  	    this.state.labels = oldLabels;
  	    return this.finishNode(node, "DoExpression");
  	  }

  	  parseSuper() {
  	    const node = this.startNode();
  	    this.next();

  	    if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
  	      this.raise(Errors.SuperNotAllowed, {
  	        at: node
  	      });
  	    } else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
  	      this.raise(Errors.UnexpectedSuper, {
  	        at: node
  	      });
  	    }

  	    if (!this.match(10) && !this.match(0) && !this.match(16)) {
  	      this.raise(Errors.UnsupportedSuper, {
  	        at: node
  	      });
  	    }

  	    return this.finishNode(node, "Super");
  	  }

  	  parsePrivateName() {
  	    const node = this.startNode();
  	    const id = this.startNodeAt(this.state.start + 1, new Position(this.state.curLine, this.state.start + 1 - this.state.lineStart, this.state.start + 1));
  	    const name = this.state.value;
  	    this.next();
  	    node.id = this.createIdentifier(id, name);
  	    return this.finishNode(node, "PrivateName");
  	  }

  	  parseFunctionOrFunctionSent() {
  	    const node = this.startNode();
  	    this.next();

  	    if (this.prodParam.hasYield && this.match(16)) {
  	      const meta = this.createIdentifier(this.startNodeAtNode(node), "function");
  	      this.next();

  	      if (this.match(102)) {
  	        this.expectPlugin("functionSent");
  	      } else if (!this.hasPlugin("functionSent")) {
  	        this.unexpected();
  	      }

  	      return this.parseMetaProperty(node, meta, "sent");
  	    }

  	    return this.parseFunction(node);
  	  }

  	  parseMetaProperty(node, meta, propertyName) {
  	    node.meta = meta;
  	    const containsEsc = this.state.containsEsc;
  	    node.property = this.parseIdentifier(true);

  	    if (node.property.name !== propertyName || containsEsc) {
  	      this.raise(Errors.UnsupportedMetaProperty, {
  	        at: node.property,
  	        target: meta.name,
  	        onlyValidPropertyName: propertyName
  	      });
  	    }

  	    return this.finishNode(node, "MetaProperty");
  	  }

  	  parseImportMetaProperty(node) {
  	    const id = this.createIdentifier(this.startNodeAtNode(node), "import");
  	    this.next();

  	    if (this.isContextual(100)) {
  	      if (!this.inModule) {
  	        this.raise(Errors.ImportMetaOutsideModule, {
  	          at: id
  	        });
  	      }

  	      this.sawUnambiguousESM = true;
  	    }

  	    return this.parseMetaProperty(node, id, "meta");
  	  }

  	  parseLiteralAtNode(value, type, node) {
  	    this.addExtra(node, "rawValue", value);
  	    this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
  	    node.value = value;
  	    this.next();
  	    return this.finishNode(node, type);
  	  }

  	  parseLiteral(value, type) {
  	    const node = this.startNode();
  	    return this.parseLiteralAtNode(value, type, node);
  	  }

  	  parseStringLiteral(value) {
  	    return this.parseLiteral(value, "StringLiteral");
  	  }

  	  parseNumericLiteral(value) {
  	    return this.parseLiteral(value, "NumericLiteral");
  	  }

  	  parseBigIntLiteral(value) {
  	    return this.parseLiteral(value, "BigIntLiteral");
  	  }

  	  parseDecimalLiteral(value) {
  	    return this.parseLiteral(value, "DecimalLiteral");
  	  }

  	  parseRegExpLiteral(value) {
  	    const node = this.parseLiteral(value.value, "RegExpLiteral");
  	    node.pattern = value.pattern;
  	    node.flags = value.flags;
  	    return node;
  	  }

  	  parseBooleanLiteral(value) {
  	    const node = this.startNode();
  	    node.value = value;
  	    this.next();
  	    return this.finishNode(node, "BooleanLiteral");
  	  }

  	  parseNullLiteral() {
  	    const node = this.startNode();
  	    this.next();
  	    return this.finishNode(node, "NullLiteral");
  	  }

  	  parseParenAndDistinguishExpression(canBeArrow) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    let val;
  	    this.next();
  	    this.expressionScope.enter(newArrowHeadScope());
  	    const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
  	    const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
  	    this.state.maybeInArrowParameters = true;
  	    this.state.inFSharpPipelineDirectBody = false;
  	    const innerStartPos = this.state.start;
  	    const innerStartLoc = this.state.startLoc;
  	    const exprList = [];
  	    const refExpressionErrors = new ExpressionErrors();
  	    let first = true;
  	    let spreadStartLoc;
  	    let optionalCommaStartLoc;

  	    while (!this.match(11)) {
  	      if (first) {
  	        first = false;
  	      } else {
  	        this.expect(12, refExpressionErrors.optionalParametersLoc === null ? null : refExpressionErrors.optionalParametersLoc);

  	        if (this.match(11)) {
  	          optionalCommaStartLoc = this.state.startLoc;
  	          break;
  	        }
  	      }

  	      if (this.match(21)) {
  	        const spreadNodeStartPos = this.state.start;
  	        const spreadNodeStartLoc = this.state.startLoc;
  	        spreadStartLoc = this.state.startLoc;
  	        exprList.push(this.parseParenItem(this.parseRestBinding(), spreadNodeStartPos, spreadNodeStartLoc));

  	        if (!this.checkCommaAfterRest(41)) {
  	          break;
  	        }
  	      } else {
  	        exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem));
  	      }
  	    }

  	    const innerEndLoc = this.state.lastTokEndLoc;
  	    this.expect(11);
  	    this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
  	    this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
  	    let arrowNode = this.startNodeAt(startPos, startLoc);

  	    if (canBeArrow && this.shouldParseArrow(exprList) && (arrowNode = this.parseArrow(arrowNode))) {
  	      this.checkDestructuringPrivate(refExpressionErrors);
  	      this.expressionScope.validateAsPattern();
  	      this.expressionScope.exit();
  	      this.parseArrowExpression(arrowNode, exprList, false);
  	      return arrowNode;
  	    }

  	    this.expressionScope.exit();

  	    if (!exprList.length) {
  	      this.unexpected(this.state.lastTokStartLoc);
  	    }

  	    if (optionalCommaStartLoc) this.unexpected(optionalCommaStartLoc);
  	    if (spreadStartLoc) this.unexpected(spreadStartLoc);
  	    this.checkExpressionErrors(refExpressionErrors, true);
  	    this.toReferencedListDeep(exprList, true);

  	    if (exprList.length > 1) {
  	      val = this.startNodeAt(innerStartPos, innerStartLoc);
  	      val.expressions = exprList;
  	      this.finishNode(val, "SequenceExpression");
  	      this.resetEndLocation(val, innerEndLoc);
  	    } else {
  	      val = exprList[0];
  	    }

  	    return this.wrapParenthesis(startPos, startLoc, val);
  	  }

  	  wrapParenthesis(startPos, startLoc, expression) {
  	    if (!this.options.createParenthesizedExpressions) {
  	      this.addExtra(expression, "parenthesized", true);
  	      this.addExtra(expression, "parenStart", startPos);
  	      this.takeSurroundingComments(expression, startPos, this.state.lastTokEndLoc.index);
  	      return expression;
  	    }

  	    const parenExpression = this.startNodeAt(startPos, startLoc);
  	    parenExpression.expression = expression;
  	    return this.finishNode(parenExpression, "ParenthesizedExpression");
  	  }

  	  shouldParseArrow(params) {
  	    return !this.canInsertSemicolon();
  	  }

  	  parseArrow(node) {
  	    if (this.eat(19)) {
  	      return node;
  	    }
  	  }

  	  parseParenItem(node, startPos, startLoc) {
  	    return node;
  	  }

  	  parseNewOrNewTarget() {
  	    const node = this.startNode();
  	    this.next();

  	    if (this.match(16)) {
  	      const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
  	      this.next();
  	      const metaProp = this.parseMetaProperty(node, meta, "target");

  	      if (!this.scope.inNonArrowFunction && !this.scope.inClass) {
  	        this.raise(Errors.UnexpectedNewTarget, {
  	          at: metaProp
  	        });
  	      }

  	      return metaProp;
  	    }

  	    return this.parseNew(node);
  	  }

  	  parseNew(node) {
  	    this.parseNewCallee(node);

  	    if (this.eat(10)) {
  	      const args = this.parseExprList(11);
  	      this.toReferencedList(args);
  	      node.arguments = args;
  	    } else {
  	      node.arguments = [];
  	    }

  	    return this.finishNode(node, "NewExpression");
  	  }

  	  parseNewCallee(node) {
  	    node.callee = this.parseNoCallExpr();

  	    if (node.callee.type === "Import") {
  	      this.raise(Errors.ImportCallNotNewExpression, {
  	        at: node.callee
  	      });
  	    } else if (this.isOptionalChain(node.callee)) {
  	      this.raise(Errors.OptionalChainingNoNew, {
  	        at: this.state.lastTokEndLoc
  	      });
  	    } else if (this.eat(18)) {
  	      this.raise(Errors.OptionalChainingNoNew, {
  	        at: this.state.startLoc
  	      });
  	    }
  	  }

  	  parseTemplateElement(isTagged) {
  	    const {
  	      start,
  	      startLoc,
  	      end,
  	      value
  	    } = this.state;
  	    const elemStart = start + 1;
  	    const elem = this.startNodeAt(elemStart, createPositionWithColumnOffset(startLoc, 1));

  	    if (value === null) {
  	      if (!isTagged) {
  	        this.raise(Errors.InvalidEscapeSequenceTemplate, {
  	          at: createPositionWithColumnOffset(startLoc, 2)
  	        });
  	      }
  	    }

  	    const isTail = this.match(24);
  	    const endOffset = isTail ? -1 : -2;
  	    const elemEnd = end + endOffset;
  	    elem.value = {
  	      raw: this.input.slice(elemStart, elemEnd).replace(/\r\n?/g, "\n"),
  	      cooked: value === null ? null : value.slice(1, endOffset)
  	    };
  	    elem.tail = isTail;
  	    this.next();
  	    const finishedNode = this.finishNode(elem, "TemplateElement");
  	    this.resetEndLocation(finishedNode, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
  	    return finishedNode;
  	  }

  	  parseTemplate(isTagged) {
  	    const node = this.startNode();
  	    node.expressions = [];
  	    let curElt = this.parseTemplateElement(isTagged);
  	    node.quasis = [curElt];

  	    while (!curElt.tail) {
  	      node.expressions.push(this.parseTemplateSubstitution());
  	      this.readTemplateContinuation();
  	      node.quasis.push(curElt = this.parseTemplateElement(isTagged));
  	    }

  	    return this.finishNode(node, "TemplateLiteral");
  	  }

  	  parseTemplateSubstitution() {
  	    return this.parseExpression();
  	  }

  	  parseObjectLike(close, isPattern, isRecord, refExpressionErrors) {
  	    if (isRecord) {
  	      this.expectPlugin("recordAndTuple");
  	    }

  	    const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
  	    this.state.inFSharpPipelineDirectBody = false;
  	    const propHash = Object.create(null);
  	    let first = true;
  	    const node = this.startNode();
  	    node.properties = [];
  	    this.next();

  	    while (!this.match(close)) {
  	      if (first) {
  	        first = false;
  	      } else {
  	        this.expect(12);

  	        if (this.match(close)) {
  	          this.addTrailingCommaExtraToNode(node);
  	          break;
  	        }
  	      }

  	      let prop;

  	      if (isPattern) {
  	        prop = this.parseBindingProperty();
  	      } else {
  	        prop = this.parsePropertyDefinition(refExpressionErrors);
  	        this.checkProto(prop, isRecord, propHash, refExpressionErrors);
  	      }

  	      if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
  	        this.raise(Errors.InvalidRecordProperty, {
  	          at: prop
  	        });
  	      }

  	      if (prop.shorthand) {
  	        this.addExtra(prop, "shorthand", true);
  	      }

  	      node.properties.push(prop);
  	    }

  	    this.next();
  	    this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
  	    let type = "ObjectExpression";

  	    if (isPattern) {
  	      type = "ObjectPattern";
  	    } else if (isRecord) {
  	      type = "RecordExpression";
  	    }

  	    return this.finishNode(node, type);
  	  }

  	  addTrailingCommaExtraToNode(node) {
  	    this.addExtra(node, "trailingComma", this.state.lastTokStart);
  	    this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
  	  }

  	  maybeAsyncOrAccessorProp(prop) {
  	    return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(55));
  	  }

  	  parsePropertyDefinition(refExpressionErrors) {
  	    let decorators = [];

  	    if (this.match(26)) {
  	      if (this.hasPlugin("decorators")) {
  	        this.raise(Errors.UnsupportedPropertyDecorator, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      while (this.match(26)) {
  	        decorators.push(this.parseDecorator());
  	      }
  	    }

  	    const prop = this.startNode();
  	    let isAsync = false;
  	    let isAccessor = false;
  	    let startPos;
  	    let startLoc;

  	    if (this.match(21)) {
  	      if (decorators.length) this.unexpected();
  	      return this.parseSpread();
  	    }

  	    if (decorators.length) {
  	      prop.decorators = decorators;
  	      decorators = [];
  	    }

  	    prop.method = false;

  	    if (refExpressionErrors) {
  	      startPos = this.state.start;
  	      startLoc = this.state.startLoc;
  	    }

  	    let isGenerator = this.eat(55);
  	    this.parsePropertyNamePrefixOperator(prop);
  	    const containsEsc = this.state.containsEsc;
  	    const key = this.parsePropertyName(prop, refExpressionErrors);

  	    if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
  	      const keyName = key.name;

  	      if (keyName === "async" && !this.hasPrecedingLineBreak()) {
  	        isAsync = true;
  	        this.resetPreviousNodeTrailingComments(key);
  	        isGenerator = this.eat(55);
  	        this.parsePropertyName(prop);
  	      }

  	      if (keyName === "get" || keyName === "set") {
  	        isAccessor = true;
  	        this.resetPreviousNodeTrailingComments(key);
  	        prop.kind = keyName;

  	        if (this.match(55)) {
  	          isGenerator = true;
  	          this.raise(Errors.AccessorIsGenerator, {
  	            at: this.state.curPosition(),
  	            kind: keyName
  	          });
  	          this.next();
  	        }

  	        this.parsePropertyName(prop);
  	      }
  	    }

  	    return this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, false, isAccessor, refExpressionErrors);
  	  }

  	  getGetterSetterExpectedParamCount(method) {
  	    return method.kind === "get" ? 0 : 1;
  	  }

  	  getObjectOrClassMethodParams(method) {
  	    return method.params;
  	  }

  	  checkGetterSetterParams(method) {
  	    var _params;

  	    const paramCount = this.getGetterSetterExpectedParamCount(method);
  	    const params = this.getObjectOrClassMethodParams(method);

  	    if (params.length !== paramCount) {
  	      this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
  	        at: method
  	      });
  	    }

  	    if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
  	      this.raise(Errors.BadSetterRestParameter, {
  	        at: method
  	      });
  	    }
  	  }

  	  parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
  	    if (isAccessor) {
  	      const finishedProp = this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
  	      this.checkGetterSetterParams(finishedProp);
  	      return finishedProp;
  	    }

  	    if (isAsync || isGenerator || this.match(10)) {
  	      if (isPattern) this.unexpected();
  	      prop.kind = "method";
  	      prop.method = true;
  	      return this.parseMethod(prop, isGenerator, isAsync, false, false, "ObjectMethod");
  	    }
  	  }

  	  parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors) {
  	    prop.shorthand = false;

  	    if (this.eat(14)) {
  	      prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors);
  	      return this.finishNode(prop, "ObjectProperty");
  	    }

  	    if (!prop.computed && prop.key.type === "Identifier") {
  	      this.checkReservedWord(prop.key.name, prop.key.loc.start, true, false);

  	      if (isPattern) {
  	        prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key));
  	      } else if (this.match(29)) {
  	        const shorthandAssignLoc = this.state.startLoc;

  	        if (refExpressionErrors != null) {
  	          if (refExpressionErrors.shorthandAssignLoc === null) {
  	            refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
  	          }
  	        } else {
  	          this.raise(Errors.InvalidCoverInitializedName, {
  	            at: shorthandAssignLoc
  	          });
  	        }

  	        prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key));
  	      } else {
  	        prop.value = cloneIdentifier(prop.key);
  	      }

  	      prop.shorthand = true;
  	      return this.finishNode(prop, "ObjectProperty");
  	    }
  	  }

  	  parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
  	    const node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors);
  	    if (!node) this.unexpected();
  	    return node;
  	  }

  	  parsePropertyName(prop, refExpressionErrors) {
  	    if (this.eat(0)) {
  	      prop.computed = true;
  	      prop.key = this.parseMaybeAssignAllowIn();
  	      this.expect(3);
  	    } else {
  	      const {
  	        type,
  	        value
  	      } = this.state;
  	      let key;

  	      if (tokenIsKeywordOrIdentifier(type)) {
  	        key = this.parseIdentifier(true);
  	      } else {
  	        switch (type) {
  	          case 130:
  	            key = this.parseNumericLiteral(value);
  	            break;

  	          case 129:
  	            key = this.parseStringLiteral(value);
  	            break;

  	          case 131:
  	            key = this.parseBigIntLiteral(value);
  	            break;

  	          case 132:
  	            key = this.parseDecimalLiteral(value);
  	            break;

  	          case 134:
  	            {
  	              const privateKeyLoc = this.state.startLoc;

  	              if (refExpressionErrors != null) {
  	                if (refExpressionErrors.privateKeyLoc === null) {
  	                  refExpressionErrors.privateKeyLoc = privateKeyLoc;
  	                }
  	              } else {
  	                this.raise(Errors.UnexpectedPrivateField, {
  	                  at: privateKeyLoc
  	                });
  	              }

  	              key = this.parsePrivateName();
  	              break;
  	            }

  	          default:
  	            throw this.unexpected();
  	        }
  	      }

  	      prop.key = key;

  	      if (type !== 134) {
  	        prop.computed = false;
  	      }
  	    }

  	    return prop.key;
  	  }

  	  initFunction(node, isAsync) {
  	    node.id = null;
  	    node.generator = false;
  	    node.async = !!isAsync;
  	  }

  	  parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
  	    this.initFunction(node, isAsync);
  	    node.generator = !!isGenerator;
  	    const allowModifiers = isConstructor;
  	    this.scope.enter(SCOPE_FUNCTION | SCOPE_SUPER | (inClassScope ? SCOPE_CLASS : 0) | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
  	    this.prodParam.enter(functionFlags(isAsync, node.generator));
  	    this.parseFunctionParams(node, allowModifiers);
  	    const finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
  	    this.prodParam.exit();
  	    this.scope.exit();
  	    return finishedNode;
  	  }

  	  parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
  	    if (isTuple) {
  	      this.expectPlugin("recordAndTuple");
  	    }

  	    const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
  	    this.state.inFSharpPipelineDirectBody = false;
  	    const node = this.startNode();
  	    this.next();
  	    node.elements = this.parseExprList(close, !isTuple, refExpressionErrors, node);
  	    this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
  	    return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
  	  }

  	  parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
  	    this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
  	    let flags = functionFlags(isAsync, false);

  	    if (!this.match(5) && this.prodParam.hasIn) {
  	      flags |= PARAM_IN;
  	    }

  	    this.prodParam.enter(flags);
  	    this.initFunction(node, isAsync);
  	    const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;

  	    if (params) {
  	      this.state.maybeInArrowParameters = true;
  	      this.setArrowFunctionParameters(node, params, trailingCommaLoc);
  	    }

  	    this.state.maybeInArrowParameters = false;
  	    this.parseFunctionBody(node, true);
  	    this.prodParam.exit();
  	    this.scope.exit();
  	    this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
  	    return this.finishNode(node, "ArrowFunctionExpression");
  	  }

  	  setArrowFunctionParameters(node, params, trailingCommaLoc) {
  	    this.toAssignableList(params, trailingCommaLoc, false);
  	    node.params = params;
  	  }

  	  parseFunctionBodyAndFinish(node, type, isMethod = false) {
  	    this.parseFunctionBody(node, false, isMethod);
  	    return this.finishNode(node, type);
  	  }

  	  parseFunctionBody(node, allowExpression, isMethod = false) {
  	    const isExpression = allowExpression && !this.match(5);
  	    this.expressionScope.enter(newExpressionScope());

  	    if (isExpression) {
  	      node.body = this.parseMaybeAssign();
  	      this.checkParams(node, false, allowExpression, false);
  	    } else {
  	      const oldStrict = this.state.strict;
  	      const oldLabels = this.state.labels;
  	      this.state.labels = [];
  	      this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN);
  	      node.body = this.parseBlock(true, false, hasStrictModeDirective => {
  	        const nonSimple = !this.isSimpleParamList(node.params);

  	        if (hasStrictModeDirective && nonSimple) {
  	          this.raise(Errors.IllegalLanguageModeDirective, {
  	            at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
  	          });
  	        }

  	        const strictModeChanged = !oldStrict && this.state.strict;
  	        this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);

  	        if (this.state.strict && node.id) {
  	          this.checkIdentifier(node.id, BIND_OUTSIDE, strictModeChanged);
  	        }
  	      });
  	      this.prodParam.exit();
  	      this.state.labels = oldLabels;
  	    }

  	    this.expressionScope.exit();
  	  }

  	  isSimpleParameter(node) {
  	    return node.type === "Identifier";
  	  }

  	  isSimpleParamList(params) {
  	    for (let i = 0, len = params.length; i < len; i++) {
  	      if (!this.isSimpleParameter(params[i])) return false;
  	    }

  	    return true;
  	  }

  	  checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
  	    const checkClashes = !allowDuplicates && new Set();
  	    const formalParameters = {
  	      type: "FormalParameters"
  	    };

  	    for (const param of node.params) {
  	      this.checkLVal(param, {
  	        in: formalParameters,
  	        binding: BIND_VAR,
  	        checkClashes,
  	        strictModeChanged
  	      });
  	    }
  	  }

  	  parseExprList(close, allowEmpty, refExpressionErrors, nodeForExtra) {
  	    const elts = [];
  	    let first = true;

  	    while (!this.eat(close)) {
  	      if (first) {
  	        first = false;
  	      } else {
  	        this.expect(12);

  	        if (this.match(close)) {
  	          if (nodeForExtra) {
  	            this.addTrailingCommaExtraToNode(nodeForExtra);
  	          }

  	          this.next();
  	          break;
  	        }
  	      }

  	      elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors));
  	    }

  	    return elts;
  	  }

  	  parseExprListItem(allowEmpty, refExpressionErrors, allowPlaceholder) {
  	    let elt;

  	    if (this.match(12)) {
  	      if (!allowEmpty) {
  	        this.raise(Errors.UnexpectedToken, {
  	          at: this.state.curPosition(),
  	          unexpected: ","
  	        });
  	      }

  	      elt = null;
  	    } else if (this.match(21)) {
  	      const spreadNodeStartPos = this.state.start;
  	      const spreadNodeStartLoc = this.state.startLoc;
  	      elt = this.parseParenItem(this.parseSpread(refExpressionErrors), spreadNodeStartPos, spreadNodeStartLoc);
  	    } else if (this.match(17)) {
  	      this.expectPlugin("partialApplication");

  	      if (!allowPlaceholder) {
  	        this.raise(Errors.UnexpectedArgumentPlaceholder, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      const node = this.startNode();
  	      this.next();
  	      elt = this.finishNode(node, "ArgumentPlaceholder");
  	    } else {
  	      elt = this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem);
  	    }

  	    return elt;
  	  }

  	  parseIdentifier(liberal) {
  	    const node = this.startNode();
  	    const name = this.parseIdentifierName(node.start, liberal);
  	    return this.createIdentifier(node, name);
  	  }

  	  createIdentifier(node, name) {
  	    node.name = name;
  	    node.loc.identifierName = name;
  	    return this.finishNode(node, "Identifier");
  	  }

  	  parseIdentifierName(pos, liberal) {
  	    let name;
  	    const {
  	      startLoc,
  	      type
  	    } = this.state;

  	    if (tokenIsKeywordOrIdentifier(type)) {
  	      name = this.state.value;
  	    } else {
  	      throw this.unexpected();
  	    }

  	    const tokenIsKeyword = tokenKeywordOrIdentifierIsKeyword(type);

  	    if (liberal) {
  	      if (tokenIsKeyword) {
  	        this.replaceToken(128);
  	      }
  	    } else {
  	      this.checkReservedWord(name, startLoc, tokenIsKeyword, false);
  	    }

  	    this.next();
  	    return name;
  	  }

  	  checkReservedWord(word, startLoc, checkKeywords, isBinding) {
  	    if (word.length > 10) {
  	      return;
  	    }

  	    if (!canBeReservedWord(word)) {
  	      return;
  	    }

  	    if (word === "yield") {
  	      if (this.prodParam.hasYield) {
  	        this.raise(Errors.YieldBindingIdentifier, {
  	          at: startLoc
  	        });
  	        return;
  	      }
  	    } else if (word === "await") {
  	      if (this.prodParam.hasAwait) {
  	        this.raise(Errors.AwaitBindingIdentifier, {
  	          at: startLoc
  	        });
  	        return;
  	      }

  	      if (this.scope.inStaticBlock) {
  	        this.raise(Errors.AwaitBindingIdentifierInStaticBlock, {
  	          at: startLoc
  	        });
  	        return;
  	      }

  	      this.expressionScope.recordAsyncArrowParametersError({
  	        at: startLoc
  	      });
  	    } else if (word === "arguments") {
  	      if (this.scope.inClassAndNotInNonArrowFunction) {
  	        this.raise(Errors.ArgumentsInClass, {
  	          at: startLoc
  	        });
  	        return;
  	      }
  	    }

  	    if (checkKeywords && isKeyword(word)) {
  	      this.raise(Errors.UnexpectedKeyword, {
  	        at: startLoc,
  	        keyword: word
  	      });
  	      return;
  	    }

  	    const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;

  	    if (reservedTest(word, this.inModule)) {
  	      this.raise(Errors.UnexpectedReservedWord, {
  	        at: startLoc,
  	        reservedWord: word
  	      });
  	    }
  	  }

  	  isAwaitAllowed() {
  	    if (this.prodParam.hasAwait) return true;

  	    if (this.options.allowAwaitOutsideFunction && !this.scope.inFunction) {
  	      return true;
  	    }

  	    return false;
  	  }

  	  parseAwait(startPos, startLoc) {
  	    const node = this.startNodeAt(startPos, startLoc);
  	    this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, {
  	      at: node
  	    });

  	    if (this.eat(55)) {
  	      this.raise(Errors.ObsoleteAwaitStar, {
  	        at: node
  	      });
  	    }

  	    if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
  	      if (this.isAmbiguousAwait()) {
  	        this.ambiguousScriptDifferentAst = true;
  	      } else {
  	        this.sawUnambiguousESM = true;
  	      }
  	    }

  	    if (!this.state.soloAwait) {
  	      node.argument = this.parseMaybeUnary(null, true);
  	    }

  	    return this.finishNode(node, "AwaitExpression");
  	  }

  	  isAmbiguousAwait() {
  	    if (this.hasPrecedingLineBreak()) return true;
  	    const {
  	      type
  	    } = this.state;
  	    return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 133 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
  	  }

  	  parseYield() {
  	    const node = this.startNode();
  	    this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, {
  	      at: node
  	    });
  	    this.next();
  	    let delegating = false;
  	    let argument = null;

  	    if (!this.hasPrecedingLineBreak()) {
  	      delegating = this.eat(55);

  	      switch (this.state.type) {
  	        case 13:
  	        case 135:
  	        case 8:
  	        case 11:
  	        case 3:
  	        case 9:
  	        case 14:
  	        case 12:
  	          if (!delegating) break;

  	        default:
  	          argument = this.parseMaybeAssign();
  	      }
  	    }

  	    node.delegate = delegating;
  	    node.argument = argument;
  	    return this.finishNode(node, "YieldExpression");
  	  }

  	  checkPipelineAtInfixOperator(left, leftStartLoc) {
  	    if (this.hasPlugin(["pipelineOperator", {
  	      proposal: "smart"
  	    }])) {
  	      if (left.type === "SequenceExpression") {
  	        this.raise(Errors.PipelineHeadSequenceExpression, {
  	          at: leftStartLoc
  	        });
  	      }
  	    }
  	  }

  	  parseSmartPipelineBodyInStyle(childExpr, startPos, startLoc) {
  	    if (this.isSimpleReference(childExpr)) {
  	      const bodyNode = this.startNodeAt(startPos, startLoc);
  	      bodyNode.callee = childExpr;
  	      return this.finishNode(bodyNode, "PipelineBareFunction");
  	    } else {
  	      const bodyNode = this.startNodeAt(startPos, startLoc);
  	      this.checkSmartPipeTopicBodyEarlyErrors(startLoc);
  	      bodyNode.expression = childExpr;
  	      return this.finishNode(bodyNode, "PipelineTopicExpression");
  	    }
  	  }

  	  isSimpleReference(expression) {
  	    switch (expression.type) {
  	      case "MemberExpression":
  	        return !expression.computed && this.isSimpleReference(expression.object);

  	      case "Identifier":
  	        return true;

  	      default:
  	        return false;
  	    }
  	  }

  	  checkSmartPipeTopicBodyEarlyErrors(startLoc) {
  	    if (this.match(19)) {
  	      throw this.raise(Errors.PipelineBodyNoArrow, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    if (!this.topicReferenceWasUsedInCurrentContext()) {
  	      this.raise(Errors.PipelineTopicUnused, {
  	        at: startLoc
  	      });
  	    }
  	  }

  	  withTopicBindingContext(callback) {
  	    const outerContextTopicState = this.state.topicContext;
  	    this.state.topicContext = {
  	      maxNumOfResolvableTopics: 1,
  	      maxTopicIndex: null
  	    };

  	    try {
  	      return callback();
  	    } finally {
  	      this.state.topicContext = outerContextTopicState;
  	    }
  	  }

  	  withSmartMixTopicForbiddingContext(callback) {
  	    if (this.hasPlugin(["pipelineOperator", {
  	      proposal: "smart"
  	    }])) {
  	      const outerContextTopicState = this.state.topicContext;
  	      this.state.topicContext = {
  	        maxNumOfResolvableTopics: 0,
  	        maxTopicIndex: null
  	      };

  	      try {
  	        return callback();
  	      } finally {
  	        this.state.topicContext = outerContextTopicState;
  	      }
  	    } else {
  	      return callback();
  	    }
  	  }

  	  withSoloAwaitPermittingContext(callback) {
  	    const outerContextSoloAwaitState = this.state.soloAwait;
  	    this.state.soloAwait = true;

  	    try {
  	      return callback();
  	    } finally {
  	      this.state.soloAwait = outerContextSoloAwaitState;
  	    }
  	  }

  	  allowInAnd(callback) {
  	    const flags = this.prodParam.currentFlags();
  	    const prodParamToSet = PARAM_IN & ~flags;

  	    if (prodParamToSet) {
  	      this.prodParam.enter(flags | PARAM_IN);

  	      try {
  	        return callback();
  	      } finally {
  	        this.prodParam.exit();
  	      }
  	    }

  	    return callback();
  	  }

  	  disallowInAnd(callback) {
  	    const flags = this.prodParam.currentFlags();
  	    const prodParamToClear = PARAM_IN & flags;

  	    if (prodParamToClear) {
  	      this.prodParam.enter(flags & ~PARAM_IN);

  	      try {
  	        return callback();
  	      } finally {
  	        this.prodParam.exit();
  	      }
  	    }

  	    return callback();
  	  }

  	  registerTopicReference() {
  	    this.state.topicContext.maxTopicIndex = 0;
  	  }

  	  topicReferenceIsAllowedInCurrentContext() {
  	    return this.state.topicContext.maxNumOfResolvableTopics >= 1;
  	  }

  	  topicReferenceWasUsedInCurrentContext() {
  	    return this.state.topicContext.maxTopicIndex != null && this.state.topicContext.maxTopicIndex >= 0;
  	  }

  	  parseFSharpPipelineBody(prec) {
  	    const startPos = this.state.start;
  	    const startLoc = this.state.startLoc;
  	    this.state.potentialArrowAt = this.state.start;
  	    const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
  	    this.state.inFSharpPipelineDirectBody = true;
  	    const ret = this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startPos, startLoc, prec);
  	    this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
  	    return ret;
  	  }

  	  parseModuleExpression() {
  	    this.expectPlugin("moduleBlocks");
  	    const node = this.startNode();
  	    this.next();
  	    this.eat(5);
  	    const revertScopes = this.initializeScopes(true);
  	    this.enterInitialScopes();
  	    const program = this.startNode();

  	    try {
  	      node.body = this.parseProgram(program, 8, "module");
  	    } finally {
  	      revertScopes();
  	    }

  	    this.eat(8);
  	    return this.finishNode(node, "ModuleExpression");
  	  }

  	  parsePropertyNamePrefixOperator(prop) {}

  	}

  	const loopLabel = {
  	  kind: "loop"
  	},
  	      switchLabel = {
  	  kind: "switch"
  	};
  	const FUNC_NO_FLAGS = 0b000,
  	      FUNC_STATEMENT = 0b001,
  	      FUNC_HANGING_STATEMENT = 0b010,
  	      FUNC_NULLABLE_ID = 0b100;
  	const loneSurrogate = /[\uD800-\uDFFF]/u;
  	const keywordRelationalOperator = /in(?:stanceof)?/y;

  	function babel7CompatTokens(tokens, input) {
  	  for (let i = 0; i < tokens.length; i++) {
  	    const token = tokens[i];
  	    const {
  	      type
  	    } = token;

  	    if (typeof type === "number") {
  	      {
  	        if (type === 134) {
  	          const {
  	            loc,
  	            start,
  	            value,
  	            end
  	          } = token;
  	          const hashEndPos = start + 1;
  	          const hashEndLoc = createPositionWithColumnOffset(loc.start, 1);
  	          tokens.splice(i, 1, new Token({
  	            type: getExportedToken(27),
  	            value: "#",
  	            start: start,
  	            end: hashEndPos,
  	            startLoc: loc.start,
  	            endLoc: hashEndLoc
  	          }), new Token({
  	            type: getExportedToken(128),
  	            value: value,
  	            start: hashEndPos,
  	            end: end,
  	            startLoc: hashEndLoc,
  	            endLoc: loc.end
  	          }));
  	          i++;
  	          continue;
  	        }

  	        if (tokenIsTemplate(type)) {
  	          const {
  	            loc,
  	            start,
  	            value,
  	            end
  	          } = token;
  	          const backquoteEnd = start + 1;
  	          const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1);
  	          let startToken;

  	          if (input.charCodeAt(start) === 96) {
  	            startToken = new Token({
  	              type: getExportedToken(22),
  	              value: "`",
  	              start: start,
  	              end: backquoteEnd,
  	              startLoc: loc.start,
  	              endLoc: backquoteEndLoc
  	            });
  	          } else {
  	            startToken = new Token({
  	              type: getExportedToken(8),
  	              value: "}",
  	              start: start,
  	              end: backquoteEnd,
  	              startLoc: loc.start,
  	              endLoc: backquoteEndLoc
  	            });
  	          }

  	          let templateValue, templateElementEnd, templateElementEndLoc, endToken;

  	          if (type === 24) {
  	            templateElementEnd = end - 1;
  	            templateElementEndLoc = createPositionWithColumnOffset(loc.end, -1);
  	            templateValue = value === null ? null : value.slice(1, -1);
  	            endToken = new Token({
  	              type: getExportedToken(22),
  	              value: "`",
  	              start: templateElementEnd,
  	              end: end,
  	              startLoc: templateElementEndLoc,
  	              endLoc: loc.end
  	            });
  	          } else {
  	            templateElementEnd = end - 2;
  	            templateElementEndLoc = createPositionWithColumnOffset(loc.end, -2);
  	            templateValue = value === null ? null : value.slice(1, -2);
  	            endToken = new Token({
  	              type: getExportedToken(23),
  	              value: "${",
  	              start: templateElementEnd,
  	              end: end,
  	              startLoc: templateElementEndLoc,
  	              endLoc: loc.end
  	            });
  	          }

  	          tokens.splice(i, 1, startToken, new Token({
  	            type: getExportedToken(20),
  	            value: templateValue,
  	            start: backquoteEnd,
  	            end: templateElementEnd,
  	            startLoc: backquoteEndLoc,
  	            endLoc: templateElementEndLoc
  	          }), endToken);
  	          i += 2;
  	          continue;
  	        }
  	      }
  	      token.type = getExportedToken(type);
  	    }
  	  }

  	  return tokens;
  	}

  	class StatementParser extends ExpressionParser {
  	  parseTopLevel(file, program) {
  	    file.program = this.parseProgram(program);
  	    file.comments = this.state.comments;

  	    if (this.options.tokens) {
  	      file.tokens = babel7CompatTokens(this.tokens, this.input);
  	    }

  	    return this.finishNode(file, "File");
  	  }

  	  parseProgram(program, end = 135, sourceType = this.options.sourceType) {
  	    program.sourceType = sourceType;
  	    program.interpreter = this.parseInterpreterDirective();
  	    this.parseBlockBody(program, true, true, end);

  	    if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
  	      for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
  	        this.raise(Errors.ModuleExportUndefined, {
  	          at,
  	          localName
  	        });
  	      }
  	    }

  	    return this.finishNode(program, "Program");
  	  }

  	  stmtToDirective(stmt) {
  	    const directive = stmt;
  	    directive.type = "Directive";
  	    directive.value = directive.expression;
  	    delete directive.expression;
  	    const directiveLiteral = directive.value;
  	    const expressionValue = directiveLiteral.value;
  	    const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end);
  	    const val = directiveLiteral.value = raw.slice(1, -1);
  	    this.addExtra(directiveLiteral, "raw", raw);
  	    this.addExtra(directiveLiteral, "rawValue", val);
  	    this.addExtra(directiveLiteral, "expressionValue", expressionValue);
  	    directiveLiteral.type = "DirectiveLiteral";
  	    return directive;
  	  }

  	  parseInterpreterDirective() {
  	    if (!this.match(28)) {
  	      return null;
  	    }

  	    const node = this.startNode();
  	    node.value = this.state.value;
  	    this.next();
  	    return this.finishNode(node, "InterpreterDirective");
  	  }

  	  isLet(context) {
  	    if (!this.isContextual(99)) {
  	      return false;
  	    }

  	    return this.isLetKeyword(context);
  	  }

  	  isLetKeyword(context) {
  	    const next = this.nextTokenStart();
  	    const nextCh = this.codePointAtPos(next);

  	    if (nextCh === 92 || nextCh === 91) {
  	      return true;
  	    }

  	    if (context) return false;
  	    if (nextCh === 123) return true;

  	    if (isIdentifierStart(nextCh)) {
  	      keywordRelationalOperator.lastIndex = next;

  	      if (keywordRelationalOperator.test(this.input)) {
  	        const endCh = this.codePointAtPos(keywordRelationalOperator.lastIndex);

  	        if (!isIdentifierChar(endCh) && endCh !== 92) {
  	          return false;
  	        }
  	      }

  	      return true;
  	    }

  	    return false;
  	  }

  	  parseStatement(context, topLevel) {
  	    if (this.match(26)) {
  	      this.parseDecorators(true);
  	    }

  	    return this.parseStatementContent(context, topLevel);
  	  }

  	  parseStatementContent(context, topLevel) {
  	    let starttype = this.state.type;
  	    const node = this.startNode();
  	    let kind;

  	    if (this.isLet(context)) {
  	      starttype = 74;
  	      kind = "let";
  	    }

  	    switch (starttype) {
  	      case 60:
  	        return this.parseBreakContinueStatement(node, true);

  	      case 63:
  	        return this.parseBreakContinueStatement(node, false);

  	      case 64:
  	        return this.parseDebuggerStatement(node);

  	      case 90:
  	        return this.parseDoStatement(node);

  	      case 91:
  	        return this.parseForStatement(node);

  	      case 68:
  	        if (this.lookaheadCharCode() === 46) break;

  	        if (context) {
  	          if (this.state.strict) {
  	            this.raise(Errors.StrictFunction, {
  	              at: this.state.startLoc
  	            });
  	          } else if (context !== "if" && context !== "label") {
  	            this.raise(Errors.SloppyFunction, {
  	              at: this.state.startLoc
  	            });
  	          }
  	        }

  	        return this.parseFunctionStatement(node, false, !context);

  	      case 80:
  	        if (context) this.unexpected();
  	        return this.parseClass(node, true);

  	      case 69:
  	        return this.parseIfStatement(node);

  	      case 70:
  	        return this.parseReturnStatement(node);

  	      case 71:
  	        return this.parseSwitchStatement(node);

  	      case 72:
  	        return this.parseThrowStatement(node);

  	      case 73:
  	        return this.parseTryStatement(node);

  	      case 75:
  	      case 74:
  	        kind = kind || this.state.value;

  	        if (context && kind !== "var") {
  	          this.raise(Errors.UnexpectedLexicalDeclaration, {
  	            at: this.state.startLoc
  	          });
  	        }

  	        return this.parseVarStatement(node, kind);

  	      case 92:
  	        return this.parseWhileStatement(node);

  	      case 76:
  	        return this.parseWithStatement(node);

  	      case 5:
  	        return this.parseBlock();

  	      case 13:
  	        return this.parseEmptyStatement(node);

  	      case 83:
  	        {
  	          const nextTokenCharCode = this.lookaheadCharCode();

  	          if (nextTokenCharCode === 40 || nextTokenCharCode === 46) {
  	            break;
  	          }
  	        }

  	      case 82:
  	        {
  	          if (!this.options.allowImportExportEverywhere && !topLevel) {
  	            this.raise(Errors.UnexpectedImportExport, {
  	              at: this.state.startLoc
  	            });
  	          }

  	          this.next();
  	          let result;

  	          if (starttype === 83) {
  	            result = this.parseImport(node);

  	            if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
  	              this.sawUnambiguousESM = true;
  	            }
  	          } else {
  	            result = this.parseExport(node);

  	            if (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportDefaultDeclaration") {
  	              this.sawUnambiguousESM = true;
  	            }
  	          }

  	          this.assertModuleNodeAllowed(result);
  	          return result;
  	        }

  	      default:
  	        {
  	          if (this.isAsyncFunction()) {
  	            if (context) {
  	              this.raise(Errors.AsyncFunctionInSingleStatementContext, {
  	                at: this.state.startLoc
  	              });
  	            }

  	            this.next();
  	            return this.parseFunctionStatement(node, true, !context);
  	          }
  	        }
  	    }

  	    const maybeName = this.state.value;
  	    const expr = this.parseExpression();

  	    if (tokenIsIdentifier(starttype) && expr.type === "Identifier" && this.eat(14)) {
  	      return this.parseLabeledStatement(node, maybeName, expr, context);
  	    } else {
  	      return this.parseExpressionStatement(node, expr);
  	    }
  	  }

  	  assertModuleNodeAllowed(node) {
  	    if (!this.options.allowImportExportEverywhere && !this.inModule) {
  	      this.raise(Errors.ImportOutsideModule, {
  	        at: node
  	      });
  	    }
  	  }

  	  takeDecorators(node) {
  	    const decorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];

  	    if (decorators.length) {
  	      node.decorators = decorators;
  	      this.resetStartLocationFromNode(node, decorators[0]);
  	      this.state.decoratorStack[this.state.decoratorStack.length - 1] = [];
  	    }
  	  }

  	  canHaveLeadingDecorator() {
  	    return this.match(80);
  	  }

  	  parseDecorators(allowExport) {
  	    const currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];

  	    while (this.match(26)) {
  	      const decorator = this.parseDecorator();
  	      currentContextDecorators.push(decorator);
  	    }

  	    if (this.match(82)) {
  	      if (!allowExport) {
  	        this.unexpected();
  	      }

  	      if (this.hasPlugin("decorators") && !this.getPluginOption("decorators", "decoratorsBeforeExport")) {
  	        this.raise(Errors.DecoratorExportClass, {
  	          at: this.state.startLoc
  	        });
  	      }
  	    } else if (!this.canHaveLeadingDecorator()) {
  	      throw this.raise(Errors.UnexpectedLeadingDecorator, {
  	        at: this.state.startLoc
  	      });
  	    }
  	  }

  	  parseDecorator() {
  	    this.expectOnePlugin(["decorators", "decorators-legacy"]);
  	    const node = this.startNode();
  	    this.next();

  	    if (this.hasPlugin("decorators")) {
  	      this.state.decoratorStack.push([]);
  	      const startPos = this.state.start;
  	      const startLoc = this.state.startLoc;
  	      let expr;

  	      if (this.match(10)) {
  	        const startPos = this.state.start;
  	        const startLoc = this.state.startLoc;
  	        this.next();
  	        expr = this.parseExpression();
  	        this.expect(11);
  	        expr = this.wrapParenthesis(startPos, startLoc, expr);
  	      } else {
  	        expr = this.parseIdentifier(false);

  	        while (this.eat(16)) {
  	          const node = this.startNodeAt(startPos, startLoc);
  	          node.object = expr;
  	          node.property = this.parseIdentifier(true);
  	          node.computed = false;
  	          expr = this.finishNode(node, "MemberExpression");
  	        }
  	      }

  	      node.expression = this.parseMaybeDecoratorArguments(expr);
  	      this.state.decoratorStack.pop();
  	    } else {
  	      node.expression = this.parseExprSubscripts();
  	    }

  	    return this.finishNode(node, "Decorator");
  	  }

  	  parseMaybeDecoratorArguments(expr) {
  	    if (this.eat(10)) {
  	      const node = this.startNodeAtNode(expr);
  	      node.callee = expr;
  	      node.arguments = this.parseCallExpressionArguments(11, false);
  	      this.toReferencedList(node.arguments);
  	      return this.finishNode(node, "CallExpression");
  	    }

  	    return expr;
  	  }

  	  parseBreakContinueStatement(node, isBreak) {
  	    this.next();

  	    if (this.isLineTerminator()) {
  	      node.label = null;
  	    } else {
  	      node.label = this.parseIdentifier();
  	      this.semicolon();
  	    }

  	    this.verifyBreakContinue(node, isBreak);
  	    return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
  	  }

  	  verifyBreakContinue(node, isBreak) {
  	    let i;

  	    for (i = 0; i < this.state.labels.length; ++i) {
  	      const lab = this.state.labels[i];

  	      if (node.label == null || lab.name === node.label.name) {
  	        if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
  	        if (node.label && isBreak) break;
  	      }
  	    }

  	    if (i === this.state.labels.length) {
  	      const type = isBreak ? "BreakStatement" : "ContinueStatement";
  	      this.raise(Errors.IllegalBreakContinue, {
  	        at: node,
  	        type
  	      });
  	    }
  	  }

  	  parseDebuggerStatement(node) {
  	    this.next();
  	    this.semicolon();
  	    return this.finishNode(node, "DebuggerStatement");
  	  }

  	  parseHeaderExpression() {
  	    this.expect(10);
  	    const val = this.parseExpression();
  	    this.expect(11);
  	    return val;
  	  }

  	  parseDoStatement(node) {
  	    this.next();
  	    this.state.labels.push(loopLabel);
  	    node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("do"));
  	    this.state.labels.pop();
  	    this.expect(92);
  	    node.test = this.parseHeaderExpression();
  	    this.eat(13);
  	    return this.finishNode(node, "DoWhileStatement");
  	  }

  	  parseForStatement(node) {
  	    this.next();
  	    this.state.labels.push(loopLabel);
  	    let awaitAt = null;

  	    if (this.isAwaitAllowed() && this.eatContextual(96)) {
  	      awaitAt = this.state.lastTokStartLoc;
  	    }

  	    this.scope.enter(SCOPE_OTHER);
  	    this.expect(10);

  	    if (this.match(13)) {
  	      if (awaitAt !== null) {
  	        this.unexpected(awaitAt);
  	      }

  	      return this.parseFor(node, null);
  	    }

  	    const startsWithLet = this.isContextual(99);
  	    const isLet = startsWithLet && this.isLetKeyword();

  	    if (this.match(74) || this.match(75) || isLet) {
  	      const initNode = this.startNode();
  	      const kind = isLet ? "let" : this.state.value;
  	      this.next();
  	      this.parseVar(initNode, true, kind);
  	      const init = this.finishNode(initNode, "VariableDeclaration");

  	      if ((this.match(58) || this.isContextual(101)) && init.declarations.length === 1) {
  	        return this.parseForIn(node, init, awaitAt);
  	      }

  	      if (awaitAt !== null) {
  	        this.unexpected(awaitAt);
  	      }

  	      return this.parseFor(node, init);
  	    }

  	    const startsWithAsync = this.isContextual(95);
  	    const refExpressionErrors = new ExpressionErrors();
  	    const init = this.parseExpression(true, refExpressionErrors);
  	    const isForOf = this.isContextual(101);

  	    if (isForOf) {
  	      if (startsWithLet) {
  	        this.raise(Errors.ForOfLet, {
  	          at: init
  	        });
  	      }

  	      if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
  	        this.raise(Errors.ForOfAsync, {
  	          at: init
  	        });
  	      }
  	    }

  	    if (isForOf || this.match(58)) {
  	      this.checkDestructuringPrivate(refExpressionErrors);
  	      this.toAssignable(init, true);
  	      const type = isForOf ? "ForOfStatement" : "ForInStatement";
  	      this.checkLVal(init, {
  	        in: {
  	          type
  	        }
  	      });
  	      return this.parseForIn(node, init, awaitAt);
  	    } else {
  	      this.checkExpressionErrors(refExpressionErrors, true);
  	    }

  	    if (awaitAt !== null) {
  	      this.unexpected(awaitAt);
  	    }

  	    return this.parseFor(node, init);
  	  }

  	  parseFunctionStatement(node, isAsync, declarationPosition) {
  	    this.next();
  	    return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), isAsync);
  	  }

  	  parseIfStatement(node) {
  	    this.next();
  	    node.test = this.parseHeaderExpression();
  	    node.consequent = this.parseStatement("if");
  	    node.alternate = this.eat(66) ? this.parseStatement("if") : null;
  	    return this.finishNode(node, "IfStatement");
  	  }

  	  parseReturnStatement(node) {
  	    if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
  	      this.raise(Errors.IllegalReturn, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    this.next();

  	    if (this.isLineTerminator()) {
  	      node.argument = null;
  	    } else {
  	      node.argument = this.parseExpression();
  	      this.semicolon();
  	    }

  	    return this.finishNode(node, "ReturnStatement");
  	  }

  	  parseSwitchStatement(node) {
  	    this.next();
  	    node.discriminant = this.parseHeaderExpression();
  	    const cases = node.cases = [];
  	    this.expect(5);
  	    this.state.labels.push(switchLabel);
  	    this.scope.enter(SCOPE_OTHER);
  	    let cur;

  	    for (let sawDefault; !this.match(8);) {
  	      if (this.match(61) || this.match(65)) {
  	        const isCase = this.match(61);
  	        if (cur) this.finishNode(cur, "SwitchCase");
  	        cases.push(cur = this.startNode());
  	        cur.consequent = [];
  	        this.next();

  	        if (isCase) {
  	          cur.test = this.parseExpression();
  	        } else {
  	          if (sawDefault) {
  	            this.raise(Errors.MultipleDefaultsInSwitch, {
  	              at: this.state.lastTokStartLoc
  	            });
  	          }

  	          sawDefault = true;
  	          cur.test = null;
  	        }

  	        this.expect(14);
  	      } else {
  	        if (cur) {
  	          cur.consequent.push(this.parseStatement(null));
  	        } else {
  	          this.unexpected();
  	        }
  	      }
  	    }

  	    this.scope.exit();
  	    if (cur) this.finishNode(cur, "SwitchCase");
  	    this.next();
  	    this.state.labels.pop();
  	    return this.finishNode(node, "SwitchStatement");
  	  }

  	  parseThrowStatement(node) {
  	    this.next();

  	    if (this.hasPrecedingLineBreak()) {
  	      this.raise(Errors.NewlineAfterThrow, {
  	        at: this.state.lastTokEndLoc
  	      });
  	    }

  	    node.argument = this.parseExpression();
  	    this.semicolon();
  	    return this.finishNode(node, "ThrowStatement");
  	  }

  	  parseCatchClauseParam() {
  	    const param = this.parseBindingAtom();
  	    const simple = param.type === "Identifier";
  	    this.scope.enter(simple ? SCOPE_SIMPLE_CATCH : 0);
  	    this.checkLVal(param, {
  	      in: {
  	        type: "CatchClause"
  	      },
  	      binding: BIND_LEXICAL,
  	      allowingSloppyLetBinding: true
  	    });
  	    return param;
  	  }

  	  parseTryStatement(node) {
  	    this.next();
  	    node.block = this.parseBlock();
  	    node.handler = null;

  	    if (this.match(62)) {
  	      const clause = this.startNode();
  	      this.next();

  	      if (this.match(10)) {
  	        this.expect(10);
  	        clause.param = this.parseCatchClauseParam();
  	        this.expect(11);
  	      } else {
  	        clause.param = null;
  	        this.scope.enter(SCOPE_OTHER);
  	      }

  	      clause.body = this.withSmartMixTopicForbiddingContext(() => this.parseBlock(false, false));
  	      this.scope.exit();
  	      node.handler = this.finishNode(clause, "CatchClause");
  	    }

  	    node.finalizer = this.eat(67) ? this.parseBlock() : null;

  	    if (!node.handler && !node.finalizer) {
  	      this.raise(Errors.NoCatchOrFinally, {
  	        at: node
  	      });
  	    }

  	    return this.finishNode(node, "TryStatement");
  	  }

  	  parseVarStatement(node, kind, allowMissingInitializer = false) {
  	    this.next();
  	    this.parseVar(node, false, kind, allowMissingInitializer);
  	    this.semicolon();
  	    return this.finishNode(node, "VariableDeclaration");
  	  }

  	  parseWhileStatement(node) {
  	    this.next();
  	    node.test = this.parseHeaderExpression();
  	    this.state.labels.push(loopLabel);
  	    node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("while"));
  	    this.state.labels.pop();
  	    return this.finishNode(node, "WhileStatement");
  	  }

  	  parseWithStatement(node) {
  	    if (this.state.strict) {
  	      this.raise(Errors.StrictWith, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    this.next();
  	    node.object = this.parseHeaderExpression();
  	    node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("with"));
  	    return this.finishNode(node, "WithStatement");
  	  }

  	  parseEmptyStatement(node) {
  	    this.next();
  	    return this.finishNode(node, "EmptyStatement");
  	  }

  	  parseLabeledStatement(node, maybeName, expr, context) {
  	    for (const label of this.state.labels) {
  	      if (label.name === maybeName) {
  	        this.raise(Errors.LabelRedeclaration, {
  	          at: expr,
  	          labelName: maybeName
  	        });
  	      }
  	    }

  	    const kind = tokenIsLoop(this.state.type) ? "loop" : this.match(71) ? "switch" : null;

  	    for (let i = this.state.labels.length - 1; i >= 0; i--) {
  	      const label = this.state.labels[i];

  	      if (label.statementStart === node.start) {
  	        label.statementStart = this.state.start;
  	        label.kind = kind;
  	      } else {
  	        break;
  	      }
  	    }

  	    this.state.labels.push({
  	      name: maybeName,
  	      kind: kind,
  	      statementStart: this.state.start
  	    });
  	    node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
  	    this.state.labels.pop();
  	    node.label = expr;
  	    return this.finishNode(node, "LabeledStatement");
  	  }

  	  parseExpressionStatement(node, expr) {
  	    node.expression = expr;
  	    this.semicolon();
  	    return this.finishNode(node, "ExpressionStatement");
  	  }

  	  parseBlock(allowDirectives = false, createNewLexicalScope = true, afterBlockParse) {
  	    const node = this.startNode();

  	    if (allowDirectives) {
  	      this.state.strictErrors.clear();
  	    }

  	    this.expect(5);

  	    if (createNewLexicalScope) {
  	      this.scope.enter(SCOPE_OTHER);
  	    }

  	    this.parseBlockBody(node, allowDirectives, false, 8, afterBlockParse);

  	    if (createNewLexicalScope) {
  	      this.scope.exit();
  	    }

  	    return this.finishNode(node, "BlockStatement");
  	  }

  	  isValidDirective(stmt) {
  	    return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized;
  	  }

  	  parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
  	    const body = node.body = [];
  	    const directives = node.directives = [];
  	    this.parseBlockOrModuleBlockBody(body, allowDirectives ? directives : undefined, topLevel, end, afterBlockParse);
  	  }

  	  parseBlockOrModuleBlockBody(body, directives, topLevel, end, afterBlockParse) {
  	    const oldStrict = this.state.strict;
  	    let hasStrictModeDirective = false;
  	    let parsedNonDirective = false;

  	    while (!this.match(end)) {
  	      const stmt = this.parseStatement(null, topLevel);

  	      if (directives && !parsedNonDirective) {
  	        if (this.isValidDirective(stmt)) {
  	          const directive = this.stmtToDirective(stmt);
  	          directives.push(directive);

  	          if (!hasStrictModeDirective && directive.value.value === "use strict") {
  	            hasStrictModeDirective = true;
  	            this.setStrict(true);
  	          }

  	          continue;
  	        }

  	        parsedNonDirective = true;
  	        this.state.strictErrors.clear();
  	      }

  	      body.push(stmt);
  	    }

  	    if (afterBlockParse) {
  	      afterBlockParse.call(this, hasStrictModeDirective);
  	    }

  	    if (!oldStrict) {
  	      this.setStrict(false);
  	    }

  	    this.next();
  	  }

  	  parseFor(node, init) {
  	    node.init = init;
  	    this.semicolon(false);
  	    node.test = this.match(13) ? null : this.parseExpression();
  	    this.semicolon(false);
  	    node.update = this.match(11) ? null : this.parseExpression();
  	    this.expect(11);
  	    node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("for"));
  	    this.scope.exit();
  	    this.state.labels.pop();
  	    return this.finishNode(node, "ForStatement");
  	  }

  	  parseForIn(node, init, awaitAt) {
  	    const isForIn = this.match(58);
  	    this.next();

  	    if (isForIn) {
  	      if (awaitAt !== null) this.unexpected(awaitAt);
  	    } else {
  	      node.await = awaitAt !== null;
  	    }

  	    if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
  	      this.raise(Errors.ForInOfLoopInitializer, {
  	        at: init,
  	        type: isForIn ? "ForInStatement" : "ForOfStatement"
  	      });
  	    }

  	    if (init.type === "AssignmentPattern") {
  	      this.raise(Errors.InvalidLhs, {
  	        at: init,
  	        ancestor: {
  	          type: "ForStatement"
  	        }
  	      });
  	    }

  	    node.left = init;
  	    node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn();
  	    this.expect(11);
  	    node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("for"));
  	    this.scope.exit();
  	    this.state.labels.pop();
  	    return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
  	  }

  	  parseVar(node, isFor, kind, allowMissingInitializer = false) {
  	    const declarations = node.declarations = [];
  	    node.kind = kind;

  	    for (;;) {
  	      const decl = this.startNode();
  	      this.parseVarId(decl, kind);
  	      decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();

  	      if (decl.init === null && !allowMissingInitializer) {
  	        if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(101)))) {
  	          this.raise(Errors.DeclarationMissingInitializer, {
  	            at: this.state.lastTokEndLoc,
  	            kind: "destructuring"
  	          });
  	        } else if (kind === "const" && !(this.match(58) || this.isContextual(101))) {
  	          this.raise(Errors.DeclarationMissingInitializer, {
  	            at: this.state.lastTokEndLoc,
  	            kind: "const"
  	          });
  	        }
  	      }

  	      declarations.push(this.finishNode(decl, "VariableDeclarator"));
  	      if (!this.eat(12)) break;
  	    }

  	    return node;
  	  }

  	  parseVarId(decl, kind) {
  	    decl.id = this.parseBindingAtom();
  	    this.checkLVal(decl.id, {
  	      in: {
  	        type: "VariableDeclarator"
  	      },
  	      binding: kind === "var" ? BIND_VAR : BIND_LEXICAL
  	    });
  	  }

  	  parseFunction(node, statement = FUNC_NO_FLAGS, isAsync = false) {
  	    const isStatement = statement & FUNC_STATEMENT;
  	    const isHangingStatement = statement & FUNC_HANGING_STATEMENT;
  	    const requireId = !!isStatement && !(statement & FUNC_NULLABLE_ID);
  	    this.initFunction(node, isAsync);

  	    if (this.match(55) && isHangingStatement) {
  	      this.raise(Errors.GeneratorInSingleStatementContext, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    node.generator = this.eat(55);

  	    if (isStatement) {
  	      node.id = this.parseFunctionId(requireId);
  	    }

  	    const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
  	    this.state.maybeInArrowParameters = false;
  	    this.scope.enter(SCOPE_FUNCTION);
  	    this.prodParam.enter(functionFlags(isAsync, node.generator));

  	    if (!isStatement) {
  	      node.id = this.parseFunctionId();
  	    }

  	    this.parseFunctionParams(node, false);
  	    this.withSmartMixTopicForbiddingContext(() => {
  	      this.parseFunctionBodyAndFinish(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
  	    });
  	    this.prodParam.exit();
  	    this.scope.exit();

  	    if (isStatement && !isHangingStatement) {
  	      this.registerFunctionStatementId(node);
  	    }

  	    this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
  	    return node;
  	  }

  	  parseFunctionId(requireId) {
  	    return requireId || tokenIsIdentifier(this.state.type) ? this.parseIdentifier() : null;
  	  }

  	  parseFunctionParams(node, allowModifiers) {
  	    this.expect(10);
  	    this.expressionScope.enter(newParameterDeclarationScope());
  	    node.params = this.parseBindingList(11, 41, false, allowModifiers);
  	    this.expressionScope.exit();
  	  }

  	  registerFunctionStatementId(node) {
  	    if (!node.id) return;
  	    this.scope.declareName(node.id.name, this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION, node.id.loc.start);
  	  }

  	  parseClass(node, isStatement, optionalId) {
  	    this.next();
  	    this.takeDecorators(node);
  	    const oldStrict = this.state.strict;
  	    this.state.strict = true;
  	    this.parseClassId(node, isStatement, optionalId);
  	    this.parseClassSuper(node);
  	    node.body = this.parseClassBody(!!node.superClass, oldStrict);
  	    return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
  	  }

  	  isClassProperty() {
  	    return this.match(29) || this.match(13) || this.match(8);
  	  }

  	  isClassMethod() {
  	    return this.match(10);
  	  }

  	  isNonstaticConstructor(method) {
  	    return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
  	  }

  	  parseClassBody(hadSuperClass, oldStrict) {
  	    this.classScope.enter();
  	    const state = {
  	      hadConstructor: false,
  	      hadSuperClass
  	    };
  	    let decorators = [];
  	    const classBody = this.startNode();
  	    classBody.body = [];
  	    this.expect(5);
  	    this.withSmartMixTopicForbiddingContext(() => {
  	      while (!this.match(8)) {
  	        if (this.eat(13)) {
  	          if (decorators.length > 0) {
  	            throw this.raise(Errors.DecoratorSemicolon, {
  	              at: this.state.lastTokEndLoc
  	            });
  	          }

  	          continue;
  	        }

  	        if (this.match(26)) {
  	          decorators.push(this.parseDecorator());
  	          continue;
  	        }

  	        const member = this.startNode();

  	        if (decorators.length) {
  	          member.decorators = decorators;
  	          this.resetStartLocationFromNode(member, decorators[0]);
  	          decorators = [];
  	        }

  	        this.parseClassMember(classBody, member, state);

  	        if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
  	          this.raise(Errors.DecoratorConstructor, {
  	            at: member
  	          });
  	        }
  	      }
  	    });
  	    this.state.strict = oldStrict;
  	    this.next();

  	    if (decorators.length) {
  	      throw this.raise(Errors.TrailingDecorator, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    this.classScope.exit();
  	    return this.finishNode(classBody, "ClassBody");
  	  }

  	  parseClassMemberFromModifier(classBody, member) {
  	    const key = this.parseIdentifier(true);

  	    if (this.isClassMethod()) {
  	      const method = member;
  	      method.kind = "method";
  	      method.computed = false;
  	      method.key = key;
  	      method.static = false;
  	      this.pushClassMethod(classBody, method, false, false, false, false);
  	      return true;
  	    } else if (this.isClassProperty()) {
  	      const prop = member;
  	      prop.computed = false;
  	      prop.key = key;
  	      prop.static = false;
  	      classBody.body.push(this.parseClassProperty(prop));
  	      return true;
  	    }

  	    this.resetPreviousNodeTrailingComments(key);
  	    return false;
  	  }

  	  parseClassMember(classBody, member, state) {
  	    const isStatic = this.isContextual(104);

  	    if (isStatic) {
  	      if (this.parseClassMemberFromModifier(classBody, member)) {
  	        return;
  	      }

  	      if (this.eat(5)) {
  	        this.parseClassStaticBlock(classBody, member);
  	        return;
  	      }
  	    }

  	    this.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
  	  }

  	  parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
  	    const publicMethod = member;
  	    const privateMethod = member;
  	    const publicProp = member;
  	    const privateProp = member;
  	    const accessorProp = member;
  	    const method = publicMethod;
  	    const publicMember = publicMethod;
  	    member.static = isStatic;
  	    this.parsePropertyNamePrefixOperator(member);

  	    if (this.eat(55)) {
  	      method.kind = "method";
  	      const isPrivateName = this.match(134);
  	      this.parseClassElementName(method);

  	      if (isPrivateName) {
  	        this.pushClassPrivateMethod(classBody, privateMethod, true, false);
  	        return;
  	      }

  	      if (this.isNonstaticConstructor(publicMethod)) {
  	        this.raise(Errors.ConstructorIsGenerator, {
  	          at: publicMethod.key
  	        });
  	      }

  	      this.pushClassMethod(classBody, publicMethod, true, false, false, false);
  	      return;
  	    }

  	    const isContextual = tokenIsIdentifier(this.state.type) && !this.state.containsEsc;
  	    const isPrivate = this.match(134);
  	    const key = this.parseClassElementName(member);
  	    const maybeQuestionTokenStartLoc = this.state.startLoc;
  	    this.parsePostMemberNameModifiers(publicMember);

  	    if (this.isClassMethod()) {
  	      method.kind = "method";

  	      if (isPrivate) {
  	        this.pushClassPrivateMethod(classBody, privateMethod, false, false);
  	        return;
  	      }

  	      const isConstructor = this.isNonstaticConstructor(publicMethod);
  	      let allowsDirectSuper = false;

  	      if (isConstructor) {
  	        publicMethod.kind = "constructor";

  	        if (state.hadConstructor && !this.hasPlugin("typescript")) {
  	          this.raise(Errors.DuplicateConstructor, {
  	            at: key
  	          });
  	        }

  	        if (isConstructor && this.hasPlugin("typescript") && member.override) {
  	          this.raise(Errors.OverrideOnConstructor, {
  	            at: key
  	          });
  	        }

  	        state.hadConstructor = true;
  	        allowsDirectSuper = state.hadSuperClass;
  	      }

  	      this.pushClassMethod(classBody, publicMethod, false, false, isConstructor, allowsDirectSuper);
  	    } else if (this.isClassProperty()) {
  	      if (isPrivate) {
  	        this.pushClassPrivateProperty(classBody, privateProp);
  	      } else {
  	        this.pushClassProperty(classBody, publicProp);
  	      }
  	    } else if (isContextual && key.name === "async" && !this.isLineTerminator()) {
  	      this.resetPreviousNodeTrailingComments(key);
  	      const isGenerator = this.eat(55);

  	      if (publicMember.optional) {
  	        this.unexpected(maybeQuestionTokenStartLoc);
  	      }

  	      method.kind = "method";
  	      const isPrivate = this.match(134);
  	      this.parseClassElementName(method);
  	      this.parsePostMemberNameModifiers(publicMember);

  	      if (isPrivate) {
  	        this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
  	      } else {
  	        if (this.isNonstaticConstructor(publicMethod)) {
  	          this.raise(Errors.ConstructorIsAsync, {
  	            at: publicMethod.key
  	          });
  	        }

  	        this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
  	      }
  	    } else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(55) && this.isLineTerminator())) {
  	      this.resetPreviousNodeTrailingComments(key);
  	      method.kind = key.name;
  	      const isPrivate = this.match(134);
  	      this.parseClassElementName(publicMethod);

  	      if (isPrivate) {
  	        this.pushClassPrivateMethod(classBody, privateMethod, false, false);
  	      } else {
  	        if (this.isNonstaticConstructor(publicMethod)) {
  	          this.raise(Errors.ConstructorIsAccessor, {
  	            at: publicMethod.key
  	          });
  	        }

  	        this.pushClassMethod(classBody, publicMethod, false, false, false, false);
  	      }

  	      this.checkGetterSetterParams(publicMethod);
  	    } else if (isContextual && key.name === "accessor" && !this.isLineTerminator()) {
  	      this.expectPlugin("decoratorAutoAccessors");
  	      this.resetPreviousNodeTrailingComments(key);
  	      const isPrivate = this.match(134);
  	      this.parseClassElementName(publicProp);
  	      this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
  	    } else if (this.isLineTerminator()) {
  	      if (isPrivate) {
  	        this.pushClassPrivateProperty(classBody, privateProp);
  	      } else {
  	        this.pushClassProperty(classBody, publicProp);
  	      }
  	    } else {
  	      this.unexpected();
  	    }
  	  }

  	  parseClassElementName(member) {
  	    const {
  	      type,
  	      value
  	    } = this.state;

  	    if ((type === 128 || type === 129) && member.static && value === "prototype") {
  	      this.raise(Errors.StaticPrototype, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    if (type === 134) {
  	      if (value === "constructor") {
  	        this.raise(Errors.ConstructorClassPrivateField, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      const key = this.parsePrivateName();
  	      member.key = key;
  	      return key;
  	    }

  	    return this.parsePropertyName(member);
  	  }

  	  parseClassStaticBlock(classBody, member) {
  	    var _member$decorators;

  	    this.scope.enter(SCOPE_CLASS | SCOPE_STATIC_BLOCK | SCOPE_SUPER);
  	    const oldLabels = this.state.labels;
  	    this.state.labels = [];
  	    this.prodParam.enter(PARAM);
  	    const body = member.body = [];
  	    this.parseBlockOrModuleBlockBody(body, undefined, false, 8);
  	    this.prodParam.exit();
  	    this.scope.exit();
  	    this.state.labels = oldLabels;
  	    classBody.body.push(this.finishNode(member, "StaticBlock"));

  	    if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
  	      this.raise(Errors.DecoratorStaticBlock, {
  	        at: member
  	      });
  	    }
  	  }

  	  pushClassProperty(classBody, prop) {
  	    if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
  	      this.raise(Errors.ConstructorClassField, {
  	        at: prop.key
  	      });
  	    }

  	    classBody.body.push(this.parseClassProperty(prop));
  	  }

  	  pushClassPrivateProperty(classBody, prop) {
  	    const node = this.parseClassPrivateProperty(prop);
  	    classBody.body.push(node);
  	    this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), CLASS_ELEMENT_OTHER, node.key.loc.start);
  	  }

  	  pushClassAccessorProperty(classBody, prop, isPrivate) {
  	    if (!isPrivate && !prop.computed) {
  	      const key = prop.key;

  	      if (key.name === "constructor" || key.value === "constructor") {
  	        this.raise(Errors.ConstructorClassField, {
  	          at: key
  	        });
  	      }
  	    }

  	    const node = this.parseClassAccessorProperty(prop);
  	    classBody.body.push(node);

  	    if (isPrivate) {
  	      this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), CLASS_ELEMENT_OTHER, node.key.loc.start);
  	    }
  	  }

  	  pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
  	    classBody.body.push(this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true));
  	  }

  	  pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
  	    const node = this.parseMethod(method, isGenerator, isAsync, false, false, "ClassPrivateMethod", true);
  	    classBody.body.push(node);
  	    const kind = node.kind === "get" ? node.static ? CLASS_ELEMENT_STATIC_GETTER : CLASS_ELEMENT_INSTANCE_GETTER : node.kind === "set" ? node.static ? CLASS_ELEMENT_STATIC_SETTER : CLASS_ELEMENT_INSTANCE_SETTER : CLASS_ELEMENT_OTHER;
  	    this.declareClassPrivateMethodInScope(node, kind);
  	  }

  	  declareClassPrivateMethodInScope(node, kind) {
  	    this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.loc.start);
  	  }

  	  parsePostMemberNameModifiers(methodOrProp) {}

  	  parseClassPrivateProperty(node) {
  	    this.parseInitializer(node);
  	    this.semicolon();
  	    return this.finishNode(node, "ClassPrivateProperty");
  	  }

  	  parseClassProperty(node) {
  	    this.parseInitializer(node);
  	    this.semicolon();
  	    return this.finishNode(node, "ClassProperty");
  	  }

  	  parseClassAccessorProperty(node) {
  	    this.parseInitializer(node);
  	    this.semicolon();
  	    return this.finishNode(node, "ClassAccessorProperty");
  	  }

  	  parseInitializer(node) {
  	    this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
  	    this.expressionScope.enter(newExpressionScope());
  	    this.prodParam.enter(PARAM);
  	    node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
  	    this.expressionScope.exit();
  	    this.prodParam.exit();
  	    this.scope.exit();
  	  }

  	  parseClassId(node, isStatement, optionalId, bindingType = BIND_CLASS) {
  	    if (tokenIsIdentifier(this.state.type)) {
  	      node.id = this.parseIdentifier();

  	      if (isStatement) {
  	        this.declareNameFromIdentifier(node.id, bindingType);
  	      }
  	    } else {
  	      if (optionalId || !isStatement) {
  	        node.id = null;
  	      } else {
  	        throw this.raise(Errors.MissingClassName, {
  	          at: this.state.startLoc
  	        });
  	      }
  	    }
  	  }

  	  parseClassSuper(node) {
  	    node.superClass = this.eat(81) ? this.parseExprSubscripts() : null;
  	  }

  	  parseExport(node) {
  	    const hasDefault = this.maybeParseExportDefaultSpecifier(node);
  	    const parseAfterDefault = !hasDefault || this.eat(12);
  	    const hasStar = parseAfterDefault && this.eatExportStar(node);
  	    const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
  	    const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(12));
  	    const isFromRequired = hasDefault || hasStar;

  	    if (hasStar && !hasNamespace) {
  	      if (hasDefault) this.unexpected();
  	      this.parseExportFrom(node, true);
  	      return this.finishNode(node, "ExportAllDeclaration");
  	    }

  	    const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);

  	    if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers || hasNamespace && parseAfterNamespace && !hasSpecifiers) {
  	      throw this.unexpected(null, 5);
  	    }

  	    let hasDeclaration;

  	    if (isFromRequired || hasSpecifiers) {
  	      hasDeclaration = false;
  	      this.parseExportFrom(node, isFromRequired);
  	    } else {
  	      hasDeclaration = this.maybeParseExportDeclaration(node);
  	    }

  	    if (isFromRequired || hasSpecifiers || hasDeclaration) {
  	      this.checkExport(node, true, false, !!node.source);
  	      return this.finishNode(node, "ExportNamedDeclaration");
  	    }

  	    if (this.eat(65)) {
  	      node.declaration = this.parseExportDefaultExpression();
  	      this.checkExport(node, true, true);
  	      return this.finishNode(node, "ExportDefaultDeclaration");
  	    }

  	    throw this.unexpected(null, 5);
  	  }

  	  eatExportStar(node) {
  	    return this.eat(55);
  	  }

  	  maybeParseExportDefaultSpecifier(node) {
  	    if (this.isExportDefaultSpecifier()) {
  	      this.expectPlugin("exportDefaultFrom");
  	      const specifier = this.startNode();
  	      specifier.exported = this.parseIdentifier(true);
  	      node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
  	      return true;
  	    }

  	    return false;
  	  }

  	  maybeParseExportNamespaceSpecifier(node) {
  	    if (this.isContextual(93)) {
  	      if (!node.specifiers) node.specifiers = [];
  	      const specifier = this.startNodeAt(this.state.lastTokStart, this.state.lastTokStartLoc);
  	      this.next();
  	      specifier.exported = this.parseModuleExportName();
  	      node.specifiers.push(this.finishNode(specifier, "ExportNamespaceSpecifier"));
  	      return true;
  	    }

  	    return false;
  	  }

  	  maybeParseExportNamedSpecifiers(node) {
  	    if (this.match(5)) {
  	      if (!node.specifiers) node.specifiers = [];
  	      const isTypeExport = node.exportKind === "type";
  	      node.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
  	      node.source = null;
  	      node.declaration = null;

  	      if (this.hasPlugin("importAssertions")) {
  	        node.assertions = [];
  	      }

  	      return true;
  	    }

  	    return false;
  	  }

  	  maybeParseExportDeclaration(node) {
  	    if (this.shouldParseExportDeclaration()) {
  	      node.specifiers = [];
  	      node.source = null;

  	      if (this.hasPlugin("importAssertions")) {
  	        node.assertions = [];
  	      }

  	      node.declaration = this.parseExportDeclaration(node);
  	      return true;
  	    }

  	    return false;
  	  }

  	  isAsyncFunction() {
  	    if (!this.isContextual(95)) return false;
  	    const next = this.nextTokenStart();
  	    return !lineBreak.test(this.input.slice(this.state.pos, next)) && this.isUnparsedContextual(next, "function");
  	  }

  	  parseExportDefaultExpression() {
  	    const expr = this.startNode();
  	    const isAsync = this.isAsyncFunction();

  	    if (this.match(68) || isAsync) {
  	      this.next();

  	      if (isAsync) {
  	        this.next();
  	      }

  	      return this.parseFunction(expr, FUNC_STATEMENT | FUNC_NULLABLE_ID, isAsync);
  	    }

  	    if (this.match(80)) {
  	      return this.parseClass(expr, true, true);
  	    }

  	    if (this.match(26)) {
  	      if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport")) {
  	        this.raise(Errors.DecoratorBeforeExport, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      this.parseDecorators(false);
  	      return this.parseClass(expr, true, true);
  	    }

  	    if (this.match(75) || this.match(74) || this.isLet()) {
  	      throw this.raise(Errors.UnsupportedDefaultExport, {
  	        at: this.state.startLoc
  	      });
  	    }

  	    const res = this.parseMaybeAssignAllowIn();
  	    this.semicolon();
  	    return res;
  	  }

  	  parseExportDeclaration(node) {
  	    return this.parseStatement(null);
  	  }

  	  isExportDefaultSpecifier() {
  	    const {
  	      type
  	    } = this.state;

  	    if (tokenIsIdentifier(type)) {
  	      if (type === 95 && !this.state.containsEsc || type === 99) {
  	        return false;
  	      }

  	      if ((type === 126 || type === 125) && !this.state.containsEsc) {
  	        const {
  	          type: nextType
  	        } = this.lookahead();

  	        if (tokenIsIdentifier(nextType) && nextType !== 97 || nextType === 5) {
  	          this.expectOnePlugin(["flow", "typescript"]);
  	          return false;
  	        }
  	      }
  	    } else if (!this.match(65)) {
  	      return false;
  	    }

  	    const next = this.nextTokenStart();
  	    const hasFrom = this.isUnparsedContextual(next, "from");

  	    if (this.input.charCodeAt(next) === 44 || tokenIsIdentifier(this.state.type) && hasFrom) {
  	      return true;
  	    }

  	    if (this.match(65) && hasFrom) {
  	      const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
  	      return nextAfterFrom === 34 || nextAfterFrom === 39;
  	    }

  	    return false;
  	  }

  	  parseExportFrom(node, expect) {
  	    if (this.eatContextual(97)) {
  	      node.source = this.parseImportSource();
  	      this.checkExport(node);
  	      const assertions = this.maybeParseImportAssertions();

  	      if (assertions) {
  	        node.assertions = assertions;
  	        this.checkJSONModuleImport(node);
  	      }
  	    } else if (expect) {
  	      this.unexpected();
  	    }

  	    this.semicolon();
  	  }

  	  shouldParseExportDeclaration() {
  	    const {
  	      type
  	    } = this.state;

  	    if (type === 26) {
  	      this.expectOnePlugin(["decorators", "decorators-legacy"]);

  	      if (this.hasPlugin("decorators")) {
  	        if (this.getPluginOption("decorators", "decoratorsBeforeExport")) {
  	          throw this.raise(Errors.DecoratorBeforeExport, {
  	            at: this.state.startLoc
  	          });
  	        }

  	        return true;
  	      }
  	    }

  	    return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
  	  }

  	  checkExport(node, checkNames, isDefault, isFrom) {
  	    if (checkNames) {
  	      if (isDefault) {
  	        this.checkDuplicateExports(node, "default");

  	        if (this.hasPlugin("exportDefaultFrom")) {
  	          var _declaration$extra;

  	          const declaration = node.declaration;

  	          if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
  	            this.raise(Errors.ExportDefaultFromAsIdentifier, {
  	              at: declaration
  	            });
  	          }
  	        }
  	      } else if (node.specifiers && node.specifiers.length) {
  	        for (const specifier of node.specifiers) {
  	          const {
  	            exported
  	          } = specifier;
  	          const exportName = exported.type === "Identifier" ? exported.name : exported.value;
  	          this.checkDuplicateExports(specifier, exportName);

  	          if (!isFrom && specifier.local) {
  	            const {
  	              local
  	            } = specifier;

  	            if (local.type !== "Identifier") {
  	              this.raise(Errors.ExportBindingIsString, {
  	                at: specifier,
  	                localName: local.value,
  	                exportName
  	              });
  	            } else {
  	              this.checkReservedWord(local.name, local.loc.start, true, false);
  	              this.scope.checkLocalExport(local);
  	            }
  	          }
  	        }
  	      } else if (node.declaration) {
  	        if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") {
  	          const id = node.declaration.id;
  	          if (!id) throw new Error("Assertion failure");
  	          this.checkDuplicateExports(node, id.name);
  	        } else if (node.declaration.type === "VariableDeclaration") {
  	          for (const declaration of node.declaration.declarations) {
  	            this.checkDeclaration(declaration.id);
  	          }
  	        }
  	      }
  	    }

  	    const currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];

  	    if (currentContextDecorators.length) {
  	      throw this.raise(Errors.UnsupportedDecoratorExport, {
  	        at: node
  	      });
  	    }
  	  }

  	  checkDeclaration(node) {
  	    if (node.type === "Identifier") {
  	      this.checkDuplicateExports(node, node.name);
  	    } else if (node.type === "ObjectPattern") {
  	      for (const prop of node.properties) {
  	        this.checkDeclaration(prop);
  	      }
  	    } else if (node.type === "ArrayPattern") {
  	      for (const elem of node.elements) {
  	        if (elem) {
  	          this.checkDeclaration(elem);
  	        }
  	      }
  	    } else if (node.type === "ObjectProperty") {
  	      this.checkDeclaration(node.value);
  	    } else if (node.type === "RestElement") {
  	      this.checkDeclaration(node.argument);
  	    } else if (node.type === "AssignmentPattern") {
  	      this.checkDeclaration(node.left);
  	    }
  	  }

  	  checkDuplicateExports(node, exportName) {
  	    if (this.exportedIdentifiers.has(exportName)) {
  	      if (exportName === "default") {
  	        this.raise(Errors.DuplicateDefaultExport, {
  	          at: node
  	        });
  	      } else {
  	        this.raise(Errors.DuplicateExport, {
  	          at: node,
  	          exportName
  	        });
  	      }
  	    }

  	    this.exportedIdentifiers.add(exportName);
  	  }

  	  parseExportSpecifiers(isInTypeExport) {
  	    const nodes = [];
  	    let first = true;
  	    this.expect(5);

  	    while (!this.eat(8)) {
  	      if (first) {
  	        first = false;
  	      } else {
  	        this.expect(12);
  	        if (this.eat(8)) break;
  	      }

  	      const isMaybeTypeOnly = this.isContextual(126);
  	      const isString = this.match(129);
  	      const node = this.startNode();
  	      node.local = this.parseModuleExportName();
  	      nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
  	    }

  	    return nodes;
  	  }

  	  parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
  	    if (this.eatContextual(93)) {
  	      node.exported = this.parseModuleExportName();
  	    } else if (isString) {
  	      node.exported = cloneStringLiteral(node.local);
  	    } else if (!node.exported) {
  	      node.exported = cloneIdentifier(node.local);
  	    }

  	    return this.finishNode(node, "ExportSpecifier");
  	  }

  	  parseModuleExportName() {
  	    if (this.match(129)) {
  	      const result = this.parseStringLiteral(this.state.value);
  	      const surrogate = result.value.match(loneSurrogate);

  	      if (surrogate) {
  	        this.raise(Errors.ModuleExportNameHasLoneSurrogate, {
  	          at: result,
  	          surrogateCharCode: surrogate[0].charCodeAt(0)
  	        });
  	      }

  	      return result;
  	    }

  	    return this.parseIdentifier(true);
  	  }

  	  isJSONModuleImport(node) {
  	    if (node.assertions != null) {
  	      return node.assertions.some(({
  	        key,
  	        value
  	      }) => {
  	        return value.value === "json" && (key.type === "Identifier" ? key.name === "type" : key.value === "type");
  	      });
  	    }

  	    return false;
  	  }

  	  checkJSONModuleImport(node) {
  	    if (this.isJSONModuleImport(node) && node.type !== "ExportAllDeclaration") {
  	      const {
  	        specifiers
  	      } = node;

  	      if (node.specifiers != null) {
  	        const nonDefaultNamedSpecifier = specifiers.find(specifier => {
  	          let imported;

  	          if (specifier.type === "ExportSpecifier") {
  	            imported = specifier.local;
  	          } else if (specifier.type === "ImportSpecifier") {
  	            imported = specifier.imported;
  	          }

  	          if (imported !== undefined) {
  	            return imported.type === "Identifier" ? imported.name !== "default" : imported.value !== "default";
  	          }
  	        });

  	        if (nonDefaultNamedSpecifier !== undefined) {
  	          this.raise(Errors.ImportJSONBindingNotDefault, {
  	            at: nonDefaultNamedSpecifier.loc.start
  	          });
  	        }
  	      }
  	    }
  	  }

  	  parseImport(node) {
  	    node.specifiers = [];

  	    if (!this.match(129)) {
  	      const hasDefault = this.maybeParseDefaultImportSpecifier(node);
  	      const parseNext = !hasDefault || this.eat(12);
  	      const hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
  	      if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
  	      this.expectContextual(97);
  	    }

  	    node.source = this.parseImportSource();
  	    const assertions = this.maybeParseImportAssertions();

  	    if (assertions) {
  	      node.assertions = assertions;
  	    } else {
  	      const attributes = this.maybeParseModuleAttributes();

  	      if (attributes) {
  	        node.attributes = attributes;
  	      }
  	    }

  	    this.checkJSONModuleImport(node);
  	    this.semicolon();
  	    return this.finishNode(node, "ImportDeclaration");
  	  }

  	  parseImportSource() {
  	    if (!this.match(129)) this.unexpected();
  	    return this.parseExprAtom();
  	  }

  	  shouldParseDefaultImport(node) {
  	    return tokenIsIdentifier(this.state.type);
  	  }

  	  parseImportSpecifierLocal(node, specifier, type) {
  	    specifier.local = this.parseIdentifier();
  	    node.specifiers.push(this.finishImportSpecifier(specifier, type));
  	  }

  	  finishImportSpecifier(specifier, type) {
  	    this.checkLVal(specifier.local, {
  	      in: specifier,
  	      binding: BIND_LEXICAL
  	    });
  	    return this.finishNode(specifier, type);
  	  }

  	  parseAssertEntries() {
  	    const attrs = [];
  	    const attrNames = new Set();

  	    do {
  	      if (this.match(8)) {
  	        break;
  	      }

  	      const node = this.startNode();
  	      const keyName = this.state.value;

  	      if (attrNames.has(keyName)) {
  	        this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
  	          at: this.state.startLoc,
  	          key: keyName
  	        });
  	      }

  	      attrNames.add(keyName);

  	      if (this.match(129)) {
  	        node.key = this.parseStringLiteral(keyName);
  	      } else {
  	        node.key = this.parseIdentifier(true);
  	      }

  	      this.expect(14);

  	      if (!this.match(129)) {
  	        throw this.raise(Errors.ModuleAttributeInvalidValue, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      node.value = this.parseStringLiteral(this.state.value);
  	      attrs.push(this.finishNode(node, "ImportAttribute"));
  	    } while (this.eat(12));

  	    return attrs;
  	  }

  	  maybeParseModuleAttributes() {
  	    if (this.match(76) && !this.hasPrecedingLineBreak()) {
  	      this.expectPlugin("moduleAttributes");
  	      this.next();
  	    } else {
  	      if (this.hasPlugin("moduleAttributes")) return [];
  	      return null;
  	    }

  	    const attrs = [];
  	    const attributes = new Set();

  	    do {
  	      const node = this.startNode();
  	      node.key = this.parseIdentifier(true);

  	      if (node.key.name !== "type") {
  	        this.raise(Errors.ModuleAttributeDifferentFromType, {
  	          at: node.key
  	        });
  	      }

  	      if (attributes.has(node.key.name)) {
  	        this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
  	          at: node.key,
  	          key: node.key.name
  	        });
  	      }

  	      attributes.add(node.key.name);
  	      this.expect(14);

  	      if (!this.match(129)) {
  	        throw this.raise(Errors.ModuleAttributeInvalidValue, {
  	          at: this.state.startLoc
  	        });
  	      }

  	      node.value = this.parseStringLiteral(this.state.value);
  	      this.finishNode(node, "ImportAttribute");
  	      attrs.push(node);
  	    } while (this.eat(12));

  	    return attrs;
  	  }

  	  maybeParseImportAssertions() {
  	    if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
  	      this.expectPlugin("importAssertions");
  	      this.next();
  	    } else {
  	      if (this.hasPlugin("importAssertions")) return [];
  	      return null;
  	    }

  	    this.eat(5);
  	    const attrs = this.parseAssertEntries();
  	    this.eat(8);
  	    return attrs;
  	  }

  	  maybeParseDefaultImportSpecifier(node) {
  	    if (this.shouldParseDefaultImport(node)) {
  	      this.parseImportSpecifierLocal(node, this.startNode(), "ImportDefaultSpecifier");
  	      return true;
  	    }

  	    return false;
  	  }

  	  maybeParseStarImportSpecifier(node) {
  	    if (this.match(55)) {
  	      const specifier = this.startNode();
  	      this.next();
  	      this.expectContextual(93);
  	      this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier");
  	      return true;
  	    }

  	    return false;
  	  }

  	  parseNamedImportSpecifiers(node) {
  	    let first = true;
  	    this.expect(5);

  	    while (!this.eat(8)) {
  	      if (first) {
  	        first = false;
  	      } else {
  	        if (this.eat(14)) {
  	          throw this.raise(Errors.DestructureNamedImport, {
  	            at: this.state.startLoc
  	          });
  	        }

  	        this.expect(12);
  	        if (this.eat(8)) break;
  	      }

  	      const specifier = this.startNode();
  	      const importedIsString = this.match(129);
  	      const isMaybeTypeOnly = this.isContextual(126);
  	      specifier.imported = this.parseModuleExportName();
  	      const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly);
  	      node.specifiers.push(importSpecifier);
  	    }
  	  }

  	  parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
  	    if (this.eatContextual(93)) {
  	      specifier.local = this.parseIdentifier();
  	    } else {
  	      const {
  	        imported
  	      } = specifier;

  	      if (importedIsString) {
  	        throw this.raise(Errors.ImportBindingIsString, {
  	          at: specifier,
  	          importName: imported.value
  	        });
  	      }

  	      this.checkReservedWord(imported.name, specifier.loc.start, true, true);

  	      if (!specifier.local) {
  	        specifier.local = cloneIdentifier(imported);
  	      }
  	    }

  	    return this.finishImportSpecifier(specifier, "ImportSpecifier");
  	  }

  	  isThisParam(param) {
  	    return param.type === "Identifier" && param.name === "this";
  	  }

  	}

  	class Parser extends StatementParser {
  	  constructor(options, input) {
  	    options = getOptions(options);
  	    super(options, input);
  	    this.options = options;
  	    this.initializeScopes();
  	    this.plugins = pluginsMap(this.options.plugins);
  	    this.filename = options.sourceFilename;
  	  }

  	  getScopeHandler() {
  	    return ScopeHandler;
  	  }

  	  parse() {
  	    this.enterInitialScopes();
  	    const file = this.startNode();
  	    const program = this.startNode();
  	    this.nextToken();
  	    file.errors = null;
  	    this.parseTopLevel(file, program);
  	    file.errors = this.state.errors;
  	    return file;
  	  }

  	}

  	function pluginsMap(plugins) {
  	  const pluginMap = new Map();

  	  for (const plugin of plugins) {
  	    const [name, options] = Array.isArray(plugin) ? plugin : [plugin, {}];
  	    if (!pluginMap.has(name)) pluginMap.set(name, options || {});
  	  }

  	  return pluginMap;
  	}

  	function parse(input, options) {
  	  var _options;

  	  if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
  	    options = Object.assign({}, options);

  	    try {
  	      options.sourceType = "module";
  	      const parser = getParser(options, input);
  	      const ast = parser.parse();

  	      if (parser.sawUnambiguousESM) {
  	        return ast;
  	      }

  	      if (parser.ambiguousScriptDifferentAst) {
  	        try {
  	          options.sourceType = "script";
  	          return getParser(options, input).parse();
  	        } catch (_unused) {}
  	      } else {
  	        ast.program.sourceType = "script";
  	      }

  	      return ast;
  	    } catch (moduleError) {
  	      try {
  	        options.sourceType = "script";
  	        return getParser(options, input).parse();
  	      } catch (_unused2) {}

  	      throw moduleError;
  	    }
  	  } else {
  	    return getParser(options, input).parse();
  	  }
  	}
  	function parseExpression(input, options) {
  	  const parser = getParser(options, input);

  	  if (parser.options.strictMode) {
  	    parser.state.strict = true;
  	  }

  	  return parser.getExpression();
  	}

  	function generateExportedTokenTypes(internalTokenTypes) {
  	  const tokenTypes = {};

  	  for (const typeName of Object.keys(internalTokenTypes)) {
  	    tokenTypes[typeName] = getExportedToken(internalTokenTypes[typeName]);
  	  }

  	  return tokenTypes;
  	}

  	const tokTypes = generateExportedTokenTypes(tt);

  	function getParser(options, input) {
  	  let cls = Parser;

  	  if (options != null && options.plugins) {
  	    validatePlugins(options.plugins);
  	    cls = getParserClass(options.plugins);
  	  }

  	  return new cls(options, input);
  	}

  	const parserClassCache = {};

  	function getParserClass(pluginsFromOptions) {
  	  const pluginList = mixinPluginNames.filter(name => hasPlugin(pluginsFromOptions, name));
  	  const key = pluginList.join("/");
  	  let cls = parserClassCache[key];

  	  if (!cls) {
  	    cls = Parser;

  	    for (const plugin of pluginList) {
  	      cls = mixinPlugins[plugin](cls);
  	    }

  	    parserClassCache[key] = cls;
  	  }

  	  return cls;
  	}

  	lib.parse = parse;
  	lib.parseExpression = parseExpression;
  	lib.tokTypes = tokTypes;
  	
  	return lib;
  }

  (function (exports) {
  	Object.defineProperty(exports, "__esModule", { value: true });
  	exports.parse = exports.parser = void 0;
  	var tslib_1 = require$$0;
  	var _babel_options_1 = tslib_1.__importDefault(require_babel_options());
  	// Prefer the new @babel/parser package, but fall back to babylon if
  	// that's what's available.
  	exports.parser = function () {
  	    try {
  	        return requireLib();
  	    }
  	    catch (e) {
  	        return require("babylon");
  	    }
  	}();
  	// This module is suitable for passing as options.parser when calling
  	// recast.parse to process JavaScript code with Babel:
  	//
  	//   const ast = recast.parse(source, {
  	//     parser: require("recast/parsers/babel")
  	//   });
  	//
  	function parse(source, options) {
  	    var babelOptions = _babel_options_1.default(options);
  	    babelOptions.plugins.push("jsx", "flow");
  	    return exports.parser.parse(source, babelOptions);
  	}
  	exports.parse = parse;
  } (babel));

  Object.defineProperty(typescript, "__esModule", { value: true });
  var parse_1 = typescript.parse = void 0;
  var tslib_1 = require$$0;
  var babel_1 = babel;
  var _babel_options_1 = tslib_1.__importDefault(require_babel_options());
  // This module is suitable for passing as options.parser when calling
  // recast.parse to process TypeScript code:
  //
  //   const ast = recast.parse(source, {
  //     parser: require("recast/parsers/typescript")
  //   });
  //
  function parse(source, options) {
      var babelOptions = _babel_options_1.default(options);
      babelOptions.plugins.push("typescript");
      return babel_1.parser.parse(source, babelOptions);
  }
  parse_1 = typescript.parse = parse;

  /**
   * Parse a js source to generate the AST
   * @param   {string} source - javascript source
   * @param   {Object} options - parser options
   * @returns {AST} AST tree
   */
  function generateAST(source, options) {
    return main$1.parse(source, {
      parser: {
        parse: (source, opts) => parse_1(source, {
          ...opts,
          ecmaVersion: 'latest'
        })
      },
      ...options
    })
  }

  const scope = builders.identifier(SCOPE);
  const getName = node => node && node.name ? node.name : node;

  /**
   * Replace the path scope with a member Expression
   * @param   { types.NodePath } path - containing the current node visited
   * @param   { types.Node } property - node we want to prefix with the scope identifier
   * @returns {undefined} this is a void function
   */
  function replacePathScope(path, property) {
    path.replace(builders.memberExpression(
      scope,
      property,
      false
    ));
  }

  /**
   * Change the nodes scope adding the `scope` prefix
   * @param   { types.NodePath } path - containing the current node visited
   * @returns { boolean } return false if we want to stop the tree traversal
   * @context { types.visit }
   */
  function updateNodeScope(path) {
    if (!isGlobal(path)) {
      replacePathScope(path, path.node);

      return false
    }

    this.traverse(path);
  }

  /**
   * Change the scope of the member expressions
   * @param   { types.NodePath } path - containing the current node visited
   * @returns { boolean } return always false because we want to check only the first node object
   */
  function visitMemberExpression(path) {
    const traversePathObject = () => this.traverse(path.get('object'));
    const currentObject = path.node.object;

    switch (true) {
    case isGlobal(path):
      if (currentObject.arguments && currentObject.arguments.length) {
        traversePathObject();
      }
      break
    case !path.value.computed && isIdentifier(currentObject):
      replacePathScope(
        path,
        path.node
      );
      break
    default:
      this.traverse(path);
    }

    return false
  }

  /**
   * Objects properties should be handled a bit differently from the Identifier
   * @param   { types.NodePath } path - containing the current node visited
   * @returns { boolean } return false if we want to stop the tree traversal
   */
  function visitObjectProperty(path) {
    const value = path.node.value;
    const isShorthand = path.node.shorthand;

    if (isIdentifier(value) || isMemberExpression(value) || isShorthand) {
      // disable shorthand object properties
      if (isShorthand) path.node.shorthand = false;

      updateNodeScope.call(this, path.get('value'));
    } else {
      this.traverse(path.get('value'));
    }

    return false
  }

  /**
   * The this expressions should be replaced with the scope
   * @param   { types.NodePath } path - containing the current node visited
   * @returns { boolean|undefined } return false if we want to stop the tree traversal
   */
  function visitThisExpression(path) {
    path.replace(scope);
    this.traverse(path);
  }

  /**
   * Replace the identifiers with the node scope
   * @param   { types.NodePath } path - containing the current node visited
   * @returns { boolean|undefined } return false if we want to stop the tree traversal
   */
  function visitIdentifier(path) {
    const parentValue = path.parent.value;

    if (!isMemberExpression(parentValue) || parentValue.computed) {
      updateNodeScope.call(this, path);
    }

    return false
  }

  /**
   * Update the scope of the global nodes
   * @param   { Object } ast - ast program
   * @returns { Object } the ast program with all the global nodes updated
   */
  function updateNodesScope(ast) {
    const ignorePath = () => false;

    types.visit(ast, {
      visitIdentifier,
      visitMemberExpression,
      visitObjectProperty,
      visitThisExpression,
      visitClassExpression: ignorePath
    });

    return ast
  }

  /**
   * Convert any expression to an AST tree
   * @param   { Object } expression - expression parsed by the riot parser
   * @param   { string } sourceFile - original tag file
   * @param   { string } sourceCode - original tag source code
   * @returns { Object } the ast generated
   */
  function createASTFromExpression(expression, sourceFile, sourceCode) {
    const code = sourceFile ?
      addLineOffset(expression.text, sourceCode, expression) :
      expression.text;

    return generateAST(`(${code})`, {
      sourceFileName: sourceFile
    })
  }

  /**
   * Create the bindings template property
   * @param   {Array} args - arguments to pass to the template function
   * @returns {ASTNode} a binding template key
   */
  function createTemplateProperty(args) {
    return simplePropertyNode(
      BINDING_TEMPLATE_KEY,
      args ? callTemplateFunction(...args) : nullNode()
    )
  }

  /**
   * Try to get the expression of an attribute node
   * @param   { RiotParser.Node.Attribute } attribute - riot parser attribute node
   * @returns { RiotParser.Node.Expression } attribute expression value
   */
  function getAttributeExpression(attribute) {
    return attribute.expressions ? attribute.expressions[0] : {
      // if no expression was found try to typecast the attribute value
      ...attribute,
      text: attribute.value
    }
  }

  /**
   * Wrap the ast generated in a function call providing the scope argument
   * @param   {Object} ast - function body
   * @returns {FunctionExpresion} function having the scope argument injected
   */
  function wrapASTInFunctionWithScope(ast) {
    const fn = builders.arrowFunctionExpression([scope], ast);

    // object expressions need to be wrapped in parenthesis
    // recast doesn't allow it
    // see also https://github.com/benjamn/recast/issues/985
    if (isObjectExpression(ast)) {
      // doing a small hack here
      // trying to figure out how the recast printer works internally
      ast.extra = {
        parenthesized: true
      };
    }

    return fn
  }

  /**
   * Convert any parser option to a valid template one
   * @param   { RiotParser.Node.Expression } expression - expression parsed by the riot parser
   * @param   { string } sourceFile - original tag file
   * @param   { string } sourceCode - original tag source code
   * @returns { Object } a FunctionExpression object
   *
   * @example
   *  toScopedFunction('foo + bar') // scope.foo + scope.bar
   *
   * @example
   *  toScopedFunction('foo.baz + bar') // scope.foo.baz + scope.bar
   */
  function toScopedFunction(expression, sourceFile, sourceCode) {
    return compose(
      wrapASTInFunctionWithScope,
      transformExpression
    )(expression, sourceFile, sourceCode)
  }

  /**
   * Transform an expression node updating its global scope
   * @param   {RiotParser.Node.Expr} expression - riot parser expression node
   * @param   {string} sourceFile - source file
   * @param   {string} sourceCode - source code
   * @returns {ASTExpression} ast expression generated from the riot parser expression node
   */
  function transformExpression(expression, sourceFile, sourceCode) {
    return compose(
      getExpressionAST,
      updateNodesScope,
      createASTFromExpression
    )(expression, sourceFile, sourceCode)
  }

  /**
   * Get the parsed AST expression of riot expression node
   * @param   {AST.Program} sourceAST - raw node parsed
   * @returns {AST.Expression} program expression output
   */
  function getExpressionAST(sourceAST) {
    const astBody = sourceAST.program.body;

    return astBody[0] ? astBody[0].expression : astBody
  }

  /**
   * Create the template call function
   * @param   {Array|string|Node.Literal} template - template string
   * @param   {Array<AST.Nodes>} bindings - template bindings provided as AST nodes
   * @returns {Node.CallExpression} template call expression
   */
  function callTemplateFunction(template, bindings) {
    return builders.callExpression(builders.identifier(TEMPLATE_FN), [
      template ? builders.literal(template) : nullNode(),
      bindings ? builders.arrayExpression(bindings) : nullNode()
    ])
  }

  /**
   * Create the template wrapper function injecting the dependencies needed to render the component html
   * @param {Array<AST.Nodes>|AST.BlockStatement} body - function body
   * @returns {AST.Node} arrow function expression
   */
  const createTemplateDependenciesInjectionWrapper = (body) => builders.arrowFunctionExpression(
    [
      TEMPLATE_FN,
      EXPRESSION_TYPES,
      BINDING_TYPES,
      GET_COMPONENT_FN
    ].map(builders.identifier),
    body
  );

  /**
   * Convert any DOM attribute into a valid DOM selector useful for the querySelector API
   * @param   { string } attributeName - name of the attribute to query
   * @returns { string } the attribute transformed to a query selector
   */
  const attributeNameToDOMQuerySelector = attributeName => `[${attributeName}]`;

  /**
   * Create the properties to query a DOM node
   * @param   { string } attributeName - attribute name needed to identify a DOM node
   * @returns { Array<AST.Node> } array containing the selector properties needed for the binding
   */
  function createSelectorProperties(attributeName) {
    return attributeName ? [
      simplePropertyNode(BINDING_REDUNDANT_ATTRIBUTE_KEY, builders.literal(attributeName)),
      simplePropertyNode(BINDING_SELECTOR_KEY,
        compose(builders.literal, attributeNameToDOMQuerySelector)(attributeName)
      )
    ] : []
  }

  /**
   * Clone the node filtering out the selector attribute from the attributes list
   * @param   {RiotParser.Node} node - riot parser node
   * @param   {string} selectorAttribute - name of the selector attribute to filter out
   * @returns {RiotParser.Node} the node with the attribute cleaned up
   */
  function cloneNodeWithoutSelectorAttribute(node, selectorAttribute) {
    return {
      ...node,
      attributes: getAttributesWithoutSelector(getNodeAttributes(node), selectorAttribute)
    }
  }


  /**
   * Get the node attributes without the selector one
   * @param   {Array<RiotParser.Attr>} attributes - attributes list
   * @param   {string} selectorAttribute - name of the selector attribute to filter out
   * @returns {Array<RiotParser.Attr>} filtered attributes
   */
  function getAttributesWithoutSelector(attributes, selectorAttribute) {
    if (selectorAttribute)
      return attributes.filter(attribute => attribute.name !== selectorAttribute)

    return attributes
  }

  /**
   * Clean binding or custom attributes
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {Array<RiotParser.Node.Attr>} only the attributes that are not bindings or directives
   */
  function cleanAttributes(node) {
    return getNodeAttributes(node).filter(attribute => ![
      IF_DIRECTIVE,
      EACH_DIRECTIVE,
      KEY_ATTRIBUTE,
      SLOT_ATTRIBUTE,
      IS_DIRECTIVE
    ].includes(attribute.name))
  }

  /**
   * Root node factory function needed for the top root nodes and the nested ones
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {RiotParser.Node} root node
   */
  function rootNodeFactory(node) {
    return {
      nodes: getChildrenNodes(node),
      isRoot: true
    }
  }

  /**
   * Create a root node proxing only its nodes and attributes
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {RiotParser.Node} root node
   */
  function createRootNode(node) {
    return {
      ...rootNodeFactory(node),
      attributes: compose(
        // root nodes should always have attribute expressions
        transformStatiAttributesIntoExpressions,
        // root nodes shouldn't have directives
        cleanAttributes
      )(node)
    }
  }

  /**
   * Create nested root node. Each and If directives create nested root nodes for example
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {RiotParser.Node} root node
   */
  function createNestedRootNode(node) {
    return {
      ...rootNodeFactory(node),
      attributes: cleanAttributes(node)
    }
  }

  /**
   * Transform the static node attributes into expressions, useful for the root nodes
   * @param   {Array<RiotParser.Node.Attr>} attributes - riot parser node
   * @returns {Array<RiotParser.Node.Attr>} all the attributes received as attribute expressions
   */
  function transformStatiAttributesIntoExpressions(attributes) {
    return attributes.map(attribute => {
      if (attribute.expressions) return attribute

      return {
        ...attribute,
        expressions: [{
          start: attribute.valueStart,
          end: attribute.end,
          text: `'${attribute.value || attribute.name}'`
        }]
      }
    })
  }

  /**
   * Get all the child nodes of a RiotParser.Node
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {Array<RiotParser.Node>} all the child nodes found
   */
  function getChildrenNodes(node) {
    return node && node.nodes ? node.nodes : []
  }

  /**
   * Get all the attributes of a riot parser node
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {Array<RiotParser.Node.Attribute>} all the attributes find
   */
  function getNodeAttributes(node) {
    return node.attributes ? node.attributes : []
  }

  /**
   * Create custom tag name function
   * @param   {RiotParser.Node} node - riot parser node
   * @param   {string} sourceFile - original tag file
   * @param   {string} sourceCode - original tag source code
   * @returns {RiotParser.Node.Attr} the node name as expression attribute
   */
  function createCustomNodeNameEvaluationFunction(node, sourceFile, sourceCode) {
    const isAttribute = findIsAttribute(node);
    const toRawString = val => `'${val}'`;

    if (isAttribute) {
      return isAttribute.expressions ? wrapASTInFunctionWithScope(
        mergeAttributeExpressions(isAttribute, sourceFile, sourceCode)
      ) :
        toScopedFunction({
          ...isAttribute,
          text: toRawString(isAttribute.value)
        }, sourceFile, sourceCode)
    }

    return toScopedFunction({ ...node, text: toRawString(getName(node)) }, sourceFile, sourceCode)
  }

  /**
   * Convert all the node static attributes to strings
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {string} all the node static concatenated as string
   */
  function staticAttributesToString(node) {
    return findStaticAttributes(node)
      .map(attribute => attribute[IS_BOOLEAN_ATTRIBUTE] || !attribute.value ?
        attribute.name :
        `${attribute.name}="${unescapeNode(attribute, 'value').value}"`
      ).join(' ')
  }

  /**
   * Make sure that node escaped chars will be unescaped
   * @param   {RiotParser.Node} node - riot parser node
   * @param   {string} key - key property to unescape
   * @returns {RiotParser.Node} node with the text property unescaped
   */
  function unescapeNode(node, key) {
    if (node.unescape) {
      return {
        ...node,
        [key]: unescapeChar(node[key], node.unescape)
      }
    }

    return node
  }

  /**
   * Convert a riot parser opening node into a string
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {string} the node as string
   */
  function nodeToString(node) {
    const attributes = staticAttributesToString(node);

    switch (true) {
    case isTagNode(node):
      return `<${node.name}${attributes ? ` ${attributes}` : ''}${isVoidNode(node) ? '/' : ''}>`
    case isTextNode(node):
      return hasExpressions(node) ? TEXT_NODE_EXPRESSION_PLACEHOLDER : unescapeNode(node, 'text').text
    default:
      return node.text || ''
    }
  }

  /**
   * Close an html node
   * @param   {RiotParser.Node} node - riot parser node
   * @returns {string} the closing tag of the html tag node passed to this function
   */
  function closeTag(node) {
    return node.name ? `</${node.name}>` : ''
  }

  /**
   * Create a strings array with the `join` call to transform it into a string
   * @param   {Array} stringsArray - array containing all the strings to concatenate
   * @returns {AST.CallExpression} array with a `join` call
   */
  function createArrayString(stringsArray) {
    return builders.callExpression(
      builders.memberExpression(
        builders.arrayExpression(stringsArray),
        builders.identifier('join'),
        false
      ),
      [builders.literal('')]
    )
  }

  /**
   * Simple expression bindings might contain multiple expressions like for example: "class="{foo} red {bar}""
   * This helper aims to merge them in a template literal if it's necessary
   * @param   {RiotParser.Attr} node - riot parser node
   * @param   {string} sourceFile - original tag file
   * @param   {string} sourceCode - original tag source code
   * @returns { Object } a template literal expression object
   */
  function mergeAttributeExpressions(node, sourceFile, sourceCode) {
    if (!node.parts || node.parts.length === 1) {
      return transformExpression(node.expressions[0], sourceFile, sourceCode)
    }
    const stringsArray = [
      ...node.parts.reduce((acc, str) => {
        const expression = node.expressions.find(e => e.text.trim() === str);

        return [
          ...acc,
          expression ?
            transformExpression(expression, sourceFile, sourceCode) :
            builders.literal(encodeHTMLEntities(str))
        ]
      }, [])
    ].filter(expr => !isLiteral(expr) || expr.value);


    return createArrayString(stringsArray)
  }

  /**
   * Create a selector that will be used to find the node via dom-bindings
   * @param   {number} id - temporary variable that will be increased anytime this function will be called
   * @returns {string} selector attribute needed to bind a riot expression
   */
  const createBindingSelector = (function createSelector(id = 0) {
    return () => `${BINDING_SELECTOR_PREFIX}${id++}`
  }());

  /**
   * Create the AST array containing the attributes to bind to this node
   * @param   { RiotParser.Node.Tag } sourceNode - the custom tag
   * @param   { string } selectorAttribute - attribute needed to select the target node
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @returns {AST.ArrayExpression} array containing the slot objects
   */
  function createBindingAttributes(sourceNode, selectorAttribute, sourceFile, sourceCode) {
    return builders.arrayExpression([
      ...compose(
        attributes => attributes.map(attribute => createExpression(attribute, sourceFile, sourceCode, 0, sourceNode)),
        attributes => attributes.filter(hasExpressions),
        attributes => getAttributesWithoutSelector(attributes, selectorAttribute),
        cleanAttributes
      )(sourceNode)
    ])
  }

  /**
   * Create an attribute evaluation function
   * @param   {RiotParser.Attr} sourceNode - riot parser node
   * @param   {string} sourceFile - original tag file
   * @param   {string} sourceCode - original tag source code
   * @returns { AST.Node } an AST function expression to evaluate the attribute value
   */
  function createAttributeEvaluationFunction(sourceNode, sourceFile, sourceCode) {
    return hasExpressions(sourceNode) ?
      // dynamic attribute
      wrapASTInFunctionWithScope(mergeAttributeExpressions(sourceNode, sourceFile, sourceCode)) :
      // static attribute
      builders.arrowFunctionExpression(
        [],
        builders.literal(sourceNode.value || true)
      )
  }

  /**
   * Return a source map as JSON, it it has not the toJSON method it means it can
   * be used right the way
   * @param   { SourceMapGenerator|Object } map - a sourcemap generator or simply an json object
   * @returns { Object } the source map as JSON
   */
  function sourcemapAsJSON(map) {
    if (map && map.toJSON) return map.toJSON()
    return map
  }

  /**
   * Compose two sourcemaps
   * @param   { SourceMapGenerator } formerMap - original sourcemap
   * @param   { SourceMapGenerator } latterMap - target sourcemap
   * @returns { Object } sourcemap json
   */
  function composeSourcemaps(formerMap, latterMap) {
    if (
      isNode() &&
      formerMap && latterMap && latterMap.mappings
    ) {
      return composeSourceMaps_1(sourcemapAsJSON(formerMap), sourcemapAsJSON(latterMap))
    } else if (isNode() && formerMap) {
      return sourcemapAsJSON(formerMap)
    }

    return {}
  }

  var sourceMapGenerator = {};

  var base64Vlq = {};

  var base64$1 = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  /*
   * Copyright 2011 Mozilla Foundation and contributors
   * Licensed under the New BSD license. See LICENSE or:
   * http://opensource.org/licenses/BSD-3-Clause
   */

  const intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");

  /**
   * Encode an integer in the range of 0 to 63 to a single base 64 digit.
   */
  base64$1.encode = function(number) {
    if (0 <= number && number < intToCharMap.length) {
      return intToCharMap[number];
    }
    throw new TypeError("Must be between 0 and 63: " + number);
  };

  /* -*- Mode: js; js-indent-level: 2; -*- */

  /*
   * Copyright 2011 Mozilla Foundation and contributors
   * Licensed under the New BSD license. See LICENSE or:
   * http://opensource.org/licenses/BSD-3-Clause
   *
   * Based on the Base 64 VLQ implementation in Closure Compiler:
   * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
   *
   * Copyright 2011 The Closure Compiler Authors. All rights reserved.
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions are
   * met:
   *
   *  * Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *  * Redistributions in binary form must reproduce the above
   *    copyright notice, this list of conditions and the following
   *    disclaimer in the documentation and/or other materials provided
   *    with the distribution.
   *  * Neither the name of Google Inc. nor the names of its
   *    contributors may be used to endorse or promote products derived
   *    from this software without specific prior written permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   */

  const base64 = base64$1;

  // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  // length quantities we use in the source map spec, the first bit is the sign,
  // the next four bits are the actual value, and the 6th bit is the
  // continuation bit. The continuation bit tells us whether there are more
  // digits in this value following this digit.
  //
  //   Continuation
  //   |    Sign
  //   |    |
  //   V    V
  //   101011

  const VLQ_BASE_SHIFT = 5;

  // binary: 100000
  const VLQ_BASE = 1 << VLQ_BASE_SHIFT;

  // binary: 011111
  const VLQ_BASE_MASK = VLQ_BASE - 1;

  // binary: 100000
  const VLQ_CONTINUATION_BIT = VLQ_BASE;

  /**
   * Converts from a two-complement value to a value where the sign bit is
   * placed in the least significant bit.  For example, as decimals:
   *   1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
   *   2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
   */
  function toVLQSigned(aValue) {
    return aValue < 0
      ? ((-aValue) << 1) + 1
      : (aValue << 1) + 0;
  }

  /**
   * Returns the base 64 VLQ encoded value.
   */
  base64Vlq.encode = function base64VLQ_encode(aValue) {
    let encoded = "";
    let digit;

    let vlq = toVLQSigned(aValue);

    do {
      digit = vlq & VLQ_BASE_MASK;
      vlq >>>= VLQ_BASE_SHIFT;
      if (vlq > 0) {
        // There are still more digits in this value, so we must make sure the
        // continuation bit is marked.
        digit |= VLQ_CONTINUATION_BIT;
      }
      encoded += base64.encode(digit);
    } while (vlq > 0);

    return encoded;
  };

  var util$3 = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  (function (exports) {
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	/**
  	 * This is a helper function for getting values from parameter/options
  	 * objects.
  	 *
  	 * @param args The object we are extracting values from
  	 * @param name The name of the property we are getting.
  	 * @param defaultValue An optional value to return if the property is missing
  	 * from the object. If this is not specified and the property is missing, an
  	 * error will be thrown.
  	 */
  	function getArg(aArgs, aName, aDefaultValue) {
  	  if (aName in aArgs) {
  	    return aArgs[aName];
  	  } else if (arguments.length === 3) {
  	    return aDefaultValue;
  	  }
  	    throw new Error('"' + aName + '" is a required argument.');

  	}
  	exports.getArg = getArg;

  	const urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  	const dataUrlRegexp = /^data:.+\,.+$/;

  	function urlParse(aUrl) {
  	  const match = aUrl.match(urlRegexp);
  	  if (!match) {
  	    return null;
  	  }
  	  return {
  	    scheme: match[1],
  	    auth: match[2],
  	    host: match[3],
  	    port: match[4],
  	    path: match[5]
  	  };
  	}
  	exports.urlParse = urlParse;

  	function urlGenerate(aParsedUrl) {
  	  let url = "";
  	  if (aParsedUrl.scheme) {
  	    url += aParsedUrl.scheme + ":";
  	  }
  	  url += "//";
  	  if (aParsedUrl.auth) {
  	    url += aParsedUrl.auth + "@";
  	  }
  	  if (aParsedUrl.host) {
  	    url += aParsedUrl.host;
  	  }
  	  if (aParsedUrl.port) {
  	    url += ":" + aParsedUrl.port;
  	  }
  	  if (aParsedUrl.path) {
  	    url += aParsedUrl.path;
  	  }
  	  return url;
  	}
  	exports.urlGenerate = urlGenerate;

  	const MAX_CACHED_INPUTS = 32;

  	/**
  	 * Takes some function `f(input) -> result` and returns a memoized version of
  	 * `f`.
  	 *
  	 * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The
  	 * memoization is a dumb-simple, linear least-recently-used cache.
  	 */
  	function lruMemoize(f) {
  	  const cache = [];

  	  return function(input) {
  	    for (let i = 0; i < cache.length; i++) {
  	      if (cache[i].input === input) {
  	        const temp = cache[0];
  	        cache[0] = cache[i];
  	        cache[i] = temp;
  	        return cache[0].result;
  	      }
  	    }

  	    const result = f(input);

  	    cache.unshift({
  	      input,
  	      result,
  	    });

  	    if (cache.length > MAX_CACHED_INPUTS) {
  	      cache.pop();
  	    }

  	    return result;
  	  };
  	}

  	/**
  	 * Normalizes a path, or the path portion of a URL:
  	 *
  	 * - Replaces consecutive slashes with one slash.
  	 * - Removes unnecessary '.' parts.
  	 * - Removes unnecessary '<dir>/..' parts.
  	 *
  	 * Based on code in the Node.js 'path' core module.
  	 *
  	 * @param aPath The path or url to normalize.
  	 */
  	const normalize = lruMemoize(function normalize(aPath) {
  	  let path = aPath;
  	  const url = urlParse(aPath);
  	  if (url) {
  	    if (!url.path) {
  	      return aPath;
  	    }
  	    path = url.path;
  	  }
  	  const isAbsolute = exports.isAbsolute(path);

  	  // Split the path into parts between `/` characters. This is much faster than
  	  // using `.split(/\/+/g)`.
  	  const parts = [];
  	  let start = 0;
  	  let i = 0;
  	  while (true) {
  	    start = i;
  	    i = path.indexOf("/", start);
  	    if (i === -1) {
  	      parts.push(path.slice(start));
  	      break;
  	    } else {
  	      parts.push(path.slice(start, i));
  	      while (i < path.length && path[i] === "/") {
  	        i++;
  	      }
  	    }
  	  }

  	  let up = 0;
  	  for (i = parts.length - 1; i >= 0; i--) {
  	    const part = parts[i];
  	    if (part === ".") {
  	      parts.splice(i, 1);
  	    } else if (part === "..") {
  	      up++;
  	    } else if (up > 0) {
  	      if (part === "") {
  	        // The first part is blank if the path is absolute. Trying to go
  	        // above the root is a no-op. Therefore we can remove all '..' parts
  	        // directly after the root.
  	        parts.splice(i + 1, up);
  	        up = 0;
  	      } else {
  	        parts.splice(i, 2);
  	        up--;
  	      }
  	    }
  	  }
  	  path = parts.join("/");

  	  if (path === "") {
  	    path = isAbsolute ? "/" : ".";
  	  }

  	  if (url) {
  	    url.path = path;
  	    return urlGenerate(url);
  	  }
  	  return path;
  	});
  	exports.normalize = normalize;

  	/**
  	 * Joins two paths/URLs.
  	 *
  	 * @param aRoot The root path or URL.
  	 * @param aPath The path or URL to be joined with the root.
  	 *
  	 * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  	 *   scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  	 *   first.
  	 * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  	 *   is updated with the result and aRoot is returned. Otherwise the result
  	 *   is returned.
  	 *   - If aPath is absolute, the result is aPath.
  	 *   - Otherwise the two paths are joined with a slash.
  	 * - Joining for example 'http://' and 'www.example.com' is also supported.
  	 */
  	function join(aRoot, aPath) {
  	  if (aRoot === "") {
  	    aRoot = ".";
  	  }
  	  if (aPath === "") {
  	    aPath = ".";
  	  }
  	  const aPathUrl = urlParse(aPath);
  	  const aRootUrl = urlParse(aRoot);
  	  if (aRootUrl) {
  	    aRoot = aRootUrl.path || "/";
  	  }

  	  // `join(foo, '//www.example.org')`
  	  if (aPathUrl && !aPathUrl.scheme) {
  	    if (aRootUrl) {
  	      aPathUrl.scheme = aRootUrl.scheme;
  	    }
  	    return urlGenerate(aPathUrl);
  	  }

  	  if (aPathUrl || aPath.match(dataUrlRegexp)) {
  	    return aPath;
  	  }

  	  // `join('http://', 'www.example.com')`
  	  if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  	    aRootUrl.host = aPath;
  	    return urlGenerate(aRootUrl);
  	  }

  	  const joined = aPath.charAt(0) === "/"
  	    ? aPath
  	    : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath);

  	  if (aRootUrl) {
  	    aRootUrl.path = joined;
  	    return urlGenerate(aRootUrl);
  	  }
  	  return joined;
  	}
  	exports.join = join;

  	exports.isAbsolute = function(aPath) {
  	  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
  	};

  	/**
  	 * Make a path relative to a URL or another path.
  	 *
  	 * @param aRoot The root path or URL.
  	 * @param aPath The path or URL to be made relative to aRoot.
  	 */
  	function relative(aRoot, aPath) {
  	  if (aRoot === "") {
  	    aRoot = ".";
  	  }

  	  aRoot = aRoot.replace(/\/$/, "");

  	  // It is possible for the path to be above the root. In this case, simply
  	  // checking whether the root is a prefix of the path won't work. Instead, we
  	  // need to remove components from the root one by one, until either we find
  	  // a prefix that fits, or we run out of components to remove.
  	  let level = 0;
  	  while (aPath.indexOf(aRoot + "/") !== 0) {
  	    const index = aRoot.lastIndexOf("/");
  	    if (index < 0) {
  	      return aPath;
  	    }

  	    // If the only part of the root that is left is the scheme (i.e. http://,
  	    // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  	    // have exhausted all components, so the path is not relative to the root.
  	    aRoot = aRoot.slice(0, index);
  	    if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  	      return aPath;
  	    }

  	    ++level;
  	  }

  	  // Make sure we add a "../" for each component we removed from the root.
  	  return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  	}
  	exports.relative = relative;

  	const supportsNullProto = (function() {
  	  const obj = Object.create(null);
  	  return !("__proto__" in obj);
  	}());

  	function identity(s) {
  	  return s;
  	}

  	/**
  	 * Because behavior goes wacky when you set `__proto__` on objects, we
  	 * have to prefix all the strings in our set with an arbitrary character.
  	 *
  	 * See https://github.com/mozilla/source-map/pull/31 and
  	 * https://github.com/mozilla/source-map/issues/30
  	 *
  	 * @param String aStr
  	 */
  	function toSetString(aStr) {
  	  if (isProtoString(aStr)) {
  	    return "$" + aStr;
  	  }

  	  return aStr;
  	}
  	exports.toSetString = supportsNullProto ? identity : toSetString;

  	function fromSetString(aStr) {
  	  if (isProtoString(aStr)) {
  	    return aStr.slice(1);
  	  }

  	  return aStr;
  	}
  	exports.fromSetString = supportsNullProto ? identity : fromSetString;

  	function isProtoString(s) {
  	  if (!s) {
  	    return false;
  	  }

  	  const length = s.length;

  	  if (length < 9 /* "__proto__".length */) {
  	    return false;
  	  }

  	  /* eslint-disable no-multi-spaces */
  	  if (s.charCodeAt(length - 1) !== 95  /* '_' */ ||
  	      s.charCodeAt(length - 2) !== 95  /* '_' */ ||
  	      s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  	      s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  	      s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  	      s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  	      s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  	      s.charCodeAt(length - 8) !== 95  /* '_' */ ||
  	      s.charCodeAt(length - 9) !== 95  /* '_' */) {
  	    return false;
  	  }
  	  /* eslint-enable no-multi-spaces */

  	  for (let i = length - 10; i >= 0; i--) {
  	    if (s.charCodeAt(i) !== 36 /* '$' */) {
  	      return false;
  	    }
  	  }

  	  return true;
  	}

  	/**
  	 * Comparator between two mappings where the original positions are compared.
  	 *
  	 * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  	 * mappings with the same original source/line/column, but different generated
  	 * line and column the same. Useful when searching for a mapping with a
  	 * stubbed out mapping.
  	 */
  	function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  	  let cmp = strcmp(mappingA.source, mappingB.source);
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.originalLine - mappingB.originalLine;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.originalColumn - mappingB.originalColumn;
  	  if (cmp !== 0 || onlyCompareOriginal) {
  	    return cmp;
  	  }

  	  cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.generatedLine - mappingB.generatedLine;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  return strcmp(mappingA.name, mappingB.name);
  	}
  	exports.compareByOriginalPositions = compareByOriginalPositions;

  	/**
  	 * Comparator between two mappings with deflated source and name indices where
  	 * the generated positions are compared.
  	 *
  	 * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  	 * mappings with the same generated line and column, but different
  	 * source/name/original line and column the same. Useful when searching for a
  	 * mapping with a stubbed out mapping.
  	 */
  	function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  	  let cmp = mappingA.generatedLine - mappingB.generatedLine;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  	  if (cmp !== 0 || onlyCompareGenerated) {
  	    return cmp;
  	  }

  	  cmp = strcmp(mappingA.source, mappingB.source);
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.originalLine - mappingB.originalLine;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.originalColumn - mappingB.originalColumn;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  return strcmp(mappingA.name, mappingB.name);
  	}
  	exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;

  	function strcmp(aStr1, aStr2) {
  	  if (aStr1 === aStr2) {
  	    return 0;
  	  }

  	  if (aStr1 === null) {
  	    return 1; // aStr2 !== null
  	  }

  	  if (aStr2 === null) {
  	    return -1; // aStr1 !== null
  	  }

  	  if (aStr1 > aStr2) {
  	    return 1;
  	  }

  	  return -1;
  	}

  	/**
  	 * Comparator between two mappings with inflated source and name strings where
  	 * the generated positions are compared.
  	 */
  	function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  	  let cmp = mappingA.generatedLine - mappingB.generatedLine;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = strcmp(mappingA.source, mappingB.source);
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.originalLine - mappingB.originalLine;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  cmp = mappingA.originalColumn - mappingB.originalColumn;
  	  if (cmp !== 0) {
  	    return cmp;
  	  }

  	  return strcmp(mappingA.name, mappingB.name);
  	}
  	exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;

  	/**
  	 * Strip any JSON XSSI avoidance prefix from the string (as documented
  	 * in the source maps specification), and then parse the string as
  	 * JSON.
  	 */
  	function parseSourceMapInput(str) {
  	  return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
  	}
  	exports.parseSourceMapInput = parseSourceMapInput;

  	/**
  	 * Compute the URL of a source given the the source root, the source's
  	 * URL, and the source map's URL.
  	 */
  	function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  	  sourceURL = sourceURL || "";

  	  if (sourceRoot) {
  	    // This follows what Chrome does.
  	    if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") {
  	      sourceRoot += "/";
  	    }
  	    // The spec says:
  	    //   Line 4: An optional source root, useful for relocating source
  	    //   files on a server or removing repeated values in the
  	    //   “sources” entry.  This value is prepended to the individual
  	    //   entries in the “source” field.
  	    sourceURL = sourceRoot + sourceURL;
  	  }

  	  // Historically, SourceMapConsumer did not take the sourceMapURL as
  	  // a parameter.  This mode is still somewhat supported, which is why
  	  // this code block is conditional.  However, it's preferable to pass
  	  // the source map URL to SourceMapConsumer, so that this function
  	  // can implement the source URL resolution algorithm as outlined in
  	  // the spec.  This block is basically the equivalent of:
  	  //    new URL(sourceURL, sourceMapURL).toString()
  	  // ... except it avoids using URL, which wasn't available in the
  	  // older releases of node still supported by this library.
  	  //
  	  // The spec says:
  	  //   If the sources are not absolute URLs after prepending of the
  	  //   “sourceRoot”, the sources are resolved relative to the
  	  //   SourceMap (like resolving script src in a html document).
  	  if (sourceMapURL) {
  	    const parsed = urlParse(sourceMapURL);
  	    if (!parsed) {
  	      throw new Error("sourceMapURL could not be parsed");
  	    }
  	    if (parsed.path) {
  	      // Strip the last path component, but keep the "/".
  	      const index = parsed.path.lastIndexOf("/");
  	      if (index >= 0) {
  	        parsed.path = parsed.path.substring(0, index + 1);
  	      }
  	    }
  	    sourceURL = join(urlGenerate(parsed), sourceURL);
  	  }

  	  return normalize(sourceURL);
  	}
  	exports.computeSourceURL = computeSourceURL;
  } (util$3));

  var arraySet = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  /*
   * Copyright 2011 Mozilla Foundation and contributors
   * Licensed under the New BSD license. See LICENSE or:
   * http://opensource.org/licenses/BSD-3-Clause
   */

  /**
   * A data structure which is a combination of an array and a set. Adding a new
   * member is O(1), testing for membership is O(1), and finding the index of an
   * element is O(1). Removing elements from the set is not supported. Only
   * strings are supported for membership.
   */
  class ArraySet$2 {
    constructor() {
      this._array = [];
      this._set = new Map();
    }

    /**
     * Static method for creating ArraySet instances from an existing array.
     */
    static fromArray(aArray, aAllowDuplicates) {
      const set = new ArraySet$2();
      for (let i = 0, len = aArray.length; i < len; i++) {
        set.add(aArray[i], aAllowDuplicates);
      }
      return set;
    }

    /**
     * Return how many unique items are in this ArraySet. If duplicates have been
     * added, than those do not count towards the size.
     *
     * @returns Number
     */
    size() {
      return this._set.size;
    }

    /**
     * Add the given string to this set.
     *
     * @param String aStr
     */
    add(aStr, aAllowDuplicates) {
      const isDuplicate = this.has(aStr);
      const idx = this._array.length;
      if (!isDuplicate || aAllowDuplicates) {
        this._array.push(aStr);
      }
      if (!isDuplicate) {
        this._set.set(aStr, idx);
      }
    }

    /**
     * Is the given string a member of this set?
     *
     * @param String aStr
     */
    has(aStr) {
        return this._set.has(aStr);
    }

    /**
     * What is the index of the given string in the array?
     *
     * @param String aStr
     */
    indexOf(aStr) {
      const idx = this._set.get(aStr);
      if (idx >= 0) {
          return idx;
      }
      throw new Error('"' + aStr + '" is not in the set.');
    }

    /**
     * What is the element at the given index?
     *
     * @param Number aIdx
     */
    at(aIdx) {
      if (aIdx >= 0 && aIdx < this._array.length) {
        return this._array[aIdx];
      }
      throw new Error("No element indexed by " + aIdx);
    }

    /**
     * Returns the array representation of this set (which has the proper indices
     * indicated by indexOf). Note that this is a copy of the internal array used
     * for storing the members so that no one can mess with internal state.
     */
    toArray() {
      return this._array.slice();
    }
  }
  arraySet.ArraySet = ArraySet$2;

  var mappingList = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  /*
   * Copyright 2014 Mozilla Foundation and contributors
   * Licensed under the New BSD license. See LICENSE or:
   * http://opensource.org/licenses/BSD-3-Clause
   */

  const util$2 = util$3;

  /**
   * Determine whether mappingB is after mappingA with respect to generated
   * position.
   */
  function generatedPositionAfter(mappingA, mappingB) {
    // Optimized for most common case
    const lineA = mappingA.generatedLine;
    const lineB = mappingB.generatedLine;
    const columnA = mappingA.generatedColumn;
    const columnB = mappingB.generatedColumn;
    return lineB > lineA || lineB == lineA && columnB >= columnA ||
           util$2.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  }

  /**
   * A data structure to provide a sorted view of accumulated mappings in a
   * performance conscious manner. It trades a negligible overhead in general
   * case for a large speedup in case of mappings being added in order.
   */
  class MappingList$1 {
    constructor() {
      this._array = [];
      this._sorted = true;
      // Serves as infimum
      this._last = {generatedLine: -1, generatedColumn: 0};
    }

    /**
     * Iterate through internal items. This method takes the same arguments that
     * `Array.prototype.forEach` takes.
     *
     * NOTE: The order of the mappings is NOT guaranteed.
     */
    unsortedForEach(aCallback, aThisArg) {
      this._array.forEach(aCallback, aThisArg);
    }

    /**
     * Add the given source mapping.
     *
     * @param Object aMapping
     */
    add(aMapping) {
      if (generatedPositionAfter(this._last, aMapping)) {
        this._last = aMapping;
        this._array.push(aMapping);
      } else {
        this._sorted = false;
        this._array.push(aMapping);
      }
    }

    /**
     * Returns the flat, sorted array of mappings. The mappings are sorted by
     * generated position.
     *
     * WARNING: This method returns internal data without copying, for
     * performance. The return value must NOT be mutated, and should be treated as
     * an immutable borrow. If you want to take ownership, you must make your own
     * copy.
     */
    toArray() {
      if (!this._sorted) {
        this._array.sort(util$2.compareByGeneratedPositionsInflated);
        this._sorted = true;
      }
      return this._array;
    }
  }

  mappingList.MappingList = MappingList$1;

  /* -*- Mode: js; js-indent-level: 2; -*- */

  /*
   * Copyright 2011 Mozilla Foundation and contributors
   * Licensed under the New BSD license. See LICENSE or:
   * http://opensource.org/licenses/BSD-3-Clause
   */

  const base64VLQ = base64Vlq;
  const util$1 = util$3;
  const ArraySet$1 = arraySet.ArraySet;
  const MappingList = mappingList.MappingList;

  /**
   * An instance of the SourceMapGenerator represents a source map which is
   * being built incrementally. You may pass an object with the following
   * properties:
   *
   *   - file: The filename of the generated source.
   *   - sourceRoot: A root for all relative URLs in this source map.
   */
  class SourceMapGenerator$1 {
    constructor(aArgs) {
      if (!aArgs) {
        aArgs = {};
      }
      this._file = util$1.getArg(aArgs, "file", null);
      this._sourceRoot = util$1.getArg(aArgs, "sourceRoot", null);
      this._skipValidation = util$1.getArg(aArgs, "skipValidation", false);
      this._sources = new ArraySet$1();
      this._names = new ArraySet$1();
      this._mappings = new MappingList();
      this._sourcesContents = null;
    }

    /**
     * Creates a new SourceMapGenerator based on a SourceMapConsumer
     *
     * @param aSourceMapConsumer The SourceMap.
     */
    static fromSourceMap(aSourceMapConsumer) {
      const sourceRoot = aSourceMapConsumer.sourceRoot;
      const generator = new SourceMapGenerator$1({
        file: aSourceMapConsumer.file,
        sourceRoot
      });
      aSourceMapConsumer.eachMapping(function(mapping) {
        const newMapping = {
          generated: {
            line: mapping.generatedLine,
            column: mapping.generatedColumn
          }
        };

        if (mapping.source != null) {
          newMapping.source = mapping.source;
          if (sourceRoot != null) {
            newMapping.source = util$1.relative(sourceRoot, newMapping.source);
          }

          newMapping.original = {
            line: mapping.originalLine,
            column: mapping.originalColumn
          };

          if (mapping.name != null) {
            newMapping.name = mapping.name;
          }
        }

        generator.addMapping(newMapping);
      });
      aSourceMapConsumer.sources.forEach(function(sourceFile) {
        let sourceRelative = sourceFile;
        if (sourceRoot !== null) {
          sourceRelative = util$1.relative(sourceRoot, sourceFile);
        }

        if (!generator._sources.has(sourceRelative)) {
          generator._sources.add(sourceRelative);
        }

        const content = aSourceMapConsumer.sourceContentFor(sourceFile);
        if (content != null) {
          generator.setSourceContent(sourceFile, content);
        }
      });
      return generator;
    }

    /**
     * Add a single mapping from original source line and column to the generated
     * source's line and column for this source map being created. The mapping
     * object should have the following properties:
     *
     *   - generated: An object with the generated line and column positions.
     *   - original: An object with the original line and column positions.
     *   - source: The original source file (relative to the sourceRoot).
     *   - name: An optional original token name for this mapping.
     */
    addMapping(aArgs) {
      const generated = util$1.getArg(aArgs, "generated");
      const original = util$1.getArg(aArgs, "original", null);
      let source = util$1.getArg(aArgs, "source", null);
      let name = util$1.getArg(aArgs, "name", null);

      if (!this._skipValidation) {
        this._validateMapping(generated, original, source, name);
      }

      if (source != null) {
        source = String(source);
        if (!this._sources.has(source)) {
          this._sources.add(source);
        }
      }

      if (name != null) {
        name = String(name);
        if (!this._names.has(name)) {
          this._names.add(name);
        }
      }

      this._mappings.add({
        generatedLine: generated.line,
        generatedColumn: generated.column,
        originalLine: original != null && original.line,
        originalColumn: original != null && original.column,
        source,
        name
      });
    }

    /**
     * Set the source content for a source file.
     */
    setSourceContent(aSourceFile, aSourceContent) {
      let source = aSourceFile;
      if (this._sourceRoot != null) {
        source = util$1.relative(this._sourceRoot, source);
      }

      if (aSourceContent != null) {
        // Add the source content to the _sourcesContents map.
        // Create a new _sourcesContents map if the property is null.
        if (!this._sourcesContents) {
          this._sourcesContents = Object.create(null);
        }
        this._sourcesContents[util$1.toSetString(source)] = aSourceContent;
      } else if (this._sourcesContents) {
        // Remove the source file from the _sourcesContents map.
        // If the _sourcesContents map is empty, set the property to null.
        delete this._sourcesContents[util$1.toSetString(source)];
        if (Object.keys(this._sourcesContents).length === 0) {
          this._sourcesContents = null;
        }
      }
    }

    /**
     * Applies the mappings of a sub-source-map for a specific source file to the
     * source map being generated. Each mapping to the supplied source file is
     * rewritten using the supplied source map. Note: The resolution for the
     * resulting mappings is the minimium of this map and the supplied map.
     *
     * @param aSourceMapConsumer The source map to be applied.
     * @param aSourceFile Optional. The filename of the source file.
     *        If omitted, SourceMapConsumer's file property will be used.
     * @param aSourceMapPath Optional. The dirname of the path to the source map
     *        to be applied. If relative, it is relative to the SourceMapConsumer.
     *        This parameter is needed when the two source maps aren't in the same
     *        directory, and the source map to be applied contains relative source
     *        paths. If so, those relative source paths need to be rewritten
     *        relative to the SourceMapGenerator.
     */
    applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
      let sourceFile = aSourceFile;
      // If aSourceFile is omitted, we will use the file property of the SourceMap
      if (aSourceFile == null) {
        if (aSourceMapConsumer.file == null) {
          throw new Error(
            "SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, " +
            'or the source map\'s "file" property. Both were omitted.'
          );
        }
        sourceFile = aSourceMapConsumer.file;
      }
      const sourceRoot = this._sourceRoot;
      // Make "sourceFile" relative if an absolute Url is passed.
      if (sourceRoot != null) {
        sourceFile = util$1.relative(sourceRoot, sourceFile);
      }
      // Applying the SourceMap can add and remove items from the sources and
      // the names array.
      const newSources = this._mappings.toArray().length > 0
        ? new ArraySet$1()
        : this._sources;
      const newNames = new ArraySet$1();

      // Find mappings for the "sourceFile"
      this._mappings.unsortedForEach(function(mapping) {
        if (mapping.source === sourceFile && mapping.originalLine != null) {
          // Check if it can be mapped by the source map, then update the mapping.
          const original = aSourceMapConsumer.originalPositionFor({
            line: mapping.originalLine,
            column: mapping.originalColumn
          });
          if (original.source != null) {
            // Copy mapping
            mapping.source = original.source;
            if (aSourceMapPath != null) {
              mapping.source = util$1.join(aSourceMapPath, mapping.source);
            }
            if (sourceRoot != null) {
              mapping.source = util$1.relative(sourceRoot, mapping.source);
            }
            mapping.originalLine = original.line;
            mapping.originalColumn = original.column;
            if (original.name != null) {
              mapping.name = original.name;
            }
          }
        }

        const source = mapping.source;
        if (source != null && !newSources.has(source)) {
          newSources.add(source);
        }

        const name = mapping.name;
        if (name != null && !newNames.has(name)) {
          newNames.add(name);
        }

      }, this);
      this._sources = newSources;
      this._names = newNames;

      // Copy sourcesContents of applied map.
      aSourceMapConsumer.sources.forEach(function(srcFile) {
        const content = aSourceMapConsumer.sourceContentFor(srcFile);
        if (content != null) {
          if (aSourceMapPath != null) {
            srcFile = util$1.join(aSourceMapPath, srcFile);
          }
          if (sourceRoot != null) {
            srcFile = util$1.relative(sourceRoot, srcFile);
          }
          this.setSourceContent(srcFile, content);
        }
      }, this);
    }

    /**
     * A mapping can have one of the three levels of data:
     *
     *   1. Just the generated position.
     *   2. The Generated position, original position, and original source.
     *   3. Generated and original position, original source, as well as a name
     *      token.
     *
     * To maintain consistency, we validate that any new mapping being added falls
     * in to one of these categories.
     */
    _validateMapping(aGenerated, aOriginal, aSource, aName) {
      // When aOriginal is truthy but has empty values for .line and .column,
      // it is most likely a programmer error. In this case we throw a very
      // specific error message to try to guide them the right way.
      // For example: https://github.com/Polymer/polymer-bundler/pull/519
      if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
          throw new Error(
              "original.line and original.column are not numbers -- you probably meant to omit " +
              "the original mapping entirely and only map the generated position. If so, pass " +
              "null for the original mapping instead of an object with empty or null values."
          );
      }

      if (aGenerated && "line" in aGenerated && "column" in aGenerated
          && aGenerated.line > 0 && aGenerated.column >= 0
          && !aOriginal && !aSource && !aName) ; else if (aGenerated && "line" in aGenerated && "column" in aGenerated
               && aOriginal && "line" in aOriginal && "column" in aOriginal
               && aGenerated.line > 0 && aGenerated.column >= 0
               && aOriginal.line > 0 && aOriginal.column >= 0
               && aSource) ; else {
        throw new Error("Invalid mapping: " + JSON.stringify({
          generated: aGenerated,
          source: aSource,
          original: aOriginal,
          name: aName
        }));
      }
    }

    /**
     * Serialize the accumulated mappings in to the stream of base 64 VLQs
     * specified by the source map format.
     */
    _serializeMappings() {
      let previousGeneratedColumn = 0;
      let previousGeneratedLine = 1;
      let previousOriginalColumn = 0;
      let previousOriginalLine = 0;
      let previousName = 0;
      let previousSource = 0;
      let result = "";
      let next;
      let mapping;
      let nameIdx;
      let sourceIdx;

      const mappings = this._mappings.toArray();
      for (let i = 0, len = mappings.length; i < len; i++) {
        mapping = mappings[i];
        next = "";

        if (mapping.generatedLine !== previousGeneratedLine) {
          previousGeneratedColumn = 0;
          while (mapping.generatedLine !== previousGeneratedLine) {
            next += ";";
            previousGeneratedLine++;
          }
        } else if (i > 0) {
          if (!util$1.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
            continue;
          }
          next += ",";
        }

        next += base64VLQ.encode(mapping.generatedColumn
                                   - previousGeneratedColumn);
        previousGeneratedColumn = mapping.generatedColumn;

        if (mapping.source != null) {
          sourceIdx = this._sources.indexOf(mapping.source);
          next += base64VLQ.encode(sourceIdx - previousSource);
          previousSource = sourceIdx;

          // lines are stored 0-based in SourceMap spec version 3
          next += base64VLQ.encode(mapping.originalLine - 1
                                     - previousOriginalLine);
          previousOriginalLine = mapping.originalLine - 1;

          next += base64VLQ.encode(mapping.originalColumn
                                     - previousOriginalColumn);
          previousOriginalColumn = mapping.originalColumn;

          if (mapping.name != null) {
            nameIdx = this._names.indexOf(mapping.name);
            next += base64VLQ.encode(nameIdx - previousName);
            previousName = nameIdx;
          }
        }

        result += next;
      }

      return result;
    }

    _generateSourcesContent(aSources, aSourceRoot) {
      return aSources.map(function(source) {
        if (!this._sourcesContents) {
          return null;
        }
        if (aSourceRoot != null) {
          source = util$1.relative(aSourceRoot, source);
        }
        const key = util$1.toSetString(source);
        return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
          ? this._sourcesContents[key]
          : null;
      }, this);
    }

    /**
     * Externalize the source map.
     */
    toJSON() {
      const map = {
        version: this._version,
        sources: this._sources.toArray(),
        names: this._names.toArray(),
        mappings: this._serializeMappings()
      };
      if (this._file != null) {
        map.file = this._file;
      }
      if (this._sourceRoot != null) {
        map.sourceRoot = this._sourceRoot;
      }
      if (this._sourcesContents) {
        map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
      }

      return map;
    }

    /**
     * Render the source map being generated to a string.
     */
    toString() {
      return JSON.stringify(this.toJSON());
    }
  }

  SourceMapGenerator$1.prototype._version = 3;
  sourceMapGenerator.SourceMapGenerator = SourceMapGenerator$1;

  var binarySearch$1 = {};

  /* -*- Mode: js; js-indent-level: 2; -*- */

  (function (exports) {
  	/*
  	 * Copyright 2011 Mozilla Foundation and contributors
  	 * Licensed under the New BSD license. See LICENSE or:
  	 * http://opensource.org/licenses/BSD-3-Clause
  	 */

  	exports.GREATEST_LOWER_BOUND = 1;
  	exports.LEAST_UPPER_BOUND = 2;

  	/**
  	 * Recursive implementation of binary search.
  	 *
  	 * @param aLow Indices here and lower do not contain the needle.
  	 * @param aHigh Indices here and higher do not contain the needle.
  	 * @param aNeedle The element being searched for.
  	 * @param aHaystack The non-empty array being searched.
  	 * @param aCompare Function which takes two elements and returns -1, 0, or 1.
  	 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  	 *     'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  	 *     closest element that is smaller than or greater than the one we are
  	 *     searching for, respectively, if the exact element cannot be found.
  	 */
  	function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
  	  // This function terminates when one of the following is true:
  	  //
  	  //   1. We find the exact element we are looking for.
  	  //
  	  //   2. We did not find the exact element, but we can return the index of
  	  //      the next-closest element.
  	  //
  	  //   3. We did not find the exact element, and there is no next-closest
  	  //      element than the one we are searching for, so we return -1.
  	  const mid = Math.floor((aHigh - aLow) / 2) + aLow;
  	  const cmp = aCompare(aNeedle, aHaystack[mid], true);
  	  if (cmp === 0) {
  	    // Found the element we are looking for.
  	    return mid;
  	  } else if (cmp > 0) {
  	    // Our needle is greater than aHaystack[mid].
  	    if (aHigh - mid > 1) {
  	      // The element is in the upper half.
  	      return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
  	    }

  	    // The exact needle element was not found in this haystack. Determine if
  	    // we are in termination case (3) or (2) and return the appropriate thing.
  	    if (aBias == exports.LEAST_UPPER_BOUND) {
  	      return aHigh < aHaystack.length ? aHigh : -1;
  	    }
  	    return mid;
  	  }

  	  // Our needle is less than aHaystack[mid].
  	  if (mid - aLow > 1) {
  	    // The element is in the lower half.
  	    return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
  	  }

  	  // we are in termination case (3) or (2) and return the appropriate thing.
  	  if (aBias == exports.LEAST_UPPER_BOUND) {
  	    return mid;
  	  }
  	  return aLow < 0 ? -1 : aLow;
  	}

  	/**
  	 * This is an implementation of binary search which will always try and return
  	 * the index of the closest element if there is no exact hit. This is because
  	 * mappings between original and generated line/col pairs are single points,
  	 * and there is an implicit region between each of them, so a miss just means
  	 * that you aren't on the very start of a region.
  	 *
  	 * @param aNeedle The element you are looking for.
  	 * @param aHaystack The array that is being searched.
  	 * @param aCompare A function which takes the needle and an element in the
  	 *     array and returns -1, 0, or 1 depending on whether the needle is less
  	 *     than, equal to, or greater than the element, respectively.
  	 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  	 *     'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  	 *     closest element that is smaller than or greater than the one we are
  	 *     searching for, respectively, if the exact element cannot be found.
  	 *     Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
  	 */
  	exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
  	  if (aHaystack.length === 0) {
  	    return -1;
  	  }

  	  let index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
  	                              aCompare, aBias || exports.GREATEST_LOWER_BOUND);
  	  if (index < 0) {
  	    return -1;
  	  }

  	  // We have found either the exact element, or the next-closest element than
  	  // the one we are searching for. However, there may be more than one such
  	  // element. Make sure we always return the smallest of these.
  	  while (index - 1 >= 0) {
  	    if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
  	      break;
  	    }
  	    --index;
  	  }

  	  return index;
  	};
  } (binarySearch$1));

  var readWasm$2 = {exports: {}};

  /* Determine browser vs node environment by testing the default top level context. Solution courtesy of: https://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser */
  const isBrowserEnvironment = (function() {
      // eslint-disable-next-line no-undef
      return (typeof window !== "undefined") && (this === window);
  }).call();

  if (isBrowserEnvironment) {
    // Web version of reading a wasm file into an array buffer.

    let mappingsWasm = null;

    readWasm$2.exports = function readWasm() {
      if (typeof mappingsWasm === "string") {
        return fetch(mappingsWasm)
          .then(response => response.arrayBuffer());
      }
      if (mappingsWasm instanceof ArrayBuffer) {
        return Promise.resolve(mappingsWasm);
      }
      throw new Error("You must provide the string URL or ArrayBuffer contents " +
                      "of lib/mappings.wasm by calling " +
                      "SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) " +
                      "before using SourceMapConsumer");
    };

    readWasm$2.exports.initialize = input => mappingsWasm = input;
  } else {
    // Node version of reading a wasm file into an array buffer.
    const fs = require("fs");
    const path = require("path");

    readWasm$2.exports = function readWasm() {
      return new Promise((resolve, reject) => {
        const wasmPath = path.join(__dirname, "mappings.wasm");
        fs.readFile(wasmPath, null, (error, data) => {
          if (error) {
            reject(error);
            return;
          }

          resolve(data.buffer);
        });
      });
    };

    readWasm$2.exports.initialize = _ => {
      console.debug("SourceMapConsumer.initialize is a no-op when running in node.js");
    };
  }

  const readWasm$1 = readWasm$2.exports;

  /**
   * Provide the JIT with a nice shape / hidden class.
   */
  function Mapping() {
    this.generatedLine = 0;
    this.generatedColumn = 0;
    this.lastGeneratedColumn = null;
    this.source = null;
    this.originalLine = null;
    this.originalColumn = null;
    this.name = null;
  }

  let cachedWasm = null;

  var wasm$1 = function wasm() {
    if (cachedWasm) {
      return cachedWasm;
    }

    const callbackStack = [];

    cachedWasm = readWasm$1().then(buffer => {
        return WebAssembly.instantiate(buffer, {
          env: {
            mapping_callback(
              generatedLine,
              generatedColumn,

              hasLastGeneratedColumn,
              lastGeneratedColumn,

              hasOriginal,
              source,
              originalLine,
              originalColumn,

              hasName,
              name
            ) {
              const mapping = new Mapping();
              // JS uses 1-based line numbers, wasm uses 0-based.
              mapping.generatedLine = generatedLine + 1;
              mapping.generatedColumn = generatedColumn;

              if (hasLastGeneratedColumn) {
                // JS uses inclusive last generated column, wasm uses exclusive.
                mapping.lastGeneratedColumn = lastGeneratedColumn - 1;
              }

              if (hasOriginal) {
                mapping.source = source;
                // JS uses 1-based line numbers, wasm uses 0-based.
                mapping.originalLine = originalLine + 1;
                mapping.originalColumn = originalColumn;

                if (hasName) {
                  mapping.name = name;
                }
              }

              callbackStack[callbackStack.length - 1](mapping);
            },

            start_all_generated_locations_for() { console.time("all_generated_locations_for"); },
            end_all_generated_locations_for() { console.timeEnd("all_generated_locations_for"); },

            start_compute_column_spans() { console.time("compute_column_spans"); },
            end_compute_column_spans() { console.timeEnd("compute_column_spans"); },

            start_generated_location_for() { console.time("generated_location_for"); },
            end_generated_location_for() { console.timeEnd("generated_location_for"); },

            start_original_location_for() { console.time("original_location_for"); },
            end_original_location_for() { console.timeEnd("original_location_for"); },

            start_parse_mappings() { console.time("parse_mappings"); },
            end_parse_mappings() { console.timeEnd("parse_mappings"); },

            start_sort_by_generated_location() { console.time("sort_by_generated_location"); },
            end_sort_by_generated_location() { console.timeEnd("sort_by_generated_location"); },

            start_sort_by_original_location() { console.time("sort_by_original_location"); },
            end_sort_by_original_location() { console.timeEnd("sort_by_original_location"); },
          }
        });
    }).then(Wasm => {
      return {
        exports: Wasm.instance.exports,
        withMappingCallback: (mappingCallback, f) => {
          callbackStack.push(mappingCallback);
          try {
            f();
          } finally {
            callbackStack.pop();
          }
        }
      };
    }).then(null, e => {
      cachedWasm = null;
      throw e;
    });

    return cachedWasm;
  };

  /* -*- Mode: js; js-indent-level: 2; -*- */

  /*
   * Copyright 2011 Mozilla Foundation and contributors
   * Licensed under the New BSD license. See LICENSE or:
   * http://opensource.org/licenses/BSD-3-Clause
   */

  const util = util$3;
  const binarySearch = binarySearch$1;
  const ArraySet = arraySet.ArraySet;
  const readWasm = readWasm$2.exports;
  const wasm = wasm$1;

  const INTERNAL = Symbol("smcInternal");

  class SourceMapConsumer {
    constructor(aSourceMap, aSourceMapURL) {
      // If the constructor was called by super(), just return Promise<this>.
      // Yes, this is a hack to retain the pre-existing API of the base-class
      // constructor also being an async factory function.
      if (aSourceMap == INTERNAL) {
        return Promise.resolve(this);
      }

      return _factory(aSourceMap, aSourceMapURL);
    }

    static initialize(opts) {
      readWasm.initialize(opts["lib/mappings.wasm"]);
    }

    static fromSourceMap(aSourceMap, aSourceMapURL) {
      return _factoryBSM(aSourceMap, aSourceMapURL);
    }

    /**
     * Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl`
     * (see the `SourceMapConsumer` constructor for details. Then, invoke the `async
     * function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait
     * for `f` to complete, call `destroy` on the consumer, and return `f`'s return
     * value.
     *
     * You must not use the consumer after `f` completes!
     *
     * By using `with`, you do not have to remember to manually call `destroy` on
     * the consumer, since it will be called automatically once `f` completes.
     *
     * ```js
     * const xSquared = await SourceMapConsumer.with(
     *   myRawSourceMap,
     *   null,
     *   async function (consumer) {
     *     // Use `consumer` inside here and don't worry about remembering
     *     // to call `destroy`.
     *
     *     const x = await whatever(consumer);
     *     return x * x;
     *   }
     * );
     *
     * // You may not use that `consumer` anymore out here; it has
     * // been destroyed. But you can use `xSquared`.
     * console.log(xSquared);
     * ```
     */
    static async with(rawSourceMap, sourceMapUrl, f) {
      const consumer = await new SourceMapConsumer(rawSourceMap, sourceMapUrl);
      try {
        return await f(consumer);
      } finally {
        consumer.destroy();
      }
    }

    /**
     * Parse the mappings in a string in to a data structure which we can easily
     * query (the ordered arrays in the `this.__generatedMappings` and
     * `this.__originalMappings` properties).
     */
    _parseMappings(aStr, aSourceRoot) {
      throw new Error("Subclasses must implement _parseMappings");
    }

    /**
     * Iterate over each mapping between an original source/line/column and a
     * generated line/column in this source map.
     *
     * @param Function aCallback
     *        The function that is called with each mapping.
     * @param Object aContext
     *        Optional. If specified, this object will be the value of `this` every
     *        time that `aCallback` is called.
     * @param aOrder
     *        Either `SourceMapConsumer.GENERATED_ORDER` or
     *        `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
     *        iterate over the mappings sorted by the generated file's line/column
     *        order or the original's source/line/column order, respectively. Defaults to
     *        `SourceMapConsumer.GENERATED_ORDER`.
     */
    eachMapping(aCallback, aContext, aOrder) {
      throw new Error("Subclasses must implement eachMapping");
    }

    /**
     * Returns all generated line and column information for the original source,
     * line, and column provided. If no column is provided, returns all mappings
     * corresponding to a either the line we are searching for or the next
     * closest line that has any mappings. Otherwise, returns all mappings
     * corresponding to the given line and either the column we are searching for
     * or the next closest column that has any offsets.
     *
     * The only argument is an object with the following properties:
     *
     *   - source: The filename of the original source.
     *   - line: The line number in the original source.  The line number is 1-based.
     *   - column: Optional. the column number in the original source.
     *    The column number is 0-based.
     *
     * and an array of objects is returned, each with the following properties:
     *
     *   - line: The line number in the generated source, or null.  The
     *    line number is 1-based.
     *   - column: The column number in the generated source, or null.
     *    The column number is 0-based.
     */
    allGeneratedPositionsFor(aArgs) {
      throw new Error("Subclasses must implement allGeneratedPositionsFor");
    }

    destroy() {
      throw new Error("Subclasses must implement destroy");
    }
  }

  /**
   * The version of the source mapping spec that we are consuming.
   */
  SourceMapConsumer.prototype._version = 3;
  SourceMapConsumer.GENERATED_ORDER = 1;
  SourceMapConsumer.ORIGINAL_ORDER = 2;

  SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
  SourceMapConsumer.LEAST_UPPER_BOUND = 2;

  /**
   * A BasicSourceMapConsumer instance represents a parsed source map which we can
   * query for information about the original file positions by giving it a file
   * position in the generated source.
   *
   * The first parameter is the raw source map (either as a JSON string, or
   * already parsed to an object). According to the spec, source maps have the
   * following attributes:
   *
   *   - version: Which version of the source map spec this map is following.
   *   - sources: An array of URLs to the original source files.
   *   - names: An array of identifiers which can be referenced by individual mappings.
   *   - sourceRoot: Optional. The URL root from which all sources are relative.
   *   - sourcesContent: Optional. An array of contents of the original source files.
   *   - mappings: A string of base64 VLQs which contain the actual mappings.
   *   - file: Optional. The generated file this source map is associated with.
   *
   * Here is an example source map, taken from the source map spec[0]:
   *
   *     {
   *       version : 3,
   *       file: "out.js",
   *       sourceRoot : "",
   *       sources: ["foo.js", "bar.js"],
   *       names: ["src", "maps", "are", "fun"],
   *       mappings: "AA,AB;;ABCDE;"
   *     }
   *
   * The second parameter, if given, is a string whose value is the URL
   * at which the source map was found.  This URL is used to compute the
   * sources array.
   *
   * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
   */
  class BasicSourceMapConsumer extends SourceMapConsumer {
    constructor(aSourceMap, aSourceMapURL) {
      return super(INTERNAL).then(that => {
        let sourceMap = aSourceMap;
        if (typeof aSourceMap === "string") {
          sourceMap = util.parseSourceMapInput(aSourceMap);
        }

        const version = util.getArg(sourceMap, "version");
        let sources = util.getArg(sourceMap, "sources");
        // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
        // requires the array) to play nice here.
        const names = util.getArg(sourceMap, "names", []);
        let sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
        const sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
        const mappings = util.getArg(sourceMap, "mappings");
        const file = util.getArg(sourceMap, "file", null);

        // Once again, Sass deviates from the spec and supplies the version as a
        // string rather than a number, so we use loose equality checking here.
        if (version != that._version) {
          throw new Error("Unsupported version: " + version);
        }

        if (sourceRoot) {
          sourceRoot = util.normalize(sourceRoot);
        }

        sources = sources
          .map(String)
          // Some source maps produce relative source paths like "./foo.js" instead of
          // "foo.js".  Normalize these first so that future comparisons will succeed.
          // See bugzil.la/1090768.
          .map(util.normalize)
          // Always ensure that absolute sources are internally stored relative to
          // the source root, if the source root is absolute. Not doing this would
          // be particularly problematic when the source root is a prefix of the
          // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
          .map(function(source) {
            return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
              ? util.relative(sourceRoot, source)
              : source;
          });

        // Pass `true` below to allow duplicate names and sources. While source maps
        // are intended to be compressed and deduplicated, the TypeScript compiler
        // sometimes generates source maps with duplicates in them. See Github issue
        // #72 and bugzil.la/889492.
        that._names = ArraySet.fromArray(names.map(String), true);
        that._sources = ArraySet.fromArray(sources, true);

        that._absoluteSources = that._sources.toArray().map(function(s) {
          return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
        });

        that.sourceRoot = sourceRoot;
        that.sourcesContent = sourcesContent;
        that._mappings = mappings;
        that._sourceMapURL = aSourceMapURL;
        that.file = file;

        that._computedColumnSpans = false;
        that._mappingsPtr = 0;
        that._wasm = null;

        return wasm().then(w => {
          that._wasm = w;
          return that;
        });
      });
    }

    /**
     * Utility function to find the index of a source.  Returns -1 if not
     * found.
     */
    _findSourceIndex(aSource) {
      let relativeSource = aSource;
      if (this.sourceRoot != null) {
        relativeSource = util.relative(this.sourceRoot, relativeSource);
      }

      if (this._sources.has(relativeSource)) {
        return this._sources.indexOf(relativeSource);
      }

      // Maybe aSource is an absolute URL as returned by |sources|.  In
      // this case we can't simply undo the transform.
      for (let i = 0; i < this._absoluteSources.length; ++i) {
        if (this._absoluteSources[i] == aSource) {
          return i;
        }
      }

      return -1;
    }

    /**
     * Create a BasicSourceMapConsumer from a SourceMapGenerator.
     *
     * @param SourceMapGenerator aSourceMap
     *        The source map that will be consumed.
     * @param String aSourceMapURL
     *        The URL at which the source map can be found (optional)
     * @returns BasicSourceMapConsumer
     */
    static fromSourceMap(aSourceMap, aSourceMapURL) {
      return new BasicSourceMapConsumer(aSourceMap.toString());
    }

    get sources() {
      return this._absoluteSources.slice();
    }

    _getMappingsPtr() {
      if (this._mappingsPtr === 0) {
        this._parseMappings(this._mappings, this.sourceRoot);
      }

      return this._mappingsPtr;
    }

    /**
     * Parse the mappings in a string in to a data structure which we can easily
     * query (the ordered arrays in the `this.__generatedMappings` and
     * `this.__originalMappings` properties).
     */
    _parseMappings(aStr, aSourceRoot) {
      const size = aStr.length;

      const mappingsBufPtr = this._wasm.exports.allocate_mappings(size);
      const mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size);
      for (let i = 0; i < size; i++) {
        mappingsBuf[i] = aStr.charCodeAt(i);
      }

      const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr);

      if (!mappingsPtr) {
        const error = this._wasm.exports.get_last_error();
        let msg = `Error parsing mappings (code ${error}): `;

        // XXX: keep these error codes in sync with `fitzgen/source-map-mappings`.
        switch (error) {
          case 1:
            msg += "the mappings contained a negative line, column, source index, or name index";
            break;
          case 2:
            msg += "the mappings contained a number larger than 2**32";
            break;
          case 3:
            msg += "reached EOF while in the middle of parsing a VLQ";
            break;
          case 4:
            msg += "invalid base 64 character while parsing a VLQ";
            break;
          default:
            msg += "unknown error code";
            break;
        }

        throw new Error(msg);
      }

      this._mappingsPtr = mappingsPtr;
    }

    eachMapping(aCallback, aContext, aOrder) {
      const context = aContext || null;
      const order = aOrder || SourceMapConsumer.GENERATED_ORDER;
      const sourceRoot = this.sourceRoot;

      this._wasm.withMappingCallback(
        mapping => {
          if (mapping.source !== null) {
            mapping.source = this._sources.at(mapping.source);
            mapping.source = util.computeSourceURL(sourceRoot, mapping.source, this._sourceMapURL);

            if (mapping.name !== null) {
              mapping.name = this._names.at(mapping.name);
            }
          }

          aCallback.call(context, mapping);
        },
        () => {
          switch (order) {
          case SourceMapConsumer.GENERATED_ORDER:
            this._wasm.exports.by_generated_location(this._getMappingsPtr());
            break;
          case SourceMapConsumer.ORIGINAL_ORDER:
            this._wasm.exports.by_original_location(this._getMappingsPtr());
            break;
          default:
            throw new Error("Unknown order of iteration.");
          }
        }
      );
    }

    allGeneratedPositionsFor(aArgs) {
      let source = util.getArg(aArgs, "source");
      const originalLine = util.getArg(aArgs, "line");
      const originalColumn = aArgs.column || 0;

      source = this._findSourceIndex(source);
      if (source < 0) {
        return [];
      }

      if (originalLine < 1) {
        throw new Error("Line numbers must be >= 1");
      }

      if (originalColumn < 0) {
        throw new Error("Column numbers must be >= 0");
      }

      const mappings = [];

      this._wasm.withMappingCallback(
        m => {
          let lastColumn = m.lastGeneratedColumn;
          if (this._computedColumnSpans && lastColumn === null) {
            lastColumn = Infinity;
          }
          mappings.push({
            line: m.generatedLine,
            column: m.generatedColumn,
            lastColumn,
          });
        }, () => {
          this._wasm.exports.all_generated_locations_for(
            this._getMappingsPtr(),
            source,
            originalLine - 1,
            "column" in aArgs,
            originalColumn
          );
        }
      );

      return mappings;
    }

    destroy() {
      if (this._mappingsPtr !== 0) {
        this._wasm.exports.free_mappings(this._mappingsPtr);
        this._mappingsPtr = 0;
      }
    }

    /**
     * Compute the last column for each generated mapping. The last column is
     * inclusive.
     */
    computeColumnSpans() {
      if (this._computedColumnSpans) {
        return;
      }

      this._wasm.exports.compute_column_spans(this._getMappingsPtr());
      this._computedColumnSpans = true;
    }

    /**
     * Returns the original source, line, and column information for the generated
     * source's line and column positions provided. The only argument is an object
     * with the following properties:
     *
     *   - line: The line number in the generated source.  The line number
     *     is 1-based.
     *   - column: The column number in the generated source.  The column
     *     number is 0-based.
     *   - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
     *     'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
     *     closest element that is smaller than or greater than the one we are
     *     searching for, respectively, if the exact element cannot be found.
     *     Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
     *
     * and an object is returned with the following properties:
     *
     *   - source: The original source file, or null.
     *   - line: The line number in the original source, or null.  The
     *     line number is 1-based.
     *   - column: The column number in the original source, or null.  The
     *     column number is 0-based.
     *   - name: The original identifier, or null.
     */
    originalPositionFor(aArgs) {
      const needle = {
        generatedLine: util.getArg(aArgs, "line"),
        generatedColumn: util.getArg(aArgs, "column")
      };

      if (needle.generatedLine < 1) {
        throw new Error("Line numbers must be >= 1");
      }

      if (needle.generatedColumn < 0) {
        throw new Error("Column numbers must be >= 0");
      }

      let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND);
      if (bias == null) {
        bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
      }

      let mapping;
      this._wasm.withMappingCallback(m => mapping = m, () => {
        this._wasm.exports.original_location_for(
          this._getMappingsPtr(),
          needle.generatedLine - 1,
          needle.generatedColumn,
          bias
        );
      });

      if (mapping) {
        if (mapping.generatedLine === needle.generatedLine) {
          let source = util.getArg(mapping, "source", null);
          if (source !== null) {
            source = this._sources.at(source);
            source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
          }

          let name = util.getArg(mapping, "name", null);
          if (name !== null) {
            name = this._names.at(name);
          }

          return {
            source,
            line: util.getArg(mapping, "originalLine", null),
            column: util.getArg(mapping, "originalColumn", null),
            name
          };
        }
      }

      return {
        source: null,
        line: null,
        column: null,
        name: null
      };
    }

    /**
     * Return true if we have the source content for every source in the source
     * map, false otherwise.
     */
    hasContentsOfAllSources() {
      if (!this.sourcesContent) {
        return false;
      }
      return this.sourcesContent.length >= this._sources.size() &&
        !this.sourcesContent.some(function(sc) { return sc == null; });
    }

    /**
     * Returns the original source content. The only argument is the url of the
     * original source file. Returns null if no original source content is
     * available.
     */
    sourceContentFor(aSource, nullOnMissing) {
      if (!this.sourcesContent) {
        return null;
      }

      const index = this._findSourceIndex(aSource);
      if (index >= 0) {
        return this.sourcesContent[index];
      }

      let relativeSource = aSource;
      if (this.sourceRoot != null) {
        relativeSource = util.relative(this.sourceRoot, relativeSource);
      }

      let url;
      if (this.sourceRoot != null
          && (url = util.urlParse(this.sourceRoot))) {
        // XXX: file:// URIs and absolute paths lead to unexpected behavior for
        // many users. We can help them out when they expect file:// URIs to
        // behave like it would if they were running a local HTTP server. See
        // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
        const fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
        if (url.scheme == "file"
            && this._sources.has(fileUriAbsPath)) {
          return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
        }

        if ((!url.path || url.path == "/")
            && this._sources.has("/" + relativeSource)) {
          return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
        }
      }

      // This function is used recursively from
      // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
      // don't want to throw if we can't find the source - we just want to
      // return null, so we provide a flag to exit gracefully.
      if (nullOnMissing) {
        return null;
      }

      throw new Error('"' + relativeSource + '" is not in the SourceMap.');
    }

    /**
     * Returns the generated line and column information for the original source,
     * line, and column positions provided. The only argument is an object with
     * the following properties:
     *
     *   - source: The filename of the original source.
     *   - line: The line number in the original source.  The line number
     *     is 1-based.
     *   - column: The column number in the original source.  The column
     *     number is 0-based.
     *   - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
     *     'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
     *     closest element that is smaller than or greater than the one we are
     *     searching for, respectively, if the exact element cannot be found.
     *     Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
     *
     * and an object is returned with the following properties:
     *
     *   - line: The line number in the generated source, or null.  The
     *     line number is 1-based.
     *   - column: The column number in the generated source, or null.
     *     The column number is 0-based.
     */
    generatedPositionFor(aArgs) {
      let source = util.getArg(aArgs, "source");
      source = this._findSourceIndex(source);
      if (source < 0) {
        return {
          line: null,
          column: null,
          lastColumn: null
        };
      }

      const needle = {
        source,
        originalLine: util.getArg(aArgs, "line"),
        originalColumn: util.getArg(aArgs, "column")
      };

      if (needle.originalLine < 1) {
        throw new Error("Line numbers must be >= 1");
      }

      if (needle.originalColumn < 0) {
        throw new Error("Column numbers must be >= 0");
      }

      let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND);
      if (bias == null) {
        bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
      }

      let mapping;
      this._wasm.withMappingCallback(m => mapping = m, () => {
        this._wasm.exports.generated_location_for(
          this._getMappingsPtr(),
          needle.source,
          needle.originalLine - 1,
          needle.originalColumn,
          bias
        );
      });

      if (mapping) {
        if (mapping.source === needle.source) {
          let lastColumn = mapping.lastGeneratedColumn;
          if (this._computedColumnSpans && lastColumn === null) {
            lastColumn = Infinity;
          }
          return {
            line: util.getArg(mapping, "generatedLine", null),
            column: util.getArg(mapping, "generatedColumn", null),
            lastColumn,
          };
        }
      }

      return {
        line: null,
        column: null,
        lastColumn: null
      };
    }
  }

  BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;

  /**
   * An IndexedSourceMapConsumer instance represents a parsed source map which
   * we can query for information. It differs from BasicSourceMapConsumer in
   * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
   * input.
   *
   * The first parameter is a raw source map (either as a JSON string, or already
   * parsed to an object). According to the spec for indexed source maps, they
   * have the following attributes:
   *
   *   - version: Which version of the source map spec this map is following.
   *   - file: Optional. The generated file this source map is associated with.
   *   - sections: A list of section definitions.
   *
   * Each value under the "sections" field has two fields:
   *   - offset: The offset into the original specified at which this section
   *       begins to apply, defined as an object with a "line" and "column"
   *       field.
   *   - map: A source map definition. This source map could also be indexed,
   *       but doesn't have to be.
   *
   * Instead of the "map" field, it's also possible to have a "url" field
   * specifying a URL to retrieve a source map from, but that's currently
   * unsupported.
   *
   * Here's an example source map, taken from the source map spec[0], but
   * modified to omit a section which uses the "url" field.
   *
   *  {
   *    version : 3,
   *    file: "app.js",
   *    sections: [{
   *      offset: {line:100, column:10},
   *      map: {
   *        version : 3,
   *        file: "section.js",
   *        sources: ["foo.js", "bar.js"],
   *        names: ["src", "maps", "are", "fun"],
   *        mappings: "AAAA,E;;ABCDE;"
   *      }
   *    }],
   *  }
   *
   * The second parameter, if given, is a string whose value is the URL
   * at which the source map was found.  This URL is used to compute the
   * sources array.
   *
   * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
   */
  class IndexedSourceMapConsumer extends SourceMapConsumer {
    constructor(aSourceMap, aSourceMapURL) {
      return super(INTERNAL).then(that => {
        let sourceMap = aSourceMap;
        if (typeof aSourceMap === "string") {
          sourceMap = util.parseSourceMapInput(aSourceMap);
        }

        const version = util.getArg(sourceMap, "version");
        const sections = util.getArg(sourceMap, "sections");

        if (version != that._version) {
          throw new Error("Unsupported version: " + version);
        }

        that._sources = new ArraySet();
        that._names = new ArraySet();
        that.__generatedMappings = null;
        that.__originalMappings = null;
        that.__generatedMappingsUnsorted = null;
        that.__originalMappingsUnsorted = null;

        let lastOffset = {
          line: -1,
          column: 0
        };
        return Promise.all(sections.map(s => {
          if (s.url) {
            // The url field will require support for asynchronicity.
            // See https://github.com/mozilla/source-map/issues/16
            throw new Error("Support for url field in sections not implemented.");
          }
          const offset = util.getArg(s, "offset");
          const offsetLine = util.getArg(offset, "line");
          const offsetColumn = util.getArg(offset, "column");

          if (offsetLine < lastOffset.line ||
              (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
            throw new Error("Section offsets must be ordered and non-overlapping.");
          }
          lastOffset = offset;

          const cons = new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL);
          return cons.then(consumer => {
            return {
              generatedOffset: {
                // The offset fields are 0-based, but we use 1-based indices when
                // encoding/decoding from VLQ.
                generatedLine: offsetLine + 1,
                generatedColumn: offsetColumn + 1
              },
              consumer
            };
          });
        })).then(s => {
          that._sections = s;
          return that;
        });
      });
    }

    // `__generatedMappings` and `__originalMappings` are arrays that hold the
    // parsed mapping coordinates from the source map's "mappings" attribute. They
    // are lazily instantiated, accessed via the `_generatedMappings` and
    // `_originalMappings` getters respectively, and we only parse the mappings
    // and create these arrays once queried for a source location. We jump through
    // these hoops because there can be many thousands of mappings, and parsing
    // them is expensive, so we only want to do it if we must.
    //
    // Each object in the arrays is of the form:
    //
    //     {
    //       generatedLine: The line number in the generated code,
    //       generatedColumn: The column number in the generated code,
    //       source: The path to the original source file that generated this
    //               chunk of code,
    //       originalLine: The line number in the original source that
    //                     corresponds to this chunk of generated code,
    //       originalColumn: The column number in the original source that
    //                       corresponds to this chunk of generated code,
    //       name: The name of the original symbol which generated this chunk of
    //             code.
    //     }
    //
    // All properties except for `generatedLine` and `generatedColumn` can be
    // `null`.
    //
    // `_generatedMappings` is ordered by the generated positions.
    //
    // `_originalMappings` is ordered by the original positions.
    get _generatedMappings() {
      if (!this.__generatedMappings) {
        this._sortGeneratedMappings();
      }

      return this.__generatedMappings;
    }

    get _originalMappings() {
      if (!this.__originalMappings) {
        this._sortOriginalMappings();
      }

      return this.__originalMappings;
    }

    get _generatedMappingsUnsorted() {
      if (!this.__generatedMappingsUnsorted) {
        this._parseMappings(this._mappings, this.sourceRoot);
      }

      return this.__generatedMappingsUnsorted;
    }

    get _originalMappingsUnsorted() {
      if (!this.__originalMappingsUnsorted) {
        this._parseMappings(this._mappings, this.sourceRoot);
      }

      return this.__originalMappingsUnsorted;
    }

    _sortGeneratedMappings() {
      const mappings = this._generatedMappingsUnsorted;
      mappings.sort(util.compareByGeneratedPositionsDeflated);
      this.__generatedMappings = mappings;
    }

    _sortOriginalMappings() {
      const mappings = this._originalMappingsUnsorted;
      mappings.sort(util.compareByOriginalPositions);
      this.__originalMappings = mappings;
    }

    /**
     * The list of original sources.
     */
    get sources() {
      const sources = [];
      for (let i = 0; i < this._sections.length; i++) {
        for (let j = 0; j < this._sections[i].consumer.sources.length; j++) {
          sources.push(this._sections[i].consumer.sources[j]);
        }
      }
      return sources;
    }

    /**
     * Returns the original source, line, and column information for the generated
     * source's line and column positions provided. The only argument is an object
     * with the following properties:
     *
     *   - line: The line number in the generated source.  The line number
     *     is 1-based.
     *   - column: The column number in the generated source.  The column
     *     number is 0-based.
     *
     * and an object is returned with the following properties:
     *
     *   - source: The original source file, or null.
     *   - line: The line number in the original source, or null.  The
     *     line number is 1-based.
     *   - column: The column number in the original source, or null.  The
     *     column number is 0-based.
     *   - name: The original identifier, or null.
     */
    originalPositionFor(aArgs) {
      const needle = {
        generatedLine: util.getArg(aArgs, "line"),
        generatedColumn: util.getArg(aArgs, "column")
      };

      // Find the section containing the generated position we're trying to map
      // to an original position.
      const sectionIndex = binarySearch.search(needle, this._sections,
        function(aNeedle, section) {
          const cmp = aNeedle.generatedLine - section.generatedOffset.generatedLine;
          if (cmp) {
            return cmp;
          }

          return (aNeedle.generatedColumn -
                  section.generatedOffset.generatedColumn);
        });
      const section = this._sections[sectionIndex];

      if (!section) {
        return {
          source: null,
          line: null,
          column: null,
          name: null
        };
      }

      return section.consumer.originalPositionFor({
        line: needle.generatedLine -
          (section.generatedOffset.generatedLine - 1),
        column: needle.generatedColumn -
          (section.generatedOffset.generatedLine === needle.generatedLine
           ? section.generatedOffset.generatedColumn - 1
           : 0),
        bias: aArgs.bias
      });
    }

    /**
     * Return true if we have the source content for every source in the source
     * map, false otherwise.
     */
    hasContentsOfAllSources() {
      return this._sections.every(function(s) {
        return s.consumer.hasContentsOfAllSources();
      });
    }

    /**
     * Returns the original source content. The only argument is the url of the
     * original source file. Returns null if no original source content is
     * available.
     */
    sourceContentFor(aSource, nullOnMissing) {
      for (let i = 0; i < this._sections.length; i++) {
        const section = this._sections[i];

        const content = section.consumer.sourceContentFor(aSource, true);
        if (content) {
          return content;
        }
      }
      if (nullOnMissing) {
        return null;
      }
      throw new Error('"' + aSource + '" is not in the SourceMap.');
    }

    /**
     * Returns the generated line and column information for the original source,
     * line, and column positions provided. The only argument is an object with
     * the following properties:
     *
     *   - source: The filename of the original source.
     *   - line: The line number in the original source.  The line number
     *     is 1-based.
     *   - column: The column number in the original source.  The column
     *     number is 0-based.
     *
     * and an object is returned with the following properties:
     *
     *   - line: The line number in the generated source, or null.  The
     *     line number is 1-based.
     *   - column: The column number in the generated source, or null.
     *     The column number is 0-based.
     */
    generatedPositionFor(aArgs) {
      for (let i = 0; i < this._sections.length; i++) {
        const section = this._sections[i];

        // Only consider this section if the requested source is in the list of
        // sources of the consumer.
        if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) {
          continue;
        }
        const generatedPosition = section.consumer.generatedPositionFor(aArgs);
        if (generatedPosition) {
          const ret = {
            line: generatedPosition.line +
              (section.generatedOffset.generatedLine - 1),
            column: generatedPosition.column +
              (section.generatedOffset.generatedLine === generatedPosition.line
               ? section.generatedOffset.generatedColumn - 1
               : 0)
          };
          return ret;
        }
      }

      return {
        line: null,
        column: null
      };
    }

    /**
     * Parse the mappings in a string in to a data structure which we can easily
     * query (the ordered arrays in the `this.__generatedMappings` and
     * `this.__originalMappings` properties).
     */
    _parseMappings(aStr, aSourceRoot) {
      const generatedMappings = this.__generatedMappingsUnsorted = [];
      const originalMappings = this.__originalMappingsUnsorted = [];
      for (let i = 0; i < this._sections.length; i++) {
        const section = this._sections[i];

        const sectionMappings = [];
        section.consumer.eachMapping(m => sectionMappings.push(m));

        for (let j = 0; j < sectionMappings.length; j++) {
          const mapping = sectionMappings[j];

          // TODO: test if null is correct here.  The original code used
          // `source`, which would actually have gotten used as null because
          // var's get hoisted.
          // See: https://github.com/mozilla/source-map/issues/333
          let source = util.computeSourceURL(section.consumer.sourceRoot, null, this._sourceMapURL);
          this._sources.add(source);
          source = this._sources.indexOf(source);

          let name = null;
          if (mapping.name) {
            this._names.add(mapping.name);
            name = this._names.indexOf(mapping.name);
          }

          // The mappings coming from the consumer for the section have
          // generated positions relative to the start of the section, so we
          // need to offset them to be relative to the start of the concatenated
          // generated file.
          const adjustedMapping = {
            source,
            generatedLine: mapping.generatedLine +
              (section.generatedOffset.generatedLine - 1),
            generatedColumn: mapping.generatedColumn +
              (section.generatedOffset.generatedLine === mapping.generatedLine
              ? section.generatedOffset.generatedColumn - 1
              : 0),
            originalLine: mapping.originalLine,
            originalColumn: mapping.originalColumn,
            name
          };

          generatedMappings.push(adjustedMapping);
          if (typeof adjustedMapping.originalLine === "number") {
            originalMappings.push(adjustedMapping);
          }
        }
      }
    }

    eachMapping(aCallback, aContext, aOrder) {
      const context = aContext || null;
      const order = aOrder || SourceMapConsumer.GENERATED_ORDER;

      let mappings;
      switch (order) {
      case SourceMapConsumer.GENERATED_ORDER:
        mappings = this._generatedMappings;
        break;
      case SourceMapConsumer.ORIGINAL_ORDER:
        mappings = this._originalMappings;
        break;
      default:
        throw new Error("Unknown order of iteration.");
      }

      const sourceRoot = this.sourceRoot;
      mappings.map(function(mapping) {
        let source = null;
        if (mapping.source !== null) {
          source = this._sources.at(mapping.source);
          source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
        }
        return {
          source,
          generatedLine: mapping.generatedLine,
          generatedColumn: mapping.generatedColumn,
          originalLine: mapping.originalLine,
          originalColumn: mapping.originalColumn,
          name: mapping.name === null ? null : this._names.at(mapping.name)
        };
      }, this).forEach(aCallback, context);
    }

    /**
     * Find the mapping that best matches the hypothetical "needle" mapping that
     * we are searching for in the given "haystack" of mappings.
     */
    _findMapping(aNeedle, aMappings, aLineName,
                aColumnName, aComparator, aBias) {
      // To return the position we are searching for, we must first find the
      // mapping for the given position and then return the opposite position it
      // points to. Because the mappings are sorted, we can use binary search to
      // find the best mapping.

      if (aNeedle[aLineName] <= 0) {
        throw new TypeError("Line must be greater than or equal to 1, got "
                            + aNeedle[aLineName]);
      }
      if (aNeedle[aColumnName] < 0) {
        throw new TypeError("Column must be greater than or equal to 0, got "
                            + aNeedle[aColumnName]);
      }

      return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
    }

    allGeneratedPositionsFor(aArgs) {
      const line = util.getArg(aArgs, "line");

      // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
      // returns the index of the closest mapping less than the needle. By
      // setting needle.originalColumn to 0, we thus find the last mapping for
      // the given line, provided such a mapping exists.
      const needle = {
        source: util.getArg(aArgs, "source"),
        originalLine: line,
        originalColumn: util.getArg(aArgs, "column", 0)
      };

      needle.source = this._findSourceIndex(needle.source);
      if (needle.source < 0) {
        return [];
      }

      if (needle.originalLine < 1) {
        throw new Error("Line numbers must be >= 1");
      }

      if (needle.originalColumn < 0) {
        throw new Error("Column numbers must be >= 0");
      }

      const mappings = [];

      let index = this._findMapping(needle,
                                    this._originalMappings,
                                    "originalLine",
                                    "originalColumn",
                                    util.compareByOriginalPositions,
                                    binarySearch.LEAST_UPPER_BOUND);
      if (index >= 0) {
        let mapping = this._originalMappings[index];

        if (aArgs.column === undefined) {
          const originalLine = mapping.originalLine;

          // Iterate until either we run out of mappings, or we run into
          // a mapping for a different line than the one we found. Since
          // mappings are sorted, this is guaranteed to find all mappings for
          // the line we found.
          while (mapping && mapping.originalLine === originalLine) {
            let lastColumn = mapping.lastGeneratedColumn;
            if (this._computedColumnSpans && lastColumn === null) {
              lastColumn = Infinity;
            }
            mappings.push({
              line: util.getArg(mapping, "generatedLine", null),
              column: util.getArg(mapping, "generatedColumn", null),
              lastColumn,
            });

            mapping = this._originalMappings[++index];
          }
        } else {
          const originalColumn = mapping.originalColumn;

          // Iterate until either we run out of mappings, or we run into
          // a mapping for a different line than the one we were searching for.
          // Since mappings are sorted, this is guaranteed to find all mappings for
          // the line we are searching for.
          while (mapping &&
                 mapping.originalLine === line &&
                 mapping.originalColumn == originalColumn) {
            let lastColumn = mapping.lastGeneratedColumn;
            if (this._computedColumnSpans && lastColumn === null) {
              lastColumn = Infinity;
            }
            mappings.push({
              line: util.getArg(mapping, "generatedLine", null),
              column: util.getArg(mapping, "generatedColumn", null),
              lastColumn,
            });

            mapping = this._originalMappings[++index];
          }
        }
      }

      return mappings;
    }

    destroy() {
      for (let i = 0; i < this._sections.length; i++) {
        this._sections[i].consumer.destroy();
      }
    }
  }

  /*
   * Cheat to get around inter-twingled classes.  `factory()` can be at the end
   * where it has access to non-hoisted classes, but it gets hoisted itself.
   */
  function _factory(aSourceMap, aSourceMapURL) {
    let sourceMap = aSourceMap;
    if (typeof aSourceMap === "string") {
      sourceMap = util.parseSourceMapInput(aSourceMap);
    }

    const consumer = sourceMap.sections != null
        ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
        : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
    return Promise.resolve(consumer);
  }

  function _factoryBSM(aSourceMap, aSourceMapURL) {
    return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
  }

  /*
   * Copyright 2009-2011 Mozilla Foundation and contributors
   * Licensed under the New BSD license. See LICENSE.txt or:
   * http://opensource.org/licenses/BSD-3-Clause
   */

  var SourceMapGenerator = sourceMapGenerator.SourceMapGenerator;

  /**
   * Create a new sourcemap generator
   * @param   { Object } options - sourcemap options
   * @returns { SourceMapGenerator } SourceMapGenerator instance
   */
  function createSourcemap(options) {
    return new SourceMapGenerator(options)
  }

  const Output = Object.freeze({
    code: '',
    ast: [],
    meta: {},
    map: null
  });

  /**
   * Create the right output data result of a parsing
   * @param   { Object } data - output data
   * @param   { string } data.code - code generated
   * @param   { AST } data.ast - ast representing the code
   * @param   { SourceMapGenerator } data.map - source map generated along with the code
   * @param   { Object } meta - compilation meta infomration
   * @returns { Output } output container object
   */
  function createOutput(data, meta) {
    const output = {
      ...Output,
      ...data,
      meta
    };

    if (!output.map && meta && meta.options && meta.options.file)
      return {
        ...output,
        map: createSourcemap({ file: meta.options.file })
      }

    return output
  }

  /**
   * Transform the source code received via a compiler function
   * @param   { Function } compiler - function needed to generate the output code
   * @param   { Object } meta - compilation meta information
   * @param   { string } source - source code
   * @returns { Output } output - the result of the compiler
   */
  function transform(compiler, meta, source) {
    const result = (compiler ? compiler(source, meta) : { code: source });
    return createOutput(result, meta)
  }

  /**
   * Throw an error with a descriptive message
   * @param   { string } message - error message
   * @returns { undefined } hoppla.. at this point the program should stop working
   */
  function panic(message) {
    throw new Error(message)
  }

  const postprocessors = new Set();

  /**
   * Register a postprocessor that will be used after the parsing and compilation of the riot tags
   * @param { Function } postprocessor - transformer that will receive the output code ans sourcemap
   * @returns { Set } the postprocessors collection
   */
  function register$1(postprocessor) {
    if (postprocessors.has(postprocessor)) {
      panic(`This postprocessor "${postprocessor.name || postprocessor.toString()}" was already registered`);
    }

    postprocessors.add(postprocessor);

    return postprocessors
  }

  /**
   * Exec all the postprocessors in sequence combining the sourcemaps generated
   * @param   { Output } compilerOutput - output generated by the compiler
   * @param   { Object } meta - compiling meta information
   * @returns { Output } object containing output code and source map
   */
  function execute$1(compilerOutput, meta) {
    return Array.from(postprocessors).reduce(function(acc, postprocessor) {
      const { code, map } = acc;
      const output = postprocessor(code, meta);

      return {
        code: output.code,
        map: composeSourcemaps(map, output.map)
      }
    }, createOutput(compilerOutput, meta))
  }

  /**
   * Parsers that can be registered by users to preparse components fragments
   * @type { Object }
   */
  const preprocessors = Object.freeze({
    javascript: new Map(),
    css: new Map(),
    template: new Map().set('default', code => ({ code }))
  });

  // throw a processor type error
  function preprocessorTypeError(type) {
    panic(`No preprocessor of type "${type}" was found, please make sure to use one of these: 'javascript', 'css' or 'template'`);
  }

  // throw an error if the preprocessor was not registered
  function preprocessorNameNotFoundError(name) {
    panic(`No preprocessor named "${name}" was found, are you sure you have registered it?'`);
  }

  /**
   * Register a custom preprocessor
   * @param   { string } type - preprocessor type either 'js', 'css' or 'template'
   * @param   { string } name - unique preprocessor id
   * @param   { Function } preprocessor - preprocessor function
   * @returns { Map } - the preprocessors map
   */
  function register(type, name, preprocessor) {
    if (!type) panic('Please define the type of preprocessor you want to register \'javascript\', \'css\' or \'template\'');
    if (!name) panic('Please define a name for your preprocessor');
    if (!preprocessor) panic('Please provide a preprocessor function');
    if (!preprocessors[type]) preprocessorTypeError(type);
    if (preprocessors[type].has(name)) panic(`The preprocessor ${name} was already registered before`);

    preprocessors[type].set(name, preprocessor);

    return preprocessors
  }

  /**
   * Exec the compilation of a preprocessor
   * @param   { string } type - preprocessor type either 'js', 'css' or 'template'
   * @param   { string } name - unique preprocessor id
   * @param   { Object } meta - preprocessor meta information
   * @param   { string } source - source code
   * @returns { Output } object containing a sourcemap and a code string
   */
  function execute(type, name, meta, source) {
    if (!preprocessors[type]) preprocessorTypeError(type);
    if (!preprocessors[type].has(name)) preprocessorNameNotFoundError(name);

    return transform(preprocessors[type].get(name), meta, source)
  }

  /**
   * Simple clone deep function, do not use it for classes or recursive objects!
   * @param   {*} source - possibily an object to clone
   * @returns {*} the object we wanted to clone
   */
  function cloneDeep(source) {
    return JSON.parse(JSON.stringify(source))
  }

  /**
   * Generate the javascript from an ast source
   * @param   {AST} ast - ast object
   * @param   {Object} options - printer options
   * @returns {Object} code + map
   */
  function generateJavascript(ast, options) {
    return main$1.print(ast, {
      ...options,
      parser: {
        parse: (source, opts) => parse_1(source, {
          ...opts,
          ecmaVersion: 'latest'
        })
      },
      tabWidth: 2,
      wrapColumn: 0,
      quote: 'single'
    })
  }

  const getEachItemName = expression => isSequenceExpression(expression.left) ? expression.left.expressions[0] : expression.left;
  const getEachIndexName = expression => isSequenceExpression(expression.left) ? expression.left.expressions[1] : null;
  const getEachValue = expression => expression.right;
  const nameToliteral = compose(builders.literal, getName);

  const generateEachItemNameKey = expression => simplePropertyNode(
    BINDING_ITEM_NAME_KEY,
    compose(nameToliteral, getEachItemName)(expression)
  );

  const generateEachIndexNameKey = expression => simplePropertyNode(
    BINDING_INDEX_NAME_KEY,
    compose(nameToliteral, getEachIndexName)(expression)
  );

  const generateEachEvaluateKey = (expression, eachExpression, sourceFile, sourceCode) => simplePropertyNode(
    BINDING_EVALUATE_KEY,
    compose(
      e => toScopedFunction(e, sourceFile, sourceCode),
      e => ({
        ...eachExpression,
        text: generateJavascript(e).code
      }),
      getEachValue
    )(expression)
  );

  /**
   * Get the each expression properties to create properly the template binding
   * @param   { DomBinding.Expression } eachExpression - original each expression data
   * @param   { string } sourceFile - original tag file
   * @param   { string } sourceCode - original tag source code
   * @returns { Array } AST nodes that are needed to build an each binding
   */
  function generateEachExpressionProperties(eachExpression, sourceFile, sourceCode) {
    const ast = createASTFromExpression(eachExpression, sourceFile, sourceCode);
    const body = ast.program.body;
    const firstNode = body[0];

    if (!isExpressionStatement(firstNode)) {
      panic(`The each directives supported should be of type "ExpressionStatement",you have provided a "${firstNode.type}"`);
    }

    const { expression } = firstNode;

    return [
      generateEachItemNameKey(expression),
      generateEachIndexNameKey(expression),
      generateEachEvaluateKey(expression, eachExpression, sourceFile, sourceCode)
    ]
  }

  /**
   * Transform a RiotParser.Node.Tag into an each binding
   * @param   { RiotParser.Node.Tag } sourceNode - tag containing the each attribute
   * @param   { string } selectorAttribute - attribute needed to select the target node
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @returns { AST.Node } an each binding node
   */
  function createEachBinding(sourceNode, selectorAttribute, sourceFile, sourceCode) {
    const [ifAttribute, eachAttribute, keyAttribute] = [
      findIfAttribute,
      findEachAttribute,
      findKeyAttribute
    ].map(f => f(sourceNode));
    const attributeOrNull = attribute => attribute ? toScopedFunction(getAttributeExpression(attribute), sourceFile, sourceCode) : nullNode();

    return builders.objectExpression([
      simplePropertyNode(BINDING_TYPE_KEY,
        builders.memberExpression(
          builders.identifier(BINDING_TYPES),
          builders.identifier(EACH_BINDING_TYPE),
          false
        )
      ),
      simplePropertyNode(BINDING_GET_KEY_KEY, attributeOrNull(keyAttribute)),
      simplePropertyNode(BINDING_CONDITION_KEY, attributeOrNull(ifAttribute)),
      createTemplateProperty(createNestedBindings(sourceNode, sourceFile, sourceCode, selectorAttribute)),
      ...createSelectorProperties(selectorAttribute),
      ...compose(generateEachExpressionProperties, getAttributeExpression)(eachAttribute)
    ])
  }

  /**
   * Transform a RiotParser.Node.Tag into an if binding
   * @param   { RiotParser.Node.Tag } sourceNode - tag containing the if attribute
   * @param   { string } selectorAttribute - attribute needed to select the target node
   * @param   { stiring } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @returns { AST.Node } an if binding node
   */
  function createIfBinding(sourceNode, selectorAttribute, sourceFile, sourceCode) {
    const ifAttribute = findIfAttribute(sourceNode);

    return builders.objectExpression([
      simplePropertyNode(BINDING_TYPE_KEY,
        builders.memberExpression(
          builders.identifier(BINDING_TYPES),
          builders.identifier(IF_BINDING_TYPE),
          false
        )
      ),
      simplePropertyNode(
        BINDING_EVALUATE_KEY,
        toScopedFunction(ifAttribute.expressions[0], sourceFile, sourceCode)
      ),
      ...createSelectorProperties(selectorAttribute),
      createTemplateProperty(createNestedBindings(sourceNode, sourceFile, sourceCode, selectorAttribute))
    ])
  }

  /**
   * Create the text node expressions
   * @param   {RiotParser.Node} sourceNode - any kind of node parsed via riot parser
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @returns {Array} array containing all the text node expressions
   */
  function createTextNodeExpressions(sourceNode, sourceFile, sourceCode) {
    const childrenNodes = getChildrenNodes(sourceNode);

    return childrenNodes
      .filter(isTextNode)
      .filter(hasExpressions)
      .map(node => createExpression(
        node,
        sourceFile,
        sourceCode,
        childrenNodes.indexOf(node),
        sourceNode
      ))
  }

  /**
   * Add a simple binding to a riot parser node
   * @param   { RiotParser.Node.Tag } sourceNode - tag containing the if attribute
   * @param   { string } selectorAttribute - attribute needed to select the target node
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @returns { AST.Node } an each binding node
   */
  function createSimpleBinding(sourceNode, selectorAttribute, sourceFile, sourceCode) {
    return builders.objectExpression([
      // root or removable nodes do not need selectors
      ...(isRemovableNode(sourceNode) || isRootNode(sourceNode) ? [] : createSelectorProperties(selectorAttribute)),
      simplePropertyNode(
        BINDING_EXPRESSIONS_KEY,
        builders.arrayExpression([
          ...createTextNodeExpressions(sourceNode, sourceFile, sourceCode),
          ...createAttributeExpressions(sourceNode, sourceFile, sourceCode)
        ])
      )
    ])
  }

  /**
   * Transform a RiotParser.Node.Tag of type slot into a slot binding
   * @param   { RiotParser.Node.Tag } sourceNode - slot node
   * @param   { string } selectorAttribute - attribute needed to select the target node
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @returns { AST.Node } a slot binding node
   */
  function createSlotBinding(sourceNode, selectorAttribute, sourceFile, sourceCode) {
    const slotNameAttribute = findAttribute(NAME_ATTRIBUTE, sourceNode);
    const slotName = slotNameAttribute ? slotNameAttribute.value : DEFAULT_SLOT_NAME;

    return builders.objectExpression([
      simplePropertyNode(BINDING_TYPE_KEY,
        builders.memberExpression(
          builders.identifier(BINDING_TYPES),
          builders.identifier(SLOT_BINDING_TYPE),
          false
        )
      ),
      simplePropertyNode(
        BINDING_ATTRIBUTES_KEY,
        createBindingAttributes(
          {
            ...sourceNode,
            // filter the name attribute
            attributes: getNodeAttributes(sourceNode)
              .filter(attribute => getName(attribute) !== NAME_ATTRIBUTE)
          },
          selectorAttribute,
          sourceFile,
          sourceCode
        )
      ),
      simplePropertyNode(
        BINDING_NAME_KEY,
        builders.literal(slotName)
      ),
      ...createSelectorProperties(selectorAttribute)
    ])
  }

  /**
   * Find the slots in the current component and group them under the same id
   * @param   {RiotParser.Node.Tag} sourceNode - the custom tag
   * @returns {Object} object containing all the slots grouped by name
   */
  function groupSlots(sourceNode) {
    return getChildrenNodes(sourceNode).reduce((acc, node) => {
      const slotAttribute = findSlotAttribute(node);

      if (slotAttribute) {
        acc[slotAttribute.value] = node;
      } else {
        acc.default = createNestedRootNode({
          nodes: [...getChildrenNodes(acc.default), node]
        });
      }

      return acc
    }, {
      default: null
    })
  }

  /**
   * Create the slot entity to pass to the riot-dom bindings
   * @param   {string} id - slot id
   * @param   {RiotParser.Node.Tag} sourceNode - slot root node
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @returns {AST.Node} ast node containing the slot object properties
   */
  function buildSlot(id, sourceNode, sourceFile, sourceCode) {
    const cloneNode = {
      ...sourceNode,
      attributes: getNodeAttributes(sourceNode)
    };
    const [html, bindings] = build(cloneNode, sourceFile, sourceCode);

    return builders.objectExpression([
      simplePropertyNode(BINDING_ID_KEY, builders.literal(id)),
      simplePropertyNode(BINDING_HTML_KEY, builders.literal(html)),
      simplePropertyNode(BINDING_BINDINGS_KEY, builders.arrayExpression(bindings))
    ])
  }

  /**
   * Create the AST array containing the slots
   * @param   { RiotParser.Node.Tag } sourceNode - the custom tag
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @returns {AST.ArrayExpression} array containing the attributes to bind
   */
  function createSlotsArray(sourceNode, sourceFile, sourceCode) {
    return builders.arrayExpression([
      ...compose(
        slots => slots.map(([key, value]) => buildSlot(key, value, sourceFile, sourceCode)),
        slots => slots.filter(([, value]) => value),
        Object.entries,
        groupSlots
      )(sourceNode)
    ])
  }

  /**
   * Find the slot attribute if it exists
   * @param   {RiotParser.Node.Tag} sourceNode - the custom tag
   * @returns {RiotParser.Node.Attr|undefined} the slot attribute found
   */
  function findSlotAttribute(sourceNode) {
    return getNodeAttributes(sourceNode).find(attribute => attribute.name === SLOT_ATTRIBUTE)
  }

  /**
   * Transform a RiotParser.Node.Tag into a tag binding
   * @param   { RiotParser.Node.Tag } sourceNode - the custom tag
   * @param   { string } selectorAttribute - attribute needed to select the target node
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @returns { AST.Node } tag binding node
   */
  function createTagBinding(sourceNode, selectorAttribute, sourceFile, sourceCode) {
    return builders.objectExpression([
      simplePropertyNode(BINDING_TYPE_KEY,
        builders.memberExpression(
          builders.identifier(BINDING_TYPES),
          builders.identifier(TAG_BINDING_TYPE),
          false
        )
      ),
      simplePropertyNode(BINDING_GET_COMPONENT_KEY, builders.identifier(GET_COMPONENT_FN)),
      simplePropertyNode(
        BINDING_EVALUATE_KEY,
        createCustomNodeNameEvaluationFunction(sourceNode, sourceFile, sourceCode)
      ),
      simplePropertyNode(BINDING_SLOTS_KEY, createSlotsArray(sourceNode, sourceFile, sourceCode)),
      simplePropertyNode(
        BINDING_ATTRIBUTES_KEY,
        createBindingAttributes(sourceNode, selectorAttribute, sourceFile, sourceCode)
      ),
      ...createSelectorProperties(selectorAttribute)
    ])
  }

  const BuildingState = Object.freeze({
    html: [],
    bindings: [],
    parent: null
  });

  /**
   * Nodes having bindings should be cloned and new selector properties should be added to them
   * @param   {RiotParser.Node} sourceNode - any kind of node parsed via riot parser
   * @param   {string} bindingsSelector - temporary string to identify the current node
   * @returns {RiotParser.Node} the original node parsed having the new binding selector attribute
   */
  function createBindingsTag(sourceNode, bindingsSelector) {
    if (!bindingsSelector) return sourceNode

    return {
      ...sourceNode,
      // inject the selector bindings into the node attributes
      attributes: [{
        name: bindingsSelector,
        value: bindingsSelector
      }, ...getNodeAttributes(sourceNode)]
    }
  }

  /**
   * Create a generic dynamic node (text or tag) and generate its bindings
   * @param   {RiotParser.Node} sourceNode - any kind of node parsed via riot parser
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @param   {BuildingState} state - state representing the current building tree state during the recursion
   * @returns {Array} array containing the html output and bindings for the current node
   */
  function createDynamicNode(sourceNode, sourceFile, sourceCode, state) {
    switch (true) {
    case isTextNode(sourceNode):
      // text nodes will not have any bindings
      return [nodeToString(sourceNode), []]
    default:
      return createTagWithBindings(sourceNode, sourceFile, sourceCode)
    }
  }

  /**
   * Create only a dynamic tag node with generating a custom selector and its bindings
   * @param   {RiotParser.Node} sourceNode - any kind of node parsed via riot parser
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @param   {BuildingState} state - state representing the current building tree state during the recursion
   * @returns {Array} array containing the html output and bindings for the current node
   */
  function createTagWithBindings(sourceNode, sourceFile, sourceCode) {
    const bindingsSelector = isRootNode(sourceNode) ? null : createBindingSelector();
    const cloneNode = createBindingsTag(sourceNode, bindingsSelector);
    const tagOpeningHTML = nodeToString(cloneNode);

    switch (true) {
    case hasEachAttribute(cloneNode):
      // EACH bindings have prio 1
      return [tagOpeningHTML, [createEachBinding(cloneNode, bindingsSelector, sourceFile, sourceCode)]]
    case hasIfAttribute(cloneNode):
      // IF bindings have prio 2
      return [tagOpeningHTML, [createIfBinding(cloneNode, bindingsSelector, sourceFile, sourceCode)]]
    case isCustomNode(cloneNode):
      // TAG bindings have prio 3
      return [tagOpeningHTML, [createTagBinding(cloneNode, bindingsSelector, sourceFile, sourceCode)]]
    case isSlotNode(cloneNode):
      // slot tag
      return [tagOpeningHTML, [createSlotBinding(cloneNode, bindingsSelector)]]
    default:
      // this node has expressions bound to it
      return [tagOpeningHTML, [createSimpleBinding(cloneNode, bindingsSelector, sourceFile, sourceCode)]]
    }
  }

  /**
   * Parse a node trying to extract its template and bindings
   * @param   {RiotParser.Node} sourceNode - any kind of node parsed via riot parser
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @param   {BuildingState} state - state representing the current building tree state during the recursion
   * @returns {Array} array containing the html output and bindings for the current node
   */
  function parseNode(sourceNode, sourceFile, sourceCode, state) {
    // static nodes have no bindings
    if (isStaticNode(sourceNode)) return [nodeToString(sourceNode), []]
    return createDynamicNode(sourceNode, sourceFile, sourceCode)
  }

  /**
   * Create the tag binding
   * @param   { RiotParser.Node.Tag } sourceNode - tag containing the each attribute
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @param   { string } selector - binding selector
   * @returns { Array } array with only the tag binding AST
   */
  function createNestedBindings(sourceNode, sourceFile, sourceCode, selector) {
    const mightBeARiotComponent = isCustomNode(sourceNode);
    const node = cloneNodeWithoutSelectorAttribute(sourceNode, selector);

    return mightBeARiotComponent ? [null, [
      createTagBinding(
        node,
        null,
        sourceFile,
        sourceCode
      )]
    ] : build(createNestedRootNode(node), sourceFile, sourceCode)
  }

  /**
   * Build the template and the bindings
   * @param   {RiotParser.Node} sourceNode - any kind of node parsed via riot parser
   * @param   {string} sourceFile - source file path
   * @param   {string} sourceCode - original source
   * @param   {BuildingState} state - state representing the current building tree state during the recursion
   * @returns {Array} array containing the html output and the dom bindings
   */
  function build(
    sourceNode,
    sourceFile,
    sourceCode,
    state
  ) {
    if (!sourceNode) panic('Something went wrong with your tag DOM parsing, your tag template can\'t be created');

    const [nodeHTML, nodeBindings] = parseNode(sourceNode, sourceFile, sourceCode);
    const childrenNodes = getChildrenNodes(sourceNode);
    const canRenderNodeHTML = isRemovableNode(sourceNode) === false;
    const currentState = { ...cloneDeep(BuildingState), ...state };

    // mutate the original arrays
    canRenderNodeHTML && currentState.html.push(...nodeHTML);
    currentState.bindings.push(...nodeBindings);

    // do recursion if
    // this tag has children and it has no special directives bound to it
    if (childrenNodes.length && !hasItsOwnTemplate(sourceNode)) {
      childrenNodes.forEach(node => build(node, sourceFile, sourceCode, { parent: sourceNode, ...currentState }));
    }

    // close the tag if it's not a void one
    if (canRenderNodeHTML && isTagNode(sourceNode) && !isVoidNode(sourceNode)) {
      currentState.html.push(closeTag(sourceNode));
    }

    return [
      currentState.html.join(''),
      currentState.bindings
    ]
  }

  /*! https://mths.be/cssesc v3.0.0 by @mathias */

  var object = {};
  var hasOwnProperty = object.hasOwnProperty;
  var merge = function merge(options, defaults) {
  	if (!options) {
  		return defaults;
  	}
  	var result = {};
  	for (var key in defaults) {
  		// `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
  		// only recognized option names are used.
  		result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
  	}
  	return result;
  };

  var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
  var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
  var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;

  // https://mathiasbynens.be/notes/css-escapes#css
  var cssesc = function cssesc(string, options) {
  	options = merge(options, cssesc.options);
  	if (options.quotes != 'single' && options.quotes != 'double') {
  		options.quotes = 'single';
  	}
  	var quote = options.quotes == 'double' ? '"' : '\'';
  	var isIdentifier = options.isIdentifier;

  	var firstChar = string.charAt(0);
  	var output = '';
  	var counter = 0;
  	var length = string.length;
  	while (counter < length) {
  		var character = string.charAt(counter++);
  		var codePoint = character.charCodeAt();
  		var value = void 0;
  		// If it’s not a printable ASCII character…
  		if (codePoint < 0x20 || codePoint > 0x7E) {
  			if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
  				// It’s a high surrogate, and there is a next character.
  				var extra = string.charCodeAt(counter++);
  				if ((extra & 0xFC00) == 0xDC00) {
  					// next character is low surrogate
  					codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
  				} else {
  					// It’s an unmatched surrogate; only append this code unit, in case
  					// the next code unit is the high surrogate of a surrogate pair.
  					counter--;
  				}
  			}
  			value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  		} else {
  			if (options.escapeEverything) {
  				if (regexAnySingleEscape.test(character)) {
  					value = '\\' + character;
  				} else {
  					value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  				}
  			} else if (/[\t\n\f\r\x0B]/.test(character)) {
  				value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  			} else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
  				value = '\\' + character;
  			} else {
  				value = character;
  			}
  		}
  		output += value;
  	}

  	if (isIdentifier) {
  		if (/^-[-\d]/.test(output)) {
  			output = '\\-' + output.slice(1);
  		} else if (/\d/.test(firstChar)) {
  			output = '\\3' + firstChar + ' ' + output.slice(1);
  		}
  	}

  	// Remove spaces after `\HEX` escapes that are not followed by a hex digit,
  	// since they’re redundant. Note that this is only possible if the escape
  	// sequence isn’t preceded by an odd number of backslashes.
  	output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
  		if ($1 && $1.length % 2) {
  			// It’s not safe to remove the space, so don’t.
  			return $0;
  		}
  		// Strip the space.
  		return ($1 || '') + $2;
  	});

  	if (!isIdentifier && options.wrap) {
  		return quote + output + quote;
  	}
  	return output;
  };

  // Expose default options (so they can be overridden globally).
  cssesc.options = {
  	'escapeEverything': false,
  	'isIdentifier': false,
  	'quotes': 'single',
  	'wrap': false
  };

  cssesc.version = '3.0.0';

  var cssesc_1 = cssesc;

  const ATTRIBUTE_TYPE_NAME = 'type';

  /**
   * Get the type attribute from a node generated by the riot parser
   * @param   { Object} sourceNode - riot parser node
   * @returns { string|null } a valid type to identify the preprocessor to use or nothing
   */
  function getPreprocessorTypeByAttribute(sourceNode) {
    const typeAttribute = sourceNode.attributes ?
      sourceNode.attributes.find(attribute => attribute.name === ATTRIBUTE_TYPE_NAME) :
      null;

    return typeAttribute ? normalize(typeAttribute.value) : null
  }


  /**
   * Remove the noise in case a user has defined the preprocessor type='text/scss'
   * @param   { string } value - input string
   * @returns { string } normalized string
   */
  function normalize(value) {
    return value.replace('text/', '')
  }

  /**
   * Preprocess a riot parser node
   * @param   { string } preprocessorType - either css, js
   * @param   { string } preprocessorName - preprocessor id
   * @param   { Object } meta - compilation meta information
   * @param   { RiotParser.nodeTypes } node - css node detected by the parser
   * @returns { Output } code and sourcemap generated by the preprocessor
   */
  function preprocess(preprocessorType, preprocessorName, meta, node) {
    const code = node.text;

    return (preprocessorName ?
      execute(preprocessorType, preprocessorName, meta, code) :
      { code }
    )
  }

  /**
   * Matches valid, multiline JavaScript comments in almost all its forms.
   * @const {RegExp}
   * @static
   */
  const R_MLCOMMS = /\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//g;

  /**
   * Source for creating regexes matching valid quoted, single-line JavaScript strings.
   * It recognizes escape characters, including nested quotes and line continuation.
   * @const {string}
   */
  const S_LINESTR = /"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source;

  /**
   * Matches CSS selectors, excluding those beginning with '@' and quoted strings.
   * @const {RegExp}
   */

  const CSS_SELECTOR = RegExp(`([{}]|^)[; ]*((?:[^@ ;{}][^{}]*)?[^@ ;{}:] ?)(?={)|${S_LINESTR}`, 'g');

  /**
   * Parses styles enclosed in a "scoped" tag
   * The "css" string is received without comments or surrounding spaces.
   *
   * @param   {string} tag - Tag name of the root element
   * @param   {string} css - The CSS code
   * @returns {string} CSS with the styles scoped to the root element
   */
  function scopedCSS(tag, css) {
    const host = ':host';
    const selectorsBlacklist = ['from', 'to'];

    return css.replace(CSS_SELECTOR, function(m, p1, p2) {
      // skip quoted strings
      if (!p2) return m

      // we have a selector list, parse each individually
      p2 = p2.replace(/[^,]+/g, function(sel) {
        const s = sel.trim();

        // skip selectors already using the tag name
        if (s.indexOf(tag) === 0) {
          return sel
        }

        // skips the keywords and percents of css animations
        if (!s || selectorsBlacklist.indexOf(s) > -1 || s.slice(-1) === '%') {
          return sel
        }

        // replace the `:host` pseudo-selector, where it is, with the root tag name;
        // if `:host` was not included, add the tag name as prefix, and mirror all
        // `[data-is]`
        if (s.indexOf(host) < 0) {
          return `${tag} ${s},[is="${tag}"] ${s}`
        } else {
          return `${s.replace(host, tag)},${
          s.replace(host, `[is="${tag}"]`)}`
        }
      });

      // add the danling bracket char and return the processed selector list
      return p1 ? `${p1} ${p2}` : p2
    })
  }

  /**
   * Remove comments, compact and trim whitespace
   * @param { string } code - compiled css code
   * @returns { string } css code normalized
   */
  function compactCss(code) {
    return code.replace(R_MLCOMMS, '').replace(/\s+/g, ' ').trim()
  }

  const escapeBackslashes = s => s.replace(/\\/g, '\\\\');
  const escapeIdentifier = identifier => escapeBackslashes(cssesc_1(identifier, {
    isIdentifier: true
  }));

  /**
   * Generate the component css
   * @param   { Object } sourceNode - node generated by the riot compiler
   * @param   { string } source - original component source code
   * @param   { Object } meta - compilation meta information
   * @param   { AST } ast - current AST output
   * @returns { AST } the AST generated
   */
  function css(sourceNode, source, meta, ast) {
    const preprocessorName = getPreprocessorTypeByAttribute(sourceNode);
    const { options } = meta;
    const preprocessorOutput = preprocess('css', preprocessorName, meta, sourceNode.text);
    const normalizedCssCode = compactCss(preprocessorOutput.code);
    const escapedCssIdentifier = escapeIdentifier(meta.tagName);

    const cssCode = (options.scopedCss ?
      scopedCSS(escapedCssIdentifier, escapeBackslashes(normalizedCssCode)) :
      escapeBackslashes(normalizedCssCode)
    ).trim();

    types.visit(ast, {
      visitProperty(path) {
        if (path.value.key.name === TAG_CSS_PROPERTY) {
          path.value.value = builders.templateLiteral(
            [builders.templateElement({ raw: cssCode, cooked: '' }, false)],
            []
          );

          return false
        }

        this.traverse(path);
      }
    });

    return ast
  }

  /**
   * Find whether there is html code outside of the root node
   * @param   {RiotParser.Node} root - node generated by the riot compiler
   * @param   {string}  code - riot tag source code
   * @param   {Function} parse - riot parser function
   * @returns {boolean} true if extra markup is detected
   */
  function hasHTMLOutsideRootNode(root, code, parse) {
    const additionalCode = root ? [
      // head
      code.substr(0, root.start),
      // tail
      code.substr(root.end, code.length)
    ].join('').trim() : '';

    if (additionalCode) {
      // if there are parsing errors we assume that there are no html
      // tags outside of the root node
      try {
        const { template, javascript, css } = parse(additionalCode).output;

        return [template, javascript, css].some(isObject)
      } catch (error) {
        return false
      }
    }

    return false
  }

  /**
   * Ckeck if an Array-like object has empty length
   * @param {Array} target - Array-like object
   * @returns {boolean} target is empty or null
   */
  function isEmptyArray(target) {
    return !target || !target.length
  }

  /**
   * True if the sourcemap has no mappings, it is empty
   * @param   {Object}  map - sourcemap json
   * @returns {boolean} true if empty
   */
  function isEmptySourcemap(map) {
    return !map || isEmptyArray(map.mappings)
  }

  /**
   * Find the export default statement
   * @param   { Array } body - tree structure containing the program code
   * @returns { Object } node containing only the code of the export default statement
   */
  function findExportDefaultStatement(body) {
    return body.find(isExportDefaultStatement)
  }

  /**
   * Find all import declarations
   * @param   { Array } body - tree structure containing the program code
   * @returns { Array } array containing all the import declarations detected
   */
  function findAllImportDeclarations(body) {
    return body.filter(isImportDeclaration)
  }

  /**
   * Find all the named export declarations
   * @param   { Array } body - tree structure containing the program code
   * @returns { Array } array containing all the named export declarations detected
   */
  function findAllExportNamedDeclarations(body) {
    return body.filter(isExportNamedDeclaration)
  }

  /**
   * Filter all the import declarations
   * @param   { Array } body - tree structure containing the program code
   * @returns { Array } array containing all the ast expressions without the import declarations
   */
  function filterOutAllImportDeclarations(body) {
    return body.filter(n => !isImportDeclaration(n))
  }

  /**
   * Filter all the export declarations
   * @param   { Array } body - tree structure containing the program code
   * @returns { Array } array containing all the ast expressions without the export declarations
   */
  function filterOutAllExportDeclarations(body) {
    return body.filter(n => !isExportNamedDeclaration(n) || isExportDefaultStatement(n))
  }

  /**
   * Find the component interface exported
   * @param   { Array } body - tree structure containing the program code
   * @returns { Object|null } the object referencing the component interface if found
   */
  function findComponentInterface(body) {
    const exportNamedDeclarations = body.filter(isExportNamedDeclaration).map(n => n.declaration);
    const types = exportNamedDeclarations.filter(isTypeAliasDeclaration);
    const interfaces = exportNamedDeclarations.filter(isInterfaceDeclaration);
    const isRiotComponentTypeName = ({ typeName }) => typeName && typeName.name ? typeName.name === RIOT_TAG_INTERFACE_NAME : false;
    const extendsRiotComponent = ({ expression }) => expression.name === RIOT_TAG_INTERFACE_NAME;

    return types.find(
      node => (node.typeAnnotation.types && node.typeAnnotation.types.some(isRiotComponentTypeName)) || isRiotComponentTypeName(node.typeAnnotation)
    ) || interfaces.find(
      node =>  node.extends && node.extends.some(extendsRiotComponent)
    )
  }

  /**
   * Add the component interface to the export declaration
   * @param   { Object } ast - ast object generated by recast
   * @param   { Object } componentInterface - the component typescript interface
   * @returns { Object } the component object exported combined with the riot typescript interfaces
   */
  function addComponentInterfaceToExportedObject(ast, componentInterface) {
    const body = getProgramBody(ast);
    const RiotComponentWrapperImportSpecifier = builders.importSpecifier(
      builders.identifier(RIOT_INTERFACE_WRAPPER_NAME)
    );
    const componentInterfaceName = componentInterface.id.name;
    const riotImportDeclaration = findAllImportDeclarations(body).find(node => node.source.value === RIOT_MODULE_ID);
    const exportDefaultStatement = body.find(isExportDefaultStatement);
    const objectExport = exportDefaultStatement.declaration;

    // add the RiotComponentWrapper to this component imports
    if (riotImportDeclaration) {
      riotImportDeclaration.specifiers.push(RiotComponentWrapperImportSpecifier);
    } else {
      // otherwise create the whole import statement from riot
      body.unshift(0, builders.importDeclaration(
        [RiotComponentWrapperImportSpecifier],
        builders.stringLiteral(RIOT_MODULE_ID)
      ));
    }

    // override the object export adding the types detected
    exportDefaultStatement.declaration = builders.tsAsExpression(
      objectExport,
      builders.tsTypeReference(
        builders.identifier(RIOT_INTERFACE_WRAPPER_NAME),
        builders.tsTypeParameterInstantiation(
          [builders.tsTypeReference(builders.identifier(componentInterfaceName))]
        )
      )
    );

    return ast
  }

  /**
   * Create the default export declaration interpreting the old riot syntax relying on "this" statements
   * @param   { Array } body - tree structure containing the program code
   * @returns { Object } ExportDefaultDeclaration
   */
  function createDefaultExportFromLegacySyntax(body) {
    return builders.exportDefaultDeclaration(
      builders.functionDeclaration(
        builders.identifier(TAG_LOGIC_PROPERTY),
        [],
        builders.blockStatement([
          ...compose(filterOutAllImportDeclarations, filterOutAllExportDeclarations)(body),
          builders.returnStatement(builders.thisExpression())
        ])
      )
    )
  }

  /**
   * Find all the code in an ast program except for the export default statements
   * @param   { Array } body - tree structure containing the program code
   * @returns { Array } array containing all the program code except the export default expressions
   */
  function filterNonExportDefaultStatements(body) {
    return body.filter(node => !isExportDefaultStatement(node) && !isThisExpressionStatement(node))
  }

  /**
   * Get the body of the AST structure
   * @param   { Object } ast - ast object generated by recast
   * @returns { Array } array containing the program code
   */
  function getProgramBody(ast) {
    return ast.body || ast.program.body
  }

  /**
   * Extend the AST adding the new tag method containing our tag sourcecode
   * @param   { Object } ast - current output ast
   * @param   { Object } exportDefaultNode - tag export default node
   * @returns { Object } the output ast having the "tag" key extended with the content of the export default
   */
  function extendTagProperty(ast, exportDefaultNode) {
    types.visit(ast, {
      visitProperty(path) {
        if (path.value.key.name === TAG_LOGIC_PROPERTY) {
          path.value.value = exportDefaultNode.declaration;
          return false
        }

        this.traverse(path);
      }
    });

    return ast
  }

  /**
   * Generate the component javascript logic
   * @param   { Object } sourceNode - node generated by the riot compiler
   * @param   { string } source - original component source code
   * @param   { Object } meta - compilation meta information
   * @param   { AST } ast - current AST output
   * @returns { AST } the AST generated
   */
  function javascript(sourceNode, source, meta, ast) {
    const preprocessorName = getPreprocessorTypeByAttribute(sourceNode);
    const javascriptNode = addLineOffset(sourceNode.text.text, source, sourceNode);
    const { options } = meta;
    const preprocessorOutput = preprocess('javascript', preprocessorName, meta, {
      ...sourceNode,
      text: javascriptNode
    });
    const inputSourceMap = sourcemapAsJSON(preprocessorOutput.map);
    const generatedAst = generateAST(preprocessorOutput.code, {
      sourceFileName: options.file,
      inputSourceMap: isEmptySourcemap(inputSourceMap) ? null : inputSourceMap
    });
    const generatedAstBody = getProgramBody(generatedAst);
    const exportDefaultNode = findExportDefaultStatement(generatedAstBody);
    const isLegacyRiotSyntax = isNil(exportDefaultNode);
    const outputBody = getProgramBody(ast);
    const componentInterface = findComponentInterface(generatedAstBody);

    // throw in case of mixed component exports
    if (exportDefaultNode && generatedAstBody.some(isThisExpressionStatement))
      throw new Error('You can\t use "export default {}" and root this statements in the same component')

    // add to the ast the "private" javascript content of our tag script node
    outputBody.unshift(
      ...(
        // for the legacy riot syntax we need to move all the import and (named) export statements outside of the function body
        isLegacyRiotSyntax ?
          [...findAllImportDeclarations(generatedAstBody), ...findAllExportNamedDeclarations(generatedAstBody)] :
          // modern riot syntax will hoist all the private stuff outside of the export default statement
          filterNonExportDefaultStatements(generatedAstBody)
      ));

    // create the public component export properties from the root this statements
    if (isLegacyRiotSyntax) extendTagProperty(
      ast,
      createDefaultExportFromLegacySyntax(generatedAstBody)
    );

    // convert the export default adding its content to the component property exported
    if (exportDefaultNode) extendTagProperty(ast, exportDefaultNode);

    return componentInterface ?
      // add the component interface to the component object exported
      addComponentInterfaceToExportedObject(ast, componentInterface) :
      ast
  }

  /**
   * Create the content of the template function
   * @param   { RiotParser.Node } sourceNode - node generated by the riot compiler
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @returns {AST.BlockStatement} the content of the template function
   */
  function createTemplateFunctionContent(sourceNode, sourceFile, sourceCode) {
    return callTemplateFunction(
      ...build(
        createRootNode(sourceNode),
        sourceFile,
        sourceCode
      )
    )
  }

  /**
   * Extend the AST adding the new template property containing our template call to render the component
   * @param   { Object } ast - current output ast
   * @param   { string } sourceFile - source file path
   * @param   { string } sourceCode - original source
   * @param   { RiotParser.Node } sourceNode - node generated by the riot compiler
   * @returns { Object } the output ast having the "template" key
   */
  function extendTemplateProperty(ast, sourceFile, sourceCode, sourceNode) {
    types.visit(ast, {
      visitProperty(path) {
        if (path.value.key.name === TAG_TEMPLATE_PROPERTY) {
          path.value.value = createTemplateDependenciesInjectionWrapper(
            createTemplateFunctionContent(sourceNode, sourceFile, sourceCode)
          );

          return false
        }

        this.traverse(path);
      }
    });

    return ast
  }

  /**
   * Generate the component template logic
   * @param   { RiotParser.Node } sourceNode - node generated by the riot compiler
   * @param   { string } source - original component source code
   * @param   { Object } meta - compilation meta information
   * @param   { AST } ast - current AST output
   * @returns { AST } the AST generated
   */
  function template(sourceNode, source, meta, ast) {
    const { options } = meta;
    return extendTemplateProperty(ast, options.file, source, sourceNode)
  }

  const DEFAULT_OPTIONS = {
    template: 'default',
    file: '[unknown-source-file]',
    scopedCss: true
  };

  /**
   * Create the initial AST
   * @param {string} tagName - the name of the component we have compiled
   * @returns { AST } the initial AST
   *
   * @example
   * // the output represents the following string in AST
   */
  function createInitialInput({ tagName }) {
    /*
    generates
    export default {
       ${TAG_CSS_PROPERTY}: null,
       ${TAG_LOGIC_PROPERTY}: null,
       ${TAG_TEMPLATE_PROPERTY}: null
    }
    */
    return builders.program([
      builders.exportDefaultDeclaration(
        builders.objectExpression([
          simplePropertyNode(TAG_CSS_PROPERTY, nullNode()),
          simplePropertyNode(TAG_LOGIC_PROPERTY, nullNode()),
          simplePropertyNode(TAG_TEMPLATE_PROPERTY, nullNode()),
          simplePropertyNode(TAG_NAME_PROPERTY, builders.literal(tagName))
        ])
      )]
    )
  }

  /**
   * Make sure the input sourcemap is valid otherwise we ignore it
   * @param   {SourceMapGenerator} map - preprocessor source map
   * @returns {Object} sourcemap as json or nothing
   */
  function normaliseInputSourceMap(map) {
    const inputSourceMap = sourcemapAsJSON(map);
    return isEmptySourcemap(inputSourceMap) ? null : inputSourceMap
  }

  /**
   * Override the sourcemap content making sure it will always contain the tag source code
   * @param   {Object} map - sourcemap as json
   * @param   {string} source - component source code
   * @returns {Object} original source map with the "sourcesContent" property overridden
   */
  function overrideSourcemapContent(map, source) {
    return {
      ...map,
      sourcesContent: [source]
    }
  }

  /**
   * Create the compilation meta object
   * @param { string } source - source code of the tag we will need to compile
   * @param { string } options - compiling options
   * @returns {Object} meta object
   */
  function createMeta(source, options) {
    return {
      tagName: null,
      fragments: null,
      options: {
        ...DEFAULT_OPTIONS,
        ...options
      },
      source
    }
  }

  /**
   * Parse a string to simply get its template AST
   * @param { string } source - string to parse
   * @param { Object } options - parser options
   * @returns {Object} riot parser template output
   */
  const parseSimpleString = (source, options) => {
    const { parse } = parser$1(options);
    return parse(source).output.template
  };

  /**
   * Generate the component slots creation function from the root node
   * @param { string } source - component outer html
   * @param { Object } parserOptions - riot parser options
   * @returns { string } content of the function that can be used to crate the slots in runtime
   */
  function generateSlotsFromString(source, parserOptions) {
    return compose(
      ({ code }) => code,
      generateJavascript,
      createTemplateDependenciesInjectionWrapper,
      createSlotsArray
    )(parseSimpleString(source, parserOptions), DEFAULT_OPTIONS.file, source)
  }

  /**
   * Generate the Riot.js binding template function from a template string
   * @param { string } source - template string
   * @param { Object } parserOptions - riot parser options
   * @returns { string } Riot.js bindings template function generated
   */
  function generateTemplateFunctionFromString(source, parserOptions) {
    return compose(
      ({ code }) => code,
      generateJavascript,
      callTemplateFunction
    )(
      ...build(
        parseSimpleString(source, parserOptions),
        DEFAULT_OPTIONS.file,
        source
      )
    )
  }

  /**
   * Generate the output code source together with the sourcemap
   * @param { string } source - source code of the tag we will need to compile
   * @param { Object } opts - compiling options
   * @returns { Output } object containing output code and source map
   */
  function compile(source, opts = {}) {
    const meta = createMeta(source, opts);
    const { options } = meta;
    const { code, map } = execute('template', options.template, meta, source);
    const { parse } = parser$1(options);
    const { template: template$1, css: css$1, javascript: javascript$1 } = parse(code).output;

    // see also https://github.com/riot/compiler/issues/130
    if (hasHTMLOutsideRootNode(template$1 || css$1 || javascript$1, code, parse)) {
      throw new Error('Multiple HTML root nodes are not supported')
    }

    // extend the meta object with the result of the parsing
    Object.assign(meta, {
      tagName: template$1.name,
      fragments: { template: template$1, css: css$1, javascript: javascript$1 }
    });

    return compose(
      result => ({ ...result, meta }),
      result => execute$1(result, meta),
      result => ({
        ...result,
        map: overrideSourcemapContent(result.map, source)
      }),
      ast => meta.ast = ast && generateJavascript(ast, {
        sourceMapName: `${options.file}.map`,
        inputSourceMap: normaliseInputSourceMap(map)
      }),
      hookGenerator(template, template$1, code, meta),
      hookGenerator(javascript, javascript$1, code, meta),
      hookGenerator(css, css$1, code, meta)
    )(createInitialInput(meta))
  }

  /**
   * Prepare the riot parser node transformers
   * @param   { Function } transformer - transformer function
   * @param   { Object } sourceNode - riot parser node
   * @param   { string } source - component source code
   * @param   { Object } meta - compilation meta information
   * @returns { function(): Promise<Output> } Function what resolves to object containing output code and source map
   */
  function hookGenerator(transformer, sourceNode, source, meta) {
    const hasContent = sourceNode && (sourceNode.text || !isEmptyArray(sourceNode.nodes) || !isEmptyArray(sourceNode.attributes));

    return hasContent ? curry(transformer)(sourceNode, source, meta) : result => result
  }

  // This function can be used to register new preprocessors
  // a preprocessor can target either only the css or javascript nodes
  // or the complete tag source file ('template')
  const registerPreprocessor = register;

  // This function can allow you to register postprocessors that will parse the output code
  // here we can run prettifiers, eslint fixes...
  const registerPostprocessor = register$1;

  exports.compile = compile;
  exports.createInitialInput = createInitialInput;
  exports.generateSlotsFromString = generateSlotsFromString;
  exports.generateTemplateFunctionFromString = generateTemplateFunctionFromString;
  exports.registerPostprocessor = registerPostprocessor;
  exports.registerPreprocessor = registerPreprocessor;

  Object.defineProperty(exports, '__esModule', { value: true });

}));
