From 7e456ece3cfbfc4fea0fcdcac51736cbb580239e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Thu, 26 Oct 2023 15:47:11 +0200 Subject: [PATCH] feat(mdx-loader): upgrade to MDX v3 + (#9451) --- jest.config.mjs | 20 +- ...js__mdx@2.1.5.js => @mdx-js__mdx@3.0.0.js} | 31033 +++++++++------- ...s => estree-util-value-to-estree@3.0.1.js} | 30 +- ...3.1.0.js => mdast-util-to-string@4.0.0.js} | 40 +- jest/vendor/rehype-stringify@10.0.0.js | 2202 ++ ...ive@2.0.1.js => remark-directive@3.0.0.js} | 3177 +- jest/vendor/remark-gfm@3.0.1.js | 4907 --- jest/vendor/remark-gfm@4.0.0.js | 3457 ++ ...emark-mdx@2.1.5.js => remark-mdx@3.0.0.js} | 16248 ++++---- jest/vendor/remark-rehype@11.0.0.js | 1334 + .../{remark@14.0.2.js => remark@15.0.1.js} | 12841 ++++--- jest/vendor/unified@10.1.2.js | 779 - .../unist-util-remove-position@5.0.0.js | 240 + jest/vendor/unist-util-visit@5.0.0.js | 232 + package.json | 4 - .../templates/classic-typescript/package.json | 2 +- .../templates/classic/package.json | 2 +- packages/docusaurus-mdx-loader/package.json | 37 +- .../docusaurus-mdx-loader/src/processor.ts | 17 +- .../src/remark/admonitions/index.ts | 4 +- .../src/remark/contentTitle/index.ts | 5 +- .../src/remark/details/index.ts | 4 +- .../src/remark/head/index.ts | 4 +- .../remark/headings/__tests__/index.test.ts | 8 +- .../src/remark/headings/index.ts | 2 +- .../src/remark/mdx1Compat/codeCompatPlugin.ts | 14 +- .../src/remark/mermaid/index.ts | 5 +- .../src/remark/toc/index.ts | 14 +- .../src/remark/transformImage/index.ts | 3 +- .../src/remark/transformLinks/index.ts | 3 +- .../src/remark/unusedDirectives/index.ts | 55 +- .../src/remark/utils/index.ts | 2 +- .../src/{vfile-datamap.d.mts => types.d.mts} | 13 + .../package.json | 2 +- .../footnoteIDFixer.test.ts.snap | 40 +- .../src/remark/footnoteIDFixer.ts | 5 +- .../package.json | 12 +- .../src/index.ts | 5 +- .../docusaurus-theme-classic/package.json | 2 +- project-words.txt | 1 + .../index.mdx | 52 +- .../index.mdx | 2 +- website/docs/api/docusaurus.config.js.mdx | 2 +- .../markdown-features-math-equations.mdx | 4 +- .../markdown-features-react.mdx | 6 +- website/docs/migration/v3.mdx | 82 +- website/package.json | 6 +- website/src/remark/configTabs.js | 2 +- yarn.lock | 1625 +- 49 files changed, 42734 insertions(+), 35852 deletions(-) rename jest/vendor/{@mdx-js__mdx@2.1.5.js => @mdx-js__mdx@3.0.0.js} (66%) rename jest/vendor/{estree-util-value-to-estree@2.1.0.js => estree-util-value-to-estree@3.0.1.js} (88%) rename jest/vendor/{mdast-util-to-string@3.1.0.js => mdast-util-to-string@4.0.0.js} (51%) create mode 100644 jest/vendor/rehype-stringify@10.0.0.js rename jest/vendor/{remark-directive@2.0.1.js => remark-directive@3.0.0.js} (86%) delete mode 100644 jest/vendor/remark-gfm@3.0.1.js create mode 100644 jest/vendor/remark-gfm@4.0.0.js rename jest/vendor/{remark-mdx@2.1.5.js => remark-mdx@3.0.0.js} (79%) create mode 100644 jest/vendor/remark-rehype@11.0.0.js rename jest/vendor/{remark@14.0.2.js => remark@15.0.1.js} (65%) delete mode 100644 jest/vendor/unified@10.1.2.js create mode 100644 jest/vendor/unist-util-remove-position@5.0.0.js create mode 100644 jest/vendor/unist-util-visit@5.0.0.js rename packages/docusaurus-mdx-loader/src/{vfile-datamap.d.mts => types.d.mts} (76%) diff --git a/jest.config.mjs b/jest.config.mjs index 564e8a458271..3245daa850ce 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -86,16 +86,20 @@ export default { // MDX packages are ESM-only and it is a pain to use in Jest // So we use them in Jest tests as CJS versions // see https://mdxjs.com/docs/troubleshooting-mdx/#problems-integrating-mdx - '^unified$': '/jest/vendor/unified@10.1.2.js', - '^@mdx-js/mdx$': '/jest/vendor/@mdx-js__mdx@2.1.5.js', - '^remark$': '/jest/vendor/remark@14.0.2.js', - '^remark-mdx$': '/jest/vendor/remark-mdx@2.1.5.js', - '^remark-directive$': '/jest/vendor/remark-directive@2.0.1.js', - '^remark-gfm$': '/jest/vendor/remark-gfm@3.0.1.js', + '^@mdx-js/mdx$': '/jest/vendor/@mdx-js__mdx@3.0.0.js', + '^remark$': '/jest/vendor/remark@15.0.1.js', + '^remark-rehype$': '/jest/vendor/remark-rehype@11.0.0.js', + '^remark-mdx$': '/jest/vendor/remark-mdx@3.0.0.js', + '^remark-directive$': '/jest/vendor/remark-directive@3.0.0.js', + '^remark-gfm$': '/jest/vendor/remark-gfm@4.0.0.js', '^estree-util-value-to-estree$': - '/jest/vendor/estree-util-value-to-estree@2.1.0.js', + '/jest/vendor/estree-util-value-to-estree@3.0.1.js', '^mdast-util-to-string$': - '/jest/vendor/mdast-util-to-string@3.1.0.js', + '/jest/vendor/mdast-util-to-string@4.0.0.js', + '^unist-util-visit$': '/jest/vendor/unist-util-visit@5.0.0.js', + '^unist-util-remove-position$': + '/jest/vendor/unist-util-remove-position@5.0.0.js', + '^rehype-stringify$': '/jest/vendor/rehype-stringify@10.0.0.js', }, snapshotSerializers: [ '/jest/snapshotPathNormalizer.ts', diff --git a/jest/vendor/@mdx-js__mdx@2.1.5.js b/jest/vendor/@mdx-js__mdx@3.0.0.js similarity index 66% rename from jest/vendor/@mdx-js__mdx@2.1.5.js rename to jest/vendor/@mdx-js__mdx@3.0.0.js index 123a38c66fbe..40b998606a82 100644 --- a/jest/vendor/@mdx-js__mdx@2.1.5.js +++ b/jest/vendor/@mdx-js__mdx@3.0.0.js @@ -7,9 +7,9 @@ var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; -var __export = (target, all4) => { - for (var name2 in all4) - __defProp(target, name2, { get: all4[name2], enumerable: true }); +var __export = (target, all3) => { + for (var name2 in all3) + __defProp(target, name2, { get: all3[name2], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { @@ -20,111 +20,15 @@ var __copyProps = (to, from, except, desc) => { return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); -// node_modules/is-buffer/index.js -var require_is_buffer = __commonJS({ - "node_modules/is-buffer/index.js"(exports, module2) { - module2.exports = function isBuffer2(obj) { - return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj); - }; - } -}); - -// node_modules/extend/index.js -var require_extend = __commonJS({ - "node_modules/extend/index.js"(exports, module2) { - "use strict"; - var hasOwn2 = Object.prototype.hasOwnProperty; - var toStr = Object.prototype.toString; - var defineProperty = Object.defineProperty; - var gOPD = Object.getOwnPropertyDescriptor; - var isArray2 = function isArray3(arr) { - if (typeof Array.isArray === "function") { - return Array.isArray(arr); - } - return toStr.call(arr) === "[object Array]"; - }; - var isPlainObject2 = function isPlainObject3(obj) { - if (!obj || toStr.call(obj) !== "[object Object]") { - return false; - } - var hasOwnConstructor = hasOwn2.call(obj, "constructor"); - var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn2.call(obj.constructor.prototype, "isPrototypeOf"); - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } - var key; - for (key in obj) { - } - return typeof key === "undefined" || hasOwn2.call(obj, key); - }; - var setProperty = function setProperty2(target, options) { - if (defineProperty && options.name === "__proto__") { - defineProperty(target, options.name, { - enumerable: true, - configurable: true, - value: options.newValue, - writable: true - }); - } else { - target[options.name] = options.newValue; - } - }; - var getProperty = function getProperty2(obj, name2) { - if (name2 === "__proto__") { - if (!hasOwn2.call(obj, name2)) { - return void 0; - } else if (gOPD) { - return gOPD(obj, name2).value; - } - } - return obj[name2]; - }; - module2.exports = function extend3() { - var options, name2, src, copy, copyIsArray, clone; - var target = arguments[0]; - var i = 1; - var length = arguments.length; - var deep = false; - if (typeof target === "boolean") { - deep = target; - target = arguments[1] || {}; - i = 2; - } - if (target == null || typeof target !== "object" && typeof target !== "function") { - target = {}; - } - for (; i < length; ++i) { - options = arguments[i]; - if (options != null) { - for (name2 in options) { - src = getProperty(target, name2); - copy = getProperty(options, name2); - if (target !== copy) { - if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray2(copy)))) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray2(src) ? src : []; - } else { - clone = src && isPlainObject2(src) ? src : {}; - } - setProperty(target, { name: name2, newValue: extend3(deep, clone, copy) }); - } else if (typeof copy !== "undefined") { - setProperty(target, { name: name2, newValue: copy }); - } - } - } - } - } - return target; - }; - } -}); - // node_modules/acorn-jsx/xhtml.js var require_xhtml = __commonJS({ "node_modules/acorn-jsx/xhtml.js"(exports, module2) { @@ -389,13 +293,13 @@ var require_xhtml = __commonJS({ // node_modules/acorn/dist/acorn.js var require_acorn = __commonJS({ "node_modules/acorn/dist/acorn.js"(exports, module2) { - (function(global, factory2) { - typeof exports === "object" && typeof module2 !== "undefined" ? factory2(exports) : typeof define === "function" && define.amd ? define(["exports"], factory2) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory2(global.acorn = {})); + (function(global, factory) { + typeof exports === "object" && typeof module2 !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.acorn = {})); })(exports, function(exports2) { "use strict"; - var astralIdentifierCodes2 = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; - var astralIdentifierStartCodes2 = [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]; - var nonASCIIidentifierChars2 = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; + var astralIdentifierCodes2 = [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, 81, 2, 71, 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, 3, 0, 158, 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, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 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, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; + var astralIdentifierStartCodes2 = [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, 20, 1, 64, 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, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 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, 16, 0, 30, 2, 3, 0, 15, 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, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 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, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191]; + var nonASCIIidentifierChars2 = "\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\u0CF3\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-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; var nonASCIIidentifierStartChars2 = "\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"; var reservedWords2 = { 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", @@ -425,6 +329,7 @@ var require_acorn = __commonJS({ return true; } } + return false; } function isIdentifierStart2(code2, astral) { if (code2 < 65) { @@ -506,6 +411,7 @@ var require_acorn = __commonJS({ name: new TokenType3("name", startsExpr2), privateId: new TokenType3("privateId", startsExpr2), eof: new TokenType3("eof"), + // Punctuation token types. bracketL: new TokenType3("[", { beforeExpr: true, startsExpr: true }), bracketR: new TokenType3("]"), braceL: new TokenType3("{", { beforeExpr: true, startsExpr: true }), @@ -524,6 +430,19 @@ var require_acorn = __commonJS({ ellipsis: new TokenType3("...", beforeExpr2), backQuote: new TokenType3("`", startsExpr2), dollarBraceL: new TokenType3("${", { beforeExpr: true, startsExpr: true }), + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. eq: new TokenType3("=", { beforeExpr: true, isAssign: true }), assign: new TokenType3("_=", { beforeExpr: true, isAssign: true }), incDec: new TokenType3("++/--", { prefix: true, postfix: true, startsExpr: true }), @@ -542,6 +461,7 @@ var require_acorn = __commonJS({ slash: binop2("/", 10), starstar: new TokenType3("**", { beforeExpr: true }), coalesce: binop2("??", 1), + // Keyword token types. _break: kw2("break"), _case: kw2("case", beforeExpr2), _catch: kw2("catch"), @@ -598,12 +518,12 @@ var require_acorn = __commonJS({ var skipWhiteSpace2 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; var ref2 = Object.prototype; var hasOwnProperty3 = ref2.hasOwnProperty; - var toString3 = ref2.toString; + var toString4 = ref2.toString; var hasOwn2 = Object.hasOwn || function(obj, propName) { return hasOwnProperty3.call(obj, propName); }; var isArray2 = Array.isArray || function(obj) { - return toString3.call(obj) === "[object Array]"; + return toString4.call(obj) === "[object Array]"; }; function wordsRegexp2(words) { return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"); @@ -623,8 +543,8 @@ var require_acorn = __commonJS({ Position3.prototype.offset = function offset2(n) { return new Position3(this.line, this.column + n); }; - var SourceLocation3 = function SourceLocation4(p, start3, end) { - this.start = start3; + var SourceLocation3 = function SourceLocation4(p, start2, end) { + this.start = start2; this.end = end; if (p.sourceFile !== null) { this.source = p.sourceFile; @@ -641,23 +561,98 @@ var require_acorn = __commonJS({ } } var defaultOptions2 = { + // `ecmaVersion` indicates the ECMAScript version to parse. Must be + // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 + // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` + // (the latest version the library supports). This influences + // support for strict mode, the set of reserved words, and support + // for new syntax features. ecmaVersion: null, + // `sourceType` indicates the mode the code should be parsed in. + // Can be either `"script"` or `"module"`. This influences global + // strict mode and parsing of `import` and `export` declarations. sourceType: "script", + // `onInsertedSemicolon` can be a callback that will be called + // when a semicolon is automatically inserted. It will be passed + // the position of the comma as an offset, and if `locations` is + // enabled, it is given the location as a `{line, column}` object + // as second argument. onInsertedSemicolon: null, + // `onTrailingComma` is similar to `onInsertedSemicolon`, but for + // trailing commas. onTrailingComma: null, + // By default, reserved words are only enforced if ecmaVersion >= 5. + // Set `allowReserved` to a boolean value to explicitly turn this on + // an off. When this option has the value "never", reserved words + // and keywords can also not be used as property names. allowReserved: null, + // When enabled, a return at the top level is not considered an + // error. allowReturnOutsideFunction: false, + // When enabled, import/export statements are not constrained to + // appearing at the top of the program, and an import.meta expression + // in a script isn't considered an error. allowImportExportEverywhere: false, + // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022. + // When enabled, await identifiers are allowed to appear at the top-level scope, + // but they are still not allowed in non-async functions. allowAwaitOutsideFunction: null, + // When enabled, super identifiers are not constrained to + // appearing in methods and do not raise an error when they appear elsewhere. allowSuperOutsideMethod: null, + // When enabled, hashbang directive in the beginning of file is + // allowed and treated as a line comment. Enabled by default when + // `ecmaVersion` >= 2023. allowHashBang: false, + // By default, the parser will verify that private properties are + // only used in places where they are valid and have been declared. + // Set this to false to turn such checks off. + checkPrivateFields: true, + // When `locations` is on, `loc` properties holding objects with + // `start` and `end` properties in `{line, column}` form (with + // line being 1-based and column 0-based) will be attached to the + // nodes. locations: false, + // A function can be passed as `onToken` option, which will + // cause Acorn to call that function with object in the same + // format as tokens returned from `tokenizer().getToken()`. Note + // that you are not allowed to call the parser from the + // callback—that will corrupt its internal state. onToken: null, + // A function can be passed as `onComment` option, which will + // cause Acorn to call that function with `(block, text, start, + // end)` parameters whenever a comment is skipped. `block` is a + // boolean indicating whether this is a block (`/* */`) comment, + // `text` is the content of the comment, and `start` and `end` are + // character offsets that denote the start and end of the comment. + // When the `locations` option is on, two more parameters are + // passed, the full `{line, column}` locations of the start and + // end of the comments. Note that you are not allowed to call the + // parser from the callback—that will corrupt its internal state. onComment: null, + // Nodes have their start and end characters offsets recorded in + // `start` and `end` properties (directly on the node, rather than + // the `loc` object, which holds line/column data. To also add a + // [semi-standardized][range] `range` property holding a `[start, + // end]` array with the same numbers, set the `ranges` option to + // `true`. + // + // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 ranges: false, + // It is possible to parse multiple files into a single AST by + // passing the tree produced by parsing the first file as + // `program` option in subsequent parses. This will add the + // toplevel forms of the parsed file to the `Program` (top) node + // of an existing parse tree. program: null, + // When `locations` is on, you can pass this to record the source + // file in every node's `loc` object. sourceFile: null, + // This value, if given, is stored in every node, whether + // `locations` is on or off. directSourceFile: null, + // When enabled, parenthesized expressions are represented by + // (non-standard) ParenthesizedExpression nodes preserveParens: false }; var warnedAboutEcmaVersion2 = false; @@ -680,7 +675,7 @@ var require_acorn = __commonJS({ if (options.allowReserved == null) { options.allowReserved = options.ecmaVersion < 5; } - if (opts.allowHashBang == null) { + if (!opts || opts.allowHashBang == null) { options.allowHashBang = options.ecmaVersion >= 14; } if (isArray2(options.onToken)) { @@ -695,18 +690,18 @@ var require_acorn = __commonJS({ return options; } function pushComment2(options, array) { - return function(block, text5, start3, end, startLoc, endLoc) { + return function(block, text5, start2, end, startLoc, endLoc) { var comment2 = { type: block ? "Block" : "Line", value: text5, - start: start3, + start: start2, end }; if (options.locations) { comment2.loc = new SourceLocation3(this, startLoc, endLoc); } if (options.ranges) { - comment2.range = [start3, end]; + comment2.range = [start2, end]; } array.push(comment2); }; @@ -766,9 +761,9 @@ var require_acorn = __commonJS({ }; var prototypeAccessors2 = { 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 } }; Parser3.prototype.parse = function parse5() { - var node = this.options.program || this.startNode(); + var node2 = this.options.program || this.startNode(); this.nextToken(); - return this.parseTopLevel(node); + return this.parseTopLevel(node2); }; prototypeAccessors2.inFunction.get = function() { return (this.currentVarScope().flags & SCOPE_FUNCTION2) > 0; @@ -836,28 +831,28 @@ var require_acorn = __commonJS({ Object.defineProperties(Parser3.prototype, prototypeAccessors2); var pp$92 = Parser3.prototype; var literal2 = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; - pp$92.strictDirective = function(start3) { + pp$92.strictDirective = function(start2) { if (this.options.ecmaVersion < 5) { return false; } for (; ; ) { - skipWhiteSpace2.lastIndex = start3; - start3 += skipWhiteSpace2.exec(this.input)[0].length; - var match = literal2.exec(this.input.slice(start3)); + skipWhiteSpace2.lastIndex = start2; + start2 += skipWhiteSpace2.exec(this.input)[0].length; + var match = literal2.exec(this.input.slice(start2)); if (!match) { return false; } if ((match[1] || match[2]) === "use strict") { - skipWhiteSpace2.lastIndex = start3 + match[0].length; + skipWhiteSpace2.lastIndex = start2 + match[0].length; var spaceAfter = skipWhiteSpace2.exec(this.input), end = spaceAfter.index + spaceAfter[0].length; var next = this.input.charAt(end); return next === ";" || next === "}" || lineBreak2.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="); } - start3 += match[0].length; - skipWhiteSpace2.lastIndex = start3; - start3 += skipWhiteSpace2.exec(this.input)[0].length; - if (this.input[start3] === ";") { - start3++; + start2 += match[0].length; + skipWhiteSpace2.lastIndex = start2; + start2 += skipWhiteSpace2.exec(this.input)[0].length; + if (this.input[start2] === ";") { + start2++; } } }; @@ -963,14 +958,14 @@ var require_acorn = __commonJS({ return expr.type === "Identifier" || expr.type === "MemberExpression"; }; var pp$82 = Parser3.prototype; - pp$82.parseTopLevel = function(node) { + pp$82.parseTopLevel = function(node2) { var exports3 = /* @__PURE__ */ Object.create(null); - if (!node.body) { - node.body = []; + if (!node2.body) { + node2.body = []; } while (this.type !== types$12.eof) { var stmt = this.parseStatement(null, true, exports3); - node.body.push(stmt); + node2.body.push(stmt); } if (this.inModule) { for (var i2 = 0, list4 = Object.keys(this.undefinedExports); i2 < list4.length; i2 += 1) { @@ -978,10 +973,10 @@ var require_acorn = __commonJS({ this.raiseRecoverable(this.undefinedExports[name2].start, "Export '" + name2 + "' is not defined"); } } - this.adaptDirectivePrologue(node.body); + this.adaptDirectivePrologue(node2.body); this.next(); - node.sourceType = this.options.sourceType; - return this.finishNode(node, "Program"); + node2.sourceType = this.options.sourceType; + return this.finishNode(node2, "Program"); }; var loopLabel2 = { kind: "loop" }, switchLabel2 = { kind: "switch" }; pp$82.isLet = function(context) { @@ -991,13 +986,13 @@ var require_acorn = __commonJS({ skipWhiteSpace2.lastIndex = this.pos; var skip = skipWhiteSpace2.exec(this.input); var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); - if (nextCh === 91 || nextCh === 92 || nextCh > 55295 && nextCh < 56320) { + if (nextCh === 91 || nextCh === 92) { return true; } if (context) { return false; } - if (nextCh === 123) { + if (nextCh === 123 || nextCh > 55295 && nextCh < 56320) { return true; } if (isIdentifierStart2(nextCh, true)) { @@ -1025,7 +1020,7 @@ var require_acorn = __commonJS({ return !lineBreak2.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar2(after = this.input.charCodeAt(next + 8)) || after > 55295 && after < 56320)); }; pp$82.parseStatement = function(context, topLevel, exports3) { - var starttype = this.type, node = this.startNode(), kind; + var starttype = this.type, node2 = this.startNode(), kind; if (this.isLet(context)) { starttype = types$12._var; kind = "let"; @@ -1033,48 +1028,48 @@ var require_acorn = __commonJS({ switch (starttype) { case types$12._break: case types$12._continue: - return this.parseBreakContinueStatement(node, starttype.keyword); + return this.parseBreakContinueStatement(node2, starttype.keyword); case types$12._debugger: - return this.parseDebuggerStatement(node); + return this.parseDebuggerStatement(node2); case types$12._do: - return this.parseDoStatement(node); + return this.parseDoStatement(node2); case types$12._for: - return this.parseForStatement(node); + return this.parseForStatement(node2); case types$12._function: if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) { this.unexpected(); } - return this.parseFunctionStatement(node, false, !context); + return this.parseFunctionStatement(node2, false, !context); case types$12._class: if (context) { this.unexpected(); } - return this.parseClass(node, true); + return this.parseClass(node2, true); case types$12._if: - return this.parseIfStatement(node); + return this.parseIfStatement(node2); case types$12._return: - return this.parseReturnStatement(node); + return this.parseReturnStatement(node2); case types$12._switch: - return this.parseSwitchStatement(node); + return this.parseSwitchStatement(node2); case types$12._throw: - return this.parseThrowStatement(node); + return this.parseThrowStatement(node2); case types$12._try: - return this.parseTryStatement(node); + return this.parseTryStatement(node2); case types$12._const: case types$12._var: kind = kind || this.value; if (context && kind !== "var") { this.unexpected(); } - return this.parseVarStatement(node, kind); + return this.parseVarStatement(node2, kind); case types$12._while: - return this.parseWhileStatement(node); + return this.parseWhileStatement(node2); case types$12._with: - return this.parseWithStatement(node); + return this.parseWithStatement(node2); case types$12.braceL: - return this.parseBlock(true, node); + return this.parseBlock(true, node2); case types$12.semi: - return this.parseEmptyStatement(node); + return this.parseEmptyStatement(node2); case types$12._export: case types$12._import: if (this.options.ecmaVersion > 10 && starttype === types$12._import) { @@ -1082,7 +1077,7 @@ var require_acorn = __commonJS({ var skip = skipWhiteSpace2.exec(this.input); var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); if (nextCh === 40 || nextCh === 46) { - return this.parseExpressionStatement(node, this.parseExpression()); + return this.parseExpressionStatement(node2, this.parseExpression()); } } if (!this.options.allowImportExportEverywhere) { @@ -1093,71 +1088,71 @@ var require_acorn = __commonJS({ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); } } - return starttype === types$12._import ? this.parseImport(node) : this.parseExport(node, exports3); + return starttype === types$12._import ? this.parseImport(node2) : this.parseExport(node2, exports3); default: if (this.isAsyncFunction()) { if (context) { this.unexpected(); } this.next(); - return this.parseFunctionStatement(node, true, !context); + return this.parseFunctionStatement(node2, true, !context); } var maybeName = this.value, expr = this.parseExpression(); if (starttype === types$12.name && expr.type === "Identifier" && this.eat(types$12.colon)) { - return this.parseLabeledStatement(node, maybeName, expr, context); + return this.parseLabeledStatement(node2, maybeName, expr, context); } else { - return this.parseExpressionStatement(node, expr); + return this.parseExpressionStatement(node2, expr); } } }; - pp$82.parseBreakContinueStatement = function(node, keyword) { + pp$82.parseBreakContinueStatement = function(node2, keyword) { var isBreak = keyword === "break"; this.next(); if (this.eat(types$12.semi) || this.insertSemicolon()) { - node.label = null; + node2.label = null; } else if (this.type !== types$12.name) { this.unexpected(); } else { - node.label = this.parseIdent(); + node2.label = this.parseIdent(); this.semicolon(); } var i2 = 0; for (; i2 < this.labels.length; ++i2) { var lab = this.labels[i2]; - if (node.label == null || lab.name === node.label.name) { + if (node2.label == null || lab.name === node2.label.name) { if (lab.kind != null && (isBreak || lab.kind === "loop")) { break; } - if (node.label && isBreak) { + if (node2.label && isBreak) { break; } } } if (i2 === this.labels.length) { - this.raise(node.start, "Unsyntactic " + keyword); + this.raise(node2.start, "Unsyntactic " + keyword); } - return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); + return this.finishNode(node2, isBreak ? "BreakStatement" : "ContinueStatement"); }; - pp$82.parseDebuggerStatement = function(node) { + pp$82.parseDebuggerStatement = function(node2) { this.next(); this.semicolon(); - return this.finishNode(node, "DebuggerStatement"); + return this.finishNode(node2, "DebuggerStatement"); }; - pp$82.parseDoStatement = function(node) { + pp$82.parseDoStatement = function(node2) { this.next(); this.labels.push(loopLabel2); - node.body = this.parseStatement("do"); + node2.body = this.parseStatement("do"); this.labels.pop(); this.expect(types$12._while); - node.test = this.parseParenExpression(); + node2.test = this.parseParenExpression(); if (this.options.ecmaVersion >= 6) { this.eat(types$12.semi); } else { this.semicolon(); } - return this.finishNode(node, "DoWhileStatement"); + return this.finishNode(node2, "DoWhileStatement"); }; - pp$82.parseForStatement = function(node) { + pp$82.parseForStatement = function(node2) { this.next(); var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1; this.labels.push(loopLabel2); @@ -1167,7 +1162,7 @@ var require_acorn = __commonJS({ if (awaitAt > -1) { this.unexpected(awaitAt); } - return this.parseFor(node, null); + return this.parseFor(node2, null); } var isLet = this.isLet(); if (this.type === types$12._var || this.type === types$12._const || isLet) { @@ -1182,15 +1177,15 @@ var require_acorn = __commonJS({ this.unexpected(awaitAt); } } else { - node.await = awaitAt > -1; + node2.await = awaitAt > -1; } } - return this.parseForIn(node, init$1); + return this.parseForIn(node2, init$1); } if (awaitAt > -1) { this.unexpected(awaitAt); } - return this.parseFor(node, init$1); + return this.parseFor(node2, init$1); } var startsWithLet = this.isContextual("let"), isForOf = false; var refDestructuringErrors = new DestructuringErrors3(); @@ -1202,7 +1197,7 @@ var require_acorn = __commonJS({ this.unexpected(awaitAt); } } else { - node.await = awaitAt > -1; + node2.await = awaitAt > -1; } } if (startsWithLet && isForOf) { @@ -1210,43 +1205,43 @@ var require_acorn = __commonJS({ } this.toAssignable(init, false, refDestructuringErrors); this.checkLValPattern(init); - return this.parseForIn(node, init); + return this.parseForIn(node2, init); } else { this.checkExpressionErrors(refDestructuringErrors, true); } if (awaitAt > -1) { this.unexpected(awaitAt); } - return this.parseFor(node, init); + return this.parseFor(node2, init); }; - pp$82.parseFunctionStatement = function(node, isAsync, declarationPosition) { + pp$82.parseFunctionStatement = function(node2, isAsync, declarationPosition) { this.next(); - return this.parseFunction(node, FUNC_STATEMENT2 | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT2), false, isAsync); + return this.parseFunction(node2, FUNC_STATEMENT2 | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT2), false, isAsync); }; - pp$82.parseIfStatement = function(node) { + pp$82.parseIfStatement = function(node2) { this.next(); - node.test = this.parseParenExpression(); - node.consequent = this.parseStatement("if"); - node.alternate = this.eat(types$12._else) ? this.parseStatement("if") : null; - return this.finishNode(node, "IfStatement"); + node2.test = this.parseParenExpression(); + node2.consequent = this.parseStatement("if"); + node2.alternate = this.eat(types$12._else) ? this.parseStatement("if") : null; + return this.finishNode(node2, "IfStatement"); }; - pp$82.parseReturnStatement = function(node) { + pp$82.parseReturnStatement = function(node2) { if (!this.inFunction && !this.options.allowReturnOutsideFunction) { this.raise(this.start, "'return' outside of function"); } this.next(); if (this.eat(types$12.semi) || this.insertSemicolon()) { - node.argument = null; + node2.argument = null; } else { - node.argument = this.parseExpression(); + node2.argument = this.parseExpression(); this.semicolon(); } - return this.finishNode(node, "ReturnStatement"); + return this.finishNode(node2, "ReturnStatement"); }; - pp$82.parseSwitchStatement = function(node) { + pp$82.parseSwitchStatement = function(node2) { this.next(); - node.discriminant = this.parseParenExpression(); - node.cases = []; + node2.discriminant = this.parseParenExpression(); + node2.cases = []; this.expect(types$12.braceL); this.labels.push(switchLabel2); this.enterScope(0); @@ -1257,7 +1252,7 @@ var require_acorn = __commonJS({ if (cur) { this.finishNode(cur, "SwitchCase"); } - node.cases.push(cur = this.startNode()); + node2.cases.push(cur = this.startNode()); cur.consequent = []; this.next(); if (isCase) { @@ -1283,31 +1278,35 @@ var require_acorn = __commonJS({ } this.next(); this.labels.pop(); - return this.finishNode(node, "SwitchStatement"); + return this.finishNode(node2, "SwitchStatement"); }; - pp$82.parseThrowStatement = function(node) { + pp$82.parseThrowStatement = function(node2) { this.next(); if (lineBreak2.test(this.input.slice(this.lastTokEnd, this.start))) { this.raise(this.lastTokEnd, "Illegal newline after throw"); } - node.argument = this.parseExpression(); + node2.argument = this.parseExpression(); this.semicolon(); - return this.finishNode(node, "ThrowStatement"); + return this.finishNode(node2, "ThrowStatement"); }; var empty$12 = []; - pp$82.parseTryStatement = function(node) { + pp$82.parseCatchClauseParam = function() { + var param = this.parseBindingAtom(); + var simple = param.type === "Identifier"; + this.enterScope(simple ? SCOPE_SIMPLE_CATCH2 : 0); + this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH2 : BIND_LEXICAL2); + this.expect(types$12.parenR); + return param; + }; + pp$82.parseTryStatement = function(node2) { this.next(); - node.block = this.parseBlock(); - node.handler = null; + node2.block = this.parseBlock(); + node2.handler = null; if (this.type === types$12._catch) { var clause = this.startNode(); this.next(); if (this.eat(types$12.parenL)) { - clause.param = this.parseBindingAtom(); - var simple = clause.param.type === "Identifier"; - this.enterScope(simple ? SCOPE_SIMPLE_CATCH2 : 0); - this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH2 : BIND_LEXICAL2); - this.expect(types$12.parenR); + clause.param = this.parseCatchClauseParam(); } else { if (this.options.ecmaVersion < 10) { this.unexpected(); @@ -1317,42 +1316,42 @@ var require_acorn = __commonJS({ } clause.body = this.parseBlock(false); this.exitScope(); - node.handler = this.finishNode(clause, "CatchClause"); + node2.handler = this.finishNode(clause, "CatchClause"); } - node.finalizer = this.eat(types$12._finally) ? this.parseBlock() : null; - if (!node.handler && !node.finalizer) { - this.raise(node.start, "Missing catch or finally clause"); + node2.finalizer = this.eat(types$12._finally) ? this.parseBlock() : null; + if (!node2.handler && !node2.finalizer) { + this.raise(node2.start, "Missing catch or finally clause"); } - return this.finishNode(node, "TryStatement"); + return this.finishNode(node2, "TryStatement"); }; - pp$82.parseVarStatement = function(node, kind) { + pp$82.parseVarStatement = function(node2, kind, allowMissingInitializer) { this.next(); - this.parseVar(node, false, kind); + this.parseVar(node2, false, kind, allowMissingInitializer); this.semicolon(); - return this.finishNode(node, "VariableDeclaration"); + return this.finishNode(node2, "VariableDeclaration"); }; - pp$82.parseWhileStatement = function(node) { + pp$82.parseWhileStatement = function(node2) { this.next(); - node.test = this.parseParenExpression(); + node2.test = this.parseParenExpression(); this.labels.push(loopLabel2); - node.body = this.parseStatement("while"); + node2.body = this.parseStatement("while"); this.labels.pop(); - return this.finishNode(node, "WhileStatement"); + return this.finishNode(node2, "WhileStatement"); }; - pp$82.parseWithStatement = function(node) { + pp$82.parseWithStatement = function(node2) { if (this.strict) { this.raise(this.start, "'with' in strict mode"); } this.next(); - node.object = this.parseParenExpression(); - node.body = this.parseStatement("with"); - return this.finishNode(node, "WithStatement"); + node2.object = this.parseParenExpression(); + node2.body = this.parseStatement("with"); + return this.finishNode(node2, "WithStatement"); }; - pp$82.parseEmptyStatement = function(node) { + pp$82.parseEmptyStatement = function(node2) { this.next(); - return this.finishNode(node, "EmptyStatement"); + return this.finishNode(node2, "EmptyStatement"); }; - pp$82.parseLabeledStatement = function(node, maybeName, expr, context) { + pp$82.parseLabeledStatement = function(node2, maybeName, expr, context) { for (var i$1 = 0, list4 = this.labels; i$1 < list4.length; i$1 += 1) { var label = list4[i$1]; if (label.name === maybeName) { @@ -1362,7 +1361,7 @@ var require_acorn = __commonJS({ var kind = this.type.isLoop ? "loop" : this.type === types$12._switch ? "switch" : null; for (var i2 = this.labels.length - 1; i2 >= 0; i2--) { var label$1 = this.labels[i2]; - if (label$1.statementStart === node.start) { + if (label$1.statementStart === node2.start) { label$1.statementStart = this.start; label$1.kind = kind; } else { @@ -1370,29 +1369,29 @@ var require_acorn = __commonJS({ } } this.labels.push({ name: maybeName, kind, statementStart: this.start }); - node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); + node2.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); this.labels.pop(); - node.label = expr; - return this.finishNode(node, "LabeledStatement"); + node2.label = expr; + return this.finishNode(node2, "LabeledStatement"); }; - pp$82.parseExpressionStatement = function(node, expr) { - node.expression = expr; + pp$82.parseExpressionStatement = function(node2, expr) { + node2.expression = expr; this.semicolon(); - return this.finishNode(node, "ExpressionStatement"); + return this.finishNode(node2, "ExpressionStatement"); }; - pp$82.parseBlock = function(createNewLexicalScope, node, exitStrict) { + pp$82.parseBlock = function(createNewLexicalScope, node2, exitStrict) { if (createNewLexicalScope === void 0) createNewLexicalScope = true; - if (node === void 0) - node = this.startNode(); - node.body = []; + if (node2 === void 0) + node2 = this.startNode(); + node2.body = []; this.expect(types$12.braceL); if (createNewLexicalScope) { this.enterScope(0); } while (this.type !== types$12.braceR) { var stmt = this.parseStatement(null); - node.body.push(stmt); + node2.body.push(stmt); } if (exitStrict) { this.strict = false; @@ -1401,21 +1400,21 @@ var require_acorn = __commonJS({ if (createNewLexicalScope) { this.exitScope(); } - return this.finishNode(node, "BlockStatement"); + return this.finishNode(node2, "BlockStatement"); }; - pp$82.parseFor = function(node, init) { - node.init = init; + pp$82.parseFor = function(node2, init) { + node2.init = init; this.expect(types$12.semi); - node.test = this.type === types$12.semi ? null : this.parseExpression(); + node2.test = this.type === types$12.semi ? null : this.parseExpression(); this.expect(types$12.semi); - node.update = this.type === types$12.parenR ? null : this.parseExpression(); + node2.update = this.type === types$12.parenR ? null : this.parseExpression(); this.expect(types$12.parenR); - node.body = this.parseStatement("for"); + node2.body = this.parseStatement("for"); this.exitScope(); this.labels.pop(); - return this.finishNode(node, "ForStatement"); + return this.finishNode(node2, "ForStatement"); }; - pp$82.parseForIn = function(node, init) { + pp$82.parseForIn = function(node2, init) { var isForIn = this.type === types$12._in; this.next(); if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { @@ -1424,96 +1423,96 @@ var require_acorn = __commonJS({ (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer" ); } - node.left = init; - node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); + node2.left = init; + node2.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); this.expect(types$12.parenR); - node.body = this.parseStatement("for"); + node2.body = this.parseStatement("for"); this.exitScope(); this.labels.pop(); - return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); + return this.finishNode(node2, isForIn ? "ForInStatement" : "ForOfStatement"); }; - pp$82.parseVar = function(node, isFor, kind) { - node.declarations = []; - node.kind = kind; + pp$82.parseVar = function(node2, isFor, kind, allowMissingInitializer) { + node2.declarations = []; + node2.kind = kind; for (; ; ) { var decl = this.startNode(); this.parseVarId(decl, kind); if (this.eat(types$12.eq)) { decl.init = this.parseMaybeAssign(isFor); - } else if (kind === "const" && !(this.type === types$12._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + } else if (!allowMissingInitializer && kind === "const" && !(this.type === types$12._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { this.unexpected(); - } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$12._in || this.isContextual("of")))) { + } else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$12._in || this.isContextual("of")))) { this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); } else { decl.init = null; } - node.declarations.push(this.finishNode(decl, "VariableDeclarator")); + node2.declarations.push(this.finishNode(decl, "VariableDeclarator")); if (!this.eat(types$12.comma)) { break; } } - return node; + return node2; }; pp$82.parseVarId = function(decl, kind) { decl.id = this.parseBindingAtom(); this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR2 : BIND_LEXICAL2, false); }; var FUNC_STATEMENT2 = 1, FUNC_HANGING_STATEMENT2 = 2, FUNC_NULLABLE_ID2 = 4; - pp$82.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) { - this.initFunction(node); + pp$82.parseFunction = function(node2, statement, allowExpressionBody, isAsync, forInit) { + this.initFunction(node2); if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { if (this.type === types$12.star && statement & FUNC_HANGING_STATEMENT2) { this.unexpected(); } - node.generator = this.eat(types$12.star); + node2.generator = this.eat(types$12.star); } if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; + node2.async = !!isAsync; } if (statement & FUNC_STATEMENT2) { - node.id = statement & FUNC_NULLABLE_ID2 && this.type !== types$12.name ? null : this.parseIdent(); - if (node.id && !(statement & FUNC_HANGING_STATEMENT2)) { - this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR2 : BIND_LEXICAL2 : BIND_FUNCTION2); + node2.id = statement & FUNC_NULLABLE_ID2 && this.type !== types$12.name ? null : this.parseIdent(); + if (node2.id && !(statement & FUNC_HANGING_STATEMENT2)) { + this.checkLValSimple(node2.id, this.strict || node2.generator || node2.async ? this.treatFunctionsAsVar ? BIND_VAR2 : BIND_LEXICAL2 : BIND_FUNCTION2); } } var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; - this.enterScope(functionFlags2(node.async, node.generator)); + this.enterScope(functionFlags2(node2.async, node2.generator)); if (!(statement & FUNC_STATEMENT2)) { - node.id = this.type === types$12.name ? this.parseIdent() : null; + node2.id = this.type === types$12.name ? this.parseIdent() : null; } - this.parseFunctionParams(node); - this.parseFunctionBody(node, allowExpressionBody, false, forInit); + this.parseFunctionParams(node2); + this.parseFunctionBody(node2, allowExpressionBody, false, forInit); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, statement & FUNC_STATEMENT2 ? "FunctionDeclaration" : "FunctionExpression"); + return this.finishNode(node2, statement & FUNC_STATEMENT2 ? "FunctionDeclaration" : "FunctionExpression"); }; - pp$82.parseFunctionParams = function(node) { + pp$82.parseFunctionParams = function(node2) { this.expect(types$12.parenL); - node.params = this.parseBindingList(types$12.parenR, false, this.options.ecmaVersion >= 8); + node2.params = this.parseBindingList(types$12.parenR, false, this.options.ecmaVersion >= 8); this.checkYieldAwaitInDefaultParams(); }; - pp$82.parseClass = function(node, isStatement) { + pp$82.parseClass = function(node2, isStatement) { this.next(); var oldStrict = this.strict; this.strict = true; - this.parseClassId(node, isStatement); - this.parseClassSuper(node); + this.parseClassId(node2, isStatement); + this.parseClassSuper(node2); var privateNameMap = this.enterClassBody(); var classBody = this.startNode(); var hadConstructor = false; classBody.body = []; this.expect(types$12.braceL); while (this.type !== types$12.braceR) { - var element2 = this.parseClassElement(node.superClass !== null); + var element2 = this.parseClassElement(node2.superClass !== null); if (element2) { classBody.body.push(element2); if (element2.type === "MethodDefinition" && element2.kind === "constructor") { if (hadConstructor) { - this.raise(element2.start, "Duplicate constructor in the same class"); + this.raiseRecoverable(element2.start, "Duplicate constructor in the same class"); } hadConstructor = true; } else if (element2.key && element2.key.type === "PrivateIdentifier" && isPrivateNameConflicted2(privateNameMap, element2)) { @@ -1523,16 +1522,16 @@ var require_acorn = __commonJS({ } this.strict = oldStrict; this.next(); - node.body = this.finishNode(classBody, "ClassBody"); + node2.body = this.finishNode(classBody, "ClassBody"); this.exitClassBody(); - return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); + return this.finishNode(node2, isStatement ? "ClassDeclaration" : "ClassExpression"); }; pp$82.parseClassElement = function(constructorAllowsSuper) { if (this.eat(types$12.semi)) { return null; } var ecmaVersion2 = this.options.ecmaVersion; - var node = this.startNode(); + var node2 = this.startNode(); var keyName = ""; var isGenerator = false; var isAsync = false; @@ -1540,8 +1539,8 @@ var require_acorn = __commonJS({ var isStatic = false; if (this.eatContextual("static")) { if (ecmaVersion2 >= 13 && this.eat(types$12.braceL)) { - this.parseClassStaticBlock(node); - return node; + this.parseClassStaticBlock(node2); + return node2; } if (this.isClassElementNameStart() || this.type === types$12.star) { isStatic = true; @@ -1549,7 +1548,7 @@ var require_acorn = __commonJS({ keyName = "static"; } } - node.static = isStatic; + node2.static = isStatic; if (!keyName && ecmaVersion2 >= 8 && this.eatContextual("async")) { if ((this.isClassElementNameStart() || this.type === types$12.star) && !this.canInsertSemicolon()) { isAsync = true; @@ -1571,25 +1570,25 @@ var require_acorn = __commonJS({ } } if (keyName) { - node.computed = false; - node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); - node.key.name = keyName; - this.finishNode(node.key, "Identifier"); + node2.computed = false; + node2.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); + node2.key.name = keyName; + this.finishNode(node2.key, "Identifier"); } else { - this.parseClassElementName(node); + this.parseClassElementName(node2); } if (ecmaVersion2 < 13 || this.type === types$12.parenL || kind !== "method" || isGenerator || isAsync) { - var isConstructor = !node.static && checkKeyName2(node, "constructor"); + var isConstructor = !node2.static && checkKeyName2(node2, "constructor"); var allowsDirectSuper = isConstructor && constructorAllowsSuper; if (isConstructor && kind !== "method") { - this.raise(node.key.start, "Constructor can't have get/set modifier"); + this.raise(node2.key.start, "Constructor can't have get/set modifier"); } - node.kind = isConstructor ? "constructor" : kind; - this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); + node2.kind = isConstructor ? "constructor" : kind; + this.parseClassMethod(node2, isGenerator, isAsync, allowsDirectSuper); } else { - this.parseClassField(node); + this.parseClassField(node2); } - return node; + return node2; }; pp$82.isClassElementNameStart = function() { return this.type === types$12.name || this.type === types$12.privateId || this.type === types$12.num || this.type === types$12.string || this.type === types$12.bracketL || this.type.keyword; @@ -1647,35 +1646,35 @@ var require_acorn = __commonJS({ this.semicolon(); return this.finishNode(field, "PropertyDefinition"); }; - pp$82.parseClassStaticBlock = function(node) { - node.body = []; + pp$82.parseClassStaticBlock = function(node2) { + node2.body = []; var oldLabels = this.labels; this.labels = []; this.enterScope(SCOPE_CLASS_STATIC_BLOCK2 | SCOPE_SUPER2); while (this.type !== types$12.braceR) { var stmt = this.parseStatement(null); - node.body.push(stmt); + node2.body.push(stmt); } this.next(); this.exitScope(); this.labels = oldLabels; - return this.finishNode(node, "StaticBlock"); + return this.finishNode(node2, "StaticBlock"); }; - pp$82.parseClassId = function(node, isStatement) { + pp$82.parseClassId = function(node2, isStatement) { if (this.type === types$12.name) { - node.id = this.parseIdent(); + node2.id = this.parseIdent(); if (isStatement) { - this.checkLValSimple(node.id, BIND_LEXICAL2, false); + this.checkLValSimple(node2.id, BIND_LEXICAL2, false); } } else { if (isStatement === true) { this.unexpected(); } - node.id = null; + node2.id = null; } }; - pp$82.parseClassSuper = function(node) { - node.superClass = this.eat(types$12._extends) ? this.parseExprSubscripts(false) : null; + pp$82.parseClassSuper = function(node2) { + node2.superClass = this.eat(types$12._extends) ? this.parseExprSubscripts(null, false) : null; }; pp$82.enterClassBody = function() { var element2 = { declared: /* @__PURE__ */ Object.create(null), used: [] }; @@ -1686,6 +1685,9 @@ var require_acorn = __commonJS({ var ref3 = this.privateNameStack.pop(); var declared = ref3.declared; var used = ref3.used; + if (!this.options.checkPrivateFields) { + return; + } var len = this.privateNameStack.length; var parent = len === 0 ? null : this.privateNameStack[len - 1]; for (var i2 = 0; i2 < used.length; ++i2) { @@ -1716,68 +1718,57 @@ var require_acorn = __commonJS({ return true; } } - function checkKeyName2(node, name2) { - var computed = node.computed; - var key = node.key; + function checkKeyName2(node2, name2) { + var computed = node2.computed; + var key = node2.key; return !computed && (key.type === "Identifier" && key.name === name2 || key.type === "Literal" && key.value === name2); } - pp$82.parseExport = function(node, exports3) { + pp$82.parseExportAllDeclaration = function(node2, exports3) { + if (this.options.ecmaVersion >= 11) { + if (this.eatContextual("as")) { + node2.exported = this.parseModuleExportName(); + this.checkExport(exports3, node2.exported, this.lastTokStart); + } else { + node2.exported = null; + } + } + this.expectContextual("from"); + if (this.type !== types$12.string) { + this.unexpected(); + } + node2.source = this.parseExprAtom(); + this.semicolon(); + return this.finishNode(node2, "ExportAllDeclaration"); + }; + pp$82.parseExport = function(node2, exports3) { this.next(); if (this.eat(types$12.star)) { - if (this.options.ecmaVersion >= 11) { - if (this.eatContextual("as")) { - node.exported = this.parseModuleExportName(); - this.checkExport(exports3, node.exported, this.lastTokStart); - } else { - node.exported = null; - } - } - this.expectContextual("from"); - if (this.type !== types$12.string) { - this.unexpected(); - } - node.source = this.parseExprAtom(); - this.semicolon(); - return this.finishNode(node, "ExportAllDeclaration"); + return this.parseExportAllDeclaration(node2, exports3); } if (this.eat(types$12._default)) { this.checkExport(exports3, "default", this.lastTokStart); - var isAsync; - if (this.type === types$12._function || (isAsync = this.isAsyncFunction())) { - var fNode = this.startNode(); - this.next(); - if (isAsync) { - this.next(); - } - node.declaration = this.parseFunction(fNode, FUNC_STATEMENT2 | FUNC_NULLABLE_ID2, false, isAsync); - } else if (this.type === types$12._class) { - var cNode = this.startNode(); - node.declaration = this.parseClass(cNode, "nullableID"); - } else { - node.declaration = this.parseMaybeAssign(); - this.semicolon(); - } - return this.finishNode(node, "ExportDefaultDeclaration"); + node2.declaration = this.parseExportDefaultDeclaration(); + return this.finishNode(node2, "ExportDefaultDeclaration"); } if (this.shouldParseExportStatement()) { - node.declaration = this.parseStatement(null); - if (node.declaration.type === "VariableDeclaration") { - this.checkVariableExport(exports3, node.declaration.declarations); + node2.declaration = this.parseExportDeclaration(node2); + if (node2.declaration.type === "VariableDeclaration") { + this.checkVariableExport(exports3, node2.declaration.declarations); } else { - this.checkExport(exports3, node.declaration.id, node.declaration.id.start); + this.checkExport(exports3, node2.declaration.id, node2.declaration.id.start); } - node.specifiers = []; - node.source = null; + node2.specifiers = []; + node2.source = null; } else { - node.declaration = null; - node.specifiers = this.parseExportSpecifiers(exports3); + node2.declaration = null; + node2.specifiers = this.parseExportSpecifiers(exports3); if (this.eatContextual("from")) { if (this.type !== types$12.string) { this.unexpected(); } - node.source = this.parseExprAtom(); + node2.source = this.parseExprAtom(); } else { - for (var i2 = 0, list4 = node.specifiers; i2 < list4.length; i2 += 1) { + for (var i2 = 0, list4 = node2.specifiers; i2 < list4.length; i2 += 1) { var spec = list4[i2]; this.checkUnreserved(spec.local); this.checkLocalExport(spec.local); @@ -1785,11 +1776,32 @@ var require_acorn = __commonJS({ this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`."); } } - node.source = null; + node2.source = null; + } + this.semicolon(); + } + return this.finishNode(node2, "ExportNamedDeclaration"); + }; + pp$82.parseExportDeclaration = function(node2) { + return this.parseStatement(null); + }; + pp$82.parseExportDefaultDeclaration = function() { + var isAsync; + if (this.type === types$12._function || (isAsync = this.isAsyncFunction())) { + var fNode = this.startNode(); + this.next(); + if (isAsync) { + this.next(); } + return this.parseFunction(fNode, FUNC_STATEMENT2 | FUNC_NULLABLE_ID2, false, isAsync); + } else if (this.type === types$12._class) { + var cNode = this.startNode(); + return this.parseClass(cNode, "nullableID"); + } else { + var declaration = this.parseMaybeAssign(); this.semicolon(); + return declaration; } - return this.finishNode(node, "ExportNamedDeclaration"); }; pp$82.checkExport = function(exports3, name2, pos) { if (!exports3) { @@ -1841,6 +1853,17 @@ var require_acorn = __commonJS({ pp$82.shouldParseExportStatement = function() { return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction(); }; + pp$82.parseExportSpecifier = function(exports3) { + var node2 = this.startNode(); + node2.local = this.parseModuleExportName(); + node2.exported = this.eatContextual("as") ? this.parseModuleExportName() : node2.local; + this.checkExport( + exports3, + node2.exported, + node2.exported.start + ); + return this.finishNode(node2, "ExportSpecifier"); + }; pp$82.parseExportSpecifiers = function(exports3) { var nodes = [], first = true; this.expect(types$12.braceL); @@ -1853,49 +1876,59 @@ var require_acorn = __commonJS({ } else { first = false; } - var node = this.startNode(); - node.local = this.parseModuleExportName(); - node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local; - this.checkExport( - exports3, - node.exported, - node.exported.start - ); - nodes.push(this.finishNode(node, "ExportSpecifier")); + nodes.push(this.parseExportSpecifier(exports3)); } return nodes; }; - pp$82.parseImport = function(node) { + pp$82.parseImport = function(node2) { this.next(); if (this.type === types$12.string) { - node.specifiers = empty$12; - node.source = this.parseExprAtom(); + node2.specifiers = empty$12; + node2.source = this.parseExprAtom(); } else { - node.specifiers = this.parseImportSpecifiers(); + node2.specifiers = this.parseImportSpecifiers(); this.expectContextual("from"); - node.source = this.type === types$12.string ? this.parseExprAtom() : this.unexpected(); + node2.source = this.type === types$12.string ? this.parseExprAtom() : this.unexpected(); } this.semicolon(); - return this.finishNode(node, "ImportDeclaration"); + return this.finishNode(node2, "ImportDeclaration"); + }; + pp$82.parseImportSpecifier = function() { + var node2 = this.startNode(); + node2.imported = this.parseModuleExportName(); + if (this.eatContextual("as")) { + node2.local = this.parseIdent(); + } else { + this.checkUnreserved(node2.imported); + node2.local = node2.imported; + } + this.checkLValSimple(node2.local, BIND_LEXICAL2); + return this.finishNode(node2, "ImportSpecifier"); + }; + pp$82.parseImportDefaultSpecifier = function() { + var node2 = this.startNode(); + node2.local = this.parseIdent(); + this.checkLValSimple(node2.local, BIND_LEXICAL2); + return this.finishNode(node2, "ImportDefaultSpecifier"); + }; + pp$82.parseImportNamespaceSpecifier = function() { + var node2 = this.startNode(); + this.next(); + this.expectContextual("as"); + node2.local = this.parseIdent(); + this.checkLValSimple(node2.local, BIND_LEXICAL2); + return this.finishNode(node2, "ImportNamespaceSpecifier"); }; pp$82.parseImportSpecifiers = function() { var nodes = [], first = true; if (this.type === types$12.name) { - var node = this.startNode(); - node.local = this.parseIdent(); - this.checkLValSimple(node.local, BIND_LEXICAL2); - nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); + nodes.push(this.parseImportDefaultSpecifier()); if (!this.eat(types$12.comma)) { return nodes; } } if (this.type === types$12.star) { - var node$1 = this.startNode(); - this.next(); - this.expectContextual("as"); - node$1.local = this.parseIdent(); - this.checkLValSimple(node$1.local, BIND_LEXICAL2); - nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")); + nodes.push(this.parseImportNamespaceSpecifier()); return nodes; } this.expect(types$12.braceL); @@ -1908,16 +1941,7 @@ var require_acorn = __commonJS({ } else { first = false; } - var node$2 = this.startNode(); - node$2.imported = this.parseModuleExportName(); - if (this.eatContextual("as")) { - node$2.local = this.parseIdent(); - } else { - this.checkUnreserved(node$2.imported); - node$2.local = node$2.imported; - } - this.checkLValSimple(node$2.local, BIND_LEXICAL2); - nodes.push(this.finishNode(node$2, "ImportSpecifier")); + nodes.push(this.parseImportSpecifier()); } return nodes; }; @@ -1937,15 +1961,16 @@ var require_acorn = __commonJS({ } }; pp$82.isDirectiveCandidate = function(statement) { - return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (this.input[statement.start] === '"' || this.input[statement.start] === "'"); + return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && // Reject parenthesized strings. + (this.input[statement.start] === '"' || this.input[statement.start] === "'"); }; var pp$72 = Parser3.prototype; - pp$72.toAssignable = function(node, isBinding, refDestructuringErrors) { - if (this.options.ecmaVersion >= 6 && node) { - switch (node.type) { + pp$72.toAssignable = function(node2, isBinding, refDestructuringErrors) { + if (this.options.ecmaVersion >= 6 && node2) { + switch (node2.type) { case "Identifier": - if (this.inAsync && node.name === "await") { - this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); + if (this.inAsync && node2.name === "await") { + this.raise(node2.start, "Cannot use 'await' as identifier inside an async function"); } break; case "ObjectPattern": @@ -1954,11 +1979,11 @@ var require_acorn = __commonJS({ case "RestElement": break; case "ObjectExpression": - node.type = "ObjectPattern"; + node2.type = "ObjectPattern"; if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } - for (var i2 = 0, list4 = node.properties; i2 < list4.length; i2 += 1) { + for (var i2 = 0, list4 = node2.properties; i2 < list4.length; i2 += 1) { var prop = list4[i2]; this.toAssignable(prop, isBinding); if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) { @@ -1967,50 +1992,50 @@ var require_acorn = __commonJS({ } break; case "Property": - if (node.kind !== "init") { - this.raise(node.key.start, "Object pattern can't contain getter or setter"); + if (node2.kind !== "init") { + this.raise(node2.key.start, "Object pattern can't contain getter or setter"); } - this.toAssignable(node.value, isBinding); + this.toAssignable(node2.value, isBinding); break; case "ArrayExpression": - node.type = "ArrayPattern"; + node2.type = "ArrayPattern"; if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } - this.toAssignableList(node.elements, isBinding); + this.toAssignableList(node2.elements, isBinding); break; case "SpreadElement": - node.type = "RestElement"; - this.toAssignable(node.argument, isBinding); - if (node.argument.type === "AssignmentPattern") { - this.raise(node.argument.start, "Rest elements cannot have a default value"); + node2.type = "RestElement"; + this.toAssignable(node2.argument, isBinding); + if (node2.argument.type === "AssignmentPattern") { + this.raise(node2.argument.start, "Rest elements cannot have a default value"); } break; case "AssignmentExpression": - if (node.operator !== "=") { - this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); + if (node2.operator !== "=") { + this.raise(node2.left.end, "Only '=' operator can be used for specifying default value."); } - node.type = "AssignmentPattern"; - delete node.operator; - this.toAssignable(node.left, isBinding); + node2.type = "AssignmentPattern"; + delete node2.operator; + this.toAssignable(node2.left, isBinding); break; case "ParenthesizedExpression": - this.toAssignable(node.expression, isBinding, refDestructuringErrors); + this.toAssignable(node2.expression, isBinding, refDestructuringErrors); break; case "ChainExpression": - this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side"); + this.raiseRecoverable(node2.start, "Optional chaining cannot appear in left-hand side"); break; case "MemberExpression": if (!isBinding) { break; } default: - this.raise(node.start, "Assigning to rvalue"); + this.raise(node2.start, "Assigning to rvalue"); } } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } - return node; + return node2; }; pp$72.toAssignableList = function(exprList, isBinding) { var end = exprList.length; @@ -2029,35 +2054,35 @@ var require_acorn = __commonJS({ return exprList; }; pp$72.parseSpread = function(refDestructuringErrors) { - var node = this.startNode(); + var node2 = this.startNode(); this.next(); - node.argument = this.parseMaybeAssign(false, refDestructuringErrors); - return this.finishNode(node, "SpreadElement"); + node2.argument = this.parseMaybeAssign(false, refDestructuringErrors); + return this.finishNode(node2, "SpreadElement"); }; pp$72.parseRestBinding = function() { - var node = this.startNode(); + var node2 = this.startNode(); this.next(); if (this.options.ecmaVersion === 6 && this.type !== types$12.name) { this.unexpected(); } - node.argument = this.parseBindingAtom(); - return this.finishNode(node, "RestElement"); + node2.argument = this.parseBindingAtom(); + return this.finishNode(node2, "RestElement"); }; pp$72.parseBindingAtom = function() { if (this.options.ecmaVersion >= 6) { switch (this.type) { case types$12.bracketL: - var node = this.startNode(); + var node2 = this.startNode(); this.next(); - node.elements = this.parseBindingList(types$12.bracketR, true, true); - return this.finishNode(node, "ArrayPattern"); + node2.elements = this.parseBindingList(types$12.bracketR, true, true); + return this.finishNode(node2, "ArrayPattern"); case types$12.braceL: return this.parseObj(true); } } return this.parseIdent(); }; - pp$72.parseBindingList = function(close, allowEmpty, allowTrailingComma) { + pp$72.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) { var elts = [], first = true; while (!this.eat(close)) { if (first) { @@ -2074,18 +2099,21 @@ var require_acorn = __commonJS({ this.parseBindingListItem(rest); elts.push(rest); if (this.type === types$12.comma) { - this.raise(this.start, "Comma is not permitted after the rest element"); + this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); } this.expect(close); break; } else { - var elem = this.parseMaybeDefault(this.start, this.startLoc); - this.parseBindingListItem(elem); - elts.push(elem); + elts.push(this.parseAssignableListItem(allowModifiers)); } } return elts; }; + pp$72.parseAssignableListItem = function(allowModifiers) { + var elem = this.parseMaybeDefault(this.start, this.startLoc); + this.parseBindingListItem(elem); + return elem; + }; pp$72.parseBindingListItem = function(param) { return param; }; @@ -2094,10 +2122,10 @@ var require_acorn = __commonJS({ if (this.options.ecmaVersion < 6 || !this.eat(types$12.eq)) { return left; } - var node = this.startNodeAt(startPos, startLoc); - node.left = left; - node.right = this.parseMaybeAssign(); - return this.finishNode(node, "AssignmentPattern"); + var node2 = this.startNodeAt(startPos, startLoc); + node2.left = left; + node2.right = this.parseMaybeAssign(); + return this.finishNode(node2, "AssignmentPattern"); }; pp$72.checkLValSimple = function(expr, bindingType, checkClashes) { if (bindingType === void 0) @@ -2376,12 +2404,12 @@ var require_acorn = __commonJS({ var startPos = this.start, startLoc = this.startLoc; var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); if (this.type === types$12.comma) { - var node = this.startNodeAt(startPos, startLoc); - node.expressions = [expr]; + var node2 = this.startNodeAt(startPos, startLoc); + node2.expressions = [expr]; while (this.eat(types$12.comma)) { - node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); + node2.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); } - return this.finishNode(node, "SequenceExpression"); + return this.finishNode(node2, "SequenceExpression"); } return expr; }; @@ -2413,8 +2441,8 @@ var require_acorn = __commonJS({ left = afterLeftParse.call(this, left, startPos, startLoc); } if (this.type.isAssign) { - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.value; + var node2 = this.startNodeAt(startPos, startLoc); + node2.operator = this.value; if (this.type === types$12.eq) { left = this.toAssignable(left, false, refDestructuringErrors); } @@ -2429,13 +2457,13 @@ var require_acorn = __commonJS({ } else { this.checkLValSimple(left); } - node.left = left; + node2.left = left; this.next(); - node.right = this.parseMaybeAssign(forInit); + node2.right = this.parseMaybeAssign(forInit); if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; } - return this.finishNode(node, "AssignmentExpression"); + return this.finishNode(node2, "AssignmentExpression"); } else { if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); @@ -2456,12 +2484,12 @@ var require_acorn = __commonJS({ return expr; } if (this.eat(types$12.question)) { - var node = this.startNodeAt(startPos, startLoc); - node.test = expr; - node.consequent = this.parseMaybeAssign(); + var node2 = this.startNodeAt(startPos, startLoc); + node2.test = expr; + node2.consequent = this.parseMaybeAssign(); this.expect(types$12.colon); - node.alternate = this.parseMaybeAssign(forInit); - return this.finishNode(node, "ConditionalExpression"); + node2.alternate = this.parseMaybeAssign(forInit); + return this.finishNode(node2, "ConditionalExpression"); } return expr; }; @@ -2486,11 +2514,11 @@ var require_acorn = __commonJS({ this.next(); var startPos = this.start, startLoc = this.startLoc; var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); - var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); + var node2 = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); if (logical && this.type === types$12.coalesce || coalesce && (this.type === types$12.logicalOR || this.type === types$12.logicalAND)) { this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); } - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit); + return this.parseExprOp(node2, leftStartPos, leftStartLoc, minPrec, forInit); } } return left; @@ -2499,11 +2527,11 @@ var require_acorn = __commonJS({ if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); } - var node = this.startNodeAt(startPos, startLoc); - node.left = left; - node.operator = op; - node.right = right; - return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression"); + var node2 = this.startNodeAt(startPos, startLoc); + node2.left = left; + node2.operator = op; + node2.right = right; + return this.finishNode(node2, logical ? "LogicalExpression" : "BinaryExpression"); }; pp$52.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) { var startPos = this.start, startLoc = this.startLoc, expr; @@ -2511,24 +2539,24 @@ var require_acorn = __commonJS({ expr = this.parseAwait(forInit); sawUnary = true; } else if (this.type.prefix) { - var node = this.startNode(), update = this.type === types$12.incDec; - node.operator = this.value; - node.prefix = true; + var node2 = this.startNode(), update = this.type === types$12.incDec; + node2.operator = this.value; + node2.prefix = true; this.next(); - node.argument = this.parseMaybeUnary(null, true, update, forInit); + node2.argument = this.parseMaybeUnary(null, true, update, forInit); this.checkExpressionErrors(refDestructuringErrors, true); if (update) { - this.checkLValSimple(node.argument); - } else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") { - this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); - } else if (node.operator === "delete" && isPrivateFieldAccess2(node.argument)) { - this.raiseRecoverable(node.start, "Private fields can not be deleted"); + this.checkLValSimple(node2.argument); + } else if (this.strict && node2.operator === "delete" && node2.argument.type === "Identifier") { + this.raiseRecoverable(node2.start, "Deleting local variable in strict mode"); + } else if (node2.operator === "delete" && isPrivateFieldAccess2(node2.argument)) { + this.raiseRecoverable(node2.start, "Private fields can not be deleted"); } else { sawUnary = true; } - expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); + expr = this.finishNode(node2, update ? "UpdateExpression" : "UnaryExpression"); } else if (!sawUnary && this.type === types$12.privateId) { - if (forInit || this.privateNameStack.length === 0) { + if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); } expr = this.parsePrivateIdent(); @@ -2560,8 +2588,8 @@ var require_acorn = __commonJS({ return expr; } }; - function isPrivateFieldAccess2(node) { - return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess2(node.expression); + function isPrivateFieldAccess2(node2) { + return node2.type === "MemberExpression" && node2.property.type === "PrivateIdentifier" || node2.type === "ChainExpression" && isPrivateFieldAccess2(node2.expression); } pp$52.parseExprSubscripts = function(refDestructuringErrors, forInit) { var startPos = this.start, startLoc = this.startLoc; @@ -2583,15 +2611,15 @@ var require_acorn = __commonJS({ } return result; }; - pp$52.parseSubscripts = function(base2, startPos, startLoc, noCalls, forInit) { - var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base2.type === "Identifier" && base2.name === "async" && this.lastTokEnd === base2.end && !this.canInsertSemicolon() && base2.end - base2.start === 5 && this.potentialArrowAt === base2.start; + pp$52.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) { + var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.potentialArrowAt === base.start; var optionalChained = false; while (true) { - var element2 = this.parseSubscript(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); + var element2 = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); if (element2.optional) { optionalChained = true; } - if (element2 === base2 || element2.type === "ArrowFunctionExpression") { + if (element2 === base || element2.type === "ArrowFunctionExpression") { if (optionalChained) { var chainNode = this.startNodeAt(startPos, startLoc); chainNode.expression = element2; @@ -2599,10 +2627,16 @@ var require_acorn = __commonJS({ } return element2; } - base2 = element2; + base = element2; } }; - pp$52.parseSubscript = function(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { + pp$52.shouldParseAsyncArrow = function() { + return !this.canInsertSemicolon() && this.eat(types$12.arrow); + }; + pp$52.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit); + }; + pp$52.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { var optionalSupported = this.options.ecmaVersion >= 11; var optional = optionalSupported && this.eat(types$12.questionDot); if (noCalls && optional) { @@ -2610,28 +2644,28 @@ var require_acorn = __commonJS({ } var computed = this.eat(types$12.bracketL); if (computed || optional && this.type !== types$12.parenL && this.type !== types$12.backQuote || this.eat(types$12.dot)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base2; + var node2 = this.startNodeAt(startPos, startLoc); + node2.object = base; if (computed) { - node.property = this.parseExpression(); + node2.property = this.parseExpression(); this.expect(types$12.bracketR); - } else if (this.type === types$12.privateId && base2.type !== "Super") { - node.property = this.parsePrivateIdent(); + } else if (this.type === types$12.privateId && base.type !== "Super") { + node2.property = this.parsePrivateIdent(); } else { - node.property = this.parseIdent(this.options.allowReserved !== "never"); + node2.property = this.parseIdent(this.options.allowReserved !== "never"); } - node.computed = !!computed; + node2.computed = !!computed; if (optionalSupported) { - node.optional = optional; + node2.optional = optional; } - base2 = this.finishNode(node, "MemberExpression"); + base = this.finishNode(node2, "MemberExpression"); } else if (!noCalls && this.eat(types$12.parenL)) { var refDestructuringErrors = new DestructuringErrors3(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; var exprList = this.parseExprList(types$12.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); - if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$12.arrow)) { + if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) { this.checkPatternErrors(refDestructuringErrors, false); this.checkYieldAwaitInDefaultParams(); if (this.awaitIdentPos > 0) { @@ -2640,53 +2674,53 @@ var require_acorn = __commonJS({ this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit); + return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit); } this.checkExpressionErrors(refDestructuringErrors, true); this.yieldPos = oldYieldPos || this.yieldPos; this.awaitPos = oldAwaitPos || this.awaitPos; this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; var node$1 = this.startNodeAt(startPos, startLoc); - node$1.callee = base2; + node$1.callee = base; node$1.arguments = exprList; if (optionalSupported) { node$1.optional = optional; } - base2 = this.finishNode(node$1, "CallExpression"); + base = this.finishNode(node$1, "CallExpression"); } else if (this.type === types$12.backQuote) { if (optional || optionalChained) { this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); } var node$2 = this.startNodeAt(startPos, startLoc); - node$2.tag = base2; + node$2.tag = base; node$2.quasi = this.parseTemplate({ isTagged: true }); - base2 = this.finishNode(node$2, "TaggedTemplateExpression"); + base = this.finishNode(node$2, "TaggedTemplateExpression"); } - return base2; + return base; }; - pp$52.parseExprAtom = function(refDestructuringErrors, forInit) { + pp$52.parseExprAtom = function(refDestructuringErrors, forInit, forNew) { if (this.type === types$12.slash) { this.readRegexp(); } - var node, canBeArrow = this.potentialArrowAt === this.start; + var node2, canBeArrow = this.potentialArrowAt === this.start; switch (this.type) { case types$12._super: if (!this.allowSuper) { this.raise(this.start, "'super' keyword outside a method"); } - node = this.startNode(); + node2 = this.startNode(); this.next(); if (this.type === types$12.parenL && !this.allowDirectSuper) { - this.raise(node.start, "super() call outside constructor of a subclass"); + this.raise(node2.start, "super() call outside constructor of a subclass"); } if (this.type !== types$12.dot && this.type !== types$12.bracketL && this.type !== types$12.parenL) { this.unexpected(); } - return this.finishNode(node, "Super"); + return this.finishNode(node2, "Super"); case types$12._this: - node = this.startNode(); + node2 = this.startNode(); this.next(); - return this.finishNode(node, "ThisExpression"); + return this.finishNode(node2, "ThisExpression"); case types$12.name: var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; var id = this.parseIdent(false); @@ -2709,43 +2743,43 @@ var require_acorn = __commonJS({ return id; case types$12.regexp: var value = this.value; - node = this.parseLiteral(value.value); - node.regex = { pattern: value.pattern, flags: value.flags }; - return node; + node2 = this.parseLiteral(value.value); + node2.regex = { pattern: value.pattern, flags: value.flags }; + return node2; case types$12.num: case types$12.string: return this.parseLiteral(this.value); case types$12._null: case types$12._true: case types$12._false: - node = this.startNode(); - node.value = this.type === types$12._null ? null : this.type === types$12._true; - node.raw = this.type.keyword; + node2 = this.startNode(); + node2.value = this.type === types$12._null ? null : this.type === types$12._true; + node2.raw = this.type.keyword; this.next(); - return this.finishNode(node, "Literal"); + return this.finishNode(node2, "Literal"); case types$12.parenL: - var start3 = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); + var start2 = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); if (refDestructuringErrors) { if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) { - refDestructuringErrors.parenthesizedAssign = start3; + refDestructuringErrors.parenthesizedAssign = start2; } if (refDestructuringErrors.parenthesizedBind < 0) { - refDestructuringErrors.parenthesizedBind = start3; + refDestructuringErrors.parenthesizedBind = start2; } } return expr; case types$12.bracketL: - node = this.startNode(); + node2 = this.startNode(); this.next(); - node.elements = this.parseExprList(types$12.bracketR, true, true, refDestructuringErrors); - return this.finishNode(node, "ArrayExpression"); + node2.elements = this.parseExprList(types$12.bracketR, true, true, refDestructuringErrors); + return this.finishNode(node2, "ArrayExpression"); case types$12.braceL: this.overrideContext(types2.b_expr); return this.parseObj(false, refDestructuringErrors); case types$12._function: - node = this.startNode(); + node2 = this.startNode(); this.next(); - return this.parseFunction(node, 0); + return this.parseFunction(node2, 0); case types$12._class: return this.parseClass(this.startNode(), false); case types$12._new: @@ -2754,33 +2788,35 @@ var require_acorn = __commonJS({ return this.parseTemplate(); case types$12._import: if (this.options.ecmaVersion >= 11) { - return this.parseExprImport(); + return this.parseExprImport(forNew); } else { return this.unexpected(); } default: - this.unexpected(); + return this.parseExprAtomDefault(); } }; - pp$52.parseExprImport = function() { - var node = this.startNode(); + pp$52.parseExprAtomDefault = function() { + this.unexpected(); + }; + pp$52.parseExprImport = function(forNew) { + var node2 = this.startNode(); if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); } var meta = this.parseIdent(true); - switch (this.type) { - case types$12.parenL: - return this.parseDynamicImport(node); - case types$12.dot: - node.meta = meta; - return this.parseImportMeta(node); - default: - this.unexpected(); + if (this.type === types$12.parenL && !forNew) { + return this.parseDynamicImport(node2); + } else if (this.type === types$12.dot) { + node2.meta = meta; + return this.parseImportMeta(node2); + } else { + this.unexpected(); } }; - pp$52.parseDynamicImport = function(node) { + pp$52.parseDynamicImport = function(node2) { this.next(); - node.source = this.parseMaybeAssign(); + node2.source = this.parseMaybeAssign(); if (!this.eat(types$12.parenR)) { var errorPos = this.start; if (this.eat(types$12.comma) && this.eat(types$12.parenR)) { @@ -2789,32 +2825,32 @@ var require_acorn = __commonJS({ this.unexpected(errorPos); } } - return this.finishNode(node, "ImportExpression"); + return this.finishNode(node2, "ImportExpression"); }; - pp$52.parseImportMeta = function(node) { + pp$52.parseImportMeta = function(node2) { this.next(); var containsEsc = this.containsEsc; - node.property = this.parseIdent(true); - if (node.property.name !== "meta") { - this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); + node2.property = this.parseIdent(true); + if (node2.property.name !== "meta") { + this.raiseRecoverable(node2.property.start, "The only valid meta property for import is 'import.meta'"); } if (containsEsc) { - this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); + this.raiseRecoverable(node2.start, "'import.meta' must not contain escaped characters"); } if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) { - this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); + this.raiseRecoverable(node2.start, "Cannot use 'import.meta' outside a module"); } - return this.finishNode(node, "MetaProperty"); + return this.finishNode(node2, "MetaProperty"); }; pp$52.parseLiteral = function(value) { - var node = this.startNode(); - node.value = value; - node.raw = this.input.slice(this.start, this.end); - if (node.raw.charCodeAt(node.raw.length - 1) === 110) { - node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); + var node2 = this.startNode(); + node2.value = value; + node2.raw = this.input.slice(this.start, this.end); + if (node2.raw.charCodeAt(node2.raw.length - 1) === 110) { + node2.bigint = node2.raw.slice(0, -1).replace(/_/g, ""); } this.next(); - return this.finishNode(node, "Literal"); + return this.finishNode(node2, "Literal"); }; pp$52.parseParenExpression = function() { this.expect(types$12.parenL); @@ -2822,6 +2858,9 @@ var require_acorn = __commonJS({ this.expect(types$12.parenR); return val; }; + pp$52.shouldParseArrow = function(exprList) { + return !this.canInsertSemicolon(); + }; pp$52.parseParenAndDistinguishExpression = function(canBeArrow, forInit) { var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8; if (this.options.ecmaVersion >= 6) { @@ -2840,7 +2879,10 @@ var require_acorn = __commonJS({ spreadStart = this.start; exprList.push(this.parseParenItem(this.parseRestBinding())); if (this.type === types$12.comma) { - this.raise(this.start, "Comma is not permitted after the rest element"); + this.raiseRecoverable( + this.start, + "Comma is not permitted after the rest element" + ); } break; } else { @@ -2849,7 +2891,7 @@ var require_acorn = __commonJS({ } var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc; this.expect(types$12.parenR); - if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$12.arrow)) { + if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$12.arrow)) { this.checkPatternErrors(refDestructuringErrors, false); this.checkYieldAwaitInDefaultParams(); this.yieldPos = oldYieldPos; @@ -2889,39 +2931,36 @@ var require_acorn = __commonJS({ pp$52.parseParenArrowList = function(startPos, startLoc, exprList, forInit) { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit); }; - var empty3 = []; + var empty5 = []; pp$52.parseNew = function() { if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } - var node = this.startNode(); + var node2 = this.startNode(); var meta = this.parseIdent(true); if (this.options.ecmaVersion >= 6 && this.eat(types$12.dot)) { - node.meta = meta; + node2.meta = meta; var containsEsc = this.containsEsc; - node.property = this.parseIdent(true); - if (node.property.name !== "target") { - this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); + node2.property = this.parseIdent(true); + if (node2.property.name !== "target") { + this.raiseRecoverable(node2.property.start, "The only valid meta property for new is 'new.target'"); } if (containsEsc) { - this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); + this.raiseRecoverable(node2.start, "'new.target' must not contain escaped characters"); } if (!this.allowNewDotTarget) { - this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); + this.raiseRecoverable(node2.start, "'new.target' can only be used in functions and class static block"); } - return this.finishNode(node, "MetaProperty"); - } - var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$12._import; - node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false); - if (isImport && node.callee.type === "ImportExpression") { - this.raise(startPos, "Cannot use new with import()"); + return this.finishNode(node2, "MetaProperty"); } + var startPos = this.start, startLoc = this.startLoc; + node2.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false); if (this.eat(types$12.parenL)) { - node.arguments = this.parseExprList(types$12.parenR, this.options.ecmaVersion >= 8, false); + node2.arguments = this.parseExprList(types$12.parenR, this.options.ecmaVersion >= 8, false); } else { - node.arguments = empty3; + node2.arguments = empty5; } - return this.finishNode(node, "NewExpression"); + return this.finishNode(node2, "NewExpression"); }; pp$52.parseTemplateElement = function(ref3) { var isTagged = ref3.isTagged; @@ -2950,29 +2989,29 @@ var require_acorn = __commonJS({ var isTagged = ref3.isTagged; if (isTagged === void 0) isTagged = false; - var node = this.startNode(); + var node2 = this.startNode(); this.next(); - node.expressions = []; + node2.expressions = []; var curElt = this.parseTemplateElement({ isTagged }); - node.quasis = [curElt]; + node2.quasis = [curElt]; while (!curElt.tail) { if (this.type === types$12.eof) { this.raise(this.pos, "Unterminated template literal"); } this.expect(types$12.dollarBraceL); - node.expressions.push(this.parseExpression()); + node2.expressions.push(this.parseExpression()); this.expect(types$12.braceR); - node.quasis.push(curElt = this.parseTemplateElement({ isTagged })); + node2.quasis.push(curElt = this.parseTemplateElement({ isTagged })); } this.next(); - return this.finishNode(node, "TemplateLiteral"); + return this.finishNode(node2, "TemplateLiteral"); }; pp$52.isAsyncProp = function(prop) { return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.type === types$12.name || this.type === types$12.num || this.type === types$12.string || this.type === types$12.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$12.star) && !lineBreak2.test(this.input.slice(this.lastTokEnd, this.start)); }; pp$52.parseObj = function(isPattern, refDestructuringErrors) { - var node = this.startNode(), first = true, propHash = {}; - node.properties = []; + var node2 = this.startNode(), first = true, propHash = {}; + node2.properties = []; this.next(); while (!this.eat(types$12.braceR)) { if (!first) { @@ -2987,9 +3026,9 @@ var require_acorn = __commonJS({ if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); } - node.properties.push(prop); + node2.properties.push(prop); } - return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); + return this.finishNode(node2, isPattern ? "ObjectPattern" : "ObjectExpression"); }; pp$52.parseProperty = function(isPattern, refDestructuringErrors) { var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; @@ -2997,7 +3036,7 @@ var require_acorn = __commonJS({ if (isPattern) { prop.argument = this.parseIdent(false); if (this.type === types$12.comma) { - this.raise(this.start, "Comma is not permitted after the rest element"); + this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); } return this.finishNode(prop, "RestElement"); } @@ -3023,13 +3062,31 @@ var require_acorn = __commonJS({ if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { isAsync = true; isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$12.star); - this.parsePropertyName(prop, refDestructuringErrors); + this.parsePropertyName(prop); } else { isAsync = false; } this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); return this.finishNode(prop, "Property"); }; + pp$52.parseGetterSetter = function(prop) { + prop.kind = prop.key.name; + this.parsePropertyName(prop); + prop.value = this.parseMethod(false); + var paramCount = prop.kind === "get" ? 0 : 1; + if (prop.value.params.length !== paramCount) { + var start2 = prop.value.start; + if (prop.kind === "get") { + this.raiseRecoverable(start2, "getter should have no params"); + } else { + this.raiseRecoverable(start2, "setter should have exactly one param"); + } + } else { + if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { + this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); + } + } + }; pp$52.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { if ((isGenerator || isAsync) && this.type === types$12.colon) { this.unexpected(); @@ -3048,22 +3105,7 @@ var require_acorn = __commonJS({ if (isGenerator || isAsync) { this.unexpected(); } - prop.kind = prop.key.name; - this.parsePropertyName(prop); - prop.value = this.parseMethod(false); - var paramCount = prop.kind === "get" ? 0 : 1; - if (prop.value.params.length !== paramCount) { - var start3 = prop.value.start; - if (prop.kind === "get") { - this.raiseRecoverable(start3, "getter should have no params"); - } else { - this.raiseRecoverable(start3, "setter should have exactly one param"); - } - } else { - if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { - this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); - } - } + this.parseGetterSetter(prop); } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { if (isGenerator || isAsync) { this.unexpected(); @@ -3101,67 +3143,67 @@ var require_acorn = __commonJS({ } return prop.key = this.type === types$12.num || this.type === types$12.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); }; - pp$52.initFunction = function(node) { - node.id = null; + pp$52.initFunction = function(node2) { + node2.id = null; if (this.options.ecmaVersion >= 6) { - node.generator = node.expression = false; + node2.generator = node2.expression = false; } if (this.options.ecmaVersion >= 8) { - node.async = false; + node2.async = false; } }; pp$52.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { - var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.initFunction(node); + var node2 = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.initFunction(node2); if (this.options.ecmaVersion >= 6) { - node.generator = isGenerator; + node2.generator = isGenerator; } if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; + node2.async = !!isAsync; } this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; - this.enterScope(functionFlags2(isAsync, node.generator) | SCOPE_SUPER2 | (allowDirectSuper ? SCOPE_DIRECT_SUPER2 : 0)); + this.enterScope(functionFlags2(isAsync, node2.generator) | SCOPE_SUPER2 | (allowDirectSuper ? SCOPE_DIRECT_SUPER2 : 0)); this.expect(types$12.parenL); - node.params = this.parseBindingList(types$12.parenR, false, this.options.ecmaVersion >= 8); + node2.params = this.parseBindingList(types$12.parenR, false, this.options.ecmaVersion >= 8); this.checkYieldAwaitInDefaultParams(); - this.parseFunctionBody(node, false, true, false); + this.parseFunctionBody(node2, false, true, false); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, "FunctionExpression"); + return this.finishNode(node2, "FunctionExpression"); }; - pp$52.parseArrowExpression = function(node, params, isAsync, forInit) { + pp$52.parseArrowExpression = function(node2, params, isAsync, forInit) { var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.enterScope(functionFlags2(isAsync, false) | SCOPE_ARROW2); - this.initFunction(node); + this.initFunction(node2); if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; + node2.async = !!isAsync; } this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; - node.params = this.toAssignableList(params, true); - this.parseFunctionBody(node, true, false, forInit); + node2.params = this.toAssignableList(params, true); + this.parseFunctionBody(node2, true, false, forInit); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, "ArrowFunctionExpression"); + return this.finishNode(node2, "ArrowFunctionExpression"); }; - pp$52.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { + pp$52.parseFunctionBody = function(node2, isArrowFunction, isMethod, forInit) { var isExpression = isArrowFunction && this.type !== types$12.braceL; var oldStrict = this.strict, useStrict = false; if (isExpression) { - node.body = this.parseMaybeAssign(forInit); - node.expression = true; - this.checkParams(node, false); + node2.body = this.parseMaybeAssign(forInit); + node2.expression = true; + this.checkParams(node2, false); } else { - var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params); + var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node2.params); if (!oldStrict || nonSimple) { useStrict = this.strictDirective(this.end); if (useStrict && nonSimple) { - this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); + this.raiseRecoverable(node2.start, "Illegal 'use strict' directive in function with non-simple parameter list"); } } var oldLabels = this.labels; @@ -3169,13 +3211,13 @@ var require_acorn = __commonJS({ if (useStrict) { this.strict = true; } - this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); - if (this.strict && node.id) { - this.checkLValSimple(node.id, BIND_OUTSIDE2); + this.checkParams(node2, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node2.params)); + if (this.strict && node2.id) { + this.checkLValSimple(node2.id, BIND_OUTSIDE2); } - node.body = this.parseBlock(false, void 0, useStrict && !oldStrict); - node.expression = false; - this.adaptDirectivePrologue(node.body.body); + node2.body = this.parseBlock(false, void 0, useStrict && !oldStrict); + node2.expression = false; + this.adaptDirectivePrologue(node2.body.body); this.labels = oldLabels; } this.exitScope(); @@ -3189,9 +3231,9 @@ var require_acorn = __commonJS({ } return true; }; - pp$52.checkParams = function(node, allowDuplicates) { + pp$52.checkParams = function(node2, allowDuplicates) { var nameHash = /* @__PURE__ */ Object.create(null); - for (var i2 = 0, list4 = node.params; i2 < list4.length; i2 += 1) { + for (var i2 = 0, list4 = node2.params; i2 < list4.length; i2 += 1) { var param = list4[i2]; this.checkLValInnerPattern(param, BIND_VAR2, allowDuplicates ? null : nameHash); } @@ -3223,96 +3265,102 @@ var require_acorn = __commonJS({ return elts; }; pp$52.checkUnreserved = function(ref3) { - var start3 = ref3.start; + var start2 = ref3.start; var end = ref3.end; var name2 = ref3.name; if (this.inGenerator && name2 === "yield") { - this.raiseRecoverable(start3, "Cannot use 'yield' as identifier inside a generator"); + this.raiseRecoverable(start2, "Cannot use 'yield' as identifier inside a generator"); } if (this.inAsync && name2 === "await") { - this.raiseRecoverable(start3, "Cannot use 'await' as identifier inside an async function"); + this.raiseRecoverable(start2, "Cannot use 'await' as identifier inside an async function"); } if (this.currentThisScope().inClassFieldInit && name2 === "arguments") { - this.raiseRecoverable(start3, "Cannot use 'arguments' in class field initializer"); + this.raiseRecoverable(start2, "Cannot use 'arguments' in class field initializer"); } if (this.inClassStaticBlock && (name2 === "arguments" || name2 === "await")) { - this.raise(start3, "Cannot use " + name2 + " in class static initialization block"); + this.raise(start2, "Cannot use " + name2 + " in class static initialization block"); } if (this.keywords.test(name2)) { - this.raise(start3, "Unexpected keyword '" + name2 + "'"); + this.raise(start2, "Unexpected keyword '" + name2 + "'"); } - if (this.options.ecmaVersion < 6 && this.input.slice(start3, end).indexOf("\\") !== -1) { + if (this.options.ecmaVersion < 6 && this.input.slice(start2, end).indexOf("\\") !== -1) { return; } - var re = this.strict ? this.reservedWordsStrict : this.reservedWords; - if (re.test(name2)) { + var re2 = this.strict ? this.reservedWordsStrict : this.reservedWords; + if (re2.test(name2)) { if (!this.inAsync && name2 === "await") { - this.raiseRecoverable(start3, "Cannot use keyword 'await' outside an async function"); + this.raiseRecoverable(start2, "Cannot use keyword 'await' outside an async function"); + } + this.raiseRecoverable(start2, "The keyword '" + name2 + "' is reserved"); + } + }; + pp$52.parseIdent = function(liberal) { + var node2 = this.parseIdentNode(); + this.next(!!liberal); + this.finishNode(node2, "Identifier"); + if (!liberal) { + this.checkUnreserved(node2); + if (node2.name === "await" && !this.awaitIdentPos) { + this.awaitIdentPos = node2.start; } - this.raiseRecoverable(start3, "The keyword '" + name2 + "' is reserved"); } + return node2; }; - pp$52.parseIdent = function(liberal, isBinding) { - var node = this.startNode(); + pp$52.parseIdentNode = function() { + var node2 = this.startNode(); if (this.type === types$12.name) { - node.name = this.value; + node2.name = this.value; } else if (this.type.keyword) { - node.name = this.type.keyword; - if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { + node2.name = this.type.keyword; + if ((node2.name === "class" || node2.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { this.context.pop(); } } else { this.unexpected(); } - this.next(!!liberal); - this.finishNode(node, "Identifier"); - if (!liberal) { - this.checkUnreserved(node); - if (node.name === "await" && !this.awaitIdentPos) { - this.awaitIdentPos = node.start; - } - } - return node; + return node2; }; pp$52.parsePrivateIdent = function() { - var node = this.startNode(); + var node2 = this.startNode(); if (this.type === types$12.privateId) { - node.name = this.value; + node2.name = this.value; } else { this.unexpected(); } this.next(); - this.finishNode(node, "PrivateIdentifier"); - if (this.privateNameStack.length === 0) { - this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class"); - } else { - this.privateNameStack[this.privateNameStack.length - 1].used.push(node); + this.finishNode(node2, "PrivateIdentifier"); + if (this.options.checkPrivateFields) { + if (this.privateNameStack.length === 0) { + this.raise(node2.start, "Private field '#" + node2.name + "' must be declared in an enclosing class"); + } else { + this.privateNameStack[this.privateNameStack.length - 1].used.push(node2); + } } - return node; + return node2; }; pp$52.parseYield = function(forInit) { if (!this.yieldPos) { this.yieldPos = this.start; } - var node = this.startNode(); + var node2 = this.startNode(); this.next(); if (this.type === types$12.semi || this.canInsertSemicolon() || this.type !== types$12.star && !this.type.startsExpr) { - node.delegate = false; - node.argument = null; + node2.delegate = false; + node2.argument = null; } else { - node.delegate = this.eat(types$12.star); - node.argument = this.parseMaybeAssign(forInit); + node2.delegate = this.eat(types$12.star); + node2.argument = this.parseMaybeAssign(forInit); } - return this.finishNode(node, "YieldExpression"); + return this.finishNode(node2, "YieldExpression"); }; pp$52.parseAwait = function(forInit) { if (!this.awaitPos) { this.awaitPos = this.start; } - var node = this.startNode(); + var node2 = this.startNode(); this.next(); - node.argument = this.parseMaybeUnary(null, true, false, forInit); - return this.finishNode(node, "AwaitExpression"); + node2.argument = this.parseMaybeUnary(null, true, false, forInit); + return this.finishNode(node2, "AwaitExpression"); }; var pp$42 = Parser3.prototype; pp$42.raise = function(pos, message) { @@ -3432,27 +3480,27 @@ var require_acorn = __commonJS({ pp$22.startNodeAt = function(pos, loc) { return new Node3(this, pos, loc); }; - function finishNodeAt2(node, type, pos, loc) { - node.type = type; - node.end = pos; + function finishNodeAt2(node2, type, pos, loc) { + node2.type = type; + node2.end = pos; if (this.options.locations) { - node.loc.end = loc; + node2.loc.end = loc; } if (this.options.ranges) { - node.range[1] = pos; + node2.range[1] = pos; } - return node; + return node2; } - pp$22.finishNode = function(node, type) { - return finishNodeAt2.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc); + pp$22.finishNode = function(node2, type) { + return finishNodeAt2.call(this, node2, type, this.lastTokEnd, this.lastTokEndLoc); }; - pp$22.finishNodeAt = function(node, type, pos, loc) { - return finishNodeAt2.call(this, node, type, pos, loc); + pp$22.finishNodeAt = function(node2, type, pos, loc) { + return finishNodeAt2.call(this, node2, type, pos, loc); }; - pp$22.copyNode = function(node) { - var newNode = new Node3(this, node.start, this.startLoc); - for (var prop in node) { - newNode[prop] = node[prop]; + pp$22.copyNode = function(node2) { + var newNode = new Node3(this, node2.start, this.startLoc); + for (var prop in node2) { + newNode[prop] = node2[prop]; } return newNode; }; @@ -3461,12 +3509,23 @@ var require_acorn = __commonJS({ var ecma11BinaryProperties2 = ecma10BinaryProperties2; var ecma12BinaryProperties2 = ecma11BinaryProperties2 + " EBase EComp EMod EPres ExtPict"; var ecma13BinaryProperties2 = ecma12BinaryProperties2; + var ecma14BinaryProperties2 = ecma13BinaryProperties2; var unicodeBinaryProperties2 = { 9: ecma9BinaryProperties2, 10: ecma10BinaryProperties2, 11: ecma11BinaryProperties2, 12: ecma12BinaryProperties2, - 13: ecma13BinaryProperties2 + 13: ecma13BinaryProperties2, + 14: ecma14BinaryProperties2 + }; + var ecma14BinaryPropertiesOfStrings2 = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"; + var unicodeBinaryPropertiesOfStrings2 = { + 9: "", + 10: "", + 11: "", + 12: "", + 13: "", + 14: ecma14BinaryPropertiesOfStrings2 }; var unicodeGeneralCategoryValues2 = "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"; var ecma9ScriptValues2 = "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"; @@ -3474,17 +3533,20 @@ var require_acorn = __commonJS({ var ecma11ScriptValues2 = ecma10ScriptValues2 + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; var ecma12ScriptValues2 = ecma11ScriptValues2 + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; var ecma13ScriptValues2 = ecma12ScriptValues2 + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith"; + var ecma14ScriptValues2 = ecma13ScriptValues2 + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz"; var unicodeScriptValues2 = { 9: ecma9ScriptValues2, 10: ecma10ScriptValues2, 11: ecma11ScriptValues2, 12: ecma12ScriptValues2, - 13: ecma13ScriptValues2 + 13: ecma13ScriptValues2, + 14: ecma14ScriptValues2 }; var data2 = {}; function buildUnicodeData2(ecmaVersion2) { var d = data2[ecmaVersion2] = { binary: wordsRegexp2(unicodeBinaryProperties2[ecmaVersion2] + " " + unicodeGeneralCategoryValues2), + binaryOfStrings: wordsRegexp2(unicodeBinaryPropertiesOfStrings2[ecmaVersion2]), nonBinary: { General_Category: wordsRegexp2(unicodeGeneralCategoryValues2), Script: wordsRegexp2(unicodeScriptValues2[ecmaVersion2]) @@ -3495,19 +3557,20 @@ var require_acorn = __commonJS({ d.nonBinary.sc = d.nonBinary.Script; d.nonBinary.scx = d.nonBinary.Script_Extensions; } - for (var i = 0, list3 = [9, 10, 11, 12, 13]; i < list3.length; i += 1) { + for (var i = 0, list3 = [9, 10, 11, 12, 13, 14]; i < list3.length; i += 1) { var ecmaVersion = list3[i]; buildUnicodeData2(ecmaVersion); } var pp$12 = Parser3.prototype; var RegExpValidationState3 = function RegExpValidationState4(parser) { this.parser = parser; - this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : ""); - this.unicodeProperties = data2[parser.options.ecmaVersion >= 13 ? 13 : parser.options.ecmaVersion]; + this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : ""); + this.unicodeProperties = data2[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion]; this.source = ""; this.flags = ""; this.start = 0; this.switchU = false; + this.switchV = false; this.switchN = false; this.pos = 0; this.lastIntValue = 0; @@ -3518,13 +3581,21 @@ var require_acorn = __commonJS({ this.groupNames = []; this.backReferenceNames = []; }; - RegExpValidationState3.prototype.reset = function reset2(start3, pattern, flags) { + RegExpValidationState3.prototype.reset = function reset2(start2, pattern, flags) { + var unicodeSets = flags.indexOf("v") !== -1; var unicode = flags.indexOf("u") !== -1; - this.start = start3 | 0; + this.start = start2 | 0; this.source = pattern + ""; this.flags = flags; - this.switchU = unicode && this.parser.options.ecmaVersion >= 6; - this.switchN = unicode && this.parser.options.ecmaVersion >= 9; + if (unicodeSets && this.parser.options.ecmaVersion >= 15) { + this.switchU = true; + this.switchV = true; + this.switchN = true; + } else { + this.switchU = unicode && this.parser.options.ecmaVersion >= 6; + this.switchV = false; + this.switchN = unicode && this.parser.options.ecmaVersion >= 9; + } }; RegExpValidationState3.prototype.raise = function raise2(message) { this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message); @@ -3582,9 +3653,26 @@ var require_acorn = __commonJS({ } return false; }; + RegExpValidationState3.prototype.eatChars = function eatChars2(chs, forceU) { + if (forceU === void 0) + forceU = false; + var pos = this.pos; + for (var i2 = 0, list4 = chs; i2 < list4.length; i2 += 1) { + var ch = list4[i2]; + var current2 = this.at(pos, forceU); + if (current2 === -1 || current2 !== ch) { + return false; + } + pos = this.nextIndex(pos, forceU); + } + this.pos = pos; + return true; + }; pp$12.validateRegExpFlags = function(state) { var validFlags = state.validFlags; var flags = state.flags; + var u = false; + var v = false; for (var i2 = 0; i2 < flags.length; i2++) { var flag = flags.charAt(i2); if (validFlags.indexOf(flag) === -1) { @@ -3593,6 +3681,15 @@ var require_acorn = __commonJS({ if (flags.indexOf(flag, i2 + 1) > -1) { this.raise(state.start, "Duplicate regular expression flag"); } + if (flag === "u") { + u = true; + } + if (flag === "v") { + v = true; + } + } + if (this.options.ecmaVersion >= 15 && u && v) { + this.raise(state.start, "Invalid regular expression flag"); } }; pp$12.validateRegExpPattern = function(state) { @@ -3613,10 +3710,19 @@ var require_acorn = __commonJS({ state.backReferenceNames.length = 0; this.regexp_disjunction(state); if (state.pos !== state.source.length) { - if (state.eat(41)) { + if (state.eat( + 41 + /* ) */ + )) { state.raise("Unmatched ')'"); } - if (state.eat(93) || state.eat(125)) { + if (state.eat( + 93 + /* ] */ + ) || state.eat( + 125 + /* } */ + )) { state.raise("Lone quantifier brackets"); } } @@ -3632,13 +3738,19 @@ var require_acorn = __commonJS({ }; pp$12.regexp_disjunction = function(state) { this.regexp_alternative(state); - while (state.eat(124)) { + while (state.eat( + 124 + /* | */ + )) { this.regexp_alternative(state); } if (this.regexp_eatQuantifier(state, true)) { state.raise("Nothing to repeat"); } - if (state.eat(123)) { + if (state.eat( + 123 + /* { */ + )) { state.raise("Lone quantifier brackets"); } }; @@ -3662,56 +3774,110 @@ var require_acorn = __commonJS({ return false; }; pp$12.regexp_eatAssertion = function(state) { - var start3 = state.pos; + var start2 = state.pos; state.lastAssertionIsQuantifiable = false; - if (state.eat(94) || state.eat(36)) { + if (state.eat( + 94 + /* ^ */ + ) || state.eat( + 36 + /* $ */ + )) { return true; } - if (state.eat(92)) { - if (state.eat(66) || state.eat(98)) { + if (state.eat( + 92 + /* \ */ + )) { + if (state.eat( + 66 + /* B */ + ) || state.eat( + 98 + /* b */ + )) { return true; } - state.pos = start3; + state.pos = start2; } - if (state.eat(40) && state.eat(63)) { + if (state.eat( + 40 + /* ( */ + ) && state.eat( + 63 + /* ? */ + )) { var lookbehind = false; if (this.options.ecmaVersion >= 9) { - lookbehind = state.eat(60); + lookbehind = state.eat( + 60 + /* < */ + ); } - if (state.eat(61) || state.eat(33)) { + if (state.eat( + 61 + /* = */ + ) || state.eat( + 33 + /* ! */ + )) { this.regexp_disjunction(state); - if (!state.eat(41)) { + if (!state.eat( + 41 + /* ) */ + )) { state.raise("Unterminated group"); } state.lastAssertionIsQuantifiable = !lookbehind; return true; } } - state.pos = start3; + state.pos = start2; return false; }; pp$12.regexp_eatQuantifier = function(state, noError) { if (noError === void 0) noError = false; if (this.regexp_eatQuantifierPrefix(state, noError)) { - state.eat(63); + state.eat( + 63 + /* ? */ + ); return true; } return false; }; pp$12.regexp_eatQuantifierPrefix = function(state, noError) { - return state.eat(42) || state.eat(43) || state.eat(63) || this.regexp_eatBracedQuantifier(state, noError); + return state.eat( + 42 + /* * */ + ) || state.eat( + 43 + /* + */ + ) || state.eat( + 63 + /* ? */ + ) || this.regexp_eatBracedQuantifier(state, noError); }; pp$12.regexp_eatBracedQuantifier = function(state, noError) { - var start3 = state.pos; - if (state.eat(123)) { + var start2 = state.pos; + if (state.eat( + 123 + /* { */ + )) { var min = 0, max = -1; if (this.regexp_eatDecimalDigits(state)) { min = state.lastIntValue; - if (state.eat(44) && this.regexp_eatDecimalDigits(state)) { + if (state.eat( + 44 + /* , */ + ) && this.regexp_eatDecimalDigits(state)) { max = state.lastIntValue; } - if (state.eat(125)) { + if (state.eat( + 125 + /* } */ + )) { if (max !== -1 && max < min && !noError) { state.raise("numbers out of order in {} quantifier"); } @@ -3721,46 +3887,70 @@ var require_acorn = __commonJS({ if (state.switchU && !noError) { state.raise("Incomplete quantifier"); } - state.pos = start3; + state.pos = start2; } return false; }; pp$12.regexp_eatAtom = function(state) { - return this.regexp_eatPatternCharacters(state) || state.eat(46) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state); + return this.regexp_eatPatternCharacters(state) || state.eat( + 46 + /* . */ + ) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state); }; pp$12.regexp_eatReverseSolidusAtomEscape = function(state) { - var start3 = state.pos; - if (state.eat(92)) { + var start2 = state.pos; + if (state.eat( + 92 + /* \ */ + )) { if (this.regexp_eatAtomEscape(state)) { return true; } - state.pos = start3; + state.pos = start2; } return false; }; pp$12.regexp_eatUncapturingGroup = function(state) { - var start3 = state.pos; - if (state.eat(40)) { - if (state.eat(63) && state.eat(58)) { + var start2 = state.pos; + if (state.eat( + 40 + /* ( */ + )) { + if (state.eat( + 63 + /* ? */ + ) && state.eat( + 58 + /* : */ + )) { this.regexp_disjunction(state); - if (state.eat(41)) { + if (state.eat( + 41 + /* ) */ + )) { return true; } state.raise("Unterminated group"); } - state.pos = start3; + state.pos = start2; } return false; }; pp$12.regexp_eatCapturingGroup = function(state) { - if (state.eat(40)) { + if (state.eat( + 40 + /* ( */ + )) { if (this.options.ecmaVersion >= 9) { this.regexp_groupSpecifier(state); } else if (state.current() === 63) { state.raise("Invalid group"); } this.regexp_disjunction(state); - if (state.eat(41)) { + if (state.eat( + 41 + /* ) */ + )) { state.numCapturingParens += 1; return true; } @@ -3769,7 +3959,10 @@ var require_acorn = __commonJS({ return false; }; pp$12.regexp_eatExtendedAtom = function(state) { - return state.eat(46) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state); + return state.eat( + 46 + /* . */ + ) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state); }; pp$12.regexp_eatInvalidBracedQuantifier = function(state) { if (this.regexp_eatBracedQuantifier(state, true)) { @@ -3790,12 +3983,12 @@ var require_acorn = __commonJS({ return ch === 36 || ch >= 40 && ch <= 43 || ch === 46 || ch === 63 || ch >= 91 && ch <= 94 || ch >= 123 && ch <= 125; } pp$12.regexp_eatPatternCharacters = function(state) { - var start3 = state.pos; + var start2 = state.pos; var ch = 0; while ((ch = state.current()) !== -1 && !isSyntaxCharacter2(ch)) { state.advance(); } - return state.pos !== start3; + return state.pos !== start2; }; pp$12.regexp_eatExtendedPatternCharacter = function(state) { var ch = state.current(); @@ -3806,7 +3999,10 @@ var require_acorn = __commonJS({ return false; }; pp$12.regexp_groupSpecifier = function(state) { - if (state.eat(63)) { + if (state.eat( + 63 + /* ? */ + )) { if (this.regexp_eatGroupName(state)) { if (state.groupNames.indexOf(state.lastStringValue) !== -1) { state.raise("Duplicate capture group name"); @@ -3819,8 +4015,14 @@ var require_acorn = __commonJS({ }; pp$12.regexp_eatGroupName = function(state) { state.lastStringValue = ""; - if (state.eat(60)) { - if (this.regexp_eatRegExpIdentifierName(state) && state.eat(62)) { + if (state.eat( + 60 + /* < */ + )) { + if (this.regexp_eatRegExpIdentifierName(state) && state.eat( + 62 + /* > */ + )) { return true; } state.raise("Invalid capture group name"); @@ -3839,7 +4041,7 @@ var require_acorn = __commonJS({ return false; }; pp$12.regexp_eatRegExpIdentifierStart = function(state) { - var start3 = state.pos; + var start2 = state.pos; var forceU = this.options.ecmaVersion >= 11; var ch = state.current(forceU); state.advance(forceU); @@ -3850,14 +4052,14 @@ var require_acorn = __commonJS({ state.lastIntValue = ch; return true; } - state.pos = start3; + state.pos = start2; return false; }; function isRegExpIdentifierStart2(ch) { return isIdentifierStart2(ch, true) || ch === 36 || ch === 95; } pp$12.regexp_eatRegExpIdentifierPart = function(state) { - var start3 = state.pos; + var start2 = state.pos; var forceU = this.options.ecmaVersion >= 11; var ch = state.current(forceU); state.advance(forceU); @@ -3868,7 +4070,7 @@ var require_acorn = __commonJS({ state.lastIntValue = ch; return true; } - state.pos = start3; + state.pos = start2; return false; }; function isRegExpIdentifierPart2(ch) { @@ -3887,7 +4089,7 @@ var require_acorn = __commonJS({ return false; }; pp$12.regexp_eatBackReference = function(state) { - var start3 = state.pos; + var start2 = state.pos; if (this.regexp_eatDecimalEscape(state)) { var n = state.lastIntValue; if (state.switchU) { @@ -3899,12 +4101,15 @@ var require_acorn = __commonJS({ if (n <= state.numCapturingParens) { return true; } - state.pos = start3; + state.pos = start2; } return false; }; pp$12.regexp_eatKGroupName = function(state) { - if (state.eat(107)) { + if (state.eat( + 107 + /* k */ + )) { if (this.regexp_eatGroupName(state)) { state.backReferenceNames.push(state.lastStringValue); return true; @@ -3917,12 +4122,15 @@ var require_acorn = __commonJS({ return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state); }; pp$12.regexp_eatCControlLetter = function(state) { - var start3 = state.pos; - if (state.eat(99)) { + var start2 = state.pos; + if (state.eat( + 99 + /* c */ + )) { if (this.regexp_eatControlLetter(state)) { return true; } - state.pos = start3; + state.pos = start2; } return false; }; @@ -3978,14 +4186,23 @@ var require_acorn = __commonJS({ pp$12.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) { if (forceU === void 0) forceU = false; - var start3 = state.pos; + var start2 = state.pos; var switchU = forceU || state.switchU; - if (state.eat(117)) { + if (state.eat( + 117 + /* u */ + )) { if (this.regexp_eatFixedHexDigits(state, 4)) { var lead = state.lastIntValue; if (switchU && lead >= 55296 && lead <= 56319) { var leadSurrogateEnd = state.pos; - if (state.eat(92) && state.eat(117) && this.regexp_eatFixedHexDigits(state, 4)) { + if (state.eat( + 92 + /* \ */ + ) && state.eat( + 117 + /* u */ + ) && this.regexp_eatFixedHexDigits(state, 4)) { var trail = state.lastIntValue; if (trail >= 56320 && trail <= 57343) { state.lastIntValue = (lead - 55296) * 1024 + (trail - 56320) + 65536; @@ -3997,13 +4214,19 @@ var require_acorn = __commonJS({ } return true; } - if (switchU && state.eat(123) && this.regexp_eatHexDigits(state) && state.eat(125) && isValidUnicode2(state.lastIntValue)) { + if (switchU && state.eat( + 123 + /* { */ + ) && this.regexp_eatHexDigits(state) && state.eat( + 125 + /* } */ + ) && isValidUnicode2(state.lastIntValue)) { return true; } if (switchU) { state.raise("Invalid unicode escape"); } - state.pos = start3; + state.pos = start2; } return false; }; @@ -4015,7 +4238,10 @@ var require_acorn = __commonJS({ if (this.regexp_eatSyntaxCharacter(state)) { return true; } - if (state.eat(47)) { + if (state.eat( + 47 + /* / */ + )) { state.lastIntValue = 47; return true; } @@ -4041,43 +4267,59 @@ var require_acorn = __commonJS({ } return false; }; + var CharSetNone2 = 0; + var CharSetOk2 = 1; + var CharSetString2 = 2; pp$12.regexp_eatCharacterClassEscape = function(state) { var ch = state.current(); if (isCharacterClassEscape2(ch)) { state.lastIntValue = -1; state.advance(); - return true; + return CharSetOk2; } - if (state.switchU && this.options.ecmaVersion >= 9 && (ch === 80 || ch === 112)) { + var negate = false; + if (state.switchU && this.options.ecmaVersion >= 9 && ((negate = ch === 80) || ch === 112)) { state.lastIntValue = -1; state.advance(); - if (state.eat(123) && this.regexp_eatUnicodePropertyValueExpression(state) && state.eat(125)) { - return true; + var result; + if (state.eat( + 123 + /* { */ + ) && (result = this.regexp_eatUnicodePropertyValueExpression(state)) && state.eat( + 125 + /* } */ + )) { + if (negate && result === CharSetString2) { + state.raise("Invalid property name"); + } + return result; } state.raise("Invalid property name"); } - return false; + return CharSetNone2; }; function isCharacterClassEscape2(ch) { return ch === 100 || ch === 68 || ch === 115 || ch === 83 || ch === 119 || ch === 87; } pp$12.regexp_eatUnicodePropertyValueExpression = function(state) { - var start3 = state.pos; - if (this.regexp_eatUnicodePropertyName(state) && state.eat(61)) { + var start2 = state.pos; + if (this.regexp_eatUnicodePropertyName(state) && state.eat( + 61 + /* = */ + )) { var name2 = state.lastStringValue; if (this.regexp_eatUnicodePropertyValue(state)) { var value = state.lastStringValue; this.regexp_validateUnicodePropertyNameAndValue(state, name2, value); - return true; + return CharSetOk2; } } - state.pos = start3; + state.pos = start2; if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { var nameOrValue = state.lastStringValue; - this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); - return true; + return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); } - return false; + return CharSetNone2; }; pp$12.regexp_validateUnicodePropertyNameAndValue = function(state, name2, value) { if (!hasOwn2(state.unicodeProperties.nonBinary, name2)) { @@ -4088,9 +4330,13 @@ var require_acorn = __commonJS({ } }; pp$12.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) { - if (!state.unicodeProperties.binary.test(nameOrValue)) { - state.raise("Invalid property name"); + if (state.unicodeProperties.binary.test(nameOrValue)) { + return CharSetOk2; + } + if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { + return CharSetString2; } + state.raise("Invalid property name"); }; pp$12.regexp_eatUnicodePropertyName = function(state) { var ch = 0; @@ -4120,20 +4366,45 @@ var require_acorn = __commonJS({ return this.regexp_eatUnicodePropertyValue(state); }; pp$12.regexp_eatCharacterClass = function(state) { - if (state.eat(91)) { - state.eat(94); - this.regexp_classRanges(state); - if (state.eat(93)) { - return true; + if (state.eat( + 91 + /* [ */ + )) { + var negate = state.eat( + 94 + /* ^ */ + ); + var result = this.regexp_classContents(state); + if (!state.eat( + 93 + /* ] */ + )) { + state.raise("Unterminated character class"); } - state.raise("Unterminated character class"); + if (negate && result === CharSetString2) { + state.raise("Negated character class may contain strings"); + } + return true; } return false; }; - pp$12.regexp_classRanges = function(state) { + pp$12.regexp_classContents = function(state) { + if (state.current() === 93) { + return CharSetOk2; + } + if (state.switchV) { + return this.regexp_classSetExpression(state); + } + this.regexp_nonEmptyClassRanges(state); + return CharSetOk2; + }; + pp$12.regexp_nonEmptyClassRanges = function(state) { while (this.regexp_eatClassAtom(state)) { var left = state.lastIntValue; - if (state.eat(45) && this.regexp_eatClassAtom(state)) { + if (state.eat( + 45 + /* - */ + ) && this.regexp_eatClassAtom(state)) { var right = state.lastIntValue; if (state.switchU && (left === -1 || right === -1)) { state.raise("Invalid character class"); @@ -4145,8 +4416,11 @@ var require_acorn = __commonJS({ } }; pp$12.regexp_eatClassAtom = function(state) { - var start3 = state.pos; - if (state.eat(92)) { + var start2 = state.pos; + if (state.eat( + 92 + /* \ */ + )) { if (this.regexp_eatClassEscape(state)) { return true; } @@ -4157,7 +4431,7 @@ var require_acorn = __commonJS({ } state.raise("Invalid escape"); } - state.pos = start3; + state.pos = start2; } var ch = state.current(); if (ch !== 93) { @@ -4168,67 +4442,280 @@ var require_acorn = __commonJS({ return false; }; pp$12.regexp_eatClassEscape = function(state) { - var start3 = state.pos; - if (state.eat(98)) { + var start2 = state.pos; + if (state.eat( + 98 + /* b */ + )) { state.lastIntValue = 8; return true; } - if (state.switchU && state.eat(45)) { + if (state.switchU && state.eat( + 45 + /* - */ + )) { state.lastIntValue = 45; return true; } - if (!state.switchU && state.eat(99)) { + if (!state.switchU && state.eat( + 99 + /* c */ + )) { if (this.regexp_eatClassControlLetter(state)) { return true; } - state.pos = start3; + state.pos = start2; } return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state); }; - pp$12.regexp_eatClassControlLetter = function(state) { - var ch = state.current(); - if (isDecimalDigit2(ch) || ch === 95) { - state.lastIntValue = ch % 32; - state.advance(); - return true; + pp$12.regexp_classSetExpression = function(state) { + var result = CharSetOk2, subResult; + if (this.regexp_eatClassSetRange(state)) + ; + else if (subResult = this.regexp_eatClassSetOperand(state)) { + if (subResult === CharSetString2) { + result = CharSetString2; + } + var start2 = state.pos; + while (state.eatChars( + [38, 38] + /* && */ + )) { + if (state.current() !== 38 && (subResult = this.regexp_eatClassSetOperand(state))) { + if (subResult !== CharSetString2) { + result = CharSetOk2; + } + continue; + } + state.raise("Invalid character in character class"); + } + if (start2 !== state.pos) { + return result; + } + while (state.eatChars( + [45, 45] + /* -- */ + )) { + if (this.regexp_eatClassSetOperand(state)) { + continue; + } + state.raise("Invalid character in character class"); + } + if (start2 !== state.pos) { + return result; + } + } else { + state.raise("Invalid character in character class"); + } + for (; ; ) { + if (this.regexp_eatClassSetRange(state)) { + continue; + } + subResult = this.regexp_eatClassSetOperand(state); + if (!subResult) { + return result; + } + if (subResult === CharSetString2) { + result = CharSetString2; + } } - return false; }; - pp$12.regexp_eatHexEscapeSequence = function(state) { - var start3 = state.pos; - if (state.eat(120)) { - if (this.regexp_eatFixedHexDigits(state, 2)) { + pp$12.regexp_eatClassSetRange = function(state) { + var start2 = state.pos; + if (this.regexp_eatClassSetCharacter(state)) { + var left = state.lastIntValue; + if (state.eat( + 45 + /* - */ + ) && this.regexp_eatClassSetCharacter(state)) { + var right = state.lastIntValue; + if (left !== -1 && right !== -1 && left > right) { + state.raise("Range out of order in character class"); + } return true; } - if (state.switchU) { - state.raise("Invalid escape"); - } - state.pos = start3; + state.pos = start2; } return false; }; - pp$12.regexp_eatDecimalDigits = function(state) { - var start3 = state.pos; - var ch = 0; - state.lastIntValue = 0; - while (isDecimalDigit2(ch = state.current())) { - state.lastIntValue = 10 * state.lastIntValue + (ch - 48); - state.advance(); + pp$12.regexp_eatClassSetOperand = function(state) { + if (this.regexp_eatClassSetCharacter(state)) { + return CharSetOk2; + } + return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state); + }; + pp$12.regexp_eatNestedClass = function(state) { + var start2 = state.pos; + if (state.eat( + 91 + /* [ */ + )) { + var negate = state.eat( + 94 + /* ^ */ + ); + var result = this.regexp_classContents(state); + if (state.eat( + 93 + /* ] */ + )) { + if (negate && result === CharSetString2) { + state.raise("Negated character class may contain strings"); + } + return result; + } + state.pos = start2; } - return state.pos !== start3; + if (state.eat( + 92 + /* \ */ + )) { + var result$1 = this.regexp_eatCharacterClassEscape(state); + if (result$1) { + return result$1; + } + state.pos = start2; + } + return null; + }; + pp$12.regexp_eatClassStringDisjunction = function(state) { + var start2 = state.pos; + if (state.eatChars( + [92, 113] + /* \q */ + )) { + if (state.eat( + 123 + /* { */ + )) { + var result = this.regexp_classStringDisjunctionContents(state); + if (state.eat( + 125 + /* } */ + )) { + return result; + } + } else { + state.raise("Invalid escape"); + } + state.pos = start2; + } + return null; + }; + pp$12.regexp_classStringDisjunctionContents = function(state) { + var result = this.regexp_classString(state); + while (state.eat( + 124 + /* | */ + )) { + if (this.regexp_classString(state) === CharSetString2) { + result = CharSetString2; + } + } + return result; + }; + pp$12.regexp_classString = function(state) { + var count = 0; + while (this.regexp_eatClassSetCharacter(state)) { + count++; + } + return count === 1 ? CharSetOk2 : CharSetString2; + }; + pp$12.regexp_eatClassSetCharacter = function(state) { + var start2 = state.pos; + if (state.eat( + 92 + /* \ */ + )) { + if (this.regexp_eatCharacterEscape(state) || this.regexp_eatClassSetReservedPunctuator(state)) { + return true; + } + if (state.eat( + 98 + /* b */ + )) { + state.lastIntValue = 8; + return true; + } + state.pos = start2; + return false; + } + var ch = state.current(); + if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter2(ch)) { + return false; + } + if (isClassSetSyntaxCharacter2(ch)) { + return false; + } + state.advance(); + state.lastIntValue = ch; + return true; + }; + function isClassSetReservedDoublePunctuatorCharacter2(ch) { + return ch === 33 || ch >= 35 && ch <= 38 || ch >= 42 && ch <= 44 || ch === 46 || ch >= 58 && ch <= 64 || ch === 94 || ch === 96 || ch === 126; + } + function isClassSetSyntaxCharacter2(ch) { + return ch === 40 || ch === 41 || ch === 45 || ch === 47 || ch >= 91 && ch <= 93 || ch >= 123 && ch <= 125; + } + pp$12.regexp_eatClassSetReservedPunctuator = function(state) { + var ch = state.current(); + if (isClassSetReservedPunctuator2(ch)) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; + }; + function isClassSetReservedPunctuator2(ch) { + return ch === 33 || ch === 35 || ch === 37 || ch === 38 || ch === 44 || ch === 45 || ch >= 58 && ch <= 62 || ch === 64 || ch === 96 || ch === 126; + } + pp$12.regexp_eatClassControlLetter = function(state) { + var ch = state.current(); + if (isDecimalDigit2(ch) || ch === 95) { + state.lastIntValue = ch % 32; + state.advance(); + return true; + } + return false; + }; + pp$12.regexp_eatHexEscapeSequence = function(state) { + var start2 = state.pos; + if (state.eat( + 120 + /* x */ + )) { + if (this.regexp_eatFixedHexDigits(state, 2)) { + return true; + } + if (state.switchU) { + state.raise("Invalid escape"); + } + state.pos = start2; + } + return false; + }; + pp$12.regexp_eatDecimalDigits = function(state) { + var start2 = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isDecimalDigit2(ch = state.current())) { + state.lastIntValue = 10 * state.lastIntValue + (ch - 48); + state.advance(); + } + return state.pos !== start2; }; function isDecimalDigit2(ch) { return ch >= 48 && ch <= 57; } pp$12.regexp_eatHexDigits = function(state) { - var start3 = state.pos; + var start2 = state.pos; var ch = 0; state.lastIntValue = 0; while (isHexDigit2(ch = state.current())) { state.lastIntValue = 16 * state.lastIntValue + hexToInt2(ch); state.advance(); } - return state.pos !== start3; + return state.pos !== start2; }; function isHexDigit2(ch) { return ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102; @@ -4273,12 +4760,12 @@ var require_acorn = __commonJS({ return ch >= 48 && ch <= 55; } pp$12.regexp_eatFixedHexDigits = function(state, length) { - var start3 = state.pos; + var start2 = state.pos; state.lastIntValue = 0; for (var i2 = 0; i2 < length; ++i2) { var ch = state.current(); if (!isHexDigit2(ch)) { - state.pos = start3; + state.pos = start2; return false; } state.lastIntValue = 16 * state.lastIntValue + hexToInt2(ch); @@ -4364,13 +4851,13 @@ var require_acorn = __commonJS({ }; pp2.skipBlockComment = function() { var startLoc = this.options.onComment && this.curPosition(); - var start3 = this.pos, end = this.input.indexOf("*/", this.pos += 2); + var start2 = this.pos, end = this.input.indexOf("*/", this.pos += 2); if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); } this.pos = end + 2; if (this.options.locations) { - for (var nextBreak = void 0, pos = start3; (nextBreak = nextLineBreak2(this.input, pos, this.pos)) > -1; ) { + for (var nextBreak = void 0, pos = start2; (nextBreak = nextLineBreak2(this.input, pos, this.pos)) > -1; ) { ++this.curLine; pos = this.lineStart = nextBreak; } @@ -4378,8 +4865,8 @@ var require_acorn = __commonJS({ if (this.options.onComment) { this.options.onComment( true, - this.input.slice(start3 + 2, end), - start3, + this.input.slice(start2 + 2, end), + start2, this.pos, startLoc, this.curPosition() @@ -4387,7 +4874,7 @@ var require_acorn = __commonJS({ } }; pp2.skipLineComment = function(startSkip) { - var start3 = this.pos; + var start2 = this.pos; var startLoc = this.options.onComment && this.curPosition(); var ch = this.input.charCodeAt(this.pos += startSkip); while (this.pos < this.input.length && !isNewLine2(ch)) { @@ -4396,8 +4883,8 @@ var require_acorn = __commonJS({ if (this.options.onComment) { this.options.onComment( false, - this.input.slice(start3 + startSkip, this.pos), - start3, + this.input.slice(start2 + startSkip, this.pos), + start2, this.pos, startLoc, this.curPosition() @@ -4696,14 +5183,14 @@ var require_acorn = __commonJS({ return this.finishToken(type, str); }; pp2.readRegexp = function() { - var escaped, inClass, start3 = this.pos; + var escaped, inClass, start2 = this.pos; for (; ; ) { if (this.pos >= this.input.length) { - this.raise(start3, "Unterminated regular expression"); + this.raise(start2, "Unterminated regular expression"); } var ch = this.input.charAt(this.pos); if (lineBreak2.test(ch)) { - this.raise(start3, "Unterminated regular expression"); + this.raise(start2, "Unterminated regular expression"); } if (!escaped) { if (ch === "[") { @@ -4719,7 +5206,7 @@ var require_acorn = __commonJS({ } ++this.pos; } - var pattern = this.input.slice(start3, this.pos); + var pattern = this.input.slice(start2, this.pos); ++this.pos; var flagsStart = this.pos; var flags = this.readWord1(); @@ -4727,7 +5214,7 @@ var require_acorn = __commonJS({ this.unexpected(flagsStart); } var state = this.regexpState || (this.regexpState = new RegExpValidationState3(this)); - state.reset(start3, pattern, flags); + state.reset(start2, pattern, flags); this.validateRegExpFlags(state); this.validateRegExpPattern(state); var value = null; @@ -4740,7 +5227,7 @@ var require_acorn = __commonJS({ pp2.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0; var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48; - var start3 = this.pos, total = 0, lastCode = 0; + var start2 = this.pos, total = 0, lastCode = 0; for (var i2 = 0, e = len == null ? Infinity : len; i2 < e; ++i2, ++this.pos) { var code2 = this.input.charCodeAt(this.pos), val = void 0; if (allowSeparators && code2 === 95) { @@ -4774,7 +5261,7 @@ var require_acorn = __commonJS({ if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); } - if (this.pos === start3 || len != null && this.pos - start3 !== len) { + if (this.pos === start2 || len != null && this.pos - start2 !== len) { return null; } return total; @@ -4792,14 +5279,14 @@ var require_acorn = __commonJS({ return BigInt(str.replace(/_/g, "")); } pp2.readRadixNumber = function(radix) { - var start3 = this.pos; + var start2 = this.pos; this.pos += 2; var val = this.readInt(radix); if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); } if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) { - val = stringToBigInt2(this.input.slice(start3, this.pos)); + val = stringToBigInt2(this.input.slice(start2, this.pos)); ++this.pos; } else if (isIdentifierStart2(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); @@ -4807,24 +5294,24 @@ var require_acorn = __commonJS({ return this.finishToken(types$12.num, val); }; pp2.readNumber = function(startsWithDot) { - var start3 = this.pos; + var start2 = this.pos; if (!startsWithDot && this.readInt(10, void 0, true) === null) { - this.raise(start3, "Invalid number"); + this.raise(start2, "Invalid number"); } - var octal = this.pos - start3 >= 2 && this.input.charCodeAt(start3) === 48; + var octal = this.pos - start2 >= 2 && this.input.charCodeAt(start2) === 48; if (octal && this.strict) { - this.raise(start3, "Invalid number"); + this.raise(start2, "Invalid number"); } var next = this.input.charCodeAt(this.pos); if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { - var val$1 = stringToBigInt2(this.input.slice(start3, this.pos)); + var val$1 = stringToBigInt2(this.input.slice(start2, this.pos)); ++this.pos; if (isIdentifierStart2(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } return this.finishToken(types$12.num, val$1); } - if (octal && /[89]/.test(this.input.slice(start3, this.pos))) { + if (octal && /[89]/.test(this.input.slice(start2, this.pos))) { octal = false; } if (next === 46 && !octal) { @@ -4838,13 +5325,13 @@ var require_acorn = __commonJS({ ++this.pos; } if (this.readInt(10) === null) { - this.raise(start3, "Invalid number"); + this.raise(start2, "Invalid number"); } } if (isIdentifierStart2(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } - var val = stringToNumber2(this.input.slice(start3, this.pos), octal); + var val = stringToNumber2(this.input.slice(start2, this.pos), octal); return this.finishToken(types$12.num, val); }; pp2.readCodePoint = function() { @@ -5027,7 +5514,6 @@ var require_acorn = __commonJS({ codePos, "Invalid escape sequence in template string" ); - return null; } default: if (ch >= 48 && ch <= 55) { @@ -5098,7 +5584,7 @@ var require_acorn = __commonJS({ } return this.finishToken(type, word); }; - var version2 = "8.8.1"; + var version2 = "8.10.0"; Parser3.acorn = { Parser: Parser3, version: version2, @@ -5151,7 +5637,6 @@ var require_acorn = __commonJS({ exports2.tokTypes = types$12; exports2.tokenizer = tokenizer2; exports2.version = version2; - Object.defineProperty(exports2, "__esModule", { value: true }); }); } }); @@ -5243,9 +5728,11 @@ var require_acorn_jsx = __commonJS({ const isIdentifierStart2 = acorn.isIdentifierStart; const isIdentifierChar2 = acorn.isIdentifierChar; return class extends Parser3 { + // Expose actual `tokTypes` and `tokContexts` to other plugins. static get acornJsx() { return acornJsx2; } + // Reads inline JSX contents token. jsx_readToken() { let out = "", chunkStart = this.pos; for (; ; ) { @@ -5357,57 +5844,68 @@ var require_acorn_jsx = __commonJS({ } return entity; } + // Read a JSX identifier (valid tag or attribute name). + // + // Optimized version since JSX identifiers can't contain + // escape characters and so can be read as single slice. + // Also assumes that first character was already checked + // by isIdentifierStart in readToken. jsx_readWord() { - let ch, start3 = this.pos; + let ch, start2 = this.pos; do { ch = this.input.charCodeAt(++this.pos); } while (isIdentifierChar2(ch) || ch === 45); - return this.finishToken(tok.jsxName, this.input.slice(start3, this.pos)); + return this.finishToken(tok.jsxName, this.input.slice(start2, this.pos)); } + // Parse next token as JSX identifier jsx_parseIdentifier() { - let node = this.startNode(); + let node2 = this.startNode(); if (this.type === tok.jsxName) - node.name = this.value; + node2.name = this.value; else if (this.type.keyword) - node.name = this.type.keyword; + node2.name = this.type.keyword; else this.unexpected(); this.next(); - return this.finishNode(node, "JSXIdentifier"); + return this.finishNode(node2, "JSXIdentifier"); } + // Parse namespaced identifier. jsx_parseNamespacedName() { let startPos = this.start, startLoc = this.startLoc; let name2 = this.jsx_parseIdentifier(); if (!options.allowNamespaces || !this.eat(tt.colon)) return name2; - var node = this.startNodeAt(startPos, startLoc); - node.namespace = name2; - node.name = this.jsx_parseIdentifier(); - return this.finishNode(node, "JSXNamespacedName"); + var node2 = this.startNodeAt(startPos, startLoc); + node2.namespace = name2; + node2.name = this.jsx_parseIdentifier(); + return this.finishNode(node2, "JSXNamespacedName"); } + // Parses element name in any form - namespaced, member + // or single identifier. jsx_parseElementName() { if (this.type === tok.jsxTagEnd) return ""; let startPos = this.start, startLoc = this.startLoc; - let node = this.jsx_parseNamespacedName(); - if (this.type === tt.dot && node.type === "JSXNamespacedName" && !options.allowNamespacedObjects) { + let node2 = this.jsx_parseNamespacedName(); + if (this.type === tt.dot && node2.type === "JSXNamespacedName" && !options.allowNamespacedObjects) { this.unexpected(); } while (this.eat(tt.dot)) { let newNode = this.startNodeAt(startPos, startLoc); - newNode.object = node; + newNode.object = node2; newNode.property = this.jsx_parseIdentifier(); - node = this.finishNode(newNode, "JSXMemberExpression"); + node2 = this.finishNode(newNode, "JSXMemberExpression"); } - return node; + return node2; } + // Parses any type of JSX attribute value. jsx_parseAttributeValue() { switch (this.type) { case tt.braceL: - let node = this.jsx_parseExpressionContainer(); - if (node.expression.type === "JSXEmptyExpression") - this.raise(node.start, "JSX attributes must only be assigned a non-empty expression"); - return node; + let node2 = this.jsx_parseExpressionContainer(); + if (node2.expression.type === "JSXEmptyExpression") + this.raise(node2.start, "JSX attributes must only be assigned a non-empty expression"); + return node2; case tok.jsxTagStart: case tt.string: return this.parseExprAtom(); @@ -5415,51 +5913,60 @@ var require_acorn_jsx = __commonJS({ this.raise(this.start, "JSX value should be either an expression or a quoted JSX text"); } } + // JSXEmptyExpression is unique type since it doesn't actually parse anything, + // and so it should start at the end of last read token (left brace) and finish + // at the beginning of the next one (right brace). jsx_parseEmptyExpression() { - let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc); - return this.finishNodeAt(node, "JSXEmptyExpression", this.start, this.startLoc); + let node2 = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc); + return this.finishNodeAt(node2, "JSXEmptyExpression", this.start, this.startLoc); } + // Parses JSX expression enclosed into curly brackets. jsx_parseExpressionContainer() { - let node = this.startNode(); + let node2 = this.startNode(); this.next(); - node.expression = this.type === tt.braceR ? this.jsx_parseEmptyExpression() : this.parseExpression(); + node2.expression = this.type === tt.braceR ? this.jsx_parseEmptyExpression() : this.parseExpression(); this.expect(tt.braceR); - return this.finishNode(node, "JSXExpressionContainer"); + return this.finishNode(node2, "JSXExpressionContainer"); } + // Parses following JSX attribute name-value pair. jsx_parseAttribute() { - let node = this.startNode(); + let node2 = this.startNode(); if (this.eat(tt.braceL)) { this.expect(tt.ellipsis); - node.argument = this.parseMaybeAssign(); + node2.argument = this.parseMaybeAssign(); this.expect(tt.braceR); - return this.finishNode(node, "JSXSpreadAttribute"); + return this.finishNode(node2, "JSXSpreadAttribute"); } - node.name = this.jsx_parseNamespacedName(); - node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null; - return this.finishNode(node, "JSXAttribute"); + node2.name = this.jsx_parseNamespacedName(); + node2.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null; + return this.finishNode(node2, "JSXAttribute"); } + // Parses JSX opening tag starting after '<'. jsx_parseOpeningElementAt(startPos, startLoc) { - let node = this.startNodeAt(startPos, startLoc); - node.attributes = []; + let node2 = this.startNodeAt(startPos, startLoc); + node2.attributes = []; let nodeName = this.jsx_parseElementName(); if (nodeName) - node.name = nodeName; + node2.name = nodeName; while (this.type !== tt.slash && this.type !== tok.jsxTagEnd) - node.attributes.push(this.jsx_parseAttribute()); - node.selfClosing = this.eat(tt.slash); + node2.attributes.push(this.jsx_parseAttribute()); + node2.selfClosing = this.eat(tt.slash); this.expect(tok.jsxTagEnd); - return this.finishNode(node, nodeName ? "JSXOpeningElement" : "JSXOpeningFragment"); + return this.finishNode(node2, nodeName ? "JSXOpeningElement" : "JSXOpeningFragment"); } + // Parses JSX closing tag starting after ' 🪦 **Note**: also has obsolete signatures. + * + * @overload + * @param {string} reason + * @param {Options | null | undefined} [options] + * @returns + * + * @overload + * @param {string} reason + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {string} reason + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {string} reason + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {Error | VFileMessage} cause + * @param {string | null | undefined} [origin] + * @returns + * + * @param {Error | VFileMessage | string} causeOrReason + * Reason for message, should use markdown. + * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace] + * Configuration (optional). + * @param {string | null | undefined} [origin] + * Place in code where the message originates (example: + * `'my-package:my-rule'` or `'my-rule'`). + * @returns + * Instance of `VFileMessage`. + */ + // eslint-disable-next-line complexity + constructor(causeOrReason, optionsOrParentOrPlace, origin) { + super(); + if (typeof optionsOrParentOrPlace === "string") { + origin = optionsOrParentOrPlace; + optionsOrParentOrPlace = void 0; + } + let reason = ""; + let options = {}; + let legacyCause = false; + if (optionsOrParentOrPlace) { + if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) { + options = { place: optionsOrParentOrPlace }; + } else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) { + options = { place: optionsOrParentOrPlace }; + } else if ("type" in optionsOrParentOrPlace) { + options = { + ancestors: [optionsOrParentOrPlace], + place: optionsOrParentOrPlace.position + }; } else { - callback(null, ...output); + options = { ...optionsOrParentOrPlace }; } } - } - function use(middelware) { - if (typeof middelware !== "function") { - throw new TypeError( - "Expected `middelware` to be a function, not " + middelware - ); + if (typeof causeOrReason === "string") { + reason = causeOrReason; + } else if (!options.cause && causeOrReason) { + legacyCause = true; + reason = causeOrReason.message; + options.cause = causeOrReason; } - fns.push(middelware); - return pipeline; - } -} -function wrap(middleware, callback) { - let called; - return wrapped; - function wrapped(...parameters) { - const fnExpectsCallback = middleware.length > parameters.length; - let result; - if (fnExpectsCallback) { - parameters.push(done); + if (!options.ruleId && !options.source && typeof origin === "string") { + const index2 = origin.indexOf(":"); + if (index2 === -1) { + options.ruleId = origin; + } else { + options.source = origin.slice(0, index2); + options.ruleId = origin.slice(index2 + 1); + } } - try { - result = middleware.apply(this, parameters); - } catch (error) { - const exception = error; - if (fnExpectsCallback && called) { - throw exception; + if (!options.place && options.ancestors && options.ancestors) { + const parent = options.ancestors[options.ancestors.length - 1]; + if (parent) { + options.place = parent.position; } - return done(exception); } - if (!fnExpectsCallback) { - if (result instanceof Promise) { - result.then(then, done); - } else if (result instanceof Error) { - done(result); - } else { - then(result); - } - } - } - function done(error, ...output) { - if (!called) { - called = true; - callback(error, ...output); - } - } - function then(value) { - done(null, value); - } -} - -// node_modules/vfile/lib/index.js -var import_is_buffer = __toESM(require_is_buffer(), 1); - -// node_modules/unist-util-stringify-position/index.js -function stringifyPosition(value) { - if (!value || typeof value !== "object") { - return ""; - } - if ("position" in value || "type" in value) { - return position(value.position); - } - if ("start" in value || "end" in value) { - return position(value); - } - if ("line" in value || "column" in value) { - return point(value); - } - return ""; -} -function point(point3) { - return index(point3 && point3.line) + ":" + index(point3 && point3.column); -} -function position(pos) { - return point(pos && pos.start) + "-" + point(pos && pos.end); -} -function index(value) { - return value && typeof value === "number" ? value : 1; -} - -// node_modules/vfile-message/index.js -var VFileMessage = class extends Error { - constructor(reason, place, origin) { - const parts = [null, null]; - let position3 = { - start: { line: null, column: null }, - end: { line: null, column: null } - }; - super(); - if (typeof place === "string") { - origin = place; - place = void 0; - } - if (typeof origin === "string") { - const index2 = origin.indexOf(":"); - if (index2 === -1) { - parts[1] = origin; - } else { - parts[0] = origin.slice(0, index2); - parts[1] = origin.slice(index2 + 1); - } - } - if (place) { - if ("type" in place || "position" in place) { - if (place.position) { - position3 = place.position; - } - } else if ("start" in place || "end" in place) { - position3 = place; - } else if ("line" in place || "column" in place) { - position3.start = place; - } - } - this.name = stringifyPosition(place) || "1:1"; - this.message = typeof reason === "object" ? reason.message : reason; - this.stack = typeof reason === "object" ? reason.stack : ""; + const start2 = options.place && "start" in options.place ? options.place.start : options.place; + this.ancestors = options.ancestors || void 0; + this.cause = options.cause || void 0; + this.column = start2 ? start2.column : void 0; + this.fatal = void 0; + this.file; + this.message = reason; + this.line = start2 ? start2.line : void 0; + this.name = stringifyPosition(options.place) || "1:1"; + this.place = options.place || void 0; this.reason = this.message; - this.fatal; - this.line = position3.start.line; - this.column = position3.start.column; - this.source = parts[0]; - this.ruleId = parts[1]; - this.position = position3; + this.ruleId = options.ruleId || void 0; + this.source = options.source || void 0; + this.stack = legacyCause && options.cause && typeof options.cause.stack === "string" ? options.cause.stack : ""; this.actual; this.expected; - this.file; - this.url; this.note; + this.url; } }; VFileMessage.prototype.file = ""; @@ -5963,118 +6508,433 @@ VFileMessage.prototype.name = ""; VFileMessage.prototype.reason = ""; VFileMessage.prototype.message = ""; VFileMessage.prototype.stack = ""; -VFileMessage.prototype.fatal = null; -VFileMessage.prototype.column = null; -VFileMessage.prototype.line = null; -VFileMessage.prototype.source = null; -VFileMessage.prototype.ruleId = null; -VFileMessage.prototype.position = null; +VFileMessage.prototype.column = void 0; +VFileMessage.prototype.line = void 0; +VFileMessage.prototype.ancestors = void 0; +VFileMessage.prototype.cause = void 0; +VFileMessage.prototype.fatal = void 0; +VFileMessage.prototype.place = void 0; +VFileMessage.prototype.ruleId = void 0; +VFileMessage.prototype.source = void 0; // node_modules/vfile/lib/minpath.js -var import_path = __toESM(require("path"), 1); +var import_node_path = __toESM(require("node:path"), 1); // node_modules/vfile/lib/minproc.js -var import_process = __toESM(require("process"), 1); +var import_node_process = __toESM(require("node:process"), 1); // node_modules/vfile/lib/minurl.js -var import_url = require("url"); +var import_node_url = require("node:url"); // node_modules/vfile/lib/minurl.shared.js -function isUrl(fileURLOrPath) { - return fileURLOrPath !== null && typeof fileURLOrPath === "object" && fileURLOrPath.href && fileURLOrPath.origin; +function isUrl(fileUrlOrPath) { + return Boolean( + fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && "href" in fileUrlOrPath && fileUrlOrPath.href && "protocol" in fileUrlOrPath && fileUrlOrPath.protocol && // @ts-expect-error: indexing is fine. + fileUrlOrPath.auth === void 0 + ); } // node_modules/vfile/lib/index.js -var order = ["history", "path", "basename", "stem", "extname", "dirname"]; +var order = ( + /** @type {const} */ + [ + "history", + "path", + "basename", + "stem", + "extname", + "dirname" + ] +); var VFile = class { + /** + * Create a new virtual file. + * + * `options` is treated as: + * + * * `string` or `Uint8Array` — `{value: options}` + * * `URL` — `{path: options}` + * * `VFile` — shallow copies its data over to the new file + * * `object` — all fields are shallow copied over to the new file + * + * Path related fields are set in the following order (least specific to + * most specific): `history`, `path`, `basename`, `stem`, `extname`, + * `dirname`. + * + * You cannot set `dirname` or `extname` without setting either `history`, + * `path`, `basename`, or `stem` too. + * + * @param {Compatible | null | undefined} [value] + * File value. + * @returns + * New instance. + */ constructor(value) { let options; if (!value) { options = {}; - } else if (typeof value === "string" || (0, import_is_buffer.default)(value)) { - options = { value }; } else if (isUrl(value)) { options = { path: value }; + } else if (typeof value === "string" || isUint8Array(value)) { + options = { value }; } else { options = value; } + this.cwd = import_node_process.default.cwd(); this.data = {}; - this.messages = []; this.history = []; - this.cwd = import_process.default.cwd(); + this.messages = []; this.value; - this.stored; - this.result; this.map; + this.result; + this.stored; let index2 = -1; while (++index2 < order.length) { const prop2 = order[index2]; - if (prop2 in options && options[prop2] !== void 0) { + if (prop2 in options && options[prop2] !== void 0 && options[prop2] !== null) { this[prop2] = prop2 === "history" ? [...options[prop2]] : options[prop2]; } } let prop; for (prop in options) { - if (!order.includes(prop)) + if (!order.includes(prop)) { this[prop] = options[prop]; + } } } - get path() { - return this.history[this.history.length - 1]; - } - set path(path) { - if (isUrl(path)) { - path = (0, import_url.fileURLToPath)(path); - } - assertNonEmpty(path, "path"); - if (this.path !== path) { - this.history.push(path); - } - } - get dirname() { - return typeof this.path === "string" ? import_path.default.dirname(this.path) : void 0; - } - set dirname(dirname) { - assertPath(this.basename, "dirname"); - this.path = import_path.default.join(dirname || "", this.basename); - } + /** + * Get the basename (including extname) (example: `'index.min.js'`). + * + * @returns {string | undefined} + * Basename. + */ get basename() { - return typeof this.path === "string" ? import_path.default.basename(this.path) : void 0; - } + return typeof this.path === "string" ? import_node_path.default.basename(this.path) : void 0; + } + /** + * Set basename (including extname) (`'index.min.js'`). + * + * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` + * on windows). + * Cannot be nullified (use `file.path = file.dirname` instead). + * + * @param {string} basename + * Basename. + * @returns {undefined} + * Nothing. + */ set basename(basename) { assertNonEmpty(basename, "basename"); assertPart(basename, "basename"); - this.path = import_path.default.join(this.dirname || "", basename); - } + this.path = import_node_path.default.join(this.dirname || "", basename); + } + /** + * Get the parent path (example: `'~'`). + * + * @returns {string | undefined} + * Dirname. + */ + get dirname() { + return typeof this.path === "string" ? import_node_path.default.dirname(this.path) : void 0; + } + /** + * Set the parent path (example: `'~'`). + * + * Cannot be set if there’s no `path` yet. + * + * @param {string | undefined} dirname + * Dirname. + * @returns {undefined} + * Nothing. + */ + set dirname(dirname) { + assertPath(this.basename, "dirname"); + this.path = import_node_path.default.join(dirname || "", this.basename); + } + /** + * Get the extname (including dot) (example: `'.js'`). + * + * @returns {string | undefined} + * Extname. + */ get extname() { - return typeof this.path === "string" ? import_path.default.extname(this.path) : void 0; - } + return typeof this.path === "string" ? import_node_path.default.extname(this.path) : void 0; + } + /** + * Set the extname (including dot) (example: `'.js'`). + * + * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` + * on windows). + * Cannot be set if there’s no `path` yet. + * + * @param {string | undefined} extname + * Extname. + * @returns {undefined} + * Nothing. + */ set extname(extname) { assertPart(extname, "extname"); assertPath(this.dirname, "extname"); if (extname) { - if (extname.charCodeAt(0) !== 46) { + if (extname.codePointAt(0) !== 46) { throw new Error("`extname` must start with `.`"); } if (extname.includes(".", 1)) { throw new Error("`extname` cannot contain multiple dots"); } } - this.path = import_path.default.join(this.dirname, this.stem + (extname || "")); + this.path = import_node_path.default.join(this.dirname, this.stem + (extname || "")); } - get stem() { - return typeof this.path === "string" ? import_path.default.basename(this.path, this.extname) : void 0; + /** + * Get the full path (example: `'~/index.min.js'`). + * + * @returns {string} + * Path. + */ + get path() { + return this.history[this.history.length - 1]; + } + /** + * Set the full path (example: `'~/index.min.js'`). + * + * Cannot be nullified. + * You can set a file URL (a `URL` object with a `file:` protocol) which will + * be turned into a path with `url.fileURLToPath`. + * + * @param {URL | string} path + * Path. + * @returns {undefined} + * Nothing. + */ + set path(path) { + if (isUrl(path)) { + path = (0, import_node_url.fileURLToPath)(path); + } + assertNonEmpty(path, "path"); + if (this.path !== path) { + this.history.push(path); + } } + /** + * Get the stem (basename w/o extname) (example: `'index.min'`). + * + * @returns {string | undefined} + * Stem. + */ + get stem() { + return typeof this.path === "string" ? import_node_path.default.basename(this.path, this.extname) : void 0; + } + /** + * Set the stem (basename w/o extname) (example: `'index.min'`). + * + * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` + * on windows). + * Cannot be nullified (use `file.path = file.dirname` instead). + * + * @param {string} stem + * Stem. + * @returns {undefined} + * Nothing. + */ set stem(stem) { assertNonEmpty(stem, "stem"); assertPart(stem, "stem"); - this.path = import_path.default.join(this.dirname || "", stem + (this.extname || "")); + this.path = import_node_path.default.join(this.dirname || "", stem + (this.extname || "")); + } + // Normal prototypal methods. + /** + * Create a fatal message for `reason` associated with the file. + * + * The `fatal` field of the message is set to `true` (error; file not usable) + * and the `file` field is set to the current file path. + * The message is added to the `messages` field on `file`. + * + * > 🪦 **Note**: also has obsolete signatures. + * + * @overload + * @param {string} reason + * @param {MessageOptions | null | undefined} [options] + * @returns {never} + * + * @overload + * @param {string} reason + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {string} reason + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {string} reason + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @param {Error | VFileMessage | string} causeOrReason + * Reason for message, should use markdown. + * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace] + * Configuration (optional). + * @param {string | null | undefined} [origin] + * Place in code where the message originates (example: + * `'my-package:my-rule'` or `'my-rule'`). + * @returns {never} + * Never. + * @throws {VFileMessage} + * Message. + */ + fail(causeOrReason, optionsOrParentOrPlace, origin) { + const message = this.message(causeOrReason, optionsOrParentOrPlace, origin); + message.fatal = true; + throw message; } - toString(encoding) { - return (this.value || "").toString(encoding); + /** + * Create an info message for `reason` associated with the file. + * + * The `fatal` field of the message is set to `undefined` (info; change + * likely not needed) and the `file` field is set to the current file path. + * The message is added to the `messages` field on `file`. + * + * > 🪦 **Note**: also has obsolete signatures. + * + * @overload + * @param {string} reason + * @param {MessageOptions | null | undefined} [options] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @param {Error | VFileMessage | string} causeOrReason + * Reason for message, should use markdown. + * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace] + * Configuration (optional). + * @param {string | null | undefined} [origin] + * Place in code where the message originates (example: + * `'my-package:my-rule'` or `'my-rule'`). + * @returns {VFileMessage} + * Message. + */ + info(causeOrReason, optionsOrParentOrPlace, origin) { + const message = this.message(causeOrReason, optionsOrParentOrPlace, origin); + message.fatal = void 0; + return message; } - message(reason, place, origin) { - const message = new VFileMessage(reason, place, origin); + /** + * Create a message for `reason` associated with the file. + * + * The `fatal` field of the message is set to `false` (warning; change may be + * needed) and the `file` field is set to the current file path. + * The message is added to the `messages` field on `file`. + * + * > 🪦 **Note**: also has obsolete signatures. + * + * @overload + * @param {string} reason + * @param {MessageOptions | null | undefined} [options] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @param {Error | VFileMessage | string} causeOrReason + * Reason for message, should use markdown. + * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace] + * Configuration (optional). + * @param {string | null | undefined} [origin] + * Place in code where the message originates (example: + * `'my-package:my-rule'` or `'my-rule'`). + * @returns {VFileMessage} + * Message. + */ + message(causeOrReason, optionsOrParentOrPlace, origin) { + const message = new VFileMessage( + // @ts-expect-error: the overloads are fine. + causeOrReason, + optionsOrParentOrPlace, + origin + ); if (this.path) { message.name = this.path + ":" + message.name; message.file = this.path; @@ -6083,21 +6943,34 @@ var VFile = class { this.messages.push(message); return message; } - info(reason, place, origin) { - const message = this.message(reason, place, origin); - message.fatal = null; - return message; - } - fail(reason, place, origin) { - const message = this.message(reason, place, origin); - message.fatal = true; - throw message; + /** + * Serialize the file. + * + * > **Note**: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > . + * + * @param {string | null | undefined} [encoding='utf8'] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (default: `'utf-8'`). + * @returns {string} + * Serialized file. + */ + toString(encoding) { + if (this.value === void 0) { + return ""; + } + if (typeof this.value === "string") { + return this.value; + } + const decoder = new TextDecoder(encoding || void 0); + return decoder.decode(this.value); } }; function assertPart(part, name2) { - if (part && part.includes(import_path.default.sep)) { + if (part && part.includes(import_node_path.default.sep)) { throw new Error( - "`" + name2 + "` cannot be a path: did not expect `" + import_path.default.sep + "`" + "`" + name2 + "` cannot be a path: did not expect `" + import_node_path.default.sep + "`" ); } } @@ -6111,6688 +6984,287 @@ function assertPath(path, name2) { throw new Error("Setting `" + name2 + "` requires `path` to be set too"); } } +function isUint8Array(value) { + return Boolean( + value && typeof value === "object" && "byteLength" in value && "byteOffset" in value + ); +} -// node_modules/@mdx-js/mdx/node_modules/unified/lib/index.js -var unified = base().freeze(); -var own = {}.hasOwnProperty; -function base() { - const transformers = trough(); - const attachers = []; - let namespace = {}; - let frozen; - let freezeIndex = -1; - processor.data = data2; - processor.Parser = void 0; - processor.Compiler = void 0; - processor.freeze = freeze; - processor.attachers = attachers; - processor.use = use; - processor.parse = parse4; - processor.stringify = stringify4; - processor.run = run2; - processor.runSync = runSync2; - processor.process = process2; - processor.processSync = processSync; - return processor; - function processor() { - const destination = base(); - let index2 = -1; - while (++index2 < attachers.length) { - destination.use(...attachers[index2]); - } - destination.data((0, import_extend.default)(true, {}, namespace)); - return destination; - } - function data2(key, value) { - if (typeof key === "string") { - if (arguments.length === 2) { - assertUnfrozen("data", frozen); - namespace[key] = value; - return processor; - } - return own.call(namespace, key) && namespace[key] || null; - } - if (key) { - assertUnfrozen("data", frozen); - namespace = key; - return processor; - } - return namespace; - } - function freeze() { - if (frozen) { - return processor; +// node_modules/markdown-extensions/index.js +var markdownExtension = [ + "md", + "markdown", + "mdown", + "mkdn", + "mkd", + "mdwn", + "mkdown", + "ron" +]; +var markdown_extensions_default = markdownExtension; + +// node_modules/@mdx-js/mdx/lib/util/extnames.js +var md = markdown_extensions_default.map(function(d) { + return "." + d; +}); + +// node_modules/@mdx-js/mdx/lib/util/resolve-file-and-options.js +function resolveFileAndOptions(vfileCompatible, options) { + const file = looksLikeAVFile(vfileCompatible) ? vfileCompatible : new VFile(vfileCompatible); + const { format, ...rest } = options || {}; + return { + file, + options: { + format: format === "md" || format === "mdx" ? format : file.extname && (rest.mdExtensions || md).includes(file.extname) ? "md" : "mdx", + ...rest } - while (++freezeIndex < attachers.length) { - const [attacher, ...options] = attachers[freezeIndex]; - if (options[0] === false) { - continue; - } - if (options[0] === true) { - options[0] = void 0; - } - const transformer = attacher.call(processor, ...options); - if (typeof transformer === "function") { - transformers.use(transformer); - } + }; +} +function looksLikeAVFile(value) { + return Boolean( + value && typeof value === "object" && "message" in value && "messages" in value + ); +} + +// node_modules/devlop/lib/default.js +function ok() { +} +function unreachable() { +} + +// node_modules/mdast-util-mdx-expression/lib/index.js +function mdxExpressionFromMarkdown() { + return { + enter: { + mdxFlowExpression: enterMdxFlowExpression, + mdxTextExpression: enterMdxTextExpression + }, + exit: { + mdxFlowExpression: exitMdxExpression, + mdxFlowExpressionChunk: exitMdxExpressionData, + mdxTextExpression: exitMdxExpression, + mdxTextExpressionChunk: exitMdxExpressionData } - frozen = true; - freezeIndex = Number.POSITIVE_INFINITY; - return processor; + }; +} +function mdxExpressionToMarkdown() { + return { + handlers: { + mdxFlowExpression: handleMdxExpression, + mdxTextExpression: handleMdxExpression + }, + unsafe: [ + { character: "{", inConstruct: ["phrasing"] }, + { atBreak: true, character: "{" } + ] + }; +} +function enterMdxFlowExpression(token) { + this.enter({ type: "mdxFlowExpression", value: "" }, token); + this.buffer(); +} +function enterMdxTextExpression(token) { + this.enter({ type: "mdxTextExpression", value: "" }, token); + this.buffer(); +} +function exitMdxExpression(token) { + const value = this.resume(); + const estree = token.estree; + const node2 = this.stack[this.stack.length - 1]; + ok(node2.type === "mdxFlowExpression" || node2.type === "mdxTextExpression"); + this.exit(token); + node2.value = value; + if (estree) { + node2.data = { estree }; } - function use(value, ...options) { - let settings; - assertUnfrozen("use", frozen); - if (value === null || value === void 0) { - } else if (typeof value === "function") { - addPlugin(value, ...options); - } else if (typeof value === "object") { - if (Array.isArray(value)) { - addList(value); - } else { - addPreset(value); - } - } else { - throw new TypeError("Expected usable value, not `" + value + "`"); - } - if (settings) { - namespace.settings = Object.assign(namespace.settings || {}, settings); - } - return processor; - function add(value2) { - if (typeof value2 === "function") { - addPlugin(value2); - } else if (typeof value2 === "object") { - if (Array.isArray(value2)) { - const [plugin, ...options2] = value2; - addPlugin(plugin, ...options2); - } else { - addPreset(value2); - } - } else { - throw new TypeError("Expected usable value, not `" + value2 + "`"); - } - } - function addPreset(result) { - addList(result.plugins); - if (result.settings) { - settings = Object.assign(settings || {}, result.settings); - } - } - function addList(plugins) { - let index2 = -1; - if (plugins === null || plugins === void 0) { - } else if (Array.isArray(plugins)) { - while (++index2 < plugins.length) { - const thing = plugins[index2]; - add(thing); - } - } else { - throw new TypeError("Expected a list of plugins, not `" + plugins + "`"); - } - } - function addPlugin(plugin, value2) { - let index2 = -1; - let entry; - while (++index2 < attachers.length) { - if (attachers[index2][0] === plugin) { - entry = attachers[index2]; - break; - } - } - if (entry) { - if (isPlainObject(entry[1]) && isPlainObject(value2)) { - value2 = (0, import_extend.default)(true, entry[1], value2); - } - entry[1] = value2; - } else { - attachers.push([...arguments]); - } - } +} +function exitMdxExpressionData(token) { + this.config.enter.data.call(this, token); + this.config.exit.data.call(this, token); +} +function handleMdxExpression(node2) { + const value = node2.value || ""; + return "{" + value + "}"; +} + +// node_modules/ccount/index.js +function ccount(value, character) { + const source = String(value); + if (typeof character !== "string") { + throw new TypeError("Expected character"); } - function parse4(doc) { - processor.freeze(); - const file = vfile(doc); - const Parser3 = processor.Parser; - assertParser("parse", Parser3); - if (newable(Parser3, "parse")) { - return new Parser3(String(file), file).parse(); - } - return Parser3(String(file), file); - } - function stringify4(node, doc) { - processor.freeze(); - const file = vfile(doc); - const Compiler = processor.Compiler; - assertCompiler("stringify", Compiler); - assertNode(node); - if (newable(Compiler, "compile")) { - return new Compiler(node, file).compile(); - } - return Compiler(node, file); - } - function run2(node, doc, callback) { - assertNode(node); - processor.freeze(); - if (!callback && typeof doc === "function") { - callback = doc; - doc = void 0; - } - if (!callback) { - return new Promise(executor); - } - executor(null, callback); - function executor(resolve, reject) { - transformers.run(node, vfile(doc), done); - function done(error, tree, file) { - tree = tree || node; - if (error) { - reject(error); - } else if (resolve) { - resolve(tree); - } else { - callback(null, tree, file); - } - } - } - } - function runSync2(node, file) { - let result; - let complete; - processor.run(node, file, done); - assertDone("runSync", "run", complete); - return result; - function done(error, tree) { - bail(error); - result = tree; - complete = true; - } - } - function process2(doc, callback) { - processor.freeze(); - assertParser("process", processor.Parser); - assertCompiler("process", processor.Compiler); - if (!callback) { - return new Promise(executor); - } - executor(null, callback); - function executor(resolve, reject) { - const file = vfile(doc); - processor.run(processor.parse(file), file, (error, tree, file2) => { - if (error || !tree || !file2) { - done(error); - } else { - const result = processor.stringify(tree, file2); - if (result === void 0 || result === null) { - } else if (looksLikeAVFileValue(result)) { - file2.value = result; - } else { - file2.result = result; - } - done(error, file2); - } - }); - function done(error, file2) { - if (error || !file2) { - reject(error); - } else if (resolve) { - resolve(file2); - } else { - callback(null, file2); - } - } - } - } - function processSync(doc) { - let complete; - processor.freeze(); - assertParser("processSync", processor.Parser); - assertCompiler("processSync", processor.Compiler); - const file = vfile(doc); - processor.process(file, done); - assertDone("processSync", "process", complete); - return file; - function done(error) { - complete = true; - bail(error); - } - } -} -function newable(value, name2) { - return typeof value === "function" && value.prototype && (keys(value.prototype) || name2 in value.prototype); -} -function keys(value) { - let key; - for (key in value) { - if (own.call(value, key)) { - return true; - } - } - return false; -} -function assertParser(name2, value) { - if (typeof value !== "function") { - throw new TypeError("Cannot `" + name2 + "` without `Parser`"); - } -} -function assertCompiler(name2, value) { - if (typeof value !== "function") { - throw new TypeError("Cannot `" + name2 + "` without `Compiler`"); - } -} -function assertUnfrozen(name2, frozen) { - if (frozen) { - throw new Error( - "Cannot call `" + name2 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`." - ); - } -} -function assertNode(node) { - if (!isPlainObject(node) || typeof node.type !== "string") { - throw new TypeError("Expected node, got `" + node + "`"); + let count = 0; + let index2 = source.indexOf(character); + while (index2 !== -1) { + count++; + index2 = source.indexOf(character, index2 + character.length); } + return count; } -function assertDone(name2, asyncName, complete) { - if (!complete) { - throw new Error( - "`" + name2 + "` finished async. Use `" + asyncName + "` instead" - ); - } + +// node_modules/character-entities-legacy/index.js +var characterEntitiesLegacy = [ + "AElig", + "AMP", + "Aacute", + "Acirc", + "Agrave", + "Aring", + "Atilde", + "Auml", + "COPY", + "Ccedil", + "ETH", + "Eacute", + "Ecirc", + "Egrave", + "Euml", + "GT", + "Iacute", + "Icirc", + "Igrave", + "Iuml", + "LT", + "Ntilde", + "Oacute", + "Ocirc", + "Ograve", + "Oslash", + "Otilde", + "Ouml", + "QUOT", + "REG", + "THORN", + "Uacute", + "Ucirc", + "Ugrave", + "Uuml", + "Yacute", + "aacute", + "acirc", + "acute", + "aelig", + "agrave", + "amp", + "aring", + "atilde", + "auml", + "brvbar", + "ccedil", + "cedil", + "cent", + "copy", + "curren", + "deg", + "divide", + "eacute", + "ecirc", + "egrave", + "eth", + "euml", + "frac12", + "frac14", + "frac34", + "gt", + "iacute", + "icirc", + "iexcl", + "igrave", + "iquest", + "iuml", + "laquo", + "lt", + "macr", + "micro", + "middot", + "nbsp", + "not", + "ntilde", + "oacute", + "ocirc", + "ograve", + "ordf", + "ordm", + "oslash", + "otilde", + "ouml", + "para", + "plusmn", + "pound", + "quot", + "raquo", + "reg", + "sect", + "shy", + "sup1", + "sup2", + "sup3", + "szlig", + "thorn", + "times", + "uacute", + "ucirc", + "ugrave", + "uml", + "uuml", + "yacute", + "yen", + "yuml" +]; + +// node_modules/character-reference-invalid/index.js +var characterReferenceInvalid = { + 0: "\uFFFD", + 128: "\u20AC", + 130: "\u201A", + 131: "\u0192", + 132: "\u201E", + 133: "\u2026", + 134: "\u2020", + 135: "\u2021", + 136: "\u02C6", + 137: "\u2030", + 138: "\u0160", + 139: "\u2039", + 140: "\u0152", + 142: "\u017D", + 145: "\u2018", + 146: "\u2019", + 147: "\u201C", + 148: "\u201D", + 149: "\u2022", + 150: "\u2013", + 151: "\u2014", + 152: "\u02DC", + 153: "\u2122", + 154: "\u0161", + 155: "\u203A", + 156: "\u0153", + 158: "\u017E", + 159: "\u0178" +}; + +// node_modules/is-decimal/index.js +function isDecimal(character) { + const code2 = typeof character === "string" ? character.charCodeAt(0) : character; + return code2 >= 48 && code2 <= 57; } -function vfile(value) { - return looksLikeAVFile(value) ? value : new VFile(value); + +// node_modules/is-hexadecimal/index.js +function isHexadecimal(character) { + const code2 = typeof character === "string" ? character.charCodeAt(0) : character; + return code2 >= 97 && code2 <= 102 || code2 >= 65 && code2 <= 70 || code2 >= 48 && code2 <= 57; } -function looksLikeAVFile(value) { - return Boolean( - value && typeof value === "object" && "message" in value && "messages" in value - ); + +// node_modules/is-alphabetical/index.js +function isAlphabetical(character) { + const code2 = typeof character === "string" ? character.charCodeAt(0) : character; + return code2 >= 97 && code2 <= 122 || code2 >= 65 && code2 <= 90; } -function looksLikeAVFileValue(value) { - return typeof value === "string" || (0, import_is_buffer2.default)(value); -} - -// node_modules/acorn/dist/acorn.mjs -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, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; -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, 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]; -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\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; -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\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"; -var reservedWords = { - 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", - 5: "class enum extends super const export import", - 6: "enum", - strict: "implements interface let package private protected public static yield", - strictBind: "eval arguments" -}; -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"; -var keywords$1 = { - 5: ecma5AndLessKeywords, - "5module": ecma5AndLessKeywords + " export import", - 6: ecma5AndLessKeywords + " const class extends export import super" -}; -var keywordRelationalOperator = /^in(stanceof)?$/; -var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); -var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); -function isInAstralSet(code2, set) { - var pos = 65536; - for (var i = 0; i < set.length; i += 2) { - pos += set[i]; - if (pos > code2) { - return false; - } - pos += set[i + 1]; - if (pos >= code2) { - return true; - } - } -} -function isIdentifierStart(code2, astral) { - if (code2 < 65) { - return code2 === 36; - } - if (code2 < 91) { - return true; - } - if (code2 < 97) { - return code2 === 95; - } - if (code2 < 123) { - return true; - } - if (code2 <= 65535) { - return code2 >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code2)); - } - if (astral === false) { - return false; - } - return isInAstralSet(code2, astralIdentifierStartCodes); -} -function isIdentifierChar(code2, astral) { - if (code2 < 48) { - return code2 === 36; - } - if (code2 < 58) { - return true; - } - if (code2 < 65) { - return false; - } - if (code2 < 91) { - return true; - } - if (code2 < 97) { - return code2 === 95; - } - if (code2 < 123) { - return true; - } - if (code2 <= 65535) { - return code2 >= 170 && nonASCIIidentifier.test(String.fromCharCode(code2)); - } - if (astral === false) { - return false; - } - return isInAstralSet(code2, astralIdentifierStartCodes) || isInAstralSet(code2, astralIdentifierCodes); -} -var TokenType = function TokenType2(label, conf) { - if (conf === void 0) - conf = {}; - this.label = label; - this.keyword = conf.keyword; - this.beforeExpr = !!conf.beforeExpr; - this.startsExpr = !!conf.startsExpr; - this.isLoop = !!conf.isLoop; - this.isAssign = !!conf.isAssign; - this.prefix = !!conf.prefix; - this.postfix = !!conf.postfix; - this.binop = conf.binop || null; - this.updateContext = null; -}; -function binop(name2, prec) { - return new TokenType(name2, { beforeExpr: true, binop: prec }); -} -var beforeExpr = { beforeExpr: true }; -var startsExpr = { startsExpr: true }; -var keywords = {}; -function kw(name2, options) { - if (options === void 0) - options = {}; - options.keyword = name2; - return keywords[name2] = new TokenType(name2, options); -} -var types$1 = { - num: new TokenType("num", startsExpr), - regexp: new TokenType("regexp", startsExpr), - string: new TokenType("string", startsExpr), - name: new TokenType("name", startsExpr), - privateId: new TokenType("privateId", startsExpr), - eof: new TokenType("eof"), - bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }), - bracketR: new TokenType("]"), - braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }), - braceR: new TokenType("}"), - parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }), - parenR: new TokenType(")"), - comma: new TokenType(",", beforeExpr), - semi: new TokenType(";", beforeExpr), - colon: new TokenType(":", beforeExpr), - dot: new TokenType("."), - question: new TokenType("?", beforeExpr), - questionDot: new TokenType("?."), - arrow: new TokenType("=>", beforeExpr), - template: new TokenType("template"), - invalidTemplate: new TokenType("invalidTemplate"), - ellipsis: new TokenType("...", beforeExpr), - backQuote: new TokenType("`", startsExpr), - dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }), - eq: new TokenType("=", { beforeExpr: true, isAssign: true }), - assign: new TokenType("_=", { beforeExpr: true, isAssign: true }), - incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }), - prefix: new TokenType("!/~", { beforeExpr: true, prefix: true, startsExpr: true }), - logicalOR: binop("||", 1), - logicalAND: binop("&&", 2), - bitwiseOR: binop("|", 3), - bitwiseXOR: binop("^", 4), - bitwiseAND: binop("&", 5), - equality: binop("==/!=/===/!==", 6), - relational: binop("/<=/>=", 7), - bitShift: binop("<>/>>>", 8), - plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }), - modulo: binop("%", 10), - star: binop("*", 10), - slash: binop("/", 10), - starstar: new TokenType("**", { beforeExpr: true }), - coalesce: binop("??", 1), - _break: kw("break"), - _case: kw("case", beforeExpr), - _catch: kw("catch"), - _continue: kw("continue"), - _debugger: kw("debugger"), - _default: kw("default", beforeExpr), - _do: kw("do", { isLoop: true, beforeExpr: true }), - _else: kw("else", beforeExpr), - _finally: kw("finally"), - _for: kw("for", { isLoop: true }), - _function: kw("function", startsExpr), - _if: kw("if"), - _return: kw("return", beforeExpr), - _switch: kw("switch"), - _throw: kw("throw", beforeExpr), - _try: kw("try"), - _var: kw("var"), - _const: kw("const"), - _while: kw("while", { isLoop: true }), - _with: kw("with"), - _new: kw("new", { beforeExpr: true, startsExpr: true }), - _this: kw("this", startsExpr), - _super: kw("super", startsExpr), - _class: kw("class", startsExpr), - _extends: kw("extends", beforeExpr), - _export: kw("export"), - _import: kw("import", startsExpr), - _null: kw("null", startsExpr), - _true: kw("true", startsExpr), - _false: kw("false", startsExpr), - _in: kw("in", { beforeExpr: true, binop: 7 }), - _instanceof: kw("instanceof", { beforeExpr: true, binop: 7 }), - _typeof: kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }), - _void: kw("void", { beforeExpr: true, prefix: true, startsExpr: true }), - _delete: kw("delete", { beforeExpr: true, prefix: true, startsExpr: true }) -}; -var lineBreak = /\r\n?|\n|\u2028|\u2029/; -var lineBreakG = new RegExp(lineBreak.source, "g"); -function isNewLine(code2) { - return code2 === 10 || code2 === 13 || code2 === 8232 || code2 === 8233; -} -function nextLineBreak(code2, from, end) { - if (end === void 0) - end = code2.length; - for (var i = from; i < end; i++) { - var next = code2.charCodeAt(i); - if (isNewLine(next)) { - return i < end - 1 && next === 13 && code2.charCodeAt(i + 1) === 10 ? i + 2 : i + 1; - } - } - return -1; -} -var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; -var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; -var ref = Object.prototype; -var hasOwnProperty = ref.hasOwnProperty; -var toString = ref.toString; -var hasOwn = Object.hasOwn || function(obj, propName) { - return hasOwnProperty.call(obj, propName); -}; -var isArray = Array.isArray || function(obj) { - return toString.call(obj) === "[object Array]"; -}; -function wordsRegexp(words) { - return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"); -} -function codePointToString(code2) { - if (code2 <= 65535) { - return String.fromCharCode(code2); - } - code2 -= 65536; - return String.fromCharCode((code2 >> 10) + 55296, (code2 & 1023) + 56320); -} -var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; -var Position = function Position2(line, col) { - this.line = line; - this.column = col; -}; -Position.prototype.offset = function offset(n) { - return new Position(this.line, this.column + n); -}; -var SourceLocation = function SourceLocation2(p, start3, end) { - this.start = start3; - this.end = end; - if (p.sourceFile !== null) { - this.source = p.sourceFile; - } -}; -function getLineInfo(input, offset2) { - for (var line = 1, cur = 0; ; ) { - var nextBreak = nextLineBreak(input, cur, offset2); - if (nextBreak < 0) { - return new Position(line, offset2 - cur); - } - ++line; - cur = nextBreak; - } -} -var defaultOptions = { - ecmaVersion: null, - sourceType: "script", - onInsertedSemicolon: null, - onTrailingComma: null, - allowReserved: null, - allowReturnOutsideFunction: false, - allowImportExportEverywhere: false, - allowAwaitOutsideFunction: null, - allowSuperOutsideMethod: null, - allowHashBang: false, - locations: false, - onToken: null, - onComment: null, - ranges: false, - program: null, - sourceFile: null, - directSourceFile: null, - preserveParens: false -}; -var warnedAboutEcmaVersion = false; -function getOptions(opts) { - var options = {}; - for (var opt in defaultOptions) { - options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; - } - if (options.ecmaVersion === "latest") { - options.ecmaVersion = 1e8; - } else if (options.ecmaVersion == null) { - if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) { - warnedAboutEcmaVersion = true; - console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future."); - } - options.ecmaVersion = 11; - } else if (options.ecmaVersion >= 2015) { - options.ecmaVersion -= 2009; - } - if (options.allowReserved == null) { - options.allowReserved = options.ecmaVersion < 5; - } - if (opts.allowHashBang == null) { - options.allowHashBang = options.ecmaVersion >= 14; - } - if (isArray(options.onToken)) { - var tokens = options.onToken; - options.onToken = function(token) { - return tokens.push(token); - }; - } - if (isArray(options.onComment)) { - options.onComment = pushComment(options, options.onComment); - } - return options; -} -function pushComment(options, array) { - return function(block, text5, start3, end, startLoc, endLoc) { - var comment2 = { - type: block ? "Block" : "Line", - value: text5, - start: start3, - end - }; - if (options.locations) { - comment2.loc = new SourceLocation(this, startLoc, endLoc); - } - if (options.ranges) { - comment2.range = [start3, end]; - } - array.push(comment2); - }; -} -var SCOPE_TOP = 1; -var SCOPE_FUNCTION = 2; -var SCOPE_ASYNC = 4; -var SCOPE_GENERATOR = 8; -var SCOPE_ARROW = 16; -var SCOPE_SIMPLE_CATCH = 32; -var SCOPE_SUPER = 64; -var SCOPE_DIRECT_SUPER = 128; -var SCOPE_CLASS_STATIC_BLOCK = 256; -var SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; -function functionFlags(async, generator) { - return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0); -} -var BIND_NONE = 0; -var BIND_VAR = 1; -var BIND_LEXICAL = 2; -var BIND_FUNCTION = 3; -var BIND_SIMPLE_CATCH = 4; -var BIND_OUTSIDE = 5; -var Parser = function Parser2(options, input, startPos) { - this.options = options = getOptions(options); - this.sourceFile = options.sourceFile; - this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); - var reserved = ""; - if (options.allowReserved !== true) { - reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3]; - if (options.sourceType === "module") { - reserved += " await"; - } - } - this.reservedWords = wordsRegexp(reserved); - var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict; - this.reservedWordsStrict = wordsRegexp(reservedStrict); - this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind); - this.input = String(input); - this.containsEsc = false; - if (startPos) { - this.pos = startPos; - this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1; - this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; - } else { - this.pos = this.lineStart = 0; - this.curLine = 1; - } - this.type = types$1.eof; - this.value = null; - this.start = this.end = this.pos; - this.startLoc = this.endLoc = this.curPosition(); - this.lastTokEndLoc = this.lastTokStartLoc = null; - this.lastTokStart = this.lastTokEnd = this.pos; - this.context = this.initialContext(); - this.exprAllowed = true; - this.inModule = options.sourceType === "module"; - this.strict = this.inModule || this.strictDirective(this.pos); - this.potentialArrowAt = -1; - this.potentialArrowInForAwait = false; - this.yieldPos = this.awaitPos = this.awaitIdentPos = 0; - this.labels = []; - this.undefinedExports = /* @__PURE__ */ Object.create(null); - if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") { - this.skipLineComment(2); - } - this.scopeStack = []; - this.enterScope(SCOPE_TOP); - this.regexpState = null; - this.privateNameStack = []; -}; -var 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 } }; -Parser.prototype.parse = function parse() { - var node = this.options.program || this.startNode(); - this.nextToken(); - return this.parseTopLevel(node); -}; -prototypeAccessors.inFunction.get = function() { - return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; -}; -prototypeAccessors.inGenerator.get = function() { - return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit; -}; -prototypeAccessors.inAsync.get = function() { - return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit; -}; -prototypeAccessors.canAwait.get = function() { - for (var i = this.scopeStack.length - 1; i >= 0; i--) { - var scope = this.scopeStack[i]; - if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { - return false; - } - if (scope.flags & SCOPE_FUNCTION) { - return (scope.flags & SCOPE_ASYNC) > 0; - } - } - return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction; -}; -prototypeAccessors.allowSuper.get = function() { - var ref2 = this.currentThisScope(); - var flags = ref2.flags; - var inClassFieldInit = ref2.inClassFieldInit; - return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod; -}; -prototypeAccessors.allowDirectSuper.get = function() { - return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; -}; -prototypeAccessors.treatFunctionsAsVar.get = function() { - return this.treatFunctionsAsVarInScope(this.currentScope()); -}; -prototypeAccessors.allowNewDotTarget.get = function() { - var ref2 = this.currentThisScope(); - var flags = ref2.flags; - var inClassFieldInit = ref2.inClassFieldInit; - return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit; -}; -prototypeAccessors.inClassStaticBlock.get = function() { - return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0; -}; -Parser.extend = function extend2() { - var plugins = [], len = arguments.length; - while (len--) - plugins[len] = arguments[len]; - var cls = this; - for (var i = 0; i < plugins.length; i++) { - cls = plugins[i](cls); - } - return cls; -}; -Parser.parse = function parse2(input, options) { - return new this(options, input).parse(); -}; -Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) { - var parser = new this(options, input, pos); - parser.nextToken(); - return parser.parseExpression(); -}; -Parser.tokenizer = function tokenizer(input, options) { - return new this(options, input); -}; -Object.defineProperties(Parser.prototype, prototypeAccessors); -var pp$9 = Parser.prototype; -var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; -pp$9.strictDirective = function(start3) { - if (this.options.ecmaVersion < 5) { - return false; - } - for (; ; ) { - skipWhiteSpace.lastIndex = start3; - start3 += skipWhiteSpace.exec(this.input)[0].length; - var match = literal.exec(this.input.slice(start3)); - if (!match) { - return false; - } - if ((match[1] || match[2]) === "use strict") { - skipWhiteSpace.lastIndex = start3 + match[0].length; - var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length; - var next = this.input.charAt(end); - return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="); - } - start3 += match[0].length; - skipWhiteSpace.lastIndex = start3; - start3 += skipWhiteSpace.exec(this.input)[0].length; - if (this.input[start3] === ";") { - start3++; - } - } -}; -pp$9.eat = function(type) { - if (this.type === type) { - this.next(); - return true; - } else { - return false; - } -}; -pp$9.isContextual = function(name2) { - return this.type === types$1.name && this.value === name2 && !this.containsEsc; -}; -pp$9.eatContextual = function(name2) { - if (!this.isContextual(name2)) { - return false; - } - this.next(); - return true; -}; -pp$9.expectContextual = function(name2) { - if (!this.eatContextual(name2)) { - this.unexpected(); - } -}; -pp$9.canInsertSemicolon = function() { - return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); -}; -pp$9.insertSemicolon = function() { - if (this.canInsertSemicolon()) { - if (this.options.onInsertedSemicolon) { - this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); - } - return true; - } -}; -pp$9.semicolon = function() { - if (!this.eat(types$1.semi) && !this.insertSemicolon()) { - this.unexpected(); - } -}; -pp$9.afterTrailingComma = function(tokType, notNext) { - if (this.type === tokType) { - if (this.options.onTrailingComma) { - this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); - } - if (!notNext) { - this.next(); - } - return true; - } -}; -pp$9.expect = function(type) { - this.eat(type) || this.unexpected(); -}; -pp$9.unexpected = function(pos) { - this.raise(pos != null ? pos : this.start, "Unexpected token"); -}; -var DestructuringErrors = function DestructuringErrors2() { - this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1; -}; -pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) { - if (!refDestructuringErrors) { - return; - } - if (refDestructuringErrors.trailingComma > -1) { - this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); - } - var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind; - if (parens > -1) { - this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern"); - } -}; -pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) { - if (!refDestructuringErrors) { - return false; - } - var shorthandAssign = refDestructuringErrors.shorthandAssign; - var doubleProto = refDestructuringErrors.doubleProto; - if (!andThrow) { - return shorthandAssign >= 0 || doubleProto >= 0; - } - if (shorthandAssign >= 0) { - this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); - } - if (doubleProto >= 0) { - this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); - } -}; -pp$9.checkYieldAwaitInDefaultParams = function() { - if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) { - this.raise(this.yieldPos, "Yield expression cannot be a default value"); - } - if (this.awaitPos) { - this.raise(this.awaitPos, "Await expression cannot be a default value"); - } -}; -pp$9.isSimpleAssignTarget = function(expr) { - if (expr.type === "ParenthesizedExpression") { - return this.isSimpleAssignTarget(expr.expression); - } - return expr.type === "Identifier" || expr.type === "MemberExpression"; -}; -var pp$8 = Parser.prototype; -pp$8.parseTopLevel = function(node) { - var exports = /* @__PURE__ */ Object.create(null); - if (!node.body) { - node.body = []; - } - while (this.type !== types$1.eof) { - var stmt = this.parseStatement(null, true, exports); - node.body.push(stmt); - } - if (this.inModule) { - for (var i = 0, list3 = Object.keys(this.undefinedExports); i < list3.length; i += 1) { - var name2 = list3[i]; - this.raiseRecoverable(this.undefinedExports[name2].start, "Export '" + name2 + "' is not defined"); - } - } - this.adaptDirectivePrologue(node.body); - this.next(); - node.sourceType = this.options.sourceType; - return this.finishNode(node, "Program"); -}; -var loopLabel = { kind: "loop" }; -var switchLabel = { kind: "switch" }; -pp$8.isLet = function(context) { - if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { - return false; - } - skipWhiteSpace.lastIndex = this.pos; - var skip = skipWhiteSpace.exec(this.input); - var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); - if (nextCh === 91 || nextCh === 92 || nextCh > 55295 && nextCh < 56320) { - return true; - } - if (context) { - return false; - } - if (nextCh === 123) { - return true; - } - if (isIdentifierStart(nextCh, true)) { - var pos = next + 1; - while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { - ++pos; - } - if (nextCh === 92 || nextCh > 55295 && nextCh < 56320) { - return true; - } - var ident = this.input.slice(next, pos); - if (!keywordRelationalOperator.test(ident)) { - return true; - } - } - return false; -}; -pp$8.isAsyncFunction = function() { - if (this.options.ecmaVersion < 8 || !this.isContextual("async")) { - return false; - } - skipWhiteSpace.lastIndex = this.pos; - var skip = skipWhiteSpace.exec(this.input); - var next = this.pos + skip[0].length, after; - return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 55295 && after < 56320)); -}; -pp$8.parseStatement = function(context, topLevel, exports) { - var starttype = this.type, node = this.startNode(), kind; - if (this.isLet(context)) { - starttype = types$1._var; - kind = "let"; - } - switch (starttype) { - case types$1._break: - case types$1._continue: - return this.parseBreakContinueStatement(node, starttype.keyword); - case types$1._debugger: - return this.parseDebuggerStatement(node); - case types$1._do: - return this.parseDoStatement(node); - case types$1._for: - return this.parseForStatement(node); - case types$1._function: - if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) { - this.unexpected(); - } - return this.parseFunctionStatement(node, false, !context); - case types$1._class: - if (context) { - this.unexpected(); - } - return this.parseClass(node, true); - case types$1._if: - return this.parseIfStatement(node); - case types$1._return: - return this.parseReturnStatement(node); - case types$1._switch: - return this.parseSwitchStatement(node); - case types$1._throw: - return this.parseThrowStatement(node); - case types$1._try: - return this.parseTryStatement(node); - case types$1._const: - case types$1._var: - kind = kind || this.value; - if (context && kind !== "var") { - this.unexpected(); - } - return this.parseVarStatement(node, kind); - case types$1._while: - return this.parseWhileStatement(node); - case types$1._with: - return this.parseWithStatement(node); - case types$1.braceL: - return this.parseBlock(true, node); - case types$1.semi: - return this.parseEmptyStatement(node); - case types$1._export: - case types$1._import: - if (this.options.ecmaVersion > 10 && starttype === types$1._import) { - skipWhiteSpace.lastIndex = this.pos; - var skip = skipWhiteSpace.exec(this.input); - var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); - if (nextCh === 40 || nextCh === 46) { - return this.parseExpressionStatement(node, this.parseExpression()); - } - } - if (!this.options.allowImportExportEverywhere) { - if (!topLevel) { - this.raise(this.start, "'import' and 'export' may only appear at the top level"); - } - if (!this.inModule) { - this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); - } - } - return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports); - default: - if (this.isAsyncFunction()) { - if (context) { - this.unexpected(); - } - this.next(); - return this.parseFunctionStatement(node, true, !context); - } - var maybeName = this.value, expr = this.parseExpression(); - if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) { - return this.parseLabeledStatement(node, maybeName, expr, context); - } else { - return this.parseExpressionStatement(node, expr); - } - } -}; -pp$8.parseBreakContinueStatement = function(node, keyword) { - var isBreak = keyword === "break"; - this.next(); - if (this.eat(types$1.semi) || this.insertSemicolon()) { - node.label = null; - } else if (this.type !== types$1.name) { - this.unexpected(); - } else { - node.label = this.parseIdent(); - this.semicolon(); - } - var i = 0; - for (; i < this.labels.length; ++i) { - var lab = this.labels[i]; - if (node.label == null || lab.name === node.label.name) { - if (lab.kind != null && (isBreak || lab.kind === "loop")) { - break; - } - if (node.label && isBreak) { - break; - } - } - } - if (i === this.labels.length) { - this.raise(node.start, "Unsyntactic " + keyword); - } - return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); -}; -pp$8.parseDebuggerStatement = function(node) { - this.next(); - this.semicolon(); - return this.finishNode(node, "DebuggerStatement"); -}; -pp$8.parseDoStatement = function(node) { - this.next(); - this.labels.push(loopLabel); - node.body = this.parseStatement("do"); - this.labels.pop(); - this.expect(types$1._while); - node.test = this.parseParenExpression(); - if (this.options.ecmaVersion >= 6) { - this.eat(types$1.semi); - } else { - this.semicolon(); - } - return this.finishNode(node, "DoWhileStatement"); -}; -pp$8.parseForStatement = function(node) { - this.next(); - var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1; - this.labels.push(loopLabel); - this.enterScope(0); - this.expect(types$1.parenL); - if (this.type === types$1.semi) { - if (awaitAt > -1) { - this.unexpected(awaitAt); - } - return this.parseFor(node, null); - } - var isLet = this.isLet(); - if (this.type === types$1._var || this.type === types$1._const || isLet) { - var init$1 = this.startNode(), kind = isLet ? "let" : this.value; - this.next(); - this.parseVar(init$1, true, kind); - this.finishNode(init$1, "VariableDeclaration"); - if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) { - if (this.options.ecmaVersion >= 9) { - if (this.type === types$1._in) { - if (awaitAt > -1) { - this.unexpected(awaitAt); - } - } else { - node.await = awaitAt > -1; - } - } - return this.parseForIn(node, init$1); - } - if (awaitAt > -1) { - this.unexpected(awaitAt); - } - return this.parseFor(node, init$1); - } - var startsWithLet = this.isContextual("let"), isForOf = false; - var refDestructuringErrors = new DestructuringErrors(); - var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors); - if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) { - if (this.options.ecmaVersion >= 9) { - if (this.type === types$1._in) { - if (awaitAt > -1) { - this.unexpected(awaitAt); - } - } else { - node.await = awaitAt > -1; - } - } - if (startsWithLet && isForOf) { - this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); - } - this.toAssignable(init, false, refDestructuringErrors); - this.checkLValPattern(init); - return this.parseForIn(node, init); - } else { - this.checkExpressionErrors(refDestructuringErrors, true); - } - if (awaitAt > -1) { - this.unexpected(awaitAt); - } - return this.parseFor(node, init); -}; -pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) { - this.next(); - return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync); -}; -pp$8.parseIfStatement = function(node) { - this.next(); - node.test = this.parseParenExpression(); - node.consequent = this.parseStatement("if"); - node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; - return this.finishNode(node, "IfStatement"); -}; -pp$8.parseReturnStatement = function(node) { - if (!this.inFunction && !this.options.allowReturnOutsideFunction) { - this.raise(this.start, "'return' outside of function"); - } - this.next(); - if (this.eat(types$1.semi) || this.insertSemicolon()) { - node.argument = null; - } else { - node.argument = this.parseExpression(); - this.semicolon(); - } - return this.finishNode(node, "ReturnStatement"); -}; -pp$8.parseSwitchStatement = function(node) { - this.next(); - node.discriminant = this.parseParenExpression(); - node.cases = []; - this.expect(types$1.braceL); - this.labels.push(switchLabel); - this.enterScope(0); - var cur; - for (var sawDefault = false; this.type !== types$1.braceR; ) { - if (this.type === types$1._case || this.type === types$1._default) { - var isCase = this.type === types$1._case; - if (cur) { - this.finishNode(cur, "SwitchCase"); - } - node.cases.push(cur = this.startNode()); - cur.consequent = []; - this.next(); - if (isCase) { - cur.test = this.parseExpression(); - } else { - if (sawDefault) { - this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); - } - sawDefault = true; - cur.test = null; - } - this.expect(types$1.colon); - } else { - if (!cur) { - this.unexpected(); - } - cur.consequent.push(this.parseStatement(null)); - } - } - this.exitScope(); - if (cur) { - this.finishNode(cur, "SwitchCase"); - } - this.next(); - this.labels.pop(); - return this.finishNode(node, "SwitchStatement"); -}; -pp$8.parseThrowStatement = function(node) { - this.next(); - if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) { - this.raise(this.lastTokEnd, "Illegal newline after throw"); - } - node.argument = this.parseExpression(); - this.semicolon(); - return this.finishNode(node, "ThrowStatement"); -}; -var empty$1 = []; -pp$8.parseTryStatement = function(node) { - this.next(); - node.block = this.parseBlock(); - node.handler = null; - if (this.type === types$1._catch) { - var clause = this.startNode(); - this.next(); - if (this.eat(types$1.parenL)) { - clause.param = this.parseBindingAtom(); - var simple = clause.param.type === "Identifier"; - this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); - this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); - this.expect(types$1.parenR); - } else { - if (this.options.ecmaVersion < 10) { - this.unexpected(); - } - clause.param = null; - this.enterScope(0); - } - clause.body = this.parseBlock(false); - this.exitScope(); - node.handler = this.finishNode(clause, "CatchClause"); - } - node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; - if (!node.handler && !node.finalizer) { - this.raise(node.start, "Missing catch or finally clause"); - } - return this.finishNode(node, "TryStatement"); -}; -pp$8.parseVarStatement = function(node, kind) { - this.next(); - this.parseVar(node, false, kind); - this.semicolon(); - return this.finishNode(node, "VariableDeclaration"); -}; -pp$8.parseWhileStatement = function(node) { - this.next(); - node.test = this.parseParenExpression(); - this.labels.push(loopLabel); - node.body = this.parseStatement("while"); - this.labels.pop(); - return this.finishNode(node, "WhileStatement"); -}; -pp$8.parseWithStatement = function(node) { - if (this.strict) { - this.raise(this.start, "'with' in strict mode"); - } - this.next(); - node.object = this.parseParenExpression(); - node.body = this.parseStatement("with"); - return this.finishNode(node, "WithStatement"); -}; -pp$8.parseEmptyStatement = function(node) { - this.next(); - return this.finishNode(node, "EmptyStatement"); -}; -pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { - for (var i$1 = 0, list3 = this.labels; i$1 < list3.length; i$1 += 1) { - var label = list3[i$1]; - if (label.name === maybeName) { - this.raise(expr.start, "Label '" + maybeName + "' is already declared"); - } - } - var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; - for (var i = this.labels.length - 1; i >= 0; i--) { - var label$1 = this.labels[i]; - if (label$1.statementStart === node.start) { - label$1.statementStart = this.start; - label$1.kind = kind; - } else { - break; - } - } - this.labels.push({ name: maybeName, kind, statementStart: this.start }); - node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); - this.labels.pop(); - node.label = expr; - return this.finishNode(node, "LabeledStatement"); -}; -pp$8.parseExpressionStatement = function(node, expr) { - node.expression = expr; - this.semicolon(); - return this.finishNode(node, "ExpressionStatement"); -}; -pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) { - if (createNewLexicalScope === void 0) - createNewLexicalScope = true; - if (node === void 0) - node = this.startNode(); - node.body = []; - this.expect(types$1.braceL); - if (createNewLexicalScope) { - this.enterScope(0); - } - while (this.type !== types$1.braceR) { - var stmt = this.parseStatement(null); - node.body.push(stmt); - } - if (exitStrict) { - this.strict = false; - } - this.next(); - if (createNewLexicalScope) { - this.exitScope(); - } - return this.finishNode(node, "BlockStatement"); -}; -pp$8.parseFor = function(node, init) { - node.init = init; - this.expect(types$1.semi); - node.test = this.type === types$1.semi ? null : this.parseExpression(); - this.expect(types$1.semi); - node.update = this.type === types$1.parenR ? null : this.parseExpression(); - this.expect(types$1.parenR); - node.body = this.parseStatement("for"); - this.exitScope(); - this.labels.pop(); - return this.finishNode(node, "ForStatement"); -}; -pp$8.parseForIn = function(node, init) { - var isForIn = this.type === types$1._in; - this.next(); - if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { - this.raise( - init.start, - (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer" - ); - } - node.left = init; - node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); - this.expect(types$1.parenR); - node.body = this.parseStatement("for"); - this.exitScope(); - this.labels.pop(); - return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); -}; -pp$8.parseVar = function(node, isFor, kind) { - node.declarations = []; - node.kind = kind; - for (; ; ) { - var decl = this.startNode(); - this.parseVarId(decl, kind); - if (this.eat(types$1.eq)) { - decl.init = this.parseMaybeAssign(isFor); - } else if (kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { - this.unexpected(); - } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) { - this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); - } else { - decl.init = null; - } - node.declarations.push(this.finishNode(decl, "VariableDeclarator")); - if (!this.eat(types$1.comma)) { - break; - } - } - return node; -}; -pp$8.parseVarId = function(decl, kind) { - decl.id = this.parseBindingAtom(); - this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); -}; -var FUNC_STATEMENT = 1; -var FUNC_HANGING_STATEMENT = 2; -var FUNC_NULLABLE_ID = 4; -pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) { - this.initFunction(node); - if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { - if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) { - this.unexpected(); - } - node.generator = this.eat(types$1.star); - } - if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; - } - if (statement & FUNC_STATEMENT) { - node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent(); - if (node.id && !(statement & FUNC_HANGING_STATEMENT)) { - this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); - } - } - var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.yieldPos = 0; - this.awaitPos = 0; - this.awaitIdentPos = 0; - this.enterScope(functionFlags(node.async, node.generator)); - if (!(statement & FUNC_STATEMENT)) { - node.id = this.type === types$1.name ? this.parseIdent() : null; - } - this.parseFunctionParams(node); - this.parseFunctionBody(node, allowExpressionBody, false, forInit); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression"); -}; -pp$8.parseFunctionParams = function(node) { - this.expect(types$1.parenL); - node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); - this.checkYieldAwaitInDefaultParams(); -}; -pp$8.parseClass = function(node, isStatement) { - this.next(); - var oldStrict = this.strict; - this.strict = true; - this.parseClassId(node, isStatement); - this.parseClassSuper(node); - var privateNameMap = this.enterClassBody(); - var classBody = this.startNode(); - var hadConstructor = false; - classBody.body = []; - this.expect(types$1.braceL); - while (this.type !== types$1.braceR) { - var element2 = this.parseClassElement(node.superClass !== null); - if (element2) { - classBody.body.push(element2); - if (element2.type === "MethodDefinition" && element2.kind === "constructor") { - if (hadConstructor) { - this.raise(element2.start, "Duplicate constructor in the same class"); - } - hadConstructor = true; - } else if (element2.key && element2.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element2)) { - this.raiseRecoverable(element2.key.start, "Identifier '#" + element2.key.name + "' has already been declared"); - } - } - } - this.strict = oldStrict; - this.next(); - node.body = this.finishNode(classBody, "ClassBody"); - this.exitClassBody(); - return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); -}; -pp$8.parseClassElement = function(constructorAllowsSuper) { - if (this.eat(types$1.semi)) { - return null; - } - var ecmaVersion = this.options.ecmaVersion; - var node = this.startNode(); - var keyName = ""; - var isGenerator = false; - var isAsync = false; - var kind = "method"; - var isStatic = false; - if (this.eatContextual("static")) { - if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { - this.parseClassStaticBlock(node); - return node; - } - if (this.isClassElementNameStart() || this.type === types$1.star) { - isStatic = true; - } else { - keyName = "static"; - } - } - node.static = isStatic; - if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { - if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) { - isAsync = true; - } else { - keyName = "async"; - } - } - if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) { - isGenerator = true; - } - if (!keyName && !isAsync && !isGenerator) { - var lastValue = this.value; - if (this.eatContextual("get") || this.eatContextual("set")) { - if (this.isClassElementNameStart()) { - kind = lastValue; - } else { - keyName = lastValue; - } - } - } - if (keyName) { - node.computed = false; - node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); - node.key.name = keyName; - this.finishNode(node.key, "Identifier"); - } else { - this.parseClassElementName(node); - } - if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { - var isConstructor = !node.static && checkKeyName(node, "constructor"); - var allowsDirectSuper = isConstructor && constructorAllowsSuper; - if (isConstructor && kind !== "method") { - this.raise(node.key.start, "Constructor can't have get/set modifier"); - } - node.kind = isConstructor ? "constructor" : kind; - this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); - } else { - this.parseClassField(node); - } - return node; -}; -pp$8.isClassElementNameStart = function() { - return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword; -}; -pp$8.parseClassElementName = function(element2) { - if (this.type === types$1.privateId) { - if (this.value === "constructor") { - this.raise(this.start, "Classes can't have an element named '#constructor'"); - } - element2.computed = false; - element2.key = this.parsePrivateIdent(); - } else { - this.parsePropertyName(element2); - } -}; -pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) { - var key = method.key; - if (method.kind === "constructor") { - if (isGenerator) { - this.raise(key.start, "Constructor can't be a generator"); - } - if (isAsync) { - this.raise(key.start, "Constructor can't be an async method"); - } - } else if (method.static && checkKeyName(method, "prototype")) { - this.raise(key.start, "Classes may not have a static property named prototype"); - } - var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); - if (method.kind === "get" && value.params.length !== 0) { - this.raiseRecoverable(value.start, "getter should have no params"); - } - if (method.kind === "set" && value.params.length !== 1) { - this.raiseRecoverable(value.start, "setter should have exactly one param"); - } - if (method.kind === "set" && value.params[0].type === "RestElement") { - this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); - } - return this.finishNode(method, "MethodDefinition"); -}; -pp$8.parseClassField = function(field) { - if (checkKeyName(field, "constructor")) { - this.raise(field.key.start, "Classes can't have a field named 'constructor'"); - } else if (field.static && checkKeyName(field, "prototype")) { - this.raise(field.key.start, "Classes can't have a static field named 'prototype'"); - } - if (this.eat(types$1.eq)) { - var scope = this.currentThisScope(); - var inClassFieldInit = scope.inClassFieldInit; - scope.inClassFieldInit = true; - field.value = this.parseMaybeAssign(); - scope.inClassFieldInit = inClassFieldInit; - } else { - field.value = null; - } - this.semicolon(); - return this.finishNode(field, "PropertyDefinition"); -}; -pp$8.parseClassStaticBlock = function(node) { - node.body = []; - var oldLabels = this.labels; - this.labels = []; - this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); - while (this.type !== types$1.braceR) { - var stmt = this.parseStatement(null); - node.body.push(stmt); - } - this.next(); - this.exitScope(); - this.labels = oldLabels; - return this.finishNode(node, "StaticBlock"); -}; -pp$8.parseClassId = function(node, isStatement) { - if (this.type === types$1.name) { - node.id = this.parseIdent(); - if (isStatement) { - this.checkLValSimple(node.id, BIND_LEXICAL, false); - } - } else { - if (isStatement === true) { - this.unexpected(); - } - node.id = null; - } -}; -pp$8.parseClassSuper = function(node) { - node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null; -}; -pp$8.enterClassBody = function() { - var element2 = { declared: /* @__PURE__ */ Object.create(null), used: [] }; - this.privateNameStack.push(element2); - return element2.declared; -}; -pp$8.exitClassBody = function() { - var ref2 = this.privateNameStack.pop(); - var declared = ref2.declared; - var used = ref2.used; - var len = this.privateNameStack.length; - var parent = len === 0 ? null : this.privateNameStack[len - 1]; - for (var i = 0; i < used.length; ++i) { - var id = used[i]; - if (!hasOwn(declared, id.name)) { - if (parent) { - parent.used.push(id); - } else { - this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class"); - } - } - } -}; -function isPrivateNameConflicted(privateNameMap, element2) { - var name2 = element2.key.name; - var curr = privateNameMap[name2]; - var next = "true"; - if (element2.type === "MethodDefinition" && (element2.kind === "get" || element2.kind === "set")) { - next = (element2.static ? "s" : "i") + element2.kind; - } - if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") { - privateNameMap[name2] = "true"; - return false; - } else if (!curr) { - privateNameMap[name2] = next; - return false; - } else { - return true; - } -} -function checkKeyName(node, name2) { - var computed = node.computed; - var key = node.key; - return !computed && (key.type === "Identifier" && key.name === name2 || key.type === "Literal" && key.value === name2); -} -pp$8.parseExport = function(node, exports) { - this.next(); - if (this.eat(types$1.star)) { - if (this.options.ecmaVersion >= 11) { - if (this.eatContextual("as")) { - node.exported = this.parseModuleExportName(); - this.checkExport(exports, node.exported, this.lastTokStart); - } else { - node.exported = null; - } - } - this.expectContextual("from"); - if (this.type !== types$1.string) { - this.unexpected(); - } - node.source = this.parseExprAtom(); - this.semicolon(); - return this.finishNode(node, "ExportAllDeclaration"); - } - if (this.eat(types$1._default)) { - this.checkExport(exports, "default", this.lastTokStart); - var isAsync; - if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) { - var fNode = this.startNode(); - this.next(); - if (isAsync) { - this.next(); - } - node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); - } else if (this.type === types$1._class) { - var cNode = this.startNode(); - node.declaration = this.parseClass(cNode, "nullableID"); - } else { - node.declaration = this.parseMaybeAssign(); - this.semicolon(); - } - return this.finishNode(node, "ExportDefaultDeclaration"); - } - if (this.shouldParseExportStatement()) { - node.declaration = this.parseStatement(null); - if (node.declaration.type === "VariableDeclaration") { - this.checkVariableExport(exports, node.declaration.declarations); - } else { - this.checkExport(exports, node.declaration.id, node.declaration.id.start); - } - node.specifiers = []; - node.source = null; - } else { - node.declaration = null; - node.specifiers = this.parseExportSpecifiers(exports); - if (this.eatContextual("from")) { - if (this.type !== types$1.string) { - this.unexpected(); - } - node.source = this.parseExprAtom(); - } else { - for (var i = 0, list3 = node.specifiers; i < list3.length; i += 1) { - var spec = list3[i]; - this.checkUnreserved(spec.local); - this.checkLocalExport(spec.local); - if (spec.local.type === "Literal") { - this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`."); - } - } - node.source = null; - } - this.semicolon(); - } - return this.finishNode(node, "ExportNamedDeclaration"); -}; -pp$8.checkExport = function(exports, name2, pos) { - if (!exports) { - return; - } - if (typeof name2 !== "string") { - name2 = name2.type === "Identifier" ? name2.name : name2.value; - } - if (hasOwn(exports, name2)) { - this.raiseRecoverable(pos, "Duplicate export '" + name2 + "'"); - } - exports[name2] = true; -}; -pp$8.checkPatternExport = function(exports, pat) { - var type = pat.type; - if (type === "Identifier") { - this.checkExport(exports, pat, pat.start); - } else if (type === "ObjectPattern") { - for (var i = 0, list3 = pat.properties; i < list3.length; i += 1) { - var prop = list3[i]; - this.checkPatternExport(exports, prop); - } - } else if (type === "ArrayPattern") { - for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) { - var elt = list$1[i$1]; - if (elt) { - this.checkPatternExport(exports, elt); - } - } - } else if (type === "Property") { - this.checkPatternExport(exports, pat.value); - } else if (type === "AssignmentPattern") { - this.checkPatternExport(exports, pat.left); - } else if (type === "RestElement") { - this.checkPatternExport(exports, pat.argument); - } else if (type === "ParenthesizedExpression") { - this.checkPatternExport(exports, pat.expression); - } -}; -pp$8.checkVariableExport = function(exports, decls) { - if (!exports) { - return; - } - for (var i = 0, list3 = decls; i < list3.length; i += 1) { - var decl = list3[i]; - this.checkPatternExport(exports, decl.id); - } -}; -pp$8.shouldParseExportStatement = function() { - return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction(); -}; -pp$8.parseExportSpecifiers = function(exports) { - var nodes = [], first = true; - this.expect(types$1.braceL); - while (!this.eat(types$1.braceR)) { - if (!first) { - this.expect(types$1.comma); - if (this.afterTrailingComma(types$1.braceR)) { - break; - } - } else { - first = false; - } - var node = this.startNode(); - node.local = this.parseModuleExportName(); - node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local; - this.checkExport( - exports, - node.exported, - node.exported.start - ); - nodes.push(this.finishNode(node, "ExportSpecifier")); - } - return nodes; -}; -pp$8.parseImport = function(node) { - this.next(); - if (this.type === types$1.string) { - node.specifiers = empty$1; - node.source = this.parseExprAtom(); - } else { - node.specifiers = this.parseImportSpecifiers(); - this.expectContextual("from"); - node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); - } - this.semicolon(); - return this.finishNode(node, "ImportDeclaration"); -}; -pp$8.parseImportSpecifiers = function() { - var nodes = [], first = true; - if (this.type === types$1.name) { - var node = this.startNode(); - node.local = this.parseIdent(); - this.checkLValSimple(node.local, BIND_LEXICAL); - nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); - if (!this.eat(types$1.comma)) { - return nodes; - } - } - if (this.type === types$1.star) { - var node$1 = this.startNode(); - this.next(); - this.expectContextual("as"); - node$1.local = this.parseIdent(); - this.checkLValSimple(node$1.local, BIND_LEXICAL); - nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")); - return nodes; - } - this.expect(types$1.braceL); - while (!this.eat(types$1.braceR)) { - if (!first) { - this.expect(types$1.comma); - if (this.afterTrailingComma(types$1.braceR)) { - break; - } - } else { - first = false; - } - var node$2 = this.startNode(); - node$2.imported = this.parseModuleExportName(); - if (this.eatContextual("as")) { - node$2.local = this.parseIdent(); - } else { - this.checkUnreserved(node$2.imported); - node$2.local = node$2.imported; - } - this.checkLValSimple(node$2.local, BIND_LEXICAL); - nodes.push(this.finishNode(node$2, "ImportSpecifier")); - } - return nodes; -}; -pp$8.parseModuleExportName = function() { - if (this.options.ecmaVersion >= 13 && this.type === types$1.string) { - var stringLiteral = this.parseLiteral(this.value); - if (loneSurrogate.test(stringLiteral.value)) { - this.raise(stringLiteral.start, "An export name cannot include a lone surrogate."); - } - return stringLiteral; - } - return this.parseIdent(true); -}; -pp$8.adaptDirectivePrologue = function(statements) { - for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { - statements[i].directive = statements[i].expression.raw.slice(1, -1); - } -}; -pp$8.isDirectiveCandidate = function(statement) { - return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (this.input[statement.start] === '"' || this.input[statement.start] === "'"); -}; -var pp$7 = Parser.prototype; -pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { - if (this.options.ecmaVersion >= 6 && node) { - switch (node.type) { - case "Identifier": - if (this.inAsync && node.name === "await") { - this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); - } - break; - case "ObjectPattern": - case "ArrayPattern": - case "AssignmentPattern": - case "RestElement": - break; - case "ObjectExpression": - node.type = "ObjectPattern"; - if (refDestructuringErrors) { - this.checkPatternErrors(refDestructuringErrors, true); - } - for (var i = 0, list3 = node.properties; i < list3.length; i += 1) { - var prop = list3[i]; - this.toAssignable(prop, isBinding); - if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) { - this.raise(prop.argument.start, "Unexpected token"); - } - } - break; - case "Property": - if (node.kind !== "init") { - this.raise(node.key.start, "Object pattern can't contain getter or setter"); - } - this.toAssignable(node.value, isBinding); - break; - case "ArrayExpression": - node.type = "ArrayPattern"; - if (refDestructuringErrors) { - this.checkPatternErrors(refDestructuringErrors, true); - } - this.toAssignableList(node.elements, isBinding); - break; - case "SpreadElement": - node.type = "RestElement"; - this.toAssignable(node.argument, isBinding); - if (node.argument.type === "AssignmentPattern") { - this.raise(node.argument.start, "Rest elements cannot have a default value"); - } - break; - case "AssignmentExpression": - if (node.operator !== "=") { - this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); - } - node.type = "AssignmentPattern"; - delete node.operator; - this.toAssignable(node.left, isBinding); - break; - case "ParenthesizedExpression": - this.toAssignable(node.expression, isBinding, refDestructuringErrors); - break; - case "ChainExpression": - this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side"); - break; - case "MemberExpression": - if (!isBinding) { - break; - } - default: - this.raise(node.start, "Assigning to rvalue"); - } - } else if (refDestructuringErrors) { - this.checkPatternErrors(refDestructuringErrors, true); - } - return node; -}; -pp$7.toAssignableList = function(exprList, isBinding) { - var end = exprList.length; - for (var i = 0; i < end; i++) { - var elt = exprList[i]; - if (elt) { - this.toAssignable(elt, isBinding); - } - } - if (end) { - var last = exprList[end - 1]; - if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") { - this.unexpected(last.argument.start); - } - } - return exprList; -}; -pp$7.parseSpread = function(refDestructuringErrors) { - var node = this.startNode(); - this.next(); - node.argument = this.parseMaybeAssign(false, refDestructuringErrors); - return this.finishNode(node, "SpreadElement"); -}; -pp$7.parseRestBinding = function() { - var node = this.startNode(); - this.next(); - if (this.options.ecmaVersion === 6 && this.type !== types$1.name) { - this.unexpected(); - } - node.argument = this.parseBindingAtom(); - return this.finishNode(node, "RestElement"); -}; -pp$7.parseBindingAtom = function() { - if (this.options.ecmaVersion >= 6) { - switch (this.type) { - case types$1.bracketL: - var node = this.startNode(); - this.next(); - node.elements = this.parseBindingList(types$1.bracketR, true, true); - return this.finishNode(node, "ArrayPattern"); - case types$1.braceL: - return this.parseObj(true); - } - } - return this.parseIdent(); -}; -pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) { - var elts = [], first = true; - while (!this.eat(close)) { - if (first) { - first = false; - } else { - this.expect(types$1.comma); - } - if (allowEmpty && this.type === types$1.comma) { - elts.push(null); - } else if (allowTrailingComma && this.afterTrailingComma(close)) { - break; - } else if (this.type === types$1.ellipsis) { - var rest = this.parseRestBinding(); - this.parseBindingListItem(rest); - elts.push(rest); - if (this.type === types$1.comma) { - this.raise(this.start, "Comma is not permitted after the rest element"); - } - this.expect(close); - break; - } else { - var elem = this.parseMaybeDefault(this.start, this.startLoc); - this.parseBindingListItem(elem); - elts.push(elem); - } - } - return elts; -}; -pp$7.parseBindingListItem = function(param) { - return param; -}; -pp$7.parseMaybeDefault = function(startPos, startLoc, left) { - left = left || this.parseBindingAtom(); - if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { - return left; - } - var node = this.startNodeAt(startPos, startLoc); - node.left = left; - node.right = this.parseMaybeAssign(); - return this.finishNode(node, "AssignmentPattern"); -}; -pp$7.checkLValSimple = function(expr, bindingType, checkClashes) { - if (bindingType === void 0) - bindingType = BIND_NONE; - var isBind = bindingType !== BIND_NONE; - switch (expr.type) { - case "Identifier": - if (this.strict && this.reservedWordsStrictBind.test(expr.name)) { - this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); - } - if (isBind) { - if (bindingType === BIND_LEXICAL && expr.name === "let") { - this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); - } - if (checkClashes) { - if (hasOwn(checkClashes, expr.name)) { - this.raiseRecoverable(expr.start, "Argument name clash"); - } - checkClashes[expr.name] = true; - } - if (bindingType !== BIND_OUTSIDE) { - this.declareName(expr.name, bindingType, expr.start); - } - } - break; - case "ChainExpression": - this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side"); - break; - case "MemberExpression": - if (isBind) { - this.raiseRecoverable(expr.start, "Binding member expression"); - } - break; - case "ParenthesizedExpression": - if (isBind) { - this.raiseRecoverable(expr.start, "Binding parenthesized expression"); - } - return this.checkLValSimple(expr.expression, bindingType, checkClashes); - default: - this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue"); - } -}; -pp$7.checkLValPattern = function(expr, bindingType, checkClashes) { - if (bindingType === void 0) - bindingType = BIND_NONE; - switch (expr.type) { - case "ObjectPattern": - for (var i = 0, list3 = expr.properties; i < list3.length; i += 1) { - var prop = list3[i]; - this.checkLValInnerPattern(prop, bindingType, checkClashes); - } - break; - case "ArrayPattern": - for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) { - var elem = list$1[i$1]; - if (elem) { - this.checkLValInnerPattern(elem, bindingType, checkClashes); - } - } - break; - default: - this.checkLValSimple(expr, bindingType, checkClashes); - } -}; -pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) { - if (bindingType === void 0) - bindingType = BIND_NONE; - switch (expr.type) { - case "Property": - this.checkLValInnerPattern(expr.value, bindingType, checkClashes); - break; - case "AssignmentPattern": - this.checkLValPattern(expr.left, bindingType, checkClashes); - break; - case "RestElement": - this.checkLValPattern(expr.argument, bindingType, checkClashes); - break; - default: - this.checkLValPattern(expr, bindingType, checkClashes); - } -}; -var TokContext = function TokContext2(token, isExpr, preserveSpace, override, generator) { - this.token = token; - this.isExpr = !!isExpr; - this.preserveSpace = !!preserveSpace; - this.override = override; - this.generator = !!generator; -}; -var types = { - b_stat: new TokContext("{", false), - b_expr: new TokContext("{", true), - b_tmpl: new TokContext("${", false), - p_stat: new TokContext("(", false), - p_expr: new TokContext("(", true), - q_tmpl: new TokContext("`", true, true, function(p) { - return p.tryReadTemplateToken(); - }), - f_stat: new TokContext("function", false), - f_expr: new TokContext("function", true), - f_expr_gen: new TokContext("function", true, false, null, true), - f_gen: new TokContext("function", false, false, null, true) -}; -var pp$6 = Parser.prototype; -pp$6.initialContext = function() { - return [types.b_stat]; -}; -pp$6.curContext = function() { - return this.context[this.context.length - 1]; -}; -pp$6.braceIsBlock = function(prevType) { - var parent = this.curContext(); - if (parent === types.f_expr || parent === types.f_stat) { - return true; - } - if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) { - return !parent.isExpr; - } - if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) { - return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); - } - if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) { - return true; - } - if (prevType === types$1.braceL) { - return parent === types.b_stat; - } - if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) { - return false; - } - return !this.exprAllowed; -}; -pp$6.inGeneratorContext = function() { - for (var i = this.context.length - 1; i >= 1; i--) { - var context = this.context[i]; - if (context.token === "function") { - return context.generator; - } - } - return false; -}; -pp$6.updateContext = function(prevType) { - var update, type = this.type; - if (type.keyword && prevType === types$1.dot) { - this.exprAllowed = false; - } else if (update = type.updateContext) { - update.call(this, prevType); - } else { - this.exprAllowed = type.beforeExpr; - } -}; -pp$6.overrideContext = function(tokenCtx) { - if (this.curContext() !== tokenCtx) { - this.context[this.context.length - 1] = tokenCtx; - } -}; -types$1.parenR.updateContext = types$1.braceR.updateContext = function() { - if (this.context.length === 1) { - this.exprAllowed = true; - return; - } - var out = this.context.pop(); - if (out === types.b_stat && this.curContext().token === "function") { - out = this.context.pop(); - } - this.exprAllowed = !out.isExpr; -}; -types$1.braceL.updateContext = function(prevType) { - this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); - this.exprAllowed = true; -}; -types$1.dollarBraceL.updateContext = function() { - this.context.push(types.b_tmpl); - this.exprAllowed = true; -}; -types$1.parenL.updateContext = function(prevType) { - var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while; - this.context.push(statementParens ? types.p_stat : types.p_expr); - this.exprAllowed = true; -}; -types$1.incDec.updateContext = function() { -}; -types$1._function.updateContext = types$1._class.updateContext = function(prevType) { - if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) { - this.context.push(types.f_expr); - } else { - this.context.push(types.f_stat); - } - this.exprAllowed = false; -}; -types$1.backQuote.updateContext = function() { - if (this.curContext() === types.q_tmpl) { - this.context.pop(); - } else { - this.context.push(types.q_tmpl); - } - this.exprAllowed = false; -}; -types$1.star.updateContext = function(prevType) { - if (prevType === types$1._function) { - var index2 = this.context.length - 1; - if (this.context[index2] === types.f_expr) { - this.context[index2] = types.f_expr_gen; - } else { - this.context[index2] = types.f_gen; - } - } - this.exprAllowed = true; -}; -types$1.name.updateContext = function(prevType) { - var allowed = false; - if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) { - if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) { - allowed = true; - } - } - this.exprAllowed = allowed; -}; -var pp$5 = Parser.prototype; -pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { - if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") { - return; - } - if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) { - return; - } - var key = prop.key; - var name2; - switch (key.type) { - case "Identifier": - name2 = key.name; - break; - case "Literal": - name2 = String(key.value); - break; - default: - return; - } - var kind = prop.kind; - if (this.options.ecmaVersion >= 6) { - if (name2 === "__proto__" && kind === "init") { - if (propHash.proto) { - if (refDestructuringErrors) { - if (refDestructuringErrors.doubleProto < 0) { - refDestructuringErrors.doubleProto = key.start; - } - } else { - this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); - } - } - propHash.proto = true; - } - return; - } - name2 = "$" + name2; - var other = propHash[name2]; - if (other) { - var redefinition; - if (kind === "init") { - redefinition = this.strict && other.init || other.get || other.set; - } else { - redefinition = other.init || other[kind]; - } - if (redefinition) { - this.raiseRecoverable(key.start, "Redefinition of property"); - } - } else { - other = propHash[name2] = { - init: false, - get: false, - set: false - }; - } - other[kind] = true; -}; -pp$5.parseExpression = function(forInit, refDestructuringErrors) { - var startPos = this.start, startLoc = this.startLoc; - var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); - if (this.type === types$1.comma) { - var node = this.startNodeAt(startPos, startLoc); - node.expressions = [expr]; - while (this.eat(types$1.comma)) { - node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); - } - return this.finishNode(node, "SequenceExpression"); - } - return expr; -}; -pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) { - if (this.isContextual("yield")) { - if (this.inGenerator) { - return this.parseYield(forInit); - } else { - this.exprAllowed = false; - } - } - var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1; - if (refDestructuringErrors) { - oldParenAssign = refDestructuringErrors.parenthesizedAssign; - oldTrailingComma = refDestructuringErrors.trailingComma; - oldDoubleProto = refDestructuringErrors.doubleProto; - refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; - } else { - refDestructuringErrors = new DestructuringErrors(); - ownDestructuringErrors = true; - } - var startPos = this.start, startLoc = this.startLoc; - if (this.type === types$1.parenL || this.type === types$1.name) { - this.potentialArrowAt = this.start; - this.potentialArrowInForAwait = forInit === "await"; - } - var left = this.parseMaybeConditional(forInit, refDestructuringErrors); - if (afterLeftParse) { - left = afterLeftParse.call(this, left, startPos, startLoc); - } - if (this.type.isAssign) { - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.value; - if (this.type === types$1.eq) { - left = this.toAssignable(left, false, refDestructuringErrors); - } - if (!ownDestructuringErrors) { - refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; - } - if (refDestructuringErrors.shorthandAssign >= left.start) { - refDestructuringErrors.shorthandAssign = -1; - } - if (this.type === types$1.eq) { - this.checkLValPattern(left); - } else { - this.checkLValSimple(left); - } - node.left = left; - this.next(); - node.right = this.parseMaybeAssign(forInit); - if (oldDoubleProto > -1) { - refDestructuringErrors.doubleProto = oldDoubleProto; - } - return this.finishNode(node, "AssignmentExpression"); - } else { - if (ownDestructuringErrors) { - this.checkExpressionErrors(refDestructuringErrors, true); - } - } - if (oldParenAssign > -1) { - refDestructuringErrors.parenthesizedAssign = oldParenAssign; - } - if (oldTrailingComma > -1) { - refDestructuringErrors.trailingComma = oldTrailingComma; - } - return left; -}; -pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) { - var startPos = this.start, startLoc = this.startLoc; - var expr = this.parseExprOps(forInit, refDestructuringErrors); - if (this.checkExpressionErrors(refDestructuringErrors)) { - return expr; - } - if (this.eat(types$1.question)) { - var node = this.startNodeAt(startPos, startLoc); - node.test = expr; - node.consequent = this.parseMaybeAssign(); - this.expect(types$1.colon); - node.alternate = this.parseMaybeAssign(forInit); - return this.finishNode(node, "ConditionalExpression"); - } - return expr; -}; -pp$5.parseExprOps = function(forInit, refDestructuringErrors) { - var startPos = this.start, startLoc = this.startLoc; - var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit); - if (this.checkExpressionErrors(refDestructuringErrors)) { - return expr; - } - return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit); -}; -pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) { - var prec = this.type.binop; - if (prec != null && (!forInit || this.type !== types$1._in)) { - if (prec > minPrec) { - var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND; - var coalesce = this.type === types$1.coalesce; - if (coalesce) { - prec = types$1.logicalAND.binop; - } - var op = this.value; - this.next(); - var startPos = this.start, startLoc = this.startLoc; - var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); - var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); - if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) { - this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); - } - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit); - } - } - return left; -}; -pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) { - if (right.type === "PrivateIdentifier") { - this.raise(right.start, "Private identifier can only be left side of binary expression"); - } - var node = this.startNodeAt(startPos, startLoc); - node.left = left; - node.operator = op; - node.right = right; - return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression"); -}; -pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) { - var startPos = this.start, startLoc = this.startLoc, expr; - if (this.isContextual("await") && this.canAwait) { - expr = this.parseAwait(forInit); - sawUnary = true; - } else if (this.type.prefix) { - var node = this.startNode(), update = this.type === types$1.incDec; - node.operator = this.value; - node.prefix = true; - this.next(); - node.argument = this.parseMaybeUnary(null, true, update, forInit); - this.checkExpressionErrors(refDestructuringErrors, true); - if (update) { - this.checkLValSimple(node.argument); - } else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") { - this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); - } else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) { - this.raiseRecoverable(node.start, "Private fields can not be deleted"); - } else { - sawUnary = true; - } - expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); - } else if (!sawUnary && this.type === types$1.privateId) { - if (forInit || this.privateNameStack.length === 0) { - this.unexpected(); - } - expr = this.parsePrivateIdent(); - if (this.type !== types$1._in) { - this.unexpected(); - } - } else { - expr = this.parseExprSubscripts(refDestructuringErrors, forInit); - if (this.checkExpressionErrors(refDestructuringErrors)) { - return expr; - } - while (this.type.postfix && !this.canInsertSemicolon()) { - var node$1 = this.startNodeAt(startPos, startLoc); - node$1.operator = this.value; - node$1.prefix = false; - node$1.argument = expr; - this.checkLValSimple(expr); - this.next(); - expr = this.finishNode(node$1, "UpdateExpression"); - } - } - if (!incDec && this.eat(types$1.starstar)) { - if (sawUnary) { - this.unexpected(this.lastTokStart); - } else { - return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false); - } - } else { - return expr; - } -}; -function isPrivateFieldAccess(node) { - return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression); -} -pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) { - var startPos = this.start, startLoc = this.startLoc; - var expr = this.parseExprAtom(refDestructuringErrors, forInit); - if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") { - return expr; - } - var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit); - if (refDestructuringErrors && result.type === "MemberExpression") { - if (refDestructuringErrors.parenthesizedAssign >= result.start) { - refDestructuringErrors.parenthesizedAssign = -1; - } - if (refDestructuringErrors.parenthesizedBind >= result.start) { - refDestructuringErrors.parenthesizedBind = -1; - } - if (refDestructuringErrors.trailingComma >= result.start) { - refDestructuringErrors.trailingComma = -1; - } - } - return result; -}; -pp$5.parseSubscripts = function(base2, startPos, startLoc, noCalls, forInit) { - var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base2.type === "Identifier" && base2.name === "async" && this.lastTokEnd === base2.end && !this.canInsertSemicolon() && base2.end - base2.start === 5 && this.potentialArrowAt === base2.start; - var optionalChained = false; - while (true) { - var element2 = this.parseSubscript(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); - if (element2.optional) { - optionalChained = true; - } - if (element2 === base2 || element2.type === "ArrowFunctionExpression") { - if (optionalChained) { - var chainNode = this.startNodeAt(startPos, startLoc); - chainNode.expression = element2; - element2 = this.finishNode(chainNode, "ChainExpression"); - } - return element2; - } - base2 = element2; - } -}; -pp$5.parseSubscript = function(base2, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { - var optionalSupported = this.options.ecmaVersion >= 11; - var optional = optionalSupported && this.eat(types$1.questionDot); - if (noCalls && optional) { - this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); - } - var computed = this.eat(types$1.bracketL); - if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base2; - if (computed) { - node.property = this.parseExpression(); - this.expect(types$1.bracketR); - } else if (this.type === types$1.privateId && base2.type !== "Super") { - node.property = this.parsePrivateIdent(); - } else { - node.property = this.parseIdent(this.options.allowReserved !== "never"); - } - node.computed = !!computed; - if (optionalSupported) { - node.optional = optional; - } - base2 = this.finishNode(node, "MemberExpression"); - } else if (!noCalls && this.eat(types$1.parenL)) { - var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.yieldPos = 0; - this.awaitPos = 0; - this.awaitIdentPos = 0; - var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); - if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { - this.checkPatternErrors(refDestructuringErrors, false); - this.checkYieldAwaitInDefaultParams(); - if (this.awaitIdentPos > 0) { - this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); - } - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - this.awaitIdentPos = oldAwaitIdentPos; - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit); - } - this.checkExpressionErrors(refDestructuringErrors, true); - this.yieldPos = oldYieldPos || this.yieldPos; - this.awaitPos = oldAwaitPos || this.awaitPos; - this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; - var node$1 = this.startNodeAt(startPos, startLoc); - node$1.callee = base2; - node$1.arguments = exprList; - if (optionalSupported) { - node$1.optional = optional; - } - base2 = this.finishNode(node$1, "CallExpression"); - } else if (this.type === types$1.backQuote) { - if (optional || optionalChained) { - this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); - } - var node$2 = this.startNodeAt(startPos, startLoc); - node$2.tag = base2; - node$2.quasi = this.parseTemplate({ isTagged: true }); - base2 = this.finishNode(node$2, "TaggedTemplateExpression"); - } - return base2; -}; -pp$5.parseExprAtom = function(refDestructuringErrors, forInit) { - if (this.type === types$1.slash) { - this.readRegexp(); - } - var node, canBeArrow = this.potentialArrowAt === this.start; - switch (this.type) { - case types$1._super: - if (!this.allowSuper) { - this.raise(this.start, "'super' keyword outside a method"); - } - node = this.startNode(); - this.next(); - if (this.type === types$1.parenL && !this.allowDirectSuper) { - this.raise(node.start, "super() call outside constructor of a subclass"); - } - if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) { - this.unexpected(); - } - return this.finishNode(node, "Super"); - case types$1._this: - node = this.startNode(); - this.next(); - return this.finishNode(node, "ThisExpression"); - case types$1.name: - var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; - var id = this.parseIdent(false); - if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { - this.overrideContext(types.f_expr); - return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit); - } - if (canBeArrow && !this.canInsertSemicolon()) { - if (this.eat(types$1.arrow)) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit); - } - if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { - id = this.parseIdent(false); - if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) { - this.unexpected(); - } - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit); - } - } - return id; - case types$1.regexp: - var value = this.value; - node = this.parseLiteral(value.value); - node.regex = { pattern: value.pattern, flags: value.flags }; - return node; - case types$1.num: - case types$1.string: - return this.parseLiteral(this.value); - case types$1._null: - case types$1._true: - case types$1._false: - node = this.startNode(); - node.value = this.type === types$1._null ? null : this.type === types$1._true; - node.raw = this.type.keyword; - this.next(); - return this.finishNode(node, "Literal"); - case types$1.parenL: - var start3 = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); - if (refDestructuringErrors) { - if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) { - refDestructuringErrors.parenthesizedAssign = start3; - } - if (refDestructuringErrors.parenthesizedBind < 0) { - refDestructuringErrors.parenthesizedBind = start3; - } - } - return expr; - case types$1.bracketL: - node = this.startNode(); - this.next(); - node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); - return this.finishNode(node, "ArrayExpression"); - case types$1.braceL: - this.overrideContext(types.b_expr); - return this.parseObj(false, refDestructuringErrors); - case types$1._function: - node = this.startNode(); - this.next(); - return this.parseFunction(node, 0); - case types$1._class: - return this.parseClass(this.startNode(), false); - case types$1._new: - return this.parseNew(); - case types$1.backQuote: - return this.parseTemplate(); - case types$1._import: - if (this.options.ecmaVersion >= 11) { - return this.parseExprImport(); - } else { - return this.unexpected(); - } - default: - this.unexpected(); - } -}; -pp$5.parseExprImport = function() { - var node = this.startNode(); - if (this.containsEsc) { - this.raiseRecoverable(this.start, "Escape sequence in keyword import"); - } - var meta = this.parseIdent(true); - switch (this.type) { - case types$1.parenL: - return this.parseDynamicImport(node); - case types$1.dot: - node.meta = meta; - return this.parseImportMeta(node); - default: - this.unexpected(); - } -}; -pp$5.parseDynamicImport = function(node) { - this.next(); - node.source = this.parseMaybeAssign(); - if (!this.eat(types$1.parenR)) { - var errorPos = this.start; - if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { - this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); - } else { - this.unexpected(errorPos); - } - } - return this.finishNode(node, "ImportExpression"); -}; -pp$5.parseImportMeta = function(node) { - this.next(); - var containsEsc = this.containsEsc; - node.property = this.parseIdent(true); - if (node.property.name !== "meta") { - this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); - } - if (containsEsc) { - this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); - } - if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) { - this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); - } - return this.finishNode(node, "MetaProperty"); -}; -pp$5.parseLiteral = function(value) { - var node = this.startNode(); - node.value = value; - node.raw = this.input.slice(this.start, this.end); - if (node.raw.charCodeAt(node.raw.length - 1) === 110) { - node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); - } - this.next(); - return this.finishNode(node, "Literal"); -}; -pp$5.parseParenExpression = function() { - this.expect(types$1.parenL); - var val = this.parseExpression(); - this.expect(types$1.parenR); - return val; -}; -pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) { - var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8; - if (this.options.ecmaVersion >= 6) { - this.next(); - var innerStartPos = this.start, innerStartLoc = this.startLoc; - var exprList = [], first = true, lastIsComma = false; - var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart; - this.yieldPos = 0; - this.awaitPos = 0; - while (this.type !== types$1.parenR) { - first ? first = false : this.expect(types$1.comma); - if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) { - lastIsComma = true; - break; - } else if (this.type === types$1.ellipsis) { - spreadStart = this.start; - exprList.push(this.parseParenItem(this.parseRestBinding())); - if (this.type === types$1.comma) { - this.raise(this.start, "Comma is not permitted after the rest element"); - } - break; - } else { - exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem)); - } - } - var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc; - this.expect(types$1.parenR); - if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { - this.checkPatternErrors(refDestructuringErrors, false); - this.checkYieldAwaitInDefaultParams(); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - return this.parseParenArrowList(startPos, startLoc, exprList, forInit); - } - if (!exprList.length || lastIsComma) { - this.unexpected(this.lastTokStart); - } - if (spreadStart) { - this.unexpected(spreadStart); - } - this.checkExpressionErrors(refDestructuringErrors, true); - this.yieldPos = oldYieldPos || this.yieldPos; - this.awaitPos = oldAwaitPos || this.awaitPos; - if (exprList.length > 1) { - val = this.startNodeAt(innerStartPos, innerStartLoc); - val.expressions = exprList; - this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); - } else { - val = exprList[0]; - } - } else { - val = this.parseParenExpression(); - } - if (this.options.preserveParens) { - var par = this.startNodeAt(startPos, startLoc); - par.expression = val; - return this.finishNode(par, "ParenthesizedExpression"); - } else { - return val; - } -}; -pp$5.parseParenItem = function(item) { - return item; -}; -pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit); -}; -var empty = []; -pp$5.parseNew = function() { - if (this.containsEsc) { - this.raiseRecoverable(this.start, "Escape sequence in keyword new"); - } - var node = this.startNode(); - var meta = this.parseIdent(true); - if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) { - node.meta = meta; - var containsEsc = this.containsEsc; - node.property = this.parseIdent(true); - if (node.property.name !== "target") { - this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); - } - if (containsEsc) { - this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); - } - if (!this.allowNewDotTarget) { - this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); - } - return this.finishNode(node, "MetaProperty"); - } - var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import; - node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false); - if (isImport && node.callee.type === "ImportExpression") { - this.raise(startPos, "Cannot use new with import()"); - } - if (this.eat(types$1.parenL)) { - node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); - } else { - node.arguments = empty; - } - return this.finishNode(node, "NewExpression"); -}; -pp$5.parseTemplateElement = function(ref2) { - var isTagged = ref2.isTagged; - var elem = this.startNode(); - if (this.type === types$1.invalidTemplate) { - if (!isTagged) { - this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"); - } - elem.value = { - raw: this.value, - cooked: null - }; - } else { - elem.value = { - raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"), - cooked: this.value - }; - } - this.next(); - elem.tail = this.type === types$1.backQuote; - return this.finishNode(elem, "TemplateElement"); -}; -pp$5.parseTemplate = function(ref2) { - if (ref2 === void 0) - ref2 = {}; - var isTagged = ref2.isTagged; - if (isTagged === void 0) - isTagged = false; - var node = this.startNode(); - this.next(); - node.expressions = []; - var curElt = this.parseTemplateElement({ isTagged }); - node.quasis = [curElt]; - while (!curElt.tail) { - if (this.type === types$1.eof) { - this.raise(this.pos, "Unterminated template literal"); - } - this.expect(types$1.dollarBraceL); - node.expressions.push(this.parseExpression()); - this.expect(types$1.braceR); - node.quasis.push(curElt = this.parseTemplateElement({ isTagged })); - } - this.next(); - return this.finishNode(node, "TemplateLiteral"); -}; -pp$5.isAsyncProp = function(prop) { - return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (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) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); -}; -pp$5.parseObj = function(isPattern, refDestructuringErrors) { - var node = this.startNode(), first = true, propHash = {}; - node.properties = []; - this.next(); - while (!this.eat(types$1.braceR)) { - if (!first) { - this.expect(types$1.comma); - if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { - break; - } - } else { - first = false; - } - var prop = this.parseProperty(isPattern, refDestructuringErrors); - if (!isPattern) { - this.checkPropClash(prop, propHash, refDestructuringErrors); - } - node.properties.push(prop); - } - return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); -}; -pp$5.parseProperty = function(isPattern, refDestructuringErrors) { - var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; - if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) { - if (isPattern) { - prop.argument = this.parseIdent(false); - if (this.type === types$1.comma) { - this.raise(this.start, "Comma is not permitted after the rest element"); - } - return this.finishNode(prop, "RestElement"); - } - prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); - if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { - refDestructuringErrors.trailingComma = this.start; - } - return this.finishNode(prop, "SpreadElement"); - } - if (this.options.ecmaVersion >= 6) { - prop.method = false; - prop.shorthand = false; - if (isPattern || refDestructuringErrors) { - startPos = this.start; - startLoc = this.startLoc; - } - if (!isPattern) { - isGenerator = this.eat(types$1.star); - } - } - var containsEsc = this.containsEsc; - this.parsePropertyName(prop); - if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { - isAsync = true; - isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star); - this.parsePropertyName(prop, refDestructuringErrors); - } else { - isAsync = false; - } - this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); - return this.finishNode(prop, "Property"); -}; -pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { - if ((isGenerator || isAsync) && this.type === types$1.colon) { - this.unexpected(); - } - if (this.eat(types$1.colon)) { - prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); - prop.kind = "init"; - } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) { - if (isPattern) { - this.unexpected(); - } - prop.kind = "init"; - prop.method = true; - prop.value = this.parseMethod(isGenerator, isAsync); - } else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) { - if (isGenerator || isAsync) { - this.unexpected(); - } - prop.kind = prop.key.name; - this.parsePropertyName(prop); - prop.value = this.parseMethod(false); - var paramCount = prop.kind === "get" ? 0 : 1; - if (prop.value.params.length !== paramCount) { - var start3 = prop.value.start; - if (prop.kind === "get") { - this.raiseRecoverable(start3, "getter should have no params"); - } else { - this.raiseRecoverable(start3, "setter should have exactly one param"); - } - } else { - if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { - this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); - } - } - } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { - if (isGenerator || isAsync) { - this.unexpected(); - } - this.checkUnreserved(prop.key); - if (prop.key.name === "await" && !this.awaitIdentPos) { - this.awaitIdentPos = startPos; - } - prop.kind = "init"; - if (isPattern) { - prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); - } else if (this.type === types$1.eq && refDestructuringErrors) { - if (refDestructuringErrors.shorthandAssign < 0) { - refDestructuringErrors.shorthandAssign = this.start; - } - prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); - } else { - prop.value = this.copyNode(prop.key); - } - prop.shorthand = true; - } else { - this.unexpected(); - } -}; -pp$5.parsePropertyName = function(prop) { - if (this.options.ecmaVersion >= 6) { - if (this.eat(types$1.bracketL)) { - prop.computed = true; - prop.key = this.parseMaybeAssign(); - this.expect(types$1.bracketR); - return prop.key; - } else { - prop.computed = false; - } - } - return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); -}; -pp$5.initFunction = function(node) { - node.id = null; - if (this.options.ecmaVersion >= 6) { - node.generator = node.expression = false; - } - if (this.options.ecmaVersion >= 8) { - node.async = false; - } -}; -pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { - var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.initFunction(node); - if (this.options.ecmaVersion >= 6) { - node.generator = isGenerator; - } - if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; - } - this.yieldPos = 0; - this.awaitPos = 0; - this.awaitIdentPos = 0; - this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); - this.expect(types$1.parenL); - node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); - this.checkYieldAwaitInDefaultParams(); - this.parseFunctionBody(node, false, true, false); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, "FunctionExpression"); -}; -pp$5.parseArrowExpression = function(node, params, isAsync, forInit) { - var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); - this.initFunction(node); - if (this.options.ecmaVersion >= 8) { - node.async = !!isAsync; - } - this.yieldPos = 0; - this.awaitPos = 0; - this.awaitIdentPos = 0; - node.params = this.toAssignableList(params, true); - this.parseFunctionBody(node, true, false, forInit); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - this.awaitIdentPos = oldAwaitIdentPos; - return this.finishNode(node, "ArrowFunctionExpression"); -}; -pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { - var isExpression = isArrowFunction && this.type !== types$1.braceL; - var oldStrict = this.strict, useStrict = false; - if (isExpression) { - node.body = this.parseMaybeAssign(forInit); - node.expression = true; - this.checkParams(node, false); - } else { - var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params); - if (!oldStrict || nonSimple) { - useStrict = this.strictDirective(this.end); - if (useStrict && nonSimple) { - this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); - } - } - var oldLabels = this.labels; - this.labels = []; - if (useStrict) { - this.strict = true; - } - this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); - if (this.strict && node.id) { - this.checkLValSimple(node.id, BIND_OUTSIDE); - } - node.body = this.parseBlock(false, void 0, useStrict && !oldStrict); - node.expression = false; - this.adaptDirectivePrologue(node.body.body); - this.labels = oldLabels; - } - this.exitScope(); -}; -pp$5.isSimpleParamList = function(params) { - for (var i = 0, list3 = params; i < list3.length; i += 1) { - var param = list3[i]; - if (param.type !== "Identifier") { - return false; - } - } - return true; -}; -pp$5.checkParams = function(node, allowDuplicates) { - var nameHash = /* @__PURE__ */ Object.create(null); - for (var i = 0, list3 = node.params; i < list3.length; i += 1) { - var param = list3[i]; - this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); - } -}; -pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { - var elts = [], first = true; - while (!this.eat(close)) { - if (!first) { - this.expect(types$1.comma); - if (allowTrailingComma && this.afterTrailingComma(close)) { - break; - } - } else { - first = false; - } - var elt = void 0; - if (allowEmpty && this.type === types$1.comma) { - elt = null; - } else if (this.type === types$1.ellipsis) { - elt = this.parseSpread(refDestructuringErrors); - if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) { - refDestructuringErrors.trailingComma = this.start; - } - } else { - elt = this.parseMaybeAssign(false, refDestructuringErrors); - } - elts.push(elt); - } - return elts; -}; -pp$5.checkUnreserved = function(ref2) { - var start3 = ref2.start; - var end = ref2.end; - var name2 = ref2.name; - if (this.inGenerator && name2 === "yield") { - this.raiseRecoverable(start3, "Cannot use 'yield' as identifier inside a generator"); - } - if (this.inAsync && name2 === "await") { - this.raiseRecoverable(start3, "Cannot use 'await' as identifier inside an async function"); - } - if (this.currentThisScope().inClassFieldInit && name2 === "arguments") { - this.raiseRecoverable(start3, "Cannot use 'arguments' in class field initializer"); - } - if (this.inClassStaticBlock && (name2 === "arguments" || name2 === "await")) { - this.raise(start3, "Cannot use " + name2 + " in class static initialization block"); - } - if (this.keywords.test(name2)) { - this.raise(start3, "Unexpected keyword '" + name2 + "'"); - } - if (this.options.ecmaVersion < 6 && this.input.slice(start3, end).indexOf("\\") !== -1) { - return; - } - var re = this.strict ? this.reservedWordsStrict : this.reservedWords; - if (re.test(name2)) { - if (!this.inAsync && name2 === "await") { - this.raiseRecoverable(start3, "Cannot use keyword 'await' outside an async function"); - } - this.raiseRecoverable(start3, "The keyword '" + name2 + "' is reserved"); - } -}; -pp$5.parseIdent = function(liberal, isBinding) { - var node = this.startNode(); - if (this.type === types$1.name) { - node.name = this.value; - } else if (this.type.keyword) { - node.name = this.type.keyword; - if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { - this.context.pop(); - } - } else { - this.unexpected(); - } - this.next(!!liberal); - this.finishNode(node, "Identifier"); - if (!liberal) { - this.checkUnreserved(node); - if (node.name === "await" && !this.awaitIdentPos) { - this.awaitIdentPos = node.start; - } - } - return node; -}; -pp$5.parsePrivateIdent = function() { - var node = this.startNode(); - if (this.type === types$1.privateId) { - node.name = this.value; - } else { - this.unexpected(); - } - this.next(); - this.finishNode(node, "PrivateIdentifier"); - if (this.privateNameStack.length === 0) { - this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class"); - } else { - this.privateNameStack[this.privateNameStack.length - 1].used.push(node); - } - return node; -}; -pp$5.parseYield = function(forInit) { - if (!this.yieldPos) { - this.yieldPos = this.start; - } - var node = this.startNode(); - this.next(); - if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) { - node.delegate = false; - node.argument = null; - } else { - node.delegate = this.eat(types$1.star); - node.argument = this.parseMaybeAssign(forInit); - } - return this.finishNode(node, "YieldExpression"); -}; -pp$5.parseAwait = function(forInit) { - if (!this.awaitPos) { - this.awaitPos = this.start; - } - var node = this.startNode(); - this.next(); - node.argument = this.parseMaybeUnary(null, true, false, forInit); - return this.finishNode(node, "AwaitExpression"); -}; -var pp$4 = Parser.prototype; -pp$4.raise = function(pos, message) { - var loc = getLineInfo(this.input, pos); - message += " (" + loc.line + ":" + loc.column + ")"; - var err = new SyntaxError(message); - err.pos = pos; - err.loc = loc; - err.raisedAt = this.pos; - throw err; -}; -pp$4.raiseRecoverable = pp$4.raise; -pp$4.curPosition = function() { - if (this.options.locations) { - return new Position(this.curLine, this.pos - this.lineStart); - } -}; -var pp$3 = Parser.prototype; -var Scope = function Scope2(flags) { - this.flags = flags; - this.var = []; - this.lexical = []; - this.functions = []; - this.inClassFieldInit = false; -}; -pp$3.enterScope = function(flags) { - this.scopeStack.push(new Scope(flags)); -}; -pp$3.exitScope = function() { - this.scopeStack.pop(); -}; -pp$3.treatFunctionsAsVarInScope = function(scope) { - return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP; -}; -pp$3.declareName = function(name2, bindingType, pos) { - var redeclared = false; - if (bindingType === BIND_LEXICAL) { - var scope = this.currentScope(); - redeclared = scope.lexical.indexOf(name2) > -1 || scope.functions.indexOf(name2) > -1 || scope.var.indexOf(name2) > -1; - scope.lexical.push(name2); - if (this.inModule && scope.flags & SCOPE_TOP) { - delete this.undefinedExports[name2]; - } - } else if (bindingType === BIND_SIMPLE_CATCH) { - var scope$1 = this.currentScope(); - scope$1.lexical.push(name2); - } else if (bindingType === BIND_FUNCTION) { - var scope$2 = this.currentScope(); - if (this.treatFunctionsAsVar) { - redeclared = scope$2.lexical.indexOf(name2) > -1; - } else { - redeclared = scope$2.lexical.indexOf(name2) > -1 || scope$2.var.indexOf(name2) > -1; - } - scope$2.functions.push(name2); - } else { - for (var i = this.scopeStack.length - 1; i >= 0; --i) { - var scope$3 = this.scopeStack[i]; - if (scope$3.lexical.indexOf(name2) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name2) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name2) > -1) { - redeclared = true; - break; - } - scope$3.var.push(name2); - if (this.inModule && scope$3.flags & SCOPE_TOP) { - delete this.undefinedExports[name2]; - } - if (scope$3.flags & SCOPE_VAR) { - break; - } - } - } - if (redeclared) { - this.raiseRecoverable(pos, "Identifier '" + name2 + "' has already been declared"); - } -}; -pp$3.checkLocalExport = function(id) { - if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1) { - this.undefinedExports[id.name] = id; - } -}; -pp$3.currentScope = function() { - return this.scopeStack[this.scopeStack.length - 1]; -}; -pp$3.currentVarScope = function() { - for (var i = this.scopeStack.length - 1; ; i--) { - var scope = this.scopeStack[i]; - if (scope.flags & SCOPE_VAR) { - return scope; - } - } -}; -pp$3.currentThisScope = function() { - for (var i = this.scopeStack.length - 1; ; i--) { - var scope = this.scopeStack[i]; - if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { - return scope; - } - } -}; -var Node = function Node2(parser, pos, loc) { - this.type = ""; - this.start = pos; - this.end = 0; - if (parser.options.locations) { - this.loc = new SourceLocation(parser, loc); - } - if (parser.options.directSourceFile) { - this.sourceFile = parser.options.directSourceFile; - } - if (parser.options.ranges) { - this.range = [pos, 0]; - } -}; -var pp$2 = Parser.prototype; -pp$2.startNode = function() { - return new Node(this, this.start, this.startLoc); -}; -pp$2.startNodeAt = function(pos, loc) { - return new Node(this, pos, loc); -}; -function finishNodeAt(node, type, pos, loc) { - node.type = type; - node.end = pos; - if (this.options.locations) { - node.loc.end = loc; - } - if (this.options.ranges) { - node.range[1] = pos; - } - return node; -} -pp$2.finishNode = function(node, type) { - return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc); -}; -pp$2.finishNodeAt = function(node, type, pos, loc) { - return finishNodeAt.call(this, node, type, pos, loc); -}; -pp$2.copyNode = function(node) { - var newNode = new Node(this, node.start, this.startLoc); - for (var prop in node) { - newNode[prop] = node[prop]; - } - return newNode; -}; -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"; -var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; -var ecma11BinaryProperties = ecma10BinaryProperties; -var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict"; -var ecma13BinaryProperties = ecma12BinaryProperties; -var unicodeBinaryProperties = { - 9: ecma9BinaryProperties, - 10: ecma10BinaryProperties, - 11: ecma11BinaryProperties, - 12: ecma12BinaryProperties, - 13: ecma13BinaryProperties -}; -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"; -var 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"; -var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; -var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; -var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; -var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith"; -var unicodeScriptValues = { - 9: ecma9ScriptValues, - 10: ecma10ScriptValues, - 11: ecma11ScriptValues, - 12: ecma12ScriptValues, - 13: ecma13ScriptValues -}; -var data = {}; -function buildUnicodeData(ecmaVersion) { - var d = data[ecmaVersion] = { - binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), - nonBinary: { - General_Category: wordsRegexp(unicodeGeneralCategoryValues), - Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) - } - }; - d.nonBinary.Script_Extensions = d.nonBinary.Script; - d.nonBinary.gc = d.nonBinary.General_Category; - d.nonBinary.sc = d.nonBinary.Script; - d.nonBinary.scx = d.nonBinary.Script_Extensions; -} -for (i = 0, list3 = [9, 10, 11, 12, 13]; i < list3.length; i += 1) { - ecmaVersion = list3[i]; - buildUnicodeData(ecmaVersion); -} -var ecmaVersion; -var i; -var list3; -var pp$1 = Parser.prototype; -var RegExpValidationState = function RegExpValidationState2(parser) { - this.parser = parser; - this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : ""); - this.unicodeProperties = data[parser.options.ecmaVersion >= 13 ? 13 : parser.options.ecmaVersion]; - this.source = ""; - this.flags = ""; - this.start = 0; - this.switchU = false; - this.switchN = false; - this.pos = 0; - this.lastIntValue = 0; - this.lastStringValue = ""; - this.lastAssertionIsQuantifiable = false; - this.numCapturingParens = 0; - this.maxBackReference = 0; - this.groupNames = []; - this.backReferenceNames = []; -}; -RegExpValidationState.prototype.reset = function reset(start3, pattern, flags) { - var unicode = flags.indexOf("u") !== -1; - this.start = start3 | 0; - this.source = pattern + ""; - this.flags = flags; - this.switchU = unicode && this.parser.options.ecmaVersion >= 6; - this.switchN = unicode && this.parser.options.ecmaVersion >= 9; -}; -RegExpValidationState.prototype.raise = function raise(message) { - this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message); -}; -RegExpValidationState.prototype.at = function at(i, forceU) { - if (forceU === void 0) - forceU = false; - var s = this.source; - var l = s.length; - if (i >= l) { - return -1; - } - var c = s.charCodeAt(i); - if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l) { - return c; - } - var next = s.charCodeAt(i + 1); - return next >= 56320 && next <= 57343 ? (c << 10) + next - 56613888 : c; -}; -RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) { - if (forceU === void 0) - forceU = false; - var s = this.source; - var l = s.length; - if (i >= l) { - return l; - } - var c = s.charCodeAt(i), next; - if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 56320 || next > 57343) { - return i + 1; - } - return i + 2; -}; -RegExpValidationState.prototype.current = function current(forceU) { - if (forceU === void 0) - forceU = false; - return this.at(this.pos, forceU); -}; -RegExpValidationState.prototype.lookahead = function lookahead(forceU) { - if (forceU === void 0) - forceU = false; - return this.at(this.nextIndex(this.pos, forceU), forceU); -}; -RegExpValidationState.prototype.advance = function advance(forceU) { - if (forceU === void 0) - forceU = false; - this.pos = this.nextIndex(this.pos, forceU); -}; -RegExpValidationState.prototype.eat = function eat(ch, forceU) { - if (forceU === void 0) - forceU = false; - if (this.current(forceU) === ch) { - this.advance(forceU); - return true; - } - return false; -}; -pp$1.validateRegExpFlags = function(state) { - var validFlags = state.validFlags; - var flags = state.flags; - for (var i = 0; i < flags.length; i++) { - var flag = flags.charAt(i); - if (validFlags.indexOf(flag) === -1) { - this.raise(state.start, "Invalid regular expression flag"); - } - if (flags.indexOf(flag, i + 1) > -1) { - this.raise(state.start, "Duplicate regular expression flag"); - } - } -}; -pp$1.validateRegExpPattern = function(state) { - this.regexp_pattern(state); - if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) { - state.switchN = true; - this.regexp_pattern(state); - } -}; -pp$1.regexp_pattern = function(state) { - state.pos = 0; - state.lastIntValue = 0; - state.lastStringValue = ""; - state.lastAssertionIsQuantifiable = false; - state.numCapturingParens = 0; - state.maxBackReference = 0; - state.groupNames.length = 0; - state.backReferenceNames.length = 0; - this.regexp_disjunction(state); - if (state.pos !== state.source.length) { - if (state.eat(41)) { - state.raise("Unmatched ')'"); - } - if (state.eat(93) || state.eat(125)) { - state.raise("Lone quantifier brackets"); - } - } - if (state.maxBackReference > state.numCapturingParens) { - state.raise("Invalid escape"); - } - for (var i = 0, list3 = state.backReferenceNames; i < list3.length; i += 1) { - var name2 = list3[i]; - if (state.groupNames.indexOf(name2) === -1) { - state.raise("Invalid named capture referenced"); - } - } -}; -pp$1.regexp_disjunction = function(state) { - this.regexp_alternative(state); - while (state.eat(124)) { - this.regexp_alternative(state); - } - if (this.regexp_eatQuantifier(state, true)) { - state.raise("Nothing to repeat"); - } - if (state.eat(123)) { - state.raise("Lone quantifier brackets"); - } -}; -pp$1.regexp_alternative = function(state) { - while (state.pos < state.source.length && this.regexp_eatTerm(state)) { - } -}; -pp$1.regexp_eatTerm = function(state) { - if (this.regexp_eatAssertion(state)) { - if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) { - if (state.switchU) { - state.raise("Invalid quantifier"); - } - } - return true; - } - if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) { - this.regexp_eatQuantifier(state); - return true; - } - return false; -}; -pp$1.regexp_eatAssertion = function(state) { - var start3 = state.pos; - state.lastAssertionIsQuantifiable = false; - if (state.eat(94) || state.eat(36)) { - return true; - } - if (state.eat(92)) { - if (state.eat(66) || state.eat(98)) { - return true; - } - state.pos = start3; - } - if (state.eat(40) && state.eat(63)) { - var lookbehind = false; - if (this.options.ecmaVersion >= 9) { - lookbehind = state.eat(60); - } - if (state.eat(61) || state.eat(33)) { - this.regexp_disjunction(state); - if (!state.eat(41)) { - state.raise("Unterminated group"); - } - state.lastAssertionIsQuantifiable = !lookbehind; - return true; - } - } - state.pos = start3; - return false; -}; -pp$1.regexp_eatQuantifier = function(state, noError) { - if (noError === void 0) - noError = false; - if (this.regexp_eatQuantifierPrefix(state, noError)) { - state.eat(63); - return true; - } - return false; -}; -pp$1.regexp_eatQuantifierPrefix = function(state, noError) { - return state.eat(42) || state.eat(43) || state.eat(63) || this.regexp_eatBracedQuantifier(state, noError); -}; -pp$1.regexp_eatBracedQuantifier = function(state, noError) { - var start3 = state.pos; - if (state.eat(123)) { - var min = 0, max = -1; - if (this.regexp_eatDecimalDigits(state)) { - min = state.lastIntValue; - if (state.eat(44) && this.regexp_eatDecimalDigits(state)) { - max = state.lastIntValue; - } - if (state.eat(125)) { - if (max !== -1 && max < min && !noError) { - state.raise("numbers out of order in {} quantifier"); - } - return true; - } - } - if (state.switchU && !noError) { - state.raise("Incomplete quantifier"); - } - state.pos = start3; - } - return false; -}; -pp$1.regexp_eatAtom = function(state) { - return this.regexp_eatPatternCharacters(state) || state.eat(46) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state); -}; -pp$1.regexp_eatReverseSolidusAtomEscape = function(state) { - var start3 = state.pos; - if (state.eat(92)) { - if (this.regexp_eatAtomEscape(state)) { - return true; - } - state.pos = start3; - } - return false; -}; -pp$1.regexp_eatUncapturingGroup = function(state) { - var start3 = state.pos; - if (state.eat(40)) { - if (state.eat(63) && state.eat(58)) { - this.regexp_disjunction(state); - if (state.eat(41)) { - return true; - } - state.raise("Unterminated group"); - } - state.pos = start3; - } - return false; -}; -pp$1.regexp_eatCapturingGroup = function(state) { - if (state.eat(40)) { - if (this.options.ecmaVersion >= 9) { - this.regexp_groupSpecifier(state); - } else if (state.current() === 63) { - state.raise("Invalid group"); - } - this.regexp_disjunction(state); - if (state.eat(41)) { - state.numCapturingParens += 1; - return true; - } - state.raise("Unterminated group"); - } - return false; -}; -pp$1.regexp_eatExtendedAtom = function(state) { - return state.eat(46) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state); -}; -pp$1.regexp_eatInvalidBracedQuantifier = function(state) { - if (this.regexp_eatBracedQuantifier(state, true)) { - state.raise("Nothing to repeat"); - } - return false; -}; -pp$1.regexp_eatSyntaxCharacter = function(state) { - var ch = state.current(); - if (isSyntaxCharacter(ch)) { - state.lastIntValue = ch; - state.advance(); - return true; - } - return false; -}; -function isSyntaxCharacter(ch) { - return ch === 36 || ch >= 40 && ch <= 43 || ch === 46 || ch === 63 || ch >= 91 && ch <= 94 || ch >= 123 && ch <= 125; -} -pp$1.regexp_eatPatternCharacters = function(state) { - var start3 = state.pos; - var ch = 0; - while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) { - state.advance(); - } - return state.pos !== start3; -}; -pp$1.regexp_eatExtendedPatternCharacter = function(state) { - var ch = state.current(); - if (ch !== -1 && ch !== 36 && !(ch >= 40 && ch <= 43) && ch !== 46 && ch !== 63 && ch !== 91 && ch !== 94 && ch !== 124) { - state.advance(); - return true; - } - return false; -}; -pp$1.regexp_groupSpecifier = function(state) { - if (state.eat(63)) { - if (this.regexp_eatGroupName(state)) { - if (state.groupNames.indexOf(state.lastStringValue) !== -1) { - state.raise("Duplicate capture group name"); - } - state.groupNames.push(state.lastStringValue); - return; - } - state.raise("Invalid group"); - } -}; -pp$1.regexp_eatGroupName = function(state) { - state.lastStringValue = ""; - if (state.eat(60)) { - if (this.regexp_eatRegExpIdentifierName(state) && state.eat(62)) { - return true; - } - state.raise("Invalid capture group name"); - } - return false; -}; -pp$1.regexp_eatRegExpIdentifierName = function(state) { - state.lastStringValue = ""; - if (this.regexp_eatRegExpIdentifierStart(state)) { - state.lastStringValue += codePointToString(state.lastIntValue); - while (this.regexp_eatRegExpIdentifierPart(state)) { - state.lastStringValue += codePointToString(state.lastIntValue); - } - return true; - } - return false; -}; -pp$1.regexp_eatRegExpIdentifierStart = function(state) { - var start3 = state.pos; - var forceU = this.options.ecmaVersion >= 11; - var ch = state.current(forceU); - state.advance(forceU); - if (ch === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { - ch = state.lastIntValue; - } - if (isRegExpIdentifierStart(ch)) { - state.lastIntValue = ch; - return true; - } - state.pos = start3; - return false; -}; -function isRegExpIdentifierStart(ch) { - return isIdentifierStart(ch, true) || ch === 36 || ch === 95; -} -pp$1.regexp_eatRegExpIdentifierPart = function(state) { - var start3 = state.pos; - var forceU = this.options.ecmaVersion >= 11; - var ch = state.current(forceU); - state.advance(forceU); - if (ch === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { - ch = state.lastIntValue; - } - if (isRegExpIdentifierPart(ch)) { - state.lastIntValue = ch; - return true; - } - state.pos = start3; - return false; -}; -function isRegExpIdentifierPart(ch) { - return isIdentifierChar(ch, true) || ch === 36 || ch === 95 || ch === 8204 || ch === 8205; -} -pp$1.regexp_eatAtomEscape = function(state) { - if (this.regexp_eatBackReference(state) || this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state) || state.switchN && this.regexp_eatKGroupName(state)) { - return true; - } - if (state.switchU) { - if (state.current() === 99) { - state.raise("Invalid unicode escape"); - } - state.raise("Invalid escape"); - } - return false; -}; -pp$1.regexp_eatBackReference = function(state) { - var start3 = state.pos; - if (this.regexp_eatDecimalEscape(state)) { - var n = state.lastIntValue; - if (state.switchU) { - if (n > state.maxBackReference) { - state.maxBackReference = n; - } - return true; - } - if (n <= state.numCapturingParens) { - return true; - } - state.pos = start3; - } - return false; -}; -pp$1.regexp_eatKGroupName = function(state) { - if (state.eat(107)) { - if (this.regexp_eatGroupName(state)) { - state.backReferenceNames.push(state.lastStringValue); - return true; - } - state.raise("Invalid named reference"); - } - return false; -}; -pp$1.regexp_eatCharacterEscape = function(state) { - return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state); -}; -pp$1.regexp_eatCControlLetter = function(state) { - var start3 = state.pos; - if (state.eat(99)) { - if (this.regexp_eatControlLetter(state)) { - return true; - } - state.pos = start3; - } - return false; -}; -pp$1.regexp_eatZero = function(state) { - if (state.current() === 48 && !isDecimalDigit(state.lookahead())) { - state.lastIntValue = 0; - state.advance(); - return true; - } - return false; -}; -pp$1.regexp_eatControlEscape = function(state) { - var ch = state.current(); - if (ch === 116) { - state.lastIntValue = 9; - state.advance(); - return true; - } - if (ch === 110) { - state.lastIntValue = 10; - state.advance(); - return true; - } - if (ch === 118) { - state.lastIntValue = 11; - state.advance(); - return true; - } - if (ch === 102) { - state.lastIntValue = 12; - state.advance(); - return true; - } - if (ch === 114) { - state.lastIntValue = 13; - state.advance(); - return true; - } - return false; -}; -pp$1.regexp_eatControlLetter = function(state) { - var ch = state.current(); - if (isControlLetter(ch)) { - state.lastIntValue = ch % 32; - state.advance(); - return true; - } - return false; -}; -function isControlLetter(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122; -} -pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) { - if (forceU === void 0) - forceU = false; - var start3 = state.pos; - var switchU = forceU || state.switchU; - if (state.eat(117)) { - if (this.regexp_eatFixedHexDigits(state, 4)) { - var lead = state.lastIntValue; - if (switchU && lead >= 55296 && lead <= 56319) { - var leadSurrogateEnd = state.pos; - if (state.eat(92) && state.eat(117) && this.regexp_eatFixedHexDigits(state, 4)) { - var trail = state.lastIntValue; - if (trail >= 56320 && trail <= 57343) { - state.lastIntValue = (lead - 55296) * 1024 + (trail - 56320) + 65536; - return true; - } - } - state.pos = leadSurrogateEnd; - state.lastIntValue = lead; - } - return true; - } - if (switchU && state.eat(123) && this.regexp_eatHexDigits(state) && state.eat(125) && isValidUnicode(state.lastIntValue)) { - return true; - } - if (switchU) { - state.raise("Invalid unicode escape"); - } - state.pos = start3; - } - return false; -}; -function isValidUnicode(ch) { - return ch >= 0 && ch <= 1114111; -} -pp$1.regexp_eatIdentityEscape = function(state) { - if (state.switchU) { - if (this.regexp_eatSyntaxCharacter(state)) { - return true; - } - if (state.eat(47)) { - state.lastIntValue = 47; - return true; - } - return false; - } - var ch = state.current(); - if (ch !== 99 && (!state.switchN || ch !== 107)) { - state.lastIntValue = ch; - state.advance(); - return true; - } - return false; -}; -pp$1.regexp_eatDecimalEscape = function(state) { - state.lastIntValue = 0; - var ch = state.current(); - if (ch >= 49 && ch <= 57) { - do { - state.lastIntValue = 10 * state.lastIntValue + (ch - 48); - state.advance(); - } while ((ch = state.current()) >= 48 && ch <= 57); - return true; - } - return false; -}; -pp$1.regexp_eatCharacterClassEscape = function(state) { - var ch = state.current(); - if (isCharacterClassEscape(ch)) { - state.lastIntValue = -1; - state.advance(); - return true; - } - if (state.switchU && this.options.ecmaVersion >= 9 && (ch === 80 || ch === 112)) { - state.lastIntValue = -1; - state.advance(); - if (state.eat(123) && this.regexp_eatUnicodePropertyValueExpression(state) && state.eat(125)) { - return true; - } - state.raise("Invalid property name"); - } - return false; -}; -function isCharacterClassEscape(ch) { - return ch === 100 || ch === 68 || ch === 115 || ch === 83 || ch === 119 || ch === 87; -} -pp$1.regexp_eatUnicodePropertyValueExpression = function(state) { - var start3 = state.pos; - if (this.regexp_eatUnicodePropertyName(state) && state.eat(61)) { - var name2 = state.lastStringValue; - if (this.regexp_eatUnicodePropertyValue(state)) { - var value = state.lastStringValue; - this.regexp_validateUnicodePropertyNameAndValue(state, name2, value); - return true; - } - } - state.pos = start3; - if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { - var nameOrValue = state.lastStringValue; - this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); - return true; - } - return false; -}; -pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name2, value) { - if (!hasOwn(state.unicodeProperties.nonBinary, name2)) { - state.raise("Invalid property name"); - } - if (!state.unicodeProperties.nonBinary[name2].test(value)) { - state.raise("Invalid property value"); - } -}; -pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) { - if (!state.unicodeProperties.binary.test(nameOrValue)) { - state.raise("Invalid property name"); - } -}; -pp$1.regexp_eatUnicodePropertyName = function(state) { - var ch = 0; - state.lastStringValue = ""; - while (isUnicodePropertyNameCharacter(ch = state.current())) { - state.lastStringValue += codePointToString(ch); - state.advance(); - } - return state.lastStringValue !== ""; -}; -function isUnicodePropertyNameCharacter(ch) { - return isControlLetter(ch) || ch === 95; -} -pp$1.regexp_eatUnicodePropertyValue = function(state) { - var ch = 0; - state.lastStringValue = ""; - while (isUnicodePropertyValueCharacter(ch = state.current())) { - state.lastStringValue += codePointToString(ch); - state.advance(); - } - return state.lastStringValue !== ""; -}; -function isUnicodePropertyValueCharacter(ch) { - return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch); -} -pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) { - return this.regexp_eatUnicodePropertyValue(state); -}; -pp$1.regexp_eatCharacterClass = function(state) { - if (state.eat(91)) { - state.eat(94); - this.regexp_classRanges(state); - if (state.eat(93)) { - return true; - } - state.raise("Unterminated character class"); - } - return false; -}; -pp$1.regexp_classRanges = function(state) { - while (this.regexp_eatClassAtom(state)) { - var left = state.lastIntValue; - if (state.eat(45) && this.regexp_eatClassAtom(state)) { - var right = state.lastIntValue; - if (state.switchU && (left === -1 || right === -1)) { - state.raise("Invalid character class"); - } - if (left !== -1 && right !== -1 && left > right) { - state.raise("Range out of order in character class"); - } - } - } -}; -pp$1.regexp_eatClassAtom = function(state) { - var start3 = state.pos; - if (state.eat(92)) { - if (this.regexp_eatClassEscape(state)) { - return true; - } - if (state.switchU) { - var ch$1 = state.current(); - if (ch$1 === 99 || isOctalDigit(ch$1)) { - state.raise("Invalid class escape"); - } - state.raise("Invalid escape"); - } - state.pos = start3; - } - var ch = state.current(); - if (ch !== 93) { - state.lastIntValue = ch; - state.advance(); - return true; - } - return false; -}; -pp$1.regexp_eatClassEscape = function(state) { - var start3 = state.pos; - if (state.eat(98)) { - state.lastIntValue = 8; - return true; - } - if (state.switchU && state.eat(45)) { - state.lastIntValue = 45; - return true; - } - if (!state.switchU && state.eat(99)) { - if (this.regexp_eatClassControlLetter(state)) { - return true; - } - state.pos = start3; - } - return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state); -}; -pp$1.regexp_eatClassControlLetter = function(state) { - var ch = state.current(); - if (isDecimalDigit(ch) || ch === 95) { - state.lastIntValue = ch % 32; - state.advance(); - return true; - } - return false; -}; -pp$1.regexp_eatHexEscapeSequence = function(state) { - var start3 = state.pos; - if (state.eat(120)) { - if (this.regexp_eatFixedHexDigits(state, 2)) { - return true; - } - if (state.switchU) { - state.raise("Invalid escape"); - } - state.pos = start3; - } - return false; -}; -pp$1.regexp_eatDecimalDigits = function(state) { - var start3 = state.pos; - var ch = 0; - state.lastIntValue = 0; - while (isDecimalDigit(ch = state.current())) { - state.lastIntValue = 10 * state.lastIntValue + (ch - 48); - state.advance(); - } - return state.pos !== start3; -}; -function isDecimalDigit(ch) { - return ch >= 48 && ch <= 57; -} -pp$1.regexp_eatHexDigits = function(state) { - var start3 = state.pos; - var ch = 0; - state.lastIntValue = 0; - while (isHexDigit(ch = state.current())) { - state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); - state.advance(); - } - return state.pos !== start3; -}; -function isHexDigit(ch) { - return ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102; -} -function hexToInt(ch) { - if (ch >= 65 && ch <= 70) { - return 10 + (ch - 65); - } - if (ch >= 97 && ch <= 102) { - return 10 + (ch - 97); - } - return ch - 48; -} -pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) { - if (this.regexp_eatOctalDigit(state)) { - var n1 = state.lastIntValue; - if (this.regexp_eatOctalDigit(state)) { - var n2 = state.lastIntValue; - if (n1 <= 3 && this.regexp_eatOctalDigit(state)) { - state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue; - } else { - state.lastIntValue = n1 * 8 + n2; - } - } else { - state.lastIntValue = n1; - } - return true; - } - return false; -}; -pp$1.regexp_eatOctalDigit = function(state) { - var ch = state.current(); - if (isOctalDigit(ch)) { - state.lastIntValue = ch - 48; - state.advance(); - return true; - } - state.lastIntValue = 0; - return false; -}; -function isOctalDigit(ch) { - return ch >= 48 && ch <= 55; -} -pp$1.regexp_eatFixedHexDigits = function(state, length) { - var start3 = state.pos; - state.lastIntValue = 0; - for (var i = 0; i < length; ++i) { - var ch = state.current(); - if (!isHexDigit(ch)) { - state.pos = start3; - return false; - } - state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); - state.advance(); - } - return true; -}; -var Token = function Token2(p) { - this.type = p.type; - this.value = p.value; - this.start = p.start; - this.end = p.end; - if (p.options.locations) { - this.loc = new SourceLocation(p, p.startLoc, p.endLoc); - } - if (p.options.ranges) { - this.range = [p.start, p.end]; - } -}; -var pp = Parser.prototype; -pp.next = function(ignoreEscapeSequenceInKeyword) { - if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) { - this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); - } - if (this.options.onToken) { - this.options.onToken(new Token(this)); - } - this.lastTokEnd = this.end; - this.lastTokStart = this.start; - this.lastTokEndLoc = this.endLoc; - this.lastTokStartLoc = this.startLoc; - this.nextToken(); -}; -pp.getToken = function() { - this.next(); - return new Token(this); -}; -if (typeof Symbol !== "undefined") { - pp[Symbol.iterator] = function() { - var this$1$1 = this; - return { - next: function() { - var token = this$1$1.getToken(); - return { - done: token.type === types$1.eof, - value: token - }; - } - }; - }; -} -pp.nextToken = function() { - var curContext = this.curContext(); - if (!curContext || !curContext.preserveSpace) { - this.skipSpace(); - } - this.start = this.pos; - if (this.options.locations) { - this.startLoc = this.curPosition(); - } - if (this.pos >= this.input.length) { - return this.finishToken(types$1.eof); - } - if (curContext.override) { - return curContext.override(this); - } else { - this.readToken(this.fullCharCodeAtPos()); - } -}; -pp.readToken = function(code2) { - if (isIdentifierStart(code2, this.options.ecmaVersion >= 6) || code2 === 92) { - return this.readWord(); - } - return this.getTokenFromCode(code2); -}; -pp.fullCharCodeAtPos = function() { - var code2 = this.input.charCodeAt(this.pos); - if (code2 <= 55295 || code2 >= 56320) { - return code2; - } - var next = this.input.charCodeAt(this.pos + 1); - return next <= 56319 || next >= 57344 ? code2 : (code2 << 10) + next - 56613888; -}; -pp.skipBlockComment = function() { - var startLoc = this.options.onComment && this.curPosition(); - var start3 = this.pos, end = this.input.indexOf("*/", this.pos += 2); - if (end === -1) { - this.raise(this.pos - 2, "Unterminated comment"); - } - this.pos = end + 2; - if (this.options.locations) { - for (var nextBreak = void 0, pos = start3; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1; ) { - ++this.curLine; - pos = this.lineStart = nextBreak; - } - } - if (this.options.onComment) { - this.options.onComment( - true, - this.input.slice(start3 + 2, end), - start3, - this.pos, - startLoc, - this.curPosition() - ); - } -}; -pp.skipLineComment = function(startSkip) { - var start3 = this.pos; - var startLoc = this.options.onComment && this.curPosition(); - var ch = this.input.charCodeAt(this.pos += startSkip); - while (this.pos < this.input.length && !isNewLine(ch)) { - ch = this.input.charCodeAt(++this.pos); - } - if (this.options.onComment) { - this.options.onComment( - false, - this.input.slice(start3 + startSkip, this.pos), - start3, - this.pos, - startLoc, - this.curPosition() - ); - } -}; -pp.skipSpace = function() { - loop: - while (this.pos < this.input.length) { - var ch = this.input.charCodeAt(this.pos); - switch (ch) { - case 32: - case 160: - ++this.pos; - break; - case 13: - if (this.input.charCodeAt(this.pos + 1) === 10) { - ++this.pos; - } - case 10: - case 8232: - case 8233: - ++this.pos; - if (this.options.locations) { - ++this.curLine; - this.lineStart = this.pos; - } - break; - case 47: - switch (this.input.charCodeAt(this.pos + 1)) { - case 42: - this.skipBlockComment(); - break; - case 47: - this.skipLineComment(2); - break; - default: - break loop; - } - break; - default: - if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { - ++this.pos; - } else { - break loop; - } - } - } -}; -pp.finishToken = function(type, val) { - this.end = this.pos; - if (this.options.locations) { - this.endLoc = this.curPosition(); - } - var prevType = this.type; - this.type = type; - this.value = val; - this.updateContext(prevType); -}; -pp.readToken_dot = function() { - var next = this.input.charCodeAt(this.pos + 1); - if (next >= 48 && next <= 57) { - return this.readNumber(true); - } - var next2 = this.input.charCodeAt(this.pos + 2); - if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { - this.pos += 3; - return this.finishToken(types$1.ellipsis); - } else { - ++this.pos; - return this.finishToken(types$1.dot); - } -}; -pp.readToken_slash = function() { - var next = this.input.charCodeAt(this.pos + 1); - if (this.exprAllowed) { - ++this.pos; - return this.readRegexp(); - } - if (next === 61) { - return this.finishOp(types$1.assign, 2); - } - return this.finishOp(types$1.slash, 1); -}; -pp.readToken_mult_modulo_exp = function(code2) { - var next = this.input.charCodeAt(this.pos + 1); - var size = 1; - var tokentype = code2 === 42 ? types$1.star : types$1.modulo; - if (this.options.ecmaVersion >= 7 && code2 === 42 && next === 42) { - ++size; - tokentype = types$1.starstar; - next = this.input.charCodeAt(this.pos + 2); - } - if (next === 61) { - return this.finishOp(types$1.assign, size + 1); - } - return this.finishOp(tokentype, size); -}; -pp.readToken_pipe_amp = function(code2) { - var next = this.input.charCodeAt(this.pos + 1); - if (next === code2) { - if (this.options.ecmaVersion >= 12) { - var next2 = this.input.charCodeAt(this.pos + 2); - if (next2 === 61) { - return this.finishOp(types$1.assign, 3); - } - } - return this.finishOp(code2 === 124 ? types$1.logicalOR : types$1.logicalAND, 2); - } - if (next === 61) { - return this.finishOp(types$1.assign, 2); - } - return this.finishOp(code2 === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1); -}; -pp.readToken_caret = function() { - var next = this.input.charCodeAt(this.pos + 1); - if (next === 61) { - return this.finishOp(types$1.assign, 2); - } - return this.finishOp(types$1.bitwiseXOR, 1); -}; -pp.readToken_plus_min = function(code2) { - var next = this.input.charCodeAt(this.pos + 1); - if (next === code2) { - if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) { - this.skipLineComment(3); - this.skipSpace(); - return this.nextToken(); - } - return this.finishOp(types$1.incDec, 2); - } - if (next === 61) { - return this.finishOp(types$1.assign, 2); - } - return this.finishOp(types$1.plusMin, 1); -}; -pp.readToken_lt_gt = function(code2) { - var next = this.input.charCodeAt(this.pos + 1); - var size = 1; - if (next === code2) { - size = code2 === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; - if (this.input.charCodeAt(this.pos + size) === 61) { - return this.finishOp(types$1.assign, size + 1); - } - return this.finishOp(types$1.bitShift, size); - } - if (next === 33 && code2 === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) { - this.skipLineComment(4); - this.skipSpace(); - return this.nextToken(); - } - if (next === 61) { - size = 2; - } - return this.finishOp(types$1.relational, size); -}; -pp.readToken_eq_excl = function(code2) { - var next = this.input.charCodeAt(this.pos + 1); - if (next === 61) { - return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2); - } - if (code2 === 61 && next === 62 && this.options.ecmaVersion >= 6) { - this.pos += 2; - return this.finishToken(types$1.arrow); - } - return this.finishOp(code2 === 61 ? types$1.eq : types$1.prefix, 1); -}; -pp.readToken_question = function() { - var ecmaVersion = this.options.ecmaVersion; - if (ecmaVersion >= 11) { - var next = this.input.charCodeAt(this.pos + 1); - if (next === 46) { - var next2 = this.input.charCodeAt(this.pos + 2); - if (next2 < 48 || next2 > 57) { - return this.finishOp(types$1.questionDot, 2); - } - } - if (next === 63) { - if (ecmaVersion >= 12) { - var next2$1 = this.input.charCodeAt(this.pos + 2); - if (next2$1 === 61) { - return this.finishOp(types$1.assign, 3); - } - } - return this.finishOp(types$1.coalesce, 2); - } - } - return this.finishOp(types$1.question, 1); -}; -pp.readToken_numberSign = function() { - var ecmaVersion = this.options.ecmaVersion; - var code2 = 35; - if (ecmaVersion >= 13) { - ++this.pos; - code2 = this.fullCharCodeAtPos(); - if (isIdentifierStart(code2, true) || code2 === 92) { - return this.finishToken(types$1.privateId, this.readWord1()); - } - } - this.raise(this.pos, "Unexpected character '" + codePointToString(code2) + "'"); -}; -pp.getTokenFromCode = function(code2) { - switch (code2) { - case 46: - return this.readToken_dot(); - case 40: - ++this.pos; - return this.finishToken(types$1.parenL); - case 41: - ++this.pos; - return this.finishToken(types$1.parenR); - case 59: - ++this.pos; - return this.finishToken(types$1.semi); - case 44: - ++this.pos; - return this.finishToken(types$1.comma); - case 91: - ++this.pos; - return this.finishToken(types$1.bracketL); - case 93: - ++this.pos; - return this.finishToken(types$1.bracketR); - case 123: - ++this.pos; - return this.finishToken(types$1.braceL); - case 125: - ++this.pos; - return this.finishToken(types$1.braceR); - case 58: - ++this.pos; - return this.finishToken(types$1.colon); - case 96: - if (this.options.ecmaVersion < 6) { - break; - } - ++this.pos; - return this.finishToken(types$1.backQuote); - case 48: - var next = this.input.charCodeAt(this.pos + 1); - if (next === 120 || next === 88) { - return this.readRadixNumber(16); - } - if (this.options.ecmaVersion >= 6) { - if (next === 111 || next === 79) { - return this.readRadixNumber(8); - } - if (next === 98 || next === 66) { - return this.readRadixNumber(2); - } - } - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - return this.readNumber(false); - case 34: - case 39: - return this.readString(code2); - case 47: - return this.readToken_slash(); - case 37: - case 42: - return this.readToken_mult_modulo_exp(code2); - case 124: - case 38: - return this.readToken_pipe_amp(code2); - case 94: - return this.readToken_caret(); - case 43: - case 45: - return this.readToken_plus_min(code2); - case 60: - case 62: - return this.readToken_lt_gt(code2); - case 61: - case 33: - return this.readToken_eq_excl(code2); - case 63: - return this.readToken_question(); - case 126: - return this.finishOp(types$1.prefix, 1); - case 35: - return this.readToken_numberSign(); - } - this.raise(this.pos, "Unexpected character '" + codePointToString(code2) + "'"); -}; -pp.finishOp = function(type, size) { - var str = this.input.slice(this.pos, this.pos + size); - this.pos += size; - return this.finishToken(type, str); -}; -pp.readRegexp = function() { - var escaped, inClass, start3 = this.pos; - for (; ; ) { - if (this.pos >= this.input.length) { - this.raise(start3, "Unterminated regular expression"); - } - var ch = this.input.charAt(this.pos); - if (lineBreak.test(ch)) { - this.raise(start3, "Unterminated regular expression"); - } - if (!escaped) { - if (ch === "[") { - inClass = true; - } else if (ch === "]" && inClass) { - inClass = false; - } else if (ch === "/" && !inClass) { - break; - } - escaped = ch === "\\"; - } else { - escaped = false; - } - ++this.pos; - } - var pattern = this.input.slice(start3, this.pos); - ++this.pos; - var flagsStart = this.pos; - var flags = this.readWord1(); - if (this.containsEsc) { - this.unexpected(flagsStart); - } - var state = this.regexpState || (this.regexpState = new RegExpValidationState(this)); - state.reset(start3, pattern, flags); - this.validateRegExpFlags(state); - this.validateRegExpPattern(state); - var value = null; - try { - value = new RegExp(pattern, flags); - } catch (e) { - } - return this.finishToken(types$1.regexp, { pattern, flags, value }); -}; -pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { - var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0; - var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48; - var start3 = this.pos, total = 0, lastCode = 0; - for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) { - var code2 = this.input.charCodeAt(this.pos), val = void 0; - if (allowSeparators && code2 === 95) { - if (isLegacyOctalNumericLiteral) { - this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); - } - if (lastCode === 95) { - this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); - } - if (i === 0) { - this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); - } - lastCode = code2; - continue; - } - if (code2 >= 97) { - val = code2 - 97 + 10; - } else if (code2 >= 65) { - val = code2 - 65 + 10; - } else if (code2 >= 48 && code2 <= 57) { - val = code2 - 48; - } else { - val = Infinity; - } - if (val >= radix) { - break; - } - lastCode = code2; - total = total * radix + val; - } - if (allowSeparators && lastCode === 95) { - this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); - } - if (this.pos === start3 || len != null && this.pos - start3 !== len) { - return null; - } - return total; -}; -function stringToNumber(str, isLegacyOctalNumericLiteral) { - if (isLegacyOctalNumericLiteral) { - return parseInt(str, 8); - } - return parseFloat(str.replace(/_/g, "")); -} -function stringToBigInt(str) { - if (typeof BigInt !== "function") { - return null; - } - return BigInt(str.replace(/_/g, "")); -} -pp.readRadixNumber = function(radix) { - var start3 = this.pos; - this.pos += 2; - var val = this.readInt(radix); - if (val == null) { - this.raise(this.start + 2, "Expected number in radix " + radix); - } - if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) { - val = stringToBigInt(this.input.slice(start3, this.pos)); - ++this.pos; - } else if (isIdentifierStart(this.fullCharCodeAtPos())) { - this.raise(this.pos, "Identifier directly after number"); - } - return this.finishToken(types$1.num, val); -}; -pp.readNumber = function(startsWithDot) { - var start3 = this.pos; - if (!startsWithDot && this.readInt(10, void 0, true) === null) { - this.raise(start3, "Invalid number"); - } - var octal = this.pos - start3 >= 2 && this.input.charCodeAt(start3) === 48; - if (octal && this.strict) { - this.raise(start3, "Invalid number"); - } - var next = this.input.charCodeAt(this.pos); - if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { - var val$1 = stringToBigInt(this.input.slice(start3, this.pos)); - ++this.pos; - if (isIdentifierStart(this.fullCharCodeAtPos())) { - this.raise(this.pos, "Identifier directly after number"); - } - return this.finishToken(types$1.num, val$1); - } - if (octal && /[89]/.test(this.input.slice(start3, this.pos))) { - octal = false; - } - if (next === 46 && !octal) { - ++this.pos; - this.readInt(10); - next = this.input.charCodeAt(this.pos); - } - if ((next === 69 || next === 101) && !octal) { - next = this.input.charCodeAt(++this.pos); - if (next === 43 || next === 45) { - ++this.pos; - } - if (this.readInt(10) === null) { - this.raise(start3, "Invalid number"); - } - } - if (isIdentifierStart(this.fullCharCodeAtPos())) { - this.raise(this.pos, "Identifier directly after number"); - } - var val = stringToNumber(this.input.slice(start3, this.pos), octal); - return this.finishToken(types$1.num, val); -}; -pp.readCodePoint = function() { - var ch = this.input.charCodeAt(this.pos), code2; - if (ch === 123) { - if (this.options.ecmaVersion < 6) { - this.unexpected(); - } - var codePos = ++this.pos; - code2 = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos); - ++this.pos; - if (code2 > 1114111) { - this.invalidStringToken(codePos, "Code point out of bounds"); - } - } else { - code2 = this.readHexChar(4); - } - return code2; -}; -pp.readString = function(quote) { - var out = "", chunkStart = ++this.pos; - for (; ; ) { - if (this.pos >= this.input.length) { - this.raise(this.start, "Unterminated string constant"); - } - var ch = this.input.charCodeAt(this.pos); - if (ch === quote) { - break; - } - if (ch === 92) { - out += this.input.slice(chunkStart, this.pos); - out += this.readEscapedChar(false); - chunkStart = this.pos; - } else if (ch === 8232 || ch === 8233) { - if (this.options.ecmaVersion < 10) { - this.raise(this.start, "Unterminated string constant"); - } - ++this.pos; - if (this.options.locations) { - this.curLine++; - this.lineStart = this.pos; - } - } else { - if (isNewLine(ch)) { - this.raise(this.start, "Unterminated string constant"); - } - ++this.pos; - } - } - out += this.input.slice(chunkStart, this.pos++); - return this.finishToken(types$1.string, out); -}; -var INVALID_TEMPLATE_ESCAPE_ERROR = {}; -pp.tryReadTemplateToken = function() { - this.inTemplateElement = true; - try { - this.readTmplToken(); - } catch (err) { - if (err === INVALID_TEMPLATE_ESCAPE_ERROR) { - this.readInvalidTemplateToken(); - } else { - throw err; - } - } - this.inTemplateElement = false; -}; -pp.invalidStringToken = function(position3, message) { - if (this.inTemplateElement && this.options.ecmaVersion >= 9) { - throw INVALID_TEMPLATE_ESCAPE_ERROR; - } else { - this.raise(position3, message); - } -}; -pp.readTmplToken = function() { - var out = "", chunkStart = this.pos; - for (; ; ) { - if (this.pos >= this.input.length) { - this.raise(this.start, "Unterminated template"); - } - var ch = this.input.charCodeAt(this.pos); - if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { - if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) { - if (ch === 36) { - this.pos += 2; - return this.finishToken(types$1.dollarBraceL); - } else { - ++this.pos; - return this.finishToken(types$1.backQuote); - } - } - out += this.input.slice(chunkStart, this.pos); - return this.finishToken(types$1.template, out); - } - if (ch === 92) { - out += this.input.slice(chunkStart, this.pos); - out += this.readEscapedChar(true); - chunkStart = this.pos; - } else if (isNewLine(ch)) { - out += this.input.slice(chunkStart, this.pos); - ++this.pos; - switch (ch) { - case 13: - if (this.input.charCodeAt(this.pos) === 10) { - ++this.pos; - } - case 10: - out += "\n"; - break; - default: - out += String.fromCharCode(ch); - break; - } - if (this.options.locations) { - ++this.curLine; - this.lineStart = this.pos; - } - chunkStart = this.pos; - } else { - ++this.pos; - } - } -}; -pp.readInvalidTemplateToken = function() { - for (; this.pos < this.input.length; this.pos++) { - switch (this.input[this.pos]) { - case "\\": - ++this.pos; - break; - case "$": - if (this.input[this.pos + 1] !== "{") { - break; - } - case "`": - return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos)); - } - } - this.raise(this.start, "Unterminated template"); -}; -pp.readEscapedChar = function(inTemplate) { - var ch = this.input.charCodeAt(++this.pos); - ++this.pos; - switch (ch) { - case 110: - return "\n"; - case 114: - return "\r"; - case 120: - return String.fromCharCode(this.readHexChar(2)); - case 117: - return codePointToString(this.readCodePoint()); - case 116: - return " "; - case 98: - return "\b"; - case 118: - return "\v"; - case 102: - return "\f"; - case 13: - if (this.input.charCodeAt(this.pos) === 10) { - ++this.pos; - } - case 10: - if (this.options.locations) { - this.lineStart = this.pos; - ++this.curLine; - } - return ""; - case 56: - case 57: - if (this.strict) { - this.invalidStringToken( - this.pos - 1, - "Invalid escape sequence" - ); - } - if (inTemplate) { - var codePos = this.pos - 1; - this.invalidStringToken( - codePos, - "Invalid escape sequence in template string" - ); - return null; - } - default: - if (ch >= 48 && ch <= 55) { - var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0]; - var octal = parseInt(octalStr, 8); - if (octal > 255) { - octalStr = octalStr.slice(0, -1); - octal = parseInt(octalStr, 8); - } - this.pos += octalStr.length - 1; - ch = this.input.charCodeAt(this.pos); - if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) { - this.invalidStringToken( - this.pos - 1 - octalStr.length, - inTemplate ? "Octal literal in template string" : "Octal literal in strict mode" - ); - } - return String.fromCharCode(octal); - } - if (isNewLine(ch)) { - return ""; - } - return String.fromCharCode(ch); - } -}; -pp.readHexChar = function(len) { - var codePos = this.pos; - var n = this.readInt(16, len); - if (n === null) { - this.invalidStringToken(codePos, "Bad character escape sequence"); - } - return n; -}; -pp.readWord1 = function() { - this.containsEsc = false; - var word = "", first = true, chunkStart = this.pos; - var astral = this.options.ecmaVersion >= 6; - while (this.pos < this.input.length) { - var ch = this.fullCharCodeAtPos(); - if (isIdentifierChar(ch, astral)) { - this.pos += ch <= 65535 ? 1 : 2; - } else if (ch === 92) { - this.containsEsc = true; - word += this.input.slice(chunkStart, this.pos); - var escStart = this.pos; - if (this.input.charCodeAt(++this.pos) !== 117) { - this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); - } - ++this.pos; - var esc = this.readCodePoint(); - if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) { - this.invalidStringToken(escStart, "Invalid Unicode escape"); - } - word += codePointToString(esc); - chunkStart = this.pos; - } else { - break; - } - first = false; - } - return word + this.input.slice(chunkStart, this.pos); -}; -pp.readWord = function() { - var word = this.readWord1(); - var type = types$1.name; - if (this.keywords.test(word)) { - type = keywords[word]; - } - return this.finishToken(type, word); -}; -var version = "8.8.1"; -Parser.acorn = { - Parser, - version, - defaultOptions, - Position, - SourceLocation, - getLineInfo, - Node, - TokenType, - tokTypes: types$1, - keywordTypes: keywords, - TokContext, - tokContexts: types, - isIdentifierChar, - isIdentifierStart, - Token, - isNewLine, - lineBreak, - lineBreakG, - nonASCIIwhitespace -}; - -// node_modules/micromark-extension-mdxjs/index.js -var import_acorn_jsx = __toESM(require_acorn_jsx(), 1); - -// node_modules/micromark-util-chunked/index.js -function splice(list3, start3, remove, items) { - const end = list3.length; - let chunkStart = 0; - let parameters; - if (start3 < 0) { - start3 = -start3 > end ? 0 : end + start3; - } else { - start3 = start3 > end ? end : start3; - } - remove = remove > 0 ? remove : 0; - if (items.length < 1e4) { - parameters = Array.from(items); - parameters.unshift(start3, remove); - [].splice.apply(list3, parameters); - } else { - if (remove) - [].splice.apply(list3, [start3, remove]); - while (chunkStart < items.length) { - parameters = items.slice(chunkStart, chunkStart + 1e4); - parameters.unshift(start3, 0); - [].splice.apply(list3, parameters); - chunkStart += 1e4; - start3 += 1e4; - } - } -} -function push(list3, items) { - if (list3.length > 0) { - splice(list3, list3.length, 0, items); - return list3; - } - return items; -} - -// node_modules/micromark-util-combine-extensions/index.js -var hasOwnProperty2 = {}.hasOwnProperty; -function combineExtensions(extensions) { - const all4 = {}; - let index2 = -1; - while (++index2 < extensions.length) { - syntaxExtension(all4, extensions[index2]); - } - return all4; -} -function syntaxExtension(all4, extension2) { - let hook; - for (hook in extension2) { - const maybe = hasOwnProperty2.call(all4, hook) ? all4[hook] : void 0; - const left = maybe || (all4[hook] = {}); - const right = extension2[hook]; - let code2; - for (code2 in right) { - if (!hasOwnProperty2.call(left, code2)) - left[code2] = []; - const value = right[code2]; - constructs( - left[code2], - Array.isArray(value) ? value : value ? [value] : [] - ); - } - } -} -function constructs(existing, list3) { - let index2 = -1; - const before = []; - while (++index2 < list3.length) { - ; - (list3[index2].add === "after" ? existing : before).push(list3[index2]); - } - splice(existing, 0, 0, before); -} - -// node_modules/micromark-util-character/lib/unicode-punctuation-regex.js -var unicodePunctuationRegex = /[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; - -// node_modules/micromark-util-character/index.js -var asciiAlpha = regexCheck(/[A-Za-z]/); -var asciiDigit = regexCheck(/\d/); -var asciiHexDigit = regexCheck(/[\dA-Fa-f]/); -var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); -var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); -var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); -function asciiControl(code2) { - return code2 !== null && (code2 < 32 || code2 === 127); -} -function markdownLineEndingOrSpace(code2) { - return code2 !== null && (code2 < 0 || code2 === 32); -} -function markdownLineEnding(code2) { - return code2 !== null && code2 < -2; -} -function markdownSpace(code2) { - return code2 === -2 || code2 === -1 || code2 === 32; -} -var unicodeWhitespace = regexCheck(/\s/); -var unicodePunctuation = regexCheck(unicodePunctuationRegex); -function regexCheck(regex2) { - return check; - function check(code2) { - return code2 !== null && regex2.test(String.fromCharCode(code2)); - } -} - -// node_modules/micromark-factory-space/index.js -function factorySpace(effects, ok2, type, max) { - const limit = max ? max - 1 : Number.POSITIVE_INFINITY; - let size = 0; - return start3; - function start3(code2) { - if (markdownSpace(code2)) { - effects.enter(type); - return prefix(code2); - } - return ok2(code2); - } - function prefix(code2) { - if (markdownSpace(code2) && size++ < limit) { - effects.consume(code2); - return prefix; - } - effects.exit(type); - return ok2(code2); - } -} - -// node_modules/unist-util-position-from-estree/index.js -function positionFromEstree(value) { - const node = value || {}; - const loc = node.loc || {}; - const range = node.range || [0, 0]; - const startOffset = range[0] || node.start; - const endOffset = range[1] || node.end; - return { - start: { - line: loc.start && typeof loc.start.line === "number" && loc.start.line > -1 ? loc.start.line : void 0, - column: loc.start && typeof loc.start.column === "number" && loc.start.column > -1 ? loc.start.column + 1 : void 0, - offset: typeof startOffset === "number" && startOffset > -1 ? startOffset : void 0 - }, - end: { - line: loc.end && typeof loc.end.line === "number" && loc.end.line > -1 ? loc.end.line : void 0, - column: loc.end && typeof loc.end.column === "number" && loc.end.column > -1 ? loc.end.column + 1 : void 0, - offset: typeof endOffset === "number" && endOffset > -1 ? endOffset : void 0 - } - }; -} - -// node_modules/estree-util-visit/color.js -function color(d) { - return "\x1B[33m" + d + "\x1B[39m"; -} - -// node_modules/estree-util-visit/index.js -var own2 = {}.hasOwnProperty; -var CONTINUE = Symbol("continue"); -var SKIP = Symbol("skip"); -var EXIT = Symbol("exit"); -function visit(tree, visitor) { - let enter; - let leave; - if (typeof visitor === "function") { - enter = visitor; - } else if (visitor && typeof visitor === "object") { - enter = visitor.enter; - leave = visitor.leave; - } - build(tree, null, null, [])(); - function build(node, key, index2, parents) { - if (nodelike(node)) { - visit3.displayName = "node (" + color(node.type) + ")"; - } - return visit3; - function visit3() { - const result = enter ? toResult(enter(node, key, index2, parents)) : []; - if (result[0] === EXIT) { - return result; - } - if (result[0] !== SKIP) { - let cKey; - for (cKey in node) { - if (own2.call(node, cKey) && node[cKey] && typeof node[cKey] === "object" && cKey !== "data" && cKey !== "position") { - const value = node[cKey]; - const grandparents = parents.concat(node); - if (Array.isArray(value)) { - let cIndex = 0; - while (cIndex > -1 && cIndex < value.length) { - const subvalue = value[cIndex]; - if (nodelike(subvalue)) { - const subresult = build( - subvalue, - cKey, - cIndex, - grandparents - )(); - if (subresult[0] === EXIT) - return subresult; - cIndex = typeof subresult[1] === "number" ? subresult[1] : cIndex + 1; - } else { - cIndex++; - } - } - } else if (nodelike(value)) { - const subresult = build(value, cKey, null, grandparents)(); - if (subresult[0] === EXIT) - return subresult; - } - } - } - } - return leave ? toResult(leave(node, key, index2, parents)) : result; - } - } -} -function toResult(value) { - if (Array.isArray(value)) { - return value; - } - if (typeof value === "number") { - return [CONTINUE, value]; - } - return [value]; -} -function nodelike(value) { - return Boolean( - value && typeof value === "object" && typeof value.type === "string" && value.type.length > 0 - ); -} - -// node_modules/micromark-util-events-to-acorn/node_modules/vfile-location/index.js -function location(file) { - var value = String(file); - var indices = []; - var search2 = /\r?\n|\r/g; - while (search2.test(value)) { - indices.push(search2.lastIndex); - } - indices.push(value.length + 1); - return { toPoint, toOffset }; - function toPoint(offset2) { - var index2 = -1; - if (offset2 > -1 && offset2 < indices[indices.length - 1]) { - while (++index2 < indices.length) { - if (indices[index2] > offset2) { - return { - line: index2 + 1, - column: offset2 - (indices[index2 - 1] || 0) + 1, - offset: offset2 - }; - } - } - } - return { line: void 0, column: void 0, offset: void 0 }; - } - function toOffset(point3) { - var line = point3 && point3.line; - var column = point3 && point3.column; - var offset2; - if (typeof line === "number" && typeof column === "number" && !Number.isNaN(line) && !Number.isNaN(column) && line - 1 in indices) { - offset2 = (indices[line - 2] || 0) + column - 1 || 0; - } - return offset2 > -1 && offset2 < indices[indices.length - 1] ? offset2 : -1; - } -} - -// node_modules/micromark-util-events-to-acorn/index.js -function eventsToAcorn(events, options) { - const { prefix = "", suffix = "" } = options; - const acornOptions = Object.assign({}, options.acornOptions); - const comments = []; - const tokens = []; - const onComment = acornOptions.onComment; - const onToken = acornOptions.onToken; - const acornConfig = Object.assign({}, acornOptions, { - onComment: comments, - onToken: onToken ? tokens : void 0, - preserveParens: true - }); - const chunks = []; - const lines = {}; - let index2 = -1; - let swallow = false; - let estree; - let exception; - let startLine; - if (options.start) { - startLine = options.start.line; - lines[startLine] = options.start; - } - while (++index2 < events.length) { - const [kind, token, context] = events[index2]; - if (kind === "exit") { - chunks.push(context.sliceSerialize(token)); - setPoint(token.start); - setPoint(token.end); - } - } - const source = chunks.join(""); - const value = prefix + source + suffix; - const isEmptyExpression = options.expression && empty2(source); - const place = location(source); - if (isEmptyExpression && !options.allowEmpty) { - throw new VFileMessage( - "Unexpected empty expression", - parseOffsetToUnistPoint(0), - "micromark-extension-mdx-expression:unexpected-empty-expression" - ); - } - try { - estree = options.expression && !isEmptyExpression ? options.acorn.parseExpressionAt(value, 0, acornConfig) : options.acorn.parse(value, acornConfig); - } catch (error_) { - const error = error_; - const point3 = parseOffsetToUnistPoint(error.pos); - error.message = String(error.message).replace(/ \(\d+:\d+\)$/, ""); - error.pos = point3.offset; - error.loc = { - line: point3.line, - column: point3.column - 1 - }; - exception = error; - swallow = error.raisedAt >= prefix.length + source.length || error.message === "Unterminated comment"; - } - if (estree && options.expression && !isEmptyExpression) { - if (empty2(value.slice(estree.end, value.length - suffix.length))) { - estree = { - type: "Program", - start: 0, - end: prefix.length + source.length, - body: [ - { - type: "ExpressionStatement", - expression: estree, - start: 0, - end: prefix.length + source.length - } - ], - sourceType: "module", - comments: [] - }; - } else { - const point3 = parseOffsetToUnistPoint(estree.end); - exception = new Error("Unexpected content after expression"); - exception.pos = point3.offset; - exception.loc = { - line: point3.line, - column: point3.column - 1 - }; - estree = void 0; - } - } - if (estree) { - estree.comments = comments; - visit(estree, (esnode, field, index3, parents) => { - let context = parents[parents.length - 1]; - let prop = field; - if (esnode.type === "ParenthesizedExpression" && context && prop) { - if (typeof index3 === "number") { - context = context[prop]; - prop = index3; - } - context[prop] = esnode.expression; - } - fixPosition(esnode); - }); - if (Array.isArray(onComment)) { - onComment.push(...comments); - } else if (typeof onComment === "function") { - for (const comment2 of comments) { - onComment( - comment2.type === "Block", - comment2.value, - comment2.start, - comment2.end, - comment2.loc.start, - comment2.loc.end - ); - } - } - for (const token of tokens) { - fixPosition(token); - if (Array.isArray(onToken)) { - onToken.push(token); - } else { - onToken(token); - } - } - } - return { - estree, - error: exception, - swallow - }; - function fixPosition(nodeOrToken) { - const pointStart2 = parseOffsetToUnistPoint(nodeOrToken.start); - const pointEnd2 = parseOffsetToUnistPoint(nodeOrToken.end); - nodeOrToken.start = pointStart2.offset; - nodeOrToken.end = pointEnd2.offset; - nodeOrToken.loc = { - start: { - line: pointStart2.line, - column: pointStart2.column - 1, - offset: pointStart2.offset - }, - end: { - line: pointEnd2.line, - column: pointEnd2.column - 1, - offset: pointEnd2.offset - } - }; - nodeOrToken.range = [nodeOrToken.start, nodeOrToken.end]; - } - function parseOffsetToUnistPoint(acornOffset) { - let sourceOffset = acornOffset - prefix.length; - if (sourceOffset < 0) { - sourceOffset = 0; - } else if (sourceOffset > source.length) { - sourceOffset = source.length; - } - const pointInSource = place.toPoint(sourceOffset); - const line = startLine + (pointInSource.line - 1); - const column = lines[line].column + (pointInSource.column - 1); - const offset2 = lines[line].offset + (pointInSource.column - 1); - return { - line, - column, - offset: offset2 - }; - } - function setPoint(point3) { - if (!startLine || point3.line < startLine) { - startLine = point3.line; - } - if (!(point3.line in lines) || lines[point3.line].offset > point3.offset) { - lines[point3.line] = point3; - } - } -} -function empty2(value) { - return /^\s*$/.test( - value.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g, "") - ); -} - -// node_modules/micromark-factory-mdx-expression/index.js -function factoryMdxExpression(effects, ok2, type, markerType, chunkType, acorn, acornOptions, addResult, spread, allowEmpty, allowLazy, startColumn) { - const self2 = this; - const eventStart = this.events.length + 3; - const tail = this.events[this.events.length - 1]; - const initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; - const prefixExpressionIndent = initialPrefix ? initialPrefix + 1 : 0; - let balance = 1; - let startPosition; - let lastCrash; - return start3; - function start3(code2) { - effects.enter(type); - effects.enter(markerType); - effects.consume(code2); - effects.exit(markerType); - startPosition = self2.now(); - return atBreak; - } - function atBreak(code2) { - if (code2 === null) { - throw lastCrash || new VFileMessage( - "Unexpected end of file in expression, expected a corresponding closing brace for `{`", - self2.now(), - "micromark-extension-mdx-expression:unexpected-eof" - ); - } - if (code2 === 125) { - return atClosingBrace(code2); - } - if (markdownLineEnding(code2)) { - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - const prefixTagIndent = startColumn ? startColumn + 4 - self2.now().column : 0; - const indent = Math.max(prefixExpressionIndent, prefixTagIndent); - return indent ? factorySpace(effects, atBreak, "linePrefix", indent) : atBreak; - } - const now = self2.now(); - if (now.line !== startPosition.line && !allowLazy && self2.parser.lazy[now.line]) { - throw new VFileMessage( - "Unexpected end of file in expression, expected a corresponding closing brace for `{`", - self2.now(), - "micromark-extension-mdx-expression:unexpected-eof" - ); - } - effects.enter(chunkType); - return inside(code2); - } - function inside(code2) { - if (code2 === null || code2 === 125 || markdownLineEnding(code2)) { - effects.exit(chunkType); - return atBreak(code2); - } - if (code2 === 123 && !acorn) { - effects.consume(code2); - balance++; - return inside; - } - effects.consume(code2); - return inside; - } - function atClosingBrace(code2) { - balance--; - if (!acorn) { - if (balance) { - effects.enter(chunkType); - effects.consume(code2); - return inside; - } - effects.enter(markerType); - effects.consume(code2); - effects.exit(markerType); - effects.exit(type); - return ok2; - } - const result = eventsToAcorn(self2.events.slice(eventStart), { - acorn, - acornOptions, - start: startPosition, - expression: true, - allowEmpty, - prefix: spread ? "({" : "", - suffix: spread ? "})" : "" - }); - const estree = result.estree; - if (spread && estree) { - const head = estree.body[0]; - if (head.type !== "ExpressionStatement" || head.expression.type !== "ObjectExpression") { - throw new VFileMessage( - "Unexpected `" + head.type + "` in code: expected an object spread (`{...spread}`)", - positionFromEstree(head).start, - "micromark-extension-mdx-expression:non-spread" - ); - } else if (head.expression.properties[1]) { - throw new VFileMessage( - "Unexpected extra content in spread: only a single spread is supported", - positionFromEstree(head.expression.properties[1]).start, - "micromark-extension-mdx-expression:spread-extra" - ); - } else if (head.expression.properties[0] && head.expression.properties[0].type !== "SpreadElement") { - throw new VFileMessage( - "Unexpected `" + head.expression.properties[0].type + "` in code: only spread elements are supported", - positionFromEstree(head.expression.properties[0]).start, - "micromark-extension-mdx-expression:non-spread" - ); - } - } - if (result.error) { - lastCrash = new VFileMessage( - "Could not parse expression with acorn: " + result.error.message, - { - line: result.error.loc.line, - column: result.error.loc.column + 1, - offset: result.error.pos - }, - "micromark-extension-mdx-expression:acorn" - ); - if (code2 !== null && result.swallow) { - effects.enter(chunkType); - effects.consume(code2); - return inside; - } - throw lastCrash; - } - effects.enter(markerType); - effects.consume(code2); - effects.exit(markerType); - Object.assign( - effects.exit(type), - addResult ? { - estree - } : void 0 - ); - return ok2; - } -} - -// node_modules/micromark-extension-mdx-expression/lib/syntax.js -function mdxExpression(options = {}) { - const addResult = options.addResult; - const acorn = options.acorn; - const spread = options.spread; - let allowEmpty = options.allowEmpty; - let acornOptions; - if (allowEmpty === null || allowEmpty === void 0) { - allowEmpty = true; - } - if (acorn) { - if (!acorn.parseExpressionAt) { - throw new Error( - "Expected a proper `acorn` instance passed in as `options.acorn`" - ); - } - acornOptions = Object.assign( - { - ecmaVersion: 2020, - sourceType: "module" - }, - options.acornOptions - ); - } else if (options.acornOptions || options.addResult) { - throw new Error("Expected an `acorn` instance passed in as `options.acorn`"); - } - return { - flow: { - [123]: { - tokenize: tokenizeFlowExpression, - concrete: true - } - }, - text: { - [123]: { - tokenize: tokenizeTextExpression - } - } - }; - function tokenizeFlowExpression(effects, ok2, nok) { - const self2 = this; - return start3; - function start3(code2) { - return factoryMdxExpression.call( - self2, - effects, - factorySpace(effects, after, "whitespace"), - "mdxFlowExpression", - "mdxFlowExpressionMarker", - "mdxFlowExpressionChunk", - acorn, - acornOptions, - addResult, - spread, - allowEmpty - )(code2); - } - function after(code2) { - return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2); - } - } - function tokenizeTextExpression(effects, ok2) { - const self2 = this; - return start3; - function start3(code2) { - return factoryMdxExpression.call( - self2, - effects, - ok2, - "mdxTextExpression", - "mdxTextExpressionMarker", - "mdxTextExpressionChunk", - acorn, - acornOptions, - addResult, - spread, - allowEmpty, - true - )(code2); - } - } -} - -// node_modules/estree-util-is-identifier-name/regex.js -var start = /[$A-Z_a-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\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\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\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]/; -var cont = /[\d\u00B7\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\u200C\u200D\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]/; - -// node_modules/estree-util-is-identifier-name/index.js -function start2(code2) { - return start.test(String.fromCharCode(code2)); -} -function cont2(code2) { - const character = String.fromCharCode(code2); - return start.test(character) || cont.test(character); -} -function name(name2) { - let index2 = -1; - while (++index2 < name2.length) { - if (!(index2 ? cont2 : start2)(name2.charCodeAt(index2))) - return false; - } - return index2 > 0; -} - -// node_modules/micromark-extension-mdx-jsx/lib/factory-tag.js -var lazyLineEnd = { - tokenize: tokenizeLazyLineEnd, - partial: true -}; -function factoryTag(effects, ok2, nok, acorn, acornOptions, addResult, allowLazy, tagType, tagMarkerType, tagClosingMarkerType, tagSelfClosingMarker, tagNameType, tagNamePrimaryType, tagNameMemberMarkerType, tagNameMemberType, tagNamePrefixMarkerType, tagNameLocalType, tagExpressionAttributeType, tagExpressionAttributeMarkerType, tagExpressionAttributeValueType, tagAttributeType, tagAttributeNameType, tagAttributeNamePrimaryType, tagAttributeNamePrefixMarkerType, tagAttributeNameLocalType, tagAttributeInitializerMarkerType, tagAttributeValueLiteralType, tagAttributeValueLiteralMarkerType, tagAttributeValueLiteralValueType, tagAttributeValueExpressionType, tagAttributeValueExpressionMarkerType, tagAttributeValueExpressionValueType) { - const self2 = this; - let returnState; - let marker; - let startPoint; - return start3; - function start3(code2) { - startPoint = self2.now(); - effects.enter(tagType); - effects.enter(tagMarkerType); - effects.consume(code2); - effects.exit(tagMarkerType); - return afterStart; - } - function afterStart(code2) { - if (markdownLineEnding(code2) || markdownSpace(code2)) { - return nok(code2); - } - returnState = beforeName; - return optionalEsWhitespace(code2); - } - function beforeName(code2) { - if (code2 === 47) { - effects.enter(tagClosingMarkerType); - effects.consume(code2); - effects.exit(tagClosingMarkerType); - returnState = beforeClosingTagName; - return optionalEsWhitespace; - } - if (code2 === 62) { - return tagEnd(code2); - } - if (code2 !== null && start2(code2)) { - effects.enter(tagNameType); - effects.enter(tagNamePrimaryType); - effects.consume(code2); - return primaryName; - } - crash( - code2, - "before name", - "a character that can start a name, such as a letter, `$`, or `_`" + (code2 === 33 ? " (note: to create a comment in MDX, use `{/* text */}`)" : "") - ); - } - function beforeClosingTagName(code2) { - if (code2 === 62) { - return tagEnd(code2); - } - if (code2 !== null && start2(code2)) { - effects.enter(tagNameType); - effects.enter(tagNamePrimaryType); - effects.consume(code2); - return primaryName; - } - crash( - code2, - "before name", - "a character that can start a name, such as a letter, `$`, or `_`" + (code2 === 42 || code2 === 47 ? " (note: JS comments in JSX tags are not supported in MDX)" : "") - ); - } - function primaryName(code2) { - if (code2 === 45 || code2 !== null && cont2(code2)) { - effects.consume(code2); - return primaryName; - } - if (code2 === 46 || code2 === 47 || code2 === 58 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { - effects.exit(tagNamePrimaryType); - returnState = afterPrimaryName; - return optionalEsWhitespace(code2); - } - crash( - code2, - "in name", - "a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag" + (code2 === 64 ? " (note: to create a link in MDX, use `[text](url)`)" : "") - ); - } - function afterPrimaryName(code2) { - if (code2 === 46) { - effects.enter(tagNameMemberMarkerType); - effects.consume(code2); - effects.exit(tagNameMemberMarkerType); - returnState = beforeMemberName; - return optionalEsWhitespace; - } - if (code2 === 58) { - effects.enter(tagNamePrefixMarkerType); - effects.consume(code2); - effects.exit(tagNamePrefixMarkerType); - returnState = beforeLocalName; - return optionalEsWhitespace; - } - if (code2 === 47 || code2 === 62 || code2 === 123 || code2 !== null && start2(code2)) { - effects.exit(tagNameType); - return beforeAttribute(code2); - } - crash( - code2, - "after name", - "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag" - ); - } - function beforeMemberName(code2) { - if (code2 !== null && start2(code2)) { - effects.enter(tagNameMemberType); - effects.consume(code2); - return memberName; - } - crash( - code2, - "before member name", - "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag" - ); - } - function memberName(code2) { - if (code2 === 45 || code2 !== null && cont2(code2)) { - effects.consume(code2); - return memberName; - } - if (code2 === 46 || code2 === 47 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { - effects.exit(tagNameMemberType); - returnState = afterMemberName; - return optionalEsWhitespace(code2); - } - crash( - code2, - "in member name", - "a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag" + (code2 === 64 ? " (note: to create a link in MDX, use `[text](url)`)" : "") - ); - } - function afterMemberName(code2) { - if (code2 === 46) { - effects.enter(tagNameMemberMarkerType); - effects.consume(code2); - effects.exit(tagNameMemberMarkerType); - returnState = beforeMemberName; - return optionalEsWhitespace; - } - if (code2 === 47 || code2 === 62 || code2 === 123 || code2 !== null && start2(code2)) { - effects.exit(tagNameType); - return beforeAttribute(code2); - } - crash( - code2, - "after member name", - "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag" - ); - } - function beforeLocalName(code2) { - if (code2 !== null && start2(code2)) { - effects.enter(tagNameLocalType); - effects.consume(code2); - return localName; - } - crash( - code2, - "before local name", - "a character that can start a name, such as a letter, `$`, or `_`" + (code2 === 43 || code2 !== null && code2 > 46 && code2 < 58 ? " (note: to create a link in MDX, use `[text](url)`)" : "") - ); - } - function localName(code2) { - if (code2 === 45 || code2 !== null && cont2(code2)) { - effects.consume(code2); - return localName; - } - if (code2 === 47 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { - effects.exit(tagNameLocalType); - returnState = afterLocalName; - return optionalEsWhitespace(code2); - } - crash( - code2, - "in local name", - "a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag" - ); - } - function afterLocalName(code2) { - if (code2 === 47 || code2 === 62 || code2 === 123 || code2 !== null && start2(code2)) { - effects.exit(tagNameType); - return beforeAttribute(code2); - } - crash( - code2, - "after local name", - "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag" - ); - } - function beforeAttribute(code2) { - if (code2 === 47) { - effects.enter(tagSelfClosingMarker); - effects.consume(code2); - effects.exit(tagSelfClosingMarker); - returnState = selfClosing; - return optionalEsWhitespace; - } - if (code2 === 62) { - return tagEnd(code2); - } - if (code2 === 123) { - return factoryMdxExpression.call( - self2, - effects, - afterAttributeExpression, - tagExpressionAttributeType, - tagExpressionAttributeMarkerType, - tagExpressionAttributeValueType, - acorn, - acornOptions, - addResult, - true, - false, - allowLazy, - startPoint.column - )(code2); - } - if (code2 !== null && start2(code2)) { - effects.enter(tagAttributeType); - effects.enter(tagAttributeNameType); - effects.enter(tagAttributeNamePrimaryType); - effects.consume(code2); - return attributePrimaryName; - } - crash( - code2, - "before attribute name", - "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag" - ); - } - function afterAttributeExpression(code2) { - returnState = beforeAttribute; - return optionalEsWhitespace(code2); - } - function attributePrimaryName(code2) { - if (code2 === 45 || code2 !== null && cont2(code2)) { - effects.consume(code2); - return attributePrimaryName; - } - if (code2 === 47 || code2 === 58 || code2 === 61 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { - effects.exit(tagAttributeNamePrimaryType); - returnState = afterAttributePrimaryName; - return optionalEsWhitespace(code2); - } - crash( - code2, - "in attribute name", - "an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag" - ); - } - function afterAttributePrimaryName(code2) { - if (code2 === 58) { - effects.enter(tagAttributeNamePrefixMarkerType); - effects.consume(code2); - effects.exit(tagAttributeNamePrefixMarkerType); - returnState = beforeAttributeLocalName; - return optionalEsWhitespace; - } - if (code2 === 61) { - effects.exit(tagAttributeNameType); - effects.enter(tagAttributeInitializerMarkerType); - effects.consume(code2); - effects.exit(tagAttributeInitializerMarkerType); - returnState = beforeAttributeValue; - return optionalEsWhitespace; - } - if (code2 === 47 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || code2 !== null && start2(code2)) { - effects.exit(tagAttributeNameType); - effects.exit(tagAttributeType); - returnState = beforeAttribute; - return optionalEsWhitespace(code2); - } - crash( - code2, - "after attribute name", - "a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag" - ); - } - function beforeAttributeLocalName(code2) { - if (code2 !== null && start2(code2)) { - effects.enter(tagAttributeNameLocalType); - effects.consume(code2); - return attributeLocalName; - } - crash( - code2, - "before local attribute name", - "a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag" - ); - } - function attributeLocalName(code2) { - if (code2 === 45 || code2 !== null && cont2(code2)) { - effects.consume(code2); - return attributeLocalName; - } - if (code2 === 47 || code2 === 61 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { - effects.exit(tagAttributeNameLocalType); - effects.exit(tagAttributeNameType); - returnState = afterAttributeLocalName; - return optionalEsWhitespace(code2); - } - crash( - code2, - "in local attribute name", - "an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag" - ); - } - function afterAttributeLocalName(code2) { - if (code2 === 61) { - effects.enter(tagAttributeInitializerMarkerType); - effects.consume(code2); - effects.exit(tagAttributeInitializerMarkerType); - returnState = beforeAttributeValue; - return optionalEsWhitespace; - } - if (code2 === 47 || code2 === 62 || code2 === 123 || code2 !== null && start2(code2)) { - effects.exit(tagAttributeType); - return beforeAttribute(code2); - } - crash( - code2, - "after local attribute name", - "a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag" - ); - } - function beforeAttributeValue(code2) { - if (code2 === 34 || code2 === 39) { - effects.enter(tagAttributeValueLiteralType); - effects.enter(tagAttributeValueLiteralMarkerType); - effects.consume(code2); - effects.exit(tagAttributeValueLiteralMarkerType); - marker = code2; - return attributeValueQuotedStart; - } - if (code2 === 123) { - return factoryMdxExpression.call( - self2, - effects, - afterAttributeValueExpression, - tagAttributeValueExpressionType, - tagAttributeValueExpressionMarkerType, - tagAttributeValueExpressionValueType, - acorn, - acornOptions, - addResult, - false, - false, - allowLazy, - startPoint.column - )(code2); - } - crash( - code2, - "before attribute value", - "a character that can start an attribute value, such as `\"`, `'`, or `{`" + (code2 === 60 ? " (note: to use an element or fragment as a prop value in MDX, use `{}`)" : "") - ); - } - function afterAttributeValueExpression(code2) { - effects.exit(tagAttributeType); - returnState = beforeAttribute; - return optionalEsWhitespace(code2); - } - function attributeValueQuotedStart(code2) { - if (code2 === null) { - crash( - code2, - "in attribute value", - "a corresponding closing quote `" + String.fromCharCode(marker) + "`" - ); - } - if (code2 === marker) { - effects.enter(tagAttributeValueLiteralMarkerType); - effects.consume(code2); - effects.exit(tagAttributeValueLiteralMarkerType); - effects.exit(tagAttributeValueLiteralType); - effects.exit(tagAttributeType); - marker = void 0; - returnState = beforeAttribute; - return optionalEsWhitespace; - } - if (markdownLineEnding(code2)) { - returnState = attributeValueQuotedStart; - return optionalEsWhitespace(code2); - } - effects.enter(tagAttributeValueLiteralValueType); - return attributeValueQuoted(code2); - } - function attributeValueQuoted(code2) { - if (code2 === null || code2 === marker || markdownLineEnding(code2)) { - effects.exit(tagAttributeValueLiteralValueType); - return attributeValueQuotedStart(code2); - } - effects.consume(code2); - return attributeValueQuoted; - } - function selfClosing(code2) { - if (code2 === 62) { - return tagEnd(code2); - } - crash( - code2, - "after self-closing slash", - "`>` to end the tag" + (code2 === 42 || code2 === 47 ? " (note: JS comments in JSX tags are not supported in MDX)" : "") - ); - } - function tagEnd(code2) { - effects.enter(tagMarkerType); - effects.consume(code2); - effects.exit(tagMarkerType); - effects.exit(tagType); - return ok2; - } - function optionalEsWhitespace(code2) { - if (markdownLineEnding(code2)) { - if (allowLazy) { - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - return factorySpace(effects, optionalEsWhitespace, "linePrefix", 4); - } - return effects.attempt( - lazyLineEnd, - factorySpace(effects, optionalEsWhitespace, "linePrefix", 4), - crashEol - )(code2); - } - if (markdownSpace(code2) || unicodeWhitespace(code2)) { - effects.enter("esWhitespace"); - return optionalEsWhitespaceContinue(code2); - } - return returnState(code2); - } - function optionalEsWhitespaceContinue(code2) { - if (markdownLineEnding(code2) || !(markdownSpace(code2) || unicodeWhitespace(code2))) { - effects.exit("esWhitespace"); - return optionalEsWhitespace(code2); - } - effects.consume(code2); - return optionalEsWhitespaceContinue; - } - function crashEol() { - throw new VFileMessage( - "Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", - self2.now(), - "micromark-extension-mdx-jsx:unexpected-eof" - ); - } - function crash(code2, at2, expect) { - throw new VFileMessage( - "Unexpected " + (code2 === null ? "end of file" : "character `" + (code2 === 96 ? "` ` `" : String.fromCharCode(code2)) + "` (" + serializeCharCode(code2) + ")") + " " + at2 + ", expected " + expect, - self2.now(), - "micromark-extension-mdx-jsx:unexpected-" + (code2 === null ? "eof" : "character") - ); - } -} -function tokenizeLazyLineEnd(effects, ok2, nok) { - const self2 = this; - return start3; - function start3(code2) { - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - return lineStart; - } - function lineStart(code2) { - return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2); - } -} -function serializeCharCode(code2) { - return "U+" + code2.toString(16).toUpperCase().padStart(4, "0"); -} - -// node_modules/micromark-extension-mdx-jsx/lib/jsx-text.js -function jsxText(acorn, acornOptions, addResult) { - return { - tokenize: tokenizeJsxText - }; - function tokenizeJsxText(effects, ok2, nok) { - return factoryTag.call( - this, - effects, - ok2, - nok, - acorn, - acornOptions, - addResult, - true, - "mdxJsxTextTag", - "mdxJsxTextTagMarker", - "mdxJsxTextTagClosingMarker", - "mdxJsxTextTagSelfClosingMarker", - "mdxJsxTextTagName", - "mdxJsxTextTagNamePrimary", - "mdxJsxTextTagNameMemberMarker", - "mdxJsxTextTagNameMember", - "mdxJsxTextTagNamePrefixMarker", - "mdxJsxTextTagNameLocal", - "mdxJsxTextTagExpressionAttribute", - "mdxJsxTextTagExpressionAttributeMarker", - "mdxJsxTextTagExpressionAttributeValue", - "mdxJsxTextTagAttribute", - "mdxJsxTextTagAttributeName", - "mdxJsxTextTagAttributeNamePrimary", - "mdxJsxTextTagAttributeNamePrefixMarker", - "mdxJsxTextTagAttributeNameLocal", - "mdxJsxTextTagAttributeInitializerMarker", - "mdxJsxTextTagAttributeValueLiteral", - "mdxJsxTextTagAttributeValueLiteralMarker", - "mdxJsxTextTagAttributeValueLiteralValue", - "mdxJsxTextTagAttributeValueExpression", - "mdxJsxTextTagAttributeValueExpressionMarker", - "mdxJsxTextTagAttributeValueExpressionValue" - ); - } -} - -// node_modules/micromark-extension-mdx-jsx/lib/jsx-flow.js -function jsxFlow(acorn, acornOptions, addResult) { - return { - tokenize: tokenizeJsxFlow, - concrete: true - }; - function tokenizeJsxFlow(effects, ok2, nok) { - const self2 = this; - return start3; - function start3(code2) { - return factoryTag.call( - self2, - effects, - factorySpace(effects, after, "whitespace"), - nok, - acorn, - acornOptions, - addResult, - false, - "mdxJsxFlowTag", - "mdxJsxFlowTagMarker", - "mdxJsxFlowTagClosingMarker", - "mdxJsxFlowTagSelfClosingMarker", - "mdxJsxFlowTagName", - "mdxJsxFlowTagNamePrimary", - "mdxJsxFlowTagNameMemberMarker", - "mdxJsxFlowTagNameMember", - "mdxJsxFlowTagNamePrefixMarker", - "mdxJsxFlowTagNameLocal", - "mdxJsxFlowTagExpressionAttribute", - "mdxJsxFlowTagExpressionAttributeMarker", - "mdxJsxFlowTagExpressionAttributeValue", - "mdxJsxFlowTagAttribute", - "mdxJsxFlowTagAttributeName", - "mdxJsxFlowTagAttributeNamePrimary", - "mdxJsxFlowTagAttributeNamePrefixMarker", - "mdxJsxFlowTagAttributeNameLocal", - "mdxJsxFlowTagAttributeInitializerMarker", - "mdxJsxFlowTagAttributeValueLiteral", - "mdxJsxFlowTagAttributeValueLiteralMarker", - "mdxJsxFlowTagAttributeValueLiteralValue", - "mdxJsxFlowTagAttributeValueExpression", - "mdxJsxFlowTagAttributeValueExpressionMarker", - "mdxJsxFlowTagAttributeValueExpressionValue" - )(code2); - } - function after(code2) { - return code2 === 60 ? start3(code2) : code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2); - } - } -} - -// node_modules/micromark-extension-mdx-jsx/lib/syntax.js -function mdxJsx(options = {}) { - const acorn = options.acorn; - let acornOptions; - if (acorn) { - if (!acorn.parse || !acorn.parseExpressionAt) { - throw new Error( - "Expected a proper `acorn` instance passed in as `options.acorn`" - ); - } - acornOptions = Object.assign( - { - ecmaVersion: 2020, - sourceType: "module" - }, - options.acornOptions, - { - locations: true - } - ); - } else if (options.acornOptions || options.addResult) { - throw new Error("Expected an `acorn` instance passed in as `options.acorn`"); - } - return { - flow: { - [60]: jsxFlow(acorn, acornOptions, options.addResult) - }, - text: { - [60]: jsxText(acorn, acornOptions, options.addResult) - } - }; -} - -// node_modules/micromark-extension-mdx-md/index.js -var mdxMd = { - disable: { null: ["autolink", "codeIndented", "htmlFlow", "htmlText"] } -}; - -// node_modules/micromark-util-classify-character/index.js -function classifyCharacter(code2) { - if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { - return 1; - } - if (unicodePunctuation(code2)) { - return 2; - } -} - -// node_modules/micromark-util-resolve-all/index.js -function resolveAll(constructs2, events, context) { - const called = []; - let index2 = -1; - while (++index2 < constructs2.length) { - const resolve = constructs2[index2].resolveAll; - if (resolve && !called.includes(resolve)) { - events = resolve(events, context); - called.push(resolve); - } - } - return events; -} - -// node_modules/micromark-core-commonmark/lib/attention.js -var attention = { - name: "attention", - tokenize: tokenizeAttention, - resolveAll: resolveAllAttention -}; -function resolveAllAttention(events, context) { - let index2 = -1; - let open; - let group; - let text5; - let openingSequence; - let closingSequence; - let use; - let nextEvents; - let offset2; - while (++index2 < events.length) { - if (events[index2][0] === "enter" && events[index2][1].type === "attentionSequence" && events[index2][1]._close) { - open = index2; - while (open--) { - if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index2][1]).charCodeAt(0)) { - if ((events[open][1]._close || events[index2][1]._open) && (events[index2][1].end.offset - events[index2][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index2][1].end.offset - events[index2][1].start.offset) % 3)) { - continue; - } - use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index2][1].end.offset - events[index2][1].start.offset > 1 ? 2 : 1; - const start3 = Object.assign({}, events[open][1].end); - const end = Object.assign({}, events[index2][1].start); - movePoint(start3, -use); - movePoint(end, use); - openingSequence = { - type: use > 1 ? "strongSequence" : "emphasisSequence", - start: start3, - end: Object.assign({}, events[open][1].end) - }; - closingSequence = { - type: use > 1 ? "strongSequence" : "emphasisSequence", - start: Object.assign({}, events[index2][1].start), - end - }; - text5 = { - type: use > 1 ? "strongText" : "emphasisText", - start: Object.assign({}, events[open][1].end), - end: Object.assign({}, events[index2][1].start) - }; - group = { - type: use > 1 ? "strong" : "emphasis", - start: Object.assign({}, openingSequence.start), - end: Object.assign({}, closingSequence.end) - }; - events[open][1].end = Object.assign({}, openingSequence.start); - events[index2][1].start = Object.assign({}, closingSequence.end); - nextEvents = []; - if (events[open][1].end.offset - events[open][1].start.offset) { - nextEvents = push(nextEvents, [ - ["enter", events[open][1], context], - ["exit", events[open][1], context] - ]); - } - nextEvents = push(nextEvents, [ - ["enter", group, context], - ["enter", openingSequence, context], - ["exit", openingSequence, context], - ["enter", text5, context] - ]); - nextEvents = push( - nextEvents, - resolveAll( - context.parser.constructs.insideSpan.null, - events.slice(open + 1, index2), - context - ) - ); - nextEvents = push(nextEvents, [ - ["exit", text5, context], - ["enter", closingSequence, context], - ["exit", closingSequence, context], - ["exit", group, context] - ]); - if (events[index2][1].end.offset - events[index2][1].start.offset) { - offset2 = 2; - nextEvents = push(nextEvents, [ - ["enter", events[index2][1], context], - ["exit", events[index2][1], context] - ]); - } else { - offset2 = 0; - } - splice(events, open - 1, index2 - open + 3, nextEvents); - index2 = open + nextEvents.length - offset2 - 2; - break; - } - } - } - } - index2 = -1; - while (++index2 < events.length) { - if (events[index2][1].type === "attentionSequence") { - events[index2][1].type = "data"; - } - } - return events; -} -function tokenizeAttention(effects, ok2) { - const attentionMarkers2 = this.parser.constructs.attentionMarkers.null; - const previous2 = this.previous; - const before = classifyCharacter(previous2); - let marker; - return start3; - function start3(code2) { - effects.enter("attentionSequence"); - marker = code2; - return sequence(code2); - } - function sequence(code2) { - if (code2 === marker) { - effects.consume(code2); - return sequence; - } - const token = effects.exit("attentionSequence"); - const after = classifyCharacter(code2); - const open = !after || after === 2 && before || attentionMarkers2.includes(code2); - const close = !before || before === 2 && after || attentionMarkers2.includes(previous2); - token._open = Boolean(marker === 42 ? open : open && (before || !close)); - token._close = Boolean(marker === 42 ? close : close && (after || !open)); - return ok2(code2); - } -} -function movePoint(point3, offset2) { - point3.column += offset2; - point3.offset += offset2; - point3._bufferIndex += offset2; -} - -// node_modules/micromark-core-commonmark/lib/autolink.js -var autolink = { - name: "autolink", - tokenize: tokenizeAutolink -}; -function tokenizeAutolink(effects, ok2, nok) { - let size = 1; - return start3; - function start3(code2) { - effects.enter("autolink"); - effects.enter("autolinkMarker"); - effects.consume(code2); - effects.exit("autolinkMarker"); - effects.enter("autolinkProtocol"); - return open; - } - function open(code2) { - if (asciiAlpha(code2)) { - effects.consume(code2); - return schemeOrEmailAtext; - } - return asciiAtext(code2) ? emailAtext(code2) : nok(code2); - } - function schemeOrEmailAtext(code2) { - return code2 === 43 || code2 === 45 || code2 === 46 || asciiAlphanumeric(code2) ? schemeInsideOrEmailAtext(code2) : emailAtext(code2); - } - function schemeInsideOrEmailAtext(code2) { - if (code2 === 58) { - effects.consume(code2); - return urlInside; - } - if ((code2 === 43 || code2 === 45 || code2 === 46 || asciiAlphanumeric(code2)) && size++ < 32) { - effects.consume(code2); - return schemeInsideOrEmailAtext; - } - return emailAtext(code2); - } - function urlInside(code2) { - if (code2 === 62) { - effects.exit("autolinkProtocol"); - return end(code2); - } - if (code2 === null || code2 === 32 || code2 === 60 || asciiControl(code2)) { - return nok(code2); - } - effects.consume(code2); - return urlInside; - } - function emailAtext(code2) { - if (code2 === 64) { - effects.consume(code2); - size = 0; - return emailAtSignOrDot; - } - if (asciiAtext(code2)) { - effects.consume(code2); - return emailAtext; - } - return nok(code2); - } - function emailAtSignOrDot(code2) { - return asciiAlphanumeric(code2) ? emailLabel(code2) : nok(code2); - } - function emailLabel(code2) { - if (code2 === 46) { - effects.consume(code2); - size = 0; - return emailAtSignOrDot; - } - if (code2 === 62) { - effects.exit("autolinkProtocol").type = "autolinkEmail"; - return end(code2); - } - return emailValue(code2); - } - function emailValue(code2) { - if ((code2 === 45 || asciiAlphanumeric(code2)) && size++ < 63) { - effects.consume(code2); - return code2 === 45 ? emailValue : emailLabel; - } - return nok(code2); - } - function end(code2) { - effects.enter("autolinkMarker"); - effects.consume(code2); - effects.exit("autolinkMarker"); - effects.exit("autolink"); - return ok2; - } -} - -// node_modules/micromark-core-commonmark/lib/blank-line.js -var blankLine = { - tokenize: tokenizeBlankLine, - partial: true -}; -function tokenizeBlankLine(effects, ok2, nok) { - return factorySpace(effects, afterWhitespace, "linePrefix"); - function afterWhitespace(code2) { - return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2); - } -} - -// node_modules/micromark-core-commonmark/lib/block-quote.js -var blockQuote = { - name: "blockQuote", - tokenize: tokenizeBlockQuoteStart, - continuation: { - tokenize: tokenizeBlockQuoteContinuation - }, - exit -}; -function tokenizeBlockQuoteStart(effects, ok2, nok) { - const self2 = this; - return start3; - function start3(code2) { - if (code2 === 62) { - const state = self2.containerState; - if (!state.open) { - effects.enter("blockQuote", { - _container: true - }); - state.open = true; - } - effects.enter("blockQuotePrefix"); - effects.enter("blockQuoteMarker"); - effects.consume(code2); - effects.exit("blockQuoteMarker"); - return after; - } - return nok(code2); - } - function after(code2) { - if (markdownSpace(code2)) { - effects.enter("blockQuotePrefixWhitespace"); - effects.consume(code2); - effects.exit("blockQuotePrefixWhitespace"); - effects.exit("blockQuotePrefix"); - return ok2; - } - effects.exit("blockQuotePrefix"); - return ok2(code2); - } -} -function tokenizeBlockQuoteContinuation(effects, ok2, nok) { - return factorySpace( - effects, - effects.attempt(blockQuote, ok2, nok), - "linePrefix", - this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 - ); -} -function exit(effects) { - effects.exit("blockQuote"); -} - -// node_modules/micromark-core-commonmark/lib/character-escape.js -var characterEscape = { - name: "characterEscape", - tokenize: tokenizeCharacterEscape -}; -function tokenizeCharacterEscape(effects, ok2, nok) { - return start3; - function start3(code2) { - effects.enter("characterEscape"); - effects.enter("escapeMarker"); - effects.consume(code2); - effects.exit("escapeMarker"); - return open; - } - function open(code2) { - if (asciiPunctuation(code2)) { - effects.enter("characterEscapeValue"); - effects.consume(code2); - effects.exit("characterEscapeValue"); - effects.exit("characterEscape"); - return ok2; - } - return nok(code2); - } + +// node_modules/is-alphanumerical/index.js +function isAlphanumerical(character) { + return isAlphabetical(character) || isDecimal(character); } // node_modules/character-entities/index.js @@ -14924,3641 +9396,10432 @@ var characterEntities = { zwnj: "\u200C" }; -// node_modules/decode-named-character-reference/index.js -var own3 = {}.hasOwnProperty; -function decodeNamedCharacterReference(value) { - return own3.call(characterEntities, value) ? characterEntities[value] : false; +// node_modules/decode-named-character-reference/index.js +var own = {}.hasOwnProperty; +function decodeNamedCharacterReference(value) { + return own.call(characterEntities, value) ? characterEntities[value] : false; +} + +// node_modules/parse-entities/lib/index.js +var fromCharCode = String.fromCharCode; +var messages = [ + "", + /* 1: Non terminated (named) */ + "Named character references must be terminated by a semicolon", + /* 2: Non terminated (numeric) */ + "Numeric character references must be terminated by a semicolon", + /* 3: Empty (named) */ + "Named character references cannot be empty", + /* 4: Empty (numeric) */ + "Numeric character references cannot be empty", + /* 5: Unknown (named) */ + "Named character references must be known", + /* 6: Disallowed (numeric) */ + "Numeric character references cannot be disallowed", + /* 7: Prohibited (numeric) */ + "Numeric character references cannot be outside the permissible Unicode range" +]; +function parseEntities(value, options = {}) { + const additional = typeof options.additional === "string" ? options.additional.charCodeAt(0) : options.additional; + const result = []; + let index2 = 0; + let lines = -1; + let queue = ""; + let point4; + let indent2; + if (options.position) { + if ("start" in options.position || "indent" in options.position) { + indent2 = options.position.indent; + point4 = options.position.start; + } else { + point4 = options.position; + } + } + let line = (point4 ? point4.line : 0) || 1; + let column = (point4 ? point4.column : 0) || 1; + let previous2 = now(); + let character; + index2--; + while (++index2 <= value.length) { + if (character === 10) { + column = (indent2 ? indent2[lines] : 0) || 1; + } + character = value.charCodeAt(index2); + if (character === 38) { + const following = value.charCodeAt(index2 + 1); + if (following === 9 || following === 10 || following === 12 || following === 32 || following === 38 || following === 60 || Number.isNaN(following) || additional && following === additional) { + queue += fromCharCode(character); + column++; + continue; + } + const start2 = index2 + 1; + let begin = start2; + let end = start2; + let type; + if (following === 35) { + end = ++begin; + const following2 = value.charCodeAt(end); + if (following2 === 88 || following2 === 120) { + type = "hexadecimal"; + end = ++begin; + } else { + type = "decimal"; + } + } else { + type = "named"; + } + let characterReferenceCharacters = ""; + let characterReference2 = ""; + let characters = ""; + const test = type === "named" ? isAlphanumerical : type === "decimal" ? isDecimal : isHexadecimal; + end--; + while (++end <= value.length) { + const following2 = value.charCodeAt(end); + if (!test(following2)) { + break; + } + characters += fromCharCode(following2); + if (type === "named" && characterEntitiesLegacy.includes(characters)) { + characterReferenceCharacters = characters; + characterReference2 = decodeNamedCharacterReference(characters); + } + } + let terminated = value.charCodeAt(end) === 59; + if (terminated) { + end++; + const namedReference = type === "named" ? decodeNamedCharacterReference(characters) : false; + if (namedReference) { + characterReferenceCharacters = characters; + characterReference2 = namedReference; + } + } + let diff = 1 + end - start2; + let reference = ""; + if (!terminated && options.nonTerminated === false) { + } else if (!characters) { + if (type !== "named") { + warning(4, diff); + } + } else if (type === "named") { + if (terminated && !characterReference2) { + warning(5, 1); + } else { + if (characterReferenceCharacters !== characters) { + end = begin + characterReferenceCharacters.length; + diff = 1 + end - begin; + terminated = false; + } + if (!terminated) { + const reason = characterReferenceCharacters ? 1 : 3; + if (options.attribute) { + const following2 = value.charCodeAt(end); + if (following2 === 61) { + warning(reason, diff); + characterReference2 = ""; + } else if (isAlphanumerical(following2)) { + characterReference2 = ""; + } else { + warning(reason, diff); + } + } else { + warning(reason, diff); + } + } + } + reference = characterReference2; + } else { + if (!terminated) { + warning(2, diff); + } + let referenceCode = Number.parseInt( + characters, + type === "hexadecimal" ? 16 : 10 + ); + if (prohibited(referenceCode)) { + warning(7, diff); + reference = fromCharCode( + 65533 + /* `�` */ + ); + } else if (referenceCode in characterReferenceInvalid) { + warning(6, diff); + reference = characterReferenceInvalid[referenceCode]; + } else { + let output = ""; + if (disallowed(referenceCode)) { + warning(6, diff); + } + if (referenceCode > 65535) { + referenceCode -= 65536; + output += fromCharCode(referenceCode >>> (10 & 1023) | 55296); + referenceCode = 56320 | referenceCode & 1023; + } + reference = output + fromCharCode(referenceCode); + } + } + if (reference) { + flush(); + previous2 = now(); + index2 = end - 1; + column += end - start2 + 1; + result.push(reference); + const next = now(); + next.offset++; + if (options.reference) { + options.reference.call( + options.referenceContext, + reference, + { start: previous2, end: next }, + value.slice(start2 - 1, end) + ); + } + previous2 = next; + } else { + characters = value.slice(start2 - 1, end); + queue += characters; + column += characters.length; + index2 = end - 1; + } + } else { + if (character === 10) { + line++; + lines++; + column = 0; + } + if (Number.isNaN(character)) { + flush(); + } else { + queue += fromCharCode(character); + column++; + } + } + } + return result.join(""); + function now() { + return { + line, + column, + offset: index2 + ((point4 ? point4.offset : 0) || 0) + }; + } + function warning(code2, offset2) { + let position3; + if (options.warning) { + position3 = now(); + position3.column += offset2; + position3.offset += offset2; + options.warning.call( + options.warningContext, + messages[code2], + position3, + code2 + ); + } + } + function flush() { + if (queue) { + result.push(queue); + if (options.text) { + options.text.call(options.textContext, queue, { + start: previous2, + end: now() + }); + } + queue = ""; + } + } +} +function prohibited(code2) { + return code2 >= 55296 && code2 <= 57343 || code2 > 1114111; +} +function disallowed(code2) { + return code2 >= 1 && code2 <= 8 || code2 === 11 || code2 >= 13 && code2 <= 31 || code2 >= 127 && code2 <= 159 || code2 >= 64976 && code2 <= 65007 || (code2 & 65535) === 65535 || (code2 & 65535) === 65534; +} + +// node_modules/stringify-entities/lib/core.js +function core(value, options) { + value = value.replace( + options.subset ? charactersToExpression(options.subset) : /["&'<>`]/g, + basic + ); + if (options.subset || options.escapeOnly) { + return value; + } + return value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, surrogate).replace( + // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape + /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, + basic + ); + function surrogate(pair, index2, all3) { + return options.format( + (pair.charCodeAt(0) - 55296) * 1024 + pair.charCodeAt(1) - 56320 + 65536, + all3.charCodeAt(index2 + 2), + options + ); + } + function basic(character, index2, all3) { + return options.format( + character.charCodeAt(0), + all3.charCodeAt(index2 + 1), + options + ); + } +} +function charactersToExpression(subset) { + const groups = []; + let index2 = -1; + while (++index2 < subset.length) { + groups.push(subset[index2].replace(/[|\\{}()[\]^$+*?.]/g, "\\$&")); + } + return new RegExp("(?:" + groups.join("|") + ")", "g"); +} + +// node_modules/stringify-entities/lib/util/format-basic.js +function formatBasic(code2) { + return "&#x" + code2.toString(16).toUpperCase() + ";"; +} + +// node_modules/stringify-entities/lib/index.js +function stringifyEntitiesLight(value, options) { + return core(value, Object.assign({ format: formatBasic }, options)); +} + +// node_modules/mdast-util-mdx-jsx/lib/index.js +var indent = " "; +function mdxJsxFromMarkdown() { + return { + canContainEols: ["mdxJsxTextElement"], + enter: { + mdxJsxFlowTag: enterMdxJsxTag, + mdxJsxFlowTagClosingMarker: enterMdxJsxTagClosingMarker, + mdxJsxFlowTagAttribute: enterMdxJsxTagAttribute, + mdxJsxFlowTagExpressionAttribute: enterMdxJsxTagExpressionAttribute, + mdxJsxFlowTagAttributeValueLiteral: buffer, + mdxJsxFlowTagAttributeValueExpression: buffer, + mdxJsxFlowTagSelfClosingMarker: enterMdxJsxTagSelfClosingMarker, + mdxJsxTextTag: enterMdxJsxTag, + mdxJsxTextTagClosingMarker: enterMdxJsxTagClosingMarker, + mdxJsxTextTagAttribute: enterMdxJsxTagAttribute, + mdxJsxTextTagExpressionAttribute: enterMdxJsxTagExpressionAttribute, + mdxJsxTextTagAttributeValueLiteral: buffer, + mdxJsxTextTagAttributeValueExpression: buffer, + mdxJsxTextTagSelfClosingMarker: enterMdxJsxTagSelfClosingMarker + }, + exit: { + mdxJsxFlowTagClosingMarker: exitMdxJsxTagClosingMarker, + mdxJsxFlowTagNamePrimary: exitMdxJsxTagNamePrimary, + mdxJsxFlowTagNameMember: exitMdxJsxTagNameMember, + mdxJsxFlowTagNameLocal: exitMdxJsxTagNameLocal, + mdxJsxFlowTagExpressionAttribute: exitMdxJsxTagExpressionAttribute, + mdxJsxFlowTagExpressionAttributeValue: data2, + mdxJsxFlowTagAttributeNamePrimary: exitMdxJsxTagAttributeNamePrimary, + mdxJsxFlowTagAttributeNameLocal: exitMdxJsxTagAttributeNameLocal, + mdxJsxFlowTagAttributeValueLiteral: exitMdxJsxTagAttributeValueLiteral, + mdxJsxFlowTagAttributeValueLiteralValue: data2, + mdxJsxFlowTagAttributeValueExpression: exitMdxJsxTagAttributeValueExpression, + mdxJsxFlowTagAttributeValueExpressionValue: data2, + mdxJsxFlowTagSelfClosingMarker: exitMdxJsxTagSelfClosingMarker, + mdxJsxFlowTag: exitMdxJsxTag, + mdxJsxTextTagClosingMarker: exitMdxJsxTagClosingMarker, + mdxJsxTextTagNamePrimary: exitMdxJsxTagNamePrimary, + mdxJsxTextTagNameMember: exitMdxJsxTagNameMember, + mdxJsxTextTagNameLocal: exitMdxJsxTagNameLocal, + mdxJsxTextTagExpressionAttribute: exitMdxJsxTagExpressionAttribute, + mdxJsxTextTagExpressionAttributeValue: data2, + mdxJsxTextTagAttributeNamePrimary: exitMdxJsxTagAttributeNamePrimary, + mdxJsxTextTagAttributeNameLocal: exitMdxJsxTagAttributeNameLocal, + mdxJsxTextTagAttributeValueLiteral: exitMdxJsxTagAttributeValueLiteral, + mdxJsxTextTagAttributeValueLiteralValue: data2, + mdxJsxTextTagAttributeValueExpression: exitMdxJsxTagAttributeValueExpression, + mdxJsxTextTagAttributeValueExpressionValue: data2, + mdxJsxTextTagSelfClosingMarker: exitMdxJsxTagSelfClosingMarker, + mdxJsxTextTag: exitMdxJsxTag + } + }; + function buffer() { + this.buffer(); + } + function data2(token) { + this.config.enter.data.call(this, token); + this.config.exit.data.call(this, token); + } + function enterMdxJsxTag(token) { + const tag = { + name: void 0, + attributes: [], + close: false, + selfClosing: false, + start: token.start, + end: token.end + }; + if (!this.data.mdxJsxTagStack) + this.data.mdxJsxTagStack = []; + this.data.mdxJsxTag = tag; + this.buffer(); + } + function enterMdxJsxTagClosingMarker(token) { + const stack = this.data.mdxJsxTagStack; + ok(stack, "expected `mdxJsxTagStack`"); + if (stack.length === 0) { + throw new VFileMessage( + "Unexpected closing slash `/` in tag, expected an open tag first", + { start: token.start, end: token.end }, + "mdast-util-mdx-jsx:unexpected-closing-slash" + ); + } + } + function enterMdxJsxTagAnyAttribute(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + if (tag.close) { + throw new VFileMessage( + "Unexpected attribute in closing tag, expected the end of the tag", + { start: token.start, end: token.end }, + "mdast-util-mdx-jsx:unexpected-attribute" + ); + } + } + function enterMdxJsxTagSelfClosingMarker(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + if (tag.close) { + throw new VFileMessage( + "Unexpected self-closing slash `/` in closing tag, expected the end of the tag", + { start: token.start, end: token.end }, + "mdast-util-mdx-jsx:unexpected-self-closing-slash" + ); + } + } + function exitMdxJsxTagClosingMarker() { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + tag.close = true; + } + function exitMdxJsxTagNamePrimary(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + tag.name = this.sliceSerialize(token); + } + function exitMdxJsxTagNameMember(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + tag.name += "." + this.sliceSerialize(token); + } + function exitMdxJsxTagNameLocal(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + tag.name += ":" + this.sliceSerialize(token); + } + function enterMdxJsxTagAttribute(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + enterMdxJsxTagAnyAttribute.call(this, token); + tag.attributes.push({ type: "mdxJsxAttribute", name: "", value: null }); + } + function enterMdxJsxTagExpressionAttribute(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + enterMdxJsxTagAnyAttribute.call(this, token); + tag.attributes.push({ type: "mdxJsxExpressionAttribute", value: "" }); + this.buffer(); + } + function exitMdxJsxTagExpressionAttribute(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + const tail = tag.attributes[tag.attributes.length - 1]; + ok(tail.type === "mdxJsxExpressionAttribute"); + const estree = token.estree; + tail.value = this.resume(); + if (estree) { + tail.data = { estree }; + } + } + function exitMdxJsxTagAttributeNamePrimary(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + const node2 = tag.attributes[tag.attributes.length - 1]; + ok(node2.type === "mdxJsxAttribute"); + node2.name = this.sliceSerialize(token); + } + function exitMdxJsxTagAttributeNameLocal(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + const node2 = tag.attributes[tag.attributes.length - 1]; + ok(node2.type === "mdxJsxAttribute"); + node2.name += ":" + this.sliceSerialize(token); + } + function exitMdxJsxTagAttributeValueLiteral() { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + tag.attributes[tag.attributes.length - 1].value = parseEntities( + this.resume(), + { nonTerminated: false } + ); + } + function exitMdxJsxTagAttributeValueExpression(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + const tail = tag.attributes[tag.attributes.length - 1]; + ok(tail.type === "mdxJsxAttribute"); + const node2 = { type: "mdxJsxAttributeValueExpression", value: this.resume() }; + const estree = token.estree; + if (estree) { + node2.data = { estree }; + } + tail.value = node2; + } + function exitMdxJsxTagSelfClosingMarker() { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + tag.selfClosing = true; + } + function exitMdxJsxTag(token) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + const stack = this.data.mdxJsxTagStack; + ok(stack, "expected `mdxJsxTagStack`"); + const tail = stack[stack.length - 1]; + if (tag.close && tail.name !== tag.name) { + throw new VFileMessage( + "Unexpected closing tag `" + serializeAbbreviatedTag(tag) + "`, expected corresponding closing tag for `" + serializeAbbreviatedTag(tail) + "` (" + stringifyPosition(tail) + ")", + { start: token.start, end: token.end }, + "mdast-util-mdx-jsx:end-tag-mismatch" + ); + } + this.resume(); + if (tag.close) { + stack.pop(); + } else { + this.enter( + { + type: token.type === "mdxJsxTextTag" ? "mdxJsxTextElement" : "mdxJsxFlowElement", + name: tag.name || null, + attributes: tag.attributes, + children: [] + }, + token, + onErrorRightIsTag + ); + } + if (tag.selfClosing || tag.close) { + this.exit(token, onErrorLeftIsTag); + } else { + stack.push(tag); + } + } + function onErrorRightIsTag(closing, open) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + const place = closing ? " before the end of `" + closing.type + "`" : ""; + const position3 = closing ? { start: closing.start, end: closing.end } : void 0; + throw new VFileMessage( + "Expected a closing tag for `" + serializeAbbreviatedTag(tag) + "` (" + stringifyPosition({ start: open.start, end: open.end }) + ")" + place, + position3, + "mdast-util-mdx-jsx:end-tag-mismatch" + ); + } + function onErrorLeftIsTag(a, b) { + const tag = this.data.mdxJsxTag; + ok(tag, "expected `mdxJsxTag`"); + throw new VFileMessage( + "Expected the closing tag `" + serializeAbbreviatedTag(tag) + "` either after the end of `" + b.type + "` (" + stringifyPosition(b.end) + ") or another opening tag after the start of `" + b.type + "` (" + stringifyPosition(b.start) + ")", + { start: a.start, end: a.end }, + "mdast-util-mdx-jsx:end-tag-mismatch" + ); + } + function serializeAbbreviatedTag(tag) { + return "<" + (tag.close ? "/" : "") + (tag.name || "") + ">"; + } +} +function mdxJsxToMarkdown(options) { + const options_ = options || {}; + const quote = options_.quote || '"'; + const quoteSmart = options_.quoteSmart || false; + const tightSelfClosing = options_.tightSelfClosing || false; + const printWidth = options_.printWidth || Number.POSITIVE_INFINITY; + const alternative = quote === '"' ? "'" : '"'; + if (quote !== '"' && quote !== "'") { + throw new Error( + "Cannot serialize attribute values with `" + quote + "` for `options.quote`, expected `\"`, or `'`" + ); + } + mdxElement.peek = peekElement; + return { + handlers: { + mdxJsxFlowElement: mdxElement, + mdxJsxTextElement: mdxElement + }, + unsafe: [ + { character: "<", inConstruct: ["phrasing"] }, + { atBreak: true, character: "<" } + ], + // Always generate fenced code (never indented code). + fences: true, + // Always generate links with resources (never autolinks). + resourceLink: true + }; + function mdxElement(node2, _, state, info) { + const flow3 = node2.type === "mdxJsxFlowElement"; + const selfClosing = node2.name ? !node2.children || node2.children.length === 0 : false; + const depth = inferDepth(state); + const currentIndent = createIndent(depth); + const trackerOneLine = state.createTracker(info); + const trackerMultiLine = state.createTracker(info); + const serializedAttributes = []; + const prefix = (flow3 ? currentIndent : "") + "<" + (node2.name || ""); + const exit2 = state.enter(node2.type); + trackerOneLine.move(prefix); + trackerMultiLine.move(prefix); + if (node2.attributes && node2.attributes.length > 0) { + if (!node2.name) { + throw new Error("Cannot serialize fragment w/ attributes"); + } + let index2 = -1; + while (++index2 < node2.attributes.length) { + const attribute = node2.attributes[index2]; + let result; + if (attribute.type === "mdxJsxExpressionAttribute") { + result = "{" + (attribute.value || "") + "}"; + } else { + if (!attribute.name) { + throw new Error("Cannot serialize attribute w/o name"); + } + const value2 = attribute.value; + const left = attribute.name; + let right = ""; + if (value2 === null || value2 === void 0) { + } else if (typeof value2 === "object") { + right = "{" + (value2.value || "") + "}"; + } else { + const appliedQuote = quoteSmart && ccount(value2, quote) > ccount(value2, alternative) ? alternative : quote; + right = appliedQuote + stringifyEntitiesLight(value2, { subset: [appliedQuote] }) + appliedQuote; + } + result = left + (right ? "=" : "") + right; + } + serializedAttributes.push(result); + } + } + let attributesOnTheirOwnLine = false; + const attributesOnOneLine = serializedAttributes.join(" "); + if ( + // Block: + flow3 && // Including a line ending (expressions). + (/\r?\n|\r/.test(attributesOnOneLine) || // Current position (including ``. + (selfClosing ? tightSelfClosing ? 2 : 3 : 1) > printWidth) + ) { + attributesOnTheirOwnLine = true; + } + let tracker = trackerOneLine; + let value = prefix; + if (attributesOnTheirOwnLine) { + tracker = trackerMultiLine; + let index2 = -1; + while (++index2 < serializedAttributes.length) { + serializedAttributes[index2] = currentIndent + indent + serializedAttributes[index2]; + } + value += tracker.move( + "\n" + serializedAttributes.join("\n") + "\n" + currentIndent + ); + } else if (attributesOnOneLine) { + value += tracker.move(" " + attributesOnOneLine); + } + if (selfClosing) { + value += tracker.move( + (tightSelfClosing || attributesOnTheirOwnLine ? "" : " ") + "/" + ); + } + value += tracker.move(">"); + if (node2.children && node2.children.length > 0) { + if (node2.type === "mdxJsxTextElement") { + value += tracker.move( + // @ts-expect-error: `containerPhrasing` is typed correctly, but TS + // generates *hardcoded* types, which means that our dynamically added + // directives are not present. + // At some point, TS should fix that, and `from-markdown` should be fine. + state.containerPhrasing(node2, { + ...tracker.current(), + before: ">", + after: "<" + }) + ); + } else { + tracker.shift(2); + value += tracker.move("\n"); + value += tracker.move(containerFlow(node2, state, tracker.current())); + value += tracker.move("\n"); + } + } + if (!selfClosing) { + value += tracker.move( + (flow3 ? currentIndent : "") + "" + ); + } + exit2(); + return value; + } +} +function containerFlow(parent, state, info) { + const indexStack = state.indexStack; + const children = parent.children; + const tracker = state.createTracker(info); + const currentIndent = createIndent(inferDepth(state)); + const results = []; + let index2 = -1; + indexStack.push(-1); + while (++index2 < children.length) { + const child = children[index2]; + indexStack[indexStack.length - 1] = index2; + const childInfo = { before: "\n", after: "\n", ...tracker.current() }; + const result = state.handle(child, parent, state, childInfo); + const serializedChild = child.type === "mdxJsxFlowElement" ? result : state.indentLines(result, function(line, _, blank) { + return (blank ? "" : currentIndent) + line; + }); + results.push(tracker.move(serializedChild)); + if (child.type !== "list") { + state.bulletLastUsed = void 0; + } + if (index2 < children.length - 1) { + results.push(tracker.move("\n\n")); + } + } + indexStack.pop(); + return results.join(""); +} +function inferDepth(state) { + let depth = 0; + for (const x of state.stack) { + if (x === "mdxJsxFlowElement") { + depth++; + } + } + return depth; +} +function createIndent(depth) { + return indent.repeat(depth); +} +function peekElement() { + return "<"; +} + +// node_modules/mdast-util-mdxjs-esm/lib/index.js +function mdxjsEsmFromMarkdown() { + return { + enter: { mdxjsEsm: enterMdxjsEsm }, + exit: { mdxjsEsm: exitMdxjsEsm, mdxjsEsmData: exitMdxjsEsmData } + }; +} +function mdxjsEsmToMarkdown() { + return { handlers: { mdxjsEsm: handleMdxjsEsm } }; +} +function enterMdxjsEsm(token) { + this.enter({ type: "mdxjsEsm", value: "" }, token); + this.buffer(); +} +function exitMdxjsEsm(token) { + const value = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + ok(node2.type === "mdxjsEsm"); + this.exit(token); + const estree = token.estree; + node2.value = value; + if (estree) { + node2.data = { estree }; + } +} +function exitMdxjsEsmData(token) { + this.config.enter.data.call(this, token); + this.config.exit.data.call(this, token); +} +function handleMdxjsEsm(node2) { + return node2.value || ""; +} + +// node_modules/mdast-util-mdx/lib/index.js +function mdxFromMarkdown() { + return [ + mdxExpressionFromMarkdown(), + mdxJsxFromMarkdown(), + mdxjsEsmFromMarkdown() + ]; +} +function mdxToMarkdown(options) { + return { + extensions: [ + mdxExpressionToMarkdown(), + mdxJsxToMarkdown(options), + mdxjsEsmToMarkdown() + ] + }; +} + +// node_modules/acorn/dist/acorn.mjs +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, 81, 2, 71, 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, 3, 0, 158, 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, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 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, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; +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, 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, 20, 1, 64, 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, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 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, 16, 0, 30, 2, 3, 0, 15, 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, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 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, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191]; +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\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\u0CF3\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-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; +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\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"; +var reservedWords = { + 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", + 5: "class enum extends super const export import", + 6: "enum", + strict: "implements interface let package private protected public static yield", + strictBind: "eval arguments" +}; +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"; +var keywords$1 = { + 5: ecma5AndLessKeywords, + "5module": ecma5AndLessKeywords + " export import", + 6: ecma5AndLessKeywords + " const class extends export import super" +}; +var keywordRelationalOperator = /^in(stanceof)?$/; +var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); +var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); +function isInAstralSet(code2, set) { + var pos = 65536; + for (var i = 0; i < set.length; i += 2) { + pos += set[i]; + if (pos > code2) { + return false; + } + pos += set[i + 1]; + if (pos >= code2) { + return true; + } + } + return false; +} +function isIdentifierStart(code2, astral) { + if (code2 < 65) { + return code2 === 36; + } + if (code2 < 91) { + return true; + } + if (code2 < 97) { + return code2 === 95; + } + if (code2 < 123) { + return true; + } + if (code2 <= 65535) { + return code2 >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code2)); + } + if (astral === false) { + return false; + } + return isInAstralSet(code2, astralIdentifierStartCodes); +} +function isIdentifierChar(code2, astral) { + if (code2 < 48) { + return code2 === 36; + } + if (code2 < 58) { + return true; + } + if (code2 < 65) { + return false; + } + if (code2 < 91) { + return true; + } + if (code2 < 97) { + return code2 === 95; + } + if (code2 < 123) { + return true; + } + if (code2 <= 65535) { + return code2 >= 170 && nonASCIIidentifier.test(String.fromCharCode(code2)); + } + if (astral === false) { + return false; + } + return isInAstralSet(code2, astralIdentifierStartCodes) || isInAstralSet(code2, astralIdentifierCodes); +} +var TokenType = function TokenType2(label, conf) { + if (conf === void 0) + conf = {}; + this.label = label; + this.keyword = conf.keyword; + this.beforeExpr = !!conf.beforeExpr; + this.startsExpr = !!conf.startsExpr; + this.isLoop = !!conf.isLoop; + this.isAssign = !!conf.isAssign; + this.prefix = !!conf.prefix; + this.postfix = !!conf.postfix; + this.binop = conf.binop || null; + this.updateContext = null; +}; +function binop(name2, prec) { + return new TokenType(name2, { beforeExpr: true, binop: prec }); +} +var beforeExpr = { beforeExpr: true }; +var startsExpr = { startsExpr: true }; +var keywords = {}; +function kw(name2, options) { + if (options === void 0) + options = {}; + options.keyword = name2; + return keywords[name2] = new TokenType(name2, options); +} +var types$1 = { + num: new TokenType("num", startsExpr), + regexp: new TokenType("regexp", startsExpr), + string: new TokenType("string", startsExpr), + name: new TokenType("name", startsExpr), + privateId: new TokenType("privateId", startsExpr), + eof: new TokenType("eof"), + // Punctuation token types. + bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }), + bracketR: new TokenType("]"), + braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }), + braceR: new TokenType("}"), + parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }), + parenR: new TokenType(")"), + comma: new TokenType(",", beforeExpr), + semi: new TokenType(";", beforeExpr), + colon: new TokenType(":", beforeExpr), + dot: new TokenType("."), + question: new TokenType("?", beforeExpr), + questionDot: new TokenType("?."), + arrow: new TokenType("=>", beforeExpr), + template: new TokenType("template"), + invalidTemplate: new TokenType("invalidTemplate"), + ellipsis: new TokenType("...", beforeExpr), + backQuote: new TokenType("`", startsExpr), + dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }), + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. + eq: new TokenType("=", { beforeExpr: true, isAssign: true }), + assign: new TokenType("_=", { beforeExpr: true, isAssign: true }), + incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }), + prefix: new TokenType("!/~", { beforeExpr: true, prefix: true, startsExpr: true }), + logicalOR: binop("||", 1), + logicalAND: binop("&&", 2), + bitwiseOR: binop("|", 3), + bitwiseXOR: binop("^", 4), + bitwiseAND: binop("&", 5), + equality: binop("==/!=/===/!==", 6), + relational: binop("/<=/>=", 7), + bitShift: binop("<>/>>>", 8), + plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }), + modulo: binop("%", 10), + star: binop("*", 10), + slash: binop("/", 10), + starstar: new TokenType("**", { beforeExpr: true }), + coalesce: binop("??", 1), + // Keyword token types. + _break: kw("break"), + _case: kw("case", beforeExpr), + _catch: kw("catch"), + _continue: kw("continue"), + _debugger: kw("debugger"), + _default: kw("default", beforeExpr), + _do: kw("do", { isLoop: true, beforeExpr: true }), + _else: kw("else", beforeExpr), + _finally: kw("finally"), + _for: kw("for", { isLoop: true }), + _function: kw("function", startsExpr), + _if: kw("if"), + _return: kw("return", beforeExpr), + _switch: kw("switch"), + _throw: kw("throw", beforeExpr), + _try: kw("try"), + _var: kw("var"), + _const: kw("const"), + _while: kw("while", { isLoop: true }), + _with: kw("with"), + _new: kw("new", { beforeExpr: true, startsExpr: true }), + _this: kw("this", startsExpr), + _super: kw("super", startsExpr), + _class: kw("class", startsExpr), + _extends: kw("extends", beforeExpr), + _export: kw("export"), + _import: kw("import", startsExpr), + _null: kw("null", startsExpr), + _true: kw("true", startsExpr), + _false: kw("false", startsExpr), + _in: kw("in", { beforeExpr: true, binop: 7 }), + _instanceof: kw("instanceof", { beforeExpr: true, binop: 7 }), + _typeof: kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }), + _void: kw("void", { beforeExpr: true, prefix: true, startsExpr: true }), + _delete: kw("delete", { beforeExpr: true, prefix: true, startsExpr: true }) +}; +var lineBreak = /\r\n?|\n|\u2028|\u2029/; +var lineBreakG = new RegExp(lineBreak.source, "g"); +function isNewLine(code2) { + return code2 === 10 || code2 === 13 || code2 === 8232 || code2 === 8233; +} +function nextLineBreak(code2, from, end) { + if (end === void 0) + end = code2.length; + for (var i = from; i < end; i++) { + var next = code2.charCodeAt(i); + if (isNewLine(next)) { + return i < end - 1 && next === 13 && code2.charCodeAt(i + 1) === 10 ? i + 2 : i + 1; + } + } + return -1; +} +var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; +var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; +var ref = Object.prototype; +var hasOwnProperty = ref.hasOwnProperty; +var toString = ref.toString; +var hasOwn = Object.hasOwn || function(obj, propName) { + return hasOwnProperty.call(obj, propName); +}; +var isArray = Array.isArray || function(obj) { + return toString.call(obj) === "[object Array]"; +}; +function wordsRegexp(words) { + return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"); +} +function codePointToString(code2) { + if (code2 <= 65535) { + return String.fromCharCode(code2); + } + code2 -= 65536; + return String.fromCharCode((code2 >> 10) + 55296, (code2 & 1023) + 56320); +} +var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; +var Position = function Position2(line, col) { + this.line = line; + this.column = col; +}; +Position.prototype.offset = function offset(n) { + return new Position(this.line, this.column + n); +}; +var SourceLocation = function SourceLocation2(p, start2, end) { + this.start = start2; + this.end = end; + if (p.sourceFile !== null) { + this.source = p.sourceFile; + } +}; +function getLineInfo(input, offset2) { + for (var line = 1, cur = 0; ; ) { + var nextBreak = nextLineBreak(input, cur, offset2); + if (nextBreak < 0) { + return new Position(line, offset2 - cur); + } + ++line; + cur = nextBreak; + } +} +var defaultOptions = { + // `ecmaVersion` indicates the ECMAScript version to parse. Must be + // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 + // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` + // (the latest version the library supports). This influences + // support for strict mode, the set of reserved words, and support + // for new syntax features. + ecmaVersion: null, + // `sourceType` indicates the mode the code should be parsed in. + // Can be either `"script"` or `"module"`. This influences global + // strict mode and parsing of `import` and `export` declarations. + sourceType: "script", + // `onInsertedSemicolon` can be a callback that will be called + // when a semicolon is automatically inserted. It will be passed + // the position of the comma as an offset, and if `locations` is + // enabled, it is given the location as a `{line, column}` object + // as second argument. + onInsertedSemicolon: null, + // `onTrailingComma` is similar to `onInsertedSemicolon`, but for + // trailing commas. + onTrailingComma: null, + // By default, reserved words are only enforced if ecmaVersion >= 5. + // Set `allowReserved` to a boolean value to explicitly turn this on + // an off. When this option has the value "never", reserved words + // and keywords can also not be used as property names. + allowReserved: null, + // When enabled, a return at the top level is not considered an + // error. + allowReturnOutsideFunction: false, + // When enabled, import/export statements are not constrained to + // appearing at the top of the program, and an import.meta expression + // in a script isn't considered an error. + allowImportExportEverywhere: false, + // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022. + // When enabled, await identifiers are allowed to appear at the top-level scope, + // but they are still not allowed in non-async functions. + allowAwaitOutsideFunction: null, + // When enabled, super identifiers are not constrained to + // appearing in methods and do not raise an error when they appear elsewhere. + allowSuperOutsideMethod: null, + // When enabled, hashbang directive in the beginning of file is + // allowed and treated as a line comment. Enabled by default when + // `ecmaVersion` >= 2023. + allowHashBang: false, + // By default, the parser will verify that private properties are + // only used in places where they are valid and have been declared. + // Set this to false to turn such checks off. + checkPrivateFields: true, + // When `locations` is on, `loc` properties holding objects with + // `start` and `end` properties in `{line, column}` form (with + // line being 1-based and column 0-based) will be attached to the + // nodes. + locations: false, + // A function can be passed as `onToken` option, which will + // cause Acorn to call that function with object in the same + // format as tokens returned from `tokenizer().getToken()`. Note + // that you are not allowed to call the parser from the + // callback—that will corrupt its internal state. + onToken: null, + // A function can be passed as `onComment` option, which will + // cause Acorn to call that function with `(block, text, start, + // end)` parameters whenever a comment is skipped. `block` is a + // boolean indicating whether this is a block (`/* */`) comment, + // `text` is the content of the comment, and `start` and `end` are + // character offsets that denote the start and end of the comment. + // When the `locations` option is on, two more parameters are + // passed, the full `{line, column}` locations of the start and + // end of the comments. Note that you are not allowed to call the + // parser from the callback—that will corrupt its internal state. + onComment: null, + // Nodes have their start and end characters offsets recorded in + // `start` and `end` properties (directly on the node, rather than + // the `loc` object, which holds line/column data. To also add a + // [semi-standardized][range] `range` property holding a `[start, + // end]` array with the same numbers, set the `ranges` option to + // `true`. + // + // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 + ranges: false, + // It is possible to parse multiple files into a single AST by + // passing the tree produced by parsing the first file as + // `program` option in subsequent parses. This will add the + // toplevel forms of the parsed file to the `Program` (top) node + // of an existing parse tree. + program: null, + // When `locations` is on, you can pass this to record the source + // file in every node's `loc` object. + sourceFile: null, + // This value, if given, is stored in every node, whether + // `locations` is on or off. + directSourceFile: null, + // When enabled, parenthesized expressions are represented by + // (non-standard) ParenthesizedExpression nodes + preserveParens: false +}; +var warnedAboutEcmaVersion = false; +function getOptions(opts) { + var options = {}; + for (var opt in defaultOptions) { + options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; + } + if (options.ecmaVersion === "latest") { + options.ecmaVersion = 1e8; + } else if (options.ecmaVersion == null) { + if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) { + warnedAboutEcmaVersion = true; + console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future."); + } + options.ecmaVersion = 11; + } else if (options.ecmaVersion >= 2015) { + options.ecmaVersion -= 2009; + } + if (options.allowReserved == null) { + options.allowReserved = options.ecmaVersion < 5; + } + if (!opts || opts.allowHashBang == null) { + options.allowHashBang = options.ecmaVersion >= 14; + } + if (isArray(options.onToken)) { + var tokens = options.onToken; + options.onToken = function(token) { + return tokens.push(token); + }; + } + if (isArray(options.onComment)) { + options.onComment = pushComment(options, options.onComment); + } + return options; +} +function pushComment(options, array) { + return function(block, text5, start2, end, startLoc, endLoc) { + var comment2 = { + type: block ? "Block" : "Line", + value: text5, + start: start2, + end + }; + if (options.locations) { + comment2.loc = new SourceLocation(this, startLoc, endLoc); + } + if (options.ranges) { + comment2.range = [start2, end]; + } + array.push(comment2); + }; +} +var SCOPE_TOP = 1; +var SCOPE_FUNCTION = 2; +var SCOPE_ASYNC = 4; +var SCOPE_GENERATOR = 8; +var SCOPE_ARROW = 16; +var SCOPE_SIMPLE_CATCH = 32; +var SCOPE_SUPER = 64; +var SCOPE_DIRECT_SUPER = 128; +var SCOPE_CLASS_STATIC_BLOCK = 256; +var SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; +function functionFlags(async, generator) { + return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0); +} +var BIND_NONE = 0; +var BIND_VAR = 1; +var BIND_LEXICAL = 2; +var BIND_FUNCTION = 3; +var BIND_SIMPLE_CATCH = 4; +var BIND_OUTSIDE = 5; +var Parser = function Parser2(options, input, startPos) { + this.options = options = getOptions(options); + this.sourceFile = options.sourceFile; + this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); + var reserved = ""; + if (options.allowReserved !== true) { + reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3]; + if (options.sourceType === "module") { + reserved += " await"; + } + } + this.reservedWords = wordsRegexp(reserved); + var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict; + this.reservedWordsStrict = wordsRegexp(reservedStrict); + this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind); + this.input = String(input); + this.containsEsc = false; + if (startPos) { + this.pos = startPos; + this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1; + this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; + } else { + this.pos = this.lineStart = 0; + this.curLine = 1; + } + this.type = types$1.eof; + this.value = null; + this.start = this.end = this.pos; + this.startLoc = this.endLoc = this.curPosition(); + this.lastTokEndLoc = this.lastTokStartLoc = null; + this.lastTokStart = this.lastTokEnd = this.pos; + this.context = this.initialContext(); + this.exprAllowed = true; + this.inModule = options.sourceType === "module"; + this.strict = this.inModule || this.strictDirective(this.pos); + this.potentialArrowAt = -1; + this.potentialArrowInForAwait = false; + this.yieldPos = this.awaitPos = this.awaitIdentPos = 0; + this.labels = []; + this.undefinedExports = /* @__PURE__ */ Object.create(null); + if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") { + this.skipLineComment(2); + } + this.scopeStack = []; + this.enterScope(SCOPE_TOP); + this.regexpState = null; + this.privateNameStack = []; +}; +var 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 } }; +Parser.prototype.parse = function parse() { + var node2 = this.options.program || this.startNode(); + this.nextToken(); + return this.parseTopLevel(node2); +}; +prototypeAccessors.inFunction.get = function() { + return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; +}; +prototypeAccessors.inGenerator.get = function() { + return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit; +}; +prototypeAccessors.inAsync.get = function() { + return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit; +}; +prototypeAccessors.canAwait.get = function() { + for (var i = this.scopeStack.length - 1; i >= 0; i--) { + var scope = this.scopeStack[i]; + if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { + return false; + } + if (scope.flags & SCOPE_FUNCTION) { + return (scope.flags & SCOPE_ASYNC) > 0; + } + } + return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction; +}; +prototypeAccessors.allowSuper.get = function() { + var ref2 = this.currentThisScope(); + var flags = ref2.flags; + var inClassFieldInit = ref2.inClassFieldInit; + return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod; +}; +prototypeAccessors.allowDirectSuper.get = function() { + return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; +}; +prototypeAccessors.treatFunctionsAsVar.get = function() { + return this.treatFunctionsAsVarInScope(this.currentScope()); +}; +prototypeAccessors.allowNewDotTarget.get = function() { + var ref2 = this.currentThisScope(); + var flags = ref2.flags; + var inClassFieldInit = ref2.inClassFieldInit; + return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit; +}; +prototypeAccessors.inClassStaticBlock.get = function() { + return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0; +}; +Parser.extend = function extend() { + var plugins = [], len = arguments.length; + while (len--) + plugins[len] = arguments[len]; + var cls = this; + for (var i = 0; i < plugins.length; i++) { + cls = plugins[i](cls); + } + return cls; +}; +Parser.parse = function parse2(input, options) { + return new this(options, input).parse(); +}; +Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) { + var parser = new this(options, input, pos); + parser.nextToken(); + return parser.parseExpression(); +}; +Parser.tokenizer = function tokenizer(input, options) { + return new this(options, input); +}; +Object.defineProperties(Parser.prototype, prototypeAccessors); +var pp$9 = Parser.prototype; +var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; +pp$9.strictDirective = function(start2) { + if (this.options.ecmaVersion < 5) { + return false; + } + for (; ; ) { + skipWhiteSpace.lastIndex = start2; + start2 += skipWhiteSpace.exec(this.input)[0].length; + var match = literal.exec(this.input.slice(start2)); + if (!match) { + return false; + } + if ((match[1] || match[2]) === "use strict") { + skipWhiteSpace.lastIndex = start2 + match[0].length; + var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length; + var next = this.input.charAt(end); + return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="); + } + start2 += match[0].length; + skipWhiteSpace.lastIndex = start2; + start2 += skipWhiteSpace.exec(this.input)[0].length; + if (this.input[start2] === ";") { + start2++; + } + } +}; +pp$9.eat = function(type) { + if (this.type === type) { + this.next(); + return true; + } else { + return false; + } +}; +pp$9.isContextual = function(name2) { + return this.type === types$1.name && this.value === name2 && !this.containsEsc; +}; +pp$9.eatContextual = function(name2) { + if (!this.isContextual(name2)) { + return false; + } + this.next(); + return true; +}; +pp$9.expectContextual = function(name2) { + if (!this.eatContextual(name2)) { + this.unexpected(); + } +}; +pp$9.canInsertSemicolon = function() { + return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); +}; +pp$9.insertSemicolon = function() { + if (this.canInsertSemicolon()) { + if (this.options.onInsertedSemicolon) { + this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); + } + return true; + } +}; +pp$9.semicolon = function() { + if (!this.eat(types$1.semi) && !this.insertSemicolon()) { + this.unexpected(); + } +}; +pp$9.afterTrailingComma = function(tokType, notNext) { + if (this.type === tokType) { + if (this.options.onTrailingComma) { + this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); + } + if (!notNext) { + this.next(); + } + return true; + } +}; +pp$9.expect = function(type) { + this.eat(type) || this.unexpected(); +}; +pp$9.unexpected = function(pos) { + this.raise(pos != null ? pos : this.start, "Unexpected token"); +}; +var DestructuringErrors = function DestructuringErrors2() { + this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1; +}; +pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) { + if (!refDestructuringErrors) { + return; + } + if (refDestructuringErrors.trailingComma > -1) { + this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); + } + var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind; + if (parens > -1) { + this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern"); + } +}; +pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) { + if (!refDestructuringErrors) { + return false; + } + var shorthandAssign = refDestructuringErrors.shorthandAssign; + var doubleProto = refDestructuringErrors.doubleProto; + if (!andThrow) { + return shorthandAssign >= 0 || doubleProto >= 0; + } + if (shorthandAssign >= 0) { + this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); + } + if (doubleProto >= 0) { + this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); + } +}; +pp$9.checkYieldAwaitInDefaultParams = function() { + if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) { + this.raise(this.yieldPos, "Yield expression cannot be a default value"); + } + if (this.awaitPos) { + this.raise(this.awaitPos, "Await expression cannot be a default value"); + } +}; +pp$9.isSimpleAssignTarget = function(expr) { + if (expr.type === "ParenthesizedExpression") { + return this.isSimpleAssignTarget(expr.expression); + } + return expr.type === "Identifier" || expr.type === "MemberExpression"; +}; +var pp$8 = Parser.prototype; +pp$8.parseTopLevel = function(node2) { + var exports = /* @__PURE__ */ Object.create(null); + if (!node2.body) { + node2.body = []; + } + while (this.type !== types$1.eof) { + var stmt = this.parseStatement(null, true, exports); + node2.body.push(stmt); + } + if (this.inModule) { + for (var i = 0, list3 = Object.keys(this.undefinedExports); i < list3.length; i += 1) { + var name2 = list3[i]; + this.raiseRecoverable(this.undefinedExports[name2].start, "Export '" + name2 + "' is not defined"); + } + } + this.adaptDirectivePrologue(node2.body); + this.next(); + node2.sourceType = this.options.sourceType; + return this.finishNode(node2, "Program"); +}; +var loopLabel = { kind: "loop" }; +var switchLabel = { kind: "switch" }; +pp$8.isLet = function(context) { + if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { + return false; + } + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + if (nextCh === 91 || nextCh === 92) { + return true; + } + if (context) { + return false; + } + if (nextCh === 123 || nextCh > 55295 && nextCh < 56320) { + return true; + } + if (isIdentifierStart(nextCh, true)) { + var pos = next + 1; + while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { + ++pos; + } + if (nextCh === 92 || nextCh > 55295 && nextCh < 56320) { + return true; + } + var ident = this.input.slice(next, pos); + if (!keywordRelationalOperator.test(ident)) { + return true; + } + } + return false; +}; +pp$8.isAsyncFunction = function() { + if (this.options.ecmaVersion < 8 || !this.isContextual("async")) { + return false; + } + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, after; + return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 55295 && after < 56320)); +}; +pp$8.parseStatement = function(context, topLevel, exports) { + var starttype = this.type, node2 = this.startNode(), kind; + if (this.isLet(context)) { + starttype = types$1._var; + kind = "let"; + } + switch (starttype) { + case types$1._break: + case types$1._continue: + return this.parseBreakContinueStatement(node2, starttype.keyword); + case types$1._debugger: + return this.parseDebuggerStatement(node2); + case types$1._do: + return this.parseDoStatement(node2); + case types$1._for: + return this.parseForStatement(node2); + case types$1._function: + if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) { + this.unexpected(); + } + return this.parseFunctionStatement(node2, false, !context); + case types$1._class: + if (context) { + this.unexpected(); + } + return this.parseClass(node2, true); + case types$1._if: + return this.parseIfStatement(node2); + case types$1._return: + return this.parseReturnStatement(node2); + case types$1._switch: + return this.parseSwitchStatement(node2); + case types$1._throw: + return this.parseThrowStatement(node2); + case types$1._try: + return this.parseTryStatement(node2); + case types$1._const: + case types$1._var: + kind = kind || this.value; + if (context && kind !== "var") { + this.unexpected(); + } + return this.parseVarStatement(node2, kind); + case types$1._while: + return this.parseWhileStatement(node2); + case types$1._with: + return this.parseWithStatement(node2); + case types$1.braceL: + return this.parseBlock(true, node2); + case types$1.semi: + return this.parseEmptyStatement(node2); + case types$1._export: + case types$1._import: + if (this.options.ecmaVersion > 10 && starttype === types$1._import) { + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + if (nextCh === 40 || nextCh === 46) { + return this.parseExpressionStatement(node2, this.parseExpression()); + } + } + if (!this.options.allowImportExportEverywhere) { + if (!topLevel) { + this.raise(this.start, "'import' and 'export' may only appear at the top level"); + } + if (!this.inModule) { + this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); + } + } + return starttype === types$1._import ? this.parseImport(node2) : this.parseExport(node2, exports); + default: + if (this.isAsyncFunction()) { + if (context) { + this.unexpected(); + } + this.next(); + return this.parseFunctionStatement(node2, true, !context); + } + var maybeName = this.value, expr = this.parseExpression(); + if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) { + return this.parseLabeledStatement(node2, maybeName, expr, context); + } else { + return this.parseExpressionStatement(node2, expr); + } + } +}; +pp$8.parseBreakContinueStatement = function(node2, keyword) { + var isBreak = keyword === "break"; + this.next(); + if (this.eat(types$1.semi) || this.insertSemicolon()) { + node2.label = null; + } else if (this.type !== types$1.name) { + this.unexpected(); + } else { + node2.label = this.parseIdent(); + this.semicolon(); + } + var i = 0; + for (; i < this.labels.length; ++i) { + var lab = this.labels[i]; + if (node2.label == null || lab.name === node2.label.name) { + if (lab.kind != null && (isBreak || lab.kind === "loop")) { + break; + } + if (node2.label && isBreak) { + break; + } + } + } + if (i === this.labels.length) { + this.raise(node2.start, "Unsyntactic " + keyword); + } + return this.finishNode(node2, isBreak ? "BreakStatement" : "ContinueStatement"); +}; +pp$8.parseDebuggerStatement = function(node2) { + this.next(); + this.semicolon(); + return this.finishNode(node2, "DebuggerStatement"); +}; +pp$8.parseDoStatement = function(node2) { + this.next(); + this.labels.push(loopLabel); + node2.body = this.parseStatement("do"); + this.labels.pop(); + this.expect(types$1._while); + node2.test = this.parseParenExpression(); + if (this.options.ecmaVersion >= 6) { + this.eat(types$1.semi); + } else { + this.semicolon(); + } + return this.finishNode(node2, "DoWhileStatement"); +}; +pp$8.parseForStatement = function(node2) { + this.next(); + var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1; + this.labels.push(loopLabel); + this.enterScope(0); + this.expect(types$1.parenL); + if (this.type === types$1.semi) { + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + return this.parseFor(node2, null); + } + var isLet = this.isLet(); + if (this.type === types$1._var || this.type === types$1._const || isLet) { + var init$1 = this.startNode(), kind = isLet ? "let" : this.value; + this.next(); + this.parseVar(init$1, true, kind); + this.finishNode(init$1, "VariableDeclaration"); + if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) { + if (this.options.ecmaVersion >= 9) { + if (this.type === types$1._in) { + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + } else { + node2.await = awaitAt > -1; + } + } + return this.parseForIn(node2, init$1); + } + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + return this.parseFor(node2, init$1); + } + var startsWithLet = this.isContextual("let"), isForOf = false; + var refDestructuringErrors = new DestructuringErrors(); + var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors); + if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + if (this.options.ecmaVersion >= 9) { + if (this.type === types$1._in) { + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + } else { + node2.await = awaitAt > -1; + } + } + if (startsWithLet && isForOf) { + this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); + } + this.toAssignable(init, false, refDestructuringErrors); + this.checkLValPattern(init); + return this.parseForIn(node2, init); + } else { + this.checkExpressionErrors(refDestructuringErrors, true); + } + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + return this.parseFor(node2, init); +}; +pp$8.parseFunctionStatement = function(node2, isAsync, declarationPosition) { + this.next(); + return this.parseFunction(node2, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync); +}; +pp$8.parseIfStatement = function(node2) { + this.next(); + node2.test = this.parseParenExpression(); + node2.consequent = this.parseStatement("if"); + node2.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; + return this.finishNode(node2, "IfStatement"); +}; +pp$8.parseReturnStatement = function(node2) { + if (!this.inFunction && !this.options.allowReturnOutsideFunction) { + this.raise(this.start, "'return' outside of function"); + } + this.next(); + if (this.eat(types$1.semi) || this.insertSemicolon()) { + node2.argument = null; + } else { + node2.argument = this.parseExpression(); + this.semicolon(); + } + return this.finishNode(node2, "ReturnStatement"); +}; +pp$8.parseSwitchStatement = function(node2) { + this.next(); + node2.discriminant = this.parseParenExpression(); + node2.cases = []; + this.expect(types$1.braceL); + this.labels.push(switchLabel); + this.enterScope(0); + var cur; + for (var sawDefault = false; this.type !== types$1.braceR; ) { + if (this.type === types$1._case || this.type === types$1._default) { + var isCase = this.type === types$1._case; + if (cur) { + this.finishNode(cur, "SwitchCase"); + } + node2.cases.push(cur = this.startNode()); + cur.consequent = []; + this.next(); + if (isCase) { + cur.test = this.parseExpression(); + } else { + if (sawDefault) { + this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); + } + sawDefault = true; + cur.test = null; + } + this.expect(types$1.colon); + } else { + if (!cur) { + this.unexpected(); + } + cur.consequent.push(this.parseStatement(null)); + } + } + this.exitScope(); + if (cur) { + this.finishNode(cur, "SwitchCase"); + } + this.next(); + this.labels.pop(); + return this.finishNode(node2, "SwitchStatement"); +}; +pp$8.parseThrowStatement = function(node2) { + this.next(); + if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) { + this.raise(this.lastTokEnd, "Illegal newline after throw"); + } + node2.argument = this.parseExpression(); + this.semicolon(); + return this.finishNode(node2, "ThrowStatement"); +}; +var empty$1 = []; +pp$8.parseCatchClauseParam = function() { + var param = this.parseBindingAtom(); + var simple = param.type === "Identifier"; + this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); + this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); + this.expect(types$1.parenR); + return param; +}; +pp$8.parseTryStatement = function(node2) { + this.next(); + node2.block = this.parseBlock(); + node2.handler = null; + if (this.type === types$1._catch) { + var clause = this.startNode(); + this.next(); + if (this.eat(types$1.parenL)) { + clause.param = this.parseCatchClauseParam(); + } else { + if (this.options.ecmaVersion < 10) { + this.unexpected(); + } + clause.param = null; + this.enterScope(0); + } + clause.body = this.parseBlock(false); + this.exitScope(); + node2.handler = this.finishNode(clause, "CatchClause"); + } + node2.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; + if (!node2.handler && !node2.finalizer) { + this.raise(node2.start, "Missing catch or finally clause"); + } + return this.finishNode(node2, "TryStatement"); +}; +pp$8.parseVarStatement = function(node2, kind, allowMissingInitializer) { + this.next(); + this.parseVar(node2, false, kind, allowMissingInitializer); + this.semicolon(); + return this.finishNode(node2, "VariableDeclaration"); +}; +pp$8.parseWhileStatement = function(node2) { + this.next(); + node2.test = this.parseParenExpression(); + this.labels.push(loopLabel); + node2.body = this.parseStatement("while"); + this.labels.pop(); + return this.finishNode(node2, "WhileStatement"); +}; +pp$8.parseWithStatement = function(node2) { + if (this.strict) { + this.raise(this.start, "'with' in strict mode"); + } + this.next(); + node2.object = this.parseParenExpression(); + node2.body = this.parseStatement("with"); + return this.finishNode(node2, "WithStatement"); +}; +pp$8.parseEmptyStatement = function(node2) { + this.next(); + return this.finishNode(node2, "EmptyStatement"); +}; +pp$8.parseLabeledStatement = function(node2, maybeName, expr, context) { + for (var i$1 = 0, list3 = this.labels; i$1 < list3.length; i$1 += 1) { + var label = list3[i$1]; + if (label.name === maybeName) { + this.raise(expr.start, "Label '" + maybeName + "' is already declared"); + } + } + var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; + for (var i = this.labels.length - 1; i >= 0; i--) { + var label$1 = this.labels[i]; + if (label$1.statementStart === node2.start) { + label$1.statementStart = this.start; + label$1.kind = kind; + } else { + break; + } + } + this.labels.push({ name: maybeName, kind, statementStart: this.start }); + node2.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); + this.labels.pop(); + node2.label = expr; + return this.finishNode(node2, "LabeledStatement"); +}; +pp$8.parseExpressionStatement = function(node2, expr) { + node2.expression = expr; + this.semicolon(); + return this.finishNode(node2, "ExpressionStatement"); +}; +pp$8.parseBlock = function(createNewLexicalScope, node2, exitStrict) { + if (createNewLexicalScope === void 0) + createNewLexicalScope = true; + if (node2 === void 0) + node2 = this.startNode(); + node2.body = []; + this.expect(types$1.braceL); + if (createNewLexicalScope) { + this.enterScope(0); + } + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node2.body.push(stmt); + } + if (exitStrict) { + this.strict = false; + } + this.next(); + if (createNewLexicalScope) { + this.exitScope(); + } + return this.finishNode(node2, "BlockStatement"); +}; +pp$8.parseFor = function(node2, init) { + node2.init = init; + this.expect(types$1.semi); + node2.test = this.type === types$1.semi ? null : this.parseExpression(); + this.expect(types$1.semi); + node2.update = this.type === types$1.parenR ? null : this.parseExpression(); + this.expect(types$1.parenR); + node2.body = this.parseStatement("for"); + this.exitScope(); + this.labels.pop(); + return this.finishNode(node2, "ForStatement"); +}; +pp$8.parseForIn = function(node2, init) { + var isForIn = this.type === types$1._in; + this.next(); + if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { + this.raise( + init.start, + (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer" + ); + } + node2.left = init; + node2.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); + this.expect(types$1.parenR); + node2.body = this.parseStatement("for"); + this.exitScope(); + this.labels.pop(); + return this.finishNode(node2, isForIn ? "ForInStatement" : "ForOfStatement"); +}; +pp$8.parseVar = function(node2, isFor, kind, allowMissingInitializer) { + node2.declarations = []; + node2.kind = kind; + for (; ; ) { + var decl = this.startNode(); + this.parseVarId(decl, kind); + if (this.eat(types$1.eq)) { + decl.init = this.parseMaybeAssign(isFor); + } else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + this.unexpected(); + } else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) { + this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); + } else { + decl.init = null; + } + node2.declarations.push(this.finishNode(decl, "VariableDeclarator")); + if (!this.eat(types$1.comma)) { + break; + } + } + return node2; +}; +pp$8.parseVarId = function(decl, kind) { + decl.id = this.parseBindingAtom(); + this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); +}; +var FUNC_STATEMENT = 1; +var FUNC_HANGING_STATEMENT = 2; +var FUNC_NULLABLE_ID = 4; +pp$8.parseFunction = function(node2, statement, allowExpressionBody, isAsync, forInit) { + this.initFunction(node2); + if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { + if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) { + this.unexpected(); + } + node2.generator = this.eat(types$1.star); + } + if (this.options.ecmaVersion >= 8) { + node2.async = !!isAsync; + } + if (statement & FUNC_STATEMENT) { + node2.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent(); + if (node2.id && !(statement & FUNC_HANGING_STATEMENT)) { + this.checkLValSimple(node2.id, this.strict || node2.generator || node2.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); + } + } + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + this.enterScope(functionFlags(node2.async, node2.generator)); + if (!(statement & FUNC_STATEMENT)) { + node2.id = this.type === types$1.name ? this.parseIdent() : null; + } + this.parseFunctionParams(node2); + this.parseFunctionBody(node2, allowExpressionBody, false, forInit); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node2, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression"); +}; +pp$8.parseFunctionParams = function(node2) { + this.expect(types$1.parenL); + node2.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + this.checkYieldAwaitInDefaultParams(); +}; +pp$8.parseClass = function(node2, isStatement) { + this.next(); + var oldStrict = this.strict; + this.strict = true; + this.parseClassId(node2, isStatement); + this.parseClassSuper(node2); + var privateNameMap = this.enterClassBody(); + var classBody = this.startNode(); + var hadConstructor = false; + classBody.body = []; + this.expect(types$1.braceL); + while (this.type !== types$1.braceR) { + var element2 = this.parseClassElement(node2.superClass !== null); + if (element2) { + classBody.body.push(element2); + if (element2.type === "MethodDefinition" && element2.kind === "constructor") { + if (hadConstructor) { + this.raiseRecoverable(element2.start, "Duplicate constructor in the same class"); + } + hadConstructor = true; + } else if (element2.key && element2.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element2)) { + this.raiseRecoverable(element2.key.start, "Identifier '#" + element2.key.name + "' has already been declared"); + } + } + } + this.strict = oldStrict; + this.next(); + node2.body = this.finishNode(classBody, "ClassBody"); + this.exitClassBody(); + return this.finishNode(node2, isStatement ? "ClassDeclaration" : "ClassExpression"); +}; +pp$8.parseClassElement = function(constructorAllowsSuper) { + if (this.eat(types$1.semi)) { + return null; + } + var ecmaVersion = this.options.ecmaVersion; + var node2 = this.startNode(); + var keyName = ""; + var isGenerator = false; + var isAsync = false; + var kind = "method"; + var isStatic = false; + if (this.eatContextual("static")) { + if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { + this.parseClassStaticBlock(node2); + return node2; + } + if (this.isClassElementNameStart() || this.type === types$1.star) { + isStatic = true; + } else { + keyName = "static"; + } + } + node2.static = isStatic; + if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { + if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) { + isAsync = true; + } else { + keyName = "async"; + } + } + if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) { + isGenerator = true; + } + if (!keyName && !isAsync && !isGenerator) { + var lastValue = this.value; + if (this.eatContextual("get") || this.eatContextual("set")) { + if (this.isClassElementNameStart()) { + kind = lastValue; + } else { + keyName = lastValue; + } + } + } + if (keyName) { + node2.computed = false; + node2.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); + node2.key.name = keyName; + this.finishNode(node2.key, "Identifier"); + } else { + this.parseClassElementName(node2); + } + if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { + var isConstructor = !node2.static && checkKeyName(node2, "constructor"); + var allowsDirectSuper = isConstructor && constructorAllowsSuper; + if (isConstructor && kind !== "method") { + this.raise(node2.key.start, "Constructor can't have get/set modifier"); + } + node2.kind = isConstructor ? "constructor" : kind; + this.parseClassMethod(node2, isGenerator, isAsync, allowsDirectSuper); + } else { + this.parseClassField(node2); + } + return node2; +}; +pp$8.isClassElementNameStart = function() { + return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword; +}; +pp$8.parseClassElementName = function(element2) { + if (this.type === types$1.privateId) { + if (this.value === "constructor") { + this.raise(this.start, "Classes can't have an element named '#constructor'"); + } + element2.computed = false; + element2.key = this.parsePrivateIdent(); + } else { + this.parsePropertyName(element2); + } +}; +pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) { + var key = method.key; + if (method.kind === "constructor") { + if (isGenerator) { + this.raise(key.start, "Constructor can't be a generator"); + } + if (isAsync) { + this.raise(key.start, "Constructor can't be an async method"); + } + } else if (method.static && checkKeyName(method, "prototype")) { + this.raise(key.start, "Classes may not have a static property named prototype"); + } + var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); + if (method.kind === "get" && value.params.length !== 0) { + this.raiseRecoverable(value.start, "getter should have no params"); + } + if (method.kind === "set" && value.params.length !== 1) { + this.raiseRecoverable(value.start, "setter should have exactly one param"); + } + if (method.kind === "set" && value.params[0].type === "RestElement") { + this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); + } + return this.finishNode(method, "MethodDefinition"); +}; +pp$8.parseClassField = function(field) { + if (checkKeyName(field, "constructor")) { + this.raise(field.key.start, "Classes can't have a field named 'constructor'"); + } else if (field.static && checkKeyName(field, "prototype")) { + this.raise(field.key.start, "Classes can't have a static field named 'prototype'"); + } + if (this.eat(types$1.eq)) { + var scope = this.currentThisScope(); + var inClassFieldInit = scope.inClassFieldInit; + scope.inClassFieldInit = true; + field.value = this.parseMaybeAssign(); + scope.inClassFieldInit = inClassFieldInit; + } else { + field.value = null; + } + this.semicolon(); + return this.finishNode(field, "PropertyDefinition"); +}; +pp$8.parseClassStaticBlock = function(node2) { + node2.body = []; + var oldLabels = this.labels; + this.labels = []; + this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node2.body.push(stmt); + } + this.next(); + this.exitScope(); + this.labels = oldLabels; + return this.finishNode(node2, "StaticBlock"); +}; +pp$8.parseClassId = function(node2, isStatement) { + if (this.type === types$1.name) { + node2.id = this.parseIdent(); + if (isStatement) { + this.checkLValSimple(node2.id, BIND_LEXICAL, false); + } + } else { + if (isStatement === true) { + this.unexpected(); + } + node2.id = null; + } +}; +pp$8.parseClassSuper = function(node2) { + node2.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null; +}; +pp$8.enterClassBody = function() { + var element2 = { declared: /* @__PURE__ */ Object.create(null), used: [] }; + this.privateNameStack.push(element2); + return element2.declared; +}; +pp$8.exitClassBody = function() { + var ref2 = this.privateNameStack.pop(); + var declared = ref2.declared; + var used = ref2.used; + if (!this.options.checkPrivateFields) { + return; + } + var len = this.privateNameStack.length; + var parent = len === 0 ? null : this.privateNameStack[len - 1]; + for (var i = 0; i < used.length; ++i) { + var id = used[i]; + if (!hasOwn(declared, id.name)) { + if (parent) { + parent.used.push(id); + } else { + this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class"); + } + } + } +}; +function isPrivateNameConflicted(privateNameMap, element2) { + var name2 = element2.key.name; + var curr = privateNameMap[name2]; + var next = "true"; + if (element2.type === "MethodDefinition" && (element2.kind === "get" || element2.kind === "set")) { + next = (element2.static ? "s" : "i") + element2.kind; + } + if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") { + privateNameMap[name2] = "true"; + return false; + } else if (!curr) { + privateNameMap[name2] = next; + return false; + } else { + return true; + } +} +function checkKeyName(node2, name2) { + var computed = node2.computed; + var key = node2.key; + return !computed && (key.type === "Identifier" && key.name === name2 || key.type === "Literal" && key.value === name2); +} +pp$8.parseExportAllDeclaration = function(node2, exports) { + if (this.options.ecmaVersion >= 11) { + if (this.eatContextual("as")) { + node2.exported = this.parseModuleExportName(); + this.checkExport(exports, node2.exported, this.lastTokStart); + } else { + node2.exported = null; + } + } + this.expectContextual("from"); + if (this.type !== types$1.string) { + this.unexpected(); + } + node2.source = this.parseExprAtom(); + this.semicolon(); + return this.finishNode(node2, "ExportAllDeclaration"); +}; +pp$8.parseExport = function(node2, exports) { + this.next(); + if (this.eat(types$1.star)) { + return this.parseExportAllDeclaration(node2, exports); + } + if (this.eat(types$1._default)) { + this.checkExport(exports, "default", this.lastTokStart); + node2.declaration = this.parseExportDefaultDeclaration(); + return this.finishNode(node2, "ExportDefaultDeclaration"); + } + if (this.shouldParseExportStatement()) { + node2.declaration = this.parseExportDeclaration(node2); + if (node2.declaration.type === "VariableDeclaration") { + this.checkVariableExport(exports, node2.declaration.declarations); + } else { + this.checkExport(exports, node2.declaration.id, node2.declaration.id.start); + } + node2.specifiers = []; + node2.source = null; + } else { + node2.declaration = null; + node2.specifiers = this.parseExportSpecifiers(exports); + if (this.eatContextual("from")) { + if (this.type !== types$1.string) { + this.unexpected(); + } + node2.source = this.parseExprAtom(); + } else { + for (var i = 0, list3 = node2.specifiers; i < list3.length; i += 1) { + var spec = list3[i]; + this.checkUnreserved(spec.local); + this.checkLocalExport(spec.local); + if (spec.local.type === "Literal") { + this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`."); + } + } + node2.source = null; + } + this.semicolon(); + } + return this.finishNode(node2, "ExportNamedDeclaration"); +}; +pp$8.parseExportDeclaration = function(node2) { + return this.parseStatement(null); +}; +pp$8.parseExportDefaultDeclaration = function() { + var isAsync; + if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) { + var fNode = this.startNode(); + this.next(); + if (isAsync) { + this.next(); + } + return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); + } else if (this.type === types$1._class) { + var cNode = this.startNode(); + return this.parseClass(cNode, "nullableID"); + } else { + var declaration = this.parseMaybeAssign(); + this.semicolon(); + return declaration; + } +}; +pp$8.checkExport = function(exports, name2, pos) { + if (!exports) { + return; + } + if (typeof name2 !== "string") { + name2 = name2.type === "Identifier" ? name2.name : name2.value; + } + if (hasOwn(exports, name2)) { + this.raiseRecoverable(pos, "Duplicate export '" + name2 + "'"); + } + exports[name2] = true; +}; +pp$8.checkPatternExport = function(exports, pat) { + var type = pat.type; + if (type === "Identifier") { + this.checkExport(exports, pat, pat.start); + } else if (type === "ObjectPattern") { + for (var i = 0, list3 = pat.properties; i < list3.length; i += 1) { + var prop = list3[i]; + this.checkPatternExport(exports, prop); + } + } else if (type === "ArrayPattern") { + for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) { + var elt = list$1[i$1]; + if (elt) { + this.checkPatternExport(exports, elt); + } + } + } else if (type === "Property") { + this.checkPatternExport(exports, pat.value); + } else if (type === "AssignmentPattern") { + this.checkPatternExport(exports, pat.left); + } else if (type === "RestElement") { + this.checkPatternExport(exports, pat.argument); + } else if (type === "ParenthesizedExpression") { + this.checkPatternExport(exports, pat.expression); + } +}; +pp$8.checkVariableExport = function(exports, decls) { + if (!exports) { + return; + } + for (var i = 0, list3 = decls; i < list3.length; i += 1) { + var decl = list3[i]; + this.checkPatternExport(exports, decl.id); + } +}; +pp$8.shouldParseExportStatement = function() { + return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction(); +}; +pp$8.parseExportSpecifier = function(exports) { + var node2 = this.startNode(); + node2.local = this.parseModuleExportName(); + node2.exported = this.eatContextual("as") ? this.parseModuleExportName() : node2.local; + this.checkExport( + exports, + node2.exported, + node2.exported.start + ); + return this.finishNode(node2, "ExportSpecifier"); +}; +pp$8.parseExportSpecifiers = function(exports) { + var nodes = [], first = true; + this.expect(types$1.braceL); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { + break; + } + } else { + first = false; + } + nodes.push(this.parseExportSpecifier(exports)); + } + return nodes; +}; +pp$8.parseImport = function(node2) { + this.next(); + if (this.type === types$1.string) { + node2.specifiers = empty$1; + node2.source = this.parseExprAtom(); + } else { + node2.specifiers = this.parseImportSpecifiers(); + this.expectContextual("from"); + node2.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); + } + this.semicolon(); + return this.finishNode(node2, "ImportDeclaration"); +}; +pp$8.parseImportSpecifier = function() { + var node2 = this.startNode(); + node2.imported = this.parseModuleExportName(); + if (this.eatContextual("as")) { + node2.local = this.parseIdent(); + } else { + this.checkUnreserved(node2.imported); + node2.local = node2.imported; + } + this.checkLValSimple(node2.local, BIND_LEXICAL); + return this.finishNode(node2, "ImportSpecifier"); +}; +pp$8.parseImportDefaultSpecifier = function() { + var node2 = this.startNode(); + node2.local = this.parseIdent(); + this.checkLValSimple(node2.local, BIND_LEXICAL); + return this.finishNode(node2, "ImportDefaultSpecifier"); +}; +pp$8.parseImportNamespaceSpecifier = function() { + var node2 = this.startNode(); + this.next(); + this.expectContextual("as"); + node2.local = this.parseIdent(); + this.checkLValSimple(node2.local, BIND_LEXICAL); + return this.finishNode(node2, "ImportNamespaceSpecifier"); +}; +pp$8.parseImportSpecifiers = function() { + var nodes = [], first = true; + if (this.type === types$1.name) { + nodes.push(this.parseImportDefaultSpecifier()); + if (!this.eat(types$1.comma)) { + return nodes; + } + } + if (this.type === types$1.star) { + nodes.push(this.parseImportNamespaceSpecifier()); + return nodes; + } + this.expect(types$1.braceL); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { + break; + } + } else { + first = false; + } + nodes.push(this.parseImportSpecifier()); + } + return nodes; +}; +pp$8.parseModuleExportName = function() { + if (this.options.ecmaVersion >= 13 && this.type === types$1.string) { + var stringLiteral = this.parseLiteral(this.value); + if (loneSurrogate.test(stringLiteral.value)) { + this.raise(stringLiteral.start, "An export name cannot include a lone surrogate."); + } + return stringLiteral; + } + return this.parseIdent(true); +}; +pp$8.adaptDirectivePrologue = function(statements) { + for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { + statements[i].directive = statements[i].expression.raw.slice(1, -1); + } +}; +pp$8.isDirectiveCandidate = function(statement) { + return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && // Reject parenthesized strings. + (this.input[statement.start] === '"' || this.input[statement.start] === "'"); +}; +var pp$7 = Parser.prototype; +pp$7.toAssignable = function(node2, isBinding, refDestructuringErrors) { + if (this.options.ecmaVersion >= 6 && node2) { + switch (node2.type) { + case "Identifier": + if (this.inAsync && node2.name === "await") { + this.raise(node2.start, "Cannot use 'await' as identifier inside an async function"); + } + break; + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + case "RestElement": + break; + case "ObjectExpression": + node2.type = "ObjectPattern"; + if (refDestructuringErrors) { + this.checkPatternErrors(refDestructuringErrors, true); + } + for (var i = 0, list3 = node2.properties; i < list3.length; i += 1) { + var prop = list3[i]; + this.toAssignable(prop, isBinding); + if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) { + this.raise(prop.argument.start, "Unexpected token"); + } + } + break; + case "Property": + if (node2.kind !== "init") { + this.raise(node2.key.start, "Object pattern can't contain getter or setter"); + } + this.toAssignable(node2.value, isBinding); + break; + case "ArrayExpression": + node2.type = "ArrayPattern"; + if (refDestructuringErrors) { + this.checkPatternErrors(refDestructuringErrors, true); + } + this.toAssignableList(node2.elements, isBinding); + break; + case "SpreadElement": + node2.type = "RestElement"; + this.toAssignable(node2.argument, isBinding); + if (node2.argument.type === "AssignmentPattern") { + this.raise(node2.argument.start, "Rest elements cannot have a default value"); + } + break; + case "AssignmentExpression": + if (node2.operator !== "=") { + this.raise(node2.left.end, "Only '=' operator can be used for specifying default value."); + } + node2.type = "AssignmentPattern"; + delete node2.operator; + this.toAssignable(node2.left, isBinding); + break; + case "ParenthesizedExpression": + this.toAssignable(node2.expression, isBinding, refDestructuringErrors); + break; + case "ChainExpression": + this.raiseRecoverable(node2.start, "Optional chaining cannot appear in left-hand side"); + break; + case "MemberExpression": + if (!isBinding) { + break; + } + default: + this.raise(node2.start, "Assigning to rvalue"); + } + } else if (refDestructuringErrors) { + this.checkPatternErrors(refDestructuringErrors, true); + } + return node2; +}; +pp$7.toAssignableList = function(exprList, isBinding) { + var end = exprList.length; + for (var i = 0; i < end; i++) { + var elt = exprList[i]; + if (elt) { + this.toAssignable(elt, isBinding); + } + } + if (end) { + var last = exprList[end - 1]; + if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") { + this.unexpected(last.argument.start); + } + } + return exprList; +}; +pp$7.parseSpread = function(refDestructuringErrors) { + var node2 = this.startNode(); + this.next(); + node2.argument = this.parseMaybeAssign(false, refDestructuringErrors); + return this.finishNode(node2, "SpreadElement"); +}; +pp$7.parseRestBinding = function() { + var node2 = this.startNode(); + this.next(); + if (this.options.ecmaVersion === 6 && this.type !== types$1.name) { + this.unexpected(); + } + node2.argument = this.parseBindingAtom(); + return this.finishNode(node2, "RestElement"); +}; +pp$7.parseBindingAtom = function() { + if (this.options.ecmaVersion >= 6) { + switch (this.type) { + case types$1.bracketL: + var node2 = this.startNode(); + this.next(); + node2.elements = this.parseBindingList(types$1.bracketR, true, true); + return this.finishNode(node2, "ArrayPattern"); + case types$1.braceL: + return this.parseObj(true); + } + } + return this.parseIdent(); +}; +pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) { + var elts = [], first = true; + while (!this.eat(close)) { + if (first) { + first = false; + } else { + this.expect(types$1.comma); + } + if (allowEmpty && this.type === types$1.comma) { + elts.push(null); + } else if (allowTrailingComma && this.afterTrailingComma(close)) { + break; + } else if (this.type === types$1.ellipsis) { + var rest = this.parseRestBinding(); + this.parseBindingListItem(rest); + elts.push(rest); + if (this.type === types$1.comma) { + this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); + } + this.expect(close); + break; + } else { + elts.push(this.parseAssignableListItem(allowModifiers)); + } + } + return elts; +}; +pp$7.parseAssignableListItem = function(allowModifiers) { + var elem = this.parseMaybeDefault(this.start, this.startLoc); + this.parseBindingListItem(elem); + return elem; +}; +pp$7.parseBindingListItem = function(param) { + return param; +}; +pp$7.parseMaybeDefault = function(startPos, startLoc, left) { + left = left || this.parseBindingAtom(); + if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { + return left; + } + var node2 = this.startNodeAt(startPos, startLoc); + node2.left = left; + node2.right = this.parseMaybeAssign(); + return this.finishNode(node2, "AssignmentPattern"); +}; +pp$7.checkLValSimple = function(expr, bindingType, checkClashes) { + if (bindingType === void 0) + bindingType = BIND_NONE; + var isBind = bindingType !== BIND_NONE; + switch (expr.type) { + case "Identifier": + if (this.strict && this.reservedWordsStrictBind.test(expr.name)) { + this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); + } + if (isBind) { + if (bindingType === BIND_LEXICAL && expr.name === "let") { + this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); + } + if (checkClashes) { + if (hasOwn(checkClashes, expr.name)) { + this.raiseRecoverable(expr.start, "Argument name clash"); + } + checkClashes[expr.name] = true; + } + if (bindingType !== BIND_OUTSIDE) { + this.declareName(expr.name, bindingType, expr.start); + } + } + break; + case "ChainExpression": + this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side"); + break; + case "MemberExpression": + if (isBind) { + this.raiseRecoverable(expr.start, "Binding member expression"); + } + break; + case "ParenthesizedExpression": + if (isBind) { + this.raiseRecoverable(expr.start, "Binding parenthesized expression"); + } + return this.checkLValSimple(expr.expression, bindingType, checkClashes); + default: + this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue"); + } +}; +pp$7.checkLValPattern = function(expr, bindingType, checkClashes) { + if (bindingType === void 0) + bindingType = BIND_NONE; + switch (expr.type) { + case "ObjectPattern": + for (var i = 0, list3 = expr.properties; i < list3.length; i += 1) { + var prop = list3[i]; + this.checkLValInnerPattern(prop, bindingType, checkClashes); + } + break; + case "ArrayPattern": + for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) { + var elem = list$1[i$1]; + if (elem) { + this.checkLValInnerPattern(elem, bindingType, checkClashes); + } + } + break; + default: + this.checkLValSimple(expr, bindingType, checkClashes); + } +}; +pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) { + if (bindingType === void 0) + bindingType = BIND_NONE; + switch (expr.type) { + case "Property": + this.checkLValInnerPattern(expr.value, bindingType, checkClashes); + break; + case "AssignmentPattern": + this.checkLValPattern(expr.left, bindingType, checkClashes); + break; + case "RestElement": + this.checkLValPattern(expr.argument, bindingType, checkClashes); + break; + default: + this.checkLValPattern(expr, bindingType, checkClashes); + } +}; +var TokContext = function TokContext2(token, isExpr, preserveSpace, override, generator) { + this.token = token; + this.isExpr = !!isExpr; + this.preserveSpace = !!preserveSpace; + this.override = override; + this.generator = !!generator; +}; +var types = { + b_stat: new TokContext("{", false), + b_expr: new TokContext("{", true), + b_tmpl: new TokContext("${", false), + p_stat: new TokContext("(", false), + p_expr: new TokContext("(", true), + q_tmpl: new TokContext("`", true, true, function(p) { + return p.tryReadTemplateToken(); + }), + f_stat: new TokContext("function", false), + f_expr: new TokContext("function", true), + f_expr_gen: new TokContext("function", true, false, null, true), + f_gen: new TokContext("function", false, false, null, true) +}; +var pp$6 = Parser.prototype; +pp$6.initialContext = function() { + return [types.b_stat]; +}; +pp$6.curContext = function() { + return this.context[this.context.length - 1]; +}; +pp$6.braceIsBlock = function(prevType) { + var parent = this.curContext(); + if (parent === types.f_expr || parent === types.f_stat) { + return true; + } + if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) { + return !parent.isExpr; + } + if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) { + return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); + } + if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) { + return true; + } + if (prevType === types$1.braceL) { + return parent === types.b_stat; + } + if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) { + return false; + } + return !this.exprAllowed; +}; +pp$6.inGeneratorContext = function() { + for (var i = this.context.length - 1; i >= 1; i--) { + var context = this.context[i]; + if (context.token === "function") { + return context.generator; + } + } + return false; +}; +pp$6.updateContext = function(prevType) { + var update, type = this.type; + if (type.keyword && prevType === types$1.dot) { + this.exprAllowed = false; + } else if (update = type.updateContext) { + update.call(this, prevType); + } else { + this.exprAllowed = type.beforeExpr; + } +}; +pp$6.overrideContext = function(tokenCtx) { + if (this.curContext() !== tokenCtx) { + this.context[this.context.length - 1] = tokenCtx; + } +}; +types$1.parenR.updateContext = types$1.braceR.updateContext = function() { + if (this.context.length === 1) { + this.exprAllowed = true; + return; + } + var out = this.context.pop(); + if (out === types.b_stat && this.curContext().token === "function") { + out = this.context.pop(); + } + this.exprAllowed = !out.isExpr; +}; +types$1.braceL.updateContext = function(prevType) { + this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); + this.exprAllowed = true; +}; +types$1.dollarBraceL.updateContext = function() { + this.context.push(types.b_tmpl); + this.exprAllowed = true; +}; +types$1.parenL.updateContext = function(prevType) { + var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while; + this.context.push(statementParens ? types.p_stat : types.p_expr); + this.exprAllowed = true; +}; +types$1.incDec.updateContext = function() { +}; +types$1._function.updateContext = types$1._class.updateContext = function(prevType) { + if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) { + this.context.push(types.f_expr); + } else { + this.context.push(types.f_stat); + } + this.exprAllowed = false; +}; +types$1.backQuote.updateContext = function() { + if (this.curContext() === types.q_tmpl) { + this.context.pop(); + } else { + this.context.push(types.q_tmpl); + } + this.exprAllowed = false; +}; +types$1.star.updateContext = function(prevType) { + if (prevType === types$1._function) { + var index2 = this.context.length - 1; + if (this.context[index2] === types.f_expr) { + this.context[index2] = types.f_expr_gen; + } else { + this.context[index2] = types.f_gen; + } + } + this.exprAllowed = true; +}; +types$1.name.updateContext = function(prevType) { + var allowed = false; + if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) { + if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) { + allowed = true; + } + } + this.exprAllowed = allowed; +}; +var pp$5 = Parser.prototype; +pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { + if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") { + return; + } + if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) { + return; + } + var key = prop.key; + var name2; + switch (key.type) { + case "Identifier": + name2 = key.name; + break; + case "Literal": + name2 = String(key.value); + break; + default: + return; + } + var kind = prop.kind; + if (this.options.ecmaVersion >= 6) { + if (name2 === "__proto__" && kind === "init") { + if (propHash.proto) { + if (refDestructuringErrors) { + if (refDestructuringErrors.doubleProto < 0) { + refDestructuringErrors.doubleProto = key.start; + } + } else { + this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); + } + } + propHash.proto = true; + } + return; + } + name2 = "$" + name2; + var other = propHash[name2]; + if (other) { + var redefinition; + if (kind === "init") { + redefinition = this.strict && other.init || other.get || other.set; + } else { + redefinition = other.init || other[kind]; + } + if (redefinition) { + this.raiseRecoverable(key.start, "Redefinition of property"); + } + } else { + other = propHash[name2] = { + init: false, + get: false, + set: false + }; + } + other[kind] = true; +}; +pp$5.parseExpression = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); + if (this.type === types$1.comma) { + var node2 = this.startNodeAt(startPos, startLoc); + node2.expressions = [expr]; + while (this.eat(types$1.comma)) { + node2.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); + } + return this.finishNode(node2, "SequenceExpression"); + } + return expr; +}; +pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) { + if (this.isContextual("yield")) { + if (this.inGenerator) { + return this.parseYield(forInit); + } else { + this.exprAllowed = false; + } + } + var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1; + if (refDestructuringErrors) { + oldParenAssign = refDestructuringErrors.parenthesizedAssign; + oldTrailingComma = refDestructuringErrors.trailingComma; + oldDoubleProto = refDestructuringErrors.doubleProto; + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; + } else { + refDestructuringErrors = new DestructuringErrors(); + ownDestructuringErrors = true; + } + var startPos = this.start, startLoc = this.startLoc; + if (this.type === types$1.parenL || this.type === types$1.name) { + this.potentialArrowAt = this.start; + this.potentialArrowInForAwait = forInit === "await"; + } + var left = this.parseMaybeConditional(forInit, refDestructuringErrors); + if (afterLeftParse) { + left = afterLeftParse.call(this, left, startPos, startLoc); + } + if (this.type.isAssign) { + var node2 = this.startNodeAt(startPos, startLoc); + node2.operator = this.value; + if (this.type === types$1.eq) { + left = this.toAssignable(left, false, refDestructuringErrors); + } + if (!ownDestructuringErrors) { + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; + } + if (refDestructuringErrors.shorthandAssign >= left.start) { + refDestructuringErrors.shorthandAssign = -1; + } + if (this.type === types$1.eq) { + this.checkLValPattern(left); + } else { + this.checkLValSimple(left); + } + node2.left = left; + this.next(); + node2.right = this.parseMaybeAssign(forInit); + if (oldDoubleProto > -1) { + refDestructuringErrors.doubleProto = oldDoubleProto; + } + return this.finishNode(node2, "AssignmentExpression"); + } else { + if (ownDestructuringErrors) { + this.checkExpressionErrors(refDestructuringErrors, true); + } + } + if (oldParenAssign > -1) { + refDestructuringErrors.parenthesizedAssign = oldParenAssign; + } + if (oldTrailingComma > -1) { + refDestructuringErrors.trailingComma = oldTrailingComma; + } + return left; +}; +pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseExprOps(forInit, refDestructuringErrors); + if (this.checkExpressionErrors(refDestructuringErrors)) { + return expr; + } + if (this.eat(types$1.question)) { + var node2 = this.startNodeAt(startPos, startLoc); + node2.test = expr; + node2.consequent = this.parseMaybeAssign(); + this.expect(types$1.colon); + node2.alternate = this.parseMaybeAssign(forInit); + return this.finishNode(node2, "ConditionalExpression"); + } + return expr; +}; +pp$5.parseExprOps = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit); + if (this.checkExpressionErrors(refDestructuringErrors)) { + return expr; + } + return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit); +}; +pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) { + var prec = this.type.binop; + if (prec != null && (!forInit || this.type !== types$1._in)) { + if (prec > minPrec) { + var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND; + var coalesce = this.type === types$1.coalesce; + if (coalesce) { + prec = types$1.logicalAND.binop; + } + var op = this.value; + this.next(); + var startPos = this.start, startLoc = this.startLoc; + var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); + var node2 = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); + if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) { + this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); + } + return this.parseExprOp(node2, leftStartPos, leftStartLoc, minPrec, forInit); + } + } + return left; +}; +pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) { + if (right.type === "PrivateIdentifier") { + this.raise(right.start, "Private identifier can only be left side of binary expression"); + } + var node2 = this.startNodeAt(startPos, startLoc); + node2.left = left; + node2.operator = op; + node2.right = right; + return this.finishNode(node2, logical ? "LogicalExpression" : "BinaryExpression"); +}; +pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) { + var startPos = this.start, startLoc = this.startLoc, expr; + if (this.isContextual("await") && this.canAwait) { + expr = this.parseAwait(forInit); + sawUnary = true; + } else if (this.type.prefix) { + var node2 = this.startNode(), update = this.type === types$1.incDec; + node2.operator = this.value; + node2.prefix = true; + this.next(); + node2.argument = this.parseMaybeUnary(null, true, update, forInit); + this.checkExpressionErrors(refDestructuringErrors, true); + if (update) { + this.checkLValSimple(node2.argument); + } else if (this.strict && node2.operator === "delete" && node2.argument.type === "Identifier") { + this.raiseRecoverable(node2.start, "Deleting local variable in strict mode"); + } else if (node2.operator === "delete" && isPrivateFieldAccess(node2.argument)) { + this.raiseRecoverable(node2.start, "Private fields can not be deleted"); + } else { + sawUnary = true; + } + expr = this.finishNode(node2, update ? "UpdateExpression" : "UnaryExpression"); + } else if (!sawUnary && this.type === types$1.privateId) { + if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { + this.unexpected(); + } + expr = this.parsePrivateIdent(); + if (this.type !== types$1._in) { + this.unexpected(); + } + } else { + expr = this.parseExprSubscripts(refDestructuringErrors, forInit); + if (this.checkExpressionErrors(refDestructuringErrors)) { + return expr; + } + while (this.type.postfix && !this.canInsertSemicolon()) { + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.operator = this.value; + node$1.prefix = false; + node$1.argument = expr; + this.checkLValSimple(expr); + this.next(); + expr = this.finishNode(node$1, "UpdateExpression"); + } + } + if (!incDec && this.eat(types$1.starstar)) { + if (sawUnary) { + this.unexpected(this.lastTokStart); + } else { + return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false); + } + } else { + return expr; + } +}; +function isPrivateFieldAccess(node2) { + return node2.type === "MemberExpression" && node2.property.type === "PrivateIdentifier" || node2.type === "ChainExpression" && isPrivateFieldAccess(node2.expression); +} +pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseExprAtom(refDestructuringErrors, forInit); + if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") { + return expr; + } + var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit); + if (refDestructuringErrors && result.type === "MemberExpression") { + if (refDestructuringErrors.parenthesizedAssign >= result.start) { + refDestructuringErrors.parenthesizedAssign = -1; + } + if (refDestructuringErrors.parenthesizedBind >= result.start) { + refDestructuringErrors.parenthesizedBind = -1; + } + if (refDestructuringErrors.trailingComma >= result.start) { + refDestructuringErrors.trailingComma = -1; + } + } + return result; +}; +pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) { + var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.potentialArrowAt === base.start; + var optionalChained = false; + while (true) { + var element2 = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); + if (element2.optional) { + optionalChained = true; + } + if (element2 === base || element2.type === "ArrowFunctionExpression") { + if (optionalChained) { + var chainNode = this.startNodeAt(startPos, startLoc); + chainNode.expression = element2; + element2 = this.finishNode(chainNode, "ChainExpression"); + } + return element2; + } + base = element2; + } +}; +pp$5.shouldParseAsyncArrow = function() { + return !this.canInsertSemicolon() && this.eat(types$1.arrow); +}; +pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit); +}; +pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { + var optionalSupported = this.options.ecmaVersion >= 11; + var optional = optionalSupported && this.eat(types$1.questionDot); + if (noCalls && optional) { + this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); + } + var computed = this.eat(types$1.bracketL); + if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) { + var node2 = this.startNodeAt(startPos, startLoc); + node2.object = base; + if (computed) { + node2.property = this.parseExpression(); + this.expect(types$1.bracketR); + } else if (this.type === types$1.privateId && base.type !== "Super") { + node2.property = this.parsePrivateIdent(); + } else { + node2.property = this.parseIdent(this.options.allowReserved !== "never"); + } + node2.computed = !!computed; + if (optionalSupported) { + node2.optional = optional; + } + base = this.finishNode(node2, "MemberExpression"); + } else if (!noCalls && this.eat(types$1.parenL)) { + var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); + if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + if (this.awaitIdentPos > 0) { + this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); + } + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit); + } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.callee = base; + node$1.arguments = exprList; + if (optionalSupported) { + node$1.optional = optional; + } + base = this.finishNode(node$1, "CallExpression"); + } else if (this.type === types$1.backQuote) { + if (optional || optionalChained) { + this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); + } + var node$2 = this.startNodeAt(startPos, startLoc); + node$2.tag = base; + node$2.quasi = this.parseTemplate({ isTagged: true }); + base = this.finishNode(node$2, "TaggedTemplateExpression"); + } + return base; +}; +pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) { + if (this.type === types$1.slash) { + this.readRegexp(); + } + var node2, canBeArrow = this.potentialArrowAt === this.start; + switch (this.type) { + case types$1._super: + if (!this.allowSuper) { + this.raise(this.start, "'super' keyword outside a method"); + } + node2 = this.startNode(); + this.next(); + if (this.type === types$1.parenL && !this.allowDirectSuper) { + this.raise(node2.start, "super() call outside constructor of a subclass"); + } + if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) { + this.unexpected(); + } + return this.finishNode(node2, "Super"); + case types$1._this: + node2 = this.startNode(); + this.next(); + return this.finishNode(node2, "ThisExpression"); + case types$1.name: + var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; + var id = this.parseIdent(false); + if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { + this.overrideContext(types.f_expr); + return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit); + } + if (canBeArrow && !this.canInsertSemicolon()) { + if (this.eat(types$1.arrow)) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit); + } + if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { + id = this.parseIdent(false); + if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) { + this.unexpected(); + } + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit); + } + } + return id; + case types$1.regexp: + var value = this.value; + node2 = this.parseLiteral(value.value); + node2.regex = { pattern: value.pattern, flags: value.flags }; + return node2; + case types$1.num: + case types$1.string: + return this.parseLiteral(this.value); + case types$1._null: + case types$1._true: + case types$1._false: + node2 = this.startNode(); + node2.value = this.type === types$1._null ? null : this.type === types$1._true; + node2.raw = this.type.keyword; + this.next(); + return this.finishNode(node2, "Literal"); + case types$1.parenL: + var start2 = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); + if (refDestructuringErrors) { + if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) { + refDestructuringErrors.parenthesizedAssign = start2; + } + if (refDestructuringErrors.parenthesizedBind < 0) { + refDestructuringErrors.parenthesizedBind = start2; + } + } + return expr; + case types$1.bracketL: + node2 = this.startNode(); + this.next(); + node2.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); + return this.finishNode(node2, "ArrayExpression"); + case types$1.braceL: + this.overrideContext(types.b_expr); + return this.parseObj(false, refDestructuringErrors); + case types$1._function: + node2 = this.startNode(); + this.next(); + return this.parseFunction(node2, 0); + case types$1._class: + return this.parseClass(this.startNode(), false); + case types$1._new: + return this.parseNew(); + case types$1.backQuote: + return this.parseTemplate(); + case types$1._import: + if (this.options.ecmaVersion >= 11) { + return this.parseExprImport(forNew); + } else { + return this.unexpected(); + } + default: + return this.parseExprAtomDefault(); + } +}; +pp$5.parseExprAtomDefault = function() { + this.unexpected(); +}; +pp$5.parseExprImport = function(forNew) { + var node2 = this.startNode(); + if (this.containsEsc) { + this.raiseRecoverable(this.start, "Escape sequence in keyword import"); + } + var meta = this.parseIdent(true); + if (this.type === types$1.parenL && !forNew) { + return this.parseDynamicImport(node2); + } else if (this.type === types$1.dot) { + node2.meta = meta; + return this.parseImportMeta(node2); + } else { + this.unexpected(); + } +}; +pp$5.parseDynamicImport = function(node2) { + this.next(); + node2.source = this.parseMaybeAssign(); + if (!this.eat(types$1.parenR)) { + var errorPos = this.start; + if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { + this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); + } else { + this.unexpected(errorPos); + } + } + return this.finishNode(node2, "ImportExpression"); +}; +pp$5.parseImportMeta = function(node2) { + this.next(); + var containsEsc = this.containsEsc; + node2.property = this.parseIdent(true); + if (node2.property.name !== "meta") { + this.raiseRecoverable(node2.property.start, "The only valid meta property for import is 'import.meta'"); + } + if (containsEsc) { + this.raiseRecoverable(node2.start, "'import.meta' must not contain escaped characters"); + } + if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) { + this.raiseRecoverable(node2.start, "Cannot use 'import.meta' outside a module"); + } + return this.finishNode(node2, "MetaProperty"); +}; +pp$5.parseLiteral = function(value) { + var node2 = this.startNode(); + node2.value = value; + node2.raw = this.input.slice(this.start, this.end); + if (node2.raw.charCodeAt(node2.raw.length - 1) === 110) { + node2.bigint = node2.raw.slice(0, -1).replace(/_/g, ""); + } + this.next(); + return this.finishNode(node2, "Literal"); +}; +pp$5.parseParenExpression = function() { + this.expect(types$1.parenL); + var val = this.parseExpression(); + this.expect(types$1.parenR); + return val; +}; +pp$5.shouldParseArrow = function(exprList) { + return !this.canInsertSemicolon(); +}; +pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) { + var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8; + if (this.options.ecmaVersion >= 6) { + this.next(); + var innerStartPos = this.start, innerStartLoc = this.startLoc; + var exprList = [], first = true, lastIsComma = false; + var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart; + this.yieldPos = 0; + this.awaitPos = 0; + while (this.type !== types$1.parenR) { + first ? first = false : this.expect(types$1.comma); + if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) { + lastIsComma = true; + break; + } else if (this.type === types$1.ellipsis) { + spreadStart = this.start; + exprList.push(this.parseParenItem(this.parseRestBinding())); + if (this.type === types$1.comma) { + this.raiseRecoverable( + this.start, + "Comma is not permitted after the rest element" + ); + } + break; + } else { + exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem)); + } + } + var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc; + this.expect(types$1.parenR); + if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + return this.parseParenArrowList(startPos, startLoc, exprList, forInit); + } + if (!exprList.length || lastIsComma) { + this.unexpected(this.lastTokStart); + } + if (spreadStart) { + this.unexpected(spreadStart); + } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + if (exprList.length > 1) { + val = this.startNodeAt(innerStartPos, innerStartLoc); + val.expressions = exprList; + this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); + } else { + val = exprList[0]; + } + } else { + val = this.parseParenExpression(); + } + if (this.options.preserveParens) { + var par = this.startNodeAt(startPos, startLoc); + par.expression = val; + return this.finishNode(par, "ParenthesizedExpression"); + } else { + return val; + } +}; +pp$5.parseParenItem = function(item) { + return item; +}; +pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit); +}; +var empty = []; +pp$5.parseNew = function() { + if (this.containsEsc) { + this.raiseRecoverable(this.start, "Escape sequence in keyword new"); + } + var node2 = this.startNode(); + var meta = this.parseIdent(true); + if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) { + node2.meta = meta; + var containsEsc = this.containsEsc; + node2.property = this.parseIdent(true); + if (node2.property.name !== "target") { + this.raiseRecoverable(node2.property.start, "The only valid meta property for new is 'new.target'"); + } + if (containsEsc) { + this.raiseRecoverable(node2.start, "'new.target' must not contain escaped characters"); + } + if (!this.allowNewDotTarget) { + this.raiseRecoverable(node2.start, "'new.target' can only be used in functions and class static block"); + } + return this.finishNode(node2, "MetaProperty"); + } + var startPos = this.start, startLoc = this.startLoc; + node2.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false); + if (this.eat(types$1.parenL)) { + node2.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); + } else { + node2.arguments = empty; + } + return this.finishNode(node2, "NewExpression"); +}; +pp$5.parseTemplateElement = function(ref2) { + var isTagged = ref2.isTagged; + var elem = this.startNode(); + if (this.type === types$1.invalidTemplate) { + if (!isTagged) { + this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"); + } + elem.value = { + raw: this.value, + cooked: null + }; + } else { + elem.value = { + raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"), + cooked: this.value + }; + } + this.next(); + elem.tail = this.type === types$1.backQuote; + return this.finishNode(elem, "TemplateElement"); +}; +pp$5.parseTemplate = function(ref2) { + if (ref2 === void 0) + ref2 = {}; + var isTagged = ref2.isTagged; + if (isTagged === void 0) + isTagged = false; + var node2 = this.startNode(); + this.next(); + node2.expressions = []; + var curElt = this.parseTemplateElement({ isTagged }); + node2.quasis = [curElt]; + while (!curElt.tail) { + if (this.type === types$1.eof) { + this.raise(this.pos, "Unterminated template literal"); + } + this.expect(types$1.dollarBraceL); + node2.expressions.push(this.parseExpression()); + this.expect(types$1.braceR); + node2.quasis.push(curElt = this.parseTemplateElement({ isTagged })); + } + this.next(); + return this.finishNode(node2, "TemplateLiteral"); +}; +pp$5.isAsyncProp = function(prop) { + return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (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) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); +}; +pp$5.parseObj = function(isPattern, refDestructuringErrors) { + var node2 = this.startNode(), first = true, propHash = {}; + node2.properties = []; + this.next(); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { + break; + } + } else { + first = false; + } + var prop = this.parseProperty(isPattern, refDestructuringErrors); + if (!isPattern) { + this.checkPropClash(prop, propHash, refDestructuringErrors); + } + node2.properties.push(prop); + } + return this.finishNode(node2, isPattern ? "ObjectPattern" : "ObjectExpression"); +}; +pp$5.parseProperty = function(isPattern, refDestructuringErrors) { + var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; + if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) { + if (isPattern) { + prop.argument = this.parseIdent(false); + if (this.type === types$1.comma) { + this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); + } + return this.finishNode(prop, "RestElement"); + } + prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); + if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { + refDestructuringErrors.trailingComma = this.start; + } + return this.finishNode(prop, "SpreadElement"); + } + if (this.options.ecmaVersion >= 6) { + prop.method = false; + prop.shorthand = false; + if (isPattern || refDestructuringErrors) { + startPos = this.start; + startLoc = this.startLoc; + } + if (!isPattern) { + isGenerator = this.eat(types$1.star); + } + } + var containsEsc = this.containsEsc; + this.parsePropertyName(prop); + if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { + isAsync = true; + isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star); + this.parsePropertyName(prop); + } else { + isAsync = false; + } + this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); + return this.finishNode(prop, "Property"); +}; +pp$5.parseGetterSetter = function(prop) { + prop.kind = prop.key.name; + this.parsePropertyName(prop); + prop.value = this.parseMethod(false); + var paramCount = prop.kind === "get" ? 0 : 1; + if (prop.value.params.length !== paramCount) { + var start2 = prop.value.start; + if (prop.kind === "get") { + this.raiseRecoverable(start2, "getter should have no params"); + } else { + this.raiseRecoverable(start2, "setter should have exactly one param"); + } + } else { + if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { + this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); + } + } +}; +pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { + if ((isGenerator || isAsync) && this.type === types$1.colon) { + this.unexpected(); + } + if (this.eat(types$1.colon)) { + prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); + prop.kind = "init"; + } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) { + if (isPattern) { + this.unexpected(); + } + prop.kind = "init"; + prop.method = true; + prop.value = this.parseMethod(isGenerator, isAsync); + } else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) { + if (isGenerator || isAsync) { + this.unexpected(); + } + this.parseGetterSetter(prop); + } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { + if (isGenerator || isAsync) { + this.unexpected(); + } + this.checkUnreserved(prop.key); + if (prop.key.name === "await" && !this.awaitIdentPos) { + this.awaitIdentPos = startPos; + } + prop.kind = "init"; + if (isPattern) { + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else if (this.type === types$1.eq && refDestructuringErrors) { + if (refDestructuringErrors.shorthandAssign < 0) { + refDestructuringErrors.shorthandAssign = this.start; + } + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else { + prop.value = this.copyNode(prop.key); + } + prop.shorthand = true; + } else { + this.unexpected(); + } +}; +pp$5.parsePropertyName = function(prop) { + if (this.options.ecmaVersion >= 6) { + if (this.eat(types$1.bracketL)) { + prop.computed = true; + prop.key = this.parseMaybeAssign(); + this.expect(types$1.bracketR); + return prop.key; + } else { + prop.computed = false; + } + } + return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); +}; +pp$5.initFunction = function(node2) { + node2.id = null; + if (this.options.ecmaVersion >= 6) { + node2.generator = node2.expression = false; + } + if (this.options.ecmaVersion >= 8) { + node2.async = false; + } +}; +pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { + var node2 = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.initFunction(node2); + if (this.options.ecmaVersion >= 6) { + node2.generator = isGenerator; + } + if (this.options.ecmaVersion >= 8) { + node2.async = !!isAsync; + } + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + this.enterScope(functionFlags(isAsync, node2.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); + this.expect(types$1.parenL); + node2.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + this.checkYieldAwaitInDefaultParams(); + this.parseFunctionBody(node2, false, true, false); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node2, "FunctionExpression"); +}; +pp$5.parseArrowExpression = function(node2, params, isAsync, forInit) { + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); + this.initFunction(node2); + if (this.options.ecmaVersion >= 8) { + node2.async = !!isAsync; + } + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + node2.params = this.toAssignableList(params, true); + this.parseFunctionBody(node2, true, false, forInit); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node2, "ArrowFunctionExpression"); +}; +pp$5.parseFunctionBody = function(node2, isArrowFunction, isMethod, forInit) { + var isExpression = isArrowFunction && this.type !== types$1.braceL; + var oldStrict = this.strict, useStrict = false; + if (isExpression) { + node2.body = this.parseMaybeAssign(forInit); + node2.expression = true; + this.checkParams(node2, false); + } else { + var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node2.params); + if (!oldStrict || nonSimple) { + useStrict = this.strictDirective(this.end); + if (useStrict && nonSimple) { + this.raiseRecoverable(node2.start, "Illegal 'use strict' directive in function with non-simple parameter list"); + } + } + var oldLabels = this.labels; + this.labels = []; + if (useStrict) { + this.strict = true; + } + this.checkParams(node2, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node2.params)); + if (this.strict && node2.id) { + this.checkLValSimple(node2.id, BIND_OUTSIDE); + } + node2.body = this.parseBlock(false, void 0, useStrict && !oldStrict); + node2.expression = false; + this.adaptDirectivePrologue(node2.body.body); + this.labels = oldLabels; + } + this.exitScope(); +}; +pp$5.isSimpleParamList = function(params) { + for (var i = 0, list3 = params; i < list3.length; i += 1) { + var param = list3[i]; + if (param.type !== "Identifier") { + return false; + } + } + return true; +}; +pp$5.checkParams = function(node2, allowDuplicates) { + var nameHash = /* @__PURE__ */ Object.create(null); + for (var i = 0, list3 = node2.params; i < list3.length; i += 1) { + var param = list3[i]; + this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); + } +}; +pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { + var elts = [], first = true; + while (!this.eat(close)) { + if (!first) { + this.expect(types$1.comma); + if (allowTrailingComma && this.afterTrailingComma(close)) { + break; + } + } else { + first = false; + } + var elt = void 0; + if (allowEmpty && this.type === types$1.comma) { + elt = null; + } else if (this.type === types$1.ellipsis) { + elt = this.parseSpread(refDestructuringErrors); + if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) { + refDestructuringErrors.trailingComma = this.start; + } + } else { + elt = this.parseMaybeAssign(false, refDestructuringErrors); + } + elts.push(elt); + } + return elts; +}; +pp$5.checkUnreserved = function(ref2) { + var start2 = ref2.start; + var end = ref2.end; + var name2 = ref2.name; + if (this.inGenerator && name2 === "yield") { + this.raiseRecoverable(start2, "Cannot use 'yield' as identifier inside a generator"); + } + if (this.inAsync && name2 === "await") { + this.raiseRecoverable(start2, "Cannot use 'await' as identifier inside an async function"); + } + if (this.currentThisScope().inClassFieldInit && name2 === "arguments") { + this.raiseRecoverable(start2, "Cannot use 'arguments' in class field initializer"); + } + if (this.inClassStaticBlock && (name2 === "arguments" || name2 === "await")) { + this.raise(start2, "Cannot use " + name2 + " in class static initialization block"); + } + if (this.keywords.test(name2)) { + this.raise(start2, "Unexpected keyword '" + name2 + "'"); + } + if (this.options.ecmaVersion < 6 && this.input.slice(start2, end).indexOf("\\") !== -1) { + return; + } + var re2 = this.strict ? this.reservedWordsStrict : this.reservedWords; + if (re2.test(name2)) { + if (!this.inAsync && name2 === "await") { + this.raiseRecoverable(start2, "Cannot use keyword 'await' outside an async function"); + } + this.raiseRecoverable(start2, "The keyword '" + name2 + "' is reserved"); + } +}; +pp$5.parseIdent = function(liberal) { + var node2 = this.parseIdentNode(); + this.next(!!liberal); + this.finishNode(node2, "Identifier"); + if (!liberal) { + this.checkUnreserved(node2); + if (node2.name === "await" && !this.awaitIdentPos) { + this.awaitIdentPos = node2.start; + } + } + return node2; +}; +pp$5.parseIdentNode = function() { + var node2 = this.startNode(); + if (this.type === types$1.name) { + node2.name = this.value; + } else if (this.type.keyword) { + node2.name = this.type.keyword; + if ((node2.name === "class" || node2.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { + this.context.pop(); + } + } else { + this.unexpected(); + } + return node2; +}; +pp$5.parsePrivateIdent = function() { + var node2 = this.startNode(); + if (this.type === types$1.privateId) { + node2.name = this.value; + } else { + this.unexpected(); + } + this.next(); + this.finishNode(node2, "PrivateIdentifier"); + if (this.options.checkPrivateFields) { + if (this.privateNameStack.length === 0) { + this.raise(node2.start, "Private field '#" + node2.name + "' must be declared in an enclosing class"); + } else { + this.privateNameStack[this.privateNameStack.length - 1].used.push(node2); + } + } + return node2; +}; +pp$5.parseYield = function(forInit) { + if (!this.yieldPos) { + this.yieldPos = this.start; + } + var node2 = this.startNode(); + this.next(); + if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) { + node2.delegate = false; + node2.argument = null; + } else { + node2.delegate = this.eat(types$1.star); + node2.argument = this.parseMaybeAssign(forInit); + } + return this.finishNode(node2, "YieldExpression"); +}; +pp$5.parseAwait = function(forInit) { + if (!this.awaitPos) { + this.awaitPos = this.start; + } + var node2 = this.startNode(); + this.next(); + node2.argument = this.parseMaybeUnary(null, true, false, forInit); + return this.finishNode(node2, "AwaitExpression"); +}; +var pp$4 = Parser.prototype; +pp$4.raise = function(pos, message) { + var loc = getLineInfo(this.input, pos); + message += " (" + loc.line + ":" + loc.column + ")"; + var err = new SyntaxError(message); + err.pos = pos; + err.loc = loc; + err.raisedAt = this.pos; + throw err; +}; +pp$4.raiseRecoverable = pp$4.raise; +pp$4.curPosition = function() { + if (this.options.locations) { + return new Position(this.curLine, this.pos - this.lineStart); + } +}; +var pp$3 = Parser.prototype; +var Scope = function Scope2(flags) { + this.flags = flags; + this.var = []; + this.lexical = []; + this.functions = []; + this.inClassFieldInit = false; +}; +pp$3.enterScope = function(flags) { + this.scopeStack.push(new Scope(flags)); +}; +pp$3.exitScope = function() { + this.scopeStack.pop(); +}; +pp$3.treatFunctionsAsVarInScope = function(scope) { + return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP; +}; +pp$3.declareName = function(name2, bindingType, pos) { + var redeclared = false; + if (bindingType === BIND_LEXICAL) { + var scope = this.currentScope(); + redeclared = scope.lexical.indexOf(name2) > -1 || scope.functions.indexOf(name2) > -1 || scope.var.indexOf(name2) > -1; + scope.lexical.push(name2); + if (this.inModule && scope.flags & SCOPE_TOP) { + delete this.undefinedExports[name2]; + } + } else if (bindingType === BIND_SIMPLE_CATCH) { + var scope$1 = this.currentScope(); + scope$1.lexical.push(name2); + } else if (bindingType === BIND_FUNCTION) { + var scope$2 = this.currentScope(); + if (this.treatFunctionsAsVar) { + redeclared = scope$2.lexical.indexOf(name2) > -1; + } else { + redeclared = scope$2.lexical.indexOf(name2) > -1 || scope$2.var.indexOf(name2) > -1; + } + scope$2.functions.push(name2); + } else { + for (var i = this.scopeStack.length - 1; i >= 0; --i) { + var scope$3 = this.scopeStack[i]; + if (scope$3.lexical.indexOf(name2) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name2) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name2) > -1) { + redeclared = true; + break; + } + scope$3.var.push(name2); + if (this.inModule && scope$3.flags & SCOPE_TOP) { + delete this.undefinedExports[name2]; + } + if (scope$3.flags & SCOPE_VAR) { + break; + } + } + } + if (redeclared) { + this.raiseRecoverable(pos, "Identifier '" + name2 + "' has already been declared"); + } +}; +pp$3.checkLocalExport = function(id) { + if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1) { + this.undefinedExports[id.name] = id; + } +}; +pp$3.currentScope = function() { + return this.scopeStack[this.scopeStack.length - 1]; +}; +pp$3.currentVarScope = function() { + for (var i = this.scopeStack.length - 1; ; i--) { + var scope = this.scopeStack[i]; + if (scope.flags & SCOPE_VAR) { + return scope; + } + } +}; +pp$3.currentThisScope = function() { + for (var i = this.scopeStack.length - 1; ; i--) { + var scope = this.scopeStack[i]; + if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { + return scope; + } + } +}; +var Node = function Node2(parser, pos, loc) { + this.type = ""; + this.start = pos; + this.end = 0; + if (parser.options.locations) { + this.loc = new SourceLocation(parser, loc); + } + if (parser.options.directSourceFile) { + this.sourceFile = parser.options.directSourceFile; + } + if (parser.options.ranges) { + this.range = [pos, 0]; + } +}; +var pp$2 = Parser.prototype; +pp$2.startNode = function() { + return new Node(this, this.start, this.startLoc); +}; +pp$2.startNodeAt = function(pos, loc) { + return new Node(this, pos, loc); +}; +function finishNodeAt(node2, type, pos, loc) { + node2.type = type; + node2.end = pos; + if (this.options.locations) { + node2.loc.end = loc; + } + if (this.options.ranges) { + node2.range[1] = pos; + } + return node2; +} +pp$2.finishNode = function(node2, type) { + return finishNodeAt.call(this, node2, type, this.lastTokEnd, this.lastTokEndLoc); +}; +pp$2.finishNodeAt = function(node2, type, pos, loc) { + return finishNodeAt.call(this, node2, type, pos, loc); +}; +pp$2.copyNode = function(node2) { + var newNode = new Node(this, node2.start, this.startLoc); + for (var prop in node2) { + newNode[prop] = node2[prop]; + } + return newNode; +}; +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"; +var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; +var ecma11BinaryProperties = ecma10BinaryProperties; +var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict"; +var ecma13BinaryProperties = ecma12BinaryProperties; +var ecma14BinaryProperties = ecma13BinaryProperties; +var unicodeBinaryProperties = { + 9: ecma9BinaryProperties, + 10: ecma10BinaryProperties, + 11: ecma11BinaryProperties, + 12: ecma12BinaryProperties, + 13: ecma13BinaryProperties, + 14: ecma14BinaryProperties +}; +var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"; +var unicodeBinaryPropertiesOfStrings = { + 9: "", + 10: "", + 11: "", + 12: "", + 13: "", + 14: ecma14BinaryPropertiesOfStrings +}; +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"; +var 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"; +var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; +var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; +var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; +var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith"; +var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz"; +var unicodeScriptValues = { + 9: ecma9ScriptValues, + 10: ecma10ScriptValues, + 11: ecma11ScriptValues, + 12: ecma12ScriptValues, + 13: ecma13ScriptValues, + 14: ecma14ScriptValues +}; +var data = {}; +function buildUnicodeData(ecmaVersion) { + var d = data[ecmaVersion] = { + binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), + binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]), + nonBinary: { + General_Category: wordsRegexp(unicodeGeneralCategoryValues), + Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) + } + }; + d.nonBinary.Script_Extensions = d.nonBinary.Script; + d.nonBinary.gc = d.nonBinary.General_Category; + d.nonBinary.sc = d.nonBinary.Script; + d.nonBinary.scx = d.nonBinary.Script_Extensions; +} +for (i = 0, list3 = [9, 10, 11, 12, 13, 14]; i < list3.length; i += 1) { + ecmaVersion = list3[i]; + buildUnicodeData(ecmaVersion); +} +var ecmaVersion; +var i; +var list3; +var pp$1 = Parser.prototype; +var RegExpValidationState = function RegExpValidationState2(parser) { + this.parser = parser; + this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : ""); + this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion]; + this.source = ""; + this.flags = ""; + this.start = 0; + this.switchU = false; + this.switchV = false; + this.switchN = false; + this.pos = 0; + this.lastIntValue = 0; + this.lastStringValue = ""; + this.lastAssertionIsQuantifiable = false; + this.numCapturingParens = 0; + this.maxBackReference = 0; + this.groupNames = []; + this.backReferenceNames = []; +}; +RegExpValidationState.prototype.reset = function reset(start2, pattern, flags) { + var unicodeSets = flags.indexOf("v") !== -1; + var unicode = flags.indexOf("u") !== -1; + this.start = start2 | 0; + this.source = pattern + ""; + this.flags = flags; + if (unicodeSets && this.parser.options.ecmaVersion >= 15) { + this.switchU = true; + this.switchV = true; + this.switchN = true; + } else { + this.switchU = unicode && this.parser.options.ecmaVersion >= 6; + this.switchV = false; + this.switchN = unicode && this.parser.options.ecmaVersion >= 9; + } +}; +RegExpValidationState.prototype.raise = function raise(message) { + this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message); +}; +RegExpValidationState.prototype.at = function at(i, forceU) { + if (forceU === void 0) + forceU = false; + var s = this.source; + var l = s.length; + if (i >= l) { + return -1; + } + var c = s.charCodeAt(i); + if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l) { + return c; + } + var next = s.charCodeAt(i + 1); + return next >= 56320 && next <= 57343 ? (c << 10) + next - 56613888 : c; +}; +RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) { + if (forceU === void 0) + forceU = false; + var s = this.source; + var l = s.length; + if (i >= l) { + return l; + } + var c = s.charCodeAt(i), next; + if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 56320 || next > 57343) { + return i + 1; + } + return i + 2; +}; +RegExpValidationState.prototype.current = function current(forceU) { + if (forceU === void 0) + forceU = false; + return this.at(this.pos, forceU); +}; +RegExpValidationState.prototype.lookahead = function lookahead(forceU) { + if (forceU === void 0) + forceU = false; + return this.at(this.nextIndex(this.pos, forceU), forceU); +}; +RegExpValidationState.prototype.advance = function advance(forceU) { + if (forceU === void 0) + forceU = false; + this.pos = this.nextIndex(this.pos, forceU); +}; +RegExpValidationState.prototype.eat = function eat(ch, forceU) { + if (forceU === void 0) + forceU = false; + if (this.current(forceU) === ch) { + this.advance(forceU); + return true; + } + return false; +}; +RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) { + if (forceU === void 0) + forceU = false; + var pos = this.pos; + for (var i = 0, list3 = chs; i < list3.length; i += 1) { + var ch = list3[i]; + var current2 = this.at(pos, forceU); + if (current2 === -1 || current2 !== ch) { + return false; + } + pos = this.nextIndex(pos, forceU); + } + this.pos = pos; + return true; +}; +pp$1.validateRegExpFlags = function(state) { + var validFlags = state.validFlags; + var flags = state.flags; + var u = false; + var v = false; + for (var i = 0; i < flags.length; i++) { + var flag = flags.charAt(i); + if (validFlags.indexOf(flag) === -1) { + this.raise(state.start, "Invalid regular expression flag"); + } + if (flags.indexOf(flag, i + 1) > -1) { + this.raise(state.start, "Duplicate regular expression flag"); + } + if (flag === "u") { + u = true; + } + if (flag === "v") { + v = true; + } + } + if (this.options.ecmaVersion >= 15 && u && v) { + this.raise(state.start, "Invalid regular expression flag"); + } +}; +pp$1.validateRegExpPattern = function(state) { + this.regexp_pattern(state); + if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) { + state.switchN = true; + this.regexp_pattern(state); + } +}; +pp$1.regexp_pattern = function(state) { + state.pos = 0; + state.lastIntValue = 0; + state.lastStringValue = ""; + state.lastAssertionIsQuantifiable = false; + state.numCapturingParens = 0; + state.maxBackReference = 0; + state.groupNames.length = 0; + state.backReferenceNames.length = 0; + this.regexp_disjunction(state); + if (state.pos !== state.source.length) { + if (state.eat( + 41 + /* ) */ + )) { + state.raise("Unmatched ')'"); + } + if (state.eat( + 93 + /* ] */ + ) || state.eat( + 125 + /* } */ + )) { + state.raise("Lone quantifier brackets"); + } + } + if (state.maxBackReference > state.numCapturingParens) { + state.raise("Invalid escape"); + } + for (var i = 0, list3 = state.backReferenceNames; i < list3.length; i += 1) { + var name2 = list3[i]; + if (state.groupNames.indexOf(name2) === -1) { + state.raise("Invalid named capture referenced"); + } + } +}; +pp$1.regexp_disjunction = function(state) { + this.regexp_alternative(state); + while (state.eat( + 124 + /* | */ + )) { + this.regexp_alternative(state); + } + if (this.regexp_eatQuantifier(state, true)) { + state.raise("Nothing to repeat"); + } + if (state.eat( + 123 + /* { */ + )) { + state.raise("Lone quantifier brackets"); + } +}; +pp$1.regexp_alternative = function(state) { + while (state.pos < state.source.length && this.regexp_eatTerm(state)) { + } +}; +pp$1.regexp_eatTerm = function(state) { + if (this.regexp_eatAssertion(state)) { + if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) { + if (state.switchU) { + state.raise("Invalid quantifier"); + } + } + return true; + } + if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) { + this.regexp_eatQuantifier(state); + return true; + } + return false; +}; +pp$1.regexp_eatAssertion = function(state) { + var start2 = state.pos; + state.lastAssertionIsQuantifiable = false; + if (state.eat( + 94 + /* ^ */ + ) || state.eat( + 36 + /* $ */ + )) { + return true; + } + if (state.eat( + 92 + /* \ */ + )) { + if (state.eat( + 66 + /* B */ + ) || state.eat( + 98 + /* b */ + )) { + return true; + } + state.pos = start2; + } + if (state.eat( + 40 + /* ( */ + ) && state.eat( + 63 + /* ? */ + )) { + var lookbehind = false; + if (this.options.ecmaVersion >= 9) { + lookbehind = state.eat( + 60 + /* < */ + ); + } + if (state.eat( + 61 + /* = */ + ) || state.eat( + 33 + /* ! */ + )) { + this.regexp_disjunction(state); + if (!state.eat( + 41 + /* ) */ + )) { + state.raise("Unterminated group"); + } + state.lastAssertionIsQuantifiable = !lookbehind; + return true; + } + } + state.pos = start2; + return false; +}; +pp$1.regexp_eatQuantifier = function(state, noError) { + if (noError === void 0) + noError = false; + if (this.regexp_eatQuantifierPrefix(state, noError)) { + state.eat( + 63 + /* ? */ + ); + return true; + } + return false; +}; +pp$1.regexp_eatQuantifierPrefix = function(state, noError) { + return state.eat( + 42 + /* * */ + ) || state.eat( + 43 + /* + */ + ) || state.eat( + 63 + /* ? */ + ) || this.regexp_eatBracedQuantifier(state, noError); +}; +pp$1.regexp_eatBracedQuantifier = function(state, noError) { + var start2 = state.pos; + if (state.eat( + 123 + /* { */ + )) { + var min = 0, max = -1; + if (this.regexp_eatDecimalDigits(state)) { + min = state.lastIntValue; + if (state.eat( + 44 + /* , */ + ) && this.regexp_eatDecimalDigits(state)) { + max = state.lastIntValue; + } + if (state.eat( + 125 + /* } */ + )) { + if (max !== -1 && max < min && !noError) { + state.raise("numbers out of order in {} quantifier"); + } + return true; + } + } + if (state.switchU && !noError) { + state.raise("Incomplete quantifier"); + } + state.pos = start2; + } + return false; +}; +pp$1.regexp_eatAtom = function(state) { + return this.regexp_eatPatternCharacters(state) || state.eat( + 46 + /* . */ + ) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state); +}; +pp$1.regexp_eatReverseSolidusAtomEscape = function(state) { + var start2 = state.pos; + if (state.eat( + 92 + /* \ */ + )) { + if (this.regexp_eatAtomEscape(state)) { + return true; + } + state.pos = start2; + } + return false; +}; +pp$1.regexp_eatUncapturingGroup = function(state) { + var start2 = state.pos; + if (state.eat( + 40 + /* ( */ + )) { + if (state.eat( + 63 + /* ? */ + ) && state.eat( + 58 + /* : */ + )) { + this.regexp_disjunction(state); + if (state.eat( + 41 + /* ) */ + )) { + return true; + } + state.raise("Unterminated group"); + } + state.pos = start2; + } + return false; +}; +pp$1.regexp_eatCapturingGroup = function(state) { + if (state.eat( + 40 + /* ( */ + )) { + if (this.options.ecmaVersion >= 9) { + this.regexp_groupSpecifier(state); + } else if (state.current() === 63) { + state.raise("Invalid group"); + } + this.regexp_disjunction(state); + if (state.eat( + 41 + /* ) */ + )) { + state.numCapturingParens += 1; + return true; + } + state.raise("Unterminated group"); + } + return false; +}; +pp$1.regexp_eatExtendedAtom = function(state) { + return state.eat( + 46 + /* . */ + ) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state); +}; +pp$1.regexp_eatInvalidBracedQuantifier = function(state) { + if (this.regexp_eatBracedQuantifier(state, true)) { + state.raise("Nothing to repeat"); + } + return false; +}; +pp$1.regexp_eatSyntaxCharacter = function(state) { + var ch = state.current(); + if (isSyntaxCharacter(ch)) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; +}; +function isSyntaxCharacter(ch) { + return ch === 36 || ch >= 40 && ch <= 43 || ch === 46 || ch === 63 || ch >= 91 && ch <= 94 || ch >= 123 && ch <= 125; +} +pp$1.regexp_eatPatternCharacters = function(state) { + var start2 = state.pos; + var ch = 0; + while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) { + state.advance(); + } + return state.pos !== start2; +}; +pp$1.regexp_eatExtendedPatternCharacter = function(state) { + var ch = state.current(); + if (ch !== -1 && ch !== 36 && !(ch >= 40 && ch <= 43) && ch !== 46 && ch !== 63 && ch !== 91 && ch !== 94 && ch !== 124) { + state.advance(); + return true; + } + return false; +}; +pp$1.regexp_groupSpecifier = function(state) { + if (state.eat( + 63 + /* ? */ + )) { + if (this.regexp_eatGroupName(state)) { + if (state.groupNames.indexOf(state.lastStringValue) !== -1) { + state.raise("Duplicate capture group name"); + } + state.groupNames.push(state.lastStringValue); + return; + } + state.raise("Invalid group"); + } +}; +pp$1.regexp_eatGroupName = function(state) { + state.lastStringValue = ""; + if (state.eat( + 60 + /* < */ + )) { + if (this.regexp_eatRegExpIdentifierName(state) && state.eat( + 62 + /* > */ + )) { + return true; + } + state.raise("Invalid capture group name"); + } + return false; +}; +pp$1.regexp_eatRegExpIdentifierName = function(state) { + state.lastStringValue = ""; + if (this.regexp_eatRegExpIdentifierStart(state)) { + state.lastStringValue += codePointToString(state.lastIntValue); + while (this.regexp_eatRegExpIdentifierPart(state)) { + state.lastStringValue += codePointToString(state.lastIntValue); + } + return true; + } + return false; +}; +pp$1.regexp_eatRegExpIdentifierStart = function(state) { + var start2 = state.pos; + var forceU = this.options.ecmaVersion >= 11; + var ch = state.current(forceU); + state.advance(forceU); + if (ch === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { + ch = state.lastIntValue; + } + if (isRegExpIdentifierStart(ch)) { + state.lastIntValue = ch; + return true; + } + state.pos = start2; + return false; +}; +function isRegExpIdentifierStart(ch) { + return isIdentifierStart(ch, true) || ch === 36 || ch === 95; +} +pp$1.regexp_eatRegExpIdentifierPart = function(state) { + var start2 = state.pos; + var forceU = this.options.ecmaVersion >= 11; + var ch = state.current(forceU); + state.advance(forceU); + if (ch === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { + ch = state.lastIntValue; + } + if (isRegExpIdentifierPart(ch)) { + state.lastIntValue = ch; + return true; + } + state.pos = start2; + return false; +}; +function isRegExpIdentifierPart(ch) { + return isIdentifierChar(ch, true) || ch === 36 || ch === 95 || ch === 8204 || ch === 8205; +} +pp$1.regexp_eatAtomEscape = function(state) { + if (this.regexp_eatBackReference(state) || this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state) || state.switchN && this.regexp_eatKGroupName(state)) { + return true; + } + if (state.switchU) { + if (state.current() === 99) { + state.raise("Invalid unicode escape"); + } + state.raise("Invalid escape"); + } + return false; +}; +pp$1.regexp_eatBackReference = function(state) { + var start2 = state.pos; + if (this.regexp_eatDecimalEscape(state)) { + var n = state.lastIntValue; + if (state.switchU) { + if (n > state.maxBackReference) { + state.maxBackReference = n; + } + return true; + } + if (n <= state.numCapturingParens) { + return true; + } + state.pos = start2; + } + return false; +}; +pp$1.regexp_eatKGroupName = function(state) { + if (state.eat( + 107 + /* k */ + )) { + if (this.regexp_eatGroupName(state)) { + state.backReferenceNames.push(state.lastStringValue); + return true; + } + state.raise("Invalid named reference"); + } + return false; +}; +pp$1.regexp_eatCharacterEscape = function(state) { + return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state); +}; +pp$1.regexp_eatCControlLetter = function(state) { + var start2 = state.pos; + if (state.eat( + 99 + /* c */ + )) { + if (this.regexp_eatControlLetter(state)) { + return true; + } + state.pos = start2; + } + return false; +}; +pp$1.regexp_eatZero = function(state) { + if (state.current() === 48 && !isDecimalDigit(state.lookahead())) { + state.lastIntValue = 0; + state.advance(); + return true; + } + return false; +}; +pp$1.regexp_eatControlEscape = function(state) { + var ch = state.current(); + if (ch === 116) { + state.lastIntValue = 9; + state.advance(); + return true; + } + if (ch === 110) { + state.lastIntValue = 10; + state.advance(); + return true; + } + if (ch === 118) { + state.lastIntValue = 11; + state.advance(); + return true; + } + if (ch === 102) { + state.lastIntValue = 12; + state.advance(); + return true; + } + if (ch === 114) { + state.lastIntValue = 13; + state.advance(); + return true; + } + return false; +}; +pp$1.regexp_eatControlLetter = function(state) { + var ch = state.current(); + if (isControlLetter(ch)) { + state.lastIntValue = ch % 32; + state.advance(); + return true; + } + return false; +}; +function isControlLetter(ch) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122; +} +pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) { + if (forceU === void 0) + forceU = false; + var start2 = state.pos; + var switchU = forceU || state.switchU; + if (state.eat( + 117 + /* u */ + )) { + if (this.regexp_eatFixedHexDigits(state, 4)) { + var lead = state.lastIntValue; + if (switchU && lead >= 55296 && lead <= 56319) { + var leadSurrogateEnd = state.pos; + if (state.eat( + 92 + /* \ */ + ) && state.eat( + 117 + /* u */ + ) && this.regexp_eatFixedHexDigits(state, 4)) { + var trail = state.lastIntValue; + if (trail >= 56320 && trail <= 57343) { + state.lastIntValue = (lead - 55296) * 1024 + (trail - 56320) + 65536; + return true; + } + } + state.pos = leadSurrogateEnd; + state.lastIntValue = lead; + } + return true; + } + if (switchU && state.eat( + 123 + /* { */ + ) && this.regexp_eatHexDigits(state) && state.eat( + 125 + /* } */ + ) && isValidUnicode(state.lastIntValue)) { + return true; + } + if (switchU) { + state.raise("Invalid unicode escape"); + } + state.pos = start2; + } + return false; +}; +function isValidUnicode(ch) { + return ch >= 0 && ch <= 1114111; +} +pp$1.regexp_eatIdentityEscape = function(state) { + if (state.switchU) { + if (this.regexp_eatSyntaxCharacter(state)) { + return true; + } + if (state.eat( + 47 + /* / */ + )) { + state.lastIntValue = 47; + return true; + } + return false; + } + var ch = state.current(); + if (ch !== 99 && (!state.switchN || ch !== 107)) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; +}; +pp$1.regexp_eatDecimalEscape = function(state) { + state.lastIntValue = 0; + var ch = state.current(); + if (ch >= 49 && ch <= 57) { + do { + state.lastIntValue = 10 * state.lastIntValue + (ch - 48); + state.advance(); + } while ((ch = state.current()) >= 48 && ch <= 57); + return true; + } + return false; +}; +var CharSetNone = 0; +var CharSetOk = 1; +var CharSetString = 2; +pp$1.regexp_eatCharacterClassEscape = function(state) { + var ch = state.current(); + if (isCharacterClassEscape(ch)) { + state.lastIntValue = -1; + state.advance(); + return CharSetOk; + } + var negate = false; + if (state.switchU && this.options.ecmaVersion >= 9 && ((negate = ch === 80) || ch === 112)) { + state.lastIntValue = -1; + state.advance(); + var result; + if (state.eat( + 123 + /* { */ + ) && (result = this.regexp_eatUnicodePropertyValueExpression(state)) && state.eat( + 125 + /* } */ + )) { + if (negate && result === CharSetString) { + state.raise("Invalid property name"); + } + return result; + } + state.raise("Invalid property name"); + } + return CharSetNone; +}; +function isCharacterClassEscape(ch) { + return ch === 100 || ch === 68 || ch === 115 || ch === 83 || ch === 119 || ch === 87; +} +pp$1.regexp_eatUnicodePropertyValueExpression = function(state) { + var start2 = state.pos; + if (this.regexp_eatUnicodePropertyName(state) && state.eat( + 61 + /* = */ + )) { + var name2 = state.lastStringValue; + if (this.regexp_eatUnicodePropertyValue(state)) { + var value = state.lastStringValue; + this.regexp_validateUnicodePropertyNameAndValue(state, name2, value); + return CharSetOk; + } + } + state.pos = start2; + if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { + var nameOrValue = state.lastStringValue; + return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); + } + return CharSetNone; +}; +pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name2, value) { + if (!hasOwn(state.unicodeProperties.nonBinary, name2)) { + state.raise("Invalid property name"); + } + if (!state.unicodeProperties.nonBinary[name2].test(value)) { + state.raise("Invalid property value"); + } +}; +pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) { + if (state.unicodeProperties.binary.test(nameOrValue)) { + return CharSetOk; + } + if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { + return CharSetString; + } + state.raise("Invalid property name"); +}; +pp$1.regexp_eatUnicodePropertyName = function(state) { + var ch = 0; + state.lastStringValue = ""; + while (isUnicodePropertyNameCharacter(ch = state.current())) { + state.lastStringValue += codePointToString(ch); + state.advance(); + } + return state.lastStringValue !== ""; +}; +function isUnicodePropertyNameCharacter(ch) { + return isControlLetter(ch) || ch === 95; +} +pp$1.regexp_eatUnicodePropertyValue = function(state) { + var ch = 0; + state.lastStringValue = ""; + while (isUnicodePropertyValueCharacter(ch = state.current())) { + state.lastStringValue += codePointToString(ch); + state.advance(); + } + return state.lastStringValue !== ""; +}; +function isUnicodePropertyValueCharacter(ch) { + return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch); +} +pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) { + return this.regexp_eatUnicodePropertyValue(state); +}; +pp$1.regexp_eatCharacterClass = function(state) { + if (state.eat( + 91 + /* [ */ + )) { + var negate = state.eat( + 94 + /* ^ */ + ); + var result = this.regexp_classContents(state); + if (!state.eat( + 93 + /* ] */ + )) { + state.raise("Unterminated character class"); + } + if (negate && result === CharSetString) { + state.raise("Negated character class may contain strings"); + } + return true; + } + return false; +}; +pp$1.regexp_classContents = function(state) { + if (state.current() === 93) { + return CharSetOk; + } + if (state.switchV) { + return this.regexp_classSetExpression(state); + } + this.regexp_nonEmptyClassRanges(state); + return CharSetOk; +}; +pp$1.regexp_nonEmptyClassRanges = function(state) { + while (this.regexp_eatClassAtom(state)) { + var left = state.lastIntValue; + if (state.eat( + 45 + /* - */ + ) && this.regexp_eatClassAtom(state)) { + var right = state.lastIntValue; + if (state.switchU && (left === -1 || right === -1)) { + state.raise("Invalid character class"); + } + if (left !== -1 && right !== -1 && left > right) { + state.raise("Range out of order in character class"); + } + } + } +}; +pp$1.regexp_eatClassAtom = function(state) { + var start2 = state.pos; + if (state.eat( + 92 + /* \ */ + )) { + if (this.regexp_eatClassEscape(state)) { + return true; + } + if (state.switchU) { + var ch$1 = state.current(); + if (ch$1 === 99 || isOctalDigit(ch$1)) { + state.raise("Invalid class escape"); + } + state.raise("Invalid escape"); + } + state.pos = start2; + } + var ch = state.current(); + if (ch !== 93) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; +}; +pp$1.regexp_eatClassEscape = function(state) { + var start2 = state.pos; + if (state.eat( + 98 + /* b */ + )) { + state.lastIntValue = 8; + return true; + } + if (state.switchU && state.eat( + 45 + /* - */ + )) { + state.lastIntValue = 45; + return true; + } + if (!state.switchU && state.eat( + 99 + /* c */ + )) { + if (this.regexp_eatClassControlLetter(state)) { + return true; + } + state.pos = start2; + } + return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state); +}; +pp$1.regexp_classSetExpression = function(state) { + var result = CharSetOk, subResult; + if (this.regexp_eatClassSetRange(state)) + ; + else if (subResult = this.regexp_eatClassSetOperand(state)) { + if (subResult === CharSetString) { + result = CharSetString; + } + var start2 = state.pos; + while (state.eatChars( + [38, 38] + /* && */ + )) { + if (state.current() !== 38 && (subResult = this.regexp_eatClassSetOperand(state))) { + if (subResult !== CharSetString) { + result = CharSetOk; + } + continue; + } + state.raise("Invalid character in character class"); + } + if (start2 !== state.pos) { + return result; + } + while (state.eatChars( + [45, 45] + /* -- */ + )) { + if (this.regexp_eatClassSetOperand(state)) { + continue; + } + state.raise("Invalid character in character class"); + } + if (start2 !== state.pos) { + return result; + } + } else { + state.raise("Invalid character in character class"); + } + for (; ; ) { + if (this.regexp_eatClassSetRange(state)) { + continue; + } + subResult = this.regexp_eatClassSetOperand(state); + if (!subResult) { + return result; + } + if (subResult === CharSetString) { + result = CharSetString; + } + } +}; +pp$1.regexp_eatClassSetRange = function(state) { + var start2 = state.pos; + if (this.regexp_eatClassSetCharacter(state)) { + var left = state.lastIntValue; + if (state.eat( + 45 + /* - */ + ) && this.regexp_eatClassSetCharacter(state)) { + var right = state.lastIntValue; + if (left !== -1 && right !== -1 && left > right) { + state.raise("Range out of order in character class"); + } + return true; + } + state.pos = start2; + } + return false; +}; +pp$1.regexp_eatClassSetOperand = function(state) { + if (this.regexp_eatClassSetCharacter(state)) { + return CharSetOk; + } + return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state); +}; +pp$1.regexp_eatNestedClass = function(state) { + var start2 = state.pos; + if (state.eat( + 91 + /* [ */ + )) { + var negate = state.eat( + 94 + /* ^ */ + ); + var result = this.regexp_classContents(state); + if (state.eat( + 93 + /* ] */ + )) { + if (negate && result === CharSetString) { + state.raise("Negated character class may contain strings"); + } + return result; + } + state.pos = start2; + } + if (state.eat( + 92 + /* \ */ + )) { + var result$1 = this.regexp_eatCharacterClassEscape(state); + if (result$1) { + return result$1; + } + state.pos = start2; + } + return null; +}; +pp$1.regexp_eatClassStringDisjunction = function(state) { + var start2 = state.pos; + if (state.eatChars( + [92, 113] + /* \q */ + )) { + if (state.eat( + 123 + /* { */ + )) { + var result = this.regexp_classStringDisjunctionContents(state); + if (state.eat( + 125 + /* } */ + )) { + return result; + } + } else { + state.raise("Invalid escape"); + } + state.pos = start2; + } + return null; +}; +pp$1.regexp_classStringDisjunctionContents = function(state) { + var result = this.regexp_classString(state); + while (state.eat( + 124 + /* | */ + )) { + if (this.regexp_classString(state) === CharSetString) { + result = CharSetString; + } + } + return result; +}; +pp$1.regexp_classString = function(state) { + var count = 0; + while (this.regexp_eatClassSetCharacter(state)) { + count++; + } + return count === 1 ? CharSetOk : CharSetString; +}; +pp$1.regexp_eatClassSetCharacter = function(state) { + var start2 = state.pos; + if (state.eat( + 92 + /* \ */ + )) { + if (this.regexp_eatCharacterEscape(state) || this.regexp_eatClassSetReservedPunctuator(state)) { + return true; + } + if (state.eat( + 98 + /* b */ + )) { + state.lastIntValue = 8; + return true; + } + state.pos = start2; + return false; + } + var ch = state.current(); + if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { + return false; + } + if (isClassSetSyntaxCharacter(ch)) { + return false; + } + state.advance(); + state.lastIntValue = ch; + return true; +}; +function isClassSetReservedDoublePunctuatorCharacter(ch) { + return ch === 33 || ch >= 35 && ch <= 38 || ch >= 42 && ch <= 44 || ch === 46 || ch >= 58 && ch <= 64 || ch === 94 || ch === 96 || ch === 126; +} +function isClassSetSyntaxCharacter(ch) { + return ch === 40 || ch === 41 || ch === 45 || ch === 47 || ch >= 91 && ch <= 93 || ch >= 123 && ch <= 125; +} +pp$1.regexp_eatClassSetReservedPunctuator = function(state) { + var ch = state.current(); + if (isClassSetReservedPunctuator(ch)) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; +}; +function isClassSetReservedPunctuator(ch) { + return ch === 33 || ch === 35 || ch === 37 || ch === 38 || ch === 44 || ch === 45 || ch >= 58 && ch <= 62 || ch === 64 || ch === 96 || ch === 126; +} +pp$1.regexp_eatClassControlLetter = function(state) { + var ch = state.current(); + if (isDecimalDigit(ch) || ch === 95) { + state.lastIntValue = ch % 32; + state.advance(); + return true; + } + return false; +}; +pp$1.regexp_eatHexEscapeSequence = function(state) { + var start2 = state.pos; + if (state.eat( + 120 + /* x */ + )) { + if (this.regexp_eatFixedHexDigits(state, 2)) { + return true; + } + if (state.switchU) { + state.raise("Invalid escape"); + } + state.pos = start2; + } + return false; +}; +pp$1.regexp_eatDecimalDigits = function(state) { + var start2 = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isDecimalDigit(ch = state.current())) { + state.lastIntValue = 10 * state.lastIntValue + (ch - 48); + state.advance(); + } + return state.pos !== start2; +}; +function isDecimalDigit(ch) { + return ch >= 48 && ch <= 57; +} +pp$1.regexp_eatHexDigits = function(state) { + var start2 = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isHexDigit(ch = state.current())) { + state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); + state.advance(); + } + return state.pos !== start2; +}; +function isHexDigit(ch) { + return ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102; +} +function hexToInt(ch) { + if (ch >= 65 && ch <= 70) { + return 10 + (ch - 65); + } + if (ch >= 97 && ch <= 102) { + return 10 + (ch - 97); + } + return ch - 48; +} +pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) { + if (this.regexp_eatOctalDigit(state)) { + var n1 = state.lastIntValue; + if (this.regexp_eatOctalDigit(state)) { + var n2 = state.lastIntValue; + if (n1 <= 3 && this.regexp_eatOctalDigit(state)) { + state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue; + } else { + state.lastIntValue = n1 * 8 + n2; + } + } else { + state.lastIntValue = n1; + } + return true; + } + return false; +}; +pp$1.regexp_eatOctalDigit = function(state) { + var ch = state.current(); + if (isOctalDigit(ch)) { + state.lastIntValue = ch - 48; + state.advance(); + return true; + } + state.lastIntValue = 0; + return false; +}; +function isOctalDigit(ch) { + return ch >= 48 && ch <= 55; +} +pp$1.regexp_eatFixedHexDigits = function(state, length) { + var start2 = state.pos; + state.lastIntValue = 0; + for (var i = 0; i < length; ++i) { + var ch = state.current(); + if (!isHexDigit(ch)) { + state.pos = start2; + return false; + } + state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); + state.advance(); + } + return true; +}; +var Token = function Token2(p) { + this.type = p.type; + this.value = p.value; + this.start = p.start; + this.end = p.end; + if (p.options.locations) { + this.loc = new SourceLocation(p, p.startLoc, p.endLoc); + } + if (p.options.ranges) { + this.range = [p.start, p.end]; + } +}; +var pp = Parser.prototype; +pp.next = function(ignoreEscapeSequenceInKeyword) { + if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) { + this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); + } + if (this.options.onToken) { + this.options.onToken(new Token(this)); + } + this.lastTokEnd = this.end; + this.lastTokStart = this.start; + this.lastTokEndLoc = this.endLoc; + this.lastTokStartLoc = this.startLoc; + this.nextToken(); +}; +pp.getToken = function() { + this.next(); + return new Token(this); +}; +if (typeof Symbol !== "undefined") { + pp[Symbol.iterator] = function() { + var this$1$1 = this; + return { + next: function() { + var token = this$1$1.getToken(); + return { + done: token.type === types$1.eof, + value: token + }; + } + }; + }; +} +pp.nextToken = function() { + var curContext = this.curContext(); + if (!curContext || !curContext.preserveSpace) { + this.skipSpace(); + } + this.start = this.pos; + if (this.options.locations) { + this.startLoc = this.curPosition(); + } + if (this.pos >= this.input.length) { + return this.finishToken(types$1.eof); + } + if (curContext.override) { + return curContext.override(this); + } else { + this.readToken(this.fullCharCodeAtPos()); + } +}; +pp.readToken = function(code2) { + if (isIdentifierStart(code2, this.options.ecmaVersion >= 6) || code2 === 92) { + return this.readWord(); + } + return this.getTokenFromCode(code2); +}; +pp.fullCharCodeAtPos = function() { + var code2 = this.input.charCodeAt(this.pos); + if (code2 <= 55295 || code2 >= 56320) { + return code2; + } + var next = this.input.charCodeAt(this.pos + 1); + return next <= 56319 || next >= 57344 ? code2 : (code2 << 10) + next - 56613888; +}; +pp.skipBlockComment = function() { + var startLoc = this.options.onComment && this.curPosition(); + var start2 = this.pos, end = this.input.indexOf("*/", this.pos += 2); + if (end === -1) { + this.raise(this.pos - 2, "Unterminated comment"); + } + this.pos = end + 2; + if (this.options.locations) { + for (var nextBreak = void 0, pos = start2; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1; ) { + ++this.curLine; + pos = this.lineStart = nextBreak; + } + } + if (this.options.onComment) { + this.options.onComment( + true, + this.input.slice(start2 + 2, end), + start2, + this.pos, + startLoc, + this.curPosition() + ); + } +}; +pp.skipLineComment = function(startSkip) { + var start2 = this.pos; + var startLoc = this.options.onComment && this.curPosition(); + var ch = this.input.charCodeAt(this.pos += startSkip); + while (this.pos < this.input.length && !isNewLine(ch)) { + ch = this.input.charCodeAt(++this.pos); + } + if (this.options.onComment) { + this.options.onComment( + false, + this.input.slice(start2 + startSkip, this.pos), + start2, + this.pos, + startLoc, + this.curPosition() + ); + } +}; +pp.skipSpace = function() { + loop: + while (this.pos < this.input.length) { + var ch = this.input.charCodeAt(this.pos); + switch (ch) { + case 32: + case 160: + ++this.pos; + break; + case 13: + if (this.input.charCodeAt(this.pos + 1) === 10) { + ++this.pos; + } + case 10: + case 8232: + case 8233: + ++this.pos; + if (this.options.locations) { + ++this.curLine; + this.lineStart = this.pos; + } + break; + case 47: + switch (this.input.charCodeAt(this.pos + 1)) { + case 42: + this.skipBlockComment(); + break; + case 47: + this.skipLineComment(2); + break; + default: + break loop; + } + break; + default: + if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { + ++this.pos; + } else { + break loop; + } + } + } +}; +pp.finishToken = function(type, val) { + this.end = this.pos; + if (this.options.locations) { + this.endLoc = this.curPosition(); + } + var prevType = this.type; + this.type = type; + this.value = val; + this.updateContext(prevType); +}; +pp.readToken_dot = function() { + var next = this.input.charCodeAt(this.pos + 1); + if (next >= 48 && next <= 57) { + return this.readNumber(true); + } + var next2 = this.input.charCodeAt(this.pos + 2); + if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { + this.pos += 3; + return this.finishToken(types$1.ellipsis); + } else { + ++this.pos; + return this.finishToken(types$1.dot); + } +}; +pp.readToken_slash = function() { + var next = this.input.charCodeAt(this.pos + 1); + if (this.exprAllowed) { + ++this.pos; + return this.readRegexp(); + } + if (next === 61) { + return this.finishOp(types$1.assign, 2); + } + return this.finishOp(types$1.slash, 1); +}; +pp.readToken_mult_modulo_exp = function(code2) { + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + var tokentype = code2 === 42 ? types$1.star : types$1.modulo; + if (this.options.ecmaVersion >= 7 && code2 === 42 && next === 42) { + ++size; + tokentype = types$1.starstar; + next = this.input.charCodeAt(this.pos + 2); + } + if (next === 61) { + return this.finishOp(types$1.assign, size + 1); + } + return this.finishOp(tokentype, size); +}; +pp.readToken_pipe_amp = function(code2) { + var next = this.input.charCodeAt(this.pos + 1); + if (next === code2) { + if (this.options.ecmaVersion >= 12) { + var next2 = this.input.charCodeAt(this.pos + 2); + if (next2 === 61) { + return this.finishOp(types$1.assign, 3); + } + } + return this.finishOp(code2 === 124 ? types$1.logicalOR : types$1.logicalAND, 2); + } + if (next === 61) { + return this.finishOp(types$1.assign, 2); + } + return this.finishOp(code2 === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1); +}; +pp.readToken_caret = function() { + var next = this.input.charCodeAt(this.pos + 1); + if (next === 61) { + return this.finishOp(types$1.assign, 2); + } + return this.finishOp(types$1.bitwiseXOR, 1); +}; +pp.readToken_plus_min = function(code2) { + var next = this.input.charCodeAt(this.pos + 1); + if (next === code2) { + if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) { + this.skipLineComment(3); + this.skipSpace(); + return this.nextToken(); + } + return this.finishOp(types$1.incDec, 2); + } + if (next === 61) { + return this.finishOp(types$1.assign, 2); + } + return this.finishOp(types$1.plusMin, 1); +}; +pp.readToken_lt_gt = function(code2) { + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + if (next === code2) { + size = code2 === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(this.pos + size) === 61) { + return this.finishOp(types$1.assign, size + 1); + } + return this.finishOp(types$1.bitShift, size); + } + if (next === 33 && code2 === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) { + this.skipLineComment(4); + this.skipSpace(); + return this.nextToken(); + } + if (next === 61) { + size = 2; + } + return this.finishOp(types$1.relational, size); +}; +pp.readToken_eq_excl = function(code2) { + var next = this.input.charCodeAt(this.pos + 1); + if (next === 61) { + return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2); + } + if (code2 === 61 && next === 62 && this.options.ecmaVersion >= 6) { + this.pos += 2; + return this.finishToken(types$1.arrow); + } + return this.finishOp(code2 === 61 ? types$1.eq : types$1.prefix, 1); +}; +pp.readToken_question = function() { + var ecmaVersion = this.options.ecmaVersion; + if (ecmaVersion >= 11) { + var next = this.input.charCodeAt(this.pos + 1); + if (next === 46) { + var next2 = this.input.charCodeAt(this.pos + 2); + if (next2 < 48 || next2 > 57) { + return this.finishOp(types$1.questionDot, 2); + } + } + if (next === 63) { + if (ecmaVersion >= 12) { + var next2$1 = this.input.charCodeAt(this.pos + 2); + if (next2$1 === 61) { + return this.finishOp(types$1.assign, 3); + } + } + return this.finishOp(types$1.coalesce, 2); + } + } + return this.finishOp(types$1.question, 1); +}; +pp.readToken_numberSign = function() { + var ecmaVersion = this.options.ecmaVersion; + var code2 = 35; + if (ecmaVersion >= 13) { + ++this.pos; + code2 = this.fullCharCodeAtPos(); + if (isIdentifierStart(code2, true) || code2 === 92) { + return this.finishToken(types$1.privateId, this.readWord1()); + } + } + this.raise(this.pos, "Unexpected character '" + codePointToString(code2) + "'"); +}; +pp.getTokenFromCode = function(code2) { + switch (code2) { + case 46: + return this.readToken_dot(); + case 40: + ++this.pos; + return this.finishToken(types$1.parenL); + case 41: + ++this.pos; + return this.finishToken(types$1.parenR); + case 59: + ++this.pos; + return this.finishToken(types$1.semi); + case 44: + ++this.pos; + return this.finishToken(types$1.comma); + case 91: + ++this.pos; + return this.finishToken(types$1.bracketL); + case 93: + ++this.pos; + return this.finishToken(types$1.bracketR); + case 123: + ++this.pos; + return this.finishToken(types$1.braceL); + case 125: + ++this.pos; + return this.finishToken(types$1.braceR); + case 58: + ++this.pos; + return this.finishToken(types$1.colon); + case 96: + if (this.options.ecmaVersion < 6) { + break; + } + ++this.pos; + return this.finishToken(types$1.backQuote); + case 48: + var next = this.input.charCodeAt(this.pos + 1); + if (next === 120 || next === 88) { + return this.readRadixNumber(16); + } + if (this.options.ecmaVersion >= 6) { + if (next === 111 || next === 79) { + return this.readRadixNumber(8); + } + if (next === 98 || next === 66) { + return this.readRadixNumber(2); + } + } + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + return this.readNumber(false); + case 34: + case 39: + return this.readString(code2); + case 47: + return this.readToken_slash(); + case 37: + case 42: + return this.readToken_mult_modulo_exp(code2); + case 124: + case 38: + return this.readToken_pipe_amp(code2); + case 94: + return this.readToken_caret(); + case 43: + case 45: + return this.readToken_plus_min(code2); + case 60: + case 62: + return this.readToken_lt_gt(code2); + case 61: + case 33: + return this.readToken_eq_excl(code2); + case 63: + return this.readToken_question(); + case 126: + return this.finishOp(types$1.prefix, 1); + case 35: + return this.readToken_numberSign(); + } + this.raise(this.pos, "Unexpected character '" + codePointToString(code2) + "'"); +}; +pp.finishOp = function(type, size) { + var str = this.input.slice(this.pos, this.pos + size); + this.pos += size; + return this.finishToken(type, str); +}; +pp.readRegexp = function() { + var escaped, inClass, start2 = this.pos; + for (; ; ) { + if (this.pos >= this.input.length) { + this.raise(start2, "Unterminated regular expression"); + } + var ch = this.input.charAt(this.pos); + if (lineBreak.test(ch)) { + this.raise(start2, "Unterminated regular expression"); + } + if (!escaped) { + if (ch === "[") { + inClass = true; + } else if (ch === "]" && inClass) { + inClass = false; + } else if (ch === "/" && !inClass) { + break; + } + escaped = ch === "\\"; + } else { + escaped = false; + } + ++this.pos; + } + var pattern = this.input.slice(start2, this.pos); + ++this.pos; + var flagsStart = this.pos; + var flags = this.readWord1(); + if (this.containsEsc) { + this.unexpected(flagsStart); + } + var state = this.regexpState || (this.regexpState = new RegExpValidationState(this)); + state.reset(start2, pattern, flags); + this.validateRegExpFlags(state); + this.validateRegExpPattern(state); + var value = null; + try { + value = new RegExp(pattern, flags); + } catch (e) { + } + return this.finishToken(types$1.regexp, { pattern, flags, value }); +}; +pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { + var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0; + var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48; + var start2 = this.pos, total = 0, lastCode = 0; + for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) { + var code2 = this.input.charCodeAt(this.pos), val = void 0; + if (allowSeparators && code2 === 95) { + if (isLegacyOctalNumericLiteral) { + this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); + } + if (lastCode === 95) { + this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); + } + if (i === 0) { + this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); + } + lastCode = code2; + continue; + } + if (code2 >= 97) { + val = code2 - 97 + 10; + } else if (code2 >= 65) { + val = code2 - 65 + 10; + } else if (code2 >= 48 && code2 <= 57) { + val = code2 - 48; + } else { + val = Infinity; + } + if (val >= radix) { + break; + } + lastCode = code2; + total = total * radix + val; + } + if (allowSeparators && lastCode === 95) { + this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); + } + if (this.pos === start2 || len != null && this.pos - start2 !== len) { + return null; + } + return total; +}; +function stringToNumber(str, isLegacyOctalNumericLiteral) { + if (isLegacyOctalNumericLiteral) { + return parseInt(str, 8); + } + return parseFloat(str.replace(/_/g, "")); +} +function stringToBigInt(str) { + if (typeof BigInt !== "function") { + return null; + } + return BigInt(str.replace(/_/g, "")); +} +pp.readRadixNumber = function(radix) { + var start2 = this.pos; + this.pos += 2; + var val = this.readInt(radix); + if (val == null) { + this.raise(this.start + 2, "Expected number in radix " + radix); + } + if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) { + val = stringToBigInt(this.input.slice(start2, this.pos)); + ++this.pos; + } else if (isIdentifierStart(this.fullCharCodeAtPos())) { + this.raise(this.pos, "Identifier directly after number"); + } + return this.finishToken(types$1.num, val); +}; +pp.readNumber = function(startsWithDot) { + var start2 = this.pos; + if (!startsWithDot && this.readInt(10, void 0, true) === null) { + this.raise(start2, "Invalid number"); + } + var octal = this.pos - start2 >= 2 && this.input.charCodeAt(start2) === 48; + if (octal && this.strict) { + this.raise(start2, "Invalid number"); + } + var next = this.input.charCodeAt(this.pos); + if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { + var val$1 = stringToBigInt(this.input.slice(start2, this.pos)); + ++this.pos; + if (isIdentifierStart(this.fullCharCodeAtPos())) { + this.raise(this.pos, "Identifier directly after number"); + } + return this.finishToken(types$1.num, val$1); + } + if (octal && /[89]/.test(this.input.slice(start2, this.pos))) { + octal = false; + } + if (next === 46 && !octal) { + ++this.pos; + this.readInt(10); + next = this.input.charCodeAt(this.pos); + } + if ((next === 69 || next === 101) && !octal) { + next = this.input.charCodeAt(++this.pos); + if (next === 43 || next === 45) { + ++this.pos; + } + if (this.readInt(10) === null) { + this.raise(start2, "Invalid number"); + } + } + if (isIdentifierStart(this.fullCharCodeAtPos())) { + this.raise(this.pos, "Identifier directly after number"); + } + var val = stringToNumber(this.input.slice(start2, this.pos), octal); + return this.finishToken(types$1.num, val); +}; +pp.readCodePoint = function() { + var ch = this.input.charCodeAt(this.pos), code2; + if (ch === 123) { + if (this.options.ecmaVersion < 6) { + this.unexpected(); + } + var codePos = ++this.pos; + code2 = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos); + ++this.pos; + if (code2 > 1114111) { + this.invalidStringToken(codePos, "Code point out of bounds"); + } + } else { + code2 = this.readHexChar(4); + } + return code2; +}; +pp.readString = function(quote) { + var out = "", chunkStart = ++this.pos; + for (; ; ) { + if (this.pos >= this.input.length) { + this.raise(this.start, "Unterminated string constant"); + } + var ch = this.input.charCodeAt(this.pos); + if (ch === quote) { + break; + } + if (ch === 92) { + out += this.input.slice(chunkStart, this.pos); + out += this.readEscapedChar(false); + chunkStart = this.pos; + } else if (ch === 8232 || ch === 8233) { + if (this.options.ecmaVersion < 10) { + this.raise(this.start, "Unterminated string constant"); + } + ++this.pos; + if (this.options.locations) { + this.curLine++; + this.lineStart = this.pos; + } + } else { + if (isNewLine(ch)) { + this.raise(this.start, "Unterminated string constant"); + } + ++this.pos; + } + } + out += this.input.slice(chunkStart, this.pos++); + return this.finishToken(types$1.string, out); +}; +var INVALID_TEMPLATE_ESCAPE_ERROR = {}; +pp.tryReadTemplateToken = function() { + this.inTemplateElement = true; + try { + this.readTmplToken(); + } catch (err) { + if (err === INVALID_TEMPLATE_ESCAPE_ERROR) { + this.readInvalidTemplateToken(); + } else { + throw err; + } + } + this.inTemplateElement = false; +}; +pp.invalidStringToken = function(position3, message) { + if (this.inTemplateElement && this.options.ecmaVersion >= 9) { + throw INVALID_TEMPLATE_ESCAPE_ERROR; + } else { + this.raise(position3, message); + } +}; +pp.readTmplToken = function() { + var out = "", chunkStart = this.pos; + for (; ; ) { + if (this.pos >= this.input.length) { + this.raise(this.start, "Unterminated template"); + } + var ch = this.input.charCodeAt(this.pos); + if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { + if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) { + if (ch === 36) { + this.pos += 2; + return this.finishToken(types$1.dollarBraceL); + } else { + ++this.pos; + return this.finishToken(types$1.backQuote); + } + } + out += this.input.slice(chunkStart, this.pos); + return this.finishToken(types$1.template, out); + } + if (ch === 92) { + out += this.input.slice(chunkStart, this.pos); + out += this.readEscapedChar(true); + chunkStart = this.pos; + } else if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.pos); + ++this.pos; + switch (ch) { + case 13: + if (this.input.charCodeAt(this.pos) === 10) { + ++this.pos; + } + case 10: + out += "\n"; + break; + default: + out += String.fromCharCode(ch); + break; + } + if (this.options.locations) { + ++this.curLine; + this.lineStart = this.pos; + } + chunkStart = this.pos; + } else { + ++this.pos; + } + } +}; +pp.readInvalidTemplateToken = function() { + for (; this.pos < this.input.length; this.pos++) { + switch (this.input[this.pos]) { + case "\\": + ++this.pos; + break; + case "$": + if (this.input[this.pos + 1] !== "{") { + break; + } + case "`": + return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos)); + } + } + this.raise(this.start, "Unterminated template"); +}; +pp.readEscapedChar = function(inTemplate) { + var ch = this.input.charCodeAt(++this.pos); + ++this.pos; + switch (ch) { + case 110: + return "\n"; + case 114: + return "\r"; + case 120: + return String.fromCharCode(this.readHexChar(2)); + case 117: + return codePointToString(this.readCodePoint()); + case 116: + return " "; + case 98: + return "\b"; + case 118: + return "\v"; + case 102: + return "\f"; + case 13: + if (this.input.charCodeAt(this.pos) === 10) { + ++this.pos; + } + case 10: + if (this.options.locations) { + this.lineStart = this.pos; + ++this.curLine; + } + return ""; + case 56: + case 57: + if (this.strict) { + this.invalidStringToken( + this.pos - 1, + "Invalid escape sequence" + ); + } + if (inTemplate) { + var codePos = this.pos - 1; + this.invalidStringToken( + codePos, + "Invalid escape sequence in template string" + ); + } + default: + if (ch >= 48 && ch <= 55) { + var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0]; + var octal = parseInt(octalStr, 8); + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } + this.pos += octalStr.length - 1; + ch = this.input.charCodeAt(this.pos); + if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) { + this.invalidStringToken( + this.pos - 1 - octalStr.length, + inTemplate ? "Octal literal in template string" : "Octal literal in strict mode" + ); + } + return String.fromCharCode(octal); + } + if (isNewLine(ch)) { + return ""; + } + return String.fromCharCode(ch); + } +}; +pp.readHexChar = function(len) { + var codePos = this.pos; + var n = this.readInt(16, len); + if (n === null) { + this.invalidStringToken(codePos, "Bad character escape sequence"); + } + return n; +}; +pp.readWord1 = function() { + this.containsEsc = false; + var word = "", first = true, chunkStart = this.pos; + var astral = this.options.ecmaVersion >= 6; + while (this.pos < this.input.length) { + var ch = this.fullCharCodeAtPos(); + if (isIdentifierChar(ch, astral)) { + this.pos += ch <= 65535 ? 1 : 2; + } else if (ch === 92) { + this.containsEsc = true; + word += this.input.slice(chunkStart, this.pos); + var escStart = this.pos; + if (this.input.charCodeAt(++this.pos) !== 117) { + this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); + } + ++this.pos; + var esc = this.readCodePoint(); + if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) { + this.invalidStringToken(escStart, "Invalid Unicode escape"); + } + word += codePointToString(esc); + chunkStart = this.pos; + } else { + break; + } + first = false; + } + return word + this.input.slice(chunkStart, this.pos); +}; +pp.readWord = function() { + var word = this.readWord1(); + var type = types$1.name; + if (this.keywords.test(word)) { + type = keywords[word]; + } + return this.finishToken(type, word); +}; +var version = "8.10.0"; +Parser.acorn = { + Parser, + version, + defaultOptions, + Position, + SourceLocation, + getLineInfo, + Node, + TokenType, + tokTypes: types$1, + keywordTypes: keywords, + TokContext, + tokContexts: types, + isIdentifierChar, + isIdentifierStart, + Token, + isNewLine, + lineBreak, + lineBreakG, + nonASCIIwhitespace +}; + +// node_modules/micromark-extension-mdxjs/index.js +var import_acorn_jsx = __toESM(require_acorn_jsx(), 1); + +// node_modules/micromark-util-character/index.js +var unicodePunctuationInternal = regexCheck(/\p{P}/u); +var asciiAlpha = regexCheck(/[A-Za-z]/); +var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); +var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); +function asciiControl(code2) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code2 !== null && (code2 < 32 || code2 === 127) + ); +} +var asciiDigit = regexCheck(/\d/); +var asciiHexDigit = regexCheck(/[\dA-Fa-f]/); +var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); +function markdownLineEnding(code2) { + return code2 !== null && code2 < -2; +} +function markdownLineEndingOrSpace(code2) { + return code2 !== null && (code2 < 0 || code2 === 32); +} +function markdownSpace(code2) { + return code2 === -2 || code2 === -1 || code2 === 32; +} +function unicodePunctuation(code2) { + return asciiPunctuation(code2) || unicodePunctuationInternal(code2); +} +var unicodeWhitespace = regexCheck(/\s/); +function regexCheck(regex2) { + return check; + function check(code2) { + return code2 !== null && code2 > -1 && regex2.test(String.fromCharCode(code2)); + } +} + +// node_modules/estree-util-visit/lib/color.node.js +function color(d) { + return "\x1B[33m" + d + "\x1B[39m"; +} + +// node_modules/estree-util-visit/lib/index.js +var own2 = {}.hasOwnProperty; +var CONTINUE = Symbol("continue"); +var EXIT = Symbol("exit"); +var SKIP = Symbol("skip"); +function visit(tree, visitor) { + let enter; + let leave; + if (typeof visitor === "function") { + enter = visitor; + } else if (visitor && typeof visitor === "object") { + if (visitor.enter) + enter = visitor.enter; + if (visitor.leave) + leave = visitor.leave; + } + build(tree, void 0, void 0, [])(); + function build(node2, key, index2, parents) { + if (nodelike(node2)) { + visit3.displayName = "node (" + color(node2.type) + ")"; + } + return visit3; + function visit3() { + const result = enter ? toResult(enter(node2, key, index2, parents)) : []; + if (result[0] === EXIT) { + return result; + } + if (result[0] !== SKIP) { + let cKey; + for (cKey in node2) { + if (own2.call(node2, cKey) && node2[cKey] && typeof node2[cKey] === "object" && // @ts-expect-error: custom esast extension. + cKey !== "data" && // @ts-expect-error: custom esast extension. + cKey !== "position") { + const grandparents = parents.concat(node2); + const value = node2[cKey]; + if (Array.isArray(value)) { + const nodes = ( + /** @type {Array} */ + value + ); + let cIndex = 0; + while (cIndex > -1 && cIndex < nodes.length) { + const subvalue = nodes[cIndex]; + if (nodelike(subvalue)) { + const subresult = build( + subvalue, + cKey, + cIndex, + grandparents + )(); + if (subresult[0] === EXIT) + return subresult; + cIndex = typeof subresult[1] === "number" ? subresult[1] : cIndex + 1; + } else { + cIndex++; + } + } + } else if (nodelike(value)) { + const subresult = build(value, cKey, void 0, grandparents)(); + if (subresult[0] === EXIT) + return subresult; + } + } + } + } + return leave ? toResult(leave(node2, key, index2, parents)) : result; + } + } +} +function toResult(value) { + if (Array.isArray(value)) { + return value; + } + if (typeof value === "number") { + return [CONTINUE, value]; + } + return [value]; +} +function nodelike(value) { + return Boolean( + value && typeof value === "object" && "type" in value && typeof value.type === "string" && value.type.length > 0 + ); +} + +// node_modules/micromark-util-events-to-acorn/index.js +function eventsToAcorn(events, options) { + const prefix = options.prefix || ""; + const suffix = options.suffix || ""; + const acornOptions = Object.assign({}, options.acornOptions); + const comments = []; + const tokens = []; + const onComment = acornOptions.onComment; + const onToken = acornOptions.onToken; + let swallow = false; + let estree; + let exception; + const acornConfig = Object.assign({}, acornOptions, { + onComment: comments, + preserveParens: true + }); + if (onToken) { + acornConfig.onToken = tokens; + } + const collection = collect(events, options.tokenTypes); + const source = collection.value; + const value = prefix + source + suffix; + const isEmptyExpression = options.expression && empty2(source); + if (isEmptyExpression && !options.allowEmpty) { + throw new VFileMessage("Unexpected empty expression", { + place: parseOffsetToUnistPoint(0), + ruleId: "unexpected-empty-expression", + source: "micromark-extension-mdx-expression" + }); + } + try { + estree = options.expression && !isEmptyExpression ? options.acorn.parseExpressionAt(value, 0, acornConfig) : options.acorn.parse(value, acornConfig); + } catch (error_) { + const error = ( + /** @type {AcornError} */ + error_ + ); + const point4 = parseOffsetToUnistPoint(error.pos); + error.message = String(error.message).replace(/ \(\d+:\d+\)$/, ""); + error.pos = point4.offset; + error.loc = { + line: point4.line, + column: point4.column - 1 + }; + exception = error; + swallow = error.raisedAt >= prefix.length + source.length || // Broken comments are raised at their start, not their end. + error.message === "Unterminated comment"; + } + if (estree && options.expression && !isEmptyExpression) { + if (empty2(value.slice(estree.end, value.length - suffix.length))) { + estree = { + type: "Program", + start: 0, + end: prefix.length + source.length, + // @ts-expect-error: It’s good. + body: [{ + type: "ExpressionStatement", + expression: estree, + start: 0, + end: prefix.length + source.length + }], + sourceType: "module", + comments: [] + }; + } else { + const point4 = parseOffsetToUnistPoint(estree.end); + const error = ( + /** @type {AcornError} */ + new Error("Unexpected content after expression") + ); + error.pos = point4.offset; + error.loc = { + line: point4.line, + column: point4.column - 1 + }; + exception = error; + estree = void 0; + } + } + if (estree) { + estree.comments = comments; + visit(estree, function(esnode, field, index2, parents) { + let context = ( + /** @type {AcornNode | Array} */ + parents[parents.length - 1] + ); + let prop = field; + if (esnode.type === "ParenthesizedExpression" && context && prop) { + if (typeof index2 === "number") { + context = context[prop]; + prop = index2; + } + context[prop] = esnode.expression; + } + fixPosition(esnode); + }); + if (Array.isArray(onComment)) { + onComment.push(...comments); + } else if (typeof onComment === "function") { + for (const comment2 of comments) { + onComment(comment2.type === "Block", comment2.value, comment2.start, comment2.end, comment2.loc.start, comment2.loc.end); + } + } + for (const token of tokens) { + if (token.end <= prefix.length || token.start - prefix.length >= source.length) { + continue; + } + fixPosition(token); + if (Array.isArray(onToken)) { + onToken.push(token); + } else { + onToken(token); + } + } + } + return { + estree, + error: exception, + swallow + }; + function fixPosition(nodeOrToken) { + const pointStart2 = parseOffsetToUnistPoint(nodeOrToken.start); + const pointEnd2 = parseOffsetToUnistPoint(nodeOrToken.end); + nodeOrToken.start = pointStart2.offset; + nodeOrToken.end = pointEnd2.offset; + nodeOrToken.loc = { + start: { + line: pointStart2.line, + column: pointStart2.column - 1, + offset: pointStart2.offset + }, + end: { + line: pointEnd2.line, + column: pointEnd2.column - 1, + offset: pointEnd2.offset + } + }; + nodeOrToken.range = [nodeOrToken.start, nodeOrToken.end]; + } + function parseOffsetToUnistPoint(acornOffset) { + let sourceOffset = acornOffset - prefix.length; + if (sourceOffset < 0) { + sourceOffset = 0; + } else if (sourceOffset > source.length) { + sourceOffset = source.length; + } + let point4 = relativeToPoint(collection.stops, sourceOffset); + if (!point4) { + point4 = { + line: options.start.line, + column: options.start.column, + offset: options.start.offset + }; + } + return point4; + } +} +function empty2(value) { + return /^\s*$/.test(value.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g, "")); +} +function collect(events, tokenTypes) { + const result = { + value: "", + stops: [] + }; + let index2 = -1; + while (++index2 < events.length) { + const event = events[index2]; + if (event[0] === "enter") { + const type = event[1].type; + if (type === "lineEnding" || tokenTypes.includes(type)) { + const chunks = event[2].sliceStream(event[1]); + while (chunks.length > 0 && chunks[0] === -1) { + chunks.shift(); + } + const value = serializeChunks(chunks); + result.stops.push([result.value.length, event[1].start]); + result.value += value; + result.stops.push([result.value.length, event[1].end]); + } + } + } + return result; +} +function relativeToPoint(stops, relative) { + let index2 = 0; + while (index2 < stops.length && stops[index2][0] <= relative) { + index2 += 1; + } + if (index2 === 0) { + return void 0; + } + const [stopRelative, stopAbsolute] = stops[index2 - 1]; + const rest = relative - stopRelative; + return { + line: stopAbsolute.line, + column: stopAbsolute.column + rest, + offset: stopAbsolute.offset + rest + }; +} +function serializeChunks(chunks) { + let index2 = -1; + const result = []; + let atTab; + while (++index2 < chunks.length) { + const chunk = chunks[index2]; + let value; + if (typeof chunk === "string") { + value = chunk; + } else + switch (chunk) { + case -5: { + value = "\r"; + break; + } + case -4: { + value = "\n"; + break; + } + case -3: { + value = "\r\n"; + break; + } + case -2: { + value = " "; + break; + } + case -1: { + if (atTab) + continue; + value = " "; + break; + } + default: { + value = String.fromCharCode(chunk); + } + } + atTab = chunk === -2; + result.push(value); + } + return result.join(""); +} + +// node_modules/unist-util-position-from-estree/lib/index.js +function positionFromEstree(node2) { + const nodeLike = node2 || {}; + const loc = nodeLike.loc || {}; + const range = nodeLike.range || [void 0, void 0]; + const start2 = pointOrUndefined(loc.start, range[0] || nodeLike.start); + const end = pointOrUndefined(loc.end, range[1] || nodeLike.end); + if (start2 && end) { + return { start: start2, end }; + } +} +function pointOrUndefined(estreePoint, estreeOffset) { + if (estreePoint && typeof estreePoint === "object") { + const line = "line" in estreePoint ? numberOrUndefined(estreePoint.line) : void 0; + const column = "column" in estreePoint ? numberOrUndefined(estreePoint.column) : void 0; + if (line && column !== void 0) { + return { + line, + column: column + 1, + offset: numberOrUndefined(estreeOffset) + }; + } + } +} +function numberOrUndefined(value) { + return typeof value === "number" && value > -1 ? value : void 0; } -// node_modules/micromark-core-commonmark/lib/character-reference.js -var characterReference = { - name: "characterReference", - tokenize: tokenizeCharacterReference -}; -function tokenizeCharacterReference(effects, ok2, nok) { +// node_modules/micromark-factory-mdx-expression/index.js +var trouble = "https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression"; +var unexpectedEofHash = "#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-"; +var unexpectedLazyHash = "#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed"; +var nonSpreadHash = "#unexpected-type-in-code-expected-an-object-spread-spread"; +var spreadExtraHash = "#unexpected-extra-content-in-spread-only-a-single-spread-is-supported"; +var acornHash = "#could-not-parse-expression-with-acorn"; +function factoryMdxExpression(effects, ok3, type, markerType, chunkType, acorn, acornOptions, addResult, spread, allowEmpty, allowLazy) { const self2 = this; + const eventStart = this.events.length + 3; let size = 0; - let max; - let test; - return start3; - function start3(code2) { - effects.enter("characterReference"); - effects.enter("characterReferenceMarker"); + let pointStart2; + let lastCrash; + return start2; + function start2(code2) { + effects.enter(type); + effects.enter(markerType); effects.consume(code2); - effects.exit("characterReferenceMarker"); - return open; + effects.exit(markerType); + pointStart2 = self2.now(); + return before; + } + function before(code2) { + if (code2 === null) { + if (lastCrash) + throw lastCrash; + const error = new VFileMessage( + "Unexpected end of file in expression, expected a corresponding closing brace for `{`", + { + place: self2.now(), + ruleId: "unexpected-eof", + source: "micromark-extension-mdx-expression" + } + ); + error.url = trouble + unexpectedEofHash; + throw error; + } + if (markdownLineEnding(code2)) { + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return eolAfter; + } + if (code2 === 125 && size === 0) { + const next = acorn ? mdxExpressionParse.call( + self2, + acorn, + acornOptions, + chunkType, + eventStart, + pointStart2, + allowEmpty || false, + spread || false + ) : { + type: "ok", + estree: void 0 + }; + if (next.type === "ok") { + effects.enter(markerType); + effects.consume(code2); + effects.exit(markerType); + const token = effects.exit(type); + if (addResult && next.estree) { + Object.assign(token, { + estree: next.estree + }); + } + return ok3; + } + lastCrash = next.message; + effects.enter(chunkType); + effects.consume(code2); + return inside; + } + effects.enter(chunkType); + return inside(code2); + } + function inside(code2) { + if (code2 === 125 && size === 0 || code2 === null || markdownLineEnding(code2)) { + effects.exit(chunkType); + return before(code2); + } + if (code2 === 123 && !acorn) { + size += 1; + } else if (code2 === 125) { + size -= 1; + } + effects.consume(code2); + return inside; + } + function eolAfter(code2) { + const now = self2.now(); + if (now.line !== pointStart2.line && !allowLazy && self2.parser.lazy[now.line]) { + const error = new VFileMessage( + "Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", + { + place: self2.now(), + ruleId: "unexpected-lazy", + source: "micromark-extension-mdx-expression" + } + ); + error.url = trouble + unexpectedLazyHash; + throw error; + } + return before(code2); + } +} +function mdxExpressionParse(acorn, acornOptions, chunkType, eventStart, pointStart2, allowEmpty, spread) { + const result = eventsToAcorn(this.events.slice(eventStart), { + acorn, + tokenTypes: [chunkType], + acornOptions, + start: pointStart2, + expression: true, + allowEmpty, + prefix: spread ? "({" : "", + suffix: spread ? "})" : "" + }); + const estree = result.estree; + if (spread && estree) { + const head = estree.body[0]; + if (head.type !== "ExpressionStatement" || head.expression.type !== "ObjectExpression") { + const place = positionFromEstree(head); + const error = new VFileMessage( + "Unexpected `" + head.type + "` in code: expected an object spread (`{...spread}`)", + { + place: place.start, + ruleId: "non-spread", + source: "micromark-extension-mdx-expression" + } + ); + error.url = trouble + nonSpreadHash; + throw error; + } + if (head.expression.properties[1]) { + const place = positionFromEstree(head.expression.properties[1]); + const error = new VFileMessage( + "Unexpected extra content in spread: only a single spread is supported", + { + place: place.start, + ruleId: "spread-extra", + source: "micromark-extension-mdx-expression" + } + ); + error.url = trouble + spreadExtraHash; + throw error; + } + if (head.expression.properties[0] && head.expression.properties[0].type !== "SpreadElement") { + const place = positionFromEstree(head.expression.properties[0]); + const error = new VFileMessage( + "Unexpected `" + head.expression.properties[0].type + "` in code: only spread elements are supported", + { + place: place.start, + ruleId: "non-spread", + source: "micromark-extension-mdx-expression" + } + ); + error.url = trouble + nonSpreadHash; + throw error; + } + } + if (result.error) { + const error = new VFileMessage("Could not parse expression with acorn", { + cause: result.error, + place: { + line: result.error.loc.line, + column: result.error.loc.column + 1, + offset: result.error.pos + }, + ruleId: "acorn", + source: "micromark-extension-mdx-expression" + }); + error.url = trouble + acornHash; + return { + type: "nok", + message: error + }; + } + return { + type: "ok", + estree + }; +} + +// node_modules/micromark-factory-space/index.js +function factorySpace(effects, ok3, type, max) { + const limit = max ? max - 1 : Number.POSITIVE_INFINITY; + let size = 0; + return start2; + function start2(code2) { + if (markdownSpace(code2)) { + effects.enter(type); + return prefix(code2); + } + return ok3(code2); + } + function prefix(code2) { + if (markdownSpace(code2) && size++ < limit) { + effects.consume(code2); + return prefix; + } + effects.exit(type); + return ok3(code2); + } +} + +// node_modules/micromark-extension-mdx-expression/lib/syntax.js +function mdxExpression(options) { + const options_ = options || {}; + const addResult = options_.addResult; + const acorn = options_.acorn; + const spread = options_.spread; + let allowEmpty = options_.allowEmpty; + let acornOptions; + if (allowEmpty === null || allowEmpty === void 0) { + allowEmpty = true; + } + if (acorn) { + if (!acorn.parseExpressionAt) { + throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`"); + } + acornOptions = Object.assign({ + ecmaVersion: 2024, + sourceType: "module" + }, options_.acornOptions); + } else if (options_.acornOptions || options_.addResult) { + throw new Error("Expected an `acorn` instance passed in as `options.acorn`"); + } + return { + flow: { + [123]: { + name: "mdxFlowExpression", + tokenize: tokenizeFlowExpression, + concrete: true + } + }, + text: { + [123]: { + name: "mdxTextExpression", + tokenize: tokenizeTextExpression + } + } + }; + function tokenizeFlowExpression(effects, ok3, nok) { + const self2 = this; + return start2; + function start2(code2) { + return before(code2); + } + function before(code2) { + return factoryMdxExpression.call(self2, effects, after, "mdxFlowExpression", "mdxFlowExpressionMarker", "mdxFlowExpressionChunk", acorn, acornOptions, addResult, spread, allowEmpty)(code2); + } + function after(code2) { + return markdownSpace(code2) ? factorySpace(effects, end, "whitespace")(code2) : end(code2); + } + function end(code2) { + const lessThanValue = self2.parser.constructs.flow[60]; + const constructs2 = Array.isArray(lessThanValue) ? lessThanValue : ( + /* c8 ignore next 3 -- always a list when normalized. */ + lessThanValue ? [lessThanValue] : [] + ); + const jsxTag = constructs2.find(function(d) { + return d.name === "mdxJsxFlowTag"; + }); + if (code2 === 60 && jsxTag) { + return effects.attempt(jsxTag, end, nok)(code2); + } + return code2 === null || markdownLineEnding(code2) ? ok3(code2) : nok(code2); + } + } + function tokenizeTextExpression(effects, ok3) { + const self2 = this; + return start2; + function start2(code2) { + return factoryMdxExpression.call(self2, effects, ok3, "mdxTextExpression", "mdxTextExpressionMarker", "mdxTextExpressionChunk", acorn, acornOptions, addResult, spread, allowEmpty, true)(code2); + } + } +} + +// node_modules/estree-util-is-identifier-name/lib/index.js +var startRe = /[$_\p{ID_Start}]/u; +var contRe = /[$_\u{200C}\u{200D}\p{ID_Continue}]/u; +var contReJsx = /[-$_\u{200C}\u{200D}\p{ID_Continue}]/u; +var nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u; +var nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u; +var emptyOptions = {}; +function start(code2) { + return code2 ? startRe.test(String.fromCodePoint(code2)) : false; +} +function cont(code2, options) { + const settings = options || emptyOptions; + const re2 = settings.jsx ? contReJsx : contRe; + return code2 ? re2.test(String.fromCodePoint(code2)) : false; +} +function name(name2, options) { + const settings = options || emptyOptions; + const re2 = settings.jsx ? nameReJsx : nameRe; + return re2.test(name2); +} + +// node_modules/micromark-extension-mdx-jsx/lib/factory-tag.js +var trouble2 = "https://github.com/micromark/micromark-extension-mdx-jsx"; +function factoryTag(effects, ok3, nok, acorn, acornOptions, addResult, allowLazy, tagType, tagMarkerType, tagClosingMarkerType, tagSelfClosingMarker, tagNameType, tagNamePrimaryType, tagNameMemberMarkerType, tagNameMemberType, tagNamePrefixMarkerType, tagNameLocalType, tagExpressionAttributeType, tagExpressionAttributeMarkerType, tagExpressionAttributeValueType, tagAttributeType, tagAttributeNameType, tagAttributeNamePrimaryType, tagAttributeNamePrefixMarkerType, tagAttributeNameLocalType, tagAttributeInitializerMarkerType, tagAttributeValueLiteralType, tagAttributeValueLiteralMarkerType, tagAttributeValueLiteralValueType, tagAttributeValueExpressionType, tagAttributeValueExpressionMarkerType, tagAttributeValueExpressionValueType) { + const self2 = this; + let returnState; + let marker; + return start2; + function start2(code2) { + effects.enter(tagType); + effects.enter(tagMarkerType); + effects.consume(code2); + effects.exit(tagMarkerType); + return startAfter; + } + function startAfter(code2) { + if (markdownLineEndingOrSpace(code2)) { + return nok(code2); + } + returnState = nameBefore; + return esWhitespaceStart(code2); + } + function nameBefore(code2) { + if (code2 === 47) { + effects.enter(tagClosingMarkerType); + effects.consume(code2); + effects.exit(tagClosingMarkerType); + returnState = closingTagNameBefore; + return esWhitespaceStart; + } + if (code2 === 62) { + return tagEnd(code2); + } + if (code2 !== null && code2 >= 0 && start(code2)) { + effects.enter(tagNameType); + effects.enter(tagNamePrimaryType); + effects.consume(code2); + return primaryName; + } + crash(code2, "before name", "a character that can start a name, such as a letter, `$`, or `_`" + (code2 === 33 ? " (note: to create a comment in MDX, use `{/* text */}`)" : "")); + } + function closingTagNameBefore(code2) { + if (code2 === 62) { + return tagEnd(code2); + } + if (code2 !== null && code2 >= 0 && start(code2)) { + effects.enter(tagNameType); + effects.enter(tagNamePrimaryType); + effects.consume(code2); + return primaryName; + } + crash(code2, "before name", "a character that can start a name, such as a letter, `$`, or `_`" + (code2 === 42 || code2 === 47 ? " (note: JS comments in JSX tags are not supported in MDX)" : "")); + } + function primaryName(code2) { + if (code2 !== null && code2 >= 0 && cont(code2, { + jsx: true + })) { + effects.consume(code2); + return primaryName; + } + if (code2 === 46 || code2 === 47 || code2 === 58 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { + effects.exit(tagNamePrimaryType); + returnState = primaryNameAfter; + return esWhitespaceStart(code2); + } + crash(code2, "in name", "a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag" + (code2 === 64 ? " (note: to create a link in MDX, use `[text](url)`)" : "")); + } + function primaryNameAfter(code2) { + if (code2 === 46) { + effects.enter(tagNameMemberMarkerType); + effects.consume(code2); + effects.exit(tagNameMemberMarkerType); + returnState = memberNameBefore; + return esWhitespaceStart; + } + if (code2 === 58) { + effects.enter(tagNamePrefixMarkerType); + effects.consume(code2); + effects.exit(tagNamePrefixMarkerType); + returnState = localNameBefore; + return esWhitespaceStart; + } + if (code2 === 47 || code2 === 62 || code2 === 123 || code2 !== null && code2 >= 0 && start(code2)) { + effects.exit(tagNameType); + return attributeBefore(code2); + } + crash(code2, "after name", "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag"); + } + function memberNameBefore(code2) { + if (code2 !== null && code2 >= 0 && start(code2)) { + effects.enter(tagNameMemberType); + effects.consume(code2); + return memberName; + } + crash(code2, "before member name", "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag"); + } + function memberName(code2) { + if (code2 !== null && code2 >= 0 && cont(code2, { + jsx: true + })) { + effects.consume(code2); + return memberName; + } + if (code2 === 46 || code2 === 47 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { + effects.exit(tagNameMemberType); + returnState = memberNameAfter; + return esWhitespaceStart(code2); + } + crash(code2, "in member name", "a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag" + (code2 === 64 ? " (note: to create a link in MDX, use `[text](url)`)" : "")); } - function open(code2) { - if (code2 === 35) { - effects.enter("characterReferenceMarkerNumeric"); + function memberNameAfter(code2) { + if (code2 === 46) { + effects.enter(tagNameMemberMarkerType); effects.consume(code2); - effects.exit("characterReferenceMarkerNumeric"); - return numeric; + effects.exit(tagNameMemberMarkerType); + returnState = memberNameBefore; + return esWhitespaceStart; } - effects.enter("characterReferenceValue"); - max = 31; - test = asciiAlphanumeric; - return value(code2); + if (code2 === 47 || code2 === 62 || code2 === 123 || code2 !== null && code2 >= 0 && start(code2)) { + effects.exit(tagNameType); + return attributeBefore(code2); + } + crash(code2, "after member name", "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag"); } - function numeric(code2) { - if (code2 === 88 || code2 === 120) { - effects.enter("characterReferenceMarkerHexadecimal"); + function localNameBefore(code2) { + if (code2 !== null && code2 >= 0 && start(code2)) { + effects.enter(tagNameLocalType); effects.consume(code2); - effects.exit("characterReferenceMarkerHexadecimal"); - effects.enter("characterReferenceValue"); - max = 6; - test = asciiHexDigit; - return value; + return localName; } - effects.enter("characterReferenceValue"); - max = 7; - test = asciiDigit; - return value(code2); + crash(code2, "before local name", "a character that can start a name, such as a letter, `$`, or `_`" + (code2 === 43 || code2 !== null && code2 > 46 && code2 < 58 ? " (note: to create a link in MDX, use `[text](url)`)" : "")); } - function value(code2) { - let token; - if (code2 === 59 && size) { - token = effects.exit("characterReferenceValue"); - if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token))) { - return nok(code2); - } - effects.enter("characterReferenceMarker"); + function localName(code2) { + if (code2 !== null && code2 >= 0 && cont(code2, { + jsx: true + })) { effects.consume(code2); - effects.exit("characterReferenceMarker"); - effects.exit("characterReference"); - return ok2; + return localName; } - if (test(code2) && size++ < max) { + if (code2 === 47 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { + effects.exit(tagNameLocalType); + returnState = localNameAfter; + return esWhitespaceStart(code2); + } + crash(code2, "in local name", "a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"); + } + function localNameAfter(code2) { + if (code2 === 47 || code2 === 62 || code2 === 123 || code2 !== null && code2 >= 0 && start(code2)) { + effects.exit(tagNameType); + return attributeBefore(code2); + } + crash(code2, "after local name", "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag"); + } + function attributeBefore(code2) { + if (code2 === 47) { + effects.enter(tagSelfClosingMarker); effects.consume(code2); - return value; + effects.exit(tagSelfClosingMarker); + returnState = selfClosing; + return esWhitespaceStart; } - return nok(code2); + if (code2 === 62) { + return tagEnd(code2); + } + if (code2 === 123) { + return factoryMdxExpression.call(self2, effects, attributeExpressionAfter, tagExpressionAttributeType, tagExpressionAttributeMarkerType, tagExpressionAttributeValueType, acorn, acornOptions, addResult, true, false, allowLazy)(code2); + } + if (code2 !== null && code2 >= 0 && start(code2)) { + effects.enter(tagAttributeType); + effects.enter(tagAttributeNameType); + effects.enter(tagAttributeNamePrimaryType); + effects.consume(code2); + return attributePrimaryName; + } + crash(code2, "before attribute name", "a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag"); } -} - -// node_modules/micromark-core-commonmark/lib/code-fenced.js -var codeFenced = { - name: "codeFenced", - tokenize: tokenizeCodeFenced, - concrete: true -}; -function tokenizeCodeFenced(effects, ok2, nok) { - const self2 = this; - const closingFenceConstruct = { - tokenize: tokenizeClosingFence, - partial: true - }; - const nonLazyLine = { - tokenize: tokenizeNonLazyLine, - partial: true - }; - const tail = this.events[this.events.length - 1]; - const initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; - let sizeOpen = 0; - let marker; - return start3; - function start3(code2) { - effects.enter("codeFenced"); - effects.enter("codeFencedFence"); - effects.enter("codeFencedFenceSequence"); - marker = code2; - return sequenceOpen(code2); + function attributeExpressionAfter(code2) { + returnState = attributeBefore; + return esWhitespaceStart(code2); } - function sequenceOpen(code2) { - if (code2 === marker) { + function attributePrimaryName(code2) { + if (code2 !== null && code2 >= 0 && cont(code2, { + jsx: true + })) { effects.consume(code2); - sizeOpen++; - return sequenceOpen; + return attributePrimaryName; } - effects.exit("codeFencedFenceSequence"); - return sizeOpen < 3 ? nok(code2) : factorySpace(effects, infoOpen, "whitespace")(code2); + if (code2 === 47 || code2 === 58 || code2 === 61 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { + effects.exit(tagAttributeNamePrimaryType); + returnState = attributePrimaryNameAfter; + return esWhitespaceStart(code2); + } + crash(code2, "in attribute name", "an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag"); } - function infoOpen(code2) { - if (code2 === null || markdownLineEnding(code2)) { - return openAfter(code2); + function attributePrimaryNameAfter(code2) { + if (code2 === 58) { + effects.enter(tagAttributeNamePrefixMarkerType); + effects.consume(code2); + effects.exit(tagAttributeNamePrefixMarkerType); + returnState = attributeLocalNameBefore; + return esWhitespaceStart; } - effects.enter("codeFencedFenceInfo"); - effects.enter("chunkString", { - contentType: "string" - }); - return info(code2); + if (code2 === 61) { + effects.exit(tagAttributeNameType); + effects.enter(tagAttributeInitializerMarkerType); + effects.consume(code2); + effects.exit(tagAttributeInitializerMarkerType); + returnState = attributeValueBefore; + return esWhitespaceStart; + } + if (code2 === 47 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || code2 !== null && code2 >= 0 && start(code2)) { + effects.exit(tagAttributeNameType); + effects.exit(tagAttributeType); + returnState = attributeBefore; + return esWhitespaceStart(code2); + } + crash(code2, "after attribute name", "a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag"); } - function info(code2) { - if (code2 === null || markdownLineEndingOrSpace(code2)) { - effects.exit("chunkString"); - effects.exit("codeFencedFenceInfo"); - return factorySpace(effects, infoAfter, "whitespace")(code2); + function attributeLocalNameBefore(code2) { + if (code2 !== null && code2 >= 0 && start(code2)) { + effects.enter(tagAttributeNameLocalType); + effects.consume(code2); + return attributeLocalName; } - if (code2 === 96 && code2 === marker) - return nok(code2); - effects.consume(code2); - return info; + crash(code2, "before local attribute name", "a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag"); } - function infoAfter(code2) { - if (code2 === null || markdownLineEnding(code2)) { - return openAfter(code2); + function attributeLocalName(code2) { + if (code2 !== null && code2 >= 0 && cont(code2, { + jsx: true + })) { + effects.consume(code2); + return attributeLocalName; } - effects.enter("codeFencedFenceMeta"); - effects.enter("chunkString", { - contentType: "string" - }); - return meta(code2); + if (code2 === 47 || code2 === 61 || code2 === 62 || code2 === 123 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { + effects.exit(tagAttributeNameLocalType); + effects.exit(tagAttributeNameType); + returnState = attributeLocalNameAfter; + return esWhitespaceStart(code2); + } + crash(code2, "in local attribute name", "an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag"); } - function meta(code2) { - if (code2 === null || markdownLineEnding(code2)) { - effects.exit("chunkString"); - effects.exit("codeFencedFenceMeta"); - return openAfter(code2); + function attributeLocalNameAfter(code2) { + if (code2 === 61) { + effects.enter(tagAttributeInitializerMarkerType); + effects.consume(code2); + effects.exit(tagAttributeInitializerMarkerType); + returnState = attributeValueBefore; + return esWhitespaceStart; } - if (code2 === 96 && code2 === marker) - return nok(code2); - effects.consume(code2); - return meta; + if (code2 === 47 || code2 === 62 || code2 === 123 || code2 !== null && code2 >= 0 && start(code2)) { + effects.exit(tagAttributeType); + return attributeBefore(code2); + } + crash(code2, "after local attribute name", "a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag"); + } + function attributeValueBefore(code2) { + if (code2 === 34 || code2 === 39) { + effects.enter(tagAttributeValueLiteralType); + effects.enter(tagAttributeValueLiteralMarkerType); + effects.consume(code2); + effects.exit(tagAttributeValueLiteralMarkerType); + marker = code2; + return attributeValueQuotedStart; + } + if (code2 === 123) { + return factoryMdxExpression.call(self2, effects, attributeValueExpressionAfter, tagAttributeValueExpressionType, tagAttributeValueExpressionMarkerType, tagAttributeValueExpressionValueType, acorn, acornOptions, addResult, false, false, allowLazy)(code2); + } + crash(code2, "before attribute value", "a character that can start an attribute value, such as `\"`, `'`, or `{`" + (code2 === 60 ? " (note: to use an element or fragment as a prop value in MDX, use `{}`)" : "")); } - function openAfter(code2) { - effects.exit("codeFencedFence"); - return self2.interrupt ? ok2(code2) : contentStart(code2); + function attributeValueExpressionAfter(code2) { + effects.exit(tagAttributeType); + returnState = attributeBefore; + return esWhitespaceStart(code2); } - function contentStart(code2) { + function attributeValueQuotedStart(code2) { if (code2 === null) { - return after(code2); + crash(code2, "in attribute value", "a corresponding closing quote `" + String.fromCodePoint(marker) + "`"); + } + if (code2 === marker) { + effects.enter(tagAttributeValueLiteralMarkerType); + effects.consume(code2); + effects.exit(tagAttributeValueLiteralMarkerType); + effects.exit(tagAttributeValueLiteralType); + effects.exit(tagAttributeType); + marker = void 0; + returnState = attributeBefore; + return esWhitespaceStart; } if (markdownLineEnding(code2)) { - return effects.attempt( - nonLazyLine, - effects.attempt( - closingFenceConstruct, - after, - initialPrefix ? factorySpace( - effects, - contentStart, - "linePrefix", - initialPrefix + 1 - ) : contentStart - ), - after - )(code2); + returnState = attributeValueQuotedStart; + return esWhitespaceStart(code2); } - effects.enter("codeFlowValue"); - return contentContinue(code2); + effects.enter(tagAttributeValueLiteralValueType); + return attributeValueQuoted(code2); } - function contentContinue(code2) { - if (code2 === null || markdownLineEnding(code2)) { - effects.exit("codeFlowValue"); - return contentStart(code2); + function attributeValueQuoted(code2) { + if (code2 === null || code2 === marker || markdownLineEnding(code2)) { + effects.exit(tagAttributeValueLiteralValueType); + return attributeValueQuotedStart(code2); } effects.consume(code2); - return contentContinue; + return attributeValueQuoted; } - function after(code2) { - effects.exit("codeFenced"); - return ok2(code2); + function selfClosing(code2) { + if (code2 === 62) { + return tagEnd(code2); + } + crash(code2, "after self-closing slash", "`>` to end the tag" + (code2 === 42 || code2 === 47 ? " (note: JS comments in JSX tags are not supported in MDX)" : "")); } - function tokenizeNonLazyLine(effects2, ok3, nok2) { - const self3 = this; - return start4; - function start4(code2) { - effects2.enter("lineEnding"); - effects2.consume(code2); - effects2.exit("lineEnding"); - return lineStart; + function tagEnd(code2) { + effects.enter(tagMarkerType); + effects.consume(code2); + effects.exit(tagMarkerType); + effects.exit(tagType); + return ok3; + } + function esWhitespaceStart(code2) { + if (markdownLineEnding(code2)) { + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return esWhitespaceEolAfter; } - function lineStart(code2) { - return self3.parser.lazy[self3.now().line] ? nok2(code2) : ok3(code2); + if (markdownSpace(code2) || unicodeWhitespace(code2)) { + effects.enter("esWhitespace"); + return esWhitespaceInside(code2); } + return returnState(code2); } - function tokenizeClosingFence(effects2, ok3, nok2) { - let size = 0; - return factorySpace( - effects2, - closingSequenceStart, - "linePrefix", - this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 - ); - function closingSequenceStart(code2) { - effects2.enter("codeFencedFence"); - effects2.enter("codeFencedFenceSequence"); - return closingSequence(code2); + function esWhitespaceInside(code2) { + if (markdownLineEnding(code2)) { + effects.exit("esWhitespace"); + return esWhitespaceStart(code2); + } + if (markdownSpace(code2) || unicodeWhitespace(code2)) { + effects.consume(code2); + return esWhitespaceInside; + } + effects.exit("esWhitespace"); + return returnState(code2); + } + function esWhitespaceEolAfter(code2) { + if (!allowLazy && self2.parser.lazy[self2.now().line]) { + const error = new VFileMessage("Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc", self2.now(), "micromark-extension-mdx-jsx:unexpected-lazy"); + error.url = trouble2 + "#unexpected-lazy-line-in-container-expected-line-to-be"; + throw error; + } + return esWhitespaceStart(code2); + } + function crash(code2, at2, expect) { + const error = new VFileMessage("Unexpected " + (code2 === null ? "end of file" : "character `" + (code2 === 96 ? "` ` `" : String.fromCodePoint(code2)) + "` (" + serializeCharCode(code2) + ")") + " " + at2 + ", expected " + expect, self2.now(), "micromark-extension-mdx-jsx:unexpected-" + (code2 === null ? "eof" : "character")); + error.url = trouble2 + (code2 === null ? "#unexpected-end-of-file-at-expected-expect" : "#unexpected-character-at-expected-expect"); + throw error; + } +} +function serializeCharCode(code2) { + return "U+" + code2.toString(16).toUpperCase().padStart(4, "0"); +} + +// node_modules/micromark-extension-mdx-jsx/lib/jsx-text.js +function jsxText(acorn, options) { + return { + name: "mdxJsxTextTag", + tokenize: tokenizeJsxText + }; + function tokenizeJsxText(effects, ok3, nok) { + return factoryTag.call(this, effects, ok3, nok, acorn, options.acornOptions, options.addResult, true, "mdxJsxTextTag", "mdxJsxTextTagMarker", "mdxJsxTextTagClosingMarker", "mdxJsxTextTagSelfClosingMarker", "mdxJsxTextTagName", "mdxJsxTextTagNamePrimary", "mdxJsxTextTagNameMemberMarker", "mdxJsxTextTagNameMember", "mdxJsxTextTagNamePrefixMarker", "mdxJsxTextTagNameLocal", "mdxJsxTextTagExpressionAttribute", "mdxJsxTextTagExpressionAttributeMarker", "mdxJsxTextTagExpressionAttributeValue", "mdxJsxTextTagAttribute", "mdxJsxTextTagAttributeName", "mdxJsxTextTagAttributeNamePrimary", "mdxJsxTextTagAttributeNamePrefixMarker", "mdxJsxTextTagAttributeNameLocal", "mdxJsxTextTagAttributeInitializerMarker", "mdxJsxTextTagAttributeValueLiteral", "mdxJsxTextTagAttributeValueLiteralMarker", "mdxJsxTextTagAttributeValueLiteralValue", "mdxJsxTextTagAttributeValueExpression", "mdxJsxTextTagAttributeValueExpressionMarker", "mdxJsxTextTagAttributeValueExpressionValue"); + } +} + +// node_modules/micromark-extension-mdx-jsx/lib/jsx-flow.js +function jsxFlow(acorn, options) { + return { + name: "mdxJsxFlowTag", + tokenize: tokenizeJsxFlow, + concrete: true + }; + function tokenizeJsxFlow(effects, ok3, nok) { + const self2 = this; + return start2; + function start2(code2) { + return before(code2); } - function closingSequence(code2) { - if (code2 === marker) { - effects2.consume(code2); - size++; - return closingSequence; - } - if (size < sizeOpen) - return nok2(code2); - effects2.exit("codeFencedFenceSequence"); - return factorySpace(effects2, closingSequenceEnd, "whitespace")(code2); + function before(code2) { + return factoryTag.call(self2, effects, after, nok, acorn, options.acornOptions, options.addResult, false, "mdxJsxFlowTag", "mdxJsxFlowTagMarker", "mdxJsxFlowTagClosingMarker", "mdxJsxFlowTagSelfClosingMarker", "mdxJsxFlowTagName", "mdxJsxFlowTagNamePrimary", "mdxJsxFlowTagNameMemberMarker", "mdxJsxFlowTagNameMember", "mdxJsxFlowTagNamePrefixMarker", "mdxJsxFlowTagNameLocal", "mdxJsxFlowTagExpressionAttribute", "mdxJsxFlowTagExpressionAttributeMarker", "mdxJsxFlowTagExpressionAttributeValue", "mdxJsxFlowTagAttribute", "mdxJsxFlowTagAttributeName", "mdxJsxFlowTagAttributeNamePrimary", "mdxJsxFlowTagAttributeNamePrefixMarker", "mdxJsxFlowTagAttributeNameLocal", "mdxJsxFlowTagAttributeInitializerMarker", "mdxJsxFlowTagAttributeValueLiteral", "mdxJsxFlowTagAttributeValueLiteralMarker", "mdxJsxFlowTagAttributeValueLiteralValue", "mdxJsxFlowTagAttributeValueExpression", "mdxJsxFlowTagAttributeValueExpressionMarker", "mdxJsxFlowTagAttributeValueExpressionValue")(code2); } - function closingSequenceEnd(code2) { - if (code2 === null || markdownLineEnding(code2)) { - effects2.exit("codeFencedFence"); - return ok3(code2); - } - return nok2(code2); + function after(code2) { + return markdownSpace(code2) ? factorySpace(effects, end, "whitespace")(code2) : end(code2); + } + function end(code2) { + const leftBraceValue = self2.parser.constructs.flow[123]; + const constructs2 = Array.isArray(leftBraceValue) ? leftBraceValue : leftBraceValue ? [leftBraceValue] : []; + const expression = constructs2.find((d) => d.name === "mdxFlowExpression"); + return code2 === 60 ? ( + // We can’t just say: fine. Lines of blocks have to be parsed until an eol/eof. + start2(code2) + ) : code2 === 123 && expression ? effects.attempt(expression, end, nok)(code2) : code2 === null || markdownLineEnding(code2) ? ok3(code2) : nok(code2); } } } -// node_modules/micromark-core-commonmark/lib/code-indented.js -var codeIndented = { - name: "codeIndented", - tokenize: tokenizeCodeIndented -}; -var indentedContent = { - tokenize: tokenizeIndentedContent, - partial: true -}; -function tokenizeCodeIndented(effects, ok2, nok) { - const self2 = this; - return start3; - function start3(code2) { - effects.enter("codeIndented"); - return factorySpace(effects, afterStartPrefix, "linePrefix", 4 + 1)(code2); - } - function afterStartPrefix(code2) { - const tail = self2.events[self2.events.length - 1]; - return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? afterPrefix(code2) : nok(code2); - } - function afterPrefix(code2) { - if (code2 === null) { - return after(code2); +// node_modules/micromark-extension-mdx-jsx/lib/syntax.js +function mdxJsx(options) { + const settings = options || {}; + const acorn = settings.acorn; + let acornOptions; + if (acorn) { + if (!acorn.parse || !acorn.parseExpressionAt) { + throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`"); } - if (markdownLineEnding(code2)) { - return effects.attempt(indentedContent, afterPrefix, after)(code2); + acornOptions = Object.assign({ + ecmaVersion: 2024, + sourceType: "module" + }, settings.acornOptions, { + locations: true + }); + } else if (settings.acornOptions || settings.addResult) { + throw new Error("Expected an `acorn` instance passed in as `options.acorn`"); + } + return { + flow: { + [60]: jsxFlow(acorn || void 0, { + acornOptions, + addResult: settings.addResult || void 0 + }) + }, + text: { + [60]: jsxText(acorn || void 0, { + acornOptions, + addResult: settings.addResult || void 0 + }) } - effects.enter("codeFlowValue"); - return content3(code2); + }; +} + +// node_modules/micromark-extension-mdx-md/index.js +function mdxMd() { + return { + disable: { null: ["autolink", "codeIndented", "htmlFlow", "htmlText"] } + }; +} + +// node_modules/micromark-util-chunked/index.js +function splice(list3, start2, remove, items) { + const end = list3.length; + let chunkStart = 0; + let parameters; + if (start2 < 0) { + start2 = -start2 > end ? 0 : end + start2; + } else { + start2 = start2 > end ? end : start2; } - function content3(code2) { - if (code2 === null || markdownLineEnding(code2)) { - effects.exit("codeFlowValue"); - return afterPrefix(code2); + remove = remove > 0 ? remove : 0; + if (items.length < 1e4) { + parameters = Array.from(items); + parameters.unshift(start2, remove); + list3.splice(...parameters); + } else { + if (remove) + list3.splice(start2, remove); + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 1e4); + parameters.unshift(start2, 0); + list3.splice(...parameters); + chunkStart += 1e4; + start2 += 1e4; } - effects.consume(code2); - return content3; } - function after(code2) { - effects.exit("codeIndented"); - return ok2(code2); +} +function push(list3, items) { + if (list3.length > 0) { + splice(list3, list3.length, 0, items); + return list3; } + return items; } -function tokenizeIndentedContent(effects, ok2, nok) { - const self2 = this; - return start3; - function start3(code2) { - if (self2.parser.lazy[self2.now().line]) { - return nok(code2); - } - if (markdownLineEnding(code2)) { - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - return start3; - } - return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code2); + +// node_modules/micromark-util-classify-character/index.js +function classifyCharacter(code2) { + if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) { + return 1; } - function afterPrefix(code2) { - const tail = self2.events[self2.events.length - 1]; - return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok2(code2) : markdownLineEnding(code2) ? start3(code2) : nok(code2); + if (unicodePunctuation(code2)) { + return 2; } } -// node_modules/micromark-core-commonmark/lib/code-text.js -var codeText = { - name: "codeText", - tokenize: tokenizeCodeText, - resolve: resolveCodeText, - previous +// node_modules/micromark-util-resolve-all/index.js +function resolveAll(constructs2, events, context) { + const called = []; + let index2 = -1; + while (++index2 < constructs2.length) { + const resolve = constructs2[index2].resolveAll; + if (resolve && !called.includes(resolve)) { + events = resolve(events, context); + called.push(resolve); + } + } + return events; +} + +// node_modules/micromark-core-commonmark/lib/attention.js +var attention = { + name: "attention", + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention }; -function resolveCodeText(events) { - let tailExitIndex = events.length - 4; - let headEnterIndex = 3; - let index2; - let enter; - if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) { - index2 = headEnterIndex; - while (++index2 < tailExitIndex) { - if (events[index2][1].type === "codeTextData") { - events[headEnterIndex][1].type = "codeTextPadding"; - events[tailExitIndex][1].type = "codeTextPadding"; - headEnterIndex += 2; - tailExitIndex -= 2; - break; +function resolveAllAttention(events, context) { + let index2 = -1; + let open; + let group; + let text5; + let openingSequence; + let closingSequence; + let use; + let nextEvents; + let offset2; + while (++index2 < events.length) { + if (events[index2][0] === "enter" && events[index2][1].type === "attentionSequence" && events[index2][1]._close) { + open = index2; + while (open--) { + if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && // If the markers are the same: + context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index2][1]).charCodeAt(0)) { + if ((events[open][1]._close || events[index2][1]._open) && (events[index2][1].end.offset - events[index2][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index2][1].end.offset - events[index2][1].start.offset) % 3)) { + continue; + } + use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index2][1].end.offset - events[index2][1].start.offset > 1 ? 2 : 1; + const start2 = Object.assign({}, events[open][1].end); + const end = Object.assign({}, events[index2][1].start); + movePoint(start2, -use); + movePoint(end, use); + openingSequence = { + type: use > 1 ? "strongSequence" : "emphasisSequence", + start: start2, + end: Object.assign({}, events[open][1].end) + }; + closingSequence = { + type: use > 1 ? "strongSequence" : "emphasisSequence", + start: Object.assign({}, events[index2][1].start), + end + }; + text5 = { + type: use > 1 ? "strongText" : "emphasisText", + start: Object.assign({}, events[open][1].end), + end: Object.assign({}, events[index2][1].start) + }; + group = { + type: use > 1 ? "strong" : "emphasis", + start: Object.assign({}, openingSequence.start), + end: Object.assign({}, closingSequence.end) + }; + events[open][1].end = Object.assign({}, openingSequence.start); + events[index2][1].start = Object.assign({}, closingSequence.end); + nextEvents = []; + if (events[open][1].end.offset - events[open][1].start.offset) { + nextEvents = push(nextEvents, [ + ["enter", events[open][1], context], + ["exit", events[open][1], context] + ]); + } + nextEvents = push(nextEvents, [ + ["enter", group, context], + ["enter", openingSequence, context], + ["exit", openingSequence, context], + ["enter", text5, context] + ]); + nextEvents = push( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + 1, index2), + context + ) + ); + nextEvents = push(nextEvents, [ + ["exit", text5, context], + ["enter", closingSequence, context], + ["exit", closingSequence, context], + ["exit", group, context] + ]); + if (events[index2][1].end.offset - events[index2][1].start.offset) { + offset2 = 2; + nextEvents = push(nextEvents, [ + ["enter", events[index2][1], context], + ["exit", events[index2][1], context] + ]); + } else { + offset2 = 0; + } + splice(events, open - 1, index2 - open + 3, nextEvents); + index2 = open + nextEvents.length - offset2 - 2; + break; + } } } } - index2 = headEnterIndex - 1; - tailExitIndex++; - while (++index2 <= tailExitIndex) { - if (enter === void 0) { - if (index2 !== tailExitIndex && events[index2][1].type !== "lineEnding") { - enter = index2; - } - } else if (index2 === tailExitIndex || events[index2][1].type === "lineEnding") { - events[enter][1].type = "codeTextData"; - if (index2 !== enter + 2) { - events[enter][1].end = events[index2 - 1][1].end; - events.splice(enter + 2, index2 - enter - 2); - tailExitIndex -= index2 - enter - 2; - index2 = enter + 2; - } - enter = void 0; + index2 = -1; + while (++index2 < events.length) { + if (events[index2][1].type === "attentionSequence") { + events[index2][1].type = "data"; + } + } + return events; +} +function tokenizeAttention(effects, ok3) { + const attentionMarkers2 = this.parser.constructs.attentionMarkers.null; + const previous2 = this.previous; + const before = classifyCharacter(previous2); + let marker; + return start2; + function start2(code2) { + marker = code2; + effects.enter("attentionSequence"); + return inside(code2); + } + function inside(code2) { + if (code2 === marker) { + effects.consume(code2); + return inside; } + const token = effects.exit("attentionSequence"); + const after = classifyCharacter(code2); + const open = !after || after === 2 && before || attentionMarkers2.includes(code2); + const close = !before || before === 2 && after || attentionMarkers2.includes(previous2); + token._open = Boolean(marker === 42 ? open : open && (before || !close)); + token._close = Boolean(marker === 42 ? close : close && (after || !open)); + return ok3(code2); } - return events; } -function previous(code2) { - return code2 !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; +function movePoint(point4, offset2) { + point4.column += offset2; + point4.offset += offset2; + point4._bufferIndex += offset2; } -function tokenizeCodeText(effects, ok2, nok) { - const self2 = this; - let sizeOpen = 0; - let size; - let token; - return start3; - function start3(code2) { - effects.enter("codeText"); - effects.enter("codeTextSequence"); - return openingSequence(code2); + +// node_modules/micromark-core-commonmark/lib/autolink.js +var autolink = { + name: "autolink", + tokenize: tokenizeAutolink +}; +function tokenizeAutolink(effects, ok3, nok) { + let size = 0; + return start2; + function start2(code2) { + effects.enter("autolink"); + effects.enter("autolinkMarker"); + effects.consume(code2); + effects.exit("autolinkMarker"); + effects.enter("autolinkProtocol"); + return open; } - function openingSequence(code2) { - if (code2 === 96) { + function open(code2) { + if (asciiAlpha(code2)) { effects.consume(code2); - sizeOpen++; - return openingSequence; + return schemeOrEmailAtext; } - effects.exit("codeTextSequence"); - return gap(code2); + return emailAtext(code2); } - function gap(code2) { - if (code2 === null) { - return nok(code2); + function schemeOrEmailAtext(code2) { + if (code2 === 43 || code2 === 45 || code2 === 46 || asciiAlphanumeric(code2)) { + size = 1; + return schemeInsideOrEmailAtext(code2); } - if (code2 === 96) { - token = effects.enter("codeTextSequence"); + return emailAtext(code2); + } + function schemeInsideOrEmailAtext(code2) { + if (code2 === 58) { + effects.consume(code2); size = 0; - return closingSequence(code2); + return urlInside; } - if (code2 === 32) { - effects.enter("space"); + if ((code2 === 43 || code2 === 45 || code2 === 46 || asciiAlphanumeric(code2)) && size++ < 32) { effects.consume(code2); - effects.exit("space"); - return gap; + return schemeInsideOrEmailAtext; } - if (markdownLineEnding(code2)) { - effects.enter("lineEnding"); + size = 0; + return emailAtext(code2); + } + function urlInside(code2) { + if (code2 === 62) { + effects.exit("autolinkProtocol"); + effects.enter("autolinkMarker"); effects.consume(code2); - effects.exit("lineEnding"); - return gap; + effects.exit("autolinkMarker"); + effects.exit("autolink"); + return ok3; } - effects.enter("codeTextData"); - return data2(code2); - } - function data2(code2) { - if (code2 === null || code2 === 32 || code2 === 96 || markdownLineEnding(code2)) { - effects.exit("codeTextData"); - return gap(code2); + if (code2 === null || code2 === 32 || code2 === 60 || asciiControl(code2)) { + return nok(code2); } effects.consume(code2); - return data2; + return urlInside; } - function closingSequence(code2) { - if (code2 === 96) { + function emailAtext(code2) { + if (code2 === 64) { effects.consume(code2); - size++; - return closingSequence; - } - if (size === sizeOpen) { - effects.exit("codeTextSequence"); - effects.exit("codeText"); - return ok2(code2); - } - token.type = "codeTextData"; - return data2(code2); - } -} - -// node_modules/micromark-util-subtokenize/index.js -function subtokenize(events) { - const jumps = {}; - let index2 = -1; - let event; - let lineIndex; - let otherIndex; - let otherEvent; - let parameters; - let subevents; - let more; - while (++index2 < events.length) { - while (index2 in jumps) { - index2 = jumps[index2]; - } - event = events[index2]; - if (index2 && event[1].type === "chunkFlow" && events[index2 - 1][1].type === "listItemPrefix") { - subevents = event[1]._tokenizer.events; - otherIndex = 0; - if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") { - otherIndex += 2; - } - if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") { - while (++otherIndex < subevents.length) { - if (subevents[otherIndex][1].type === "content") { - break; - } - if (subevents[otherIndex][1].type === "chunkText") { - subevents[otherIndex][1]._isInFirstContentOfListItem = true; - otherIndex++; - } - } - } - } - if (event[0] === "enter") { - if (event[1].contentType) { - Object.assign(jumps, subcontent(events, index2)); - index2 = jumps[index2]; - more = true; - } - } else if (event[1]._container) { - otherIndex = index2; - lineIndex = void 0; - while (otherIndex--) { - otherEvent = events[otherIndex]; - if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") { - if (otherEvent[0] === "enter") { - if (lineIndex) { - events[lineIndex][1].type = "lineEndingBlank"; - } - otherEvent[1].type = "lineEnding"; - lineIndex = otherIndex; - } - } else { - break; - } - } - if (lineIndex) { - event[1].end = Object.assign({}, events[lineIndex][1].start); - parameters = events.slice(lineIndex, index2); - parameters.unshift(event); - splice(events, lineIndex, index2 - lineIndex + 1, parameters); - } - } - } - return !more; -} -function subcontent(events, eventIndex) { - const token = events[eventIndex][1]; - const context = events[eventIndex][2]; - let startPosition = eventIndex - 1; - const startPositions = []; - const tokenizer2 = token._tokenizer || context.parser[token.contentType](token.start); - const childEvents = tokenizer2.events; - const jumps = []; - const gaps = {}; - let stream; - let previous2; - let index2 = -1; - let current2 = token; - let adjust = 0; - let start3 = 0; - const breaks = [start3]; - while (current2) { - while (events[++startPosition][1] !== current2) { - } - startPositions.push(startPosition); - if (!current2._tokenizer) { - stream = context.sliceStream(current2); - if (!current2.next) { - stream.push(null); - } - if (previous2) { - tokenizer2.defineSkip(current2.start); - } - if (current2._isInFirstContentOfListItem) { - tokenizer2._gfmTasklistFirstContentOfListItem = true; - } - tokenizer2.write(stream); - if (current2._isInFirstContentOfListItem) { - tokenizer2._gfmTasklistFirstContentOfListItem = void 0; - } + return emailAtSignOrDot; } - previous2 = current2; - current2 = current2.next; - } - current2 = token; - while (++index2 < childEvents.length) { - if (childEvents[index2][0] === "exit" && childEvents[index2 - 1][0] === "enter" && childEvents[index2][1].type === childEvents[index2 - 1][1].type && childEvents[index2][1].start.line !== childEvents[index2][1].end.line) { - start3 = index2 + 1; - breaks.push(start3); - current2._tokenizer = void 0; - current2.previous = void 0; - current2 = current2.next; + if (asciiAtext(code2)) { + effects.consume(code2); + return emailAtext; } + return nok(code2); } - tokenizer2.events = []; - if (current2) { - current2._tokenizer = void 0; - current2.previous = void 0; - } else { - breaks.pop(); - } - index2 = breaks.length; - while (index2--) { - const slice2 = childEvents.slice(breaks[index2], breaks[index2 + 1]); - const start4 = startPositions.pop(); - jumps.unshift([start4, start4 + slice2.length - 1]); - splice(events, start4, 2, slice2); - } - index2 = -1; - while (++index2 < jumps.length) { - gaps[adjust + jumps[index2][0]] = adjust + jumps[index2][1]; - adjust += jumps[index2][1] - jumps[index2][0] - 1; - } - return gaps; -} - -// node_modules/micromark-core-commonmark/lib/content.js -var content = { - tokenize: tokenizeContent, - resolve: resolveContent -}; -var continuationConstruct = { - tokenize: tokenizeContinuation, - partial: true -}; -function resolveContent(events) { - subtokenize(events); - return events; -} -function tokenizeContent(effects, ok2) { - let previous2; - return start3; - function start3(code2) { - effects.enter("content"); - previous2 = effects.enter("chunkContent", { - contentType: "content" - }); - return data2(code2); + function emailAtSignOrDot(code2) { + return asciiAlphanumeric(code2) ? emailLabel(code2) : nok(code2); } - function data2(code2) { - if (code2 === null) { - return contentEnd(code2); + function emailLabel(code2) { + if (code2 === 46) { + effects.consume(code2); + size = 0; + return emailAtSignOrDot; } - if (markdownLineEnding(code2)) { - return effects.check( - continuationConstruct, - contentContinue, - contentEnd - )(code2); + if (code2 === 62) { + effects.exit("autolinkProtocol").type = "autolinkEmail"; + effects.enter("autolinkMarker"); + effects.consume(code2); + effects.exit("autolinkMarker"); + effects.exit("autolink"); + return ok3; } - effects.consume(code2); - return data2; - } - function contentEnd(code2) { - effects.exit("chunkContent"); - effects.exit("content"); - return ok2(code2); + return emailValue(code2); } - function contentContinue(code2) { - effects.consume(code2); - effects.exit("chunkContent"); - previous2.next = effects.enter("chunkContent", { - contentType: "content", - previous: previous2 - }); - previous2 = previous2.next; - return data2; + function emailValue(code2) { + if ((code2 === 45 || asciiAlphanumeric(code2)) && size++ < 63) { + const next = code2 === 45 ? emailValue : emailLabel; + effects.consume(code2); + return next; + } + return nok(code2); } } -function tokenizeContinuation(effects, ok2, nok) { - const self2 = this; - return startLookahead; - function startLookahead(code2) { - effects.exit("chunkContent"); - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - return factorySpace(effects, prefixed, "linePrefix"); + +// node_modules/micromark-core-commonmark/lib/blank-line.js +var blankLine = { + tokenize: tokenizeBlankLine, + partial: true +}; +function tokenizeBlankLine(effects, ok3, nok) { + return start2; + function start2(code2) { + return markdownSpace(code2) ? factorySpace(effects, after, "linePrefix")(code2) : after(code2); } - function prefixed(code2) { - if (code2 === null || markdownLineEnding(code2)) { - return nok(code2); - } - const tail = self2.events[self2.events.length - 1]; - if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) { - return ok2(code2); - } - return effects.interrupt(self2.parser.constructs.flow, nok, ok2)(code2); + function after(code2) { + return code2 === null || markdownLineEnding(code2) ? ok3(code2) : nok(code2); } } -// node_modules/micromark-factory-destination/index.js -function factoryDestination(effects, ok2, nok, type, literalType, literalMarkerType, rawType, stringType, max) { - const limit = max || Number.POSITIVE_INFINITY; - let balance = 0; - return start3; - function start3(code2) { - if (code2 === 60) { - effects.enter(type); - effects.enter(literalType); - effects.enter(literalMarkerType); +// node_modules/micromark-core-commonmark/lib/block-quote.js +var blockQuote = { + name: "blockQuote", + tokenize: tokenizeBlockQuoteStart, + continuation: { + tokenize: tokenizeBlockQuoteContinuation + }, + exit +}; +function tokenizeBlockQuoteStart(effects, ok3, nok) { + const self2 = this; + return start2; + function start2(code2) { + if (code2 === 62) { + const state = self2.containerState; + if (!state.open) { + effects.enter("blockQuote", { + _container: true + }); + state.open = true; + } + effects.enter("blockQuotePrefix"); + effects.enter("blockQuoteMarker"); effects.consume(code2); - effects.exit(literalMarkerType); - return destinationEnclosedBefore; - } - if (code2 === null || code2 === 41 || asciiControl(code2)) { - return nok(code2); + effects.exit("blockQuoteMarker"); + return after; } - effects.enter(type); - effects.enter(rawType); - effects.enter(stringType); - effects.enter("chunkString", { - contentType: "string" - }); - return destinationRaw(code2); + return nok(code2); } - function destinationEnclosedBefore(code2) { - if (code2 === 62) { - effects.enter(literalMarkerType); + function after(code2) { + if (markdownSpace(code2)) { + effects.enter("blockQuotePrefixWhitespace"); effects.consume(code2); - effects.exit(literalMarkerType); - effects.exit(literalType); - effects.exit(type); - return ok2; + effects.exit("blockQuotePrefixWhitespace"); + effects.exit("blockQuotePrefix"); + return ok3; } - effects.enter(stringType); - effects.enter("chunkString", { - contentType: "string" - }); - return destinationEnclosed(code2); + effects.exit("blockQuotePrefix"); + return ok3(code2); } - function destinationEnclosed(code2) { - if (code2 === 62) { - effects.exit("chunkString"); - effects.exit(stringType); - return destinationEnclosedBefore(code2); - } - if (code2 === null || code2 === 60 || markdownLineEnding(code2)) { - return nok(code2); +} +function tokenizeBlockQuoteContinuation(effects, ok3, nok) { + const self2 = this; + return contStart; + function contStart(code2) { + if (markdownSpace(code2)) { + return factorySpace( + effects, + contBefore, + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code2); } + return contBefore(code2); + } + function contBefore(code2) { + return effects.attempt(blockQuote, ok3, nok)(code2); + } +} +function exit(effects) { + effects.exit("blockQuote"); +} + +// node_modules/micromark-core-commonmark/lib/character-escape.js +var characterEscape = { + name: "characterEscape", + tokenize: tokenizeCharacterEscape +}; +function tokenizeCharacterEscape(effects, ok3, nok) { + return start2; + function start2(code2) { + effects.enter("characterEscape"); + effects.enter("escapeMarker"); effects.consume(code2); - return code2 === 92 ? destinationEnclosedEscape : destinationEnclosed; + effects.exit("escapeMarker"); + return inside; } - function destinationEnclosedEscape(code2) { - if (code2 === 60 || code2 === 62 || code2 === 92) { + function inside(code2) { + if (asciiPunctuation(code2)) { + effects.enter("characterEscapeValue"); effects.consume(code2); - return destinationEnclosed; + effects.exit("characterEscapeValue"); + effects.exit("characterEscape"); + return ok3; } - return destinationEnclosed(code2); + return nok(code2); } - function destinationRaw(code2) { - if (code2 === 40) { - if (++balance > limit) - return nok(code2); +} + +// node_modules/micromark-core-commonmark/lib/character-reference.js +var characterReference = { + name: "characterReference", + tokenize: tokenizeCharacterReference +}; +function tokenizeCharacterReference(effects, ok3, nok) { + const self2 = this; + let size = 0; + let max; + let test; + return start2; + function start2(code2) { + effects.enter("characterReference"); + effects.enter("characterReferenceMarker"); + effects.consume(code2); + effects.exit("characterReferenceMarker"); + return open; + } + function open(code2) { + if (code2 === 35) { + effects.enter("characterReferenceMarkerNumeric"); effects.consume(code2); - return destinationRaw; + effects.exit("characterReferenceMarkerNumeric"); + return numeric; } - if (code2 === 41) { - if (!balance--) { - effects.exit("chunkString"); - effects.exit(stringType); - effects.exit(rawType); - effects.exit(type); - return ok2(code2); - } + effects.enter("characterReferenceValue"); + max = 31; + test = asciiAlphanumeric; + return value(code2); + } + function numeric(code2) { + if (code2 === 88 || code2 === 120) { + effects.enter("characterReferenceMarkerHexadecimal"); effects.consume(code2); - return destinationRaw; + effects.exit("characterReferenceMarkerHexadecimal"); + effects.enter("characterReferenceValue"); + max = 6; + test = asciiHexDigit; + return value; } - if (code2 === null || markdownLineEndingOrSpace(code2)) { - if (balance) + effects.enter("characterReferenceValue"); + max = 7; + test = asciiDigit; + return value(code2); + } + function value(code2) { + if (code2 === 59 && size) { + const token = effects.exit("characterReferenceValue"); + if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token))) { return nok(code2); - effects.exit("chunkString"); - effects.exit(stringType); - effects.exit(rawType); - effects.exit(type); - return ok2(code2); + } + effects.enter("characterReferenceMarker"); + effects.consume(code2); + effects.exit("characterReferenceMarker"); + effects.exit("characterReference"); + return ok3; } - if (asciiControl(code2)) - return nok(code2); - effects.consume(code2); - return code2 === 92 ? destinationRawEscape : destinationRaw; - } - function destinationRawEscape(code2) { - if (code2 === 40 || code2 === 41 || code2 === 92) { + if (test(code2) && size++ < max) { effects.consume(code2); - return destinationRaw; + return value; } - return destinationRaw(code2); + return nok(code2); } } -// node_modules/micromark-factory-label/index.js -function factoryLabel(effects, ok2, nok, type, markerType, stringType) { +// node_modules/micromark-core-commonmark/lib/code-fenced.js +var nonLazyContinuation = { + tokenize: tokenizeNonLazyContinuation, + partial: true +}; +var codeFenced = { + name: "codeFenced", + tokenize: tokenizeCodeFenced, + concrete: true +}; +function tokenizeCodeFenced(effects, ok3, nok) { const self2 = this; - let size = 0; - let data2; - return start3; - function start3(code2) { - effects.enter(type); - effects.enter(markerType); - effects.consume(code2); - effects.exit(markerType); - effects.enter(stringType); - return atBreak; + const closeStart = { + tokenize: tokenizeCloseStart, + partial: true + }; + let initialPrefix = 0; + let sizeOpen = 0; + let marker; + return start2; + function start2(code2) { + return beforeSequenceOpen(code2); } - function atBreak(code2) { - if (code2 === null || code2 === 91 || code2 === 93 && !data2 || code2 === 94 && !size && "_hiddenFootnoteSupport" in self2.parser.constructs || size > 999) { + function beforeSequenceOpen(code2) { + const tail = self2.events[self2.events.length - 1]; + initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + marker = code2; + effects.enter("codeFenced"); + effects.enter("codeFencedFence"); + effects.enter("codeFencedFenceSequence"); + return sequenceOpen(code2); + } + function sequenceOpen(code2) { + if (code2 === marker) { + sizeOpen++; + effects.consume(code2); + return sequenceOpen; + } + if (sizeOpen < 3) { return nok(code2); } - if (code2 === 93) { - effects.exit(stringType); - effects.enter(markerType); - effects.consume(code2); - effects.exit(markerType); - effects.exit(type); - return ok2; + effects.exit("codeFencedFenceSequence"); + return markdownSpace(code2) ? factorySpace(effects, infoBefore, "whitespace")(code2) : infoBefore(code2); + } + function infoBefore(code2) { + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("codeFencedFence"); + return self2.interrupt ? ok3(code2) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code2); } - if (markdownLineEnding(code2)) { - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - return atBreak; + effects.enter("codeFencedFenceInfo"); + effects.enter("chunkString", { + contentType: "string" + }); + return info(code2); + } + function info(code2) { + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceInfo"); + return infoBefore(code2); + } + if (markdownSpace(code2)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceInfo"); + return factorySpace(effects, metaBefore, "whitespace")(code2); + } + if (code2 === 96 && code2 === marker) { + return nok(code2); + } + effects.consume(code2); + return info; + } + function metaBefore(code2) { + if (code2 === null || markdownLineEnding(code2)) { + return infoBefore(code2); } + effects.enter("codeFencedFenceMeta"); effects.enter("chunkString", { contentType: "string" }); - return label(code2); + return meta(code2); } - function label(code2) { - if (code2 === null || code2 === 91 || code2 === 93 || markdownLineEnding(code2) || size++ > 999) { + function meta(code2) { + if (code2 === null || markdownLineEnding(code2)) { effects.exit("chunkString"); - return atBreak(code2); + effects.exit("codeFencedFenceMeta"); + return infoBefore(code2); + } + if (code2 === 96 && code2 === marker) { + return nok(code2); } effects.consume(code2); - data2 = data2 || !markdownSpace(code2); - return code2 === 92 ? labelEscape : label; + return meta; } - function labelEscape(code2) { - if (code2 === 91 || code2 === 92 || code2 === 93) { - effects.consume(code2); - size++; - return label; - } - return label(code2); + function atNonLazyBreak(code2) { + return effects.attempt(closeStart, after, contentBefore)(code2); } -} - -// node_modules/micromark-factory-title/index.js -function factoryTitle(effects, ok2, nok, type, markerType, stringType) { - let marker; - return start3; - function start3(code2) { - effects.enter(type); - effects.enter(markerType); + function contentBefore(code2) { + effects.enter("lineEnding"); effects.consume(code2); - effects.exit(markerType); - marker = code2 === 40 ? 41 : code2; - return atFirstTitleBreak; + effects.exit("lineEnding"); + return contentStart; } - function atFirstTitleBreak(code2) { - if (code2 === marker) { - effects.enter(markerType); - effects.consume(code2); - effects.exit(markerType); - effects.exit(type); - return ok2; - } - effects.enter(stringType); - return atTitleBreak(code2); + function contentStart(code2) { + return initialPrefix > 0 && markdownSpace(code2) ? factorySpace( + effects, + beforeContentChunk, + "linePrefix", + initialPrefix + 1 + )(code2) : beforeContentChunk(code2); } - function atTitleBreak(code2) { - if (code2 === marker) { - effects.exit(stringType); - return atFirstTitleBreak(marker); - } - if (code2 === null) { - return nok(code2); - } - if (markdownLineEnding(code2)) { - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - return factorySpace(effects, atTitleBreak, "linePrefix"); + function beforeContentChunk(code2) { + if (code2 === null || markdownLineEnding(code2)) { + return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code2); } - effects.enter("chunkString", { - contentType: "string" - }); - return title(code2); + effects.enter("codeFlowValue"); + return contentChunk(code2); } - function title(code2) { - if (code2 === marker || code2 === null || markdownLineEnding(code2)) { - effects.exit("chunkString"); - return atTitleBreak(code2); + function contentChunk(code2) { + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("codeFlowValue"); + return beforeContentChunk(code2); } effects.consume(code2); - return code2 === 92 ? titleEscape : title; + return contentChunk; } - function titleEscape(code2) { - if (code2 === marker || code2 === 92) { - effects.consume(code2); - return title; - } - return title(code2); + function after(code2) { + effects.exit("codeFenced"); + return ok3(code2); } -} - -// node_modules/micromark-factory-whitespace/index.js -function factoryWhitespace(effects, ok2) { - let seen; - return start3; - function start3(code2) { - if (markdownLineEnding(code2)) { - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - seen = true; + function tokenizeCloseStart(effects2, ok4, nok2) { + let size = 0; + return startBefore; + function startBefore(code2) { + effects2.enter("lineEnding"); + effects2.consume(code2); + effects2.exit("lineEnding"); return start3; } - if (markdownSpace(code2)) { - return factorySpace( - effects, - start3, - seen ? "linePrefix" : "lineSuffix" - )(code2); + function start3(code2) { + effects2.enter("codeFencedFence"); + return markdownSpace(code2) ? factorySpace( + effects2, + beforeSequenceClose, + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code2) : beforeSequenceClose(code2); + } + function beforeSequenceClose(code2) { + if (code2 === marker) { + effects2.enter("codeFencedFenceSequence"); + return sequenceClose(code2); + } + return nok2(code2); + } + function sequenceClose(code2) { + if (code2 === marker) { + size++; + effects2.consume(code2); + return sequenceClose; + } + if (size >= sizeOpen) { + effects2.exit("codeFencedFenceSequence"); + return markdownSpace(code2) ? factorySpace(effects2, sequenceCloseAfter, "whitespace")(code2) : sequenceCloseAfter(code2); + } + return nok2(code2); + } + function sequenceCloseAfter(code2) { + if (code2 === null || markdownLineEnding(code2)) { + effects2.exit("codeFencedFence"); + return ok4(code2); + } + return nok2(code2); } - return ok2(code2); } } - -// node_modules/micromark-util-normalize-identifier/index.js -function normalizeIdentifier(value) { - return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase(); +function tokenizeNonLazyContinuation(effects, ok3, nok) { + const self2 = this; + return start2; + function start2(code2) { + if (code2 === null) { + return nok(code2); + } + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return lineStart; + } + function lineStart(code2) { + return self2.parser.lazy[self2.now().line] ? nok(code2) : ok3(code2); + } } -// node_modules/micromark-core-commonmark/lib/definition.js -var definition = { - name: "definition", - tokenize: tokenizeDefinition +// node_modules/micromark-core-commonmark/lib/code-indented.js +var codeIndented = { + name: "codeIndented", + tokenize: tokenizeCodeIndented }; -var titleConstruct = { - tokenize: tokenizeTitle, +var furtherStart = { + tokenize: tokenizeFurtherStart, partial: true }; -function tokenizeDefinition(effects, ok2, nok) { +function tokenizeCodeIndented(effects, ok3, nok) { const self2 = this; - let identifier; - return start3; - function start3(code2) { - effects.enter("definition"); - return factoryLabel.call( - self2, - effects, - labelAfter, - nok, - "definitionLabel", - "definitionLabelMarker", - "definitionLabelString" - )(code2); + return start2; + function start2(code2) { + effects.enter("codeIndented"); + return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code2); } - function labelAfter(code2) { - identifier = normalizeIdentifier( - self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1) - ); - if (code2 === 58) { - effects.enter("definitionMarker"); - effects.consume(code2); - effects.exit("definitionMarker"); - return factoryWhitespace( - effects, - factoryDestination( - effects, - effects.attempt( - titleConstruct, - factorySpace(effects, after, "whitespace"), - factorySpace(effects, after, "whitespace") - ), - nok, - "definitionDestination", - "definitionDestinationLiteral", - "definitionDestinationLiteralMarker", - "definitionDestinationRaw", - "definitionDestinationString" - ) - ); - } - return nok(code2); + function afterPrefix(code2) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code2) : nok(code2); } - function after(code2) { - if (code2 === null || markdownLineEnding(code2)) { - effects.exit("definition"); - if (!self2.parser.defined.includes(identifier)) { - self2.parser.defined.push(identifier); - } - return ok2(code2); + function atBreak(code2) { + if (code2 === null) { + return after(code2); } - return nok(code2); - } -} -function tokenizeTitle(effects, ok2, nok) { - return start3; - function start3(code2) { - return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, before)(code2) : nok(code2); + if (markdownLineEnding(code2)) { + return effects.attempt(furtherStart, atBreak, after)(code2); + } + effects.enter("codeFlowValue"); + return inside(code2); } - function before(code2) { - if (code2 === 34 || code2 === 39 || code2 === 40) { - return factoryTitle( - effects, - factorySpace(effects, after, "whitespace"), - nok, - "definitionTitle", - "definitionTitleMarker", - "definitionTitleString" - )(code2); + function inside(code2) { + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("codeFlowValue"); + return atBreak(code2); } - return nok(code2); + effects.consume(code2); + return inside; } function after(code2) { - return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2); + effects.exit("codeIndented"); + return ok3(code2); } } - -// node_modules/micromark-core-commonmark/lib/hard-break-escape.js -var hardBreakEscape = { - name: "hardBreakEscape", - tokenize: tokenizeHardBreakEscape -}; -function tokenizeHardBreakEscape(effects, ok2, nok) { - return start3; - function start3(code2) { - effects.enter("hardBreakEscape"); - effects.enter("escapeMarker"); - effects.consume(code2); - return open; - } - function open(code2) { +function tokenizeFurtherStart(effects, ok3, nok) { + const self2 = this; + return furtherStart2; + function furtherStart2(code2) { + if (self2.parser.lazy[self2.now().line]) { + return nok(code2); + } if (markdownLineEnding(code2)) { - effects.exit("escapeMarker"); - effects.exit("hardBreakEscape"); - return ok2(code2); + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return furtherStart2; } - return nok(code2); + return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code2); + } + function afterPrefix(code2) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok3(code2) : markdownLineEnding(code2) ? furtherStart2(code2) : nok(code2); } } -// node_modules/micromark-core-commonmark/lib/heading-atx.js -var headingAtx = { - name: "headingAtx", - tokenize: tokenizeHeadingAtx, - resolve: resolveHeadingAtx +// node_modules/micromark-core-commonmark/lib/code-text.js +var codeText = { + name: "codeText", + tokenize: tokenizeCodeText, + resolve: resolveCodeText, + previous }; -function resolveHeadingAtx(events, context) { - let contentEnd = events.length - 2; - let contentStart = 3; - let content3; - let text5; - if (events[contentStart][1].type === "whitespace") { - contentStart += 2; - } - if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") { - contentEnd -= 2; - } - if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) { - contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; - } - if (contentEnd > contentStart) { - content3 = { - type: "atxHeadingText", - start: events[contentStart][1].start, - end: events[contentEnd][1].end - }; - text5 = { - type: "chunkText", - start: events[contentStart][1].start, - end: events[contentEnd][1].end, - contentType: "text" - }; - splice(events, contentStart, contentEnd - contentStart + 1, [ - ["enter", content3, context], - ["enter", text5, context], - ["exit", text5, context], - ["exit", content3, context] - ]); +function resolveCodeText(events) { + let tailExitIndex = events.length - 4; + let headEnterIndex = 3; + let index2; + let enter; + if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) { + index2 = headEnterIndex; + while (++index2 < tailExitIndex) { + if (events[index2][1].type === "codeTextData") { + events[headEnterIndex][1].type = "codeTextPadding"; + events[tailExitIndex][1].type = "codeTextPadding"; + headEnterIndex += 2; + tailExitIndex -= 2; + break; + } + } + } + index2 = headEnterIndex - 1; + tailExitIndex++; + while (++index2 <= tailExitIndex) { + if (enter === void 0) { + if (index2 !== tailExitIndex && events[index2][1].type !== "lineEnding") { + enter = index2; + } + } else if (index2 === tailExitIndex || events[index2][1].type === "lineEnding") { + events[enter][1].type = "codeTextData"; + if (index2 !== enter + 2) { + events[enter][1].end = events[index2 - 1][1].end; + events.splice(enter + 2, index2 - enter - 2); + tailExitIndex -= index2 - enter - 2; + index2 = enter + 2; + } + enter = void 0; + } } return events; } -function tokenizeHeadingAtx(effects, ok2, nok) { +function previous(code2) { + return code2 !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; +} +function tokenizeCodeText(effects, ok3, nok) { const self2 = this; - let size = 0; - return start3; - function start3(code2) { - effects.enter("atxHeading"); - effects.enter("atxHeadingSequence"); - return fenceOpenInside(code2); + let sizeOpen = 0; + let size; + let token; + return start2; + function start2(code2) { + effects.enter("codeText"); + effects.enter("codeTextSequence"); + return sequenceOpen(code2); } - function fenceOpenInside(code2) { - if (code2 === 35 && size++ < 6) { + function sequenceOpen(code2) { + if (code2 === 96) { effects.consume(code2); - return fenceOpenInside; - } - if (code2 === null || markdownLineEndingOrSpace(code2)) { - effects.exit("atxHeadingSequence"); - return self2.interrupt ? ok2(code2) : headingBreak(code2); + sizeOpen++; + return sequenceOpen; } - return nok(code2); + effects.exit("codeTextSequence"); + return between(code2); } - function headingBreak(code2) { - if (code2 === 35) { - effects.enter("atxHeadingSequence"); - return sequence(code2); + function between(code2) { + if (code2 === null) { + return nok(code2); } - if (code2 === null || markdownLineEnding(code2)) { - effects.exit("atxHeading"); - return ok2(code2); + if (code2 === 32) { + effects.enter("space"); + effects.consume(code2); + effects.exit("space"); + return between; } - if (markdownSpace(code2)) { - return factorySpace(effects, headingBreak, "whitespace")(code2); + if (code2 === 96) { + token = effects.enter("codeTextSequence"); + size = 0; + return sequenceClose(code2); } - effects.enter("atxHeadingText"); - return data2(code2); - } - function sequence(code2) { - if (code2 === 35) { + if (markdownLineEnding(code2)) { + effects.enter("lineEnding"); effects.consume(code2); - return sequence; + effects.exit("lineEnding"); + return between; } - effects.exit("atxHeadingSequence"); - return headingBreak(code2); + effects.enter("codeTextData"); + return data2(code2); } function data2(code2) { - if (code2 === null || code2 === 35 || markdownLineEndingOrSpace(code2)) { - effects.exit("atxHeadingText"); - return headingBreak(code2); + if (code2 === null || code2 === 32 || code2 === 96 || markdownLineEnding(code2)) { + effects.exit("codeTextData"); + return between(code2); } effects.consume(code2); return data2; } + function sequenceClose(code2) { + if (code2 === 96) { + effects.consume(code2); + size++; + return sequenceClose; + } + if (size === sizeOpen) { + effects.exit("codeTextSequence"); + effects.exit("codeText"); + return ok3(code2); + } + token.type = "codeTextData"; + return data2(code2); + } } -// node_modules/micromark-util-html-tag-name/index.js -var htmlBlockNames = [ - "address", - "article", - "aside", - "base", - "basefont", - "blockquote", - "body", - "caption", - "center", - "col", - "colgroup", - "dd", - "details", - "dialog", - "dir", - "div", - "dl", - "dt", - "fieldset", - "figcaption", - "figure", - "footer", - "form", - "frame", - "frameset", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hr", - "html", - "iframe", - "legend", - "li", - "link", - "main", - "menu", - "menuitem", - "nav", - "noframes", - "ol", - "optgroup", - "option", - "p", - "param", - "section", - "summary", - "table", - "tbody", - "td", - "tfoot", - "th", - "thead", - "title", - "tr", - "track", - "ul" -]; -var htmlRawNames = ["pre", "script", "style", "textarea"]; +// node_modules/micromark-util-subtokenize/index.js +function subtokenize(events) { + const jumps = {}; + let index2 = -1; + let event; + let lineIndex; + let otherIndex; + let otherEvent; + let parameters; + let subevents; + let more; + while (++index2 < events.length) { + while (index2 in jumps) { + index2 = jumps[index2]; + } + event = events[index2]; + if (index2 && event[1].type === "chunkFlow" && events[index2 - 1][1].type === "listItemPrefix") { + subevents = event[1]._tokenizer.events; + otherIndex = 0; + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") { + otherIndex += 2; + } + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === "content") { + break; + } + if (subevents[otherIndex][1].type === "chunkText") { + subevents[otherIndex][1]._isInFirstContentOfListItem = true; + otherIndex++; + } + } + } + } + if (event[0] === "enter") { + if (event[1].contentType) { + Object.assign(jumps, subcontent(events, index2)); + index2 = jumps[index2]; + more = true; + } + } else if (event[1]._container) { + otherIndex = index2; + lineIndex = void 0; + while (otherIndex--) { + otherEvent = events[otherIndex]; + if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") { + if (otherEvent[0] === "enter") { + if (lineIndex) { + events[lineIndex][1].type = "lineEndingBlank"; + } + otherEvent[1].type = "lineEnding"; + lineIndex = otherIndex; + } + } else { + break; + } + } + if (lineIndex) { + event[1].end = Object.assign({}, events[lineIndex][1].start); + parameters = events.slice(lineIndex, index2); + parameters.unshift(event); + splice(events, lineIndex, index2 - lineIndex + 1, parameters); + } + } + } + return !more; +} +function subcontent(events, eventIndex) { + const token = events[eventIndex][1]; + const context = events[eventIndex][2]; + let startPosition = eventIndex - 1; + const startPositions = []; + const tokenizer2 = token._tokenizer || context.parser[token.contentType](token.start); + const childEvents = tokenizer2.events; + const jumps = []; + const gaps = {}; + let stream; + let previous2; + let index2 = -1; + let current2 = token; + let adjust = 0; + let start2 = 0; + const breaks = [start2]; + while (current2) { + while (events[++startPosition][1] !== current2) { + } + startPositions.push(startPosition); + if (!current2._tokenizer) { + stream = context.sliceStream(current2); + if (!current2.next) { + stream.push(null); + } + if (previous2) { + tokenizer2.defineSkip(current2.start); + } + if (current2._isInFirstContentOfListItem) { + tokenizer2._gfmTasklistFirstContentOfListItem = true; + } + tokenizer2.write(stream); + if (current2._isInFirstContentOfListItem) { + tokenizer2._gfmTasklistFirstContentOfListItem = void 0; + } + } + previous2 = current2; + current2 = current2.next; + } + current2 = token; + while (++index2 < childEvents.length) { + if ( + // Find a void token that includes a break. + childEvents[index2][0] === "exit" && childEvents[index2 - 1][0] === "enter" && childEvents[index2][1].type === childEvents[index2 - 1][1].type && childEvents[index2][1].start.line !== childEvents[index2][1].end.line + ) { + start2 = index2 + 1; + breaks.push(start2); + current2._tokenizer = void 0; + current2.previous = void 0; + current2 = current2.next; + } + } + tokenizer2.events = []; + if (current2) { + current2._tokenizer = void 0; + current2.previous = void 0; + } else { + breaks.pop(); + } + index2 = breaks.length; + while (index2--) { + const slice2 = childEvents.slice(breaks[index2], breaks[index2 + 1]); + const start3 = startPositions.pop(); + jumps.unshift([start3, start3 + slice2.length - 1]); + splice(events, start3, 2, slice2); + } + index2 = -1; + while (++index2 < jumps.length) { + gaps[adjust + jumps[index2][0]] = adjust + jumps[index2][1]; + adjust += jumps[index2][1] - jumps[index2][0] - 1; + } + return gaps; +} -// node_modules/micromark-core-commonmark/lib/html-flow.js -var htmlFlow = { - name: "htmlFlow", - tokenize: tokenizeHtmlFlow, - resolveTo: resolveToHtmlFlow, - concrete: true +// node_modules/micromark-core-commonmark/lib/content.js +var content = { + tokenize: tokenizeContent, + resolve: resolveContent }; -var nextBlankConstruct = { - tokenize: tokenizeNextBlank, +var continuationConstruct = { + tokenize: tokenizeContinuation, partial: true }; -function resolveToHtmlFlow(events) { - let index2 = events.length; - while (index2--) { - if (events[index2][0] === "enter" && events[index2][1].type === "htmlFlow") { - break; +function resolveContent(events) { + subtokenize(events); + return events; +} +function tokenizeContent(effects, ok3) { + let previous2; + return chunkStart; + function chunkStart(code2) { + effects.enter("content"); + previous2 = effects.enter("chunkContent", { + contentType: "content" + }); + return chunkInside(code2); + } + function chunkInside(code2) { + if (code2 === null) { + return contentEnd(code2); + } + if (markdownLineEnding(code2)) { + return effects.check( + continuationConstruct, + contentContinue, + contentEnd + )(code2); } + effects.consume(code2); + return chunkInside; } - if (index2 > 1 && events[index2 - 2][1].type === "linePrefix") { - events[index2][1].start = events[index2 - 2][1].start; - events[index2 + 1][1].start = events[index2 - 2][1].start; - events.splice(index2 - 2, 2); + function contentEnd(code2) { + effects.exit("chunkContent"); + effects.exit("content"); + return ok3(code2); + } + function contentContinue(code2) { + effects.consume(code2); + effects.exit("chunkContent"); + previous2.next = effects.enter("chunkContent", { + contentType: "content", + previous: previous2 + }); + previous2 = previous2.next; + return chunkInside; } - return events; } -function tokenizeHtmlFlow(effects, ok2, nok) { +function tokenizeContinuation(effects, ok3, nok) { const self2 = this; - let kind; - let startTag; - let buffer2; - let index2; - let marker; - return start3; - function start3(code2) { - effects.enter("htmlFlow"); - effects.enter("htmlFlowData"); + return startLookahead; + function startLookahead(code2) { + effects.exit("chunkContent"); + effects.enter("lineEnding"); effects.consume(code2); - return open; - } - function open(code2) { - if (code2 === 33) { - effects.consume(code2); - return declarationStart; - } - if (code2 === 47) { - effects.consume(code2); - return tagCloseStart; - } - if (code2 === 63) { - effects.consume(code2); - kind = 3; - return self2.interrupt ? ok2 : continuationDeclarationInside; - } - if (asciiAlpha(code2)) { - effects.consume(code2); - buffer2 = String.fromCharCode(code2); - startTag = true; - return tagName; - } - return nok(code2); + effects.exit("lineEnding"); + return factorySpace(effects, prefixed, "linePrefix"); } - function declarationStart(code2) { - if (code2 === 45) { - effects.consume(code2); - kind = 2; - return commentOpenInside; - } - if (code2 === 91) { - effects.consume(code2); - kind = 5; - buffer2 = "CDATA["; - index2 = 0; - return cdataOpenInside; + function prefixed(code2) { + if (code2 === null || markdownLineEnding(code2)) { + return nok(code2); } - if (asciiAlpha(code2)) { - effects.consume(code2); - kind = 4; - return self2.interrupt ? ok2 : continuationDeclarationInside; + const tail = self2.events[self2.events.length - 1]; + if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) { + return ok3(code2); } - return nok(code2); + return effects.interrupt(self2.parser.constructs.flow, nok, ok3)(code2); } - function commentOpenInside(code2) { - if (code2 === 45) { +} + +// node_modules/micromark-factory-destination/index.js +function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerType, rawType, stringType, max) { + const limit = max || Number.POSITIVE_INFINITY; + let balance = 0; + return start2; + function start2(code2) { + if (code2 === 60) { + effects.enter(type); + effects.enter(literalType); + effects.enter(literalMarkerType); effects.consume(code2); - return self2.interrupt ? ok2 : continuationDeclarationInside; + effects.exit(literalMarkerType); + return enclosedBefore; } - return nok(code2); - } - function cdataOpenInside(code2) { - if (code2 === buffer2.charCodeAt(index2++)) { - effects.consume(code2); - return index2 === buffer2.length ? self2.interrupt ? ok2 : continuation : cdataOpenInside; + if (code2 === null || code2 === 32 || code2 === 41 || asciiControl(code2)) { + return nok(code2); } - return nok(code2); + effects.enter(type); + effects.enter(rawType); + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return raw(code2); } - function tagCloseStart(code2) { - if (asciiAlpha(code2)) { + function enclosedBefore(code2) { + if (code2 === 62) { + effects.enter(literalMarkerType); effects.consume(code2); - buffer2 = String.fromCharCode(code2); - return tagName; + effects.exit(literalMarkerType); + effects.exit(literalType); + effects.exit(type); + return ok3; } - return nok(code2); + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return enclosed(code2); } - function tagName(code2) { - if (code2 === null || code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) { - if (code2 !== 47 && startTag && htmlRawNames.includes(buffer2.toLowerCase())) { - kind = 1; - return self2.interrupt ? ok2(code2) : continuation(code2); - } - if (htmlBlockNames.includes(buffer2.toLowerCase())) { - kind = 6; - if (code2 === 47) { - effects.consume(code2); - return basicSelfClosing; - } - return self2.interrupt ? ok2(code2) : continuation(code2); - } - kind = 7; - return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code2) : startTag ? completeAttributeNameBefore(code2) : completeClosingTagAfter(code2); + function enclosed(code2) { + if (code2 === 62) { + effects.exit("chunkString"); + effects.exit(stringType); + return enclosedBefore(code2); } - if (code2 === 45 || asciiAlphanumeric(code2)) { - effects.consume(code2); - buffer2 += String.fromCharCode(code2); - return tagName; + if (code2 === null || code2 === 60 || markdownLineEnding(code2)) { + return nok(code2); } - return nok(code2); + effects.consume(code2); + return code2 === 92 ? enclosedEscape : enclosed; } - function basicSelfClosing(code2) { - if (code2 === 62) { + function enclosedEscape(code2) { + if (code2 === 60 || code2 === 62 || code2 === 92) { effects.consume(code2); - return self2.interrupt ? ok2 : continuation; + return enclosed; } - return nok(code2); + return enclosed(code2); } - function completeClosingTagAfter(code2) { - if (markdownSpace(code2)) { - effects.consume(code2); - return completeClosingTagAfter; + function raw(code2) { + if (!balance && (code2 === null || code2 === 41 || markdownLineEndingOrSpace(code2))) { + effects.exit("chunkString"); + effects.exit(stringType); + effects.exit(rawType); + effects.exit(type); + return ok3(code2); } - return completeEnd(code2); - } - function completeAttributeNameBefore(code2) { - if (code2 === 47) { + if (balance < limit && code2 === 40) { effects.consume(code2); - return completeEnd; + balance++; + return raw; } - if (code2 === 58 || code2 === 95 || asciiAlpha(code2)) { + if (code2 === 41) { effects.consume(code2); - return completeAttributeName; + balance--; + return raw; } - if (markdownSpace(code2)) { - effects.consume(code2); - return completeAttributeNameBefore; + if (code2 === null || code2 === 32 || code2 === 40 || asciiControl(code2)) { + return nok(code2); } - return completeEnd(code2); + effects.consume(code2); + return code2 === 92 ? rawEscape : raw; } - function completeAttributeName(code2) { - if (code2 === 45 || code2 === 46 || code2 === 58 || code2 === 95 || asciiAlphanumeric(code2)) { + function rawEscape(code2) { + if (code2 === 40 || code2 === 41 || code2 === 92) { effects.consume(code2); - return completeAttributeName; + return raw; } - return completeAttributeNameAfter(code2); + return raw(code2); } - function completeAttributeNameAfter(code2) { - if (code2 === 61) { - effects.consume(code2); - return completeAttributeValueBefore; - } - if (markdownSpace(code2)) { - effects.consume(code2); - return completeAttributeNameAfter; - } - return completeAttributeNameBefore(code2); +} + +// node_modules/micromark-factory-label/index.js +function factoryLabel(effects, ok3, nok, type, markerType, stringType) { + const self2 = this; + let size = 0; + let seen; + return start2; + function start2(code2) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code2); + effects.exit(markerType); + effects.enter(stringType); + return atBreak; } - function completeAttributeValueBefore(code2) { - if (code2 === null || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96) { + function atBreak(code2) { + if (size > 999 || code2 === null || code2 === 91 || code2 === 93 && !seen || // To do: remove in the future once we’ve switched from + // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, + // which doesn’t need this. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + code2 === 94 && !size && "_hiddenFootnoteSupport" in self2.parser.constructs) { return nok(code2); } - if (code2 === 34 || code2 === 39) { - effects.consume(code2); - marker = code2; - return completeAttributeValueQuoted; - } - if (markdownSpace(code2)) { + if (code2 === 93) { + effects.exit(stringType); + effects.enter(markerType); effects.consume(code2); - return completeAttributeValueBefore; - } - marker = null; - return completeAttributeValueUnquoted(code2); - } - function completeAttributeValueQuoted(code2) { - if (code2 === null || markdownLineEnding(code2)) { - return nok(code2); + effects.exit(markerType); + effects.exit(type); + return ok3; } - if (code2 === marker) { + if (markdownLineEnding(code2)) { + effects.enter("lineEnding"); effects.consume(code2); - return completeAttributeValueQuotedAfter; + effects.exit("lineEnding"); + return atBreak; } - effects.consume(code2); - return completeAttributeValueQuoted; + effects.enter("chunkString", { + contentType: "string" + }); + return labelInside(code2); } - function completeAttributeValueUnquoted(code2) { - if (code2 === null || code2 === 34 || code2 === 39 || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96 || markdownLineEndingOrSpace(code2)) { - return completeAttributeNameAfter(code2); + function labelInside(code2) { + if (code2 === null || code2 === 91 || code2 === 93 || markdownLineEnding(code2) || size++ > 999) { + effects.exit("chunkString"); + return atBreak(code2); } effects.consume(code2); - return completeAttributeValueUnquoted; + if (!seen) + seen = !markdownSpace(code2); + return code2 === 92 ? labelEscape : labelInside; } - function completeAttributeValueQuotedAfter(code2) { - if (code2 === 47 || code2 === 62 || markdownSpace(code2)) { - return completeAttributeNameBefore(code2); + function labelEscape(code2) { + if (code2 === 91 || code2 === 92 || code2 === 93) { + effects.consume(code2); + size++; + return labelInside; } - return nok(code2); + return labelInside(code2); } - function completeEnd(code2) { - if (code2 === 62) { +} + +// node_modules/micromark-factory-title/index.js +function factoryTitle(effects, ok3, nok, type, markerType, stringType) { + let marker; + return start2; + function start2(code2) { + if (code2 === 34 || code2 === 39 || code2 === 40) { + effects.enter(type); + effects.enter(markerType); effects.consume(code2); - return completeAfter; + effects.exit(markerType); + marker = code2 === 40 ? 41 : code2; + return begin; } return nok(code2); } - function completeAfter(code2) { - if (markdownSpace(code2)) { + function begin(code2) { + if (code2 === marker) { + effects.enter(markerType); effects.consume(code2); - return completeAfter; + effects.exit(markerType); + effects.exit(type); + return ok3; } - return code2 === null || markdownLineEnding(code2) ? continuation(code2) : nok(code2); + effects.enter(stringType); + return atBreak(code2); } - function continuation(code2) { - if (code2 === 45 && kind === 2) { - effects.consume(code2); - return continuationCommentInside; - } - if (code2 === 60 && kind === 1) { - effects.consume(code2); - return continuationRawTagOpen; - } - if (code2 === 62 && kind === 4) { - effects.consume(code2); - return continuationClose; + function atBreak(code2) { + if (code2 === marker) { + effects.exit(stringType); + return begin(marker); } - if (code2 === 63 && kind === 3) { - effects.consume(code2); - return continuationDeclarationInside; + if (code2 === null) { + return nok(code2); } - if (code2 === 93 && kind === 5) { + if (markdownLineEnding(code2)) { + effects.enter("lineEnding"); effects.consume(code2); - return continuationCharacterDataInside; - } - if (markdownLineEnding(code2) && (kind === 6 || kind === 7)) { - return effects.check( - nextBlankConstruct, - continuationClose, - continuationAtLineEnding - )(code2); + effects.exit("lineEnding"); + return factorySpace(effects, atBreak, "linePrefix"); } - if (code2 === null || markdownLineEnding(code2)) { - return continuationAtLineEnding(code2); + effects.enter("chunkString", { + contentType: "string" + }); + return inside(code2); + } + function inside(code2) { + if (code2 === marker || code2 === null || markdownLineEnding(code2)) { + effects.exit("chunkString"); + return atBreak(code2); } effects.consume(code2); - return continuation; - } - function continuationAtLineEnding(code2) { - effects.exit("htmlFlowData"); - return htmlContinueStart(code2); + return code2 === 92 ? escape : inside; } - function htmlContinueStart(code2) { - if (code2 === null) { - return done(code2); + function escape(code2) { + if (code2 === marker || code2 === 92) { + effects.consume(code2); + return inside; } + return inside(code2); + } +} + +// node_modules/micromark-factory-whitespace/index.js +function factoryWhitespace(effects, ok3) { + let seen; + return start2; + function start2(code2) { if (markdownLineEnding(code2)) { - return effects.attempt( - { - tokenize: htmlLineEnd, - partial: true - }, - htmlContinueStart, - done + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + seen = true; + return start2; + } + if (markdownSpace(code2)) { + return factorySpace( + effects, + start2, + seen ? "linePrefix" : "lineSuffix" )(code2); } - effects.enter("htmlFlowData"); - return continuation(code2); + return ok3(code2); } - function htmlLineEnd(effects2, ok3, nok2) { - return start4; - function start4(code2) { - effects2.enter("lineEnding"); - effects2.consume(code2); - effects2.exit("lineEnding"); - return lineStart; - } - function lineStart(code2) { - return self2.parser.lazy[self2.now().line] ? nok2(code2) : ok3(code2); - } +} + +// node_modules/micromark-util-normalize-identifier/index.js +function normalizeIdentifier(value) { + return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase(); +} + +// node_modules/micromark-core-commonmark/lib/definition.js +var definition = { + name: "definition", + tokenize: tokenizeDefinition +}; +var titleBefore = { + tokenize: tokenizeTitleBefore, + partial: true +}; +function tokenizeDefinition(effects, ok3, nok) { + const self2 = this; + let identifier; + return start2; + function start2(code2) { + effects.enter("definition"); + return before(code2); } - function continuationCommentInside(code2) { - if (code2 === 45) { - effects.consume(code2); - return continuationDeclarationInside; - } - return continuation(code2); + function before(code2) { + return factoryLabel.call( + self2, + effects, + labelAfter, + // Note: we don’t need to reset the way `markdown-rs` does. + nok, + "definitionLabel", + "definitionLabelMarker", + "definitionLabelString" + )(code2); } - function continuationRawTagOpen(code2) { - if (code2 === 47) { + function labelAfter(code2) { + identifier = normalizeIdentifier( + self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1) + ); + if (code2 === 58) { + effects.enter("definitionMarker"); effects.consume(code2); - buffer2 = ""; - return continuationRawEndTag; + effects.exit("definitionMarker"); + return markerAfter; } - return continuation(code2); + return nok(code2); } - function continuationRawEndTag(code2) { - if (code2 === 62 && htmlRawNames.includes(buffer2.toLowerCase())) { - effects.consume(code2); - return continuationClose; - } - if (asciiAlpha(code2) && buffer2.length < 8) { - effects.consume(code2); - buffer2 += String.fromCharCode(code2); - return continuationRawEndTag; - } - return continuation(code2); + function markerAfter(code2) { + return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, destinationBefore)(code2) : destinationBefore(code2); } - function continuationCharacterDataInside(code2) { - if (code2 === 93) { - effects.consume(code2); - return continuationDeclarationInside; - } - return continuation(code2); + function destinationBefore(code2) { + return factoryDestination( + effects, + destinationAfter, + // Note: we don’t need to reset the way `markdown-rs` does. + nok, + "definitionDestination", + "definitionDestinationLiteral", + "definitionDestinationLiteralMarker", + "definitionDestinationRaw", + "definitionDestinationString" + )(code2); } - function continuationDeclarationInside(code2) { - if (code2 === 62) { - effects.consume(code2); - return continuationClose; - } - if (code2 === 45 && kind === 2) { - effects.consume(code2); - return continuationDeclarationInside; - } - return continuation(code2); + function destinationAfter(code2) { + return effects.attempt(titleBefore, after, after)(code2); } - function continuationClose(code2) { + function after(code2) { + return markdownSpace(code2) ? factorySpace(effects, afterWhitespace, "whitespace")(code2) : afterWhitespace(code2); + } + function afterWhitespace(code2) { if (code2 === null || markdownLineEnding(code2)) { - effects.exit("htmlFlowData"); - return done(code2); + effects.exit("definition"); + self2.parser.defined.push(identifier); + return ok3(code2); } - effects.consume(code2); - return continuationClose; + return nok(code2); } - function done(code2) { - effects.exit("htmlFlow"); - return ok2(code2); +} +function tokenizeTitleBefore(effects, ok3, nok) { + return titleBefore2; + function titleBefore2(code2) { + return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, beforeMarker)(code2) : nok(code2); + } + function beforeMarker(code2) { + return factoryTitle( + effects, + titleAfter, + nok, + "definitionTitle", + "definitionTitleMarker", + "definitionTitleString" + )(code2); + } + function titleAfter(code2) { + return markdownSpace(code2) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code2) : titleAfterOptionalWhitespace(code2); + } + function titleAfterOptionalWhitespace(code2) { + return code2 === null || markdownLineEnding(code2) ? ok3(code2) : nok(code2); } } -function tokenizeNextBlank(effects, ok2, nok) { - return start3; - function start3(code2) { - effects.exit("htmlFlowData"); - effects.enter("lineEndingBlank"); + +// node_modules/micromark-core-commonmark/lib/hard-break-escape.js +var hardBreakEscape = { + name: "hardBreakEscape", + tokenize: tokenizeHardBreakEscape +}; +function tokenizeHardBreakEscape(effects, ok3, nok) { + return start2; + function start2(code2) { + effects.enter("hardBreakEscape"); effects.consume(code2); - effects.exit("lineEndingBlank"); - return effects.attempt(blankLine, ok2, nok); + return after; + } + function after(code2) { + if (markdownLineEnding(code2)) { + effects.exit("hardBreakEscape"); + return ok3(code2); + } + return nok(code2); + } +} + +// node_modules/micromark-core-commonmark/lib/heading-atx.js +var headingAtx = { + name: "headingAtx", + tokenize: tokenizeHeadingAtx, + resolve: resolveHeadingAtx +}; +function resolveHeadingAtx(events, context) { + let contentEnd = events.length - 2; + let contentStart = 3; + let content3; + let text5; + if (events[contentStart][1].type === "whitespace") { + contentStart += 2; + } + if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") { + contentEnd -= 2; + } + if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; + } + if (contentEnd > contentStart) { + content3 = { + type: "atxHeadingText", + start: events[contentStart][1].start, + end: events[contentEnd][1].end + }; + text5 = { + type: "chunkText", + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: "text" + }; + splice(events, contentStart, contentEnd - contentStart + 1, [ + ["enter", content3, context], + ["enter", text5, context], + ["exit", text5, context], + ["exit", content3, context] + ]); } + return events; } - -// node_modules/micromark-core-commonmark/lib/html-text.js -var htmlText = { - name: "htmlText", - tokenize: tokenizeHtmlText -}; -function tokenizeHtmlText(effects, ok2, nok) { - const self2 = this; - let marker; - let buffer2; - let index2; - let returnState; - return start3; - function start3(code2) { - effects.enter("htmlText"); - effects.enter("htmlTextData"); - effects.consume(code2); - return open; +function tokenizeHeadingAtx(effects, ok3, nok) { + let size = 0; + return start2; + function start2(code2) { + effects.enter("atxHeading"); + return before(code2); } - function open(code2) { - if (code2 === 33) { - effects.consume(code2); - return declarationOpen; - } - if (code2 === 47) { - effects.consume(code2); - return tagCloseStart; - } - if (code2 === 63) { - effects.consume(code2); - return instruction; - } - if (asciiAlpha(code2)) { - effects.consume(code2); - return tagOpen; - } - return nok(code2); + function before(code2) { + effects.enter("atxHeadingSequence"); + return sequenceOpen(code2); } - function declarationOpen(code2) { - if (code2 === 45) { - effects.consume(code2); - return commentOpen; - } - if (code2 === 91) { - effects.consume(code2); - buffer2 = "CDATA["; - index2 = 0; - return cdataOpen; - } - if (asciiAlpha(code2)) { + function sequenceOpen(code2) { + if (code2 === 35 && size++ < 6) { effects.consume(code2); - return declaration; + return sequenceOpen; } - return nok(code2); - } - function commentOpen(code2) { - if (code2 === 45) { - effects.consume(code2); - return commentStart; + if (code2 === null || markdownLineEndingOrSpace(code2)) { + effects.exit("atxHeadingSequence"); + return atBreak(code2); } return nok(code2); } - function commentStart(code2) { - if (code2 === null || code2 === 62) { - return nok(code2); + function atBreak(code2) { + if (code2 === 35) { + effects.enter("atxHeadingSequence"); + return sequenceFurther(code2); } - if (code2 === 45) { - effects.consume(code2); - return commentStartDash; + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("atxHeading"); + return ok3(code2); } - return comment2(code2); - } - function commentStartDash(code2) { - if (code2 === null || code2 === 62) { - return nok(code2); + if (markdownSpace(code2)) { + return factorySpace(effects, atBreak, "whitespace")(code2); } - return comment2(code2); + effects.enter("atxHeadingText"); + return data2(code2); } - function comment2(code2) { - if (code2 === null) { - return nok(code2); - } - if (code2 === 45) { + function sequenceFurther(code2) { + if (code2 === 35) { effects.consume(code2); - return commentClose; + return sequenceFurther; } - if (markdownLineEnding(code2)) { - returnState = comment2; - return atLineEnding(code2); + effects.exit("atxHeadingSequence"); + return atBreak(code2); + } + function data2(code2) { + if (code2 === null || code2 === 35 || markdownLineEndingOrSpace(code2)) { + effects.exit("atxHeadingText"); + return atBreak(code2); } effects.consume(code2); - return comment2; + return data2; } - function commentClose(code2) { - if (code2 === 45) { - effects.consume(code2); - return end; +} + +// node_modules/micromark-util-html-tag-name/index.js +var htmlBlockNames = [ + "address", + "article", + "aside", + "base", + "basefont", + "blockquote", + "body", + "caption", + "center", + "col", + "colgroup", + "dd", + "details", + "dialog", + "dir", + "div", + "dl", + "dt", + "fieldset", + "figcaption", + "figure", + "footer", + "form", + "frame", + "frameset", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "head", + "header", + "hr", + "html", + "iframe", + "legend", + "li", + "link", + "main", + "menu", + "menuitem", + "nav", + "noframes", + "ol", + "optgroup", + "option", + "p", + "param", + "search", + "section", + "summary", + "table", + "tbody", + "td", + "tfoot", + "th", + "thead", + "title", + "tr", + "track", + "ul" +]; +var htmlRawNames = ["pre", "script", "style", "textarea"]; + +// node_modules/micromark-core-commonmark/lib/html-flow.js +var htmlFlow = { + name: "htmlFlow", + tokenize: tokenizeHtmlFlow, + resolveTo: resolveToHtmlFlow, + concrete: true +}; +var blankLineBefore = { + tokenize: tokenizeBlankLineBefore, + partial: true +}; +var nonLazyContinuationStart = { + tokenize: tokenizeNonLazyContinuationStart, + partial: true +}; +function resolveToHtmlFlow(events) { + let index2 = events.length; + while (index2--) { + if (events[index2][0] === "enter" && events[index2][1].type === "htmlFlow") { + break; } - return comment2(code2); } - function cdataOpen(code2) { - if (code2 === buffer2.charCodeAt(index2++)) { - effects.consume(code2); - return index2 === buffer2.length ? cdata : cdataOpen; - } - return nok(code2); + if (index2 > 1 && events[index2 - 2][1].type === "linePrefix") { + events[index2][1].start = events[index2 - 2][1].start; + events[index2 + 1][1].start = events[index2 - 2][1].start; + events.splice(index2 - 2, 2); } - function cdata(code2) { - if (code2 === null) { - return nok(code2); - } - if (code2 === 93) { - effects.consume(code2); - return cdataClose; - } - if (markdownLineEnding(code2)) { - returnState = cdata; - return atLineEnding(code2); - } + return events; +} +function tokenizeHtmlFlow(effects, ok3, nok) { + const self2 = this; + let marker; + let closingTag; + let buffer; + let index2; + let markerB; + return start2; + function start2(code2) { + return before(code2); + } + function before(code2) { + effects.enter("htmlFlow"); + effects.enter("htmlFlowData"); effects.consume(code2); - return cdata; + return open; } - function cdataClose(code2) { - if (code2 === 93) { + function open(code2) { + if (code2 === 33) { effects.consume(code2); - return cdataEnd; - } - return cdata(code2); - } - function cdataEnd(code2) { - if (code2 === 62) { - return end(code2); + return declarationOpen; } - if (code2 === 93) { + if (code2 === 47) { effects.consume(code2); - return cdataEnd; - } - return cdata(code2); - } - function declaration(code2) { - if (code2 === null || code2 === 62) { - return end(code2); - } - if (markdownLineEnding(code2)) { - returnState = declaration; - return atLineEnding(code2); - } - effects.consume(code2); - return declaration; - } - function instruction(code2) { - if (code2 === null) { - return nok(code2); + closingTag = true; + return tagCloseStart; } if (code2 === 63) { effects.consume(code2); - return instructionClose; - } - if (markdownLineEnding(code2)) { - returnState = instruction; - return atLineEnding(code2); - } - effects.consume(code2); - return instruction; - } - function instructionClose(code2) { - return code2 === 62 ? end(code2) : instruction(code2); - } - function tagCloseStart(code2) { + marker = 3; + return self2.interrupt ? ok3 : continuationDeclarationInside; + } if (asciiAlpha(code2)) { effects.consume(code2); - return tagClose; + buffer = String.fromCharCode(code2); + return tagName; } return nok(code2); } - function tagClose(code2) { - if (code2 === 45 || asciiAlphanumeric(code2)) { + function declarationOpen(code2) { + if (code2 === 45) { effects.consume(code2); - return tagClose; + marker = 2; + return commentOpenInside; } - return tagCloseBetween(code2); - } - function tagCloseBetween(code2) { - if (markdownLineEnding(code2)) { - returnState = tagCloseBetween; - return atLineEnding(code2); + if (code2 === 91) { + effects.consume(code2); + marker = 5; + index2 = 0; + return cdataOpenInside; } - if (markdownSpace(code2)) { + if (asciiAlpha(code2)) { effects.consume(code2); - return tagCloseBetween; + marker = 4; + return self2.interrupt ? ok3 : continuationDeclarationInside; } - return end(code2); + return nok(code2); } - function tagOpen(code2) { - if (code2 === 45 || asciiAlphanumeric(code2)) { + function commentOpenInside(code2) { + if (code2 === 45) { effects.consume(code2); - return tagOpen; - } - if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) { - return tagOpenBetween(code2); + return self2.interrupt ? ok3 : continuationDeclarationInside; } return nok(code2); } - function tagOpenBetween(code2) { - if (code2 === 47) { + function cdataOpenInside(code2) { + const value = "CDATA["; + if (code2 === value.charCodeAt(index2++)) { effects.consume(code2); - return end; + if (index2 === value.length) { + return self2.interrupt ? ok3 : continuation; + } + return cdataOpenInside; } - if (code2 === 58 || code2 === 95 || asciiAlpha(code2)) { + return nok(code2); + } + function tagCloseStart(code2) { + if (asciiAlpha(code2)) { effects.consume(code2); - return tagOpenAttributeName; + buffer = String.fromCharCode(code2); + return tagName; } - if (markdownLineEnding(code2)) { - returnState = tagOpenBetween; - return atLineEnding(code2); + return nok(code2); + } + function tagName(code2) { + if (code2 === null || code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) { + const slash = code2 === 47; + const name2 = buffer.toLowerCase(); + if (!slash && !closingTag && htmlRawNames.includes(name2)) { + marker = 1; + return self2.interrupt ? ok3(code2) : continuation(code2); + } + if (htmlBlockNames.includes(buffer.toLowerCase())) { + marker = 6; + if (slash) { + effects.consume(code2); + return basicSelfClosing; + } + return self2.interrupt ? ok3(code2) : continuation(code2); + } + marker = 7; + return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code2) : closingTag ? completeClosingTagAfter(code2) : completeAttributeNameBefore(code2); } - if (markdownSpace(code2)) { + if (code2 === 45 || asciiAlphanumeric(code2)) { effects.consume(code2); - return tagOpenBetween; + buffer += String.fromCharCode(code2); + return tagName; } - return end(code2); + return nok(code2); } - function tagOpenAttributeName(code2) { - if (code2 === 45 || code2 === 46 || code2 === 58 || code2 === 95 || asciiAlphanumeric(code2)) { + function basicSelfClosing(code2) { + if (code2 === 62) { effects.consume(code2); - return tagOpenAttributeName; + return self2.interrupt ? ok3 : continuation; } - return tagOpenAttributeNameAfter(code2); + return nok(code2); } - function tagOpenAttributeNameAfter(code2) { - if (code2 === 61) { - effects.consume(code2); - return tagOpenAttributeValueBefore; - } - if (markdownLineEnding(code2)) { - returnState = tagOpenAttributeNameAfter; - return atLineEnding(code2); - } + function completeClosingTagAfter(code2) { if (markdownSpace(code2)) { effects.consume(code2); - return tagOpenAttributeNameAfter; + return completeClosingTagAfter; } - return tagOpenBetween(code2); + return completeEnd(code2); } - function tagOpenAttributeValueBefore(code2) { - if (code2 === null || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96) { - return nok(code2); - } - if (code2 === 34 || code2 === 39) { + function completeAttributeNameBefore(code2) { + if (code2 === 47) { effects.consume(code2); - marker = code2; - return tagOpenAttributeValueQuoted; + return completeEnd; } - if (markdownLineEnding(code2)) { - returnState = tagOpenAttributeValueBefore; - return atLineEnding(code2); + if (code2 === 58 || code2 === 95 || asciiAlpha(code2)) { + effects.consume(code2); + return completeAttributeName; } if (markdownSpace(code2)) { effects.consume(code2); - return tagOpenAttributeValueBefore; + return completeAttributeNameBefore; } - effects.consume(code2); - marker = void 0; - return tagOpenAttributeValueUnquoted; + return completeEnd(code2); } - function tagOpenAttributeValueQuoted(code2) { - if (code2 === marker) { + function completeAttributeName(code2) { + if (code2 === 45 || code2 === 46 || code2 === 58 || code2 === 95 || asciiAlphanumeric(code2)) { effects.consume(code2); - return tagOpenAttributeValueQuotedAfter; - } - if (code2 === null) { - return nok(code2); - } - if (markdownLineEnding(code2)) { - returnState = tagOpenAttributeValueQuoted; - return atLineEnding(code2); - } - effects.consume(code2); - return tagOpenAttributeValueQuoted; - } - function tagOpenAttributeValueQuotedAfter(code2) { - if (code2 === 62 || code2 === 47 || markdownLineEndingOrSpace(code2)) { - return tagOpenBetween(code2); - } - return nok(code2); - } - function tagOpenAttributeValueUnquoted(code2) { - if (code2 === null || code2 === 34 || code2 === 39 || code2 === 60 || code2 === 61 || code2 === 96) { - return nok(code2); - } - if (code2 === 62 || markdownLineEndingOrSpace(code2)) { - return tagOpenBetween(code2); + return completeAttributeName; } - effects.consume(code2); - return tagOpenAttributeValueUnquoted; - } - function atLineEnding(code2) { - effects.exit("htmlTextData"); - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - return factorySpace( - effects, - afterPrefix, - "linePrefix", - self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 - ); - } - function afterPrefix(code2) { - effects.enter("htmlTextData"); - return returnState(code2); + return completeAttributeNameAfter(code2); } - function end(code2) { - if (code2 === 62) { + function completeAttributeNameAfter(code2) { + if (code2 === 61) { effects.consume(code2); - effects.exit("htmlTextData"); - effects.exit("htmlText"); - return ok2; - } - return nok(code2); - } -} - -// node_modules/micromark-core-commonmark/lib/label-end.js -var labelEnd = { - name: "labelEnd", - tokenize: tokenizeLabelEnd, - resolveTo: resolveToLabelEnd, - resolveAll: resolveAllLabelEnd -}; -var resourceConstruct = { - tokenize: tokenizeResource -}; -var fullReferenceConstruct = { - tokenize: tokenizeFullReference -}; -var collapsedReferenceConstruct = { - tokenize: tokenizeCollapsedReference -}; -function resolveAllLabelEnd(events) { - let index2 = -1; - let token; - while (++index2 < events.length) { - token = events[index2][1]; - if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { - events.splice(index2 + 1, token.type === "labelImage" ? 4 : 2); - token.type = "data"; - index2++; - } - } - return events; -} -function resolveToLabelEnd(events, context) { - let index2 = events.length; - let offset2 = 0; - let token; - let open; - let close; - let media; - while (index2--) { - token = events[index2][1]; - if (open) { - if (token.type === "link" || token.type === "labelLink" && token._inactive) { - break; - } - if (events[index2][0] === "enter" && token.type === "labelLink") { - token._inactive = true; - } - } else if (close) { - if (events[index2][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) { - open = index2; - if (token.type !== "labelLink") { - offset2 = 2; - break; - } - } - } else if (token.type === "labelEnd") { - close = index2; + return completeAttributeValueBefore; } - } - const group = { - type: events[open][1].type === "labelLink" ? "link" : "image", - start: Object.assign({}, events[open][1].start), - end: Object.assign({}, events[events.length - 1][1].end) - }; - const label = { - type: "label", - start: Object.assign({}, events[open][1].start), - end: Object.assign({}, events[close][1].end) - }; - const text5 = { - type: "labelText", - start: Object.assign({}, events[open + offset2 + 2][1].end), - end: Object.assign({}, events[close - 2][1].start) - }; - media = [ - ["enter", group, context], - ["enter", label, context] - ]; - media = push(media, events.slice(open + 1, open + offset2 + 3)); - media = push(media, [["enter", text5, context]]); - media = push( - media, - resolveAll( - context.parser.constructs.insideSpan.null, - events.slice(open + offset2 + 4, close - 3), - context - ) - ); - media = push(media, [ - ["exit", text5, context], - events[close - 2], - events[close - 1], - ["exit", label, context] - ]); - media = push(media, events.slice(close + 1)); - media = push(media, [["exit", group, context]]); - splice(events, open, events.length, media); - return events; -} -function tokenizeLabelEnd(effects, ok2, nok) { - const self2 = this; - let index2 = self2.events.length; - let labelStart; - let defined; - while (index2--) { - if ((self2.events[index2][1].type === "labelImage" || self2.events[index2][1].type === "labelLink") && !self2.events[index2][1]._balanced) { - labelStart = self2.events[index2][1]; - break; + if (markdownSpace(code2)) { + effects.consume(code2); + return completeAttributeNameAfter; } + return completeAttributeNameBefore(code2); } - return start3; - function start3(code2) { - if (!labelStart) { + function completeAttributeValueBefore(code2) { + if (code2 === null || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96) { + return nok(code2); + } + if (code2 === 34 || code2 === 39) { + effects.consume(code2); + markerB = code2; + return completeAttributeValueQuoted; + } + if (markdownSpace(code2)) { + effects.consume(code2); + return completeAttributeValueBefore; + } + return completeAttributeValueUnquoted(code2); + } + function completeAttributeValueQuoted(code2) { + if (code2 === markerB) { + effects.consume(code2); + markerB = null; + return completeAttributeValueQuotedAfter; + } + if (code2 === null || markdownLineEnding(code2)) { return nok(code2); } - if (labelStart._inactive) - return balanced(code2); - defined = self2.parser.defined.includes( - normalizeIdentifier( - self2.sliceSerialize({ - start: labelStart.end, - end: self2.now() - }) - ) - ); - effects.enter("labelEnd"); - effects.enter("labelMarker"); effects.consume(code2); - effects.exit("labelMarker"); - effects.exit("labelEnd"); - return afterLabelEnd; + return completeAttributeValueQuoted; } - function afterLabelEnd(code2) { - if (code2 === 40) { - return effects.attempt( - resourceConstruct, - ok2, - defined ? ok2 : balanced - )(code2); + function completeAttributeValueUnquoted(code2) { + if (code2 === null || code2 === 34 || code2 === 39 || code2 === 47 || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96 || markdownLineEndingOrSpace(code2)) { + return completeAttributeNameAfter(code2); } - if (code2 === 91) { - return effects.attempt( - fullReferenceConstruct, - ok2, - defined ? effects.attempt(collapsedReferenceConstruct, ok2, balanced) : balanced - )(code2); + effects.consume(code2); + return completeAttributeValueUnquoted; + } + function completeAttributeValueQuotedAfter(code2) { + if (code2 === 47 || code2 === 62 || markdownSpace(code2)) { + return completeAttributeNameBefore(code2); } - return defined ? ok2(code2) : balanced(code2); + return nok(code2); } - function balanced(code2) { - labelStart._balanced = true; + function completeEnd(code2) { + if (code2 === 62) { + effects.consume(code2); + return completeAfter; + } return nok(code2); } -} -function tokenizeResource(effects, ok2, nok) { - return start3; - function start3(code2) { - effects.enter("resource"); - effects.enter("resourceMarker"); - effects.consume(code2); - effects.exit("resourceMarker"); - return factoryWhitespace(effects, open); + function completeAfter(code2) { + if (code2 === null || markdownLineEnding(code2)) { + return continuation(code2); + } + if (markdownSpace(code2)) { + effects.consume(code2); + return completeAfter; + } + return nok(code2); } - function open(code2) { - if (code2 === 41) { - return end(code2); + function continuation(code2) { + if (code2 === 45 && marker === 2) { + effects.consume(code2); + return continuationCommentInside; } - return factoryDestination( - effects, - destinationAfter, - nok, - "resourceDestination", - "resourceDestinationLiteral", - "resourceDestinationLiteralMarker", - "resourceDestinationRaw", - "resourceDestinationString", - 32 + if (code2 === 60 && marker === 1) { + effects.consume(code2); + return continuationRawTagOpen; + } + if (code2 === 62 && marker === 4) { + effects.consume(code2); + return continuationClose; + } + if (code2 === 63 && marker === 3) { + effects.consume(code2); + return continuationDeclarationInside; + } + if (code2 === 93 && marker === 5) { + effects.consume(code2); + return continuationCdataInside; + } + if (markdownLineEnding(code2) && (marker === 6 || marker === 7)) { + effects.exit("htmlFlowData"); + return effects.check( + blankLineBefore, + continuationAfter, + continuationStart + )(code2); + } + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("htmlFlowData"); + return continuationStart(code2); + } + effects.consume(code2); + return continuation; + } + function continuationStart(code2) { + return effects.check( + nonLazyContinuationStart, + continuationStartNonLazy, + continuationAfter )(code2); } - function destinationAfter(code2) { - return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, between)(code2) : end(code2); + function continuationStartNonLazy(code2) { + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return continuationBefore; } - function between(code2) { - if (code2 === 34 || code2 === 39 || code2 === 40) { - return factoryTitle( - effects, - factoryWhitespace(effects, end), - nok, - "resourceTitle", - "resourceTitleMarker", - "resourceTitleString" - )(code2); + function continuationBefore(code2) { + if (code2 === null || markdownLineEnding(code2)) { + return continuationStart(code2); } - return end(code2); + effects.enter("htmlFlowData"); + return continuation(code2); } - function end(code2) { - if (code2 === 41) { - effects.enter("resourceMarker"); + function continuationCommentInside(code2) { + if (code2 === 45) { effects.consume(code2); - effects.exit("resourceMarker"); - effects.exit("resource"); - return ok2; + return continuationDeclarationInside; } - return nok(code2); - } -} -function tokenizeFullReference(effects, ok2, nok) { - const self2 = this; - return start3; - function start3(code2) { - return factoryLabel.call( - self2, - effects, - afterLabel, - nok, - "reference", - "referenceMarker", - "referenceString" - )(code2); + return continuation(code2); } - function afterLabel(code2) { - return self2.parser.defined.includes( - normalizeIdentifier( - self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1) - ) - ) ? ok2(code2) : nok(code2); + function continuationRawTagOpen(code2) { + if (code2 === 47) { + effects.consume(code2); + buffer = ""; + return continuationRawEndTag; + } + return continuation(code2); } -} -function tokenizeCollapsedReference(effects, ok2, nok) { - return start3; - function start3(code2) { - effects.enter("reference"); - effects.enter("referenceMarker"); - effects.consume(code2); - effects.exit("referenceMarker"); - return open; + function continuationRawEndTag(code2) { + if (code2 === 62) { + const name2 = buffer.toLowerCase(); + if (htmlRawNames.includes(name2)) { + effects.consume(code2); + return continuationClose; + } + return continuation(code2); + } + if (asciiAlpha(code2) && buffer.length < 8) { + effects.consume(code2); + buffer += String.fromCharCode(code2); + return continuationRawEndTag; + } + return continuation(code2); } - function open(code2) { + function continuationCdataInside(code2) { if (code2 === 93) { - effects.enter("referenceMarker"); effects.consume(code2); - effects.exit("referenceMarker"); - effects.exit("reference"); - return ok2; + return continuationDeclarationInside; } - return nok(code2); - } -} - -// node_modules/micromark-core-commonmark/lib/label-start-image.js -var labelStartImage = { - name: "labelStartImage", - tokenize: tokenizeLabelStartImage, - resolveAll: labelEnd.resolveAll -}; -function tokenizeLabelStartImage(effects, ok2, nok) { - const self2 = this; - return start3; - function start3(code2) { - effects.enter("labelImage"); - effects.enter("labelImageMarker"); - effects.consume(code2); - effects.exit("labelImageMarker"); - return open; + return continuation(code2); } - function open(code2) { - if (code2 === 91) { - effects.enter("labelMarker"); + function continuationDeclarationInside(code2) { + if (code2 === 62) { effects.consume(code2); - effects.exit("labelMarker"); - effects.exit("labelImage"); - return after; + return continuationClose; } - return nok(code2); + if (code2 === 45 && marker === 2) { + effects.consume(code2); + return continuationDeclarationInside; + } + return continuation(code2); } - function after(code2) { - return code2 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2); + function continuationClose(code2) { + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("htmlFlowData"); + return continuationAfter(code2); + } + effects.consume(code2); + return continuationClose; + } + function continuationAfter(code2) { + effects.exit("htmlFlow"); + return ok3(code2); } } - -// node_modules/micromark-core-commonmark/lib/label-start-link.js -var labelStartLink = { - name: "labelStartLink", - tokenize: tokenizeLabelStartLink, - resolveAll: labelEnd.resolveAll -}; -function tokenizeLabelStartLink(effects, ok2, nok) { +function tokenizeNonLazyContinuationStart(effects, ok3, nok) { const self2 = this; - return start3; - function start3(code2) { - effects.enter("labelLink"); - effects.enter("labelMarker"); - effects.consume(code2); - effects.exit("labelMarker"); - effects.exit("labelLink"); - return after; + return start2; + function start2(code2) { + if (markdownLineEnding(code2)) { + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return after; + } + return nok(code2); } function after(code2) { - return code2 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2); + return self2.parser.lazy[self2.now().line] ? nok(code2) : ok3(code2); } } - -// node_modules/micromark-core-commonmark/lib/line-ending.js -var lineEnding = { - name: "lineEnding", - tokenize: tokenizeLineEnding -}; -function tokenizeLineEnding(effects, ok2) { - return start3; - function start3(code2) { +function tokenizeBlankLineBefore(effects, ok3, nok) { + return start2; + function start2(code2) { effects.enter("lineEnding"); effects.consume(code2); effects.exit("lineEnding"); - return factorySpace(effects, ok2, "linePrefix"); + return effects.attempt(blankLine, ok3, nok); } } -// node_modules/micromark-core-commonmark/lib/thematic-break.js -var thematicBreak = { - name: "thematicBreak", - tokenize: tokenizeThematicBreak +// node_modules/micromark-core-commonmark/lib/html-text.js +var htmlText = { + name: "htmlText", + tokenize: tokenizeHtmlText }; -function tokenizeThematicBreak(effects, ok2, nok) { - let size = 0; +function tokenizeHtmlText(effects, ok3, nok) { + const self2 = this; let marker; - return start3; - function start3(code2) { - effects.enter("thematicBreak"); - marker = code2; - return atBreak(code2); + let index2; + let returnState; + return start2; + function start2(code2) { + effects.enter("htmlText"); + effects.enter("htmlTextData"); + effects.consume(code2); + return open; } - function atBreak(code2) { - if (code2 === marker) { - effects.enter("thematicBreakSequence"); - return sequence(code2); + function open(code2) { + if (code2 === 33) { + effects.consume(code2); + return declarationOpen; } - if (markdownSpace(code2)) { - return factorySpace(effects, atBreak, "whitespace")(code2); + if (code2 === 47) { + effects.consume(code2); + return tagCloseStart; } - if (size < 3 || code2 !== null && !markdownLineEnding(code2)) { - return nok(code2); + if (code2 === 63) { + effects.consume(code2); + return instruction; } - effects.exit("thematicBreak"); - return ok2(code2); - } - function sequence(code2) { - if (code2 === marker) { + if (asciiAlpha(code2)) { effects.consume(code2); - size++; - return sequence; + return tagOpen; } - effects.exit("thematicBreakSequence"); - return atBreak(code2); + return nok(code2); } -} - -// node_modules/micromark-core-commonmark/lib/list.js -var list = { - name: "list", - tokenize: tokenizeListStart, - continuation: { - tokenize: tokenizeListContinuation - }, - exit: tokenizeListEnd -}; -var listItemPrefixWhitespaceConstruct = { - tokenize: tokenizeListItemPrefixWhitespace, - partial: true -}; -var indentConstruct = { - tokenize: tokenizeIndent, - partial: true -}; -function tokenizeListStart(effects, ok2, nok) { - const self2 = this; - const tail = self2.events[self2.events.length - 1]; - let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; - let size = 0; - return start3; - function start3(code2) { - const kind = self2.containerState.type || (code2 === 42 || code2 === 43 || code2 === 45 ? "listUnordered" : "listOrdered"); - if (kind === "listUnordered" ? !self2.containerState.marker || code2 === self2.containerState.marker : asciiDigit(code2)) { - if (!self2.containerState.type) { - self2.containerState.type = kind; - effects.enter(kind, { - _container: true - }); - } - if (kind === "listUnordered") { - effects.enter("listItemPrefix"); - return code2 === 42 || code2 === 45 ? effects.check(thematicBreak, nok, atMarker)(code2) : atMarker(code2); - } - if (!self2.interrupt || code2 === 49) { - effects.enter("listItemPrefix"); - effects.enter("listItemValue"); - return inside(code2); - } + function declarationOpen(code2) { + if (code2 === 45) { + effects.consume(code2); + return commentOpenInside; + } + if (code2 === 91) { + effects.consume(code2); + index2 = 0; + return cdataOpenInside; + } + if (asciiAlpha(code2)) { + effects.consume(code2); + return declaration; } return nok(code2); } - function inside(code2) { - if (asciiDigit(code2) && ++size < 10) { + function commentOpenInside(code2) { + if (code2 === 45) { effects.consume(code2); - return inside; - } - if ((!self2.interrupt || size < 2) && (self2.containerState.marker ? code2 === self2.containerState.marker : code2 === 41 || code2 === 46)) { - effects.exit("listItemValue"); - return atMarker(code2); + return commentEnd; } return nok(code2); } - function atMarker(code2) { - effects.enter("listItemMarker"); + function comment2(code2) { + if (code2 === null) { + return nok(code2); + } + if (code2 === 45) { + effects.consume(code2); + return commentClose; + } + if (markdownLineEnding(code2)) { + returnState = comment2; + return lineEndingBefore(code2); + } effects.consume(code2); - effects.exit("listItemMarker"); - self2.containerState.marker = self2.containerState.marker || code2; - return effects.check( - blankLine, - self2.interrupt ? nok : onBlank, - effects.attempt( - listItemPrefixWhitespaceConstruct, - endOfPrefix, - otherPrefix - ) - ); - } - function onBlank(code2) { - self2.containerState.initialBlankLine = true; - initialSize++; - return endOfPrefix(code2); + return comment2; } - function otherPrefix(code2) { - if (markdownSpace(code2)) { - effects.enter("listItemPrefixWhitespace"); + function commentClose(code2) { + if (code2 === 45) { effects.consume(code2); - effects.exit("listItemPrefixWhitespace"); - return endOfPrefix; + return commentEnd; } - return nok(code2); - } - function endOfPrefix(code2) { - self2.containerState.size = initialSize + self2.sliceSerialize(effects.exit("listItemPrefix"), true).length; - return ok2(code2); + return comment2(code2); } -} -function tokenizeListContinuation(effects, ok2, nok) { - const self2 = this; - self2.containerState._closeFlow = void 0; - return effects.check(blankLine, onBlank, notBlank); - function onBlank(code2) { - self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine; - return factorySpace( - effects, - ok2, - "listItemIndent", - self2.containerState.size + 1 - )(code2); + function commentEnd(code2) { + return code2 === 62 ? end(code2) : code2 === 45 ? commentClose(code2) : comment2(code2); } - function notBlank(code2) { - if (self2.containerState.furtherBlankLines || !markdownSpace(code2)) { - self2.containerState.furtherBlankLines = void 0; - self2.containerState.initialBlankLine = void 0; - return notInCurrentItem(code2); + function cdataOpenInside(code2) { + const value = "CDATA["; + if (code2 === value.charCodeAt(index2++)) { + effects.consume(code2); + return index2 === value.length ? cdata : cdataOpenInside; } - self2.containerState.furtherBlankLines = void 0; - self2.containerState.initialBlankLine = void 0; - return effects.attempt(indentConstruct, ok2, notInCurrentItem)(code2); + return nok(code2); } - function notInCurrentItem(code2) { - self2.containerState._closeFlow = true; - self2.interrupt = void 0; - return factorySpace( - effects, - effects.attempt(list, ok2, nok), - "linePrefix", - self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 - )(code2); + function cdata(code2) { + if (code2 === null) { + return nok(code2); + } + if (code2 === 93) { + effects.consume(code2); + return cdataClose; + } + if (markdownLineEnding(code2)) { + returnState = cdata; + return lineEndingBefore(code2); + } + effects.consume(code2); + return cdata; } -} -function tokenizeIndent(effects, ok2, nok) { - const self2 = this; - return factorySpace( - effects, - afterPrefix, - "listItemIndent", - self2.containerState.size + 1 - ); - function afterPrefix(code2) { - const tail = self2.events[self2.events.length - 1]; - return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok2(code2) : nok(code2); + function cdataClose(code2) { + if (code2 === 93) { + effects.consume(code2); + return cdataEnd; + } + return cdata(code2); } -} -function tokenizeListEnd(effects) { - effects.exit(this.containerState.type); -} -function tokenizeListItemPrefixWhitespace(effects, ok2, nok) { - const self2 = this; - return factorySpace( - effects, - afterPrefix, - "listItemPrefixWhitespace", - self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1 - ); - function afterPrefix(code2) { - const tail = self2.events[self2.events.length - 1]; - return !markdownSpace(code2) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok2(code2) : nok(code2); + function cdataEnd(code2) { + if (code2 === 62) { + return end(code2); + } + if (code2 === 93) { + effects.consume(code2); + return cdataEnd; + } + return cdata(code2); } -} - -// node_modules/micromark-core-commonmark/lib/setext-underline.js -var setextUnderline = { - name: "setextUnderline", - tokenize: tokenizeSetextUnderline, - resolveTo: resolveToSetextUnderline -}; -function resolveToSetextUnderline(events, context) { - let index2 = events.length; - let content3; - let text5; - let definition2; - while (index2--) { - if (events[index2][0] === "enter") { - if (events[index2][1].type === "content") { - content3 = index2; - break; - } - if (events[index2][1].type === "paragraph") { - text5 = index2; - } - } else { - if (events[index2][1].type === "content") { - events.splice(index2, 1); - } - if (!definition2 && events[index2][1].type === "definition") { - definition2 = index2; - } + function declaration(code2) { + if (code2 === null || code2 === 62) { + return end(code2); + } + if (markdownLineEnding(code2)) { + returnState = declaration; + return lineEndingBefore(code2); + } + effects.consume(code2); + return declaration; + } + function instruction(code2) { + if (code2 === null) { + return nok(code2); + } + if (code2 === 63) { + effects.consume(code2); + return instructionClose; + } + if (markdownLineEnding(code2)) { + returnState = instruction; + return lineEndingBefore(code2); } + effects.consume(code2); + return instruction; } - const heading2 = { - type: "setextHeading", - start: Object.assign({}, events[text5][1].start), - end: Object.assign({}, events[events.length - 1][1].end) - }; - events[text5][1].type = "setextHeadingText"; - if (definition2) { - events.splice(text5, 0, ["enter", heading2, context]); - events.splice(definition2 + 1, 0, ["exit", events[content3][1], context]); - events[content3][1].end = Object.assign({}, events[definition2][1].end); - } else { - events[content3][1] = heading2; + function instructionClose(code2) { + return code2 === 62 ? end(code2) : instruction(code2); } - events.push(["exit", heading2, context]); - return events; -} -function tokenizeSetextUnderline(effects, ok2, nok) { - const self2 = this; - let index2 = self2.events.length; - let marker; - let paragraph2; - while (index2--) { - if (self2.events[index2][1].type !== "lineEnding" && self2.events[index2][1].type !== "linePrefix" && self2.events[index2][1].type !== "content") { - paragraph2 = self2.events[index2][1].type === "paragraph"; - break; + function tagCloseStart(code2) { + if (asciiAlpha(code2)) { + effects.consume(code2); + return tagClose; } + return nok(code2); } - return start3; - function start3(code2) { - if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph2)) { - effects.enter("setextHeadingLine"); - effects.enter("setextHeadingLineSequence"); - marker = code2; - return closingSequence(code2); + function tagClose(code2) { + if (code2 === 45 || asciiAlphanumeric(code2)) { + effects.consume(code2); + return tagClose; } - return nok(code2); + return tagCloseBetween(code2); } - function closingSequence(code2) { - if (code2 === marker) { + function tagCloseBetween(code2) { + if (markdownLineEnding(code2)) { + returnState = tagCloseBetween; + return lineEndingBefore(code2); + } + if (markdownSpace(code2)) { effects.consume(code2); - return closingSequence; + return tagCloseBetween; } - effects.exit("setextHeadingLineSequence"); - return factorySpace(effects, closingSequenceEnd, "lineSuffix")(code2); + return end(code2); } - function closingSequenceEnd(code2) { - if (code2 === null || markdownLineEnding(code2)) { - effects.exit("setextHeadingLine"); - return ok2(code2); + function tagOpen(code2) { + if (code2 === 45 || asciiAlphanumeric(code2)) { + effects.consume(code2); + return tagOpen; + } + if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) { + return tagOpenBetween(code2); } return nok(code2); } -} - -// node_modules/micromark-extension-mdxjs-esm/lib/syntax.js -var nextBlankConstruct2 = { - tokenize: tokenizeNextBlank2, - partial: true -}; -var allowedAcornTypes = /* @__PURE__ */ new Set([ - "ExportAllDeclaration", - "ExportDefaultDeclaration", - "ExportNamedDeclaration", - "ImportDeclaration" -]); -function mdxjsEsm(options) { - const exportImportConstruct = { - tokenize: tokenizeExportImport, - concrete: true - }; - if (!options || !options.acorn || !options.acorn.parse) { - throw new Error("Expected an `acorn` instance passed in as `options.acorn`"); + function tagOpenBetween(code2) { + if (code2 === 47) { + effects.consume(code2); + return end; + } + if (code2 === 58 || code2 === 95 || asciiAlpha(code2)) { + effects.consume(code2); + return tagOpenAttributeName; + } + if (markdownLineEnding(code2)) { + returnState = tagOpenBetween; + return lineEndingBefore(code2); + } + if (markdownSpace(code2)) { + effects.consume(code2); + return tagOpenBetween; + } + return end(code2); } - const acorn = options.acorn; - const acornOptions = Object.assign( - { - ecmaVersion: 2020, - sourceType: "module" - }, - options.acornOptions - ); - return { - flow: { - [101]: exportImportConstruct, - [105]: exportImportConstruct + function tagOpenAttributeName(code2) { + if (code2 === 45 || code2 === 46 || code2 === 58 || code2 === 95 || asciiAlphanumeric(code2)) { + effects.consume(code2); + return tagOpenAttributeName; } - }; - function tokenizeExportImport(effects, ok2, nok) { - const self2 = this; - const definedModuleSpecifiers = self2.parser.definedModuleSpecifiers || (self2.parser.definedModuleSpecifiers = []); - const eventStart = this.events.length + 1; - let index2 = 0; - let buffer2; - return self2.interrupt ? nok : start3; - function start3(code2) { - if (self2.now().column > 1) - return nok(code2); - buffer2 = code2 === 101 ? "export" : "import"; - effects.enter("mdxjsEsm"); - effects.enter("mdxjsEsmData"); - return keyword(code2); + return tagOpenAttributeNameAfter(code2); + } + function tagOpenAttributeNameAfter(code2) { + if (code2 === 61) { + effects.consume(code2); + return tagOpenAttributeValueBefore; } - function keyword(code2) { - if (code2 === buffer2.charCodeAt(index2++)) { - effects.consume(code2); - return index2 === buffer2.length ? after : keyword; - } - return nok(code2); + if (markdownLineEnding(code2)) { + returnState = tagOpenAttributeNameAfter; + return lineEndingBefore(code2); } - function after(code2) { - if (unicodeWhitespace(code2)) { - effects.consume(code2); - return rest; - } + if (markdownSpace(code2)) { + effects.consume(code2); + return tagOpenAttributeNameAfter; + } + return tagOpenBetween(code2); + } + function tagOpenAttributeValueBefore(code2) { + if (code2 === null || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96) { return nok(code2); } - function rest(code2) { - if (code2 === null) { - return atEndOfData(code2); - } - if (markdownLineEnding(code2)) { - return effects.check(nextBlankConstruct2, atEndOfData, atEol)(code2); - } + if (code2 === 34 || code2 === 39) { effects.consume(code2); - return rest; + marker = code2; + return tagOpenAttributeValueQuoted; } - function atEol(code2) { - effects.exit("mdxjsEsmData"); - return lineStart(code2); + if (markdownLineEnding(code2)) { + returnState = tagOpenAttributeValueBefore; + return lineEndingBefore(code2); } - function lineStart(code2) { - if (markdownLineEnding(code2)) { - effects.enter("lineEnding"); - effects.consume(code2); - effects.exit("lineEnding"); - return lineStart; - } - if (code2 === null) { - return atEnd(code2); - } - effects.enter("mdxjsEsmData"); - return rest(code2); + if (markdownSpace(code2)) { + effects.consume(code2); + return tagOpenAttributeValueBefore; } - function atEndOfData(code2) { - effects.exit("mdxjsEsmData"); - return atEnd(code2); + effects.consume(code2); + return tagOpenAttributeValueUnquoted; + } + function tagOpenAttributeValueQuoted(code2) { + if (code2 === marker) { + effects.consume(code2); + marker = void 0; + return tagOpenAttributeValueQuotedAfter; } - function atEnd(code2) { - let index3 = -1; - const result = eventsToAcorn(self2.events.slice(eventStart), { - acorn, - acornOptions, - prefix: definedModuleSpecifiers.length > 0 ? "var " + definedModuleSpecifiers.join(",") + "\n" : "" - }); - if (code2 !== null && result.swallow) { - return lineStart(code2); - } - if (result.error) { - throw new VFileMessage( - "Could not parse import/exports with acorn: " + String(result.error), - { - line: result.error.loc.line, - column: result.error.loc.column + 1, - offset: result.error.pos - }, - "micromark-extension-mdxjs-esm:acorn" - ); - } - if (definedModuleSpecifiers.length > 0) { - result.estree.body.shift(); - } - while (++index3 < result.estree.body.length) { - const node = result.estree.body[index3]; - if (!allowedAcornTypes.has(node.type)) { - throw new VFileMessage( - "Unexpected `" + node.type + "` in code: only import/exports are supported", - positionFromEstree(node), - "micromark-extension-mdxjs-esm:non-esm" - ); - } - if (node.type === "ImportDeclaration" && !self2.interrupt) { - let index4 = -1; - while (++index4 < node.specifiers.length) { - definedModuleSpecifiers.push(node.specifiers[index4].local.name); - } - } - } - Object.assign( - effects.exit("mdxjsEsm"), - options.addResult ? { - estree: result.estree - } : void 0 - ); - return ok2(code2); + if (code2 === null) { + return nok(code2); + } + if (markdownLineEnding(code2)) { + returnState = tagOpenAttributeValueQuoted; + return lineEndingBefore(code2); } + effects.consume(code2); + return tagOpenAttributeValueQuoted; } -} -function tokenizeNextBlank2(effects, ok2, nok) { - return start3; - function start3(code2) { - effects.exit("mdxjsEsmData"); - effects.enter("lineEndingBlank"); + function tagOpenAttributeValueUnquoted(code2) { + if (code2 === null || code2 === 34 || code2 === 39 || code2 === 60 || code2 === 61 || code2 === 96) { + return nok(code2); + } + if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) { + return tagOpenBetween(code2); + } effects.consume(code2); - effects.exit("lineEndingBlank"); - return effects.attempt(blankLine, ok2, nok); + return tagOpenAttributeValueUnquoted; } -} - -// node_modules/micromark-extension-mdxjs/index.js -function mdxjs(options) { - const settings = Object.assign( - { - acorn: Parser.extend((0, import_acorn_jsx.default)()), - acornOptions: { ecmaVersion: 2020, sourceType: "module" }, - addResult: true - }, - options - ); - return combineExtensions([ - mdxjsEsm(settings), - mdxExpression(settings), - mdxJsx(settings), - mdxMd - ]); -} - -// node_modules/mdast-util-mdx-expression/index.js -var mdxExpressionFromMarkdown = { - enter: { - mdxFlowExpression: enterMdxFlowExpression, - mdxTextExpression: enterMdxTextExpression - }, - exit: { - mdxFlowExpression: exitMdxExpression, - mdxFlowExpressionChunk: exitMdxExpressionData, - mdxTextExpression: exitMdxExpression, - mdxTextExpressionChunk: exitMdxExpressionData + function tagOpenAttributeValueQuotedAfter(code2) { + if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) { + return tagOpenBetween(code2); + } + return nok(code2); } -}; -var mdxExpressionToMarkdown = { - handlers: { - mdxFlowExpression: handleMdxExpression, - mdxTextExpression: handleMdxExpression - }, - unsafe: [ - { character: "{", inConstruct: ["phrasing"] }, - { atBreak: true, character: "{" } - ] -}; -function enterMdxFlowExpression(token) { - this.enter({ type: "mdxFlowExpression", value: "" }, token); - this.buffer(); -} -function enterMdxTextExpression(token) { - this.enter({ type: "mdxTextExpression", value: "" }, token); - this.buffer(); -} -function exitMdxExpression(token) { - const value = this.resume(); - const estree = token.estree; - const node = this.exit(token); - node.value = value; - if (estree) { - node.data = { estree }; + function end(code2) { + if (code2 === 62) { + effects.consume(code2); + effects.exit("htmlTextData"); + effects.exit("htmlText"); + return ok3; + } + return nok(code2); } -} -function exitMdxExpressionData(token) { - this.config.enter.data.call(this, token); - this.config.exit.data.call(this, token); -} -function handleMdxExpression(node) { - const value = node.value || ""; - return "{" + value + "}"; -} - -// node_modules/mdast-util-mdx-jsx/node_modules/ccount/index.js -function ccount(value, character) { - const source = String(value); - if (typeof character !== "string") { - throw new TypeError("Expected character"); + function lineEndingBefore(code2) { + effects.exit("htmlTextData"); + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return lineEndingAfter; } - let count = 0; - let index2 = source.indexOf(character); - while (index2 !== -1) { - count++; - index2 = source.indexOf(character, index2 + character.length); + function lineEndingAfter(code2) { + return markdownSpace(code2) ? factorySpace( + effects, + lineEndingAfterPrefix, + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code2) : lineEndingAfterPrefix(code2); + } + function lineEndingAfterPrefix(code2) { + effects.enter("htmlTextData"); + return returnState(code2); } - return count; } -// node_modules/parse-entities/node_modules/character-entities-legacy/index.js -var characterEntitiesLegacy = [ - "AElig", - "AMP", - "Aacute", - "Acirc", - "Agrave", - "Aring", - "Atilde", - "Auml", - "COPY", - "Ccedil", - "ETH", - "Eacute", - "Ecirc", - "Egrave", - "Euml", - "GT", - "Iacute", - "Icirc", - "Igrave", - "Iuml", - "LT", - "Ntilde", - "Oacute", - "Ocirc", - "Ograve", - "Oslash", - "Otilde", - "Ouml", - "QUOT", - "REG", - "THORN", - "Uacute", - "Ucirc", - "Ugrave", - "Uuml", - "Yacute", - "aacute", - "acirc", - "acute", - "aelig", - "agrave", - "amp", - "aring", - "atilde", - "auml", - "brvbar", - "ccedil", - "cedil", - "cent", - "copy", - "curren", - "deg", - "divide", - "eacute", - "ecirc", - "egrave", - "eth", - "euml", - "frac12", - "frac14", - "frac34", - "gt", - "iacute", - "icirc", - "iexcl", - "igrave", - "iquest", - "iuml", - "laquo", - "lt", - "macr", - "micro", - "middot", - "nbsp", - "not", - "ntilde", - "oacute", - "ocirc", - "ograve", - "ordf", - "ordm", - "oslash", - "otilde", - "ouml", - "para", - "plusmn", - "pound", - "quot", - "raquo", - "reg", - "sect", - "shy", - "sup1", - "sup2", - "sup3", - "szlig", - "thorn", - "times", - "uacute", - "ucirc", - "ugrave", - "uml", - "uuml", - "yacute", - "yen", - "yuml" -]; - -// node_modules/character-reference-invalid/index.js -var characterReferenceInvalid = { - 0: "\uFFFD", - 128: "\u20AC", - 130: "\u201A", - 131: "\u0192", - 132: "\u201E", - 133: "\u2026", - 134: "\u2020", - 135: "\u2021", - 136: "\u02C6", - 137: "\u2030", - 138: "\u0160", - 139: "\u2039", - 140: "\u0152", - 142: "\u017D", - 145: "\u2018", - 146: "\u2019", - 147: "\u201C", - 148: "\u201D", - 149: "\u2022", - 150: "\u2013", - 151: "\u2014", - 152: "\u02DC", - 153: "\u2122", - 154: "\u0161", - 155: "\u203A", - 156: "\u0153", - 158: "\u017E", - 159: "\u0178" +// node_modules/micromark-core-commonmark/lib/label-end.js +var labelEnd = { + name: "labelEnd", + tokenize: tokenizeLabelEnd, + resolveTo: resolveToLabelEnd, + resolveAll: resolveAllLabelEnd }; - -// node_modules/parse-entities/node_modules/is-decimal/index.js -function isDecimal(character) { - const code2 = typeof character === "string" ? character.charCodeAt(0) : character; - return code2 >= 48 && code2 <= 57; -} - -// node_modules/is-hexadecimal/index.js -function isHexadecimal(character) { - const code2 = typeof character === "string" ? character.charCodeAt(0) : character; - return code2 >= 97 && code2 <= 102 || code2 >= 65 && code2 <= 70 || code2 >= 48 && code2 <= 57; -} - -// node_modules/is-alphanumerical/node_modules/is-alphabetical/index.js -function isAlphabetical(character) { - const code2 = typeof character === "string" ? character.charCodeAt(0) : character; - return code2 >= 97 && code2 <= 122 || code2 >= 65 && code2 <= 90; -} - -// node_modules/is-alphanumerical/node_modules/is-decimal/index.js -function isDecimal2(character) { - const code2 = typeof character === "string" ? character.charCodeAt(0) : character; - return code2 >= 48 && code2 <= 57; -} - -// node_modules/is-alphanumerical/index.js -function isAlphanumerical(character) { - return isAlphabetical(character) || isDecimal2(character); -} - -// node_modules/parse-entities/lib/index.js -var fromCharCode = String.fromCharCode; -var messages = [ - "", - "Named character references must be terminated by a semicolon", - "Numeric character references must be terminated by a semicolon", - "Named character references cannot be empty", - "Numeric character references cannot be empty", - "Named character references must be known", - "Numeric character references cannot be disallowed", - "Numeric character references cannot be outside the permissible Unicode range" -]; -function parseEntities(value, options = {}) { - const additional = typeof options.additional === "string" ? options.additional.charCodeAt(0) : options.additional; - const result = []; - let index2 = 0; - let lines = -1; - let queue = ""; - let point3; - let indent; - if (options.position) { - if ("start" in options.position || "indent" in options.position) { - indent = options.position.indent; - point3 = options.position.start; - } else { - point3 = options.position; +var resourceConstruct = { + tokenize: tokenizeResource +}; +var referenceFullConstruct = { + tokenize: tokenizeReferenceFull +}; +var referenceCollapsedConstruct = { + tokenize: tokenizeReferenceCollapsed +}; +function resolveAllLabelEnd(events) { + let index2 = -1; + while (++index2 < events.length) { + const token = events[index2][1]; + if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { + events.splice(index2 + 1, token.type === "labelImage" ? 4 : 2); + token.type = "data"; + index2++; } } - let line = (point3 ? point3.line : 0) || 1; - let column = (point3 ? point3.column : 0) || 1; - let previous2 = now(); - let character; - index2--; - while (++index2 <= value.length) { - if (character === 10) { - column = (indent ? indent[lines] : 0) || 1; - } - character = value.charCodeAt(index2); - if (character === 38) { - const following = value.charCodeAt(index2 + 1); - if (following === 9 || following === 10 || following === 12 || following === 32 || following === 38 || following === 60 || Number.isNaN(following) || additional && following === additional) { - queue += fromCharCode(character); - column++; - continue; + return events; +} +function resolveToLabelEnd(events, context) { + let index2 = events.length; + let offset2 = 0; + let token; + let open; + let close; + let media; + while (index2--) { + token = events[index2][1]; + if (open) { + if (token.type === "link" || token.type === "labelLink" && token._inactive) { + break; } - const start3 = index2 + 1; - let begin = start3; - let end = start3; - let type; - if (following === 35) { - end = ++begin; - const following2 = value.charCodeAt(end); - if (following2 === 88 || following2 === 120) { - type = "hexadecimal"; - end = ++begin; - } else { - type = "decimal"; - } - } else { - type = "named"; + if (events[index2][0] === "enter" && token.type === "labelLink") { + token._inactive = true; } - let characterReferenceCharacters = ""; - let characterReference2 = ""; - let characters = ""; - const test = type === "named" ? isAlphanumerical : type === "decimal" ? isDecimal : isHexadecimal; - end--; - while (++end <= value.length) { - const following2 = value.charCodeAt(end); - if (!test(following2)) { + } else if (close) { + if (events[index2][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) { + open = index2; + if (token.type !== "labelLink") { + offset2 = 2; break; } - characters += fromCharCode(following2); - if (type === "named" && characterEntitiesLegacy.includes(characters)) { - characterReferenceCharacters = characters; - characterReference2 = decodeNamedCharacterReference(characters); - } - } - let terminated = value.charCodeAt(end) === 59; - if (terminated) { - end++; - const namedReference = type === "named" ? decodeNamedCharacterReference(characters) : false; - if (namedReference) { - characterReferenceCharacters = characters; - characterReference2 = namedReference; - } - } - let diff = 1 + end - start3; - let reference = ""; - if (!terminated && options.nonTerminated === false) { - } else if (!characters) { - if (type !== "named") { - warning(4, diff); - } - } else if (type === "named") { - if (terminated && !characterReference2) { - warning(5, 1); - } else { - if (characterReferenceCharacters !== characters) { - end = begin + characterReferenceCharacters.length; - diff = 1 + end - begin; - terminated = false; - } - if (!terminated) { - const reason = characterReferenceCharacters ? 1 : 3; - if (options.attribute) { - const following2 = value.charCodeAt(end); - if (following2 === 61) { - warning(reason, diff); - characterReference2 = ""; - } else if (isAlphanumerical(following2)) { - characterReference2 = ""; - } else { - warning(reason, diff); - } - } else { - warning(reason, diff); - } - } - } - reference = characterReference2; - } else { - if (!terminated) { - warning(2, diff); - } - let referenceCode = Number.parseInt( - characters, - type === "hexadecimal" ? 16 : 10 - ); - if (prohibited(referenceCode)) { - warning(7, diff); - reference = fromCharCode(65533); - } else if (referenceCode in characterReferenceInvalid) { - warning(6, diff); - reference = characterReferenceInvalid[referenceCode]; - } else { - let output = ""; - if (disallowed(referenceCode)) { - warning(6, diff); - } - if (referenceCode > 65535) { - referenceCode -= 65536; - output += fromCharCode(referenceCode >>> (10 & 1023) | 55296); - referenceCode = 56320 | referenceCode & 1023; - } - reference = output + fromCharCode(referenceCode); - } - } - if (reference) { - flush(); - previous2 = now(); - index2 = end - 1; - column += end - start3 + 1; - result.push(reference); - const next = now(); - next.offset++; - if (options.reference) { - options.reference.call( - options.referenceContext, - reference, - { start: previous2, end: next }, - value.slice(start3 - 1, end) - ); - } - previous2 = next; - } else { - characters = value.slice(start3 - 1, end); - queue += characters; - column += characters.length; - index2 = end - 1; - } - } else { - if (character === 10) { - line++; - lines++; - column = 0; - } - if (Number.isNaN(character)) { - flush(); - } else { - queue += fromCharCode(character); - column++; } + } else if (token.type === "labelEnd") { + close = index2; } } - return result.join(""); - function now() { - return { - line, - column, - offset: index2 + ((point3 ? point3.offset : 0) || 0) - }; + const group = { + type: events[open][1].type === "labelLink" ? "link" : "image", + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[events.length - 1][1].end) + }; + const label = { + type: "label", + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[close][1].end) + }; + const text5 = { + type: "labelText", + start: Object.assign({}, events[open + offset2 + 2][1].end), + end: Object.assign({}, events[close - 2][1].start) + }; + media = [ + ["enter", group, context], + ["enter", label, context] + ]; + media = push(media, events.slice(open + 1, open + offset2 + 3)); + media = push(media, [["enter", text5, context]]); + media = push( + media, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + offset2 + 4, close - 3), + context + ) + ); + media = push(media, [ + ["exit", text5, context], + events[close - 2], + events[close - 1], + ["exit", label, context] + ]); + media = push(media, events.slice(close + 1)); + media = push(media, [["exit", group, context]]); + splice(events, open, events.length, media); + return events; +} +function tokenizeLabelEnd(effects, ok3, nok) { + const self2 = this; + let index2 = self2.events.length; + let labelStart; + let defined; + while (index2--) { + if ((self2.events[index2][1].type === "labelImage" || self2.events[index2][1].type === "labelLink") && !self2.events[index2][1]._balanced) { + labelStart = self2.events[index2][1]; + break; + } } - function warning(code2, offset2) { - let position3; - if (options.warning) { - position3 = now(); - position3.column += offset2; - position3.offset += offset2; - options.warning.call( - options.warningContext, - messages[code2], - position3, - code2 - ); + return start2; + function start2(code2) { + if (!labelStart) { + return nok(code2); + } + if (labelStart._inactive) { + return labelEndNok(code2); + } + defined = self2.parser.defined.includes( + normalizeIdentifier( + self2.sliceSerialize({ + start: labelStart.end, + end: self2.now() + }) + ) + ); + effects.enter("labelEnd"); + effects.enter("labelMarker"); + effects.consume(code2); + effects.exit("labelMarker"); + effects.exit("labelEnd"); + return after; + } + function after(code2) { + if (code2 === 40) { + return effects.attempt( + resourceConstruct, + labelEndOk, + defined ? labelEndOk : labelEndNok + )(code2); + } + if (code2 === 91) { + return effects.attempt( + referenceFullConstruct, + labelEndOk, + defined ? referenceNotFull : labelEndNok + )(code2); + } + return defined ? labelEndOk(code2) : labelEndNok(code2); + } + function referenceNotFull(code2) { + return effects.attempt( + referenceCollapsedConstruct, + labelEndOk, + labelEndNok + )(code2); + } + function labelEndOk(code2) { + return ok3(code2); + } + function labelEndNok(code2) { + labelStart._balanced = true; + return nok(code2); + } +} +function tokenizeResource(effects, ok3, nok) { + return resourceStart; + function resourceStart(code2) { + effects.enter("resource"); + effects.enter("resourceMarker"); + effects.consume(code2); + effects.exit("resourceMarker"); + return resourceBefore; + } + function resourceBefore(code2) { + return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceOpen)(code2) : resourceOpen(code2); + } + function resourceOpen(code2) { + if (code2 === 41) { + return resourceEnd(code2); + } + return factoryDestination( + effects, + resourceDestinationAfter, + resourceDestinationMissing, + "resourceDestination", + "resourceDestinationLiteral", + "resourceDestinationLiteralMarker", + "resourceDestinationRaw", + "resourceDestinationString", + 32 + )(code2); + } + function resourceDestinationAfter(code2) { + return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceBetween)(code2) : resourceEnd(code2); + } + function resourceDestinationMissing(code2) { + return nok(code2); + } + function resourceBetween(code2) { + if (code2 === 34 || code2 === 39 || code2 === 40) { + return factoryTitle( + effects, + resourceTitleAfter, + nok, + "resourceTitle", + "resourceTitleMarker", + "resourceTitleString" + )(code2); } + return resourceEnd(code2); } - function flush() { - if (queue) { - result.push(queue); - if (options.text) { - options.text.call(options.textContext, queue, { - start: previous2, - end: now() - }); - } - queue = ""; + function resourceTitleAfter(code2) { + return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects, resourceEnd)(code2) : resourceEnd(code2); + } + function resourceEnd(code2) { + if (code2 === 41) { + effects.enter("resourceMarker"); + effects.consume(code2); + effects.exit("resourceMarker"); + effects.exit("resource"); + return ok3; } + return nok(code2); } } -function prohibited(code2) { - return code2 >= 55296 && code2 <= 57343 || code2 > 1114111; -} -function disallowed(code2) { - return code2 >= 1 && code2 <= 8 || code2 === 11 || code2 >= 13 && code2 <= 31 || code2 >= 127 && code2 <= 159 || code2 >= 64976 && code2 <= 65007 || (code2 & 65535) === 65535 || (code2 & 65535) === 65534; -} - -// node_modules/mdast-util-mdx-jsx/node_modules/stringify-entities/lib/core.js -function core(value, options) { - value = value.replace( - options.subset ? charactersToExpression(options.subset) : /["&'<>`]/g, - basic - ); - if (options.subset || options.escapeOnly) { - return value; +function tokenizeReferenceFull(effects, ok3, nok) { + const self2 = this; + return referenceFull; + function referenceFull(code2) { + return factoryLabel.call( + self2, + effects, + referenceFullAfter, + referenceFullMissing, + "reference", + "referenceMarker", + "referenceString" + )(code2); } - return value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, surrogate).replace( - /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, - basic - ); - function surrogate(pair, index2, all4) { - return options.format( - (pair.charCodeAt(0) - 55296) * 1024 + pair.charCodeAt(1) - 56320 + 65536, - all4.charCodeAt(index2 + 2), - options - ); + function referenceFullAfter(code2) { + return self2.parser.defined.includes( + normalizeIdentifier( + self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1) + ) + ) ? ok3(code2) : nok(code2); } - function basic(character, index2, all4) { - return options.format( - character.charCodeAt(0), - all4.charCodeAt(index2 + 1), - options - ); + function referenceFullMissing(code2) { + return nok(code2); } } -function charactersToExpression(subset) { - const groups = []; - let index2 = -1; - while (++index2 < subset.length) { - groups.push(subset[index2].replace(/[|\\{}()[\]^$+*?.]/g, "\\$&")); +function tokenizeReferenceCollapsed(effects, ok3, nok) { + return referenceCollapsedStart; + function referenceCollapsedStart(code2) { + effects.enter("reference"); + effects.enter("referenceMarker"); + effects.consume(code2); + effects.exit("referenceMarker"); + return referenceCollapsedOpen; } - return new RegExp("(?:" + groups.join("|") + ")", "g"); -} - -// node_modules/mdast-util-mdx-jsx/node_modules/stringify-entities/lib/util/format-basic.js -function formatBasic(code2) { - return "&#x" + code2.toString(16).toUpperCase() + ";"; -} - -// node_modules/mdast-util-mdx-jsx/node_modules/stringify-entities/lib/index.js -function stringifyEntitiesLight(value, options) { - return core(value, Object.assign({ format: formatBasic }, options)); -} - -// node_modules/mdast-util-to-markdown/lib/util/track.js -function track(options_) { - const options = options_ || {}; - const now = options.now || {}; - let lineShift = options.lineShift || 0; - let line = now.line || 1; - let column = now.column || 1; - return { move, current: current2, shift }; - function current2() { - return { now: { line, column }, lineShift }; - } - function shift(value) { - lineShift += value; - } - function move(value = "") { - const chunks = value.split(/\r?\n|\r/g); - const tail = chunks[chunks.length - 1]; - line += chunks.length - 1; - column = chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift; - return value; + function referenceCollapsedOpen(code2) { + if (code2 === 93) { + effects.enter("referenceMarker"); + effects.consume(code2); + effects.exit("referenceMarker"); + effects.exit("reference"); + return ok3; + } + return nok(code2); } } -// node_modules/mdast-util-to-markdown/lib/util/container-flow.js -function containerFlow(parent, context, safeOptions) { - const indexStack = context.indexStack; - const children = parent.children || []; - const tracker = track(safeOptions); - const results = []; - let index2 = -1; - indexStack.push(-1); - while (++index2 < children.length) { - const child = children[index2]; - indexStack[indexStack.length - 1] = index2; - results.push( - tracker.move( - context.handle(child, parent, context, { - before: "\n", - after: "\n", - ...tracker.current() - }) - ) - ); - if (child.type !== "list") { - context.bulletLastUsed = void 0; - } - if (index2 < children.length - 1) { - results.push(tracker.move(between(child, children[index2 + 1]))); - } +// node_modules/micromark-core-commonmark/lib/label-start-image.js +var labelStartImage = { + name: "labelStartImage", + tokenize: tokenizeLabelStartImage, + resolveAll: labelEnd.resolveAll +}; +function tokenizeLabelStartImage(effects, ok3, nok) { + const self2 = this; + return start2; + function start2(code2) { + effects.enter("labelImage"); + effects.enter("labelImageMarker"); + effects.consume(code2); + effects.exit("labelImageMarker"); + return open; } - indexStack.pop(); - return results.join(""); - function between(left, right) { - let index3 = context.join.length; - while (index3--) { - const result = context.join[index3](left, right, parent, context); - if (result === true || result === 1) { - break; - } - if (typeof result === "number") { - return "\n".repeat(1 + result); - } - if (result === false) { - return "\n\n\n\n"; - } + function open(code2) { + if (code2 === 91) { + effects.enter("labelMarker"); + effects.consume(code2); + effects.exit("labelMarker"); + effects.exit("labelImage"); + return after; } - return "\n\n"; + return nok(code2); + } + function after(code2) { + return code2 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok3(code2); } } -// node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js -function containerPhrasing(parent, context, safeOptions) { - const indexStack = context.indexStack; - const children = parent.children || []; - const results = []; - let index2 = -1; - let before = safeOptions.before; - indexStack.push(-1); - let tracker = track(safeOptions); - while (++index2 < children.length) { - const child = children[index2]; - let after; - indexStack[indexStack.length - 1] = index2; - if (index2 + 1 < children.length) { - let handle = context.handle.handlers[children[index2 + 1].type]; - if (handle && handle.peek) - handle = handle.peek; - after = handle ? handle(children[index2 + 1], parent, context, { - before: "", - after: "", - ...tracker.current() - }).charAt(0) : ""; - } else { - after = safeOptions.after; - } - if (results.length > 0 && (before === "\r" || before === "\n") && child.type === "html") { - results[results.length - 1] = results[results.length - 1].replace( - /(\r?\n|\r)$/, - " " - ); - before = " "; - tracker = track(safeOptions); - tracker.move(results.join("")); - } - results.push( - tracker.move( - context.handle(child, parent, context, { - ...tracker.current(), - before, - after - }) - ) - ); - before = results[results.length - 1].slice(-1); +// node_modules/micromark-core-commonmark/lib/label-start-link.js +var labelStartLink = { + name: "labelStartLink", + tokenize: tokenizeLabelStartLink, + resolveAll: labelEnd.resolveAll +}; +function tokenizeLabelStartLink(effects, ok3, nok) { + const self2 = this; + return start2; + function start2(code2) { + effects.enter("labelLink"); + effects.enter("labelMarker"); + effects.consume(code2); + effects.exit("labelMarker"); + effects.exit("labelLink"); + return after; + } + function after(code2) { + return code2 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok3(code2); } - indexStack.pop(); - return results.join(""); } -// node_modules/mdast-util-to-markdown/lib/util/indent-lines.js -var eol = /\r?\n|\r/g; -function indentLines(value, map) { - const result = []; - let start3 = 0; - let line = 0; - let match; - while (match = eol.exec(value)) { - one3(value.slice(start3, match.index)); - result.push(match[0]); - start3 = match.index + match[0].length; - line++; - } - one3(value.slice(start3)); - return result.join(""); - function one3(value2) { - result.push(map(value2, line, !value2)); +// node_modules/micromark-core-commonmark/lib/line-ending.js +var lineEnding = { + name: "lineEnding", + tokenize: tokenizeLineEnding +}; +function tokenizeLineEnding(effects, ok3) { + return start2; + function start2(code2) { + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return factorySpace(effects, ok3, "linePrefix"); } } -// node_modules/mdast-util-mdx-jsx/lib/index.js -function mdxJsxFromMarkdown() { - return { - canContainEols: ["mdxJsxTextElement"], - enter: { - mdxJsxFlowTag: enterMdxJsxTag, - mdxJsxFlowTagClosingMarker: enterMdxJsxTagClosingMarker, - mdxJsxFlowTagAttribute: enterMdxJsxTagAttribute, - mdxJsxFlowTagExpressionAttribute: enterMdxJsxTagExpressionAttribute, - mdxJsxFlowTagAttributeValueLiteral: buffer2, - mdxJsxFlowTagAttributeValueExpression: buffer2, - mdxJsxFlowTagSelfClosingMarker: enterMdxJsxTagSelfClosingMarker, - mdxJsxTextTag: enterMdxJsxTag, - mdxJsxTextTagClosingMarker: enterMdxJsxTagClosingMarker, - mdxJsxTextTagAttribute: enterMdxJsxTagAttribute, - mdxJsxTextTagExpressionAttribute: enterMdxJsxTagExpressionAttribute, - mdxJsxTextTagAttributeValueLiteral: buffer2, - mdxJsxTextTagAttributeValueExpression: buffer2, - mdxJsxTextTagSelfClosingMarker: enterMdxJsxTagSelfClosingMarker - }, - exit: { - mdxJsxFlowTagClosingMarker: exitMdxJsxTagClosingMarker, - mdxJsxFlowTagNamePrimary: exitMdxJsxTagNamePrimary, - mdxJsxFlowTagNameMember: exitMdxJsxTagNameMember, - mdxJsxFlowTagNameLocal: exitMdxJsxTagNameLocal, - mdxJsxFlowTagExpressionAttribute: exitMdxJsxTagExpressionAttribute, - mdxJsxFlowTagExpressionAttributeValue: data2, - mdxJsxFlowTagAttributeNamePrimary: exitMdxJsxTagAttributeNamePrimary, - mdxJsxFlowTagAttributeNameLocal: exitMdxJsxTagAttributeNameLocal, - mdxJsxFlowTagAttributeValueLiteral: exitMdxJsxTagAttributeValueLiteral, - mdxJsxFlowTagAttributeValueLiteralValue: data2, - mdxJsxFlowTagAttributeValueExpression: exitMdxJsxTagAttributeValueExpression, - mdxJsxFlowTagAttributeValueExpressionValue: data2, - mdxJsxFlowTagSelfClosingMarker: exitMdxJsxTagSelfClosingMarker, - mdxJsxFlowTag: exitMdxJsxTag, - mdxJsxTextTagClosingMarker: exitMdxJsxTagClosingMarker, - mdxJsxTextTagNamePrimary: exitMdxJsxTagNamePrimary, - mdxJsxTextTagNameMember: exitMdxJsxTagNameMember, - mdxJsxTextTagNameLocal: exitMdxJsxTagNameLocal, - mdxJsxTextTagExpressionAttribute: exitMdxJsxTagExpressionAttribute, - mdxJsxTextTagExpressionAttributeValue: data2, - mdxJsxTextTagAttributeNamePrimary: exitMdxJsxTagAttributeNamePrimary, - mdxJsxTextTagAttributeNameLocal: exitMdxJsxTagAttributeNameLocal, - mdxJsxTextTagAttributeValueLiteral: exitMdxJsxTagAttributeValueLiteral, - mdxJsxTextTagAttributeValueLiteralValue: data2, - mdxJsxTextTagAttributeValueExpression: exitMdxJsxTagAttributeValueExpression, - mdxJsxTextTagAttributeValueExpressionValue: data2, - mdxJsxTextTagSelfClosingMarker: exitMdxJsxTagSelfClosingMarker, - mdxJsxTextTag: exitMdxJsxTag - } - }; - function buffer2() { - this.buffer(); - } - function data2(token) { - this.config.enter.data.call(this, token); - this.config.exit.data.call(this, token); +// node_modules/micromark-core-commonmark/lib/thematic-break.js +var thematicBreak = { + name: "thematicBreak", + tokenize: tokenizeThematicBreak +}; +function tokenizeThematicBreak(effects, ok3, nok) { + let size = 0; + let marker; + return start2; + function start2(code2) { + effects.enter("thematicBreak"); + return before(code2); } - function enterMdxJsxTag(token) { - const tag = { name: null, attributes: [], start: token.start, end: token.end }; - if (!this.getData("mdxJsxTagStack")) - this.setData("mdxJsxTagStack", []); - this.setData("mdxJsxTag", tag); - this.buffer(); + function before(code2) { + marker = code2; + return atBreak(code2); } - function enterMdxJsxTagClosingMarker(token) { - const stack = this.getData("mdxJsxTagStack"); - if (stack.length === 0) { - throw new VFileMessage( - "Unexpected closing slash `/` in tag, expected an open tag first", - { start: token.start, end: token.end }, - "mdast-util-mdx-jsx:unexpected-closing-slash" - ); + function atBreak(code2) { + if (code2 === marker) { + effects.enter("thematicBreakSequence"); + return sequence(code2); } + if (size >= 3 && (code2 === null || markdownLineEnding(code2))) { + effects.exit("thematicBreak"); + return ok3(code2); + } + return nok(code2); } - function enterMdxJsxTagAnyAttribute(token) { - const tag = this.getData("mdxJsxTag"); - if (tag.close) { - throw new VFileMessage( - "Unexpected attribute in closing tag, expected the end of the tag", - { start: token.start, end: token.end }, - "mdast-util-mdx-jsx:unexpected-attribute" - ); + function sequence(code2) { + if (code2 === marker) { + effects.consume(code2); + size++; + return sequence; } + effects.exit("thematicBreakSequence"); + return markdownSpace(code2) ? factorySpace(effects, atBreak, "whitespace")(code2) : atBreak(code2); } - function enterMdxJsxTagSelfClosingMarker(token) { - const tag = this.getData("mdxJsxTag"); - if (tag.close) { - throw new VFileMessage( - "Unexpected self-closing slash `/` in closing tag, expected the end of the tag", - { start: token.start, end: token.end }, - "mdast-util-mdx-jsx:unexpected-self-closing-slash" - ); +} + +// node_modules/micromark-core-commonmark/lib/list.js +var list = { + name: "list", + tokenize: tokenizeListStart, + continuation: { + tokenize: tokenizeListContinuation + }, + exit: tokenizeListEnd +}; +var listItemPrefixWhitespaceConstruct = { + tokenize: tokenizeListItemPrefixWhitespace, + partial: true +}; +var indentConstruct = { + tokenize: tokenizeIndent, + partial: true +}; +function tokenizeListStart(effects, ok3, nok) { + const self2 = this; + const tail = self2.events[self2.events.length - 1]; + let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + let size = 0; + return start2; + function start2(code2) { + const kind = self2.containerState.type || (code2 === 42 || code2 === 43 || code2 === 45 ? "listUnordered" : "listOrdered"); + if (kind === "listUnordered" ? !self2.containerState.marker || code2 === self2.containerState.marker : asciiDigit(code2)) { + if (!self2.containerState.type) { + self2.containerState.type = kind; + effects.enter(kind, { + _container: true + }); + } + if (kind === "listUnordered") { + effects.enter("listItemPrefix"); + return code2 === 42 || code2 === 45 ? effects.check(thematicBreak, nok, atMarker)(code2) : atMarker(code2); + } + if (!self2.interrupt || code2 === 49) { + effects.enter("listItemPrefix"); + effects.enter("listItemValue"); + return inside(code2); + } } + return nok(code2); } - function exitMdxJsxTagClosingMarker() { - const tag = this.getData("mdxJsxTag"); - tag.close = true; + function inside(code2) { + if (asciiDigit(code2) && ++size < 10) { + effects.consume(code2); + return inside; + } + if ((!self2.interrupt || size < 2) && (self2.containerState.marker ? code2 === self2.containerState.marker : code2 === 41 || code2 === 46)) { + effects.exit("listItemValue"); + return atMarker(code2); + } + return nok(code2); } - function exitMdxJsxTagNamePrimary(token) { - const tag = this.getData("mdxJsxTag"); - tag.name = this.sliceSerialize(token); + function atMarker(code2) { + effects.enter("listItemMarker"); + effects.consume(code2); + effects.exit("listItemMarker"); + self2.containerState.marker = self2.containerState.marker || code2; + return effects.check( + blankLine, + // Can’t be empty when interrupting. + self2.interrupt ? nok : onBlank, + effects.attempt( + listItemPrefixWhitespaceConstruct, + endOfPrefix, + otherPrefix + ) + ); } - function exitMdxJsxTagNameMember(token) { - const tag = this.getData("mdxJsxTag"); - tag.name += "." + this.sliceSerialize(token); + function onBlank(code2) { + self2.containerState.initialBlankLine = true; + initialSize++; + return endOfPrefix(code2); } - function exitMdxJsxTagNameLocal(token) { - const tag = this.getData("mdxJsxTag"); - tag.name += ":" + this.sliceSerialize(token); + function otherPrefix(code2) { + if (markdownSpace(code2)) { + effects.enter("listItemPrefixWhitespace"); + effects.consume(code2); + effects.exit("listItemPrefixWhitespace"); + return endOfPrefix; + } + return nok(code2); } - function enterMdxJsxTagAttribute(token) { - const tag = this.getData("mdxJsxTag"); - enterMdxJsxTagAnyAttribute.call(this, token); - tag.attributes.push({ type: "mdxJsxAttribute", name: "", value: null }); + function endOfPrefix(code2) { + self2.containerState.size = initialSize + self2.sliceSerialize(effects.exit("listItemPrefix"), true).length; + return ok3(code2); } - function enterMdxJsxTagExpressionAttribute(token) { - const tag = this.getData("mdxJsxTag"); - enterMdxJsxTagAnyAttribute.call(this, token); - tag.attributes.push({ type: "mdxJsxExpressionAttribute", value: "" }); - this.buffer(); +} +function tokenizeListContinuation(effects, ok3, nok) { + const self2 = this; + self2.containerState._closeFlow = void 0; + return effects.check(blankLine, onBlank, notBlank); + function onBlank(code2) { + self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine; + return factorySpace( + effects, + ok3, + "listItemIndent", + self2.containerState.size + 1 + )(code2); } - function exitMdxJsxTagExpressionAttribute(token) { - const tag = this.getData("mdxJsxTag"); - const tail = tag.attributes[tag.attributes.length - 1]; - const estree = token.estree; - tail.value = this.resume(); - if (estree) { - tail.data = { estree }; + function notBlank(code2) { + if (self2.containerState.furtherBlankLines || !markdownSpace(code2)) { + self2.containerState.furtherBlankLines = void 0; + self2.containerState.initialBlankLine = void 0; + return notInCurrentItem(code2); } + self2.containerState.furtherBlankLines = void 0; + self2.containerState.initialBlankLine = void 0; + return effects.attempt(indentConstruct, ok3, notInCurrentItem)(code2); } - function exitMdxJsxTagAttributeNamePrimary(token) { - const tag = this.getData("mdxJsxTag"); - const node = tag.attributes[tag.attributes.length - 1]; - node.name = this.sliceSerialize(token); + function notInCurrentItem(code2) { + self2.containerState._closeFlow = true; + self2.interrupt = void 0; + return factorySpace( + effects, + effects.attempt(list, ok3, nok), + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code2); } - function exitMdxJsxTagAttributeNameLocal(token) { - const tag = this.getData("mdxJsxTag"); - const node = tag.attributes[tag.attributes.length - 1]; - node.name += ":" + this.sliceSerialize(token); +} +function tokenizeIndent(effects, ok3, nok) { + const self2 = this; + return factorySpace( + effects, + afterPrefix, + "listItemIndent", + self2.containerState.size + 1 + ); + function afterPrefix(code2) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok3(code2) : nok(code2); } - function exitMdxJsxTagAttributeValueLiteral() { - const tag = this.getData("mdxJsxTag"); - tag.attributes[tag.attributes.length - 1].value = parseEntities( - this.resume(), - { nonTerminated: false } - ); +} +function tokenizeListEnd(effects) { + effects.exit(this.containerState.type); +} +function tokenizeListItemPrefixWhitespace(effects, ok3, nok) { + const self2 = this; + return factorySpace( + effects, + afterPrefix, + "listItemPrefixWhitespace", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1 + ); + function afterPrefix(code2) { + const tail = self2.events[self2.events.length - 1]; + return !markdownSpace(code2) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok3(code2) : nok(code2); } - function exitMdxJsxTagAttributeValueExpression(token) { - const tag = this.getData("mdxJsxTag"); - const tail = tag.attributes[tag.attributes.length - 1]; - const node = { type: "mdxJsxAttributeValueExpression", value: this.resume() }; - const estree = token.estree; - if (estree) { - node.data = { estree }; +} + +// node_modules/micromark-core-commonmark/lib/setext-underline.js +var setextUnderline = { + name: "setextUnderline", + tokenize: tokenizeSetextUnderline, + resolveTo: resolveToSetextUnderline +}; +function resolveToSetextUnderline(events, context) { + let index2 = events.length; + let content3; + let text5; + let definition2; + while (index2--) { + if (events[index2][0] === "enter") { + if (events[index2][1].type === "content") { + content3 = index2; + break; + } + if (events[index2][1].type === "paragraph") { + text5 = index2; + } + } else { + if (events[index2][1].type === "content") { + events.splice(index2, 1); + } + if (!definition2 && events[index2][1].type === "definition") { + definition2 = index2; + } } - tail.value = node; } - function exitMdxJsxTagSelfClosingMarker() { - const tag = this.getData("mdxJsxTag"); - tag.selfClosing = true; + const heading2 = { + type: "setextHeading", + start: Object.assign({}, events[text5][1].start), + end: Object.assign({}, events[events.length - 1][1].end) + }; + events[text5][1].type = "setextHeadingText"; + if (definition2) { + events.splice(text5, 0, ["enter", heading2, context]); + events.splice(definition2 + 1, 0, ["exit", events[content3][1], context]); + events[content3][1].end = Object.assign({}, events[definition2][1].end); + } else { + events[content3][1] = heading2; } - function exitMdxJsxTag(token) { - const tag = this.getData("mdxJsxTag"); - const stack = this.getData("mdxJsxTagStack"); - const tail = stack[stack.length - 1]; - if (tag.close && tail.name !== tag.name) { - throw new VFileMessage( - "Unexpected closing tag `" + serializeAbbreviatedTag(tag) + "`, expected corresponding closing tag for `" + serializeAbbreviatedTag(tail) + "` (" + stringifyPosition(tail) + ")", - { start: token.start, end: token.end }, - "mdast-util-mdx-jsx:end-tag-mismatch" - ); - } - this.resume(); - if (tag.close) { - stack.pop(); - } else { - this.enter( - { - type: token.type === "mdxJsxTextTag" ? "mdxJsxTextElement" : "mdxJsxFlowElement", - name: tag.name, - attributes: tag.attributes, - children: [] - }, - token, - onErrorRightIsTag - ); + events.push(["exit", heading2, context]); + return events; +} +function tokenizeSetextUnderline(effects, ok3, nok) { + const self2 = this; + let marker; + return start2; + function start2(code2) { + let index2 = self2.events.length; + let paragraph2; + while (index2--) { + if (self2.events[index2][1].type !== "lineEnding" && self2.events[index2][1].type !== "linePrefix" && self2.events[index2][1].type !== "content") { + paragraph2 = self2.events[index2][1].type === "paragraph"; + break; + } } - if (tag.selfClosing || tag.close) { - this.exit(token, onErrorLeftIsTag); - } else { - stack.push(tag); + if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph2)) { + effects.enter("setextHeadingLine"); + marker = code2; + return before(code2); } + return nok(code2); } - function onErrorRightIsTag(closing, open) { - const tag = this.getData("mdxJsxTag"); - const place = closing ? " before the end of `" + closing.type + "`" : ""; - const position3 = closing ? { start: closing.start, end: closing.end } : void 0; - throw new VFileMessage( - "Expected a closing tag for `" + serializeAbbreviatedTag(tag) + "` (" + stringifyPosition({ start: open.start, end: open.end }) + ")" + place, - position3, - "mdast-util-mdx-jsx:end-tag-mismatch" - ); + function before(code2) { + effects.enter("setextHeadingLineSequence"); + return inside(code2); } - function onErrorLeftIsTag(a, b) { - const tag = this.getData("mdxJsxTag"); - throw new VFileMessage( - "Expected the closing tag `" + serializeAbbreviatedTag(tag) + "` either after the end of `" + b.type + "` (" + stringifyPosition(b.end) + ") or another opening tag after the start of `" + b.type + "` (" + stringifyPosition(b.start) + ")", - { start: a.start, end: a.end }, - "mdast-util-mdx-jsx:end-tag-mismatch" - ); + function inside(code2) { + if (code2 === marker) { + effects.consume(code2); + return inside; + } + effects.exit("setextHeadingLineSequence"); + return markdownSpace(code2) ? factorySpace(effects, after, "lineSuffix")(code2) : after(code2); } - function serializeAbbreviatedTag(tag) { - return "<" + (tag.close ? "/" : "") + (tag.name || "") + ">"; + function after(code2) { + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("setextHeadingLine"); + return ok3(code2); + } + return nok(code2); } } -function mdxJsxToMarkdown(options = {}) { - const { - quote = '"', - quoteSmart, - tightSelfClosing, - printWidth = Number.POSITIVE_INFINITY - } = options; - const alternative = quote === '"' ? "'" : '"'; - if (quote !== '"' && quote !== "'") { - throw new Error( - "Cannot serialize attribute values with `" + quote + "` for `options.quote`, expected `\"`, or `'`" - ); + +// node_modules/micromark-extension-mdxjs-esm/lib/syntax.js +var blankLineBefore2 = { + tokenize: tokenizeNextBlank, + partial: true +}; +var trouble3 = "https://github.com/micromark/micromark-extension-mdxjs-esm"; +var allowedAcornTypes = /* @__PURE__ */ new Set(["ExportAllDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ImportDeclaration"]); +function mdxjsEsm(options) { + const exportImportConstruct = { + tokenize: tokenizeExportImport, + concrete: true + }; + if (!options || !options.acorn || !options.acorn.parse) { + throw new Error("Expected an `acorn` instance passed in as `options.acorn`"); } - mdxElement.peek = peekElement; + const acorn = options.acorn; + const acornOptions = Object.assign({ + ecmaVersion: 2024, + sourceType: "module" + }, options.acornOptions, { + locations: true + }); return { - handlers: { - mdxJsxFlowElement: mdxElement, - mdxJsxTextElement: mdxElement - }, - unsafe: [ - { character: "<", inConstruct: ["phrasing"] }, - { atBreak: true, character: "<" } - ], - fences: true, - resourceLink: true + flow: { + [101]: exportImportConstruct, + [105]: exportImportConstruct + } }; - function mdxElement(node, _, context, safeOptions) { - const tracker = track(safeOptions); - const selfClosing = node.name && (!node.children || node.children.length === 0); - const exit2 = context.enter(node.type); - let index2 = -1; - const serializedAttributes = []; - let value = tracker.move("<" + (node.name || "")); - if (node.attributes && node.attributes.length > 0) { - if (!node.name) { - throw new Error("Cannot serialize fragment w/ attributes"); + function tokenizeExportImport(effects, ok3, nok) { + const self2 = this; + const definedModuleSpecifiers = self2.parser.definedModuleSpecifiers || (self2.parser.definedModuleSpecifiers = []); + const eventStart = this.events.length + 1; + let buffer = ""; + return self2.interrupt ? nok : start2; + function start2(code2) { + if (self2.now().column > 1) + return nok(code2); + effects.enter("mdxjsEsm"); + effects.enter("mdxjsEsmData"); + effects.consume(code2); + buffer += String.fromCharCode(code2); + return word; + } + function word(code2) { + if (asciiAlpha(code2)) { + effects.consume(code2); + buffer += String.fromCharCode(code2); + return word; } - while (++index2 < node.attributes.length) { - const attribute = node.attributes[index2]; - let result; - if (attribute.type === "mdxJsxExpressionAttribute") { - result = "{" + (attribute.value || "") + "}"; - } else { - if (!attribute.name) { - throw new Error("Cannot serialize attribute w/o name"); - } - const value2 = attribute.value; - const left = attribute.name; - let right = ""; - if (value2 === void 0 || value2 === null) { - } else if (typeof value2 === "object") { - right = "{" + (value2.value || "") + "}"; - } else { - const appliedQuote = quoteSmart && ccount(value2, quote) > ccount(value2, alternative) ? alternative : quote; - right = appliedQuote + stringifyEntitiesLight(value2, { subset: [appliedQuote] }) + appliedQuote; - } - result = left + (right ? "=" : "") + right; - } - serializedAttributes.push(result); + if ((buffer === "import" || buffer === "export") && code2 === 32) { + effects.consume(code2); + return inside; } + return nok(code2); } - let attributesOnTheirOwnLine = false; - const attributesOnOneLine = serializedAttributes.join(" "); - if (node.type === "mdxJsxFlowElement" && (/\r?\n|\r/.test(attributesOnOneLine) || tracker.current().now.column + attributesOnOneLine.length + (selfClosing ? tightSelfClosing ? 2 : 3 : 1) > printWidth)) { - attributesOnTheirOwnLine = true; - } - if (attributesOnTheirOwnLine) { - value += tracker.move( - "\n" + indentLines(serializedAttributes.join("\n"), map) - ); - } else if (attributesOnOneLine) { - value += tracker.move(" " + attributesOnOneLine); + function inside(code2) { + if (code2 === null || markdownLineEnding(code2)) { + effects.exit("mdxjsEsmData"); + return lineStart(code2); + } + effects.consume(code2); + return inside; } - if (attributesOnTheirOwnLine) { - value += tracker.move("\n"); + function lineStart(code2) { + if (code2 === null) { + return atEnd(code2); + } + if (markdownLineEnding(code2)) { + return effects.check(blankLineBefore2, atEnd, continuationStart)(code2); + } + effects.enter("mdxjsEsmData"); + return inside(code2); } - if (selfClosing) { - value += tracker.move( - (tightSelfClosing || attributesOnTheirOwnLine ? "" : " ") + "/" - ); + function continuationStart(code2) { + effects.enter("lineEnding"); + effects.consume(code2); + effects.exit("lineEnding"); + return lineStart; } - value += tracker.move(">"); - if (node.children && node.children.length > 0) { - if (node.type === "mdxJsxFlowElement") { - tracker.shift(2); - value += tracker.move("\n"); - value += tracker.move( - indentLines(containerFlow(node, context, tracker.current()), map) - ); - value += tracker.move("\n"); - } else { - value += tracker.move( - containerPhrasing(node, context, { - ...tracker.current(), - before: "<", - after: ">" - }) - ); + function atEnd(code2) { + const result = eventsToAcorn(self2.events.slice(eventStart), { + acorn, + acornOptions, + tokenTypes: ["mdxjsEsmData"], + prefix: definedModuleSpecifiers.length > 0 ? "var " + definedModuleSpecifiers.join(",") + "\n" : "" + }); + if (result.error) { + if (code2 !== null && result.swallow) { + return continuationStart(code2); + } + const error = new VFileMessage("Could not parse import/exports with acorn", { + cause: result.error, + place: { + line: result.error.loc.line, + column: result.error.loc.column + 1, + offset: result.error.pos + }, + ruleId: "acorn", + source: "micromark-extension-mdxjs-esm" + }); + error.url = trouble3 + "#could-not-parse-importexports-with-acorn"; + throw error; } + if (definedModuleSpecifiers.length > 0) { + const declaration = result.estree.body.shift(); + } + let index2 = -1; + while (++index2 < result.estree.body.length) { + const node2 = result.estree.body[index2]; + if (!allowedAcornTypes.has(node2.type)) { + const error = new VFileMessage("Unexpected `" + node2.type + "` in code: only import/exports are supported", { + place: positionFromEstree(node2), + ruleId: "non-esm", + source: "micromark-extension-mdxjs-esm" + }); + error.url = trouble3 + "#unexpected-type-in-code-only-importexports-are-supported"; + throw error; + } + if (node2.type === "ImportDeclaration" && !self2.interrupt) { + let index3 = -1; + while (++index3 < node2.specifiers.length) { + const specifier = node2.specifiers[index3]; + definedModuleSpecifiers.push(specifier.local.name); + } + } + } + Object.assign(effects.exit("mdxjsEsm"), options.addResult ? { + estree: result.estree + } : void 0); + return ok3(code2); } - if (!selfClosing) { - value += tracker.move(""); - } - exit2(); - return value; - } - function map(line, _, blank) { - return (blank ? "" : " ") + line; } - function peekElement() { - return "<"; +} +function tokenizeNextBlank(effects, ok3, nok) { + return start2; + function start2(code2) { + effects.enter("lineEndingBlank"); + effects.consume(code2); + effects.exit("lineEndingBlank"); + return effects.attempt(blankLine, ok3, nok); } } -// node_modules/mdast-util-mdxjs-esm/index.js -var mdxjsEsmFromMarkdown = { - enter: { mdxjsEsm: enterMdxjsEsm }, - exit: { mdxjsEsm: exitMdxjsEsm, mdxjsEsmData: exitMdxjsEsmData } -}; -var mdxjsEsmToMarkdown = { handlers: { mdxjsEsm: handleMdxjsEsm } }; -function enterMdxjsEsm(token) { - this.enter({ type: "mdxjsEsm", value: "" }, token); - this.buffer(); -} -function exitMdxjsEsm(token) { - const value = this.resume(); - const node = this.exit(token); - const estree = token.estree; - node.value = value; - if (estree) { - node.data = { estree }; +// node_modules/micromark-util-combine-extensions/index.js +var hasOwnProperty2 = {}.hasOwnProperty; +function combineExtensions(extensions) { + const all3 = {}; + let index2 = -1; + while (++index2 < extensions.length) { + syntaxExtension(all3, extensions[index2]); } + return all3; } -function exitMdxjsEsmData(token) { - this.config.enter.data.call(this, token); - this.config.exit.data.call(this, token); +function syntaxExtension(all3, extension2) { + let hook; + for (hook in extension2) { + const maybe = hasOwnProperty2.call(all3, hook) ? all3[hook] : void 0; + const left = maybe || (all3[hook] = {}); + const right = extension2[hook]; + let code2; + if (right) { + for (code2 in right) { + if (!hasOwnProperty2.call(left, code2)) + left[code2] = []; + const value = right[code2]; + constructs( + // @ts-expect-error Looks like a list. + left[code2], + Array.isArray(value) ? value : value ? [value] : [] + ); + } + } + } } -function handleMdxjsEsm(node) { - return node.value || ""; +function constructs(existing, list3) { + let index2 = -1; + const before = []; + while (++index2 < list3.length) { + ; + (list3[index2].add === "after" ? existing : before).push(list3[index2]); + } + splice(existing, 0, 0, before); } -// node_modules/mdast-util-mdx/index.js -function mdxFromMarkdown() { - return [mdxExpressionFromMarkdown, mdxJsxFromMarkdown(), mdxjsEsmFromMarkdown]; +// node_modules/micromark-extension-mdxjs/index.js +function mdxjs(options) { + const settings = Object.assign( + { + acorn: Parser.extend((0, import_acorn_jsx.default)()), + acornOptions: { ecmaVersion: 2024, sourceType: "module" }, + addResult: true + }, + options + ); + return combineExtensions([ + mdxjsEsm(settings), + mdxExpression(settings), + mdxJsx(settings), + mdxMd() + ]); } -function mdxToMarkdown(options) { - return { - extensions: [ - mdxExpressionToMarkdown, - mdxJsxToMarkdown(options), - mdxjsEsmToMarkdown - ] - }; + +// node_modules/remark-mdx/lib/index.js +var emptyOptions2 = {}; +function remarkMdx(options) { + const self2 = ( + /** @type {Processor} */ + this + ); + const settings = options || emptyOptions2; + const data2 = self2.data(); + const micromarkExtensions = data2.micromarkExtensions || (data2.micromarkExtensions = []); + const fromMarkdownExtensions = data2.fromMarkdownExtensions || (data2.fromMarkdownExtensions = []); + const toMarkdownExtensions = data2.toMarkdownExtensions || (data2.toMarkdownExtensions = []); + micromarkExtensions.push(mdxjs(settings)); + fromMarkdownExtensions.push(mdxFromMarkdown()); + toMarkdownExtensions.push(mdxToMarkdown(settings)); } -// node_modules/remark-mdx/index.js -function remarkMdx(options = {}) { - const data2 = this.data(); - add("micromarkExtensions", mdxjs(options)); - add("fromMarkdownExtensions", mdxFromMarkdown()); - add("toMarkdownExtensions", mdxToMarkdown(options)); - function add(field, value) { - const list3 = data2[field] ? data2[field] : data2[field] = []; - list3.push(value); +// node_modules/mdast-util-to-string/lib/index.js +var emptyOptions3 = {}; +function toString2(value, options) { + const settings = options || emptyOptions3; + const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true; + const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true; + return one(value, includeImageAlt, includeHtml); +} +function one(value, includeImageAlt, includeHtml) { + if (node(value)) { + if ("value" in value) { + return value.type === "html" && !includeHtml ? "" : value.value; + } + if (includeImageAlt && "alt" in value && value.alt) { + return value.alt; + } + if ("children" in value) { + return all(value.children, includeImageAlt, includeHtml); + } + } + if (Array.isArray(value)) { + return all(value, includeImageAlt, includeHtml); } + return ""; } - -// node_modules/mdast-util-to-string/index.js -function toString2(node, options) { - var { includeImageAlt = true } = options || {}; - return one(node, includeImageAlt); +function all(values, includeImageAlt, includeHtml) { + const result = []; + let index2 = -1; + while (++index2 < values.length) { + result[index2] = one(values[index2], includeImageAlt, includeHtml); + } + return result.join(""); } -function one(node, includeImageAlt) { - return node && typeof node === "object" && (node.value || (includeImageAlt ? node.alt : "") || "children" in node && all(node.children, includeImageAlt) || Array.isArray(node) && all(node, includeImageAlt)) || ""; +function node(value) { + return Boolean(value && typeof value === "object"); +} + +// node_modules/micromark-util-decode-numeric-character-reference/index.js +function decodeNumericCharacterReference(value, base) { + const code2 = Number.parseInt(value, base); + if ( + // C0 except for HT, LF, FF, CR, space. + code2 < 9 || code2 === 11 || code2 > 13 && code2 < 32 || // Control character (DEL) of C0, and C1 controls. + code2 > 126 && code2 < 160 || // Lone high surrogates and low surrogates. + code2 > 55295 && code2 < 57344 || // Noncharacters. + code2 > 64975 && code2 < 65008 || (code2 & 65535) === 65535 || (code2 & 65535) === 65534 || // Out of range + code2 > 1114111 + ) { + return "\uFFFD"; + } + return String.fromCharCode(code2); } -function all(values, includeImageAlt) { - var result = []; - var index2 = -1; - while (++index2 < values.length) { - result[index2] = one(values[index2], includeImageAlt); + +// node_modules/micromark-util-sanitize-uri/index.js +function normalizeUri(value) { + const result = []; + let index2 = -1; + let start2 = 0; + let skip = 0; + while (++index2 < value.length) { + const code2 = value.charCodeAt(index2); + let replace = ""; + if (code2 === 37 && asciiAlphanumeric(value.charCodeAt(index2 + 1)) && asciiAlphanumeric(value.charCodeAt(index2 + 2))) { + skip = 2; + } else if (code2 < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code2))) { + replace = String.fromCharCode(code2); + } + } else if (code2 > 55295 && code2 < 57344) { + const next = value.charCodeAt(index2 + 1); + if (code2 < 56320 && next > 56319 && next < 57344) { + replace = String.fromCharCode(code2, next); + skip = 1; + } else { + replace = "\uFFFD"; + } + } else { + replace = String.fromCharCode(code2); + } + if (replace) { + result.push(value.slice(start2, index2), encodeURIComponent(replace)); + start2 = index2 + skip + 1; + replace = ""; + } + if (skip) { + index2 += skip; + skip = 0; + } } - return result.join(""); + return result.join("") + value.slice(start2); } // node_modules/micromark/lib/initialize/content.js @@ -18629,8 +19892,8 @@ function initializeDocument(effects) { let childFlow; let childToken; let lineStartOffset; - return start3; - function start3(code2) { + return start2; + function start2(code2) { if (continued < stack.length) { const item = stack[continued]; self2.containerState = item[1]; @@ -18651,17 +19914,17 @@ function initializeDocument(effects) { } const indexBeforeExits = self2.events.length; let indexBeforeFlow = indexBeforeExits; - let point3; + let point4; while (indexBeforeFlow--) { if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") { - point3 = self2.events[indexBeforeFlow][1].end; + point4 = self2.events[indexBeforeFlow][1].end; break; } } exitContainers(continued); let index2 = indexBeforeExits; while (index2 < self2.events.length) { - self2.events[index2][1].end = Object.assign({}, point3); + self2.events[index2][1].end = Object.assign({}, point4); index2++; } splice( @@ -18673,7 +19936,7 @@ function initializeDocument(effects) { self2.events.length = index2; return checkNewContainers(code2); } - return start3(code2); + return start2(code2); } function checkNewContainers(code2) { if (continued === stack.length) { @@ -18746,7 +20009,7 @@ function initializeDocument(effects) { writeToChild(effects.exit("chunkFlow")); continued = 0; self2.interrupt = void 0; - return start3; + return start2; } effects.consume(code2); return flowContinue; @@ -18764,18 +20027,23 @@ function initializeDocument(effects) { if (self2.parser.lazy[token.start.line]) { let index2 = childFlow.events.length; while (index2--) { - if (childFlow.events[index2][1].start.offset < lineStartOffset && (!childFlow.events[index2][1].end || childFlow.events[index2][1].end.offset > lineStartOffset)) { + if ( + // The token starts before the line ending… + childFlow.events[index2][1].start.offset < lineStartOffset && // …and either is not ended yet… + (!childFlow.events[index2][1].end || // …or ends after it. + childFlow.events[index2][1].end.offset > lineStartOffset) + ) { return; } } const indexBeforeExits = self2.events.length; let indexBeforeFlow = indexBeforeExits; let seen; - let point3; + let point4; while (indexBeforeFlow--) { if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") { if (seen) { - point3 = self2.events[indexBeforeFlow][1].end; + point4 = self2.events[indexBeforeFlow][1].end; break; } seen = true; @@ -18784,7 +20052,7 @@ function initializeDocument(effects) { exitContainers(continued); index2 = indexBeforeExits; while (index2 < self2.events.length) { - self2.events[index2][1].end = Object.assign({}, point3); + self2.events[index2][1].end = Object.assign({}, point4); index2++; } splice( @@ -18812,10 +20080,10 @@ function initializeDocument(effects) { self2.containerState._closeFlow = void 0; } } -function tokenizeContainer(effects, ok2, nok) { +function tokenizeContainer(effects, ok3, nok) { return factorySpace( effects, - effects.attempt(this.parser.constructs.document, ok2, nok), + effects.attempt(this.parser.constructs.document, ok3, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 ); @@ -18828,8 +20096,10 @@ var flow = { function initializeFlow(effects) { const self2 = this; const initial = effects.attempt( + // Try to parse a blank line. blankLine, atBlankEnding, + // Try to parse initial flow (essentially, only code). effects.attempt( this.parser.constructs.flowInitial, afterConstruct, @@ -18885,9 +20155,9 @@ function initializeFactory(field) { function initializeText(effects) { const self2 = this; const constructs2 = this.parser.constructs[field]; - const text5 = effects.attempt(constructs2, start3, notText); - return start3; - function start3(code2) { + const text5 = effects.attempt(constructs2, start2, notText); + return start2; + function start2(code2) { return atBreak(code2) ? text5(code2) : notText(code2); } function notText(code2) { @@ -19011,7 +20281,7 @@ function resolveAllLineSuffixes(events, context) { // node_modules/micromark/lib/create-tokenizer.js function createTokenizer(parser, initialize, from) { - let point3 = Object.assign( + let point4 = Object.assign( from ? Object.assign({}, from) : { line: 1, column: 1, @@ -19066,13 +20336,20 @@ function createTokenizer(parser, initialize, from) { return context.events; } function sliceSerialize(token, expandTabs) { - return serializeChunks(sliceStream(token), expandTabs); + return serializeChunks2(sliceStream(token), expandTabs); } function sliceStream(token) { return sliceChunks(chunks, token); } function now() { - return Object.assign({}, point3); + const { line, column, offset: offset2, _index, _bufferIndex } = point4; + return { + line, + column, + offset: offset2, + _index, + _bufferIndex + }; } function defineSkip(value) { columnStart[value.line] = value.column; @@ -19080,15 +20357,15 @@ function createTokenizer(parser, initialize, from) { } function main() { let chunkIndex; - while (point3._index < chunks.length) { - const chunk = chunks[point3._index]; + while (point4._index < chunks.length) { + const chunk = chunks[point4._index]; if (typeof chunk === "string") { - chunkIndex = point3._index; - if (point3._bufferIndex < 0) { - point3._bufferIndex = 0; + chunkIndex = point4._index; + if (point4._bufferIndex < 0) { + point4._bufferIndex = 0; } - while (point3._index === chunkIndex && point3._bufferIndex < chunk.length) { - go(chunk.charCodeAt(point3._bufferIndex)); + while (point4._index === chunkIndex && point4._bufferIndex < chunk.length) { + go(chunk.charCodeAt(point4._bufferIndex)); } } else { go(chunk); @@ -19102,21 +20379,21 @@ function createTokenizer(parser, initialize, from) { } function consume(code2) { if (markdownLineEnding(code2)) { - point3.line++; - point3.column = 1; - point3.offset += code2 === -3 ? 2 : 1; + point4.line++; + point4.column = 1; + point4.offset += code2 === -3 ? 2 : 1; accountForPotentialSkip(); } else if (code2 !== -1) { - point3.column++; - point3.offset++; + point4.column++; + point4.offset++; } - if (point3._bufferIndex < 0) { - point3._index++; + if (point4._bufferIndex < 0) { + point4._index++; } else { - point3._bufferIndex++; - if (point3._bufferIndex === chunks[point3._index].length) { - point3._bufferIndex = -1; - point3._index++; + point4._bufferIndex++; + if (point4._bufferIndex === chunks[point4._index].length) { + point4._bufferIndex = -1; + point4._index++; } } context.previous = code2; @@ -19149,15 +20426,20 @@ function createTokenizer(parser, initialize, from) { let constructIndex; let currentConstruct; let info; - return Array.isArray(constructs2) ? handleListOfConstructs(constructs2) : "tokenize" in constructs2 ? handleListOfConstructs([constructs2]) : handleMapOfConstructs(constructs2); + return Array.isArray(constructs2) ? handleListOfConstructs(constructs2) : "tokenize" in constructs2 ? ( + // @ts-expect-error Looks like a construct. + handleListOfConstructs([constructs2]) + ) : handleMapOfConstructs(constructs2); function handleMapOfConstructs(map) { - return start3; - function start3(code2) { + return start2; + function start2(code2) { const def = code2 !== null && map[code2]; - const all4 = code2 !== null && map.null; + const all3 = code2 !== null && map.null; const list3 = [ + // To do: add more extension tests. + /* c8 ignore next 2 */ ...Array.isArray(def) ? def : def ? [def] : [], - ...Array.isArray(all4) ? all4 : all4 ? [all4] : [] + ...Array.isArray(all3) ? all3 : all3 ? [all3] : [] ]; return handleListOfConstructs(list3)(code2); } @@ -19171,8 +20453,8 @@ function createTokenizer(parser, initialize, from) { return handleConstruct(list3[constructIndex]); } function handleConstruct(construct) { - return start3; - function start3(code2) { + return start2; + function start2(code2) { info = store(); currentConstruct = construct; if (!construct.partial) { @@ -19182,14 +20464,17 @@ function createTokenizer(parser, initialize, from) { return nok(code2); } return construct.tokenize.call( + // If we do have fields, create an object w/ `context` as its + // prototype. + // This allows a “live binding”, which is needed for `interrupt`. fields ? Object.assign(Object.create(context), fields) : context, effects, - ok2, + ok3, nok )(code2); } } - function ok2(code2) { + function ok3(code2) { consumed = true; onreturn(currentConstruct, info); return returnState; @@ -19231,7 +20516,7 @@ function createTokenizer(parser, initialize, from) { from: startEventsIndex }; function restore() { - point3 = startPoint; + point4 = startPoint; context.previous = startPrevious; context.currentConstruct = startCurrentConstruct; context.events.length = startEventsIndex; @@ -19240,9 +20525,9 @@ function createTokenizer(parser, initialize, from) { } } function accountForPotentialSkip() { - if (point3.line in columnStart && point3.column < 2) { - point3.column = columnStart[point3.line]; - point3.offset += columnStart[point3.line] - 1; + if (point4.line in columnStart && point4.column < 2) { + point4.column = columnStart[point4.line]; + point4.offset += columnStart[point4.line] - 1; } } } @@ -19257,7 +20542,12 @@ function sliceChunks(chunks, token) { } else { view = chunks.slice(startIndex, endIndex); if (startBufferIndex > -1) { - view[0] = view[0].slice(startBufferIndex); + const head = view[0]; + if (typeof head === "string") { + view[0] = head.slice(startBufferIndex); + } else { + view.shift(); + } } if (endBufferIndex > 0) { view.push(chunks[endIndex].slice(0, endBufferIndex)); @@ -19265,7 +20555,7 @@ function sliceChunks(chunks, token) { } return view; } -function serializeChunks(chunks, expandTabs) { +function serializeChunks2(chunks, expandTabs) { let index2 = -1; const result = []; let atTab; @@ -19384,22 +20674,24 @@ var disable = { }; // node_modules/micromark/lib/parse.js -function parse3(options = {}) { - const constructs2 = combineExtensions( - [constructs_exports].concat(options.extensions || []) +function parse3(options) { + const settings = options || {}; + const constructs2 = ( + /** @type {FullNormalizedExtension} */ + combineExtensions([constructs_exports, ...settings.extensions || []]) ); const parser = { defined: [], lazy: {}, constructs: constructs2, - content: create5(content2), - document: create5(document), - flow: create5(flow), - string: create5(string), - text: create5(text) + content: create4(content2), + document: create4(document), + flow: create4(flow), + string: create4(string), + text: create4(text) }; return parser; - function create5(initial) { + function create4(initial) { return creator; function creator(from) { return createTokenizer(parser, initial, from); @@ -19407,12 +20699,19 @@ function parse3(options = {}) { } } +// node_modules/micromark/lib/postprocess.js +function postprocess(events) { + while (!subtokenize(events)) { + } + return events; +} + // node_modules/micromark/lib/preprocess.js var search = /[\0\t\n\r]/g; function preprocess() { let column = 1; - let buffer2 = ""; - let start3 = true; + let buffer = ""; + let start2 = true; let atCarriageReturn; return preprocessor; function preprocessor(value, encoding, end) { @@ -19422,14 +20721,14 @@ function preprocess() { let startPosition; let endPosition; let code2; - value = buffer2 + value.toString(encoding); + value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value)); startPosition = 0; - buffer2 = ""; - if (start3) { + buffer = ""; + if (start2) { if (value.charCodeAt(0) === 65279) { startPosition++; } - start3 = void 0; + start2 = void 0; } while (startPosition < value.length) { search.lastIndex = startPosition; @@ -19437,7 +20736,7 @@ function preprocess() { endPosition = match && match.index !== void 0 ? match.index : value.length; code2 = value.charCodeAt(endPosition); if (!match) { - buffer2 = value.slice(startPosition); + buffer = value.slice(startPosition); break; } if (code2 === 10 && startPosition === endPosition && atCarriageReturn) { @@ -19481,30 +20780,14 @@ function preprocess() { if (end) { if (atCarriageReturn) chunks.push(-5); - if (buffer2) - chunks.push(buffer2); + if (buffer) + chunks.push(buffer); chunks.push(null); } return chunks; } } -// node_modules/micromark/lib/postprocess.js -function postprocess(events) { - while (!subtokenize(events)) { - } - return events; -} - -// node_modules/micromark-util-decode-numeric-character-reference/index.js -function decodeNumericCharacterReference(value, base2) { - const code2 = Number.parseInt(value, base2); - if (code2 < 9 || code2 === 11 || code2 > 13 && code2 < 32 || code2 > 126 && code2 < 160 || code2 > 55295 && code2 < 57344 || code2 > 64975 && code2 < 65008 || (code2 & 65535) === 65535 || (code2 & 65535) === 65534 || code2 > 1114111) { - return "\uFFFD"; - } - return String.fromCharCode(code2); -} - // node_modules/micromark-util-decode-string/index.js var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; function decodeString(value) { @@ -19524,8 +20807,8 @@ function decode($0, $1, $2) { } // node_modules/mdast-util-from-markdown/lib/index.js -var own4 = {}.hasOwnProperty; -var fromMarkdown = function(value, encoding, options) { +var own3 = {}.hasOwnProperty; +function fromMarkdown(value, encoding, options) { if (typeof encoding !== "string") { options = encoding; encoding = void 0; @@ -19535,114 +20818,106 @@ var fromMarkdown = function(value, encoding, options) { parse3(options).document().write(preprocess()(value, encoding, true)) ) ); -}; -function compiler(options = {}) { - const config = configure( - { - transforms: [], - canContainEols: [ - "emphasis", - "fragment", - "heading", - "paragraph", - "strong" - ], - enter: { - autolink: opener(link2), - autolinkProtocol: onenterdata, - autolinkEmail: onenterdata, - atxHeading: opener(heading2), - blockQuote: opener(blockQuote2), - characterEscape: onenterdata, - characterReference: onenterdata, - codeFenced: opener(codeFlow), - codeFencedFenceInfo: buffer2, - codeFencedFenceMeta: buffer2, - codeIndented: opener(codeFlow, buffer2), - codeText: opener(codeText2, buffer2), - codeTextData: onenterdata, - data: onenterdata, - codeFlowValue: onenterdata, - definition: opener(definition2), - definitionDestinationString: buffer2, - definitionLabelString: buffer2, - definitionTitleString: buffer2, - emphasis: opener(emphasis2), - hardBreakEscape: opener(hardBreak2), - hardBreakTrailing: opener(hardBreak2), - htmlFlow: opener(html4, buffer2), - htmlFlowData: onenterdata, - htmlText: opener(html4, buffer2), - htmlTextData: onenterdata, - image: opener(image2), - label: buffer2, - link: opener(link2), - listItem: opener(listItem2), - listItemValue: onenterlistitemvalue, - listOrdered: opener(list3, onenterlistordered), - listUnordered: opener(list3), - paragraph: opener(paragraph2), - reference: onenterreference, - referenceString: buffer2, - resourceDestinationString: buffer2, - resourceTitleString: buffer2, - setextHeading: opener(heading2), - strong: opener(strong2), - thematicBreak: opener(thematicBreak3) - }, - exit: { - atxHeading: closer(), - atxHeadingSequence: onexitatxheadingsequence, - autolink: closer(), - autolinkEmail: onexitautolinkemail, - autolinkProtocol: onexitautolinkprotocol, - blockQuote: closer(), - characterEscapeValue: onexitdata, - characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, - characterReferenceMarkerNumeric: onexitcharacterreferencemarker, - characterReferenceValue: onexitcharacterreferencevalue, - codeFenced: closer(onexitcodefenced), - codeFencedFence: onexitcodefencedfence, - codeFencedFenceInfo: onexitcodefencedfenceinfo, - codeFencedFenceMeta: onexitcodefencedfencemeta, - codeFlowValue: onexitdata, - codeIndented: closer(onexitcodeindented), - codeText: closer(onexitcodetext), - codeTextData: onexitdata, - data: onexitdata, - definition: closer(), - definitionDestinationString: onexitdefinitiondestinationstring, - definitionLabelString: onexitdefinitionlabelstring, - definitionTitleString: onexitdefinitiontitlestring, - emphasis: closer(), - hardBreakEscape: closer(onexithardbreak), - hardBreakTrailing: closer(onexithardbreak), - htmlFlow: closer(onexithtmlflow), - htmlFlowData: onexitdata, - htmlText: closer(onexithtmltext), - htmlTextData: onexitdata, - image: closer(onexitimage), - label: onexitlabel, - labelText: onexitlabeltext, - lineEnding: onexitlineending, - link: closer(onexitlink), - listItem: closer(), - listOrdered: closer(), - listUnordered: closer(), - paragraph: closer(), - referenceString: onexitreferencestring, - resourceDestinationString: onexitresourcedestinationstring, - resourceTitleString: onexitresourcetitlestring, - resource: onexitresource, - setextHeading: closer(onexitsetextheading), - setextHeadingLineSequence: onexitsetextheadinglinesequence, - setextHeadingText: onexitsetextheadingtext, - strong: closer(), - thematicBreak: closer() - } +} +function compiler(options) { + const config = { + transforms: [], + canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"], + enter: { + autolink: opener(link2), + autolinkProtocol: onenterdata, + autolinkEmail: onenterdata, + atxHeading: opener(heading2), + blockQuote: opener(blockQuote2), + characterEscape: onenterdata, + characterReference: onenterdata, + codeFenced: opener(codeFlow), + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: opener(codeFlow, buffer), + codeText: opener(codeText2, buffer), + codeTextData: onenterdata, + data: onenterdata, + codeFlowValue: onenterdata, + definition: opener(definition2), + definitionDestinationString: buffer, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: opener(emphasis2), + hardBreakEscape: opener(hardBreak2), + hardBreakTrailing: opener(hardBreak2), + htmlFlow: opener(html5, buffer), + htmlFlowData: onenterdata, + htmlText: opener(html5, buffer), + htmlTextData: onenterdata, + image: opener(image2), + label: buffer, + link: opener(link2), + listItem: opener(listItem2), + listItemValue: onenterlistitemvalue, + listOrdered: opener(list3, onenterlistordered), + listUnordered: opener(list3), + paragraph: opener(paragraph2), + reference: onenterreference, + referenceString: buffer, + resourceDestinationString: buffer, + resourceTitleString: buffer, + setextHeading: opener(heading2), + strong: opener(strong2), + thematicBreak: opener(thematicBreak3) }, - options.mdastExtensions || [] - ); + exit: { + atxHeading: closer(), + atxHeadingSequence: onexitatxheadingsequence, + autolink: closer(), + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: closer(), + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: closer(onexitcodefenced), + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: onexitcodefencedfencemeta, + codeFlowValue: onexitdata, + codeIndented: closer(onexitcodeindented), + codeText: closer(onexitcodetext), + codeTextData: onexitdata, + data: onexitdata, + definition: closer(), + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: closer(), + hardBreakEscape: closer(onexithardbreak), + hardBreakTrailing: closer(onexithardbreak), + htmlFlow: closer(onexithtmlflow), + htmlFlowData: onexitdata, + htmlText: closer(onexithtmltext), + htmlTextData: onexitdata, + image: closer(onexitimage), + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: closer(onexitlink), + listItem: closer(), + listOrdered: closer(), + listUnordered: closer(), + paragraph: closer(), + referenceString: onexitreferencestring, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + resource: onexitresource, + setextHeading: closer(onexitsetextheading), + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: closer(), + thematicBreak: closer() + } + }; + configure(config, (options || {}).mdastExtensions || []); const data2 = {}; return compile2; function compile2(events) { @@ -19650,20 +20925,17 @@ function compiler(options = {}) { type: "root", children: [] }; - const stack = [tree]; - const tokenStack = []; - const listStack = []; const context = { - stack, - tokenStack, + stack: [tree], + tokenStack: [], config, enter, exit: exit2, - buffer: buffer2, + buffer, resume, - setData, - getData + data: data2 }; + const listStack = []; let index2 = -1; while (++index2 < events.length) { if (events[index2][1].type === "listOrdered" || events[index2][1].type === "listUnordered") { @@ -19678,7 +20950,7 @@ function compiler(options = {}) { index2 = -1; while (++index2 < events.length) { const handler = config[events[index2][0]]; - if (own4.call(handler, events[index2][1].type)) { + if (own3.call(handler, events[index2][1].type)) { handler[events[index2][1].type].call( Object.assign( { @@ -19690,20 +20962,20 @@ function compiler(options = {}) { ); } } - if (tokenStack.length > 0) { - const tail = tokenStack[tokenStack.length - 1]; + if (context.tokenStack.length > 0) { + const tail = context.tokenStack[context.tokenStack.length - 1]; const handler = tail[1] || defaultOnError; handler.call(context, void 0, tail[0]); } tree.position = { - start: point3( + start: point2( events.length > 0 ? events[0][1].start : { line: 1, column: 1, offset: 0 } ), - end: point3( + end: point2( events.length > 0 ? events[events.length - 2][1].end : { line: 1, column: 1, @@ -19717,8 +20989,8 @@ function compiler(options = {}) { } return tree; } - function prepareList(events, start3, length) { - let index2 = start3 - 1; + function prepareList(events, start2, length) { + let index2 = start2 - 1; let containerBalance = -1; let listSpread = false; let listItem3; @@ -19727,23 +20999,37 @@ function compiler(options = {}) { let atMarker; while (++index2 <= length) { const event = events[index2]; - if (event[1].type === "listUnordered" || event[1].type === "listOrdered" || event[1].type === "blockQuote") { - if (event[0] === "enter") { - containerBalance++; - } else { - containerBalance--; + switch (event[1].type) { + case "listUnordered": + case "listOrdered": + case "blockQuote": { + if (event[0] === "enter") { + containerBalance++; + } else { + containerBalance--; + } + atMarker = void 0; + break; } - atMarker = void 0; - } else if (event[1].type === "lineEndingBlank") { - if (event[0] === "enter") { - if (listItem3 && !atMarker && !containerBalance && !firstBlankLineIndex) { - firstBlankLineIndex = index2; + case "lineEndingBlank": { + if (event[0] === "enter") { + if (listItem3 && !atMarker && !containerBalance && !firstBlankLineIndex) { + firstBlankLineIndex = index2; + } + atMarker = void 0; } + break; + } + case "linePrefix": + case "listItemValue": + case "listItemMarker": + case "listItemPrefix": + case "listItemPrefixWhitespace": { + break; + } + default: { atMarker = void 0; } - } else if (event[1].type === "linePrefix" || event[1].type === "listItemValue" || event[1].type === "listItemMarker" || event[1].type === "listItemPrefix" || event[1].type === "listItemPrefixWhitespace") { - } else { - atMarker = void 0; } if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) { if (listItem3) { @@ -19777,12 +21063,15 @@ function compiler(options = {}) { length++; } if (event[1].type === "listItemPrefix") { - listItem3 = { + const item = { type: "listItem", _spread: false, - start: Object.assign({}, event[1].start) + start: Object.assign({}, event[1].start), + // @ts-expect-error: we’ll add `end` in a second. + end: void 0 }; - events.splice(index2, 0, ["enter", listItem3, event[2]]); + listItem3 = item; + events.splice(index2, 0, ["enter", item, event[2]]); index2++; length++; firstBlankLineIndex = void 0; @@ -19790,45 +21079,34 @@ function compiler(options = {}) { } } } - events[start3][1]._spread = listSpread; + events[start2][1]._spread = listSpread; return length; } - function setData(key, value) { - data2[key] = value; - } - function getData(key) { - return data2[key]; - } - function point3(d) { - return { - line: d.line, - column: d.column, - offset: d.offset - }; - } - function opener(create5, and) { + function opener(create4, and) { return open; function open(token) { - enter.call(this, create5(token), token); + enter.call(this, create4(token), token); if (and) and.call(this, token); } } - function buffer2() { + function buffer() { this.stack.push({ type: "fragment", children: [] }); } - function enter(node, token, errorHandler) { + function enter(node2, token, errorHandler) { const parent = this.stack[this.stack.length - 1]; - parent.children.push(node); - this.stack.push(node); + const siblings = parent.children; + siblings.push(node2); + this.stack.push(node2); this.tokenStack.push([token, errorHandler]); - node.position = { - start: point3(token.start) + node2.position = { + start: point2(token.start), + // @ts-expect-error: `end` will be patched later. + end: void 0 }; - return node; } function closer(and) { return close; @@ -19839,7 +21117,7 @@ function compiler(options = {}) { } } function exit2(token, onExitError) { - const node = this.stack.pop(); + const node2 = this.stack.pop(); const open = this.tokenStack.pop(); if (!open) { throw new Error( @@ -19856,229 +21134,235 @@ function compiler(options = {}) { handler.call(this, token, open[0]); } } - node.position.end = point3(token.end); - return node; + node2.position.end = point2(token.end); } function resume() { return toString2(this.stack.pop()); } function onenterlistordered() { - setData("expectingFirstListItemValue", true); + this.data.expectingFirstListItemValue = true; } function onenterlistitemvalue(token) { - if (getData("expectingFirstListItemValue")) { + if (this.data.expectingFirstListItemValue) { const ancestor = this.stack[this.stack.length - 2]; ancestor.start = Number.parseInt(this.sliceSerialize(token), 10); - setData("expectingFirstListItemValue"); + this.data.expectingFirstListItemValue = void 0; } } function onexitcodefencedfenceinfo() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.lang = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.lang = data3; } function onexitcodefencedfencemeta() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.meta = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.meta = data3; } function onexitcodefencedfence() { - if (getData("flowCodeInside")) + if (this.data.flowCodeInside) return; this.buffer(); - setData("flowCodeInside", true); + this.data.flowCodeInside = true; } function onexitcodefenced() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data3.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""); - setData("flowCodeInside"); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data3.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""); + this.data.flowCodeInside = void 0; } function onexitcodeindented() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data3.replace(/(\r?\n|\r)$/g, ""); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data3.replace(/(\r?\n|\r)$/g, ""); } function onexitdefinitionlabelstring(token) { const label = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.label = label; - node.identifier = normalizeIdentifier( + const node2 = this.stack[this.stack.length - 1]; + node2.label = label; + node2.identifier = normalizeIdentifier( this.sliceSerialize(token) ).toLowerCase(); } function onexitdefinitiontitlestring() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.title = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.title = data3; } function onexitdefinitiondestinationstring() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.url = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.url = data3; } function onexitatxheadingsequence(token) { - const node = this.stack[this.stack.length - 1]; - if (!node.depth) { + const node2 = this.stack[this.stack.length - 1]; + if (!node2.depth) { const depth = this.sliceSerialize(token).length; - node.depth = depth; + node2.depth = depth; } } function onexitsetextheadingtext() { - setData("setextHeadingSlurpLineEnding", true); + this.data.setextHeadingSlurpLineEnding = true; } function onexitsetextheadinglinesequence(token) { - const node = this.stack[this.stack.length - 1]; - node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2; + const node2 = this.stack[this.stack.length - 1]; + node2.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2; } function onexitsetextheading() { - setData("setextHeadingSlurpLineEnding"); + this.data.setextHeadingSlurpLineEnding = void 0; } function onenterdata(token) { - const parent = this.stack[this.stack.length - 1]; - let tail = parent.children[parent.children.length - 1]; + const node2 = this.stack[this.stack.length - 1]; + const siblings = node2.children; + let tail = siblings[siblings.length - 1]; if (!tail || tail.type !== "text") { tail = text5(); tail.position = { - start: point3(token.start) + start: point2(token.start), + // @ts-expect-error: we’ll add `end` later. + end: void 0 }; - parent.children.push(tail); + siblings.push(tail); } this.stack.push(tail); } function onexitdata(token) { const tail = this.stack.pop(); tail.value += this.sliceSerialize(token); - tail.position.end = point3(token.end); + tail.position.end = point2(token.end); } function onexitlineending(token) { const context = this.stack[this.stack.length - 1]; - if (getData("atHardBreak")) { + if (this.data.atHardBreak) { const tail = context.children[context.children.length - 1]; - tail.position.end = point3(token.end); - setData("atHardBreak"); + tail.position.end = point2(token.end); + this.data.atHardBreak = void 0; return; } - if (!getData("setextHeadingSlurpLineEnding") && config.canContainEols.includes(context.type)) { + if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) { onenterdata.call(this, token); onexitdata.call(this, token); } } function onexithardbreak() { - setData("atHardBreak", true); + this.data.atHardBreak = true; } function onexithtmlflow() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.value = data3; } function onexithtmltext() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.value = data3; } function onexitcodetext() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.value = data3; } function onexitlink() { - const context = this.stack[this.stack.length - 1]; - if (getData("inReference")) { - context.type += "Reference"; - context.referenceType = getData("referenceType") || "shortcut"; - delete context.url; - delete context.title; + const node2 = this.stack[this.stack.length - 1]; + if (this.data.inReference) { + const referenceType = this.data.referenceType || "shortcut"; + node2.type += "Reference"; + node2.referenceType = referenceType; + delete node2.url; + delete node2.title; } else { - delete context.identifier; - delete context.label; + delete node2.identifier; + delete node2.label; } - setData("referenceType"); + this.data.referenceType = void 0; } function onexitimage() { - const context = this.stack[this.stack.length - 1]; - if (getData("inReference")) { - context.type += "Reference"; - context.referenceType = getData("referenceType") || "shortcut"; - delete context.url; - delete context.title; + const node2 = this.stack[this.stack.length - 1]; + if (this.data.inReference) { + const referenceType = this.data.referenceType || "shortcut"; + node2.type += "Reference"; + node2.referenceType = referenceType; + delete node2.url; + delete node2.title; } else { - delete context.identifier; - delete context.label; + delete node2.identifier; + delete node2.label; } - setData("referenceType"); + this.data.referenceType = void 0; } function onexitlabeltext(token) { - const ancestor = this.stack[this.stack.length - 2]; const string3 = this.sliceSerialize(token); + const ancestor = this.stack[this.stack.length - 2]; ancestor.label = decodeString(string3); ancestor.identifier = normalizeIdentifier(string3).toLowerCase(); } function onexitlabel() { const fragment = this.stack[this.stack.length - 1]; const value = this.resume(); - const node = this.stack[this.stack.length - 1]; - setData("inReference", true); - if (node.type === "link") { - node.children = fragment.children; + const node2 = this.stack[this.stack.length - 1]; + this.data.inReference = true; + if (node2.type === "link") { + const children = fragment.children; + node2.children = children; } else { - node.alt = value; + node2.alt = value; } } function onexitresourcedestinationstring() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.url = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.url = data3; } function onexitresourcetitlestring() { const data3 = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.title = data3; + const node2 = this.stack[this.stack.length - 1]; + node2.title = data3; } function onexitresource() { - setData("inReference"); + this.data.inReference = void 0; } function onenterreference() { - setData("referenceType", "collapsed"); + this.data.referenceType = "collapsed"; } function onexitreferencestring(token) { const label = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.label = label; - node.identifier = normalizeIdentifier( + const node2 = this.stack[this.stack.length - 1]; + node2.label = label; + node2.identifier = normalizeIdentifier( this.sliceSerialize(token) ).toLowerCase(); - setData("referenceType", "full"); + this.data.referenceType = "full"; } function onexitcharacterreferencemarker(token) { - setData("characterReferenceType", token.type); + this.data.characterReferenceType = token.type; } function onexitcharacterreferencevalue(token) { const data3 = this.sliceSerialize(token); - const type = getData("characterReferenceType"); + const type = this.data.characterReferenceType; let value; if (type) { value = decodeNumericCharacterReference( data3, type === "characterReferenceMarkerNumeric" ? 10 : 16 ); - setData("characterReferenceType"); + this.data.characterReferenceType = void 0; } else { - value = decodeNamedCharacterReference(data3); + const result = decodeNamedCharacterReference(data3); + value = result; } const tail = this.stack.pop(); tail.value += value; - tail.position.end = point3(token.end); + tail.position.end = point2(token.end); } function onexitautolinkprotocol(token) { onexitdata.call(this, token); - const node = this.stack[this.stack.length - 1]; - node.url = this.sliceSerialize(token); + const node2 = this.stack[this.stack.length - 1]; + node2.url = this.sliceSerialize(token); } function onexitautolinkemail(token) { onexitdata.call(this, token); - const node = this.stack[this.stack.length - 1]; - node.url = "mailto:" + this.sliceSerialize(token); + const node2 = this.stack[this.stack.length - 1]; + node2.url = "mailto:" + this.sliceSerialize(token); } function blockQuote2() { return { @@ -20118,7 +21402,8 @@ function compiler(options = {}) { function heading2() { return { type: "heading", - depth: void 0, + // @ts-expect-error `depth` will be set later. + depth: 0, children: [] }; } @@ -20127,7 +21412,7 @@ function compiler(options = {}) { type: "break" }; } - function html4() { + function html5() { return { type: "html", value: "" @@ -20149,205 +21434,1034 @@ function compiler(options = {}) { children: [] }; } - function list3(token) { - return { - type: "list", - ordered: token.type === "listOrdered", - start: null, - spread: token._spread, - children: [] - }; + function list3(token) { + return { + type: "list", + ordered: token.type === "listOrdered", + start: null, + spread: token._spread, + children: [] + }; + } + function listItem2(token) { + return { + type: "listItem", + spread: token._spread, + checked: null, + children: [] + }; + } + function paragraph2() { + return { + type: "paragraph", + children: [] + }; + } + function strong2() { + return { + type: "strong", + children: [] + }; + } + function text5() { + return { + type: "text", + value: "" + }; + } + function thematicBreak3() { + return { + type: "thematicBreak" + }; + } +} +function point2(d) { + return { + line: d.line, + column: d.column, + offset: d.offset + }; +} +function configure(combined, extensions) { + let index2 = -1; + while (++index2 < extensions.length) { + const value = extensions[index2]; + if (Array.isArray(value)) { + configure(combined, value); + } else { + extension(combined, value); + } + } +} +function extension(combined, extension2) { + let key; + for (key in extension2) { + if (own3.call(extension2, key)) { + switch (key) { + case "canContainEols": { + const right = extension2[key]; + if (right) { + combined[key].push(...right); + } + break; + } + case "transforms": { + const right = extension2[key]; + if (right) { + combined[key].push(...right); + } + break; + } + case "enter": + case "exit": { + const right = extension2[key]; + if (right) { + Object.assign(combined[key], right); + } + break; + } + } + } + } +} +function defaultOnError(left, right) { + if (left) { + throw new Error( + "Cannot close `" + left.type + "` (" + stringifyPosition({ + start: left.start, + end: left.end + }) + "): a different token (`" + right.type + "`, " + stringifyPosition({ + start: right.start, + end: right.end + }) + ") is open" + ); + } else { + throw new Error( + "Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ + start: right.start, + end: right.end + }) + ") is still open" + ); + } +} + +// node_modules/remark-parse/lib/index.js +function remarkParse(options) { + const self2 = this; + self2.parser = parser; + function parser(doc) { + return fromMarkdown(doc, { + ...self2.data("settings"), + ...options, + // Note: these options are not in the readme. + // The goal is for them to be set by plugins on `data` instead of being + // passed by users. + extensions: self2.data("micromarkExtensions") || [], + mdastExtensions: self2.data("fromMarkdownExtensions") || [] + }); + } +} + +// node_modules/mdast-util-to-hast/lib/handlers/blockquote.js +function blockquote(state, node2) { + const result = { + type: "element", + tagName: "blockquote", + properties: {}, + children: state.wrap(state.all(node2), true) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/break.js +function hardBreak(state, node2) { + const result = { type: "element", tagName: "br", properties: {}, children: [] }; + state.patch(node2, result); + return [state.applyData(node2, result), { type: "text", value: "\n" }]; +} + +// node_modules/mdast-util-to-hast/lib/handlers/code.js +function code(state, node2) { + const value = node2.value ? node2.value + "\n" : ""; + const properties = {}; + if (node2.lang) { + properties.className = ["language-" + node2.lang]; + } + let result = { + type: "element", + tagName: "code", + properties, + children: [{ type: "text", value }] + }; + if (node2.meta) { + result.data = { meta: node2.meta }; + } + state.patch(node2, result); + result = state.applyData(node2, result); + result = { type: "element", tagName: "pre", properties: {}, children: [result] }; + state.patch(node2, result); + return result; +} + +// node_modules/mdast-util-to-hast/lib/handlers/delete.js +function strikethrough(state, node2) { + const result = { + type: "element", + tagName: "del", + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/emphasis.js +function emphasis(state, node2) { + const result = { + type: "element", + tagName: "em", + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js +function footnoteReference(state, node2) { + const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-"; + const id = String(node2.identifier).toUpperCase(); + const safeId = normalizeUri(id.toLowerCase()); + const index2 = state.footnoteOrder.indexOf(id); + let counter; + let reuseCounter = state.footnoteCounts.get(id); + if (reuseCounter === void 0) { + reuseCounter = 0; + state.footnoteOrder.push(id); + counter = state.footnoteOrder.length; + } else { + counter = index2 + 1; + } + reuseCounter += 1; + state.footnoteCounts.set(id, reuseCounter); + const link2 = { + type: "element", + tagName: "a", + properties: { + href: "#" + clobberPrefix + "fn-" + safeId, + id: clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""), + dataFootnoteRef: true, + ariaDescribedBy: ["footnote-label"] + }, + children: [{ type: "text", value: String(counter) }] + }; + state.patch(node2, link2); + const sup = { + type: "element", + tagName: "sup", + properties: {}, + children: [link2] + }; + state.patch(node2, sup); + return state.applyData(node2, sup); +} + +// node_modules/mdast-util-to-hast/lib/handlers/heading.js +function heading(state, node2) { + const result = { + type: "element", + tagName: "h" + node2.depth, + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/html.js +function html(state, node2) { + if (state.options.allowDangerousHtml) { + const result = { type: "raw", value: node2.value }; + state.patch(node2, result); + return state.applyData(node2, result); + } + return void 0; +} + +// node_modules/mdast-util-to-hast/lib/revert.js +function revert(state, node2) { + const subtype = node2.referenceType; + let suffix = "]"; + if (subtype === "collapsed") { + suffix += "[]"; + } else if (subtype === "full") { + suffix += "[" + (node2.label || node2.identifier) + "]"; + } + if (node2.type === "imageReference") { + return [{ type: "text", value: "![" + node2.alt + suffix }]; + } + const contents = state.all(node2); + const head = contents[0]; + if (head && head.type === "text") { + head.value = "[" + head.value; + } else { + contents.unshift({ type: "text", value: "[" }); + } + const tail = contents[contents.length - 1]; + if (tail && tail.type === "text") { + tail.value += suffix; + } else { + contents.push({ type: "text", value: suffix }); + } + return contents; +} + +// node_modules/mdast-util-to-hast/lib/handlers/image-reference.js +function imageReference(state, node2) { + const id = String(node2.identifier).toUpperCase(); + const def = state.definitionById.get(id); + if (!def) { + return revert(state, node2); + } + const properties = { src: normalizeUri(def.url || ""), alt: node2.alt }; + if (def.title !== null && def.title !== void 0) { + properties.title = def.title; } - function listItem2(token) { - return { - type: "listItem", - spread: token._spread, - checked: null, - children: [] - }; + const result = { type: "element", tagName: "img", properties, children: [] }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/image.js +function image(state, node2) { + const properties = { src: normalizeUri(node2.url) }; + if (node2.alt !== null && node2.alt !== void 0) { + properties.alt = node2.alt; } - function paragraph2() { - return { - type: "paragraph", - children: [] - }; + if (node2.title !== null && node2.title !== void 0) { + properties.title = node2.title; } - function strong2() { - return { - type: "strong", - children: [] - }; + const result = { type: "element", tagName: "img", properties, children: [] }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/inline-code.js +function inlineCode(state, node2) { + const text5 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") }; + state.patch(node2, text5); + const result = { + type: "element", + tagName: "code", + properties: {}, + children: [text5] + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/link-reference.js +function linkReference(state, node2) { + const id = String(node2.identifier).toUpperCase(); + const def = state.definitionById.get(id); + if (!def) { + return revert(state, node2); } - function text5() { - return { - type: "text", - value: "" - }; + const properties = { href: normalizeUri(def.url || "") }; + if (def.title !== null && def.title !== void 0) { + properties.title = def.title; } - function thematicBreak3() { - return { - type: "thematicBreak" - }; + const result = { + type: "element", + tagName: "a", + properties, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/link.js +function link(state, node2) { + const properties = { href: normalizeUri(node2.url) }; + if (node2.title !== null && node2.title !== void 0) { + properties.title = node2.title; } + const result = { + type: "element", + tagName: "a", + properties, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); } -function configure(combined, extensions) { + +// node_modules/mdast-util-to-hast/lib/handlers/list-item.js +function listItem(state, node2, parent) { + const results = state.all(node2); + const loose = parent ? listLoose(parent) : listItemLoose(node2); + const properties = {}; + const children = []; + if (typeof node2.checked === "boolean") { + const head = results[0]; + let paragraph2; + if (head && head.type === "element" && head.tagName === "p") { + paragraph2 = head; + } else { + paragraph2 = { type: "element", tagName: "p", properties: {}, children: [] }; + results.unshift(paragraph2); + } + if (paragraph2.children.length > 0) { + paragraph2.children.unshift({ type: "text", value: " " }); + } + paragraph2.children.unshift({ + type: "element", + tagName: "input", + properties: { type: "checkbox", checked: node2.checked, disabled: true }, + children: [] + }); + properties.className = ["task-list-item"]; + } let index2 = -1; - while (++index2 < extensions.length) { - const value = extensions[index2]; - if (Array.isArray(value)) { - configure(combined, value); + while (++index2 < results.length) { + const child = results[index2]; + if (loose || index2 !== 0 || child.type !== "element" || child.tagName !== "p") { + children.push({ type: "text", value: "\n" }); + } + if (child.type === "element" && child.tagName === "p" && !loose) { + children.push(...child.children); } else { - extension(combined, value); + children.push(child); } } - return combined; + const tail = results[results.length - 1]; + if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) { + children.push({ type: "text", value: "\n" }); + } + const result = { type: "element", tagName: "li", properties, children }; + state.patch(node2, result); + return state.applyData(node2, result); } -function extension(combined, extension2) { - let key; - for (key in extension2) { - if (own4.call(extension2, key)) { - const list3 = key === "canContainEols" || key === "transforms"; - const maybe = own4.call(combined, key) ? combined[key] : void 0; - const left = maybe || (combined[key] = list3 ? [] : {}); - const right = extension2[key]; - if (right) { - if (list3) { - combined[key] = [...left, ...right]; - } else { - Object.assign(left, right); - } - } +function listLoose(node2) { + let loose = false; + if (node2.type === "list") { + loose = node2.spread || false; + const children = node2.children; + let index2 = -1; + while (!loose && ++index2 < children.length) { + loose = listItemLoose(children[index2]); } } + return loose; } -function defaultOnError(left, right) { - if (left) { - throw new Error( - "Cannot close `" + left.type + "` (" + stringifyPosition({ - start: left.start, - end: left.end - }) + "): a different token (`" + right.type + "`, " + stringifyPosition({ - start: right.start, - end: right.end - }) + ") is open" - ); - } else { - throw new Error( - "Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ - start: right.start, - end: right.end - }) + ") is still open" - ); +function listItemLoose(node2) { + const spread = node2.spread; + return spread === null || spread === void 0 ? node2.children.length > 1 : spread; +} + +// node_modules/mdast-util-to-hast/lib/handlers/list.js +function list2(state, node2) { + const properties = {}; + const results = state.all(node2); + let index2 = -1; + if (typeof node2.start === "number" && node2.start !== 1) { + properties.start = node2.start; + } + while (++index2 < results.length) { + const child = results[index2]; + if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) { + properties.className = ["contains-task-list"]; + break; + } } + const result = { + type: "element", + tagName: node2.ordered ? "ol" : "ul", + properties, + children: state.wrap(results, true) + }; + state.patch(node2, result); + return state.applyData(node2, result); } -// node_modules/@mdx-js/mdx/node_modules/remark-parse/lib/index.js -function remarkParse(options) { - const parser = (doc) => { - const settings = this.data("settings"); - return fromMarkdown( - doc, - Object.assign({}, settings, options, { - extensions: this.data("micromarkExtensions") || [], - mdastExtensions: this.data("fromMarkdownExtensions") || [] - }) - ); +// node_modules/mdast-util-to-hast/lib/handlers/paragraph.js +function paragraph(state, node2) { + const result = { + type: "element", + tagName: "p", + properties: {}, + children: state.all(node2) }; - Object.assign(this, { Parser: parser }); + state.patch(node2, result); + return state.applyData(node2, result); } -// node_modules/@mdx-js/mdx/node_modules/remark-parse/index.js -var remark_parse_default = remarkParse; +// node_modules/mdast-util-to-hast/lib/handlers/root.js +function root(state, node2) { + const result = { type: "root", children: state.wrap(state.all(node2)) }; + state.patch(node2, result); + return state.applyData(node2, result); +} -// node_modules/@mdx-js/mdx/node_modules/unist-builder/index.js -var u = function(type, props, value) { - var node = { type: String(type) }; - if ((value === void 0 || value === null) && (typeof props === "string" || Array.isArray(props))) { - value = props; - } else { - Object.assign(node, props); +// node_modules/mdast-util-to-hast/lib/handlers/strong.js +function strong(state, node2) { + const result = { + type: "element", + tagName: "strong", + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/unist-util-position/lib/index.js +var pointEnd = point3("end"); +var pointStart = point3("start"); +function point3(type) { + return point4; + function point4(node2) { + const point5 = node2 && node2.position && node2.position[type] || {}; + if (typeof point5.line === "number" && point5.line > 0 && typeof point5.column === "number" && point5.column > 0) { + return { + line: point5.line, + column: point5.column, + offset: typeof point5.offset === "number" && point5.offset > -1 ? point5.offset : void 0 + }; + } } - if (Array.isArray(value)) { - node.children = value; - } else if (value !== void 0 && value !== null) { - node.value = String(value); +} +function position2(node2) { + const start2 = pointStart(node2); + const end = pointEnd(node2); + if (start2 && end) { + return { start: start2, end }; } - return node; -}; +} -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/traverse.js -var own5 = {}.hasOwnProperty; -function unknown(h, node) { - const data2 = node.data || {}; - if ("value" in node && !(own5.call(data2, "hName") || own5.call(data2, "hProperties") || own5.call(data2, "hChildren"))) { - return h.augment(node, u("text", node.value)); - } - return h(node, "div", all2(h, node)); -} -function one2(h, node, parent) { - const type = node && node.type; - let fn; - if (!type) { - throw new Error("Expected node, got `" + node + "`"); - } - if (own5.call(h.handlers, type)) { - fn = h.handlers[type]; - } else if (h.passThrough && h.passThrough.includes(type)) { - fn = returnNode; - } else { - fn = h.unknownHandler; +// node_modules/mdast-util-to-hast/lib/handlers/table.js +function table(state, node2) { + const rows = state.all(node2); + const firstRow = rows.shift(); + const tableContent = []; + if (firstRow) { + const head = { + type: "element", + tagName: "thead", + properties: {}, + children: state.wrap([firstRow], true) + }; + state.patch(node2.children[0], head); + tableContent.push(head); } - return (typeof fn === "function" ? fn : unknown)(h, node, parent); + if (rows.length > 0) { + const body = { + type: "element", + tagName: "tbody", + properties: {}, + children: state.wrap(rows, true) + }; + const start2 = pointStart(node2.children[1]); + const end = pointEnd(node2.children[node2.children.length - 1]); + if (start2 && end) + body.position = { start: start2, end }; + tableContent.push(body); + } + const result = { + type: "element", + tagName: "table", + properties: {}, + children: state.wrap(tableContent, true) + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/table-row.js +function tableRow(state, node2, parent) { + const siblings = parent ? parent.children : void 0; + const rowIndex = siblings ? siblings.indexOf(node2) : 1; + const tagName = rowIndex === 0 ? "th" : "td"; + const align = parent && parent.type === "table" ? parent.align : void 0; + const length = align ? align.length : node2.children.length; + let cellIndex = -1; + const cells = []; + while (++cellIndex < length) { + const cell = node2.children[cellIndex]; + const properties = {}; + const alignValue = align ? align[cellIndex] : void 0; + if (alignValue) { + properties.align = alignValue; + } + let result2 = { type: "element", tagName, properties, children: [] }; + if (cell) { + result2.children = state.all(cell); + state.patch(cell, result2); + result2 = state.applyData(cell, result2); + } + cells.push(result2); + } + const result = { + type: "element", + tagName: "tr", + properties: {}, + children: state.wrap(cells, true) + }; + state.patch(node2, result); + return state.applyData(node2, result); } -function returnNode(h, node) { - return "children" in node ? { ...node, children: all2(h, node) } : node; + +// node_modules/mdast-util-to-hast/lib/handlers/table-cell.js +function tableCell(state, node2) { + const result = { + type: "element", + tagName: "td", + // Assume body cell. + properties: {}, + children: state.all(node2) + }; + state.patch(node2, result); + return state.applyData(node2, result); } -function all2(h, parent) { - const values = []; - if ("children" in parent) { - const nodes = parent.children; - let index2 = -1; - while (++index2 < nodes.length) { - const result = one2(h, nodes[index2], parent); - if (result) { - if (index2 && nodes[index2 - 1].type === "break") { - if (!Array.isArray(result) && result.type === "text") { - result.value = result.value.replace(/^\s+/, ""); - } - if (!Array.isArray(result) && result.type === "element") { - const head = result.children[0]; - if (head && head.type === "text") { - head.value = head.value.replace(/^\s+/, ""); - } - } + +// node_modules/trim-lines/index.js +var tab = 9; +var space = 32; +function trimLines(value) { + const source = String(value); + const search2 = /\r?\n|\r/g; + let match = search2.exec(source); + let last = 0; + const lines = []; + while (match) { + lines.push( + trimLine(source.slice(last, match.index), last > 0, true), + match[0] + ); + last = match.index + match[0].length; + match = search2.exec(source); + } + lines.push(trimLine(source.slice(last), last > 0, false)); + return lines.join(""); +} +function trimLine(value, start2, end) { + let startIndex = 0; + let endIndex = value.length; + if (start2) { + let code2 = value.codePointAt(startIndex); + while (code2 === tab || code2 === space) { + startIndex++; + code2 = value.codePointAt(startIndex); + } + } + if (end) { + let code2 = value.codePointAt(endIndex - 1); + while (code2 === tab || code2 === space) { + endIndex--; + code2 = value.codePointAt(endIndex - 1); + } + } + return endIndex > startIndex ? value.slice(startIndex, endIndex) : ""; +} + +// node_modules/mdast-util-to-hast/lib/handlers/text.js +function text3(state, node2) { + const result = { type: "text", value: trimLines(String(node2.value)) }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js +function thematicBreak2(state, node2) { + const result = { + type: "element", + tagName: "hr", + properties: {}, + children: [] + }; + state.patch(node2, result); + return state.applyData(node2, result); +} + +// node_modules/mdast-util-to-hast/lib/handlers/index.js +var handlers = { + blockquote, + break: hardBreak, + code, + delete: strikethrough, + emphasis, + footnoteReference, + heading, + html, + imageReference, + image, + inlineCode, + linkReference, + link, + listItem, + list: list2, + paragraph, + // @ts-expect-error: root is different, but hard to type. + root, + strong, + table, + tableCell, + tableRow, + text: text3, + thematicBreak: thematicBreak2, + toml: ignore, + yaml: ignore, + definition: ignore, + footnoteDefinition: ignore +}; +function ignore() { + return void 0; +} + +// node_modules/@ungap/structured-clone/esm/types.js +var VOID = -1; +var PRIMITIVE = 0; +var ARRAY = 1; +var OBJECT = 2; +var DATE = 3; +var REGEXP = 4; +var MAP = 5; +var SET = 6; +var ERROR = 7; +var BIGINT = 8; + +// node_modules/@ungap/structured-clone/esm/deserialize.js +var env = typeof self === "object" ? self : globalThis; +var deserializer = ($, _) => { + const as = (out, index2) => { + $.set(index2, out); + return out; + }; + const unpair = (index2) => { + if ($.has(index2)) + return $.get(index2); + const [type, value] = _[index2]; + switch (type) { + case PRIMITIVE: + case VOID: + return as(value, index2); + case ARRAY: { + const arr = as([], index2); + for (const index3 of value) + arr.push(unpair(index3)); + return arr; + } + case OBJECT: { + const object = as({}, index2); + for (const [key, index3] of value) + object[unpair(key)] = unpair(index3); + return object; + } + case DATE: + return as(new Date(value), index2); + case REGEXP: { + const { source, flags } = value; + return as(new RegExp(source, flags), index2); + } + case MAP: { + const map = as(/* @__PURE__ */ new Map(), index2); + for (const [key, index3] of value) + map.set(unpair(key), unpair(index3)); + return map; + } + case SET: { + const set = as(/* @__PURE__ */ new Set(), index2); + for (const index3 of value) + set.add(unpair(index3)); + return set; + } + case ERROR: { + const { name: name2, message } = value; + return as(new env[name2](message), index2); + } + case BIGINT: + return as(BigInt(value), index2); + case "BigInt": + return as(Object(BigInt(value)), index2); + } + return as(new env[type](value), index2); + }; + return unpair; +}; +var deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0); + +// node_modules/@ungap/structured-clone/esm/serialize.js +var EMPTY = ""; +var { toString: toString3 } = {}; +var { keys } = Object; +var typeOf = (value) => { + const type = typeof value; + if (type !== "object" || !value) + return [PRIMITIVE, type]; + const asString = toString3.call(value).slice(8, -1); + switch (asString) { + case "Array": + return [ARRAY, EMPTY]; + case "Object": + return [OBJECT, EMPTY]; + case "Date": + return [DATE, EMPTY]; + case "RegExp": + return [REGEXP, EMPTY]; + case "Map": + return [MAP, EMPTY]; + case "Set": + return [SET, EMPTY]; + } + if (asString.includes("Array")) + return [ARRAY, asString]; + if (asString.includes("Error")) + return [ERROR, asString]; + return [OBJECT, asString]; +}; +var shouldSkip = ([TYPE, type]) => TYPE === PRIMITIVE && (type === "function" || type === "symbol"); +var serializer = (strict, json, $, _) => { + const as = (out, value) => { + const index2 = _.push(out) - 1; + $.set(value, index2); + return index2; + }; + const pair = (value) => { + if ($.has(value)) + return $.get(value); + let [TYPE, type] = typeOf(value); + switch (TYPE) { + case PRIMITIVE: { + let entry = value; + switch (type) { + case "bigint": + TYPE = BIGINT; + entry = value.toString(); + break; + case "function": + case "symbol": + if (strict) + throw new TypeError("unable to serialize " + type); + entry = null; + break; + case "undefined": + return as([VOID], value); + } + return as([TYPE, entry], value); + } + case ARRAY: { + if (type) + return as([type, [...value]], value); + const arr = []; + const index2 = as([TYPE, arr], value); + for (const entry of value) + arr.push(pair(entry)); + return index2; + } + case OBJECT: { + if (type) { + switch (type) { + case "BigInt": + return as([type, value.toString()], value); + case "Boolean": + case "Number": + case "String": + return as([type, value.valueOf()], value); + } + } + if (json && "toJSON" in value) + return pair(value.toJSON()); + const entries = []; + const index2 = as([TYPE, entries], value); + for (const key of keys(value)) { + if (strict || !shouldSkip(typeOf(value[key]))) + entries.push([pair(key), pair(value[key])]); } - if (Array.isArray(result)) { - values.push(...result); - } else { - values.push(result); + return index2; + } + case DATE: + return as([TYPE, value.toISOString()], value); + case REGEXP: { + const { source, flags } = value; + return as([TYPE, { source, flags }], value); + } + case MAP: { + const entries = []; + const index2 = as([TYPE, entries], value); + for (const [key, entry] of value) { + if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry)))) + entries.push([pair(key), pair(entry)]); + } + return index2; + } + case SET: { + const entries = []; + const index2 = as([TYPE, entries], value); + for (const entry of value) { + if (strict || !shouldSkip(typeOf(entry))) + entries.push(pair(entry)); } + return index2; + } + } + const { message } = value; + return as([TYPE, { name: type, message }], value); + }; + return pair; +}; +var serialize = (value, { json, lossy } = {}) => { + const _ = []; + return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _; +}; + +// node_modules/@ungap/structured-clone/esm/index.js +var esm_default = typeof structuredClone === "function" ? ( + /* c8 ignore start */ + (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any) +) : (any, options) => deserialize(serialize(any, options)); + +// node_modules/mdast-util-to-hast/lib/footer.js +function defaultFootnoteBackContent(_, rereferenceIndex) { + const result = [{ type: "text", value: "\u21A9" }]; + if (rereferenceIndex > 1) { + result.push({ + type: "element", + tagName: "sup", + properties: {}, + children: [{ type: "text", value: String(rereferenceIndex) }] + }); + } + return result; +} +function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) { + return "Back to reference " + (referenceIndex + 1) + (rereferenceIndex > 1 ? "-" + rereferenceIndex : ""); +} +function footer(state) { + const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-"; + const footnoteBackContent = state.options.footnoteBackContent || defaultFootnoteBackContent; + const footnoteBackLabel = state.options.footnoteBackLabel || defaultFootnoteBackLabel; + const footnoteLabel = state.options.footnoteLabel || "Footnotes"; + const footnoteLabelTagName = state.options.footnoteLabelTagName || "h2"; + const footnoteLabelProperties = state.options.footnoteLabelProperties || { + className: ["sr-only"] + }; + const listItems = []; + let referenceIndex = -1; + while (++referenceIndex < state.footnoteOrder.length) { + const def = state.footnoteById.get(state.footnoteOrder[referenceIndex]); + if (!def) { + continue; + } + const content3 = state.all(def); + const id = String(def.identifier).toUpperCase(); + const safeId = normalizeUri(id.toLowerCase()); + let rereferenceIndex = 0; + const backReferences = []; + const counts = state.footnoteCounts.get(id); + while (counts !== void 0 && ++rereferenceIndex <= counts) { + if (backReferences.length > 0) { + backReferences.push({ type: "text", value: " " }); + } + let children = typeof footnoteBackContent === "string" ? footnoteBackContent : footnoteBackContent(referenceIndex, rereferenceIndex); + if (typeof children === "string") { + children = { type: "text", value: children }; + } + backReferences.push({ + type: "element", + tagName: "a", + properties: { + href: "#" + clobberPrefix + "fnref-" + safeId + (rereferenceIndex > 1 ? "-" + rereferenceIndex : ""), + dataFootnoteBackref: "", + ariaLabel: typeof footnoteBackLabel === "string" ? footnoteBackLabel : footnoteBackLabel(referenceIndex, rereferenceIndex), + className: ["data-footnote-backref"] + }, + children: Array.isArray(children) ? children : [children] + }); + } + const tail = content3[content3.length - 1]; + if (tail && tail.type === "element" && tail.tagName === "p") { + const tailTail = tail.children[tail.children.length - 1]; + if (tailTail && tailTail.type === "text") { + tailTail.value += " "; + } else { + tail.children.push({ type: "text", value: " " }); } + tail.children.push(...backReferences); + } else { + content3.push(...backReferences); } + const listItem2 = { + type: "element", + tagName: "li", + properties: { id: clobberPrefix + "fn-" + safeId }, + children: state.wrap(content3, true) + }; + state.patch(def, listItem2); + listItems.push(listItem2); } - return values; + if (listItems.length === 0) { + return; + } + return { + type: "element", + tagName: "section", + properties: { dataFootnotes: true, className: ["footnotes"] }, + children: [ + { + type: "element", + tagName: footnoteLabelTagName, + properties: { + ...esm_default(footnoteLabelProperties), + id: "footnote-label" + }, + children: [{ type: "text", value: footnoteLabel }] + }, + { type: "text", value: "\n" }, + { + type: "element", + tagName: "ol", + properties: {}, + children: state.wrap(listItems, true) + }, + { type: "text", value: "\n" } + ] + }; } -// node_modules/unist-util-is/index.js -var convert = function(test) { - if (test === void 0 || test === null) { - return ok; - } - if (typeof test === "string") { - return typeFactory(test); - } - if (typeof test === "object") { - return Array.isArray(test) ? anyFactory(test) : propsFactory(test); - } - if (typeof test === "function") { - return castFactory(test); +// node_modules/unist-util-is/lib/index.js +var convert = ( + // Note: overloads in JSDoc can’t yet use different `@template`s. + /** + * @type {( + * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) & + * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) & + * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) & + * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) & + * ((test?: Test) => Check) + * )} + */ + /** + * @param {Test} [test] + * @returns {Check} + */ + function(test) { + if (test === null || test === void 0) { + return ok2; + } + if (typeof test === "function") { + return castFactory(test); + } + if (typeof test === "object") { + return Array.isArray(test) ? anyFactory(test) : propsFactory(test); + } + if (typeof test === "string") { + return typeFactory(test); + } + throw new Error("Expected function, string, or object as test"); } - throw new Error("Expected function, string, or object as test"); -}; +); function anyFactory(tests) { const checks2 = []; let index2 = -1; @@ -20358,18 +22472,27 @@ function anyFactory(tests) { function any(...parameters) { let index3 = -1; while (++index3 < checks2.length) { - if (checks2[index3].call(this, ...parameters)) + if (checks2[index3].apply(this, parameters)) return true; } return false; } } function propsFactory(check) { - return castFactory(all4); - function all4(node) { + const checkAsRecord = ( + /** @type {Record} */ + check + ); + return castFactory(all3); + function all3(node2) { + const nodeAsRecord = ( + /** @type {Record} */ + /** @type {unknown} */ + node2 + ); let key; for (key in check) { - if (node[key] !== check[key]) + if (nodeAsRecord[key] !== checkAsRecord[key]) return false; } return true; @@ -20377,74 +22500,102 @@ function propsFactory(check) { } function typeFactory(check) { return castFactory(type); - function type(node) { - return node && node.type === check; + function type(node2) { + return node2 && node2.type === check; } } -function castFactory(check) { - return assertion; - function assertion(...parameters) { - return Boolean(check.call(this, ...parameters)); +function castFactory(testFunction) { + return check; + function check(value, index2, parent) { + return Boolean( + looksLikeANode(value) && testFunction.call( + this, + value, + typeof index2 === "number" ? index2 : void 0, + parent || void 0 + ) + ); } } -function ok() { +function ok2() { return true; } +function looksLikeANode(value) { + return value !== null && typeof value === "object" && "type" in value; +} -// node_modules/unist-util-visit-parents/color.js +// node_modules/unist-util-visit-parents/lib/color.node.js function color2(d) { return "\x1B[33m" + d + "\x1B[39m"; } -// node_modules/unist-util-visit-parents/index.js +// node_modules/unist-util-visit-parents/lib/index.js +var empty3 = []; var CONTINUE2 = true; -var SKIP2 = "skip"; var EXIT2 = false; -var visitParents = function(tree, test, visitor, reverse) { +var SKIP2 = "skip"; +function visitParents(tree, test, visitor, reverse) { + let check; if (typeof test === "function" && typeof visitor !== "function") { reverse = visitor; visitor = test; - test = null; + } else { + check = test; } - const is = convert(test); + const is2 = convert(check); const step = reverse ? -1 : 1; - factory2(tree, null, [])(); - function factory2(node, index2, parents) { - const value = typeof node === "object" && node !== null ? node : {}; - let name2; + factory(tree, void 0, [])(); + function factory(node2, index2, parents) { + const value = ( + /** @type {Record} */ + node2 && typeof node2 === "object" ? node2 : {} + ); if (typeof value.type === "string") { - name2 = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : void 0; + const name2 = ( + // `hast` + typeof value.tagName === "string" ? value.tagName : ( + // `xast` + typeof value.name === "string" ? value.name : void 0 + ) + ); Object.defineProperty(visit3, "name", { - value: "node (" + color2(value.type + (name2 ? "<" + name2 + ">" : "")) + ")" + value: "node (" + color2(node2.type + (name2 ? "<" + name2 + ">" : "")) + ")" }); } return visit3; function visit3() { - let result = []; + let result = empty3; let subresult; let offset2; let grandparents; - if (!test || is(node, index2, parents[parents.length - 1] || null)) { - result = toResult2(visitor(node, parents)); + if (!test || is2(node2, index2, parents[parents.length - 1] || void 0)) { + result = toResult2(visitor(node2, parents)); if (result[0] === EXIT2) { return result; } } - if (node.children && result[0] !== SKIP2) { - offset2 = (reverse ? node.children.length : -1) + step; - grandparents = parents.concat(node); - while (offset2 > -1 && offset2 < node.children.length) { - subresult = factory2(node.children[offset2], offset2, grandparents)(); - if (subresult[0] === EXIT2) { - return subresult; + if ("children" in node2 && node2.children) { + const nodeAsParent = ( + /** @type {UnistParent} */ + node2 + ); + if (nodeAsParent.children && result[0] !== SKIP2) { + offset2 = (reverse ? nodeAsParent.children.length : -1) + step; + grandparents = parents.concat(nodeAsParent); + while (offset2 > -1 && offset2 < nodeAsParent.children.length) { + const child = nodeAsParent.children[offset2]; + subresult = factory(child, offset2, grandparents)(); + if (subresult[0] === EXIT2) { + return subresult; + } + offset2 = typeof subresult[1] === "number" ? subresult[1] : offset2 + step; } - offset2 = typeof subresult[1] === "number" ? subresult[1] : offset2 + step; } } return result; } } -}; +} function toResult2(value) { if (Array.isArray(value)) { return value; @@ -20452,701 +22603,979 @@ function toResult2(value) { if (typeof value === "number") { return [CONTINUE2, value]; } - return [value]; + return value === null || value === void 0 ? empty3 : [value]; } -// node_modules/@mdx-js/mdx/node_modules/unist-util-visit/index.js -var visit2 = function(tree, test, visitor, reverse) { - if (typeof test === "function" && typeof visitor !== "function") { - reverse = visitor; - visitor = test; - test = null; +// node_modules/unist-util-visit/lib/index.js +function visit2(tree, testOrVisitor, visitorOrReverse, maybeReverse) { + let reverse; + let test; + let visitor; + if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") { + test = void 0; + visitor = testOrVisitor; + reverse = visitorOrReverse; + } else { + test = testOrVisitor; + visitor = visitorOrReverse; + reverse = maybeReverse; } visitParents(tree, test, overload, reverse); - function overload(node, parents) { + function overload(node2, parents) { const parent = parents[parents.length - 1]; - return visitor( - node, - parent ? parent.children.indexOf(node) : null, - parent - ); - } -}; - -// node_modules/unist-util-position/index.js -var pointStart = point2("start"); -var pointEnd = point2("end"); -function position2(node) { - return { start: pointStart(node), end: pointEnd(node) }; -} -function point2(type) { - return point3; - function point3(node) { - const point4 = node && node.position && node.position[type] || {}; - return { - line: point4.line || null, - column: point4.column || null, - offset: point4.offset > -1 ? point4.offset : null - }; + const index2 = parent ? parent.children.indexOf(node2) : void 0; + return visitor(node2, index2, parent); } } -// node_modules/@mdx-js/mdx/node_modules/unist-util-generated/index.js -function generated(node) { - return !node || !node.position || !node.position.start || !node.position.start.line || !node.position.start.column || !node.position.end || !node.position.end.line || !node.position.end.column; -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-definitions/index.js -var own6 = {}.hasOwnProperty; -function definitions(node) { - const cache = /* @__PURE__ */ Object.create(null); - if (!node || !node.type) { - throw new Error("mdast-util-definitions expected node"); - } - visit2(node, "definition", (definition3) => { - const id = clean(definition3.identifier); - if (id && !own6.call(cache, id)) { - cache[id] = definition3; +// node_modules/mdast-util-to-hast/lib/state.js +var own4 = {}.hasOwnProperty; +var emptyOptions4 = {}; +function createState(tree, options) { + const settings = options || emptyOptions4; + const definitionById = /* @__PURE__ */ new Map(); + const footnoteById = /* @__PURE__ */ new Map(); + const footnoteCounts = /* @__PURE__ */ new Map(); + const handlers3 = { ...handlers, ...settings.handlers }; + const state = { + all: all3, + applyData, + definitionById, + footnoteById, + footnoteCounts, + footnoteOrder: [], + handlers: handlers3, + one: one2, + options: settings, + patch, + wrap + }; + visit2(tree, function(node2) { + if (node2.type === "definition" || node2.type === "footnoteDefinition") { + const map = node2.type === "definition" ? definitionById : footnoteById; + const id = String(node2.identifier).toUpperCase(); + if (!map.has(id)) { + map.set(id, node2); + } } }); - return definition2; - function definition2(identifier) { - const id = clean(identifier); - return id && own6.call(cache, id) ? cache[id] : null; - } -} -function clean(value) { - return String(value || "").toUpperCase(); -} - -// node_modules/micromark-util-sanitize-uri/index.js -function normalizeUri(value) { - const result = []; - let index2 = -1; - let start3 = 0; - let skip = 0; - while (++index2 < value.length) { - const code2 = value.charCodeAt(index2); - let replace = ""; - if (code2 === 37 && asciiAlphanumeric(value.charCodeAt(index2 + 1)) && asciiAlphanumeric(value.charCodeAt(index2 + 2))) { - skip = 2; - } else if (code2 < 128) { - if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code2))) { - replace = String.fromCharCode(code2); - } - } else if (code2 > 55295 && code2 < 57344) { - const next = value.charCodeAt(index2 + 1); - if (code2 < 56320 && next > 56319 && next < 57344) { - replace = String.fromCharCode(code2, next); - skip = 1; - } else { - replace = "\uFFFD"; + return state; + function one2(node2, parent) { + const type = node2.type; + const handle = state.handlers[type]; + if (own4.call(state.handlers, type) && handle) { + return handle(state, node2, parent); + } + if (state.options.passThrough && state.options.passThrough.includes(type)) { + if ("children" in node2) { + const { children, ...shallow } = node2; + const result = esm_default(shallow); + result.children = state.all(node2); + return result; } - } else { - replace = String.fromCharCode(code2); - } - if (replace) { - result.push(value.slice(start3, index2), encodeURIComponent(replace)); - start3 = index2 + skip + 1; - replace = ""; + return esm_default(node2); } - if (skip) { - index2 += skip; - skip = 0; + const unknown2 = state.options.unknownHandler || defaultUnknownHandler; + return unknown2(state, node2, parent); + } + function all3(parent) { + const values = []; + if ("children" in parent) { + const nodes = parent.children; + let index2 = -1; + while (++index2 < nodes.length) { + const result = state.one(nodes[index2], parent); + if (result) { + if (index2 && nodes[index2 - 1].type === "break") { + if (!Array.isArray(result) && result.type === "text") { + result.value = trimMarkdownSpaceStart(result.value); + } + if (!Array.isArray(result) && result.type === "element") { + const head = result.children[0]; + if (head && head.type === "text") { + head.value = trimMarkdownSpaceStart(head.value); + } + } + } + if (Array.isArray(result)) { + values.push(...result); + } else { + values.push(result); + } + } + } } + return values; } - return result.join("") + value.slice(start3); } - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/wrap.js -function wrap2(nodes, loose) { - const result = []; - let index2 = -1; - if (loose) { - result.push(u("text", "\n")); - } - while (++index2 < nodes.length) { - if (index2) - result.push(u("text", "\n")); - result.push(nodes[index2]); - } - if (loose && nodes.length > 0) { - result.push(u("text", "\n")); - } - return result; +function patch(from, to) { + if (from.position) + to.position = position2(from); } - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/footer.js -function footer(h) { - let index2 = -1; - const listItems = []; - while (++index2 < h.footnoteOrder.length) { - const def = h.footnoteById[h.footnoteOrder[index2].toUpperCase()]; - if (!def) { - continue; - } - const content3 = all2(h, def); - const id = String(def.identifier); - const safeId = normalizeUri(id.toLowerCase()); - let referenceIndex = 0; - const backReferences = []; - while (++referenceIndex <= h.footnoteCounts[id]) { - const backReference = { - type: "element", - tagName: "a", - properties: { - href: "#" + h.clobberPrefix + "fnref-" + safeId + (referenceIndex > 1 ? "-" + referenceIndex : ""), - dataFootnoteBackref: true, - className: ["data-footnote-backref"], - ariaLabel: h.footnoteBackLabel - }, - children: [{ type: "text", value: "\u21A9" }] - }; - if (referenceIndex > 1) { - backReference.children.push({ - type: "element", - tagName: "sup", - children: [{ type: "text", value: String(referenceIndex) }] - }); - } - if (backReferences.length > 0) { - backReferences.push({ type: "text", value: " " }); - } - backReferences.push(backReference); - } - const tail = content3[content3.length - 1]; - if (tail && tail.type === "element" && tail.tagName === "p") { - const tailTail = tail.children[tail.children.length - 1]; - if (tailTail && tailTail.type === "text") { - tailTail.value += " "; +function applyData(from, to) { + let result = to; + if (from && from.data) { + const hName = from.data.hName; + const hChildren = from.data.hChildren; + const hProperties = from.data.hProperties; + if (typeof hName === "string") { + if (result.type === "element") { + result.tagName = hName; } else { - tail.children.push({ type: "text", value: " " }); + const children = "children" in result ? result.children : [result]; + result = { type: "element", tagName: hName, properties: {}, children }; } - tail.children.push(...backReferences); - } else { - content3.push(...backReferences); } - const listItem2 = { - type: "element", - tagName: "li", - properties: { id: h.clobberPrefix + "fn-" + safeId }, - children: wrap2(content3, true) - }; - if (def.position) { - listItem2.position = def.position; + if (result.type === "element" && hProperties) { + Object.assign(result.properties, esm_default(hProperties)); + } + if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) { + result.children = hChildren; } - listItems.push(listItem2); - } - if (listItems.length === 0) { - return null; - } - return { - type: "element", - tagName: "section", - properties: { dataFootnotes: true, className: ["footnotes"] }, - children: [ - { - type: "element", - tagName: h.footnoteLabelTagName, - properties: { - ...JSON.parse(JSON.stringify(h.footnoteLabelProperties)), - id: "footnote-label" - }, - children: [u("text", h.footnoteLabel)] - }, - { type: "text", value: "\n" }, - { - type: "element", - tagName: "ol", - properties: {}, - children: wrap2(listItems, true) - }, - { type: "text", value: "\n" } - ] - }; -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/blockquote.js -function blockquote(h, node) { - return h(node, "blockquote", wrap2(all2(h, node), true)); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/break.js -function hardBreak(h, node) { - return [h(node, "br"), u("text", "\n")]; -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/code.js -function code(h, node) { - const value = node.value ? node.value + "\n" : ""; - const lang = node.lang && node.lang.match(/^[^ \t]+(?=[ \t]|$)/); - const props = {}; - if (lang) { - props.className = ["language-" + lang]; - } - const code2 = h(node, "code", props, [u("text", value)]); - if (node.meta) { - code2.data = { meta: node.meta }; - } - return h(node.position, "pre", [code2]); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/delete.js -function strikethrough(h, node) { - return h(node, "del", all2(h, node)); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js -function emphasis(h, node) { - return h(node, "em", all2(h, node)); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js -function footnoteReference(h, node) { - const id = String(node.identifier); - const safeId = normalizeUri(id.toLowerCase()); - const index2 = h.footnoteOrder.indexOf(id); - let counter; - if (index2 === -1) { - h.footnoteOrder.push(id); - h.footnoteCounts[id] = 1; - counter = h.footnoteOrder.length; - } else { - h.footnoteCounts[id]++; - counter = index2 + 1; } - const reuseCounter = h.footnoteCounts[id]; - return h(node, "sup", [ - h( - node.position, - "a", - { - href: "#" + h.clobberPrefix + "fn-" + safeId, - id: h.clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""), - dataFootnoteRef: true, - ariaDescribedBy: "footnote-label" - }, - [u("text", String(counter))] - ) - ]); + return result; } - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/footnote.js -function footnote(h, node) { - const footnoteById = h.footnoteById; - let no = 1; - while (no in footnoteById) - no++; - const identifier = String(no); - footnoteById[identifier] = { - type: "footnoteDefinition", - identifier, - children: [{ type: "paragraph", children: node.children }], - position: node.position +function defaultUnknownHandler(state, node2) { + const data2 = node2.data || {}; + const result = "value" in node2 && !(own4.call(data2, "hProperties") || own4.call(data2, "hChildren")) ? { type: "text", value: node2.value } : { + type: "element", + tagName: "div", + properties: {}, + children: state.all(node2) }; - return footnoteReference(h, { - type: "footnoteReference", - identifier, - position: node.position - }); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/heading.js -function heading(h, node) { - return h(node, "h" + node.depth, all2(h, node)); + state.patch(node2, result); + return state.applyData(node2, result); } - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/html.js -function html(h, node) { - return h.dangerous ? h.augment(node, u("raw", node.value)) : null; -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/revert.js -function revert(h, node) { - const subtype = node.referenceType; - let suffix = "]"; - if (subtype === "collapsed") { - suffix += "[]"; - } else if (subtype === "full") { - suffix += "[" + (node.label || node.identifier) + "]"; - } - if (node.type === "imageReference") { - return u("text", "![" + node.alt + suffix); +function wrap(nodes, loose) { + const result = []; + let index2 = -1; + if (loose) { + result.push({ type: "text", value: "\n" }); } - const contents = all2(h, node); - const head = contents[0]; - if (head && head.type === "text") { - head.value = "[" + head.value; - } else { - contents.unshift(u("text", "[")); + while (++index2 < nodes.length) { + if (index2) + result.push({ type: "text", value: "\n" }); + result.push(nodes[index2]); } - const tail = contents[contents.length - 1]; - if (tail && tail.type === "text") { - tail.value += suffix; - } else { - contents.push(u("text", suffix)); + if (loose && nodes.length > 0) { + result.push({ type: "text", value: "\n" }); } - return contents; + return result; } - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js -function imageReference(h, node) { - const def = h.definition(node.identifier); - if (!def) { - return revert(h, node); - } - const props = { src: normalizeUri(def.url || ""), alt: node.alt }; - if (def.title !== null && def.title !== void 0) { - props.title = def.title; +function trimMarkdownSpaceStart(value) { + let index2 = 0; + let code2 = value.charCodeAt(index2); + while (code2 === 9 || code2 === 32) { + index2++; + code2 = value.charCodeAt(index2); } - return h(node, "img", props); + return value.slice(index2); } -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/image.js -function image(h, node) { - const props = { src: normalizeUri(node.url), alt: node.alt }; - if (node.title !== null && node.title !== void 0) { - props.title = node.title; +// node_modules/mdast-util-to-hast/lib/index.js +function toHast(tree, options) { + const state = createState(tree, options); + const node2 = state.one(tree, void 0); + const foot = footer(state); + const result = Array.isArray(node2) ? { type: "root", children: node2 } : node2 || { type: "root", children: [] }; + if (foot) { + ok("children" in result); + result.children.push({ type: "text", value: "\n" }, foot); } - return h(node, "img", props); + return result; } -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js -function inlineCode(h, node) { - return h(node, "code", [u("text", node.value.replace(/\r?\n|\r/g, " "))]); +// node_modules/remark-rehype/lib/index.js +function remarkRehype(destination, options) { + if (destination && "run" in destination) { + return async function(tree, file) { + const hastTree = ( + /** @type {HastRoot} */ + toHast(tree, options) + ); + await destination.run(hastTree, file); + }; + } + return function(tree) { + return ( + /** @type {HastRoot} */ + toHast(tree, options || destination) + ); + }; } -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js -function linkReference(h, node) { - const def = h.definition(node.identifier); - if (!def) { - return revert(h, node); - } - const props = { href: normalizeUri(def.url || "") }; - if (def.title !== null && def.title !== void 0) { - props.title = def.title; +// node_modules/bail/index.js +function bail(error) { + if (error) { + throw error; } - return h(node, "a", props, all2(h, node)); } -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/link.js -function link(h, node) { - const props = { href: normalizeUri(node.url) }; - if (node.title !== null && node.title !== void 0) { - props.title = node.title; +// node_modules/unified/lib/index.js +var import_extend = __toESM(require_extend(), 1); + +// node_modules/is-plain-obj/index.js +function isPlainObject(value) { + if (typeof value !== "object" || value === null) { + return false; } - return h(node, "a", props, all2(h, node)); + const prototype = Object.getPrototypeOf(value); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); } -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/list-item.js -function listItem(h, node, parent) { - const result = all2(h, node); - const loose = parent ? listLoose(parent) : listItemLoose(node); - const props = {}; - const wrapped = []; - if (typeof node.checked === "boolean") { - let paragraph2; - if (result[0] && result[0].type === "element" && result[0].tagName === "p") { - paragraph2 = result[0]; - } else { - paragraph2 = h(null, "p", []); - result.unshift(paragraph2); +// node_modules/trough/index.js +function trough() { + const fns = []; + const pipeline = { run: run2, use }; + return pipeline; + function run2(...values) { + let middlewareIndex = -1; + const callback = values.pop(); + if (typeof callback !== "function") { + throw new TypeError("Expected function as last argument, not " + callback); } - if (paragraph2.children.length > 0) { - paragraph2.children.unshift(u("text", " ")); + next(null, ...values); + function next(error, ...output) { + const fn = fns[++middlewareIndex]; + let index2 = -1; + if (error) { + callback(error); + return; + } + while (++index2 < values.length) { + if (output[index2] === null || output[index2] === void 0) { + output[index2] = values[index2]; + } + } + values = output; + if (fn) { + wrap2(fn, next)(...output); + } else { + callback(null, ...output); + } } - paragraph2.children.unshift( - h(null, "input", { - type: "checkbox", - checked: node.checked, - disabled: true - }) - ); - props.className = ["task-list-item"]; } - let index2 = -1; - while (++index2 < result.length) { - const child = result[index2]; - if (loose || index2 !== 0 || child.type !== "element" || child.tagName !== "p") { - wrapped.push(u("text", "\n")); - } - if (child.type === "element" && child.tagName === "p" && !loose) { - wrapped.push(...child.children); - } else { - wrapped.push(child); + function use(middelware) { + if (typeof middelware !== "function") { + throw new TypeError( + "Expected `middelware` to be a function, not " + middelware + ); } + fns.push(middelware); + return pipeline; } - const tail = result[result.length - 1]; - if (tail && (loose || !("tagName" in tail) || tail.tagName !== "p")) { - wrapped.push(u("text", "\n")); - } - return h(node, "li", props, wrapped); -} -function listLoose(node) { - let loose = node.spread; - const children = node.children; - let index2 = -1; - while (!loose && ++index2 < children.length) { - loose = listItemLoose(children[index2]); - } - return Boolean(loose); -} -function listItemLoose(node) { - const spread = node.spread; - return spread === void 0 || spread === null ? node.children.length > 1 : spread; } - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/list.js -function list2(h, node) { - const props = {}; - const name2 = node.ordered ? "ol" : "ul"; - const items = all2(h, node); - let index2 = -1; - if (typeof node.start === "number" && node.start !== 1) { - props.start = node.start; +function wrap2(middleware, callback) { + let called; + return wrapped; + function wrapped(...parameters) { + const fnExpectsCallback = middleware.length > parameters.length; + let result; + if (fnExpectsCallback) { + parameters.push(done); + } + try { + result = middleware.apply(this, parameters); + } catch (error) { + const exception = ( + /** @type {Error} */ + error + ); + if (fnExpectsCallback && called) { + throw exception; + } + return done(exception); + } + if (!fnExpectsCallback) { + if (result instanceof Promise) { + result.then(then, done); + } else if (result instanceof Error) { + done(result); + } else { + then(result); + } + } } - while (++index2 < items.length) { - const item = items[index2]; - if (item.type === "element" && item.tagName === "li" && item.properties && Array.isArray(item.properties.className) && item.properties.className.includes("task-list-item")) { - props.className = ["contains-task-list"]; - break; + function done(error, ...output) { + if (!called) { + called = true; + callback(error, ...output); } } - return h(node, name2, props, wrap2(items, true)); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js -function paragraph(h, node) { - return h(node, "p", all2(h, node)); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/root.js -function root(h, node) { - return h.augment(node, u("root", wrap2(all2(h, node)))); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/strong.js -function strong(h, node) { - return h(node, "strong", all2(h, node)); + function then(value) { + done(null, value); + } } -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/table.js -function table(h, node) { - const rows = node.children; - let index2 = -1; - const align = node.align || []; - const result = []; - while (++index2 < rows.length) { - const row = rows[index2].children; - const name2 = index2 === 0 ? "th" : "td"; - const out = []; - let cellIndex = -1; - const length = node.align ? align.length : row.length; - while (++cellIndex < length) { - const cell = row[cellIndex]; - out.push( - h(cell, name2, { align: align[cellIndex] }, cell ? all2(h, cell) : []) - ); +// node_modules/unified/lib/callable-instance.js +var CallableInstance = ( + /** + * @type {new , Result>(property: string | symbol) => (...parameters: Parameters) => Result} + */ + /** @type {unknown} */ + /** + * @this {Function} + * @param {string | symbol} property + * @returns {(...parameters: Array) => unknown} + */ + function(property) { + const self2 = this; + const constr = self2.constructor; + const proto = ( + /** @type {Record} */ + // Prototypes do exist. + // type-coverage:ignore-next-line + constr.prototype + ); + const func = proto[property]; + const apply = function() { + return func.apply(apply, arguments); + }; + Object.setPrototypeOf(apply, proto); + const names = Object.getOwnPropertyNames(func); + for (const p of names) { + const descriptor = Object.getOwnPropertyDescriptor(func, p); + if (descriptor) + Object.defineProperty(apply, p, descriptor); } - result[index2] = h(rows[index2], "tr", wrap2(out, true)); + return apply; } - return h( - node, - "table", - wrap2( - [h(result[0].position, "thead", wrap2([result[0]], true))].concat( - result[1] ? h( - { - start: pointStart(result[1]), - end: pointEnd(result[result.length - 1]) - }, - "tbody", - wrap2(result.slice(1), true) - ) : [] - ), - true - ) - ); -} +); -// node_modules/trim-lines/index.js -var tab = 9; -var space = 32; -function trimLines(value) { - const source = String(value); - const search2 = /\r?\n|\r/g; - let match = search2.exec(source); - let last = 0; - const lines = []; - while (match) { - lines.push( - trimLine(source.slice(last, match.index), last > 0, true), - match[0] +// node_modules/unified/lib/index.js +var own5 = {}.hasOwnProperty; +var Processor = class _Processor extends CallableInstance { + /** + * Create a processor. + */ + constructor() { + super("copy"); + this.Compiler = void 0; + this.Parser = void 0; + this.attachers = []; + this.compiler = void 0; + this.freezeIndex = -1; + this.frozen = void 0; + this.namespace = {}; + this.parser = void 0; + this.transformers = trough(); + } + /** + * Copy a processor. + * + * @deprecated + * This is a private internal method and should not be used. + * @returns {Processor} + * New *unfrozen* processor ({@link Processor `Processor`}) that is + * configured to work the same as its ancestor. + * When the descendant processor is configured in the future it does not + * affect the ancestral processor. + */ + copy() { + const destination = ( + /** @type {Processor} */ + new _Processor() ); - last = match.index + match[0].length; - match = search2.exec(source); - } - lines.push(trimLine(source.slice(last), last > 0, false)); - return lines.join(""); -} -function trimLine(value, start3, end) { - let startIndex = 0; - let endIndex = value.length; - if (start3) { - let code2 = value.codePointAt(startIndex); - while (code2 === tab || code2 === space) { - startIndex++; - code2 = value.codePointAt(startIndex); + let index2 = -1; + while (++index2 < this.attachers.length) { + const attacher = this.attachers[index2]; + destination.use(...attacher); } + destination.data((0, import_extend.default)(true, {}, this.namespace)); + return destination; } - if (end) { - let code2 = value.codePointAt(endIndex - 1); - while (code2 === tab || code2 === space) { - endIndex--; - code2 = value.codePointAt(endIndex - 1); + /** + * Configure the processor with info available to all plugins. + * Information is stored in an object. + * + * Typically, options can be given to a specific plugin, but sometimes it + * makes sense to have information shared with several plugins. + * For example, a list of HTML elements that are self-closing, which is + * needed during all phases. + * + * > 👉 **Note**: setting information cannot occur on *frozen* processors. + * > Call the processor first to create a new unfrozen processor. + * + * > 👉 **Note**: to register custom data in TypeScript, augment the + * > {@link Data `Data`} interface. + * + * @example + * This example show how to get and set info: + * + * ```js + * import {unified} from 'unified' + * + * const processor = unified().data('alpha', 'bravo') + * + * processor.data('alpha') // => 'bravo' + * + * processor.data() // => {alpha: 'bravo'} + * + * processor.data({charlie: 'delta'}) + * + * processor.data() // => {charlie: 'delta'} + * ``` + * + * @template {keyof Data} Key + * + * @overload + * @returns {Data} + * + * @overload + * @param {Data} dataset + * @returns {Processor} + * + * @overload + * @param {Key} key + * @returns {Data[Key]} + * + * @overload + * @param {Key} key + * @param {Data[Key]} value + * @returns {Processor} + * + * @param {Data | Key} [key] + * Key to get or set, or entire dataset to set, or nothing to get the + * entire dataset (optional). + * @param {Data[Key]} [value] + * Value to set (optional). + * @returns {unknown} + * The current processor when setting, the value at `key` when getting, or + * the entire dataset when getting without key. + */ + data(key, value) { + if (typeof key === "string") { + if (arguments.length === 2) { + assertUnfrozen("data", this.frozen); + this.namespace[key] = value; + return this; + } + return own5.call(this.namespace, key) && this.namespace[key] || void 0; } - } - return endIndex > startIndex ? value.slice(startIndex, endIndex) : ""; -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/text.js -function text3(h, node) { - return h.augment(node, u("text", trimLines(String(node.value)))); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js -function thematicBreak2(h, node) { - return h(node, "hr"); -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/handlers/index.js -var handlers = { - blockquote, - break: hardBreak, - code, - delete: strikethrough, - emphasis, - footnoteReference, - footnote, - heading, - html, - imageReference, - image, - inlineCode, - linkReference, - link, - listItem, - list: list2, - paragraph, - root, - strong, - table, - text: text3, - thematicBreak: thematicBreak2, - toml: ignore, - yaml: ignore, - definition: ignore, - footnoteDefinition: ignore -}; -function ignore() { - return null; -} - -// node_modules/@mdx-js/mdx/node_modules/mdast-util-to-hast/lib/index.js -var own7 = {}.hasOwnProperty; -function factory(tree, options) { - const settings = options || {}; - const dangerous = settings.allowDangerousHtml || false; - const footnoteById = {}; - h.dangerous = dangerous; - h.clobberPrefix = settings.clobberPrefix === void 0 || settings.clobberPrefix === null ? "user-content-" : settings.clobberPrefix; - h.footnoteLabel = settings.footnoteLabel || "Footnotes"; - h.footnoteLabelTagName = settings.footnoteLabelTagName || "h2"; - h.footnoteLabelProperties = settings.footnoteLabelProperties || { - className: ["sr-only"] - }; - h.footnoteBackLabel = settings.footnoteBackLabel || "Back to content"; - h.definition = definitions(tree); - h.footnoteById = footnoteById; - h.footnoteOrder = []; - h.footnoteCounts = {}; - h.augment = augment; - h.handlers = { ...handlers, ...settings.handlers }; - h.unknownHandler = settings.unknownHandler; - h.passThrough = settings.passThrough; - visit2(tree, "footnoteDefinition", (definition2) => { - const id = String(definition2.identifier).toUpperCase(); - if (!own7.call(footnoteById, id)) { - footnoteById[id] = definition2; + if (key) { + assertUnfrozen("data", this.frozen); + this.namespace = key; + return this; + } + return this.namespace; + } + /** + * Freeze a processor. + * + * Frozen processors are meant to be extended and not to be configured + * directly. + * + * When a processor is frozen it cannot be unfrozen. + * New processors working the same way can be created by calling the + * processor. + * + * It’s possible to freeze processors explicitly by calling `.freeze()`. + * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`, + * `.stringify()`, `.process()`, or `.processSync()` are called. + * + * @returns {Processor} + * The current processor. + */ + freeze() { + if (this.frozen) { + return this; + } + const self2 = ( + /** @type {Processor} */ + /** @type {unknown} */ + this + ); + while (++this.freezeIndex < this.attachers.length) { + const [attacher, ...options] = this.attachers[this.freezeIndex]; + if (options[0] === false) { + continue; + } + if (options[0] === true) { + options[0] = void 0; + } + const transformer = attacher.call(self2, ...options); + if (typeof transformer === "function") { + this.transformers.use(transformer); + } + } + this.frozen = true; + this.freezeIndex = Number.POSITIVE_INFINITY; + return this; + } + /** + * Parse text to a syntax tree. + * + * > 👉 **Note**: `parse` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `parse` performs the parse phase, not the run phase or other + * > phases. + * + * @param {Compatible | undefined} [file] + * file to parse (optional); typically `string` or `VFile`; any value + * accepted as `x` in `new VFile(x)`. + * @returns {ParseTree extends undefined ? Node : ParseTree} + * Syntax tree representing `file`. + */ + parse(file) { + this.freeze(); + const realFile = vfile(file); + const parser = this.parser || this.Parser; + assertParser("parse", parser); + return parser(String(realFile), realFile); + } + /** + * Process the given file as configured on the processor. + * + * > 👉 **Note**: `process` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `process` performs the parse, run, and stringify phases. + * + * @overload + * @param {Compatible | undefined} file + * @param {ProcessCallback>} done + * @returns {undefined} + * + * @overload + * @param {Compatible | undefined} [file] + * @returns {Promise>} + * + * @param {Compatible | undefined} [file] + * File (optional); typically `string` or `VFile`]; any value accepted as + * `x` in `new VFile(x)`. + * @param {ProcessCallback> | undefined} [done] + * Callback (optional). + * @returns {Promise | undefined} + * Nothing if `done` is given. + * Otherwise a promise, rejected with a fatal error or resolved with the + * processed file. + * + * The parsed, transformed, and compiled value is available at + * `file.value` (see note). + * + * > 👉 **Note**: unified typically compiles by serializing: most + * > compilers return `string` (or `Uint8Array`). + * > Some compilers, such as the one configured with + * > [`rehype-react`][rehype-react], return other values (in this case, a + * > React tree). + * > If you’re using a compiler that doesn’t serialize, expect different + * > result values. + * > + * > To register custom results in TypeScript, add them to + * > {@link CompileResultMap `CompileResultMap`}. + * + * [rehype-react]: https://github.com/rehypejs/rehype-react + */ + process(file, done) { + const self2 = this; + this.freeze(); + assertParser("process", this.parser || this.Parser); + assertCompiler("process", this.compiler || this.Compiler); + return done ? executor(void 0, done) : new Promise(executor); + function executor(resolve, reject) { + const realFile = vfile(file); + const parseTree = ( + /** @type {HeadTree extends undefined ? Node : HeadTree} */ + /** @type {unknown} */ + self2.parse(realFile) + ); + self2.run(parseTree, realFile, function(error, tree, file2) { + if (error || !tree || !file2) { + return realDone(error); + } + const compileTree = ( + /** @type {CompileTree extends undefined ? Node : CompileTree} */ + /** @type {unknown} */ + tree + ); + const compileResult = self2.stringify(compileTree, file2); + if (looksLikeAValue(compileResult)) { + file2.value = compileResult; + } else { + file2.result = compileResult; + } + realDone( + error, + /** @type {VFileWithOutput} */ + file2 + ); + }); + function realDone(error, file2) { + if (error || !file2) { + reject(error); + } else if (resolve) { + resolve(file2); + } else { + ok(done, "`done` is defined if `resolve` is not"); + done(void 0, file2); + } + } + } + } + /** + * Process the given file as configured on the processor. + * + * An error is thrown if asynchronous transforms are configured. + * + * > 👉 **Note**: `processSync` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `processSync` performs the parse, run, and stringify phases. + * + * @param {Compatible | undefined} [file] + * File (optional); typically `string` or `VFile`; any value accepted as + * `x` in `new VFile(x)`. + * @returns {VFileWithOutput} + * The processed file. + * + * The parsed, transformed, and compiled value is available at + * `file.value` (see note). + * + * > 👉 **Note**: unified typically compiles by serializing: most + * > compilers return `string` (or `Uint8Array`). + * > Some compilers, such as the one configured with + * > [`rehype-react`][rehype-react], return other values (in this case, a + * > React tree). + * > If you’re using a compiler that doesn’t serialize, expect different + * > result values. + * > + * > To register custom results in TypeScript, add them to + * > {@link CompileResultMap `CompileResultMap`}. + * + * [rehype-react]: https://github.com/rehypejs/rehype-react + */ + processSync(file) { + let complete = false; + let result; + this.freeze(); + assertParser("processSync", this.parser || this.Parser); + assertCompiler("processSync", this.compiler || this.Compiler); + this.process(file, realDone); + assertDone("processSync", "process", complete); + ok(result, "we either bailed on an error or have a tree"); + return result; + function realDone(error, file2) { + complete = true; + bail(error); + result = file2; + } + } + /** + * Run *transformers* on a syntax tree. + * + * > 👉 **Note**: `run` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `run` performs the run phase, not other phases. + * + * @overload + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * @param {RunCallback} done + * @returns {undefined} + * + * @overload + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * @param {Compatible | undefined} file + * @param {RunCallback} done + * @returns {undefined} + * + * @overload + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * @param {Compatible | undefined} [file] + * @returns {Promise} + * + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * Tree to transform and inspect. + * @param {( + * RunCallback | + * Compatible + * )} [file] + * File associated with `node` (optional); any value accepted as `x` in + * `new VFile(x)`. + * @param {RunCallback} [done] + * Callback (optional). + * @returns {Promise | undefined} + * Nothing if `done` is given. + * Otherwise, a promise rejected with a fatal error or resolved with the + * transformed tree. + */ + run(tree, file, done) { + assertNode(tree); + this.freeze(); + const transformers = this.transformers; + if (!done && typeof file === "function") { + done = file; + file = void 0; + } + return done ? executor(void 0, done) : new Promise(executor); + function executor(resolve, reject) { + ok( + typeof file !== "function", + "`file` can\u2019t be a `done` anymore, we checked" + ); + const realFile = vfile(file); + transformers.run(tree, realFile, realDone); + function realDone(error, outputTree, file2) { + const resultingTree = ( + /** @type {TailTree extends undefined ? Node : TailTree} */ + outputTree || tree + ); + if (error) { + reject(error); + } else if (resolve) { + resolve(resultingTree); + } else { + ok(done, "`done` is defined if `resolve` is not"); + done(void 0, resultingTree, file2); + } + } + } + } + /** + * Run *transformers* on a syntax tree. + * + * An error is thrown if asynchronous transforms are configured. + * + * > 👉 **Note**: `runSync` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `runSync` performs the run phase, not other phases. + * + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * Tree to transform and inspect. + * @param {Compatible | undefined} [file] + * File associated with `node` (optional); any value accepted as `x` in + * `new VFile(x)`. + * @returns {TailTree extends undefined ? Node : TailTree} + * Transformed tree. + */ + runSync(tree, file) { + let complete = false; + let result; + this.run(tree, file, realDone); + assertDone("runSync", "run", complete); + ok(result, "we either bailed on an error or have a tree"); + return result; + function realDone(error, tree2) { + bail(error); + result = tree2; + complete = true; } - }); - return h; - function augment(left, right) { - if (left && "data" in left && left.data) { - const data2 = left.data; - if (data2.hName) { - if (right.type !== "element") { - right = { - type: "element", - tagName: "", - properties: {}, - children: [] - }; + } + /** + * Compile a syntax tree. + * + * > 👉 **Note**: `stringify` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `stringify` performs the stringify phase, not the run phase + * > or other phases. + * + * @param {CompileTree extends undefined ? Node : CompileTree} tree + * Tree to compile. + * @param {Compatible | undefined} [file] + * File associated with `node` (optional); any value accepted as `x` in + * `new VFile(x)`. + * @returns {CompileResult extends undefined ? Value : CompileResult} + * Textual representation of the tree (see note). + * + * > 👉 **Note**: unified typically compiles by serializing: most compilers + * > return `string` (or `Uint8Array`). + * > Some compilers, such as the one configured with + * > [`rehype-react`][rehype-react], return other values (in this case, a + * > React tree). + * > If you’re using a compiler that doesn’t serialize, expect different + * > result values. + * > + * > To register custom results in TypeScript, add them to + * > {@link CompileResultMap `CompileResultMap`}. + * + * [rehype-react]: https://github.com/rehypejs/rehype-react + */ + stringify(tree, file) { + this.freeze(); + const realFile = vfile(file); + const compiler2 = this.compiler || this.Compiler; + assertCompiler("stringify", compiler2); + assertNode(tree); + return compiler2(tree, realFile); + } + /** + * Configure the processor to use a plugin, a list of usable values, or a + * preset. + * + * If the processor is already using a plugin, the previous plugin + * configuration is changed based on the options that are passed in. + * In other words, the plugin is not added a second time. + * + * > 👉 **Note**: `use` cannot be called on *frozen* processors. + * > Call the processor first to create a new unfrozen processor. + * + * @example + * There are many ways to pass plugins to `.use()`. + * This example gives an overview: + * + * ```js + * import {unified} from 'unified' + * + * unified() + * // Plugin with options: + * .use(pluginA, {x: true, y: true}) + * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`): + * .use(pluginA, {y: false, z: true}) + * // Plugins: + * .use([pluginB, pluginC]) + * // Two plugins, the second with options: + * .use([pluginD, [pluginE, {}]]) + * // Preset with plugins and settings: + * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}}) + * // Settings only: + * .use({settings: {position: false}}) + * ``` + * + * @template {Array} [Parameters=[]] + * @template {Node | string | undefined} [Input=undefined] + * @template [Output=Input] + * + * @overload + * @param {Preset | null | undefined} [preset] + * @returns {Processor} + * + * @overload + * @param {PluggableList} list + * @returns {Processor} + * + * @overload + * @param {Plugin} plugin + * @param {...(Parameters | [boolean])} parameters + * @returns {UsePlugin} + * + * @param {PluggableList | Plugin | Preset | null | undefined} value + * Usable value. + * @param {...unknown} parameters + * Parameters, when a plugin is given as a usable value. + * @returns {Processor} + * Current processor. + */ + use(value, ...parameters) { + const attachers = this.attachers; + const namespace = this.namespace; + assertUnfrozen("use", this.frozen); + if (value === null || value === void 0) { + } else if (typeof value === "function") { + addPlugin(value, parameters); + } else if (typeof value === "object") { + if (Array.isArray(value)) { + addList(value); + } else { + addPreset(value); + } + } else { + throw new TypeError("Expected usable value, not `" + value + "`"); + } + return this; + function add(value2) { + if (typeof value2 === "function") { + addPlugin(value2, []); + } else if (typeof value2 === "object") { + if (Array.isArray(value2)) { + const [plugin, ...parameters2] = ( + /** @type {PluginTuple>} */ + value2 + ); + addPlugin(plugin, parameters2); + } else { + addPreset(value2); } - right.tagName = data2.hName; + } else { + throw new TypeError("Expected usable value, not `" + value2 + "`"); + } + } + function addPreset(result) { + if (!("plugins" in result) && !("settings" in result)) { + throw new Error( + "Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither" + ); } - if (right.type === "element" && data2.hProperties) { - right.properties = { ...right.properties, ...data2.hProperties }; + addList(result.plugins); + if (result.settings) { + namespace.settings = (0, import_extend.default)(true, namespace.settings, result.settings); } - if ("children" in right && right.children && data2.hChildren) { - right.children = data2.hChildren; + } + function addList(plugins) { + let index2 = -1; + if (plugins === null || plugins === void 0) { + } else if (Array.isArray(plugins)) { + while (++index2 < plugins.length) { + const thing = plugins[index2]; + add(thing); + } + } else { + throw new TypeError("Expected a list of plugins, not `" + plugins + "`"); } } - if (left) { - const ctx = "type" in left ? left : { position: left }; - if (!generated(ctx)) { - right.position = { start: pointStart(ctx), end: pointEnd(ctx) }; + function addPlugin(plugin, parameters2) { + let index2 = -1; + let entryIndex = -1; + while (++index2 < attachers.length) { + if (attachers[index2][0] === plugin) { + entryIndex = index2; + break; + } + } + if (entryIndex === -1) { + attachers.push([plugin, ...parameters2]); + } else if (parameters2.length > 0) { + let [primary, ...rest] = parameters2; + const currentPrimary = attachers[entryIndex][1]; + if (isPlainObject(currentPrimary) && isPlainObject(primary)) { + primary = (0, import_extend.default)(true, currentPrimary, primary); + } + attachers[entryIndex] = [plugin, primary, ...rest]; } } - return right; } - function h(node, tagName, props, children) { - if (Array.isArray(props)) { - children = props; - props = {}; - } - return augment(node, { - type: "element", - tagName, - properties: props || {}, - children: children || [] - }); +}; +var unified = new Processor().freeze(); +function assertParser(name2, value) { + if (typeof value !== "function") { + throw new TypeError("Cannot `" + name2 + "` without `parser`"); } } -function toHast(tree, options) { - const h = factory(tree, options); - const node = one2(h, tree, null); - const foot = footer(h); - if (foot) { - node.children.push(u("text", "\n"), foot); +function assertCompiler(name2, value) { + if (typeof value !== "function") { + throw new TypeError("Cannot `" + name2 + "` without `compiler`"); } - return Array.isArray(node) ? { type: "root", children: node } : node; } - -// node_modules/@mdx-js/mdx/node_modules/remark-rehype/lib/index.js -var remarkRehype = function(destination, options) { - return destination && "run" in destination ? bridge(destination, options) : mutate(destination || options); -}; -var lib_default = remarkRehype; -function bridge(destination, options) { - return (node, file, next) => { - destination.run(toHast(node, options), file, (error) => { - next(error); - }); - }; +function assertUnfrozen(name2, frozen) { + if (frozen) { + throw new Error( + "Cannot call `" + name2 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`." + ); + } +} +function assertNode(node2) { + if (!isPlainObject(node2) || typeof node2.type !== "string") { + throw new TypeError("Expected node, got `" + node2 + "`"); + } +} +function assertDone(name2, asyncName, complete) { + if (!complete) { + throw new Error( + "`" + name2 + "` finished async. Use `" + asyncName + "` instead" + ); + } +} +function vfile(value) { + return looksLikeAVFile2(value) ? value : new VFile(value); +} +function looksLikeAVFile2(value) { + return Boolean( + value && typeof value === "object" && "message" in value && "messages" in value + ); +} +function looksLikeAValue(value) { + return typeof value === "string" || isUint8Array2(value); } -function mutate(options) { - return (node) => toHast(node, options); +function isUint8Array2(value) { + return Boolean( + value && typeof value === "object" && "byteLength" in value && "byteOffset" in value + ); } // node_modules/estree-walker/src/walker.js @@ -21158,21 +23587,34 @@ var WalkerBase = class { this.context = { skip: () => this.should_skip = true, remove: () => this.should_remove = true, - replace: (node) => this.replacement = node + replace: (node2) => this.replacement = node2 }; } - replace(parent, prop, index2, node) { - if (parent) { - if (index2 !== null) { - parent[prop][index2] = node; + /** + * @template {Node} Parent + * @param {Parent | null | undefined} parent + * @param {keyof Parent | null | undefined} prop + * @param {number | null | undefined} index + * @param {Node} node + */ + replace(parent, prop, index2, node2) { + if (parent && prop) { + if (index2 != null) { + parent[prop][index2] = node2; } else { - parent[prop] = node; + parent[prop] = node2; } } } + /** + * @template {Node} Parent + * @param {Parent | null | undefined} parent + * @param {keyof Parent | null | undefined} prop + * @param {number | null | undefined} index + */ remove(parent, prop, index2) { - if (parent) { - if (index2 !== null) { + if (parent && prop) { + if (index2 !== null && index2 !== void 0) { parent[prop].splice(index2, 1); } else { delete parent[prop]; @@ -21183,13 +23625,34 @@ var WalkerBase = class { // node_modules/estree-walker/src/sync.js var SyncWalker = class extends WalkerBase { + /** + * + * @param {SyncHandler} [enter] + * @param {SyncHandler} [leave] + */ constructor(enter, leave) { super(); + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + this.context = { + skip: () => this.should_skip = true, + remove: () => this.should_remove = true, + replace: (node2) => this.replacement = node2 + }; this.enter = enter; this.leave = leave; } - visit(node, parent, prop, index2) { - if (node) { + /** + * @template {Node} Parent + * @param {Node} node + * @param {Parent | null} parent + * @param {keyof Parent} [prop] + * @param {number | null} [index] + * @returns {Node | null} + */ + visit(node2, parent, prop, index2) { + if (node2) { if (this.enter) { const _should_skip = this.should_skip; const _should_remove = this.should_remove; @@ -21197,419 +23660,323 @@ var SyncWalker = class extends WalkerBase { this.should_skip = false; this.should_remove = false; this.replacement = null; - this.enter.call(this.context, node, parent, prop, index2); - if (this.replacement) { - node = this.replacement; - this.replace(parent, prop, index2, node); - } - if (this.should_remove) { - this.remove(parent, prop, index2); - } - const skipped = this.should_skip; - const removed = this.should_remove; - this.should_skip = _should_skip; - this.should_remove = _should_remove; - this.replacement = _replacement; - if (skipped) - return node; - if (removed) - return null; - } - for (const key in node) { - const value = node[key]; - if (typeof value !== "object") { - continue; - } else if (Array.isArray(value)) { - for (let i = 0; i < value.length; i += 1) { - if (value[i] !== null && typeof value[i].type === "string") { - if (!this.visit(value[i], node, key, i)) { - i--; - } - } - } - } else if (value !== null && typeof value.type === "string") { - this.visit(value, node, key, null); - } - } - if (this.leave) { - const _replacement = this.replacement; - const _should_remove = this.should_remove; - this.replacement = null; - this.should_remove = false; - this.leave.call(this.context, node, parent, prop, index2); + this.enter.call(this.context, node2, parent, prop, index2); if (this.replacement) { - node = this.replacement; - this.replace(parent, prop, index2, node); - } - if (this.should_remove) { - this.remove(parent, prop, index2); + node2 = this.replacement; + this.replace(parent, prop, index2, node2); } - const removed = this.should_remove; - this.replacement = _replacement; - this.should_remove = _should_remove; - if (removed) - return null; - } - } - return node; - } -}; - -// node_modules/estree-walker/src/index.js -function walk(ast, { enter, leave }) { - const instance = new SyncWalker(enter, leave); - return instance.visit(ast, null); -} - -// node_modules/estree-util-build-jsx/lib/index.js -var regex = /@(jsx|jsxFrag|jsxImportSource|jsxRuntime)\s+(\S+)/g; -function buildJsx(tree, options = {}) { - let automatic = options.runtime === "automatic"; - const annotations = {}; - const imports = {}; - walk(tree, { - enter(node) { - if (node.type === "Program") { - const comments = node.comments || []; - let index2 = -1; - while (++index2 < comments.length) { - regex.lastIndex = 0; - let match = regex.exec(comments[index2].value); - while (match) { - annotations[match[1]] = match[2]; - match = regex.exec(comments[index2].value); - } - } - if (annotations.jsxRuntime) { - if (annotations.jsxRuntime === "automatic") { - automatic = true; - if (annotations.jsx) { - throw new Error("Unexpected `@jsx` pragma w/ automatic runtime"); - } - if (annotations.jsxFrag) { - throw new Error( - "Unexpected `@jsxFrag` pragma w/ automatic runtime" - ); - } - } else if (annotations.jsxRuntime === "classic") { - automatic = false; - if (annotations.jsxImportSource) { - throw new Error( - "Unexpected `@jsxImportSource` w/ classic runtime" - ); - } - } else { - throw new Error( - "Unexpected `jsxRuntime` `" + annotations.jsxRuntime + "`, expected `automatic` or `classic`" - ); - } - } - } - }, - leave(node) { - if (node.type === "Program") { - const specifiers = []; - if (imports.fragment) { - specifiers.push({ - type: "ImportSpecifier", - imported: { type: "Identifier", name: "Fragment" }, - local: { type: "Identifier", name: "_Fragment" } - }); - } - if (imports.jsx) { - specifiers.push({ - type: "ImportSpecifier", - imported: { type: "Identifier", name: "jsx" }, - local: { type: "Identifier", name: "_jsx" } - }); - } - if (imports.jsxs) { - specifiers.push({ - type: "ImportSpecifier", - imported: { type: "Identifier", name: "jsxs" }, - local: { type: "Identifier", name: "_jsxs" } - }); - } - if (imports.jsxDEV) { - specifiers.push({ - type: "ImportSpecifier", - imported: { type: "Identifier", name: "jsxDEV" }, - local: { type: "Identifier", name: "_jsxDEV" } - }); - } - if (specifiers.length > 0) { - node.body.unshift({ - type: "ImportDeclaration", - specifiers, - source: { - type: "Literal", - value: (annotations.jsxImportSource || options.importSource || "react") + (options.development ? "/jsx-dev-runtime" : "/jsx-runtime") - } - }); - } - } - if (node.type !== "JSXElement" && node.type !== "JSXFragment") { - return; - } - const children = []; - let index2 = -1; - while (++index2 < node.children.length) { - const child = node.children[index2]; - if (child.type === "JSXExpressionContainer") { - if (child.expression.type !== "JSXEmptyExpression") { - children.push(child.expression); - } - } else if (child.type === "JSXText") { - const value = child.value.replace(/\t/g, " ").replace(/ *(\r?\n|\r) */g, "\n").replace(/\n+/g, "\n").replace(/\n+$/, "").replace(/\n/g, " "); - if (value) { - children.push(create(child, { type: "Literal", value })); - } - } else { - children.push(child); - } - } - let name2; - let fields = []; - const objects = []; - let parameters = []; - let key; - if (node.type === "JSXElement") { - name2 = toIdentifier(node.openingElement.name); - if (name2.type === "Identifier" && /^[a-z]/.test(name2.name)) { - name2 = create(name2, { type: "Literal", value: name2.name }); - } - let spread; - const attributes = node.openingElement.attributes; - let index3 = -1; - while (++index3 < attributes.length) { - const attribute = attributes[index3]; - if (attribute.type === "JSXSpreadAttribute") { - if (fields.length > 0) { - objects.push({ type: "ObjectExpression", properties: fields }); - fields = []; - } - objects.push(attribute.argument); - spread = true; - } else { - const prop = toProperty(attribute); - if (automatic && prop.key.type === "Identifier" && prop.key.name === "key") { - if (spread) { - throw new Error( - "Expected `key` to come before any spread expressions" - ); + if (this.should_remove) { + this.remove(parent, prop, index2); + } + const skipped = this.should_skip; + const removed = this.should_remove; + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + if (skipped) + return node2; + if (removed) + return null; + } + let key; + for (key in node2) { + const value = node2[key]; + if (value && typeof value === "object") { + if (Array.isArray(value)) { + const nodes = ( + /** @type {Array} */ + value + ); + for (let i = 0; i < nodes.length; i += 1) { + const item = nodes[i]; + if (isNode(item)) { + if (!this.visit(item, node2, key, i)) { + i--; + } } - key = prop.value; - } else { - fields.push(prop); } + } else if (isNode(value)) { + this.visit(value, node2, key, null); } } - } else if (automatic) { - imports.fragment = true; - name2 = { type: "Identifier", name: "_Fragment" }; - } else { - name2 = toMemberExpression( - annotations.jsxFrag || options.pragmaFrag || "React.Fragment" - ); } - if (automatic) { - if (children.length > 0) { - fields.push({ - type: "Property", - key: { type: "Identifier", name: "children" }, - value: children.length > 1 ? { type: "ArrayExpression", elements: children } : children[0], - kind: "init", - method: false, - shorthand: false, - computed: false - }); + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + this.leave.call(this.context, node2, parent, prop, index2); + if (this.replacement) { + node2 = this.replacement; + this.replace(parent, prop, index2, node2); } - } else { - parameters = children; - } - if (fields.length > 0) { - objects.push({ type: "ObjectExpression", properties: fields }); - } - let props; - let callee; - if (objects.length > 1) { - if (objects[0].type !== "ObjectExpression") { - objects.unshift({ type: "ObjectExpression", properties: [] }); + if (this.should_remove) { + this.remove(parent, prop, index2); } - props = { - type: "CallExpression", - callee: toMemberExpression("Object.assign"), - arguments: objects, - optional: false - }; - } else if (objects.length > 0) { - props = objects[0]; + const removed = this.should_remove; + this.replacement = _replacement; + this.should_remove = _should_remove; + if (removed) + return null; } - if (automatic) { - parameters.push(props || { type: "ObjectExpression", properties: [] }); - if (key) { - parameters.push(key); - } else if (options.development) { - parameters.push({ type: "Identifier", name: "undefined" }); - } - const isStaticChildren = children.length > 1; - if (options.development) { - imports.jsxDEV = true; - callee = { - type: "Identifier", - name: "_jsxDEV" - }; - parameters.push({ type: "Literal", value: isStaticChildren }); - const source = { - type: "ObjectExpression", - properties: [ - { - type: "Property", - method: false, - shorthand: false, - computed: false, - kind: "init", - key: { type: "Identifier", name: "fileName" }, - value: { - type: "Literal", - value: options.filePath || "" - } - } - ] - }; - if (node.loc) { - source.properties.push( - { - type: "Property", - method: false, - shorthand: false, - computed: false, - kind: "init", - key: { type: "Identifier", name: "lineNumber" }, - value: { type: "Literal", value: node.loc.start.line } - }, - { - type: "Property", - method: false, - shorthand: false, - computed: false, - kind: "init", - key: { type: "Identifier", name: "columnNumber" }, - value: { type: "Literal", value: node.loc.start.column + 1 } + } + return node2; + } +}; +function isNode(value) { + return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string"; +} + +// node_modules/estree-walker/src/index.js +function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); +} + +// node_modules/is-reference/src/index.js +function is_reference(node2, parent) { + if (node2.type === "MemberExpression") { + return !node2.computed && is_reference(node2.object, node2); + } + if (node2.type === "Identifier") { + if (!parent) + return true; + switch (parent.type) { + case "MemberExpression": + return parent.computed || node2 === parent.object; + case "MethodDefinition": + return parent.computed; + case "PropertyDefinition": + return parent.computed || node2 === parent.value; + case "Property": + return parent.computed || node2 === parent.value; + case "ExportSpecifier": + case "ImportSpecifier": + return node2 === parent.local; + case "LabeledStatement": + case "BreakStatement": + case "ContinueStatement": + return false; + default: + return true; + } + } + return false; +} + +// node_modules/periscopic/src/index.js +function analyze(expression) { + const map = /* @__PURE__ */ new WeakMap(); + const globals = /* @__PURE__ */ new Map(); + const scope = new Scope3(null, false); + const references = []; + let current_scope = scope; + walk(expression, { + enter(node2, parent) { + switch (node2.type) { + case "Identifier": + if (parent && is_reference(node2, parent)) { + references.push([current_scope, node2]); + } + break; + case "ImportDeclaration": + node2.specifiers.forEach((specifier) => { + current_scope.declarations.set(specifier.local.name, specifier); + }); + break; + case "FunctionExpression": + case "FunctionDeclaration": + case "ArrowFunctionExpression": + if (node2.type === "FunctionDeclaration") { + if (node2.id) { + current_scope.declarations.set(node2.id.name, node2); + } + map.set(node2, current_scope = new Scope3(current_scope, false)); + } else { + map.set(node2, current_scope = new Scope3(current_scope, false)); + if (node2.type === "FunctionExpression" && node2.id) { + current_scope.declarations.set(node2.id.name, node2); + } + } + node2.params.forEach((param) => { + extract_names(param).forEach((name2) => { + current_scope.declarations.set(name2, node2); + }); + }); + break; + case "ForStatement": + case "ForInStatement": + case "ForOfStatement": + map.set(node2, current_scope = new Scope3(current_scope, true)); + break; + case "BlockStatement": + map.set(node2, current_scope = new Scope3(current_scope, true)); + break; + case "ClassDeclaration": + case "VariableDeclaration": + current_scope.add_declaration(node2); + break; + case "CatchClause": + map.set(node2, current_scope = new Scope3(current_scope, true)); + if (node2.param) { + extract_names(node2.param).forEach((name2) => { + if (node2.param) { + current_scope.declarations.set(name2, node2.param); } - ); + }); } - parameters.push(source, { type: "ThisExpression" }); - } else if (isStaticChildren) { - imports.jsxs = true; - callee = { type: "Identifier", name: "_jsxs" }; - } else { - imports.jsx = true; - callee = { type: "Identifier", name: "_jsx" }; - } - } else { - if (props || parameters.length > 0) { - parameters.unshift(props || { type: "Literal", value: null }); - } - callee = toMemberExpression( - annotations.jsx || options.pragma || "React.createElement" - ); + break; + } + }, + leave(node2) { + if (map.has(node2) && current_scope !== null && current_scope.parent) { + current_scope = current_scope.parent; } - parameters.unshift(name2); - this.replace( - create(node, { - type: "CallExpression", - callee, - arguments: parameters, - optional: false - }) - ); } }); - return tree; -} -function toProperty(node) { - let value; - if (node.value) { - if (node.value.type === "JSXExpressionContainer") { - value = node.value.expression; - } else { - value = node.value; - delete value.raw; + for (let i = references.length - 1; i >= 0; --i) { + const [scope2, reference] = references[i]; + if (!scope2.references.has(reference.name)) { + add_reference(scope2, reference.name); + } + if (!scope2.find_owner(reference.name)) { + globals.set(reference.name, reference); } - } else { - value = { type: "Literal", value: true }; } - return create(node, { - type: "Property", - key: toIdentifier(node.name), - value, - kind: "init", - method: false, - shorthand: false, - computed: false - }); + return { map, scope, globals }; } -function toIdentifier(node) { - let replace; - if (node.type === "JSXMemberExpression") { - const id = toIdentifier(node.property); - replace = { - type: "MemberExpression", - object: toIdentifier(node.object), - property: id, - computed: id.type === "Literal", - optional: false - }; - } else if (node.type === "JSXNamespacedName") { - replace = { - type: "Literal", - value: node.namespace.name + ":" + node.name.name - }; - } else { - replace = name(node.name) ? { type: "Identifier", name: node.name } : { type: "Literal", value: node.name }; +function add_reference(scope, name2) { + scope.references.add(name2); + if (scope.parent) + add_reference(scope.parent, name2); +} +var Scope3 = class { + /** + * @param {Scope | null} parent + * @param {boolean} block + */ + constructor(parent, block) { + this.parent = parent; + this.block = block; + this.declarations = /* @__PURE__ */ new Map(); + this.initialised_declarations = /* @__PURE__ */ new Set(); + this.references = /* @__PURE__ */ new Set(); + } + /** + * @param {import('estree').VariableDeclaration | import('estree').ClassDeclaration} node + */ + add_declaration(node2) { + if (node2.type === "VariableDeclaration") { + if (node2.kind === "var" && this.block && this.parent) { + this.parent.add_declaration(node2); + } else { + const handle_declarator = (declarator) => { + extract_names(declarator.id).forEach((name2) => { + this.declarations.set(name2, node2); + if (declarator.init) + this.initialised_declarations.add(name2); + }); + ; + }; + node2.declarations.forEach(handle_declarator); + } + } else if (node2.id) { + this.declarations.set(node2.id.name, node2); + } + } + /** + * @param {string} name + * @returns {Scope | null} + */ + find_owner(name2) { + if (this.declarations.has(name2)) + return this; + return this.parent && this.parent.find_owner(name2); } - return create(node, replace); + /** + * @param {string} name + * @returns {boolean} + */ + has(name2) { + return this.declarations.has(name2) || !!this.parent && this.parent.has(name2); + } +}; +function extract_names(param) { + return extract_identifiers(param).map((node2) => node2.name); } -function toMemberExpression(id) { - const identifiers = id.split("."); - let index2 = -1; - let result; - while (++index2 < identifiers.length) { - const prop = name(identifiers[index2]) ? { type: "Identifier", name: identifiers[index2] } : { type: "Literal", value: identifiers[index2] }; - result = result ? { - type: "MemberExpression", - object: result, - property: prop, - computed: Boolean(index2 && prop.type === "Literal"), - optional: false - } : prop; +function extract_identifiers(param, nodes = []) { + switch (param.type) { + case "Identifier": + nodes.push(param); + break; + case "MemberExpression": + let object = param; + while (object.type === "MemberExpression") { + object = /** @type {any} */ + object.object; + } + nodes.push( + /** @type {any} */ + object + ); + break; + case "ObjectPattern": + const handle_prop = (prop) => { + if (prop.type === "RestElement") { + extract_identifiers(prop.argument, nodes); + } else { + extract_identifiers(prop.value, nodes); + } + }; + param.properties.forEach(handle_prop); + break; + case "ArrayPattern": + const handle_element = (element2) => { + if (element2) + extract_identifiers(element2, nodes); + }; + param.elements.forEach((element2) => { + if (element2) { + handle_element(element2); + } + }); + break; + case "RestElement": + extract_identifiers(param.argument, nodes); + break; + case "AssignmentPattern": + extract_identifiers(param.left, nodes); + break; } - return result; + return nodes; } -function create(from, node) { + +// node_modules/@mdx-js/mdx/lib/util/estree-util-create.js +function create(from, to) { const fields = ["start", "end", "loc", "range", "comments"]; let index2 = -1; while (++index2 < fields.length) { const field = fields[index2]; if (field in from) { - node[field] = from[field]; + to[field] = from[field]; } } - return node; } -// node_modules/@mdx-js/mdx/lib/util/estree-util-create.js -function create2(template, node) { - const fields = ["start", "end", "loc", "range", "comments"]; - let index2 = -1; - while (++index2 < fields.length) { - const field = fields[index2]; - if (field in template) { - node[field] = template[field]; - } +// node_modules/@mdx-js/mdx/lib/util/estree-util-declaration-to-expression.js +function declarationToExpression(declaration) { + if (declaration.type === "FunctionDeclaration") { + return { ...declaration, type: "FunctionExpression" }; } - return node; + ok(declaration.type === "ClassDeclaration", "unexpected node type"); + return { ...declaration, type: "ClassExpression" }; +} + +// node_modules/@mdx-js/mdx/lib/util/estree-util-is-declaration.js +function isDeclaration(node2) { + return Boolean( + node2.type === "FunctionDeclaration" || node2.type === "ClassDeclaration" || node2.type === "VariableDeclaration" + ); } // node_modules/@mdx-js/mdx/lib/util/estree-util-specifiers-to-declarations.js @@ -21627,26 +23994,26 @@ function specifiersToDeclarations(specifiers, init) { } } if (importNamespaceSpecifier) { - declarations.push( - create2(importNamespaceSpecifier, { - type: "VariableDeclarator", - id: importNamespaceSpecifier.local, - init - }) - ); + const declarator = { + type: "VariableDeclarator", + id: importNamespaceSpecifier.local, + init + }; + create(importNamespaceSpecifier, declarator); + declarations.push(declarator); } declarations.push({ type: "VariableDeclarator", id: { type: "ObjectPattern", - properties: otherSpecifiers.map((specifier) => { + properties: otherSpecifiers.map(function(specifier) { let key = specifier.type === "ImportSpecifier" ? specifier.imported : specifier.type === "ExportSpecifier" ? specifier.exported : { type: "Identifier", name: "default" }; let value = specifier.local; if (specifier.type === "ExportSpecifier") { value = key; key = specifier.local; } - return create2(specifier, { + const property = { type: "Property", kind: "init", shorthand: key.name === value.name, @@ -21654,7 +24021,9 @@ function specifiersToDeclarations(specifiers, init) { computed: false, key, value - }); + }; + create(specifier, property); + return property; }) }, init: importNamespaceSpecifier ? { type: "Identifier", name: importNamespaceSpecifier.local.name } : init @@ -21663,638 +24032,1035 @@ function specifiersToDeclarations(specifiers, init) { } // node_modules/@mdx-js/mdx/lib/util/estree-util-to-id-or-member-expression.js -var toIdOrMemberExpression = toIdOrMemberExpressionFactory( - "Identifier", - "MemberExpression", - name -); -var toJsxIdOrMemberExpression = toIdOrMemberExpressionFactory( - "JSXIdentifier", - "JSXMemberExpression", - isJsxIdentifierName -); -function toIdOrMemberExpressionFactory(idType, memberType, isIdentifier) { - return toIdOrMemberExpression2; - function toIdOrMemberExpression2(ids) { - let index2 = -1; - let object; - while (++index2 < ids.length) { - const name2 = ids[index2]; - const valid2 = typeof name2 === "string" && isIdentifier(name2); - if (idType === "JSXIdentifier" && !valid2) { - throw new Error("Cannot turn `" + name2 + "` into a JSX identifier"); - } - const id = valid2 ? { type: idType, name: name2 } : { type: "Literal", value: name2 }; - object = object ? { - type: memberType, - object, - property: id, - computed: id.type === "Literal", - optional: false - } : id; - } - if (!object) - throw new Error("Expected non-empty `ids` to be passed"); - if (object.type === "Literal") - throw new Error("Expected identifier as left-most value"); - return object; +function toIdOrMemberExpression(ids) { + let index2 = -1; + let object; + while (++index2 < ids.length) { + const name2 = ids[index2]; + const id = typeof name2 === "string" && name(name2) ? { type: "Identifier", name: name2 } : { type: "Literal", value: name2 }; + object = object ? { + type: "MemberExpression", + object, + property: id, + computed: id.type === "Literal", + optional: false + } : id; } + ok(object, "expected non-empty `ids` to be passed"); + ok(object.type !== "Literal", "expected identifier as left-most value"); + return object; } -function isJsxIdentifierName(name2) { +function toJsxIdOrMemberExpression(ids) { let index2 = -1; - while (++index2 < name2.length) { - if (!(index2 ? jsxCont : start2)(name2.charCodeAt(index2))) - return false; + let object; + while (++index2 < ids.length) { + const name2 = ids[index2]; + ok( + typeof name2 === "string" && name(name2, { jsx: true }), + "expected valid jsx identifier, not `" + name2 + "`" + ); + const id = { type: "JSXIdentifier", name: name2 }; + object = object ? { type: "JSXMemberExpression", object, property: id } : id; } - return index2 > 0; -} -function jsxCont(code2) { - return code2 === 45 || cont2(code2); + ok(object, "expected non-empty `ids` to be passed"); + return object; } -// node_modules/@mdx-js/mdx/lib/plugin/recma-jsx-build.js -function recmaJsxBuild(options = {}) { - const { outputFormat } = options; - return (tree) => { - buildJsx(tree); - if (outputFormat === "function-body" && tree.body[0] && tree.body[0].type === "ImportDeclaration" && typeof tree.body[0].source.value === "string" && /\/jsx-runtime$/.test(tree.body[0].source.value)) { - tree.body[0] = { - type: "VariableDeclaration", - kind: "const", - declarations: specifiersToDeclarations( - tree.body[0].specifiers, - toIdOrMemberExpression(["arguments", 0]) - ) - }; +// node_modules/@mdx-js/mdx/lib/plugin/recma-document.js +function recmaDocument(options) { + const baseUrl = options.baseUrl || void 0; + const baseHref = typeof baseUrl === "object" ? baseUrl.href : baseUrl; + const outputFormat = options.outputFormat || "program"; + const pragma = options.pragma === void 0 ? "React.createElement" : options.pragma; + const pragmaFrag = options.pragmaFrag === void 0 ? "React.Fragment" : options.pragmaFrag; + const pragmaImportSource = options.pragmaImportSource || "react"; + const jsxImportSource = options.jsxImportSource || "react"; + const jsxRuntime = options.jsxRuntime || "automatic"; + return function(tree, file) { + const exportedIdentifiers = []; + const replacement = []; + const pragmas = []; + let exportAllCount = 0; + let layout; + let content3; + let child; + if (jsxRuntime) { + pragmas.push("@jsxRuntime " + jsxRuntime); } - }; -} - -// node_modules/is-reference/src/index.js -function is_reference(node, parent) { - if (node.type === "MemberExpression") { - return !node.computed && is_reference(node.object, node); - } - if (node.type === "Identifier") { - if (!parent) - return true; - switch (parent.type) { - case "MemberExpression": - return parent.computed || node === parent.object; - case "MethodDefinition": - return parent.computed; - case "PropertyDefinition": - return parent.computed || node === parent.value; - case "Property": - return parent.computed || node === parent.value; - case "ExportSpecifier": - case "ImportSpecifier": - return node === parent.local; - case "LabeledStatement": - case "BreakStatement": - case "ContinueStatement": - return false; - default: - return true; + if (jsxRuntime === "automatic" && jsxImportSource) { + pragmas.push("@jsxImportSource " + jsxImportSource); } - } - return false; -} - -// node_modules/periscopic/src/index.js -function analyze(expression) { - const map = /* @__PURE__ */ new WeakMap(); - const globals = /* @__PURE__ */ new Map(); - const scope = new Scope3(null, false); - const references = []; - let current_scope = scope; - walk(expression, { - enter(node, parent) { - switch (node.type) { - case "Identifier": - if (is_reference(node, parent)) { - references.push([current_scope, node]); + if (jsxRuntime === "classic" && pragma) { + pragmas.push("@jsx " + pragma); + } + if (jsxRuntime === "classic" && pragmaFrag) { + pragmas.push("@jsxFrag " + pragmaFrag); + } + if (!tree.comments) + tree.comments = []; + if (pragmas.length > 0) { + tree.comments.unshift({ + type: "Block", + value: pragmas.join(" "), + data: { _mdxIsPragmaComment: true } + }); + } + if (jsxRuntime === "classic" && pragmaImportSource) { + if (!pragma) { + throw new Error( + "Missing `pragma` in classic runtime with `pragmaImportSource`" + ); + } + handleEsm({ + type: "ImportDeclaration", + specifiers: [ + { + type: "ImportDefaultSpecifier", + local: { type: "Identifier", name: pragma.split(".")[0] } } - break; - case "ImportDeclaration": - node.specifiers.forEach((specifier) => { - current_scope.declarations.set(specifier.local.name, specifier); - }); - break; - case "FunctionExpression": - case "FunctionDeclaration": - case "ArrowFunctionExpression": - if (node.type === "FunctionDeclaration") { - if (node.id) { - current_scope.declarations.set(node.id.name, node); + ], + source: { type: "Literal", value: pragmaImportSource } + }); + } + for (child of tree.body) { + if (child.type === "ExportDefaultDeclaration") { + if (layout) { + file.fail( + "Unexpected duplicate layout, expected a single layout (previous: " + stringifyPosition(positionFromEstree(layout)) + ")", + { + ancestors: [tree, child], + place: positionFromEstree(child), + ruleId: "duplicate-layout", + source: "recma-document" + } + ); + } + layout = child; + replacement.push({ + type: "VariableDeclaration", + kind: "const", + declarations: [ + { + type: "VariableDeclarator", + id: { type: "Identifier", name: "MDXLayout" }, + init: isDeclaration(child.declaration) ? declarationToExpression(child.declaration) : child.declaration + } + ] + }); + } else if (child.type === "ExportNamedDeclaration" && child.source) { + const source = ( + /** @type {SimpleLiteral} */ + child.source + ); + child.specifiers = child.specifiers.filter(function(specifier) { + if (specifier.exported.name === "default") { + if (layout) { + file.fail( + "Unexpected duplicate layout, expected a single layout (previous: " + stringifyPosition(positionFromEstree(layout)) + ")", + { + ancestors: [tree, child, specifier], + place: positionFromEstree(child), + ruleId: "duplicate-layout", + source: "recma-document" + } + ); + } + layout = specifier; + const specifiers = []; + if (specifier.local.name === "default") { + specifiers.push({ + type: "ImportDefaultSpecifier", + local: { type: "Identifier", name: "MDXLayout" } + }); + } else { + const importSpecifier = { + type: "ImportSpecifier", + imported: specifier.local, + local: { type: "Identifier", name: "MDXLayout" } + }; + create(specifier.local, importSpecifier); + specifiers.push(importSpecifier); + } + const from = { type: "Literal", value: source.value }; + create(source, from); + const declaration = { + type: "ImportDeclaration", + specifiers, + source: from + }; + create(specifier, declaration); + handleEsm(declaration); + return false; + } + return true; + }); + if (child.specifiers.length > 0) { + handleExport(child); + } + } else if (child.type === "ExportNamedDeclaration" || child.type === "ExportAllDeclaration") { + handleExport(child); + } else if (child.type === "ImportDeclaration") { + handleEsm(child); + } else if (child.type === "ExpressionStatement" && (child.expression.type === "JSXElement" || // @ts-expect-error: `estree-jsx` does not register `JSXFragment` as an expression. + child.expression.type === "JSXFragment")) { + content3 = true; + replacement.push( + ...createMdxContent(child.expression, outputFormat, Boolean(layout)) + ); + } else { + replacement.push(child); + } + } + if (!content3) { + replacement.push( + ...createMdxContent(void 0, outputFormat, Boolean(layout)) + ); + } + exportedIdentifiers.push(["MDXContent", "default"]); + if (outputFormat === "function-body") { + replacement.push({ + type: "ReturnStatement", + argument: { + type: "ObjectExpression", + properties: [ + ...Array.from({ length: exportAllCount }).map( + /** + * @param {undefined} _ + * Nothing. + * @param {number} index + * Index. + * @returns {SpreadElement} + * Node. + */ + function(_, index2) { + return { + type: "SpreadElement", + argument: { + type: "Identifier", + name: "_exportAll" + (index2 + 1) + } + }; + } + ), + ...exportedIdentifiers.map(function(d) { + const prop = { + type: "Property", + kind: "init", + method: false, + computed: false, + shorthand: typeof d === "string", + key: { + type: "Identifier", + name: typeof d === "string" ? d : d[1] + }, + value: { + type: "Identifier", + name: typeof d === "string" ? d : d[0] + } + }; + return prop; + }) + ] + } + }); + } + tree.body = replacement; + let usesImportMetaUrlVariable = false; + let usesResolveDynamicHelper = false; + if (baseHref || outputFormat === "function-body") { + walk(tree, { + enter(node2) { + if ((node2.type === "ExportAllDeclaration" || node2.type === "ExportNamedDeclaration" || node2.type === "ImportDeclaration") && node2.source) { + ok(baseHref, "unexpected missing `baseHref` in branch"); + let value = node2.source.value; + ok(typeof value === "string", "expected string source"); + try { + new URL(value); + } catch { + if (value.startsWith("/") || value.startsWith("./") || value.startsWith("../")) { + value = new URL(value, baseHref).href; + } else { + } } - map.set(node, current_scope = new Scope3(current_scope, false)); + const replacement2 = { type: "Literal", value }; + create(node2.source, replacement2); + node2.source = replacement2; + return; + } + if (node2.type === "ImportExpression") { + usesResolveDynamicHelper = true; + const replacement2 = { + type: "CallExpression", + callee: { type: "Identifier", name: "_resolveDynamicMdxSpecifier" }, + arguments: [node2.source], + optional: false + }; + node2.source = replacement2; + return; + } + if (node2.type === "MemberExpression" && "object" in node2 && node2.object.type === "MetaProperty" && node2.property.type === "Identifier" && node2.object.meta.name === "import" && node2.object.property.name === "meta" && node2.property.name === "url") { + usesImportMetaUrlVariable = true; + const replacement2 = { type: "Identifier", name: "_importMetaUrl" }; + create(node2, replacement2); + this.replace(replacement2); + } + } + }); + } + if (usesResolveDynamicHelper) { + if (!baseHref) { + usesImportMetaUrlVariable = true; + } + tree.body.push( + resolveDynamicMdxSpecifier( + baseHref ? { type: "Literal", value: baseHref } : { type: "Identifier", name: "_importMetaUrl" } + ) + ); + } + if (usesImportMetaUrlVariable) { + ok( + outputFormat === "function-body", + "expected `function-body` when using dynamic url injection" + ); + tree.body.unshift(...createImportMetaUrlVariable()); + } + function handleExport(node2) { + if (node2.type === "ExportNamedDeclaration") { + if (node2.declaration) { + exportedIdentifiers.push( + ...analyze(node2.declaration).scope.declarations.keys() + ); + } + for (child of node2.specifiers) { + exportedIdentifiers.push(child.exported.name); + } + } + handleEsm(node2); + } + function handleEsm(node2) { + let replace; + let init; + if (outputFormat === "function-body") { + if ( + // Always have a source: + node2.type === "ImportDeclaration" || node2.type === "ExportAllDeclaration" || // Source optional: + node2.type === "ExportNamedDeclaration" && node2.source + ) { + ok(node2.source, "expected `node.source` to be defined"); + const argument = { type: "ImportExpression", source: node2.source }; + create(node2, argument); + init = { type: "AwaitExpression", argument }; + if ((node2.type === "ImportDeclaration" || node2.type === "ExportNamedDeclaration") && node2.specifiers.length === 0) { + replace = { type: "ExpressionStatement", expression: init }; } else { - map.set(node, current_scope = new Scope3(current_scope, false)); - if (node.type === "FunctionExpression" && node.id) { - current_scope.declarations.set(node.id.name, node); - } + replace = { + type: "VariableDeclaration", + kind: "const", + declarations: node2.type === "ExportAllDeclaration" ? [ + { + type: "VariableDeclarator", + id: { + type: "Identifier", + name: "_exportAll" + ++exportAllCount + }, + init + } + ] : specifiersToDeclarations(node2.specifiers, init) + }; } - node.params.forEach((param) => { - extract_names(param).forEach((name2) => { - current_scope.declarations.set(name2, node); - }); + } else if (node2.declaration) { + replace = node2.declaration; + } else { + const declarators = node2.specifiers.filter(function(specifier) { + return specifier.local.name !== specifier.exported.name; + }).map(function(specifier) { + return { + type: "VariableDeclarator", + id: specifier.exported, + init: specifier.local + }; }); - break; - case "ForStatement": - case "ForInStatement": - case "ForOfStatement": - map.set(node, current_scope = new Scope3(current_scope, true)); - break; - case "BlockStatement": - map.set(node, current_scope = new Scope3(current_scope, true)); - break; - case "ClassDeclaration": - case "VariableDeclaration": - current_scope.add_declaration(node); - break; - case "CatchClause": - map.set(node, current_scope = new Scope3(current_scope, true)); - if (node.param) { - extract_names(node.param).forEach((name2) => { - current_scope.declarations.set(name2, node.param); - }); + if (declarators.length > 0) { + replace = { + type: "VariableDeclaration", + kind: "const", + declarations: declarators + }; } - break; + } + } else { + replace = node2; } - }, - leave(node) { - if (map.has(node)) { - current_scope = current_scope.parent; + if (replace) { + replacement.push(replace); } } - }); - for (let i = references.length - 1; i >= 0; --i) { - const [scope2, reference] = references[i]; - if (!scope2.references.has(reference.name)) { - add_reference(scope2, reference.name); + }; + function createMdxContent(content3, outputFormat2, hasInternalLayout) { + const element2 = { + type: "JSXElement", + openingElement: { + type: "JSXOpeningElement", + name: { type: "JSXIdentifier", name: "MDXLayout" }, + attributes: [ + { + type: "JSXSpreadAttribute", + argument: { type: "Identifier", name: "props" } + } + ], + selfClosing: false + }, + closingElement: { + type: "JSXClosingElement", + name: { type: "JSXIdentifier", name: "MDXLayout" } + }, + children: [ + { + type: "JSXElement", + openingElement: { + type: "JSXOpeningElement", + name: { type: "JSXIdentifier", name: "_createMdxContent" }, + attributes: [ + { + type: "JSXSpreadAttribute", + argument: { type: "Identifier", name: "props" } + } + ], + selfClosing: true + }, + closingElement: null, + children: [] + } + ] + }; + let result = ( + /** @type {Expression} */ + element2 + ); + if (!hasInternalLayout) { + result = { + type: "ConditionalExpression", + test: { type: "Identifier", name: "MDXLayout" }, + consequent: result, + alternate: { + type: "CallExpression", + callee: { type: "Identifier", name: "_createMdxContent" }, + arguments: [{ type: "Identifier", name: "props" }], + optional: false + } + }; } - if (!scope2.find_owner(reference.name)) { - globals.set(reference.name, reference); + let argument = ( + // Cast because TS otherwise does not think `JSXFragment`s are expressions. + /** @type {Readonly | Readonly} */ + content3 || { type: "Identifier", name: "undefined" } + ); + if (argument.type === "JSXFragment" && argument.children.length === 1 && argument.children[0].type === "JSXElement") { + argument = argument.children[0]; } - } - return { map, scope, globals }; -} -function add_reference(scope, name2) { - scope.references.add(name2); - if (scope.parent) - add_reference(scope.parent, name2); -} -var Scope3 = class { - constructor(parent, block) { - this.parent = parent; - this.block = block; - this.declarations = /* @__PURE__ */ new Map(); - this.initialised_declarations = /* @__PURE__ */ new Set(); - this.references = /* @__PURE__ */ new Set(); - } - add_declaration(node) { - if (node.type === "VariableDeclaration") { - if (node.kind === "var" && this.block && this.parent) { - this.parent.add_declaration(node); - } else { - const handle_declarator = (declarator) => { - extract_names(declarator.id).forEach((name2) => { - this.declarations.set(name2, node); - if (declarator.init) - this.initialised_declarations.add(name2); - }); - ; - }; - node.declarations.forEach(handle_declarator); + let awaitExpression = false; + walk(argument, { + enter(node2) { + if (node2.type === "ArrowFunctionExpression" || node2.type === "FunctionDeclaration" || node2.type === "FunctionExpression") { + return this.skip(); + } + if (node2.type === "AwaitExpression" || /* c8 ignore next 2 -- can only occur in a function (which then can + * only be async, so skipped it) */ + node2.type === "ForOfStatement" && node2.await) { + awaitExpression = true; + } } - } else if (node.id) { - this.declarations.set(node.id.name, node); - } - } - find_owner(name2) { - if (this.declarations.has(name2)) - return this; - return this.parent && this.parent.find_owner(name2); - } - has(name2) { - return this.declarations.has(name2) || !!this.parent && this.parent.has(name2); - } -}; -function extract_names(param) { - return extract_identifiers(param).map((node) => node.name); -} -function extract_identifiers(param, nodes = []) { - switch (param.type) { - case "Identifier": - nodes.push(param); - break; - case "MemberExpression": - let object = param; - while (object.type === "MemberExpression") { - object = object.object; + }); + const declaration = { + type: "FunctionDeclaration", + id: { type: "Identifier", name: "MDXContent" }, + params: [ + { + type: "AssignmentPattern", + left: { type: "Identifier", name: "props" }, + right: { type: "ObjectExpression", properties: [] } + } + ], + body: { + type: "BlockStatement", + body: [{ type: "ReturnStatement", argument: result }] } - nodes.push(object); - break; - case "ObjectPattern": - const handle_prop = (prop) => { - if (prop.type === "RestElement") { - extract_identifiers(prop.argument, nodes); - } else { - extract_identifiers(prop.value, nodes); + }; + return [ + { + type: "FunctionDeclaration", + async: awaitExpression, + id: { type: "Identifier", name: "_createMdxContent" }, + params: [{ type: "Identifier", name: "props" }], + body: { + type: "BlockStatement", + body: [ + { + type: "ReturnStatement", + // Cast because TS doesn’t think `JSXFragment` is an expression. + // eslint-disable-next-line object-shorthand + argument: ( + /** @type {Expression} */ + argument + ) + } + ] } - }; - param.properties.forEach(handle_prop); - break; - case "ArrayPattern": - const handle_element = (element2) => { - if (element2) - extract_identifiers(element2, nodes); - }; - param.elements.forEach(handle_element); - break; - case "RestElement": - extract_identifiers(param.argument, nodes); - break; - case "AssignmentPattern": - extract_identifiers(param.left, nodes); - break; + }, + outputFormat2 === "program" ? { type: "ExportDefaultDeclaration", declaration } : declaration + ]; } - return nodes; } - -// node_modules/@mdx-js/mdx/lib/util/estree-util-declaration-to-expression.js -function declarationToExpression(declaration) { - if (declaration.type === "FunctionDeclaration") { - return { ...declaration, type: "FunctionExpression" }; - } - if (declaration.type === "ClassDeclaration") { - return { ...declaration, type: "ClassExpression" }; - } - throw new Error("Cannot turn `" + declaration.type + "` into an expression"); +function resolveDynamicMdxSpecifier(importMetaUrl) { + return { + type: "FunctionDeclaration", + id: { type: "Identifier", name: "_resolveDynamicMdxSpecifier" }, + generator: false, + async: false, + params: [{ type: "Identifier", name: "d" }], + body: { + type: "BlockStatement", + body: [ + { + type: "IfStatement", + test: { + type: "BinaryExpression", + left: { + type: "UnaryExpression", + operator: "typeof", + prefix: true, + argument: { type: "Identifier", name: "d" } + }, + operator: "!==", + right: { type: "Literal", value: "string" } + }, + consequent: { + type: "ReturnStatement", + argument: { type: "Identifier", name: "d" } + }, + alternate: null + }, + // To do: use `URL.canParse` when widely supported (see commented + // out code below). + { + type: "TryStatement", + block: { + type: "BlockStatement", + body: [ + { + type: "ExpressionStatement", + expression: { + type: "NewExpression", + callee: { type: "Identifier", name: "URL" }, + arguments: [{ type: "Identifier", name: "d" }] + } + }, + { + type: "ReturnStatement", + argument: { type: "Identifier", name: "d" } + } + ] + }, + handler: { + type: "CatchClause", + param: null, + body: { type: "BlockStatement", body: [] } + }, + finalizer: null + }, + // To do: use `URL.canParse` when widely supported. + // { + // type: 'IfStatement', + // test: { + // type: 'CallExpression', + // callee: toIdOrMemberExpression(['URL', 'canParse']), + // arguments: [{type: 'Identifier', name: 'd'}], + // optional: false + // }, + // consequent: { + // type: 'ReturnStatement', + // argument: {type: 'Identifier', name: 'd'} + // }, + // alternate: null + // }, + { + type: "IfStatement", + test: { + type: "LogicalExpression", + left: { + type: "LogicalExpression", + left: { + type: "CallExpression", + callee: toIdOrMemberExpression(["d", "startsWith"]), + arguments: [{ type: "Literal", value: "/" }], + optional: false + }, + operator: "||", + right: { + type: "CallExpression", + callee: toIdOrMemberExpression(["d", "startsWith"]), + arguments: [{ type: "Literal", value: "./" }], + optional: false + } + }, + operator: "||", + right: { + type: "CallExpression", + callee: toIdOrMemberExpression(["d", "startsWith"]), + arguments: [{ type: "Literal", value: "../" }], + optional: false + } + }, + consequent: { + type: "ReturnStatement", + argument: { + type: "MemberExpression", + object: { + type: "NewExpression", + callee: { type: "Identifier", name: "URL" }, + arguments: [{ type: "Identifier", name: "d" }, importMetaUrl] + }, + property: { type: "Identifier", name: "href" }, + computed: false, + optional: false + } + }, + alternate: null + }, + { + type: "ReturnStatement", + argument: { type: "Identifier", name: "d" } + } + ] + } + }; } - -// node_modules/@mdx-js/mdx/lib/util/estree-util-is-declaration.js -function isDeclaration(node) { - const type = node && typeof node === "object" && node.type; - return Boolean( - type === "FunctionDeclaration" || type === "ClassDeclaration" || type === "VariableDeclaration" - ); +function createImportMetaUrlVariable() { + return [ + { + type: "VariableDeclaration", + declarations: [ + { + type: "VariableDeclarator", + id: { type: "Identifier", name: "_importMetaUrl" }, + init: toIdOrMemberExpression(["arguments", 0, "baseUrl"]) + } + ], + kind: "const" + }, + { + type: "IfStatement", + test: { + type: "UnaryExpression", + operator: "!", + prefix: true, + argument: { type: "Identifier", name: "_importMetaUrl" } + }, + consequent: { + type: "ThrowStatement", + argument: { + type: "NewExpression", + callee: { type: "Identifier", name: "Error" }, + arguments: [ + { + type: "Literal", + value: "Unexpected missing `options.baseUrl` needed to support `export \u2026 from`, `import`, or `import.meta.url` when generating `function-body`" + } + ] + } + }, + alternate: null + } + ]; } -// node_modules/@mdx-js/mdx/lib/plugin/recma-document.js -function recmaDocument(options = {}) { - const { - baseUrl, - useDynamicImport, - outputFormat = "program", - pragma = "React.createElement", - pragmaFrag = "React.Fragment", - pragmaImportSource = "react", - jsxImportSource = "react", - jsxRuntime = "automatic" - } = options; - return (tree, file) => { - const exportedIdentifiers = []; - const replacement = []; - const pragmas = []; - let exportAllCount = 0; - let layout; - let content3; - let child; - if (!tree.comments) - tree.comments = []; - if (jsxRuntime) { - pragmas.push("@jsxRuntime " + jsxRuntime); - } - if (jsxRuntime === "automatic" && jsxImportSource) { - pragmas.push("@jsxImportSource " + jsxImportSource); - } - if (jsxRuntime === "classic" && pragma) { - pragmas.push("@jsx " + pragma); - } - if (jsxRuntime === "classic" && pragmaFrag) { - pragmas.push("@jsxFrag " + pragmaFrag); - } - if (pragmas.length > 0) { - tree.comments.unshift({ type: "Block", value: pragmas.join(" ") }); - } - if (jsxRuntime === "classic" && pragmaImportSource) { - if (!pragma) { - throw new Error( - "Missing `pragma` in classic runtime with `pragmaImportSource`" - ); - } - handleEsm({ - type: "ImportDeclaration", - specifiers: [ - { - type: "ImportDefaultSpecifier", - local: { type: "Identifier", name: pragma.split(".")[0] } +// node_modules/estree-util-build-jsx/lib/index.js +var regex = /@(jsx|jsxFrag|jsxImportSource|jsxRuntime)\s+(\S+)/g; +function buildJsx(tree, options) { + const config = options || {}; + let automatic = config.runtime === "automatic"; + const annotations = {}; + const imports = {}; + walk(tree, { + enter(node2) { + if (node2.type === "Program") { + const comments = node2.comments || []; + let index2 = -1; + while (++index2 < comments.length) { + regex.lastIndex = 0; + let match = regex.exec(comments[index2].value); + while (match) { + annotations[match[1]] = match[2]; + match = regex.exec(comments[index2].value); } - ], - source: { type: "Literal", value: pragmaImportSource } - }); - } - for (child of tree.body) { - if (child.type === "ExportDefaultDeclaration") { - if (layout) { - file.fail( - "Cannot specify multiple layouts (previous: " + stringifyPosition(positionFromEstree(layout)) + ")", - positionFromEstree(child), - "recma-document:duplicate-layout" - ); } - layout = child; - replacement.push({ - type: "VariableDeclaration", - kind: "const", - declarations: [ - { - type: "VariableDeclarator", - id: { type: "Identifier", name: "MDXLayout" }, - init: isDeclaration(child.declaration) ? declarationToExpression(child.declaration) : child.declaration + if (annotations.jsxRuntime) { + if (annotations.jsxRuntime === "automatic") { + automatic = true; + if (annotations.jsx) { + throw new Error("Unexpected `@jsx` pragma w/ automatic runtime"); } - ] - }); - } else if (child.type === "ExportNamedDeclaration" && child.source) { - const source = child.source; - child.specifiers = child.specifiers.filter((specifier) => { - if (specifier.exported.name === "default") { - if (layout) { - file.fail( - "Cannot specify multiple layouts (previous: " + stringifyPosition(positionFromEstree(layout)) + ")", - positionFromEstree(child), - "recma-document:duplicate-layout" + if (annotations.jsxFrag) { + throw new Error( + "Unexpected `@jsxFrag` pragma w/ automatic runtime" ); } - layout = specifier; - handleEsm( - create2(specifier, { - type: "ImportDeclaration", - specifiers: [ - specifier.local.name === "default" ? { - type: "ImportDefaultSpecifier", - local: { type: "Identifier", name: "MDXLayout" } - } : create2(specifier.local, { - type: "ImportSpecifier", - imported: specifier.local, - local: { type: "Identifier", name: "MDXLayout" } - }) - ], - source: create2(source, { type: "Literal", value: source.value }) - }) + } else if (annotations.jsxRuntime === "classic") { + automatic = false; + if (annotations.jsxImportSource) { + throw new Error( + "Unexpected `@jsxImportSource` w/ classic runtime" + ); + } + } else { + throw new Error( + "Unexpected `jsxRuntime` `" + annotations.jsxRuntime + "`, expected `automatic` or `classic`" ); - return false; } - return true; - }); - if (child.specifiers.length > 0) { - handleExport(child); } - } else if (child.type === "ExportNamedDeclaration" || child.type === "ExportAllDeclaration") { - handleExport(child); - } else if (child.type === "ImportDeclaration") { - handleEsm(child); - } else if (child.type === "ExpressionStatement" && (child.expression.type === "JSXFragment" || child.expression.type === "JSXElement")) { - content3 = true; - replacement.push(...createMdxContent(child.expression, Boolean(layout))); - } else { - replacement.push(child); } - } - if (!content3) { - replacement.push(...createMdxContent(void 0, Boolean(layout))); - } - exportedIdentifiers.push(["MDXContent", "default"]); - if (outputFormat === "function-body") { - replacement.push({ - type: "ReturnStatement", - argument: { - type: "ObjectExpression", - properties: [ - ...Array.from({ length: exportAllCount }).map( - (_, index2) => ({ - type: "SpreadElement", - argument: { type: "Identifier", name: "_exportAll" + (index2 + 1) } - }) - ), - ...exportedIdentifiers.map((d) => { - const prop = { - type: "Property", - kind: "init", - method: false, - computed: false, - shorthand: typeof d === "string", - key: { - type: "Identifier", - name: typeof d === "string" ? d : d[1] - }, - value: { - type: "Identifier", - name: typeof d === "string" ? d : d[0] - } - }; - return prop; - }) - ] + }, + // eslint-disable-next-line complexity + leave(node2) { + if (node2.type === "Program") { + const specifiers = []; + if (imports.fragment) { + specifiers.push({ + type: "ImportSpecifier", + imported: { type: "Identifier", name: "Fragment" }, + local: { type: "Identifier", name: "_Fragment" } + }); } - }); - } else { - replacement.push({ - type: "ExportDefaultDeclaration", - declaration: { type: "Identifier", name: "MDXContent" } - }); - } - tree.body = replacement; - if (baseUrl) { - walk(tree, { - enter(_node) { - const node = _node; - if (node.type === "MemberExpression" && "object" in node && node.object.type === "MetaProperty" && node.property.type === "Identifier" && node.object.meta.name === "import" && node.object.property.name === "meta" && node.property.name === "url") { - const replacement2 = { type: "Literal", value: baseUrl }; - this.replace(replacement2); + if (imports.jsx) { + specifiers.push({ + type: "ImportSpecifier", + imported: { type: "Identifier", name: "jsx" }, + local: { type: "Identifier", name: "_jsx" } + }); + } + if (imports.jsxs) { + specifiers.push({ + type: "ImportSpecifier", + imported: { type: "Identifier", name: "jsxs" }, + local: { type: "Identifier", name: "_jsxs" } + }); + } + if (imports.jsxDEV) { + specifiers.push({ + type: "ImportSpecifier", + imported: { type: "Identifier", name: "jsxDEV" }, + local: { type: "Identifier", name: "_jsxDEV" } + }); + } + if (specifiers.length > 0) { + let injectIndex = 0; + while (injectIndex < node2.body.length) { + const child = node2.body[injectIndex]; + if ("directive" in child && child.directive) { + injectIndex++; + } else { + break; + } + } + node2.body.splice(injectIndex, 0, { + type: "ImportDeclaration", + specifiers, + source: { + type: "Literal", + value: (annotations.jsxImportSource || config.importSource || "react") + (config.development ? "/jsx-dev-runtime" : "/jsx-runtime") + } + }); + } + } + if (node2.type !== "JSXElement" && node2.type !== "JSXFragment") { + return; + } + const children = []; + let index2 = -1; + while (++index2 < node2.children.length) { + const child = node2.children[index2]; + if (child.type === "JSXExpressionContainer") { + if (child.expression.type !== "JSXEmptyExpression") { + children.push(child.expression); + } + } else if (child.type === "JSXText") { + const value = child.value.replace(/\t/g, " ").replace(/ *(\r?\n|\r) */g, "\n").replace(/\n+/g, "\n").replace(/\n+$/, "").replace(/^\n+/, "").replace(/\n/g, " "); + if (value) { + const text5 = { type: "Literal", value }; + create2(child, text5); + children.push(text5); + } + } else { + ok( + child.type !== "JSXElement" && child.type !== "JSXFragment" && child.type !== "JSXSpreadChild" + ); + children.push(child); + } + } + let name2; + const fields = []; + let parameters = []; + let key; + if (node2.type === "JSXElement") { + name2 = toIdentifier(node2.openingElement.name); + if (name2.type === "Identifier" && /^[a-z]/.test(name2.name)) { + const next = { type: "Literal", value: name2.name }; + create2(name2, next); + name2 = next; + } + let spread; + const attributes = node2.openingElement.attributes; + let index3 = -1; + while (++index3 < attributes.length) { + const attribute = attributes[index3]; + if (attribute.type === "JSXSpreadAttribute") { + if (attribute.argument.type === "ObjectExpression") { + fields.push(...attribute.argument.properties); + } else { + fields.push({ type: "SpreadElement", argument: attribute.argument }); + } + spread = true; + } else { + const prop = toProperty(attribute); + if (automatic && prop.key.type === "Identifier" && prop.key.name === "key") { + if (spread) { + throw new Error( + "Expected `key` to come before any spread expressions" + ); + } + const value = prop.value; + ok( + value.type !== "AssignmentPattern" && value.type !== "ArrayPattern" && value.type !== "ObjectPattern" && value.type !== "RestElement" + ); + key = value; + } else { + fields.push(prop); + } } } - }); - } - function handleExport(node) { - if (node.type === "ExportNamedDeclaration") { - if (node.declaration) { - exportedIdentifiers.push( - ...analyze(node.declaration).scope.declarations.keys() - ); - } - for (child of node.specifiers) { - exportedIdentifiers.push(child.exported.name); - } + } else if (automatic) { + imports.fragment = true; + name2 = { type: "Identifier", name: "_Fragment" }; + } else { + name2 = toMemberExpression( + annotations.jsxFrag || config.pragmaFrag || "React.Fragment" + ); } - handleEsm(node); - } - function handleEsm(node) { - if (baseUrl && node.source) { - let value = String(node.source.value); - try { - value = String(new URL(value)); - } catch { - if (/^\.{0,2}\//.test(value)) { - value = String(new URL(value, baseUrl)); - } + if (automatic) { + if (children.length > 0) { + fields.push({ + type: "Property", + key: { type: "Identifier", name: "children" }, + value: children.length > 1 ? { type: "ArrayExpression", elements: children } : children[0], + kind: "init", + method: false, + shorthand: false, + computed: false + }); } - node.source = create2(node.source, { type: "Literal", value }); + } else { + parameters = children; } - let replace; - let init; - if (outputFormat === "function-body") { - if (node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration" && node.source) { - if (!useDynamicImport) { - file.fail( - "Cannot use `import` or `export \u2026 from` in `evaluate` (outputting a function body) by default: please set `useDynamicImport: true` (and probably specify a `baseUrl`)", - positionFromEstree(node), - "recma-document:invalid-esm-statement" - ); - } - if (!node.source) { - throw new Error("Expected `node.source` to be defined"); - } - init = { - type: "AwaitExpression", - argument: create2(node, { - type: "ImportExpression", - source: node.source - }) + let callee; + if (automatic) { + parameters.push({ type: "ObjectExpression", properties: fields }); + if (key) { + parameters.push(key); + } else if (config.development) { + parameters.push({ type: "Identifier", name: "undefined" }); + } + const isStaticChildren = children.length > 1; + if (config.development) { + imports.jsxDEV = true; + callee = { + type: "Identifier", + name: "_jsxDEV" }; - if ((node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration") && node.specifiers.length === 0) { - replace = { type: "ExpressionStatement", expression: init }; - } else { - replace = { - type: "VariableDeclaration", - kind: "const", - declarations: node.type === "ExportAllDeclaration" ? [ - { - type: "VariableDeclarator", - id: { - type: "Identifier", - name: "_exportAll" + ++exportAllCount - }, - init + parameters.push({ type: "Literal", value: isStaticChildren }); + const source = { + type: "ObjectExpression", + properties: [ + { + type: "Property", + method: false, + shorthand: false, + computed: false, + kind: "init", + key: { type: "Identifier", name: "fileName" }, + value: { + type: "Literal", + value: config.filePath || "" } - ] : specifiersToDeclarations(node.specifiers, init) - }; + } + ] + }; + if (node2.loc) { + source.properties.push( + { + type: "Property", + method: false, + shorthand: false, + computed: false, + kind: "init", + key: { type: "Identifier", name: "lineNumber" }, + value: { type: "Literal", value: node2.loc.start.line } + }, + { + type: "Property", + method: false, + shorthand: false, + computed: false, + kind: "init", + key: { type: "Identifier", name: "columnNumber" }, + value: { type: "Literal", value: node2.loc.start.column + 1 } + } + ); } - } else if (node.declaration) { - replace = node.declaration; + parameters.push(source, { type: "ThisExpression" }); + } else if (isStaticChildren) { + imports.jsxs = true; + callee = { type: "Identifier", name: "_jsxs" }; } else { - const declarators = node.specifiers.filter( - (specifier) => specifier.local.name !== specifier.exported.name - ).map((specifier) => ({ - type: "VariableDeclarator", - id: specifier.exported, - init: specifier.local - })); - if (declarators.length > 0) { - replace = { - type: "VariableDeclaration", - kind: "const", - declarations: declarators - }; - } + imports.jsx = true; + callee = { type: "Identifier", name: "_jsx" }; } } else { - replace = node; - } - if (replace) { - replacement.push(replace); + if (fields.length > 0) { + parameters.unshift({ type: "ObjectExpression", properties: fields }); + } else if (parameters.length > 0) { + parameters.unshift({ type: "Literal", value: null }); + } + callee = toMemberExpression( + annotations.jsx || config.pragma || "React.createElement" + ); } + parameters.unshift(name2); + const call = { + type: "CallExpression", + callee, + arguments: parameters, + optional: false + }; + create2(node2, call); + this.replace(call); + } + }); +} +function toProperty(node2) { + let value; + if (node2.value) { + if (node2.value.type === "JSXExpressionContainer") { + const valueExpression = node2.value.expression; + ok( + valueExpression.type !== "JSXEmptyExpression", + "`JSXEmptyExpression` is not allowed in props." + ); + value = valueExpression; + } else { + const nodeValue = node2.value; + ok( + nodeValue.type !== "JSXElement" && nodeValue.type !== "JSXFragment", + "JSX{Element,Fragment} are already compiled to `CallExpression`" + ); + value = nodeValue; + delete value.raw; } + } else { + value = { type: "Literal", value: true }; + } + const replacement = { + type: "Property", + key: toIdentifier(node2.name), + value, + kind: "init", + method: false, + shorthand: false, + computed: false }; - function createMdxContent(content3, hasInternalLayout) { - const element2 = { - type: "JSXElement", - openingElement: { - type: "JSXOpeningElement", - name: { type: "JSXIdentifier", name: "MDXLayout" }, - attributes: [ - { - type: "JSXSpreadAttribute", - argument: { type: "Identifier", name: "props" } - } - ], - selfClosing: false - }, - closingElement: { - type: "JSXClosingElement", - name: { type: "JSXIdentifier", name: "MDXLayout" } - }, - children: [ - { - type: "JSXElement", - openingElement: { - type: "JSXOpeningElement", - name: { type: "JSXIdentifier", name: "_createMdxContent" }, - attributes: [ - { - type: "JSXSpreadAttribute", - argument: { type: "Identifier", name: "props" } - } - ], - selfClosing: true - }, - closingElement: null, - children: [] - } - ] + create2(node2, replacement); + return replacement; +} +function toIdentifier(node2) { + let replace; + if (node2.type === "JSXMemberExpression") { + const id = toIdentifier(node2.property); + replace = { + type: "MemberExpression", + object: toIdentifier(node2.object), + property: id, + computed: id.type === "Literal", + optional: false }; - let result = element2; - if (!hasInternalLayout) { - result = { - type: "ConditionalExpression", - test: { type: "Identifier", name: "MDXLayout" }, - consequent: result, - alternate: { - type: "CallExpression", - callee: { type: "Identifier", name: "_createMdxContent" }, - arguments: [{ type: "Identifier", name: "props" }], - optional: false - } - }; + } else if (node2.type === "JSXNamespacedName") { + replace = { + type: "Literal", + value: node2.namespace.name + ":" + node2.name.name + }; + } else { + replace = name(node2.name) ? { type: "Identifier", name: node2.name } : { type: "Literal", value: node2.name }; + } + create2(node2, replace); + return replace; +} +function toMemberExpression(id) { + const identifiers = id.split("."); + let index2 = -1; + let result; + while (++index2 < identifiers.length) { + const prop = name(identifiers[index2]) ? { type: "Identifier", name: identifiers[index2] } : { type: "Literal", value: identifiers[index2] }; + result = result ? { + type: "MemberExpression", + object: result, + property: prop, + computed: Boolean(index2 && prop.type === "Literal"), + optional: false + } : prop; + } + ok(result, "always a result"); + return result; +} +function create2(from, to) { + const fields = ["start", "end", "loc", "range", "comments"]; + let index2 = -1; + while (++index2 < fields.length) { + const field = fields[index2]; + if (field in from) { + to[field] = from[field]; } - let argument = content3 || { type: "Literal", value: null }; - if (argument && argument.type === "JSXFragment" && argument.children.length === 1 && argument.children[0].type === "JSXElement") { - argument = argument.children[0]; + } +} + +// node_modules/@mdx-js/mdx/lib/plugin/recma-jsx-build.js +function recmaJsxBuild(options) { + const { development, outputFormat } = options || {}; + return function(tree, file) { + buildJsx(tree, { development, filePath: file.history[0] }); + if (tree.comments && tree.comments[0].type === "Block" && tree.comments[0].data && tree.comments[0].data._mdxIsPragmaComment) { + tree.comments.shift(); } - return [ - { - type: "FunctionDeclaration", - id: { type: "Identifier", name: "_createMdxContent" }, - params: [{ type: "Identifier", name: "props" }], - body: { - type: "BlockStatement", - body: [{ type: "ReturnStatement", argument }] - } - }, - { - type: "FunctionDeclaration", - id: { type: "Identifier", name: "MDXContent" }, - params: [ - { - type: "AssignmentPattern", - left: { type: "Identifier", name: "props" }, - right: { type: "ObjectExpression", properties: [] } - } - ], - body: { - type: "BlockStatement", - body: [ - { - type: "ReturnStatement", - argument: result - } - ] + if (outputFormat === "function-body") { + let index2 = 0; + while (index2 < tree.body.length) { + const child = tree.body[index2]; + if ("directive" in child && child.directive) { + index2++; + } else { + break; } } - ]; - } + const declaration = tree.body[index2]; + if (declaration && declaration.type === "ImportDeclaration" && typeof declaration.source.value === "string" && /\/jsx-(dev-)?runtime$/.test(declaration.source.value)) { + tree.body[index2] = { + type: "VariableDeclaration", + kind: "const", + declarations: specifiersToDeclarations( + declaration.specifiers, + toIdOrMemberExpression(["arguments", 0]) + ) + }; + } + } + }; } // node_modules/@mdx-js/mdx/lib/util/estree-util-to-binary-addition.js @@ -22305,35 +25071,35 @@ function toBinaryAddition(expressions) { const right = expressions[index2]; left = left ? { type: "BinaryExpression", left, operator: "+", right } : right; } - if (!left) - throw new Error("Expected non-empty `expressions` to be passed"); + ok(left, "expected non-empty `expressions` to be passed"); return left; } // node_modules/@mdx-js/mdx/lib/plugin/recma-jsx-rewrite.js -var own8 = {}.hasOwnProperty; -function recmaJsxRewrite(options = {}) { - const { development: development2, providerImportSource, outputFormat } = options; - return (tree, file) => { +function recmaJsxRewrite(options) { + const { development, outputFormat, providerImportSource } = options; + return function(tree, file) { const scopeInfo = analyze(tree); const fnStack = []; - let importProvider; - let createErrorHelper; + let importProvider = false; + let createErrorHelper = false; let currentScope; walk(tree, { - enter(_node) { - const node = _node; - const newScope = scopeInfo.map.get(node); - if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") { + enter(node2) { + const newScope = ( + /** @type {Scope | undefined} */ + scopeInfo.map.get(node2) + ); + if (node2.type === "FunctionDeclaration" || node2.type === "FunctionExpression" || node2.type === "ArrowFunctionExpression") { fnStack.push({ - objects: [], components: [], - tags: [], - references: {}, idToInvalidComponentName: /* @__PURE__ */ new Map(), - node + node: node2, + objects: [], + references: {}, + tags: [] }); - if (isNamedFunction(node, "MDXContent") && newScope && !inScope(newScope, "MDXLayout")) { + if (isNamedFunction(node2, "MDXContent") && newScope && !inScope(newScope, "MDXLayout")) { fnStack[0].components.push("MDXLayout"); } } @@ -22342,11 +25108,11 @@ function recmaJsxRewrite(options = {}) { return; } if (newScope) { - newScope.node = node; + newScope.node = node2; currentScope = newScope; } - if (currentScope && node.type === "JSXElement") { - let name2 = node.openingElement.name; + if (currentScope && node2.type === "JSXElement") { + let name2 = node2.openingElement.name; if (name2.type === "JSXMemberExpression") { const ids = []; while (name2.type === "JSXMemberExpression") { @@ -22357,10 +25123,15 @@ function recmaJsxRewrite(options = {}) { const fullId = ids.join("."); const id = name2.name; const isInScope = inScope(currentScope, id); - if (!own8.call(fnScope.references, fullId)) { - const parentScope = currentScope.parent; - if (!isInScope || parentScope && parentScope.node.type === "FunctionDeclaration" && isNamedFunction(parentScope.node, "_createMdxContent")) { - fnScope.references[fullId] = { node, component: true }; + if (!Object.hasOwn(fnScope.references, fullId)) { + const parentScope = ( + /** @type {Scope | undefined} */ + currentScope.parent + ); + if (!isInScope || // If the parent scope is `_createMdxContent`, then this + // references a component we can add a check statement for. + parentScope && parentScope.node.type === "FunctionDeclaration" && isNamedFunction(parentScope.node, "_createMdxContent")) { + fnScope.references[fullId] = { component: true, node: node2 }; } } if (!fnScope.objects.includes(id) && !isInScope) { @@ -22370,14 +25141,14 @@ function recmaJsxRewrite(options = {}) { } else if (name(name2.name) && !/^[a-z]/.test(name2.name)) { const id = name2.name; if (!inScope(currentScope, id)) { - if (id !== "MDXLayout" && !own8.call(fnScope.references, id)) { - fnScope.references[id] = { node, component: true }; + if (id !== "MDXLayout" && !Object.hasOwn(fnScope.references, id)) { + fnScope.references[id] = { component: true, node: node2 }; } if (!fnScope.components.includes(id)) { fnScope.components.push(id); } } - } else if (node.data && node.data._mdxExplicitJsx) { + } else if (node2.data && node2.data._mdxExplicitJsx) { } else { const id = name2.name; if (!fnScope.tags.includes(id)) { @@ -22392,26 +25163,27 @@ function recmaJsxRewrite(options = {}) { } jsxIdExpression = [invalidComponentName]; } - node.openingElement.name = toJsxIdOrMemberExpression(jsxIdExpression); - if (node.closingElement) { - node.closingElement.name = toJsxIdOrMemberExpression(jsxIdExpression); + node2.openingElement.name = toJsxIdOrMemberExpression(jsxIdExpression); + if (node2.closingElement) { + node2.closingElement.name = toJsxIdOrMemberExpression(jsxIdExpression); } } } }, - leave(node) { + leave(node2) { const defaults = []; const actual = []; const parameters = []; const declarations = []; - if (currentScope && currentScope.node === node) { - currentScope = currentScope.parent; + if (currentScope && currentScope.node === node2) { + currentScope = /** @type {Scope} */ + currentScope.parent; } - if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") { - const fn = node; + if (node2.type === "FunctionDeclaration" || node2.type === "FunctionExpression" || node2.type === "ArrowFunctionExpression") { + const fn = node2; const scope = fnStack[fnStack.length - 1]; let name2; - for (name2 of scope.tags) { + for (name2 of scope.tags.sort()) { defaults.push({ type: "Property", kind: "init", @@ -22428,6 +25200,7 @@ function recmaJsxRewrite(options = {}) { actual.push(name2); } } + actual.sort(); const statements = []; if (defaults.length > 0 || actual.length > 0 || scope.idToInvalidComponentName.size > 0) { if (providerImportSource) { @@ -22443,38 +25216,38 @@ function recmaJsxRewrite(options = {}) { parameters.push(toIdOrMemberExpression(["props", "components"])); } if (defaults.length > 0 || parameters.length > 1) { - parameters.unshift({ - type: "ObjectExpression", - properties: defaults - }); + for (const parameter of parameters) { + defaults.push({ type: "SpreadElement", argument: parameter }); + } } - let componentsInit = parameters.length > 1 ? { - type: "CallExpression", - callee: toIdOrMemberExpression(["Object", "assign"]), - arguments: parameters, - optional: false - } : parameters[0].type === "MemberExpression" ? { - type: "LogicalExpression", - operator: "||", - left: parameters[0], - right: { type: "ObjectExpression", properties: [] } - } : parameters[0]; + let componentsInit = defaults.length > 0 ? { type: "ObjectExpression", properties: defaults } : ( + // If we’re only getting components from `props.components`, + // make sure it’s defined. + { + type: "LogicalExpression", + operator: "||", + left: parameters[0], + right: { type: "ObjectExpression", properties: [] } + } + ); let componentsPattern; if (actual.length > 0) { componentsPattern = { type: "ObjectPattern", - properties: actual.map((name3) => ({ - type: "Property", - kind: "init", - key: { - type: "Identifier", - name: name3 === "MDXLayout" ? "wrapper" : name3 - }, - value: { type: "Identifier", name: name3 }, - method: false, - shorthand: name3 !== "MDXLayout", - computed: false - })) + properties: actual.map(function(name3) { + return { + type: "Property", + kind: "init", + key: { + type: "Identifier", + name: name3 === "MDXLayout" ? "wrapper" : name3 + }, + value: { type: "Identifier", name: name3 }, + method: false, + shorthand: name3 !== "MDXLayout", + computed: false + }; + }) }; } if (scope.tags.length > 0) { @@ -22486,13 +25259,17 @@ function recmaJsxRewrite(options = {}) { componentsInit = { type: "Identifier", name: "_components" }; } if (isNamedFunction(scope.node, "_createMdxContent")) { - for (const [ - id, - componentName - ] of scope.idToInvalidComponentName) { + for (const [id, componentName] of [ + ...scope.idToInvalidComponentName + ].sort(function([a], [b]) { + return a.localeCompare(b); + })) { declarations.push({ type: "VariableDeclarator", - id: { type: "Identifier", name: componentName }, + id: { + type: "Identifier", + name: componentName + }, init: { type: "MemberExpression", object: { type: "Identifier", name: "_components" }, @@ -22520,15 +25297,15 @@ function recmaJsxRewrite(options = {}) { } let key; for (key in scope.references) { - if (own8.call(scope.references, key)) { + if (Object.hasOwn(scope.references, key)) { const parts = key.split("."); let index3 = 0; while (++index3 < parts.length) { const partial = parts.slice(0, index3).join("."); - if (!own8.call(scope.references, partial)) { + if (!Object.hasOwn(scope.references, partial)) { scope.references[partial] = { - node: scope.references[key].node, - component: false + component: false, + node: scope.references[key].node }; } } @@ -22545,7 +25322,7 @@ function recmaJsxRewrite(options = {}) { { type: "Literal", value: info.component } ]; createErrorHelper = true; - if (development2 && place !== "1:1-1:1") { + if (development && place) { parameters2.push({ type: "Literal", value: place }); } statements.push({ @@ -22565,7 +25342,7 @@ function recmaJsxRewrite(options = {}) { optional: false } }, - alternate: null + alternate: void 0 }); } if (statements.length > 0) { @@ -22606,7 +25383,7 @@ function recmaJsxRewrite(options = {}) { { type: "Identifier", name: "id" }, { type: "Identifier", name: "component" } ]; - if (development2) { + if (development) { message.push({ type: "ConditionalExpression", test: { type: "Identifier", name: "place" }, @@ -22643,6 +25420,13 @@ function recmaJsxRewrite(options = {}) { } }); } + if (outputFormat === "function-body") { + tree.body.unshift({ + type: "ExpressionStatement", + expression: { type: "Literal", value: "use strict" }, + directive: "use strict" + }); + } }; } function createImportProvider(providerImportSource, outputFormat) { @@ -22666,8 +25450,8 @@ function createImportProvider(providerImportSource, outputFormat) { source: { type: "Literal", value: providerImportSource } }; } -function isNamedFunction(node, name2) { - return Boolean(node && "id" in node && node.id && node.id.name === name2); +function isNamedFunction(node2, name2) { + return Boolean(node2 && "id" in node2 && node2.id && node2.id.name === name2); } function inScope(scope, id) { let currentScope = scope; @@ -22675,7 +25459,8 @@ function inScope(scope, id) { if (currentScope.declarations.has(id)) { return true; } - currentScope = currentScope.parent; + currentScope = /** @type {Scope | undefined} */ + currentScope.parent || void 0; } return false; } @@ -22693,10 +25478,10 @@ if (!String.prototype.endsWith) { ); } var OPERATOR_PRECEDENCE = { - "||": 3, + "||": 2, + "??": 3, "&&": 4, "|": 5, - "??": 5, "^": 6, "&": 7, "==": 8, @@ -22721,6 +25506,7 @@ var OPERATOR_PRECEDENCE = { }; var NEEDS_PARENTHESES = 17; var EXPRESSIONS_PRECEDENCE = { + // Definitions ArrayExpression: 20, TaggedTemplateExpression: 20, ThisExpression: 20, @@ -22730,14 +25516,17 @@ var EXPRESSIONS_PRECEDENCE = { TemplateLiteral: 20, Super: 20, SequenceExpression: 20, + // Operations MemberExpression: 19, ChainExpression: 19, CallExpression: 19, NewExpression: 19, + // Other definitions ArrowFunctionExpression: NEEDS_PARENTHESES, ClassExpression: NEEDS_PARENTHESES, FunctionExpression: NEEDS_PARENTHESES, ObjectExpression: NEEDS_PARENTHESES, + // Other operations UpdateExpression: 16, UnaryExpression: 15, AwaitExpression: 15, @@ -22762,8 +25551,8 @@ function formatSequence(state, nodes) { } state.write(")"); } -function expressionNeedsParenthesis(state, node, parentNode, isRightHand) { - const nodePrecedence = state.expressionsPrecedence[node.type]; +function expressionNeedsParenthesis(state, node2, parentNode, isRightHand) { + const nodePrecedence = state.expressionsPrecedence[node2.type]; if (nodePrecedence === NEEDS_PARENTHESES) { return true; } @@ -22774,52 +25563,55 @@ function expressionNeedsParenthesis(state, node, parentNode, isRightHand) { if (nodePrecedence !== 13 && nodePrecedence !== 14) { return false; } - if (node.operator === "**" && parentNode.operator === "**") { + if (node2.operator === "**" && parentNode.operator === "**") { return !isRightHand; } + if (nodePrecedence === 13 && parentNodePrecedence === 13 && (node2.operator === "??" || parentNode.operator === "??")) { + return true; + } if (isRightHand) { - return OPERATOR_PRECEDENCE[node.operator] <= OPERATOR_PRECEDENCE[parentNode.operator]; + return OPERATOR_PRECEDENCE[node2.operator] <= OPERATOR_PRECEDENCE[parentNode.operator]; } - return OPERATOR_PRECEDENCE[node.operator] < OPERATOR_PRECEDENCE[parentNode.operator]; + return OPERATOR_PRECEDENCE[node2.operator] < OPERATOR_PRECEDENCE[parentNode.operator]; } -function formatExpression(state, node, parentNode, isRightHand) { +function formatExpression(state, node2, parentNode, isRightHand) { const { generator } = state; - if (expressionNeedsParenthesis(state, node, parentNode, isRightHand)) { + if (expressionNeedsParenthesis(state, node2, parentNode, isRightHand)) { state.write("("); - generator[node.type](node, state); + generator[node2.type](node2, state); state.write(")"); } else { - generator[node.type](node, state); + generator[node2.type](node2, state); } } -function reindent(state, text5, indent, lineEnd) { +function reindent(state, text5, indent2, lineEnd) { const lines = text5.split("\n"); const end = lines.length - 1; state.write(lines[0].trim()); if (end > 0) { state.write(lineEnd); for (let i = 1; i < end; i++) { - state.write(indent + lines[i].trim() + lineEnd); + state.write(indent2 + lines[i].trim() + lineEnd); } - state.write(indent + lines[end].trim()); + state.write(indent2 + lines[end].trim()); } } -function formatComments(state, comments, indent, lineEnd) { +function formatComments(state, comments, indent2, lineEnd) { const { length } = comments; for (let i = 0; i < length; i++) { const comment2 = comments[i]; - state.write(indent); + state.write(indent2); if (comment2.type[0] === "L") { state.write("// " + comment2.value.trim() + "\n", comment2); } else { state.write("/*"); - reindent(state, comment2.value, indent, lineEnd); + reindent(state, comment2.value, indent2, lineEnd); state.write("*/" + lineEnd); } } } -function hasCallExpression(node) { - let currentNode = node; +function hasCallExpression(node2) { + let currentNode = node2; while (currentNode != null) { const { type } = currentNode; if (type[0] === "C" && type[1] === "a") { @@ -22831,10 +25623,10 @@ function hasCallExpression(node) { } } } -function formatVariableDeclaration(state, node) { +function formatVariableDeclaration(state, node2) { const { generator } = state; - const { declarations } = node; - state.write(node.kind + " "); + const { declarations } = node2; + state.write(node2.kind + " "); const { length } = declarations; if (length > 0) { generator.VariableDeclarator(declarations[0], state); @@ -22851,37 +25643,40 @@ var BinaryExpression; var ArrayExpression; var BlockStatement; var GENERATOR = { - Program(node, state) { - const indent = state.indent.repeat(state.indentLevel); + /* + Default generator. + */ + Program(node2, state) { + const indent2 = state.indent.repeat(state.indentLevel); const { lineEnd, writeComments } = state; - if (writeComments && node.comments != null) { - formatComments(state, node.comments, indent, lineEnd); + if (writeComments && node2.comments != null) { + formatComments(state, node2.comments, indent2, lineEnd); } - const statements = node.body; + const statements = node2.body; const { length } = statements; for (let i = 0; i < length; i++) { const statement = statements[i]; if (writeComments && statement.comments != null) { - formatComments(state, statement.comments, indent, lineEnd); + formatComments(state, statement.comments, indent2, lineEnd); } - state.write(indent); + state.write(indent2); this[statement.type](statement, state); state.write(lineEnd); } - if (writeComments && node.trailingComments != null) { - formatComments(state, node.trailingComments, indent, lineEnd); + if (writeComments && node2.trailingComments != null) { + formatComments(state, node2.trailingComments, indent2, lineEnd); } }, - BlockStatement: BlockStatement = function(node, state) { - const indent = state.indent.repeat(state.indentLevel++); + BlockStatement: BlockStatement = function(node2, state) { + const indent2 = state.indent.repeat(state.indentLevel++); const { lineEnd, writeComments } = state; - const statementIndent = indent + state.indent; + const statementIndent = indent2 + state.indent; state.write("{"); - const statements = node.body; + const statements = node2.body; if (statements != null && statements.length > 0) { state.write(lineEnd); - if (writeComments && node.comments != null) { - formatComments(state, node.comments, statementIndent, lineEnd); + if (writeComments && node2.comments != null) { + formatComments(state, node2.comments, statementIndent, lineEnd); } const { length } = statements; for (let i = 0; i < length; i++) { @@ -22893,86 +25688,86 @@ var GENERATOR = { this[statement.type](statement, state); state.write(lineEnd); } - state.write(indent); + state.write(indent2); } else { - if (writeComments && node.comments != null) { + if (writeComments && node2.comments != null) { state.write(lineEnd); - formatComments(state, node.comments, statementIndent, lineEnd); - state.write(indent); + formatComments(state, node2.comments, statementIndent, lineEnd); + state.write(indent2); } } - if (writeComments && node.trailingComments != null) { - formatComments(state, node.trailingComments, statementIndent, lineEnd); + if (writeComments && node2.trailingComments != null) { + formatComments(state, node2.trailingComments, statementIndent, lineEnd); } state.write("}"); state.indentLevel--; }, ClassBody: BlockStatement, - StaticBlock(node, state) { + StaticBlock(node2, state) { state.write("static "); - this.BlockStatement(node, state); + this.BlockStatement(node2, state); }, - EmptyStatement(node, state) { + EmptyStatement(node2, state) { state.write(";"); }, - ExpressionStatement(node, state) { - const precedence = state.expressionsPrecedence[node.expression.type]; - if (precedence === NEEDS_PARENTHESES || precedence === 3 && node.expression.left.type[0] === "O") { + ExpressionStatement(node2, state) { + const precedence = state.expressionsPrecedence[node2.expression.type]; + if (precedence === NEEDS_PARENTHESES || precedence === 3 && node2.expression.left.type[0] === "O") { state.write("("); - this[node.expression.type](node.expression, state); + this[node2.expression.type](node2.expression, state); state.write(")"); } else { - this[node.expression.type](node.expression, state); + this[node2.expression.type](node2.expression, state); } state.write(";"); }, - IfStatement(node, state) { + IfStatement(node2, state) { state.write("if ("); - this[node.test.type](node.test, state); + this[node2.test.type](node2.test, state); state.write(") "); - this[node.consequent.type](node.consequent, state); - if (node.alternate != null) { + this[node2.consequent.type](node2.consequent, state); + if (node2.alternate != null) { state.write(" else "); - this[node.alternate.type](node.alternate, state); + this[node2.alternate.type](node2.alternate, state); } }, - LabeledStatement(node, state) { - this[node.label.type](node.label, state); + LabeledStatement(node2, state) { + this[node2.label.type](node2.label, state); state.write(": "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, - BreakStatement(node, state) { + BreakStatement(node2, state) { state.write("break"); - if (node.label != null) { + if (node2.label != null) { state.write(" "); - this[node.label.type](node.label, state); + this[node2.label.type](node2.label, state); } state.write(";"); }, - ContinueStatement(node, state) { + ContinueStatement(node2, state) { state.write("continue"); - if (node.label != null) { + if (node2.label != null) { state.write(" "); - this[node.label.type](node.label, state); + this[node2.label.type](node2.label, state); } state.write(";"); }, - WithStatement(node, state) { + WithStatement(node2, state) { state.write("with ("); - this[node.object.type](node.object, state); + this[node2.object.type](node2.object, state); state.write(") "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, - SwitchStatement(node, state) { - const indent = state.indent.repeat(state.indentLevel++); + SwitchStatement(node2, state) { + const indent2 = state.indent.repeat(state.indentLevel++); const { lineEnd, writeComments } = state; state.indentLevel++; - const caseIndent = indent + state.indent; + const caseIndent = indent2 + state.indent; const statementIndent = caseIndent + state.indent; state.write("switch ("); - this[node.discriminant.type](node.discriminant, state); + this[node2.discriminant.type](node2.discriminant, state); state.write(") {" + lineEnd); - const { cases: occurences } = node; + const { cases: occurences } = node2; const { length: occurencesCount } = occurences; for (let i = 0; i < occurencesCount; i++) { const occurence = occurences[i]; @@ -22999,26 +25794,26 @@ var GENERATOR = { } } state.indentLevel -= 2; - state.write(indent + "}"); + state.write(indent2 + "}"); }, - ReturnStatement(node, state) { + ReturnStatement(node2, state) { state.write("return"); - if (node.argument) { + if (node2.argument) { state.write(" "); - this[node.argument.type](node.argument, state); + this[node2.argument.type](node2.argument, state); } state.write(";"); }, - ThrowStatement(node, state) { + ThrowStatement(node2, state) { state.write("throw "); - this[node.argument.type](node.argument, state); + this[node2.argument.type](node2.argument, state); state.write(";"); }, - TryStatement(node, state) { + TryStatement(node2, state) { state.write("try "); - this[node.block.type](node.block, state); - if (node.handler) { - const { handler } = node; + this[node2.block.type](node2.block, state); + if (node2.handler) { + const { handler } = node2; if (handler.param == null) { state.write(" catch "); } else { @@ -23028,28 +25823,28 @@ var GENERATOR = { } this[handler.body.type](handler.body, state); } - if (node.finalizer) { + if (node2.finalizer) { state.write(" finally "); - this[node.finalizer.type](node.finalizer, state); + this[node2.finalizer.type](node2.finalizer, state); } }, - WhileStatement(node, state) { + WhileStatement(node2, state) { state.write("while ("); - this[node.test.type](node.test, state); + this[node2.test.type](node2.test, state); state.write(") "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, - DoWhileStatement(node, state) { + DoWhileStatement(node2, state) { state.write("do "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); state.write(" while ("); - this[node.test.type](node.test, state); + this[node2.test.type](node2.test, state); state.write(");"); }, - ForStatement(node, state) { + ForStatement(node2, state) { state.write("for ("); - if (node.init != null) { - const { init } = node; + if (node2.init != null) { + const { init } = node2; if (init.type[0] === "V") { formatVariableDeclaration(state, init); } else { @@ -23057,75 +25852,75 @@ var GENERATOR = { } } state.write("; "); - if (node.test) { - this[node.test.type](node.test, state); + if (node2.test) { + this[node2.test.type](node2.test, state); } state.write("; "); - if (node.update) { - this[node.update.type](node.update, state); + if (node2.update) { + this[node2.update.type](node2.update, state); } state.write(") "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, - ForInStatement: ForInStatement = function(node, state) { - state.write(`for ${node.await ? "await " : ""}(`); - const { left } = node; + ForInStatement: ForInStatement = function(node2, state) { + state.write(`for ${node2.await ? "await " : ""}(`); + const { left } = node2; if (left.type[0] === "V") { formatVariableDeclaration(state, left); } else { this[left.type](left, state); } - state.write(node.type[3] === "I" ? " in " : " of "); - this[node.right.type](node.right, state); + state.write(node2.type[3] === "I" ? " in " : " of "); + this[node2.right.type](node2.right, state); state.write(") "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, ForOfStatement: ForInStatement, - DebuggerStatement(node, state) { - state.write("debugger;", node); + DebuggerStatement(node2, state) { + state.write("debugger;", node2); }, - FunctionDeclaration: FunctionDeclaration = function(node, state) { + FunctionDeclaration: FunctionDeclaration = function(node2, state) { state.write( - (node.async ? "async " : "") + (node.generator ? "function* " : "function ") + (node.id ? node.id.name : ""), - node + (node2.async ? "async " : "") + (node2.generator ? "function* " : "function ") + (node2.id ? node2.id.name : ""), + node2 ); - formatSequence(state, node.params); + formatSequence(state, node2.params); state.write(" "); - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); }, FunctionExpression: FunctionDeclaration, - VariableDeclaration(node, state) { - formatVariableDeclaration(state, node); + VariableDeclaration(node2, state) { + formatVariableDeclaration(state, node2); state.write(";"); }, - VariableDeclarator(node, state) { - this[node.id.type](node.id, state); - if (node.init != null) { + VariableDeclarator(node2, state) { + this[node2.id.type](node2.id, state); + if (node2.init != null) { state.write(" = "); - this[node.init.type](node.init, state); + this[node2.init.type](node2.init, state); } }, - ClassDeclaration(node, state) { - state.write("class " + (node.id ? `${node.id.name} ` : ""), node); - if (node.superClass) { + ClassDeclaration(node2, state) { + state.write("class " + (node2.id ? `${node2.id.name} ` : ""), node2); + if (node2.superClass) { state.write("extends "); - const { superClass } = node; + const { superClass } = node2; const { type } = superClass; const precedence = state.expressionsPrecedence[type]; if ((type[0] !== "C" || type[1] !== "l" || type[5] !== "E") && (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.ClassExpression)) { state.write("("); - this[node.superClass.type](superClass, state); + this[node2.superClass.type](superClass, state); state.write(")"); } else { this[superClass.type](superClass, state); } state.write(" "); } - this.ClassBody(node.body, state); + this.ClassBody(node2.body, state); }, - ImportDeclaration(node, state) { + ImportDeclaration(node2, state) { state.write("import "); - const { specifiers } = node; + const { specifiers } = node2; const { length } = specifiers; let i = 0; if (length > 0) { @@ -23164,28 +25959,28 @@ var GENERATOR = { } state.write(" from "); } - this.Literal(node.source, state); + this.Literal(node2.source, state); state.write(";"); }, - ImportExpression(node, state) { + ImportExpression(node2, state) { state.write("import("); - this[node.source.type](node.source, state); + this[node2.source.type](node2.source, state); state.write(")"); }, - ExportDefaultDeclaration(node, state) { + ExportDefaultDeclaration(node2, state) { state.write("export default "); - this[node.declaration.type](node.declaration, state); - if (state.expressionsPrecedence[node.declaration.type] != null && node.declaration.type[0] !== "F") { + this[node2.declaration.type](node2.declaration, state); + if (state.expressionsPrecedence[node2.declaration.type] != null && node2.declaration.type[0] !== "F") { state.write(";"); } }, - ExportNamedDeclaration(node, state) { + ExportNamedDeclaration(node2, state) { state.write("export "); - if (node.declaration) { - this[node.declaration.type](node.declaration, state); + if (node2.declaration) { + this[node2.declaration.type](node2.declaration, state); } else { state.write("{"); - const { specifiers } = node, { length } = specifiers; + const { specifiers } = node2, { length } = specifiers; if (length > 0) { for (let i = 0; ; ) { const specifier = specifiers[i]; @@ -23202,93 +25997,93 @@ var GENERATOR = { } } state.write("}"); - if (node.source) { + if (node2.source) { state.write(" from "); - this.Literal(node.source, state); + this.Literal(node2.source, state); } state.write(";"); } }, - ExportAllDeclaration(node, state) { - if (node.exported != null) { - state.write("export * as " + node.exported.name + " from "); + ExportAllDeclaration(node2, state) { + if (node2.exported != null) { + state.write("export * as " + node2.exported.name + " from "); } else { state.write("export * from "); } - this.Literal(node.source, state); + this.Literal(node2.source, state); state.write(";"); }, - MethodDefinition(node, state) { - if (node.static) { + MethodDefinition(node2, state) { + if (node2.static) { state.write("static "); } - const kind = node.kind[0]; + const kind = node2.kind[0]; if (kind === "g" || kind === "s") { - state.write(node.kind + " "); + state.write(node2.kind + " "); } - if (node.value.async) { + if (node2.value.async) { state.write("async "); } - if (node.value.generator) { + if (node2.value.generator) { state.write("*"); } - if (node.computed) { + if (node2.computed) { state.write("["); - this[node.key.type](node.key, state); + this[node2.key.type](node2.key, state); state.write("]"); } else { - this[node.key.type](node.key, state); + this[node2.key.type](node2.key, state); } - formatSequence(state, node.value.params); + formatSequence(state, node2.value.params); state.write(" "); - this[node.value.body.type](node.value.body, state); + this[node2.value.body.type](node2.value.body, state); }, - ClassExpression(node, state) { - this.ClassDeclaration(node, state); + ClassExpression(node2, state) { + this.ClassDeclaration(node2, state); }, - ArrowFunctionExpression(node, state) { - state.write(node.async ? "async " : "", node); - const { params } = node; + ArrowFunctionExpression(node2, state) { + state.write(node2.async ? "async " : "", node2); + const { params } = node2; if (params != null) { if (params.length === 1 && params[0].type[0] === "I") { state.write(params[0].name, params[0]); } else { - formatSequence(state, node.params); + formatSequence(state, node2.params); } } state.write(" => "); - if (node.body.type[0] === "O") { + if (node2.body.type[0] === "O") { state.write("("); - this.ObjectExpression(node.body, state); + this.ObjectExpression(node2.body, state); state.write(")"); } else { - this[node.body.type](node.body, state); + this[node2.body.type](node2.body, state); } }, - ThisExpression(node, state) { - state.write("this", node); + ThisExpression(node2, state) { + state.write("this", node2); }, - Super(node, state) { - state.write("super", node); + Super(node2, state) { + state.write("super", node2); }, - RestElement: RestElement = function(node, state) { + RestElement: RestElement = function(node2, state) { state.write("..."); - this[node.argument.type](node.argument, state); + this[node2.argument.type](node2.argument, state); }, SpreadElement: RestElement, - YieldExpression(node, state) { - state.write(node.delegate ? "yield*" : "yield"); - if (node.argument) { + YieldExpression(node2, state) { + state.write(node2.delegate ? "yield*" : "yield"); + if (node2.argument) { state.write(" "); - this[node.argument.type](node.argument, state); + this[node2.argument.type](node2.argument, state); } }, - AwaitExpression(node, state) { - state.write("await ", node); - formatExpression(state, node.argument, node); + AwaitExpression(node2, state) { + state.write("await ", node2); + formatExpression(state, node2.argument, node2); }, - TemplateLiteral(node, state) { - const { quasis, expressions } = node; + TemplateLiteral(node2, state) { + const { quasis, expressions } = node2; state.write("`"); const { length } = expressions; for (let i = 0; i < length; i++) { @@ -23303,17 +26098,17 @@ var GENERATOR = { state.write(quasi.value.raw, quasi); state.write("`"); }, - TemplateElement(node, state) { - state.write(node.value.raw, node); + TemplateElement(node2, state) { + state.write(node2.value.raw, node2); }, - TaggedTemplateExpression(node, state) { - formatExpression(state, node.tag, node); - this[node.quasi.type](node.quasi, state); + TaggedTemplateExpression(node2, state) { + formatExpression(state, node2.tag, node2); + this[node2.quasi.type](node2.quasi, state); }, - ArrayExpression: ArrayExpression = function(node, state) { + ArrayExpression: ArrayExpression = function(node2, state) { state.write("["); - if (node.elements.length > 0) { - const { elements } = node, { length } = elements; + if (node2.elements.length > 0) { + const { elements } = node2, { length } = elements; for (let i = 0; ; ) { const element2 = elements[i]; if (element2 != null) { @@ -23332,18 +26127,18 @@ var GENERATOR = { state.write("]"); }, ArrayPattern: ArrayExpression, - ObjectExpression(node, state) { - const indent = state.indent.repeat(state.indentLevel++); + ObjectExpression(node2, state) { + const indent2 = state.indent.repeat(state.indentLevel++); const { lineEnd, writeComments } = state; - const propertyIndent = indent + state.indent; + const propertyIndent = indent2 + state.indent; state.write("{"); - if (node.properties.length > 0) { + if (node2.properties.length > 0) { state.write(lineEnd); - if (writeComments && node.comments != null) { - formatComments(state, node.comments, propertyIndent, lineEnd); + if (writeComments && node2.comments != null) { + formatComments(state, node2.comments, propertyIndent, lineEnd); } const comma = "," + lineEnd; - const { properties } = node, { length } = properties; + const { properties } = node2, { length } = properties; for (let i = 0; ; ) { const property = properties[i]; if (writeComments && property.comments != null) { @@ -23358,22 +26153,22 @@ var GENERATOR = { } } state.write(lineEnd); - if (writeComments && node.trailingComments != null) { - formatComments(state, node.trailingComments, propertyIndent, lineEnd); + if (writeComments && node2.trailingComments != null) { + formatComments(state, node2.trailingComments, propertyIndent, lineEnd); } - state.write(indent + "}"); + state.write(indent2 + "}"); } else if (writeComments) { - if (node.comments != null) { + if (node2.comments != null) { state.write(lineEnd); - formatComments(state, node.comments, propertyIndent, lineEnd); - if (node.trailingComments != null) { - formatComments(state, node.trailingComments, propertyIndent, lineEnd); + formatComments(state, node2.comments, propertyIndent, lineEnd); + if (node2.trailingComments != null) { + formatComments(state, node2.trailingComments, propertyIndent, lineEnd); } - state.write(indent + "}"); - } else if (node.trailingComments != null) { + state.write(indent2 + "}"); + } else if (node2.trailingComments != null) { state.write(lineEnd); - formatComments(state, node.trailingComments, propertyIndent, lineEnd); - state.write(indent + "}"); + formatComments(state, node2.trailingComments, propertyIndent, lineEnd); + state.write(indent2 + "}"); } else { state.write("}"); } @@ -23382,38 +26177,48 @@ var GENERATOR = { } state.indentLevel--; }, - Property(node, state) { - if (node.method || node.kind[0] !== "i") { - this.MethodDefinition(node, state); + Property(node2, state) { + if (node2.method || node2.kind[0] !== "i") { + this.MethodDefinition(node2, state); } else { - if (!node.shorthand) { - if (node.computed) { + if (!node2.shorthand) { + if (node2.computed) { state.write("["); - this[node.key.type](node.key, state); + this[node2.key.type](node2.key, state); state.write("]"); } else { - this[node.key.type](node.key, state); + this[node2.key.type](node2.key, state); } state.write(": "); } - this[node.value.type](node.value, state); + this[node2.value.type](node2.value, state); } }, - PropertyDefinition(node, state) { - if (node.static) { + PropertyDefinition(node2, state) { + if (node2.static) { state.write("static "); } - this[node.key.type](node.key, state); - if (node.value == null) { + if (node2.computed) { + state.write("["); + } + this[node2.key.type](node2.key, state); + if (node2.computed) { + state.write("]"); + } + if (node2.value == null) { + if (node2.key.type[0] !== "F") { + state.write(";"); + } return; } state.write(" = "); - this[node.value.type](node.value, state); + this[node2.value.type](node2.value, state); + state.write(";"); }, - ObjectPattern(node, state) { + ObjectPattern(node2, state) { state.write("{"); - if (node.properties.length > 0) { - const { properties } = node, { length } = properties; + if (node2.properties.length > 0) { + const { properties } = node2, { length } = properties; for (let i = 0; ; ) { this[properties[i].type](properties[i], state); if (++i < length) { @@ -23425,18 +26230,18 @@ var GENERATOR = { } state.write("}"); }, - SequenceExpression(node, state) { - formatSequence(state, node.expressions); + SequenceExpression(node2, state) { + formatSequence(state, node2.expressions); }, - UnaryExpression(node, state) { - if (node.prefix) { + UnaryExpression(node2, state) { + if (node2.prefix) { const { operator, argument, argument: { type } - } = node; + } = node2; state.write(operator); - const needsParentheses = expressionNeedsParenthesis(state, argument, node); + const needsParentheses = expressionNeedsParenthesis(state, argument, node2); if (!needsParentheses && (operator.length > 1 || type[0] === "U" && (type[1] === "n" || type[1] === "p") && argument.prefix && argument.operator[0] === operator && (operator === "+" || operator === "-"))) { state.write(" "); } @@ -23448,44 +26253,44 @@ var GENERATOR = { this[type](argument, state); } } else { - this[node.argument.type](node.argument, state); - state.write(node.operator); + this[node2.argument.type](node2.argument, state); + state.write(node2.operator); } }, - UpdateExpression(node, state) { - if (node.prefix) { - state.write(node.operator); - this[node.argument.type](node.argument, state); + UpdateExpression(node2, state) { + if (node2.prefix) { + state.write(node2.operator); + this[node2.argument.type](node2.argument, state); } else { - this[node.argument.type](node.argument, state); - state.write(node.operator); + this[node2.argument.type](node2.argument, state); + state.write(node2.operator); } }, - AssignmentExpression(node, state) { - this[node.left.type](node.left, state); - state.write(" " + node.operator + " "); - this[node.right.type](node.right, state); + AssignmentExpression(node2, state) { + this[node2.left.type](node2.left, state); + state.write(" " + node2.operator + " "); + this[node2.right.type](node2.right, state); }, - AssignmentPattern(node, state) { - this[node.left.type](node.left, state); + AssignmentPattern(node2, state) { + this[node2.left.type](node2.left, state); state.write(" = "); - this[node.right.type](node.right, state); + this[node2.right.type](node2.right, state); }, - BinaryExpression: BinaryExpression = function(node, state) { - const isIn = node.operator === "in"; + BinaryExpression: BinaryExpression = function(node2, state) { + const isIn = node2.operator === "in"; if (isIn) { state.write("("); } - formatExpression(state, node.left, node, false); - state.write(" " + node.operator + " "); - formatExpression(state, node.right, node, true); + formatExpression(state, node2.left, node2, false); + state.write(" " + node2.operator + " "); + formatExpression(state, node2.right, node2, true); if (isIn) { state.write(")"); } }, LogicalExpression: BinaryExpression, - ConditionalExpression(node, state) { - const { test } = node; + ConditionalExpression(node2, state) { + const { test } = node2; const precedence = state.expressionsPrecedence[test.type]; if (precedence === NEEDS_PARENTHESES || precedence <= state.expressionsPrecedence.ConditionalExpression) { state.write("("); @@ -23495,87 +26300,87 @@ var GENERATOR = { this[test.type](test, state); } state.write(" ? "); - this[node.consequent.type](node.consequent, state); + this[node2.consequent.type](node2.consequent, state); state.write(" : "); - this[node.alternate.type](node.alternate, state); + this[node2.alternate.type](node2.alternate, state); }, - NewExpression(node, state) { + NewExpression(node2, state) { state.write("new "); - const precedence = state.expressionsPrecedence[node.callee.type]; - if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression || hasCallExpression(node.callee)) { + const precedence = state.expressionsPrecedence[node2.callee.type]; + if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression || hasCallExpression(node2.callee)) { state.write("("); - this[node.callee.type](node.callee, state); + this[node2.callee.type](node2.callee, state); state.write(")"); } else { - this[node.callee.type](node.callee, state); + this[node2.callee.type](node2.callee, state); } - formatSequence(state, node["arguments"]); + formatSequence(state, node2["arguments"]); }, - CallExpression(node, state) { - const precedence = state.expressionsPrecedence[node.callee.type]; + CallExpression(node2, state) { + const precedence = state.expressionsPrecedence[node2.callee.type]; if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.CallExpression) { state.write("("); - this[node.callee.type](node.callee, state); + this[node2.callee.type](node2.callee, state); state.write(")"); } else { - this[node.callee.type](node.callee, state); + this[node2.callee.type](node2.callee, state); } - if (node.optional) { + if (node2.optional) { state.write("?."); } - formatSequence(state, node["arguments"]); + formatSequence(state, node2["arguments"]); }, - ChainExpression(node, state) { - this[node.expression.type](node.expression, state); + ChainExpression(node2, state) { + this[node2.expression.type](node2.expression, state); }, - MemberExpression(node, state) { - const precedence = state.expressionsPrecedence[node.object.type]; + MemberExpression(node2, state) { + const precedence = state.expressionsPrecedence[node2.object.type]; if (precedence === NEEDS_PARENTHESES || precedence < state.expressionsPrecedence.MemberExpression) { state.write("("); - this[node.object.type](node.object, state); + this[node2.object.type](node2.object, state); state.write(")"); } else { - this[node.object.type](node.object, state); + this[node2.object.type](node2.object, state); } - if (node.computed) { - if (node.optional) { + if (node2.computed) { + if (node2.optional) { state.write("?."); } state.write("["); - this[node.property.type](node.property, state); + this[node2.property.type](node2.property, state); state.write("]"); } else { - if (node.optional) { + if (node2.optional) { state.write("?."); } else { state.write("."); } - this[node.property.type](node.property, state); + this[node2.property.type](node2.property, state); } }, - MetaProperty(node, state) { - state.write(node.meta.name + "." + node.property.name, node); + MetaProperty(node2, state) { + state.write(node2.meta.name + "." + node2.property.name, node2); }, - Identifier(node, state) { - state.write(node.name, node); + Identifier(node2, state) { + state.write(node2.name, node2); }, - PrivateIdentifier(node, state) { - state.write(`#${node.name}`, node); + PrivateIdentifier(node2, state) { + state.write(`#${node2.name}`, node2); }, - Literal(node, state) { - if (node.raw != null) { - state.write(node.raw, node); - } else if (node.regex != null) { - this.RegExpLiteral(node, state); - } else if (node.bigint != null) { - state.write(node.bigint + "n", node); + Literal(node2, state) { + if (node2.raw != null) { + state.write(node2.raw, node2); + } else if (node2.regex != null) { + this.RegExpLiteral(node2, state); + } else if (node2.bigint != null) { + state.write(node2.bigint + "n", node2); } else { - state.write(stringify(node.value), node); + state.write(stringify(node2.value), node2); } }, - RegExpLiteral(node, state) { - const { regex: regex2 } = node; - state.write(`/${regex2.pattern}/${regex2.flags}`, node); + RegExpLiteral(node2, state) { + const { regex: regex2 } = node2; + state.write(`/${regex2.pattern}/${regex2.flags}`, node2); } }; var EMPTY_OBJECT = {}; @@ -23603,6 +26408,7 @@ var State = class { this.lineEndSize = this.lineEnd.split("\n").length - 1; this.mapping = { original: null, + // Uses the entire state to avoid generating ephemeral objects generated: this, name: void 0, source: setup.sourceMap.file || setup.sourceMap._file @@ -23615,29 +26421,29 @@ var State = class { writeToStream(code2) { this.output.write(code2); } - writeAndMap(code2, node) { + writeAndMap(code2, node2) { this.output += code2; - this.map(code2, node); + this.map(code2, node2); } - writeToStreamAndMap(code2, node) { + writeToStreamAndMap(code2, node2) { this.output.write(code2); - this.map(code2, node); + this.map(code2, node2); } - map(code2, node) { - if (node != null) { - const { type } = node; + map(code2, node2) { + if (node2 != null) { + const { type } = node2; if (type[0] === "L" && type[2] === "n") { this.column = 0; this.line++; return; } - if (node.loc != null) { + if (node2.loc != null) { const { mapping } = this; - mapping.original = node.loc.start; - mapping.name = node.name; + mapping.original = node2.loc.start; + mapping.name = node2.name; this.sourceMap.addMapping(mapping); } - if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node.value === "string") { + if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node2.value === "string") { const { length: length2 } = code2; let { column, line } = this; for (let i = 0; i < length2; i++) { @@ -23668,155 +26474,161 @@ var State = class { return this.output; } }; -function generate(node, options) { +function generate(node2, options) { const state = new State(options); - state.generator[node.type](node, state); + state.generator[node2.type](node2, state); return state.output; } // node_modules/estree-util-to-js/lib/index.js -var toJs = function(tree, options = {}) { - const { SourceMapGenerator, filePath, handlers: handlers2 } = options; +var emptyOptions5 = {}; +function toJs(tree, options) { + const { SourceMapGenerator, filePath, handlers: handlers3 } = options || emptyOptions5; const sourceMap = SourceMapGenerator ? new SourceMapGenerator({ file: filePath || ".js" }) : void 0; - const value = generate(tree, { - comments: true, - generator: { ...GENERATOR, ...handlers2 }, - sourceMap - }); + const value = generate( + tree, + // @ts-expect-error: `sourceMap` can be undefined, `astring` types are buggy. + { + comments: true, + generator: { ...GENERATOR, ...handlers3 }, + sourceMap: sourceMap || void 0 + } + ); const map = sourceMap ? sourceMap.toJSON() : void 0; return { value, map }; -}; +} // node_modules/estree-util-to-js/lib/jsx.js var jsx = { - JSXAttribute, - JSXClosingElement, - JSXClosingFragment, - JSXElement, - JSXEmptyExpression, - JSXExpressionContainer, - JSXFragment, - JSXIdentifier, - JSXMemberExpression, - JSXNamespacedName, - JSXOpeningElement, - JSXOpeningFragment, - JSXSpreadAttribute, - JSXText -}; -function JSXAttribute(node, state) { - this[node.name.type](node.name, state); - if (node.value !== void 0 && node.value !== null) { + JSXAttribute: jsxAttribute, + JSXClosingElement: jsxClosingElement, + JSXClosingFragment: jsxClosingFragment, + JSXElement: jsxElement, + JSXEmptyExpression: jsxEmptyExpression, + JSXExpressionContainer: jsxExpressionContainer, + JSXFragment: jsxFragment, + JSXIdentifier: jsxIdentifier, + JSXMemberExpression: jsxMemberExpression, + JSXNamespacedName: jsxNamespacedName, + JSXOpeningElement: jsxOpeningElement, + JSXOpeningFragment: jsxOpeningFragment, + JSXSpreadAttribute: jsxSpreadAttribute, + JSXText: jsxText2 +}; +function jsxAttribute(node2, state) { + this[node2.name.type](node2.name, state); + if (node2.value !== null && node2.value !== void 0) { state.write("="); - if (node.value.type === "Literal") { + if (node2.value.type === "Literal") { state.write( - '"' + encodeJsx(String(node.value.value)).replace(/"/g, """) + '"', - node + '"' + encodeJsx(String(node2.value.value)).replace(/"/g, """) + '"', + node2 ); } else { - this[node.value.type](node.value, state); + this[node2.value.type](node2.value, state); } } } -function JSXClosingElement(node, state) { +function jsxClosingElement(node2, state) { state.write(""); } -function JSXClosingFragment(node, state) { - state.write("", node); +function jsxClosingFragment(node2, state) { + state.write("", node2); } -function JSXElement(node, state) { +function jsxElement(node2, state) { let index2 = -1; - this[node.openingElement.type](node.openingElement, state); - if (node.children) { - while (++index2 < node.children.length) { - const child = node.children[index2]; + this[node2.openingElement.type](node2.openingElement, state); + if (node2.children) { + while (++index2 < node2.children.length) { + const child = node2.children[index2]; if (child.type === "JSXSpreadChild") { throw new Error("JSX spread children are not supported"); } this[child.type](child, state); } } - if (node.closingElement) { - this[node.closingElement.type](node.closingElement, state); + if (node2.closingElement) { + this[node2.closingElement.type](node2.closingElement, state); } } -function JSXEmptyExpression() { +function jsxEmptyExpression() { } -function JSXExpressionContainer(node, state) { +function jsxExpressionContainer(node2, state) { state.write("{"); - this[node.expression.type](node.expression, state); + this[node2.expression.type](node2.expression, state); state.write("}"); } -function JSXFragment(node, state) { +function jsxFragment(node2, state) { let index2 = -1; - this[node.openingFragment.type](node.openingFragment, state); - if (node.children) { - while (++index2 < node.children.length) { - const child = node.children[index2]; + this[node2.openingFragment.type](node2.openingFragment, state); + if (node2.children) { + while (++index2 < node2.children.length) { + const child = node2.children[index2]; if (child.type === "JSXSpreadChild") { throw new Error("JSX spread children are not supported"); } this[child.type](child, state); } } - this[node.closingFragment.type](node.closingFragment, state); + this[node2.closingFragment.type](node2.closingFragment, state); } -function JSXIdentifier(node, state) { - state.write(node.name, node); +function jsxIdentifier(node2, state) { + state.write(node2.name, node2); } -function JSXMemberExpression(node, state) { - this[node.object.type](node.object, state); +function jsxMemberExpression(node2, state) { + this[node2.object.type](node2.object, state); state.write("."); - this[node.property.type](node.property, state); + this[node2.property.type](node2.property, state); } -function JSXNamespacedName(node, state) { - this[node.namespace.type](node.namespace, state); +function jsxNamespacedName(node2, state) { + this[node2.namespace.type](node2.namespace, state); state.write(":"); - this[node.name.type](node.name, state); + this[node2.name.type](node2.name, state); } -function JSXOpeningElement(node, state) { +function jsxOpeningElement(node2, state) { let index2 = -1; state.write("<"); - this[node.name.type](node.name, state); - if (node.attributes) { - while (++index2 < node.attributes.length) { + this[node2.name.type](node2.name, state); + if (node2.attributes) { + while (++index2 < node2.attributes.length) { state.write(" "); - this[node.attributes[index2].type](node.attributes[index2], state); + this[node2.attributes[index2].type](node2.attributes[index2], state); } } - state.write(node.selfClosing ? " />" : ">"); + state.write(node2.selfClosing ? " />" : ">"); } -function JSXOpeningFragment(node, state) { - state.write("<>", node); +function jsxOpeningFragment(node2, state) { + state.write("<>", node2); } -function JSXSpreadAttribute(node, state) { +function jsxSpreadAttribute(node2, state) { state.write("{"); - this.SpreadElement(node, state); + this.SpreadElement(node2, state); state.write("}"); } -function JSXText(node, state) { - state.write( - encodeJsx(node.value).replace( - /[<>{}]/g, - ($0) => $0 === "<" ? "<" : $0 === ">" ? ">" : $0 === "{" ? "{" : "}" - ), - node - ); +function jsxText2(node2, state) { + state.write(encodeJsx(node2.value).replace(/[<>{}]/g, replaceJsxChar), node2); } function encodeJsx(value) { return value.replace(/&(?=[#a-z])/gi, "&"); } +function replaceJsxChar($0) { + return $0 === "<" ? "<" : $0 === ">" ? ">" : $0 === "{" ? "{" : "}"; +} // node_modules/@mdx-js/mdx/lib/plugin/recma-stringify.js -function recmaStringify(options = {}) { +function recmaStringify(options) { + const self2 = ( + /** @type {Processor} */ + this + ); const { SourceMapGenerator } = options; - Object.assign(this, { Compiler: compiler2 }); + self2.compiler = compiler2; function compiler2(tree, file) { const result = SourceMapGenerator ? toJs(tree, { - filePath: file.path || "unknown.mdx", SourceMapGenerator, + filePath: file.path || "unknown.mdx", handlers: jsx }) : toJs(tree, { handlers: jsx }); file.map = result.map; @@ -23824,94 +26636,39 @@ function recmaStringify(options = {}) { } } -// node_modules/hast-util-to-estree/node_modules/comma-separated-tokens/index.js +// node_modules/hast-util-to-estree/lib/handlers/comment.js +function comment(node2, state) { + const result = { type: "Block", value: node2.value }; + state.inherit(node2, result); + state.comments.push(result); + const expression = { + type: "JSXEmptyExpression", + // @ts-expect-error: `comments` is custom. + comments: [Object.assign({}, result, { leading: false, trailing: true })] + }; + state.patch(node2, expression); + const container = { type: "JSXExpressionContainer", expression }; + state.patch(node2, container); + return container; +} + +// node_modules/comma-separated-tokens/index.js function stringify2(values, options) { - var settings = options || {}; - if (values[values.length - 1] === "") { - values = values.concat(""); - } - return values.join( + const settings = options || {}; + const input = values[values.length - 1] === "" ? [...values, ""] : values; + return input.join( (settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ") ).trim(); } -// node_modules/estree-util-attach-comments/index.js -var own9 = {}.hasOwnProperty; -function attachComments(tree, comments) { - const list3 = (comments || []).concat().sort(compare); - if (list3.length > 0) - walk2(tree, { comments: list3, index: 0 }); - return tree; -} -function walk2(node, state) { - if (state.index === state.comments.length) { - return; - } - const children = []; - const comments = []; - let key; - for (key in node) { - if (own9.call(node, key)) { - const value = node[key]; - if (value && typeof value === "object" && key !== "comments") { - if (Array.isArray(value)) { - let index3 = -1; - while (++index3 < value.length) { - if (value[index3] && typeof value[index3].type === "string") { - children.push(value[index3]); - } - } - } else if (typeof value.type === "string") { - children.push(value); - } - } - } - } - children.sort(compare); - comments.push(...slice(state, node, false, { leading: true, trailing: false })); - let index2 = -1; - while (++index2 < children.length) { - walk2(children[index2], state); - } - comments.push( - ...slice(state, node, true, { - leading: false, - trailing: children.length > 0 - }) - ); - if (comments.length > 0) { - node.comments = comments; - } -} -function slice(state, node, compareEnd, fields) { - const result = []; - while (state.comments[state.index] && compare(state.comments[state.index], node, compareEnd) < 1) { - result.push(Object.assign({}, state.comments[state.index++], fields)); - } - return result; -} -function compare(left, right, compareEnd) { - const field = compareEnd ? "end" : "start"; - if (left.range && right.range) { - return left.range[0] - right.range[compareEnd ? 1 : 0]; - } - if (left.loc && left.loc.start && right.loc && right.loc[field]) { - return left.loc.start.line - right.loc[field].line || left.loc.start.column - right.loc[field].column; - } - if ("start" in left && field in right) { - return left.start - right[field]; - } - return Number.NaN; -} - -// node_modules/hast-util-to-estree/node_modules/hast-util-whitespace/index.js -function whitespace(thing) { - var value = thing && typeof thing === "object" && thing.type === "text" ? thing.value || "" : thing; - return typeof value === "string" && value.replace(/[ \t\n\f\r]/g, "") === ""; -} - -// node_modules/hast-util-to-estree/node_modules/property-information/lib/util/schema.js +// node_modules/property-information/lib/util/schema.js var Schema = class { + /** + * @constructor + * @param {Properties} property + * @param {Normal} normal + * @param {string} [space] + */ constructor(property, normal, space2) { this.property = property; this.normal = normal; @@ -23924,25 +26681,30 @@ Schema.prototype.property = {}; Schema.prototype.normal = {}; Schema.prototype.space = null; -// node_modules/hast-util-to-estree/node_modules/property-information/lib/util/merge.js -function merge(definitions2, space2) { +// node_modules/property-information/lib/util/merge.js +function merge(definitions, space2) { const property = {}; const normal = {}; let index2 = -1; - while (++index2 < definitions2.length) { - Object.assign(property, definitions2[index2].property); - Object.assign(normal, definitions2[index2].normal); + while (++index2 < definitions.length) { + Object.assign(property, definitions[index2].property); + Object.assign(normal, definitions[index2].normal); } return new Schema(property, normal, space2); } -// node_modules/hast-util-to-estree/node_modules/property-information/lib/normalize.js +// node_modules/property-information/lib/normalize.js function normalize(value) { return value.toLowerCase(); } -// node_modules/hast-util-to-estree/node_modules/property-information/lib/util/info.js +// node_modules/property-information/lib/util/info.js var Info = class { + /** + * @constructor + * @param {string} property + * @param {string} attribute + */ constructor(property, attribute) { this.property = property; this.attribute = attribute; @@ -23959,7 +26721,7 @@ Info.prototype.commaOrSpaceSeparated = false; Info.prototype.mustUseProperty = false; Info.prototype.defined = false; -// node_modules/hast-util-to-estree/node_modules/property-information/lib/util/types.js +// node_modules/property-information/lib/util/types.js var types_exports = {}; __export(types_exports, { boolean: () => boolean, @@ -23982,9 +26744,16 @@ function increment() { return 2 ** ++powers; } -// node_modules/hast-util-to-estree/node_modules/property-information/lib/util/defined-info.js +// node_modules/property-information/lib/util/defined-info.js var checks = Object.keys(types_exports); var DefinedInfo = class extends Info { + /** + * @constructor + * @param {string} property + * @param {string} attribute + * @param {number|null} [mask] + * @param {string} [space] + */ constructor(property, attribute, mask, space2) { let index2 = -1; super(property, attribute); @@ -24004,14 +26773,14 @@ function mark(values, key, value) { } } -// node_modules/hast-util-to-estree/node_modules/property-information/lib/util/create.js -var own10 = {}.hasOwnProperty; +// node_modules/property-information/lib/util/create.js +var own6 = {}.hasOwnProperty; function create3(definition2) { const property = {}; const normal = {}; let prop; for (prop in definition2.properties) { - if (own10.call(definition2.properties, prop)) { + if (own6.call(definition2.properties, prop)) { const value = definition2.properties[prop]; const info = new DefinedInfo( prop, @@ -24030,7 +26799,7 @@ function create3(definition2) { return new Schema(property, normal, definition2.space); } -// node_modules/hast-util-to-estree/node_modules/property-information/lib/xlink.js +// node_modules/property-information/lib/xlink.js var xlink = create3({ space: "xlink", transform(_, prop) { @@ -24047,7 +26816,7 @@ var xlink = create3({ } }); -// node_modules/hast-util-to-estree/node_modules/property-information/lib/xml.js +// node_modules/property-information/lib/xml.js var xml = create3({ space: "xml", transform(_, prop) { @@ -24056,17 +26825,17 @@ var xml = create3({ properties: { xmlLang: null, xmlBase: null, xmlSpace: null } }); -// node_modules/hast-util-to-estree/node_modules/property-information/lib/util/case-sensitive-transform.js +// node_modules/property-information/lib/util/case-sensitive-transform.js function caseSensitiveTransform(attributes, attribute) { return attribute in attributes ? attributes[attribute] : attribute; } -// node_modules/hast-util-to-estree/node_modules/property-information/lib/util/case-insensitive-transform.js +// node_modules/property-information/lib/util/case-insensitive-transform.js function caseInsensitiveTransform(attributes, property) { return caseSensitiveTransform(attributes, property.toLowerCase()); } -// node_modules/hast-util-to-estree/node_modules/property-information/lib/xmlns.js +// node_modules/property-information/lib/xmlns.js var xmlns = create3({ space: "xmlns", attributes: { xmlnsxlink: "xmlns:xlink" }, @@ -24074,7 +26843,7 @@ var xmlns = create3({ properties: { xmlns: null, xmlnsXLink: null } }); -// node_modules/hast-util-to-estree/node_modules/property-information/lib/aria.js +// node_modules/property-information/lib/aria.js var aria = create3({ transform(_, prop) { return prop === "role" ? prop : "aria-" + prop.slice(4).toLowerCase(); @@ -24132,7 +26901,7 @@ var aria = create3({ } }); -// node_modules/hast-util-to-estree/node_modules/property-information/lib/html.js +// node_modules/property-information/lib/html.js var html2 = create3({ space: "html", attributes: { @@ -24144,6 +26913,7 @@ var html2 = create3({ transform: caseInsensitiveTransform, mustUseProperty: ["checked", "multiple", "muted", "selected"], properties: { + // Standard Properties. abbr: null, accept: commaSeparated, acceptCharset: spaceSeparated, @@ -24160,6 +26930,7 @@ var html2 = create3({ autoComplete: spaceSeparated, autoFocus: boolean, autoPlay: boolean, + blocking: spaceSeparated, capture: boolean, charSet: null, checked: boolean, @@ -24185,6 +26956,7 @@ var html2 = create3({ draggable: booleanish, encType: null, enterKeyHint: null, + fetchPriority: null, form: null, formAction: null, formEncType: null, @@ -24202,6 +26974,7 @@ var html2 = create3({ id: null, imageSizes: null, imageSrcSet: null, + inert: boolean, inputMode: null, integrity: null, is: null, @@ -24235,6 +27008,7 @@ var html2 = create3({ onAbort: null, onAfterPrint: null, onAuxClick: null, + onBeforeMatch: null, onBeforePrint: null, onBeforeUnload: null, onBlur: null, @@ -24301,6 +27075,7 @@ var html2 = create3({ onReset: null, onResize: null, onScroll: null, + onScrollEnd: null, onSecurityPolicyViolation: null, onSeeked: null, onSeeking: null, @@ -24323,6 +27098,9 @@ var html2 = create3({ ping: spaceSeparated, placeholder: null, playsInline: boolean, + popover: null, + popoverTarget: null, + popoverTargetAction: null, poster: null, preload: null, readOnly: boolean, @@ -24360,59 +27138,115 @@ var html2 = create3({ value: booleanish, width: number, wrap: null, + // Legacy. + // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis align: null, + // Several. Use CSS `text-align` instead, aLink: null, + // ``. Use CSS `a:active {color}` instead archive: spaceSeparated, + // ``. List of URIs to archives axis: null, + // `` and ``. Use `scope` on `` background: null, + // ``. Use CSS `background-image` instead bgColor: null, + // `` and table elements. Use CSS `background-color` instead border: number, + // ``. Use CSS `border-width` instead, borderColor: null, + // `
`. Use CSS `border-color` instead, bottomMargin: number, + // `` cellPadding: null, + // `
` cellSpacing: null, + // `
` char: null, + // Several table elements. When `align=char`, sets the character to align on charOff: null, + // Several table elements. When `char`, offsets the alignment classId: null, + // `` clear: null, + // `
`. Use CSS `clear` instead code: null, + // `` codeBase: null, + // `` codeType: null, + // `` color: null, + // `` and `
`. Use CSS instead compact: boolean, + // Lists. Use CSS to reduce space between items instead declare: boolean, + // `` event: null, + // `