PageSourceSearch

https://fines-fees.netlify.app/site_libs/quarto-ojs/quarto-ojs-runtime.js

js fines-fees.netlify.app collected 2026-10-03 10:44:21 UTC 663,698 bytes, 19,146 lines download raw bytes

vendor: 4,178 bytes, lines 1-133
1// @quarto/quarto-ojs-runtime v0.0.12 Copyright 2022 undefined
2var EOL = {},
3    EOF = {},
4    QUOTE = 34,
5    NEWLINE = 10,
6    RETURN = 13;
7
8function objectConverter(columns) {
9  return new Function("d", "return {" + columns.map(function(name, i) {
10    return JSON.stringify(name) + ": d[" + i + "] || \"\"";
11  }).join(",") + "}");
12}
13
14function customConverter(columns, f) {
15  var object = objectConverter(columns);
16  return function(row, i) {
17    return f(object(row), i, columns);
18  };
19}
20
21// Compute unique columns in order of discovery.
22function inferColumns(rows) {
23  var columnSet = Object.create(null),
24      columns = [];
25
26  rows.forEach(function(row) {
27    for (var column in row) {
28      if (!(column in columnSet)) {
29        columns.push(columnSet[column] = column);
30      }
31    }
32  });
33
34  return columns;
35}
36
37function pad$1(value, width) {
38  var s = value + "", length = s.length;
39  return length < width ? new Array(width - length + 1).join(0) + s : s;
40}
41
42function formatYear$1(year) {
43  return year < 0 ? "-" + pad$1(-year, 6)
44    : year > 9999 ? "+" + pad$1(year, 6)
45    : pad$1(year, 4);
46}
47
48function formatDate$2(date) {
49  var hours = date.getUTCHours(),
50      minutes = date.getUTCMinutes(),
51      seconds = date.getUTCSeconds(),
52      milliseconds = date.getUTCMilliseconds();
53  return isNaN(date) ? "Invalid Date"
54      : formatYear$1(date.getUTCFullYear()) + "-" + pad$1(date.getUTCMonth() + 1, 2) + "-" + pad$1(date.getUTCDate(), 2)
55      + (milliseconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "." + pad$1(milliseconds, 3) + "Z"
56      : seconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "Z"
57      : minutes || hours ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + "Z"
58      : "");
59}
60
61function dsv$1(delimiter) {
62  var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
63      DELIMITER = delimiter.charCodeAt(0);
64
65  function parse(text, f) {
66    var convert, columns, rows = parseRows(text, function(row, i) {
67      if (convert) return convert(row, i - 1);
68      columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
69    });
70    rows.columns = columns || [];
71    return rows;
72  }
73
74  function parseRows(text, f) {
75    var rows = [], // output rows
76        N = text.length,
77        I = 0, // current character index
78        n = 0, // current line number
79        t, // current token
80        eof = N <= 0, // current token followed by EOF?
81        eol = false; // current token followed by EOL?
82
83    // Strip the trailing newline.
84    if (text.charCodeAt(N - 1) === NEWLINE) --N;
85    if (text.charCodeAt(N - 1) === RETURN) --N;
86
87    function token() {
88      if (eof) return EOF;
89      if (eol) return eol = false, EOL;
90
91      // Unescape quotes.
92      var i, j = I, c;
93      if (text.charCodeAt(j) === QUOTE) {
94        while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);
95        if ((i = I) >= N) eof = true;
96        else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;
97        else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
98        return text.slice(j + 1, i - 1).replace(/""/g, "\"");
99      }
100
101      // Find next delimiter or newline.
102      while (I < N) {
103        if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;
104        else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
105        else if (c !== DELIMITER) continue;
106        return text.slice(j, i);
107      }
108
109      // Return last token before EOF.
110      return eof = true, text.slice(j, N);
111    }
112
113    while ((t = token()) !== EOF) {
114      var row = [];
115      while (t !== EOL && t !== EOF) row.push(t), t = token();
116      if (f && (row = f(row, n++)) == null) continue;
117      rows.push(row);
118    }
119
120    return rows;
121  }
122
123  function preformatBody(rows, columns) {
124    return rows.map(function(row) {
125      return columns.map(function(column) {
126        return formatValue(row[column]);
127      }).join(delimiter);
128    });
129  }
130
131  function format(rows, columns) {
132    if (columns == null) columns = inferColumns(rows);
133    return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, c
133olumns)).join("\n");
134  }
135
136  function formatBody(rows, columns) {
137    if (columns == null) columns = inferColumns(rows);
138    return preformatBody(rows, columns).join("\n");
139  }
140
141  function formatRows(rows) {
142    return rows.map(formatRow).join("\n");
143  }
144
145  function formatRow(row) {
146    return row.map(formatValue).join(delimiter);
147  }
148
149  function formatValue(value) {
150    return value == null ? ""
151        : value instanceof Date ? formatDate$2(value)
152        : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\""
153        : value;
154  }
155
156  return {
157    parse: parse,
158    parseRows: parseRows,
159    format: format,
160    formatBody: formatBody,
161    formatRows: formatRows,
162    formatRow: formatRow,
163    formatValue: formatValue
164  };
165}
166
167var csv = dsv$1(",");
168
169var csvParse = csv.parse;
170var csvParseRows = csv.parseRows;
171
172var tsv = dsv$1("\t");
173
174var tsvParse = tsv.parse;
175var tsvParseRows = tsv.parseRows;
176
177function autoType(object) {
178  for (var key in object) {
179    var value = object[key].trim(), number, m;
180    if (!value) value = null;
181    else if (value === "true") value = true;
182    else if (value === "false") value = false;
183    else if (value === "NaN") value = NaN;
184    else if (!isNaN(number = +value)) value = number;
185    else if (m = value.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)) {
186      if (fixtz && !!m[4] && !m[7]) value = value.replace(/-/g, "/").replace(/T/, " ");
187      value = new Date(value);
188    }
189    else continue;
190    object[key] = value;
191  }
192  return object;
193}
194
195// https://github.com/d3/d3-dsv/issues/45
196const fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours();
197
198const metas = new Map;
199const queue$1 = [];
200const map$2 = queue$1.map;
201const some = queue$1.some;
202const hasOwnProperty$2 = queue$1.hasOwnProperty;
203const identifierRe = /^((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(.*))?$/;
204const versionRe = /^\d+\.\d+\.\d+(-[\w-.+]+)?$/;
205const extensionRe = /(?:\.[^/]*|\/)$/;
206
207class RequireError extends Error {
208  constructor(message) {
209    super(message);
210  }
211}
212
213RequireError.prototype.name = RequireError.name;
214
215function parseIdentifier(identifier) {
216  const match = identifierRe.exec(identifier);
217  return match && {
218    name: match[1],
219    version: match[2],
220    path: match[3]
221  };
222}
223
224function resolveFrom(origin = "https://cdn.jsdelivr.net/npm/", mains = ["unpkg", "jsdelivr", "browser", "main"]) {
225  if (!/\/$/.test(origin)) throw new Error("origin lacks trailing slash");
226
227  function main(meta) {
228    for (const key of mains) {
229      let value = meta[key];
230      if (typeof value === "string") {
231        if (value.startsWith("./")) value = value.slice(2);
232        return extensionRe.test(value) ? value : `${value}.js`;
233      }
234    }
235  }
236
237  function resolveMeta(target) {
238    const url = `${origin}${target.name}${target.version ? `@${target.version}` : ""}/package.json`;
239    let meta = metas.get(url);
240    if (!meta) metas.set(url, meta = fetch(url).then(response => {
241      if (!response.ok) throw new RequireError("unable to load package.json");
242      if (response.redirected && !metas.has(response.url)) metas.set(response.url, meta);
243      return response.json();
244    }));
245    return meta;
246  }
247
248  return async function resolve(name, base) {
249    if (name.startsWith(origin)) name = name.substring(origin.length);
250    if (/^(\w+:)|\/\//i.test(name)) return name;
251    if (/^[.]{0,2}\//i.test(name)) return new URL(name, base == null ? location : base).href;
252    if (!name.length || /^[\s._]/.test(name) || /\s$/.test(name)) throw new RequireError("illegal name");
253    const target = parseIdentifier(name);
254    if (!target) return `${origin}${name}`;
255    if (!target.version && base != null && base.startsWith(origin)) {
256      const meta = await resolveMeta(parseIdentifier(base.substring(origin.length)));
257      target.version = meta.dependencies && meta.dependencies[target.name] || meta.peerDependencies && meta.peerDependencies[target.name];
258    }
259    if (target.path && !extensionRe.test(target.path)) target.path += ".js";
260    if (target.path && target.version && versionRe.test(target.version)) return `${origin}${target.name}@${target.version}/${target.path}`;
261    const meta = await resolveMeta(target);
262    return `${origin}${meta.name}@${meta.version}/${target.path || main(meta) || "index.js"}`;
263  };
264}
265
266var require = requireFrom(resolveFrom());
267let requestsInFlight = 0;
268let prevDefine = undefined;
269
270function requireFrom(resolver) {
271  const cache = new Map;
272  const requireBase = requireRelative(null);
273    
274  function requireAbsolute(url) {
275    if (typeof url !== "string") return url;
276    let module = cache.get(url);
277    if (!module) cache.set(url, module = new Promise((resolve, reject) => {
278
279      const script = document.createElement("script");
280      script.onload = () => {
281        try { resolve(queue$1.pop()(requireRelative(url))); }
282        catch (error) { reject(new RequireError("invalid module")); }
283        script.remove();
284        requestsInFlight--;
285        if (requestsInFlight === 0) {
286          window.define = prevDefine;
287        }
288      };
289      script.onerror = () => {
290        reject(new RequireError("unable to load module"));
291        script.remove();
292        requestsInFlight--;
293        if (requestsInFlight === 0) {
294          window.define = prevDefine;
295        }
296      };
297      script.async = true;
298      script.src = url;
299      if (requestsInFlight === 0) {
300        prevDefine = window.define;
301        window.define = define;
302      }
303      requestsInFlight++;
304      document.head.appendChild(script);
305    }));
306    return module;
307  }
308
309  function requireRelative(base) {
310    return name => Promise.resolve(resolver(name, base)).then(requireAbsolute);
311  }
312
313  function requireAlias(aliases) {
314    return requireFrom((name, base) => {
315      if (name in aliases) {
316        name = aliases[name], base = null;
317        if (typeof name !== "string") return name;
318      }
319      return resolver(name, base);
320    });
321  }
322
323  function require(name) {
324    return arguments.length > 1
325        ? Promise.all(map$2.call(arguments, requireBase)).then(merge)
326        : requireBase(name);
327  }
328
329  require.alias = requireAlias;
330  require.resolve = resolver;
331
332  return require;
333}
334
335function merge(modules) {
336  const o = {};
337  for (const m of modules) {
338    for (const k in m) {
339      if (hasOwnProperty$2.call(m, k)) {
340        if (m[k] == null) Object.defineProperty(o, k, {get: getter(m, k)});
341        else o[k] = m[k];
342      }
343    }
344  }
345  return o;
346}
347
348function getter(object, name) {
349  return () => object[name];
350}
351
352function isbuiltin(name) {
353  name = name + "";
354  return name === "exports" || name === "module";
355}
356
357function define(name, dependencies, factory) {
358  const n = arguments.length;
359  if (n < 2) factory = name, dependencies = [];
360  else if (n < 3) factory = dependencies, dependencies = typeof name === "string" ? [] : name;
361  queue$1.push(some.call(dependencies, isbuiltin) ? require => {
362    const exports = {};
363    const module = {exports};
364    return Promise.all(map$2.call(dependencies, name => {
365      name = name + "";
366      return name === "exports" ? exports : name === "module" ? module : require(name);
367    })).then(dependencies => {
368      factory.apply(null, dependencies);
369      return module.exports;
370    });
371  } : require => {
372    return Promise.all(map$2.call(dependencies, require)).then(dependencies => {
373      return typeof factory === "function" ? factory.apply(null, dependencies) : factory;
374    });
375  });
376}
377
378define.amd = {};
379
380let requireDefault = require;
381
382function setDefaultRequire(require) {
383  requireDefault = require;
384}
385
386function requirer(resolve) {
387  return resolve == null ? requireDefault : requireFrom(resolve);
388}
389
390async function remote_fetch(file) {
391  const response = await fetch(await file.url());
392  if (!response.ok) throw new Error(`Unable to load file: ${file.name}`);
393  return response;
394}
395
396async function dsv(file, delimiter, {array = false, typed = false} = {}) {
397  const text = await file.text();
398  return (delimiter === "\t"
399      ? (array ? tsvParseRows : tsvParse)
400      : (array ? csvParseRows : csvParse))(text, typed && autoType);
401}
402
403class AbstractFile {
404  constructor(name, mimeType) {
405    Object.defineProperty(this, "name", {value: name, enumerable: true});
406    if (mimeType !== undefined) Object.defineProperty(this, "mimeType", {value: mimeType + "", enumerable: true});
407  }
408  async blob() {
409    return (await remote_fetch(this)).blob();
410  }
411  async arrayBuffer() {
412    return (await remote_fetch(this)).arrayBuffer();
413  }
414  async text() {
415    return (await remote_fetch(this)).text();
416  }
417  async json() {
418    return (await remote_fetch(this)).json();
419  }
420  async stream() {
421    return (await remote_fetch(this)).body;
422  }
423  async csv(options) {
424    return dsv(this, ",", options);
425  }
426  async tsv(options) {
427    return dsv(this, "\t", options);
428  }
429  async image(props) {
430    const url = await this.url();
431    return new Promise((resolve, reject) => {
432      const i = new Image();
433      if (new URL(url, document.baseURI).origin !== new URL(location).origin) {
434        i.crossOrigin = "anonymous";
435      }
436      Object.assign(i, props);
437      i.onload = () => resolve(i);
438      i.onerror = () => reject(new Error(`Unable to load file: ${this.name}`));
439      i.src = url;
440    });
441  }
442  async arrow() {
443    const [Arrow, response] = await Promise.all([requireDefault(arrow.resolve()), remote_fetch(this)]);
444    return Arrow.Table.from(response);
445  }
446  async sqlite() {
447    return SQLiteDatabaseClient.open(remote_fetch(this));
448  }
449  async zip() {
450    const [JSZip, buffer] = await Promise.all([requireDefault(jszip.resolve()), this.arrayBuffer()]);
451    return new ZipArchive(await JSZip.loadAsync(buffer));
452  }
453  async xml(mimeType = "application/xml") {
454    return (new DOMParser).parseFromString(await this.text(), mimeType);
455  }
456  async html() {
457    return this.xml("text/html");
458  }
459  async xlsx() {
460    const [ExcelJS, buffer] = await Promise.all([requireDefault(exceljs.resolve()), this.arrayBuffer()]);
461    return new Workbook(await new ExcelJS.Workbook().xlsx.load(buffer));
462  }
463}
464
465class FileAttachment extends AbstractFile {
466  constructor(url, name, mimeType) {
467    super(name, mimeType);
468    Object.defineProperty(this, "_url", {value: url});
469  }
470  async url() {
471    return (await this._url) + "";
472  }
473}
474
475function NoFileAttachments(name) {
476  throw new Error(`File not found: ${name}`);
477}
478
479function FileAttachments(resolve) {
480  return Object.assign(
481    name => {
482      const result = resolve(name += "");
483      if (result == null) throw new Error(`File not found: ${name}`);
484      if (typeof result === "object" && "url" in result) {
485        const {url, mimeType} = result;
486        return new FileAttachment(url, name, mimeType);
487      }
488      return new FileAttachment(result, name);
489    },
490    {prototype: FileAttachment.prototype} // instanceof
491  );
492}
493
494class ZipArchive {
495  constructor(archive) {
496    Object.defineProperty(this, "_", {value: archive});
497    this.filenames = Object.keys(archive.files).filter(name => !archive.files[name].dir);
498  }
499  file(path) {
500    const object = this._.file(path += "");
501    if (!object || object.dir) throw new Error(`file not found: ${path}`);
502    return new ZipArchiveEntry(object);
503  }
504}
505
506class ZipArchiveEntry extends AbstractFile {
507  constructor(object) {
508    super(object.name);
509    Object.defineProperty(this, "_", {value: object});
510    Object.defineProperty(this, "_url", {writable: true});
511  }
512  async url() {
513    return this._url || (this._url = this.blob().then(URL.createObjectURL));
514  }
515  async blob() {
516    return this._.async("blob");
517  }
518  async arrayBuffer() {
519    return this._.async("arraybuffer");
520  }
521  async text() {
522    return this._.async("text");
523  }
524  async json() {
525    return JSON.parse(await this.text());
526  }
527}
528
529function canvas(width, height) {
530  var canvas = document.createElement("canvas");
531  canvas.width = width;
532  canvas.height = height;
533  return canvas;
534}
535
536function context2d(width, height, dpi) {
537  if (dpi == null) dpi = devicePixelRatio;
538  var canvas = document.createElement("canvas");
539  canvas.width = width * dpi;
540  canvas.height = height * dpi;
541  canvas.style.width = width + "px";
542  var context = canvas.getContext("2d");
543  context.scale(dpi, dpi);
544  return context;
545}
546
547function download(value, name = "untitled", label = "Save") {
548  const a = document.createElement("a");
549  const b = a.appendChild(document.createElement("button"));
550  b.textContent = label;
551  a.download = name;
552
553  async function reset() {
554    await new Promise(requestAnimationFrame);
555    URL.revokeObjectURL(a.href);
556    a.removeAttribute("href");
557    b.textContent = label;
558    b.disabled = false;
559  }
560
561  a.onclick = async event => {
562    b.disabled = true;
563    if (a.href) return reset(); // Already saved.
564    b.textContent = "Saving…";
565    try {
566      const object = await (typeof value === "function" ? value() : value);
567      b.textContent = "Download";
568      a.href = URL.createObjectURL(object); // eslint-disable-line require-atomic-updates
569    } catch (ignore) {
570      b.textContent = label;
571    }
572    if (event.eventPhase) return reset(); // Already downloaded.
573    b.disabled = false;
574  };
575
576  return a;
577}
578
579var namespaces = {
580  math: "http://www.w3.org/1998/Math/MathML",
581  svg: "http://www.w3.org/2000/svg",
582  xhtml: "http://www.w3.org/1999/xhtml",
583  xlink: "http://www.w3.org/1999/xlink",
584  xml: "http://www.w3.org/XML/1998/namespace",
585  xmlns: "http://www.w3.org/2000/xmlns/"
586};
587
588function element$1(name, attributes) {
589  var prefix = name += "", i = prefix.indexOf(":"), value;
590  if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
591  var element = namespaces.hasOwnProperty(prefix) // eslint-disable-line no-prototype-builtins
592      ? document.createElementNS(namespaces[prefix], name)
593      : document.createElement(name);
594  if (attributes) for (var key in attributes) {
595    prefix = key, i = prefix.indexOf(":"), value = attributes[key];
596    if (i >= 0 && (prefix = key.slice(0, i)) !== "xmlns") key = key.slice(i + 1);
597    if (namespaces.hasOwnProperty(prefix)) element.setAttributeNS(namespaces[prefix], key, value); // eslint-disable-line no-prototype-builtins
598    else element.setAttribute(key, value);
599  }
600  return element;
601}
602
603function input$1(type) {
604  var input = document.createElement("input");
605  if (type != null) input.type = type;
606  return input;
607}
608
609function range$1(min, max, step) {
610  if (arguments.length === 1) max = min, min = null;
611  var input = document.createElement("input");
612  input.min = min = min == null ? 0 : +min;
613  input.max = max = max == null ? 1 : +max;
614  input.step = step == null ? "any" : step = +step;
615  input.type = "range";
616  return input;
617}
618
619function select(values) {
620  var select = document.createElement("select");
621  Array.prototype.forEach.call(values, function(value) {
622    var option = document.createElement("option");
623    option.value = option.textContent = value;
624    select.appendChild(option);
625  });
626  return select;
627}
628
629function svg$1(width, height) {
630  var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
631  svg.setAttribute("viewBox", [0, 0, width, height]);
632  svg.setAttribute("width", width);
633  svg.setAttribute("height", height);
634  return svg;
635}
636
637function text$2(value) {
638  return document.createTextNode(value);
639}
640
641var count$1 = 0;
642
643function uid(name) {
644  return new Id("O-" + (name == null ? "" : name + "-") + ++count$1);
645}
646
647function Id(id) {
648  this.id = id;
649  this.href = new URL(`#${id}`, location) + "";
650}
651
652Id.prototype.toString = function() {
653  return "url(" + this.href + ")";
654};
655
656var DOM = {
657  canvas: canvas,
658  context2d: context2d,
659  download: download,
660  element: element$1,
661  input: input$1,
662  range: range$1,
663  select: select,
664  svg: svg$1,
665  text: text$2,
666  uid: uid
667};
668
669function buffer(file) {
670  return new Promise(function(resolve, reject) {
671    var reader = new FileReader;
672    reader.onload = function() { resolve(reader.result); };
673    reader.onerror = reject;
674    reader.readAsArrayBuffer(file);
675  });
676}
677
678function text$1(file) {
679  return new Promise(function(resolve, reject) {
680    var reader = new FileReader;
681    reader.onload = function() { resolve(reader.result); };
682    reader.onerror = reject;
683    reader.readAsText(file);
684  });
685}
686
687function url(file) {
688  return new Promise(function(resolve, reject) {
689    var reader = new FileReader;
690    reader.onload = function() { resolve(reader.result); };
691    reader.onerror = reject;
692    reader.readAsDataURL(file);
693  });
694}
695
696var Files = {
697  buffer: buffer,
698  text: text$1,
699  url: url
700};
701
702function that() {
703  return this;
704}
705
706function disposable(value, dispose) {
707  let done = false;
708  if (typeof dispose !== "function") {
709    throw new Error("dispose is not a function");
710  }
711  return {
712    [Symbol.iterator]: that,
713    next: () => done ? {done: true} : (done = true, {done: false, value}),
714    return: () => (done = true, dispose(value), {done: true}),
715    throw: () => ({done: done = true})
716  };
717}
718
719function* filter(iterator, test) {
720  var result, index = -1;
721  while (!(result = iterator.next()).done) {
722    if (test(result.value, ++index)) {
723      yield result.value;
724    }
725  }
726}
727
728function observe(initialize) {
729  let stale = false;
730  let value;
731  let resolve;
732  const dispose = initialize(change);
733
734  if (dispose != null && typeof dispose !== "function") {
735    throw new Error(typeof dispose.then === "function"
736        ? "async initializers are not supported"
737        : "initializer returned something, but not a dispose function");
738  }
739
740  function change(x) {
741    if (resolve) resolve(x), resolve = null;
742    else stale = true;
743    return value = x;
744  }
745
746  function next() {
747    return {done: false, value: stale
748        ? (stale = false, Promise.resolve(value))
749        : new Promise(_ => (resolve = _))};
750  }
751
752  return {
753    [Symbol.iterator]: that,
754    throw: () => ({done: true}),
755    return: () => (dispose != null && dispose(), {done: true}),
756    next
757  };
758}
759
760function input(input) {
761  return observe(function(change) {
762    var event = eventof(input), value = valueof$1(input);
763    function inputted() { change(valueof$1(input)); }
764    input.addEventListener(event, inputted);
765    if (value !== undefined) change(value);
766    return function() { input.removeEventListener(event, inputted); };
767  });
768}
769
770function valueof$1(input) {
771  switch (input.type) {
772    case "range":
773    case "number": return input.valueAsNumber;
774    case "date": return input.valueAsDate;
775    case "checkbox": return input.checked;
776    case "file": return input.multiple ? input.files : input.files[0];
777    case "select-multiple": return Array.from(input.selectedOptions, o => o.value);
778    default: return input.value;
779  }
780}
781
782function eventof(input) {
783  switch (input.type) {
784    case "button":
785    case "submit":
786    case "checkbox": return "click";
787    case "file": return "change";
788    default: return "input";
789  }
790}
791
792function* map$1(iterator, transform) {
793  var result, index = -1;
794  while (!(result = iterator.next()).done) {
795    yield transform(result.value, ++index);
796  }
797}
798
799function queue(initialize) {
800  let resolve;
801  const queue = [];
802  const dispose = initialize(push);
803
804  if (dispose != null && typeof dispose !== "function") {
805    throw new Error(typeof dispose.then === "function"
806        ? "async initializers are not supported"
807        : "initializer returned something, but not a dispose function");
808  }
809
810  function push(x) {
811    queue.push(x);
812    if (resolve) resolve(queue.shift()), resolve = null;
813    return x;
814  }
815
816  function next() {
817    return {done: false, value: queue.length
818        ? Promise.resolve(queue.shift())
819        : new Promise(_ => (resolve = _))};
820  }
821
822  return {
823    [Symbol.iterator]: that,
824    throw: () => ({done: true}),
825    return: () => (dispose != null && dispose(), {done: true}),
826    next
827  };
828}
829
830function* range(start, stop, step) {
831  start = +start;
832  stop = +stop;
833  step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
834  var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0;
835  while (++i < n) {
836    yield start + i * step;
837  }
838}
839
840function valueAt(iterator, i) {
841  if (!isFinite(i = +i) || i < 0 || i !== i | 0) return;
842  var result, index = -1;
843  while (!(result = iterator.next()).done) {
844    if (++index === i) {
845      return result.value;
846    }
847  }
848}
849
850function worker(source) {
851  const url = URL.createObjectURL(new Blob([source], {type: "text/javascript"}));
852  const worker = new Worker(url);
853  return disposable(worker, () => {
854    worker.terminate();
855    URL.revokeObjectURL(url);
856  });
857}
858
859var Generators$1 = {
860  disposable: disposable,
861  filter: filter,
862  input: input,
863  map: map$1,
864  observe: observe,
865  queue: queue,
866  range: range,
867  valueAt: valueAt,
868  worker: worker
869};
870
871function template(render, wrapper) {
872  return function(strings) {
873    var string = strings[0],
874        parts = [], part,
875        root = null,
876        node, nodes,
877        walker,
878        i, n, j, m, k = -1;
879
880    // Concatenate the text using comments as placeholders.
881    for (i = 1, n = arguments.length; i < n; ++i) {
882      part = arguments[i];
883      if (part instanceof Node) {
884        parts[++k] = part;
885        string += "<!--o:" + k + "-->";
886      } else if (Array.isArray(part)) {
887        for (j = 0, m = part.length; j < m; ++j) {
888          node = part[j];
889          if (node instanceof Node) {
890            if (root === null) {
891              parts[++k] = root = document.createDocumentFragment();
892              string += "<!--o:" + k + "-->";
893            }
894            root.appendChild(node);
895          } else {
896            root = null;
897            string += node;
898          }
899        }
900        root = null;
901      } else {
902        string += part;
903      }
904      string += strings[i];
905    }
906
907    // Render the text.
908    root = render(string);
909
910    // Walk the rendered content to replace comment placeholders.
911    if (++k > 0) {
912      nodes = new Array(k);
913      walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT, null, false);
914      while (walker.nextNode()) {
915        node = walker.currentNode;
916        if (/^o:/.test(node.nodeValue)) {
917          nodes[+node.nodeValue.slice(2)] = node;
918        }
919      }
920      for (i = 0; i < k; ++i) {
921        if (node = nodes[i]) {
922          node.parentNode.replaceChild(parts[i], node);
923        }
924      }
925    }
926
927    // Is the rendered content
928    // … a parent of a single child? Detach and return the child.
929    // … a document fragment? Replace the fragment with an element.
930    // … some other node? Return it.
931    return root.childNodes.length === 1 ? root.removeChild(root.firstChild)
932        : root.nodeType === 11 ? ((node = wrapper()).appendChild(root), node)
933        : root;
934  };
935}
936
937var html$1 = template(function(string) {
938  var template = document.createElement("template");
939  template.innerHTML = string.trim();
940  return document.importNode(template.content, true);
941}, function() {
942  return document.createElement("span");
943});
944
945function dependency(name, version, main) {
946  return {
947    resolve(path = main) {
948      return `${name}@${version}/${path}`;
949    }
950  };
951}
952
953const d3 = dependency("d3", "7.6.1", "dist/d3.min.js");
954const inputs = dependency("@observablehq/inputs", "0.10.4", "dist/inputs.min.js");
955const plot = dependency("@observablehq/plot", "0.5.2", "dist/plot.umd.min.js");
956const graphviz = dependency("@observablehq/graphviz", "0.2.1", "dist/graphviz.min.js");
957const highlight = dependency("@observablehq/highlight.js", "2.0.0", "highlight.min.js");
958const katex = dependency("@observablehq/katex", "0.11.1", "dist/katex.min.js");
959const lodash = dependency("lodash", "4.17.21", "lodash.min.js");
960const htl = dependency("htl", "0.3.1", "dist/htl.min.js");
961const marked = dependency("marked", "0.3.12", "marked.min.js");
962const sql = dependency("sql.js", "1.7.0", "dist/sql-wasm.js");
963const vega = dependency("vega", "5.22.1", "build/vega.min.js");
964const vegalite = dependency("vega-lite", "5.2.0", "build/vega-lite.min.js");
965const vegaliteApi = dependency("vega-lite-api", "5.0.0", "build/vega-lite-api.min.js");
966const arrow$1 = dependency("apache-arrow", "4.0.1", "Arrow.es2015.min.js");
967const arquero = dependency("arquero", "4.8.8", "dist/arquero.min.js");
968const topojson = dependency("topojson-client", "3.1.0", "dist/topojson-client.min.js");
969const mermaid$1 = dependency("mermaid", "9.1.1", "dist/mermaid.min.js");
970const leaflet$1 = dependency("leaflet", "1.8.0", "dist/leaflet.js");
971
972async function leaflet(require) {
973  const L = await require(leaflet$1.resolve());
974  if (!L._style) {
975    const link = document.createElement("link");
976    link.rel = "stylesheet";
977    link.href = await require.resolve(leaflet$1.resolve("dist/leaflet.css"));
978    L._style = document.head.appendChild(link);
979  }
980  return L;
981}
982
983function md(require) {
984  return require(marked.resolve()).then(function(marked) {
985    return template(
986      function(string) {
987        var root = document.createElement("div");
988        root.innerHTML = marked(string, {langPrefix: ""}).trim();
989        var code = root.querySelectorAll("pre code[class]");
990        if (code.length > 0) {
991          require(highlight.resolve()).then(function(hl) {
992            code.forEach(function(block) {
993              function done() {
994                hl.highlightBlock(block);
995                block.parentNode.classList.add("observablehq--md-pre");
996              }
997              if (hl.getLanguage(block.className)) {
998                done();
999              } else {
1000                require(highlight.resolve("async-languages/index.js"))
1001                  .then(index => {
1002                    if (index.has(block.className)) {
1003                      return require(highlight.resolve("async-languages/" + index.get(block.className))).then(language => {
1004                        hl.registerLanguage(block.className, language);
1005                      });
1006                    }
1007                  })
1008                  .then(done, done);
1009              }
1010            });
1011          });
1012        }
1013        return root;
1014      },
1015      function() {
1016        return document.createElement("div");
1017      }
1018    );
1019  });
1020}
1021
1022async function mermaid(require) {
1023  const mer = await require(mermaid$1.resolve());
1024  mer.initialize({securityLevel: "loose", theme: "neutral"});
1025  return function mermaid() {
1026    const root = document.createElement("div");
1027    root.innerHTML = mer.render(uid().id, String.raw.apply(String, arguments));
1028    return root.removeChild(root.firstChild);
1029  };
1030}
1031
1032function Mutable(value) {
1033  let change;
1034  Object.defineProperties(this, {
1035    generator: {value: observe(_ => void (change = _))},
1036    value: {get: () => value, set: x => change(value = x)} // eslint-disable-line no-setter-return
1037  });
1038  if (value !== undefined) change(value);
1039}
1040
1041function* now() {
1042  while (true) {
1043    yield Date.now();
1044  }
1045}
1046
1047function delay(duration, value) {
1048  return new Promise(function(resolve) {
1049    setTimeout(function() {
1050      resolve(value);
1051    }, duration);
1052  });
1053}
1054
1055var timeouts = new Map;
1056
1057function timeout(now, time) {
1058  var t = new Promise(function(resolve) {
1059    timeouts.delete(time);
1060    var delay = time - now;
1061    if (!(delay > 0)) throw new Error("invalid time");
1062    if (delay > 0x7fffffff) throw new Error("too long to wait");
1063    setTimeout(resolve, delay);
1064  });
1065  timeouts.set(time, t);
1066  return t;
1067}
1068
1069function when(time, value) {
1070  var now;
1071  return (now = timeouts.get(time = +time)) ? now.then(() => value)
1072      : (now = Date.now()) >= time ? Promise.resolve(value)
1073      : timeout(now, time).then(() => value);
1074}
1075
1076function tick(duration, value) {
1077  return when(Math.ceil((Date.now() + 1) / duration) * duration, value);
1078}
1079
1080var Promises = {
1081  delay: delay,
1082  tick: tick,
1083  when: when
1084};
1085
1086function resolve(name, base) {
1087  if (/^(\w+:)|\/\//i.test(name)) return name;
1088  if (/^[.]{0,2}\//i.test(name)) return new URL(name, base == null ? location : base).href;
1089  if (!name.length || /^[\s._]/.test(name) || /\s$/.test(name)) throw new Error("illegal name");
1090  return "https://unpkg.com/" + name;
1091}
1092
1093async function sqlite(require) {
1094  const [init, dist] = await Promise.all([require(sql.resolve()), require.resolve(sql.resolve("dist/"))]);
1095  return init({locateFile: file => `${dist}${file}`});
1096}
1097
1098class SQLiteDatabaseClient$1 {
1099  constructor(db) {
1100    Object.defineProperties(this, {
1101      _db: {value: db}
1102    });
1103  }
1104  static async open(source) {
1105    const [SQL, buffer] = await Promise.all([sqlite(requireDefault), Promise.resolve(source).then(load$1)]);
1106    return new SQLiteDatabaseClient$1(new SQL.Database(buffer));
1107  }
1108  async query(query, params) {
1109    return await exec(this._db, query, params);
1110  }
1111  async queryRow(query, params) {
1112    return (await this.query(query, params))[0] || null;
1113  }
1114  async explain(query, params) {
1115    const rows = await this.query(`EXPLAIN QUERY PLAN ${query}`, params);
1116    return element("pre", {className: "observablehq--inspect"}, [
1117      text(rows.map(row => row.detail).join("\n"))
1118    ]);
1119  }
1120  async describeTables({schema} = {}) {
1121    return this.query(`SELECT NULLIF(schema, 'main') AS schema, name FROM pragma_table_list() WHERE type = 'table'${schema == null ? "" : ` AND schema = ?`} AND name NOT LIKE 'sqlite_%'`, schema == null ? [] : [schema]);
1122  }
1123  async describeColumns({schema, table} = {}) {
1124    if (table == null) throw new Error(`missing table`);
1125    const rows = await this.query(`SELECT name, type, "notnull" FROM pragma_table_info(?${schema == null ? "" : `, ?`}) ORDER BY cid`, schema == null ? [table] : [table, schema]);
1126    if (!rows.length) throw new Error(`table not found: ${table}`);
1127    return rows.map(({name, type, notnull}) => ({name, type: sqliteType(type), databaseType: type, nullable: !notnull}));
1128  }
1129  async describe(object) {
1130    const rows = await (object === undefined
1131      ? this.query(`SELECT name FROM sqlite_master WHERE type = 'table'`)
1132      : this.query(`SELECT * FROM pragma_table_info(?)`, [object]));
1133    if (!rows.length) throw new Error("Not found");
1134    const {columns} = rows;
1135    return element("table", {value: rows}, [
1136      element("thead", [element("tr", columns.map(c => element("th", [text(c)])))]),
1137      element("tbody", rows.map(r => element("tr", columns.map(c => element("td", [text(r[c])])))))
1138    ]);
1139  }
1140  async sql() {
1141    return this.query(...this.queryTag.apply(this, arguments));
1142  }
1143  queryTag(strings, ...params) {
1144    return [strings.join("?"), params];
1145  }
1146}
1147
1148Object.defineProperty(SQLiteDatabaseClient$1.prototype, "dialect", {
1149  value: "sqlite"
1150});
1151
1152// https://www.sqlite.org/datatype3.html
1153function sqliteType(type) {
1154  switch (type) {
1155    case "NULL":
1156      return "null";
1157    case "INT":
1158    case "INTEGER":
1159    case "TINYINT":
1160    case "SMALLINT":
1161    case "MEDIUMINT":
1162    case "BIGINT":
1163    case "UNSIGNED BIG INT":
1164    case "INT2":
1165    case "INT8":
1166      return "integer";
1167    case "TEXT":
1168    case "CLOB":
1169      return "string";
1170    case "REAL":
1171    case "DOUBLE":
1172    case "DOUBLE PRECISION":
1173    case "FLOAT":
1174    case "NUMERIC":
1175      return "number";
1176    case "BLOB":
1177      return "buffer";
1178    case "DATE":
1179    case "DATETIME":
1180      return "string"; // TODO convert strings to Date instances in sql.js
1181    default:
1182      return /^(?:(?:(?:VARYING|NATIVE) )?CHARACTER|(?:N|VAR|NVAR)CHAR)\(/.test(type) ? "string"
1183        : /^(?:DECIMAL|NUMERIC)\(/.test(type) ? "number"
1184        : "other";
1185  }
1186}
1187
1188function load$1(source) {
1189  return typeof source === "string" ? fetch(source).then(load$1)
1190    : source instanceof Response || source instanceof Blob ? source.arrayBuffer().then(load$1)
1191    : source instanceof ArrayBuffer ? new Uint8Array(source)
1192    : source;
1193}
1194
1195async function exec(db, query, params) {
1196  const [result] = await db.exec(query, params);
1197  if (!result) return [];
1198  const {columns, values} = result;
1199  const rows = values.map(row => fromEntries(row.map((value, i) => [columns[i], value])));
1200  rows.columns = columns;
1201  return rows;
1202}
1203
1204function element(name, props, children) {
1205  if (arguments.length === 2) children = props, props = undefined;
1206  const element = document.createElement(name);
1207  if (props !== undefined) for (const p in props) element[p] = props[p];
1208  if (children !== undefined) for (const c of children) element.appendChild(c);
1209  return element;
1210}
1211
1212function text(value) {
1213  return document.createTextNode(value);
1214}
1215
1216var svg = template(function(string) {
1217  var root = document.createElementNS("http://www.w3.org/2000/svg", "g");
1218  root.innerHTML = string.trim();
1219  return root;
1220}, function() {
1221  return document.createElementNS("http://www.w3.org/2000/svg", "g");
1222});
1223
1224var raw = String.raw;
1225
1226function style(href) {
1227  return new Promise(function(resolve, reject) {
1228    var link = document.createElement("link");
1229    link.rel = "stylesheet";
1230    link.href = href;
1231    link.onerror = reject;
1232    link.onload = resolve;
1233    document.head.appendChild(link);
1234  });
1235}
1236
1237function tex(require) {
1238  return Promise.all([
1239    require(katex.resolve()),
1240    require.resolve(katex.resolve("dist/katex.min.css")).then(style)
1241  ]).then(function(values) {
1242    var katex = values[0], tex = renderer();
1243
1244    function renderer(options) {
1245      return function() {
1246        var root = document.createElement("div");
1247        katex.render(raw.apply(String, arguments), root, options);
1248        return root.removeChild(root.firstChild);
1249      };
1250    }
1251
1252    tex.options = renderer;
1253    tex.block = renderer({displayMode: true});
1254    return tex;
1255  });
1256}
1257
1258async function vl(require) {
1259  const [v, vl, api] = await Promise.all([vega, vegalite, vegaliteApi].map(d => require(d.resolve())));
1260  return api.register(v, vl);
1261}
1262
1263function width() {
1264  return observe(function(change) {
1265    var width = change(document.body.clientWidth);
1266    function resized() {
1267      var w = document.body.clientWidth;
1268      if (w !== width) change(width = w);
1269    }
1270    window.addEventListener("resize", resized);
1271    return function() {
1272      window.removeEventListener("resize", resized);
1273    };
1274  });
1275}
1276
1277const __query = Object.assign(
1278  // This function is used by table cells.
1279  async (source, operations, invalidation) => {
1280    const args = makeQueryTemplate(operations, await source);
1281    if (!args) return null; // the empty state
1282    return evaluateQuery(await source, args, invalidation);
1283  },
1284  {
1285    // This function is used by SQL cells.
1286    sql(source, invalidation) {
1287      return async function () {
1288        return evaluateQuery(source, arguments, invalidation);
1289      };
1290    }
1291  }
1292);
1293
1294async function evaluateQuery(source, args, invalidation) {
1295  if (!source) return;
1296
1297  // If this DatabaseClient supports abort and streaming, use that.
1298  if (typeof source.queryTag === "function") {
1299    const abortController = new AbortController();
1300    const options = {signal: abortController.signal};
1301    invalidation.then(() => abortController.abort("invalidated"));
1302    if (typeof source.queryStream === "function") {
1303      return accumulateQuery(
1304        source.queryStream(...source.queryTag.apply(source, args), options)
1305      );
1306    }
1307    if (typeof source.query === "function") {
1308      return source.query(...source.queryTag.apply(source, args), options);
1309    }
1310  }
1311
1312  // Otherwise, fallback to the basic sql tagged template literal.
1313  if (typeof source.sql === "function") {
1314    return source.sql.apply(source, args);
1315  }
1316
1317  // TODO: test if source is a file attachment, and support CSV etc.
1318  throw new Error("source does not implement query, queryStream, or sql");
1319}
1320
1321// Generator function that yields accumulated query results client.queryStream
1322async function* accumulateQuery(queryRequest) {
1323  const queryResponse = await queryRequest;
1324  const values = [];
1325  values.done = false;
1326  values.error = null;
1327  values.schema = queryResponse.schema;
1328  try {
1329    const iterator = queryResponse.readRows();
1330    do {
1331      const result = await iterator.next();
1332      if (result.done) {
1333        values.done = true;
1334      } else {
1335        for (const value of result.value) {
1336          values.push(value);
1337        }
1338      }
1339      yield values;
1340    } while (!values.done);
1341  } catch (error) {
1342    values.error = error;
1343    yield values;
1344  }
1345}
1346
1347/**
1348 * Returns a SQL query in the form [[parts], ...params] where parts is an array
1349 * of sub-strings and params are the parameter values to be inserted between each
1350 * sub-string.
1351 */
1352 function makeQueryTemplate(operations, source) {
1353  const escaper =
1354    source && typeof source.escape === "function" ? source.escape : (i) => i;
1355  const {select, from, filter, sort, slice} = operations;
1356  if (
1357    from.table === null ||
1358    select.columns === null ||
1359    (select.columns && select.columns.length === 0)
1360  )
1361    return;
1362  const columns = select.columns.map((c) => `t.${escaper(c)}`);
1363  const args = [
1364    [`SELECT ${columns} FROM ${formatTable(from.table, escaper)} t`]
1365  ];
1366  for (let i = 0; i < filter.length; ++i) {
1367    appendSql(i ? `\nAND ` : `\nWHERE `, args);
1368    appendWhereEntry(filter[i], args);
1369  }
1370  for (let i = 0; i < sort.length; ++i) {
1371    appendSql(i ? `, ` : `\nORDER BY `, args);
1372    appendOrderBy(sort[i], args);
1373  }
1374  if (slice.to !== null || slice.from !== null) {
1375    appendSql(
1376      `\nLIMIT ${slice.to !== null ? slice.to - (slice.from || 0) : 1e9}`,
1377      args
1378    );
1379  }
1380  if (slice.from !== null) {
1381    appendSql(` OFFSET ${slice.from}`, args);
1382  }
1383  return args;
1384}
1385
1386function formatTable(table, escaper) {
1387  if (typeof table === "object") {
1388    let from = "";
1389    if (table.database != null) from += escaper(table.database) + ".";
1390    if (table.schema != null) from += escaper(table.schema) + ".";
1391    from += escaper(table.table);
1392    return from;
1393  }
1394  return table;
1395}
1396
1397function appendSql(sql, args) {
1398  const strings = args[0];
1399  strings[strings.length - 1] += sql;
1400}
1401
1402function appendOrderBy({column, direction}, args) {
1403  appendSql(`t.${column} ${direction.toUpperCase()}`, args);
1404}
1405
1406function appendWhereEntry({type, operands}, args) {
1407  if (operands.length < 1) throw new Error("Invalid operand length");
1408
1409  // Unary operations
1410  if (operands.length === 1) {
1411    appendOperand(operands[0], args);
1412    switch (type) {
1413      case "n":
1414        appendSql(` IS NULL`, args);
1415        return;
1416      case "nn":
1417        appendSql(` IS NOT NULL`, args);
1418        return;
1419      default:
1420        throw new Error("Invalid filter operation");
1421    }
1422  }
1423
1424  // Binary operations
1425  if (operands.length === 2) {
1426    if (["in", "nin"].includes(type)) ; else if (["c", "nc"].includes(type)) {
1427      // TODO: Case (in)sensitive?
1428      appendOperand(operands[0], args);
1429      switch (type) {
1430        case "c":
1431          appendSql(` LIKE `, args);
1432          break;
1433        case "nc":
1434          appendSql(` NOT LIKE `, args);
1435          break;
1436      }
1437      appendOperand(likeOperand(operands[1]), args);
1438      return;
1439    } else {
1440      appendOperand(operands[0], args);
1441      switch (type) {
1442        case "eq":
1443          appendSql(` = `, args);
1444          break;
1445        case "ne":
1446          appendSql(` <> `, args);
1447          break;
1448        case "gt":
1449          appendSql(` > `, args);
1450          break;
1451        case "lt":
1452          appendSql(` < `, args);
1453          break;
1454        case "gte":
1455          appendSql(` >= `, args);
1456          break;
1457        case "lte":
1458          appendSql(` <= `, args);
1459          break;
1460        default:
1461          throw new Error("Invalid filter operation");
1462      }
1463      appendOperand(operands[1], args);
1464      return;
1465    }
1466  }
1467
1468  // List operations
1469  appendOperand(operands[0], args);
1470  switch (type) {
1471    case "in":
1472      appendSql(` IN (`, args);
1473      break;
1474    case "nin":
1475      appendSql(` NOT IN (`, args);
1476      break;
1477    default:
1478      throw new Error("Invalid filter operation");
1479  }
1480  appendListOperands(operands.slice(1), args);
1481  appendSql(")", args);
1482}
1483
1484function appendOperand(o, args) {
1485  if (o.type === "column") {
1486    appendSql(`t.${o.value}`, args);
1487  } else {
1488    args.push(o.value);
1489    args[0].push("");
1490  }
1491}
1492
1493// TODO: Support column operands here?
1494function appendListOperands(ops, args) {
1495  let first = true;
1496  for (const op of ops) {
1497    if (first) first = false;
1498    else appendSql(",", args);
1499    args.push(op.value);
1500    args[0].push("");
1501  }
1502}
1503
1504function likeOperand(operand) {
1505  return {...operand, value: `%${operand.value}%`};
1506}
1507
1508var Library = Object.assign(Object.defineProperties(function Library(resolver) {
1509  const require = requirer(resolver);
1510  Object.defineProperties(this, properties({
1511    FileAttachment: () => NoFileAttachments,
1512    Mutable: () => Mutable,
1513    now,
1514    width,
1515
1516    // Tagged template literals
1517    dot: () => require(graphviz.resolve()),
1518    htl: () => require(htl.resolve()),
1519    html: () => html$1,
1520    md: () => md(require),
1521    svg: () => svg,
1522    tex: () => tex(require),
1523
1524    // Recommended libraries
1525    // https://observablehq.com/@observablehq/recommended-libraries
1526    _: () => require(lodash.resolve()),
1527    aq: () => require.alias({"apache-arrow": arrow$1.resolve()})(arquero.resolve()),
1528    Arrow: () => require(arrow$1.resolve()),
1529    d3: () => require(d3.resolve()),
1530    Inputs: () => require(inputs.resolve()).then(Inputs => ({...Inputs, file: Inputs.fileOf(AbstractFile)})),
1531    L: () => leaflet(require),
1532    mermaid: () => mermaid(require),
1533    Plot: () => require(plot.resolve()),
1534    __query: () => __query,
1535    require: () => require,
1536    resolve: () => resolve, // deprecated; use async require.resolve instead
1537    SQLite: () => sqlite(require),
1538    SQLiteDatabaseClient: () => SQLiteDatabaseClient$1,
1539    topojson: () => require(topojson.resolve()),
1540    vl: () => vl(require),
1541
1542    // Sample datasets
1543    // https://observablehq.com/@observablehq/datasets
1544    aapl: () => new FileAttachment("https://static.observableusercontent.com/files/3ccff97fd2d93da734e76829b2b066eafdaac6a1fafdec0faf6ebc443271cfc109d29e80dd217468fcb2aff1e6bffdc73f356cc48feb657f35378e6abbbb63b9").csv({typed: true}),
1545    alphabet: () => new FileAttachment("https://static.observableusercontent.com/files/75d52e6c3130b1cae83cda89305e17b50f33e7420ef205587a135e8562bcfd22e483cf4fa2fb5df6dff66f9c5d19740be1cfaf47406286e2eb6574b49ffc685d").csv({typed: true}),
1546    cars: () => new FileAttachment("https://static.observableusercontent.com/files/048ec3dfd528110c0665dfa363dd28bc516ffb7247231f3ab25005036717f5c4c232a5efc7bb74bc03037155cb72b1abe85a33d86eb9f1a336196030443be4f6").csv({typed: true}),
1547    citywages: () => new FileAttachment("https://static.observableusercontent.com/files/39837ec5121fcc163131dbc2fe8c1a2e0b3423a5d1e96b5ce371e2ac2e20a290d78b71a4fb08b9fa6a0107776e17fb78af313b8ea70f4cc6648fad68ddf06f7a").csv({typed: true}),
1548    diamonds: () => new FileAttachment("https://static.observableusercontent.com/files/87942b1f5d061a21fa4bb8f2162db44e3ef0f7391301f867ab5ba718b225a63091af20675f0bfe7f922db097b217b377135203a7eab34651e21a8d09f4e37252").csv({typed: true}),
1549    flare: () => new FileAttachment("https://static.observableusercontent.com/files/a6b0d94a7f5828fd133765a934f4c9746d2010e2f342d335923991f31b14120de96b5cb4f160d509d8dc627f0107d7f5b5070d2516f01e4c862b5b4867533000").csv({typed: true}),
1550    industries: () => new FileAttachment("https://static.observableusercontent.com/files/76f13741128340cc88798c0a0b7fa5a2df8370f57554000774ab8ee9ae785ffa2903010cad670d4939af3e9c17e5e18e7e05ed2b38b848ac2fc1a0066aa0005f").csv({typed: true}),
1551    miserables: () => new FileAttachment("https://static.observableusercontent.com/files/31d904f6e21d42d4963ece9c8cc4fbd75efcbdc404bf511bc79906f0a1be68b5a01e935f65123670ed04e35ca8cae3c2b943f82bf8db49c5a67c85cbb58db052").json(),
1552    olympians: () => new FileAttachment("https://static.observableusercontent.com/files/31ca24545a0603dce099d10ee89ee5ae72d29fa55e8fc7c9ffb5ded87ac83060d80f1d9e21f4ae8eb04c1e8940b7287d179fe8060d887fb1f055f430e210007c").csv({typed: true}),
1553    penguins: () => new FileAttachment("https://static.observableusercontent.com/files/715db1223e067f00500780077febc6cebbdd90c151d3d78317c802732252052ab0e367039872ab9c77d6ef99e5f55a0724b35ddc898a1c99cb14c31a379af80a").csv({typed: true}),
1554    weather: () => new FileAttachment("https://static.observableusercontent.com/files/693a46b22b33db0f042728700e0c73e836fa13d55446df89120682d55339c6db7cc9e574d3d73f24ecc9bc7eb9ac9a1e7e104a1ee52c00aab1e77eb102913c1f").csv({typed: true}),
1555
1556    // Note: these are namespace objects, and thus exposed directly rather than
1557    // being wrapped in a function. This allows library.Generators to resolve,
1558    // rather than needing module.value.
1559    DOM,
1560    Files,
1561    Generators: Generators$1,
1562    Promises
1563  }));
1564}, {
1565  resolve: {
1566    get: () => requireDefault.resolve,
1567    enumerable: true,
1568    configurable: true
1569  },
1570  require: {
1571    get: () => requireDefault,
1572    set: setDefaultRequire,
1573    enumerable: true,
1574    configurable: true
1575  }
1576}), {
1577  resolveFrom,
1578  requireFrom
1579});
1580
1581function properties(values) {
1582  return Object.fromEntries(Object.entries(values).map(property));
1583}
1584
1585function property([key, value]) {
1586  return [key, ({value, writable: true, enumerable: true})];
1587}
1588
1589// src/main.js
1590class PandocCodeDecorator {
1591  constructor(node) {
1592    this._node = node;
1593    this._spans = [];
1594    this.normalizeCodeRange();
1595    this.initializeEntryPoints();
1596  }
1597  normalizeCodeRange() {
1598    const n = this._node;
1599    const lines = n.querySelectorAll("code > span");
1600    for (const line of lines) {
1601      Array.from(line.childNodes).filter((n2) =>
1601 n2.nodeType === n2.TEXT_NODE).forEach((n2) => {
1602        const newSpan = document.createElement("span");
1603        newSpan.textContent = n2.wholeText;
1604        n2.replaceWith(newSpan);
1605      });
1606    }
1607  }
1608  initializeEntryPoints() {
1609    const lines = this._node.querySelectorAll("code > span");
1610    let result = [];
1611    let offset = this._node.parentElement.dataset.sourceOffset && -Number(this._node.parentElement.dataset.sourceOffset) || 0;
1612    for (const line of lines) {
1613      let lineNumber = Number(line.id.split("-").pop());
1614      let column = 1;
1615      Array.from(line.childNodes).filter((n) => n.nodeType === n.ELEMENT_NODE && n.nodeName === "SPAN").forEach((n) => {
1616        result.push({
1617          offset,
1618          line: lineNumber,
1619          column,
1620          node: n
1621        });
1622        offset += n.textContent.length;
1623        column += n.textContent.length;
1624      });
1625      offset += 1;
1626    }
1627    this._elementEntryPoints = result;
1628  }
1629  locateEntry(offset) {
1630    let candidate;
1631    if (offset === Infinity)
1632      return void 0;
1633    for (let i = 0; i < this._elementEntryPoints.length; ++i) {
1634      const entry = this._elementEntryPoints[i];
1635      if (entry.offset > offset) {
1636        return { entry: candidate, index: i - 1 };
1637      }
1638      candidate = entry;
1639    }
1640    if (offset < candidate.offset + candidate.node.textContent.length) {
1641      return { entry: candidate, index: this._elementEntryPoints.length - 1 };
1642    } else {
1643      return void 0;
1644    }
1645  }
1646  offsetToLineColumn(offset) {
1647    let entry = this.locateEntry(offset);
1648    if (entry === void 0) {
1649      const entries = this._elementEntryPoints;
1650      const last = entries[entries.length - 1];
1651      return {
1652        line: last.line,
1653        column: last.column + Math.min(last.node.textContent.length, offset - last.offset)
1654      };
1655    }
1656    return {
1657      line: entry.entry.line,
1658      column: entry.entry.column + offset - entry.entry.offset
1659    };
1660  }
1661  *spanSelection(start, end) {
1662    this.ensureExactSpan(start, end);
1663    const startEntry = this.locateEntry(start);
1664    const endEntry = this.locateEntry(end);
1665    if (startEntry === void 0) {
1666      return;
1667    }
1668    const startIndex = startEntry.index;
1669    const endIndex = endEntry && endEntry.index || this._elementEntryPoints.length;
1670    for (let i = startIndex; i < endIndex; ++i) {
1671      if (this._elementEntryPoints[i] !== void 0) {
1672        yield this._elementEntryPoints[i];
1673      }
1674    }
1675  }
1676  decorateSpan(start, end, classes) {
1677    for (const entryPoint of this.spanSelection(start, end)) {
1678      for (const cssClass of classes) {
1679        entryPoint.node.classList.add(cssClass);
1680      }
1681    }
1682  }
1683  clearSpan(start, end, classes) {
1684    for (const entryPoint of this.spanSelection(start, end)) {
1685      for (const cssClass of classes) {
1686        entryPoint.node.classList.remove(cssClass);
1687      }
1688    }
1689  }
1690  ensureExactSpan(start, end) {
1691    const splitEntry = (entry, offset) => {
1692      const newSpan = document.createElement("span");
1693      for (const cssClass of entry.node.classList) {
1694        newSpan.classList.add(cssClass);
1695      }
1696      const beforeText = entry.node.textContent.slice(0, offset - entry.offset);
1697      const afterText = entry.node.textContent.slice(offset - entry.offset);
1698      entry.node.textContent = beforeText;
1699      newSpan.textContent = afterText;
1700      entry.node.after(newSpan);
1701      this._elementEntryPoints.push({
1702        column: entry.column + offset - entry.offset,
1703        line: entry.line,
1704        node: newSpan,
1705        offset
1706      });
1707      this._elementEntryPoints.sort((a, b) => a.offset - b.offset);
1708    };
1709    const startEntry = this.locateEntry(start);
1710    if (startEntry !== void 0 && startEntry.entry !== void 0 && startEntry.entry.offset != start) {
1711      splitEntry(startEntry.entry, start);
1712    }
1713    const endEntry = this.locateEntry(end);
1714    if (endEntry !== void 0 && startEntry.entry !== void 0 && endEntry.entry.offset !== end) {
1715      splitEntry(endEntry.entry, end);
1716    }
1717  }
1718  clearSpan(start, end, classes) {
1719    this.ensureExactSpan(start, end);
1720    const startEntry = this.locateEntry(start);
1721    const endEntry = this.locateEntry(end);
1722    if (startEntry === void 0) {
1723      return;
1724    }
1725    const startIndex = startEntry.index;
1726    const endIndex = endEntry && endEntry.index || this._elementEntryPoints.length;
1727    for (let i = startIndex; i < endIndex; ++i) {
1728      for (const cssClass of classes) {
1729        this._elementEntryPoints[i].node.classList.remove(cssClass);
1730      }
1731    }
1732  }
1733}
1734
1735function dispatch(node, type, detail) {
1736  detail = detail || {};
1737  var document = node.ownerDocument, event = document.defaultView.CustomEvent;
1738  if (typeof event === "function") {
1739    event = new event(type, {detail: detail});
1740  } else {
1741    event = document.createEvent("Event");
1742    event.initEvent(type, false, false);
1743    event.detail = detail;
1744  }
1745  node.dispatchEvent(event);
1746}
1747
1748// TODO https://twitter.com/mbostock/status/702737065121742848
1749function isarray(value) {
1750  return Array.isArray(value)
1751      || value instanceof Int8Array
1752      || value instanceof Int16Array
1753      || value instanceof Int32Array
1754      || value instanceof Uint8Array
1755      || value instanceof Uint8ClampedArray
1756      || value instanceof Uint16Array
1757      || value instanceof Uint32Array
1758      || value instanceof Float32Array
1759      || value instanceof Float64Array;
1760}
1761
1762// Non-integer keys in arrays, e.g. [1, 2, 0.5: "value"].
1763function isindex(key) {
1764  return key === (key | 0) + "";
1765}
1766
1767function inspectName(name) {
1768  const n = document.createElement("span");
1769  n.className = "observablehq--cellname";
1770  n.textContent = `${name} = `;
1771  return n;
1772}
1773
1774const symbolToString = Symbol.prototype.toString;
1775
1776// Symbols do not coerce to strings; they must be explicitly converted.
1777function formatSymbol(symbol) {
1778  return symbolToString.call(symbol);
1779}
1780
1781const {getOwnPropertySymbols, prototype: {hasOwnProperty: hasOwnProperty$1}} = Object;
1782const {toStringTag} = Symbol;
1783
1784const FORBIDDEN = {};
1785
1786const symbolsof = getOwnPropertySymbols;
1787
1788function isown(object, key) {
1789  return hasOwnProperty$1.call(object, key);
1790}
1791
1792function tagof(object) {
1793  return object[toStringTag]
1794      || (object.constructor && object.constructor.name)
1795      || "Object";
1796}
1797
1798function valueof(object, key) {
1799  try {
1800    const value = object[key];
1801    if (value) value.constructor; // Test for SecurityError.
1802    return value;
1803  } catch (ignore) {
1804    return FORBIDDEN;
1805  }
1806}
1807
1808const SYMBOLS = [
1809  { symbol: "@@__IMMUTABLE_INDEXED__@@", name: "Indexed", modifier: true },
1810  { symbol: "@@__IMMUTABLE_KEYED__@@", name: "Keyed", modifier: true },
1811  { symbol: "@@__IMMUTABLE_LIST__@@", name: "List", arrayish: true },
1812  { symbol: "@@__IMMUTABLE_MAP__@@", name: "Map" },
1813  {
1814    symbol: "@@__IMMUTABLE_ORDERED__@@",
1815    name: "Ordered",
1816    modifier: true,
1817    prefix: true
1818  },
1819  { symbol: "@@__IMMUTABLE_RECORD__@@", name: "Record" },
1820  {
1821    symbol: "@@__IMMUTABLE_SET__@@",
1822    name: "Set",
1823    arrayish: true,
1824    setish: true
1825  },
1826  { symbol: "@@__IMMUTABLE_STACK__@@", name: "Stack", arrayish: true }
1827];
1828
1829function immutableName(obj) {
1830  try {
1831    let symbols = SYMBOLS.filter(({ symbol }) => obj[symbol] === true);
1832    if (!symbols.length) return;
1833
1834    const name = symbols.find(s => !s.modifier);
1835    const prefix =
1836      name.name === "Map" && symbols.find(s => s.modifier && s.prefix);
1837
1838    const arrayish = symbols.some(s => s.arrayish);
1839    const setish = symbols.some(s => s.setish);
1840
1841    return {
1842      name: `${prefix ? prefix.name : ""}${name.name}`,
1843      symbols,
1844      arrayish: arrayish && !setish,
1845      setish
1846    };
1847  } catch (e) {
1848    return null;
1849  }
1850}
1851
1852const {getPrototypeOf, getOwnPropertyDescriptors} = Object;
1853const objectPrototype = getPrototypeOf({});
1854
1855function inspectExpanded(object, _, name, proto) {
1856  let arrayish = isarray(object);
1857  let tag, fields, next, n;
1858
1859  if (object instanceof Map) {
1860    if (object instanceof object.constructor) {
1861      tag = `Map(${object.size})`;
1862      fields = iterateMap$1;
1863    } else { // avoid incompatible receiver error for prototype
1864      tag = "Map()";
1865      fields = iterateObject$1;
1866    }
1867  } else if (object instanceof Set) {
1868    if (object instanceof object.constructor) {
1869      tag = `Set(${object.size})`;
1870      fields = iterateSet$1;
1871    } else { // avoid incompatible receiver error for prototype
1872      tag = "Set()";
1873      fields = iterateObject$1;
1874    }
1875  } else if (arrayish) {
1876    tag = `${object.constructor.name}(${object.length})`;
1877    fields = iterateArray$1;
1878  } else if ((n = immutableName(object))) {
1879    tag = `Immutable.${n.name}${n.name === "Record" ? "" : `(${object.size})`}`;
1880    arrayish = n.arrayish;
1881    fields = n.arrayish
1882      ? iterateImArray$1
1883      : n.setish
1884      ? iterateImSet$1
1885      : iterateImObject$1;
1886  } else if (proto) {
1887    tag = tagof(object);
1888    fields = iterateProto;
1889  } else {
1890    tag = tagof(object);
1891    fields = iterateObject$1;
1892  }
1893
1894  const span = document.createElement("span");
1895  span.className = "observablehq--expanded";
1896  if (name) {
1897    span.appendChild(inspectName(name));
1898  }
1899  const a = span.appendChild(document.createElement("a"));
1900  a.innerHTML = `<svg width=8 height=8 class='observablehq--caret'>
1901    <path d='M4 7L0 1h8z' fill='currentColor' />
1902  </svg>`;
1903  a.appendChild(document.createTextNode(`${tag}${arrayish ? " [" : " {"}`));
1904  a.addEventListener("mouseup", function(event) {
1905    event.stopPropagation();
1906    replace(span, inspectCollapsed(object, null, name, proto));
1907  });
1908
1909  fields = fields(object);
1910  for (let i = 0; !(next = fields.next()).done && i < 20; ++i) {
1911    span.appendChild(next.value);
1912  }
1913
1914  if (!next.done) {
1915    const a = span.appendChild(document.createElement("a"));
1916    a.className = "observablehq--field";
1917    a.style.display = "block";
1918    a.appendChild(document.createTextNode(`  … more`));
1919    a.addEventListener("mouseup", function(event) {
1920      event.stopPropagation();
1921      span.insertBefore(next.value, span.lastChild.previousSibling);
1922      for (let i = 0; !(next = fields.next()).done && i < 19; ++i) {
1923        span.insertBefore(next.value, span.lastChild.previousSibling);
1924      }
1925      if (next.done) span.removeChild(span.lastChild.previousSibling);
1926      dispatch(span, "load");
1927    });
1928  }
1929
1930  span.appendChild(document.createTextNode(arrayish ? "]" : "}"));
1931
1932  return span;
1933}
1934
1935function* iterateMap$1(map) {
1936  for (const [key, value] of map) {
1937    yield formatMapField$1(key, value);
1938  }
1939  yield* iterateObject$1(map);
1940}
1941
1942function* iterateSet$1(set) {
1943  for (const value of set) {
1944    yield formatSetField(value);
1945  }
1946  yield* iterateObject$1(set);
1947}
1948
1949function* iterateImSet$1(set) {
1950  for (const value of set) {
1951    yield formatSetField(value);
1952  }
1953}
1954
1955function* iterateArray$1(array) {
1956  for (let i = 0, n = array.length; i < n; ++i) {
1957    if (i in array) {
1958      yield formatField$1(i, valueof(array, i), "observablehq--index");
1959    }
1960  }
1961  for (const key in array) {
1962    if (!isindex(key) && isown(array, key)) {
1963      yield formatField$1(key, valueof(array, key), "observablehq--key");
1964    }
1965  }
1966  for (const symbol of symbolsof(array)) {
1967    yield formatField$1(
1968      formatSymbol(symbol),
1969      valueof(array, symbol),
1970      "observablehq--symbol"
1971    );
1972  }
1973}
1974
1975function* iterateImArray$1(array) {
1976  let i1 = 0;
1977  for (const n = array.size; i1 < n; ++i1) {
1978    yield formatField$1(i1, array.get(i1), true);
1979  }
1980}
1981
1982function* iterateProto(object) {
1983  for (const key in getOwnPropertyDescriptors(object)) {
1984    yield formatField$1(key, valueof(object, key), "observablehq--key");
1985  }
1986  for (const symbol of symbolsof(object)) {
1987    yield formatField$1(
1988      formatSymbol(symbol),
1989      valueof(object, symbol),
1990      "observablehq--symbol"
1991    );
1992  }
1993
1994  const proto = getPrototypeOf(object);
1995  if (proto && proto !== objectPrototype) {
1996    yield formatPrototype(proto);
1997  }
1998}
1999
2000function* iterateObject$1(object) {
2001  for (const key in object) {
2002    if (isown(object, key)) {
2003      yield formatField$1(key, valueof(object, key), "observablehq--key");
2004    }
2005  }
2006  for (const symbol of symbolsof(object)) {
2007    yield formatField$1(
2008      formatSymbol(symbol),
2009      valueof(object, symbol),
2010      "observablehq--symbol"
2011    );
2012  }
2013
2014  const proto = getPrototypeOf(object);
2015  if (proto && proto !== objectPrototype) {
2016    yield formatPrototype(proto);
2017  }
2018}
2019
2020function* iterateImObject$1(object) {
2021  for (const [key, value] of object) {
2022    yield formatField$1(key, value, "observablehq--key");
2023  }
2024}
2025
2026function formatPrototype(value) {
2027  const item = document.createElement("div");
2028  const span = item.appendChild(document.createElement("span"));
2029  item.className = "observablehq--field";
2030  span.className = "observablehq--prototype-key";
2031  span.textContent = `  <prototype>`;
2032  item.appendChild(document.createTextNode(": "));
2033  item.appendChild(inspect(value, undefined, undefined, undefined, true));
2034  return item;
2035}
2036
2037function formatField$1(key, value, className) {
2038  const item = document.createElement("div");
2039  const span = item.appendChild(document.createElement("span"));
2040  item.className = "observablehq--field";
2041  span.className = className;
2042  span.textContent = `  ${key}`;
2043  item.appendChild(document.createTextNode(": "));
2044  item.appendChild(inspect(value));
2045  return item;
2046}
2047
2048function formatMapField$1(key, value) {
2049  const item = document.createElement("div");
2050  item.className = "observablehq--field";
2051  item.appendChild(document.createTextNode("  "));
2052  item.appendChild(inspect(key));
2053  item.appendChild(document.createTextNode(" => "));
2054  item.appendChild(inspect(value));
2055  return item;
2056}
2057
2058function formatSetField(value) {
2059  const item = document.createElement("div");
2060  item.className = "observablehq--field";
2061  item.appendChild(document.createTextNode("  "));
2062  item.appendChild(inspect(value));
2063  return item;
2064}
2065
2066function hasSelection(elem) {
2067  const sel = window.getSelection();
2068  return (
2069    sel.type === "Range" &&
2070    (sel.containsNode(elem, true) ||
2071      sel.anchorNode.isSelfOrDescendant(elem) ||
2072      sel.focusNode.isSelfOrDescendant(elem))
2073  );
2074}
2075
2076function inspectCollapsed(object, shallow, name, proto) {
2077  let arrayish = isarray(object);
2078  let tag, fields, next, n;
2079
2080  if (object instanceof Map) {
2081    if (object instanceof object.constructor) {
2082      tag = `Map(${object.size})`;
2083      fields = iterateMap;
2084    } else { // avoid incompatible receiver error for prototype
2085      tag = "Map()";
2086      fields = iterateObject;
2087    }
2088  } else if (object instanceof Set) {
2089    if (object instanceof object.constructor) {
2090      tag = `Set(${object.size})`;
2091      fields = iterateSet;
2092    } else { // avoid incompatible receiver error for prototype
2093      tag = "Set()";
2094      fields = iterateObject;
2095    }
2096  } else if (arrayish) {
2097    tag = `${object.constructor.name}(${object.length})`;
2098    fields = iterateArray;
2099  } else if ((n = immutableName(object))) {
2100    tag = `Immutable.${n.name}${n.name === 'Record' ? '' : `(${object.size})`}`;
2101    arrayish = n.arrayish;
2102    fields = n.arrayish ? iterateImArray : n.setish ? iterateImSet : iterateImObject;
2103  } else {
2104    tag = tagof(object);
2105    fields = iterateObject;
2106  }
2107
2108  if (shallow) {
2109    const span = document.createElement("span");
2110    span.className = "observablehq--shallow";
2111    if (name) {
2112      span.appendChild(inspectName(name));
2113    }
2114    span.appendChild(document.createTextNode(tag));
2115    span.addEventListener("mouseup", function(event) {
2116      if (hasSelection(span)) return;
2117      event.stopPropagation();
2118      replace(span, inspectCollapsed(object));
2119    });
2120    return span;
2121  }
2122
2123  const span = document.createElement("span");
2124  span.className = "observablehq--collapsed";
2125  if (name) {
2126    span.appendChild(inspectName(name));
2127  }
2128  const a = span.appendChild(document.createElement("a"));
2129  a.innerHTML = `<svg width=8 height=8 class='observablehq--caret'>
2130    <path d='M7 4L1 8V0z' fill='currentColor' />
2131  </svg>`;
2132  a.appendChild(document.createTextNode(`${tag}${arrayish ? " [" : " {"}`));
2133  span.addEventListener("mouseup", function(event) {
2134    if (hasSelection(span)) return;
2135    event.stopPropagation();
2136    replace(span, inspectExpanded(object, null, name, proto));
2137  }, true);
2138
2139  fields = fields(object);
2140  for (let i = 0; !(next = fields.next()).done && i < 20; ++i) {
2141    if (i > 0) span.appendChild(document.createTextNode(", "));
2142    span.appendChild(next.value);
2143  }
2144
2145  if (!next.done) span.appendChild(document.createTextNode(", …"));
2146  span.appendChild(document.createTextNode(arrayish ? "]" : "}"));
2147
2148  return span;
2149}
2150
2151function* iterateMap(map) {
2152  for (const [key, value] of map) {
2153    yield formatMapField(key, value);
2154  }
2155  yield* iterateObject(map);
2156}
2157
2158function* iterateSet(set) {
2159  for (const value of set) {
2160    yield inspect(value, true);
2161  }
2162  yield* iterateObject(set);
2163}
2164
2165function* iterateImSet(set) {
2166  for (const value of set) {
2167    yield inspect(value, true);
2168  }
2169}
2170
2171function* iterateImArray(array) {
2172  let i0 = -1, i1 = 0;
2173  for (const n = array.size; i1 < n; ++i1) {
2174    if (i1 > i0 + 1) yield formatEmpty(i1 - i0 - 1);
2175    yield inspect(array.get(i1), true);
2176    i0 = i1;
2177  }
2178  if (i1 > i0 + 1) yield formatEmpty(i1 - i0 - 1);
2179}
2180
2181function* iterateArray(array) {
2182  let i0 = -1, i1 = 0;
2183  for (const n = array.length; i1 < n; ++i1) {
2184    if (i1 in array) {
2185      if (i1 > i0 + 1) yield formatEmpty(i1 - i0 - 1);
2186      yield inspect(valueof(array, i1), true);
2187      i0 = i1;
2188    }
2189  }
2190  if (i1 > i0 + 1) yield formatEmpty(i1 - i0 - 1);
2191  for (const key in array) {
2192    if (!isindex(key) && isown(array, key)) {
2193      yield formatField(key, valueof(array, key), "observablehq--key");
2194    }
2195  }
2196  for (const symbol of symbolsof(array)) {
2197    yield formatField(formatSymbol(symbol), valueof(array, symbol), "observablehq--symbol");
2198  }
2199}
2200
2201function* iterateObject(object) {
2202  for (const key in object) {
2203    if (isown(object, key)) {
2204      yield formatField(key, valueof(object, key), "observablehq--key");
2205    }
2206  }
2207  for (const symbol of symbolsof(object)) {
2208    yield formatField(formatSymbol(symbol), valueof(object, symbol), "observablehq--symbol");
2209  }
2210}
2211
2212function* iterateImObject(object) {
2213  for (const [key, value] of object) {
2214    yield formatField(key, value, "observablehq--key");
2215  }
2216}
2217
2218function formatEmpty(e) {
2219  const span = document.createElement("span");
2220  span.className = "observablehq--empty";
2221  span.textContent = e === 1 ? "empty" : `empty × ${e}`;
2222  return span;
2223}
2224
2225function formatField(key, value, className) {
2226  const fragment = document.createDocumentFragment();
2227  const span = fragment.appendChild(document.createElement("span"));
2228  span.className = className;
2229  span.textContent = key;
2230  fragment.appendChild(document.createTextNode(": "));
2231  fragment.appendChild(inspect(value, true));
2232  return fragment;
2233}
2234
2235function formatMapField(key, value) {
2236  const fragment = document.createDocumentFragment();
2237  fragment.appendChild(inspect(key, true));
2238  fragment.appendChild(document.createTextNode(" => "));
2239  fragment.appendChild(inspect(value, true));
2240  return fragment;
2241}
2242
2243function format(date, fallback) {
2244  if (!(date instanceof Date)) date = new Date(+date);
2245  if (isNaN(date)) return typeof fallback === "function" ? fallback(date) : fallback;
2246  const hours = date.getUTCHours();
2247  const minutes = date.getUTCMinutes();
2248  const seconds = date.getUTCSeconds();
2249  const milliseconds = date.getUTCMilliseconds();
2250  return `${formatYear(date.getUTCFullYear())}-${pad(date.getUTCMonth() + 1, 2)}-${pad(date.getUTCDate(), 2)}${
2251    hours || minutes || seconds || milliseconds ? `T${pad(hours, 2)}:${pad(minutes, 2)}${
2252      seconds || milliseconds ? `:${pad(seconds, 2)}${
2253        milliseconds ? `.${pad(milliseconds, 3)}` : ``
2254      }` : ``
2255    }Z` : ``
2256  }`;
2257}
2258
2259function formatYear(year) {
2260  return year < 0 ? `-${pad(-year, 6)}`
2261    : year > 9999 ? `+${pad(year, 6)}`
2262    : pad(year, 4);
2263}
2264
2265function pad(value, width) {
2266  return `${value}`.padStart(width, "0");
2267}
2268
2269function formatDate$1(date) {
2270  return format(date, "Invalid Date");
2271}
2272
2273var errorToString = Error.prototype.toString;
2274
2275function formatError(value) {
2276  return value.stack || errorToString.call(value);
2277}
2278
2279var regExpToString = RegExp.prototype.toString;
2280
2281function formatRegExp(value) {
2282  return regExpToString.call(value);
2283}
2284
2285/* eslint-disable no-control-regex */
2286const NEWLINE_LIMIT = 20;
2287
2288function formatString(string, shallow, expanded, name) {
2289  if (shallow === false) {
2290    // String has fewer escapes displayed with double quotes
2291    if (count(string, /["\n]/g) <= count(string, /`|\${/g)) {
2292      const span = document.createElement("span");
2293      if (name) span.appendChild(inspectName(name));
2294      const textValue = span.appendChild(document.createElement("span"));
2295      textValue.className = "observablehq--string";
2296      textValue.textContent = JSON.stringify(string);
2297      return span;
2298    }
2299    const lines = string.split("\n");
2300    if (lines.length > NEWLINE_LIMIT && !expanded) {
2301      const div = document.createElement("div");
2302      if (name) div.appendChild(inspectName(name));
2303      const textValue = div.appendChild(document.createElement("span"));
2304      textValue.className = "observablehq--string";
2305      textValue.textContent = "`" + templatify(lines.slice(0, NEWLINE_LIMIT).join("\n"));
2306      const splitter = div.appendChild(document.createElement("span"));
2307      const truncatedCount = lines.length - NEWLINE_LIMIT;
2308      splitter.textContent = `Show ${truncatedCount} truncated line${truncatedCount > 1 ? "s": ""}`; splitter.className = "observablehq--string-expand";
2309      splitter.addEventListener("mouseup", function (event) {
2310        event.stopPropagation();
2311        replace(div, inspect(string, shallow, true, name));
2312      });
2313      return div;
2314    }
2315    const span = document.createElement("span");
2316    if (name) span.appendChild(inspectName(name));
2317    const textValue = span.appendChild(document.createElement("span"));
2318    textValue.className = `observablehq--string${expanded ? " observablehq--expanded" : ""}`;
2319    textValue.textContent = "`" + templatify(string) + "`";
2320    return span;
2321  }
2322
2323  const span = document.createElement("span");
2324  if (name) span.appendChild(inspectName(name));
2325  const textValue = span.appendChild(document.createElement("span"));
2326  textValue.className = "observablehq--string";
2327  textValue.textContent = JSON.stringify(string.length > 100 ?
2328    `${string.slice(0, 50)}…${string.slice(-49)}` : string);
2329  return span;
2330}
2331
2332function templatify(string) {
2333  return string.replace(/[\\`\x00-\x09\x0b-\x19]|\${/g, templatifyChar);
2334}
2335
2336function templatifyChar(char) {
2337  var code = char.charCodeAt(0);
2338  switch (code) {
2339    case 0x8: return "\\b";
2340    case 0x9: return "\\t";
2341    case 0xb: return "\\v";
2342    case 0xc: return "\\f";
2343    case 0xd: return "\\r";
2344  }
2345  return code < 0x10 ? "\\x0" + code.toString(16)
2346      : code < 0x20 ? "\\x" + code.toString(16)
2347      : "\\" + char;
2348}
2349
2350function count(string, re) {
2351  var n = 0;
2352  while (re.exec(string)) ++n;
2353  return n;
2354}
2355
2356var toString$2 = Function.prototype.toString,
2357    TYPE_ASYNC = {prefix: "async ƒ"},
2358    TYPE_ASYNC_GENERATOR = {prefix: "async ƒ*"},
2359    TYPE_CLASS = {prefix: "class"},
2360    TYPE_FUNCTION = {prefix: "ƒ"},
2361    TYPE_GENERATOR = {prefix: "ƒ*"};
2362
2363function inspectFunction(f, name) {
2364  var type, m, t = toString$2.call(f);
2365
2366  switch (f.constructor && f.constructor.name) {
2367    case "AsyncFunction": type = TYPE_ASYNC; break;
2368    case "AsyncGeneratorFunction": type = TYPE_ASYNC_GENERATOR; break;
2369    case "GeneratorFunction": type = TYPE_GENERATOR; break;
2370    default: type = /^class\b/.test(t) ? TYPE_CLASS : TYPE_FUNCTION; break;
2371  }
2372
2373  // A class, possibly named.
2374  // class Name
2375  if (type === TYPE_CLASS) {
2376    return formatFunction(type, "", name);
2377  }
2378
2379  // An arrow function with a single argument.
2380  // foo =>
2381  // async foo =>
2382  if ((m = /^(?:async\s*)?(\w+)\s*=>/.exec(t))) {
2383    return formatFunction(type, "(" + m[1] + ")", name);
2384  }
2385
2386  // An arrow function with parenthesized arguments.
2387  // (…)
2388  // async (…)
2389  if ((m = /^(?:async\s*)?\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(t))) {
2390    return formatFunction(type, m[1] ? "(" + m[1].replace(/\s*,\s*/g, ", ") + ")" : "()", name);
2391  }
2392
2393  // A function, possibly: async, generator, anonymous, simply arguments.
2394  // function name(…)
2395  // function* name(…)
2396  // async function name(…)
2397  // async function* name(…)
2398  if ((m = /^(?:async\s*)?function(?:\s*\*)?(?:\s*\w+)?\s*\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(t))) {
2399    return formatFunction(type, m[1] ? "(" + m[1].replace(/\s*,\s*/g, ", ") + ")" : "()", name);
2400  }
2401
2402  // Something else, like destructuring, comments or default values.
2403  return formatFunction(type, "(…)", name);
2404}
2405
2406function formatFunction(type, args, cellname) {
2407  var span = document.createElement("span");
2408  span.className = "observablehq--function";
2409  if (cellname) {
2410    span.appendChild(inspectName(cellname));
2411  }
2412  var spanType = span.appendChild(document.createElement("span"));
2413  spanType.className = "observablehq--keyword";
2414  spanType.textContent = type.prefix;
2415  span.appendChild(document.createTextNode(args));
2416  return span;
2417}
2418
2419const {prototype: {toString: toString$1}} = Object;
2420
2421function inspect(value, shallow, expand, name, proto) {
2422  let type = typeof value;
2423  switch (type) {
2424    case "boolean":
2425    case "undefined": { value += ""; break; }
2426    case "number": { value = value === 0 && 1 / value < 0 ? "-0" : value + ""; break; }
2427    case "bigint": { value = value + "n"; break; }
2428    case "symbol": { value = formatSymbol(value); break; }
2429    case "function": { return inspectFunction(value, name); }
2430    case "string": { return formatString(value, shallow, expand, name); }
2431    default: {
2432      if (value === null) { type = null, value = "null"; break; }
2433      if (value instanceof Date) { type = "date", value = formatDate$1(value); break; }
2434      if (value === FORBIDDEN) { type = "forbidden", value = "[forbidden]"; break; }
2435      switch (toString$1.call(value)) {
2436        case "[object RegExp]": { type = "regexp", value = formatRegExp(value); break; }
2437        case "[object Error]": // https://github.com/lodash/lodash/blob/master/isError.js#L26
2438        case "[object DOMException]": { type = "error", value = formatError(value); break; }
2439        default: return (expand ? inspectExpanded : inspectCollapsed)(value, shallow, name, proto);
2440      }
2441      break;
2442    }
2443  }
2444  const span = document.createElement("span");
2445  if (name) span.appendChild(inspectName(name));
2446  const n = span.appendChild(document.createElement("span"));
2447  n.className = `observablehq--${type}`;
2448  n.textContent = value;
2449  return span;
2450}
2451
2452function replace(spanOld, spanNew) {
2453  if (spanOld.classList.contains("observablehq--inspect")) spanNew.classList.add("observablehq--inspect");
2454  spanOld.parentNode.replaceChild(spanNew, spanOld);
2455  dispatch(spanNew, "load");
2456}
2457
2458const LOCATION_MATCH = /\s+\(\d+:\d+\)$/m;
2459
2460class Inspector {
2461  constructor(node) {
2462    if (!node) throw new Error("invalid node");
2463    this._node = node;
2464    node.classList.add("observablehq");
2465  }
2466  pending() {
2467    const {_node} = this;
2468    _node.classList.remove("observablehq--error");
2469    _node.classList.add("observablehq--running");
2470  }
2471  fulfilled(value, name) {
2472    const {_node} = this;
2473    if (!isnode(value) || (value.parentNode && value.parentNode !== _node)) {
2474      value = inspect(value, false, _node.firstChild // TODO Do this better.
2475          && _node.firstChild.classList
2476          && _node.firstChild.classList.contains("observablehq--expanded"), name);
2477      value.classList.add("observablehq--inspect");
2478    }
2479    _node.classList.remove("observablehq--running", "observablehq--error");
2480    if (_node.firstChild !== value) {
2481      if (_node.firstChild) {
2482        while (_node.lastChild !== _node.firstChild) _node.removeChild(_node.lastChild);
2483        _node.replaceChild(value, _node.firstChild);
2484      } else {
2485        _node.appendChild(value);
2486      }
2487    }
2488    dispatch(_node, "update");
2489  }
2490  rejected(error, name) {
2491    const {_node} = this;
2492    _node.classList.remove("observablehq--running");
2493    _node.classList.add("observablehq--error");
2494    while (_node.lastChild) _node.removeChild(_node.lastChild);
2495    var div = document.createElement("div");
2496    div.className = "observablehq--inspect";
2497    if (name) div.appendChild(inspectName(name));
2498    div.appendChild(document.createTextNode((error + "").replace(LOCATION_MATCH, "")));
2499    _node.appendChild(div);
2500    dispatch(_node, "error", {error: error});
2501  }
2502}
2503
2504Inspector.into = function(container) {
2505  if (typeof container === "string") {
2506    container = document.querySelector(container);
2507    if (container == null) throw new Error("container not found");
2508  }
2509  return function() {
2510    return new Inspector(container.appendChild(document.createElement("div")));
2511  };
2512};
2513
2514// Returns true if the given value is something that should be added to the DOM
2515// by the inspector, rather than being inspected. This deliberately excludes
2516// DocumentFragment since appending a fragment “dissolves” (mutates) the
2517// fragment, and we wish for the inspector to not have side-effects. Also,
2518// HTMLElement.prototype is an instanceof Element, but not an element!
2519function isnode(value) {
2520  return (value instanceof Element || value instanceof Text)
2521      && (value instanceof value.constructor);
2522}
2523
2524function RuntimeError(message, input) {
2525  this.message = message + "";
2526  this.input = input;
2527}
2528
2529RuntimeError.prototype = Object.create(Error.prototype);
2530RuntimeError.prototype.name = "RuntimeError";
2531RuntimeError.prototype.constructor = RuntimeError;
2532
2533function generatorish(value) {
2534  return value
2535      && typeof value.next === "function"
2536      && typeof value.return === "function";
2537}
2538
2539function load(notebook, library, observer) {
2540  if (typeof library == "function") observer = library, library = null;
2541  if (typeof observer !== "function") throw new Error("invalid observer");
2542  if (library == null) library = new Library();
2543
2544  const {modules, id} = notebook;
2545  const map = new Map;
2546  const runtime = new Runtime(library);
2547  const main = runtime_module(id);
2548
2549  function runtime_module(id) {
2550    let module = map.get(id);
2551    if (!module) map.set(id, module = runtime.module());
2552    return module;
2553  }
2554
2555  for (const m of modules) {
2556    const module = runtime_module(m.id);
2557    let i = 0;
2558    for (const v of m.variables) {
2559      if (v.from) module.import(v.remote, v.name, runtime_module(v.from));
2560      else if (module === main) module.variable(observer(v, i, m.variables)).define(v.name, v.inputs, v.value);
2561      else module.define(v.name, v.inputs, v.value);
2562      ++i;
2563    }
2564  }
2565
2566  return runtime;
2567}
2568
2569var prototype = Array.prototype;
2570var map = prototype.map;
2571var forEach = prototype.forEach;
2572
2573function constant(x) {
2574  return function() {
2575    return x;
2576  };
2577}
2578
2579function identity$1(x) {
2580  return x;
2581}
2582
2583function rethrow(e) {
2584  return function() {
2585    throw e;
2586  };
2587}
2588
2589function noop() {}
2590
2591var TYPE_NORMAL = 1; // a normal variable
2592var TYPE_IMPLICIT = 2; // created on reference
2593var TYPE_DUPLICATE = 3; // created on duplicate definition
2594
2595var no_observer = {};
2596
2597function Variable(type, module, observer) {
2598  if (!observer) observer = no_observer;
2599  Object.defineProperties(this, {
2600    _observer: {value: observer, writable: true},
2601    _definition: {value: variable_undefined, writable: true},
2602    _duplicate: {value: undefined, writable: true},
2603    _duplicates: {value: undefined, writable: true},
2604    _indegree: {value: NaN, writable: true}, // The number of computing inputs.
2605    _inputs: {value: [], writable: true},
2606    _invalidate: {value: noop, writable: true},
2607    _module: {value: module},
2608    _name: {value: null, writable: true},
2609    _outputs: {value: new Set, writable: true},
2610    _promise: {value: Promise.resolve(undefined), writable: true},
2611    _reachable: {value: observer !== no_observer, writable: true}, // Is this variable transitively visible?
2612    _rejector: {value: variable_rejector(this)},
2613    _type: {value: type},
2614    _value: {value: undefined, writable: true},
2615    _version: {value: 0, writable: true}
2616  });
2617}
2618
2619Object.defineProperties(Variable.prototype, {
2620  _pending: {value: variable_pending, writable: true, configurable: true},
2621  _fulfilled: {value: variable_fulfilled, writable: true, configurable: true},
2622  _rejected: {value: variable_rejected, writable: true, configurable: true},
2623  define: {value: variable_define, writable: true, configurable: true},
2624  delete: {value: variable_delete, writable: true, configurable: true},
2625  import: {value: variable_import, writable: true, configurable: true}
2626});
2627
2628function variable_attach(variable) {
2629  variable._module._runtime._dirty.add(variable);
2630  variable._outputs.add(this);
2631}
2632
2633function variable_detach(variable) {
2634  variable._module._runtime._dirty.add(variable);
2635  variable._outputs.delete(this);
2636}
2637
2638function variable_undefined() {
2639  throw variable_undefined;
2640}
2641
2642function variable_stale() {
2643  throw variable_stale;
2644}
2645
2646function variable_rejector(variable) {
2647  return function(error) {
2648    if (error === variable_stale) throw error;
2649    if (error === variable_undefined) throw new RuntimeError(variable._name + " is not defined", variable._name);
2650    if (error instanceof Error && error.message) throw new RuntimeError(error.message, variable._name);
2651    throw new RuntimeError(variable._name + " could not be resolved", variable._name);
2652  };
2653}
2654
2655function variable_duplicate(name) {
2656  return function() {
2657    throw new RuntimeError(name + " is defined more than once");
2658  };
2659}
2660
2661function variable_define(name, inputs, definition) {
2662  switch (arguments.length) {
2663    case 1: {
2664      definition = name, name = inputs = null;
2665      break;
2666    }
2667    case 2: {
2668      definition = inputs;
2669      if (typeof name === "string") inputs = null;
2670      else inputs = name, name = null;
2671      break;
2672    }
2673  }
2674  return variable_defineImpl.call(this,
2675    name == null ? null : name + "",
2676    inputs == null ? [] : map.call(inputs, this._module._resolve, this._module),
2677    typeof definition === "function" ? definition : constant(definition)
2678  );
2679}
2680
2681function variable_defineImpl(name, inputs, definition) {
2682  var scope = this._module._scope, runtime = this._module._runtime;
2683
2684  this._inputs.forEach(variable_detach, this);
2685  inputs.forEach(variable_attach, this);
2686  this._inputs = inputs;
2687  this._definition = definition;
2688  this._value = undefined;
2689
2690  // Is this an active variable (that may require disposal)?
2691  if (definition === noop) runtime._variables.delete(this);
2692  else runtime._variables.add(this);
2693
2694  // Did the variable’s name change? Time to patch references!
2695  if (name !== this._name || scope.get(name) !== this) {
2696    var error, found;
2697
2698    if (this._name) { // Did this variable previously have a name?
2699      if (this._outputs.size) { // And did other variables reference this variable?
2700        scope.delete(this._name);
2701        found = this._module._resolve(this._name);
2702        found._outputs = this._outputs, this._outputs = new Set;
2703        found._outputs.forEach(function(output) { output._inputs[output._inputs.indexOf(this)] = found; }, this);
2704        found._outputs.forEach(runtime._updates.add, runtime._updates);
2705        runtime._dirty.add(found).add(this);
2706        scope.set(this._name, found);
2707      } else if ((found = scope.get(this._name)) === this) { // Do no other variables reference this variable?
2708        scope.delete(this._name); // It’s safe to delete!
2709      } else if (found._type === TYPE_DUPLICATE) { // Do other variables assign this name?
2710        found._duplicates.delete(this); // This variable no longer assigns this name.
2711        this._duplicate = undefined;
2712        if (found._duplicates.size === 1) { // Is there now only one variable assigning this name?
2713          found = found._duplicates.keys().next().value; // Any references are now fixed!
2714          error = scope.get(this._name);
2715          found._outputs = error._outputs, error._outputs = new Set;
2716          found._outputs.forEach(function(output) { output._inputs[output._inputs.indexOf(error)] = found; });
2717          found._definition = found._duplicate, found._duplicate = undefined;
2718          runtime._dirty.add(error).add(found);
2719          runtime._updates.add(found);
2720          scope.set(this._name, found);
2721        }
2722      } else {
2723        throw new Error;
2724      }
2725    }
2726
2727    if (this._outputs.size) throw new Error;
2728
2729    if (name) { // Does this variable have a new name?
2730      if (found = scope.get(name)) { // Do other variables reference or assign this name?
2731        if (found._type === TYPE_DUPLICATE) { // Do multiple other variables already define this name?
2732          this._definition = variable_duplicate(name), this._duplicate = definition;
2733          found._duplicates.add(this);
2734        } else if (found._type === TYPE_IMPLICIT) { // Are the variable references broken?
2735          this._outputs = found._outputs, found._outputs = new Set; // Now they’re fixed!
2736          this._outputs.forEach(function(output) { output._inputs[output._inputs.indexOf(found)] = this; }, this);
2737          runtime._dirty.add(found).add(this);
2738          scope.set(name, this);
2739        } else { // Does another variable define this name?
2740          found._duplicate = found._definition, this._duplicate = definition; // Now they’re duplicates.
2741          error = new Variable(TYPE_DUPLICATE, this._module);
2742          error._name = name;
2743          error._definition = this._definition = found._definition = variable_duplicate(name);
2744          error._outputs = found._outputs, found._outputs = new Set;
2745          error._outputs.forEach(function(output) { output._inputs[output._inputs.indexOf(found)] = error; });
2746          error._duplicates = new Set([this, found]);
2747          runtime._dirty.add(found).add(error);
2748          runtime._updates.add(found).add(error);
2749          scope.set(name, error);
2750        }
2751      } else {
2752        scope.set(name, this);
2753      }
2754    }
2755
2756    this._name = name;
2757  }
2758
2759  // If this redefined variable was previously evaluated, invalidate it. (If the
2760  // variable was never evaluated, then the invalidated value could never have
2761  // been exposed and we can avoid this extra work.)
2762  if (this._version > 0) ++this._version;
2763
2764  runtime._updates.add(this);
2765  runtime._compute();
2766  return this;
2767}
2768
2769function variable_import(remote, name, module) {
2770  if (arguments.length < 3) module = name, name = remote;
2771  return variable_defineImpl.call(this, name + "", [module._resolve(remote + "")], identity$1);
2772}
2773
2774function variable_delete() {
2775  return variable_defineImpl.call(this, null, [], noop);
2776}
2777
2778function variable_pending() {
2779  if (this._observer.pending) this._observer.pending();
2780}
2781
2782function variable_fulfilled(value) {
2783  if (this._observer.fulfilled) this._observer.fulfilled(value, this._name);
2784}
2785
2786function variable_rejected(error) {
2787  if (this._observer.rejected) this._observer.rejected(error, this._name);
2788}
2789
2790function Module(runtime, builtins = []) {
2791  Object.defineProperties(this, {
2792    _runtime: {value: runtime},
2793    _scope: {value: new Map},
2794    _builtins: {value: new Map([
2795      ["invalidation", variable_invalidation],
2796      ["visibility", variable_visibility],
2797      ...builtins
2798    ])},
2799    _source: {value: null, writable: true}
2800  });
2801}
2802
2803Object.defineProperties(Module.prototype, {
2804  _copy: {value: module_copy, writable: true, configurable: true},
2805  _resolve: {value: module_resolve, writable: true, configurable: true},
2806  redefine: {value: module_redefine, writable: true, configurable: true},
2807  define: {value: module_define, writable: true, configurable: true},
2808  derive: {value: module_derive, writable: true, configurable: true},
2809  import: {value: module_import, writable: true, configurable: true},
2810  value: {value: module_value, writable: true, configurable: true},
2811  variable: {value: module_variable, writable: true, configurable: true},
2812  builtin: {value: module_builtin, writable: true, configurable: true}
2813});
2814
2815function module_redefine(name) {
2816  var v = this._scope.get(name);
2817  if (!v) throw new RuntimeError(name + " is not defined");
2818  if (v._type === TYPE_DUPLICATE) throw new RuntimeError(name + " is defined more than once");
2819  return v.define.apply(v, arguments);
2820}
2821
2822function module_define() {
2823  var v = new Variable(TYPE_NORMAL, this);
2824  return v.define.apply(v, arguments);
2825}
2826
2827function module_import() {
2828  var v = new Variable(TYPE_NORMAL, this);
2829  return v.import.apply(v, arguments);
2830}
2831
2832function module_variable(observer) {
2833  return new Variable(TYPE_NORMAL, this, observer);
2834}
2835
2836async function module_value(name) {
2837  var v = this._scope.get(name);
2838  if (!v) throw new RuntimeError(name + " is not defined");
2839  if (v._observer === no_observer) {
2840    v = this.variable(true).define([name], identity$1);
2841    try {
2842      return await module_revalue(this._runtime, v);
2843    } finally {
2844      v.delete();
2845    }
2846  } else {
2847    return module_revalue(this._runtime, v);
2848  }
2849}
2850
2851// If the variable is redefined before its value resolves, try again.
2852async function module_revalue(runtime, variable) {
2853  await runtime._compute();
2854  try {
2855    return await variable._promise;
2856  } catch (error) {
2857    if (error === variable_stale) return module_revalue(runtime, variable);
2858    throw error;
2859  }
2860}
2861
2862function module_derive(injects, injectModule) {
2863  var copy = new Module(this._runtime, this._builtins);
2864  copy._source = this;
2865  forEach.call(injects, function(inject) {
2866    if (typeof inject !== "object") inject = {name: inject + ""};
2867    if (inject.alias == null) inject.alias = inject.name;
2868    copy.import(inject.name, inject.alias, injectModule);
2869  });
2870  Promise.resolve().then(() => {
2871    const modules = new Set([this]);
2872    for (const module of modules) {
2873      for (const variable of module._scope.values()) {
2874        if (variable._definition === identity$1) { // import
2875          const module = variable._inputs[0]._module;
2876          const source = module._source || module;
2877          if (source === this) { // circular import-with!
2878            console.warn("circular module definition; ignoring"); // eslint-disable-line no-console
2879            return;
2880          }
2881          modules.add(source);
2882        }
2883      }
2884    }
2885    this._copy(copy, new Map);
2886  });
2887  return copy;
2888}
2889
2890function module_copy(copy, map) {
2891  copy._source = this;
2892  map.set(this, copy);
2893  for (const [name, source] of this._scope) {
2894    var target = copy._scope.get(name);
2895    if (target && target._type === TYPE_NORMAL) continue; // injection
2896    if (source._definition === identity$1) { // import
2897      var sourceInput = source._inputs[0],
2898          sourceModule = sourceInput._module;
2899      copy.import(sourceInput._name, name, map.get(sourceModule)
2900        || (sourceModule._source
2901           ? sourceModule._copy(new Module(copy._runtime, copy._builtins), map) // import-with
2902           : sourceModule));
2903    } else {
2904      copy.define(name, source._inputs.map(variable_name), source._definition);
2905    }
2906  }
2907  return copy;
2908}
2909
2910function module_resolve(name) {
2911  var variable = this._scope.get(name), value;
2912  if (!variable) {
2913    variable = new Variable(TYPE_IMPLICIT, this);
2914    if (this._builtins.has(name)) {
2915      variable.define(name, constant(this._builtins.get(name)));
2916    } else if (this._runtime._builtin._scope.has(name)) {
2917      variable.import(name, this._runtime._builtin);
2918    } else {
2919      try {
2920        value = this._runtime._global(name);
2921      } catch (error) {
2922        return variable.define(name, rethrow(error));
2923      }
2924      if (value === undefined) {
2925        this._scope.set(variable._name = name, variable);
2926      } else {
2927        variable.define(name, constant(value));
2928      }
2929    }
2930  }
2931  return variable;
2932}
2933
2934function module_builtin(name, value) {
2935  this._builtins.set(name, value);
2936}
2937
2938function variable_name(variable) {
2939  return variable._name;
2940}
2941
2942const frame = typeof requestAnimationFrame === "function" ? requestAnimationFrame
2943  : typeof setImmediate === "function" ? setImmediate
2944  : f => setTimeout(f, 0);
2945
2946var variable_invalidation = {};
2947var variable_visibility = {};
2948
2949function Runtime(builtins = new Library, global = window_global) {
2950  var builtin = this.module();
2951  Object.defineProperties(this, {
2952    _dirty: {value: new Set},
2953    _updates: {value: new Set},
2954    _precomputes: {value: [], writable: true},
2955    _computing: {value: null, writable: true},
2956    _init: {value: null, writable: true},
2957    _modules: {value: new Map},
2958    _variables: {value: new Set},
2959    _disposed: {value: false, writable: true},
2960    _builtin: {value: builtin},
2961    _global: {value: global}
2962  });
2963  if (builtins) for (var name in builtins) {
2964    (new Variable(TYPE_IMPLICIT, builtin)).define(name, [], builtins[name]);
2965  }
2966}
2967
2968Object.defineProperties(Runtime, {
2969  load: {value: load, writable: true, configurable: true}
2970});
2971
2972Object.defineProperties(Runtime.prototype, {
2973  _precompute: {value: runtime_precompute, writable: true, configurable: true},
2974  _compute: {value: runtime_compute, writable: true, configurable: true},
2975  _computeSoon: {value: runtime_computeSoon, writable: true, configurable: true},
2976  _computeNow: {value: runtime_computeNow, writable: true, configurable: true},
2977  dispose: {value: runtime_dispose, writable: true, configurable: true},
2978  module: {value: runtime_module, writable: true, configurable: true},
2979  fileAttachments: {value: FileAttachments, writable: true, configurable: true}
2980});
2981
2982function runtime_dispose() {
2983  this._computing = Promise.resolve();
2984  this._disposed = true;
2985  this._variables.forEach(v => {
2986    v._invalidate();
2987    v._version = NaN;
2988  });
2989}
2990
2991function runtime_module(define, observer = noop) {
2992  let module;
2993  if (define === undefined) {
2994    if (module = this._init) {
2995      this._init = null;
2996      return module;
2997    }
2998    return new Module(this);
2999  }
3000  module = this._modules.get(define);
3001  if (module) return module;
3002  this._init = module = new Module(this);
3003  this._modules.set(define, module);
3004  try {
3005    define(this, observer);
3006  } finally {
3007    this._init = null;
3008  }
3009  return module;
3010}
3011
3012function runtime_precompute(callback) {
3013  this._precomputes.push(callback);
3014  this._compute();
3015}
3016
3017function runtime_compute() {
3018  return this._computing || (this._computing = this._computeSoon());
3019}
3020
3021function runtime_computeSoon() {
3022  return new Promise(frame).then(() => this._disposed ? undefined : this._computeNow());
3023}
3024
3025async function runtime_computeNow() {
3026  var queue = [],
3027      variables,
3028      variable,
3029      precomputes = this._precomputes;
3030
3031  // If there are any paused generators, resume them before computing so they
3032  // can update (if synchronous) before computing downstream variables.
3033  if (precomputes.length) {
3034    this._precomputes = [];
3035    for (const callback of precomputes) callback();
3036    await runtime_defer(3);
3037  }
3038
3039  // Compute the reachability of the transitive closure of dirty variables.
3040  // Any newly-reachable variable must also be recomputed.
3041  // Any no-longer-reachable variable must be terminated.
3042  variables = new Set(this._dirty);
3043  variables.forEach(function(variable) {
3044    variable._inputs.forEach(variables.add, variables);
3045    const reachable = variable_reachable(variable);
3046    if (reachable > variable._reachable) {
3047      this._updates.add(variable);
3048    } else if (reachable < variable._reachable) {
3049      variable._invalidate();
3050    }
3051    variable._reachable = reachable;
3052  }, this);
3053
3054  // Compute the transitive closure of updating, reachable variables.
3055  variables = new Set(this._updates);
3056  variables.forEach(function(variable) {
3057    if (variable._reachable) {
3058      variable._indegree = 0;
3059      variable._outputs.forEach(variables.add, variables);
3060    } else {
3061      variable._indegree = NaN;
3062      variables.delete(variable);
3063    }
3064  });
3065
3066  this._computing = null;
3067  this._updates.clear();
3068  this._dirty.clear();
3069
3070  // Compute the indegree of updating variables.
3071  variables.forEach(function(variable) {
3072    variable._outputs.forEach(variable_increment);
3073  });
3074
3075  do {
3076    // Identify the root variables (those with no updating inputs).
3077    variables.forEac
3077h(function(variable) {
3078      if (variable._indegree === 0) {
3079        queue.push(variable);
3080      }
3081    });
3082
3083    // Compute the variables in topological order.
3084    while (variable = queue.pop()) {
3085      variable_compute(variable);
3086      variable._outputs.forEach(postqueue);
3087      variables.delete(variable);
3088    }
3089
3090    // Any remaining variables are circular, or depend on them.
3091    variables.forEach(function(variable) {
3092      if (variable_circular(variable)) {
3093        variable_error(variable, new RuntimeError("circular definition"));
3094        variable._outputs.forEach(variable_decrement);
3095        variables.delete(variable);
3096      }
3097    });
3098  } while (variables.size);
3099
3100  function postqueue(variable) {
3101    if (--variable._indegree === 0) {
3102      queue.push(variable);
3103    }
3104  }
3105}
3106
3107// We want to give generators, if they’re defined synchronously, a chance to
3108// update before computing downstream variables. This creates a synchronous
3109// promise chain of the given depth that we’ll await before recomputing
3110// downstream variables.
3111function runtime_defer(depth = 0) {
3112  let p = Promise.resolve();
3113  for (let i = 0; i < depth; ++i) p = p.then(() => {});
3114  return p;
3115}
3116
3117function variable_circular(variable) {
3118  const inputs = new Set(variable._inputs);
3119  for (const i of inputs) {
3120    if (i === variable) return true;
3121    i._inputs.forEach(inputs.add, inputs);
3122  }
3123  return false;
3124}
3125
3126function variable_increment(variable) {
3127  ++variable._indegree;
3128}
3129
3130function variable_decrement(variable) {
3131  --variable._indegree;
3132}
3133
3134function variable_value(variable) {
3135  return variable._promise.catch(variable._rejector);
3136}
3137
3138function variable_invalidator(variable) {
3139  return new Promise(function(resolve) {
3140    variable._invalidate = resolve;
3141  });
3142}
3143
3144function variable_intersector(invalidation, variable) {
3145  let node = typeof IntersectionObserver === "function" && variable._observer && variable._observer._node;
3146  let visible = !node, resolve = noop, reject = noop, promise, observer;
3147  if (node) {
3148    observer = new IntersectionObserver(([entry]) => (visible = entry.isIntersecting) && (promise = null, resolve()));
3149    observer.observe(node);
3150    invalidation.then(() => (observer.disconnect(), observer = null, reject()));
3151  }
3152  return function(value) {
3153    if (visible) return Promise.resolve(value);
3154    if (!observer) return Promise.reject();
3155    if (!promise) promise = new Promise((y, n) => (resolve = y, reject = n));
3156    return promise.then(() => value);
3157  };
3158}
3159
3160function variable_compute(variable) {
3161  variable._invalidate();
3162  variable._invalidate = noop;
3163  variable._pending();
3164
3165  const value0 = variable._value;
3166  const version = ++variable._version;
3167
3168  // Lazily-constructed invalidation variable; only constructed if referenced as an input.
3169  let invalidation = null;
3170
3171  // If the variable doesn’t have any inputs, we can optimize slightly.
3172  const promise = variable._promise = (variable._inputs.length
3173      ? Promise.all(variable._inputs.map(variable_value)).then(define)
3174      : new Promise(resolve => resolve(variable._definition.call(value0))))
3175    .then(generate);
3176
3177  // Compute the initial value of the variable.
3178  function define(inputs) {
3179    if (variable._version !== version) throw variable_stale;
3180
3181    // Replace any reference to invalidation with the promise, lazily.
3182    for (var i = 0, n = inputs.length; i < n; ++i) {
3183      switch (inputs[i]) {
3184        case variable_invalidation: {
3185          inputs[i] = invalidation = variable_invalidator(variable);
3186          break;
3187        }
3188        case variable_visibility: {
3189          if (!invalidation) invalidation = variable_invalidator(variable);
3190          inputs[i] = variable_intersector(invalidation, variable);
3191          break;
3192        }
3193      }
3194    }
3195
3196    return variable._definition.apply(value0, inputs);
3197  }
3198
3199  // If the value is a generator, then retrieve its first value, and dispose of
3200  // the generator if the variable is invalidated. Note that the cell may
3201  // already have been invalidated here, in which case we need to terminate the
3202  // generator immediately!
3203  function generate(value) {
3204    if (variable._version !== version) throw variable_stale;
3205    if (generatorish(value)) {
3206      (invalidation || variable_invalidator(variable)).then(variable_return(value));
3207      return variable_generate(variable, version, value);
3208    }
3209    return value;
3210  }
3211
3212  promise.then((value) => {
3213    variable._value = value;
3214    variable._fulfilled(value);
3215  }, (error) => {
3216    if (error === variable_stale) return;
3217    variable._value = undefined;
3218    variable._rejected(error);
3219  });
3220}
3221
3222function variable_generate(variable, version, generator) {
3223  const runtime = variable._module._runtime;
3224  let currentValue; // so that yield resolves to the yielded value
3225
3226  // Retrieve the next value from the generator; if successful, invoke the
3227  // specified callback. The returned promise resolves to the yielded value, or
3228  // to undefined if the generator is done.
3229  function compute(onfulfilled) {
3230    return new Promise(resolve => resolve(generator.next(currentValue))).then(({done, value}) => {
3231      return done ? undefined : Promise.resolve(value).then(onfulfilled);
3232    });
3233  }
3234
3235  // Retrieve the next value from the generator; if successful, fulfill the
3236  // variable, compute downstream variables, and schedule the next value to be
3237  // pulled from the generator at the start of the next animation frame. If not
3238  // successful, reject the variable, compute downstream variables, and return.
3239  function recompute() {
3240    const promise = compute((value) => {
3241      if (variable._version !== version) throw variable_stale;
3242      currentValue = value;
3243      postcompute(value, promise).then(() => runtime._precompute(recompute));
3244      variable._fulfilled(value);
3245      return value;
3246    });
3247    promise.catch((error) => {
3248      if (error === variable_stale) throw error;
3249      if (variable._version !== version) throw variable_stale;
3250      postcompute(undefined, promise);
3251      variable._rejected(error);
3252    });
3253  }
3254
3255  // After the generator fulfills or rejects, set its current value, promise,
3256  // and schedule any downstream variables for update.
3257  function postcompute(value, promise) {
3258    variable._value = value;
3259    variable._promise = promise;
3260    variable._outputs.forEach(runtime._updates.add, runtime._updates);
3261    return runtime._compute();
3262  }
3263
3264  // When retrieving the first value from the generator, the promise graph is
3265  // already established, so we only need to queue the next pull.
3266  return compute((value) => {
3267    if (variable._version !== version) throw variable_stale;
3268    currentValue = value;
3269    runtime._precompute(recompute);
3270    return value;
3271  });
3272}
3273
3274function variable_error(variable, error) {
3275  variable._invalidate();
3276  variable._invalidate = noop;
3277  variable._pending();
3278  ++variable._version;
3279  variable._indegree = NaN;
3280  (variable._promise = Promise.reject(error)).catch(noop);
3281  variable._value = undefined;
3282  variable._rejected(error);
3283}
3284
3285function variable_return(generator) {
3286  return function() {
3287    generator.return();
3288  };
3289}
3290
3291function variable_reachable(variable) {
3292  if (variable._observer !== no_observer) return true; // Directly reachable.
3293  var outputs = new Set(variable._outputs);
3294  for (const output of outputs) {
3295    if (output._observer !== no_observer) return true;
3296    output._outputs.forEach(outputs.add, outputs);
3297  }
3298  return false;
3299}
3300
3301function window_global(name) {
3302  return window[name];
3303}
3304
3305function renderHtml(string) {
3306  const template = document.createElement("template");
3307  template.innerHTML = string;
3308  return document.importNode(template.content, true);
3309}
3310
3311function renderSvg(string) {
3312  const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
3313  g.innerHTML = string;
3314  return g;
3315}
3316
3317const html = Object.assign(hypertext(renderHtml, fragment => {
3318  if (fragment.firstChild === null) return null;
3319  if (fragment.firstChild === fragment.lastChild) return fragment.removeChild(fragment.firstChild);
3320  const span = document.createElement("span");
3321  span.appendChild(fragment);
3322  return span;
3323}), {fragment: hypertext(renderHtml, fragment => fragment)});
3324
3325Object.assign(hypertext(renderSvg, g => {
3326  if (g.firstChild === null) return null;
3327  if (g.firstChild === g.lastChild) return g.removeChild(g.firstChild);
3328  return g;
3329}), {fragment: hypertext(renderSvg, g => {
3330  const fragment = document.createDocumentFragment();
3331  while (g.firstChild) fragment.appendChild(g.firstChild);
3332  return fragment;
3333})});
3334
3335const
3336CODE_TAB = 9,
3337CODE_LF = 10,
3338CODE_FF = 12,
3339CODE_CR = 13,
3340CODE_SPACE = 32,
3341CODE_UPPER_A = 65,
3342CODE_UPPER_Z = 90,
3343CODE_LOWER_A = 97,
3344CODE_LOWER_Z = 122,
3345CODE_LT = 60,
3346CODE_GT = 62,
3347CODE_SLASH = 47,
3348CODE_DASH = 45,
3349CODE_BANG = 33,
3350CODE_EQ = 61,
3351CODE_DQUOTE = 34,
3352CODE_SQUOTE = 39,
3353CODE_QUESTION = 63,
3354STATE_DATA = 1,
3355STATE_TAG_OPEN = 2,
3356STATE_END_TAG_OPEN = 3,
3357STATE_TAG_NAME = 4,
3358STATE_BOGUS_COMMENT = 5,
3359STATE_BEFORE_ATTRIBUTE_NAME = 6,
3360STATE_AFTER_ATTRIBUTE_NAME = 7,
3361STATE_ATTRIBUTE_NAME = 8,
3362STATE_BEFORE_ATTRIBUTE_VALUE = 9,
3363STATE_ATTRIBUTE_VALUE_DOUBLE_QUOTED = 10,
3364STATE_ATTRIBUTE_VALUE_SINGLE_QUOTED = 11,
3365STATE_ATTRIBUTE_VALUE_UNQUOTED = 12,
3366STATE_AFTER_ATTRIBUTE_VALUE_QUOTED = 13,
3367STATE_SELF_CLOSING_START_TAG = 14,
3368STATE_COMMENT_START = 15,
3369STATE_COMMENT_START_DASH = 16,
3370STATE_COMMENT = 17,
3371STATE_COMMENT_LESS_THAN_SIGN = 18,
3372STATE_COMMENT_LESS_THAN_SIGN_BANG = 19,
3373STATE_COMMENT_LESS_THAN_SIGN_BANG_DASH = 20,
3374STATE_COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH = 21,
3375STATE_COMMENT_END_DASH = 22,
3376STATE_COMMENT_END = 23,
3377STATE_COMMENT_END_BANG = 24,
3378STATE_MARKUP_DECLARATION_OPEN = 25,
3379STATE_RAWTEXT = 26,
3380STATE_RAWTEXT_LESS_THAN_SIGN = 27,
3381STATE_RAWTEXT_END_TAG_OPEN = 28,
3382STATE_RAWTEXT_END_TAG_NAME = 29,
3383SHOW_COMMENT = 128,
3384SHOW_ELEMENT = 1,
3385TYPE_COMMENT = 8,
3386TYPE_ELEMENT = 1,
3387NS_SVG = "http://www.w3.org/2000/svg",
3388NS_XLINK = "http://www.w3.org/1999/xlink",
3389NS_XML = "http://www.w3.org/XML/1998/namespace",
3390NS_XMLNS = "http://www.w3.org/2000/xmlns/";
3391
3392const svgAdjustAttributes = new Map([
3393  "attributeName",
3394  "attributeType",
3395  "baseFrequency",
3396  "baseProfile",
3397  "calcMode",
3398  "clipPathUnits",
3399  "diffuseConstant",
3400  "edgeMode",
3401  "filterUnits",
3402  "glyphRef",
3403  "gradientTransform",
3404  "gradientUnits",
3405  "kernelMatrix",
3406  "kernelUnitLength",
3407  "keyPoints",
3408  "keySplines",
3409  "keyTimes",
3410  "lengthAdjust",
3411  "limitingConeAngle",
3412  "markerHeight",
3413  "markerUnits",
3414  "markerWidth",
3415  "maskContentUnits",
3416  "maskUnits",
3417  "numOctaves",
3418  "pathLength",
3419  "patternContentUnits",
3420  "patternTransform",
3421  "patternUnits",
3422  "pointsAtX",
3423  "pointsAtY",
3424  "pointsAtZ",
3425  "preserveAlpha",
3426  "preserveAspectRatio",
3427  "primitiveUnits",
3428  "refX",
3429  "refY",
3430  "repeatCount",
3431  "repeatDur",
3432  "requiredExtensions",
3433  "requiredFeatures",
3434  "specularConstant",
3435  "specularExponent",
3436  "spreadMethod",
3437  "startOffset",
3438  "stdDeviation",
3439  "stitchTiles",
3440  "surfaceScale",
3441  "systemLanguage",
3442  "tableValues",
3443  "targetX",
3444  "targetY",
3445  "textLength",
3446  "viewBox",
3447  "viewTarget",
3448  "xChannelSelector",
3449  "yChannelSelector",
3450  "zoomAndPan"
3451].map(name => [name.toLowerCase(), name]));
3452
3453const svgForeignAttributes = new Map([
3454  ["xlink:actuate", NS_XLINK],
3455  ["xlink:arcrole", NS_XLINK],
3456  ["xlink:href", NS_XLINK],
3457  ["xlink:role", NS_XLINK],
3458  ["xlink:show", NS_XLINK],
3459  ["xlink:title", NS_XLINK],
3460  ["xlink:type", NS_XLINK],
3461  ["xml:lang", NS_XML],
3462  ["xml:space", NS_XML],
3463  ["xmlns", NS_XMLNS],
3464  ["xmlns:xlink", NS_XMLNS]
3465]);
3466
3467function hypertext(render, postprocess) {
3468  return function({raw: strings}) {
3469    let state = STATE_DATA;
3470    let string = "";
3471    let tagNameStart; // either an open tag or an end tag
3472    let tagName; // only open; beware nesting! used only for rawtext
3473    let attributeNameStart;
3474    let attributeNameEnd;
3475    let nodeFilter = 0;
3476
3477    for (let j = 0, m = arguments.length; j < m; ++j) {
3478      const input = strings[j];
3479
3480      if (j > 0) {
3481        const value = arguments[j];
3482        switch (state) {
3483          case STATE_RAWTEXT: {
3484            if (value != null) {
3485              const text = `${value}`;
3486              if (isEscapableRawText(tagName)) {
3487                string += text.replace(/[<]/g, entity);
3488              } else if (new RegExp(`</${tagName}[\\s>/]`, "i").test(string.slice(-tagName.length - 2) + text)) {
3489                throw new Error("unsafe raw text"); // appropriate end tag
3490              } else {
3491                string += text;
3492              }
3493            }
3494            break;
3495          }
3496          case STATE_DATA: {
3497            if (value == null) ; else if (value instanceof Node
3498                || (typeof value !== "string" && value[Symbol.iterator])
3499                || (/(?:^|>)$/.test(strings[j - 1]) && /^(?:<|$)/.test(input))) {
3500              string += "<!--::" + j + "-->";
3501              nodeFilter |= SHOW_COMMENT;
3502            } else {
3503              string += `${value}`.replace(/[<&]/g, entity);
3504            }
3505            break;
3506          }
3507          case STATE_BEFORE_ATTRIBUTE_VALUE: {
3508            state = STATE_ATTRIBUTE_VALUE_UNQUOTED;
3509            let text;
3510            if (/^[\s>]/.test(input)) {
3511              if (value == null || value === false) {
3512                string = string.slice(0, attributeNameStart - strings[j - 1].length);
3513                break;
3514              }
3515              if (value === true || (text = `${value}`) === "") {
3516                string += "''";
3517                break;
3518              }
3519              const name = strings[j - 1].slice(attributeNameStart, attributeNameEnd);
3520              if ((name === "style" && isObjectLiteral(value)) || typeof value === "function") {
3521                string += "::" + j;
3522                nodeFilter |= SHOW_ELEMENT;
3523                break;
3524              }
3525            }
3526            if (text === undefined) text = `${value}`;
3527            if (text === "") throw new Error("unsafe unquoted empty string");
3528            string += text.replace(/^['"]|[\s>&]/g, entity);
3529            break;
3530          }
3531          case STATE_ATTRIBUTE_VALUE_UNQUOTED: {
3532            string += `${value}`.replace(/[\s>&]/g, entity);
3533            break;
3534          }
3535          case STATE_ATTRIBUTE_VALUE_SINGLE_QUOTED: {
3536            string += `${value}`.replace(/['&]/g, entity);
3537            break;
3538          }
3539          case STATE_ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
3540            string += `${value}`.replace(/["&]/g, entity);
3541            break;
3542          }
3543          case STATE_BEFORE_ATTRIBUTE_NAME: {
3544            if (isObjectLiteral(value)) {
3545              string += "::" + j + "=''";
3546              nodeFilter |= SHOW_ELEMENT;
3547              break;
3548            }
3549            throw new Error("invalid binding");
3550          }
3551          case STATE_COMMENT: break;
3552          default: throw new Error("invalid binding");
3553        }
3554      }
3555
3556      for (let i = 0, n = input.length; i < n; ++i) {
3557        const code = input.charCodeAt(i);
3558
3559        switch (state) {
3560          case STATE_DATA: {
3561            if (code === CODE_LT) {
3562              state = STATE_TAG_OPEN;
3563            }
3564            break;
3565          }
3566          case STATE_TAG_OPEN: {
3567            if (code === CODE_BANG) {
3568              state = STATE_MARKUP_DECLARATION_OPEN;
3569            } else if (code === CODE_SLASH) {
3570              state = STATE_END_TAG_OPEN;
3571            } else if (isAsciiAlphaCode(code)) {
3572              tagNameStart = i, tagName = undefined;
3573              state = STATE_TAG_NAME, --i;
3574            } else if (code === CODE_QUESTION) {
3575              state = STATE_BOGUS_COMMENT, --i;
3576            } else {
3577              state = STATE_DATA, --i;
3578            }
3579            break;
3580          }
3581          case STATE_END_TAG_OPEN: {
3582            if (isAsciiAlphaCode(code)) {
3583              state = STATE_TAG_NAME, --i;
3584            } else if (code === CODE_GT) {
3585              state = STATE_DATA;
3586            } else {
3587              state = STATE_BOGUS_COMMENT, --i;
3588            }
3589            break;
3590          }
3591          case STATE_TAG_NAME: {
3592            if (isSpaceCode(code)) {
3593              state = STATE_BEFORE_ATTRIBUTE_NAME;
3594              tagName = lower(input, tagNameStart, i);
3595            } else if (code === CODE_SLASH) {
3596              state = STATE_SELF_CLOSING_START_TAG;
3597            } else if (code === CODE_GT) {
3598              tagName = lower(input, tagNameStart, i);
3599              state = isRawText(tagName) ? STATE_RAWTEXT : STATE_DATA;
3600            }
3601            break;
3602          }
3603          case STATE_BEFORE_ATTRIBUTE_NAME: {
3604            if (isSpaceCode(code)) ; else if (code === CODE_SLASH || code === CODE_GT) {
3605              state = STATE_AFTER_ATTRIBUTE_NAME, --i;
3606            } else if (code === CODE_EQ) {
3607              state = STATE_ATTRIBUTE_NAME;
3608              attributeNameStart = i + 1, attributeNameEnd = undefined;
3609            } else {
3610              state = STATE_ATTRIBUTE_NAME, --i;
3611              attributeNameStart = i + 1, attributeNameEnd = undefined;
3612            }
3613            break;
3614          }
3615          case STATE_ATTRIBUTE_NAME: {
3616            if (isSpaceCode(code) || code === CODE_SLASH || code === CODE_GT) {
3617              state = STATE_AFTER_ATTRIBUTE_NAME, --i;
3618              attributeNameEnd = i;
3619            } else if (code === CODE_EQ) {
3620              state = STATE_BEFORE_ATTRIBUTE_VALUE;
3621              attributeNameEnd = i;
3622            }
3623            break;
3624          }
3625          case STATE_AFTER_ATTRIBUTE_NAME: {
3626            if (isSpaceCode(code)) ; else if (code === CODE_SLASH) {
3627              state = STATE_SELF_CLOSING_START_TAG;
3628            } else if (code === CODE_EQ) {
3629              state = STATE_BEFORE_ATTRIBUTE_VALUE;
3630            } else if (code === CODE_GT) {
3631              state = isRawText(tagName) ? STATE_RAWTEXT : STATE_DATA;
3632            } else {
3633              state = STATE_ATTRIBUTE_NAME, --i;
3634              attributeNameStart = i + 1, attributeNameEnd = undefined;
3635            }
3636            break;
3637          }
3638          case STATE_BEFORE_ATTRIBUTE_VALUE: {
3639            if (isSpaceCode(code)) ; else if (code === CODE_DQUOTE) {
3640              state = STATE_ATTRIBUTE_VALUE_DOUBLE_QUOTED;
3641            } else if (code === CODE_SQUOTE) {
3642              state = STATE_ATTRIBUTE_VALUE_SINGLE_QUOTED;
3643            } else if (code === CODE_GT) {
3644              state = isRawText(tagName) ? STATE_RAWTEXT : STATE_DATA;
3645            } else {
3646              state = STATE_ATTRIBUTE_VALUE_UNQUOTED, --i;
3647            }
3648            break;
3649          }
3650          case STATE_ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
3651            if (code === CODE_DQUOTE) {
3652              state = STATE_AFTER_ATTRIBUTE_VALUE_QUOTED;
3653            }
3654            break;
3655          }
3656          case STATE_ATTRIBUTE_VALUE_SINGLE_QUOTED: {
3657            if (code === CODE_SQUOTE) {
3658              state = STATE_AFTER_ATTRIBUTE_VALUE_QUOTED;
3659            }
3660            break;
3661          }
3662          case STATE_ATTRIBUTE_VALUE_UNQUOTED: {
3663            if (isSpaceCode(code)) {
3664              state = STATE_BEFORE_ATTRIBUTE_NAME;
3665            } else if (code === CODE_GT) {
3666              state = isRawText(tagName) ? STATE_RAWTEXT : STATE_DATA;
3667            }
3668            break;
3669          }
3670          case STATE_AFTER_ATTRIBUTE_VALUE_QUOTED: {
3671            if (isSpaceCode(code)) {
3672              state = STATE_BEFORE_ATTRIBUTE_NAME;
3673            } else if (code === CODE_SLASH) {
3674              state = STATE_SELF_CLOSING_START_TAG;
3675            } else if (code === CODE_GT) {
3676              state = isRawText(tagName) ? STATE_RAWTEXT : STATE_DATA;
3677            } else {
3678              state = STATE_BEFORE_ATTRIBUTE_NAME, --i;
3679            }
3680            break;
3681          }
vendor: 4,776 bytes, lines 3682-3829
3682          case STATE_SELF_CLOSING_START_TAG: {
3683            if (code === CODE_GT) {
3684              state = STATE_DATA;
3685            } else {
3686              state = STATE_BEFORE_ATTRIBUTE_NAME, --i;
3687            }
3688            break;
3689          }
3690          case STATE_BOGUS_COMMENT: {
3691            if (code === CODE_GT) {
3692              state = STATE_DATA;
3693            }
3694            break;
3695          }
3696          case STATE_COMMENT_START: {
3697            if (code === CODE_DASH) {
3698              state = STATE_COMMENT_START_DASH;
3699            } else if (code === CODE_GT) {
3700              state = STATE_DATA;
3701            } else {
3702              state = STATE_COMMENT, --i;
3703            }
3704            break;
3705          }
3706          case STATE_COMMENT_START_DASH: {
3707            if (code === CODE_DASH) {
3708              state = STATE_COMMENT_END;
3709            } else if (code === CODE_GT) {
3710              state = STATE_DATA;
3711            } else {
3712              state = STATE_COMMENT, --i;
3713            }
3714            break;
3715          }
3716          case STATE_COMMENT: {
3717            if (code === CODE_LT) {
3718              state = STATE_COMMENT_LESS_THAN_SIGN;
3719            } else if (code === CODE_DASH) {
3720              state = STATE_COMMENT_END_DASH;
3721            }
3722            break;
3723          }
3724          case STATE_COMMENT_LESS_THAN_SIGN: {
3725            if (code === CODE_BANG) {
3726              state = STATE_COMMENT_LESS_THAN_SIGN_BANG;
3727            } else if (code !== CODE_LT) {
3728              state = STATE_COMMENT, --i;
3729            }
3730            break;
3731          }
3732          case STATE_COMMENT_LESS_THAN_SIGN_BANG: {
3733            if (code === CODE_DASH) {
3734              state = STATE_COMMENT_LESS_THAN_SIGN_BANG_DASH;
3735            } else {
3736              state = STATE_COMMENT, --i;
3737            }
3738            break;
3739          }
3740          case STATE_COMMENT_LESS_THAN_SIGN_BANG_DASH: {
3741            if (code === CODE_DASH) {
3742              state = STATE_COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH;
3743            } else {
3744              state = STATE_COMMENT_END, --i;
3745            }
3746            break;
3747          }
3748          case STATE_COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH: {
3749            state = STATE_COMMENT_END, --i;
3750            break;
3751          }
3752          case STATE_COMMENT_END_DASH: {
3753            if (code === CODE_DASH) {
3754              state = STATE_COMMENT_END;
3755            } else {
3756              state = STATE_COMMENT, --i;
3757            }
3758            break;
3759          }
3760          case STATE_COMMENT_END: {
3761            if (code === CODE_GT) {
3762              state = STATE_DATA;
3763            } else if (code === CODE_BANG) {
3764              state = STATE_COMMENT_END_BANG;
3765            } else if (code !== CODE_DASH) {
3766              state = STATE_COMMENT, --i;
3767            }
3768            break;
3769          }
3770          case STATE_COMMENT_END_BANG: {
3771            if (code === CODE_DASH) {
3772              state = STATE_COMMENT_END_DASH;
3773            } else if (code === CODE_GT) {
3774              state = STATE_DATA;
3775            } else {
3776              state = STATE_COMMENT, --i;
3777            }
3778            break;
3779          }
3780          case STATE_MARKUP_DECLARATION_OPEN: {
3781            if (code === CODE_DASH && input.charCodeAt(i + 1) === CODE_DASH) {
3782              state = STATE_COMMENT_START, ++i;
3783            } else { // Note: CDATA and DOCTYPE unsupported!
3784              state = STATE_BOGUS_COMMENT, --i;
3785            }
3786            break;
3787          }
3788          case STATE_RAWTEXT: {
3789            if (code === CODE_LT) {
3790              state = STATE_RAWTEXT_LESS_THAN_SIGN;
3791            }
3792            break;
3793          }
3794          case STATE_RAWTEXT_LESS_THAN_SIGN: {
3795            if (code === CODE_SLASH) {
3796              state = STATE_RAWTEXT_END_TAG_OPEN;
3797            } else {
3798              state = STATE_RAWTEXT, --i;
3799            }
3800            break;
3801          }
3802          case STATE_RAWTEXT_END_TAG_OPEN: {
3803            if (isAsciiAlphaCode(code)) {
3804              tagNameStart = i;
3805              state = STATE_RAWTEXT_END_TAG_NAME, --i;
3806            } else {
3807              state = STATE_RAWTEXT, --i;
3808            }
3809            break;
3810          }
3811          case STATE_RAWTEXT_END_TAG_NAME: {
3812            if (isSpaceCode(code) && tagName === lower(input, tagNameStart, i)) {
3813              state = STATE_BEFORE_ATTRIBUTE_NAME;
3814            } else if (code === CODE_SLASH && tagName === lower(input, tagNameStart, i)) {
3815              state = STATE_SELF_CLOSING_START_TAG;
3816            } else if (code === CODE_GT && tagName === lower(input, tagNameStart, i)) {
3817              state = STATE_DATA;
3818            } else if (!isAsciiAlphaCode(code)) {
3819              state = STATE_RAWTEXT, --i;
3820            }
3821            break;
3822          }
3823          default: {
3824            state = undefined;
3825            break;
3826          }
3827        }
3828      }
3829
3830      string += input;
3831    }
3832
3833    const root = render(string);
3834
3835    const walker = document.createTreeWalker(root, nodeFilter, null, false);
3836    const removeNodes = [];
3837    while (walker.nextNode()) {
3838      const node = walker.currentNode;
3839      switch (node.nodeType) {
3840        case TYPE_ELEMENT: {
3841          const attributes = node.attributes;
3842          for (let i = 0, n = attributes.length; i < n; ++i) {
3843            const {name, value: currentValue} = attributes[i];
3844            if (/^::/.test(name)) {
3845              const value = arguments[+name.slice(2)];
3846              removeAttribute(node, name), --i, --n;
3847              for (const key in value) {
3848                const subvalue = value[key];
3849                if (subvalue == null || subvalue === false) ; else if (typeof subvalue === "function") {
3850                  node[key] = subvalue;
3851                } else if (key === "style" && isObjectLiteral(subvalue)) {
3852                  setStyles(node[key], subvalue);
3853                } else {
3854                  setAttribute(node, key, subvalue === true ? "" : subvalue);
3855                }
3856              }
3857            } else if (/^::/.test(currentValue)) {
3858              const value = arguments[+currentValue.slice(2)];
3859              removeAttribute(node, name), --i, --n;
3860              if (typeof value === "function") {
3861                node[name] = value;
3862              } else { // style
3863                setStyles(node[name], value);
3864              }
3865            }
3866          }
3867          break;
3868        }
3869        case TYPE_COMMENT: {
3870          if (/^::/.test(node.data)) {
3871            const parent = node.parentNode;
3872            const value = arguments[+node.data.slice(2)];
3873            if (value instanceof Node) {
3874              parent.insertBefore(value, node);
3875            } else if (typeof value !== "string" && value[Symbol.iterator]) {
3876              if (value instanceof NodeList || value instanceof HTMLCollection) {
3877                for (let i = value.length - 1, r = node; i >= 0; --i) {
3878                  r = parent.insertBefore(value[i], r);
3879                }
3880              } else {
3881                for (const subvalue of value) {
3882                  if (subvalue == null) continue;
3883                  parent.insertBefore(subvalue instanceof Node ? subvalue : document.createTextNode(subvalue), node);
3884                }
3885              }
3886            } else {
3887              parent.insertBefore(document.createTextNode(value), node);
3888            }
3889            removeNodes.push(node);
3890          }
3891          break;
3892        }
3893      }
3894    }
3895
3896    for (const node of removeNodes) {
3897      node.parentNode.removeChild(node);
3898    }
3899
3900    return postprocess(root);
3901  };
3902}
3903
3904function entity(character) {
3905  return `&#${character.charCodeAt(0).toString()};`;
3906}
3907
3908function isAsciiAlphaCode(code) {
3909  return (CODE_UPPER_A <= code && code <= CODE_UPPER_Z)
3910      || (CODE_LOWER_A <= code && code <= CODE_LOWER_Z);
3911}
3912
3913function isSpaceCode(code) {
3914  return code === CODE_TAB
3915      || code === CODE_LF
3916      || code === CODE_FF
3917      || code === CODE_SPACE
3918      || code === CODE_CR; // normalize newlines
3919}
3920
3921function isObjectLiteral(value) {
3922  return value && value.toString === Object.prototype.toString;
3923}
3924
3925function isRawText(tagName) {
3926  return tagName === "script" || tagName === "style" || isEscapableRawText(tagName);
3927}
3928
3929function isEscapableRawText(tagName) {
3930  return tagName === "textarea" || tagName === "title";
3931}
3932
3933function lower(input, start, end) {
3934  return input.slice(start, end).toLowerCase();
3935}
3936
3937function setAttribute(node, name, value) {
3938  if (node.namespaceURI === NS_SVG) {
3939    name = name.toLowerCase();
3940    name = svgAdjustAttributes.get(name) || name;
3941    if (svgForeignAttributes.has(name)) {
3942      node.setAttributeNS(svgForeignAttributes.get(name), name, value);
3943      return;
3944    }
3945  }
3946  node.setAttribute(name, value);
3947}
3948
3949function removeAttribute(node, name) {
3950  if (node.namespaceURI === NS_SVG) {
3951    name = name.toLowerCase();
3952    name = svgAdjustAttributes.get(name) || name;
3953    if (svgForeignAttributes.has(name)) {
3954      node.removeAttributeNS(svgForeignAttributes.get(name), name);
3955      return;
3956    }
3957  }
3958  node.removeAttribute(name);
3959}
3960
3961// We can’t use Object.assign because custom properties…
3962function setStyles(style, values) {
3963  for (const name in values) {
3964    const value = values[name];
3965    if (name.startsWith("--")) style.setProperty(name, value);
3966    else style[name] = value;
3967  }
3968}
3969
3970function length(x) {
3971  return x == null ? null : typeof x === "number" ? `${x}px` : `${x}`;
3972}
3973
3974const bubbles = {bubbles: true};
3975
3976function preventDefault(event) {
3977  event.preventDefault();
3978}
3979
3980function dispatchInput({currentTarget}) {
3981  (currentTarget.form || currentTarget).dispatchEvent(new Event("input", bubbles));
3982}
3983
3984function identity(x) {
3985  return x;
3986}
3987
3988let nextId = 0;
3989
3990function newId() {
3991  return `__ns__-${++nextId}`;
3992}
3993
3994function maybeLabel(label, input) {
3995  if (!label) return;
3996  label = html`<label>${label}`;
3997  if (input !== undefined) label.htmlFor = input.id = newId();
3998  return label;
3999}
4000
4001function button(content = "≡", {
4002  label = "",
4003  value,
4004  reduce,
4005  disabled,
4006  required = false,
4007  width
4008} = {}) {
4009  const solitary = typeof content === "string" || content instanceof Node;
4010  if (solitary) {
4011    if (!required && value === undefined) value = 0;
4012    if (reduce === undefined) reduce = (value = 0) => value + 1;
4013    disabled = new Set(disabled ? [content] : []);
4014    content = [[content, reduce]];
4015  } else {
4016    if (!required && value === undefined) value = null;
4017    disabled = new Set(disabled === true ? Array.from(content, ([content]) => content) : disabled || undefined);
4018  }
4019  const form = html`<form class=__ns__ onsubmit=${preventDefault}>`;
4020  const style = {width: length(width)};
4021  const buttons = Array.from(content, ([content, reduce = identity]) => {
4022    if (typeof reduce !== "function") throw new TypeError("reduce is not a function");
4023    return html`<button disabled=${disabled.has(content)} style=${style} onclick=${event => {
4024      form.value = reduce(form.value);
4025      dispatchInput(event);
4026    }}>${content}`;
4027  });
4028  if (label = maybeLabel(label, solitary ? buttons[0] : undefined)) form.append(label);
4029  form.append(...buttons);
4030  form.value = value;
4031  return form;
4032}
4033
4034const formatLocaleAuto = localize(locale => {
4035  const formatNumber = formatLocaleNumber(locale);
4036  return value => value == null ? ""
4037    : typeof value === "number" ? formatNumber(value)
4038    : value instanceof Date ? formatDate(value)
4039    : `${value}`;
4040});
4041
4042const formatLocaleNumber = localize(locale => {
4043  return value =>
4043 value === 0 ? "0" : value.toLocaleString(locale); // handle negative zero
4044});
4045
4046formatLocaleAuto();
4047
4048formatLocaleNumber();
4049
4050function formatDate(date) {
4051  return format(date, "Invalid Date");
4052}
4053
4054// Memoize the last-returned locale.
4055function localize(f) {
4056  let key = localize, value;
4057  return (locale = "en") => locale === key ? value : (value = f(key = locale));
4058}
4059
4060/*
4061* quarto-inspector.js
4062*
4063* Copyright (C) 2022 RStudio, PBC
4064*
4065*/
4066
4067class QuartoInspector extends Inspector {
4068  constructor(node, cellAst) {
4069    super(node);
4070    this._cellAst = cellAst;
4071  }
4072  rejected(error) {
4073    return super.rejected(error);
4074  }
4075}
4076
4077/*global Shiny, $
4078*
4079* quarto-observable-shiny.js
4080*
4081* Copyright (C) 2022 RStudio, PBC
4082*/
4083
4084const shinyInputVars = new Set();
4085let shinyInitialValue = {};
4086
4087function extendObservableStdlib(lib) {
4088  class NamedVariableOutputBinding extends Shiny.OutputBinding {
4089    constructor(name, change) {
4090      super();
4091      this._name = name;
4092      this._change = change;
4093    }
4094    find(scope) {
4095      return $(scope).find("#" + this._name);
4096    }
4097    getId(el) {
4098      return el.id;
4099    }
4100    renderValue(_el, data) {
4101      this._change(data);
4102    }
4103    onValueError(el, err) {
4104      const group = `Shiny error in ${el.id}`;
4105      console.groupCollapsed(`%c${group}`, "color:red");
4106      console.log(`${err.message}`);
4107      console.log(`call: ${err.call}`);
4108      console.groupEnd(group);
4109    }
4110  }
4111
4112  $(document).on("shiny:connected", function (_event) {
4113    Object.entries(shinyInitialValue).map(([k, v]) => {
4114      window.Shiny.setInputValue(k, v);
4115    });
4116    shinyInitialValue = {};
4117  });
4118
4119  lib.shinyInput = function () {
4120    return (name) => {
4121      shinyInputVars.add(name);
4122      window._ojs.ojsConnector.mainModule.value(name)
4123        .then((val) => {
4124          if (window.Shiny && window.Shiny.setInputValue) {
4125            window.Shiny.setInputValue(name, val);
4126          } else {
4127            shinyInitialValue[name] = val;
4128          }
4129        });
4130    };
4131  };
4132
4133  lib.shinyOutput = function () {
4134    return function (name) {
4135      const dummySpan = document.createElement("div");
4136      dummySpan.id = name;
4137      dummySpan.classList.add("ojs-variable-writer");
4138      window._ojs.shinyElementRoot.appendChild(dummySpan);
4139      return lib.Generators.observe((change) => {
4140        Shiny.outputBindings.register(
4141          new NamedVariableOutputBinding(name, change),
4142        );
4143      });
4144    };
4145  };
4146}
4147
4148class ShinyInspector extends QuartoInspector {
4149  constructor(node) {
4150    super(node);
4151  }
4152  fulfilled(value, name) {
4153    if (shinyInputVars.has(name) && window.Shiny) {
4154      if (window.Shiny.setInputValue === undefined) {
4155        shinyInitialValue[name] = value;
4156      } else {
4157        window.Shiny.setInputValue(name, value);
4158      }
4159    }
4160    return super.fulfilled(value, name);
4161  }
4162}
4163
4164const { Generators } = new Library();
4165
4166class OjsButtonInput /*extends ShinyInput*/ {
4167  find(_scope) {
4168    return document.querySelectorAll(".ojs-inputs-button");
4169  }
4170
4171  init(el, change) {
4172    const btn = button(el.textContent);
4173    el.innerHTML = "";
4174    el.appendChild(btn);
4175
4176    const obs = Generators.input(el.firstChild);
4177    (async function () {
4178      // throw away the first value, it doesn't count for buttons
4179      await obs.next().value;
4180      for (const x of obs) {
4181        change(await x);
4182      }
4183    })();
4184    // TODO: error handling
4185
4186    return {
4187      onSetValue: (_value) => {
4188      },
4189      dispose: () => {
4190        obs.return();
4191      },
4192    };
4193  }
4194}
4195
4196function initOjsShinyRuntime() {
4197  const valueSym = Symbol("value");
4198  const callbackSym = Symbol("callback");
4199  const instanceSym = Symbol("instance");
4200  // const values = new WeakMap(); // unused?
4201
4202  class BindingAdapter extends Shiny.InputBinding {
4203    constructor(x) {
4204      super();
4205      this.x = x;
4206    }
4207
4208    find(scope) {
4209      const matches = this.x.find(scope);
4210      return $(matches);
4211    }
4212    getId(el) {
4213      if (this.x.getId) {
4214        return this.x.getId(el);
4215      } else {
4216        return super.getId(el);
4217      }
4218    }
4219    initialize(el) {
4220      const changeHandler = (value) => {
4221        el[valueSym] = value;
4222        el[callbackSym]();
4223      };
4224      const instance = this.x.init(el, changeHandler);
4225      el[instanceSym] = instance;
4226    }
4227    getValue(el) {
4228      return el[valueSym];
4229    }
4230    setValue(el, value) {
4231      el[valueSym] = value;
4232      el[instanceSym].onSetValue(value);
4233    }
4234    subscribe(el, callback) {
4235      el[callbackSym] = callback;
4236    }
4237    unsubscribe(el) {
4238      el[instanceSym].dispose();
4239    }
4240  }
4241
4242  class InspectorOutputBinding extends Shiny.OutputBinding {
4243    find(scope) {
4244      return $(scope).find(".observablehq-inspector");
4245    }
4246    getId(el) {
4247      return el.id;
4248    }
4249    renderValue(el, data) {
4250      (new Inspector(el)).fulfilled(data);
4251    }
4252  }
4253
4254  if (window.Shiny === undefined) {
4255    console.warn("Shiny runtime not found; Shiny features won't work.");
4256    return false;
4257  }
4258
4259  Shiny.inputBindings.register(new BindingAdapter(new OjsButtonInput()));
4260  Shiny.outputBindings.register(new InspectorOutputBinding());
4261
4262  // Handle requests from the server to export Shiny outputs to ojs.
4263  Shiny.addCustomMessageHandler("ojs-export", ({ name }) => {
4264    window._ojs.ojsConnector.mainModule.redefine(
4265      name,
4266      window._ojs.ojsConnector.library.shinyOutput()(name),
4267    );
4268    // shinyOutput() creates an output DOM element, but we have to cause it to
4269    // be actually bound. I don't love this code being here, I'd prefer if we
4270    // could receive Shiny outputs without using output bindings at all (for
4271    // this case, not for things that truly are DOM-oriented outputs).
4272    Shiny.bindAll(document.body);
4273  });
4274
4275  return true;
4276}
4277
4278var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4279
4280var dist = {exports: {}};
4281
4282(function (module, exports) {
4283	(function(g,f){f(exports);}(commonjsGlobal,(function(exports){
4284	var reservedWords = {
4285	  3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
4286	  5: "class enum extends super const export import",
4287	  6: "enum",
4288	  strict: "implements interface let package private protected public static yield",
4289	  strictBind: "eval arguments"
4290	};
4291
4292	// And the keywords
4293
4294	var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
4295
4296	var keywords = {
4297	  5: ecma5AndLessKeywords,
4298	  "5module": ecma5AndLessKeywords + " export import",
4299	  6: ecma5AndLessKeywords + " const class extends export import super"
4300	};
4301
4302	var keywordRelationalOperator = /^in(stanceof)?$/;
4303
4304	// ## Character categories
4305
4306	// Big ugly regular expressions that match characters in the
4307	// whitespace, identifier, and identifier-start categories. These
4308	// are only applied when a character is found to actually have a
4309	// code point above 128.
4310	// Generated by `bin/generate-identifier-regex.js`.
4311	var 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\u08a0-\u08b4\u08b6-\u08c7\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\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\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-\u170c\u170e-\u1711\u1720-\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\u
431119b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\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-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\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";
4312	var 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\u08d3-\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\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-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\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-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\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";
4313
4314	var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
4315	var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
4316
4317	nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
4318
4319	// These are a run-length and offset encoded representation of the
4320	// >0xffff code points that are a valid part of identifiers. The
4321	// offset starts at 0x10000, and each pair of numbers represents an
4322	// offset to the next range, and then a size of the range. They were
4323	// generated by bin/generate-identifier-regex.js
4324
4325	// eslint-disable-next-line comma-spacing
4326	var 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,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,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,107,20,28,22,13,52,76,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,230,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,35,56,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,2749,1070,4050,582,8634,568,8,30,114,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,8952,286,50,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,2357,44,11,6,17,0,370,43,1301,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,42717,35,4148,12,221,3,5761,
vendor: 2,553 bytes, lines 4326-4379
432615,7472,3104,541,1507,4938];
4327
4328	// eslint-disable-next-line comma-spacing
4329	var 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,176,2,54,14,32,9,16,3,46,10,54,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,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];
4330
4331	// This has a complexity linear to the value of the code. The
4332	// assumption is that looking up astral identifier characters is
4333	// rare.
4334	function isInAstralSet(code, set) {
4335	  var pos = 0x10000;
4336	  for (var i = 0; i < set.length; i += 2) {
4337	    pos += set[i];
4338	    if (pos > code) { return false }
4339	    pos += set[i + 1];
4340	    if (pos >= code) { return true }
4341	  }
4342	}
4343
4344	// Test whether a given character code starts an identifier.
4345
4346	function isIdentifierStart(code, astral) {
4347	  if (code < 65) { return code === 36 }
4348	  if (code < 91) { return true }
4349	  if (code < 97) { return code === 95 }
4350	  if (code < 123) { return true }
4351	  if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }
4352	  if (astral === false) { return false }
4353	  return isInAstralSet(code, astralIdentifierStartCodes)
4354	}
4355
4356	// Test whether a given character is part of an identifier.
4357
4358	function isIdentifierChar(code, astral) {
4359	  if (code < 48) { return code === 36 }
4360	  if (code < 58) { return true }
4361	  if (code < 65) { return false }
4362	  if (code < 91) { return true }
4363	  if (code < 97) { return code === 95 }
4364	  if (code < 123) { return true }
4365	  if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }
4366	  if (astral === false) { return false }
4367	  return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
4368	}
4369
4370	// ## Token types
4371
4372	// The assignment of fine-grained, information-carrying type objects
4373	// allows the tokenizer to store the information it has about a
4374	// token in a way that is very cheap for the parser to look up.
4375
4376	// All token type variables start with an underscore, to make them
4377	// easy to recognize.
4378
4379	// The `beforeExpr` property is used to disambiguate between regular
vendor: 2,028 bytes, lines 4380-4438
4380	// expressions and divisions. It is set on all token types that can
4381	// be followed by an expression (thus, a slash after them would be a
4382	// regular expression).
4383	//
4384	// The `startsExpr` property is used to check if the token ends a
4385	// `yield` expression. It is set on all token types that either can
4386	// directly start an expression (like a quotation mark) or can
4387	// continue an expression (like the body of a string).
4388	//
4389	// `isLoop` marks a keyword as starting a loop, which is important
4390	// to know when parsing a label, in order to allow or disallow
4391	// continue jumps to that label.
4392
4393	var TokenType = function TokenType(label, conf) {
4394	  if ( conf === void 0 ) conf = {};
4395
4396	  this.label = label;
4397	  this.keyword = conf.keyword;
4398	  this.beforeExpr = !!conf.beforeExpr;
4399	  this.startsExpr = !!conf.startsExpr;
4400	  this.isLoop = !!conf.isLoop;
4401	  this.isAssign = !!conf.isAssign;
4402	  this.prefix = !!conf.prefix;
4403	  this.postfix = !!conf.postfix;
4404	  this.binop = conf.binop || null;
4405	  this.updateContext = null;
4406	};
4407
4408	function binop(name, prec) {
4409	  return new TokenType(name, {beforeExpr: true, binop: prec})
4410	}
4411	var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
4412
4413	// Map keyword names to token types.
4414
4415	var keywords$1 = {};
4416
4417	// Succinct definitions of keyword token types
4418	function kw(name, options) {
4419	  if ( options === void 0 ) options = {};
4420
4421	  options.keyword = name;
4422	  return keywords$1[name] = new TokenType(name, options)
4423	}
4424
4425	var types = {
4426	  num: new TokenType("num", startsExpr),
4427	  regexp: new TokenType("regexp", startsExpr),
4428	  string: new TokenType("string", startsExpr),
4429	  name: new TokenType("name", startsExpr),
4430	  eof: new TokenType("eof"),
4431
4432	  // Punctuation token types.
4433	  bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
4434	  bracketR: new TokenType("]"),
4435	  braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
4436	  braceR: new TokenType("}"),
4437	  parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
4438	  parenR: new TokenType(")"),
4439	  comma: new TokenType(",", beforeExpr),
4440	  semi: new TokenType(";", beforeExpr),
4441	  colon: new TokenType(":", beforeExpr),
4442	  dot: new TokenType("."),
4443	  question: new TokenType("?", beforeExpr),
4444	  questionDot: new TokenType("?."),
4445	  arrow: new TokenType("=>", beforeExpr),
4446	  template: new TokenType("template"),
4447	  invalidTemplate: new TokenType("invalidTemplate"),
4448	  ellipsis: new TokenType("...", beforeExpr),
4449	  backQuote: new TokenType("`", startsExpr),
4450	  dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
4451
4452	  // Operators. These carry several kinds of properties to help the
4453	  // parser use them properly (the presence of these properties is
4454	  // what categorizes them as operators).
4455	  //
4456	  // `binop`, when present, specifies that this operator is a binary
4457	  // operator, and will refer to its precedence.
4458	  //
4459	  // `prefix` and `postfix` mark the operator as a prefix or postfix
4460	  // unary operator.
4461	  //
4462	  // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
4463	  // binary operators with a very low precedence, that should result
4464	  // in AssignmentExpression nodes.
4465
4466	  eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
4467	  assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
4468	  incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
4469	  prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
4470	  logicalOR: binop("||", 1),
4471	  logicalAND: binop("&&", 2),
4472	  bitwiseOR: binop("|", 3),
4473	  bitwiseXOR: binop("^", 4),
4474	  bitwiseAND: binop("&", 5),
4475	  equality: binop("==/!=/===/!==", 6),
4476	  relational: binop("</>/<=/>=", 7),
4477	  bitShift: binop("<</>>/>>>", 8),
4478	  plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
4479	  modulo: binop("%", 10),
4480	  star: binop("*", 10),
4481	  slash: binop("/", 10),
4482	  starstar: new TokenType("**", {beforeExpr: true}),
4483	  coalesce: binop("??", 1),
4484
4485	  // Keyword token types.
4486	  _break: kw("break"),
vendor: 125,239 bytes, lines 4487-7765
4487	  _case: kw("case", beforeExpr),
4488	  _catch: kw("catch"),
4489	  _continue: kw("continue"),
4490	  _debugger: kw("debugger"),
4491	  _default: kw("default", beforeExpr),
4492	  _do: kw("do", {isLoop: true, beforeExpr: true}),
4493	  _else: kw("else", beforeExpr),
4494	  _finally: kw("finally"),
4495	  _for: kw("for", {isLoop: true}),
4496	  _function: kw("function", startsExpr),
4497	  _if: kw("if"),
4498	  _return: kw("return", beforeExpr),
4499	  _switch: kw("switch"),
4500	  _throw: kw("throw", beforeExpr),
4501	  _try: kw("try"),
4502	  _var: kw("var"),
4503	  _const: kw("const"),
4504	  _while: kw("while", {isLoop: true}),
4505	  _with: kw("with"),
4506	  _new: kw("new", {beforeExpr: true, startsExpr: true}),
4507	  _this: kw("this", startsExpr),
4508	  _super: kw("super", startsExpr),
4509	  _class: kw("class", startsExpr),
4510	  _extends: kw("extends", beforeExpr),
4511	  _export: kw("export"),
4512	  _import: kw("import", startsExpr),
4513	  _null: kw("null", startsExpr),
4514	  _true: kw("true", startsExpr),
4515	  _false: kw("false", startsExpr),
4516	  _in: kw("in", {beforeExpr: true, binop: 7}),
4517	  _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
4518	  _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
4519	  _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
4520	  _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
4521	};
4522
4523	// Matches a whole line break (where CRLF is considered a single
4524	// line break). Used to count lines.
4525
4526	var lineBreak = /\r\n?|\n|\u2028|\u2029/;
4527	var lineBreakG = new RegExp(lineBreak.source, "g");
4528
4529	function isNewLine(code, ecma2019String) {
4530	  return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029))
4531	}
4532
4533	var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
4534
4535	var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
4536
4537	var ref = Object.prototype;
4538	var hasOwnProperty = ref.hasOwnProperty;
4539	var toString = ref.toString;
4540
4541	// Checks if an object has a property.
4542
4543	function has(obj, propName) {
4544	  return hasOwnProperty.call(obj, propName)
4545	}
4546
4547	var isArray = Array.isArray || (function (obj) { return (
4548	  toString.call(obj) === "[object Array]"
4549	); });
4550
4551	function wordsRegexp(words) {
4552	  return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
4553	}
4554
4555	// These are used when `options.locations` is on, for the
4556	// `startLoc` and `endLoc` properties.
4557
4558	var Position = function Position(line, col) {
4559	  this.line = line;
4560	  this.column = col;
4561	};
4562
4563	Position.prototype.offset = function offset (n) {
4564	  return new Position(this.line, this.column + n)
4565	};
4566
4567	var SourceLocation = function SourceLocation(p, start, end) {
4568	  this.start = start;
4569	  this.end = end;
4570	  if (p.sourceFile !== null) { this.source = p.sourceFile; }
4571	};
4572
4573	// The `getLineInfo` function is mostly useful when the
4574	// `locations` option is off (for performance reasons) and you
4575	// want to find the line/column position for a given character
4576	// offset. `input` should be the code string that the offset refers
4577	// into.
4578
4579	function getLineInfo(input, offset) {
4580	  for (var line = 1, cur = 0;;) {
4581	    lineBreakG.lastIndex = cur;
4582	    var match = lineBreakG.exec(input);
4583	    if (match && match.index < offset) {
4584	      ++line;
4585	      cur = match.index + match[0].length;
4586	    } else {
4587	      return new Position(line, offset - cur)
4588	    }
4589	  }
4590	}
4591
4592	// A second optional argument can be given to further configure
4593	// the parser process. These options are recognized:
4594
4595	var defaultOptions = {
4596	  // `ecmaVersion` indicates the ECMAScript version to parse. Must be
4597	  // either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), or 10
4598	  // (2019). This influences support for strict mode, the set of
4599	  // reserved words, and support for new syntax features. The default
4600	  // is 10.
4601	  ecmaVersion: 10,
4602	  // `sourceType` indicates the mode the code should be parsed in.
4603	  // Can be either `"script"` or `"module"`. This influences global
4604	  // strict mode and parsing of `import` and `export` declarations.
4605	  sourceType: "script",
4606	  // `onInsertedSemicolon` can be a callback that will be called
4607	  // when a semicolon is automatically inserted. It will be passed
4608	  // the position of the comma as an offset, and if `locations` is
4609	  // enabled, it is given the location as a `{line, column}` object
4610	  // as second argument.
4611	  onInsertedSemicolon: null,
4612	  // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
4613	  // trailing commas.
4614	  onTrailingComma: null,
4615	  // By default, reserved words are only enforced if ecmaVersion >= 5.
4616	  // Set `allowReserved` to a boolean value to explicitly turn this on
4617	  // an off. When this option has the value "never", reserved words
4618	  // and keywords can also not be used as property names.
4619	  allowReserved: null,
4620	  // When enabled, a return at the top level is not considered an
4621	  // error.
4622	  allowReturnOutsideFunction: false,
4623	  // When enabled, import/export statements are not constrained to
4624	  // appearing at the top of the program.
4625	  allowImportExportEverywhere: false,
4626	  // When enabled, await identifiers are allowed to appear at the top-level scope,
4627	  // but they are still not allowed in non-async functions.
4628	  allowAwaitOutsideFunction: false,
4629	  // When enabled, hashbang directive in the beginning of file
4630	  // is allowed and treated as a line comment.
4631	  allowHashBang: false,
4632	  // When `locations` is on, `loc` properties holding objects with
4633	  // `start` and `end` properties in `{line, column}` form (with
4634	  // line being 1-based and column 0-based) will be attached to the
4635	  // nodes.
4636	  locations: false,
4637	  // A function can be passed as `onToken` option, which will
4638	  // cause Acorn to call that function with object in the same
4639	  // format as tokens returned from `tokenizer().getToken()`. Note
4640	  // that you are not allowed to call the parser from the
4641	  // callback—that will corrupt its internal state.
4642	  onToken: null,
4643	  // A function can be passed as `onComment` option, which will
4644	  // cause Acorn to call that function with `(block, text, start,
4645	  // end)` parameters whenever a comment is skipped. `block` is a
4646	  // boolean indicating whether this is a block (`/* */`) comment,
4647	  // `text` is the content of the comment, and `start` and `end` are
4648	  // character offsets that denote the start and end of the comment.
4649	  // When the `locations` option is on, two more parameters are
4650	  // passed, the full `{line, column}` locations of the start and
4651	  // end of the comments. Note that you are not allowed to call the
4652	  // parser from the callback—that will corrupt its internal state.
4653	  onComment: null,
4654	  // Nodes have their start and end characters offsets recorded in
4655	  // `start` and `end` properties (directly on the node, rather than
4656	  // the `loc` object, which holds line/column data. To also add a
4657	  // [semi-standardized][range] `range` property holding a `[start,
4658	  // end]` array with the same numbers, set the `ranges` option to
4659	  // `true`.
4660	  //
4661	  // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
4662	  ranges: false,
4663	  // It is possible to parse multiple files into a single AST by
4664	  // passing the tree produced by parsing the first file as
4665	  // `program` option in subsequent parses. This will add the
4666	  // toplevel forms of the parsed file to the `Program` (top) node
4667	  // of an existing parse tree.
4668	  program: null,
4669	  // When `locations` is on, you can pass this to record the source
4670	  // file in every node's `loc` object.
4671	  sourceFile: null,
4672	  // This value, if given, is stored in every node, whether
4673	  // `locations` is on or off.
4674	  directSourceFile: null,
4675	  // When enabled, parenthesized expressions are represented by
4676	  // (non-standard) ParenthesizedExpression nodes
4677	  preserveParens: false
4678	};
4679
4680	// Interpret and default an options object
4681
4682	function getOptions(opts) {
4683	  var options = {};
4684
4685	  for (var opt in defaultOptions)
4686	    { options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; }
4687
4688	  if (options.ecmaVersion >= 2015)
4689	    { options.ecmaVersion -= 2009; }
4690
4691	  if (options.allowReserved == null)
4692	    { options.allowReserved = options.ecmaVersion < 5; }
4693
4694	  if (isArray(options.onToken)) {
4695	    var tokens = options.onToken;
4696	    options.onToken = function (token) { return tokens.push(token); };
4697	  }
4698	  if (isArray(options.onComment))
4699	    { options.onComment = pushComment(options, options.onComment); }
4700
4701	  return options
4702	}
4703
4704	function pushComment(options, array) {
4705	  return function(block, text, start, end, startLoc, endLoc) {
4706	    var comment = {
4707	      type: block ? "Block" : "Line",
4708	      value: text,
4709	      start: start,
4710	      end: end
4711	    };
4712	    if (options.locations)
4713	      { comment.loc = new SourceLocation(this, startLoc, endLoc); }
4714	    if (options.ranges)
4715	      { comment.range = [start, end]; }
4716	    array.push(comment);
4717	  }
4718	}
4719
4720	// Each scope gets a bitset that may contain these flags
4721	var
4722	    SCOPE_TOP = 1,
4723	    SCOPE_FUNCTION = 2,
4724	    SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION,
4725	    SCOPE_ASYNC = 4,
4726	    SCOPE_GENERATOR = 8,
4727	    SCOPE_ARROW = 16,
4728	    SCOPE_SIMPLE_CATCH = 32,
4729	    SCOPE_SUPER = 64,
4730	    SCOPE_DIRECT_SUPER = 128;
4731
4732	function functionFlags(async, generator) {
4733	  return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)
4734	}
4735
4736	// Used in checkLVal and declareName to determine the type of a binding
4737	var
4738	    BIND_NONE = 0, // Not a binding
4739	    BIND_VAR = 1, // Var-style binding
4740	    BIND_LEXICAL = 2, // Let- or const-style binding
4741	    BIND_FUNCTION = 3, // Function declaration
4742	    BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding
4743	    BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
4744
4745	var Parser = function Parser(options, input, startPos) {
4746	  this.options = options = getOptions(options);
4747	  this.sourceFile = options.sourceFile;
4748	  this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
4749	  var reserved = "";
4750	  if (options.allowReserved !== true) {
4751	    for (var v = options.ecmaVersion;; v--)
4752	      { if (reserved = reservedWords[v]) { break } }
4753	    if (options.sourceType === "module") { reserved += " await"; }
4754	  }
4755	  this.reservedWords = wordsRegexp(reserved);
4756	  var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
4757	  this.reservedWordsStrict = wordsRegexp(reservedStrict);
4758	  this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
4759	  this.input = String(input);
4760
4761	  // Used to signal to callers of `readWord1` whether the word
4762	  // contained any escape sequences. This is needed because words with
4763	  // escape sequences must not be interpreted as keywords.
4764	  this.containsEsc = false;
4765
4766	  // Set up token state
4767
4768	  // The current position of the tokenizer in the input.
4769	  if (startPos) {
4770	    this.pos = startPos;
4771	    this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
4772	    this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
4773	  } else {
4774	    this.pos = this.lineStart = 0;
4775	    this.curLine = 1;
4776	  }
4777
4778	  // Properties of the current token:
4779	  // Its type
4780	  this.type = types.eof;
4781	  // For tokens that include more information than their type, the value
4782	  this.value = null;
4783	  // Its start and end offset
4784	  this.start = this.end = this.pos;
4785	  // And, if locations are used, the {line, column} object
4786	  // corresponding to those offsets
4787	  this.startLoc = this.endLoc = this.curPosition();
4788
4789	  // Position information for the previous token
4790	  this.lastTokEndLoc = this.lastTokStartLoc = null;
4791	  this.lastTokStart = this.lastTokEnd = this.pos;
4792
4793	  // The context stack is used to superficially track syntactic
4794	  // context to predict whether a regular expression is allowed in a
4795	  // given position.
4796	  this.context = this.initialContext();
4797	  this.exprAllowed = true;
4798
4799	  // Figure out if it's a module code.
4800	  this.inModule = options.sourceType === "module";
4801	  this.strict = this.inModule || this.strictDirective(this.pos);
4802
4803	  // Used to signify the start of a potential arrow function
4804	  this.potentialArrowAt = -1;
4805
4806	  // Positions to delayed-check that yield/await does not exist in default parameters.
4807	  this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
4808	  // Labels in scope.
4809	  this.labels = [];
4810	  // Thus-far undefined exports.
4811	  this.undefinedExports = {};
4812
4813	  // If enabled, skip leading hashbang line.
4814	  if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
4815	    { this.skipLineComment(2); }
4816
4817	  // Scope tracking for duplicate variable names (see scope.js)
4818	  this.scopeStack = [];
4819	  this.enterScope(SCOPE_TOP);
4820
4821	  // For RegExp validation
4822	  this.regexpState = null;
4823	};
4824
4825	var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true } };
4826
4827	Parser.prototype.parse = function parse () {
4828	  var node = this.options.program || this.startNode();
4829	  this.nextToken();
4830	  return this.parseTopLevel(node)
4831	};
4832
4833	prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
4834	prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
4835	prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
4836	prototypeAccessors.allowSuper.get = function () { return (this.currentThisScope().flags & SCOPE_SUPER) > 0 };
4837	prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
4838	prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
4839
4840	// Switch to a getter for 7.0.0.
4841	Parser.prototype.inNonArrowFunction = function inNonArrowFunction () { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0 };
4842
4843	Parser.extend = function extend () {
4844	    var plugins = [], len = arguments.length;
4845	    while ( len-- ) plugins[ len ] = arguments[ len ];
4846
4847	  var cls = this;
4848	  for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }
4849	  return cls
4850	};
4851
4852	Parser.parse = function parse (input, options) {
4853	  return new this(options, input).parse()
4854	};
4855
4856	Parser.parseExpressionAt = function parseExpressionAt (input, pos, options) {
4857	  var parser = new this(options, input, pos);
4858	  parser.nextToken();
4859	  return parser.parseExpression()
4860	};
4861
4862	Parser.tokenizer = function tokenizer (input, options) {
4863	  return new this(options, input)
4864	};
4865
4866	Object.defineProperties( Parser.prototype, prototypeAccessors );
4867
4868	var pp = Parser.prototype;
4869
4870	// ## Parser utilities
4871
4872	var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
4873	pp.strictDirective = function(start) {
4874	  for (;;) {
4875	    // Try to find string literal.
4876	    skipWhiteSpace.lastIndex = start;
4877	    start += skipWhiteSpace.exec(this.input)[0].length;
4878	    var match = literal.exec(this.input.slice(start));
4879	    if (!match) { return false }
4880	    if ((match[1] || match[2]) === "use strict") {
4881	      skipWhiteSpace.lastIndex = start + match[0].length;
4882	      var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
4883	      var next = this.input.charAt(end);
4884	      return next === ";" || next === "}" ||
4885	        (lineBreak.test(spaceAfter[0]) &&
4886	         !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="))
4887	    }
4888	    start += match[0].length;
4889
4890	    // Skip semicolon, if any.
4891	    skipWhiteSpace.lastIndex = start;
4892	    start += skipWhiteSpace.exec(this.input)[0].length;
4893	    if (this.input[start] === ";")
4894	      { start++; }
4895	  }
4896	};
4897
4898	// Predicate that tests whether the next token is of the given
4899	// type, and if yes, consumes it as a side effect.
4900
4901	pp.eat = function(type) {
4902	  if (this.type === type) {
4903	    this.next();
4904	    return true
4905	  } else {
4906	    return false
4907	  }
4908	};
4909
4910	// Tests whether parsed token is a contextual keyword.
4911
4912	pp.isContextual = function(name) {
4913	  return this.type === types.name && this.value === name && !this.containsEsc
4914	};
4915
4916	// Consumes contextual keyword if possible.
4917
4918	pp.eatContextual = function(name) {
4919	  if (!this.isContextual(name)) { return false }
4920	  this.next();
4921	  return true
4922	};
4923
4924	// Asserts that following token is given contextual keyword.
4925
4926	pp.expectContextual = function(name) {
4927	  if (!this.eatContextual(name)) { this.unexpected(); }
4928	};
4929
4930	// Test whether a semicolon can be inserted at the current position.
4931
4932	pp.canInsertSemicolon = function() {
4933	  return this.type === types.eof ||
4934	    this.type === types.braceR ||
4935	    lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
4936	};
4937
4938	pp.insertSemicolon = function() {
4939	  if (this.canInsertSemicolon()) {
4940	    if (this.options.onInsertedSemicolon)
4941	      { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
4942	    return true
4943	  }
4944	};
4945
4946	// Consume a semicolon, or, failing that, see if we are allowed to
4947	// pretend that there is a semicolon at this position.
4948
4949	pp.semicolon = function() {
4950	  if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
4951	};
4952
4953	pp.afterTrailingComma = function(tokType, notNext) {
4954	  if (this.type === tokType) {
4955	    if (this.options.onTrailingComma)
4956	      { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
4957	    if (!notNext)
4958	      { this.next(); }
4959	    return true
4960	  }
4961	};
4962
4963	// Expect a token of a given type. If found, consume it, otherwise,
4964	// raise an unexpected token error.
4965
4966	pp.expect = function(type) {
4967	  this.eat(type) || this.unexpected();
4968	};
4969
4970	// Raise an unexpected token error.
4971
4972	pp.unexpected = function(pos) {
4973	  this.raise(pos != null ? pos : this.start, "Unexpected token");
4974	};
4975
4976	function DestructuringErrors() {
4977	  this.shorthandAssign =
4978	  this.trailingComma =
4979	  this.parenthesizedAssign =
4980	  this.parenthesizedBind =
4981	  this.doubleProto =
4982	    -1;
4983	}
4984
4985	pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
4986	  if (!refDestructuringErrors) { return }
4987	  if (refDestructuringErrors.trailingComma > -1)
4988	    { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
4989	  var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
4990	  if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
4991	};
4992
4993	pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
4994	  if (!refDestructuringErrors) { return false }
4995	  var shorthandAssign = refDestructuringErrors.shorthandAssign;
4996	  var doubleProto = refDestructuringErrors.doubleProto;
4997	  if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }
4998	  if (shorthandAssign >= 0)
4999	    { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); }
5000	  if (doubleProto >= 0)
5001	    { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
5002	};
5003
5004	pp.checkYieldAwaitInDefaultParams = function() {
5005	  if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
5006	    { this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
5007	  if (this.awaitPos)
5008	    { this.raise(this.awaitPos, "Await expression cannot be a default value"); }
5009	};
5010
5011	pp.isSimpleAssignTarget = function(expr) {
5012	  if (expr.type === "ParenthesizedExpression")
5013	    { return this.isSimpleAssignTarget(expr.expression) }
5014	  return expr.type === "Identifier" || expr.type === "MemberExpression"
5015	};
5016
5017	var pp$1 = Parser.prototype;
5018
5019	// ### Statement parsing
5020
5021	// Parse a program. Initializes the parser, reads any number of
5022	// statements, and wraps them in a Program node.  Optionally takes a
5023	// `program` argument.  If present, the statements will be appended
5024	// to its body instead of creating a new node.
5025
5026	pp$1.parseTopLevel = function(node) {
5027	  var exports = {};
5028	  if (!node.body) { node.body = []; }
5029	  while (this.type !== types.eof) {
5030	    var stmt = this.parseStatement(null, true, exports);
5031	    node.body.push(stmt);
5032	  }
5033	  if (this.inModule)
5034	    { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)
5035	      {
5036	        var name = list[i];
5037
5038	        this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined"));
5039	      } }
5040	  this.adaptDirectivePrologue(node.body);
5041	  this.next();
5042	  node.sourceType = this.options.sourceType;
5043	  return this.finishNode(node, "Program")
5044	};
5045
5046	var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
5047
5048	pp$1.isLet = function(context) {
5049	  if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
5050	  skipWhiteSpace.lastIndex = this.pos;
5051	  var skip = skipWhiteSpace.exec(this.input);
5052	  var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
5053	  // For ambiguous cases, determine if a LexicalDeclaration (or only a
5054	  // Statement) is allowed here. If context is not empty then only a Statement
5055	  // is allowed. However, `let [` is an explicit negative lookahead for
5056	  // ExpressionStatement, so special-case it first.
5057	  if (nextCh === 91) { return true } // '['
5058	  if (context) { return false }
5059
5060	  if (nextCh === 123) { return true } // '{'
5061	  if (isIdentifierStart(nextCh, true)) {
5062	    var pos = next + 1;
5063	    while (isIdentifierChar(this.input.charCodeAt(pos), true)) { ++pos; }
5064	    var ident = this.input.slice(next, pos);
5065	    if (!keywordRelationalOperator.test(ident)) { return true }
5066	  }
5067	  return false
5068	};
5069
5070	// check 'async [no LineTerminator here] function'
5071	// - 'async /*foo*/ function' is OK.
5072	// - 'async /*\n*/ function' is invalid.
5073	pp$1.isAsyncFunction = function() {
5074	  if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
5075	    { return false }
5076
5077	  skipWhiteSpace.lastIndex = this.pos;
5078	  var skip = skipWhiteSpace.exec(this.input);
5079	  var next = this.pos + skip[0].length;
5080	  return !lineBreak.test(this.input.slice(this.pos, next)) &&
5081	    this.input.slice(next, next + 8) === "function" &&
5082	    (next + 8 === this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))
5083	};
5084
5085	// Parse a single statement.
5086	//
5087	// If expecting a statement and finding a slash operator, parse a
5088	// regular expression literal. This is to handle cases like
5089	// `if (foo) /blah/.exec(foo)`, where looking at the previous token
5090	// does not help.
5091
5092	pp$1.parseStatement = function(context, topLevel, exports) {
5093	  var starttype = this.type, node = this.startNode(), kind;
5094
5095	  if (this.isLet(context)) {
5096	    starttype = types._var;
5097	    kind = "let";
5098	  }
5099
5100	  // Most types of statements are recognized by the keyword they
5101	  // start with. Many are trivial to parse, some require a bit of
5102	  // complexity.
5103
5104	  switch (starttype) {
5105	  case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
5106	  case types._debugger: return this.parseDebuggerStatement(node)
5107	  case types._do: return this.parseDoStatement(node)
5108	  case types._for: return this.parseForStatement(node)
5109	  case types._function:
5110	    // Function as sole body of either an if statement or a labeled statement
5111	    // works, but not when it is part of a labeled statement that is the sole
5112	    // body of an if statement.
5113	    if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
5114	    return this.parseFunctionStatement(node, false, !context)
5115	  case types._class:
5116	    if (context) { this.unexpected(); }
5117	    return this.parseClass(node, true)
5118	  case types._if: return this.parseIfStatement(node)
5119	  case types._return: return this.parseReturnStatement(node)
5120	  case types._switch: return this.parseSwitchStatement(node)
5121	  case types._throw: return this.parseThrowStatement(node)
5122	  case types._try: return this.parseTryStatement(node)
5123	  case types._const: case types._var:
5124	    kind = kind || this.value;
5125	    if (context && kind !== "var") { this.unexpected(); }
5126	    return this.parseVarStatement(node, kind)
5127	  case types._while: return this.parseWhileStatement(node)
5128	  case types._with: return this.parseWithStatement(node)
5129	  case types.braceL: return this.parseBlock(true, node)
5130	  case types.semi: return this.parseEmptyStatement(node)
5131	  case types._export:
5132	  case types._import:
5133	    if (this.options.ecmaVersion > 10 && starttype === types._import) {
5134	      skipWhiteSpace.lastIndex = this.pos;
5135	      var skip = skipWhiteSpace.exec(this.input);
5136	      var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
5137	      if (nextCh === 40 || nextCh === 46) // '(' or '.'
5138	        { return this.parseExpressionStatement(node, this.parseExpression()) }
5139	    }
5140
5141	    if (!this.options.allowImportExportEverywhere) {
5142	      if (!topLevel)
5143	        { this.raise(this.start, "'import' and 'export' may only appear at the top level"); }
5144	      if (!this.inModule)
5145	        { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
5146	    }
5147	    return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
5148
5149	    // If the statement does not start with a statement keyword or a
5150	    // brace, it's an ExpressionStatement or LabeledStatement. We
5151	    // simply start parsing an expression, and afterwards, if the
5152	    // next token is a colon and the expression was a simple
5153	    // Identifier node, we switch to interpreting it as a label.
5154	  default:
5155	    if (this.isAsyncFunction()) {
5156	      if (context) { this.unexpected(); }
5157	      this.next();
5158	      return this.parseFunctionStatement(node, true, !context)
5159	    }
5160
5161	    var maybeName = this.value, expr = this.parseExpression();
5162	    if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
5163	      { return this.parseLabeledStatement(node, maybeName, expr, context) }
5164	    else { return this.parseExpressionStatement(node, expr) }
5165	  }
5166	};
5167
5168	pp$1.parseBreakContinueStatement = function(node, keyword) {
5169	  var isBreak = keyword === "break";
5170	  this.next();
5171	  if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
5172	  else if (this.type !== types.name) { this.unexpected(); }
5173	  else {
5174	    node.label = this.parseIdent();
5175	    this.semicolon();
5176	  }
5177
5178	  // Verify that there is an actual destination to break or
5179	  // continue to.
5180	  var i = 0;
5181	  for (; i < this.labels.length; ++i) {
5182	    var lab = this.labels[i];
5183	    if (node.label == null || lab.name === node.label.name) {
5184	      if (lab.kind != null && (isBreak || lab.kind === "loop")) { break }
5185	      if (node.label && isBreak) { break }
5186	    }
5187	  }
5188	  if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); }
5189	  return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
5190	};
5191
5192	pp$1.parseDebuggerStatement = function(node) {
5193	  this.next();
5194	  this.semicolon();
5195	  return this.finishNode(node, "DebuggerStatement")
5196	};
5197
5198	pp$1.parseDoStatement = function(node) {
5199	  this.next();
5200	  this.labels.push(loopLabel);
5201	  node.body = this.parseStatement("do");
5202	  this.labels.pop();
5203	  this.expect(types._while);
5204	  node.test = this.parseParenExpression();
5205	  if (this.options.ecmaVersion >= 6)
5206	    { this.eat(types.semi); }
5207	  else
5208	    { this.semicolon(); }
5209	  return this.finishNode(node, "DoWhileStatement")
5210	};
5211
5212	// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
5213	// loop is non-trivial. Basically, we have to parse the init `var`
5214	// statement or expression, disallowing the `in` operator (see
5215	// the second parameter to `parseExpression`), and then check
5216	// whether the next token is `in` or `of`. When there is no init
5217	// part (semicolon immediately after the opening parenthesis), it
5218	// is a regular `for` loop.
5219
5220	pp$1.parseForStatement = function(node) {
5221	  this.next();
5222	  var awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual("await")) ? this.lastTokStart : -1;
5223	  this.labels.push(loopLabel);
5224	  this.enterScope(0);
5225	  this.expect(types.parenL);
5226	  if (this.type === types.semi) {
5227	    if (awaitAt > -1) { this.unexpected(awaitAt); }
5228	    return this.parseFor(node, null)
5229	  }
5230	  var isLet = this.isLet();
5231	  if (this.type === types._var || this.type === types._const || isLet) {
5232	    var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
5233	    this.next();
5234	    this.parseVar(init$1, true, kind);
5235	    this.finishNode(init$1, "VariableDeclaration");
5236	    if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
5237	      if (this.options.ecmaVersion >= 9) {
5238	        if (this.type === types._in) {
5239	          if (awaitAt > -1) { this.unexpected(awaitAt); }
5240	        } else { node.await = awaitAt > -1; }
5241	      }
5242	      return this.parseForIn(node, init$1)
5243	    }
5244	    if (awaitAt > -1) { this.unexpected(awaitAt); }
5245	    return this.parseFor(node, init$1)
5246	  }
5247	  var refDestructuringErrors = new DestructuringErrors;
5248	  var init = this.parseExpression(true, refDestructuringErrors);
5249	  if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
5250	    if (this.options.ecmaVersion >= 9) {
5251	      if (this.type === types._in) {
5252	        if (awaitAt > -1) { this.unexpected(awaitAt); }
5253	      } else { node.await = awaitAt > -1; }
5254	    }
5255	    this.toAssignable(init, false, refDestructuringErrors);
5256	    this.checkLVal(init);
5257	    return this.parseForIn(node, init)
5258	  } else {
5259	    this.checkExpressionErrors(refDestructuringErrors, true);
5260	  }
5261	  if (awaitAt > -1) { this.unexpected(awaitAt); }
5262	  return this.parseFor(node, init)
5263	};
5264
5265	pp$1.parseFunctionStatement = function(node, isAsync, declarationPosition) {
5266	  this.next();
5267	  return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
5268	};
5269
5270	pp$1.parseIfStatement = function(node) {
5271	  this.next();
5272	  node.test = this.parseParenExpression();
5273	  // allow function declarations in branches, but only in non-strict mode
5274	  node.consequent = this.parseStatement("if");
5275	  node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
5276	  return this.finishNode(node, "IfStatement")
5277	};
5278
5279	pp$1.parseReturnStatement = function(node) {
5280	  if (!this.inFunction && !this.options.allowReturnOutsideFunction)
5281	    { this.raise(this.start, "'return' outside of function"); }
5282	  this.next();
5283
5284	  // In `return` (and `break`/`continue`), the keywords with
5285	  // optional arguments, we eagerly look for a semicolon or the
5286	  // possibility to insert one.
5287
5288	  if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
5289	  else { node.argument = this.parseExpression(); this.semicolon(); }
5290	  return this.finishNode(node, "ReturnStatement")
5291	};
5292
5293	pp$1.parseSwitchStatement = function(node) {
5294	  this.next();
5295	  node.discriminant = this.parseParenExpression();
5296	  node.cases = [];
5297	  this.expect(types.braceL);
5298	  this.labels.push(switchLabel);
5299	  this.enterScope(0);
5300
5301	  // Statements under must be grouped (by label) in SwitchCase
5302	  // nodes. `cur` is used to keep the node that we are currently
5303	  // adding statements to.
5304
5305	  var cur;
5306	  for (var sawDefault = false; this.type !== types.braceR;) {
5307	    if (this.type === types._case || this.type === types._default) {
5308	      var isCase = this.type === types._case;
5309	      if (cur) { this.finishNode(cur, "SwitchCase"); }
5310	      node.cases.push(cur = this.startNode());
5311	      cur.consequent = [];
5312	      this.next();
5313	      if (isCase) {
5314	        cur.test = this.parseExpression();
5315	      } else {
5316	        if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); }
5317	        sawDefault = true;
5318	        cur.test = null;
5319	      }
5320	      this.expect(types.colon);
5321	    } else {
5322	      if (!cur) { this.unexpected(); }
5323	      cur.consequent.push(this.parseStatement(null));
5324	    }
5325	  }
5326	  this.exitScope();
5327	  if (cur) { this.finishNode(cur, "SwitchCase"); }
5328	  this.next(); // Closing brace
5329	  this.labels.pop();
5330	  return this.finishNode(node, "SwitchStatement")
5331	};
5332
5333	pp$1.parseThrowStatement = function(node) {
5334	  this.next();
5335	  if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
5336	    { this.raise(this.lastTokEnd, "Illegal newline after throw"); }
5337	  node.argument = this.parseExpression();
5338	  this.semicolon();
5339	  return this.finishNode(node, "ThrowStatement")
5340	};
5341
5342	// Reused empty array added for node fields that are always empty.
5343
5344	var empty = [];
5345
5346	pp$1.parseTryStatement = function(node) {
5347	  this.next();
5348	  node.block = this.parseBlock();
5349	  node.handler = null;
5350	  if (this.type === types._catch) {
5351	    var clause = this.startNode();
5352	    this.next();
5353	    if (this.eat(types.parenL)) {
5354	      clause.param = this.parseBindingAtom();
5355	      var simple = clause.param.type === "Identifier";
5356	      this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
5357	      this.checkLVal(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
5358	      this.expect(types.parenR);
5359	    } else {
5360	      if (this.options.ecmaVersion < 10) { this.unexpected(); }
5361	      clause.param = null;
5362	      this.enterScope(0);
5363	    }
5364	    clause.body = this.parseBlock(false);
5365	    this.exitScope();
5366	    node.handler = this.finishNode(clause, "CatchClause");
5367	  }
5368	  node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
5369	  if (!node.handler && !node.finalizer)
5370	    { this.raise(node.start, "Missing catch or finally clause"); }
5371	  return this.finishNode(node, "TryStatement")
5372	};
5373
5374	pp$1.parseVarStatement = function(node, kind) {
5375	  this.next();
5376	  this.parseVar(node, false, kind);
5377	  this.semicolon();
5378	  return this.finishNode(node, "VariableDeclaration")
5379	};
5380
5381	pp$1.parseWhileStatement = function(node) {
5382	  this.next();
5383	  node.test = this.parseParenExpression();
5384	  this.labels.push(loopLabel);
5385	  node.body = this.parseStatement("while");
5386	  this.labels.pop();
5387	  return this.finishNode(node, "WhileStatement")
5388	};
5389
5390	pp$1.parseWithStatement = function(node) {
5391	  if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
5392	  this.next();
5393	  node.object = this.parseParenExpression();
5394	  node.body = this.parseStatement("with");
5395	  return this.finishNode(node, "WithStatement")
5396	};
5397
5398	pp$1.parseEmptyStatement = function(node) {
5399	  this.next();
5400	  return this.finishNode(node, "EmptyStatement")
5401	};
5402
5403	pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
5404	  for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
5405	    {
5406	    var label = list[i$1];
5407
5408	    if (label.name === maybeName)
5409	      { this.raise(expr.start, "Label '" + maybeName + "' is already declared");
5410	  } }
5411	  var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
5412	  for (var i = this.labels.length - 1; i >= 0; i--) {
5413	    var label$1 = this.labels[i];
5414	    if (label$1.statementStart === node.start) {
5415	      // Update information about previous labels on this node
5416	      label$1.statementStart = this.start;
5417	      label$1.kind = kind;
5418	    } else { break }
5419	  }
5420	  this.labels.push({name: maybeName, kind: kind, statementStart: this.start});
5421	  node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
5422	  this.labels.pop();
5423	  node.label = expr;
5424	  return this.finishNode(node, "LabeledStatement")
5425	};
5426
5427	pp$1.parseExpressionStatement = function(node, expr) {
5428	  node.expression = expr;
5429	  this.semicolon();
5430	  return this.finishNode(node, "ExpressionStatement")
5431	};
5432
5433	// Parse a semicolon-enclosed block of statements, handling `"use
5434	// strict"` declarations when `allowStrict` is true (used for
5435	// function bodies).
5436
5437	pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
5438	  if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
5439	  if ( node === void 0 ) node = this.startNode();
5440
5441	  node.body = [];
5442	  this.expect(types.braceL);
5443	  if (createNewLexicalScope) { this.enterScope(0); }
5444	  while (this.type !== types.braceR) {
5445	    var stmt = this.parseStatement(null);
5446	    node.body.push(stmt);
5447	  }
5448	  if (exitStrict) { this.strict = false; }
5449	  this.next();
5450	  if (createNewLexicalScope) { this.exitScope(); }
5451	  return this.finishNode(node, "BlockStatement")
5452	};
5453
5454	// Parse a regular `for` loop. The disambiguation code in
5455	// `parseStatement` will already have parsed the init statement or
5456	// expression.
5457
5458	pp$1.parseFor = function(node, init) {
5459	  node.init = init;
5460	  this.expect(types.semi);
5461	  node.test = this.type === types.semi ? null : this.parseExpression();
5462	  this.expect(types.semi);
5463	  node.update = this.type === types.parenR ? null : this.parseExpression();
5464	  this.expect(types.parenR);
5465	  node.body = this.parseStatement("for");
5466	  this.exitScope();
5467	  this.labels.pop();
5468	  return this.finishNode(node, "ForStatement")
5469	};
5470
5471	// Parse a `for`/`in` and `for`/`of` loop, which are almost
5472	// same from parser's perspective.
5473
5474	pp$1.parseForIn = function(node, init) {
5475	  var isForIn = this.type === types._in;
5476	  this.next();
5477
5478	  if (
5479	    init.type === "VariableDeclaration" &&
5480	    init.declarations[0].init != null &&
5481	    (
5482	      !isForIn ||
5483	      this.options.ecmaVersion < 8 ||
5484	      this.strict ||
5485	      init.kind !== "var" ||
5486	      init.declarations[0].id.type !== "Identifier"
5487	    )
5488	  ) {
5489	    this.raise(
5490	      init.start,
5491	      ((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer")
5492	    );
5493	  } else if (init.type === "AssignmentPattern") {
5494	    this.raise(init.start, "Invalid left-hand side in for-loop");
5495	  }
5496	  node.left = init;
5497	  node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
5498	  this.expect(types.parenR);
5499	  node.body = this.parseStatement("for");
5500	  this.exitScope();
5501	  this.labels.pop();
5502	  return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement")
5503	};
5504
5505	// Parse a list of variable declarations.
5506
5507	pp$1.parseVar = function(node, isFor, kind) {
5508	  node.declarations = [];
5509	  node.kind = kind;
5510	  for (;;) {
5511	    var decl = this.startNode();
5512	    this.parseVarId(decl, kind);
5513	    if (this.eat(types.eq)) {
5514	      decl.init = this.parseMaybeAssign(isFor);
5515	    } else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
5516	      this.unexpected();
5517	    } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
5518	      this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
5519	    } else {
5520	      decl.init = null;
5521	    }
5522	    node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
5523	    if (!this.eat(types.comma)) { break }
5524	  }
5525	  return node
5526	};
5527
5528	pp$1.parseVarId = function(decl, kind) {
5529	  decl.id = this.parseBindingAtom();
5530	  this.checkLVal(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
5531	};
5532
5533	var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
5534
5535	// Parse a function declaration or literal (depending on the
5536	// `statement & FUNC_STATEMENT`).
5537
5538	// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
5539	pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync) {
5540	  this.initFunction(node);
5541	  if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
5542	    if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
5543	      { this.unexpected(); }
5544	    node.generator = this.eat(types.star);
5545	  }
5546	  if (this.options.ecmaVersion >= 8)
5547	    { node.async = !!isAsync; }
5548
5549	  if (statement & FUNC_STATEMENT) {
5550	    node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
5551	    if (node.id && !(statement & FUNC_HANGING_STATEMENT))
5552	      // If it is a regular function declaration in sloppy mode, then it is
5553	      // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
5554	      // mode depends on properties of the current scope (see
5555	      // treatFunctionsAsVar).
5556	      { this.checkLVal(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }
5557	  }
5558
5559	  var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
5560	  this.yieldPos = 0;
5561	  this.awaitPos = 0;
5562	  this.awaitIdentPos = 0;
5563	  this.enterScope(functionFlags(node.async, node.generator));
5564
5565	  if (!(statement & FUNC_STATEMENT))
5566	    { node.id = this.type === types.name ? this.parseIdent() : null; }
5567
5568	  this.parseFunctionParams(node);
5569	  this.parseFunctionBody(node, allowExpressionBody, false);
5570
5571	  this.yieldPos = oldYieldPos;
5572	  this.awaitPos = oldAwaitPos;
5573	  this.awaitIdentPos = oldAwaitIdentPos;
5574	  return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
5575	};
5576
5577	pp$1.parseFunctionParams = function(node) {
5578	  this.expect(types.parenL);
5579	  node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
5580	  this.checkYieldAwaitInDefaultParams();
5581	};
5582
5583	// Parse a class declaration or literal (depending on the
5584	// `isStatement` parameter).
5585
5586	pp$1.parseClass = function(node, isStatement) {
5587	  this.next();
5588
5589	  // ecma-262 14.6 Class Definitions
5590	  // A class definition is always strict mode code.
5591	  var oldStrict = this.strict;
5592	  this.strict = true;
5593
5594	  this.parseClassId(node, isStatement);
5595	  this.parseClassSuper(node);
5596	  var classBody = this.startNode();
5597	  var hadConstructor = false;
5598	  classBody.body = [];
5599	  this.expect(types.braceL);
5600	  while (this.type !== types.braceR) {
5601	    var element = this.parseClassElement(node.superClass !== null);
5602	    if (element) {
5603	      classBody.body.push(element);
5604	      if (element.type === "MethodDefinition" && element.kind === "constructor") {
5605	        if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
5606	        hadConstructor = true;
5607	      }
5608	    }
5609	  }
5610	  this.strict = oldStrict;
5611	  this.next();
5612	  node.body = this.finishNode(classBody, "ClassBody");
5613	  return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
5614	};
5615
5616	pp$1.parseClassElement = function(constructorAllowsSuper) {
5617	  var this$1$1 = this;
5618
5619	  if (this.eat(types.semi)) { return null }
5620
5621	  var method = this.startNode();
5622	  var tryContextual = function (k, noLineBreak) {
5623	    if ( noLineBreak === void 0 ) noLineBreak = false;
5624
5625	    var start = this$1$1.start, startLoc = this$1$1.startLoc;
5626	    if (!this$1$1.eatContextual(k)) { return false }
5627	    if (this$1$1.type !== types.parenL && (!noLineBreak || !this$1$1.canInsertSemicolon())) { return true }
5628	    if (method.key) { this$1$1.unexpected(); }
5629	    method.computed = false;
5630	    method.key = this$1$1.startNodeAt(start, startLoc);
5631	    method.key.name = k;
5632	    this$1$1.finishNode(method.key, "Identifier");
5633	    return false
5634	  };
5635
5636	  method.kind = "method";
5637	  method.static = tryContextual("static");
5638	  var isGenerator = this.eat(types.star);
5639	  var isAsync = false;
5640	  if (!isGenerator) {
5641	    if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
5642	      isAsync = true;
5643	      isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
5644	    } else if (tryContextual("get")) {
5645	      method.kind = "get";
5646	    } else if (tryContextual("set")) {
5647	      method.kind = "set";
5648	    }
5649	  }
5650	  if (!method.key) { this.parsePropertyName(method); }
5651	  var key = method.key;
5652	  var allowsDirectSuper = false;
5653	  if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" ||
5654	      key.type === "Literal" && key.value === "constructor")) {
5655	    if (method.kind !== "method") { this.raise(key.start, "Constructor can't have get/set modifier"); }
5656	    if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
5657	    if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
5658	    method.kind = "constructor";
5659	    allowsDirectSuper = constructorAllowsSuper;
5660	  } else if (method.static && key.type === "Identifier" && key.name === "prototype") {
5661	    this.raise(key.start, "Classes may not have a static property named prototype");
5662	  }
5663	  this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper);
5664	  if (method.kind === "get" && method.value.params.length !== 0)
5665	    { this.raiseRecoverable(method.value.start, "getter should have no params"); }
5666	  if (method.kind === "set" && method.value.params.length !== 1)
5667	    { this.raiseRecoverable(method.value.start, "setter should have exactly one param"); }
5668	  if (method.kind === "set" && method.value.params[0].type === "RestElement")
5669	    { this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); }
5670	  return method
5671	};
5672
5673	pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
5674	  method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
5675	  return this.finishNode(method, "MethodDefinition")
5676	};
5677
5678	pp$1.parseClassId = function(node, isStatement) {
5679	  if (this.type === types.name) {
5680	    node.id = this.parseIdent();
5681	    if (isStatement)
5682	      { this.checkLVal(node.id, BIND_LEXICAL, false); }
5683	  } else {
5684	    if (isStatement === true)
5685	      { this.unexpected(); }
5686	    node.id = null;
5687	  }
5688	};
5689
5690	pp$1.parseClassSuper = function(node) {
5691	  node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
5692	};
5693
5694	// Parses module export declaration.
5695
5696	pp$1.parseExport = function(node, exports) {
5697	  this.next();
5698	  // export * from '...'
5699	  if (this.eat(types.star)) {
5700	    if (this.options.ecmaVersion >= 11) {
5701	      if (this.eatContextual("as")) {
5702	        node.exported = this.parseIdent(true);
5703	        this.checkExport(exports, node.exported.name, this.lastTokStart);
5704	      } else {
5705	        node.exported = null;
5706	      }
5707	    }
5708	    this.expectContextual("from");
5709	    if (this.type !== types.string) { this.unexpected(); }
5710	    node.source = this.parseExprAtom();
5711	    this.semicolon();
5712	    return this.finishNode(node, "ExportAllDeclaration")
5713	  }
5714	  if (this.eat(types._default)) { // export default ...
5715	    this.checkExport(exports, "default", this.lastTokStart);
5716	    var isAsync;
5717	    if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
5718	      var fNode = this.startNode();
5719	      this.next();
5720	      if (isAsync) { this.next(); }
5721	      node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
5722	    } else if (this.type === types._class) {
5723	      var cNode = this.startNode();
5724	      node.declaration = this.parseClass(cNode, "nullableID");
5725	    } else {
5726	      node.declaration = this.parseMaybeAssign();
5727	      this.semicolon();
5728	    }
5729	    return this.finishNode(node, "ExportDefaultDeclaration")
5730	  }
5731	  // export var|const|let|function|class ...
5732	  if (this.shouldParseExportStatement()) {
5733	    node.declaration = this.parseStatement(null);
5734	    if (node.declaration.type === "VariableDeclaration")
5735	      { this.checkVariableExport(exports, node.declaration.declarations); }
5736	    else
5737	      { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); }
5738	    node.specifiers = [];
5739	    node.source = null;
5740	  } else { // export { x, y as z } [from '...']
5741	    node.declaration = null;
5742	    node.specifiers = this.parseExportSpecifiers(exports);
5743	    if (this.eatContextual("from")) {
5744	      if (this.type !== types.string) { this.unexpected(); }
5745	      node.source = this.parseExprAtom();
5746	    } else {
5747	      for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
5748	        // check for keywords used as local names
5749	        var spec = list[i];
5750
5751	        this.checkUnreserved(spec.local);
5752	        // check if export is defined
5753	        this.checkLocalExport(spec.local);
5754	      }
5755
5756	      node.source = null;
5757	    }
5758	    this.semicolon();
5759	  }
5760	  return this.finishNode(node, "ExportNamedDeclaration")
5761	};
5762
5763	pp$1.checkExport = function(exports, name, pos) {
5764	  if (!exports) { return }
5765	  if (has(exports, name))
5766	    { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
5767	  exports[name] = true;
5768	};
5769
5770	pp$1.checkPatternExport = function(exports, pat) {
5771	  var type = pat.type;
5772	  if (type === "Identifier")
5773	    { this.checkExport(exports, pat.name, pat.start); }
5774	  else if (type === "ObjectPattern")
5775	    { for (var i = 0, list = pat.properties; i < list.length; i += 1)
5776	      {
5777	        var prop = list[i];
5778
5779	        this.checkPatternExport(exports, prop);
5780	      } }
5781	  else if (type === "ArrayPattern")
5782	    { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
5783	      var elt = list$1[i$1];
5784
5785	        if (elt) { this.checkPatternExport(exports, elt); }
5786	    } }
5787	  else if (type === "Property")
5788	    { this.checkPatternExport(exports, pat.value); }
5789	  else if (type === "AssignmentPattern")
5790	    { this.checkPatternExport(exports, pat.left); }
5791	  else if (type === "RestElement")
5792	    { this.checkPatternExport(exports, pat.argument); }
5793	  else if (type === "ParenthesizedExpression")
5794	    { this.checkPatternExport(exports, pat.expression); }
5795	};
5796
5797	pp$1.checkVariableExport = function(exports, decls) {
5798	  if (!exports) { return }
5799	  for (var i = 0, list = decls; i < list.length; i += 1)
5800	    {
5801	    var decl = list[i];
5802
5803	    this.checkPatternExport(exports, decl.id);
5804	  }
5805	};
5806
5807	pp$1.shouldParseExportStatement = function() {
5808	  return this.type.keyword === "var" ||
5809	    this.type.keyword === "const" ||
5810	    this.type.keyword === "class" ||
5811	    this.type.keyword === "function" ||
5812	    this.isLet() ||
5813	    this.isAsyncFunction()
5814	};
5815
5816	// Parses a comma-separated list of module exports.
5817
5818	pp$1.parseExportSpecifiers = function(exports) {
5819	  var nodes = [], first = true;
5820	  // export { x, y as z } [from '...']
5821	  this.expect(types.braceL);
5822	  while (!this.eat(types.braceR)) {
5823	    if (!first) {
5824	      this.expect(types.comma);
5825	      if (this.afterTrailingComma(types.braceR)) { break }
5826	    } else { first = false; }
5827
5828	    var node = this.startNode();
5829	    node.local = this.parseIdent(true);
5830	    node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;
5831	    this.checkExport(exports, node.exported.name, node.exported.start);
5832	    nodes.push(this.finishNode(node, "ExportSpecifier"));
5833	  }
5834	  return nodes
5835	};
5836
5837	// Parses import declaration.
5838
5839	pp$1.parseImport = function(node) {
5840	  this.next();
5841	  // import '...'
5842	  if (this.type === types.string) {
5843	    node.specifiers = empty;
5844	    node.source = this.parseExprAtom();
5845	  } else {
5846	    node.specifiers = this.parseImportSpecifiers();
5847	    this.expectContextual("from");
5848	    node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
5849	  }
5850	  this.semicolon();
5851	  return this.finishNode(node, "ImportDeclaration")
5852	};
5853
5854	// Parses a comma-separated list of module imports.
5855
5856	pp$1.parseImportSpecifiers = function() {
5857	  var nodes = [], first = true;
5858	  if (this.type === types.name) {
5859	    // import defaultObj, { x, y as z } from '...'
5860	    var node = this.startNode();
5861	    node.local = this.parseIdent();
5862	    this.checkLVal(node.local, BIND_LEXICAL);
5863	    nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
5864	    if (!this.eat(types.comma)) { return nodes }
5865	  }
5866	  if (this.type === types.star) {
5867	    var node$1 = this.startNode();
5868	    this.next();
5869	    this.expectContextual("as");
5870	    node$1.local = this.parseIdent();
5871	    this.checkLVal(node$1.local, BIND_LEXICAL);
5872	    nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
5873	    return nodes
5874	  }
5875	  this.expect(types.braceL);
5876	  while (!this.eat(types.braceR)) {
5877	    if (!first) {
5878	      this.expect(types.comma);
5879	      if (this.afterTrailingComma(types.braceR)) { break }
5880	    } else { first = false; }
5881
5882	    var node$2 = this.startNode();
5883	    node$2.imported = this.parseIdent(true);
5884	    if (this.eatContextual("as")) {
5885	      node$2.local = this.parseIdent();
5886	    } else {
5887	      this.checkUnreserved(node$2.imported);
5888	      node$2.local = node$2.imported;
5889	    }
5890	    this.checkLVal(node$2.local, BIND_LEXICAL);
5891	    nodes.push(this.finishNode(node$2, "ImportSpecifier"));
5892	  }
5893	  return nodes
5894	};
5895
5896	// Set `ExpressionStatement#directive` property for directive prologues.
5897	pp$1.adaptDirectivePrologue = function(statements) {
5898	  for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
5899	    statements[i].directive = statements[i].expression.raw.slice(1, -1);
5900	  }
5901	};
5902	pp$1.isDirectiveCandidate = function(statement) {
5903	  return (
5904	    statement.type === "ExpressionStatement" &&
5905	    statement.expression.type === "Literal" &&
5906	    typeof statement.expression.value === "string" &&
5907	    // Reject parenthesized strings.
5908	    (this.input[statement.start] === "\"" || this.input[statement.start] === "'")
5909	  )
5910	};
5911
5912	var pp$2 = Parser.prototype;
5913
5914	// Convert existing expression atom to assignable pattern
5915	// if possible.
5916
5917	pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
5918	  if (this.options.ecmaVersion >= 6 && node) {
5919	    switch (node.type) {
5920	    case "Identifier":
5921	      if (this.inAsync && node.name === "await")
5922	        { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); }
5923	      break
5924
5925	    case "ObjectPattern":
5926	    case "ArrayPattern":
5927	    case "RestElement":
5928	      break
5929
5930	    case "ObjectExpression":
5931	      node.type = "ObjectPattern";
5932	      if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
5933	      for (var i = 0, list = node.properties; i < list.length; i += 1) {
5934	        var prop = list[i];
5935
5936	      this.toAssignable(prop, isBinding);
5937	        // Early error:
5938	        //   AssignmentRestProperty[Yield, Await] :
5939	        //     `...` DestructuringAssignmentTarget[Yield, Await]
5940	        //
5941	        //   It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
5942	        if (
5943	          prop.type === "RestElement" &&
5944	          (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
5945	        ) {
5946	          this.raise(prop.argument.start, "Unexpected token");
5947	        }
5948	      }
5949	      break
5950
5951	    case "Property":
5952	      // AssignmentProperty has type === "Property"
5953	      if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); }
5954	      this.toAssignable(node.value, isBinding);
5955	      break
5956
5957	    case "ArrayExpression":
5958	      node.type = "ArrayPattern";
5959	      if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
5960	      this.toAssignableList(node.elements, isBinding);
5961	      break
5962
5963	    case "SpreadElement":
5964	      node.type = "RestElement";
5965	      this.toAssignable(node.argument, isBinding);
5966	      if (node.argument.type === "AssignmentPattern")
5967	        { this.raise(node.argument.start, "Rest elements cannot have a default value"); }
5968	      break
5969
5970	    case "AssignmentExpression":
5971	      if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); }
5972	      node.type = "AssignmentPattern";
5973	      delete node.operator;
5974	      this.toAssignable(node.left, isBinding);
5975	      // falls through to AssignmentPattern
5976
5977	    case "AssignmentPattern":
5978	      break
5979
5980	    case "ParenthesizedExpression":
5981	      this.toAssignable(node.expression, isBinding, refDestructuringErrors);
5982	      break
5983
5984	    case "ChainExpression":
5985	      this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
5986	      break
5987
5988	    case "MemberExpression":
5989	      if (!isBinding) { break }
5990
5991	    default:
5992	      this.raise(node.start, "Assigning to rvalue");
5993	    }
5994	  } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
5995	  return node
5996	};
5997
5998	// Convert list of expression atoms to binding list.
5999
6000	pp$2.toAssignableList = function(exprList, isBinding) {
6001	  var end = exprList.length;
6002	  for (var i = 0; i < end; i++) {
6003	    var elt = exprList[i];
6004	    if (elt) { this.toAssignable(elt, isBinding); }
6005	  }
6006	  if (end) {
6007	    var last = exprList[end - 1];
6008	    if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
6009	      { this.unexpected(last.argument.start); }
6010	  }
6011	  return exprList
6012	};
6013
6014	// Parses spread element.
6015
6016	pp$2.parseSpread = function(refDestructuringErrors) {
6017	  var node = this.startNode();
6018	  this.next();
6019	  node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
6020	  return this.finishNode(node, "SpreadElement")
6021	};
6022
6023	pp$2.parseRestBinding = function() {
6024	  var node = this.startNode();
6025	  this.next();
6026
6027	  // RestElement inside of a function parameter must be an identifier
6028	  if (this.options.ecmaVersion === 6 && this.type !== types.name)
6029	    { this.unexpected(); }
6030
6031	  node.argument = this.parseBindingAtom();
6032
6033	  return this.finishNode(node, "RestElement")
6034	};
6035
6036	// Parses lvalue (assignable) atom.
6037
6038	pp$2.parseBindingAtom = function() {
6039	  if (this.options.ecmaVersion >= 6) {
6040	    switch (this.type) {
6041	    case types.bracketL:
6042	      var node = this.startNode();
6043	      this.next();
6044	      node.elements = this.parseBindingList(types.bracketR, true, true);
6045	      return this.finishNode(node, "ArrayPattern")
6046
6047	    case types.braceL:
6048	      return this.parseObj(true)
6049	    }
6050	  }
6051	  return this.parseIdent()
6052	};
6053
6054	pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
6055	  var elts = [], first = true;
6056	  while (!this.eat(close)) {
6057	    if (first) { first = false; }
6058	    else { this.expect(types.comma); }
6059	    if (allowEmpty && this.type === types.comma) {
6060	      elts.push(null);
6061	    } else if (allowTrailingComma && this.afterTrailingComma(close)) {
6062	      break
6063	    } else if (this.type === types.ellipsis) {
6064	      var rest = this.parseRestBinding();
6065	      this.parseBindingListItem(rest);
6066	      elts.push(rest);
6067	      if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
6068	      this.expect(close);
6069	      break
6070	    } else {
6071	      var elem = this.parseMaybeDefault(this.start, this.startLoc);
6072	      this.parseBindingListItem(elem);
6073	      elts.push(elem);
6074	    }
6075	  }
6076	  return elts
6077	};
6078
6079	pp$2.parseBindingListItem = function(param) {
6080	  return param
6081	};
6082
6083	// Parses assignment pattern around given atom if possible.
6084
6085	pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
6086	  left = left || this.parseBindingAtom();
6087	  if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
6088	  var node = this.startNodeAt(startPos, startLoc);
6089	  node.left = left;
6090	  node.right = this.parseMaybeAssign();
6091	  return this.finishNode(node, "AssignmentPattern")
6092	};
6093
6094	// Verify that a node is an lval — something that can be assigned
6095	// to.
6096	// bindingType can be either:
6097	// 'var' indicating that the lval creates a 'var' binding
6098	// 'let' indicating that the lval creates a lexical ('let' or 'const') binding
6099	// 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references
6100
6101	pp$2.checkLVal = function(expr, bindingType, checkClashes) {
6102	  if ( bindingType === void 0 ) bindingType = BIND_NONE;
6103
6104	  switch (expr.type) {
6105	  case "Identifier":
6106	    if (bindingType === BIND_LEXICAL && expr.name === "let")
6107	      { this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); }
6108	    if (this.strict && this.reservedWordsStrictBind.test(expr.name))
6109	      { this.raiseRecoverable(expr.start, (bindingType ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); }
6110	    if (checkClashes) {
6111	      if (has(checkClashes, expr.name))
6112	        { this.raiseRecoverable(expr.start, "Argument name clash"); }
6113	      checkClashes[expr.name] = true;
6114	    }
6115	    if (bindingType !== BIND_NONE && bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }
6116	    break
6117
6118	  case "ChainExpression":
6119	    this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
6120	    break
6121
6122	  case "MemberExpression":
6123	    if (bindingType) { this.raiseRecoverable(expr.start, "Binding member expression"); }
6124	    break
6125
6126	  case "ObjectPattern":
6127	    for (var i = 0, list = expr.properties; i < list.length; i += 1)
6128	      {
6129	    var prop = list[i];
6130
6131	    this.checkLVal(prop, bindingType, checkClashes);
6132	  }
6133	    break
6134
6135	  case "Property":
6136	    // AssignmentProperty has type === "Property"
6137	    this.checkLVal(expr.value, bindingType, checkClashes);
6138	    break
6139
6140	  case "ArrayPattern":
6141	    for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
6142	      var elem = list$1[i$1];
6143
6144	    if (elem) { this.checkLVal(elem, bindingType, checkClashes); }
6145	    }
6146	    break
6147
6148	  case "AssignmentPattern":
6149	    this.checkLVal(expr.left, bindingType, checkClashes);
6150	    break
6151
6152	  case "RestElement":
6153	    this.checkLVal(expr.argument, bindingType, checkClashes);
6154	    break
6155
6156	  case "ParenthesizedExpression":
6157	    this.checkLVal(expr.expression, bindingType, checkClashes);
6158	    break
6159
6160	  default:
6161	    this.raise(expr.start, (bindingType ? "Binding" : "Assigning to") + " rvalue");
6162	  }
6163	};
6164
6165	// A recursive descent parser operates by defining functions for all
6166
6167	var pp$3 = Parser.prototype;
6168
6169	// Check if property name clashes with already added.
6170	// Object/class getters and setters are not allowed to clash —
6171	// either with each other or with an init property — and in
6172	// strict mode, init properties are also not allowed to be repeated.
6173
6174	pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {
6175	  if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
6176	    { return }
6177	  if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
6178	    { return }
6179	  var key = prop.key;
6180	  var name;
6181	  switch (key.type) {
6182	  case "Identifier": name = key.name; break
6183	  case "Literal": name = String(key.value); break
6184	  default: return
6185	  }
6186	  var kind = prop.kind;
6187	  if (this.options.ecmaVersion >= 6) {
6188	    if (name === "__proto__" && kind === "init") {
6189	      if (propHash.proto) {
6190	        if (refDestructuringErrors) {
6191	          if (refDestructuringErrors.doubleProto < 0)
6192	            { refDestructuringErrors.doubleProto = key.start; }
6193	          // Backwards-compat kludge. Can be removed in version 6.0
6194	        } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); }
6195	      }
6196	      propHash.proto = true;
6197	    }
6198	    return
6199	  }
6200	  name = "$" + name;
6201	  var other = propHash[name];
6202	  if (other) {
6203	    var redefinition;
6204	    if (kind === "init") {
6205	      redefinition = this.strict && other.init || other.get || other.set;
6206	    } else {
6207	      redefinition = other.init || other[kind];
6208	    }
6209	    if (redefinition)
6210	      { this.raiseRecoverable(key.start, "Redefinition of property"); }
6211	  } else {
6212	    other = propHash[name] = {
6213	      init: false,
6214	      get: false,
6215	      set: false
6216	    };
6217	  }
6218	  other[kind] = true;
6219	};
6220
6221	// ### Expression parsing
6222
6223	// These nest, from the most general expression type at the top to
6224	// 'atomic', nondivisible expression types at the bottom. Most of
6225	// the functions will simply let the function(s) below them parse,
6226	// and, *if* the syntactic construct they handle is present, wrap
6227	// the AST node that the inner parser gave them in another node.
6228
6229	// Parse a full expression. The optional arguments are used to
6230	// forbid the `in` operator (in for loops initalization expressions)
6231	// and provide reference for storing '=' operator inside shorthand
6232	// property assignment in contexts where both object expression
6233	// and object pattern might appear (so it's possible to raise
6234	// delayed syntax error at correct position).
6235
6236	pp$3.parseExpression = function(noIn, refDestructuringErrors) {
6237	  var startPos = this.start, startLoc = this.startLoc;
6238	  var expr = this.parseMaybeAssign(noIn, refDestructuringErrors);
6239	  if (this.type === types.comma) {
6240	    var node = this.startNodeAt(startPos, startLoc);
6241	    node.expressions = [expr];
6242	    while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); }
6243	    return this.finishNode(node, "SequenceExpression")
6244	  }
6245	  return expr
6246	};
6247
6248	// Parse an assignment expression. This includes applications of
6249	// operators like `+=`.
6250
6251	pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
6252	  if (this.isContextual("yield")) {
6253	    if (this.inGenerator) { return this.parseYield(noIn) }
6254	    // The tokenizer will assume an expression is allowed after
6255	    // `yield`, but this isn't that kind of yield
6256	    else { this.exprAllowed = false; }
6257	  }
6258
6259	  var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
6260	  if (refDestructuringErrors) {
6261	    oldParenAssign = refDestructuringErrors.parenthesizedAssign;
6262	    oldTrailingComma = refDestructuringErrors.trailingComma;
6263	    refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
6264	  } else {
6265	    refDestructuringErrors = new DestructuringErrors;
6266	    ownDestructuringErrors = true;
6267	  }
6268
6269	  var startPos = this.start, startLoc = this.startLoc;
6270	  if (this.type === types.parenL || this.type === types.name)
6271	    { this.potentialArrowAt = this.start; }
6272	  var left = this.parseMaybeConditional(noIn, refDestructuringErrors);
6273	  if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
6274	  if (this.type.isAssign) {
6275	    var node = this.startNodeAt(startPos, startLoc);
6276	    node.operator = this.value;
6277	    node.left = this.type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left;
6278	    if (!ownDestructuringErrors) {
6279	      refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
6280	    }
6281	    if (refDestructuringErrors.shorthandAssign >= node.left.start)
6282	      { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
6283	    this.checkLVal(left);
6284	    this.next();
6285	    node.right = this.parseMaybeAssign(noIn);
6286	    return this.finishNode(node, "AssignmentExpression")
6287	  } else {
6288	    if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
6289	  }
6290	  if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }
6291	  if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }
6292	  return left
6293	};
6294
6295	// Parse a ternary conditional (`?:`) operator.
6296
6297	pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {
6298	  var startPos = this.start, startLoc = this.startLoc;
6299	  var expr = this.parseExprOps(noIn, refDestructuringErrors);
6300	  if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
6301	  if (this.eat(types.question)) {
6302	    var node = this.startNodeAt(startPos, startLoc);
6303	    node.test = expr;
6304	    node.consequent = this.parseMaybeAssign();
6305	    this.expect(types.colon);
6306	    node.alternate = this.parseMaybeAssign(noIn);
6307	    return this.finishNode(node, "ConditionalExpression")
6308	  }
6309	  return expr
6310	};
6311
6312	// Start the precedence parser.
6313
6314	pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
6315	  var startPos = this.start, startLoc = this.startLoc;
6316	  var expr = this.parseMaybeUnary(refDestructuringErrors, false);
6317	  if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
6318	  return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)
6319	};
6320
6321	// Parse binary operators with the operator precedence parsing
6322	// algorithm. `left` is the left-hand side of the operator.
6323	// `minPrec` provides context that allows the function to stop and
6324	// defer further parser to one of its callers when it encounters an
6325	// operator that has a lower precedence than the set it is parsing.
6326
6327	pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
6328	  var prec = this.type.binop;
6329	  if (prec != null && (!noIn || this.type !== types._in)) {
6330	    if (prec > minPrec) {
6331	      var logical = this.type === types.logicalOR || this.type === types.logicalAND;
6332	      var coalesce = this.type === types.coalesce;
6333	      if (coalesce) {
6334	        // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
6335	        // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
6336	        prec = types.logicalAND.binop;
6337	      }
6338	      var op = this.value;
6339	      this.next();
6340	      var startPos = this.start, startLoc = this.startLoc;
6341	      var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
6342	      var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
6343	      if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
6344	        this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
6345	      }
6346	      return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
6347	    }
6348	  }
6349	  return left
6350	};
6351
6352	pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {
6353	  var node = this.startNodeAt(startPos, startLoc);
6354	  node.left = left;
6355	  node.operator = op;
6356	  node.right = right;
6357	  return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")
6358	};
6359
6360	// Parse unary operators, both prefix and postfix.
6361
6362	pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
6363	  var startPos = this.start, startLoc = this.startLoc, expr;
6364	  if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
6365	    expr = this.parseAwait();
6366	    sawUnary = true;
6367	  } else if (this.type.prefix) {
6368	    var node = this.startNode(), update = this.type === types.incDec;
6369	    node.operator = this.value;
6370	    node.prefix = true;
6371	    this.next();
6372	    node.argument = this.parseMaybeUnary(null, true);
6373	    this.checkExpressionErrors(refDestructuringErrors, true);
6374	    if (update) { this.checkLVal(node.argument); }
6375	    else if (this.strict && node.operator === "delete" &&
6376	             node.argument.type === "Identifier")
6377	      { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
6378	    else { sawUnary = true; }
6379	    expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
6380	  } else {
6381	    expr = this.parseExprSubscripts(refDestructuringErrors);
6382	    if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
6383	    while (this.type.postfix && !this.canInsertSemicolon()) {
6384	      var node$1 = this.startNodeAt(startPos, startLoc);
6385	      node$1.operator = this.value;
6386	      node$1.prefix = false;
6387	      node$1.argument = expr;
6388	      this.checkLVal(expr);
6389	      this.next();
6390	      expr = this.finishNode(node$1, "UpdateExpression");
6391	    }
6392	  }
6393
6394	  if (!sawUnary && this.eat(types.starstar))
6395	    { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
6396	  else
6397	    { return expr }
6398	};
6399
6400	// Parse call, dot, and `[]`-subscript expressions.
6401
6402	pp$3.parseExprSubscripts = function(refDestructuringErrors) {
6403	  var startPos = this.start, startLoc = this.startLoc;
6404	  var expr = this.parseExprAtom(refDestructuringErrors);
6405	  if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
6406	    { return expr }
6407	  var result = this.parseSubscripts(expr, startPos, startLoc);
6408	  if (refDestructuringErrors && result.type === "MemberExpression") {
6409	    if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
6410	    if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
6411	  }
6412	  return result
6413	};
6414
6415	pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
6416	  var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
6417	      this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
6418	      this.potentialArrowAt === base.start;
6419	  var optionalChained = false;
6420
6421	  while (true) {
6422	    var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained);
6423
6424	    if (element.optional) { optionalChained = true; }
6425	    if (element === base || element.type === "ArrowFunctionExpression") {
6426	      if (optionalChained) {
6427	        var chainNode = this.startNodeAt(startPos, startLoc);
6428	        chainNode.expression = element;
6429	        element = this.finishNode(chainNode, "ChainExpression");
6430	      }
6431	      return element
6432	    }
6433
6434	    base = element;
6435	  }
6436	};
6437
6438	pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained) {
6439	  var optionalSupported = this.options.ecmaVersion >= 11;
6440	  var optional = optionalSupported && this.eat(types.questionDot);
6441	  if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
6442
6443	  var computed = this.eat(types.bracketL);
6444	  if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
6445	    var node = this.startNodeAt(startPos, startLoc);
6446	    node.object = base;
6447	    node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== "never");
6448	    node.computed = !!computed;
6449	    if (computed) { this.expect(types.bracketR); }
6450	    if (optionalSupported) {
6451	      node.optional = optional;
6452	    }
6453	    base = this.finishNode(node, "MemberExpression");
6454	  } else if (!noCalls && this.eat(types.parenL)) {
6455	    var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
6456	    this.yieldPos = 0;
6457	    this.awaitPos = 0;
6458	    this.awaitIdentPos = 0;
6459	    var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
6460	    if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
6461	      this.checkPatternErrors(refDestructuringErrors, false);
6462	      this.checkYieldAwaitInDefaultParams();
6463	      if (this.awaitIdentPos > 0)
6464	        { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
6465	      this.yieldPos = oldYieldPos;
6466	      this.awaitPos = oldAwaitPos;
6467	      this.awaitIdentPos = oldAwaitIdentPos;
6468	      return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
6469	    }
6470	    this.checkExpressionErrors(refDestructuringErrors, true);
6471	    this.yieldPos = oldYieldPos || this.yieldPos;
6472	    this.awaitPos = oldAwaitPos || this.awaitPos;
6473	    this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
6474	    var node$1 = this.startNodeAt(startPos, startLoc);
6475	    node$1.callee = base;
6476	    node$1.arguments = exprList;
6477	    if (optionalSupported) {
6478	      node$1.optional = optional;
6479	    }
6480	    base = this.finishNode(node$1, "CallExpression");
6481	  } else if (this.type === types.backQuote) {
6482	    if (optional || optionalChained) {
6483	      this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
6484	    }
6485	    var node$2 = this.startNodeAt(startPos, startLoc);
6486	    node$2.tag = base;
6487	    node$2.quasi = this.parseTemplate({isTagged: true});
6488	    base = this.finishNode(node$2, "TaggedTemplateExpression");
6489	  }
6490	  return base
6491	};
6492
6493	// Parse an atomic expression — either a single token that is an
6494	// expression, an expression started by a keyword like `function` or
6495	// `new`, or an expression wrapped in punctuation like `()`, `[]`,
6496	// or `{}`.
6497
6498	pp$3.parseExprAtom = function(refDestructuringErrors) {
6499	  // If a division operator appears in an expression position, the
6500	  // tokenizer got confused, and we force it to read a regexp instead.
6501	  if (this.type === types.slash) { this.readRegexp(); }
6502
6503	  var node, canBeArrow = this.potentialArrowAt === this.start;
6504	  switch (this.type) {
6505	  case types._super:
6506	    if (!this.allowSuper)
6507	      { this.raise(this.start, "'super' keyword outside a method"); }
6508	    node = this.startNode();
6509	    this.next();
6510	    if (this.type === types.parenL && !this.allowDirectSuper)
6511	      { this.raise(node.start, "super() call outside constructor of a subclass"); }
6512	    // The `super` keyword can appear at below:
6513	    // SuperProperty:
6514	    //     super [ Expression ]
6515	    //     super . IdentifierName
6516	    // SuperCall:
6517	    //     super ( Arguments )
6518	    if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
6519	      { this.unexpected(); }
6520	    return this.finishNode(node, "Super")
6521
6522	  case types._this:
6523	    node = this.startNode();
6524	    this.next();
6525	    return this.finishNode(node, "ThisExpression")
6526
6527	  case types.name:
6528	    var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
6529	    var id = this.parseIdent(false);
6530	    if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function))
6531	      { return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true) }
6532	    if (canBeArrow && !this.canInsertSemicolon()) {
6533	      if (this.eat(types.arrow))
6534	        { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }
6535	      if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc) {
6536	        id = this.parseIdent(false);
6537	        if (this.canInsertSemicolon() || !this.eat(types.arrow))
6538	          { this.unexpected(); }
6539	        return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)
6540	      }
6541	    }
6542	    return id
6543
6544	  case types.regexp:
6545	    var value = this.value;
6546	    node = this.parseLiteral(value.value);
6547	    node.regex = {pattern: value.pattern, flags: value.flags};
6548	    return node
6549
6550	  case types.num: case types.string:
6551	    return this.parseLiteral(this.value)
6552
6553	  case types._null: case types._true: case types._false:
6554	    node = this.startNode();
6555	    node.value = this.type === types._null ? null : this.type === types._true;
6556	    node.raw = this.type.keyword;
6557	    this.next();
6558	    return this.finishNode(node, "Literal")
6559
6560	  case types.parenL:
6561	    var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow);
6562	    if (refDestructuringErrors) {
6563	      if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
6564	        { refDestructuringErrors.parenthesizedAssign = start; }
6565	      if (refDestructuringErrors.parenthesizedBind < 0)
6566	        { refDestructuringErrors.parenthesizedBind = start; }
6567	    }
6568	    return expr
6569
6570	  case types.bracketL:
6571	    node = this.startNode();
6572	    this.next();
6573	    node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
6574	    return this.finishNode(node, "ArrayExpression")
6575
6576	  case types.braceL:
6577	    return this.parseObj(false, refDestructuringErrors)
6578
6579	  case types._function:
6580	    node = this.startNode();
6581	    this.next();
6582	    return this.parseFunction(node, 0)
6583
6584	  case types._class:
6585	    return this.parseClass(this.startNode(), false)
6586
6587	  case types._new:
6588	    return this.parseNew()
6589
6590	  case types.backQuote:
6591	    return this.parseTemplate()
6592
6593	  case types._import:
6594	    if (this.options.ecmaVersion >= 11) {
6595	      return this.parseExprImport()
6596	    } else {
6597	      return this.unexpected()
6598	    }
6599
6600	  default:
6601	    this.unexpected();
6602	  }
6603	};
6604
6605	pp$3.parseExprImport = function() {
6606	  var node = this.startNode();
6607
6608	  // Consume `import` as an identifier for `import.meta`.
6609	  // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
6610	  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
6611	  var meta = this.parseIdent(true);
6612
6613	  switch (this.type) {
6614	  case types.parenL:
6615	    return this.parseDynamicImport(node)
6616	  case types.dot:
6617	    node.meta = meta;
6618	    return this.parseImportMeta(node)
6619	  default:
6620	    this.unexpected();
6621	  }
6622	};
6623
6624	pp$3.parseDynamicImport = function(node) {
6625	  this.next(); // skip `(`
6626
6627	  // Parse node.source.
6628	  node.source = this.parseMaybeAssign();
6629
6630	  // Verify ending.
6631	  if (!this.eat(types.parenR)) {
6632	    var errorPos = this.start;
6633	    if (this.eat(types.comma) && this.eat(types.parenR)) {
6634	      this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
6635	    } else {
6636	      this.unexpected(errorPos);
6637	    }
6638	  }
6639
6640	  return this.finishNode(node, "ImportExpression")
6641	};
6642
6643	pp$3.parseImportMeta = function(node) {
6644	  this.next(); // skip `.`
6645
6646	  var containsEsc = this.containsEsc;
6647	  node.property = this.parseIdent(true);
6648
6649	  if (node.property.name !== "meta")
6650	    { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
6651	  if (containsEsc)
6652	    { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
6653	  if (this.options.sourceType !== "module")
6654	    { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
6655
6656	  return this.finishNode(node, "MetaProperty")
6657	};
6658
6659	pp$3.parseLiteral = function(value) {
6660	  var node = this.startNode();
6661	  node.value = value;
6662	  node.raw = this.input.slice(this.start, this.end);
6663	  if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); }
6664	  this.next();
6665	  return this.finishNode(node, "Literal")
6666	};
6667
6668	pp$3.parseParenExpression = function() {
6669	  this.expect(types.parenL);
6670	  var val = this.parseExpression();
6671	  this.expect(types.parenR);
6672	  return val
6673	};
6674
6675	pp$3.parseParenAndDistinguishExpression = function(canBeArrow) {
6676	  var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
6677	  if (this.options.ecmaVersion >= 6) {
6678	    this.next();
6679
6680	    var innerStartPos = this.start, innerStartLoc = this.startLoc;
6681	    var exprList = [], first = true, lastIsComma = false;
6682	    var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
6683	    this.yieldPos = 0;
6684	    this.awaitPos = 0;
6685	    // Do not save awaitIdentPos to allow checking awaits nested in parameters
6686	    while (this.type !== types.parenR) {
6687	      first ? first = false : this.expect(types.comma);
6688	      if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
6689	        lastIsComma = true;
6690	        break
6691	      } else if (this.type === types.ellipsis) {
6692	        spreadStart = this.start;
6693	        exprList.push(this.parseParenItem(this.parseRestBinding()));
6694	        if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
6695	        break
6696	      } else {
6697	        exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
6698	      }
6699	    }
6700	    var innerEndPos = this.start, innerEndLoc = this.startLoc;
6701	    this.expect(types.parenR);
6702
6703	    if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
6704	      this.checkPatternErrors(refDestructuringErrors, false);
6705	      this.checkYieldAwaitInDefaultParams();
6706	      this.yieldPos = oldYieldPos;
6707	      this.awaitPos = oldAwaitPos;
6708	      return this.parseParenArrowList(startPos, startLoc, exprList)
6709	    }
6710
6711	    if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }
6712	    if (spreadStart) { this.unexpected(spreadStart); }
6713	    this.checkExpressionErrors(refDestructuringErrors, true);
6714	    this.yieldPos = oldYieldPos || this.yieldPos;
6715	    this.awaitPos = oldAwaitPos || this.awaitPos;
6716
6717	    if (exprList.length > 1) {
6718	      val = this.startNodeAt(innerStartPos, innerStartLoc);
6719	      val.expressions = exprList;
6720	      this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
6721	    } else {
6722	      val = exprList[0];
6723	    }
6724	  } else {
6725	    val = this.parseParenExpression();
6726	  }
6727
6728	  if (this.options.preserveParens) {
6729	    var par = this.startNodeAt(startPos, startLoc);
6730	    par.expression = val;
6731	    return this.finishNode(par, "ParenthesizedExpression")
6732	  } else {
6733	    return val
6734	  }
6735	};
6736
6737	pp$3.parseParenItem = function(item) {
6738	  return item
6739	};
6740
6741	pp$3.parseParenArrowList = function(startPos, startLoc, exprList) {
6742	  return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)
6743	};
6744
6745	// New's precedence is slightly tricky. It must allow its argument to
6746	// be a `[]` or dot subscript expression, but not a call — at least,
6747	// not without wrapping it in parentheses. Thus, it uses the noCalls
6748	// argument to parseSubscripts to prevent it from consuming the
6749	// argument list.
6750
6751	var empty$1 = [];
6752
6753	pp$3.parseNew = function() {
6754	  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
6755	  var node = this.startNode();
6756	  var meta = this.parseIdent(true);
6757	  if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
6758	    node.meta = meta;
6759	    var containsEsc = this.containsEsc;
6760	    node.property = this.parseIdent(true);
6761	    if (node.property.name !== "target")
6762	      { this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); }
6763	    if (containsEsc)
6764	      { this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); }
6765	    if (!this.inNonArrowFunction())
6766	      { this.raiseRecoverable(node.start, "'new.target' can only be used in functions"); }
6767	    return this.finishNode(node, "MetaProperty")
6768	  }
6769	  var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
6770	  node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
6771	  if (isImport && node.callee.type === "ImportExpression") {
6772	    this.raise(startPos, "Cannot use new with import()");
6773	  }
6774	  if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
6775	  else { node.arguments = empty$1; }
6776	  return this.finishNode(node, "NewExpression")
6777	};
6778
6779	// Parse template expression.
6780
6781	pp$3.parseTemplateElement = function(ref) {
6782	  var isTagged = ref.isTagged;
6783
6784	  var elem = this.startNode();
6785	  if (this.type === types.invalidTemplate) {
6786	    if (!isTagged) {
6787	      this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
6788	    }
6789	    elem.value = {
6790	      raw: this.value,
6791	      cooked: null
6792	    };
6793	  } else {
6794	    elem.value = {
6795	      raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
6796	      cooked: this.value
6797	    };
6798	  }
6799	  this.next();
6800	  elem.tail = this.type === types.backQuote;
6801	  return this.finishNode(elem, "TemplateElement")
6802	};
6803
6804	pp$3.parseTemplate = function(ref) {
6805	  if ( ref === void 0 ) ref = {};
6806	  var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
6807
6808	  var node = this.startNode();
6809	  this.next();
6810	  node.expressions = [];
6811	  var curElt = this.parseTemplateElement({isTagged: isTagged});
6812	  node.quasis = [curElt];
6813	  while (!curElt.tail) {
6814	    if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
6815	    this.expect(types.dollarBraceL);
6816	    node.expressions.push(this.parseExpression());
6817	    this.expect(types.braceR);
6818	    node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
6819	  }
6820	  this.next();
6821	  return this.finishNode(node, "TemplateLiteral")
6822	};
6823
6824	pp$3.isAsyncProp = function(prop) {
6825	  return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
6826	    (this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&
6827	    !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
6828	};
6829
6830	// Parse an object literal or binding pattern.
6831
6832	pp$3.parseObj = function(isPattern, refDestructuringErrors) {
6833	  var node = this.startNode(), first = true, propHash = {};
6834	  node.properties = [];
6835	  this.next();
6836	  while (!this.eat(types.braceR)) {
6837	    if (!first) {
6838	      this.expect(types.comma);
6839	      if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
6840	    } else { first = false; }
6841
6842	    var prop = this.parseProperty(isPattern, refDestructuringErrors);
6843	    if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }
6844	    node.properties.push(prop);
6845	  }
6846	  return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
6847	};
6848
6849	pp$3.parseProperty = function(isPattern, refDestructuringErrors) {
6850	  var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
6851	  if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
6852	    if (isPattern) {
6853	      prop.argument = this.parseIdent(false);
6854	      if (this.type === types.comma) {
6855	        this.raise(this.start, "Comma is not permitted after the rest element");
6856	      }
6857	      return this.finishNode(prop, "RestElement")
6858	    }
6859	    // To disallow parenthesized identifier via `this.toAssignable()`.
6860	    if (this.type === types.parenL && refDestructuringErrors) {
6861	      if (refDestructuringErrors.parenthesizedAssign < 0) {
6862	        refDestructuringErrors.parenthesizedAssign = this.start;
6863	      }
6864	      if (refDestructuringErrors.parenthesizedBind < 0) {
6865	        refDestructuringErrors.parenthesizedBind = this.start;
6866	      }
6867	    }
6868	    // Parse argument.
6869	    prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
6870	    // To disallow trailing comma via `this.toAssignable()`.
6871	    if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
6872	      refDestructuringErrors.trailingComma = this.start;
6873	    }
6874	    // Finish
6875	    return this.finishNode(prop, "SpreadElement")
6876	  }
6877	  if (this.options.ecmaVersion >= 6) {
6878	    prop.method = false;
6879	    prop.shorthand = false;
6880	    if (isPattern || refDestructuringErrors) {
6881	      startPos = this.start;
6882	      startLoc = this.startLoc;
6883	    }
6884	    if (!isPattern)
6885	      { isGenerator = this.eat(types.star); }
6886	  }
6887	  var containsEsc = this.containsEsc;
6888	  this.parsePropertyName(prop);
6889	  if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
6890	    isAsync = true;
6891	    isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
6892	    this.parsePropertyName(prop, refDestructuringErrors);
6893	  } else {
6894	    isAsync = false;
6895	  }
6896	  this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
6897	  return this.finishNode(prop, "Property")
6898	};
6899
6900	pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
6901	  if ((isGenerator || isAsync) && this.type === types.colon)
6902	    { this.unexpected(); }
6903
6904	  if (this.eat(types.colon)) {
6905	    prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
6906	    prop.kind = "init";
6907	  } else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
6908	    if (isPattern) { this.unexpected(); }
6909	    prop.kind = "init";
6910	    prop.method = true;
6911	    prop.value = this.parseMethod(isGenerator, isAsync);
6912	  } else if (!isPattern && !containsEsc &&
6913	             this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
6914	             (prop.key.name === "get" || prop.key.name === "set") &&
6915	             (this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
6916	    if (isGenerator || isAsync) { this.unexpected(); }
6917	    prop.kind = prop.key.name;
6918	    this.parsePropertyName(prop);
6919	    prop.value = this.parseMethod(false);
6920	    var paramCount = prop.kind === "get" ? 0 : 1;
6921	    if (prop.value.params.length !== paramCount) {
6922	      var start = prop.value.start;
6923	      if (prop.kind === "get")
6924	        { this.raiseRecoverable(start, "getter should have no params"); }
6925	      else
6926	        { this.raiseRecoverable(start, "setter should have exactly one param"); }
6927	    } else {
6928	      if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
6929	        { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
6930	    }
6931	  } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
6932	    if (isGenerator || isAsync) { this.unexpected(); }
6933	    this.checkUnreserved(prop.key);
6934	    if (prop.key.name === "await" && !this.awaitIdentPos)
6935	      { this.awaitIdentPos = startPos; }
6936	    prop.kind = "init";
6937	    if (isPattern) {
6938	      prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
6939	    } else if (this.type === types.eq && refDestructuringErrors) {
6940	      if (refDestructuringErrors.shorthandAssign < 0)
6941	        { refDestructuringErrors.shorthandAssign = this.start; }
6942	      prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
6943	    } else {
6944	      prop.value = prop.key;
6945	    }
6946	    prop.shorthand = true;
6947	  } else { this.unexpected(); }
6948	};
6949
6950	pp$3.parsePropertyName = function(prop) {
6951	  if (this.options.ecmaVersion >= 6) {
6952	    if (this.eat(types.bracketL)) {
6953	      prop.computed = true;
6954	      prop.key = this.parseMaybeAssign();
6955	      this.expect(types.bracketR);
6956	      return prop.key
6957	    } else {
6958	      prop.computed = false;
6959	    }
6960	  }
6961	  return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
6962	};
6963
6964	// Initialize empty function node.
6965
6966	pp$3.initFunction = function(node) {
6967	  node.id = null;
6968	  if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
6969	  if (this.options.ecmaVersion >= 8) { node.async = false; }
6970	};
6971
6972	// Parse object or class method.
6973
6974	pp$3.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
6975	  var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
6976
6977	  this.initFunction(node);
6978	  if (this.options.ecmaVersion >= 6)
6979	    { node.generator = isGenerator; }
6980	  if (this.options.ecmaVersion >= 8)
6981	    { node.async = !!isAsync; }
6982
6983	  this.yieldPos = 0;
6984	  this.awaitPos = 0;
6985	  this.awaitIdentPos = 0;
6986	  this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
6987
6988	  this.expect(types.parenL);
6989	  node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
6990	  this.checkYieldAwaitInDefaultParams();
6991	  this.parseFunctionBody(node, false, true);
6992
6993	  this.yieldPos = oldYieldPos;
6994	  this.awaitPos = oldAwaitPos;
6995	  this.awaitIdentPos = oldAwaitIdentPos;
6996	  return this.finishNode(node, "FunctionExpression")
6997	};
6998
6999	// Parse arrow function expression with given parameters.
7000
7001	pp$3.parseArrowExpression = function(node, params, isAsync) {
7002	  var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
7003
7004	  this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
7005	  this.initFunction(node);
7006	  if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }
7007
7008	  this.yieldPos = 0;
7009	  this.awaitPos = 0;
7010	  this.awaitIdentPos = 0;
7011
7012	  node.params = this.toAssignableList(params, true);
7013	  this.parseFunctionBody(node, true, false);
7014
7015	  this.yieldPos = oldYieldPos;
7016	  this.awaitPos = oldAwaitPos;
7017	  this.awaitIdentPos = oldAwaitIdentPos;
7018	  return this.finishNode(node, "ArrowFunctionExpression")
7019	};
7020
7021	// Parse function body and check parameters.
7022
7023	pp$3.parseFunctionBody = function(node, isArrowFunction, isMethod) {
7024	  var isExpression = isArrowFunction && this.type !== types.braceL;
7025	  var oldStrict = this.strict, useStrict = false;
7026
7027	  if (isExpression) {
7028	    node.body = this.parseMaybeAssign();
7029	    node.expression = true;
7030	    this.checkParams(node, false);
7031	  } else {
7032	    var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
7033	    if (!oldStrict || nonSimple) {
7034	      useStrict = this.strictDirective(this.end);
7035	      // If this is a strict mode function, verify that argument names
7036	      // are not repeated, and it does not try to bind the words `eval`
7037	      // or `arguments`.
7038	      if (useStrict && nonSimple)
7039	        { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); }
7040	    }
7041	    // Start a new scope with regard to labels and the `inFunction`
7042	    // flag (restore them to their old value afterwards).
7043	    var oldLabels = this.labels;
7044	    this.labels = [];
7045	    if (useStrict) { this.strict = true; }
7046
7047	    // Add the params to varDeclaredNames to ensure that an error is thrown
7048	    // if a let/const declaration in the function clashes with one of the params.
7049	    this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
7050	    // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
7051	    if (this.strict && node.id) { this.checkLVal(node.id, BIND_OUTSIDE); }
7052	    node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
7053	    node.expression = false;
7054	    this.adaptDirectivePrologue(node.body.body);
7055	    this.labels = oldLabels;
7056	  }
7057	  this.exitScope();
7058	};
7059
7060	pp$3.isSimpleParamList = function(params) {
7061	  for (var i = 0, list = params; i < list.length; i += 1)
7062	    {
7063	    var param = list[i];
7064
7065	    if (param.type !== "Identifier") { return false
7066	  } }
7067	  return true
7068	};
7069
7070	// Checks function params for various disallowed patterns such as using "eval"
7071	// or "arguments" and duplicate parameters.
7072
7073	pp$3.checkParams = function(node, allowDuplicates) {
7074	  var nameHash = {};
7075	  for (var i = 0, list = node.params; i < list.length; i += 1)
7076	    {
7077	    var param = list[i];
7078
7079	    this.checkLVal(param, BIND_VAR, allowDuplicates ? null : nameHash);
7080	  }
7081	};
7082
7083	// Parses a comma-separated list of expressions, and returns them as
7084	// an array. `close` is the token type that ends the list, and
7085	// `allowEmpty` can be turned on to allow subsequent commas with
7086	// nothing in between them to be parsed as `null` (which is needed
7087	// for array literals).
7088
7089	pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
7090	  var elts = [], first = true;
7091	  while (!this.eat(close)) {
7092	    if (!first) {
7093	      this.expect(types.comma);
7094	      if (allowTrailingComma && this.afterTrailingComma(close)) { break }
7095	    } else { first = false; }
7096
7097	    var elt = (void 0);
7098	    if (allowEmpty && this.type === types.comma)
7099	      { elt = null; }
7100	    else if (this.type === types.ellipsis) {
7101	      elt = this.parseSpread(refDestructuringErrors);
7102	      if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
7103	        { refDestructuringErrors.trailingComma = this.start; }
7104	    } else {
7105	      elt = this.parseMaybeAssign(false, refDestructuringErrors);
7106	    }
7107	    elts.push(elt);
7108	  }
7109	  return elts
7110	};
7111
7112	pp$3.checkUnreserved = function(ref) {
7113	  var start = ref.start;
7114	  var end = ref.end;
7115	  var name = ref.name;
7116
7117	  if (this.inGenerator && name === "yield")
7118	    { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
7119	  if (this.inAsync && name === "await")
7120	    { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
7121	  if (this.keywords.test(name))
7122	    { this.raise(start, ("Unexpected keyword '" + name + "'")); }
7123	  if (this.options.ecmaVersion < 6 &&
7124	    this.input.slice(start, end).indexOf("\\") !== -1) { return }
7125	  var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
7126	  if (re.test(name)) {
7127	    if (!this.inAsync && name === "await")
7128	      { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); }
7129	    this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved"));
7130	  }
7131	};
7132
7133	// Parse the next token as an identifier. If `liberal` is true (used
7134	// when parsing properties), it will also convert keywords into
7135	// identifiers.
7136
7137	pp$3.parseIdent = function(liberal, isBinding) {
7138	  var node = this.startNode();
7139	  if (this.type === types.name) {
7140	    node.name = this.value;
7141	  } else if (this.type.keyword) {
7142	    node.name = this.type.keyword;
7143
7144	    // To fix https://github.com/acornjs/acorn/issues/575
7145	    // `class` and `function` keywords push new context into this.context.
7146	    // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
7147	    // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
7148	    if ((node.name === "class" || node.name === "function") &&
7149	        (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
7150	      this.context.pop();
7151	    }
7152	  } else {
7153	    this.unexpected();
7154	  }
7155	  this.next(!!liberal);
7156	  this.finishNode(node, "Identifier");
7157	  if (!liberal) {
7158	    this.checkUnreserved(node);
7159	    if (node.name === "await" && !this.awaitIdentPos)
7160	      { this.awaitIdentPos = node.start; }
7161	  }
7162	  return node
7163	};
7164
7165	// Parses yield expression inside generator.
7166
7167	pp$3.parseYield = function(noIn) {
7168	  if (!this.yieldPos) { this.yieldPos = this.start; }
7169
7170	  var node = this.startNode();
7171	  this.next();
7172	  if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
7173	    node.delegate = false;
7174	    node.argument = null;
7175	  } else {
7176	    node.delegate = this.eat(types.star);
7177	    node.argument = this.parseMaybeAssign(noIn);
7178	  }
7179	  return this.finishNode(node, "YieldExpression")
7180	};
7181
7182	pp$3.parseAwait = function() {
7183	  if (!this.awaitPos) { this.awaitPos = this.start; }
7184
7185	  var node = this.startNode();
7186	  this.next();
7187	  node.argument = this.parseMaybeUnary(null, false);
7188	  return this.finishNode(node, "AwaitExpression")
7189	};
7190
7191	var pp$4 = Parser.prototype;
7192
7193	// This function is used to raise exceptions on parse errors. It
7194	// takes an offset integer (into the current `input`) to indicate
7195	// the location of the error, attaches the position to the end
7196	// of the error message, and then raises a `SyntaxError` with that
7197	// message.
7198
7199	pp$4.raise = function(pos, message) {
7200	  var loc = getLineInfo(this.input, pos);
7201	  message += " (" + loc.line + ":" + loc.column + ")";
7202	  var err = new SyntaxError(message);
7203	  err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
7204	  throw err
7205	};
7206
7207	pp$4.raiseRecoverable = pp$4.raise;
7208
7209	pp$4.curPosition = function() {
7210	  if (this.options.locations) {
7211	    return new Position(this.curLine, this.pos - this.lineStart)
7212	  }
7213	};
7214
7215	var pp$5 = Parser.prototype;
7216
7217	var Scope = function Scope(flags) {
7218	  this.flags = flags;
7219	  // A list of var-declared names in the current lexical scope
7220	  this.var = [];
7221	  // A list of lexically-declared names in the current lexical scope
7222	  this.lexical = [];
7223	  // A list of lexically-declared FunctionDeclaration names in the current lexical scope
7224	  this.functions = [];
7225	};
7226
7227	// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
7228
7229	pp$5.enterScope = function(flags) {
7230	  this.scopeStack.push(new Scope(flags));
7231	};
7232
7233	pp$5.exitScope = function() {
7234	  this.scopeStack.pop();
7235	};
7236
7237	// The spec says:
7238	// > At the top level of a function, or script, function declarations are
7239	// > treated like var declarations rather than like lexical declarations.
7240	pp$5.treatFunctionsAsVarInScope = function(scope) {
7241	  return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
7242	};
7243
7244	pp$5.declareName = function(name, bindingType, pos) {
7245	  var redeclared = false;
7246	  if (bindingType === BIND_LEXICAL) {
7247	    var scope = this.currentScope();
7248	    redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
7249	    scope.lexical.push(name);
7250	    if (this.inModule && (scope.flags & SCOPE_TOP))
7251	      { delete this.undefinedExports[name]; }
7252	  } else if (bindingType === BIND_SIMPLE_CATCH) {
7253	    var scope$1 = this.currentScope();
7254	    scope$1.lexical.push(name);
7255	  } else if (bindingType === BIND_FUNCTION) {
7256	    var scope$2 = this.currentScope();
7257	    if (this.treatFunctionsAsVar)
7258	      { redeclared = scope$2.lexical.indexOf(name) > -1; }
7259	    else
7260	      { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }
7261	    scope$2.functions.push(name);
7262	  } else {
7263	    for (var i = this.scopeStack.length - 1; i >= 0; --i) {
7264	      var scope$3 = this.scopeStack[i];
7265	      if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
7266	          !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
7267	        redeclared = true;
7268	        break
7269	      }
7270	      scope$3.var.push(name);
7271	      if (this.inModule && (scope$3.flags & SCOPE_TOP))
7272	        { delete this.undefinedExports[name]; }
7273	      if (scope$3.flags & SCOPE_VAR) { break }
7274	    }
7275	  }
7276	  if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
7277	};
7278
7279	pp$5.checkLocalExport = function(id) {
7280	  // scope.functions must be empty as Module code is always strict.
7281	  if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
7282	      this.scopeStack[0].var.indexOf(id.name) === -1) {
7283	    this.undefinedExports[id.name] = id;
7284	  }
7285	};
7286
7287	pp$5.currentScope = function() {
7288	  return this.scopeStack[this.scopeStack.length - 1]
7289	};
7290
7291	pp$5.currentVarScope = function() {
7292	  for (var i = this.scopeStack.length - 1;; i--) {
7293	    var scope = this.scopeStack[i];
7294	    if (scope.flags & SCOPE_VAR) { return scope }
7295	  }
7296	};
7297
7298	// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
7299	pp$5.currentThisScope = function() {
7300	  for (var i = this.scopeStack.length - 1;; i--) {
7301	    var scope = this.scopeStack[i];
7302	    if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
7303	  }
7304	};
7305
7306	var Node = function Node(parser, pos, loc) {
7307	  this.type = "";
7308	  this.start = pos;
7309	  this.end = 0;
7310	  if (parser.options.locations)
7311	    { this.loc = new SourceLocation(parser, loc); }
7312	  if (parser.options.directSourceFile)
7313	    { this.sourceFile = parser.options.directSourceFile; }
7314	  if (parser.options.ranges)
7315	    { this.range = [pos, 0]; }
7316	};
7317
7318	// Start an AST node, attaching a start offset.
7319
7320	var pp$6 = Parser.prototype;
7321
7322	pp$6.startNode = function() {
7323	  return new Node(this, this.start, this.startLoc)
7324	};
7325
7326	pp$6.startNodeAt = function(pos, loc) {
7327	  return new Node(this, pos, loc)
7328	};
7329
7330	// Finish an AST node, adding `type` and `end` properties.
7331
7332	function finishNodeAt(node, type, pos, loc) {
7333	  node.type = type;
7334	  node.end = pos;
7335	  if (this.options.locations)
7336	    { node.loc.end = loc; }
7337	  if (this.options.ranges)
7338	    { node.range[1] = pos; }
7339	  return node
7340	}
7341
7342	pp$6.finishNode = function(node, type) {
7343	  return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
7344	};
7345
7346	// Finish node at given position
7347
7348	pp$6.finishNodeAt = function(node, type, pos, loc) {
7349	  return finishNodeAt.call(this, node, type, pos, loc)
7350	};
7351
7352	// The algorithm used to determine whether a regexp can appear at a
7353
7354	var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
7355	  this.token = token;
7356	  this.isExpr = !!isExpr;
7357	  this.preserveSpace = !!preserveSpace;
7358	  this.override = override;
7359	  this.generator = !!generator;
7360	};
7361
7362	var types$1 = {
7363	  b_stat: new TokContext("{", false),
7364	  b_expr: new TokContext("{", true),
7365	  b_tmpl: new TokContext("${", false),
7366	  p_stat: new TokContext("(", false),
7367	  p_expr: new TokContext("(", true),
7368	  q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
7369	  f_stat: new TokContext("function", false),
7370	  f_expr: new TokContext("function", true),
7371	  f_expr_gen: new TokContext("function", true, false, null, true),
7372	  f_gen: new TokContext("function", false, false, null, true)
7373	};
7374
7375	var pp$7 = Parser.prototype;
7376
7377	pp$7.initialContext = function() {
7378	  return [types$1.b_stat]
7379	};
7380
7381	pp$7.braceIsBlock = function(prevType) {
7382	  var parent = this.curContext();
7383	  if (parent === types$1.f_expr || parent === types$1.f_stat)
7384	    { return true }
7385	  if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr))
7386	    { return !parent.isExpr }
7387
7388	  // The check for `tt.name && exprAllowed` detects whether we are
7389	  // after a `yield` or `of` construct. See the `updateContext` for
7390	  // `tt.name`.
7391	  if (prevType === types._return || prevType === types.name && this.exprAllowed)
7392	    { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
7393	  if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
7394	    { return true }
7395	  if (prevType === types.braceL)
7396	    { return parent === types$1.b_stat }
7397	  if (prevType === types._var || prevType === types._const || prevType === types.name)
7398	    { return false }
7399	  return !this.exprAllowed
7400	};
7401
7402	pp$7.inGeneratorContext = function() {
7403	  for (var i = this.context.length - 1; i >= 1; i--) {
7404	    var context = this.context[i];
7405	    if (context.token === "function")
7406	      { return context.generator }
7407	  }
7408	  return false
7409	};
7410
7411	pp$7.updateContext = function(prevType) {
7412	  var update, type = this.type;
7413	  if (type.keyword && prevType === types.dot)
7414	    { this.exprAllowed = false; }
7415	  else if (update = type.updateContext)
7416	    { update.call(this, prevType); }
7417	  else
7418	    { this.exprAllowed = type.beforeExpr; }
7419	};
7420
7421	// Token-specific context update code
7422
7423	types.parenR.updateContext = types.braceR.updateContext = function() {
7424	  if (this.context.length === 1) {
7425	    this.exprAllowed = true;
7426	    return
7427	  }
7428	  var out = this.context.pop();
7429	  if (out === types$1.b_stat && this.curContext().token === "function") {
7430	    out = this.context.pop();
7431	  }
7432	  this.exprAllowed = !out.isExpr;
7433	};
7434
7435	types.braceL.updateContext = function(prevType) {
7436	  this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr);
7437	  this.exprAllowed = true;
7438	};
7439
7440	types.dollarBraceL.updateContext = function() {
7441	  this.context.push(types$1.b_tmpl);
7442	  this.exprAllowed = true;
7443	};
7444
7445	types.parenL.updateContext = function(prevType) {
7446	  var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
7447	  this.context.push(statementParens ? types$1.p_stat : types$1.p_expr);
7448	  this.exprAllowed = true;
7449	};
7450
7451	types.incDec.updateContext = function() {
7452	  // tokExprAllowed stays unchanged
7453	};
7454
7455	types._function.updateContext = types._class.updateContext = function(prevType) {
7456	  if (prevType.beforeExpr && prevType !== types.semi && prevType !== types._else &&
7457	      !(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
7458	      !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))
7459	    { this.context.push(types$1.f_expr); }
7460	  else
7461	    { this.context.push(types$1.f_stat); }
7462	  this.exprAllowed = false;
7463	};
7464
7465	types.backQuote.updateContext = function() {
7466	  if (this.curContext() === types$1.q_tmpl)
7467	    { this.context.pop(); }
7468	  else
7469	    { this.context.push(types$1.q_tmpl); }
7470	  this.exprAllowed = false;
7471	};
7472
7473	types.star.updateContext = function(prevType) {
7474	  if (prevType === types._function) {
7475	    var index = this.context.length - 1;
7476	    if (this.context[index] === types$1.f_expr)
7477	      { this.context[index] = types$1.f_expr_gen; }
7478	    else
7479	      { this.context[index] = types$1.f_gen; }
7480	  }
7481	  this.exprAllowed = true;
7482	};
7483
7484	types.name.updateContext = function(prevType) {
7485	  var allowed = false;
7486	  if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
7487	    if (this.value === "of" && !this.exprAllowed ||
7488	        this.value === "yield" && this.inGeneratorContext())
7489	      { allowed = true; }
7490	  }
7491	  this.exprAllowed = allowed;
7492	};
7493
7494	// This file contains Unicode properties extracted from the ECMAScript
7495	// specification. The lists are extracted like so:
7496	// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
7497
7498	// #table-binary-unicode-properties
7499	var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
7500	var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
7501	var ecma11BinaryProperties = ecma10BinaryProperties;
7502	var unicodeBinaryProperties = {
7503	  9: ecma9BinaryProperties,
7504	  10: ecma10BinaryProperties,
7505	  11: ecma11BinaryProperties
7506	};
7507
7508	// #table-unicode-general-category-values
7509	var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
7510
7511	// #table-unicode-script-values
7512	var ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
7513	var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
7514	var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
7515	var unicodeScriptValues = {
7516	  9: ecma9ScriptValues,
7517	  10: ecma10ScriptValues,
7518	  11: ecma11ScriptValues
7519	};
7520
7521	var data = {};
7522	function buildUnicodeData(ecmaVersion) {
7523	  var d = data[ecmaVersion] = {
7524	    binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
7525	    nonBinary: {
7526	      General_Category: wordsRegexp(unicodeGeneralCategoryValues),
7527	      Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
7528	    }
7529	  };
7530	  d.nonBinary.Script_Extensions = d.nonBinary.Script;
7531
7532	  d.nonBinary.gc = d.nonBinary.General_Category;
7533	  d.nonBinary.sc = d.nonBinary.Script;
7534	  d.nonBinary.scx = d.nonBinary.Script_Extensions;
7535	}
7536	buildUnicodeData(9);
7537	buildUnicodeData(10);
7538	buildUnicodeData(11);
7539
7540	var pp$8 = Parser.prototype;
7541
7542	var RegExpValidationState = function RegExpValidationState(parser) {
7543	  this.parser = parser;
7544	  this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "");
7545	  this.unicodeProperties = data[parser.options.ecmaVersion >= 11 ? 11 : parser.options.ecmaVersion];
7546	  this.source = "";
7547	  this.flags = "";
7548	  this.start = 0;
7549	  this.switchU = false;
7550	  this.switchN = false;
7551	  this.pos = 0;
7552	  this.lastIntValue = 0;
7553	  this.lastStringValue = "";
7554	  this.lastAssertionIsQuantifiable = false;
7555	  this.numCapturingParens = 0;
7556	  this.maxBackReference = 0;
7557	  this.groupNames = [];
7558	  this.backReferenceNames = [];
7559	};
7560
7561	RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
7562	  var unicode = flags.indexOf("u") !== -1;
7563	  this.start = start | 0;
7564	  this.source = pattern + "";
7565	  this.flags = flags;
7566	  this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
7567	  this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
7568	};
7569
7570	RegExpValidationState.prototype.raise = function raise (message) {
7571	  this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message));
7572	};
7573
7574	// If u flag is given, this returns the code point at the index (it combines a surrogate pair).
7575	// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
7576	RegExpValidationState.prototype.at = function at (i, forceU) {
7577	    if ( forceU === void 0 ) forceU = false;
7578
7579	  var s = this.source;
7580	  var l = s.length;
7581	  if (i >= l) {
7582	    return -1
7583	  }
7584	  var c = s.charCodeAt(i);
7585	  if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
7586	    return c
7587	  }
7588	  var next = s.charCodeAt(i + 1);
7589	  return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c
7590	};
7591
7592	RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {
7593	    if ( forceU === void 0 ) forceU = false;
7594
7595	  var s = this.source;
7596	  var l = s.length;
7597	  if (i >= l) {
7598	    return l
7599	  }
7600	  var c = s.charCodeAt(i), next;
7601	  if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
7602	      (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
7603	    return i + 1
7604	  }
7605	  return i + 2
7606	};
7607
7608	RegExpValidationState.prototype.current = function current (forceU) {
7609	    if ( forceU === void 0 ) forceU = false;
7610
7611	  return this.at(this.pos, forceU)
7612	};
7613
7614	RegExpValidationState.prototype.lookahead = function lookahead (forceU) {
7615	    if ( forceU === void 0 ) forceU = false;
7616
7617	  return this.at(this.nextIndex(this.pos, forceU), forceU)
7618	};
7619
7620	RegExpValidationState.prototype.advance = function advance (forceU) {
7621	    if ( forceU === void 0 ) forceU = false;
7622
7623	  this.pos = this.nextIndex(this.pos, forceU);
7624	};
7625
7626	RegExpValidationState.prototype.eat = function eat (ch, forceU) {
7627	    if ( forceU === void 0 ) forceU = false;
7628
7629	  if (this.current(forceU) === ch) {
7630	    this.advance(forceU);
7631	    return true
7632	  }
7633	  return false
7634	};
7635
7636	function codePointToString(ch) {
7637	  if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
7638	  ch -= 0x10000;
7639	  return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
7640	}
7641
7642	/**
7643	 * Validate the flags part of a given RegExpLiteral.
7644	 *
7645	 * @param {RegExpValidationState} state The state to validate RegExp.
7646	 * @returns {void}
7647	 */
7648	pp$8.validateRegExpFlags = function(state) {
7649	  var validFlags = state.validFlags;
7650	  var flags = state.flags;
7651
7652	  for (var i = 0; i < flags.length; i++) {
7653	    var flag = flags.charAt(i);
7654	    if (validFlags.indexOf(flag) === -1) {
7655	      this.raise(state.start, "Invalid regular expression flag");
7656	    }
7657	    if (flags.indexOf(flag, i + 1) > -1) {
7658	      this.raise(state.start, "Duplicate regular expression flag");
7659	    }
7660	  }
7661	};
7662
7663	/**
7664	 * Validate the pattern part of a given RegExpLiteral.
7665	 *
7666	 * @param {RegExpValidationState} state The state to validate RegExp.
7667	 * @returns {void}
7668	 */
7669	pp$8.validateRegExpPattern = function(state) {
7670	  this.regexp_pattern(state);
7671
7672	  // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
7673	  // parsing contains a |GroupName|, reparse with the goal symbol
7674	  // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
7675	  // exception if _P_ did not conform to the grammar, if any elements of _P_
7676	  // were not matched by the parse, or if any Early Error conditions exist.
7677	  if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
7678	    state.switchN = true;
7679	    this.regexp_pattern(state);
7680	  }
7681	};
7682
7683	// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
7684	pp$8.regexp_pattern = function(state) {
7685	  state.pos = 0;
7686	  state.lastIntValue = 0;
7687	  state.lastStringValue = "";
7688	  state.lastAssertionIsQuantifiable = false;
7689	  state.numCapturingParens = 0;
7690	  state.maxBackReference = 0;
7691	  state.groupNames.length = 0;
7692	  state.backReferenceNames.length = 0;
7693
7694	  this.regexp_disjunction(state);
7695
7696	  if (state.pos !== state.source.length) {
7697	    // Make the same messages as V8.
7698	    if (state.eat(0x29 /* ) */)) {
7699	      state.raise("Unmatched ')'");
7700	    }
7701	    if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
7702	      state.raise("Lone quantifier brackets");
7703	    }
7704	  }
7705	  if (state.maxBackReference > state.numCapturingParens) {
7706	    state.raise("Invalid escape");
7707	  }
7708	  for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
7709	    var name = list[i];
7710
7711	    if (state.groupNames.indexOf(name) === -1) {
7712	      state.raise("Invalid named capture referenced");
7713	    }
7714	  }
7715	};
7716
7717	// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
7718	pp$8.regexp_disjunction = function(state) {
7719	  this.regexp_alternative(state);
7720	  while (state.eat(0x7C /* | */)) {
7721	    this.regexp_alternative(state);
7722	  }
7723
7724	  // Make the same message as V8.
7725	  if (this.regexp_eatQuantifier(state, true)) {
7726	    state.raise("Nothing to repeat");
7727	  }
7728	  if (state.eat(0x7B /* { */)) {
7729	    state.raise("Lone quantifier brackets");
7730	  }
7731	};
7732
7733	// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
7734	pp$8.regexp_alternative = function(state) {
7735	  while (state.pos < state.source.length && this.regexp_eatTerm(state))
7736	    { }
7737	};
7738
7739	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
7740	pp$8.regexp_eatTerm = function(state) {
7741	  if (this.regexp_eatAssertion(state)) {
7742	    // Handle `QuantifiableAssertion Quantifier` alternative.
7743	    // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
7744	    // is a QuantifiableAssertion.
7745	    if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
7746	      // Make the same message as V8.
7747	      if (state.switchU) {
7748	        state.raise("Invalid quantifier");
7749	      }
7750	    }
7751	    return true
7752	  }
7753
7754	  if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
7755	    this.regexp_eatQuantifier(state);
7756	    return true
7757	  }
7758
7759	  return false
7760	};
7761
7762	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
7763	pp$8.regexp_eatAssertion = function(state) {
7764	  var start = state.pos;
7765	  state.lastAssertionIsQuantifiable = false;
vendor: 10,920 bytes, lines 7766-8140
7766
7767	  // ^, $
7768	  if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
7769	    return true
7770	  }
7771
7772	  // \b \B
7773	  if (state.eat(0x5C /* \ */)) {
7774	    if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
7775	      return true
7776	    }
7777	    state.pos = start;
7778	  }
7779
7780	  // Lookahead / Lookbehind
7781	  if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
7782	    var lookbehind = false;
7783	    if (this.options.ecmaVersion >= 9) {
7784	      lookbehind = state.eat(0x3C /* < */);
7785	    }
7786	    if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
7787	      this.regexp_disjunction(state);
7788	      if (!state.eat(0x29 /* ) */)) {
7789	        state.raise("Unterminated group");
7790	      }
7791	      state.lastAssertionIsQuantifiable = !lookbehind;
7792	      return true
7793	    }
7794	  }
7795
7796	  state.pos = start;
7797	  return false
7798	};
7799
7800	// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
7801	pp$8.regexp_eatQuantifier = function(state, noError) {
7802	  if ( noError === void 0 ) noError = false;
7803
7804	  if (this.regexp_eatQuantifierPrefix(state, noError)) {
7805	    state.eat(0x3F /* ? */);
7806	    return true
7807	  }
7808	  return false
7809	};
7810
7811	// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
7812	pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
7813	  return (
7814	    state.eat(0x2A /* * */) ||
7815	    state.eat(0x2B /* + */) ||
7816	    state.eat(0x3F /* ? */) ||
7817	    this.regexp_eatBracedQuantifier(state, noError)
7818	  )
7819	};
7820	pp$8.regexp_eatBracedQuantifier = function(state, noError) {
7821	  var start = state.pos;
7822	  if (state.eat(0x7B /* { */)) {
7823	    var min = 0, max = -1;
7824	    if (this.regexp_eatDecimalDigits(state)) {
7825	      min = state.lastIntValue;
7826	      if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
7827	        max = state.lastIntValue;
7828	      }
7829	      if (state.eat(0x7D /* } */)) {
7830	        // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
7831	        if (max !== -1 && max < min && !noError) {
7832	          state.raise("numbers out of order in {} quantifier");
7833	        }
7834	        return true
7835	      }
7836	    }
7837	    if (state.switchU && !noError) {
7838	      state.raise("Incomplete quantifier");
7839	    }
7840	    state.pos = start;
7841	  }
7842	  return false
7843	};
7844
7845	// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
7846	pp$8.regexp_eatAtom = function(state) {
7847	  return (
7848	    this.regexp_eatPatternCharacters(state) ||
7849	    state.eat(0x2E /* . */) ||
7850	    this.regexp_eatReverseSolidusAtomEscape(state) ||
7851	    this.regexp_eatCharacterClass(state) ||
7852	    this.regexp_eatUncapturingGroup(state) ||
7853	    this.regexp_eatCapturingGroup(state)
7854	  )
7855	};
7856	pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
7857	  var start = state.pos;
7858	  if (state.eat(0x5C /* \ */)) {
7859	    if (this.regexp_eatAtomEscape(state)) {
7860	      return true
7861	    }
7862	    state.pos = start;
7863	  }
7864	  return false
7865	};
7866	pp$8.regexp_eatUncapturingGroup = function(state) {
7867	  var start = state.pos;
7868	  if (state.eat(0x28 /* ( */)) {
7869	    if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
7870	      this.regexp_disjunction(state);
7871	      if (state.eat(0x29 /* ) */)) {
7872	        return true
7873	      }
7874	      state.raise("Unterminated group");
7875	    }
7876	    state.pos = start;
7877	  }
7878	  return false
7879	};
7880	pp$8.regexp_eatCapturingGroup = function(state) {
7881	  if (state.eat(0x28 /* ( */)) {
7882	    if (this.options.ecmaVersion >= 9) {
7883	      this.regexp_groupSpecifier(state);
7884	    } else if (state.current() === 0x3F /* ? */) {
7885	      state.raise("Invalid group");
7886	    }
7887	    this.regexp_disjunction(state);
7888	    if (state.eat(0x29 /* ) */)) {
7889	      state.numCapturingParens += 1;
7890	      return true
7891	    }
7892	    state.raise("Unterminated group");
7893	  }
7894	  return false
7895	};
7896
7897	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
7898	pp$8.regexp_eatExtendedAtom = function(state) {
7899	  return (
7900	    state.eat(0x2E /* . */) ||
7901	    this.regexp_eatReverseSolidusAtomEscape(state) ||
7902	    this.regexp_eatCharacterClass(state) ||
7903	    this.regexp_eatUncapturingGroup(state) ||
7904	    this.regexp_eatCapturingGroup(state) ||
7905	    this.regexp_eatInvalidBracedQuantifier(state) ||
7906	    this.regexp_eatExtendedPatternCharacter(state)
7907	  )
7908	};
7909
7910	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
7911	pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
7912	  if (this.regexp_eatBracedQuantifier(state, true)) {
7913	    state.raise("Nothing to repeat");
7914	  }
7915	  return false
7916	};
7917
7918	// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
7919	pp$8.regexp_eatSyntaxCharacter = function(state) {
7920	  var ch = state.current();
7921	  if (isSyntaxCharacter(ch)) {
7922	    state.lastIntValue = ch;
7923	    state.advance();
7924	    return true
7925	  }
7926	  return false
7927	};
7928	function isSyntaxCharacter(ch) {
7929	  return (
7930	    ch === 0x24 /* $ */ ||
7931	    ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||
7932	    ch === 0x2E /* . */ ||
7933	    ch === 0x3F /* ? */ ||
7934	    ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||
7935	    ch >= 0x7B /* { */ && ch <= 0x7D /* } */
7936	  )
7937	}
7938
7939	// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
7940	// But eat eager.
7941	pp$8.regexp_eatPatternCharacters = function(state) {
7942	  var start = state.pos;
7943	  var ch = 0;
7944	  while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
7945	    state.advance();
7946	  }
7947	  return state.pos !== start
7948	};
7949
7950	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
7951	pp$8.regexp_eatExtendedPatternCharacter = function(state) {
7952	  var ch = state.current();
7953	  if (
7954	    ch !== -1 &&
7955	    ch !== 0x24 /* $ */ &&
7956	    !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&
7957	    ch !== 0x2E /* . */ &&
7958	    ch !== 0x3F /* ? */ &&
7959	    ch !== 0x5B /* [ */ &&
7960	    ch !== 0x5E /* ^ */ &&
7961	    ch !== 0x7C /* | */
7962	  ) {
7963	    state.advance();
7964	    return true
7965	  }
7966	  return false
7967	};
7968
7969	// GroupSpecifier ::
7970	//   [empty]
7971	//   `?` GroupName
7972	pp$8.regexp_groupSpecifier = function(state) {
7973	  if (state.eat(0x3F /* ? */)) {
7974	    if (this.regexp_eatGroupName(state)) {
7975	      if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
7976	        state.raise("Duplicate capture group name");
7977	      }
7978	      state.groupNames.push(state.lastStringValue);
7979	      return
7980	    }
7981	    state.raise("Invalid group");
7982	  }
7983	};
7984
7985	// GroupName ::
7986	//   `<` RegExpIdentifierName `>`
7987	// Note: this updates `state.lastStringValue` property with the eaten name.
7988	pp$8.regexp_eatGroupName = function(state) {
7989	  state.lastStringValue = "";
7990	  if (state.eat(0x3C /* < */)) {
7991	    if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
7992	      return true
7993	    }
7994	    state.raise("Invalid capture group name");
7995	  }
7996	  return false
7997	};
7998
7999	// RegExpIdentifierName ::
8000	//   RegExpIdentifierStart
8001	//   RegExpIdentifierName RegExpIdentifierPart
8002	// Note: this updates `state.lastStringValue` property with the eaten name.
8003	pp$8.regexp_eatRegExpIdentifierName = function(state) {
8004	  state.lastStringValue = "";
8005	  if (this.regexp_eatRegExpIdentifierStart(state)) {
8006	    state.lastStringValue += codePointToString(state.lastIntValue);
8007	    while (this.regexp_eatRegExpIdentifierPart(state)) {
8008	      state.lastStringValue += codePointToString(state.lastIntValue);
8009	    }
8010	    return true
8011	  }
8012	  return false
8013	};
8014
8015	// RegExpIdentifierStart ::
8016	//   UnicodeIDStart
8017	//   `$`
8018	//   `_`
8019	//   `\` RegExpUnicodeEscapeSequence[+U]
8020	pp$8.regexp_eatRegExpIdentifierStart = function(state) {
8021	  var start = state.pos;
8022	  var forceU = this.options.ecmaVersion >= 11;
8023	  var ch = state.current(forceU);
8024	  state.advance(forceU);
8025
8026	  if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
8027	    ch = state.lastIntValue;
8028	  }
8029	  if (isRegExpIdentifierStart(ch)) {
8030	    state.lastIntValue = ch;
8031	    return true
8032	  }
8033
8034	  state.pos = start;
8035	  return false
8036	};
8037	function isRegExpIdentifierStart(ch) {
8038	  return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */
8039	}
8040
8041	// RegExpIdentifierPart ::
8042	//   UnicodeIDContinue
8043	//   `$`
8044	//   `_`
8045	//   `\` RegExpUnicodeEscapeSequence[+U]
8046	//   <ZWNJ>
8047	//   <ZWJ>
8048	pp$8.regexp_eatRegExpIdentifierPart = function(state) {
8049	  var start = state.pos;
8050	  var forceU = this.options.ecmaVersion >= 11;
8051	  var ch = state.current(forceU);
8052	  state.advance(forceU);
8053
8054	  if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
8055	    ch = state.lastIntValue;
8056	  }
8057	  if (isRegExpIdentifierPart(ch)) {
8058	    state.lastIntValue = ch;
8059	    return true
8060	  }
8061
8062	  state.pos = start;
8063	  return false
8064	};
8065	function isRegExpIdentifierPart(ch) {
8066	  return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D /* <ZWJ> */
8067	}
8068
8069	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
8070	pp$8.regexp_eatAtomEscape = function(state) {
8071	  if (
8072	    this.regexp_eatBackReference(state) ||
8073	    this.regexp_eatCharacterClassEscape(state) ||
8074	    this.regexp_eatCharacterEscape(state) ||
8075	    (state.switchN && this.regexp_eatKGroupName(state))
8076	  ) {
8077	    return true
8078	  }
8079	  if (state.switchU) {
8080	    // Make the same message as V8.
8081	    if (state.current() === 0x63 /* c */) {
8082	      state.raise("Invalid unicode escape");
8083	    }
8084	    state.raise("Invalid escape");
8085	  }
8086	  return false
8087	};
8088	pp$8.regexp_eatBackReference = function(state) {
8089	  var start = state.pos;
8090	  if (this.regexp_eatDecimalEscape(state)) {
8091	    var n = state.lastIntValue;
8092	    if (state.switchU) {
8093	      // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
8094	      if (n > state.maxBackReference) {
8095	        state.maxBackReference = n;
8096	      }
8097	      return true
8098	    }
8099	    if (n <= state.numCapturingParens) {
8100	      return true
8101	    }
8102	    state.pos = start;
8103	  }
8104	  return false
8105	};
8106	pp$8.regexp_eatKGroupName = function(state) {
8107	  if (state.eat(0x6B /* k */)) {
8108	    if (this.regexp_eatGroupName(state)) {
8109	      state.backReferenceNames.push(state.lastStringValue);
8110	      return true
8111	    }
8112	    state.raise("Invalid named reference");
8113	  }
8114	  return false
8115	};
8116
8117	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
8118	pp$8.regexp_eatCharacterEscape = function(state) {
8119	  return (
8120	    this.regexp_eatControlEscape(state) ||
8121	    this.regexp_eatCControlLetter(state) ||
8122	    this.regexp_eatZero(state) ||
8123	    this.regexp_eatHexEscapeSequence(state) ||
8124	    this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||
8125	    (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
8126	    this.regexp_eatIdentityEscape(state)
8127	  )
8128	};
8129	pp$8.regexp_eatCControlLetter = function(state) {
8130	  var start = state.pos;
8131	  if (state.eat(0x63 /* c */)) {
8132	    if (this.regexp_eatControlLetter(state)) {
8133	      return true
8134	    }
8135	    state.pos = start;
8136	  }
8137	  return false
8138	};
8139	pp$8.regexp_eatZero = function(state) {
8140	  if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())
vendor: 51,004 bytes, lines 8140-9771
8140) {
8141	    state.lastIntValue = 0;
8142	    state.advance();
8143	    return true
8144	  }
8145	  return false
8146	};
8147
8148	// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
8149	pp$8.regexp_eatControlEscape = function(state) {
8150	  var ch = state.current();
8151	  if (ch === 0x74 /* t */) {
8152	    state.lastIntValue = 0x09; /* \t */
8153	    state.advance();
8154	    return true
8155	  }
8156	  if (ch === 0x6E /* n */) {
8157	    state.lastIntValue = 0x0A; /* \n */
8158	    state.advance();
8159	    return true
8160	  }
8161	  if (ch === 0x76 /* v */) {
8162	    state.lastIntValue = 0x0B; /* \v */
8163	    state.advance();
8164	    return true
8165	  }
8166	  if (ch === 0x66 /* f */) {
8167	    state.lastIntValue = 0x0C; /* \f */
8168	    state.advance();
8169	    return true
8170	  }
8171	  if (ch === 0x72 /* r */) {
8172	    state.lastIntValue = 0x0D; /* \r */
8173	    state.advance();
8174	    return true
8175	  }
8176	  return false
8177	};
8178
8179	// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
8180	pp$8.regexp_eatControlLetter = function(state) {
8181	  var ch = state.current();
8182	  if (isControlLetter(ch)) {
8183	    state.lastIntValue = ch % 0x20;
8184	    state.advance();
8185	    return true
8186	  }
8187	  return false
8188	};
8189	function isControlLetter(ch) {
8190	  return (
8191	    (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||
8192	    (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)
8193	  )
8194	}
8195
8196	// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
8197	pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
8198	  if ( forceU === void 0 ) forceU = false;
8199
8200	  var start = state.pos;
8201	  var switchU = forceU || state.switchU;
8202
8203	  if (state.eat(0x75 /* u */)) {
8204	    if (this.regexp_eatFixedHexDigits(state, 4)) {
8205	      var lead = state.lastIntValue;
8206	      if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
8207	        var leadSurrogateEnd = state.pos;
8208	        if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
8209	          var trail = state.lastIntValue;
8210	          if (trail >= 0xDC00 && trail <= 0xDFFF) {
8211	            state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
8212	            return true
8213	          }
8214	        }
8215	        state.pos = leadSurrogateEnd;
8216	        state.lastIntValue = lead;
8217	      }
8218	      return true
8219	    }
8220	    if (
8221	      switchU &&
8222	      state.eat(0x7B /* { */) &&
8223	      this.regexp_eatHexDigits(state) &&
8224	      state.eat(0x7D /* } */) &&
8225	      isValidUnicode(state.lastIntValue)
8226	    ) {
8227	      return true
8228	    }
8229	    if (switchU) {
8230	      state.raise("Invalid unicode escape");
8231	    }
8232	    state.pos = start;
8233	  }
8234
8235	  return false
8236	};
8237	function isValidUnicode(ch) {
8238	  return ch >= 0 && ch <= 0x10FFFF
8239	}
8240
8241	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
8242	pp$8.regexp_eatIdentityEscape = function(state) {
8243	  if (state.switchU) {
8244	    if (this.regexp_eatSyntaxCharacter(state)) {
8245	      return true
8246	    }
8247	    if (state.eat(0x2F /* / */)) {
8248	      state.lastIntValue = 0x2F; /* / */
8249	      return true
8250	    }
8251	    return false
8252	  }
8253
8254	  var ch = state.current();
8255	  if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
8256	    state.lastIntValue = ch;
8257	    state.advance();
8258	    return true
8259	  }
8260
8261	  return false
8262	};
8263
8264	// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
8265	pp$8.regexp_eatDecimalEscape = function(state) {
8266	  state.lastIntValue = 0;
8267	  var ch = state.current();
8268	  if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
8269	    do {
8270	      state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
8271	      state.advance();
8272	    } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)
8273	    return true
8274	  }
8275	  return false
8276	};
8277
8278	// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
8279	pp$8.regexp_eatCharacterClassEscape = function(state) {
8280	  var ch = state.current();
8281
8282	  if (isCharacterClassEscape(ch)) {
8283	    state.lastIntValue = -1;
8284	    state.advance();
8285	    return true
8286	  }
8287
8288	  if (
8289	    state.switchU &&
8290	    this.options.ecmaVersion >= 9 &&
8291	    (ch === 0x50 /* P */ || ch === 0x70 /* p */)
8292	  ) {
8293	    state.lastIntValue = -1;
8294	    state.advance();
8295	    if (
8296	      state.eat(0x7B /* { */) &&
8297	      this.regexp_eatUnicodePropertyValueExpression(state) &&
8298	      state.eat(0x7D /* } */)
8299	    ) {
8300	      return true
8301	    }
8302	    state.raise("Invalid property name");
8303	  }
8304
8305	  return false
8306	};
8307	function isCharacterClassEscape(ch) {
8308	  return (
8309	    ch === 0x64 /* d */ ||
8310	    ch === 0x44 /* D */ ||
8311	    ch === 0x73 /* s */ ||
8312	    ch === 0x53 /* S */ ||
8313	    ch === 0x77 /* w */ ||
8314	    ch === 0x57 /* W */
8315	  )
8316	}
8317
8318	// UnicodePropertyValueExpression ::
8319	//   UnicodePropertyName `=` UnicodePropertyValue
8320	//   LoneUnicodePropertyNameOrValue
8321	pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
8322	  var start = state.pos;
8323
8324	  // UnicodePropertyName `=` UnicodePropertyValue
8325	  if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
8326	    var name = state.lastStringValue;
8327	    if (this.regexp_eatUnicodePropertyValue(state)) {
8328	      var value = state.lastStringValue;
8329	      this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
8330	      return true
8331	    }
8332	  }
8333	  state.pos = start;
8334
8335	  // LoneUnicodePropertyNameOrValue
8336	  if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
8337	    var nameOrValue = state.lastStringValue;
8338	    this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
8339	    return true
8340	  }
8341	  return false
8342	};
8343	pp$8.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
8344	  if (!has(state.unicodeProperties.nonBinary, name))
8345	    { state.raise("Invalid property name"); }
8346	  if (!state.unicodeProperties.nonBinary[name].test(value))
8347	    { state.raise("Invalid property value"); }
8348	};
8349	pp$8.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
8350	  if (!state.unicodeProperties.binary.test(nameOrValue))
8351	    { state.raise("Invalid property name"); }
8352	};
8353
8354	// UnicodePropertyName ::
8355	//   UnicodePropertyNameCharacters
8356	pp$8.regexp_eatUnicodePropertyName = function(state) {
8357	  var ch = 0;
8358	  state.lastStringValue = "";
8359	  while (isUnicodePropertyNameCharacter(ch = state.current())) {
8360	    state.lastStringValue += codePointToString(ch);
8361	    state.advance();
8362	  }
8363	  return state.lastStringValue !== ""
8364	};
8365	function isUnicodePropertyNameCharacter(ch) {
8366	  return isControlLetter(ch) || ch === 0x5F /* _ */
8367	}
8368
8369	// UnicodePropertyValue ::
8370	//   UnicodePropertyValueCharacters
8371	pp$8.regexp_eatUnicodePropertyValue = function(state) {
8372	  var ch = 0;
8373	  state.lastStringValue = "";
8374	  while (isUnicodePropertyValueCharacter(ch = state.current())) {
8375	    state.lastStringValue += codePointToString(ch);
8376	    state.advance();
8377	  }
8378	  return state.lastStringValue !== ""
8379	};
8380	function isUnicodePropertyValueCharacter(ch) {
8381	  return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)
8382	}
8383
8384	// LoneUnicodePropertyNameOrValue ::
8385	//   UnicodePropertyValueCharacters
8386	pp$8.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
8387	  return this.regexp_eatUnicodePropertyValue(state)
8388	};
8389
8390	// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
8391	pp$8.regexp_eatCharacterClass = function(state) {
8392	  if (state.eat(0x5B /* [ */)) {
8393	    state.eat(0x5E /* ^ */);
8394	    this.regexp_classRanges(state);
8395	    if (state.eat(0x5D /* ] */)) {
8396	      return true
8397	    }
8398	    // Unreachable since it threw "unterminated regular expression" error before.
8399	    state.raise("Unterminated character class");
8400	  }
8401	  return false
8402	};
8403
8404	// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
8405	// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
8406	// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
8407	pp$8.regexp_classRanges = function(state) {
8408	  while (this.regexp_eatClassAtom(state)) {
8409	    var left = state.lastIntValue;
8410	    if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
8411	      var right = state.lastIntValue;
8412	      if (state.switchU && (left === -1 || right === -1)) {
8413	        state.raise("Invalid character class");
8414	      }
8415	      if (left !== -1 && right !== -1 && left > right) {
8416	        state.raise("Range out of order in character class");
8417	      }
8418	    }
8419	  }
8420	};
8421
8422	// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
8423	// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
8424	pp$8.regexp_eatClassAtom = function(state) {
8425	  var start = state.pos;
8426
8427	  if (state.eat(0x5C /* \ */)) {
8428	    if (this.regexp_eatClassEscape(state)) {
8429	      return true
8430	    }
8431	    if (state.switchU) {
8432	      // Make the same message as V8.
8433	      var ch$1 = state.current();
8434	      if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {
8435	        state.raise("Invalid class escape");
8436	      }
8437	      state.raise("Invalid escape");
8438	    }
8439	    state.pos = start;
8440	  }
8441
8442	  var ch = state.current();
8443	  if (ch !== 0x5D /* ] */) {
8444	    state.lastIntValue = ch;
8445	    state.advance();
8446	    return true
8447	  }
8448
8449	  return false
8450	};
8451
8452	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
8453	pp$8.regexp_eatClassEscape = function(state) {
8454	  var start = state.pos;
8455
8456	  if (state.eat(0x62 /* b */)) {
8457	    state.lastIntValue = 0x08; /* <BS> */
8458	    return true
8459	  }
8460
8461	  if (state.switchU && state.eat(0x2D /* - */)) {
8462	    state.lastIntValue = 0x2D; /* - */
8463	    return true
8464	  }
8465
8466	  if (!state.switchU && state.eat(0x63 /* c */)) {
8467	    if (this.regexp_eatClassControlLetter(state)) {
8468	      return true
8469	    }
8470	    state.pos = start;
8471	  }
8472
8473	  return (
8474	    this.regexp_eatCharacterClassEscape(state) ||
8475	    this.regexp_eatCharacterEscape(state)
8476	  )
8477	};
8478
8479	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
8480	pp$8.regexp_eatClassControlLetter = function(state) {
8481	  var ch = state.current();
8482	  if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
8483	    state.lastIntValue = ch % 0x20;
8484	    state.advance();
8485	    return true
8486	  }
8487	  return false
8488	};
8489
8490	// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
8491	pp$8.regexp_eatHexEscapeSequence = function(state) {
8492	  var start = state.pos;
8493	  if (state.eat(0x78 /* x */)) {
8494	    if (this.regexp_eatFixedHexDigits(state, 2)) {
8495	      return true
8496	    }
8497	    if (state.switchU) {
8498	      state.raise("Invalid escape");
8499	    }
8500	    state.pos = start;
8501	  }
8502	  return false
8503	};
8504
8505	// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
8506	pp$8.regexp_eatDecimalDigits = function(state) {
8507	  var start = state.pos;
8508	  var ch = 0;
8509	  state.lastIntValue = 0;
8510	  while (isDecimalDigit(ch = state.current())) {
8511	    state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
8512	    state.advance();
8513	  }
8514	  return state.pos !== start
8515	};
8516	function isDecimalDigit(ch) {
8517	  return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */
8518	}
8519
8520	// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
8521	pp$8.regexp_eatHexDigits = function(state) {
8522	  var start = state.pos;
8523	  var ch = 0;
8524	  state.lastIntValue = 0;
8525	  while (isHexDigit(ch = state.current())) {
8526	    state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
8527	    state.advance();
8528	  }
8529	  return state.pos !== start
8530	};
8531	function isHexDigit(ch) {
8532	  return (
8533	    (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||
8534	    (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||
8535	    (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)
8536	  )
8537	}
8538	function hexToInt(ch) {
8539	  if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
8540	    return 10 + (ch - 0x41 /* A */)
8541	  }
8542	  if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
8543	    return 10 + (ch - 0x61 /* a */)
8544	  }
8545	  return ch - 0x30 /* 0 */
8546	}
8547
8548	// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
8549	// Allows only 0-377(octal) i.e. 0-255(decimal).
8550	pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
8551	  if (this.regexp_eatOctalDigit(state)) {
8552	    var n1 = state.lastIntValue;
8553	    if (this.regexp_eatOctalDigit(state)) {
8554	      var n2 = state.lastIntValue;
8555	      if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
8556	        state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
8557	      } else {
8558	        state.lastIntValue = n1 * 8 + n2;
8559	      }
8560	    } else {
8561	      state.lastIntValue = n1;
8562	    }
8563	    return true
8564	  }
8565	  return false
8566	};
8567
8568	// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
8569	pp$8.regexp_eatOctalDigit = function(state) {
8570	  var ch = state.current();
8571	  if (isOctalDigit(ch)) {
8572	    state.lastIntValue = ch - 0x30; /* 0 */
8573	    state.advance();
8574	    return true
8575	  }
8576	  state.lastIntValue = 0;
8577	  return false
8578	};
8579	function isOctalDigit(ch) {
8580	  return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */
8581	}
8582
8583	// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
8584	// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
8585	// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
8586	pp$8.regexp_eatFixedHexDigits = function(state, length) {
8587	  var start = state.pos;
8588	  state.lastIntValue = 0;
8589	  for (var i = 0; i < length; ++i) {
8590	    var ch = state.current();
8591	    if (!isHexDigit(ch)) {
8592	      state.pos = start;
8593	      return false
8594	    }
8595	    state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
8596	    state.advance();
8597	  }
8598	  return true
8599	};
8600
8601	// Object type used to represent tokens. Note that normally, tokens
8602	// simply exist as properties on the parser object. This is only
8603	// used for the onToken callback and the external tokenizer.
8604
8605	var Token = function Token(p) {
8606	  this.type = p.type;
8607	  this.value = p.value;
8608	  this.start = p.start;
8609	  this.end = p.end;
8610	  if (p.options.locations)
8611	    { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }
8612	  if (p.options.ranges)
8613	    { this.range = [p.start, p.end]; }
8614	};
8615
8616	// ## Tokenizer
8617
8618	var pp$9 = Parser.prototype;
8619
8620	// Move to the next token
8621
8622	pp$9.next = function(ignoreEscapeSequenceInKeyword) {
8623	  if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
8624	    { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
8625	  if (this.options.onToken)
8626	    { this.options.onToken(new Token(this)); }
8627
8628	  this.lastTokEnd = this.end;
8629	  this.lastTokStart = this.start;
8630	  this.lastTokEndLoc = this.endLoc;
8631	  this.lastTokStartLoc = this.startLoc;
8632	  this.nextToken();
8633	};
8634
8635	pp$9.getToken = function() {
8636	  this.next();
8637	  return new Token(this)
8638	};
8639
8640	// If we're in an ES6 environment, make parsers iterable
8641	if (typeof Symbol !== "undefined")
8642	  { pp$9[Symbol.iterator] = function() {
8643	    var this$1$1 = this;
8644
8645	    return {
8646	      next: function () {
8647	        var token = this$1$1.getToken();
8648	        return {
8649	          done: token.type === types.eof,
8650	          value: token
8651	        }
8652	      }
8653	    }
8654	  }; }
8655
8656	// Toggle strict mode. Re-reads the next number or string to please
8657	// pedantic tests (`"use strict"; 010;` should fail).
8658
8659	pp$9.curContext = function() {
8660	  return this.context[this.context.length - 1]
8661	};
8662
8663	// Read a single token, updating the parser object's token-related
8664	// properties.
8665
8666	pp$9.nextToken = function() {
8667	  var curContext = this.curContext();
8668	  if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
8669
8670	  this.start = this.pos;
8671	  if (this.options.locations) { this.startLoc = this.curPosition(); }
8672	  if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
8673
8674	  if (curContext.override) { return curContext.override(this) }
8675	  else { this.readToken(this.fullCharCodeAtPos()); }
8676	};
8677
8678	pp$9.readToken = function(code) {
8679	  // Identifier or keyword. '\uXXXX' sequences are allowed in
8680	  // identifiers, so '\' also dispatches to that.
8681	  if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
8682	    { return this.readWord() }
8683
8684	  return this.getTokenFromCode(code)
8685	};
8686
8687	pp$9.fullCharCodeAtPos = function() {
8688	  var code = this.input.charCodeAt(this.pos);
8689	  if (code <= 0xd7ff || code >= 0xe000) { return code }
8690	  var next = this.input.charCodeAt(this.pos + 1);
8691	  return (code << 10) + next - 0x35fdc00
8692	};
8693
8694	pp$9.skipBlockComment = function() {
8695	  var startLoc = this.options.onComment && this.curPosition();
8696	  var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
8697	  if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
8698	  this.pos = end + 2;
8699	  if (this.options.locations) {
8700	    lineBreakG.lastIndex = start;
8701	    var match;
8702	    while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
8703	      ++this.curLine;
8704	      this.lineStart = match.index + match[0].length;
8705	    }
8706	  }
8707	  if (this.options.onComment)
8708	    { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
8709	                           startLoc, this.curPosition()); }
8710	};
8711
8712	pp$9.skipLineComment = function(startSkip) {
8713	  var start = this.pos;
8714	  var startLoc = this.options.onComment && this.curPosition();
8715	  var ch = this.input.charCodeAt(this.pos += startSkip);
8716	  while (this.pos < this.input.length && !isNewLine(ch)) {
8717	    ch = this.input.charCodeAt(++this.pos);
8718	  }
8719	  if (this.options.onComment)
8720	    { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
8721	                           startLoc, this.curPosition()); }
8722	};
8723
8724	// Called at the start of the parse and after every token. Skips
8725	// whitespace and comments, and.
8726
8727	pp$9.skipSpace = function() {
8728	  loop: while (this.pos < this.input.length) {
8729	    var ch = this.input.charCodeAt(this.pos);
8730	    switch (ch) {
8731	    case 32: case 160: // ' '
8732	      ++this.pos;
8733	      break
8734	    case 13:
8735	      if (this.input.charCodeAt(this.pos + 1) === 10) {
8736	        ++this.pos;
8737	      }
8738	    case 10: case 8232: case 8233:
8739	      ++this.pos;
8740	      if (this.options.locations) {
8741	        ++this.curLine;
8742	        this.lineStart = this.pos;
8743	      }
8744	      break
8745	    case 47: // '/'
8746	      switch (this.input.charCodeAt(this.pos + 1)) {
8747	      case 42: // '*'
8748	        this.skipBlockComment();
8749	        break
8750	      case 47:
8751	        this.skipLineComment(2);
8752	        break
8753	      default:
8754	        break loop
8755	      }
8756	      break
8757	    default:
8758	      if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
8759	        ++this.pos;
8760	      } else {
8761	        break loop
8762	      }
8763	    }
8764	  }
8765	};
8766
8767	// Called at the end of every token. Sets `end`, `val`, and
8768	// maintains `context` and `exprAllowed`, and skips the space after
8769	// the token, so that the next one's `start` will point at the
8770	// right position.
8771
8772	pp$9.finishToken = function(type, val) {
8773	  this.end = this.pos;
8774	  if (this.options.locations) { this.endLoc = this.curPosition(); }
8775	  var prevType = this.type;
8776	  this.type = type;
8777	  this.value = val;
8778
8779	  this.updateContext(prevType);
8780	};
8781
8782	// ### Token reading
8783
8784	// This is the function that is called to fetch the next token. It
8785	// is somewhat obscure, because it works in character codes rather
8786	// than characters, and because operator parsing has been inlined
8787	// into it.
8788	//
8789	// All in the name of speed.
8790	//
8791	pp$9.readToken_dot = function() {
8792	  var next = this.input.charCodeAt(this.pos + 1);
8793	  if (next >= 48 && next <= 57) { return this.readNumber(true) }
8794	  var next2 = this.input.charCodeAt(this.pos + 2);
8795	  if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
8796	    this.pos += 3;
8797	    return this.finishToken(types.ellipsis)
8798	  } else {
8799	    ++this.pos;
8800	    return this.finishToken(types.dot)
8801	  }
8802	};
8803
8804	pp$9.readToken_slash = function() { // '/'
8805	  var next = this.input.charCodeAt(this.pos + 1);
8806	  if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
8807	  if (next === 61) { return this.finishOp(types.assign, 2) }
8808	  return this.finishOp(types.slash, 1)
8809	};
8810
8811	pp$9.readToken_mult_modulo_exp = function(code) { // '%*'
8812	  var next = this.input.charCodeAt(this.pos + 1);
8813	  var size = 1;
8814	  var tokentype = code === 42 ? types.star : types.modulo;
8815
8816	  // exponentiation operator ** and **=
8817	  if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
8818	    ++size;
8819	    tokentype = types.starstar;
8820	    next = this.input.charCodeAt(this.pos + 2);
8821	  }
8822
8823	  if (next === 61) { return this.finishOp(types.assign, size + 1) }
8824	  return this.finishOp(tokentype, size)
8825	};
8826
8827	pp$9.readToken_pipe_amp = function(code) { // '|&'
8828	  var next = this.input.charCodeAt(this.pos + 1);
8829	  if (next === code) {
8830	    if (this.options.ecmaVersion >= 12) {
8831	      var next2 = this.input.charCodeAt(this.pos + 2);
8832	      if (next2 === 61) { return this.finishOp(types.assign, 3) }
8833	    }
8834	    return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
8835	  }
8836	  if (next === 61) { return this.finishOp(types.assign, 2) }
8837	  return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
8838	};
8839
8840	pp$9.readToken_caret = function() { // '^'
8841	  var next = this.input.charCodeAt(this.pos + 1);
8842	  if (next === 61) { return this.finishOp(types.assign, 2) }
8843	  return this.finishOp(types.bitwiseXOR, 1)
8844	};
8845
8846	pp$9.readToken_plus_min = function(code) { // '+-'
8847	  var next = this.input.charCodeAt(this.pos + 1);
8848	  if (next === code) {
8849	    if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
8850	        (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
8851	      // A `-->` line comment
8852	      this.skipLineComment(3);
8853	      this.skipSpace();
8854	      return this.nextToken()
8855	    }
8856	    return this.finishOp(types.incDec, 2)
8857	  }
8858	  if (next === 61) { return this.finishOp(types.assign, 2) }
8859	  return this.finishOp(types.plusMin, 1)
8860	};
8861
8862	pp$9.readToken_lt_gt = function(code) { // '<>'
8863	  var next = this.input.charCodeAt(this.pos + 1);
8864	  var size = 1;
8865	  if (next === code) {
8866	    size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
8867	    if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
8868	    return this.finishOp(types.bitShift, size)
8869	  }
8870	  if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
8871	      this.input.charCodeAt(this.pos + 3) === 45) {
8872	    // `<!--`, an XML-style comment that should be interpreted as a line comment
8873	    this.skipLineComment(4);
8874	    this.skipSpace();
8875	    return this.nextToken()
8876	  }
8877	  if (next === 61) { size = 2; }
8878	  return this.finishOp(types.relational, size)
8879	};
8880
8881	pp$9.readToken_eq_excl = function(code) { // '=!'
8882	  var next = this.input.charCodeAt(this.pos + 1);
8883	  if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
8884	  if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
8885	    this.pos += 2;
8886	    return this.finishToken(types.arrow)
8887	  }
8888	  return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
8889	};
8890
8891	pp$9.readToken_question = function() { // '?'
8892	  var ecmaVersion = this.options.ecmaVersion;
8893	  if (ecmaVersion >= 11) {
8894	    var next = this.input.charCodeAt(this.pos + 1);
8895	    if (next === 46) {
8896	      var next2 = this.input.charCodeAt(this.pos + 2);
8897	      if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
8898	    }
8899	    if (next === 63) {
8900	      if (ecmaVersion >= 12) {
8901	        var next2$1 = this.input.charCodeAt(this.pos + 2);
8902	        if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
8903	      }
8904	      return this.finishOp(types.coalesce, 2)
8905	    }
8906	  }
8907	  return this.finishOp(types.question, 1)
8908	};
8909
8910	pp$9.getTokenFromCode = function(code) {
8911	  switch (code) {
8912	  // The interpretation of a dot depends on whether it is followed
8913	  // by a digit or another two dots.
8914	  case 46: // '.'
8915	    return this.readToken_dot()
8916
8917	  // Punctuation tokens.
8918	  case 40: ++this.pos; return this.finishToken(types.parenL)
8919	  case 41: ++this.pos; return this.finishToken(types.parenR)
8920	  case 59: ++this.pos; return this.finishToken(types.semi)
8921	  case 44: ++this.pos; return this.finishToken(types.comma)
8922	  case 91: ++this.pos; return this.finishToken(types.bracketL)
8923	  case 93: ++this.pos; return this.finishToken(types.bracketR)
8924	  case 123: ++this.pos; return this.finishToken(types.braceL)
8925	  case 125: ++this.pos; return this.finishToken(types.braceR)
8926	  case 58: ++this.pos; return this.finishToken(types.colon)
8927
8928	  case 96: // '`'
8929	    if (this.options.ecmaVersion < 6) { break }
8930	    ++this.pos;
8931	    return this.finishToken(types.backQuote)
8932
8933	  case 48: // '0'
8934	    var next = this.input.charCodeAt(this.pos + 1);
8935	    if (next === 120 || next === 88) { return this.readRadixNumber(16) } // '0x', '0X' - hex number
8936	    if (this.options.ecmaVersion >= 6) {
8937	      if (next === 111 || next === 79) { return this.readRadixNumber(8) } // '0o', '0O' - octal number
8938	      if (next === 98 || next === 66) { return this.readRadixNumber(2) } // '0b', '0B' - binary number
8939	    }
8940
8941	  // Anything else beginning with a digit is an integer, octal
8942	  // number, or float.
8943	  case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9
8944	    return this.readNumber(false)
8945
8946	  // Quotes produce strings.
8947	  case 34: case 39: // '"', "'"
8948	    return this.readString(code)
8949
8950	  // Operators are parsed inline in tiny state machines. '=' (61) is
8951	  // often referred to. `finishOp` simply skips the amount of
8952	  // characters it is given as second argument, and returns a token
8953	  // of the type given by its first argument.
8954
8955	  case 47: // '/'
8956	    return this.readToken_slash()
8957
8958	  case 37: case 42: // '%*'
8959	    return this.readToken_mult_modulo_exp(code)
8960
8961	  case 124: case 38: // '|&'
8962	    return this.readToken_pipe_amp(code)
8963
8964	  case 94: // '^'
8965	    return this.readToken_caret()
8966
8967	  case 43: case 45: // '+-'
8968	    return this.readToken_plus_min(code)
8969
8970	  case 60: case 62: // '<>'
8971	    return this.readToken_lt_gt(code)
8972
8973	  case 61: case 33: // '=!'
8974	    return this.readToken_eq_excl(code)
8975
8976	  case 63: // '?'
8977	    return this.readToken_question()
8978
8979	  case 126: // '~'
8980	    return this.finishOp(types.prefix, 1)
8981	  }
8982
8983	  this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
8984	};
8985
8986	pp$9.finishOp = function(type, size) {
8987	  var str = this.input.slice(this.pos, this.pos + size);
8988	  this.pos += size;
8989	  return this.finishToken(type, str)
8990	};
8991
8992	pp$9.readRegexp = function() {
8993	  var escaped, inClass, start = this.pos;
8994	  for (;;) {
8995	    if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
8996	    var ch = this.input.charAt(this.pos);
8997	    if (lineBreak.test(ch)) { this.raise(start, "Unterminated regular expression"); }
8998	    if (!escaped) {
8999	      if (ch === "[") { inClass = true; }
9000	      else if (ch === "]" && inClass) { inClass = false; }
9001	      else if (ch === "/" && !inClass) { break }
9002	      escaped = ch === "\\";
9003	    } else { escaped = false; }
9004	    ++this.pos;
9005	  }
9006	  var pattern = this.input.slice(start, this.pos);
9007	  ++this.pos;
9008	  var flagsStart = this.pos;
9009	  var flags = this.readWord1();
9010	  if (this.containsEsc) { this.unexpected(flagsStart); }
9011
9012	  // Validate pattern
9013	  var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
9014	  state.reset(start, pattern, flags);
9015	  this.validateRegExpFlags(state);
9016	  this.validateRegExpPattern(state);
9017
9018	  // Create Literal#value property value.
9019	  var value = null;
9020	  try {
9021	    value = new RegExp(pattern, flags);
9022	  } catch (e) {
9023	    // ESTree requires null if it failed to instantiate RegExp object.
9024	    // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
9025	  }
9026
9027	  return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
9028	};
9029
9030	// Read an integer in the given radix. Return null if zero digits
9031	// were read, the integer value otherwise. When `len` is given, this
9032	// will return `null` unless the integer has exactly `len` digits.
9033
9034	pp$9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
9035	  // `len` is used for character escape sequences. In that case, disallow separators.
9036	  var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
9037
9038	  // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)
9039	  // and isn't fraction part nor exponent part. In that case, if the first digit
9040	  // is zero then disallow separators.
9041	  var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
9042
9043	  var start = this.pos, total = 0, lastCode = 0;
9044	  for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
9045	    var code = this.input.charCodeAt(this.pos), val = (void 0);
9046
9047	    if (allowSeparators && code === 95) {
9048	      if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); }
9049	      if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); }
9050	      if (i === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); }
9051	      lastCode = code;
9052	      continue
9053	    }
9054
9055	    if (code >= 97) { val = code - 97 + 10; } // a
9056	    else if (code >= 65) { val = code - 65 + 10; } // A
9057	    else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9
9058	    else { val = Infinity; }
9059	    if (val >= radix) { break }
9060	    lastCode = code;
9061	    total = total * radix + val;
9062	  }
9063
9064	  if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); }
9065	  if (this.pos === start || len != null && this.pos - start !== len) { return null }
9066
9067	  return total
9068	};
9069
9070	function stringToNumber(str, isLegacyOctalNumericLiteral) {
9071	  if (isLegacyOctalNumericLiteral) {
9072	    return parseInt(str, 8)
9073	  }
9074
9075	  // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
9076	  return parseFloat(str.replace(/_/g, ""))
9077	}
9078
9079	function stringToBigInt(str) {
9080	  if (typeof BigInt !== "function") {
9081	    return null
9082	  }
9083
9084	  // `BigInt(value)` throws syntax error if the string contains numeric separators.
9085	  return BigInt(str.replace(/_/g, ""))
9086	}
9087
9088	pp$9.readRadixNumber = function(radix) {
9089	  var start = this.pos;
9090	  this.pos += 2; // 0x
9091	  var val = this.readInt(radix);
9092	  if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
9093	  if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
9094	    val = stringToBigInt(this.input.slice(start, this.pos));
9095	    ++this.pos;
9096	  } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
9097	  return this.finishToken(types.num, val)
9098	};
9099
9100	// Read an integer, octal integer, or floating-point number.
9101
9102	pp$9.readNumber = function(startsWithDot) {
9103	  var start = this.pos;
9104	  if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
9105	  var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
9106	  if (octal && this.strict) { this.raise(start, "Invalid number"); }
9107	  var next = this.input.charCodeAt(this.pos);
9108	  if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
9109	    var val$1 = stringToBigInt(this.input.slice(start, this.pos));
9110	    ++this.pos;
9111	    if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
9112	    return this.finishToken(types.num, val$1)
9113	  }
9114	  if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
9115	  if (next === 46 && !octal) { // '.'
9116	    ++this.pos;
9117	    this.readInt(10);
9118	    next = this.input.charCodeAt(this.pos);
9119	  }
9120	  if ((next === 69 || next === 101) && !octal) { // 'eE'
9121	    next = this.input.charCodeAt(++this.pos);
9122	    if (next === 43 || next === 45) { ++this.pos; } // '+-'
9123	    if (this.readInt(10) === null) { this.raise(start, "Invalid number"); }
9124	  }
9125	  if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
9126
9127	  var val = stringToNumber(this.input.slice(start, this.pos), octal);
9128	  return this.finishToken(types.num, val)
9129	};
9130
9131	// Read a string value, interpreting backslash-escapes.
9132
9133	pp$9.readCodePoint = function() {
9134	  var ch = this.input.charCodeAt(this.pos), code;
9135
9136	  if (ch === 123) { // '{'
9137	    if (this.options.ecmaVersion < 6) { this.unexpected(); }
9138	    var codePos = ++this.pos;
9139	    code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
9140	    ++this.pos;
9141	    if (code > 0x10FFFF) { this.invalidStringToken(codePos, "Code point out of bounds"); }
9142	  } else {
9143	    code = this.readHexChar(4);
9144	  }
9145	  return code
9146	};
9147
9148	function codePointToString$1(code) {
9149	  // UTF-16 Decoding
9150	  if (code <= 0xFFFF) { return String.fromCharCode(code) }
9151	  code -= 0x10000;
9152	  return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
9153	}
9154
9155	pp$9.readString = function(quote) {
9156	  var out = "", chunkStart = ++this.pos;
9157	  for (;;) {
9158	    if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
9159	    var ch = this.input.charCodeAt(this.pos);
9160	    if (ch === quote) { break }
9161	    if (ch === 92) { // '\'
9162	      out += this.input.slice(chunkStart, this.pos);
9163	      out += this.readEscapedChar(false);
9164	      chunkStart = this.pos;
9165	    } else {
9166	      if (isNewLine(ch, this.options.ecmaVersion >= 10)) { this.raise(this.start, "Unterminated string constant"); }
9167	      ++this.pos;
9168	    }
9169	  }
9170	  out += this.input.slice(chunkStart, this.pos++);
9171	  return this.finishToken(types.string, out)
9172	};
9173
9174	// Reads template string tokens.
9175
9176	var INVALID_TEMPLATE_ESCAPE_ERROR = {};
9177
9178	pp$9.tryReadTemplateToken = function() {
9179	  this.inTemplateElement = true;
9180	  try {
9181	    this.readTmplToken();
9182	  } catch (err) {
9183	    if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
9184	      this.readInvalidTemplateToken();
9185	    } else {
9186	      throw err
9187	    }
9188	  }
9189
9190	  this.inTemplateElement = false;
9191	};
9192
9193	pp$9.invalidStringToken = function(position, message) {
9194	  if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
9195	    throw INVALID_TEMPLATE_ESCAPE_ERROR
9196	  } else {
9197	    this.raise(position, message);
9198	  }
9199	};
9200
9201	pp$9.readTmplToken = function() {
9202	  var out = "", chunkStart = this.pos;
9203	  for (;;) {
9204	    if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
9205	    var ch = this.input.charCodeAt(this.pos);
9206	    if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
9207	      if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
9208	        if (ch === 36) {
9209	          this.pos += 2;
9210	          return this.finishToken(types.dollarBraceL)
9211	        } else {
9212	          ++this.pos;
9213	          return this.finishToken(types.backQuote)
9214	        }
9215	      }
9216	      out += this.input.slice(chunkStart, this.pos);
9217	      return this.finishToken(types.template, out)
9218	    }
9219	    if (ch === 92) { // '\'
9220	      out += this.input.slice(chunkStart, this.pos);
9221	      out += this.readEscapedChar(true);
9222	      chunkStart = this.pos;
9223	    } else if (isNewLine(ch)) {
9224	      out += this.input.slice(chunkStart, this.pos);
9225	      ++this.pos;
9226	      switch (ch) {
9227	      case 13:
9228	        if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }
9229	      case 10:
9230	        out += "\n";
9231	        break
9232	      default:
9233	        out += String.fromCharCode(ch);
9234	        break
9235	      }
9236	      if (this.options.locations) {
9237	        ++this.curLine;
9238	        this.lineStart = this.pos;
9239	      }
9240	      chunkStart = this.pos;
9241	    } else {
9242	      ++this.pos;
9243	    }
9244	  }
9245	};
9246
9247	// Reads a template token to search for the end, without validating any escape sequences
9248	pp$9.readInvalidTemplateToken = function() {
9249	  for (; this.pos < this.input.length; this.pos++) {
9250	    switch (this.input[this.pos]) {
9251	    case "\\":
9252	      ++this.pos;
9253	      break
9254
9255	    case "$":
9256	      if (this.input[this.pos + 1] !== "{") {
9257	        break
9258	      }
9259	    // falls through
9260
9261	    case "`":
9262	      return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
9263
9264	    // no default
9265	    }
9266	  }
9267	  this.raise(this.start, "Unterminated template");
9268	};
9269
9270	// Used to read escaped characters
9271
9272	pp$9.readEscapedChar = function(inTemplate) {
9273	  var ch = this.input.charCodeAt(++this.pos);
9274	  ++this.pos;
9275	  switch (ch) {
9276	  case 110: return "\n" // 'n' -> '\n'
9277	  case 114: return "\r" // 'r' -> '\r'
9278	  case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
9279	  case 117: return codePointToString$1(this.readCodePoint()) // 'u'
9280	  case 116: return "\t" // 't' -> '\t'
9281	  case 98: return "\b" // 'b' -> '\b'
9282	  case 118: return "\u000b" // 'v' -> '\u000b'
9283	  case 102: return "\f" // 'f' -> '\f'
9284	  case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; } // '\r\n'
9285	  case 10: // ' \n'
9286	    if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }
9287	    return ""
9288	  case 56:
9289	  case 57:
9290	    if (inTemplate) {
9291	      var codePos = this.pos - 1;
9292
9293	      this.invalidStringToken(
9294	        codePos,
9295	        "Invalid escape sequence in template string"
9296	      );
9297
9298	      return null
9299	    }
9300	  default:
9301	    if (ch >= 48 && ch <= 55) {
9302	      var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
9303	      var octal = parseInt(octalStr, 8);
9304	      if (octal > 255) {
9305	        octalStr = octalStr.slice(0, -1);
9306	        octal = parseInt(octalStr, 8);
9307	      }
9308	      this.pos += octalStr.length - 1;
9309	      ch = this.input.charCodeAt(this.pos);
9310	      if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
9311	        this.invalidStringToken(
9312	          this.pos - 1 - octalStr.length,
9313	          inTemplate
9314	            ? "Octal literal in template string"
9315	            : "Octal literal in strict mode"
9316	        );
9317	      }
9318	      return String.fromCharCode(octal)
9319	    }
9320	    if (isNewLine(ch)) {
9321	      // Unicode new line characters after \ get removed from output in both
9322	      // template literals and strings
9323	      return ""
9324	    }
9325	    return String.fromCharCode(ch)
9326	  }
9327	};
9328
9329	// Used to read character escape sequences ('\x', '\u', '\U').
9330
9331	pp$9.readHexChar = function(len) {
9332	  var codePos = this.pos;
9333	  var n = this.readInt(16, len);
9334	  if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
9335	  return n
9336	};
9337
9338	// Read an identifier, and return it as a string. Sets `this.containsEsc`
9339	// to whether the word contained a '\u' escape.
9340	//
9341	// Incrementally adds only escaped chars, adding other chunks as-is
9342	// as a micro-optimization.
9343
9344	pp$9.readWord1 = function() {
9345	  this.containsEsc = false;
9346	  var word = "", first = true, chunkStart = this.pos;
9347	  var astral = this.options.ecmaVersion >= 6;
9348	  while (this.pos < this.input.length) {
9349	    var ch = this.fullCharCodeAtPos();
9350	    if (isIdentifierChar(ch, astral)) {
9351	      this.pos += ch <= 0xffff ? 1 : 2;
9352	    } else if (ch === 92) { // "\"
9353	      this.containsEsc = true;
9354	      word += this.input.slice(chunkStart, this.pos);
9355	      var escStart = this.pos;
9356	      if (this.input.charCodeAt(++this.pos) !== 117) // "u"
9357	        { this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); }
9358	      ++this.pos;
9359	      var esc = this.readCodePoint();
9360	      if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
9361	        { this.invalidStringToken(escStart, "Invalid Unicode escape"); }
9362	      word += codePointToString$1(esc);
9363	      chunkStart = this.pos;
9364	    } else {
9365	      break
9366	    }
9367	    first = false;
9368	  }
9369	  return word + this.input.slice(chunkStart, this.pos)
9370	};
9371
9372	// Read an identifier or keyword token. Will check for reserved
9373	// words when necessary.
9374
9375	pp$9.readWord = function() {
9376	  var word = this.readWord1();
9377	  var type = types.name;
9378	  if (this.keywords.test(word)) {
9379	    type = keywords$1[word];
9380	  }
9381	  return this.finishToken(type, word)
9382	};
9383
9384	// Acorn is a tiny, fast JavaScript parser written in JavaScript.
9385
9386	var version = "7.4.1";
9387
9388	Parser.acorn = {
9389	  Parser: Parser,
9390	  version: version,
9391	  defaultOptions: defaultOptions,
9392	  Position: Position,
9393	  SourceLocation: SourceLocation,
9394	  getLineInfo: getLineInfo,
9395	  Node: Node,
9396	  TokenType: TokenType,
9397	  tokTypes: types,
9398	  keywordTypes: keywords$1,
9399	  TokContext: TokContext,
9400	  tokContexts: types$1,
9401	  isIdentifierChar: isIdentifierChar,
9402	  isIdentifierStart: isIdentifierStart,
9403	  Token: Token,
9404	  isNewLine: isNewLine,
9405	  lineBreak: lineBreak,
9406	  lineBreakG: lineBreakG,
9407	  nonASCIIwhitespace: nonASCIIwhitespace
9408	};var defaultGlobals = new Set([
9409	  "Array",
9410	  "ArrayBuffer",
9411	  "atob",
9412	  "AudioContext",
9413	  "Blob",
9414	  "Boolean",
9415	  "BigInt",
9416	  "btoa",
9417	  "clearInterval",
9418	  "clearTimeout",
9419	  "console",
9420	  "crypto",
9421	  "CustomEvent",
9422	  "DataView",
9423	  "Date",
9424	  "decodeURI",
9425	  "decodeURIComponent",
9426	  "devicePixelRatio",
9427	  "document",
9428	  "encodeURI",
9429	  "encodeURIComponent",
9430	  "Error",
9431	  "escape",
9432	  "eval",
9433	  "fetch",
9434	  "File",
9435	  "FileList",
9436	  "FileReader",
9437	  "Float32Array",
9438	  "Float64Array",
9439	  "Function",
9440	  "Headers",
9441	  "Image",
9442	  "ImageData",
9443	  "Infinity",
9444	  "Int16Array",
9445	  "Int32Array",
9446	  "Int8Array",
9447	  "Intl",
9448	  "isFinite",
9449	  "isNaN",
9450	  "JSON",
9451	  "Map",
9452	  "Math",
9453	  "NaN",
9454	  "Number",
9455	  "navigator",
9456	  "Object",
9457	  "parseFloat",
9458	  "parseInt",
9459	  "performance",
9460	  "Path2D",
9461	  "Promise",
9462	  "Proxy",
9463	  "RangeError",
9464	  "ReferenceError",
9465	  "Reflect",
9466	  "RegExp",
9467	  "cancelAnimationFrame",
9468	  "requestAnimationFrame",
9469	  "Set",
9470	  "setInterval",
9471	  "setTimeout",
9472	  "String",
9473	  "Symbol",
9474	  "SyntaxError",
9475	  "TextDecoder",
9476	  "TextEncoder",
9477	  "this",
9478	  "TypeError",
9479	  "Uint16Array",
9480	  "Uint32Array",
9481	  "Uint8Array",
9482	  "Uint8ClampedArray",
9483	  "undefined",
9484	  "unescape",
9485	  "URIError",
9486	  "URL",
9487	  "WeakMap",
9488	  "WeakSet",
9489	  "WebSocket",
9490	  "Worker",
9491	  "window"
9492	]);// AST walker module for Mozilla Parser API compatible trees
9493
9494	// A simple walk is one where you simply specify callbacks to be
9495	// called on specific nodes. The last two arguments are optional. A
9496	// simple use would be
9497	//
9498	//     walk.simple(myTree, {
9499	//         Expression: function(node) { ... }
9500	//     });
9501	//
9502	// to do something with all expressions. All Parser API node types
9503	// can be used to identify node types, as well as Expression and
9504	// Statement, which denote categories of nodes.
9505	//
9506	// The base argument can be used to pass a custom (recursive)
9507	// walker, and state can be used to give this walked an initial
9508	// state.
9509
9510	function simple(node, visitors, baseVisitor, state, override) {
9511	  if (!baseVisitor) { baseVisitor = base
9512	  ; }(function c(node, st, override) {
9513	    var type = override || node.type, found = visitors[type];
9514	    baseVisitor[type](node, st, c);
9515	    if (found) { found(node, st); }
9516	  })(node, state, override);
9517	}
9518
9519	// An ancestor walk keeps an array of ancestor nodes (including the
9520	// current node) and passes them to the callback as third parameter
9521	// (and also as state parameter when no other state is present).
9522	function ancestor(node, visitors, baseVisitor, state) {
9523	  var ancestors = [];
9524	  if (!baseVisitor) { baseVisitor = base
9525	  ; }(function c(node, st, override) {
9526	    var type = override || node.type, found = visitors[type];
9527	    var isNew = node !== ancestors[ancestors.length - 1];
9528	    if (isNew) { ancestors.push(node); }
9529	    baseVisitor[type](node, st, c);
9530	    if (found) { found(node, st || ancestors, ancestors); }
9531	    if (isNew) { ancestors.pop(); }
9532	  })(node, state);
9533	}
9534
9535	// A full walk triggers the callback on each node
9536	function full(node, callback, baseVisitor, state, override) {
9537	  if (!baseVisitor) { baseVisitor = base
9538	  ; }(function c(node, st, override) {
9539	    var type = override || node.type;
9540	    baseVisitor[type](node, st, c);
9541	    if (!override) { callback(node, st, type); }
9542	  })(node, state, override);
9543	}
9544
9545	// Fallback to an Object.create polyfill for older environments.
9546	var create = Object.create || function(proto) {
9547	  function Ctor() {}
9548	  Ctor.prototype = proto;
9549	  return new Ctor
9550	};
9551
9552	// Used to create a custom walker. Will fill in all missing node
9553	// type properties with the defaults.
9554	function make(funcs, baseVisitor) {
9555	  var visitor = create(baseVisitor || base);
9556	  for (var type in funcs) { visitor[type] = funcs[type]; }
9557	  return visitor
9558	}
9559
9560	function skipThrough(node, st, c) { c(node, st); }
9561	function ignore(_node, _st, _c) {}
9562
9563	// Node walkers.
9564
9565	var base = {};
9566
9567	base.Program = base.BlockStatement = function (node, st, c) {
9568	  for (var i = 0, list = node.body; i < list.length; i += 1)
9569	    {
9570	    var stmt = list[i];
9571
9572	    c(stmt, st, "Statement");
9573	  }
9574	};
9575	base.Statement = skipThrough;
9576	base.EmptyStatement = ignore;
9577	base.ExpressionStatement = base.ParenthesizedExpression =
9578	  function (node, st, c) { return c(node.expression, st, "Expression"); };
9579	base.IfStatement = function (node, st, c) {
9580	  c(node.test, st, "Expression");
9581	  c(node.consequent, st, "Statement");
9582	  if (node.alternate) { c(node.alternate, st, "Statement"); }
9583	};
9584	base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
9585	base.BreakStatement = base.ContinueStatement = ignore;
9586	base.WithStatement = function (node, st, c) {
9587	  c(node.object, st, "Expression");
9588	  c(node.body, st, "Statement");
9589	};
9590	base.SwitchStatement = function (node, st, c) {
9591	  c(node.discriminant, st, "Expression");
9592	  for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
9593	    var cs = list$1[i$1];
9594
9595	    if (cs.test) { c(cs.test, st, "Expression"); }
9596	    for (var i = 0, list = cs.consequent; i < list.length; i += 1)
9597	      {
9598	      var cons = list[i];
9599
9600	      c(cons, st, "Statement");
9601	    }
9602	  }
9603	};
9604	base.SwitchCase = function (node, st, c) {
9605	  if (node.test) { c(node.test, st, "Expression"); }
9606	  for (var i = 0, list = node.consequent; i < list.length; i += 1)
9607	    {
9608	    var cons = list[i];
9609
9610	    c(cons, st, "Statement");
9611	  }
9612	};
9613	base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
9614	  if (node.argument) { c(node.argument, st, "Expression"); }
9615	};
9616	base.ThrowStatement = base.SpreadElement =
9617	  function (node, st, c) { return c(node.argument, st, "Expression"); };
9618	base.TryStatement = function (node, st, c) {
9619	  c(node.block, st, "Statement");
9620	  if (node.handler) { c(node.handler, st); }
9621	  if (node.finalizer) { c(node.finalizer, st, "Statement"); }
9622	};
9623	base.CatchClause = function (node, st, c) {
9624	  if (node.param) { c(node.param, st, "Pattern"); }
9625	  c(node.body, st, "Statement");
9626	};
9627	base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
9628	  c(node.test, st, "Expression");
9629	  c(node.body, st, "Statement");
9630	};
9631	base.ForStatement = function (node, st, c) {
9632	  if (node.init) { c(node.init, st, "ForInit"); }
9633	  if (node.test) { c(node.test, st, "Expression"); }
9634	  if (node.update) { c(node.update, st, "Expression"); }
9635	  c(node.body, st, "Statement");
9636	};
9637	base.ForInStatement = base.ForOfStatement = function (node, st, c) {
9638	  c(node.left, st, "ForInit");
9639	  c(node.right, st, "Expression");
9640	  c(node.body, st, "Statement");
9641	};
9642	base.ForInit = function (node, st, c) {
9643	  if (node.type === "VariableDeclaration") { c(node, st); }
9644	  else { c(node, st, "Expression"); }
9645	};
9646	base.DebuggerStatement = ignore;
9647
9648	base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
9649	base.VariableDeclaration = function (node, st, c) {
9650	  for (var i = 0, list = node.declarations; i < list.length; i += 1)
9651	    {
9652	    var decl = list[i];
9653
9654	    c(decl, st);
9655	  }
9656	};
9657	base.VariableDeclarator = function (node, st, c) {
9658	  c(node.id, st, "Pattern");
9659	  if (node.init) { c(node.init, st, "Expression"); }
9660	};
9661
9662	base.Function = function (node, st, c) {
9663	  if (node.id) { c(node.id, st, "Pattern"); }
9664	  for (var i = 0, list = node.params; i < list.length; i += 1)
9665	    {
9666	    var param = list[i];
9667
9668	    c(param, st, "Pattern");
9669	  }
9670	  c(node.body, st, node.expression ? "Expression" : "Statement");
9671	};
9672
9673	base.Pattern = function (node, st, c) {
9674	  if (node.type === "Identifier")
9675	    { c(node, st, "VariablePattern"); }
9676	  else if (node.type === "MemberExpression")
9677	    { c(node, st, "MemberPattern"); }
9678	  else
9679	    { c(node, st); }
9680	};
9681	base.VariablePattern = ignore;
9682	base.MemberPattern = skipThrough;
9683	base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
9684	base.ArrayPattern = function (node, st, c) {
9685	  for (var i = 0, list = node.elements; i < list.length; i += 1) {
9686	    var elt = list[i];
9687
9688	    if (elt) { c(elt, st, "Pattern"); }
9689	  }
9690	};
9691	base.ObjectPattern = function (node, st, c) {
9692	  for (var i = 0, list = node.properties; i < list.length; i += 1) {
9693	    var prop = list[i];
9694
9695	    if (prop.type === "Property") {
9696	      if (prop.computed) { c(prop.key, st, "Expression"); }
9697	      c(prop.value, st, "Pattern");
9698	    } else if (prop.type === "RestElement") {
9699	      c(prop.argument, st, "Pattern");
9700	    }
9701	  }
9702	};
9703
9704	base.Expression = skipThrough;
9705	base.ThisExpression = base.Super = base.MetaProperty = ignore;
9706	base.ArrayExpression = function (node, st, c) {
9707	  for (var i = 0, list = node.elements; i < list.length; i += 1) {
9708	    var elt = list[i];
9709
9710	    if (elt) { c(elt, st, "Expression"); }
9711	  }
9712	};
9713	base.ObjectExpression = function (node, st, c) {
9714	  for (var i = 0, list = node.properties; i < list.length; i += 1)
9715	    {
9716	    var prop = list[i];
9717
9718	    c(prop, st);
9719	  }
9720	};
9721	base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
9722	base.SequenceExpression = function (node, st, c) {
9723	  for (var i = 0, list = node.expressions; i < list.length; i += 1)
9724	    {
9725	    var expr = list[i];
9726
9727	    c(expr, st, "Expression");
9728	  }
9729	};
9730	base.TemplateLiteral = function (node, st, c) {
9731	  for (var i = 0, list = node.quasis; i < list.length; i += 1)
9732	    {
9733	    var quasi = list[i];
9734
9735	    c(quasi, st);
9736	  }
9737
9738	  for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
9739	    {
9740	    var expr = list$1[i$1];
9741
9742	    c(expr, st, "Expression");
9743	  }
9744	};
9745	base.TemplateElement = ignore;
9746	base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
9747	  c(node.argument, st, "Expression");
9748	};
9749	base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
9750	  c(node.left, st, "Expression");
9751	  c(node.right, st, "Expression");
9752	};
9753	base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
9754	  c(node.left, st, "Pattern");
9755	  c(node.right, st, "Expression");
9756	};
9757	base.ConditionalExpression = function (node, st, c) {
9758	  c(node.test, st, "Expression");
9759	  c(node.consequent, st, "Expression");
9760	  c(node.alternate, st, "Expression");
9761	};
9762	base.NewExpression = base.CallExpression = function (node, st, c) {
9763	  c(node.callee, st, "Expression");
9764	  if (node.arguments)
9765	    { for (var i = 0, list = node.arguments; i < list.length; i += 1)
9766	      {
9767	        var arg = list[i];
9768
9769	        c(arg, st, "Expression");
9770	      } }
9771	};
9772	base.MemberExpression = function (node, st, c) {
9773	  c(node.object, st, "Expression");
9774	  if (node.computed) { c(node.property, st, "Expression"); }
9775	};
9776	base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
9777	  if (node.declaration)
9778	    { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
9779	  if (node.source) { c(node.source, st, "Expression"); }
9780	};
9781	base.ExportAllDeclaration = function (node, st, c) {
9782	  c(node.source, st, "Expression");
9783	};
9784	base.ImportDeclaration = function (node, st, c) {
9785	  for (var i = 0, list = node.specifiers; i < list.length; i += 1)
9786	    {
9787	    var spec = list[i];
9788
9789	    c(spec, st);
9790	  }
9791	  c(node.source, st, "Expression");
9792	};
9793	base.ImportExpression = function (node, st, c) {
9794	  c(node.source, st, "Expression");
9795	};
9796	base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
9797
9798	base.TaggedTemplateExpression = function (node, st, c) {
9799	  c(node.tag, st, "Expression");
9800	  c(node.quasi, st, "Expression");
9801	};
9802	base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
9803	base.Class = function (node, st, c) {
9804	  if (node.id) { c(node.id, st, "Pattern"); }
9805	  if (node.superClass) { c(node.superClass, st, "Expression"); }
9806	  c(node.body, st);
9807	};
9808	base.ClassBody = function (node, st, c) {
9809	  for (var i = 0, list = node.body; i < list.length; i += 1)
9810	    {
9811	    var elt = list[i];
9812
9813	    c(elt, st);
9814	  }
9815	};
9816	base.MethodDefinition = base.Property = function (node, st, c) {
9817	  if (node.computed) { c(node.key, st, "Expression"); }
9818	  c(node.value, st, "Expression");
9819	};var walk = make({
9820	  Import() {},
9821	  ViewExpression(node, st, c) {
9822	    c(node.id, st, "Identifier");
9823	  },
9824	  MutableExpression(node, st, c) {
9825	    c(node.id, st, "Identifier");
9826	  }
9827	});// Based on https://github.com/ForbesLindesay/acorn-globals
9828
9829	function isScope(node) {
9830	  return node.type === "FunctionExpression"
9831	      || node.type === "FunctionDeclaration"
9832	      || node.type === "ArrowFunctionExpression"
9833	      || node.type === "Program";
9834	}
9835
9836	function isBlockScope(node) {
9837	  return node.type === "BlockStatement"
9838	      || node.type === "ForInStatement"
9839	      || node.type === "ForOfStatement"
9840	      || node.type === "ForStatement"
9841	      || isScope(node);
9842	}
9843
9844	function declaresArguments(node) {
9845	  return node.type === "FunctionExpression"
9846	      || node.type === "FunctionDeclaration";
9847	}
9848
9849	function findReferences(cell, globals) {
9850	  const ast = {type: "Program", body: [cell.body]};
9851	  const locals = new Map;
9852	  const globalSet = new Set(globals);
9853	  const references = [];
9854
9855	  function hasLocal(node, name) {
9856	    const l = locals.get(node);
9857	    return l ? l.has(name) : false;
9858	  }
9859
9860	  function declareLocal(node, id) {
9861	    const l = locals.get(node);
9862	    if (l) l.add(id.name);
9863	    else locals.set(node, new Set([id.name]));
9864	  }
9865
9866	  function declareClass(node) {
9867	    if (node.id) declareLocal(node, node.id);
9868	  }
9869
9870	  function declareFunction(node) {
9871	    node.params.forEach(param => declarePattern(param, node));
9872	    if (node.id) declareLocal(node, node.id);
9873	  }
9874
9875	  function declareCatchClause(node) {
9876	    if (node.param) declarePattern(node.param, node);
9877	  }
9878
9879	  function declarePattern(node, parent) {
9880	    switch (node.type) {
9881	      case "Identifier":
9882	        declareLocal(parent, node);
9883	        break;
9884	      case "ObjectPattern":
9885	        node.properties.forEach(node => declarePattern(node, parent));
9886	        break;
9887	      case "ArrayPattern":
9888	        node.elements.forEach(node => node && declarePattern(node, parent));
9889	        break;
9890	      case "Property":
9891	        declarePattern(node.value, parent);
9892	        break;
9893	      case "RestElement":
9894	        declarePattern(node.argument, parent);
9895	        break;
9896	      case "AssignmentPattern":
9897	        declarePattern(node.left, parent);
9898	        break;
9899	      default:
9900	        throw new Error("Unrecognized pattern type: " + node.type);
9901	    }
9902	  }
9903
9904	  function declareModuleSpecifier(node) {
9905	    declareLocal(ast, node.local);
9906	  }
9907
9908	  ancestor(
9909	    ast,
9910	    {
9911	      VariableDeclaration: (node, parents) => {
9912	        let parent = null;
9913	        for (let i = parents.length - 1; i >= 0 && parent === null; --i) {
9914	          if (node.kind === "var" ? isScope(parents[i]) : isBlockScope(parents[i])) {
9915	            parent = parents[i];
9916	          }
9917	        }
9918	        node.declarations.forEach(declaration => declarePattern(declaration.id, parent));
9919	      },
9920	      FunctionDeclaration: (node, parents) => {
9921	        let parent = null;
9922	        for (let i = parents.length - 2; i >= 0 && parent === null; --i) {
9923	          if (isScope(parents[i])) {
9924	            parent = parents[i];
9925	          }
9926	        }
9927	        declareLocal(parent, node.id);
9928	        declareFunction(node);
9929	      },
9930	      Function: declareFunction,
9931	      ClassDeclaration: (node, parents) => {
9932	        let parent = null;
9933	        for (let i = parents.length - 2; i >= 0 && parent === null; i--) {
9934	          if (isScope(parents[i])) {
9935	            parent = parents[i];
9936	          }
9937	        }
9938	        declareLocal(parent, node.id);
9939	      },
9940	      Class: declareClass,
9941	      CatchClause: declareCatchClause,
9942	      ImportDefaultSpecifier: declareModuleSpecifier,
9943	      ImportSpecifier: declareModuleSpecifier,
9944	      ImportNamespaceSpecifier: declareModuleSpecifier
9945	    },
9946	    walk
9947	  );
9948
9949	  function identifier(node, parents) {
9950	    let name = node.name;
9951	    if (name === "undefined") return;
9952	    for (let i = parents.length - 2; i >= 0; --i) {
9953	      if (name === "arguments") {
9954	        if (declaresArguments(parents[i])) {
9955	          return;
9956	        }
9957	      }
9958	      if (hasLocal(parents[i], name)) {
9959	        return;
9960	      }
9961	      if (parents[i].type === "ViewExpression") {
9962	        node = parents[i];
9963	        name = `viewof ${node.id.name}`;
9964	      }
9965	      if (parents[i].type === "MutableExpression") {
9966	        node = parents[i];
9967	        name = `mutable ${node.id.name}`;
9968	      }
9969	    }
9970	    if (!globalSet.has(name)) {
9971	      if (name === "arguments") {
9972	        throw Object.assign(new SyntaxError(`arguments is not allowed`), {node});
9973	      }
9974	      references.push(node);
9975	    }
9976	  }
9977
9978	  ancestor(
9979	    ast,
9980	    {
9981	      VariablePattern: identifier,
9982	      Identifier: identifier
9983	    },
9984	    walk
9985	  );
9986
9987	  function checkConst(node, parents) {
9988	    switch (node.type) {
9989	      case "Identifier":
9990	      case "VariablePattern": {
9991	        identifier(node, parents);
9992	        break;
9993	      }
9994	      case "ArrayPattern":
9995	      case "ObjectPattern": {
9996	        ancestor(
9997	          node,
9998	          {
9999	            Identifier: identifier,
10000	            VariablePattern: identifier
10001	          },
10002	          walk
10003	        );
10004	        break;
10005	      }
10006	    }
10007	    function identifier(node, nodeParents) {
10008	      for (const parent of parents) {
10009	        if (hasLocal(parent, node.name)) {
10010	          return;
10011	        }
10012	      }
10013	      if (nodeParents[nodeParents.length - 2].type === "MutableExpression") {
10014	        return;
10015	      }
10016	      throw Object.assign(new SyntaxError(`Assignment to constant variable ${node.name}`), {node});
10017	    }
10018	  }
10019
10020	  function checkConstArgument(node, parents) {
10021	    checkConst(node.argument, parents);
10022	  }
10023
10024	  function checkConstLeft(node, parents) {
10025	    checkConst(node.left, parents);
10026	  }
10027
10028	  ancestor(
10029	    ast,
10030	    {
10031	      AssignmentExpression: checkConstLeft,
10032	      UpdateExpression: checkConstArgument,
10033	      ForOfStatement: checkConstLeft,
10034	      ForInStatement: checkConstLeft
10035	    },
10036	    walk
10037	  );
10038
10039	  return references;
10040	}function findFeatures(cell, featureName) {
10041	  const ast = {type: "Program", body: [cell.body]};
10042	  const features = new Map();
10043	  const {references} = cell;
10044
10045	  simple(
10046	    ast,
10047	    {
10048	      CallExpression: node => {
10049	        const {callee, arguments: args} = node;
10050
10051	        // Ignore function calls that are not references to the feature.
10052	        if (
10053	          callee.type !== "Identifier" ||
10054	          callee.name !== featureName ||
10055	          references.indexOf(callee) < 0
10056	        ) return;
10057
10058	        // Forbid dynamic calls.
10059	        if (
10060	          args.length !== 1 ||
10061	          !((args[0].type === "Literal" && /^['"]/.test(args[0].raw)) ||
10062	            (args[0].type === "TemplateLiteral" && args[0].expressions.length === 0))
10063	        ) {
10064	          throw Object.assign(new SyntaxError(`${featureName} requires a single literal string argument`), {node});
10065	        }
10066
10067	        const [arg] = args;
10068	        const name = arg.type === "Literal" ? arg.value : arg.quasis[0].value.cooked;
10069	        const location = {start: arg.start, end: arg.end};
10070	        if (features.has(name)) features.get(name).push(location);
10071	        else features.set(name, [location]);
10072	      }
10073	    },
10074	    walk
10075	  );
10076
10077	  return features;
10078	}const SCOPE_FUNCTION$1 = 2;
10079	const SCOPE_ASYNC$1 = 4;
10080	const SCOPE_GENERATOR$1 = 8;
10081
10082	const STATE_START = Symbol("start");
10083	const STATE_MODIFIER = Symbol("modifier");
10084	const STATE_FUNCTION = Symbol("function");
10085	const STATE_NAME = Symbol("name");
10086
10087	function parseCell(input, {globals} = {}) {
10088	  const cell = CellParser.parse(input);
10089	  parseReferences(cell, input, globals);
10090	  parseFeatures(cell);
10091	  return cell;
10092	}
10093
10094	/*
10095	                       ┌─────┐
10096	           ┌───────────│START│─function|class
10097	           │           └─────┘             │
10098	viewof|mutable|async      │                ▼
10099	           │              │           ┌────────┐     ┌─┐
10100	           ▼              │           │FUNCTION│◀───▶│*│
10101	      ┌────────┐          │           └────────┘     └─┘
10102	      │MODIFIER│          │                │
10103	      └────────┘        name             name
10104	           │              │                │
10105	           └──name─┐      │                ▼
10106	                   ▼      │         ┌─────────────┐
10107	              ┌────────┐  │         │FUNCTION_NAME│
10108	              │  NAME  │◀─┘         └─────────────┘
10109	              └────────┘
10110	                   │
10111	                   =
10112	                   ▼
10113	              ┌────────┐
10114	              │   EQ   │
10115	              └────────┘
10116	*/
10117
10118	function peekId(input) {
10119	  let state = STATE_START;
10120	  let name;
10121	  try {
10122	    for (const token of Parser.tokenizer(input, {ecmaVersion: 11})) {
10123	      switch (state) {
10124	        case STATE_START:
10125	        case STATE_MODIFIER: {
10126	          if (token.type === types.name) {
10127	            if (
10128	              state === STATE_START &&
10129	              (token.value === "viewof" ||
10130	                token.value === "mutable" ||
10131	                token.value === "async")
10132	            ) {
10133	              state = STATE_MODIFIER;
10134	              continue;
10135	            }
10136	            state = STATE_NAME;
10137	            name = token;
10138	            continue;
10139	          }
10140	          if (token.type === types._function || token.type === types._class) {
10141	            state = STATE_FUNCTION;
10142	            continue;
10143	          }
10144	          break;
10145	        }
10146	        case STATE_NAME: {
10147	          if (token.type === types.eq) return name.value;
10148	          break;
10149	        }
10150	        case STATE_FUNCTION: {
10151	          if (token.type === types.star) continue;
10152	          if (token.type === types.name && token.end < input.length)
10153	            return token.value;
10154	          break;
10155	        }
10156	      }
10157	      return;
10158	    }
10159	  } catch (ignore) {
10160	    return;
10161	  }
10162	}
10163
10164	class CellParser extends Parser {
10165	  constructor(options, ...args) {
10166	    super(Object.assign({ecmaVersion: 12}, options), ...args);
10167	  }
10168	  enterScope(flags) {
10169	    if (flags & SCOPE_FUNCTION$1) ++this.O_function;
10170	    return super.enterScope(flags);
10171	  }
10172	  exitScope() {
10173	    if (this.currentScope().flags & SCOPE_FUNCTION$1) --this.O_function;
10174	    return super.exitScope();
10175	  }
10176	  parseForIn(node, init) {
10177	    if (this.O_function === 1 && node.await) this.O_async = true;
10178	    return super.parseForIn(node, init);
10179	  }
10180	  parseAwait() {
10181	    if (this.O_function === 1) this.O_async = true;
10182	    return super.parseAwait();
10183	  }
10184	  parseYield(noIn) {
10185	    if (this.O_function === 1) this.O_generator = true;
10186	    return super.parseYield(noIn);
10187	  }
10188	  parseImport(node) {
10189	    this.next();
10190	    node.specifiers = this.parseImportSpecifiers();
10191	    if (this.type === types._with) {
10192	      this.next();
10193	      node.injections = this.parseImportSpecifiers();
10194	    }
10195	    this.expectContextual("from");
10196	    node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
10197	    return this.finishNode(node, "ImportDeclaration");
10198	  }
10199	  parseImportSpecifiers() {
10200	    const nodes = [];
10201	    const identifiers = new Set;
10202	    let first = true;
10203	    this.expect(types.braceL);
10204	    while (!this.eat(types.braceR)) {
10205	      if (first) {
10206	        first = false;
10207	      } else {
10208	        this.expect(types.comma);
10209	        if (this.afterTrailingComma(types.braceR)) break;
10210	      }
10211	      const node = this.startNode();
10212	      node.view = this.eatContextual("viewof");
10213	      node.mutable = node.view ? false : this.eatContextual("mutable");
10214	      node.imported = this.parseIdent();
10215	      this.checkUnreserved(node.imported);
10216	      this.checkLocal(node.imported);
10217	      if (this.eatContextual("as")) {
10218	        node.local = this.parseIdent();
10219	        this.checkUnreserved(node.local);
10220	        this.checkLocal(node.local);
10221	      } else {
10222	        node.local = node.imported;
10223	      }
10224	      this.checkLVal(node.local, "let");
10225	      if (identifiers.has(node.local.name)) {
10226	        this.raise(node.local.start, `Identifier '${node.local.name}' has already been declared`);
10227	      }
10228	      identifiers.add(node.local.name);
10229	      nodes.push(this.finishNode(node, "ImportSpecifier"));
10230	    }
10231	    return nodes;
10232	  }
10233	  parseExprAtom(refDestructuringErrors) {
10234	    return (
10235	      this.parseMaybeKeywordExpression("viewof", "ViewExpression") ||
10236	      this.parseMaybeKeywordExpression("mutable", "MutableExpression") ||
10237	      super.parseExprAtom(refDestructuringErrors)
10238	    );
10239	  }
10240	  parseCell(node, eof) {
10241	    const lookahead = new CellParser({}, this.input, this.start);
10242	    let token = lookahead.getToken();
10243	    let body = null;
10244	    let id = null;
10245
10246	    this.O_function = 0;
10247	    this.O_async = false;
10248	    this.O_generator = false;
10249	    this.strict = true;
10250	    this.enterScope(SCOPE_FUNCTION$1 | SCOPE_ASYNC$1 | SCOPE_GENERATOR$1);
10251
10252	    // An import?
10253	    if (token.type === types._import && lookahead.getToken().type !== types.parenL) {
10254	      body = this.parseImport(this.startNode());
10255	    }
10256
10257	    // A non-empty cell?
10258	    else if (token.type !== types.eof && token.type !== types.semi) {
10259	      // A named cell?
10260	      if (token.type === types.name) {
10261	        if (token.value === "viewof" || token.value === "mutable") {
10262	          token = lookahead.getToken();
10263	          if (token.type !== types.name) {
10264	            lookahead.unexpected();
10265	          }
10266	        }
10267	        token = lookahead.getToken();
10268	        if (token.type === types.eq) {
10269	          id =
10270	            this.parseMaybeKeywordExpression("viewof", "ViewExpression") ||
10271	            this.parseMaybeKeywordExpression("mutable", "MutableExpression") ||
10272	            this.parseIdent();
10273	          token = lookahead.getToken();
10274	          this.expect(types.eq);
10275	        }
10276	      }
10277
10278	      // A block?
10279	      if (token.type === types.braceL) {
10280	        body = this.parseBlock();
10281	      }
10282
10283	      // An expression?
10284	      // Possibly a function or class declaration?
10285	      else {
10286	        body = this.parseExpression();
10287	        if (
10288	          id === null &&
10289	          (body.type === "FunctionExpression" ||
10290	            body.type === "ClassExpression")
10291	        ) {
10292	          id = body.id;
10293	        }
10294	      }
10295	    }
10296
10297	    this.semicolon();
10298	    if (eof) this.expect(types.eof); // TODO
10299
10300	    if (id) this.checkLocal(id);
10301	    node.id = id;
10302	    node.async = this.O_async;
10303	    node.generator = this.O_generator;
10304	    node.body = body;
10305	    this.exitScope();
10306	    return this.finishNode(node, "Cell");
10307	  }
10308	  parseTopLevel(node) {
10309	    return this.parseCell(node, true);
10310	  }
10311	  toAssignable(node, isBinding, refDestructuringErrors) {
10312	    return node.type === "MutableExpression"
10313	      ? node
10314	      : super.toAssignable(node, isBinding, refDestructuringErrors);
10315	  }
10316	  checkLocal(id) {
10317	    const node = id.id || id;
10318	    if (defaultGlobals.has(node.name) || node.name === "arguments") {
10319	      this.raise(node.start, `Identifier '${node.name}' is reserved`);
10320	    }
10321	  }
10322	  checkUnreserved(node) {
10323	    if (node.name === "viewof" || node.name === "mutable") {
10324	      this.raise(node.start, `Unexpected keyword '${node.name}'`);
10325	    }
10326	    return super.checkUnreserved(node);
10327	  }
10328	  checkLVal(expr, bindingType, checkClashes) {
10329	    return super.checkLVal(
10330	      expr.type === "MutableExpression" ? expr.id : expr,
10331	      bindingType,
10332	      checkClashes
10333	    );
10334	  }
10335	  unexpected(pos) {
10336	    this.raise(
10337	      pos != null ? pos : this.start,
10338	      this.type === types.eof ? "Unexpected end of input" : "Unexpected token"
10339	    );
10340	  }
10341	  parseMaybeKeywordExpression(keyword, type) {
10342	    if (this.isContextual(keyword)) {
10343	      const node = this.startNode();
10344	      this.next();
10345	      node.id = this.parseIdent();
10346	      return this.finishNode(node, type);
10347	    }
10348	  }
10349	}
10350
10351	function parseModule(input, {globals} = {}) {
10352	  const program = ModuleParser.parse(input);
10353	  for (const cell of program.cells) {
10354	    parseReferences(cell, input, globals);
10355	    parseFeatures(cell, input);
10356	  }
10357	  return program;
10358	}
10359
10360	class ModuleParser extends CellParser {
10361	  parseTopLevel(node) {
10362	    if (!node.cells) node.cells = [];
10363	    while (this.type !== types.eof) {
10364	      const cell = this.parseCell(this.startNode());
10365	      cell.input = this.input;
10366	      node.cells.push(cell);
10367	    }
10368	    this.next();
10369	    return this.finishNode(node, "Program");
10370	  }
10371	}
10372
10373	// Find references.
10374	// Check for illegal references to arguments.
10375	// Check for illegal assignments to global references.
10376	function parseReferences(cell, input, globals = defaultGlobals) {
10377	  if (cell.body && cell.body.type !== "ImportDeclaration") {
10378	    try {
10379	      cell.references = findReferences(cell, globals);
10380	    } catch (error) {
10381	      if (error.node) {
10382	        const loc = getLineInfo(input, error.node.start);
10383	        error.message += ` (${loc.line}:${loc.column})`;
10384	        error.pos = error.node.start;
10385	        error.loc = loc;
10386	        delete error.node;
10387	      }
10388	      throw error;
10389	    }
10390	  }
10391	  return cell;
10392	}
10393
10394	// Find features: file attachments, secrets, database clients.
10395	// Check for illegal references to arguments.
10396	// Check for illegal assignments to global references.
10397	function parseFeatures(cell, input) {
10398	  if (cell.body && cell.body.type !== "ImportDeclaration") {
10399	    try {
10400	      cell.fileAttachments = findFeatures(cell, "FileAttachment");
10401	      cell.databaseClients = findFeatures(cell, "DatabaseClient");
10402	      cell.secrets = findFeatures(cell, "Secret");
10403	    } catch (error) {
10404	      if (error.node) {
10405	        const loc = getLineInfo(input, error.node.start);
10406	        error.message += ` (${loc.line}:${loc.column})`;
10407	        error.pos = error.node.start;
10408	        error.loc = loc;
10409	        delete error.node;
10410	      }
10411	      throw error;
10412	    }
10413	  } else {
10414	    cell.fileAttachments = new Map();
10415	    cell.databaseClients = new Map();
10416	    cell.secrets = new Map();
10417	  }
10418	  return cell;
10419	}var index=/*#__PURE__*/Object.freeze({__proto__:null,parseCell: parseCell,peekId: peekId,CellParser: CellParser,parseModule: parseModule,ModuleParser: ModuleParser,walk: walk});/**
10420	 *  FINISH REPLACING THE SIMPLE WALKER WITH A FULL WALKER THAT DOES SUBSTITUTION ALL AT ONCE.
10421	 * 
10422	 */
10423
10424	const extractPath = path => {
10425	  let source = path;
10426	  let m;
10427
10428	  // "https://api.observablehq.com/@jashkenas/inputs.js?v=3" => strip off ".js"
10429	  if ((m = /\.js(\?|$)/i.exec(source))) source = source.slice(0, m.index);
10430
10431	  // "74f872c4fde62e35" => "d/..."
10432	  if ((m = /^[0-9a-f]{16}$/i.test(source))) source = `d/${source}`;
10433
10434	  // link of notebook
10435	  if ((m = /^https:\/\/(api\.|beta\.|)observablehq\.com\//i.exec(source)))
10436	    source = source.slice(m[0].length);
10437	  return source;
10438	};
10439
10440	function setupImportCell(cell) {
10441	  const specifiers = [];
10442
10443	  if (cell.body.specifiers)
10444	    for (const specifier of cell.body.specifiers) {
10445	      if (specifier.view) {
10446	        specifiers.push({
10447	          name: "viewof " + specifier.imported.name,
10448	          alias: "viewof " + specifier.local.name
10449	        });
10450	      } else if (specifier.mutable) {
10451	        specifiers.push({
10452	          name: "mutable " + specifier.imported.name,
10453	          alias: "mutable " + specifier.local.name
10454	        });
10455	      }
10456	      specifiers.push({
10457	        name: specifier.imported.name,
10458	        alias: specifier.local.name
10459	      });
10460	    }
10461	  // If injections is undefined, do not derive!
10462	  const hasInjections = cell.body.injections !== undefined;
10463	  const injections = [];
10464	  if (hasInjections)
10465	    for (const injection of cell.body.injections) {
10466	      // This currently behaves like notebooks on observablehq.com
10467	      // Commenting out the if & else if blocks result in behavior like Example 3 here: https://observablehq.com/d/7ccad009e4d89969
10468	      if (injection.view) {
10469	        injections.push({
10470	          name: "viewof " + injection.imported.name,
10471	          alias: "viewof " + injection.local.name
10472	        });
10473	      } else if (injection.mutable) {
10474	        injections.push({
10475	          name: "mutable " + injection.imported.name,
10476	          alias: "mutable " + injection.local.name
10477	        });
10478	      }
10479	      injections.push({
10480	        name: injection.imported.name,
10481	        alias: injection.local.name
10482	      });
10483	    }
10484	  const importString = `import {${specifiers
10485	    .map(specifier => `${specifier.name} as ${specifier.alias}`)
10486	    .join(", ")}} ${
10487	    hasInjections
10488	      ? `with {${injections
10489	          .map(injection => `${injection.name} as ${injection.alias}`)
10490	          .join(", ")}} `
10491	      : ``
10492	  }from "${cell.body.source.value}"`;
10493
10494	  return { specifiers, hasInjections, injections, importString };
10495	}
10496
10497	function setupRegularCell(cell) {
10498	  let name = null;
10499	  if (cell.id && cell.id.name) name = cell.id.name;
10500	  else if (cell.id && cell.id.id && cell.id.id.name) name = cell.id.id.name;
10501	  let bodyText = cell.input.substring(cell.body.start, cell.body.end);
10502	  let expressionMap = {};
10503	  let references = [];
10504	  const cellReferences = Array.from(new Set((cell.references || []).map(ref => {
10505	    if (ref.type === "ViewExpression") {
10506	      if (expressionMap[ref.id.name] === undefined) {
10507	        expressionMap[ref.id.name] = ref.id.name;
10508	        references.push(ref.id.name);
10509	      }
10510	      return "viewof " + ref.id.name;
10511	    } else if (ref.type === "MutableExpression") {
10512	      if (expressionMap[ref.id.name] === undefined) {
10513	        expressionMap[ref.id.name] = ref.id.name;
10514	        references.push(ref.id.name);
10515	      }
10516	      return "mutable " + ref.id.name;
10517	    } else {
10518	      references.push(ref.name);
10519	      return ref.name;
10520	    }
10521	  })));
10522	  const uniq = (lst) => {
10523	    const result = [];
10524	    const s = new Set();
10525	    for (const v of lst) {
10526	      if (s.has(v)) continue;
10527	      s.add(v);
10528	      result.push(v);
10529	    }
10530	    return result;
10531	  };
10532	  const patches = [];
10533	  let latestPatch = { newStr: "", span: [cell.body.start, cell.body.start] };
10534	  full(cell.body, node => {
10535	    if (node.type === "ViewExpression" || node.type === "MutableExpression") {
10536	      // cover previous ground?
10537	      if (node.start !== latestPatch.span[1]) {
10538	        patches.push({ newStr: cell.input.substring(latestPatch.span[1], node.start)});
10539	      }
10540	      const suffix = node.type === "MutableExpression" ? ".value" : "";
10541	      const newStr = `${expressionMap[node.id.name]}${suffix}`;
10542	      const patch = {
10543	        newStr,
10544	        span: [node.start, node.end]
10545	      };
10546	      latestPatch = patch;
10547	      patches.push(patch);
10548	    }
10549	  }, walk);
10550	  patches.push({newStr: cell.input.substring(latestPatch.span[1], cell.body.end), span: [latestPatch.span[1], cell.body.end]});
10551	  bodyText = patches.map(x => x.newStr).join("");
10552
10553	  return {
10554	    cellName: name,
10555	    references: uniq(references),
10556	    bodyText,
10557	    cellReferences: uniq(cellReferences)
10558	  };
10559	}function names(cell) {
10560	  if (cell.body && cell.body.specifiers)
10561	    return cell.body.specifiers.map(
10562	      d => `${d.view ? "viewof " : d.mutable ? "mutable " : ""}${d.local.name}`
10563	    );
10564
10565	  if (cell.id && cell.id.type && cell.id) {
10566	    if (cell.id.type === "ViewExpression") return [`viewof ${cell.id.id.name}`];
10567	    if (cell.id.type === "MutableExpression")
10568	      return [`mutable ${cell.id.id.name}`];
10569	    if (cell.id.name) return [cell.id.name];
10570	  }
10571
10572	  return [];
10573	}
10574
10575	function references(cell) {
10576	  if (cell.references)
10577	    return cell.references.map(d => {
10578	      if (d.name) return d.name;
10579	      if (d.type === "ViewExpression") return `viewof ${d.id.name}`;
10580	      if (d.type === "MutableExpression") return `mutable ${d.id.name}`;
10581	      return null;
10582	    });
10583
10584	  if (cell.body && cell.body.injections)
10585	    return cell.body.injections.map(
10586	      d =>
10587	        `${d.view ? "viewof " : d.mutable ? "mutable " : ""}${d.imported.name}`
10588	    );
10589
10590	  return [];
10591	}
10592
10593	function getCellRefs(module) {
10594	  const cells = [];
10595	  for (const cell of module.cells) {
10596	    const ns = names(cell);
10597	    const refs = references(cell);
10598	    if (!ns || !ns.length) continue;
10599	    for (const name of ns) {
10600	      cells.push([name, refs]);
10601	      if (name.startsWith("viewof "))
10602	        cells.push([name.substring("viewof ".length), [name]]);
10603	    }
10604	  }
10605	  return new Map(cells);
10606	}
10607
10608	function treeShakeModule(module, targets) {
10609	  const cellRefs = getCellRefs(module);
10610
10611	  const embed = new Set();
10612	  const todo = targets.slice();
10613	  while (todo.length) {
10614	    const d = todo.pop();
10615	    embed.add(d);
10616	    // happens when 1) d is an stdlib cell, 2) d doesnt have a defintion,
10617	    // or 3) d is in the window/global object. Let's be forgiving
10618	    // and let it happen
10619	    if (!cellRefs.has(d)) continue;
10620	    const refs = cellRefs.get(d);
10621	    for (const ref of refs) if (!embed.has(ref)) todo.push(ref);
10622	  }
10623	  return {
10624	    cells: module.cells.filter(
10625	      cell => names(cell).filter(name => embed.has(name)).length
10626	    )
10627	  };
10628	}function ESMImports(moduleObject, resolveImportPath) {
10629	  const importMap = new Map();
10630	  let importSrc = "";
10631	  let j = 0;
10632
10633	  for (const { body } of moduleObject.cells) {
10634	    if (body.type !== "ImportDeclaration" || importMap.has(body.source.value))
10635	      continue;
10636
10637	    const defineName = `define${++j}`;
10638	    // TODO get cell specififiers here and pass in as 2nd param to resolveImportPath
10639	    // need to use same logic as tree-shake name()s
10640	    const specifiers = body.specifiers.map(d => {
10641	      const prefix = d.view ? "viewof " : d.mutable ? "mutable " : "";
10642	      return `${prefix}${d.imported.name}`;
10643	    });
10644	    const fromPath = resolveImportPath(body.source.value, specifiers);
10645	    importMap.set(body.source.value, { defineName, fromPath });
10646	    importSrc += `import ${defineName} from "${fromPath}";\n`;
10647	  }
10648
10649	  if (importSrc.length) importSrc += "\n";
10650	  return { importSrc, importMap };
10651	}
10652
10653	// by default, file attachments get resolved like:
10654	//   [ ["a", "https://example.com/files/a"] ]
10655	// but sometimes, you'll want to write JS code when resolving
10656	// instead of being limiting by strings. The third param
10657	// enables that, allowing for resolving like:
10658	//   [ ["a", new URL("./files/a", import.meta.url)] ]
10659	function ESMAttachments(
10660	  moduleObject,
10661	  resolveFileAttachments,
10662	  UNSAFE_allowJavascriptFileAttachments = false
10663	) {
10664	  let mapValue;
10665	  if (UNSAFE_allowJavascriptFileAttachments) {
10666	    const attachmentMapEntries = [];
10667	    for (const cell of moduleObject.cells) {
10668	      if (cell.fileAttachments.size === 0) continue;
10669	      for (const file of cell.fileAttachments.keys())
10670	        attachmentMapEntries.push([file, resolveFileAttachments(file)]);
10671	    }
10672	    if (attachmentMapEntries.length)
10673	      mapValue = `[${attachmentMapEntries
10674	        .map(([key, value]) => `[${JSON.stringify(key)}, ${value}]`)
10675	        .join(",")}]`;
10676	  } else {
10677	    const attachmentMapEntries = [];
10678	    // loop over cells with fileAttachments
10679	    for (const cell of moduleObject.cells) {
10680	      if (cell.fileAttachments.size === 0) continue;
10681	      // add filenames and resolved URLs to array
10682	      for (const file of cell.fileAttachments.keys())
10683	        attachmentMapEntries.push([file, resolveFileAttachments(file)]);
10684	    }
10685	    if (attachmentMapEntries.length)
10686	      mapValue = JSON.stringify(attachmentMapEntries);
10687	  }
10688
10689	  if (!mapValue) return "";
10690	  return `  const fileAttachments = new Map(${mapValue});
10691	  main.builtin("FileAttachment", runtime.fileAttachments(name => fileAttachments.get(name)));`;
10692	}
10693
10694	function ESMVariables(moduleObject, importMap, params) {
10695	  const {
10696	    defineImportMarkdown,
10697	    observeViewofValues,
10698	    observeMutableValues
10699	  } = params;
10700
10701	  let childJ = 0;
10702	  return moduleObject.cells
10703	    .map(cell => {
10704	      let src = "";
10705
10706	      if (cell.body.type === "ImportDeclaration") {
10707	        const {
10708	          specifiers,
10709	          hasInjections,
10710	          injections,
10711	          importString
10712	        } = setupImportCell(cell);
10713
10714	        if (defineImportMarkdown)
10715	          src +=
10716	            `  main.variable(observer()).define(
10717	    null,
10718	    ["md"],
10719	    md => md\`~~~javascript
10720	${importString}
10721	~~~\`
10722	  );` + "\n";
10723
10724	        // name imported notebook define functions
10725	        const childName = `child${++childJ}`;
10726	        src += `  const ${childName} = runtime.module(${
10727	          importMap.get(cell.body.source.value).defineName
10728	        })${
10729	          hasInjections ? `.derive(${JSON.stringify(injections)}, main)` : ""
10730	        };
10731	${specifiers
10732	  .map(
10733	    specifier =>
10734	      `  main.import("${specifier.name}", "${specifier.alias}", ${childName});`
10735	  )
10736	  .join("\n")}`;
10737	      } else {
10738	        const {
10739	          cellName,
10740	          references,
10741	          bodyText,
10742	          cellReferences
10743	        } = setupRegularCell(cell);
10744
10745	        const cellNameString = cellName ? `"${cellName}"` : "";
10746	        const referenceString = references.join(",");
10747	        let code = "";
10748	        if (cell.body.type !== "BlockStatement")
10749	          code = `{return(
10750	${bodyText}
10751	)}`;
10752	        else code = "\n" + bodyText + "\n";
10753	        const cellReferencesString = cellReferences.length
10754	          ? JSON.stringify(cellReferences) + ", "
10755	          : "";
10756	        let cellFunction = "";
10757	        if (cell.generator && cell.async)
10758	          cellFunction = `async function*(${referenceString})${code}`;
10759	        else if (cell.async)
10760	          cellFunction = `async function(${referenceString})${code}`;
10761	        else if (cell.generator)
10762	          cellFunction = `function*(${referenceString})${code}`;
10763	        else cellFunction = `function(${referenceString})${code}`;
10764
10765	        if (cell.id && cell.id.type === "ViewExpression") {
10766	          const reference = `"viewof ${cellName}"`;
10767	          src += `  main.variable(observer(${reference})).define(${reference}, ${cellReferencesString}${cellFunction});
10768	  main.variable(${
10769	    observeViewofValues ? `observer("${cellName}")` : `null`
10770	  }).define("${cellName}", ["Generators", ${reference}], (G, _) => G.input(_));`;
10771	        } else if (cell.id && cell.id.type === "MutableExpression") {
10772	          const initialName = `"initial ${cellName}"`;
10773	          const mutableName = `"mutable ${cellName}"`;
10774	          src += `  main.define(${initialName}, ${cellReferencesString}${cellFunction});
10775	  main.variable(observer(${mutableName})).define(${mutableName}, ["Mutable", ${initialName}], (M, _) => new M(_));
10776	  main.variable(${
10777	    observeMutableValues ? `observer("${cellName}")` : `null`
10778	  }).define("${cellName}", [${mutableName}], _ => _.generator);`;
10779	        } else {
10780	          src += `  main.variable(observer(${cellNameString})).define(${
10781	            cellName ? cellNameString + ", " : ""
10782	          }${cellReferencesString}${cellFunction});`;
10783	        }
10784	      }
10785	      return src;
10786	    })
10787	    .join("\n");
10788	}
10789	function createESModule(moduleObject, params = {}) {
10790	  const {
10791	    resolveImportPath,
10792	    resolveFileAttachments,
10793	    defineImportMarkdown,
10794	    observeViewofValues,
10795	    observeMutableValues,
10796	    UNSAFE_allowJavascriptFileAttachments
10797	  } = params;
10798	  const { importSrc, importMap } = ESMImports(moduleObject, resolveImportPath);
10799	  return `${importSrc}export default function define(runtime, observer) {
10800	  const main = runtime.module();
10801	${ESMAttachments(
10802	  moduleObject,
10803	  resolveFileAttachments,
10804	  UNSAFE_allowJavascriptFileAttachments
10805	)}
10806	${ESMVariables(moduleObject, importMap, {
10807	  defineImportMarkdown,
10808	  observeViewofValues,
10809	  observeMutableValues
10810	}) || ""}
10811	  return main;
10812	}`;
10813	}
10814
10815	function defaultResolveImportPath(path) {
10816	  const source = extractPath(path);
10817	  return `https://api.observablehq.com/${source}.js?v=3`;
10818	}
10819
10820	function defaultResolveFileAttachments(name) {
10821	  return name;
10822	}
10823	class Compiler {
10824	  constructor(params = {}) {
10825	    const {
10826	      resolveFileAttachments = defaultResolveFileAttachments,
10827	      resolveImportPath = defaultResolveImportPath,
10828	      defineImportMarkdown = true,
10829	      observeViewofValues = true,
10830	      observeMutableValues = true,
10831	      UNSAFE_allowJavascriptFileAttachments = false
10832	    } = params;
10833	    this.resolveFileAttachments = resolveFileAttachments;
10834	    this.resolveImportPath = resolveImportPath;
10835	    this.defineImportMarkdown = defineImportMarkdown;
10836	    this.observeViewofValues = observeViewofValues;
10837	    this.observeMutableValues = observeMutableValues;
10838	    this.UNSAFE_allowJavascriptFileAttachments = UNSAFE_allowJavascriptFileAttachments;
10839	  }
10840	  module(input, params = {}) {
10841	    let m1 = typeof input === "string" ? parseModule(input) : input;
10842
10843	    if (params.treeShake) m1 = treeShakeModule(m1, params.treeShake);
10844
10845	    return createESModule(m1, {
10846	      resolveImportPath: this.resolveImportPath,
10847	      resolveFileAttachments: this.resolveFileAttachments,
10848	      defineImportMarkdown: this.defineImportMarkdown,
10849	      observeViewofValues: this.observeViewofValues,
10850	      observeMutableValues: this.observeMutableValues,
10851	      UNSAFE_allowJavascriptFileAttachments: this
10852	        .UNSAFE_allowJavascriptFileAttachments
10853	    });
10854	  }
10855	  notebook(obj) {
10856	    const cells = obj.nodes.map(({ value }) => {
10857	      const cell = parseCell(value);
10858	      cell.input = value;
10859	      return cell;
10860	    });
10861	    return createESModule(
10862	      { cells },
10863	      {
10864	        resolveImportPath: this.resolveImportPath,
10865	        resolveFileAttachments: this.resolveFileAttachments,
10866	        defineImportMarkdown: this.defineImportMarkdown,
10867	        observeViewofValues: this.observeViewofValues,
10868	        observeMutableValues: this.observeMutableValues
10869	      }
10870	    );
10871	  }
10872	}const AsyncFunction = Object.getPrototypeOf(async function() {}).constructor;
10873	const GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor;
10874	const AsyncGeneratorFunction = Object.getPrototypeOf(async function*() {})
10875	  .constructor;
10876
10877	function createRegularCellDefinition(cell) {
10878	  const { cellName, references, bodyText, cellReferences } = setupRegularCell(
10879	    cell
10880	  );
10881
10882	  let code;
10883	  if (cell.body.type !== "BlockStatement") {
10884	    if (cell.async)
10885	      code = `return (async function(){ return (${bodyText});})()`;
10886	    else code = `return (function(){ return (${bodyText});})()`;
10887	  } else code = bodyText;
10888
10889	  let f;
10890	  if (cell.generator && cell.async)
10891	    f = new AsyncGeneratorFunction(...references, code);
10892	  else if (cell.async) f = new AsyncFunction(...references, code);
10893	  else if (cell.generator) f = new GeneratorFunction(...references, code);
10894	  else f = new Function(...references, code);
10895	  return {
10896	    cellName,
10897	    cellFunction: f,
10898	    cellReferences
10899	  };
10900	}
10901
10902	function defaultResolveImportPath$1(path) {
10903	  const source = extractPath(path);
10904	  return import(`https://api.observablehq.com/${source}.js?v=3`).then(
10905	    m => m.default
10906	  );
10907	}
10908
10909	function defaultResolveFileAttachments$1(name) {
10910	  return name;
10911	}
10912
10913	class Interpreter {
10914	  constructor(params = {}) {
10915	    const {
10916	      module = null,
10917	      observer = null,
10918	      resolveImportPath = defaultResolveImportPath$1,
10919	      resolveFileAttachments = defaultResolveFileAttachments$1,
10920	      defineImportMarkdown = true,
10921	      observeViewofValues = true,
10922	      observeMutableValues = true
10923	    } = params;
10924
10925	    // can't be this.module bc of async module().
10926	    // so make defaultObserver follow same convention.
10927	    this.defaultModule = module;
10928	    this.defaultObserver = observer;
10929
10930	    this.resolveImportPath = resolveImportPath;
10931	    this.resolveFileAttachments = resolveFileAttachments;
10932	    this.defineImportMarkdown = defineImportMarkdown;
10933	    this.observeViewofValues = observeViewofValues;
10934	    this.observeMutableValues = observeMutableValues;
10935	  }
10936
10937	  async module(input, module, observer) {
10938	    module = module || this.defaultModule;
10939	    observer = observer || this.defaultObserver;
10940
10941	    if (!module) throw Error("No module provided.");
10942	    if (!observer) throw Error("No observer provided.");
10943
10944	    const parsedModule = parseModule(input);
10945	    const cellPromises = [];
10946	    for (const cell of parsedModule.cells) {
10947	      cell.input = input;
10948	      cellPromises.push(this.cell(cell, module, observer));
10949	    }
10950	    return Promise.all(cellPromises);
10951	  }
10952
10953	  async cell(input, module, observer) {
10954	    module = module || this.defaultModule;
10955	    observer = observer || this.defaultObserver;
10956
10957	    if (!module) throw Error("No module provided.");
10958	    if (!observer) throw Error("No observer provided.");
10959
10960	    let cell;
10961	    if (typeof input === "string") {
10962	      cell = parseCell(input);
10963	      cell.input = input;
10964	    } else {
10965	      cell = input;
10966	    }
10967
10968	    if (cell.body.type === "ImportDeclaration") {
10969	      const path = cell.body.source.value;
10970	      const specs = cell.body.specifiers.map(d => {
10971	        const prefix = d.view ? "viewof " : d.mutable ? "mutable " : "";
10972	        return `${prefix}${d.imported.name}`;
10973	      });
10974	      const fromModule = await this.resolveImportPath(path, specs);
10975	      let mdVariable, vars;
10976
10977	      const {
10978	        specifiers,
10979	        hasInjections,
10980	        injections,
10981	        importString
10982	      } = setupImportCell(cell);
10983
10984	      const other = module._runtime.module(fromModule);
10985
10986	      if (this.defineImportMarkdown)
10987	        mdVariable = module.variable(observer()).define(
10988	          null,
10989	          ["md"],
10990	          md => md`~~~javascript
10991	  ${importString}
10992	  ~~~`
10993	        );
10994	      if (hasInjections) {
10995	        const child = other.derive(injections, module);
10996	        vars = specifiers.map(({ name, alias }) =>
10997	          module.import(name, alias, child)
10998	        );
10999	      } else {
11000	        vars = specifiers.map(({ name, alias }) =>
11001	          module.import(name, alias, other)
11002	        );
11003	      }
11004	      return mdVariable ? [mdVariable, ...vars] : vars;
11005	    } else {
11006	      const {
11007	        cellName,
11008	        cellFunction,
11009	        cellReferences
11010	      } = createRegularCellDefinition(cell);
11011	      if (cell.id && cell.id.type === "ViewExpression") {
11012	        const reference = `viewof ${cellName}`;
11013	        return [
11014	          module
11015	            .variable(observer(reference))
11016	            .define(reference, cellReferences, cellFunction.bind(this)),
11017	          module
11018	            .variable(this.observeViewofValues ? observer(cellName) : null)
11019	            .define(cellName, ["Generators", reference], (G, _) => G.input(_))
11020	        ];
11021	      } else if (cell.id && cell.id.type === "MutableExpression") {
11022	        const initialName = `initial ${cellName}`;
11023	        const mutableName = `mutable ${cellName}`;
11024	        return [
11025	          module
11026	            .variable(null)
11027	            .define(initialName, cellReferences, cellFunction),
11028	          module
11029	            .variable(observer(mutableName))
11030	            .define(mutableName, ["Mutable", initialName], (M, _) => new M(_)),
11031	          module
11032	            .variable(this.observeMutableValues ? observer(cellName) : null)
11033	            .define(cellName, [mutableName], _ => _.generator)
11034	        ];
11035	      } else {
11036	        return [
11037	          module
11038	            .variable(observer(cellName))
11039	            .define(cellName, cellReferences, cellFunction.bind(this))
11040	        ];
11041	      }
11042	    }
11043	  }
11044	}exports.Compiler=Compiler;exports.Interpreter=Interpreter;exports.parser=index;exports.treeShakeModule=treeShakeModule;Object.defineProperty(exports,'__esModule',{value:true});})));
11045} (dist, dist.exports));
11046
11047// This file was generated. Do not modify manually!
11048var 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, 
11048193, 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];
11049
11050// This file was generated. Do not modify manually!
11051var 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];
11052
11053// This file was generated. Do not modify manually!
11054var 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\u10
1105471-\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";
11055
11056// This file was generated. Do not modify manually!
11057var 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";
11058
11059// These are a run-length and offset encoded representation of the
11060
11061// Reserved word lists for various dialects of the language
11062
11063var reservedWords = {
11064  3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
11065  5: "class enum extends super const export import",
11066  6: "enum",
11067  strict: "implements interface let package private protected public static yield",
11068  strictBind: "eval arguments"
11069};
11070
11071// And the keywords
11072
11073var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
11074
11075var keywords$1 = {
11076  5: ecma5AndLessKeywords,
11077  "5module": ecma5AndLessKeywords + " export import",
11078  6: ecma5AndLessKeywords + " const class extends export import super"
11079};
11080
11081var keywordRelationalOperator = /^in(stanceof)?$/;
11082
11083// ## Character categories
11084
11085var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
11086var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
11087
11088// This has a complexity linear to the value of the code. The
11089// assumption is that looking up astral identifier characters is
11090// rare.
11091function isInAstralSet(code, set) {
11092  var pos = 0x10000;
11093  for (var i = 0; i < set.length; i += 2) {
11094    pos += set[i];
11095    if (pos > code) { return false }
11096    pos += set[i + 1];
11097    if (pos >= code) { return true }
11098  }
vendor: 7,711 bytes, lines 11098-11317
11098
11099}
11100
11101// Test whether a given character code starts an identifier.
11102
11103function isIdentifierStart(code, astral) {
11104  if (code < 65) { return code === 36 }
11105  if (code < 91) { return true }
11106  if (code < 97) { return code === 95 }
11107  if (code < 123) { return true }
11108  if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }
11109  if (astral === false) { return false }
11110  return isInAstralSet(code, astralIdentifierStartCodes)
11111}
11112
11113// Test whether a given character is part of an identifier.
11114
11115function isIdentifierChar(code, astral) {
11116  if (code < 48) { return code === 36 }
11117  if (code < 58) { return true }
11118  if (code < 65) { return false }
11119  if (code < 91) { return true }
11120  if (code < 97) { return code === 95 }
11121  if (code < 123) { return true }
11122  if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }
11123  if (astral === false) { return false }
11124  return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
11125}
11126
11127// ## Token types
11128
11129// The assignment of fine-grained, information-carrying type objects
11130// allows the tokenizer to store the information it has about a
11131// token in a way that is very cheap for the parser to look up.
11132
11133// All token type variables start with an underscore, to make them
11134// easy to recognize.
11135
11136// The `beforeExpr` property is used to disambiguate between regular
11137// expressions and divisions. It is set on all token types that can
11138// be followed by an expression (thus, a slash after them would be a
11139// regular expression).
11140//
11141// The `startsExpr` property is used to check if the token ends a
11142// `yield` expression. It is set on all token types that either can
11143// directly start an expression (like a quotation mark) or can
11144// continue an expression (like the body of a string).
11145//
11146// `isLoop` marks a keyword as starting a loop, which is important
11147// to know when parsing a label, in order to allow or disallow
11148// continue jumps to that label.
11149
11150var TokenType = function TokenType(label, conf) {
11151  if ( conf === void 0 ) conf = {};
11152
11153  this.label = label;
11154  this.keyword = conf.keyword;
11155  this.beforeExpr = !!conf.beforeExpr;
11156  this.startsExpr = !!conf.startsExpr;
11157  this.isLoop = !!conf.isLoop;
11158  this.isAssign = !!conf.isAssign;
11159  this.prefix = !!conf.prefix;
11160  this.postfix = !!conf.postfix;
11161  this.binop = conf.binop || null;
11162  this.updateContext = null;
11163};
11164
11165function binop(name, prec) {
11166  return new TokenType(name, {beforeExpr: true, binop: prec})
11167}
11168var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
11169
11170// Map keyword names to token types.
11171
11172var keywords = {};
11173
11174// Succinct definitions of keyword token types
11175function kw(name, options) {
11176  if ( options === void 0 ) options = {};
11177
11178  options.keyword = name;
11179  return keywords[name] = new TokenType(name, options)
11180}
11181
11182var types$1 = {
11183  num: new TokenType("num", startsExpr),
11184  regexp: new TokenType("regexp", startsExpr),
11185  string: new TokenType("string", startsExpr),
11186  name: new TokenType("name", startsExpr),
11187  privateId: new TokenType("privateId", startsExpr),
11188  eof: new TokenType("eof"),
11189
11190  // Punctuation token types.
11191  bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
11192  bracketR: new TokenType("]"),
11193  braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
11194  braceR: new TokenType("}"),
11195  parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
11196  parenR: new TokenType(")"),
11197  comma: new TokenType(",", beforeExpr),
11198  semi: new TokenType(";", beforeExpr),
11199  colon: new TokenType(":", beforeExpr),
11200  dot: new TokenType("."),
11201  question: new TokenType("?", beforeExpr),
11202  questionDot: new TokenType("?."),
11203  arrow: new TokenType("=>", beforeExpr),
11204  template: new TokenType("template"),
11205  invalidTemplate: new TokenType("invalidTemplate"),
11206  ellipsis: new TokenType("...", beforeExpr),
11207  backQuote: new TokenType("`", startsExpr),
11208  dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
11209
11210  // Operators. These carry several kinds of properties to help the
11211  // parser use them properly (the presence of these properties is
11212  // what categorizes them as operators).
11213  //
11214  // `binop`, when present, specifies that this operator is a binary
11215  // operator, and will refer to its precedence.
11216  //
11217  // `prefix` and `postfix` mark the operator as a prefix or postfix
11218  // unary operator.
11219  //
11220  // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
11221  // binary operators with a very low precedence, that should result
11222  // in AssignmentExpression nodes.
11223
11224  eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
11225  assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
11226  incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
11227  prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
11228  logicalOR: binop("||", 1),
11229  logicalAND: binop("&&", 2),
11230  bitwiseOR: binop("|", 3),
11231  bitwiseXOR: binop("^", 4),
11232  bitwiseAND: binop("&", 5),
11233  equality: binop("==/!=/===/!==", 6),
11234  relational: binop("</>/<=/>=", 7),
11235  bitShift: binop("<</>>/>>>", 8),
11236  plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
11237  modulo: binop("%", 10),
11238  star: binop("*", 10),
11239  slash: binop("/", 10),
11240  starstar: new TokenType("**", {beforeExpr: true}),
11241  coalesce: binop("??", 1),
11242
11243  // Keyword token types.
11244  _break: kw("break"),
11245  _case: kw("case", beforeExpr),
11246  _catch: kw("catch"),
11247  _continue: kw("continue"),
11248  _debugger: kw("debugger"),
11249  _default: kw("default", beforeExpr),
11250  _do: kw("do", {isLoop: true, beforeExpr: true}),
11251  _else: kw("else", beforeExpr),
11252  _finally: kw("finally"),
11253  _for: kw("for", {isLoop: true}),
11254  _function: kw("function", startsExpr),
11255  _if: kw("if"),
11256  _return: kw("return", beforeExpr),
11257  _switch: kw("switch"),
11258  _throw: kw("throw", beforeExpr),
11259  _try: kw("try"),
11260  _var: kw("var"),
11261  _const: kw("const"),
11262  _while: kw("while", {isLoop: true}),
11263  _with: kw("with"),
11264  _new: kw("new", {beforeExpr: true, startsExpr: true}),
11265  _this: kw("this", startsExpr),
11266  _super: kw("super", startsExpr),
11267  _class: kw("class", startsExpr),
11268  _extends: kw("extends", beforeExpr),
11269  _export: kw("export"),
11270  _import: kw("import", startsExpr),
11271  _null: kw("null", startsExpr),
11272  _true: kw("true", startsExpr),
11273  _false: kw("false", startsExpr),
11274  _in: kw("in", {beforeExpr: true, binop: 7}),
11275  _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
11276  _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
11277  _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
11278  _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
11279};
11280
11281// Matches a whole line break (where CRLF is considered a single
11282// line break). Used to count lines.
11283
11284var lineBreak = /\r\n?|\n|\u2028|\u2029/;
11285var lineBreakG = new RegExp(lineBreak.source, "g");
11286
11287function isNewLine(code) {
11288  return code === 10 || code === 13 || code === 0x2028 || code === 0x2029
11289}
11290
11291function nextLineBreak(code, from, end) {
11292  if ( end === void 0 ) end = code.length;
11293
11294  for (var i = from; i < end; i++) {
11295    var next = code.charCodeAt(i);
11296    if (isNewLine(next))
11297      { return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1 }
11298  }
11299  return -1
11300}
11301
11302var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
11303
11304var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
11305
11306var ref = Object.prototype;
11307var hasOwnProperty = ref.hasOwnProperty;
11308var toString = ref.toString;
11309
11310var hasOwn = Object.hasOwn || (function (obj, propName) { return (
11311  hasOwnProperty.call(obj, propName)
11312); });
11313
11314var isArray = Array.isArray || (function (obj) { return (
11315  toString.call(obj) === "[object Array]"
11316); });
11317
vendor: 14,099 bytes, lines 11318-11662
11318function wordsRegexp(words) {
11319  return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
11320}
11321
11322function codePointToString(code) {
11323  // UTF-16 Decoding
11324  if (code <= 0xFFFF) { return String.fromCharCode(code) }
11325  code -= 0x10000;
11326  return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
11327}
11328
11329var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
11330
11331// These are used when `options.locations` is on, for the
11332// `startLoc` and `endLoc` properties.
11333
11334var Position = function Position(line, col) {
11335  this.line = line;
11336  this.column = col;
11337};
11338
11339Position.prototype.offset = function offset (n) {
11340  return new Position(this.line, this.column + n)
11341};
11342
11343var SourceLocation = function SourceLocation(p, start, end) {
11344  this.start = start;
11345  this.end = end;
11346  if (p.sourceFile !== null) { this.source = p.sourceFile; }
11347};
11348
11349// The `getLineInfo` function is mostly useful when the
11350// `locations` option is off (for performance reasons) and you
11351// want to find the line/column position for a given character
11352// offset. `input` should be the code string that the offset refers
11353// into.
11354
11355function getLineInfo(input, offset) {
11356  for (var line = 1, cur = 0;;) {
11357    var nextBreak = nextLineBreak(input, cur, offset);
11358    if (nextBreak < 0) { return new Position(line, offset - cur) }
11359    ++line;
11360    cur = nextBreak;
11361  }
11362}
11363
11364// A second argument must be given to configure the parser process.
11365// These options are recognized (only `ecmaVersion` is required):
11366
11367var defaultOptions = {
11368  // `ecmaVersion` indicates the ECMAScript version to parse. Must be
11369  // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
11370  // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
11371  // (the latest version the library supports). This influences
11372  // support for strict mode, the set of reserved words, and support
11373  // for new syntax features.
11374  ecmaVersion: null,
11375  // `sourceType` indicates the mode the code should be parsed in.
11376  // Can be either `"script"` or `"module"`. This influences global
11377  // strict mode and parsing of `import` and `export` declarations.
11378  sourceType: "script",
11379  // `onInsertedSemicolon` can be a callback that will be called
11380  // when a semicolon is automatically inserted. It will be passed
11381  // the position of the comma as an offset, and if `locations` is
11382  // enabled, it is given the location as a `{line, column}` object
11383  // as second argument.
11384  onInsertedSemicolon: null,
11385  // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
11386  // trailing commas.
11387  onTrailingComma: null,
11388  // By default, reserved words are only enforced if ecmaVersion >= 5.
11389  // Set `allowReserved` to a boolean value to explicitly turn this on
11390  // an off. When this option has the value "never", reserved words
11391  // and keywords can also not be used as property names.
11392  allowReserved: null,
11393  // When enabled, a return at the top level is not considered an
11394  // error.
11395  allowReturnOutsideFunction: false,
11396  // When enabled, import/export statements are not constrained to
11397  // appearing at the top of the program, and an import.meta expression
11398  // in a script isn't considered an error.
11399  allowImportExportEverywhere: false,
11400  // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.
11401  // When enabled, await identifiers are allowed to appear at the top-level scope,
11402  // but they are still not allowed in non-async functions.
11403  allowAwaitOutsideFunction: null,
11404  // When enabled, super identifiers are not constrained to
11405  // appearing in methods and do not raise an error when they appear elsewhere.
11406  allowSuperOutsideMethod: null,
11407  // When enabled, hashbang directive in the beginning of file is
11408  // allowed and treated as a line comment. Enabled by default when
11409  // `ecmaVersion` >= 2023.
11410  allowHashBang: false,
11411  // When `locations` is on, `loc` properties holding objects with
11412  // `start` and `end` properties in `{line, column}` form (with
11413  // line being 1-based and column 0-based) will be attached to the
11414  // nodes.
11415  locations: false,
11416  // A function can be passed as `onToken` option, which will
11417  // cause Acorn to call that function with object in the same
11418  // format as tokens returned from `tokenizer().getToken()`. Note
11419  // that you are not allowed to call the parser from the
11420  // callback—that will corrupt its internal state.
11421  onToken: null,
11422  // A function can be passed as `onComment` option, which will
11423  // cause Acorn to call that function with `(block, text, start,
11424  // end)` parameters whenever a comment is skipped. `block` is a
11425  // boolean indicating whether this is a block (`/* */`) comment,
11426  // `text` is the content of the comment, and `start` and `end` are
11427  // character offsets that denote the start and end of the comment.
11428  // When the `locations` option is on, two more parameters are
11429  // passed, the full `{line, column}` locations of the start and
11430  // end of the comments. Note that you are not allowed to call the
11431  // parser from the callback—that will corrupt its internal state.
11432  onComment: null,
11433  // Nodes have their start and end characters offsets recorded in
11434  // `start` and `end` properties (directly on the node, rather than
11435  // the `loc` object, which holds line/column data. To also add a
11436  // [semi-standardized][range] `range` property holding a `[start,
11437  // end]` array with the same numbers, set the `ranges` option to
11438  // `true`.
11439  //
11440  // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
11441  ranges: false,
11442  // It is possible to parse multiple files into a single AST by
11443  // passing the tree produced by parsing the first file as
11444  // `program` option in subsequent parses. This will add the
11445  // toplevel forms of the parsed file to the `Program` (top) node
11446  // of an existing parse tree.
11447  program: null,
11448  // When `locations` is on, you can pass this to record the source
11449  // file in every node's `loc` object.
11450  sourceFile: null,
11451  // This value, if given, is stored in every node, whether
11452  // `locations` is on or off.
11453  directSourceFile: null,
11454  // When enabled, parenthesized expressions are represented by
11455  // (non-standard) ParenthesizedExpression nodes
11456  preserveParens: false
11457};
11458
11459// Interpret and default an options object
11460
11461var warnedAboutEcmaVersion = false;
11462
11463function getOptions(opts) {
11464  var options = {};
11465
11466  for (var opt in defaultOptions)
11467    { options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; }
11468
11469  if (options.ecmaVersion === "latest") {
11470    options.ecmaVersion = 1e8;
11471  } else if (options.ecmaVersion == null) {
11472    if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
11473      warnedAboutEcmaVersion = true;
11474      console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.");
11475    }
11476    options.ecmaVersion = 11;
11477  } else if (options.ecmaVersion >= 2015) {
11478    options.ecmaVersion -= 2009;
11479  }
11480
11481  if (options.allowReserved == null)
11482    { options.allowReserved = options.ecmaVersion < 5; }
11483
11484  if (opts.allowHashBang == null)
11485    { options.allowHashBang = options.ecmaVersion >= 14; }
11486
11487  if (isArray(options.onToken)) {
11488    var tokens = options.onToken;
11489    options.onToken = function (token) { return tokens.push(token); };
11490  }
11491  if (isArray(options.onComment))
11492    { options.onComment = pushComment(options, options.onComment); }
11493
11494  return options
11495}
11496
11497function pushComment(options, array) {
11498  return function(block, text, start, end, startLoc, endLoc) {
11499    var comment = {
11500      type: block ? "Block" : "Line",
11501      value: text,
11502      start: start,
11503      end: end
11504    };
11505    if (options.locations)
11506      { comment.loc = new SourceLocation(this, startLoc, endLoc); }
11507    if (options.ranges)
11508      { comment.range = [start, end]; }
11509    array.push(comment);
11510  }
11511}
11512
11513// Each scope gets a bitset that may contain these flags
11514var
11515    SCOPE_TOP = 1,
11516    SCOPE_FUNCTION$1 = 2,
11517    SCOPE_ASYNC$1 = 4,
11518    SCOPE_GENERATOR$1 = 8,
11519    SCOPE_ARROW = 16,
11520    SCOPE_SIMPLE_CATCH = 32,
11521    SCOPE_SUPER = 64,
11522    SCOPE_DIRECT_SUPER = 128,
11523    SCOPE_CLASS_STATIC_BLOCK = 256,
11524    SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION$1 | SCOPE_CLASS_STATIC_BLOCK;
11525
11526function functionFlags(async, generator) {
11527  return SCOPE_FUNCTION$1 | (async ? SCOPE_ASYNC$1 : 0) | (generator ? SCOPE_GENERATOR$1 : 0)
11528}
11529
11530// Used in checkLVal* and declareName to determine the type of a binding
11531var
11532    BIND_NONE = 0, // Not a binding
11533    BIND_VAR = 1, // Var-style binding
11534    BIND_LEXICAL = 2, // Let- or const-style binding
11535    BIND_FUNCTION = 3, // Function declaration
11536    BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding
11537    BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
11538
11539var Parser = function Parser(options, input, startPos) {
11540  this.options = options = getOptions(options);
11541  this.sourceFile = options.sourceFile;
11542  this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
11543  var reserved = "";
11544  if (options.allowReserved !== true) {
11545    reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
11546    if (options.sourceType === "module") { reserved += " await"; }
11547  }
11548  this.reservedWords = wordsRegexp(reserved);
11549  var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
11550  this.reservedWordsStrict = wordsRegexp(reservedStrict);
11551  this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
11552  this.input = String(input);
11553
11554  // Used to signal to callers of `readWord1` whether the word
11555  // contained any escape sequences. This is needed because words with
11556  // escape sequences must not be interpreted as keywords.
11557  this.containsEsc = false;
11558
11559  // Set up token state
11560
11561  // The current position of the tokenizer in the input.
11562  if (startPos) {
11563    this.pos = startPos;
11564    this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
11565    this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
11566  } else {
11567    this.pos = this.lineStart = 0;
11568    this.curLine = 1;
11569  }
11570
11571  // Properties of the current token:
11572  // Its type
11573  this.type = types$1.eof;
11574  // For tokens that include more information than their type, the value
11575  this.value = null;
11576  // Its start and end offset
11577  this.start = this.end = this.pos;
11578  // And, if locations are used, the {line, column} object
11579  // corresponding to those offsets
11580  this.startLoc = this.endLoc = this.curPosition();
11581
11582  // Position information for the previous token
11583  this.lastTokEndLoc = this.lastTokStartLoc = null;
11584  this.lastTokStart = this.lastTokEnd = this.pos;
11585
11586  // The context stack is used to superficially track syntactic
11587  // context to predict whether a regular expression is allowed in a
11588  // given position.
11589  this.context = this.initialContext();
11590  this.exprAllowed = true;
11591
11592  // Figure out if it's a module code.
11593  this.inModule = options.sourceType === "module";
11594  this.strict = this.inModule || this.strictDirective(this.pos);
11595
11596  // Used to signify the start of a potential arrow function
11597  this.potentialArrowAt = -1;
11598  this.potentialArrowInForAwait = false;
11599
11600  // Positions to delayed-check that yield/await does not exist in default parameters.
11601  this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
11602  // Labels in scope.
11603  this.labels = [];
11604  // Thus-far undefined exports.
11605  this.undefinedExports = Object.create(null);
11606
11607  // If enabled, skip leading hashbang line.
11608  if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
11609    { this.skipLineComment(2); }
11610
11611  // Scope tracking for duplicate variable names (see scope.js)
11612  this.scopeStack = [];
11613  this.enterScope(SCOPE_TOP);
11614
11615  // For RegExp validation
11616  this.regexpState = null;
11617
11618  // The stack of private names.
11619  // Each element has two properties: 'declared' and 'used'.
11620  // When it exited from the outermost class definition, all used private names must be declared.
11621  this.privateNameStack = [];
11622};
11623
11624var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };
11625
11626Parser.prototype.parse = function parse () {
11627  var node = this.options.program || this.startNode();
11628  this.nextToken();
11629  return this.parseTopLevel(node)
11630};
11631
11632prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION$1) > 0 };
11633
11634prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR$1) > 0 && !this.currentVarScope().inClassFieldInit };
11635
11636prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC$1) > 0 && !this.currentVarScope().inClassFieldInit };
11637
11638prototypeAccessors.canAwait.get = function () {
11639  for (var i = this.scopeStack.length - 1; i >= 0; i--) {
11640    var scope = this.scopeStack[i];
11641    if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false }
11642    if (scope.flags & SCOPE_FUNCTION$1) { return (scope.flags & SCOPE_ASYNC$1) > 0 }
11643  }
11644  return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
11645};
11646
11647prototypeAccessors.allowSuper.get = function () {
11648  var ref = this.currentThisScope();
11649    var flags = ref.flags;
11650    var inClassFieldInit = ref.inClassFieldInit;
11651  return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
11652};
11653
11654prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
11655
11656prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
11657
11658prototypeAccessors.allowNewDotTarget.get = function () {
11659  var ref = this.currentThisScope();
11660    var flags = ref.flags;
11661    var inClassFieldInit = ref.inClassFieldInit;
11662  return (flags & (SCOPE_FUNCTION$1
vendor: 7,441 bytes, lines 11662-11884
11662 | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
11663};
11664
11665prototypeAccessors.inClassStaticBlock.get = function () {
11666  return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
11667};
11668
11669Parser.extend = function extend () {
11670    var plugins = [], len = arguments.length;
11671    while ( len-- ) plugins[ len ] = arguments[ len ];
11672
11673  var cls = this;
11674  for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }
11675  return cls
11676};
11677
11678Parser.parse = function parse (input, options) {
11679  return new this(options, input).parse()
11680};
11681
11682Parser.parseExpressionAt = function parseExpressionAt (input, pos, options) {
11683  var parser = new this(options, input, pos);
11684  parser.nextToken();
11685  return parser.parseExpression()
11686};
11687
11688Parser.tokenizer = function tokenizer (input, options) {
11689  return new this(options, input)
11690};
11691
11692Object.defineProperties( Parser.prototype, prototypeAccessors );
11693
11694var pp$9 = Parser.prototype;
11695
11696// ## Parser utilities
11697
11698var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
11699pp$9.strictDirective = function(start) {
11700  if (this.options.ecmaVersion < 5) { return false }
11701  for (;;) {
11702    // Try to find string literal.
11703    skipWhiteSpace.lastIndex = start;
11704    start += skipWhiteSpace.exec(this.input)[0].length;
11705    var match = literal.exec(this.input.slice(start));
11706    if (!match) { return false }
11707    if ((match[1] || match[2]) === "use strict") {
11708      skipWhiteSpace.lastIndex = start + match[0].length;
11709      var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
11710      var next = this.input.charAt(end);
11711      return next === ";" || next === "}" ||
11712        (lineBreak.test(spaceAfter[0]) &&
11713         !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="))
11714    }
11715    start += match[0].length;
11716
11717    // Skip semicolon, if any.
11718    skipWhiteSpace.lastIndex = start;
11719    start += skipWhiteSpace.exec(this.input)[0].length;
11720    if (this.input[start] === ";")
11721      { start++; }
11722  }
11723};
11724
11725// Predicate that tests whether the next token is of the given
11726// type, and if yes, consumes it as a side effect.
11727
11728pp$9.eat = function(type) {
11729  if (this.type === type) {
11730    this.next();
11731    return true
11732  } else {
11733    return false
11734  }
11735};
11736
11737// Tests whether parsed token is a contextual keyword.
11738
11739pp$9.isContextual = function(name) {
11740  return this.type === types$1.name && this.value === name && !this.containsEsc
11741};
11742
11743// Consumes contextual keyword if possible.
11744
11745pp$9.eatContextual = function(name) {
11746  if (!this.isContextual(name)) { return false }
11747  this.next();
11748  return true
11749};
11750
11751// Asserts that following token is given contextual keyword.
11752
11753pp$9.expectContextual = function(name) {
11754  if (!this.eatContextual(name)) { this.unexpected(); }
11755};
11756
11757// Test whether a semicolon can be inserted at the current position.
11758
11759pp$9.canInsertSemicolon = function() {
11760  return this.type === types$1.eof ||
11761    this.type === types$1.braceR ||
11762    lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
11763};
11764
11765pp$9.insertSemicolon = function() {
11766  if (this.canInsertSemicolon()) {
11767    if (this.options.onInsertedSemicolon)
11768      { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
11769    return true
11770  }
11771};
11772
11773// Consume a semicolon, or, failing that, see if we are allowed to
11774// pretend that there is a semicolon at this position.
11775
11776pp$9.semicolon = function() {
11777  if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
11778};
11779
11780pp$9.afterTrailingComma = function(tokType, notNext) {
11781  if (this.type === tokType) {
11782    if (this.options.onTrailingComma)
11783      { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
11784    if (!notNext)
11785      { this.next(); }
11786    return true
11787  }
11788};
11789
11790// Expect a token of a given type. If found, consume it, otherwise,
11791// raise an unexpected token error.
11792
11793pp$9.expect = function(type) {
11794  this.eat(type) || this.unexpected();
11795};
11796
11797// Raise an unexpected token error.
11798
11799pp$9.unexpected = function(pos) {
11800  this.raise(pos != null ? pos : this.start, "Unexpected token");
11801};
11802
11803var DestructuringErrors = function DestructuringErrors() {
11804  this.shorthandAssign =
11805  this.trailingComma =
11806  this.parenthesizedAssign =
11807  this.parenthesizedBind =
11808  this.doubleProto =
11809    -1;
11810};
11811
11812pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
11813  if (!refDestructuringErrors) { return }
11814  if (refDestructuringErrors.trailingComma > -1)
11815    { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
11816  var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
11817  if (parens > -1) { this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern"); }
11818};
11819
11820pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
11821  if (!refDestructuringErrors) { return false }
11822  var shorthandAssign = refDestructuringErrors.shorthandAssign;
11823  var doubleProto = refDestructuringErrors.doubleProto;
11824  if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }
11825  if (shorthandAssign >= 0)
11826    { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); }
11827  if (doubleProto >= 0)
11828    { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
11829};
11830
11831pp$9.checkYieldAwaitInDefaultParams = function() {
11832  if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
11833    { this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
11834  if (this.awaitPos)
11835    { this.raise(this.awaitPos, "Await expression cannot be a default value"); }
11836};
11837
11838pp$9.isSimpleAssignTarget = function(expr) {
11839  if (expr.type === "ParenthesizedExpression")
11840    { return this.isSimpleAssignTarget(expr.expression) }
11841  return expr.type === "Identifier" || expr.type === "MemberExpression"
11842};
11843
11844var pp$8 = Parser.prototype;
11845
11846// ### Statement parsing
11847
11848// Parse a program. Initializes the parser, reads any number of
11849// statements, and wraps them in a Program node.  Optionally takes a
11850// `program` argument.  If present, the statements will be appended
11851// to its body instead of creating a new node.
11852
11853pp$8.parseTopLevel = function(node) {
11854  var exports = Object.create(null);
11855  if (!node.body) { node.body = []; }
11856  while (this.type !== types$1.eof) {
11857    var stmt = this.parseStatement(null, true, exports);
11858    node.body.push(stmt);
11859  }
11860  if (this.inModule)
11861    { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)
11862      {
11863        var name = list[i];
11864
11865        this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined"));
11866      } }
11867  this.adaptDirectivePrologue(node.body);
11868  this.next();
11869  node.sourceType = this.options.sourceType;
11870  return this.finishNode(node, "Program")
11871};
11872
11873var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
11874
11875pp$8.isLet = function(context) {
11876  if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
11877  skipWhiteSpace.lastIndex = this.pos;
11878  var skip = skipWhiteSpace.exec(this.input);
11879  var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
11880  // For ambiguous cases, determine if a LexicalDeclaration (or only a
11881  // Statement) is allowed here. If context is not empty then only a Statement
11882  // is allowed. However, `let [` is an explicit negative lookahead for
11883  // ExpressionStatement, so special-case it first.
11884  if (nextCh === 91 || nextCh === 92
11884 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '[', '/', astral
11885  if (context) { return false }
11886
11887  if (nextCh === 123) { return true } // '{'
vendor: 11,465 bytes, lines 11887-12177
11887
11888  if (isIdentifierStart(nextCh, true)) {
11889    var pos = next + 1;
11890    while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
11891    if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
11892    var ident = this.input.slice(next, pos);
11893    if (!keywordRelationalOperator.test(ident)) { return true }
11894  }
11895  return false
11896};
11897
11898// check 'async [no LineTerminator here] function'
11899// - 'async /*foo*/ function' is OK.
11900// - 'async /*\n*/ function' is invalid.
11901pp$8.isAsyncFunction = function() {
11902  if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
11903    { return false }
11904
11905  skipWhiteSpace.lastIndex = this.pos;
11906  var skip = skipWhiteSpace.exec(this.input);
11907  var next = this.pos + skip[0].length, after;
11908  return !lineBreak.test(this.input.slice(this.pos, next)) &&
11909    this.input.slice(next, next + 8) === "function" &&
11910    (next + 8 === this.input.length ||
11911     !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
11912};
11913
11914// Parse a single statement.
11915//
11916// If expecting a statement and finding a slash operator, parse a
11917// regular expression literal. This is to handle cases like
11918// `if (foo) /blah/.exec(foo)`, where looking at the previous token
11919// does not help.
11920
11921pp$8.parseStatement = function(context, topLevel, exports) {
11922  var starttype = this.type, node = this.startNode(), kind;
11923
11924  if (this.isLet(context)) {
11925    starttype = types$1._var;
11926    kind = "let";
11927  }
11928
11929  // Most types of statements are recognized by the keyword they
11930  // start with. Many are trivial to parse, some require a bit of
11931  // complexity.
11932
11933  switch (starttype) {
11934  case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
11935  case types$1._debugger: return this.parseDebuggerStatement(node)
11936  case types$1._do: return this.parseDoStatement(node)
11937  case types$1._for: return this.parseForStatement(node)
11938  case types$1._function:
11939    // Function as sole body of either an if statement or a labeled statement
11940    // works, but not when it is part of a labeled statement that is the sole
11941    // body of an if statement.
11942    if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
11943    return this.parseFunctionStatement(node, false, !context)
11944  case types$1._class:
11945    if (context) { this.unexpected(); }
11946    return this.parseClass(node, true)
11947  case types$1._if: return this.parseIfStatement(node)
11948  case types$1._return: return this.parseReturnStatement(node)
11949  case types$1._switch: return this.parseSwitchStatement(node)
11950  case types$1._throw: return this.parseThrowStatement(node)
11951  case types$1._try: return this.parseTryStatement(node)
11952  case types$1._const: case types$1._var:
11953    kind = kind || this.value;
11954    if (context && kind !== "var") { this.unexpected(); }
11955    return this.parseVarStatement(node, kind)
11956  case types$1._while: return this.parseWhileStatement(node)
11957  case types$1._with: return this.parseWithStatement(node)
11958  case types$1.braceL: return this.parseBlock(true, node)
11959  case types$1.semi: return this.parseEmptyStatement(node)
11960  case types$1._export:
11961  case types$1._import:
11962    if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
11963      skipWhiteSpace.lastIndex = this.pos;
11964      var skip = skipWhiteSpace.exec(this.input);
11965      var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
11966      if (nextCh === 40 || nextCh === 46) // '(' or '.'
11967        { return this.parseExpressionStatement(node, this.parseExpression()) }
11968    }
11969
11970    if (!this.options.allowImportExportEverywhere) {
11971      if (!topLevel)
11972        { this.raise(this.start, "'import' and 'export' may only appear at the top level"); }
11973      if (!this.inModule)
11974        { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
11975    }
11976    return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
11977
11978    // If the statement does not start with a statement keyword or a
11979    // brace, it's an ExpressionStatement or LabeledStatement. We
11980    // simply start parsing an expression, and afterwards, if the
11981    // next token is a colon and the expression was a simple
11982    // Identifier node, we switch to interpreting it as a label.
11983  default:
11984    if (this.isAsyncFunction()) {
11985      if (context) { this.unexpected(); }
11986      this.next();
11987      return this.parseFunctionStatement(node, true, !context)
11988    }
11989
11990    var maybeName = this.value, expr = this.parseExpression();
11991    if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
11992      { return this.parseLabeledStatement(node, maybeName, expr, context) }
11993    else { return this.parseExpressionStatement(node, expr) }
11994  }
11995};
11996
11997pp$8.parseBreakContinueStatement = function(node, keyword) {
11998  var isBreak = keyword === "break";
11999  this.next();
12000  if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
12001  else if (this.type !== types$1.name) { this.unexpected(); }
12002  else {
12003    node.label = this.parseIdent();
12004    this.semicolon();
12005  }
12006
12007  // Verify that there is an actual destination to break or
12008  // continue to.
12009  var i = 0;
12010  for (; i < this.labels.length; ++i) {
12011    var lab = this.labels[i];
12012    if (node.label == null || lab.name === node.label.name) {
12013      if (lab.kind != null && (isBreak || lab.kind === "loop")) { break }
12014      if (node.label && isBreak) { break }
12015    }
12016  }
12017  if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); }
12018  return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
12019};
12020
12021pp$8.parseDebuggerStatement = function(node) {
12022  this.next();
12023  this.semicolon();
12024  return this.finishNode(node, "DebuggerStatement")
12025};
12026
12027pp$8.parseDoStatement = function(node) {
12028  this.next();
12029  this.labels.push(loopLabel);
12030  node.body = this.parseStatement("do");
12031  this.labels.pop();
12032  this.expect(types$1._while);
12033  node.test = this.parseParenExpression();
12034  if (this.options.ecmaVersion >= 6)
12035    { this.eat(types$1.semi); }
12036  else
12037    { this.semicolon(); }
12038  return this.finishNode(node, "DoWhileStatement")
12039};
12040
12041// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
12042// loop is non-trivial. Basically, we have to parse the init `var`
12043// statement or expression, disallowing the `in` operator (see
12044// the second parameter to `parseExpression`), and then check
12045// whether the next token is `in` or `of`. When there is no init
12046// part (semicolon immediately after the opening parenthesis), it
12047// is a regular `for` loop.
12048
12049pp$8.parseForStatement = function(node) {
12050  this.next();
12051  var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
12052  this.labels.push(loopLabel);
12053  this.enterScope(0);
12054  this.expect(types$1.parenL);
12055  if (this.type === types$1.semi) {
12056    if (awaitAt > -1) { this.unexpected(awaitAt); }
12057    return this.parseFor(node, null)
12058  }
12059  var isLet = this.isLet();
12060  if (this.type === types$1._var || this.type === types$1._const || isLet) {
12061    var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
12062    this.next();
12063    this.parseVar(init$1, true, kind);
12064    this.finishNode(init$1, "VariableDeclaration");
12065    if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
12066      if (this.options.ecmaVersion >= 9) {
12067        if (this.type === types$1._in) {
12068          if (awaitAt > -1) { this.unexpected(awaitAt); }
12069        } else { node.await = awaitAt > -1; }
12070      }
12071      return this.parseForIn(node, init$1)
12072    }
12073    if (awaitAt > -1) { this.unexpected(awaitAt); }
12074    return this.parseFor(node, init$1)
12075  }
12076  var startsWithLet = this.isContextual("let"), isForOf = false;
12077  var refDestructuringErrors = new DestructuringErrors;
12078  var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
12079  if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
12080    if (this.options.ecmaVersion >= 9) {
12081      if (this.type === types$1._in) {
12082        if (awaitAt > -1) { this.unexpected(awaitAt); }
12083      } else { node.await = awaitAt > -1; }
12084    }
12085    if (startsWithLet && isForOf) { this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); }
12086    this.toAssignable(init, false, refDestructuringErrors);
12087    this.checkLValPattern(init);
12088    return this.parseForIn(node, init)
12089  } else {
12090    this.checkExpressionErrors(refDestructuringErrors, true);
12091  }
12092  if (awaitAt > -1) { this.unexpected(awaitAt); }
12093  return this.parseFor(node, init)
12094};
12095
12096pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
12097  this.next();
12098  return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
12099};
12100
12101pp$8.parseIfStatement = function(node) {
12102  this.next();
12103  node.test = this.parseParenExpression();
12104  // allow function declarations in branches, but only in non-strict mode
12105  node.consequent = this.parseStatement("if");
12106  node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
12107  return this.finishNode(node, "IfStatement")
12108};
12109
12110pp$8.parseReturnStatement = function(node) {
12111  if (!this.inFunction && !this.options.allowReturnOutsideFunction)
12112    { this.raise(this.start, "'return' outside of function"); }
12113  this.next();
12114
12115  // In `return` (and `break`/`continue`), the keywords with
12116  // optional arguments, we eagerly look for a semicolon or the
12117  // possibility to insert one.
12118
12119  if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
12120  else { node.argument = this.parseExpression(); this.semicolon(); }
12121  return this.finishNode(node, "ReturnStatement")
12122};
12123
12124pp$8.parseSwitchStatement = function(node) {
12125  this.next();
12126  node.discriminant = this.parseParenExpression();
12127  node.cases = [];
12128  this.expect(types$1.braceL);
12129  this.labels.push(switchLabel);
12130  this.enterScope(0);
12131
12132  // Statements under must be grouped (by label) in SwitchCase
12133  // nodes. `cur` is used to keep the node that we are currently
12134  // adding statements to.
12135
12136  var cur;
12137  for (var sawDefault = false; this.type !== types$1.braceR;) {
12138    if (this.type === types$1._case || this.type === types$1._default) {
12139      var isCase = this.type === types$1._case;
12140      if (cur) { this.finishNode(cur, "SwitchCase"); }
12141      node.cases.push(cur = this.startNode());
12142      cur.consequent = [];
12143      this.next();
12144      if (isCase) {
12145        cur.test = this.parseExpression();
12146      } else {
12147        if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); }
12148        sawDefault = true;
12149        cur.test = null;
12150      }
12151      this.expect(types$1.colon);
12152    } else {
12153      if (!cur) { this.unexpected(); }
12154      cur.consequent.push(this.parseStatement(null));
12155    }
12156  }
12157  this.exitScope();
12158  if (cur) { this.finishNode(cur, "SwitchCase"); }
12159  this.next(); // Closing brace
12160  this.labels.pop();
12161  return this.finishNode(node, "SwitchStatement")
12162};
12163
12164pp$8.parseThrowStatement = function(node) {
12165  this.next();
12166  if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
12167    { this.raise(this.lastTokEnd, "Illegal newline after throw"); }
12168  node.argument = this.parseExpression();
12169  this.semicolon();
12170  return this.finishNode(node, "ThrowStatement")
12171};
12172
12173// Reused empty array added for node fields that are always empty.
12174
12175var empty$1 = [];
12176
12177pp$8.parse
12177TryStatement = function(node) {
12178  this.next();
12179  node.block = this.parseBlock();
12180  node.handler = null;
vendor: 9,013 bytes, lines 12181-12435
12181  if (this.type === types$1._catch) {
12182    var clause = this.startNode();
12183    this.next();
12184    if (this.eat(types$1.parenL)) {
12185      clause.param = this.parseBindingAtom();
12186      var simple = clause.param.type === "Identifier";
12187      this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
12188      this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
12189      this.expect(types$1.parenR);
12190    } else {
12191      if (this.options.ecmaVersion < 10) { this.unexpected(); }
12192      clause.param = null;
12193      this.enterScope(0);
12194    }
12195    clause.body = this.parseBlock(false);
12196    this.exitScope();
12197    node.handler = this.finishNode(clause, "CatchClause");
12198  }
12199  node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
12200  if (!node.handler && !node.finalizer)
12201    { this.raise(node.start, "Missing catch or finally clause"); }
12202  return this.finishNode(node, "TryStatement")
12203};
12204
12205pp$8.parseVarStatement = function(node, kind) {
12206  this.next();
12207  this.parseVar(node, false, kind);
12208  this.semicolon();
12209  return this.finishNode(node, "VariableDeclaration")
12210};
12211
12212pp$8.parseWhileStatement = function(node) {
12213  this.next();
12214  node.test = this.parseParenExpression();
12215  this.labels.push(loopLabel);
12216  node.body = this.parseStatement("while");
12217  this.labels.pop();
12218  return this.finishNode(node, "WhileStatement")
12219};
12220
12221pp$8.parseWithStatement = function(node) {
12222  if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
12223  this.next();
12224  node.object = this.parseParenExpression();
12225  node.body = this.parseStatement("with");
12226  return this.finishNode(node, "WithStatement")
12227};
12228
12229pp$8.parseEmptyStatement = function(node) {
12230  this.next();
12231  return this.finishNode(node, "EmptyStatement")
12232};
12233
12234pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
12235  for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
12236    {
12237    var label = list[i$1];
12238
12239    if (label.name === maybeName)
12240      { this.raise(expr.start, "Label '" + maybeName + "' is already declared");
12241  } }
12242  var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
12243  for (var i = this.labels.length - 1; i >= 0; i--) {
12244    var label$1 = this.labels[i];
12245    if (label$1.statementStart === node.start) {
12246      // Update information about previous labels on this node
12247      label$1.statementStart = this.start;
12248      label$1.kind = kind;
12249    } else { break }
12250  }
12251  this.labels.push({name: maybeName, kind: kind, statementStart: this.start});
12252  node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
12253  this.labels.pop();
12254  node.label = expr;
12255  return this.finishNode(node, "LabeledStatement")
12256};
12257
12258pp$8.parseExpressionStatement = function(node, expr) {
12259  node.expression = expr;
12260  this.semicolon();
12261  return this.finishNode(node, "ExpressionStatement")
12262};
12263
12264// Parse a semicolon-enclosed block of statements, handling `"use
12265// strict"` declarations when `allowStrict` is true (used for
12266// function bodies).
12267
12268pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
12269  if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
12270  if ( node === void 0 ) node = this.startNode();
12271
12272  node.body = [];
12273  this.expect(types$1.braceL);
12274  if (createNewLexicalScope) { this.enterScope(0); }
12275  while (this.type !== types$1.braceR) {
12276    var stmt = this.parseStatement(null);
12277    node.body.push(stmt);
12278  }
12279  if (exitStrict) { this.strict = false; }
12280  this.next();
12281  if (createNewLexicalScope) { this.exitScope(); }
12282  return this.finishNode(node, "BlockStatement")
12283};
12284
12285// Parse a regular `for` loop. The disambiguation code in
12286// `parseStatement` will already have parsed the init statement or
12287// expression.
12288
12289pp$8.parseFor = function(node, init) {
12290  node.init = init;
12291  this.expect(types$1.semi);
12292  node.test = this.type === types$1.semi ? null : this.parseExpression();
12293  this.expect(types$1.semi);
12294  node.update = this.type === types$1.parenR ? null : this.parseExpression();
12295  this.expect(types$1.parenR);
12296  node.body = this.parseStatement("for");
12297  this.exitScope();
12298  this.labels.pop();
12299  return this.finishNode(node, "ForStatement")
12300};
12301
12302// Parse a `for`/`in` and `for`/`of` loop, which are almost
12303// same from parser's perspective.
12304
12305pp$8.parseForIn = function(node, init) {
12306  var isForIn = this.type === types$1._in;
12307  this.next();
12308
12309  if (
12310    init.type === "VariableDeclaration" &&
12311    init.declarations[0].init != null &&
12312    (
12313      !isForIn ||
12314      this.options.ecmaVersion < 8 ||
12315      this.strict ||
12316      init.kind !== "var" ||
12317      init.declarations[0].id.type !== "Identifier"
12318    )
12319  ) {
12320    this.raise(
12321      init.start,
12322      ((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer")
12323    );
12324  }
12325  node.left = init;
12326  node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
12327  this.expect(types$1.parenR);
12328  node.body = this.parseStatement("for");
12329  this.exitScope();
12330  this.labels.pop();
12331  return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement")
12332};
12333
12334// Parse a list of variable declarations.
12335
12336pp$8.parseVar = function(node, isFor, kind) {
12337  node.declarations = [];
12338  node.kind = kind;
12339  for (;;) {
12340    var decl = this.startNode();
12341    this.parseVarId(decl, kind);
12342    if (this.eat(types$1.eq)) {
12343      decl.init = this.parseMaybeAssign(isFor);
12344    } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
12345      this.unexpected();
12346    } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
12347      this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
12348    } else {
12349      decl.init = null;
12350    }
12351    node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
12352    if (!this.eat(types$1.comma)) { break }
12353  }
12354  return node
12355};
12356
12357pp$8.parseVarId = function(decl, kind) {
12358  decl.id = this.parseBindingAtom();
12359  this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
12360};
12361
12362var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
12363
12364// Parse a function declaration or literal (depending on the
12365// `statement & FUNC_STATEMENT`).
12366
12367// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
12368pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
12369  this.initFunction(node);
12370  if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
12371    if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
12372      { this.unexpected(); }
12373    node.generator = this.eat(types$1.star);
12374  }
12375  if (this.options.ecmaVersion >= 8)
12376    { node.async = !!isAsync; }
12377
12378  if (statement & FUNC_STATEMENT) {
12379    node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
12380    if (node.id && !(statement & FUNC_HANGING_STATEMENT))
12381      // If it is a regular function declaration in sloppy mode, then it is
12382      // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
12383      // mode depends on properties of the current scope (see
12384      // treatFunctionsAsVar).
12385      { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }
12386  }
12387
12388  var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
12389  this.yieldPos = 0;
12390  this.awaitPos = 0;
12391  this.awaitIdentPos = 0;
12392  this.enterScope(functionFlags(node.async, node.generator));
12393
12394  if (!(statement & FUNC_STATEMENT))
12395    { node.id = this.type === types$1.name ? this.parseIdent() : null; }
12396
12397  this.parseFunctionParams(node);
12398  this.parseFunctionBody(node, allowExpressionBody, false, forInit);
12399
12400  this.yieldPos = oldYieldPos;
12401  this.awaitPos = oldAwaitPos;
12402  this.awaitIdentPos = oldAwaitIdentPos;
12403  return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
12404};
12405
12406pp$8.parseFunctionParams = function(node) {
12407  this.expect(types$1.parenL);
12408  node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
12409  this.checkYieldAwaitInDefaultParams();
12410};
12411
12412// Parse a class declaration or literal (depending on the
12413// `isStatement` parameter).
12414
12415pp$8.parseClass = function(node, isStatement) {
12416  this.next();
12417
12418  // ecma-262 14.6 Class Definitions
12419  // A class definition is always strict mode code.
12420  var oldStrict = this.strict;
12421  this.strict = true;
12422
12423  this.parseClassId(node, isStatement);
12424  this.parseClassSuper(node);
12425  var privateNameMap = this.enterClassBody();
12426  var classBody = this.startNode();
12427  var hadConstructor = false;
12428  classBody.body = [];
12429  this.expect(types$1.braceL);
12430  while (this.type !== types$1.braceR) {
12431    var element = this.parseClassElement(node.superClass !== null);
12432    if (element) {
12433      classBody.body.push(element);
12434      if (element.type === "MethodDefinition" && element.kind === "constructor") {
12435        if (hadConstructor) { this.rais
vendor: 6,255 bytes, lines 12435-12620
12435e(element.start, "Duplicate constructor in the same class"); }
12436        hadConstructor = true;
12437      } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
12438        this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
12439      }
12440    }
12441  }
12442  this.strict = oldStrict;
12443  this.next();
12444  node.body = this.finishNode(classBody, "ClassBody");
12445  this.exitClassBody();
12446  return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
12447};
12448
12449pp$8.parseClassElement = function(constructorAllowsSuper) {
12450  if (this.eat(types$1.semi)) { return null }
12451
12452  var ecmaVersion = this.options.ecmaVersion;
12453  var node = this.startNode();
12454  var keyName = "";
12455  var isGenerator = false;
12456  var isAsync = false;
12457  var kind = "method";
12458  var isStatic = false;
12459
12460  if (this.eatContextual("static")) {
12461    // Parse static init block
12462    if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
12463      this.parseClassStaticBlock(node);
12464      return node
12465    }
12466    if (this.isClassElementNameStart() || this.type === types$1.star) {
12467      isStatic = true;
12468    } else {
12469      keyName = "static";
12470    }
12471  }
12472  node.static = isStatic;
12473  if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
12474    if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
12475      isAsync = true;
12476    } else {
12477      keyName = "async";
12478    }
12479  }
12480  if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
12481    isGenerator = true;
12482  }
12483  if (!keyName && !isAsync && !isGenerator) {
12484    var lastValue = this.value;
12485    if (this.eatContextual("get") || this.eatContextual("set")) {
12486      if (this.isClassElementNameStart()) {
12487        kind = lastValue;
12488      } else {
12489        keyName = lastValue;
12490      }
12491    }
12492  }
12493
12494  // Parse element name
12495  if (keyName) {
12496    // 'async', 'get', 'set', or 'static' were not a keyword contextually.
12497    // The last token is any of those. Make it the element name.
12498    node.computed = false;
12499    node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
12500    node.key.name = keyName;
12501    this.finishNode(node.key, "Identifier");
12502  } else {
12503    this.parseClassElementName(node);
12504  }
12505
12506  // Parse element value
12507  if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
12508    var isConstructor = !node.static && checkKeyName(node, "constructor");
12509    var allowsDirectSuper = isConstructor && constructorAllowsSuper;
12510    // Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
12511    if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); }
12512    node.kind = isConstructor ? "constructor" : kind;
12513    this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
12514  } else {
12515    this.parseClassField(node);
12516  }
12517
12518  return node
12519};
12520
12521pp$8.isClassElementNameStart = function() {
12522  return (
12523    this.type === types$1.name ||
12524    this.type === types$1.privateId ||
12525    this.type === types$1.num ||
12526    this.type === types$1.string ||
12527    this.type === types$1.bracketL ||
12528    this.type.keyword
12529  )
12530};
12531
12532pp$8.parseClassElementName = function(element) {
12533  if (this.type === types$1.privateId) {
12534    if (this.value === "constructor") {
12535      this.raise(this.start, "Classes can't have an element named '#constructor'");
12536    }
12537    element.computed = false;
12538    element.key = this.parsePrivateIdent();
12539  } else {
12540    this.parsePropertyName(element);
12541  }
12542};
12543
12544pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
12545  // Check key and flags
12546  var key = method.key;
12547  if (method.kind === "constructor") {
12548    if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
12549    if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
12550  } else if (method.static && checkKeyName(method, "prototype")) {
12551    this.raise(key.start, "Classes may not have a static property named prototype");
12552  }
12553
12554  // Parse value
12555  var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
12556
12557  // Check value
12558  if (method.kind === "get" && value.params.length !== 0)
12559    { this.raiseRecoverable(value.start, "getter should have no params"); }
12560  if (method.kind === "set" && value.params.length !== 1)
12561    { this.raiseRecoverable(value.start, "setter should have exactly one param"); }
12562  if (method.kind === "set" && value.params[0].type === "RestElement")
12563    { this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); }
12564
12565  return this.finishNode(method, "MethodDefinition")
12566};
12567
12568pp$8.parseClassField = function(field) {
12569  if (checkKeyName(field, "constructor")) {
12570    this.raise(field.key.start, "Classes can't have a field named 'constructor'");
12571  } else if (field.static && checkKeyName(field, "prototype")) {
12572    this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
12573  }
12574
12575  if (this.eat(types$1.eq)) {
12576    // To raise SyntaxError if 'arguments' exists in the initializer.
12577    var scope = this.currentThisScope();
12578    var inClassFieldInit = scope.inClassFieldInit;
12579    scope.inClassFieldInit = true;
12580    field.value = this.parseMaybeAssign();
12581    scope.inClassFieldInit = inClassFieldInit;
12582  } else {
12583    field.value = null;
12584  }
12585  this.semicolon();
12586
12587  return this.finishNode(field, "PropertyDefinition")
12588};
12589
12590pp$8.parseClassStaticBlock = function(node) {
12591  node.body = [];
12592
12593  var oldLabels = this.labels;
12594  this.labels = [];
12595  this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
12596  while (this.type !== types$1.braceR) {
12597    var stmt = this.parseStatement(null);
12598    node.body.push(stmt);
12599  }
12600  this.next();
12601  this.exitScope();
12602  this.labels = oldLabels;
12603
12604  return this.finishNode(node, "StaticBlock")
12605};
12606
12607pp$8.parseClassId = function(node, isStatement) {
12608  if (this.type === types$1.name) {
12609    node.id = this.parseIdent();
12610    if (isStatement)
12611      { this.checkLValSimple(node.id, BIND_LEXICAL, false); }
12612  } else {
12613    if (isStatement === true)
12614      { this.unexpected(); }
12615    node.id = null;
12616  }
12617};
12618
12619pp$8.parseClassSuper = function(node) {
12620  node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(
vendor: 12,305 bytes, lines 12620-12995
12620false) : null;
12621};
12622
12623pp$8.enterClassBody = function() {
12624  var element = {declared: Object.create(null), used: []};
12625  this.privateNameStack.push(element);
12626  return element.declared
12627};
12628
12629pp$8.exitClassBody = function() {
12630  var ref = this.privateNameStack.pop();
12631  var declared = ref.declared;
12632  var used = ref.used;
12633  var len = this.privateNameStack.length;
12634  var parent = len === 0 ? null : this.privateNameStack[len - 1];
12635  for (var i = 0; i < used.length; ++i) {
12636    var id = used[i];
12637    if (!hasOwn(declared, id.name)) {
12638      if (parent) {
12639        parent.used.push(id);
12640      } else {
12641        this.raiseRecoverable(id.start, ("Private field '#" + (id.name) + "' must be declared in an enclosing class"));
12642      }
12643    }
12644  }
12645};
12646
12647function isPrivateNameConflicted(privateNameMap, element) {
12648  var name = element.key.name;
12649  var curr = privateNameMap[name];
12650
12651  var next = "true";
12652  if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
12653    next = (element.static ? "s" : "i") + element.kind;
12654  }
12655
12656  // `class { get #a(){}; static set #a(_){} }` is also conflict.
12657  if (
12658    curr === "iget" && next === "iset" ||
12659    curr === "iset" && next === "iget" ||
12660    curr === "sget" && next === "sset" ||
12661    curr === "sset" && next === "sget"
12662  ) {
12663    privateNameMap[name] = "true";
12664    return false
12665  } else if (!curr) {
12666    privateNameMap[name] = next;
12667    return false
12668  } else {
12669    return true
12670  }
12671}
12672
12673function checkKeyName(node, name) {
12674  var computed = node.computed;
12675  var key = node.key;
12676  return !computed && (
12677    key.type === "Identifier" && key.name === name ||
12678    key.type === "Literal" && key.value === name
12679  )
12680}
12681
12682// Parses module export declaration.
12683
12684pp$8.parseExport = function(node, exports) {
12685  this.next();
12686  // export * from '...'
12687  if (this.eat(types$1.star)) {
12688    if (this.options.ecmaVersion >= 11) {
12689      if (this.eatContextual("as")) {
12690        node.exported = this.parseModuleExportName();
12691        this.checkExport(exports, node.exported, this.lastTokStart);
12692      } else {
12693        node.exported = null;
12694      }
12695    }
12696    this.expectContextual("from");
12697    if (this.type !== types$1.string) { this.unexpected(); }
12698    node.source = this.parseExprAtom();
12699    this.semicolon();
12700    return this.finishNode(node, "ExportAllDeclaration")
12701  }
12702  if (this.eat(types$1._default)) { // export default ...
12703    this.checkExport(exports, "default", this.lastTokStart);
12704    var isAsync;
12705    if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
12706      var fNode = this.startNode();
12707      this.next();
12708      if (isAsync) { this.next(); }
12709      node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
12710    } else if (this.type === types$1._class) {
12711      var cNode = this.startNode();
12712      node.declaration = this.parseClass(cNode, "nullableID");
12713    } else {
12714      node.declaration = this.parseMaybeAssign();
12715      this.semicolon();
12716    }
12717    return this.finishNode(node, "ExportDefaultDeclaration")
12718  }
12719  // export var|const|let|function|class ...
12720  if (this.shouldParseExportStatement()) {
12721    node.declaration = this.parseStatement(null);
12722    if (node.declaration.type === "VariableDeclaration")
12723      { this.checkVariableExport(exports, node.declaration.declarations); }
12724    else
12725      { this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
12726    node.specifiers = [];
12727    node.source = null;
12728  } else { // export { x, y as z } [from '...']
12729    node.declaration = null;
12730    node.specifiers = this.parseExportSpecifiers(exports);
12731    if (this.eatContextual("from")) {
12732      if (this.type !== types$1.string) { this.unexpected(); }
12733      node.source = this.parseExprAtom();
12734    } else {
12735      for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
12736        // check for keywords used as local names
12737        var spec = list[i];
12738
12739        this.checkUnreserved(spec.local);
12740        // check if export is defined
12741        this.checkLocalExport(spec.local);
12742
12743        if (spec.local.type === "Literal") {
12744          this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
12745        }
12746      }
12747
12748      node.source = null;
12749    }
12750    this.semicolon();
12751  }
12752  return this.finishNode(node, "ExportNamedDeclaration")
12753};
12754
12755pp$8.checkExport = function(exports, name, pos) {
12756  if (!exports) { return }
12757  if (typeof name !== "string")
12758    { name = name.type === "Identifier" ? name.name : name.value; }
12759  if (hasOwn(exports, name))
12760    { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
12761  exports[name] = true;
12762};
12763
12764pp$8.checkPatternExport = function(exports, pat) {
12765  var type = pat.type;
12766  if (type === "Identifier")
12767    { this.checkExport(exports, pat, pat.start); }
12768  else if (type === "ObjectPattern")
12769    { for (var i = 0, list = pat.properties; i < list.length; i += 1)
12770      {
12771        var prop = list[i];
12772
12773        this.checkPatternExport(exports, prop);
12774      } }
12775  else if (type === "ArrayPattern")
12776    { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
12777      var elt = list$1[i$1];
12778
12779        if (elt) { this.checkPatternExport(exports, elt); }
12780    } }
12781  else if (type === "Property")
12782    { this.checkPatternExport(exports, pat.value); }
12783  else if (type === "AssignmentPattern")
12784    { this.checkPatternExport(exports, pat.left); }
12785  else if (type === "RestElement")
12786    { this.checkPatternExport(exports, pat.argument); }
12787  else if (type === "ParenthesizedExpression")
12788    { this.checkPatternExport(exports, pat.expression); }
12789};
12790
12791pp$8.checkVariableExport = function(exports, decls) {
12792  if (!exports) { return }
12793  for (var i = 0, list = decls; i < list.length; i += 1)
12794    {
12795    var decl = list[i];
12796
12797    this.checkPatternExport(exports, decl.id);
12798  }
12799};
12800
12801pp$8.shouldParseExportStatement = function() {
12802  return this.type.keyword === "var" ||
12803    this.type.keyword === "const" ||
12804    this.type.keyword === "class" ||
12805    this.type.keyword === "function" ||
12806    this.isLet() ||
12807    this.isAsyncFunction()
12808};
12809
12810// Parses a comma-separated list of module exports.
12811
12812pp$8.parseExportSpecifiers = function(exports) {
12813  var nodes = [], first = true;
12814  // export { x, y as z } [from '...']
12815  this.expect(types$1.braceL);
12816  while (!this.eat(types$1.braceR)) {
12817    if (!first) {
12818      this.expect(types$1.comma);
12819      if (this.afterTrailingComma(types$1.braceR)) { break }
12820    } else { first = false; }
12821
12822    var node = this.startNode();
12823    node.local = this.parseModuleExportName();
12824    node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
12825    this.checkExport(
12826      exports,
12827      node.exported,
12828      node.exported.start
12829    );
12830    nodes.push(this.finishNode(node, "ExportSpecifier"));
12831  }
12832  return nodes
12833};
12834
12835// Parses import declaration.
12836
12837pp$8.parseImport = function(node) {
12838  this.next();
12839  // import '...'
12840  if (this.type === types$1.string) {
12841    node.specifiers = empty$1;
12842    node.source = this.parseExprAtom();
12843  } else {
12844    node.specifiers = this.parseImportSpecifiers();
12845    this.expectContextual("from");
12846    node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
12847  }
12848  this.semicolon();
12849  return this.finishNode(node, "ImportDeclaration")
12850};
12851
12852// Parses a comma-separated list of module imports.
12853
12854pp$8.parseImportSpecifiers = function() {
12855  var nodes = [], first = true;
12856  if (this.type === types$1.name) {
12857    // import defaultObj, { x, y as z } from '...'
12858    var node = this.startNode();
12859    node.local = this.parseIdent();
12860    this.checkLValSimple(node.local, BIND_LEXICAL);
12861    nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
12862    if (!this.eat(types$1.comma)) { return nodes }
12863  }
12864  if (this.type === types$1.star) {
12865    var node$1 = this.startNode();
12866    this.next();
12867    this.expectContextual("as");
12868    node$1.local = this.parseIdent();
12869    this.checkLValSimple(node$1.local, BIND_LEXICAL);
12870    nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
12871    return nodes
12872  }
12873  this.expect(types$1.braceL);
12874  while (!this.eat(types$1.braceR)) {
12875    if (!first) {
12876      this.expect(types$1.comma);
12877      if (this.afterTrailingComma(types$1.braceR)) { break }
12878    } else { first = false; }
12879
12880    var node$2 = this.startNode();
12881    node$2.imported = this.parseModuleExportName();
12882    if (this.eatContextual("as")) {
12883      node$2.local = this.parseIdent();
12884    } else {
12885      this.checkUnreserved(node$2.imported);
12886      node$2.local = node$2.imported;
12887    }
12888    this.checkLValSimple(node$2.local, BIND_LEXICAL);
12889    nodes.push(this.finishNode(node$2, "ImportSpecifier"));
12890  }
12891  return nodes
12892};
12893
12894pp$8.parseModuleExportName = function() {
12895  if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
12896    var stringLiteral = this.parseLiteral(this.value);
12897    if (loneSurrogate.test(stringLiteral.value)) {
12898      this.raise(stringLiteral.start, "An export name cannot include a lone surrogate.");
12899    }
12900    return stringLiteral
12901  }
12902  return this.parseIdent(true)
12903};
12904
12905// Set `ExpressionStatement#directive` property for directive prologues.
12906pp$8.adaptDirectivePrologue = function(statements) {
12907  for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
12908    statements[i].directive = statements[i].expression.raw.slice(1, -1);
12909  }
12910};
12911pp$8.isDirectiveCandidate = function(statement) {
12912  return (
12913    this.options.ecmaVersion >= 5 &&
12914    statement.type === "ExpressionStatement" &&
12915    statement.expression.type === "Literal" &&
12916    typeof statement.expression.value === "string" &&
12917    // Reject parenthesized strings.
12918    (this.input[statement.start] === "\"" || this.input[statement.start] === "'")
12919  )
12920};
12921
12922var pp$7 = Parser.prototype;
12923
12924// Convert existing expression atom to assignable pattern
12925// if possible.
12926
12927pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
12928  if (this.options.ecmaVersion >= 6 && node) {
12929    switch (node.type) {
12930    case "Identifier":
12931      if (this.inAsync && node.name === "await")
12932        { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); }
12933      break
12934
12935    case "ObjectPattern":
12936    case "ArrayPattern":
12937    case "AssignmentPattern":
12938    case "RestElement":
12939      break
12940
12941    case "ObjectExpression":
12942      node.type = "ObjectPattern";
12943      if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
12944      for (var i = 0, list = node.properties; i < list.length; i += 1) {
12945        var prop = list[i];
12946
12947      this.toAssignable(prop, isBinding);
12948        // Early error:
12949        //   AssignmentRestProperty[Yield, Await] :
12950        //     `...` DestructuringAssignmentTarget[Yield, Await]
12951        //
12952        //   It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
12953        if (
12954          prop.type === "RestElement" &&
12955          (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
12956        ) {
12957          this.raise(prop.argument.start, "Unexpected token");
12958        }
12959      }
12960      break
12961
12962    case "Property":
12963      // AssignmentProperty has type === "Property"
12964      if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); }
12965      this.toAssignable(node.value, isBinding);
12966      break
12967
12968    case "ArrayExpression":
12969      node.type = "ArrayPattern";
12970      if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
12971      this.toAssignableList(node.elements, isBinding);
12972      break
12973
12974    case "SpreadElement":
12975      node.type = "RestElement";
12976      this.toAssignable(node.argument, isBinding);
12977      if (node.argument.type === "AssignmentPattern")
12978        { this.raise(node.argument.start, "Rest elements cannot have a default value"); }
12979      break
12980
12981    case "AssignmentExpression":
12982      if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); }
12983      node.type = "AssignmentPattern";
12984      delete node.operator;
12985      this.toAssignable(node.left, isBinding);
12986      break
12987
12988    case "ParenthesizedExpression":
12989      this.toAssignable(node.expression, isBinding, refDestructuringErrors);
12990      break
12991
12992    case "ChainExpression":
12993      this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
12994      break
12995
vendor: 4,243 bytes, lines 12996-13125
12996    case "MemberExpression":
12997      if (!isBinding) { break }
12998
12999    default:
13000      this.raise(node.start, "Assigning to rvalue");
13001    }
13002  } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
13003  return node
13004};
13005
13006// Convert list of expression atoms to binding list.
13007
13008pp$7.toAssignableList = function(exprList, isBinding) {
13009  var end = exprList.length;
13010  for (var i = 0; i < end; i++) {
13011    var elt = exprList[i];
13012    if (elt) { this.toAssignable(elt, isBinding); }
13013  }
13014  if (end) {
13015    var last = exprList[end - 1];
13016    if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
13017      { this.unexpected(last.argument.start); }
13018  }
13019  return exprList
13020};
13021
13022// Parses spread element.
13023
13024pp$7.parseSpread = function(refDestructuringErrors) {
13025  var node = this.startNode();
13026  this.next();
13027  node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
13028  return this.finishNode(node, "SpreadElement")
13029};
13030
13031pp$7.parseRestBinding = function() {
13032  var node = this.startNode();
13033  this.next();
13034
13035  // RestElement inside of a function parameter must be an identifier
13036  if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
13037    { this.unexpected(); }
13038
13039  node.argument = this.parseBindingAtom();
13040
13041  return this.finishNode(node, "RestElement")
13042};
13043
13044// Parses lvalue (assignable) atom.
13045
13046pp$7.parseBindingAtom = function() {
13047  if (this.options.ecmaVersion >= 6) {
13048    switch (this.type) {
13049    case types$1.bracketL:
13050      var node = this.startNode();
13051      this.next();
13052      node.elements = this.parseBindingList(types$1.bracketR, true, true);
13053      return this.finishNode(node, "ArrayPattern")
13054
13055    case types$1.braceL:
13056      return this.parseObj(true)
13057    }
13058  }
13059  return this.parseIdent()
13060};
13061
13062pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
13063  var elts = [], first = true;
13064  while (!this.eat(close)) {
13065    if (first) { first = false; }
13066    else { this.expect(types$1.comma); }
13067    if (allowEmpty && this.type === types$1.comma) {
13068      elts.push(null);
13069    } else if (allowTrailingComma && this.afterTrailingComma(close)) {
13070      break
13071    } else if (this.type === types$1.ellipsis) {
13072      var rest = this.parseRestBinding();
13073      this.parseBindingListItem(rest);
13074      elts.push(rest);
13075      if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
13076      this.expect(close);
13077      break
13078    } else {
13079      var elem = this.parseMaybeDefault(this.start, this.startLoc);
13080      this.parseBindingListItem(elem);
13081      elts.push(elem);
13082    }
13083  }
13084  return elts
13085};
13086
13087pp$7.parseBindingListItem = function(param) {
13088  return param
13089};
13090
13091// Parses assignment pattern around given atom if possible.
13092
13093pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
13094  left = left || this.parseBindingAtom();
13095  if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
13096  var node = this.startNodeAt(startPos, startLoc);
13097  node.left = left;
13098  node.right = this.parseMaybeAssign();
13099  return this.finishNode(node, "AssignmentPattern")
13100};
13101
13102// The following three functions all verify that a node is an lvalue —
13103// something that can be bound, or assigned to. In order to do so, they perform
13104// a variety of checks:
13105//
13106// - Check that none of the bound/assigned-to identifiers are reserved words.
13107// - Record name declarations for bindings in the appropriate scope.
13108// - Check duplicate argument names, if checkClashes is set.
13109//
13110// If a complex binding pattern is encountered (e.g., object and array
13111// destructuring), the entire pattern is recursively checked.
13112//
13113// There are three versions of checkLVal*() appropriate for different
13114// circumstances:
13115//
13116// - checkLValSimple() shall be used if the syntactic construct supports
13117//   nothing other than identifiers and member expressions. Parenthesized
13118//   expressions are also correctly handled. This is generally appropriate for
13119//   constructs for which the spec says
13120//
13121//   > It is a Syntax Error if AssignmentTargetType of [the production] is not
13122//   > simple.
13123//
13124//   It is also appropriate for checking if an identifier is valid and not
13125//   defined elsewhere, like import declarations or function/class i
vendor: 12,563 bytes, lines 13125-13488
13125dentifiers.
13126//
13127//   Examples where this is used include:
13128//     a += …;
13129//     import a from '…';
13130//   where a is the node to be checked.
13131//
13132// - checkLValPattern() shall be used if the syntactic construct supports
13133//   anything checkLValSimple() supports, as well as object and array
13134//   destructuring patterns. This is generally appropriate for constructs for
13135//   which the spec says
13136//
13137//   > It is a Syntax Error if [the production] is neither an ObjectLiteral nor
13138//   > an ArrayLiteral and AssignmentTargetType of [the production] is not
13139//   > simple.
13140//
13141//   Examples where this is used include:
13142//     (a = …);
13143//     const a = …;
13144//     try { … } catch (a) { … }
13145//   where a is the node to be checked.
13146//
13147// - checkLValInnerPattern() shall be used if the syntactic construct supports
13148//   anything checkLValPattern() supports, as well as default assignment
13149//   patterns, rest elements, and other constructs that may appear within an
13150//   object or array destructuring pattern.
13151//
13152//   As a special case, function parameters also use checkLValInnerPattern(),
13153//   as they also support defaults and rest constructs.
13154//
13155// These functions deliberately support both assignment and binding constructs,
13156// as the logic for both is exceedingly similar. If the node is the target of
13157// an assignment, then bindingType should be set to BIND_NONE. Otherwise, it
13158// should be set to the appropriate BIND_* constant, like BIND_VAR or
13159// BIND_LEXICAL.
13160//
13161// If the function is called with a non-BIND_NONE bindingType, then
13162// additionally a checkClashes object may be specified to allow checking for
13163// duplicate argument names. checkClashes is ignored if the provided construct
13164// is an assignment (i.e., bindingType is BIND_NONE).
13165
13166pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
13167  if ( bindingType === void 0 ) bindingType = BIND_NONE;
13168
13169  var isBind = bindingType !== BIND_NONE;
13170
13171  switch (expr.type) {
13172  case "Identifier":
13173    if (this.strict && this.reservedWordsStrictBind.test(expr.name))
13174      { this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); }
13175    if (isBind) {
13176      if (bindingType === BIND_LEXICAL && expr.name === "let")
13177        { this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); }
13178      if (checkClashes) {
13179        if (hasOwn(checkClashes, expr.name))
13180          { this.raiseRecoverable(expr.start, "Argument name clash"); }
13181        checkClashes[expr.name] = true;
13182      }
13183      if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }
13184    }
13185    break
13186
13187  case "ChainExpression":
13188    this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
13189    break
13190
13191  case "MemberExpression":
13192    if (isBind) { this.raiseRecoverable(expr.start, "Binding member expression"); }
13193    break
13194
13195  case "ParenthesizedExpression":
13196    if (isBind) { this.raiseRecoverable(expr.start, "Binding parenthesized expression"); }
13197    return this.checkLValSimple(expr.expression, bindingType, checkClashes)
13198
13199  default:
13200    this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
13201  }
13202};
13203
13204pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
13205  if ( bindingType === void 0 ) bindingType = BIND_NONE;
13206
13207  switch (expr.type) {
13208  case "ObjectPattern":
13209    for (var i = 0, list = expr.properties; i < list.length; i += 1) {
13210      var prop = list[i];
13211
13212    this.checkLValInnerPattern(prop, bindingType, checkClashes);
13213    }
13214    break
13215
13216  case "ArrayPattern":
13217    for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
13218      var elem = list$1[i$1];
13219
13220    if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); }
13221    }
13222    break
13223
13224  default:
13225    this.checkLValSimple(expr, bindingType, checkClashes);
13226  }
13227};
13228
13229pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
13230  if ( bindingType === void 0 ) bindingType = BIND_NONE;
13231
13232  switch (expr.type) {
13233  case "Property":
13234    // AssignmentProperty has type === "Property"
13235    this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
13236    break
13237
13238  case "AssignmentPattern":
13239    this.checkLValPattern(expr.left, bindingType, checkClashes);
13240    break
13241
13242  case "RestElement":
13243    this.checkLValPattern(expr.argument, bindingType, checkClashes);
13244    break
13245
13246  default:
13247    this.checkLValPattern(expr, bindingType, checkClashes);
13248  }
13249};
13250
13251// The algorithm used to determine whether a regexp can appear at a
13252
13253var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
13254  this.token = token;
13255  this.isExpr = !!isExpr;
13256  this.preserveSpace = !!preserveSpace;
13257  this.override = override;
13258  this.generator = !!generator;
13259};
13260
13261var types = {
13262  b_stat: new TokContext("{", false),
13263  b_expr: new TokContext("{", true),
13264  b_tmpl: new TokContext("${", false),
13265  p_stat: new TokContext("(", false),
13266  p_expr: new TokContext("(", true),
13267  q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
13268  f_stat: new TokContext("function", false),
13269  f_expr: new TokContext("function", true),
13270  f_expr_gen: new TokContext("function", true, false, null, true),
13271  f_gen: new TokContext("function", false, false, null, true)
13272};
13273
13274var pp$6 = Parser.prototype;
13275
13276pp$6.initialContext = function() {
13277  return [types.b_stat]
13278};
13279
13280pp$6.curContext = function() {
13281  return this.context[this.context.length - 1]
13282};
13283
13284pp$6.braceIsBlock = function(prevType) {
13285  var parent = this.curContext();
13286  if (parent === types.f_expr || parent === types.f_stat)
13287    { return true }
13288  if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
13289    { return !parent.isExpr }
13290
13291  // The check for `tt.name && exprAllowed` detects whether we are
13292  // after a `yield` or `of` construct. See the `updateContext` for
13293  // `tt.name`.
13294  if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
13295    { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
13296  if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
13297    { return true }
13298  if (prevType === types$1.braceL)
13299    { return parent === types.b_stat }
13300  if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
13301    { return false }
13302  return !this.exprAllowed
13303};
13304
13305pp$6.inGeneratorContext = function() {
13306  for (var i = this.context.length - 1; i >= 1; i--) {
13307    var context = this.context[i];
13308    if (context.token === "function")
13309      { return context.generator }
13310  }
13311  return false
13312};
13313
13314pp$6.updateContext = function(prevType) {
13315  var update, type = this.type;
13316  if (type.keyword && prevType === types$1.dot)
13317    { this.exprAllowed = false; }
13318  else if (update = type.updateContext)
13319    { update.call(this, prevType); }
13320  else
13321    { this.exprAllowed = type.beforeExpr; }
13322};
13323
13324// Used to handle egde cases when token context could not be inferred correctly during tokenization phase
13325
13326pp$6.overrideContext = function(tokenCtx) {
13327  if (this.curContext() !== tokenCtx) {
13328    this.context[this.context.length - 1] = tokenCtx;
13329  }
13330};
13331
13332// Token-specific context update code
13333
13334types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
13335  if (this.context.length === 1) {
13336    this.exprAllowed = true;
13337    return
13338  }
13339  var out = this.context.pop();
13340  if (out === types.b_stat && this.curContext().token === "function") {
13341    out = this.context.pop();
13342  }
13343  this.exprAllowed = !out.isExpr;
13344};
13345
13346types$1.braceL.updateContext = function(prevType) {
13347  this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
13348  this.exprAllowed = true;
13349};
13350
13351types$1.dollarBraceL.updateContext = function() {
13352  this.context.push(types.b_tmpl);
13353  this.exprAllowed = true;
13354};
13355
13356types$1.parenL.updateContext = function(prevType) {
13357  var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
13358  this.context.push(statementParens ? types.p_stat : types.p_expr);
13359  this.exprAllowed = true;
13360};
13361
13362types$1.incDec.updateContext = function() {
13363  // tokExprAllowed stays unchanged
13364};
13365
13366types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
13367  if (prevType.beforeExpr && prevType !== types$1._else &&
13368      !(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
13369      !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
13370      !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
13371    { this.context.push(types.f_expr); }
13372  else
13373    { this.context.push(types.f_stat); }
13374  this.exprAllowed = false;
13375};
13376
13377types$1.backQuote.updateContext = function() {
13378  if (this.curContext() === types.q_tmpl)
13379    { this.context.pop(); }
13380  else
13381    { this.context.push(types.q_tmpl); }
13382  this.exprAllowed = false;
13383};
13384
13385types$1.star.updateContext = function(prevType) {
13386  if (prevType === types$1._function) {
13387    var index = this.context.length - 1;
13388    if (this.context[index] === types.f_expr)
13389      { this.context[index] = types.f_expr_gen; }
13390    else
13391      { this.context[index] = types.f_gen; }
13392  }
13393  this.exprAllowed = true;
13394};
13395
13396types$1.name.updateContext = function(prevType) {
13397  var allowed = false;
13398  if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
13399    if (this.value === "of" && !this.exprAllowed ||
13400        this.value === "yield" && this.inGeneratorContext())
13401      { allowed = true; }
13402  }
13403  this.exprAllowed = allowed;
13404};
13405
13406// A recursive descent parser operates by defining functions for all
13407
13408var pp$5 = Parser.prototype;
13409
13410// Check if property name clashes with already added.
13411// Object/class getters and setters are not allowed to clash —
13412// either with each other or with an init property — and in
13413// strict mode, init properties are also not allowed to be repeated.
13414
13415pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
13416  if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
13417    { return }
13418  if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
13419    { return }
13420  var key = prop.key;
13421  var name;
13422  switch (key.type) {
13423  case "Identifier": name = key.name; break
13424  case "Literal": name = String(key.value); break
13425  default: return
13426  }
13427  var kind = prop.kind;
13428  if (this.options.ecmaVersion >= 6) {
13429    if (name === "__proto__" && kind === "init") {
13430      if (propHash.proto) {
13431        if (refDestructuringErrors) {
13432          if (refDestructuringErrors.doubleProto < 0) {
13433            refDestructuringErrors.doubleProto = key.start;
13434          }
13435        } else {
13436          this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
13437        }
13438      }
13439      propHash.proto = true;
13440    }
13441    return
13442  }
13443  name = "$" + name;
13444  var other = propHash[name];
13445  if (other) {
13446    var redefinition;
13447    if (kind === "init") {
13448      redefinition = this.strict && other.init || other.get || other.set;
13449    } else {
13450      redefinition = other.init || other[kind];
13451    }
13452    if (redefinition)
13453      { this.raiseRecoverable(key.start, "Redefinition of property"); }
13454  } else {
13455    other = propHash[name] = {
13456      init: false,
13457      get: false,
13458      set: false
13459    };
13460  }
13461  other[kind] = true;
13462};
13463
13464// ### Expression parsing
13465
13466// These nest, from the most general expression type at the top to
13467// 'atomic', nondivisible expression types at the bottom. Most of
13468// the functions will simply let the function(s) below them parse,
13469// and, *if* the syntactic construct they handle is present, wrap
13470// the AST node that the inner parser gave them in another node.
13471
13472// Parse a full expression. The optional arguments are used to
13473// forbid the `in` operator (in for loops initalization expressions)
13474// and provide reference for storing '=' operator inside shorthand
13475// property assignment in contexts where both object expression
13476// and object pattern might appear (so it's possible to raise
13477// delayed syntax error at correct position).
13478
13479pp$5.parseExpression = function(forInit, refDestructuringErrors) {
13480  var startPos = this.start, startLoc = this.startLoc;
13481  var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
13482  if (this.type === types$1.comma) {
13483    var node = this.startNodeAt(startPos, startLoc);
13484    node.expressions = [expr];
13485    while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
13486    return this.finishNode(node, "SequenceExpression")
13487  }
13488  return expr
vendor: 1,788 bytes, lines 13488-13528
13488
13489};
13490
13491// Parse an assignment expression. This includes applications of
13492// operators like `+=`.
13493
13494pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
13495  if (this.isContextual("yield")) {
13496    if (this.inGenerator) { return this.parseYield(forInit) }
13497    // The tokenizer will assume an expression is allowed after
13498    // `yield`, but this isn't that kind of yield
13499    else { this.exprAllowed = false; }
13500  }
13501
13502  var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
13503  if (refDestructuringErrors) {
13504    oldParenAssign = refDestructuringErrors.parenthesizedAssign;
13505    oldTrailingComma = refDestructuringErrors.trailingComma;
13506    oldDoubleProto = refDestructuringErrors.doubleProto;
13507    refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
13508  } else {
13509    refDestructuringErrors = new DestructuringErrors;
13510    ownDestructuringErrors = true;
13511  }
13512
13513  var startPos = this.start, startLoc = this.startLoc;
13514  if (this.type === types$1.parenL || this.type === types$1.name) {
13515    this.potentialArrowAt = this.start;
13516    this.potentialArrowInForAwait = forInit === "await";
13517  }
13518  var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
13519  if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
13520  if (this.type.isAssign) {
13521    var node = this.startNodeAt(startPos, startLoc);
13522    node.operator = this.value;
13523    if (this.type === types$1.eq)
13524      { left = this.toAssignable(left, false, refDestructuringErrors); }
13525    if (!ownDestructuringErrors) {
13526      refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
13527    }
13528    if (refDestructuringErrors.shorthandAssign >= left.start)
vendor: 5,168 bytes, lines 13529-13636
13529      { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
13530    if (this.type === types$1.eq)
13531      { this.checkLValPattern(left); }
13532    else
13533      { this.checkLValSimple(left); }
13534    node.left = left;
13535    this.next();
13536    node.right = this.parseMaybeAssign(forInit);
13537    if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
13538    return this.finishNode(node, "AssignmentExpression")
13539  } else {
13540    if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
13541  }
13542  if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }
13543  if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }
13544  return left
13545};
13546
13547// Parse a ternary conditional (`?:`) operator.
13548
13549pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
13550  var startPos = this.start, startLoc = this.startLoc;
13551  var expr = this.parseExprOps(forInit, refDestructuringErrors);
13552  if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
13553  if (this.eat(types$1.question)) {
13554    var node = this.startNodeAt(startPos, startLoc);
13555    node.test = expr;
13556    node.consequent = this.parseMaybeAssign();
13557    this.expect(types$1.colon);
13558    node.alternate = this.parseMaybeAssign(forInit);
13559    return this.finishNode(node, "ConditionalExpression")
13560  }
13561  return expr
13562};
13563
13564// Start the precedence parser.
13565
13566pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
13567  var startPos = this.start, startLoc = this.startLoc;
13568  var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
13569  if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
13570  return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)
13571};
13572
13573// Parse binary operators with the operator precedence parsing
13574// algorithm. `left` is the left-hand side of the operator.
13575// `minPrec` provides context that allows the function to stop and
13576// defer further parser to one of its callers when it encounters an
13577// operator that has a lower precedence than the set it is parsing.
13578
13579pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
13580  var prec = this.type.binop;
13581  if (prec != null && (!forInit || this.type !== types$1._in)) {
13582    if (prec > minPrec) {
13583      var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
13584      var coalesce = this.type === types$1.coalesce;
13585      if (coalesce) {
13586        // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
13587        // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
13588        prec = types$1.logicalAND.binop;
13589      }
13590      var op = this.value;
13591      this.next();
13592      var startPos = this.start, startLoc = this.startLoc;
13593      var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
13594      var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
13595      if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
13596        this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
13597      }
13598      return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
13599    }
13600  }
13601  return left
13602};
13603
13604pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
13605  if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
13606  var node = this.startNodeAt(startPos, startLoc);
13607  node.left = left;
13608  node.operator = op;
13609  node.right = right;
13610  return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")
13611};
13612
13613// Parse unary operators, both prefix and postfix.
13614
13615pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
13616  var startPos = this.start, startLoc = this.startLoc, expr;
13617  if (this.isContextual("await") && this.canAwait) {
13618    expr = this.parseAwait(forInit);
13619    sawUnary = true;
13620  } else if (this.type.prefix) {
13621    var node = this.startNode(), update = this.type === types$1.incDec;
13622    node.operator = this.value;
13623    node.prefix = true;
13624    this.next();
13625    node.argument = this.parseMaybeUnary(null, true, update, forInit);
13626    this.checkExpressionErrors(refDestructuringErrors, true);
13627    if (update) { this.checkLValSimple(node.argument); }
13628    else if (this.strict && node.operator === "delete" &&
13629             node.argument.type === "Identifier")
13630      { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
13631    else if (node.operator === "delete" && isPrivateFieldAccess(node.argument))
13632      { this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
13633    else { sawUnary = true; }
13634    expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
13635  } else if (!sawUnary && this.type === types$1.privateId) {
13636    if (
vendor: 12,750 bytes, lines 13636-13963
13636forInit || this.privateNameStack.length === 0) { this.unexpected(); }
13637    expr = this.parsePrivateIdent();
13638    // only could be private fields in 'in', such as #x in obj
13639    if (this.type !== types$1._in) { this.unexpected(); }
13640  } else {
13641    expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
13642    if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
13643    while (this.type.postfix && !this.canInsertSemicolon()) {
13644      var node$1 = this.startNodeAt(startPos, startLoc);
13645      node$1.operator = this.value;
13646      node$1.prefix = false;
13647      node$1.argument = expr;
13648      this.checkLValSimple(expr);
13649      this.next();
13650      expr = this.finishNode(node$1, "UpdateExpression");
13651    }
13652  }
13653
13654  if (!incDec && this.eat(types$1.starstar)) {
13655    if (sawUnary)
13656      { this.unexpected(this.lastTokStart); }
13657    else
13658      { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false) }
13659  } else {
13660    return expr
13661  }
13662};
13663
13664function isPrivateFieldAccess(node) {
13665  return (
13666    node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
13667    node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
13668  )
13669}
13670
13671// Parse call, dot, and `[]`-subscript expressions.
13672
13673pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
13674  var startPos = this.start, startLoc = this.startLoc;
13675  var expr = this.parseExprAtom(refDestructuringErrors, forInit);
13676  if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
13677    { return expr }
13678  var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
13679  if (refDestructuringErrors && result.type === "MemberExpression") {
13680    if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
13681    if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
13682    if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }
13683  }
13684  return result
13685};
13686
13687pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
13688  var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
13689      this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
13690      this.potentialArrowAt === base.start;
13691  var optionalChained = false;
13692
13693  while (true) {
13694    var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
13695
13696    if (element.optional) { optionalChained = true; }
13697    if (element === base || element.type === "ArrowFunctionExpression") {
13698      if (optionalChained) {
13699        var chainNode = this.startNodeAt(startPos, startLoc);
13700        chainNode.expression = element;
13701        element = this.finishNode(chainNode, "ChainExpression");
13702      }
13703      return element
13704    }
13705
13706    base = element;
13707  }
13708};
13709
13710pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
13711  var optionalSupported = this.options.ecmaVersion >= 11;
13712  var optional = optionalSupported && this.eat(types$1.questionDot);
13713  if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
13714
13715  var computed = this.eat(types$1.bracketL);
13716  if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
13717    var node = this.startNodeAt(startPos, startLoc);
13718    node.object = base;
13719    if (computed) {
13720      node.property = this.parseExpression();
13721      this.expect(types$1.bracketR);
13722    } else if (this.type === types$1.privateId && base.type !== "Super") {
13723      node.property = this.parsePrivateIdent();
13724    } else {
13725      node.property = this.parseIdent(this.options.allowReserved !== "never");
13726    }
13727    node.computed = !!computed;
13728    if (optionalSupported) {
13729      node.optional = optional;
13730    }
13731    base = this.finishNode(node, "MemberExpression");
13732  } else if (!noCalls && this.eat(types$1.parenL)) {
13733    var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
13734    this.yieldPos = 0;
13735    this.awaitPos = 0;
13736    this.awaitIdentPos = 0;
13737    var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
13738    if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
13739      this.checkPatternErrors(refDestructuringErrors, false);
13740      this.checkYieldAwaitInDefaultParams();
13741      if (this.awaitIdentPos > 0)
13742        { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
13743      this.yieldPos = oldYieldPos;
13744      this.awaitPos = oldAwaitPos;
13745      this.awaitIdentPos = oldAwaitIdentPos;
13746      return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
13747    }
13748    this.checkExpressionErrors(refDestructuringErrors, true);
13749    this.yieldPos = oldYieldPos || this.yieldPos;
13750    this.awaitPos = oldAwaitPos || this.awaitPos;
13751    this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
13752    var node$1 = this.startNodeAt(startPos, startLoc);
13753    node$1.callee = base;
13754    node$1.arguments = exprList;
13755    if (optionalSupported) {
13756      node$1.optional = optional;
13757    }
13758    base = this.finishNode(node$1, "CallExpression");
13759  } else if (this.type === types$1.backQuote) {
13760    if (optional || optionalChained) {
13761      this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
13762    }
13763    var node$2 = this.startNodeAt(startPos, startLoc);
13764    node$2.tag = base;
13765    node$2.quasi = this.parseTemplate({isTagged: true});
13766    base = this.finishNode(node$2, "TaggedTemplateExpression");
13767  }
13768  return base
13769};
13770
13771// Parse an atomic expression — either a single token that is an
13772// expression, an expression started by a keyword like `function` or
13773// `new`, or an expression wrapped in punctuation like `()`, `[]`,
13774// or `{}`.
13775
13776pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
13777  // If a division operator appears in an expression position, the
13778  // tokenizer got confused, and we force it to read a regexp instead.
13779  if (this.type === types$1.slash) { this.readRegexp(); }
13780
13781  var node, canBeArrow = this.potentialArrowAt === this.start;
13782  switch (this.type) {
13783  case types$1._super:
13784    if (!this.allowSuper)
13785      { this.raise(this.start, "'super' keyword outside a method"); }
13786    node = this.startNode();
13787    this.next();
13788    if (this.type === types$1.parenL && !this.allowDirectSuper)
13789      { this.raise(node.start, "super() call outside constructor of a subclass"); }
13790    // The `super` keyword can appear at below:
13791    // SuperProperty:
13792    //     super [ Expression ]
13793    //     super . IdentifierName
13794    // SuperCall:
13795    //     super ( Arguments )
13796    if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
13797      { this.unexpected(); }
13798    return this.finishNode(node, "Super")
13799
13800  case types$1._this:
13801    node = this.startNode();
13802    this.next();
13803    return this.finishNode(node, "ThisExpression")
13804
13805  case types$1.name:
13806    var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
13807    var id = this.parseIdent(false);
13808    if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
13809      this.overrideContext(types.f_expr);
13810      return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
13811    }
13812    if (canBeArrow && !this.canInsertSemicolon()) {
13813      if (this.eat(types$1.arrow))
13814        { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
13815      if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
13816          (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
13817        id = this.parseIdent(false);
13818        if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
13819          { this.unexpected(); }
13820        return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
13821      }
13822    }
13823    return id
13824
13825  case types$1.regexp:
13826    var value = this.value;
13827    node = this.parseLiteral(value.value);
13828    node.regex = {pattern: value.pattern, flags: value.flags};
13829    return node
13830
13831  case types$1.num: case types$1.string:
13832    return this.parseLiteral(this.value)
13833
13834  case types$1._null: case types$1._true: case types$1._false:
13835    node = this.startNode();
13836    node.value = this.type === types$1._null ? null : this.type === types$1._true;
13837    node.raw = this.type.keyword;
13838    this.next();
13839    return this.finishNode(node, "Literal")
13840
13841  case types$1.parenL:
13842    var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
13843    if (refDestructuringErrors) {
13844      if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
13845        { refDestructuringErrors.parenthesizedAssign = start; }
13846      if (refDestructuringErrors.parenthesizedBind < 0)
13847        { refDestructuringErrors.parenthesizedBind = start; }
13848    }
13849    return expr
13850
13851  case types$1.bracketL:
13852    node = this.startNode();
13853    this.next();
13854    node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
13855    return this.finishNode(node, "ArrayExpression")
13856
13857  case types$1.braceL:
13858    this.overrideContext(types.b_expr);
13859    return this.parseObj(false, refDestructuringErrors)
13860
13861  case types$1._function:
13862    node = this.startNode();
13863    this.next();
13864    return this.parseFunction(node, 0)
13865
13866  case types$1._class:
13867    return this.parseClass(this.startNode(), false)
13868
13869  case types$1._new:
13870    return this.parseNew()
13871
13872  case types$1.backQuote:
13873    return this.parseTemplate()
13874
13875  case types$1._import:
13876    if (this.options.ecmaVersion >= 11) {
13877      return this.parseExprImport()
13878    } else {
13879      return this.unexpected()
13880    }
13881
13882  default:
13883    this.unexpected();
13884  }
13885};
13886
13887pp$5.parseExprImport = function() {
13888  var node = this.startNode();
13889
13890  // Consume `import` as an identifier for `import.meta`.
13891  // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
13892  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
13893  var meta = this.parseIdent(true);
13894
13895  switch (this.type) {
13896  case types$1.parenL:
13897    return this.parseDynamicImport(node)
13898  case types$1.dot:
13899    node.meta = meta;
13900    return this.parseImportMeta(node)
13901  default:
13902    this.unexpected();
13903  }
13904};
13905
13906pp$5.parseDynamicImport = function(node) {
13907  this.next(); // skip `(`
13908
13909  // Parse node.source.
13910  node.source = this.parseMaybeAssign();
13911
13912  // Verify ending.
13913  if (!this.eat(types$1.parenR)) {
13914    var errorPos = this.start;
13915    if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
13916      this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
13917    } else {
13918      this.unexpected(errorPos);
13919    }
13920  }
13921
13922  return this.finishNode(node, "ImportExpression")
13923};
13924
13925pp$5.parseImportMeta = function(node) {
13926  this.next(); // skip `.`
13927
13928  var containsEsc = this.containsEsc;
13929  node.property = this.parseIdent(true);
13930
13931  if (node.property.name !== "meta")
13932    { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
13933  if (containsEsc)
13934    { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
13935  if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere)
13936    { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
13937
13938  return this.finishNode(node, "MetaProperty")
13939};
13940
13941pp$5.parseLiteral = function(value) {
13942  var node = this.startNode();
13943  node.value = value;
13944  node.raw = this.input.slice(this.start, this.end);
13945  if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); }
13946  this.next();
13947  return this.finishNode(node, "Literal")
13948};
13949
13950pp$5.parseParenExpression = function() {
13951  this.expect(types$1.parenL);
13952  var val = this.parseExpression();
13953  this.expect(types$1.parenR);
13954  return val
13955};
13956
13957pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
13958  var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
13959  if (this.options.ecmaVersion >= 6) {
13960    this.next();
13961
13962    var innerStartPos = this.start, innerStartLoc = this.startLoc;
13963    var exprList = [], first = true, lastIsComma = false;
vendor: 3,837 bytes, lines 13964-14055
13964    var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
13965    this.yieldPos = 0;
13966    this.awaitPos = 0;
13967    // Do not save awaitIdentPos to allow checking awaits nested in parameters
13968    while (this.type !== types$1.parenR) {
13969      first ? first = false : this.expect(types$1.comma);
13970      if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
13971        lastIsComma = true;
13972        break
13973      } else if (this.type === types$1.ellipsis) {
13974        spreadStart = this.start;
13975        exprList.push(this.parseParenItem(this.parseRestBinding()));
13976        if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
13977        break
13978      } else {
13979        exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
13980      }
13981    }
13982    var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
13983    this.expect(types$1.parenR);
13984
13985    if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
13986      this.checkPatternErrors(refDestructuringErrors, false);
13987      this.checkYieldAwaitInDefaultParams();
13988      this.yieldPos = oldYieldPos;
13989      this.awaitPos = oldAwaitPos;
13990      return this.parseParenArrowList(startPos, startLoc, exprList, forInit)
13991    }
13992
13993    if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }
13994    if (spreadStart) { this.unexpected(spreadStart); }
13995    this.checkExpressionErrors(refDestructuringErrors, true);
13996    this.yieldPos = oldYieldPos || this.yieldPos;
13997    this.awaitPos = oldAwaitPos || this.awaitPos;
13998
13999    if (exprList.length > 1) {
14000      val = this.startNodeAt(innerStartPos, innerStartLoc);
14001      val.expressions = exprList;
14002      this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
14003    } else {
14004      val = exprList[0];
14005    }
14006  } else {
14007    val = this.parseParenExpression();
14008  }
14009
14010  if (this.options.preserveParens) {
14011    var par = this.startNodeAt(startPos, startLoc);
14012    par.expression = val;
14013    return this.finishNode(par, "ParenthesizedExpression")
14014  } else {
14015    return val
14016  }
14017};
14018
14019pp$5.parseParenItem = function(item) {
14020  return item
14021};
14022
14023pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
14024  return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
14025};
14026
14027// New's precedence is slightly tricky. It must allow its argument to
14028// be a `[]` or dot subscript expression, but not a call — at least,
14029// not without wrapping it in parentheses. Thus, it uses the noCalls
14030// argument to parseSubscripts to prevent it from consuming the
14031// argument list.
14032
14033var empty = [];
14034
14035pp$5.parseNew = function() {
14036  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
14037  var node = this.startNode();
14038  var meta = this.parseIdent(true);
14039  if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
14040    node.meta = meta;
14041    var containsEsc = this.containsEsc;
14042    node.property = this.parseIdent(true);
14043    if (node.property.name !== "target")
14044      { this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); }
14045    if (containsEsc)
14046      { this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); }
14047    if (!this.allowNewDotTarget)
14048      { this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
14049    return this.finishNode(node, "MetaProperty")
14050  }
14051  var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
14052  node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
14053  if (isImport && node.callee.type === "ImportExpression") {
14054    this.raise(startPos, "Cannot use new with import()");
14055  }
vendor: 2,998 bytes, lines 14055-14137
14055
14056  if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
14057  else { node.arguments = empty; }
14058  return this.finishNode(node, "NewExpression")
14059};
14060
14061// Parse template expression.
14062
14063pp$5.parseTemplateElement = function(ref) {
14064  var isTagged = ref.isTagged;
14065
14066  var elem = this.startNode();
14067  if (this.type === types$1.invalidTemplate) {
14068    if (!isTagged) {
14069      this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
14070    }
14071    elem.value = {
14072      raw: this.value,
14073      cooked: null
14074    };
14075  } else {
14076    elem.value = {
14077      raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
14078      cooked: this.value
14079    };
14080  }
14081  this.next();
14082  elem.tail = this.type === types$1.backQuote;
14083  return this.finishNode(elem, "TemplateElement")
14084};
14085
14086pp$5.parseTemplate = function(ref) {
14087  if ( ref === void 0 ) ref = {};
14088  var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
14089
14090  var node = this.startNode();
14091  this.next();
14092  node.expressions = [];
14093  var curElt = this.parseTemplateElement({isTagged: isTagged});
14094  node.quasis = [curElt];
14095  while (!curElt.tail) {
14096    if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
14097    this.expect(types$1.dollarBraceL);
14098    node.expressions.push(this.parseExpression());
14099    this.expect(types$1.braceR);
14100    node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
14101  }
14102  this.next();
14103  return this.finishNode(node, "TemplateLiteral")
14104};
14105
14106pp$5.isAsyncProp = function(prop) {
14107  return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
14108    (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&
14109    !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
14110};
14111
14112// Parse an object literal or binding pattern.
14113
14114pp$5.parseObj = function(isPattern, refDestructuringErrors) {
14115  var node = this.startNode(), first = true, propHash = {};
14116  node.properties = [];
14117  this.next();
14118  while (!this.eat(types$1.braceR)) {
14119    if (!first) {
14120      this.expect(types$1.comma);
14121      if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
14122    } else { first = false; }
14123
14124    var prop = this.parseProperty(isPattern, refDestructuringErrors);
14125    if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }
14126    node.properties.push(prop);
14127  }
14128  return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
14129};
14130
14131pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
14132  var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
14133  if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
14134    if (isPattern) {
14135      prop.argument = this.parseIdent(false);
14136      if (this.type === types$1.comma) {
14137        this.raise
vendor: 2,810 bytes, lines 14137-14200
14137(this.start, "Comma is not permitted after the rest element");
14138      }
14139      return this.finishNode(prop, "RestElement")
14140    }
14141    // Parse argument.
14142    prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
14143    // To disallow trailing comma via `this.toAssignable()`.
14144    if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
14145      refDestructuringErrors.trailingComma = this.start;
14146    }
14147    // Finish
14148    return this.finishNode(prop, "SpreadElement")
14149  }
14150  if (this.options.ecmaVersion >= 6) {
14151    prop.method = false;
14152    prop.shorthand = false;
14153    if (isPattern || refDestructuringErrors) {
14154      startPos = this.start;
14155      startLoc = this.startLoc;
14156    }
14157    if (!isPattern)
14158      { isGenerator = this.eat(types$1.star); }
14159  }
14160  var containsEsc = this.containsEsc;
14161  this.parsePropertyName(prop);
14162  if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
14163    isAsync = true;
14164    isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
14165    this.parsePropertyName(prop, refDestructuringErrors);
14166  } else {
14167    isAsync = false;
14168  }
14169  this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
14170  return this.finishNode(prop, "Property")
14171};
14172
14173pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
14174  if ((isGenerator || isAsync) && this.type === types$1.colon)
14175    { this.unexpected(); }
14176
14177  if (this.eat(types$1.colon)) {
14178    prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
14179    prop.kind = "init";
14180  } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
14181    if (isPattern) { this.unexpected(); }
14182    prop.kind = "init";
14183    prop.method = true;
14184    prop.value = this.parseMethod(isGenerator, isAsync);
14185  } else if (!isPattern && !containsEsc &&
14186             this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
14187             (prop.key.name === "get" || prop.key.name === "set") &&
14188             (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
14189    if (isGenerator || isAsync) { this.unexpected(); }
14190    prop.kind = prop.key.name;
14191    this.parsePropertyName(prop);
14192    prop.value = this.parseMethod(false);
14193    var paramCount = prop.kind === "get" ? 0 : 1;
14194    if (prop.value.params.length !== paramCount) {
14195      var start = prop.value.start;
14196      if (prop.kind === "get")
14197        { this.raiseRecoverable(start, "getter should have no params"); }
14198      else
14199        { this.raiseRecoverable(start, "setter should have exactly one param"); }
14200    } else {
vendor: 17,100 bytes, lines 14201-14662
14201      if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
14202        { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
14203    }
14204  } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
14205    if (isGenerator || isAsync) { this.unexpected(); }
14206    this.checkUnreserved(prop.key);
14207    if (prop.key.name === "await" && !this.awaitIdentPos)
14208      { this.awaitIdentPos = startPos; }
14209    prop.kind = "init";
14210    if (isPattern) {
14211      prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
14212    } else if (this.type === types$1.eq && refDestructuringErrors) {
14213      if (refDestructuringErrors.shorthandAssign < 0)
14214        { refDestructuringErrors.shorthandAssign = this.start; }
14215      prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
14216    } else {
14217      prop.value = this.copyNode(prop.key);
14218    }
14219    prop.shorthand = true;
14220  } else { this.unexpected(); }
14221};
14222
14223pp$5.parsePropertyName = function(prop) {
14224  if (this.options.ecmaVersion >= 6) {
14225    if (this.eat(types$1.bracketL)) {
14226      prop.computed = true;
14227      prop.key = this.parseMaybeAssign();
14228      this.expect(types$1.bracketR);
14229      return prop.key
14230    } else {
14231      prop.computed = false;
14232    }
14233  }
14234  return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
14235};
14236
14237// Initialize empty function node.
14238
14239pp$5.initFunction = function(node) {
14240  node.id = null;
14241  if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
14242  if (this.options.ecmaVersion >= 8) { node.async = false; }
14243};
14244
14245// Parse object or class method.
14246
14247pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
14248  var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
14249
14250  this.initFunction(node);
14251  if (this.options.ecmaVersion >= 6)
14252    { node.generator = isGenerator; }
14253  if (this.options.ecmaVersion >= 8)
14254    { node.async = !!isAsync; }
14255
14256  this.yieldPos = 0;
14257  this.awaitPos = 0;
14258  this.awaitIdentPos = 0;
14259  this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
14260
14261  this.expect(types$1.parenL);
14262  node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
14263  this.checkYieldAwaitInDefaultParams();
14264  this.parseFunctionBody(node, false, true, false);
14265
14266  this.yieldPos = oldYieldPos;
14267  this.awaitPos = oldAwaitPos;
14268  this.awaitIdentPos = oldAwaitIdentPos;
14269  return this.finishNode(node, "FunctionExpression")
14270};
14271
14272// Parse arrow function expression with given parameters.
14273
14274pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
14275  var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
14276
14277  this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
14278  this.initFunction(node);
14279  if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }
14280
14281  this.yieldPos = 0;
14282  this.awaitPos = 0;
14283  this.awaitIdentPos = 0;
14284
14285  node.params = this.toAssignableList(params, true);
14286  this.parseFunctionBody(node, true, false, forInit);
14287
14288  this.yieldPos = oldYieldPos;
14289  this.awaitPos = oldAwaitPos;
14290  this.awaitIdentPos = oldAwaitIdentPos;
14291  return this.finishNode(node, "ArrowFunctionExpression")
14292};
14293
14294// Parse function body and check parameters.
14295
14296pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
14297  var isExpression = isArrowFunction && this.type !== types$1.braceL;
14298  var oldStrict = this.strict, useStrict = false;
14299
14300  if (isExpression) {
14301    node.body = this.parseMaybeAssign(forInit);
14302    node.expression = true;
14303    this.checkParams(node, false);
14304  } else {
14305    var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
14306    if (!oldStrict || nonSimple) {
14307      useStrict = this.strictDirective(this.end);
14308      // If this is a strict mode function, verify that argument names
14309      // are not repeated, and it does not try to bind the words `eval`
14310      // or `arguments`.
14311      if (useStrict && nonSimple)
14312        { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); }
14313    }
14314    // Start a new scope with regard to labels and the `inFunction`
14315    // flag (restore them to their old value afterwards).
14316    var oldLabels = this.labels;
14317    this.labels = [];
14318    if (useStrict) { this.strict = true; }
14319
14320    // Add the params to varDeclaredNames to ensure that an error is thrown
14321    // if a let/const declaration in the function clashes with one of the params.
14322    this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
14323    // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
14324    if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); }
14325    node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
14326    node.expression = false;
14327    this.adaptDirectivePrologue(node.body.body);
14328    this.labels = oldLabels;
14329  }
14330  this.exitScope();
14331};
14332
14333pp$5.isSimpleParamList = function(params) {
14334  for (var i = 0, list = params; i < list.length; i += 1)
14335    {
14336    var param = list[i];
14337
14338    if (param.type !== "Identifier") { return false
14339  } }
14340  return true
14341};
14342
14343// Checks function params for various disallowed patterns such as using "eval"
14344// or "arguments" and duplicate parameters.
14345
14346pp$5.checkParams = function(node, allowDuplicates) {
14347  var nameHash = Object.create(null);
14348  for (var i = 0, list = node.params; i < list.length; i += 1)
14349    {
14350    var param = list[i];
14351
14352    this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
14353  }
14354};
14355
14356// Parses a comma-separated list of expressions, and returns them as
14357// an array. `close` is the token type that ends the list, and
14358// `allowEmpty` can be turned on to allow subsequent commas with
14359// nothing in between them to be parsed as `null` (which is needed
14360// for array literals).
14361
14362pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
14363  var elts = [], first = true;
14364  while (!this.eat(close)) {
14365    if (!first) {
14366      this.expect(types$1.comma);
14367      if (allowTrailingComma && this.afterTrailingComma(close)) { break }
14368    } else { first = false; }
14369
14370    var elt = (void 0);
14371    if (allowEmpty && this.type === types$1.comma)
14372      { elt = null; }
14373    else if (this.type === types$1.ellipsis) {
14374      elt = this.parseSpread(refDestructuringErrors);
14375      if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
14376        { refDestructuringErrors.trailingComma = this.start; }
14377    } else {
14378      elt = this.parseMaybeAssign(false, refDestructuringErrors);
14379    }
14380    elts.push(elt);
14381  }
14382  return elts
14383};
14384
14385pp$5.checkUnreserved = function(ref) {
14386  var start = ref.start;
14387  var end = ref.end;
14388  var name = ref.name;
14389
14390  if (this.inGenerator && name === "yield")
14391    { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
14392  if (this.inAsync && name === "await")
14393    { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
14394  if (this.currentThisScope().inClassFieldInit && name === "arguments")
14395    { this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
14396  if (this.inClassStaticBlock && (name === "arguments" || name === "await"))
14397    { this.raise(start, ("Cannot use " + name + " in class static initialization block")); }
14398  if (this.keywords.test(name))
14399    { this.raise(start, ("Unexpected keyword '" + name + "'")); }
14400  if (this.options.ecmaVersion < 6 &&
14401    this.input.slice(start, end).indexOf("\\") !== -1) { return }
14402  var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
14403  if (re.test(name)) {
14404    if (!this.inAsync && name === "await")
14405      { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); }
14406    this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved"));
14407  }
14408};
14409
14410// Parse the next token as an identifier. If `liberal` is true (used
14411// when parsing properties), it will also convert keywords into
14412// identifiers.
14413
14414pp$5.parseIdent = function(liberal, isBinding) {
14415  var node = this.startNode();
14416  if (this.type === types$1.name) {
14417    node.name = this.value;
14418  } else if (this.type.keyword) {
14419    node.name = this.type.keyword;
14420
14421    // To fix https://github.com/acornjs/acorn/issues/575
14422    // `class` and `function` keywords push new context into this.context.
14423    // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
14424    // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
14425    if ((node.name === "class" || node.name === "function") &&
14426        (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
14427      this.context.pop();
14428    }
14429  } else {
14430    this.unexpected();
14431  }
14432  this.next(!!liberal);
14433  this.finishNode(node, "Identifier");
14434  if (!liberal) {
14435    this.checkUnreserved(node);
14436    if (node.name === "await" && !this.awaitIdentPos)
14437      { this.awaitIdentPos = node.start; }
14438  }
14439  return node
14440};
14441
14442pp$5.parsePrivateIdent = function() {
14443  var node = this.startNode();
14444  if (this.type === types$1.privateId) {
14445    node.name = this.value;
14446  } else {
14447    this.unexpected();
14448  }
14449  this.next();
14450  this.finishNode(node, "PrivateIdentifier");
14451
14452  // For validating existence
14453  if (this.privateNameStack.length === 0) {
14454    this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
14455  } else {
14456    this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
14457  }
14458
14459  return node
14460};
14461
14462// Parses yield expression inside generator.
14463
14464pp$5.parseYield = function(forInit) {
14465  if (!this.yieldPos) { this.yieldPos = this.start; }
14466
14467  var node = this.startNode();
14468  this.next();
14469  if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
14470    node.delegate = false;
14471    node.argument = null;
14472  } else {
14473    node.delegate = this.eat(types$1.star);
14474    node.argument = this.parseMaybeAssign(forInit);
14475  }
14476  return this.finishNode(node, "YieldExpression")
14477};
14478
14479pp$5.parseAwait = function(forInit) {
14480  if (!this.awaitPos) { this.awaitPos = this.start; }
14481
14482  var node = this.startNode();
14483  this.next();
14484  node.argument = this.parseMaybeUnary(null, true, false, forInit);
14485  return this.finishNode(node, "AwaitExpression")
14486};
14487
14488var pp$4 = Parser.prototype;
14489
14490// This function is used to raise exceptions on parse errors. It
14491// takes an offset integer (into the current `input`) to indicate
14492// the location of the error, attaches the position to the end
14493// of the error message, and then raises a `SyntaxError` with that
14494// message.
14495
14496pp$4.raise = function(pos, message) {
14497  var loc = getLineInfo(this.input, pos);
14498  message += " (" + loc.line + ":" + loc.column + ")";
14499  var err = new SyntaxError(message);
14500  err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
14501  throw err
14502};
14503
14504pp$4.raiseRecoverable = pp$4.raise;
14505
14506pp$4.curPosition = function() {
14507  if (this.options.locations) {
14508    return new Position(this.curLine, this.pos - this.lineStart)
14509  }
14510};
14511
14512var pp$3 = Parser.prototype;
14513
14514var Scope = function Scope(flags) {
14515  this.flags = flags;
14516  // A list of var-declared names in the current lexical scope
14517  this.var = [];
14518  // A list of lexically-declared names in the current lexical scope
14519  this.lexical = [];
14520  // A list of lexically-declared FunctionDeclaration names in the current lexical scope
14521  this.functions = [];
14522  // A switch to disallow the identifier reference 'arguments'
14523  this.inClassFieldInit = false;
14524};
14525
14526// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
14527
14528pp$3.enterScope = function(flags) {
14529  this.scopeStack.push(new Scope(flags));
14530};
14531
14532pp$3.exitScope = function() {
14533  this.scopeStack.pop();
14534};
14535
14536// The spec says:
14537// > At the top level of a function, or script, function declarations are
14538// > treated like var declarations rather than like lexical declarations.
14539pp$3.treatFunctionsAsVarInScope = function(scope) {
14540  return (scope.flags & SCOPE_FUNCTION$1) || !this.inModule && (scope.flags & SCOPE_TOP)
14541};
14542
14543pp$3.declareName = function(name, bindingType, pos) {
14544  var redeclared = false;
14545  if (bindingType === BIND_LEXICAL) {
14546    var scope = this.currentScope();
14547    redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
14548    scope.lexical.push(name);
14549    if (this.inModule && (scope.flags & SCOPE_TOP))
14550      { delete this.undefinedExports[name]; }
14551  } else if (bindingType === BIND_SIMPLE_CATCH) {
14552    var scope$1 = this.currentScope();
14553    scope$1.lexical.push(name);
14554  } else if (bindingType === BIND_FUNCTION) {
14555    var scope$2 = this.currentScope();
14556    if (this.treatFunctionsAsVar)
14557      { redeclared = scope$2.lexical.indexOf(name) > -1; }
14558    else
14559      { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }
14560    scope$2.functions.push(name);
14561  } else {
14562    for (var i = this.scopeStack.length - 1; i >= 0; --i) {
14563      var scope$3 = this.scopeStack[i];
14564      if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
14565          !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
14566        redeclared = true;
14567        break
14568      }
14569      scope$3.var.push(name);
14570      if (this.inModule && (scope$3.flags & SCOPE_TOP))
14571        { delete this.undefinedExports[name]; }
14572      if (scope$3.flags & SCOPE_VAR) { break }
14573    }
14574  }
14575  if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
14576};
14577
14578pp$3.checkLocalExport = function(id) {
14579  // scope.functions must be empty as Module code is always strict.
14580  if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
14581      this.scopeStack[0].var.indexOf(id.name) === -1) {
14582    this.undefinedExports[id.name] = id;
14583  }
14584};
14585
14586pp$3.currentScope = function() {
14587  return this.scopeStack[this.scopeStack.length - 1]
14588};
14589
14590pp$3.currentVarScope = function() {
14591  for (var i = this.scopeStack.length - 1;; i--) {
14592    var scope = this.scopeStack[i];
14593    if (scope.flags & SCOPE_VAR) { return scope }
14594  }
14595};
14596
14597// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
14598pp$3.currentThisScope = function() {
14599  for (var i = this.scopeStack.length - 1;; i--) {
14600    var scope = this.scopeStack[i];
14601    if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
14602  }
14603};
14604
14605var Node$1 = function Node(parser, pos, loc) {
14606  this.type = "";
14607  this.start = pos;
14608  this.end = 0;
14609  if (parser.options.locations)
14610    { this.loc = new SourceLocation(parser, loc); }
14611  if (parser.options.directSourceFile)
14612    { this.sourceFile = parser.options.directSourceFile; }
14613  if (parser.options.ranges)
14614    { this.range = [pos, 0]; }
14615};
14616
14617// Start an AST node, attaching a start offset.
14618
14619var pp$2 = Parser.prototype;
14620
14621pp$2.startNode = function() {
14622  return new Node$1(this, this.start, this.startLoc)
14623};
14624
14625pp$2.startNodeAt = function(pos, loc) {
14626  return new Node$1(this, pos, loc)
14627};
14628
14629// Finish an AST node, adding `type` and `end` properties.
14630
14631function finishNodeAt(node, type, pos, loc) {
14632  node.type = type;
14633  node.end = pos;
14634  if (this.options.locations)
14635    { node.loc.end = loc; }
14636  if (this.options.ranges)
14637    { node.range[1] = pos; }
14638  return node
14639}
14640
14641pp$2.finishNode = function(node, type) {
14642  return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
14643};
14644
14645// Finish node at given position
14646
14647pp$2.finishNodeAt = function(node, type, pos, loc) {
14648  return finishNodeAt.call(this, node, type, pos, loc)
14649};
14650
14651pp$2.copyNode = function(node) {
14652  var newNode = new Node$1(this, node.start, this.startLoc);
14653  for (var prop in node) { newNode[prop] = node[prop]; }
14654  return newNode
14655};
14656
14657// This file contains Unicode properties extracted from the ECMAScript
14658// specification. The lists are extracted like so:
14659// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
14660
14661// #table-binary-unicode-properties
14662var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE L
14662owercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
14663var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
14664var ecma11BinaryProperties = ecma10BinaryProperties;
14665var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
14666var ecma13BinaryProperties = ecma12BinaryProperties;
14667var unicodeBinaryProperties = {
14668  9: ecma9BinaryProperties,
14669  10: ecma10BinaryProperties,
14670  11: ecma11BinaryProperties,
14671  12: ecma12BinaryProperties,
14672  13: ecma13BinaryProperties
14673};
14674
14675// #table-unicode-general-category-values
14676var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
14677
14678// #table-unicode-script-values
14679var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
14680var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
14681var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
14682var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
14683var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
14684var unicodeScriptValues = {
14685  9: ecma9ScriptValues,
14686  10: ecma10ScriptValues,
14687  11: ecma11ScriptValues,
14688  12: ecma12ScriptValues,
14689  13: ecma13ScriptValues
14690};
14691
14692var data = {};
14693function buildUnicodeData(ecmaVersion) {
14694  var d = data[ecmaVersion] = {
14695    binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
14696    nonBinary: {
14697      General_Category: wordsRegexp(unicodeGeneralCategoryValues),
14698      Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
14699    }
14700  };
14701  d.nonBinary.Script_Extensions = d.nonBinary.Script;
14702
14703  d.nonBinary.gc = d.nonBinary.General_Category;
14704  d.nonBinary.sc = d.nonBinary.Script;
14705  d.nonBinary.scx = d.nonBinary.Script_Extensions;
14706}
14707
14708for (var i = 0, list = [9, 10, 11, 12, 13]; i < list.length; i += 1) {
14709  var ecmaVersion = list[i];
14710
14711  buildUnicodeData(ecmaVersion);
14712}
14713
14714var pp$1 = Parser.prototype;
14715
14716var RegExpValidationState = function RegExpValidationState(parser) {
14717  this.parser = parser;
14718  this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
14719  this.unicodeProperties = data[parser.options.ecmaVersion >= 13 ? 13 : parser.options.ecmaVersion];
14720  this.source = "";
14721  this.flags = "";
14722  this.start = 0;
14723  this.switchU = false;
vendor: 3,094 bytes, lines 14724-14827
14724  this.switchN = false;
14725  this.pos = 0;
14726  this.lastIntValue = 0;
14727  this.lastStringValue = "";
14728  this.lastAssertionIsQuantifiable = false;
14729  this.numCapturingParens = 0;
14730  this.maxBackReference = 0;
14731  this.groupNames = [];
14732  this.backReferenceNames = [];
14733};
14734
14735RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
14736  var unicode = flags.indexOf("u") !== -1;
14737  this.start = start | 0;
14738  this.source = pattern + "";
14739  this.flags = flags;
14740  this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
14741  this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
14742};
14743
14744RegExpValidationState.prototype.raise = function raise (message) {
14745  this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message));
14746};
14747
14748// If u flag is given, this returns the code point at the index (it combines a surrogate pair).
14749// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
14750RegExpValidationState.prototype.at = function at (i, forceU) {
14751    if ( forceU === void 0 ) forceU = false;
14752
14753  var s = this.source;
14754  var l = s.length;
14755  if (i >= l) {
14756    return -1
14757  }
14758  var c = s.charCodeAt(i);
14759  if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
14760    return c
14761  }
14762  var next = s.charCodeAt(i + 1);
14763  return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c
14764};
14765
14766RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {
14767    if ( forceU === void 0 ) forceU = false;
14768
14769  var s = this.source;
14770  var l = s.length;
14771  if (i >= l) {
14772    return l
14773  }
14774  var c = s.charCodeAt(i), next;
14775  if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
14776      (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
14777    return i + 1
14778  }
14779  return i + 2
14780};
14781
14782RegExpValidationState.prototype.current = function current (forceU) {
14783    if ( forceU === void 0 ) forceU = false;
14784
14785  return this.at(this.pos, forceU)
14786};
14787
14788RegExpValidationState.prototype.lookahead = function lookahead (forceU) {
14789    if ( forceU === void 0 ) forceU = false;
14790
14791  return this.at(this.nextIndex(this.pos, forceU), forceU)
14792};
14793
14794RegExpValidationState.prototype.advance = function advance (forceU) {
14795    if ( forceU === void 0 ) forceU = false;
14796
14797  this.pos = this.nextIndex(this.pos, forceU);
14798};
14799
14800RegExpValidationState.prototype.eat = function eat (ch, forceU) {
14801    if ( forceU === void 0 ) forceU = false;
14802
14803  if (this.current(forceU) === ch) {
14804    this.advance(forceU);
14805    return true
14806  }
14807  return false
14808};
14809
14810/**
14811 * Validate the flags part of a given RegExpLiteral.
14812 *
14813 * @param {RegExpValidationState} state The state to validate RegExp.
14814 * @returns {void}
14815 */
14816pp$1.validateRegExpFlags = function(state) {
14817  var validFlags = state.validFlags;
14818  var flags = state.flags;
14819
14820  for (var i = 0; i < flags.length; i++) {
14821    var flag = flags.charAt(i);
14822    if (validFlags.indexOf(flag) === -1) {
14823      this.raise(state.start, "Invalid regular expression flag");
14824    }
14825    if (flags.indexOf(flag, i + 1) > -1) {
14826      this.raise(state.start, "Duplicate regular expression flag");
14827    }
vendor: 17,384 bytes, lines 14827-15446
14827
14828  }
14829};
14830
14831/**
14832 * Validate the pattern part of a given RegExpLiteral.
14833 *
14834 * @param {RegExpValidationState} state The state to validate RegExp.
14835 * @returns {void}
14836 */
14837pp$1.validateRegExpPattern = function(state) {
14838  this.regexp_pattern(state);
14839
14840  // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
14841  // parsing contains a |GroupName|, reparse with the goal symbol
14842  // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
14843  // exception if _P_ did not conform to the grammar, if any elements of _P_
14844  // were not matched by the parse, or if any Early Error conditions exist.
14845  if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
14846    state.switchN = true;
14847    this.regexp_pattern(state);
14848  }
14849};
14850
14851// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
14852pp$1.regexp_pattern = function(state) {
14853  state.pos = 0;
14854  state.lastIntValue = 0;
14855  state.lastStringValue = "";
14856  state.lastAssertionIsQuantifiable = false;
14857  state.numCapturingParens = 0;
14858  state.maxBackReference = 0;
14859  state.groupNames.length = 0;
14860  state.backReferenceNames.length = 0;
14861
14862  this.regexp_disjunction(state);
14863
14864  if (state.pos !== state.source.length) {
14865    // Make the same messages as V8.
14866    if (state.eat(0x29 /* ) */)) {
14867      state.raise("Unmatched ')'");
14868    }
14869    if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
14870      state.raise("Lone quantifier brackets");
14871    }
14872  }
14873  if (state.maxBackReference > state.numCapturingParens) {
14874    state.raise("Invalid escape");
14875  }
14876  for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
14877    var name = list[i];
14878
14879    if (state.groupNames.indexOf(name) === -1) {
14880      state.raise("Invalid named capture referenced");
14881    }
14882  }
14883};
14884
14885// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
14886pp$1.regexp_disjunction = function(state) {
14887  this.regexp_alternative(state);
14888  while (state.eat(0x7C /* | */)) {
14889    this.regexp_alternative(state);
14890  }
14891
14892  // Make the same message as V8.
14893  if (this.regexp_eatQuantifier(state, true)) {
14894    state.raise("Nothing to repeat");
14895  }
14896  if (state.eat(0x7B /* { */)) {
14897    state.raise("Lone quantifier brackets");
14898  }
14899};
14900
14901// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
14902pp$1.regexp_alternative = function(state) {
14903  while (state.pos < state.source.length && this.regexp_eatTerm(state))
14904    { }
14905};
14906
14907// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
14908pp$1.regexp_eatTerm = function(state) {
14909  if (this.regexp_eatAssertion(state)) {
14910    // Handle `QuantifiableAssertion Quantifier` alternative.
14911    // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
14912    // is a QuantifiableAssertion.
14913    if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
14914      // Make the same message as V8.
14915      if (state.switchU) {
14916        state.raise("Invalid quantifier");
14917      }
14918    }
14919    return true
14920  }
14921
14922  if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
14923    this.regexp_eatQuantifier(state);
14924    return true
14925  }
14926
14927  return false
14928};
14929
14930// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
14931pp$1.regexp_eatAssertion = function(state) {
14932  var start = state.pos;
14933  state.lastAssertionIsQuantifiable = false;
14934
14935  // ^, $
14936  if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
14937    return true
14938  }
14939
14940  // \b \B
14941  if (state.eat(0x5C /* \ */)) {
14942    if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
14943      return true
14944    }
14945    state.pos = start;
14946  }
14947
14948  // Lookahead / Lookbehind
14949  if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
14950    var lookbehind = false;
14951    if (this.options.ecmaVersion >= 9) {
14952      lookbehind = state.eat(0x3C /* < */);
14953    }
14954    if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
14955      this.regexp_disjunction(state);
14956      if (!state.eat(0x29 /* ) */)) {
14957        state.raise("Unterminated group");
14958      }
14959      state.lastAssertionIsQuantifiable = !lookbehind;
14960      return true
14961    }
14962  }
14963
14964  state.pos = start;
14965  return false
14966};
14967
14968// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
14969pp$1.regexp_eatQuantifier = function(state, noError) {
14970  if ( noError === void 0 ) noError = false;
14971
14972  if (this.regexp_eatQuantifierPrefix(state, noError)) {
14973    state.eat(0x3F /* ? */);
14974    return true
14975  }
14976  return false
14977};
14978
14979// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
14980pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
14981  return (
14982    state.eat(0x2A /* * */) ||
14983    state.eat(0x2B /* + */) ||
14984    state.eat(0x3F /* ? */) ||
14985    this.regexp_eatBracedQuantifier(state, noError)
14986  )
14987};
14988pp$1.regexp_eatBracedQuantifier = function(state, noError) {
14989  var start = state.pos;
14990  if (state.eat(0x7B /* { */)) {
14991    var min = 0, max = -1;
14992    if (this.regexp_eatDecimalDigits(state)) {
14993      min = state.lastIntValue;
14994      if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
14995        max = state.lastIntValue;
14996      }
14997      if (state.eat(0x7D /* } */)) {
14998        // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
14999        if (max !== -1 && max < min && !noError) {
15000          state.raise("numbers out of order in {} quantifier");
15001        }
15002        return true
15003      }
15004    }
15005    if (state.switchU && !noError) {
15006      state.raise("Incomplete quantifier");
15007    }
15008    state.pos = start;
15009  }
15010  return false
15011};
15012
15013// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
15014pp$1.regexp_eatAtom = function(state) {
15015  return (
15016    this.regexp_eatPatternCharacters(state) ||
15017    state.eat(0x2E /* . */) ||
15018    this.regexp_eatReverseSolidusAtomEscape(state) ||
15019    this.regexp_eatCharacterClass(state) ||
15020    this.regexp_eatUncapturingGroup(state) ||
15021    this.regexp_eatCapturingGroup(state)
15022  )
15023};
15024pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
15025  var start = state.pos;
15026  if (state.eat(0x5C /* \ */)) {
15027    if (this.regexp_eatAtomEscape(state)) {
15028      return true
15029    }
15030    state.pos = start;
15031  }
15032  return false
15033};
15034pp$1.regexp_eatUncapturingGroup = function(state) {
15035  var start = state.pos;
15036  if (state.eat(0x28 /* ( */)) {
15037    if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
15038      this.regexp_disjunction(state);
15039      if (state.eat(0x29 /* ) */)) {
15040        return true
15041      }
15042      state.raise("Unterminated group");
15043    }
15044    state.pos = start;
15045  }
15046  return false
15047};
15048pp$1.regexp_eatCapturingGroup = function(state) {
15049  if (state.eat(0x28 /* ( */)) {
15050    if (this.options.ecmaVersion >= 9) {
15051      this.regexp_groupSpecifier(state);
15052    } else if (state.current() === 0x3F /* ? */) {
15053      state.raise("Invalid group");
15054    }
15055    this.regexp_disjunction(state);
15056    if (state.eat(0x29 /* ) */)) {
15057      state.numCapturingParens += 1;
15058      return true
15059    }
15060    state.raise("Unterminated group");
15061  }
15062  return false
15063};
15064
15065// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
15066pp$1.regexp_eatExtendedAtom = function(state) {
15067  return (
15068    state.eat(0x2E /* . */) ||
15069    this.regexp_eatReverseSolidusAtomEscape(state) ||
15070    this.regexp_eatCharacterClass(state) ||
15071    this.regexp_eatUncapturingGroup(state) ||
15072    this.regexp_eatCapturingGroup(state) ||
15073    this.regexp_eatInvalidBracedQuantifier(state) ||
15074    this.regexp_eatExtendedPatternCharacter(state)
15075  )
15076};
15077
15078// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
15079pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
15080  if (this.regexp_eatBracedQuantifier(state, true)) {
15081    state.raise("Nothing to repeat");
15082  }
15083  return false
15084};
15085
15086// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
15087pp$1.regexp_eatSyntaxCharacter = function(state) {
15088  var ch = state.current();
15089  if (isSyntaxCharacter(ch)) {
15090    state.lastIntValue = ch;
15091    state.advance();
15092    return true
15093  }
15094  return false
15095};
15096function isSyntaxCharacter(ch) {
15097  return (
15098    ch === 0x24 /* $ */ ||
15099    ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||
15100    ch === 0x2E /* . */ ||
15101    ch === 0x3F /* ? */ ||
15102    ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||
15103    ch >= 0x7B /* { */ && ch <= 0x7D /* } */
15104  )
15105}
15106
15107// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
15108// But eat eager.
15109pp$1.regexp_eatPatternCharacters = function(state) {
15110  var start = state.pos;
15111  var ch = 0;
15112  while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
15113    state.advance();
15114  }
15115  return state.pos !== start
15116};
15117
15118// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
15119pp$1.regexp_eatExtendedPatternCharacter = function(state) {
15120  var ch = state.current();
15121  if (
15122    ch !== -1 &&
15123    ch !== 0x24 /* $ */ &&
15124    !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&
15125    ch !== 0x2E /* . */ &&
15126    ch !== 0x3F /* ? */ &&
15127    ch !== 0x5B /* [ */ &&
15128    ch !== 0x5E /* ^ */ &&
15129    ch !== 0x7C /* | */
15130  ) {
15131    state.advance();
15132    return true
15133  }
15134  return false
15135};
15136
15137// GroupSpecifier ::
15138//   [empty]
15139//   `?` GroupName
15140pp$1.regexp_groupSpecifier = function(state) {
15141  if (state.eat(0x3F /* ? */)) {
15142    if (this.regexp_eatGroupName(state)) {
15143      if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
15144        state.raise("Duplicate capture group name");
15145      }
15146      state.groupNames.push(state.lastStringValue);
15147      return
15148    }
15149    state.raise("Invalid group");
15150  }
15151};
15152
15153// GroupName ::
15154//   `<` RegExpIdentifierName `>`
15155// Note: this updates `state.lastStringValue` property with the eaten name.
15156pp$1.regexp_eatGroupName = function(state) {
15157  state.lastStringValue = "";
15158  if (state.eat(0x3C /* < */)) {
15159    if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
15160      return true
15161    }
15162    state.raise("Invalid capture group name");
15163  }
15164  return false
15165};
15166
15167// RegExpIdentifierName ::
15168//   RegExpIdentifierStart
15169//   RegExpIdentifierName RegExpIdentifierPart
15170// Note: this updates `state.lastStringValue` property with the eaten name.
15171pp$1.regexp_eatRegExpIdentifierName = function(state) {
15172  state.lastStringValue = "";
15173  if (this.regexp_eatRegExpIdentifierStart(state)) {
15174    state.lastStringValue += codePointToString(state.lastIntValue);
15175    while (this.regexp_eatRegExpIdentifierPart(state)) {
15176      state.lastStringValue += codePointToString(state.lastIntValue);
15177    }
15178    return true
15179  }
15180  return false
15181};
15182
15183// RegExpIdentifierStart ::
15184//   UnicodeIDStart
15185//   `$`
15186//   `_`
15187//   `\` RegExpUnicodeEscapeSequence[+U]
15188pp$1.regexp_eatRegExpIdentifierStart = function(state) {
15189  var start = state.pos;
15190  var forceU = this.options.ecmaVersion >= 11;
15191  var ch = state.current(forceU);
15192  state.advance(forceU);
15193
15194  if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
15195    ch = state.lastIntValue;
15196  }
15197  if (isRegExpIdentifierStart(ch)) {
15198    state.lastIntValue = ch;
15199    return true
15200  }
15201
15202  state.pos = start;
15203  return false
15204};
15205function isRegExpIdentifierStart(ch) {
15206  return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */
15207}
15208
15209// RegExpIdentifierPart ::
15210//   UnicodeIDContinue
15211//   `$`
15212//   `_`
15213//   `\` RegExpUnicodeEscapeSequence[+U]
15214//   <ZWNJ>
15215//   <ZWJ>
15216pp$1.regexp_eatRegExpIdentifierPart = function(state) {
15217  var start = state.pos;
15218  var forceU = this.options.ecmaVersion >= 11;
15219  var ch = state.current(forceU);
15220  state.advance(forceU);
15221
15222  if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
15223    ch = state.lastIntValue;
15224  }
15225  if (isRegExpIdentifierPart(ch)) {
15226    state.lastIntValue = ch;
15227    return true
15228  }
15229
15230  state.pos = start;
15231  return false
15232};
15233function isRegExpIdentifierPart(ch) {
15234  return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D /* <ZWJ> */
15235}
15236
15237// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
15238pp$1.regexp_eatAtomEscape = function(state) {
15239  if (
15240    this.regexp_eatBackReference(state) ||
15241    this.regexp_eatCharacterClassEscape(state) ||
15242    this.regexp_eatCharacterEscape(state) ||
15243    (state.switchN && this.regexp_eatKGroupName(state))
15244  ) {
15245    return true
15246  }
15247  if (state.switchU) {
15248    // Make the same message as V8.
15249    if (state.current() === 0x63 /* c */) {
15250      state.raise("Invalid unicode escape");
15251    }
15252    state.raise("Invalid escape");
15253  }
15254  return false
15255};
15256pp$1.regexp_eatBackReference = function(state) {
15257  var start = state.pos;
15258  if (this.regexp_eatDecimalEscape(state)) {
15259    var n = state.lastIntValue;
15260    if (state.switchU) {
15261      // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
15262      if (n > state.maxBackReference) {
15263        state.maxBackReference = n;
15264      }
15265      return true
15266    }
15267    if (n <= state.numCapturingParens) {
15268      return true
15269    }
15270    state.pos = start;
15271  }
15272  return false
15273};
15274pp$1.regexp_eatKGroupName = function(state) {
15275  if (state.eat(0x6B /* k */)) {
15276    if (this.regexp_eatGroupName(state)) {
15277      state.backReferenceNames.push(state.lastStringValue);
15278      return true
15279    }
15280    state.raise("Invalid named reference");
15281  }
15282  return false
15283};
15284
15285// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
15286pp$1.regexp_eatCharacterEscape = function(state) {
15287  return (
15288    this.regexp_eatControlEscape(state) ||
15289    this.regexp_eatCControlLetter(state) ||
15290    this.regexp_eatZero(state) ||
15291    this.regexp_eatHexEscapeSequence(state) ||
15292    this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||
15293    (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
15294    this.regexp_eatIdentityEscape(state)
15295  )
15296};
15297pp$1.regexp_eatCControlLetter = function(state) {
15298  var start = state.pos;
15299  if (state.eat(0x63 /* c */)) {
15300    if (this.regexp_eatControlLetter(state)) {
15301      return true
15302    }
15303    state.pos = start;
15304  }
15305  return false
15306};
15307pp$1.regexp_eatZero = function(state) {
15308  if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
15309    state.lastIntValue = 0;
15310    state.advance();
15311    return true
15312  }
15313  return false
15314};
15315
15316// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
15317pp$1.regexp_eatControlEscape = function(state) {
15318  var ch = state.current();
15319  if (ch === 0x74 /* t */) {
15320    state.lastIntValue = 0x09; /* \t */
15321    state.advance();
15322    return true
15323  }
15324  if (ch === 0x6E /* n */) {
15325    state.lastIntValue = 0x0A; /* \n */
15326    state.advance();
15327    return true
15328  }
15329  if (ch === 0x76 /* v */) {
15330    state.lastIntValue = 0x0B; /* \v */
15331    state.advance();
15332    return true
15333  }
15334  if (ch === 0x66 /* f */) {
15335    state.lastIntValue = 0x0C; /* \f */
15336    state.advance();
15337    return true
15338  }
15339  if (ch === 0x72 /* r */) {
15340    state.lastIntValue = 0x0D; /* \r */
15341    state.advance();
15342    return true
15343  }
15344  return false
15345};
15346
15347// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
15348pp$1.regexp_eatControlLetter = function(state) {
15349  var ch = state.current();
15350  if (isControlLetter(ch)) {
15351    state.lastIntValue = ch % 0x20;
15352    state.advance();
15353    return true
15354  }
15355  return false
15356};
15357function isControlLetter(ch) {
15358  return (
15359    (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||
15360    (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)
15361  )
15362}
15363
15364// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
15365pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
15366  if ( forceU === void 0 ) forceU = false;
15367
15368  var start = state.pos;
15369  var switchU = forceU || state.switchU;
15370
15371  if (state.eat(0x75 /* u */)) {
15372    if (this.regexp_eatFixedHexDigits(state, 4)) {
15373      var lead = state.lastIntValue;
15374      if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
15375        var leadSurrogateEnd = state.pos;
15376        if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
15377          var trail = state.lastIntValue;
15378          if (trail >= 0xDC00 && trail <= 0xDFFF) {
15379            state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
15380            return true
15381          }
15382        }
15383        state.pos = leadSurrogateEnd;
15384        state.lastIntValue = lead;
15385      }
15386      return true
15387    }
15388    if (
15389      switchU &&
15390      state.eat(0x7B /* { */) &&
15391      this.regexp_eatHexDigits(state) &&
15392      state.eat(0x7D /* } */) &&
15393      isValidUnicode(state.lastIntValue)
15394    ) {
15395      return true
15396    }
15397    if (switchU) {
15398      state.raise("Invalid unicode escape");
15399    }
15400    state.pos = start;
15401  }
15402
15403  return false
15404};
15405function isValidUnicode(ch) {
15406  return ch >= 0 && ch <= 0x10FFFF
15407}
15408
15409// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
15410pp$1.regexp_eatIdentityEscape = function(state) {
15411  if (state.switchU) {
15412    if (this.regexp_eatSyntaxCharacter(state)) {
15413      return true
15414    }
15415    if (state.eat(0x2F /* / */)) {
15416      state.lastIntValue = 0x2F; /* / */
15417      return true
15418    }
15419    return false
15420  }
15421
15422  var ch = state.current();
15423  if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
15424    state.lastIntValue = ch;
15425    state.advance();
15426    return true
15427  }
15428
15429  return false
15430};
15431
15432// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
15433pp$1.regexp_eatDecimalEscape = function(state) {
15434  state.lastIntValue = 0;
15435  var ch = state.current();
15436  if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
15437    do {
15438      state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
15439      state.advance();
15440    } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)
15441    return true
15442  }
15443  return false
15444};
15445
15446// 
vendor: 5,826 bytes, lines 15446-15645
15446https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
15447pp$1.regexp_eatCharacterClassEscape = function(state) {
15448  var ch = state.current();
15449
15450  if (isCharacterClassEscape(ch)) {
15451    state.lastIntValue = -1;
15452    state.advance();
15453    return true
15454  }
15455
15456  if (
15457    state.switchU &&
15458    this.options.ecmaVersion >= 9 &&
15459    (ch === 0x50 /* P */ || ch === 0x70 /* p */)
15460  ) {
15461    state.lastIntValue = -1;
15462    state.advance();
15463    if (
15464      state.eat(0x7B /* { */) &&
15465      this.regexp_eatUnicodePropertyValueExpression(state) &&
15466      state.eat(0x7D /* } */)
15467    ) {
15468      return true
15469    }
15470    state.raise("Invalid property name");
15471  }
15472
15473  return false
15474};
15475function isCharacterClassEscape(ch) {
15476  return (
15477    ch === 0x64 /* d */ ||
15478    ch === 0x44 /* D */ ||
15479    ch === 0x73 /* s */ ||
15480    ch === 0x53 /* S */ ||
15481    ch === 0x77 /* w */ ||
15482    ch === 0x57 /* W */
15483  )
15484}
15485
15486// UnicodePropertyValueExpression ::
15487//   UnicodePropertyName `=` UnicodePropertyValue
15488//   LoneUnicodePropertyNameOrValue
15489pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
15490  var start = state.pos;
15491
15492  // UnicodePropertyName `=` UnicodePropertyValue
15493  if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
15494    var name = state.lastStringValue;
15495    if (this.regexp_eatUnicodePropertyValue(state)) {
15496      var value = state.lastStringValue;
15497      this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
15498      return true
15499    }
15500  }
15501  state.pos = start;
15502
15503  // LoneUnicodePropertyNameOrValue
15504  if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
15505    var nameOrValue = state.lastStringValue;
15506    this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
15507    return true
15508  }
15509  return false
15510};
15511pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
15512  if (!hasOwn(state.unicodeProperties.nonBinary, name))
15513    { state.raise("Invalid property name"); }
15514  if (!state.unicodeProperties.nonBinary[name].test(value))
15515    { state.raise("Invalid property value"); }
15516};
15517pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
15518  if (!state.unicodeProperties.binary.test(nameOrValue))
15519    { state.raise("Invalid property name"); }
15520};
15521
15522// UnicodePropertyName ::
15523//   UnicodePropertyNameCharacters
15524pp$1.regexp_eatUnicodePropertyName = function(state) {
15525  var ch = 0;
15526  state.lastStringValue = "";
15527  while (isUnicodePropertyNameCharacter(ch = state.current())) {
15528    state.lastStringValue += codePointToString(ch);
15529    state.advance();
15530  }
15531  return state.lastStringValue !== ""
15532};
15533function isUnicodePropertyNameCharacter(ch) {
15534  return isControlLetter(ch) || ch === 0x5F /* _ */
15535}
15536
15537// UnicodePropertyValue ::
15538//   UnicodePropertyValueCharacters
15539pp$1.regexp_eatUnicodePropertyValue = function(state) {
15540  var ch = 0;
15541  state.lastStringValue = "";
15542  while (isUnicodePropertyValueCharacter(ch = state.current())) {
15543    state.lastStringValue += codePointToString(ch);
15544    state.advance();
15545  }
15546  return state.lastStringValue !== ""
15547};
15548function isUnicodePropertyValueCharacter(ch) {
15549  return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)
15550}
15551
15552// LoneUnicodePropertyNameOrValue ::
15553//   UnicodePropertyValueCharacters
15554pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
15555  return this.regexp_eatUnicodePropertyValue(state)
15556};
15557
15558// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
15559pp$1.regexp_eatCharacterClass = function(state) {
15560  if (state.eat(0x5B /* [ */)) {
15561    state.eat(0x5E /* ^ */);
15562    this.regexp_classRanges(state);
15563    if (state.eat(0x5D /* ] */)) {
15564      return true
15565    }
15566    // Unreachable since it threw "unterminated regular expression" error before.
15567    state.raise("Unterminated character class");
15568  }
15569  return false
15570};
15571
15572// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
15573// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
15574// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
15575pp$1.regexp_classRanges = function(state) {
15576  while (this.regexp_eatClassAtom(state)) {
15577    var left = state.lastIntValue;
15578    if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
15579      var right = state.lastIntValue;
15580      if (state.switchU && (left === -1 || right === -1)) {
15581        state.raise("Invalid character class");
15582      }
15583      if (left !== -1 && right !== -1 && left > right) {
15584        state.raise("Range out of order in character class");
15585      }
15586    }
15587  }
15588};
15589
15590// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
15591// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
15592pp$1.regexp_eatClassAtom = function(state) {
15593  var start = state.pos;
15594
15595  if (state.eat(0x5C /* \ */)) {
15596    if (this.regexp_eatClassEscape(state)) {
15597      return true
15598    }
15599    if (state.switchU) {
15600      // Make the same message as V8.
15601      var ch$1 = state.current();
15602      if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {
15603        state.raise("Invalid class escape");
15604      }
15605      state.raise("Invalid escape");
15606    }
15607    state.pos = start;
15608  }
15609
15610  var ch = state.current();
15611  if (ch !== 0x5D /* ] */) {
15612    state.lastIntValue = ch;
15613    state.advance();
15614    return true
15615  }
15616
15617  return false
15618};
15619
15620// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
15621pp$1.regexp_eatClassEscape = function(state) {
15622  var start = state.pos;
15623
15624  if (state.eat(0x62 /* b */)) {
15625    state.lastIntValue = 0x08; /* <BS> */
15626    return true
15627  }
15628
15629  if (state.switchU && state.eat(0x2D /* - */)) {
15630    state.lastIntValue = 0x2D; /* - */
15631    return true
15632  }
15633
15634  if (!state.switchU && state.eat(0x63 /* c */)) {
15635    if (this.regexp_eatClassControlLetter(state)) {
15636      return true
15637    }
15638    state.pos = start;
15639  }
15640
15641  return (
15642    this.regexp_eatCharacterClassEscape(state) ||
15643    this.regexp_eatCharacterEscape(state)
15644  )
15645};
vendor: 27,406 bytes, lines 15645-16480
15645
15646
15647// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
15648pp$1.regexp_eatClassControlLetter = function(state) {
15649  var ch = state.current();
15650  if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
15651    state.lastIntValue = ch % 0x20;
15652    state.advance();
15653    return true
15654  }
15655  return false
15656};
15657
15658// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
15659pp$1.regexp_eatHexEscapeSequence = function(state) {
15660  var start = state.pos;
15661  if (state.eat(0x78 /* x */)) {
15662    if (this.regexp_eatFixedHexDigits(state, 2)) {
15663      return true
15664    }
15665    if (state.switchU) {
15666      state.raise("Invalid escape");
15667    }
15668    state.pos = start;
15669  }
15670  return false
15671};
15672
15673// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
15674pp$1.regexp_eatDecimalDigits = function(state) {
15675  var start = state.pos;
15676  var ch = 0;
15677  state.lastIntValue = 0;
15678  while (isDecimalDigit(ch = state.current())) {
15679    state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
15680    state.advance();
15681  }
15682  return state.pos !== start
15683};
15684function isDecimalDigit(ch) {
15685  return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */
15686}
15687
15688// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
15689pp$1.regexp_eatHexDigits = function(state) {
15690  var start = state.pos;
15691  var ch = 0;
15692  state.lastIntValue = 0;
15693  while (isHexDigit(ch = state.current())) {
15694    state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
15695    state.advance();
15696  }
15697  return state.pos !== start
15698};
15699function isHexDigit(ch) {
15700  return (
15701    (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||
15702    (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||
15703    (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)
15704  )
15705}
15706function hexToInt(ch) {
15707  if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
15708    return 10 + (ch - 0x41 /* A */)
15709  }
15710  if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
15711    return 10 + (ch - 0x61 /* a */)
15712  }
15713  return ch - 0x30 /* 0 */
15714}
15715
15716// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
15717// Allows only 0-377(octal) i.e. 0-255(decimal).
15718pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
15719  if (this.regexp_eatOctalDigit(state)) {
15720    var n1 = state.lastIntValue;
15721    if (this.regexp_eatOctalDigit(state)) {
15722      var n2 = state.lastIntValue;
15723      if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
15724        state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
15725      } else {
15726        state.lastIntValue = n1 * 8 + n2;
15727      }
15728    } else {
15729      state.lastIntValue = n1;
15730    }
15731    return true
15732  }
15733  return false
15734};
15735
15736// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
15737pp$1.regexp_eatOctalDigit = function(state) {
15738  var ch = state.current();
15739  if (isOctalDigit(ch)) {
15740    state.lastIntValue = ch - 0x30; /* 0 */
15741    state.advance();
15742    return true
15743  }
15744  state.lastIntValue = 0;
15745  return false
15746};
15747function isOctalDigit(ch) {
15748  return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */
15749}
15750
15751// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
15752// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
15753// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
15754pp$1.regexp_eatFixedHexDigits = function(state, length) {
15755  var start = state.pos;
15756  state.lastIntValue = 0;
15757  for (var i = 0; i < length; ++i) {
15758    var ch = state.current();
15759    if (!isHexDigit(ch)) {
15760      state.pos = start;
15761      return false
15762    }
15763    state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
15764    state.advance();
15765  }
15766  return true
15767};
15768
15769// Object type used to represent tokens. Note that normally, tokens
15770// simply exist as properties on the parser object. This is only
15771// used for the onToken callback and the external tokenizer.
15772
15773var Token = function Token(p) {
15774  this.type = p.type;
15775  this.value = p.value;
15776  this.start = p.start;
15777  this.end = p.end;
15778  if (p.options.locations)
15779    { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }
15780  if (p.options.ranges)
15781    { this.range = [p.start, p.end]; }
15782};
15783
15784// ## Tokenizer
15785
15786var pp = Parser.prototype;
15787
15788// Move to the next token
15789
15790pp.next = function(ignoreEscapeSequenceInKeyword) {
15791  if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
15792    { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
15793  if (this.options.onToken)
15794    { this.options.onToken(new Token(this)); }
15795
15796  this.lastTokEnd = this.end;
15797  this.lastTokStart = this.start;
15798  this.lastTokEndLoc = this.endLoc;
15799  this.lastTokStartLoc = this.startLoc;
15800  this.nextToken();
15801};
15802
15803pp.getToken = function() {
15804  this.next();
15805  return new Token(this)
15806};
15807
15808// If we're in an ES6 environment, make parsers iterable
15809if (typeof Symbol !== "undefined")
15810  { pp[Symbol.iterator] = function() {
15811    var this$1$1 = this;
15812
15813    return {
15814      next: function () {
15815        var token = this$1$1.getToken();
15816        return {
15817          done: token.type === types$1.eof,
15818          value: token
15819        }
15820      }
15821    }
15822  }; }
15823
15824// Toggle strict mode. Re-reads the next number or string to please
15825// pedantic tests (`"use strict"; 010;` should fail).
15826
15827// Read a single token, updating the parser object's token-related
15828// properties.
15829
15830pp.nextToken = function() {
15831  var curContext = this.curContext();
15832  if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
15833
15834  this.start = this.pos;
15835  if (this.options.locations) { this.startLoc = this.curPosition(); }
15836  if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
15837
15838  if (curContext.override) { return curContext.override(this) }
15839  else { this.readToken(this.fullCharCodeAtPos()); }
15840};
15841
15842pp.readToken = function(code) {
15843  // Identifier or keyword. '\uXXXX' sequences are allowed in
15844  // identifiers, so '\' also dispatches to that.
15845  if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
15846    { return this.readWord() }
15847
15848  return this.getTokenFromCode(code)
15849};
15850
15851pp.fullCharCodeAtPos = function() {
15852  var code = this.input.charCodeAt(this.pos);
15853  if (code <= 0xd7ff || code >= 0xdc00) { return code }
15854  var next = this.input.charCodeAt(this.pos + 1);
15855  return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
15856};
15857
15858pp.skipBlockComment = function() {
15859  var startLoc = this.options.onComment && this.curPosition();
15860  var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
15861  if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
15862  this.pos = end + 2;
15863  if (this.options.locations) {
15864    for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {
15865      ++this.curLine;
15866      pos = this.lineStart = nextBreak;
15867    }
15868  }
15869  if (this.options.onComment)
15870    { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
15871                           startLoc, this.curPosition()); }
15872};
15873
15874pp.skipLineComment = function(startSkip) {
15875  var start = this.pos;
15876  var startLoc = this.options.onComment && this.curPosition();
15877  var ch = this.input.charCodeAt(this.pos += startSkip);
15878  while (this.pos < this.input.length && !isNewLine(ch)) {
15879    ch = this.input.charCodeAt(++this.pos);
15880  }
15881  if (this.options.onComment)
15882    { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
15883                           startLoc, this.curPosition()); }
15884};
15885
15886// Called at the start of the parse and after every token. Skips
15887// whitespace and comments, and.
15888
15889pp.skipSpace = function() {
15890  loop: while (this.pos < this.input.length) {
15891    var ch = this.input.charCodeAt(this.pos);
15892    switch (ch) {
15893    case 32: case 160: // ' '
15894      ++this.pos;
15895      break
15896    case 13:
15897      if (this.input.charCodeAt(this.pos + 1) === 10) {
15898        ++this.pos;
15899      }
15900    case 10: case 8232: case 8233:
15901      ++this.pos;
15902      if (this.options.locations) {
15903        ++this.curLine;
15904        this.lineStart = this.pos;
15905      }
15906      break
15907    case 47: // '/'
15908      switch (this.input.charCodeAt(this.pos + 1)) {
15909      case 42: // '*'
15910        this.skipBlockComment();
15911        break
15912      case 47:
15913        this.skipLineComment(2);
15914        break
15915      default:
15916        break loop
15917      }
15918      break
15919    default:
15920      if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
15921        ++this.pos;
15922      } else {
15923        break loop
15924      }
15925    }
15926  }
15927};
15928
15929// Called at the end of every token. Sets `end`, `val`, and
15930// maintains `context` and `exprAllowed`, and skips the space after
15931// the token, so that the next one's `start` will point at the
15932// right position.
15933
15934pp.finishToken = function(type, val) {
15935  this.end = this.pos;
15936  if (this.options.locations) { this.endLoc = this.curPosition(); }
15937  var prevType = this.type;
15938  this.type = type;
15939  this.value = val;
15940
15941  this.updateContext(prevType);
15942};
15943
15944// ### Token reading
15945
15946// This is the function that is called to fetch the next token. It
15947// is somewhat obscure, because it works in character codes rather
15948// than characters, and because operator parsing has been inlined
15949// into it.
15950//
15951// All in the name of speed.
15952//
15953pp.readToken_dot = function() {
15954  var next = this.input.charCodeAt(this.pos + 1);
15955  if (next >= 48 && next <= 57) { return this.readNumber(true) }
15956  var next2 = this.input.charCodeAt(this.pos + 2);
15957  if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
15958    this.pos += 3;
15959    return this.finishToken(types$1.ellipsis)
15960  } else {
15961    ++this.pos;
15962    return this.finishToken(types$1.dot)
15963  }
15964};
15965
15966pp.readToken_slash = function() { // '/'
15967  var next = this.input.charCodeAt(this.pos + 1);
15968  if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
15969  if (next === 61) { return this.finishOp(types$1.assign, 2) }
15970  return this.finishOp(types$1.slash, 1)
15971};
15972
15973pp.readToken_mult_modulo_exp = function(code) { // '%*'
15974  var next = this.input.charCodeAt(this.pos + 1);
15975  var size = 1;
15976  var tokentype = code === 42 ? types$1.star : types$1.modulo;
15977
15978  // exponentiation operator ** and **=
15979  if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
15980    ++size;
15981    tokentype = types$1.starstar;
15982    next = this.input.charCodeAt(this.pos + 2);
15983  }
15984
15985  if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
15986  return this.finishOp(tokentype, size)
15987};
15988
15989pp.readToken_pipe_amp = function(code) { // '|&'
15990  var next = this.input.charCodeAt(this.pos + 1);
15991  if (next === code) {
15992    if (this.options.ecmaVersion >= 12) {
15993      var next2 = this.input.charCodeAt(this.pos + 2);
15994      if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
15995    }
15996    return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
15997  }
15998  if (next === 61) { return this.finishOp(types$1.assign, 2) }
15999  return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
16000};
16001
16002pp.readToken_caret = function() { // '^'
16003  var next = this.input.charCodeAt(this.pos + 1);
16004  if (next === 61) { return this.finishOp(types$1.assign, 2) }
16005  return this.finishOp(types$1.bitwiseXOR, 1)
16006};
16007
16008pp.readToken_plus_min = function(code) { // '+-'
16009  var next = this.input.charCodeAt(this.pos + 1);
16010  if (next === code) {
16011    if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
16012        (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
16013      // A `-->` line comment
16014      this.skipLineComment(3);
16015      this.skipSpace();
16016      return this.nextToken()
16017    }
16018    return this.finishOp(types$1.incDec, 2)
16019  }
16020  if (next === 61) { return this.finishOp(types$1.assign, 2) }
16021  return this.finishOp(types$1.plusMin, 1)
16022};
16023
16024pp.readToken_lt_gt = function(code) { // '<>'
16025  var next = this.input.charCodeAt(this.pos + 1);
16026  var size = 1;
16027  if (next === code) {
16028    size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
16029    if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
16030    return this.finishOp(types$1.bitShift, size)
16031  }
16032  if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
16033      this.input.charCodeAt(this.pos + 3) === 45) {
16034    // `<!--`, an XML-style comment that should be interpreted as a line comment
16035    this.skipLineComment(4);
16036    this.skipSpace();
16037    return this.nextToken()
16038  }
16039  if (next === 61) { size = 2; }
16040  return this.finishOp(types$1.relational, size)
16041};
16042
16043pp.readToken_eq_excl = function(code) { // '=!'
16044  var next = this.input.charCodeAt(this.pos + 1);
16045  if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
16046  if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
16047    this.pos += 2;
16048    return this.finishToken(types$1.arrow)
16049  }
16050  return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
16051};
16052
16053pp.readToken_question = function() { // '?'
16054  var ecmaVersion = this.options.ecmaVersion;
16055  if (ecmaVersion >= 11) {
16056    var next = this.input.charCodeAt(this.pos + 1);
16057    if (next === 46) {
16058      var next2 = this.input.charCodeAt(this.pos + 2);
16059      if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
16060    }
16061    if (next === 63) {
16062      if (ecmaVersion >= 12) {
16063        var next2$1 = this.input.charCodeAt(this.pos + 2);
16064        if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
16065      }
16066      return this.finishOp(types$1.coalesce, 2)
16067    }
16068  }
16069  return this.finishOp(types$1.question, 1)
16070};
16071
16072pp.readToken_numberSign = function() { // '#'
16073  var ecmaVersion = this.options.ecmaVersion;
16074  var code = 35; // '#'
16075  if (ecmaVersion >= 13) {
16076    ++this.pos;
16077    code = this.fullCharCodeAtPos();
16078    if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
16079      return this.finishToken(types$1.privateId, this.readWord1())
16080    }
16081  }
16082
16083  this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
16084};
16085
16086pp.getTokenFromCode = function(code) {
16087  switch (code) {
16088  // The interpretation of a dot depends on whether it is followed
16089  // by a digit or another two dots.
16090  case 46: // '.'
16091    return this.readToken_dot()
16092
16093  // Punctuation tokens.
16094  case 40: ++this.pos; return this.finishToken(types$1.parenL)
16095  case 41: ++this.pos; return this.finishToken(types$1.parenR)
16096  case 59: ++this.pos; return this.finishToken(types$1.semi)
16097  case 44: ++this.pos; return this.finishToken(types$1.comma)
16098  case 91: ++this.pos; return this.finishToken(types$1.bracketL)
16099  case 93: ++this.pos; return this.finishToken(types$1.bracketR)
16100  case 123: ++this.pos; return this.finishToken(types$1.braceL)
16101  case 125: ++this.pos; return this.finishToken(types$1.braceR)
16102  case 58: ++this.pos; return this.finishToken(types$1.colon)
16103
16104  case 96: // '`'
16105    if (this.options.ecmaVersion < 6) { break }
16106    ++this.pos;
16107    return this.finishToken(types$1.backQuote)
16108
16109  case 48: // '0'
16110    var next = this.input.charCodeAt(this.pos + 1);
16111    if (next === 120 || next === 88) { return this.readRadixNumber(16) } // '0x', '0X' - hex number
16112    if (this.options.ecmaVersion >= 6) {
16113      if (next === 111 || next === 79) { return this.readRadixNumber(8) } // '0o', '0O' - octal number
16114      if (next === 98 || next === 66) { return this.readRadixNumber(2) } // '0b', '0B' - binary number
16115    }
16116
16117  // Anything else beginning with a digit is an integer, octal
16118  // number, or float.
16119  case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9
16120    return this.readNumber(false)
16121
16122  // Quotes produce strings.
16123  case 34: case 39: // '"', "'"
16124    return this.readString(code)
16125
16126  // Operators are parsed inline in tiny state machines. '=' (61) is
16127  // often referred to. `finishOp` simply skips the amount of
16128  // characters it is given as second argument, and returns a token
16129  // of the type given by its first argument.
16130  case 47: // '/'
16131    return this.readToken_slash()
16132
16133  case 37: case 42: // '%*'
16134    return this.readToken_mult_modulo_exp(code)
16135
16136  case 124: case 38: // '|&'
16137    return this.readToken_pipe_amp(code)
16138
16139  case 94: // '^'
16140    return this.readToken_caret()
16141
16142  case 43: case 45: // '+-'
16143    return this.readToken_plus_min(code)
16144
16145  case 60: case 62: // '<>'
16146    return this.readToken_lt_gt(code)
16147
16148  case 61: case 33: // '=!'
16149    return this.readToken_eq_excl(code)
16150
16151  case 63: // '?'
16152    return this.readToken_question()
16153
16154  case 126: // '~'
16155    return this.finishOp(types$1.prefix, 1)
16156
16157  case 35: // '#'
16158    return this.readToken_numberSign()
16159  }
16160
16161  this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
16162};
16163
16164pp.finishOp = function(type, size) {
16165  var str = this.input.slice(this.pos, this.pos + size);
16166  this.pos += size;
16167  return this.finishToken(type, str)
16168};
16169
16170pp.readRegexp = function() {
16171  var escaped, inClass, start = this.pos;
16172  for (;;) {
16173    if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
16174    var ch = this.input.charAt(this.pos);
16175    if (lineBreak.test(ch)) { this.raise(start, "Unterminated regular expression"); }
16176    if (!escaped) {
16177      if (ch === "[") { inClass = true; }
16178      else if (ch === "]" && inClass) { inClass = false; }
16179      else if (ch === "/" && !inClass) { break }
16180      escaped = ch === "\\";
16181    } else { escaped = false; }
16182    ++this.pos;
16183  }
16184  var pattern = this.input.slice(start, this.pos);
16185  ++this.pos;
16186  var flagsStart = this.pos;
16187  var flags = this.readWord1();
16188  if (this.containsEsc) { this.unexpected(flagsStart); }
16189
16190  // Validate pattern
16191  var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
16192  state.reset(start, pattern, flags);
16193  this.validateRegExpFlags(state);
16194  this.validateRegExpPattern(state);
16195
16196  // Create Literal#value property value.
16197  var value = null;
16198  try {
16199    value = new RegExp(pattern, flags);
16200  } catch (e) {
16201    // ESTree requires null if it failed to instantiate RegExp object.
16202    // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
16203  }
16204
16205  return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
16206};
16207
16208// Read an integer in the given radix. Return null if zero digits
16209// were read, the integer value otherwise. When `len` is given, this
16210// will return `null` unless the integer has exactly `len` digits.
16211
16212pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
16213  // `len` is used for character escape sequences. In that case, disallow separators.
16214  var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
16215
16216  // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)
16217  // and isn't fraction part nor exponent part. In that case, if the first digit
16218  // is zero then disallow separators.
16219  var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
16220
16221  var start = this.pos, total = 0, lastCode = 0;
16222  for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
16223    var code = this.input.charCodeAt(this.pos), val = (void 0);
16224
16225    if (allowSeparators && code === 95) {
16226      if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); }
16227      if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); }
16228      if (i === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); }
16229      lastCode = code;
16230      continue
16231    }
16232
16233    if (code >= 97) { val = code - 97 + 10; } // a
16234    else if (code >= 65) { val = code - 65 + 10; } // A
16235    else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9
16236    else { val = Infinity; }
16237    if (val >= radix) { break }
16238    lastCode = code;
16239    total = total * radix + val;
16240  }
16241
16242  if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); }
16243  if (this.pos === start || len != null && this.pos - start !== len) { return null }
16244
16245  return total
16246};
16247
16248function stringToNumber(str, isLegacyOctalNumericLiteral) {
16249  if (isLegacyOctalNumericLiteral) {
16250    return parseInt(str, 8)
16251  }
16252
16253  // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
16254  return parseFloat(str.replace(/_/g, ""))
16255}
16256
16257function stringToBigInt(str) {
16258  if (typeof BigInt !== "function") {
16259    return null
16260  }
16261
16262  // `BigInt(value)` throws syntax error if the string contains numeric separators.
16263  return BigInt(str.replace(/_/g, ""))
16264}
16265
16266pp.readRadixNumber = function(radix) {
16267  var start = this.pos;
16268  this.pos += 2; // 0x
16269  var val = this.readInt(radix);
16270  if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
16271  if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
16272    val = stringToBigInt(this.input.slice(start, this.pos));
16273    ++this.pos;
16274  } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
16275  return this.finishToken(types$1.num, val)
16276};
16277
16278// Read an integer, octal integer, or floating-point number.
16279
16280pp.readNumber = function(startsWithDot) {
16281  var start = this.pos;
16282  if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
16283  var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
16284  if (octal && this.strict) { this.raise(start, "Invalid number"); }
16285  var next = this.input.charCodeAt(this.pos);
16286  if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
16287    var val$1 = stringToBigInt(this.input.slice(start, this.pos));
16288    ++this.pos;
16289    if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
16290    return this.finishToken(types$1.num, val$1)
16291  }
16292  if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
16293  if (next === 46 && !octal) { // '.'
16294    ++this.pos;
16295    this.readInt(10);
16296    next = this.input.charCodeAt(this.pos);
16297  }
16298  if ((next === 69 || next === 101) && !octal) { // 'eE'
16299    next = this.input.charCodeAt(++this.pos);
16300    if (next === 43 || next === 45) { ++this.pos; } // '+-'
16301    if (this.readInt(10) === null) { this.raise(start, "Invalid number"); }
16302  }
16303  if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
16304
16305  var val = stringToNumber(this.input.slice(start, this.pos), octal);
16306  return this.finishToken(types$1.num, val)
16307};
16308
16309// Read a string value, interpreting backslash-escapes.
16310
16311pp.readCodePoint = function() {
16312  var ch = this.input.charCodeAt(this.pos), code;
16313
16314  if (ch === 123) { // '{'
16315    if (this.options.ecmaVersion < 6) { this.unexpected(); }
16316    var codePos = ++this.pos;
16317    code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
16318    ++this.pos;
16319    if (code > 0x10FFFF) { this.invalidStringToken(codePos, "Code point out of bounds"); }
16320  } else {
16321    code = this.readHexChar(4);
16322  }
16323  return code
16324};
16325
16326pp.readString = function(quote) {
16327  var out = "", chunkStart = ++this.pos;
16328  for (;;) {
16329    if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
16330    var ch = this.input.charCodeAt(this.pos);
16331    if (ch === quote) { break }
16332    if (ch === 92) { // '\'
16333      out += this.input.slice(chunkStart, this.pos);
16334      out += this.readEscapedChar(false);
16335      chunkStart = this.pos;
16336    } else if (ch === 0x2028 || ch === 0x2029) {
16337      if (this.options.ecmaVersion < 10) { this.raise(this.start, "Unterminated string constant"); }
16338      ++this.pos;
16339      if (this.options.locations) {
16340        this.curLine++;
16341        this.lineStart = this.pos;
16342      }
16343    } else {
16344      if (isNewLine(ch)) { this.raise(this.start, "Unterminated string constant"); }
16345      ++this.pos;
16346    }
16347  }
16348  out += this.input.slice(chunkStart, this.pos++);
16349  return this.finishToken(types$1.string, out)
16350};
16351
16352// Reads template string tokens.
16353
16354var INVALID_TEMPLATE_ESCAPE_ERROR = {};
16355
16356pp.tryReadTemplateToken = function() {
16357  this.inTemplateElement = true;
16358  try {
16359    this.readTmplToken();
16360  } catch (err) {
16361    if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
16362      this.readInvalidTemplateToken();
16363    } else {
16364      throw err
16365    }
16366  }
16367
16368  this.inTemplateElement = false;
16369};
16370
16371pp.invalidStringToken = function(position, message) {
16372  if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
16373    throw INVALID_TEMPLATE_ESCAPE_ERROR
16374  } else {
16375    this.raise(position, message);
16376  }
16377};
16378
16379pp.readTmplToken = function() {
16380  var out = "", chunkStart = this.pos;
16381  for (;;) {
16382    if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
16383    var ch = this.input.charCodeAt(this.pos);
16384    if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
16385      if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
16386        if (ch === 36) {
16387          this.pos += 2;
16388          return this.finishToken(types$1.dollarBraceL)
16389        } else {
16390          ++this.pos;
16391          return this.finishToken(types$1.backQuote)
16392        }
16393      }
16394      out += this.input.slice(chunkStart, this.pos);
16395      return this.finishToken(types$1.template, out)
16396    }
16397    if (ch === 92) { // '\'
16398      out += this.input.slice(chunkStart, this.pos);
16399      out += this.readEscapedChar(true);
16400      chunkStart = this.pos;
16401    } else if (isNewLine(ch)) {
16402      out += this.input.slice(chunkStart, this.pos);
16403      ++this.pos;
16404      switch (ch) {
16405      case 13:
16406        if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }
16407      case 10:
16408        out += "\n";
16409        break
16410      default:
16411        out += String.fromCharCode(ch);
16412        break
16413      }
16414      if (this.options.locations) {
16415        ++this.curLine;
16416        this.lineStart = this.pos;
16417      }
16418      chunkStart = this.pos;
16419    } else {
16420      ++this.pos;
16421    }
16422  }
16423};
16424
16425// Reads a template token to search for the end, without validating any escape sequences
16426pp.readInvalidTemplateToken = function() {
16427  for (; this.pos < this.input.length; this.pos++) {
16428    switch (this.input[this.pos]) {
16429    case "\\":
16430      ++this.pos;
16431      break
16432
16433    case "$":
16434      if (this.input[this.pos + 1] !== "{") {
16435        break
16436      }
16437
16438    // falls through
16439    case "`":
16440      return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
16441
16442    // no default
16443    }
16444  }
16445  this.raise(this.start, "Unterminated template");
16446};
16447
16448// Used to read escaped characters
16449
16450pp.readEscapedChar = function(inTemplate) {
16451  var ch = this.input.charCodeAt(++this.pos);
16452  ++this.pos;
16453  switch (ch) {
16454  case 110: return "\n" // 'n' -> '\n'
16455  case 114: return "\r" // 'r' -> '\r'
16456  case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
16457  case 117: return codePointToString(this.readCodePoint()) // 'u'
16458  case 116: return "\t" // 't' -> '\t'
16459  case 98: return "\b" // 'b' -> '\b'
16460  case 118: return "\u000b" // 'v' -> '\u000b'
16461  case 102: return "\f" // 'f' -> '\f'
16462  case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; } // '\r\n'
16463  case 10: // ' \n'
16464    if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }
16465    return ""
16466  case 56:
16467  case 57:
16468    if (this.strict) {
16469      this.invalidStringToken(
16470        this.pos - 1,
16471        "Invalid escape sequence"
16472      );
16473    }
16474    if (inTemplate) {
16475      var codePos = this.pos - 1;
16476
16477      this.invalidStringToken(
16478        codePos,
16479        "Invalid escape sequence in template string"
16480      );
vendor: 1,471 bytes, lines 16481-16529
16481
16482      return null
16483    }
16484  default:
16485    if (ch >= 48 && ch <= 55) {
16486      var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
16487      var octal = parseInt(octalStr, 8);
16488      if (octal > 255) {
16489        octalStr = octalStr.slice(0, -1);
16490        octal = parseInt(octalStr, 8);
16491      }
16492      this.pos += octalStr.length - 1;
16493      ch = this.input.charCodeAt(this.pos);
16494      if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
16495        this.invalidStringToken(
16496          this.pos - 1 - octalStr.length,
16497          inTemplate
16498            ? "Octal literal in template string"
16499            : "Octal literal in strict mode"
16500        );
16501      }
16502      return String.fromCharCode(octal)
16503    }
16504    if (isNewLine(ch)) {
16505      // Unicode new line characters after \ get removed from output in both
16506      // template literals and strings
16507      return ""
16508    }
16509    return String.fromCharCode(ch)
16510  }
16511};
16512
16513// Used to read character escape sequences ('\x', '\u', '\U').
16514
16515pp.readHexChar = function(len) {
16516  var codePos = this.pos;
16517  var n = this.readInt(16, len);
16518  if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
16519  return n
16520};
16521
16522// Read an identifier, and return it as a string. Sets `this.containsEsc`
16523// to whether the word contained a '\u' escape.
16524//
16525// Incrementally adds only escaped chars, adding other chunks as-is
16526// as a micro-optimization.
16527
16528pp.readWord1 = function() {
16529  this.containsEsc = false;
vendor: 11,452 bytes, lines 16530-16942
16530  var word = "", first = true, chunkStart = this.pos;
16531  var astral = this.options.ecmaVersion >= 6;
16532  while (this.pos < this.input.length) {
16533    var ch = this.fullCharCodeAtPos();
16534    if (isIdentifierChar(ch, astral)) {
16535      this.pos += ch <= 0xffff ? 1 : 2;
16536    } else if (ch === 92) { // "\"
16537      this.containsEsc = true;
16538      word += this.input.slice(chunkStart, this.pos);
16539      var escStart = this.pos;
16540      if (this.input.charCodeAt(++this.pos) !== 117) // "u"
16541        { this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); }
16542      ++this.pos;
16543      var esc = this.readCodePoint();
16544      if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
16545        { this.invalidStringToken(escStart, "Invalid Unicode escape"); }
16546      word += codePointToString(esc);
16547      chunkStart = this.pos;
16548    } else {
16549      break
16550    }
16551    first = false;
16552  }
16553  return word + this.input.slice(chunkStart, this.pos)
16554};
16555
16556// Read an identifier or keyword token. Will check for reserved
16557// words when necessary.
16558
16559pp.readWord = function() {
16560  var word = this.readWord1();
16561  var type = types$1.name;
16562  if (this.keywords.test(word)) {
16563    type = keywords[word];
16564  }
16565  return this.finishToken(type, word)
16566};
16567
16568// Acorn is a tiny, fast JavaScript parser written in JavaScript.
16569
16570var version = "8.8.0";
16571
16572Parser.acorn = {
16573  Parser: Parser,
16574  version: version,
16575  defaultOptions: defaultOptions,
16576  Position: Position,
16577  SourceLocation: SourceLocation,
16578  getLineInfo: getLineInfo,
16579  Node: Node$1,
16580  TokenType: TokenType,
16581  tokTypes: types$1,
16582  keywordTypes: keywords,
16583  TokContext: TokContext,
16584  tokContexts: types,
16585  isIdentifierChar: isIdentifierChar,
16586  isIdentifierStart: isIdentifierStart,
16587  Token: Token,
16588  isNewLine: isNewLine,
16589  lineBreak: lineBreak,
16590  lineBreakG: lineBreakG,
16591  nonASCIIwhitespace: nonASCIIwhitespace
16592};
16593
16594var defaultGlobals = new Set([
16595  "Array",
16596  "ArrayBuffer",
16597  "atob",
16598  "AudioContext",
16599  "Blob",
16600  "Boolean",
16601  "BigInt",
16602  "btoa",
16603  "clearInterval",
16604  "clearTimeout",
16605  "console",
16606  "crypto",
16607  "CustomEvent",
16608  "DataView",
16609  "Date",
16610  "decodeURI",
16611  "decodeURIComponent",
16612  "devicePixelRatio",
16613  "document",
16614  "encodeURI",
16615  "encodeURIComponent",
16616  "Error",
16617  "escape",
16618  "eval",
16619  "fetch",
16620  "File",
16621  "FileList",
16622  "FileReader",
16623  "Float32Array",
16624  "Float64Array",
16625  "Function",
16626  "Headers",
16627  "Image",
16628  "ImageData",
16629  "Infinity",
16630  "Int16Array",
16631  "Int32Array",
16632  "Int8Array",
16633  "Intl",
16634  "isFinite",
16635  "isNaN",
16636  "JSON",
16637  "Map",
16638  "Math",
16639  "NaN",
16640  "Number",
16641  "navigator",
16642  "Object",
16643  "parseFloat",
16644  "parseInt",
16645  "performance",
16646  "Path2D",
16647  "Promise",
16648  "Proxy",
16649  "RangeError",
16650  "ReferenceError",
16651  "Reflect",
16652  "RegExp",
16653  "cancelAnimationFrame",
16654  "requestAnimationFrame",
16655  "Set",
16656  "setInterval",
16657  "setTimeout",
16658  "String",
16659  "Symbol",
16660  "SyntaxError",
16661  "TextDecoder",
16662  "TextEncoder",
16663  "this",
16664  "TypeError",
16665  "Uint16Array",
16666  "Uint32Array",
16667  "Uint8Array",
16668  "Uint8ClampedArray",
16669  "undefined",
16670  "unescape",
16671  "URIError",
16672  "URL",
16673  "WeakMap",
16674  "WeakSet",
16675  "WebSocket",
16676  "Worker",
16677  "window"
16678]);
16679
16680// AST walker module for Mozilla Parser API compatible trees
16681
16682// A simple walk is one where you simply specify callbacks to be
16683// called on specific nodes. The last two arguments are optional. A
16684// simple use would be
16685//
16686//     walk.simple(myTree, {
16687//         Expression: function(node) { ... }
16688//     });
16689//
16690// to do something with all expressions. All Parser API node types
16691// can be used to identify node types, as well as Expression and
16692// Statement, which denote categories of nodes.
16693//
16694// The base argument can be used to pass a custom (recursive)
16695// walker, and state can be used to give this walked an initial
16696// state.
16697
16698function simple(node, visitors, baseVisitor, state, override) {
16699  if (!baseVisitor) { baseVisitor = base
16700  ; }(function c(node, st, override) {
16701    var type = override || node.type, found = visitors[type];
16702    baseVisitor[type](node, st, c);
16703    if (found) { found(node, st); }
16704  })(node, state, override);
16705}
16706
16707// An ancestor walk keeps an array of ancestor nodes (including the
16708// current node) and passes them to the callback as third parameter
16709// (and also as state parameter when no other state is present).
16710function ancestor(node, visitors, baseVisitor, state, override) {
16711  var ancestors = [];
16712  if (!baseVisitor) { baseVisitor = base
16713  ; }(function c(node, st, override) {
16714    var type = override || node.type, found = visitors[type];
16715    var isNew = node !== ancestors[ancestors.length - 1];
16716    if (isNew) { ancestors.push(node); }
16717    baseVisitor[type](node, st, c);
16718    if (found) { found(node, st || ancestors, ancestors); }
16719    if (isNew) { ancestors.pop(); }
16720  })(node, state, override);
16721}
16722
16723// Used to create a custom walker. Will fill in all missing node
16724// type properties with the defaults.
16725function make(funcs, baseVisitor) {
16726  var visitor = Object.create(baseVisitor || base);
16727  for (var type in funcs) { visitor[type] = funcs[type]; }
16728  return visitor
16729}
16730
16731function skipThrough(node, st, c) { c(node, st); }
16732function ignore(_node, _st, _c) {}
16733
16734// Node walkers.
16735
16736var base = {};
16737
16738base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) {
16739  for (var i = 0, list = node.body; i < list.length; i += 1)
16740    {
16741    var stmt = list[i];
16742
16743    c(stmt, st, "Statement");
16744  }
16745};
16746base.Statement = skipThrough;
16747base.EmptyStatement = ignore;
16748base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
16749  function (node, st, c) { return c(node.expression, st, "Expression"); };
16750base.IfStatement = function (node, st, c) {
16751  c(node.test, st, "Expression");
16752  c(node.consequent, st, "Statement");
16753  if (node.alternate) { c(node.alternate, st, "Statement"); }
16754};
16755base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
16756base.BreakStatement = base.ContinueStatement = ignore;
16757base.WithStatement = function (node, st, c) {
16758  c(node.object, st, "Expression");
16759  c(node.body, st, "Statement");
16760};
16761base.SwitchStatement = function (node, st, c) {
16762  c(node.discriminant, st, "Expression");
16763  for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
16764    var cs = list$1[i$1];
16765
16766    if (cs.test) { c(cs.test, st, "Expression"); }
16767    for (var i = 0, list = cs.consequent; i < list.length; i += 1)
16768      {
16769      var cons = list[i];
16770
16771      c(cons, st, "Statement");
16772    }
16773  }
16774};
16775base.SwitchCase = function (node, st, c) {
16776  if (node.test) { c(node.test, st, "Expression"); }
16777  for (var i = 0, list = node.consequent; i < list.length; i += 1)
16778    {
16779    var cons = list[i];
16780
16781    c(cons, st, "Statement");
16782  }
16783};
16784base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
16785  if (node.argument) { c(node.argument, st, "Expression"); }
16786};
16787base.ThrowStatement = base.SpreadElement =
16788  function (node, st, c) { return c(node.argument, st, "Expression"); };
16789base.TryStatement = function (node, st, c) {
16790  c(node.block, st, "Statement");
16791  if (node.handler) { c(node.handler, st); }
16792  if (node.finalizer) { c(node.finalizer, st, "Statement"); }
16793};
16794base.CatchClause = function (node, st, c) {
16795  if (node.param) { c(node.param, st, "Pattern"); }
16796  c(node.body, st, "Statement");
16797};
16798base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
16799  c(node.test, st, "Expression");
16800  c(node.body, st, "Statement");
16801};
16802base.ForStatement = function (node, st, c) {
16803  if (node.init) { c(node.init, st, "ForInit"); }
16804  if (node.test) { c(node.test, st, "Expression"); }
16805  if (node.update) { c(node.update, st, "Expression"); }
16806  c(node.body, st, "Statement");
16807};
16808base.ForInStatement = base.ForOfStatement = function (node, st, c) {
16809  c(node.left, st, "ForInit");
16810  c(node.right, st, "Expression");
16811  c(node.body, st, "Statement");
16812};
16813base.ForInit = function (node, st, c) {
16814  if (node.type === "VariableDeclaration") { c(node, st); }
16815  else { c(node, st, "Expression"); }
16816};
16817base.DebuggerStatement = ignore;
16818
16819base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
16820base.VariableDeclaration = function (node, st, c) {
16821  for (var i = 0, list = node.declarations; i < list.length; i += 1)
16822    {
16823    var decl = list[i];
16824
16825    c(decl, st);
16826  }
16827};
16828base.VariableDeclarator = function (node, st, c) {
16829  c(node.id, st, "Pattern");
16830  if (node.init) { c(node.init, st, "Expression"); }
16831};
16832
16833base.Function = function (node, st, c) {
16834  if (node.id) { c(node.id, st, "Pattern"); }
16835  for (var i = 0, list = node.params; i < list.length; i += 1)
16836    {
16837    var param = list[i];
16838
16839    c(param, st, "Pattern");
16840  }
16841  c(node.body, st, node.expression ? "Expression" : "Statement");
16842};
16843
16844base.Pattern = function (node, st, c) {
16845  if (node.type === "Identifier")
16846    { c(node, st, "VariablePattern"); }
16847  else if (node.type === "MemberExpression")
16848    { c(node, st, "MemberPattern"); }
16849  else
16850    { c(node, st); }
16851};
16852base.VariablePattern = ignore;
16853base.MemberPattern = skipThrough;
16854base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
16855base.ArrayPattern = function (node, st, c) {
16856  for (var i = 0, list = node.elements; i < list.length; i += 1) {
16857    var elt = list[i];
16858
16859    if (elt) { c(elt, st, "Pattern"); }
16860  }
16861};
16862base.ObjectPattern = function (node, st, c) {
16863  for (var i = 0, list = node.properties; i < list.length; i += 1) {
16864    var prop = list[i];
16865
16866    if (prop.type === "Property") {
16867      if (prop.computed) { c(prop.key, st, "Expression"); }
16868      c(prop.value, st, "Pattern");
16869    } else if (prop.type === "RestElement") {
16870      c(prop.argument, st, "Pattern");
16871    }
16872  }
16873};
16874
16875base.Expression = skipThrough;
16876base.ThisExpression = base.Super = base.MetaProperty = ignore;
16877base.ArrayExpression = function (node, st, c) {
16878  for (var i = 0, list = node.elements; i < list.length; i += 1) {
16879    var elt = list[i];
16880
16881    if (elt) { c(elt, st, "Expression"); }
16882  }
16883};
16884base.ObjectExpression = function (node, st, c) {
16885  for (var i = 0, list = node.properties; i < list.length; i += 1)
16886    {
16887    var prop = list[i];
16888
16889    c(prop, st);
16890  }
16891};
16892base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
16893base.SequenceExpression = function (node, st, c) {
16894  for (var i = 0, list = node.expressions; i < list.length; i += 1)
16895    {
16896    var expr = list[i];
16897
16898    c(expr, st, "Expression");
16899  }
16900};
16901base.TemplateLiteral = function (node, st, c) {
16902  for (var i = 0, list = node.quasis; i < list.length; i += 1)
16903    {
16904    var quasi = list[i];
16905
16906    c(quasi, st);
16907  }
16908
16909  for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
16910    {
16911    var expr = list$1[i$1];
16912
16913    c(expr, st, "Expression");
16914  }
16915};
16916base.TemplateElement = ignore;
16917base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
16918  c(node.argument, st, "Expression");
16919};
16920base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
16921  c(node.left, st, "Expression");
16922  c(node.right, st, "Expression");
16923};
16924base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
16925  c(node.left, st, "Pattern");
16926  c(node.right, st, "Expression");
16927};
16928base.ConditionalExpression = function (node, st, c) {
16929  c(node.test, st, "Expression");
16930  c(node.consequent, st, "Expression");
16931  c(node.alternate, st, "Expression");
16932};
16933base.NewExpression = base.CallExpression = function (node, st, c) {
16934  c(node.callee, st, "Expression");
16935  if (node.arguments)
16936    { for (var i = 0, list = node.arguments; i < list.length; i += 1)
16937      {
16938        var arg = list[i];
16939
16940        c(arg, st, "Expression");
16941      } }
16942};
16943base.MemberExpression = function (node, st, c) {
16944  c(node.object, st, "Expression");
16945  if (node.computed) { c(node.property, st, "Expression"); }
16946};
16947base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
16948  if (node.declaration)
16949    { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
16950  if (node.source) { c(node.source, st, "Expression"); }
16951};
16952base.ExportAllDeclaration = function (node, st, c) {
16953  if (node.exported)
16954    { c(node.exported, st); }
16955  c(node.source, st, "Expression");
16956};
16957base.ImportDeclaration = function (node, st, c) {
16958  for (var i = 0, list = node.specifiers; i < list.length; i += 1)
16959    {
16960    var spec = list[i];
16961
16962    c(spec, st);
16963  }
16964  c(node.source, st, "Expression");
16965};
16966base.ImportExpression = function (node, st, c) {
16967  c(node.source, st, "Expression");
16968};
16969base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
16970
16971base.TaggedTemplateExpression = function (node, st, c) {
16972  c(node.tag, st, "Expression");
16973  c(node.quasi, st, "Expression");
16974};
16975base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
16976base.Class = function (node, st, c) {
16977  if (node.id) { c(node.id, st, "Pattern"); }
16978  if (node.superClass) { c(node.superClass, st, "Expression"); }
16979  c(node.body, st);
16980};
16981base.ClassBody = function (node, st, c) {
16982  for (var i = 0, list = node.body; i < list.length; i += 1)
16983    {
16984    var elt = list[i];
16985
16986    c(elt, st);
16987  }
16988};
16989base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
16990  if (node.computed) { c(node.key, st, "Expression"); }
16991  if (node.value) { c(node.value, st, "Expression"); }
16992};
16993
16994var walk = make({
16995  Import() {},
16996  ViewExpression(node, st, c) {
16997    c(node.id, st, "Identifier");
16998  },
16999  MutableExpression(node, st, c) {
17000    c(node.id, st, "Identifier");
17001  }
17002});
17003
17004// Based on https://github.com/ForbesLindesay/acorn-globals
17005
17006function isScope(node) {
17007  return node.type === "FunctionExpression"
17008      || node.type === "FunctionDeclaration"
17009      || node.type === "ArrowFunctionExpression"
17010      || node.type === "Program";
17011}
17012
17013function isBlockScope(node) {
17014  return node.type === "BlockStatement"
17015      || node.type === "ForInStatement"
17016      || node.type === "ForOfStatement"
17017      || node.type === "ForStatement"
17018      || isScope(node);
17019}
17020
17021function declaresArguments(node) {
17022  return node.type === "FunctionExpression"
17023      || node.type === "FunctionDeclaration";
17024}
17025
17026function findReferences(cell, globals) {
17027  const ast = {type: "Program", body: [cell.body]};
17028  const locals = new Map;
17029  const globalSet = new Set(globals);
17030  const references = [];
17031
17032  function hasLocal(node, name) {
17033    const l = locals.get(node);
17034    return l ? l.has(name) : false;
17035  }
17036
17037  function declareLocal(node, id) {
17038    const l = locals.get(node);
17039    if (l) l.add(id.name);
17040    else locals.set(node, new Set([id.name]));
17041  }
17042
17043  function declareClass(node) {
17044    if (node.id) declareLocal(node, node.id);
17045  }
17046
17047  function declareFunction(node) {
17048    node.params.forEach(param => declarePattern(param, node));
17049    if (node.id) declareLocal(node, node.id);
17050  }
17051
17052  function declareCatchClause(node) {
17053    if (node.param) declarePattern(node.param, node);
17054  }
17055
17056  function declarePattern(node, parent) {
17057    switch (node.type) {
17058      case "Identifier":
17059        declareLocal(parent, node);
17060        break;
17061      case "ObjectPattern":
17062        node.properties.forEach(node => declarePattern(node, parent));
17063        break;
17064      case "ArrayPattern":
17065        node.elements.forEach(node => node && declarePattern(node, parent));
17066        break;
17067      case "Property":
17068        declarePattern(node.value, parent);
17069        break;
17070      case "RestElement":
17071        declarePattern(node.argument, parent);
17072        break;
17073      case "AssignmentPattern":
17074        declarePattern(node.left, parent);
17075        break;
17076      default:
17077        throw new Error("Unrecognized pattern type: " + node.type);
17078    }
17079  }
17080
17081  function declareModuleSpecifier(node) {
17082    declareLocal(ast, node.local);
17083  }
17084
17085  ancestor(
17086    ast,
17087    {
17088      VariableDeclaration: (node, parents) => {
17089        let parent = null;
17090        for (let i = parents.length - 1; i >= 0 && parent === null; --i) {
17091          if (node.kind === "var" ? isScope(parents[i]) : isBlockScope(parents[i])) {
17092            parent = parents[i];
17093          }
17094        }
17095        node.declarations.forEach(declaration => declarePattern(declaration.id, parent));
17096      },
17097      FunctionDeclaration: (node, parents) => {
17098        let parent = null;
17099        for (let i = parents.length - 2; i >= 0 && parent === null; --i) {
17100          if (isScope(parents[i])) {
17101            parent = parents[i];
17102          }
17103        }
17104        declareLocal(parent, node.id);
17105        declareFunction(node);
17106      },
17107      Function: declareFunction,
17108      ClassDeclaration: (node, parents) => {
17109        let parent = null;
17110        for (let i = parents.length - 2; i >= 0 && parent === null; i--) {
17111          if (isScope(parents[i])) {
17112            parent = parents[i];
17113          }
17114        }
17115        declareLocal(parent, node.id);
17116      },
17117      Class: declareClass,
17118      CatchClause: declareCatchClause,
17119      ImportDefaultSpecifier: declareModuleSpecifier,
17120      ImportSpecifier: declareModuleSpecifier,
17121      ImportNamespaceSpecifier: declareModuleSpecifier
17122    },
17123    walk
17124  );
17125
17126  function identifier(node, parents) {
17127    let name = node.name;
17128    if (name === "undefined") return;
17129    for (let i = parents.length - 2; i >= 0; --i) {
17130      if (name === "arguments") {
17131        if (declaresArguments(parents[i])) {
17132          return;
17133        }
17134      }
17135      if (hasLocal(parents[i], name)) {
17136        return;
17137      }
17138      if (parents[i].type === "ViewExpression") {
17139        node = parents[i];
17140        name = `viewof ${node.id.name}`;
17141      }
17142      if (parents[i].type === "MutableExpression") {
17143        node = parents[i];
17144        name = `mutable ${node.id.name}`;
17145      }
17146    }
17147    if (!globalSet.has(name)) {
17148      if (name === "arguments") {
17149        throw Object.assign(new SyntaxError(`arguments is not allowed`), {node});
17150      }
17151      references.push(node);
17152    }
17153  }
17154
17155  ancestor(
17156    ast,
17157    {
17158      VariablePattern: identifier,
17159      Identifier: identifier
17160    },
17161    walk
17162  );
17163
17164  function checkConst(node, parents) {
17165    if (!node) return;
17166    switch (node.type) {
17167      case "Identifier":
17168      case "VariablePattern": {
17169        for (const parent of parents) {
17170          if (hasLocal(parent, node.name)) {
17171            return;
17172          }
17173        }
17174        if (parents[parents.length - 2].type === "MutableExpression") {
17175          return;
17176        }
17177        throw Object.assign(new SyntaxError(`Assignment to constant variable ${node.name}`), {node});
17178      }
17179      case "ArrayPattern": {
17180        for (const element of node.elements) {
17181          checkConst(element, parents);
17182        }
17183        return;
17184      }
17185      case "ObjectPattern": {
17186        for (const property of node.properties) {
17187          checkConst(property, parents);
17188        }
17189        return;
17190      }
17191      case "Property": {
17192        checkConst(node.value, parents);
17193        return;
17194      }
17195      case "RestElement": {
17196        checkConst(node.argument, parents);
17197        return;
17198      }
17199    }
17200  }
17201
17202  function checkConstArgument(node, parents) {
17203    checkConst(node.argument, parents);
17204  }
17205
17206  function checkConstLeft(node, parents) {
17207    checkConst(node.left, parents);
17208  }
17209
17210  ancestor(
17211    ast,
17212    {
17213      AssignmentExpression: checkConstLeft,
17214      AssignmentPattern: checkConstLeft,
17215      UpdateExpression: checkConstArgument,
17216      ForOfStatement: checkConstLeft,
17217      ForInStatement: checkConstLeft
17218    },
17219    walk
17220  );
17221
17222  return references;
17223}
17224
17225function findFeatures(cell, featureName) {
17226  const ast = {type: "Program", body: [cell.body]};
17227  const features = new Map();
17228  const {references} = cell;
17229
17230  simple(
17231    ast,
17232    {
17233      CallExpression: node => {
17234        const {callee, arguments: args} = node;
17235
17236        // Ignore function calls that are not references to the feature.
17237        if (
17238          callee.type !== "Identifier" ||
17239          callee.name !== featureName ||
17240          references.indexOf(callee) < 0
17241        ) return;
17242
17243        // Forbid dynamic calls.
17244        if (
17245          args.length !== 1 ||
17246          !((args[0].type === "Literal" && /^['"]/.test(args[0].raw)) ||
17247            (args[0].type === "TemplateLiteral" && args[0].expressions.length === 0))
17248        ) {
17249          throw Object.assign(new SyntaxError(`${featureName} requires a single literal string argument`), {node});
17250        }
17251
17252        const [arg] = args;
17253        const name = arg.type === "Literal" ? arg.value : arg.quasis[0].value.cooked;
17254        const location = {start: arg.start, end: arg.end};
17255        if (features.has(name)) features.get(name).push(location);
17256        else features.set(name, [location]);
17257      }
17258    },
17259    walk
17260  );
17261
17262  return features;
17263}
17264
17265const SCOPE_FUNCTION = 2;
17266const SCOPE_ASYNC = 4;
17267const SCOPE_GENERATOR = 8;
17268
17269class CellParser extends Parser {
17270  constructor(options, ...args) {
17271    super(Object.assign({ecmaVersion: 13}, options), ...args);
17272  }
17273  enterScope(flags) {
17274    if (flags & SCOPE_FUNCTION) ++this.O_function;
17275    return super.enterScope(flags);
17276  }
17277  exitScope() {
17278    if (this.currentScope().flags & SCOPE_FUNCTION) --this.O_function;
17279    return super.exitScope();
17280  }
17281  parseForIn(node, init) {
17282    if (this.O_function === 1 && node.await) this.O_async = true;
17283    return super.parseForIn(node, init);
17284  }
17285  parseAwait() {
17286    if (this.O_function === 1) this.O_async = true;
17287    return super.parseAwait();
17288  }
17289  parseYield(noIn) {
17290    if (this.O_function === 1) this.O_generator = true;
17291    return super.parseYield(noIn);
17292  }
17293  parseImport(node) {
17294    this.next();
17295    node.specifiers = this.parseImportSpecifiers();
17296    if (this.type === types$1._with) {
17297      this.next();
17298      node.injections = this.parseImportSpecifiers();
17299    }
17300    this.expectContextual("from");
17301    node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
17302    return this.finishNode(node, "ImportDeclaration");
17303  }
17304  parseImportSpecifiers() {
17305    const nodes = [];
17306    const identifiers = new Set;
17307    let first = true;
17308    this.expect(types$1.braceL);
17309    while (!this.eat(types$1.braceR)) {
17310      if (first) {
17311        first = false;
17312      } else {
17313        this.expect(types$1.comma);
17314        if (this.afterTrailingComma(types$1.braceR)) break;
17315      }
17316      const node = this.startNode();
17317      node.view = this.eatContextual("viewof");
17318      node.mutable = node.view ? false : this.eatContextual("mutable");
17319      node.imported = this.parseIdent();
17320      this.checkUnreserved(node.imported);
17321      this.checkLocal(node.imported);
17322      if (this.eatContextual("as")) {
17323        node.local = this.parseIdent();
17324        this.checkUnreserved(node.local);
17325        this.checkLocal(node.local);
17326      } else {
17327        node.local = node.imported;
17328      }
17329      this.checkLValSimple(node.local, "let");
17330      if (identifiers.has(node.local.name)) {
17331        this.raise(node.local.start, `Identifier '${node.local.name}' has already been declared`);
17332      }
17333      identifiers.add(node.local.name);
17334      nodes.push(this.finishNode(node, "ImportSpecifier"));
17335    }
17336    return nodes;
17337  }
17338  parseExprAtom(refDestructuringErrors) {
17339    return (
17340      this.parseMaybeKeywordExpression("viewof", "ViewExpression") ||
17341      this.parseMaybeKeywordExpression("mutable", "MutableExpression") ||
17342      super.parseExprAtom(refDestructuringErrors)
17343    );
17344  }
17345  startCell() {
17346    this.O_function = 0;
17347    this.O_async = false;
17348    this.O_generator = false;
17349    this.strict = true;
17350    this.enterScope(SCOPE_FUNCTION | SCOPE_ASYNC | SCOPE_GENERATOR);
17351  }
17352  finishCell(node, body, id) {
17353    if (id) this.checkLocal(id);
17354    node.id = id;
17355    node.body = body;
17356    node.async = this.O_async;
17357    node.generator = this.O_generator;
17358    this.exitScope();
17359    return this.finishNode(node, "Cell");
17360  }
17361  parseCell(node, eof) {
17362    const lookahead = new CellParser({}, this.input, this.start);
17363    let token = lookahead.getToken();
17364    let body = null;
17365    let id = null;
17366
17367    this.startCell();
17368
17369    // An import?
17370    if (token.type === types$1._import && lookahead.getToken().type !== types$1.parenL) {
17371      body = this.parseImport(this.startNode());
17372    }
17373
17374    // A non-empty cell?
17375    else if (token.type !== types$1.eof && token.type !== types$1.semi) {
17376      // A named cell?
17377      if (token.type === types$1.name) {
17378        if (token.value === "viewof" || token.value === "mutable") {
17379          token = lookahead.getToken();
17380          if (token.type !== types$1.name) {
17381            lookahead.unexpected();
17382          }
17383        }
17384        token = lookahead.getToken();
17385        if (token.type === types$1.eq) {
17386          id =
17387            this.parseMaybeKeywordExpression("viewof", "ViewExpression") ||
17388            this.parseMaybeKeywordExpression("mutable", "MutableExpression") ||
17389            this.parseIdent();
17390          token = lookahead.getToken();
17391          this.expect(types$1.eq);
17392        }
17393      }
17394
17395      // A block?
17396      if (token.type === types$1.braceL) {
17397        body = this.parseBlock();
17398      }
17399
17400      // An expression?
17401      // Possibly a function or class declaration?
17402      else {
17403        body = this.parseExpression();
17404        if (
17405          id === null &&
17406          (body.type === "FunctionExpression" ||
17407            body.type === "ClassExpression")
17408        ) {
17409          id = body.id;
17410        }
17411      }
17412    }
17413
17414    this.semicolon();
17415    if (eof) this.expect(types$1.eof); // TODO
17416
17417    return this.finishCell(node, body, id);
17418  }
17419  parseTopLevel(node) {
17420    return this.parseCell(node, true);
17421  }
17422  toAssignable(node, isBinding, refDestructuringErrors) {
17423    return node.type === "MutableExpression"
17424      ? node
17425      : super.toAssignable(node, isBinding, refDestructuringErrors);
17426  }
17427  checkLocal(id) {
17428    const node = id.id || id;
17429    if (defaultGlobals.has(node.name) || node.name === "arguments") {
17430      this.raise(node.start, `Identifier '${node.name}' is reserved`);
17431    }
17432  }
17433  checkUnreserved(node) {
17434    if (node.name === "viewof" || node.name === "mutable") {
17435      this.raise(node.start, `Unexpected keyword '${node.name}'`);
17436    }
17437    return super.checkUnreserved(node);
17438  }
17439  checkLValSimple(expr, bindingType, checkClashes) {
17440    return super.checkLValSimple(
17441      expr.type === "MutableExpression" ? expr.id : expr,
17442      bindingType,
17443      checkClashes
17444    );
17445  }
17446  unexpected(pos) {
17447    this.raise(
17448      pos != null ? pos : this.start,
17449      this.type === types$1.eof ? "Unexpected end of input" : "Unexpected token"
17450    );
17451  }
17452  parseMaybeKeywordExpression(keyword, type) {
17453    if (this.isContextual(keyword)) {
17454      const node = this.startNode();
17455      this.next();
17456      node.id = this.parseIdent();
17457      return this.finishNode(node, type);
17458    }
17459  }
17460}
17461
17462// Based on acorn’s q_tmpl. We will use this to initialize the
17463// parser context so our `readTemplateToken` override is called.
17464// `readTemplateToken` is based on acorn's `readTmplToken` which
17465// is used inside template literals. Our version allows backQuotes.
17466new TokContext(
17467  "`", // token
17468  true, // isExpr
17469  true, // preserveSpace
17470  parser => readTemplateToken.call(parser) // override
17471);
17472
17473// This is our custom override for parsing a template that allows backticks.
17474// Based on acorn's readInvalidTemplateToken.
17475function readTemplateToken() {
17476  out: for (; this.pos < this.input.length; this.pos++) {
17477    switch (this.input.charCodeAt(this.pos)) {
17478      case 92: { // slash
17479        if (this.pos < this.input.length - 1) ++this.pos; // not a terminal slash
17480        break;
17481      }
17482      case 36: { // dollar
17483        if (this.input.charCodeAt(this.pos + 1) === 123) { // dollar curly
17484          if (this.pos === this.start && this.type === types$1.invalidTemplate) {
17485            this.pos += 2;
17486            return this.finishToken(types$1.dollarBraceL);
17487          }
17488          break out;
17489        }
17490        break;
17491      }
17492    }
17493  }
17494  return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos));
17495}
17496
17497// Find references.
17498// Check for illegal references to arguments.
17499// Check for illegal assignments to global references.
17500function parseReferences(cell, input, globals = defaultGlobals) {
17501  if (!cell.body) {
17502    cell.references = [];
17503  } else if (cell.body.type === "ImportDeclaration") {
17504    cell.references = cell.body.injections
17505      ? cell.body.injections.map(i => i.imported)
17506      : [];
17507  } else {
17508    try {
17509      cell.references = findReferences(cell, globals);
17510    } catch (error) {
17511      if (error.node) {
17512        const loc = getLineInfo(input, error.node.start);
17513        error.message += ` (${loc.line}:${loc.column})`;
17514        error.pos = error.node.start;
17515        error.loc = loc;
17516        delete error.node;
17517      }
17518      throw error;
17519    }
17520  }
17521  return cell;
17522}
17523
17524// Find features: file attachments, secrets, database clients.
17525// Check for illegal references to arguments.
17526// Check for illegal assignments to global references.
17527function parseFeatures(cell, input) {
17528  if (cell.body && cell.body.type !== "ImportDeclaration") {
17529    try {
17530      cell.fileAttachments = findFeatures(cell, "FileAttachment");
17531      cell.databaseClients = findFeatures(cell, "DatabaseClient");
17532      cell.secrets = findFeatures(cell, "Secret");
17533    } catch (error) {
17534      if (error.node) {
17535        const loc = getLineInfo(input, error.node.start);
17536        error.message += ` (${loc.line}:${loc.column})`;
17537        error.pos = error.node.start;
17538        error.loc = loc;
17539        delete error.node;
17540      }
17541      throw error;
17542    }
17543  } else {
17544    cell.fileAttachments = new Map();
17545    cell.databaseClients = new Map();
17546    cell.secrets = new Map();
17547  }
17548  return cell;
17549}
17550
17551/* Fork changes begin here */
17552
17553function parseModule(input, {globals} = {}) {
17554  const program = ModuleParser.parse(input);
17555  for (const cell of program.cells) {
17556    parseReferences(cell, input, globals);
17557    parseFeatures(cell, input);
17558  }
17559  return program;
17560}
17561
17562class ModuleParser extends CellParser {
17563  parseTopLevel(node) {
17564    if (!node.cells) node.cells = [];
17565    while (this.type !== types$1.eof) {
17566      const cell = this.parseCell(this.startNode());
17567      cell.input = this.input;
17568      node.cells.push(cell);
17569    }
17570    this.next();
17571    return this.finishNode(node, "Program");
17572  }
17573}
17574
17575/* Fork changes end here */
17576
17577/*global Shiny, $, DOMParser, MutationObserver, URL
17578*
17579* ojs-connector.js
17580*
17581* Copyright (C) 2022 RStudio, PBC
17582*
17583*/
17584
17585//////////////////////////////////////////////////////////////////////////////
17586
17587class EmptyInspector {
17588  pending() {
17589  }
17590  fulfilled(_value, _name) {
17591  }
17592  rejected(_error, _name) {
17593    // TODO we should probably communicate this upstream somehow.
17594  }
17595}
17596
17597// here we need to convert from an ES6 module to an observable module
17598// in, well, a best-effort kind of way.
17599function es6ImportAsObservableModule(modulePromise, specs) {
17600  const promiseMap = {};
17601  const resolveMap = {};
17602  specs.forEach(spec => {
17603    promiseMap[spec] = new Promise((resolve, reject) => { resolveMap[spec] = { resolve, reject }; });
17604  });
17605  modulePromise.then(m => {
17606    specs.forEach(spec => {
17607      resolveMap[spec].resolve(m[spec]);
17608    });
17609  }).catch(error => {
17610    specs.forEach(spec => {
17611      resolveMap[spec].reject(error);
17612    });
17613  });
17614  return function (runtime, observer) {
17615    const main = runtime.module();
17616
17617    specs.forEach(key => {
17618      main.variable(observer(key)).define(key, [], () => promiseMap[key]);
17619    });
17620/* 
17621    Object.keys(m).forEach((key) => {
17622      const v = m[key];
17623
17624      main.variable(observer(key)).define(key, [], () => promiseMap[key]v);
17625    });
17626 */
17627    return main;
17628  };
17629}
17630
17631
17632// this is essentially the import resolution code from observable's
17633// runtime. we change it to add a license check for permissive
17634// open-source licenses before resolving the import
17635async function defaultResolveImportPath(path) {
17636  const extractPath = (path) => {
17637    let source = path;
17638    let m;
17639    if ((m = /\.js(\?|$)/i.exec(source))) {
17640      source = source.slice(0, m.index);
17641    }
17642    if ((m = /^[0-9a-f]{16}$/i.test(source))) {
17643      source = `d/${source}`;
17644    }
17645    if ((m = /^https:\/\/(api\.|beta\.|)observablehq\.com\//i.exec(source))) {
17646      source = source.slice(m[0].length);
17647    }
17648    return source;
17649  };
17650  const source = extractPath(path);
17651  const moduleURL = `https://api.observablehq.com/${source}.js?v=3`;
17652
17653  /* TODO This should be the implementation we use, once/if observable
17654  starts reporting notebook license on their metadata.
17655
17656  const metadata = await fetch(metadataURL, { mode: 'no-cors' });
17657  const nbJson = metadata.json();
17658  if (["isc", "mit", "bsd-3-clause", "apache-2.0"].indexOf(nbJson.license) === -1) {
17659    throw new Error(`Notebook doesn't have a permissive open-source license`);
17660  } */
17661
17662  const m = await import(moduleURL);
17663  return m.default;
17664}
17665
17666/*
17667  importPathResolver encodes the rules for ojsconnector to resolve
17668  import statements. 
17669
17670  This code doesn't depend have any dependencies on quarto, but some
17671  of the decisions here are influence by the needs of the quarto
17672  system.
17673
17674  We use the same name from observable's runtime so the intended
17675  functionality is clear.  However, note that their name is slightly
17676  misleading. importPathResolver not only resolves import paths but
17677  performs module imports as well. This is useful for us because it
17678  allows us to extend the meaning of ojs's import statement, but it
17679  makes the name confusing.
17680
17681  Here are the rules for our version of the import statement.
17682
17683  The function returned by importPathResolver expects a "module specifier", and
17684  produces a module as defined by observable's runtime.
17685
17686  ## Local vs remote vs observable imports
17687
17688  A module specifier is a string, interpreted differently depending on
17689  the following properties:
17690
17691  - it starts with "." or "/", in which case we call it a "local module"
17692
17693  - it is a well-defined absolute URL which does _not_ match the regexp:
17694    /^https:\/\/(api\.|beta\.|)observablehq\.com\//i
17695    in which case we call it a "remote import"
17696
17697  - otherwise, it is an "observable import"
17698
17699  If the string is an observable import, it behaves exactly like the import
17700  statement inside observable notebooks (we actually defer to their function
17701  call.) Otherwise, the import statement first retrieves the text content
17702  of the resource referenced by the path, and then interprets it.
17703
17704  ## where resources come from
17705
17706  When operating in non-self-contained mode, local and remote import
17707  paths are then interpreted as relative URLs (RFC 1808) with base URL
17708  window.location (specifically as "relative path" and "absolute path"
17709  relative URLs).
17710
17711  In self-contained mode, these paths are interpreted as paths in the
17712  quarto project, either as root-relative or relative paths. The
17713  contents of these files are converted to data URLs and stored in a
17714  local resolution map.
17715
17716  ## how are contents interpreted
17717
17718  The contents of the resource are then interpreted differently
17719  depending on the file type of the requested resource.
17720
17721  For non-self-contained imports, the file type is determined by the
17722  extension of the URL pathname. If the extension is "js", we take the
17723  specifier to mean an ES module; If the extension is "ojs", we take
17724  the specifier to mean an "ojs" module (a collection of observable
17725  statements packaged into a module, suitable for reuse). If the 
17726  extension is "ts" or "tsx", then this is an import that was actually transpiled 
17727  into js during quarto render, and we change the extension to .js and
17728  resolve that. Finally, if the extension is "qmd", we take the specifier
17729  to mean an "implicit ojs module", equivalent to extracting all
17730  the ojs statements from the .qmd file and producing an OJS module.
17731
17732  For self-contained imports, the file type is determined by the MIME
17733  type of the data URL. "application/javascript" is interpreted to
17734  mean an ES module, and "application/ojs-javascript" is interpreted
17735  to mean an "ojs" module. (.qmd imports will have been
17736  translated to ojs modules by the compilation step.)
17737
17738  The resources are finally retrieved, compiled into modules
17739  compatible with the observable runtime, and returned as
17740  the result of the import statement.
17741
17742*/
17743
17744function importPathResolver(paths, localResolverMap) {
17745  // NB: only resolve the field values in paths when calling rootPath
17746  // and relativePath. If we prematurely optimize this by moving the
17747  // const declarations outside, then we will capture the
17748  // uninitialized values.
17749
17750  // fetch() and import() have different relative path semantics, so
17751  // we need different paths for each use case
17752
17753  function importRootPath(path) {
17754    const { runtimeToRoot } = paths;
17755    if (!runtimeToRoot) {
17756      return path;
17757    } else {
17758      return `${runtimeToRoot}/${path}`;
17759    }
17760  }
17761
17762  function importRelativePath(path) {
17763    const { runtimeToDoc } = paths;
17764    if (!runtimeToDoc) {
17765      return path;
17766    } else {
17767      return `${runtimeToDoc}/${path}`;
17768    }
17769  }
17770
17771  // a fetch path of a root-relative path is resolved wrt to
17772  // the document root
17773  function fetchRootPath(path) {
17774    const { docToRoot } = paths;
17775    if (!docToRoot) {
17776      return path;
17777    } else {
17778      return `${docToRoot}/${path}`;
17779    }
17780  }
17781
17782  // a fetch path of a relative path is resolved the naive way
17783  function fetchRelativePath(path) {
17784    return path;
17785  }
17786
17787  return async (path, specs) => {
17788    const isLocalModule = path.startsWith("/") || path.startsWith(".");
17789    const isImportFromObservableWebsite = path.match(
17790      /^https:\/\/(api\.|beta\.|)observablehq\.com\//i,
17791    );
17792
17793    if (!isLocalModule || isImportFromObservableWebsite) {
17794      return defaultResolveImportPath(path);
17795    }
17796
17797    let importPath, fetchPath;
17798    let moduleType;
17799    if (window._ojs.selfContained) {
17800      if (path.endsWith(".ts")) {
17801        path = path.replace(/\.ts$/, ".js");
17802      } else if (path.endsWith(".tsx")) {
17803        path = path.replace(/\.tsx$/, ".js");
17804      }
17805      const resolved = localResolverMap.get(path);
17806      if (resolved === undefined) {
17807        throw new Error(`missing local file ${path} in self-contained mode`);
17808      }
17809      // self-contained resolves to data URLs, so they behave the same.
17810      importPath = resolved;
17811      fetchPath = resolved;
17812
17813      // we have a data URL here.
17814      const mimeType = resolved.match(/data:(.*);base64/)[1];
17815      switch (mimeType) {
17816        case "application/javascript":
17817          moduleType = "js";
17818          break;
17819        case "application/ojs-javascript":
17820          moduleType = "ojs";
17821          break;
17822        default:
17823          throw new Error(`unrecognized MIME type ${mimeType}`);
17824      }
17825    } else {
17826      // we have a relative URL here
17827      const resourceURL = new URL(path, window.location);
17828      moduleType = resourceURL.pathname.match(/\.(ojs|js|ts|tsx|qmd)$/)[1];
17829
17830      // resolve path according to quarto path resolution rules.
17831      if (path.startsWith("/")) {
17832        importPath = importRootPath(path);
17833        fetchPath = fetchRootPath(path);
17834      } else {
17835        importPath = importRelativePath(path);
17836        fetchPath = fetchRelativePath(path);
17837      }
17838    }
17839
17840    if (moduleType === "ts" || moduleType === "tsx") {
17841      try {
17842        const modulePromise = import(window._ojs.selfContained ? 
17843          importPath : 
17844          importPath.replace(/\.ts$/, ".js").replace(/\.tsx$/, ".js"));
17845        return es6ImportAsObservableModule(modulePromise, specs);
17846      } catch (e) {
17847        // record the error on the browser console to make debugging
17848        // slightly more convenient.
17849        console.error(e);
17850        throw e;
17851      }
17852    } else if (moduleType === "js") {
17853      try {
17854        const modulePromise = import(importPath);
17855        return es6ImportAsObservableModule(modulePromise, specs);
17856      } catch (e) {
17857        // record the error on the browser console to make debugging
17858        // slightly more convenient.
17859        console.error(e);
17860        throw e;
17861      }
17862    } else if (moduleType === "ojs") {
17863      return importOjsFromURL(fetchPath);
17864    } else if (moduleType === "qmd") {
17865      const htmlPath = `${fetchPath.slice(0, -4)}.html`;
17866      const response = await fetch(htmlPath);
17867      const text = await response.text();
17868      return createOjsModuleFromHTMLSrc(text);
17869    } else {
17870      throw new Error(`internal error, unrecognized module type ${moduleType}`);
17871    }
17872  };
17873}
17874
17875function createOjsModuleFromHTMLSrc(text) {
17876  const parser = new DOMParser();
17877  const doc = parser.parseFromString(text, "text/html");
17878  const staticDefns = [];
17879  for (const el of doc.querySelectorAll('script[type="ojs-define"]')) {
17880    staticDefns.push(el.text);
17881  }
17882  const ojsSource = [];
17883  for (
17884    const content of doc.querySelectorAll('script[type="ojs-module-contents"]')
17885  ) {
17886    for (const cell of JSON.parse(content.text).contents) {
17887      ojsSource.push(cell.source);
17888    }
17889  }
17890  return createOjsModuleFromSrc(ojsSource.join("\n"), staticDefns);
17891}
17892
17893function createOjsModuleFromSrc(src, staticDefns = []) {
17894  return (runtime, _observer) => {
17895    const newModule = runtime.module();
17896    const interpreter = window._ojs.ojsConnector.interpreter;
17897    interpreter.module(
17898      src,
17899      newModule,
17900      (_name) => new EmptyInspector(),
17901    );
17902    for (const defn of staticDefns) {
17903      for (const { name, value } of JSON.parse(defn).contents) {
17904        window._ojs.ojsConnector.define(name, newModule)(value);
17905      }
17906    }
17907    return newModule;
17908  };
17909}
17910
17911/*
17912  * Given a URL, fetches the text content and creates a new observable module
17913  * exporting all of the names as variables
17914  */
17915async function importOjsFromURL(path) {
17916  const r = await fetch(path);
17917  const src = await r.text();
17918  return createOjsModuleFromSrc(src);
17919}
17920
17921class OJSConnector {
17922  constructor({ paths, inspectorClass, library, allowPendingGlobals = false }) {
17923    this.library = library || new Library();
17924
17925    // this map contains a mapping from resource names to data URLs
17926    // that governs fileAttachment and import() resolutions in the
17927    // case of self-contained files.
17928    this.localResolverMap = new Map();
17929    // Keeps track of variables that have been requested by ojs code, but do
17930    // not exist (not in the module, not in the library, not on window).
17931    // The keys are variable names, the values are {promise, resolve, reject}.
17932    // This is intended to allow for a (hopefully brief) phase during startup
17933    // in which, if an ojs code chunk references a variable that is not defined,
17934    // instead of treating it as an "x is not defined" error we instead
17935    // take a wait-and-see approach, in case the variable dynamically becomes
17936    // defined later. When the phase ends, killPendingGlobals() must be called
17937    // so any variables that are still missing do cause "x is not defined"
17938    // errors.
17939    this.pendingGlobals = {};
17940    // When true, the mechanism described in the `this.pendingGlobals` comment
17941    // is used. When false, the result of accessing undefined variables is just
17942    // "x is not defined". This should be considered private, only settable via
17943    // constructor or `killPendingGlobals`.
17944    this.allowPendingGlobals = allowPendingGlobals;
17945    // NB it looks like Runtime makes a local copy of the library object,
17946    // such that mutating library after this is initializaed doesn't actually
17947    // work.
17948    this.runtime = new Runtime(this.library, (name) => this.global(name));
17949    this.mainModule = this.runtime.module();
17950    this.interpreter = new dist.exports.Interpreter({
17951      module: this.mainModule,
17952      resolveImportPath: importPathResolver(paths, this.localResolverMap),
17953    });
17954    this.inspectorClass = inspectorClass || Inspector;
17955
17956    // state to handle flash of unevaluated js because of async module imports
17957    this.mainModuleHasImports = false;
17958    this.mainModuleOutstandingImportCount = 0;
17959    this.chunkPromises = [];
17960  }
17961
17962  // Customizes the Runtime's behavior when an undefined variable is accessed.
17963  // This is needed for cases where the ojs graph is not all present at the
17964  // time of initialization; in particular, the case where a dependent cell
17965  // starts executing before one or more of its dependencies have been defined.
17966  // Without this customization, the user would see a flash of errors while the
17967  // graph is constructed; with this customization, the dependents stay blank
17968  // while they wait.
17969  global(name) {
17970    if (typeof window[name] !== "undefined") {
17971      return window[name];
17972    }
17973    if (!this.allowPendingGlobals) {
17974      return undefined;
17975    }
17976
17977    // deno-lint-ignore no-prototype-builtins
17978    if (!this.pendingGlobals.hasOwnProperty(name)) {
17979      // This is a pending global we haven't seen before. Stash a new promise,
17980      // along with its resolve/reject callbacks, in an object and remember it
17981      // for later.
17982      const info = {};
17983      info.promise = new Promise((resolve, reject) => {
17984        info.resolve = resolve;
17985        info.reject = reject;
17986      });
17987      this.pendingGlobals[name] = info;
17988    }
17989    return this.pendingGlobals[name].promise;
17990  }
17991
17992  // Signals the end of the "pending globals" phase. Any promises we've handed
17993  // out from the global() method now are rejected. (We never resolve these
17994  // promises to values; if these variables made an appearance, it would've
17995  // been as variables on modules.)
17996  killPendingGlobals() {
17997    this.allowPendingGlobals = false;
17998    for (const [name, { reject }] of Object.entries(this.pendingGlobals)) {
17999      reject(new RuntimeError(`${name} is not defined`));
18000    }
18001  }
18002
18003  setLocalResolver(map) {
18004    for (const [key, value] of Object.entries(map)) {
18005      this.localResolverMap.set(key, value);
18006    }
18007  }
18008
18009  define(name, module = undefined) {
18010    if (!module) {
18011      module = this.mainModule;
18012    }
18013    let change;
18014    const obs = this.library.Generators.observe((change_) => {
18015      change = change_;
18016      // TODO do something about destruction
18017    });
18018    module.variable().define(name, obs);
18019    return change;
18020  }
18021
18022  watch(name, k, module = undefined) {
18023    if (!module) {
18024      module = this.mainModule;
18025    }
18026    module.variable({
18027      fulfilled: (x) => k(x, name),
18028    }).define([name], (val) => val);
18029  }
18030
18031  async value(val, module = undefined) {
18032    if (!module) {
18033      module = this.mainModule;
18034    }
18035    const result = await module.value(val);
18036    return result;
18037  }
18038
18039  finishInterpreting() {
18040    return Promise.all(this.chunkPromises);
18041  }
18042  
18043  interpretWithRunner(src, runner) {
18044    try {
18045      const parse = parseModule(src);
18046      const chunkPromise = Promise.all(parse.cells.map(runner));
18047      this.chunkPromises.push(chunkPromise);
18048      return chunkPromise;
18049    } catch (error) {
18050      return Promise.reject(error);
18051    }
18052  }
18053
18054  waitOnImports(cell, promise) {
18055    if (cell.body.type !== "ImportDeclaration") {
18056      return promise;
18057    } else {
18058      this.mainModuleHasImports = true;
18059      this.mainModuleOutstandingImportCount++;
18060      return promise.then((result) => {
18061        this.mainModuleOutstandingImportCount--;
18062        if (this.mainModuleOutstandingImportCount === 0) {
18063          this.clearImportModuleWait();
18064        }
18065        return result;
18066      });
18067    }
18068  }
18069
18070  interpretQuiet(src) {
18071    const runCell = (cell) => {
18072      const cellSrc = src.slice(cell.start, cell.end);
18073      const promise = this.interpreter.module(
18074        cellSrc,
18075        undefined,
18076        (_name) => new EmptyInspector(),
18077      );
18078      return this.waitOnImports(cell, promise);
18079    };
18080    return this.interpretWithRunner(src, runCell);
18081  }
18082}
18083
18084/*!
18085 * escape-html
18086 * Copyright(c) 2012-2013 TJ Holowaychuk
18087 * Copyright(c) 2015 Andreas Lubbe
18088 * Copyright(c) 2015 Tiancheng "Timothy" Gu
18089 * Copyright(c) 2022 RStudio, PBC
18090 * 
18091 * MIT Licensed
18092 *
18093 * Minimal changes to make ES6
18094 * 
18095 */
18096
18097var matchHtmlRegExp = /["'&<>]/;
18098
18099/**
18100 * Escape special characters in the given string of text.
18101 *
18102 * @param  {string} string The string to escape for inserting into HTML
18103 * @return {string}
18104 * @public
18105 */
18106
18107function escapeHtml (string) {
18108  var str = '' + string;
18109  var match = matchHtmlRegExp.exec(str);
18110
18111  if (!match) {
18112    return str
18113  }
18114
18115  var escape;
18116  var html = '';
18117  var index = 0;
18118  var lastIndex = 0;
18119
18120  for (index = match.index; index < str.length; index++) {
18121    switch (str.charCodeAt(index)) {
18122      case 34: // "
18123        escape = '&quot;';
18124        break
18125      case 38: // &
18126        escape = '&amp;';
18127        break
18128      case 39: // '
18129        escape = '&#39;';
18130        break
18131      case 60: // <
18132        escape = '&lt;';
18133        break
18134      case 62: // >
18135        escape = '&gt;';
18136        break
18137      default:
18138        continue
18139    }
18140
18141    if (lastIndex !== index) {
18142      html += str.substring(lastIndex, index);
18143    }
18144
18145    lastIndex = index + 1;
18146    html += escape;
18147  }
18148
18149  return lastIndex !== index
18150    ? html + str.substring(lastIndex, index)
18151    : html
18152}
18153
18154function createHtmlElement(tag, attrs, ...children) {
18155  const el = document.createElement(tag);
18156  for (const [key, val] of Object.entries(attrs || {})) {
18157    el.setAttribute(key, val);
18158  }
18159  while (children.length) {
18160    const child = children.shift();
18161    if (Array.isArray(child)) {
18162      children.unshift(...child);
18163    } else if (child instanceof HTMLElement) {
18164      el.appendChild(child);
18165    } else {
18166      el.appendChild(document.createTextNode(escapeHtml(child)));
18167    }
18168  }
18169  return el;
18170}
18171
18172function createNamespacedElement(ns, tag, attrs, ...children) {
18173  const el = document.createElementNS(ns.namespace, tag);
18174  for (const [key, val] of Object.entries(attrs || {})) {
18175    el.setAttribute(key, val);
18176  }
18177  while (children.length) {
18178    const child = children.shift();
18179    if (Array.isArray(child)) {
18180      children.unshift(...child);
18181    } else if (child instanceof HTMLElement || child instanceof ns.class) {
18182      el.appendChild(child);
18183    } else {
18184      el.appendChild(document.createTextNode(escapeHtml(child)));
18185    }
18186  }
18187  return el;
18188}
18189
18190const resolver = {
18191  a: "svg",
18192  animate: "svg",
18193  animateMotion: "svg",
18194  animateTransform: "svg",
18195  circle: "svg",
18196  clipPath: "svg",
18197  defs: "svg",
18198  desc: "svg",
18199  discard: "svg",
18200  ellipse: "svg",
18201  feBlend: "svg",
18202  feColorMatrix: "svg",
18203  feComponentTransfer: "svg",
18204  feComposite: "svg",
18205  feConvolveMatrix: "svg",
18206  feDiffuseLighting: "svg",
18207  feDisplacementMap: "svg",
18208  feDistantLight: "svg",
18209  feDropShadow: "svg",
18210  feFlood: "svg",
18211  feFuncA: "svg",
18212  feFuncB: "svg",
18213  feFuncG: "svg",
18214  feFuncR: "svg",
18215  feGaussianBlur: "svg",
18216  feImage: "svg",
18217  feMerge: "svg",
18218  feMergeNode: "svg",
18219  feMorphology: "svg",
18220  feOffset: "svg",
18221  fePointLight: "svg",
18222  feSpecularLighting: "svg",
18223  feSpotLight: "svg",
18224  feTile: "svg",
18225  feTurbulence: "svg",
18226  filter: "svg",
18227  foreignObject: "svg",
18228  g: "svg",
18229  image: "svg",
18230  line: "svg",
18231  linearGradient: "svg",
18232  marker: "svg",
18233  mask: "svg",
18234  metadata: "svg",
18235  mpath: "svg",
18236  path: "svg",
18237  pattern: "svg",
18238  polygon: "svg",
18239  polyline: "svg",
18240  radialGradient: "svg",
18241  rect: "svg",
18242  script: "svg",
18243  set: "svg",
18244  stop: "svg",
18245  style: "svg",
18246  svg: "svg",
18247  switch: "svg",
18248  symbol: "svg",
18249  text: "svg",
18250  textPath: "svg",
18251  title: "svg",
18252  tspan: "svg",
18253  use: "svg",
18254  view: "svg",  
18255};
18256
18257const nss = {
18258  "svg": { namespace: "http://www.w3.org/2000/svg", class: SVGElement }
18259};
18260
18261function resolveCreator(tag) {
18262  const nsKey = resolver[tag];
18263  if (nsKey === undefined) {
18264    return createHtmlElement;
18265  }
18266  const namespace = nss[nsKey];
18267
18268  return function(tag, attrs, ...children) {
18269    return createNamespacedElement(namespace, tag, attrs, ...children);
18270  }
18271}
18272
18273function createQuartoJsxShim()
18274{
18275  return {
18276    createElement(tag, attrs, ...children) {
18277      if (typeof tag === "function") {
18278        return tag({...attrs, children });
18279      }
18280
18281      return resolveCreator(tag)(tag, attrs, ...children);
18282    }
18283  };
18284}
18285
18286/*global Shiny, $, DOMParser, MutationObserver, URL
18287 *
18288 * quarto-ojs.js
18289 *
18290 * Copyright (C) 2021 RStudio, PBC
18291 *
18292 */
18293
18294//////////////////////////////////////////////////////////////////////////////
18295// Quarto-specific code starts here.
18296
18297// For RStudio IDE integration
18298/** creates a click handler to point the IDE to a given line and column */
18299const makeDevhostErrorClickHandler = (line, column) => {
18300  return function () {
18301    if (!window.quartoDevhost) {
18302      return false;
18303    }
18304    window.quartoDevhost.openInputFile(line, column, true);
18305    return false;
18306  };
18307};
18308
18309// we cannot depend on Object.fromEntries because the IDE
18310// doesn't support it. We minimally polyfill it
18311if (Object.fromEntries === undefined) {
18312  Object.fromEntries = function (obj) {
18313    const result = {};
18314    for (const [key, value] of obj) {
18315      result[key] = value;
18316    }
18317    return result;
18318  };
18319}
18320
18321/** create a callout block with the given opts, currently to be used
18322    to signal a runtime error in the observable runtime.
18323*/
18324function calloutBlock(opts) {
18325  const { type, heading, message, onclick } = opts;
18326
18327  const outerBlock = document.createElement("div");
18328  outerBlock.classList.add(
18329    `callout-${type}`,
18330    "callout",
18331    "callout-style-default",
18332    "callout-captioned"
18333  );
18334  const header = document.createElement("div");
18335  header.classList.add("callout-header", "d-flex", "align-content-center");
18336  const iconContainer = document.createElement("div");
18337  iconContainer.classList.add("callout-icon-container");
18338  const icon = document.createElement("i");
18339  icon.classList.add("callout-icon");
18340  iconContainer.appendChild(icon);
18341  header.appendChild(iconContainer);
18342
18343  const headingDiv = document.createElement("div");
18344  headingDiv.classList.add("callout-caption-container", "flex-fill");
18345  // we assume heading is either a string or a span
18346  if (typeof heading === "string") {
18347    headingDiv.innerText = heading;
18348  } else {
18349    headingDiv.appendChild(heading);
18350  }
18351  header.appendChild(headingDiv);
18352  outerBlock.appendChild(header);
18353
18354  const container = document.createElement("div");
18355  container.classList.add("callout-body-container", "callout-body");
18356  if (typeof message === "string") {
18357    const p = document.createElement("p");
18358    p.innerText = message;
18359    container.appendChild(p);
18360  } else {
18361    container.append(message);
18362  }
18363  outerBlock.appendChild(container);
18364
18365  if (onclick) {
18366    outerBlock.onclick = onclick;
18367    outerBlock.style.cursor = "pointer";
18368  }
18369
18370  return outerBlock;
18371}
18372
18373const kQuartoModuleWaitClass = "ojs-in-a-box-waiting-for-module-import";
18374
18375class QuartoOJSConnector extends OJSConnector {
18376  constructor(opts) {
18377    super(opts);
18378  }
18379
18380  ////////////////////////////////////////////////////////////////////////////
18381  // handle import module waits
18382
18383  clearImportModuleWait() {
18384    const array = Array.from(
18385      document.querySelectorAll(`.${kQuartoModuleWaitClass}`)
18386    );
18387    for (const node of array) {
18388      node.classList.remove(kQuartoModuleWaitClass);
18389    }
18390  }
18391
18392  finishInterpreting() {
18393    return super.finishInterpreting().then(() => {
18394      if (this.mainModuleHasImports) {
18395        this.clearImportModuleWait();
18396      }
18397    });
18398  }
18399
18400  ////////////////////////////////////////////////////////////////////////////
18401  // Error tracking/reporting
18402
18403  locatePreDiv(cellDiv, ojsDiv) {
18404    // locate the correct pre div with the pandocDecorator
18405    // of all potential divs, we need to find the one that most
18406    // immediately precedes `ojsDiv` in the DOM.
18407    let preDiv;
18408    for (const candidate of cellDiv.querySelectorAll("pre.sourceCode")) {
18409      if (
18410        candidate.compareDocumentPosition(ojsDiv) &
18411        ojsDiv.DOCUMENT_POSITION_FOLLOWING
18412      ) {
18413        preDiv = candidate;
18414      } else {
18415        break;
18416      }
18417    }
18418    return preDiv;
18419  }
18420
18421  findCellOutputDisplay(ojsDiv) {
18422    while (ojsDiv && !ojsDiv.classList.contains("cell-output-display")) {
18423      ojsDiv = ojsDiv.parentElement;
18424    }
18425    if (!ojsDiv) {
18426      return null;
18427    }
18428    return ojsDiv;
18429  }
18430
18431  setPreDivClasses(preDiv, hasErrors) {
18432    if (!hasErrors) {
18433      preDiv.classList.remove("numberSource");
18434      if (preDiv._hidden === true) {
18435        const parent = preDiv.parentElement;
18436        parent.classList.add("hidden");
18437        // when code-tools is active (that is, when pre is inside a details tag), we also need to hide the details tag.
18438        if (parent.parentElement.tagName === "DETAILS") {
18439          parent.parentElement.classList.add("hidden");
18440        }
18441      }
18442    } else {
18443      preDiv.classList.add("numberSource");
18444      const parent = preDiv.parentElement;
18445      if (parent.classList.contains("hidden")) {
18446        preDiv._hidden = true; // signal that we used to be hidden so that when errors go away, we're hidden again.
18447        parent.classList.remove("hidden");
18448
18449        // when code-tools is active (that is, when pre is inside a details tag), we also need to unhide the details tag.
18450        if (parent.parentElement.tagName === "DETAILS") {
18451          parent.parentElement.classList.remove("hidden");
18452          // open the code-tools by default when error happens.
18453          parent.parentElement.setAttribute("open", "open");
18454        }
18455      }
18456    }
18457  }
18458
18459  clearErrorPinpoints(cellDiv, ojsDiv) {
18460    const preDiv = this.locatePreDiv(cellDiv, ojsDiv);
18461    if (preDiv === undefined) {
18462      return;
18463    }
18464    this.setPreDivClasses(preDiv, false);
18465    let startingOffset = 0;
18466    if (preDiv.parentElement.dataset.sourceOffset) {
18467      startingOffset = -Number(preDiv.parentElement.dataset.sourceOffset);
18468    }
18469    for (const entryPoint of preDiv._decorator.spanSelection(
18470      startingOffset,
18471      Infinity
18472    )) {
18473      const { node } = entryPoint;
18474      node.classList.remove("quarto-ojs-error-pinpoint");
18475      node.onclick = null;
18476    }
18477  }
18478
18479  decorateOjsDivWithErrorPinpoint(ojsDiv, start, end, line, column) {
18480    const cellOutputDisplay = this.findCellOutputDisplay(ojsDiv);
18481    // if ojs element is inline, there's no div.
18482    if (!cellOutputDisplay) {
18483      return;
18484    }
18485    if (cellOutputDisplay._errorSpans === undefined) {
18486      cellOutputDisplay._errorSpans = [];
18487    }
18488    cellOutputDisplay._errorSpans.push({
18489      start,
18490      end,
18491      line,
18492      column,
18493    });
18494  }
18495
18496  decorateSource(cellDiv, ojsDiv) {
18497    if (!cellDiv) {
18498      // no div in inline spans
18499      return;
18500    }
18501    this.clearErrorPinpoints(cellDiv, ojsDiv);
18502    const preDiv = this.locatePreDiv(cellDiv, ojsDiv);
18503    // sometimes the source code is not echoed.
18504    // FIXME: should ojs source always be "hidden" so we can show it
18505    // in case of runtime errors?
18506    if (preDiv === undefined) {
18507      return;
18508    }
18509    // now find all ojsDivs that contain errors that need to be decorated
18510    // on preDiv
18511    let parent = preDiv.parentElement;
18512    if (parent.parentElement.tagName === "DETAILS") {
18513      // we're in a code-tools setting, need to go one further up
18514      parent = parent.parentElement;
18515    }
18516    let div = parent.nextElementSibling;
18517    let foundErrors = false;
18518    while (div !== null && div.classList.contains("cell-output-display")) {
18519      for (const errorSpan of div._errorSpans || []) {
18520        for (const entryPoint of preDiv._decorator.spanSelection(
18521          errorSpan.start,
18522          errorSpan.end
18523        )) {
18524          const { node } = entryPoint;
18525          node.classList.add("quarto-ojs-error-pinpoint");
18526          node.onclick = makeDevhostErrorClickHandler(
18527            errorSpan.line,
18528            errorSpan.column
18529          );
18530        }
18531        foundErrors = true;
18532      }
18533      div = div.nextElementSibling;
18534    }
18535    this.setPreDivClasses(preDiv, foundErrors);
18536  }
18537
18538  clearError(ojsDiv) {
18539    const cellOutputDisplay = this.findCellOutputDisplay(ojsDiv);
18540    // if ojs element is inline, there's no div.
18541    if (cellOutputDisplay)
18542      cellOutputDisplay._errorSpans = [];
18543  }
18544
18545  signalError(cellDiv, ojsDiv, ojsAst) {
18546    const buildCallout = (ojsDiv) => {
18547      let onclick;
18548      const inspectChild = ojsDiv.querySelector(".observablehq--inspect");
18549      let [heading, message] = inspectChild.textContent.split(": ");
18550      if (heading === "RuntimeError") {
18551        heading = "OJS Runtime Error";
18552        if (message.match(/^(.+) is not defined$/)) {
18553          const [varName, ...rest] = message.split(" ");
18554          const p = document.createElement("p");
18555          const tt = document.createElement("tt");
18556          tt.innerText = varName;
18557          p.appendChild(tt);
18558          p.appendChild(document.createTextNode(" " + rest.join(" ")));
18559          message = p;
18560
18561          const preDiv = this.locatePreDiv(cellDiv, ojsDiv);
18562          // preDiv might not be exist in case source isn't echoed to HTML
18563          if (preDiv !== undefined) {
18564            // force line numbers to show
18565            preDiv.classList.add("numberSource");
18566            const missingRef = ojsAst.references.find(
18567              (n) => n.name === varName
18568            );
18569            // TODO when missingRef === undefined, it likely means an unresolved
18570            // import reference. For now we will leave things as is, but
18571            // this needs better handling.
18572            if (missingRef !== undefined) {
18573              const { line, column } = preDiv._decorator.offsetToLineColumn(
18574                missingRef.start
18575              );
18576              const headingSpan = document.createElement("span");
18577              const headingTextEl = document.createTextNode(
18578                `${heading} (line ${line}, column ${column}) `
18579              );
18580              headingSpan.appendChild(headingTextEl);
18581              if (window.quartoDevhost) {
18582                const clicker = document.createElement("a");
18583                clicker.href = "#"; // this forces the right CSS to apply
18584                clicker.innerText = "(source)";
18585                onclick = makeDevhostErrorClickHandler(line, column);
18586                headingSpan.appendChild(clicker);
18587              }
18588              heading = headingSpan;
18589              this.decorateOjsDivWithErrorPinpoint(
18590                ojsDiv,
18591                missingRef.start,
18592                missingRef.end,
18593                line,
18594                column
18595              );
18596            }
18597          }
18598        } else if (
18599          message.match(/^(.+) could not be resolved$/) ||
18600          message.match(/^(.+) is defined more than once$/)
18601        ) {
18602          const [varName, ...rest] = message.split(" ");
18603          const p = document.createElement("p");
18604          const tt = document.createElement("tt");
18605          tt.innerText = varName;
18606          p.appendChild(tt);
18607          p.appendChild(document.createTextNode(" " + rest.join(" ")));
18608          message = p;
18609        } else {
18610          const p = document.createElement("p");
18611          p.appendChild(document.createTextNode(message));
18612          message = p;
18613        }
18614      } else {
18615        heading = "OJS Error";
18616        const p = document.createElement("p");
18617        p.appendChild(document.createTextNode(inspectChild.textContent));
18618        message = p;
18619      }
18620      const callout = calloutBlock({
18621        type: "important",
18622        heading,
18623        message,
18624        onclick,
18625      });
18626      ojsDiv.appendChild(callout);
18627    };
18628
18629    buildCallout(ojsDiv);
18630  }
18631
18632  interpret(src, elementGetter, elementCreator) {
18633    // deno-lint-ignore no-this-alias
18634    const that = this;
18635    const observer = (targetElement, ojsAst) => {
18636      return (name) => {
18637        const element =
18638          typeof elementCreator === "function"
18639            ? elementCreator()
18640            : elementCreator;
18641        targetElement.appendChild(element);
18642
18643        // TODO the unofficial interpreter always calls viewexpression observers
18644        // twice, one with the name, and the next with 'viewof $name'.
18645        // we check for 'viewof ' here and hide the element we're creating.
18646        // this behavior appears inconsistent with OHQ's interpreter, so we
18647        // shouldn't be surprised to see this fail in the future.
18648        if (
18649          ojsAst.id &&
18650          ojsAst.id.type === "ViewExpression" &&
18651          !name.startsWith("viewof ")
18652        ) {
18653          element.classList.add("quarto-ojs-hide");
18654        }
18655
18656        // handle output:all hiding
18657        //
18658        // if every output from a cell is is not displayed, then we
18659        // must also not display the cell output display element
18660        // itself.
18661
18662        // collect the cell element as well as the cell output display
18663        // element
18664        let cellDiv = targetElement;
18665        let cellOutputDisplay;
18666        while (cellDiv !== null && !cellDiv.classList.contains("cell")) {
18667          cellDiv = cellDiv.parentElement;
18668          if (cellDiv && cellDiv.classList.contains("cell-output-display")) {
18669            cellOutputDisplay = cellDiv;
18670          }
18671        }
18672        const forceShowDeclarations = !(
18673          cellDiv && cellDiv.dataset.output !== "all"
18674        );
18675
18676        const config = { childList: true };
18677        const callback = function (mutationsList) {
18678          // we may fail to find a cell in inline settings; but
18679          // inline cells won't have inspectors, so in that case
18680          // we never hide
18681          for (const mutation of mutationsList) {
18682            const ojsDiv = mutation.target;
18683
18684            if (!forceShowDeclarations) {
18685              const childNodes = Array.from(mutation.target.childNodes);
18686              for (const n of childNodes) {
18687                // hide the inner inspect outputs that aren't errors or
18688                // declarations
18689                if (
18690                  n.classList.contains("observablehq--inspect") &&
18691                  !n.parentNode.classList.contains("observablehq--error") &&
18692                  n.parentNode.parentNode.dataset.nodetype !== "expression"
18693                ) {
18694                  n.classList.add("quarto-ojs-hide");
18695                }
18696                // show the inspect outputs that aren't errors and are
18697                // expressions (they might have been hidden in the past,
18698                // since errors can clear)
18699                if (
18700                  n.classList.contains("observablehq--inspect") &&
18701                  !n.parentNode.classList.contains("observablehq--error") &&
18702                  n.parentNode.parentNode.dataset.nodetype === "expression"
18703                ) {
18704                  n.classList.remove("quarto-ojs-hide");
18705                }
18706              }
18707            }
18708
18709            // if the ojsDiv shows an error, display a callout block instead of it.
18710            if (ojsDiv.classList.contains("observablehq--error")) {
18711              // we don't use quarto-ojs-hide here because that would confuse
18712              // the code which depends on that class for its logic.
18713              ojsDiv.querySelector(".observablehq--inspect").style.display =
18714                "none";
18715
18716              if (ojsDiv.querySelectorAll(".callout-important").length === 0) {
18717                that.signalError(cellDiv, ojsDiv, ojsAst);
18718              }
18719            } else {
18720              that.clearError(ojsDiv);
18721              if (
18722                ojsDiv.parentNode.dataset.nodetype !== "expression" &&
18723                !forceShowDeclarations &&
18724                Array.from(ojsDiv.childNodes).every((n) =>
18725                  n.classList.contains("observablehq--inspect")
18726                )
18727              ) {
18728                // if every child is an inspect output, hide the ojsDiv
18729                ojsDiv.classList.add("quarto-ojs-hide");
18730              }
18731            }
18732
18733            that.decorateSource(cellDiv, ojsDiv);
18734
18735            // hide import statements even if output === "all"
18736            for (const added of mutation.addedNodes) {
18737              if (
18738                added.tagName === "FORM" &&
18739                Array.from(added.classList).some(
18740                  (x) => x.endsWith("table") && x.startsWith("oi-")
18741                )
18742              ) {
18743                added.classList.add("quarto-ojs-table-fixup");
18744              }
18745
18746              const addedButtons = added.querySelectorAll("button");
18747              for (const button of Array.from(addedButtons)) {
18748                button.classList.add("btn");
18749                button.classList.add("btn-quarto");
18750              }
18751              //// Hide imports that aren't javascript code
18752              //
18753              // We search here for code.javascript and node span.hljs-... be
18753cause
18754              // at this point in the DOM, observable's runtime hasn't called
18755              // HLJS yet. if you inspect the DOM yourself, you're likely to see
18756              // HLJS, so this comment is here to prevent future confusion.
18757              const result = added.querySelectorAll("code.javascript");
18758              if (result.length !== 1) {
18759                continue;
18760              }
18761              if (result[0].textContent.trim().startsWith("import")) {
18762                ojsDiv.classList.add("quarto-ojs-hide");
18763              }
18764            }
18765          }
18766
18767          // cellOutputDisplay doesn't exist in inline spans, so we must check it explicitly
18768          if (cellOutputDisplay) {
18769            const children = Array.from(
18770              cellOutputDisplay.querySelectorAll("div.observablehq")
18771            );
18772            // after all mutations are handled, we check the full cell for hiding
18773            if (
18774              children.every((n) => {
18775                return n.classList.contains("quarto-ojs-hide");
18776              })
18777            ) {
18778              cellOutputDisplay.classList.add("quarto-ojs-hide");
18779            } else {
18780              cellOutputDisplay.classList.remove("quarto-ojs-hide");
18781            }
18782          }
18783        };
18784        new MutationObserver(callback).observe(element, config);
18785        // 'element' is the outer div given to observable's runtime to insert their output
18786        // every quarto cell will have either one or two such divs.
18787        // The parent of these divs should always be a div corresponding to an ojs "cell"
18788        // (with ids "ojs-cell-*")
18789
18790        element.classList.add(kQuartoModuleWaitClass);
18791
18792        return new this.inspectorClass(element, ojsAst);
18793      };
18794    };
18795    const runCell = (cell) => {
18796      const targetElement =
18797        typeof elementGetter === "function" ? elementGetter() : elementGetter;
18798      const cellSrc = src.slice(cell.start, cell.end);
18799      const promise = this.interpreter.module(
18800        cellSrc,
18801        undefined,
18802        observer(targetElement, cell)
18803      );
18804      return this.waitOnImports(cell, promise);
18805    };
18806    return this.interpretWithRunner(src, runCell);
18807  }
18808}
18809
18810//////////////////////////////////////////////////////////////////////////////
18811// previously quarto-observable-shiny.js
18812
18813function createRuntime() {
18814  const quartoOjsGlobal = window._ojs;
18815  const isShiny = window.Shiny !== undefined;
18816
18817  // Are we shiny?
18818  if (isShiny) {
18819    quartoOjsGlobal.hasShiny = true;
18820    initOjsShinyRuntime();
18821
18822    const span = document.createElement("span");
18823    window._ojs.shinyElementRoot = span;
18824    document.body.appendChild(span);
18825  }
18826
18827  // we use the trick described here to extend observable runtime's standard library
18828  // https://talk.observablehq.com/t/embedded-width/1063
18829
18830  // stdlib from our fork, which uses the safe d3-require
18831  const lib = new Library();
18832  if (isShiny) {
18833    extendObservableStdlib(lib);
18834  }
18835
18836  function transpose(df) {
18837    const keys = Object.keys(df);
18838    return df[keys[0]]
18839      .map((v, i) =>
18840        Object.fromEntries(keys.map((key) => {
18841          const v = df[key][i];
18842          const result = v === null ? undefined : v;
18843          return [key, result];
18844        })))
18845      .filter((v) => !Object.values(v).every((e) => e === undefined));
18846  }
18847  lib.transpose = () => transpose;
18848
18849  const mainEl = document.querySelector("main");
18850  function width() {
18851    return lib.Generators.observe(function (change) {
18852      var width = change(mainEl.clientWidth);
18853      function resized() {
18854        var w = mainEl.clientWidth;
18855        if (w !== width) change((width = w));
18856      }
18857      window.addEventListener("resize", resized);
18858      return function () {
18859        window.removeEventListener("resize", resized);
18860      };
18861    });
18862  }
18863  lib.width = width;
18864
18865  // hack for "echo: fenced": remove all "//| echo: fenced" lines the hard way, but keep
18866  // the right line numbers around.
18867  Array.from(document.querySelectorAll("span.co"))
18868    .filter((n) => n.textContent === "//| echo: fenced")
18869    .forEach((n) => {
18870      const lineSpan = n.parentElement;
18871      const lineBreak = lineSpan.nextSibling;
18872      if (lineBreak) {
18873        const nextLineSpan = lineBreak.nextSibling;
18874        if (nextLineSpan) {
18875          const lineNumber = Number(nextLineSpan.id.split("-")[1]);
18876          nextLineSpan.style = `counter-reset: source-line ${lineNumber - 1}`;
18877        }
18878      }
18879
18880      // update the source offset variable with the new right amount
18881      const sourceDiv = lineSpan.parentElement.parentElement.parentElement;
18882      const oldOffset = Number(sourceDiv.dataset.sourceOffset);
18883      sourceDiv.dataset.sourceOffset = oldOffset - "//| echo: fenced\n".length;
18884
18885      lineSpan.remove();
18886      lineBreak.remove();
18887    });
18888
18889  // select all elements to track:
18890  //   panel elements with ids, and divs with ids and .ojs-track-layout
18891
18892  const layoutDivs = [...Array.from(
18893    document.querySelectorAll("div.quarto-layout-panel div[id]")
18894  ),
18895  ...Array.from(
18896    document.querySelectorAll('div.ojs-track-layout[id]')
18897  )];
18898  
18899  function layoutWidth() {
18900    return lib.Generators.observe(function (change) {
18901      const ourWidths = Object.fromEntries(
18902        layoutDivs.map((div) => [div.id, div.clientWidth])
18903      );
18904      change(ourWidths);
18905      function resized() {
18906        let changed = false;
18907        for (const div of layoutDivs) {
18908          const w = div.clientWidth;
18909          if (w !== ourWidths[div.id]) {
18910            ourWidths[div.id] = w;
18911            changed = true;
18912          }
18913        }
18914        if (changed) {
18915          change(ourWidths);
18916        }
18917      }
18918      window.addEventListener("resize", resized);
18919      return function () {
18920        window.removeEventListener("resize", resized);
18921      };
18922    });
18923  }
18924  lib.layoutWidth = layoutWidth;
18925  let localResolver = {};
18926
18927  function fileAttachmentPathResolver(n) {
18928    if (localResolver[n]) {
18929      return localResolver[n];
18930    }
18931
18932    if (n.startsWith("/")) {
18933      // docToRoot can be empty, in which case naive concatenation creates
18934      // an absolute path.
18935      if (quartoOjsGlobal.paths.docToRoot === "") {
18936        return `.${n}`;
18937      } else {
18938        return `${quartoOjsGlobal.paths.docToRoot}${n}`;
18939      }
18940    } else {
18941      return n;
18942    }
18943  }
18944  lib.FileAttachment = () => FileAttachments(fileAttachmentPathResolver);
18945
18946  const ojsConnector = new QuartoOJSConnector({
18947    paths: quartoOjsGlobal.paths,
18948    inspectorClass: isShiny ? ShinyInspector : QuartoInspector,
18949    library: lib,
18950    allowPendingGlobals: isShiny,
18951  });
18952  quartoOjsGlobal.ojsConnector = ojsConnector;
18953  if (isShiny) {
18954    // When isShiny, OJSConnector is constructed with allowPendingGlobals:true.
18955    // Our guess is that most shiny-to-ojs exports will have been defined
18956    // by the time the server function finishes executing (i.e. session init
18957    // completion); so we call `killPendingGlobals()` to show errors for
18958    // variables that are still undefined.
18959    $(document).one("shiny:idle", () => {
18960      // "shiny:idle" is not late enough; it is raised before the resulting
18961      // outputs are received from the server.
18962      $(document).one("shiny:message", () => {
18963        // "shiny:message" is not late enough; it is raised after the message
18964        // is received, but before it is processed (i.e. variables are still
18965        // not actually defined).
18966        setTimeout(() => {
18967          ojsConnector.killPendingGlobals();
18968        }, 0);
18969      });
18970    });
18971  }
18972
18973  const subfigIdMap = new Map();
18974  function getSubfigId(elementId) {
18975    if (!subfigIdMap.has(elementId)) {
18976      subfigIdMap.set(elementId, 0);
18977    }
18978    let nextIx = subfigIdMap.get(elementId);
18979    nextIx++;
18980    subfigIdMap.set(elementId, nextIx);
18981    return `${elementId}-${nextIx}`;
18982  }
18983
18984  const sourceNodes = document.querySelectorAll(
18985    "pre.sourceCode code.sourceCode"
18986  );
18987  const decorators = Array.from(sourceNodes).map((n) => {
18988    n = n.parentElement;
18989    const decorator = new PandocCodeDecorator(n);
18990    n._decorator = decorator;
18991    return decorator;
18992  });
18993  // handle build-time syntax error
18994  decorators.forEach((n) => {
18995    if (n._node.parentElement.dataset.syntaxErrorPosition === undefined) {
18996      return;
18997    }
18998    const offset = Number(n._node.parentElement.dataset.syntaxErrorPosition);
18999    n.decorateSpan(offset, offset + 1, ["quarto-ojs-error-pinpoint"]);
19000  });
19001
19002  const result = {
19003    setLocalResolver(obj) {
19004      localResolver = obj;
19005      ojsConnector.setLocalResolver(obj);
19006    },
19007    finishInterpreting() {
19008      return ojsConnector.finishInterpreting();
19009    },
19010
19011    // return the latest value of the named reactive variable in the main module
19012    async value(name) {
19013      await this.finishInterpreting();
19014      const result = await ojsConnector.value(name);
19015      return result;
19016    },
19017
19018    // fixme clarify what's the expected behavior of the 'error' option
19019    // when evaluation is at client-time
19020    interpretLenient(src, targetElementId, inline) {
19021      return result.interpret(src, targetElementId, inline).catch(() => {});
19022    },
19023    interpret(src, targetElementId, inline) {
19024      // we capture the result here so that the error handler doesn't
19025      // grab a new id accidentally.
19026      let targetElement;
19027      const getElement = () => {
19028        targetElement = document.getElementById(targetElementId);
19029        let subFigId;
19030        if (!targetElement) {
19031          // this is a subfigure
19032          subFigId = getSubfigId(targetElementId);
19033          targetElement = document.getElementById(subFigId);
19034          if (!targetElement) {
19035            // console.error("Ran out of subfigures for element", targetElementId);
19036            // console.error("This will fail.");
19037            throw new Error("Ran out of quarto subfigures.");
19038          }
19039        }
19040        return targetElement;
19041      };
19042
19043      const makeElement = () => {
19044        return document.createElement(inline ? "span" : "div");
19045      };
19046
19047      return ojsConnector.interpret(src, getElement, makeElement).catch((e) => {
19048        // to the best of our knowledge, we only get here
19049        // on import statement failures. So we report those
19050        // in a callout
19051
19052        let cellDiv = targetElement;
19053        while (cellDiv !== null && !cellDiv.classList.contains("cell")) {
19054          cellDiv = cellDiv.parentElement;
19055        }
19056
19057        const ojsDiv = targetElement.querySelector(".observablehq");
19058        if (!ojsDiv) {
19059          // we failed to find an observablehq div inside the targetElement.
19060          // This is an internal error and we have no way to report it
19061          // except throwing the original exception.
19062          throw e;
19063        }
19064        // because this is in an exception handler, we might need
19065        // to clear some of the garbage that other pieces of code
19066        // won't have the chance to
19067        //
19068        for (const div of ojsDiv.querySelectorAll(".callout")) {
19069          div.remove();
19070        }
19071
19072        const messagePre = document.createElement("pre");
19073        messagePre.innerText = e.stack;
19074
19075        const callout = calloutBlock({
19076          type: "important",
19077          heading: `${e.name}: ${e.message}`,
19078          message: messagePre,
19079        });
19080        ojsDiv.appendChild(callout);
19081        ojsConnector.clearError(ojsDiv);
19082        ojsConnector.clearErrorPinpoints(cellDiv, ojsDiv);
19083
19084        return e;
19085      });
19086    },
19087    interpretQuiet(src) {
19088      return ojsConnector.interpretQuiet(src);
19089    },
19090    interpretFromScriptTags() {
19091      // source definitions
19092      for (const el of document.querySelectorAll(
19093        "script[type='ojs-module-contents']"
19094      )) {
19095        for (const call of JSON.parse(el.text).contents) {
19096          switch (call.methodName) {
19097            case "interpret":
19098              this.interpret(call.source, call.cellName, call.inline);
19099              break;
19100            case "interpretLenient":
19101              this.interpretLenient(call.source, call.cellName, call.inline);
19102              break;
19103            case "interpretQuiet":
19104              this.interpretQuiet(call.source);
19105              break;
19106            default:
19107              throw new Error(
19108                `Don't know how to call method ${call.methodName}`
19109              );
19110          }
19111        }
19112      }
19113
19114      // static data definitions
19115      for (const el of document.querySelectorAll("script[type='ojs-define']")) {
19116        for (const { name, value } of JSON.parse(el.text).contents) {
19117          ojsConnector.define(name)(value);
19118        }
19119      }
19120    },
19121  };
19122
19123  return result;
19124}
19125
19126
19127function initializeRuntime()
19128{
19129  // TODO "obs" or "ojs"? Inconsistent naming.
19130  window._ojs = {
19131    ojsConnector: undefined,
19132
19133    paths: {}, // placeholder for per-quarto-file paths
19134    // necessary for module resolution
19135
19136    hasShiny: false, // true if we have the quarto-ojs-shiny runtime
19137
19138    shinyElementRoot: undefined, // root element for the communication with shiny
19139    // via DOM
19140  };
19141  window._ojs.runtime = createRuntime();
19142  window._ojs.jsx = createQuartoJsxShim();
19143}
19144
19145initializeRuntime();
19146// export default init;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.