@sijanbhattarai/veda-utils 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChartContext.d.ts +13 -0
- package/dist/CreateInterface.d.ts +25 -0
- package/dist/MapContext.d.ts +13 -0
- package/dist/content.d.ts +15 -0
- package/dist/data.d.ts +6 -0
- package/dist/extractImports.d.ts +1 -0
- package/dist/groupElements.d.ts +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1625 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +32 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/inputValidation.d.ts +6 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/parseTwoColumn.d.ts +1 -0
- package/dist/reserializeMDast.d.ts +1 -0
- package/dist/wrapComponent.d.ts +6 -0
- package/package.json +59 -0
- package/src/ChartContext.tsx +29 -0
- package/src/CreateInterface.tsx +300 -0
- package/src/MapContext.tsx +29 -0
- package/src/content.tsx +18 -0
- package/src/data.tsx +36 -0
- package/src/extractImports.tsx +45 -0
- package/src/groupElements.tsx +90 -0
- package/src/index.ts +13 -0
- package/src/inputValidation.tsx +148 -0
- package/src/lib/index.ts +89 -0
- package/src/parseTwoColumn.tsx +26 -0
- package/src/reserializeMDast.tsx +107 -0
- package/src/wrapComponent.tsx +25 -0
- package/tsconfig.json +25 -0
- package/vite.config.ts +50 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../node_modules/zwitch/index.js","../../../node_modules/mdast-util-to-markdown/lib/configure.js","../../../node_modules/mdast-util-to-markdown/lib/handle/blockquote.js","../../../node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js","../../../node_modules/mdast-util-to-markdown/lib/handle/break.js","../../../node_modules/longest-streak/index.js","../../../node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-fence.js","../../../node_modules/mdast-util-to-markdown/lib/handle/code.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-quote.js","../../../node_modules/mdast-util-to-markdown/lib/handle/definition.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js","../../../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js","../../../node_modules/micromark-util-character/index.js","../../../node_modules/micromark-util-classify-character/index.js","../../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js","../../../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js","../../../node_modules/mdast-util-to-string/lib/index.js","../../../node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js","../../../node_modules/mdast-util-to-markdown/lib/handle/heading.js","../../../node_modules/mdast-util-to-markdown/lib/handle/html.js","../../../node_modules/mdast-util-to-markdown/lib/handle/image.js","../../../node_modules/mdast-util-to-markdown/lib/handle/image-reference.js","../../../node_modules/mdast-util-to-markdown/lib/handle/inline-code.js","../../../node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js","../../../node_modules/mdast-util-to-markdown/lib/handle/link.js","../../../node_modules/mdast-util-to-markdown/lib/handle/link-reference.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-bullet.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-rule.js","../../../node_modules/mdast-util-to-markdown/lib/handle/list.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js","../../../node_modules/mdast-util-to-markdown/lib/handle/list-item.js","../../../node_modules/mdast-util-to-markdown/lib/handle/paragraph.js","../../../node_modules/unist-util-is/lib/index.js","../../../node_modules/mdast-util-phrasing/lib/index.js","../../../node_modules/mdast-util-to-markdown/lib/handle/root.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-strong.js","../../../node_modules/mdast-util-to-markdown/lib/handle/strong.js","../../../node_modules/mdast-util-to-markdown/lib/handle/text.js","../../../node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js","../../../node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js","../../../node_modules/mdast-util-to-markdown/lib/handle/index.js","../../../node_modules/mdast-util-to-markdown/lib/join.js","../../../node_modules/mdast-util-to-markdown/lib/unsafe.js","../../../node_modules/decode-named-character-reference/index.dom.js","../../../node_modules/micromark-util-decode-numeric-character-reference/index.js","../../../node_modules/micromark-util-decode-string/index.js","../../../node_modules/mdast-util-to-markdown/lib/util/association.js","../../../node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js","../../../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js","../../../node_modules/mdast-util-to-markdown/lib/util/container-flow.js","../../../node_modules/mdast-util-to-markdown/lib/util/indent-lines.js","../../../node_modules/mdast-util-to-markdown/lib/util/safe.js","../../../node_modules/mdast-util-to-markdown/lib/util/track.js","../../../node_modules/mdast-util-to-markdown/lib/index.js","../../../node_modules/mdast-util-mdx-expression/lib/index.js","../../../node_modules/mdast-util-mdxjs-esm/lib/index.js","../../../node_modules/mdast-util-mdx/lib/index.js","../src/extractImports.tsx","../src/wrapComponent.tsx","../src/parseTwoColumn.tsx","../src/groupElements.tsx","../src/reserializeMDast.tsx","../src/ChartContext.tsx","../src/MapContext.tsx","../src/inputValidation.tsx","../src/CreateInterface.tsx","../src/data.tsx"],"sourcesContent":["/**\n * @callback Handler\n * Handle a value, with a certain ID field set to a certain value.\n * The ID field is passed to `zwitch`, and it’s value is this function’s\n * place on the `handlers` record.\n * @param {...any} parameters\n * Arbitrary parameters passed to the zwitch.\n * The first will be an object with a certain ID field set to a certain value.\n * @returns {any}\n * Anything!\n */\n\n/**\n * @callback UnknownHandler\n * Handle values that do have a certain ID field, but it’s set to a value\n * that is not listed in the `handlers` record.\n * @param {unknown} value\n * An object with a certain ID field set to an unknown value.\n * @param {...any} rest\n * Arbitrary parameters passed to the zwitch.\n * @returns {any}\n * Anything!\n */\n\n/**\n * @callback InvalidHandler\n * Handle values that do not have a certain ID field.\n * @param {unknown} value\n * Any unknown value.\n * @param {...any} rest\n * Arbitrary parameters passed to the zwitch.\n * @returns {void|null|undefined|never}\n * This should crash or return nothing.\n */\n\n/**\n * @template {InvalidHandler} [Invalid=InvalidHandler]\n * @template {UnknownHandler} [Unknown=UnknownHandler]\n * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]\n * @typedef Options\n * Configuration (required).\n * @property {Invalid} [invalid]\n * Handler to use for invalid values.\n * @property {Unknown} [unknown]\n * Handler to use for unknown values.\n * @property {Handlers} [handlers]\n * Handlers to use.\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * Handle values based on a field.\n *\n * @template {InvalidHandler} [Invalid=InvalidHandler]\n * @template {UnknownHandler} [Unknown=UnknownHandler]\n * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]\n * @param {string} key\n * Field to switch on.\n * @param {Options<Invalid, Unknown, Handlers>} [options]\n * Configuration (required).\n * @returns {{unknown: Unknown, invalid: Invalid, handlers: Handlers, (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType<Handlers[keyof Handlers]>, (...parameters: Parameters<Unknown>): ReturnType<Unknown>}}\n */\nexport function zwitch(key, options) {\n const settings = options || {}\n\n /**\n * Handle one value.\n *\n * Based on the bound `key`, a respective handler will be called.\n * If `value` is not an object, or doesn’t have a `key` property, the special\n * “invalid” handler will be called.\n * If `value` has an unknown `key`, the special “unknown” handler will be\n * called.\n *\n * All arguments, and the context object, are passed through to the handler,\n * and it’s result is returned.\n *\n * @this {unknown}\n * Any context object.\n * @param {unknown} [value]\n * Any value.\n * @param {...unknown} parameters\n * Arbitrary parameters passed to the zwitch.\n * @property {Handler} invalid\n * Handle for values that do not have a certain ID field.\n * @property {Handler} unknown\n * Handle values that do have a certain ID field, but it’s set to a value\n * that is not listed in the `handlers` record.\n * @property {Handlers} handlers\n * Record of handlers.\n * @returns {unknown}\n * Anything.\n */\n function one(value, ...parameters) {\n /** @type {Handler|undefined} */\n let fn = one.invalid\n const handlers = one.handlers\n\n if (value && own.call(value, key)) {\n // @ts-expect-error Indexable.\n const id = String(value[key])\n // @ts-expect-error Indexable.\n fn = own.call(handlers, id) ? handlers[id] : one.unknown\n }\n\n if (fn) {\n return fn.call(this, value, ...parameters)\n }\n }\n\n one.handlers = settings.handlers || {}\n one.invalid = settings.invalid\n one.unknown = settings.unknown\n\n // @ts-expect-error: matches!\n return one\n}\n","/**\n * @import {Options, State} from './types.js'\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * @param {State} base\n * @param {Options} extension\n * @returns {State}\n */\nexport function configure(base, extension) {\n let index = -1\n /** @type {keyof Options} */\n let key\n\n // First do subextensions.\n if (extension.extensions) {\n while (++index < extension.extensions.length) {\n configure(base, extension.extensions[index])\n }\n }\n\n for (key in extension) {\n if (own.call(extension, key)) {\n switch (key) {\n case 'extensions': {\n // Empty.\n break\n }\n\n /* c8 ignore next 4 */\n case 'unsafe': {\n list(base[key], extension[key])\n break\n }\n\n case 'join': {\n list(base[key], extension[key])\n break\n }\n\n case 'handlers': {\n map(base[key], extension[key])\n break\n }\n\n default: {\n // @ts-expect-error: matches.\n base.options[key] = extension[key]\n }\n }\n }\n }\n\n return base\n}\n\n/**\n * @template T\n * @param {Array<T>} left\n * @param {Array<T> | null | undefined} right\n */\nfunction list(left, right) {\n if (right) {\n left.push(...right)\n }\n}\n\n/**\n * @template T\n * @param {Record<string, T>} left\n * @param {Record<string, T> | null | undefined} right\n */\nfunction map(left, right) {\n if (right) {\n Object.assign(left, right)\n }\n}\n","/**\n * @import {Blockquote, Parents} from 'mdast'\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {Blockquote} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function blockquote(node, _, state, info) {\n const exit = state.enter('blockquote')\n const tracker = state.createTracker(info)\n tracker.move('> ')\n tracker.shift(2)\n const value = state.indentLines(\n state.containerFlow(node, tracker.current()),\n map\n )\n exit()\n return value\n}\n\n/** @type {Map} */\nfunction map(line, _, blank) {\n return '>' + (blank ? '' : ' ') + line\n}\n","/**\n * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {Array<ConstructName>} stack\n * @param {Unsafe} pattern\n * @returns {boolean}\n */\nexport function patternInScope(stack, pattern) {\n return (\n listInScope(stack, pattern.inConstruct, true) &&\n !listInScope(stack, pattern.notInConstruct, false)\n )\n}\n\n/**\n * @param {Array<ConstructName>} stack\n * @param {Unsafe['inConstruct']} list\n * @param {boolean} none\n * @returns {boolean}\n */\nfunction listInScope(stack, list, none) {\n if (typeof list === 'string') {\n list = [list]\n }\n\n if (!list || list.length === 0) {\n return none\n }\n\n let index = -1\n\n while (++index < list.length) {\n if (stack.includes(list[index])) {\n return true\n }\n }\n\n return false\n}\n","/**\n * @import {Break, Parents} from 'mdast'\n * @import {Info, State} from 'mdast-util-to-markdown'\n */\n\nimport {patternInScope} from '../util/pattern-in-scope.js'\n\n/**\n * @param {Break} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function hardBreak(_, _1, state, info) {\n let index = -1\n\n while (++index < state.unsafe.length) {\n // If we can’t put eols in this construct (setext headings, tables), use a\n // space instead.\n if (\n state.unsafe[index].character === '\\n' &&\n patternInScope(state.stack, state.unsafe[index])\n ) {\n return /[ \\t]/.test(info.before) ? '' : ' '\n }\n }\n\n return '\\\\\\n'\n}\n","/**\n * Get the count of the longest repeating streak of `substring` in `value`.\n *\n * @param {string} value\n * Content to search in.\n * @param {string} substring\n * Substring to look for, typically one character.\n * @returns {number}\n * Count of most frequent adjacent `substring`s in `value`.\n */\nexport function longestStreak(value, substring) {\n const source = String(value)\n let index = source.indexOf(substring)\n let expected = index\n let count = 0\n let max = 0\n\n if (typeof substring !== 'string') {\n throw new TypeError('Expected substring')\n }\n\n while (index !== -1) {\n if (index === expected) {\n if (++count > max) {\n max = count\n }\n } else {\n count = 1\n }\n\n expected = index + substring.length\n index = source.indexOf(substring, expected)\n }\n\n return max\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Code} from 'mdast'\n */\n\n/**\n * @param {Code} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatCodeAsIndented(node, state) {\n return Boolean(\n state.options.fences === false &&\n node.value &&\n // If there’s no info…\n !node.lang &&\n // And there’s a non-whitespace character…\n /[^ \\r\\n]/.test(node.value) &&\n // And the value doesn’t start or end in a blank…\n !/^[\\t ]*(?:[\\r\\n]|$)|(?:^|[\\r\\n])[\\t ]*$/.test(node.value)\n )\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['fence'], null | undefined>}\n */\nexport function checkFence(state) {\n const marker = state.options.fence || '`'\n\n if (marker !== '`' && marker !== '~') {\n throw new Error(\n 'Cannot serialize code with `' +\n marker +\n '` for `options.fence`, expected `` ` `` or `~`'\n )\n }\n\n return marker\n}\n","/**\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n * @import {Code, Parents} from 'mdast'\n */\n\nimport {longestStreak} from 'longest-streak'\nimport {formatCodeAsIndented} from '../util/format-code-as-indented.js'\nimport {checkFence} from '../util/check-fence.js'\n\n/**\n * @param {Code} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function code(node, _, state, info) {\n const marker = checkFence(state)\n const raw = node.value || ''\n const suffix = marker === '`' ? 'GraveAccent' : 'Tilde'\n\n if (formatCodeAsIndented(node, state)) {\n const exit = state.enter('codeIndented')\n const value = state.indentLines(raw, map)\n exit()\n return value\n }\n\n const tracker = state.createTracker(info)\n const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3))\n const exit = state.enter('codeFenced')\n let value = tracker.move(sequence)\n\n if (node.lang) {\n const subexit = state.enter(`codeFencedLang${suffix}`)\n value += tracker.move(\n state.safe(node.lang, {\n before: value,\n after: ' ',\n encode: ['`'],\n ...tracker.current()\n })\n )\n subexit()\n }\n\n if (node.lang && node.meta) {\n const subexit = state.enter(`codeFencedMeta${suffix}`)\n value += tracker.move(' ')\n value += tracker.move(\n state.safe(node.meta, {\n before: value,\n after: '\\n',\n encode: ['`'],\n ...tracker.current()\n })\n )\n subexit()\n }\n\n value += tracker.move('\\n')\n\n if (raw) {\n value += tracker.move(raw + '\\n')\n }\n\n value += tracker.move(sequence)\n exit()\n return value\n}\n\n/** @type {Map} */\nfunction map(line, _, blank) {\n return (blank ? '' : ' ') + line\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['quote'], null | undefined>}\n */\nexport function checkQuote(state) {\n const marker = state.options.quote || '\"'\n\n if (marker !== '\"' && marker !== \"'\") {\n throw new Error(\n 'Cannot serialize title with `' +\n marker +\n '` for `options.quote`, expected `\"`, or `\\'`'\n )\n }\n\n return marker\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Definition, Parents} from 'mdast'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\n\n/**\n * @param {Definition} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function definition(node, _, state, info) {\n const quote = checkQuote(state)\n const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n const exit = state.enter('definition')\n let subexit = state.enter('label')\n const tracker = state.createTracker(info)\n let value = tracker.move('[')\n value += tracker.move(\n state.safe(state.associationId(node), {\n before: value,\n after: ']',\n ...tracker.current()\n })\n )\n value += tracker.move(']: ')\n\n subexit()\n\n if (\n // If there’s no url, or…\n !node.url ||\n // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter('destinationLiteral')\n value += tracker.move('<')\n value += tracker.move(\n state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n )\n value += tracker.move('>')\n } else {\n // No whitespace, raw is prettier.\n subexit = state.enter('destinationRaw')\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? ' ' : '\\n',\n ...tracker.current()\n })\n )\n }\n\n subexit()\n\n if (node.title) {\n subexit = state.enter(`title${suffix}`)\n value += tracker.move(' ' + quote)\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n )\n value += tracker.move(quote)\n subexit()\n }\n\n exit()\n\n return value\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['emphasis'], null | undefined>}\n */\nexport function checkEmphasis(state) {\n const marker = state.options.emphasis || '*'\n\n if (marker !== '*' && marker !== '_') {\n throw new Error(\n 'Cannot serialize emphasis with `' +\n marker +\n '` for `options.emphasis`, expected `*`, or `_`'\n )\n }\n\n return marker\n}\n","/**\n * Encode a code point as a character reference.\n *\n * @param {number} code\n * Code point to encode.\n * @returns {string}\n * Encoded character reference.\n */\nexport function encodeCharacterReference(code) {\n return '&#x' + code.toString(16).toUpperCase() + ';'\n}\n","/**\n * @import {Code} from 'micromark-util-types'\n */\n\n/**\n * Check whether the character code represents an ASCII alpha (`a` through `z`,\n * case insensitive).\n *\n * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.\n *\n * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)\n * to U+005A (`Z`).\n *\n * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)\n * to U+007A (`z`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAlpha = regexCheck(/[A-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII alphanumeric (`a`\n * through `z`, case insensitive, or `0` through `9`).\n *\n * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha\n * (see `asciiAlpha`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII atext.\n *\n * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in\n * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),\n * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F\n * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E\n * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE\n * (`{`) to U+007E TILDE (`~`).\n *\n * See:\n * **\\[RFC5322]**:\n * [Internet Message Format](https://tools.ietf.org/html/rfc5322).\n * P. Resnick.\n * IETF.\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAtext = regexCheck(/[#-'*+\\--9=?A-Z^-~]/);\n\n/**\n * Check whether a character code is an ASCII control character.\n *\n * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)\n * to U+001F (US), or U+007F (DEL).\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function asciiControl(code) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code !== null && (code < 32 || code === 127)\n );\n}\n\n/**\n * Check whether the character code represents an ASCII digit (`0` through `9`).\n *\n * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to\n * U+0039 (`9`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiDigit = regexCheck(/\\d/);\n\n/**\n * Check whether the character code represents an ASCII hex digit (`a` through\n * `f`, case insensitive, or `0` through `9`).\n *\n * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex\n * digit, or an ASCII lower hex digit.\n *\n * An **ASCII upper hex digit** is a character in the inclusive range U+0041\n * (`A`) to U+0046 (`F`).\n *\n * An **ASCII lower hex digit** is a character in the inclusive range U+0061\n * (`a`) to U+0066 (`f`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiHexDigit = regexCheck(/[\\dA-Fa-f]/);\n\n/**\n * Check whether the character code represents ASCII punctuation.\n *\n * An **ASCII punctuation** is a character in the inclusive ranges U+0021\n * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT\n * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT\n * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);\n\n/**\n * Check whether a character code is a markdown line ending.\n *\n * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN\n * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).\n *\n * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE\n * RETURN (CR) are replaced by these virtual characters depending on whether\n * they occurred together.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownLineEnding(code) {\n return code !== null && code < -2;\n}\n\n/**\n * Check whether a character code is a markdown line ending (see\n * `markdownLineEnding`) or markdown space (see `markdownSpace`).\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownLineEndingOrSpace(code) {\n return code !== null && (code < 0 || code === 32);\n}\n\n/**\n * Check whether a character code is a markdown space.\n *\n * A **markdown space** is the concrete character U+0020 SPACE (SP) and the\n * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).\n *\n * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is\n * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL\n * SPACE (VS) characters, depending on the column at which the tab occurred.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownSpace(code) {\n return code === -2 || code === -1 || code === 32;\n}\n\n// Size note: removing ASCII from the regex and using `asciiPunctuation` here\n// In fact adds to the bundle size.\n/**\n * Check whether the character code represents Unicode punctuation.\n *\n * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,\n * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`\n * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`\n * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII\n * punctuation (see `asciiPunctuation`).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n * Code.\n * @returns\n * Whether it matches.\n */\nexport const unicodePunctuation = regexCheck(/\\p{P}|\\p{S}/u);\n\n/**\n * Check whether the character code represents Unicode whitespace.\n *\n * Note that this does handle micromark specific markdown whitespace characters.\n * See `markdownLineEndingOrSpace` to check that.\n *\n * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,\n * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),\n * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\\[UNICODE]**).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n * Code.\n * @returns\n * Whether it matches.\n */\nexport const unicodeWhitespace = regexCheck(/\\s/);\n\n/**\n * Create a code check from a regex.\n *\n * @param {RegExp} regex\n * Expression.\n * @returns {(code: Code) => boolean}\n * Check.\n */\nfunction regexCheck(regex) {\n return check;\n\n /**\n * Check whether a code matches the bound regex.\n *\n * @param {Code} code\n * Character code.\n * @returns {boolean}\n * Whether the character code matches the bound regex.\n */\n function check(code) {\n return code !== null && code > -1 && regex.test(String.fromCharCode(code));\n }\n}","/**\n * @import {Code} from 'micromark-util-types'\n */\n\nimport { markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character';\n/**\n * Classify whether a code represents whitespace, punctuation, or something\n * else.\n *\n * Used for attention (emphasis, strong), whose sequences can open or close\n * based on the class of surrounding characters.\n *\n * > 👉 **Note**: eof (`null`) is seen as whitespace.\n *\n * @param {Code} code\n * Code.\n * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}\n * Group.\n */\nexport function classifyCharacter(code) {\n if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n return 1;\n }\n if (unicodePunctuation(code)) {\n return 2;\n }\n}","/**\n * @import {EncodeSides} from '../types.js'\n */\n\nimport {classifyCharacter} from 'micromark-util-classify-character'\n\n/**\n * Check whether to encode (as a character reference) the characters\n * surrounding an attention run.\n *\n * Which characters are around an attention run influence whether it works or\n * not.\n *\n * See <https://github.com/orgs/syntax-tree/discussions/60> for more info.\n * See this markdown in a particular renderer to see what works:\n *\n * ```markdown\n * | | A (letter inside) | B (punctuation inside) | C (whitespace inside) | D (nothing inside) |\n * | ----------------------- | ----------------- | ---------------------- | --------------------- | ------------------ |\n * | 1 (letter outside) | x*y*z | x*.*z | x* *z | x**z |\n * | 2 (punctuation outside) | .*y*. | .*.*. | .* *. | .**. |\n * | 3 (whitespace outside) | x *y* z | x *.* z | x * * z | x ** z |\n * | 4 (nothing outside) | *x* | *.* | * * | ** |\n * ```\n *\n * @param {number} outside\n * Code point on the outer side of the run.\n * @param {number} inside\n * Code point on the inner side of the run.\n * @param {'*' | '_'} marker\n * Marker of the run.\n * Underscores are handled more strictly (they form less often) than\n * asterisks.\n * @returns {EncodeSides}\n * Whether to encode characters.\n */\n// Important: punctuation must never be encoded.\n// Punctuation is solely used by markdown constructs.\n// And by encoding itself.\n// Encoding them will break constructs or double encode things.\nexport function encodeInfo(outside, inside, marker) {\n const outsideKind = classifyCharacter(outside)\n const insideKind = classifyCharacter(inside)\n\n // Letter outside:\n if (outsideKind === undefined) {\n return insideKind === undefined\n ? // Letter inside:\n // we have to encode *both* letters for `_` as it is looser.\n // it already forms for `*` (and GFMs `~`).\n marker === '_'\n ? {inside: true, outside: true}\n : {inside: false, outside: false}\n : insideKind === 1\n ? // Whitespace inside: encode both (letter, whitespace).\n {inside: true, outside: true}\n : // Punctuation inside: encode outer (letter)\n {inside: false, outside: true}\n }\n\n // Whitespace outside:\n if (outsideKind === 1) {\n return insideKind === undefined\n ? // Letter inside: already forms.\n {inside: false, outside: false}\n : insideKind === 1\n ? // Whitespace inside: encode both (whitespace).\n {inside: true, outside: true}\n : // Punctuation inside: already forms.\n {inside: false, outside: false}\n }\n\n // Punctuation outside:\n return insideKind === undefined\n ? // Letter inside: already forms.\n {inside: false, outside: false}\n : insideKind === 1\n ? // Whitespace inside: encode inner (whitespace).\n {inside: true, outside: false}\n : // Punctuation inside: already forms.\n {inside: false, outside: false}\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Emphasis, Parents} from 'mdast'\n */\n\nimport {checkEmphasis} from '../util/check-emphasis.js'\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {encodeInfo} from '../util/encode-info.js'\n\nemphasis.peek = emphasisPeek\n\n/**\n * @param {Emphasis} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function emphasis(node, _, state, info) {\n const marker = checkEmphasis(state)\n const exit = state.enter('emphasis')\n const tracker = state.createTracker(info)\n const before = tracker.move(marker)\n\n let between = tracker.move(\n state.containerPhrasing(node, {\n after: marker,\n before,\n ...tracker.current()\n })\n )\n const betweenHead = between.charCodeAt(0)\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n )\n\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1)\n }\n\n const betweenTail = between.charCodeAt(between.length - 1)\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)\n\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail)\n }\n\n const after = tracker.move(marker)\n\n exit()\n\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n }\n return before + between + after\n}\n\n/**\n * @param {Emphasis} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nfunction emphasisPeek(_, _1, state) {\n return state.options.emphasis || '*'\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean | null | undefined} [includeImageAlt=true]\n * Whether to use `alt` for `image`s (default: `true`).\n * @property {boolean | null | undefined} [includeHtml=true]\n * Whether to use `value` of HTML (default: `true`).\n */\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Get the text content of a node or list of nodes.\n *\n * Prefers the node’s plain-text fields, otherwise serializes its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} [value]\n * Thing to serialize, typically `Node`.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized `value`.\n */\nexport function toString(value, options) {\n const settings = options || emptyOptions\n const includeImageAlt =\n typeof settings.includeImageAlt === 'boolean'\n ? settings.includeImageAlt\n : true\n const includeHtml =\n typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true\n\n return one(value, includeImageAlt, includeHtml)\n}\n\n/**\n * One node or several nodes.\n *\n * @param {unknown} value\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized node.\n */\nfunction one(value, includeImageAlt, includeHtml) {\n if (node(value)) {\n if ('value' in value) {\n return value.type === 'html' && !includeHtml ? '' : value.value\n }\n\n if (includeImageAlt && 'alt' in value && value.alt) {\n return value.alt\n }\n\n if ('children' in value) {\n return all(value.children, includeImageAlt, includeHtml)\n }\n }\n\n if (Array.isArray(value)) {\n return all(value, includeImageAlt, includeHtml)\n }\n\n return ''\n}\n\n/**\n * Serialize a list of nodes.\n *\n * @param {Array<unknown>} values\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized nodes.\n */\nfunction all(values, includeImageAlt, includeHtml) {\n /** @type {Array<string>} */\n const result = []\n let index = -1\n\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt, includeHtml)\n }\n\n return result.join('')\n}\n\n/**\n * Check if `value` looks like a node.\n *\n * @param {unknown} value\n * Thing.\n * @returns {value is Nodes}\n * Whether `value` is a node.\n */\nfunction node(value) {\n return Boolean(value && typeof value === 'object')\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Heading} from 'mdast'\n */\n\nimport {EXIT, visit} from 'unist-util-visit'\nimport {toString} from 'mdast-util-to-string'\n\n/**\n * @param {Heading} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatHeadingAsSetext(node, state) {\n let literalWithBreak = false\n\n // Look for literals with a line break.\n // Note that this also\n visit(node, function (node) {\n if (\n ('value' in node && /\\r?\\n|\\r/.test(node.value)) ||\n node.type === 'break'\n ) {\n literalWithBreak = true\n return EXIT\n }\n })\n\n return Boolean(\n (!node.depth || node.depth < 3) &&\n toString(node) &&\n (state.options.setext || literalWithBreak)\n )\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Heading, Parents} from 'mdast'\n */\n\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {formatHeadingAsSetext} from '../util/format-heading-as-setext.js'\n\n/**\n * @param {Heading} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function heading(node, _, state, info) {\n const rank = Math.max(Math.min(6, node.depth || 1), 1)\n const tracker = state.createTracker(info)\n\n if (formatHeadingAsSetext(node, state)) {\n const exit = state.enter('headingSetext')\n const subexit = state.enter('phrasing')\n const value = state.containerPhrasing(node, {\n ...tracker.current(),\n before: '\\n',\n after: '\\n'\n })\n subexit()\n exit()\n\n return (\n value +\n '\\n' +\n (rank === 1 ? '=' : '-').repeat(\n // The whole size…\n value.length -\n // Minus the position of the character after the last EOL (or\n // 0 if there is none)…\n (Math.max(value.lastIndexOf('\\r'), value.lastIndexOf('\\n')) + 1)\n )\n )\n }\n\n const sequence = '#'.repeat(rank)\n const exit = state.enter('headingAtx')\n const subexit = state.enter('phrasing')\n\n // Note: for proper tracking, we should reset the output positions when there\n // is no content returned, because then the space is not output.\n // Practically, in that case, there is no content, so it doesn’t matter that\n // we’ve tracked one too many characters.\n tracker.move(sequence + ' ')\n\n let value = state.containerPhrasing(node, {\n before: '# ',\n after: '\\n',\n ...tracker.current()\n })\n\n if (/^[\\t ]/.test(value)) {\n // To do: what effect has the character reference on tracking?\n value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1)\n }\n\n value = value ? sequence + ' ' + value : sequence\n\n if (state.options.closeAtx) {\n value += ' ' + sequence\n }\n\n subexit()\n exit()\n\n return value\n}\n","/**\n * @import {Html} from 'mdast'\n */\n\nhtml.peek = htmlPeek\n\n/**\n * @param {Html} node\n * @returns {string}\n */\nexport function html(node) {\n return node.value || ''\n}\n\n/**\n * @returns {string}\n */\nfunction htmlPeek() {\n return '<'\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Image, Parents} from 'mdast'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\n\nimage.peek = imagePeek\n\n/**\n * @param {Image} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function image(node, _, state, info) {\n const quote = checkQuote(state)\n const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n const exit = state.enter('image')\n let subexit = state.enter('label')\n const tracker = state.createTracker(info)\n let value = tracker.move('![')\n value += tracker.move(\n state.safe(node.alt, {before: value, after: ']', ...tracker.current()})\n )\n value += tracker.move('](')\n\n subexit()\n\n if (\n // If there’s no url but there is a title…\n (!node.url && node.title) ||\n // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter('destinationLiteral')\n value += tracker.move('<')\n value += tracker.move(\n state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n )\n value += tracker.move('>')\n } else {\n // No whitespace, raw is prettier.\n subexit = state.enter('destinationRaw')\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? ' ' : ')',\n ...tracker.current()\n })\n )\n }\n\n subexit()\n\n if (node.title) {\n subexit = state.enter(`title${suffix}`)\n value += tracker.move(' ' + quote)\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n )\n value += tracker.move(quote)\n subexit()\n }\n\n value += tracker.move(')')\n exit()\n\n return value\n}\n\n/**\n * @returns {string}\n */\nfunction imagePeek() {\n return '!'\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {ImageReference, Parents} from 'mdast'\n */\n\nimageReference.peek = imageReferencePeek\n\n/**\n * @param {ImageReference} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function imageReference(node, _, state, info) {\n const type = node.referenceType\n const exit = state.enter('imageReference')\n let subexit = state.enter('label')\n const tracker = state.createTracker(info)\n let value = tracker.move('![')\n const alt = state.safe(node.alt, {\n before: value,\n after: ']',\n ...tracker.current()\n })\n value += tracker.move(alt + '][')\n\n subexit()\n // Hide the fact that we’re in phrasing, because escapes don’t work.\n const stack = state.stack\n state.stack = []\n subexit = state.enter('reference')\n // Note: for proper tracking, we should reset the output positions when we end\n // up making a `shortcut` reference, because then there is no brace output.\n // Practically, in that case, there is no content, so it doesn’t matter that\n // we’ve tracked one too many characters.\n const reference = state.safe(state.associationId(node), {\n before: value,\n after: ']',\n ...tracker.current()\n })\n subexit()\n state.stack = stack\n exit()\n\n if (type === 'full' || !alt || alt !== reference) {\n value += tracker.move(reference + ']')\n } else if (type === 'shortcut') {\n // Remove the unwanted `[`.\n value = value.slice(0, -1)\n } else {\n value += tracker.move(']')\n }\n\n return value\n}\n\n/**\n * @returns {string}\n */\nfunction imageReferencePeek() {\n return '!'\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {InlineCode, Parents} from 'mdast'\n */\n\ninlineCode.peek = inlineCodePeek\n\n/**\n * @param {InlineCode} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @returns {string}\n */\nexport function inlineCode(node, _, state) {\n let value = node.value || ''\n let sequence = '`'\n let index = -1\n\n // If there is a single grave accent on its own in the code, use a fence of\n // two.\n // If there are two in a row, use one.\n while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {\n sequence += '`'\n }\n\n // If this is not just spaces or eols (tabs don’t count), and either the\n // first or last character are a space, eol, or tick, then pad with spaces.\n if (\n /[^ \\r\\n]/.test(value) &&\n ((/^[ \\r\\n]/.test(value) && /[ \\r\\n]$/.test(value)) || /^`|`$/.test(value))\n ) {\n value = ' ' + value + ' '\n }\n\n // We have a potential problem: certain characters after eols could result in\n // blocks being seen.\n // For example, if someone injected the string `'\\n# b'`, then that would\n // result in an ATX heading.\n // We can’t escape characters in `inlineCode`, but because eols are\n // transformed to spaces when going from markdown to HTML anyway, we can swap\n // them out.\n while (++index < state.unsafe.length) {\n const pattern = state.unsafe[index]\n const expression = state.compilePattern(pattern)\n /** @type {RegExpExecArray | null} */\n let match\n\n // Only look for `atBreak`s.\n // Btw: note that `atBreak` patterns will always start the regex at LF or\n // CR.\n if (!pattern.atBreak) continue\n\n while ((match = expression.exec(value))) {\n let position = match.index\n\n // Support CRLF (patterns only look for one of the characters).\n if (\n value.charCodeAt(position) === 10 /* `\\n` */ &&\n value.charCodeAt(position - 1) === 13 /* `\\r` */\n ) {\n position--\n }\n\n value = value.slice(0, position) + ' ' + value.slice(match.index + 1)\n }\n }\n\n return sequence + value + sequence\n}\n\n/**\n * @returns {string}\n */\nfunction inlineCodePeek() {\n return '`'\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Link} from 'mdast'\n */\n\nimport {toString} from 'mdast-util-to-string'\n\n/**\n * @param {Link} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatLinkAsAutolink(node, state) {\n const raw = toString(node)\n\n return Boolean(\n !state.options.resourceLink &&\n // If there’s a url…\n node.url &&\n // And there’s a no title…\n !node.title &&\n // And the content of `node` is a single text node…\n node.children &&\n node.children.length === 1 &&\n node.children[0].type === 'text' &&\n // And if the url is the same as the content…\n (raw === node.url || 'mailto:' + raw === node.url) &&\n // And that starts w/ a protocol…\n /^[a-z][a-z+.-]+:/i.test(node.url) &&\n // And that doesn’t contain ASCII control codes (character escapes and\n // references don’t work), space, or angle brackets…\n !/[\\0- <>\\u007F]/.test(node.url)\n )\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Link, Parents} from 'mdast'\n * @import {Exit} from '../types.js'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\nimport {formatLinkAsAutolink} from '../util/format-link-as-autolink.js'\n\nlink.peek = linkPeek\n\n/**\n * @param {Link} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function link(node, _, state, info) {\n const quote = checkQuote(state)\n const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n const tracker = state.createTracker(info)\n /** @type {Exit} */\n let exit\n /** @type {Exit} */\n let subexit\n\n if (formatLinkAsAutolink(node, state)) {\n // Hide the fact that we’re in phrasing, because escapes don’t work.\n const stack = state.stack\n state.stack = []\n exit = state.enter('autolink')\n let value = tracker.move('<')\n value += tracker.move(\n state.containerPhrasing(node, {\n before: value,\n after: '>',\n ...tracker.current()\n })\n )\n value += tracker.move('>')\n exit()\n state.stack = stack\n return value\n }\n\n exit = state.enter('link')\n subexit = state.enter('label')\n let value = tracker.move('[')\n value += tracker.move(\n state.containerPhrasing(node, {\n before: value,\n after: '](',\n ...tracker.current()\n })\n )\n value += tracker.move('](')\n subexit()\n\n if (\n // If there’s no url but there is a title…\n (!node.url && node.title) ||\n // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter('destinationLiteral')\n value += tracker.move('<')\n value += tracker.move(\n state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n )\n value += tracker.move('>')\n } else {\n // No whitespace, raw is prettier.\n subexit = state.enter('destinationRaw')\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? ' ' : ')',\n ...tracker.current()\n })\n )\n }\n\n subexit()\n\n if (node.title) {\n subexit = state.enter(`title${suffix}`)\n value += tracker.move(' ' + quote)\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n )\n value += tracker.move(quote)\n subexit()\n }\n\n value += tracker.move(')')\n\n exit()\n return value\n}\n\n/**\n * @param {Link} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @returns {string}\n */\nfunction linkPeek(node, _, state) {\n return formatLinkAsAutolink(node, state) ? '<' : '['\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {LinkReference, Parents} from 'mdast'\n */\n\nlinkReference.peek = linkReferencePeek\n\n/**\n * @param {LinkReference} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function linkReference(node, _, state, info) {\n const type = node.referenceType\n const exit = state.enter('linkReference')\n let subexit = state.enter('label')\n const tracker = state.createTracker(info)\n let value = tracker.move('[')\n const text = state.containerPhrasing(node, {\n before: value,\n after: ']',\n ...tracker.current()\n })\n value += tracker.move(text + '][')\n\n subexit()\n // Hide the fact that we’re in phrasing, because escapes don’t work.\n const stack = state.stack\n state.stack = []\n subexit = state.enter('reference')\n // Note: for proper tracking, we should reset the output positions when we end\n // up making a `shortcut` reference, because then there is no brace output.\n // Practically, in that case, there is no content, so it doesn’t matter that\n // we’ve tracked one too many characters.\n const reference = state.safe(state.associationId(node), {\n before: value,\n after: ']',\n ...tracker.current()\n })\n subexit()\n state.stack = stack\n exit()\n\n if (type === 'full' || !text || text !== reference) {\n value += tracker.move(reference + ']')\n } else if (type === 'shortcut') {\n // Remove the unwanted `[`.\n value = value.slice(0, -1)\n } else {\n value += tracker.move(']')\n }\n\n return value\n}\n\n/**\n * @returns {string}\n */\nfunction linkReferencePeek() {\n return '['\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bullet'], null | undefined>}\n */\nexport function checkBullet(state) {\n const marker = state.options.bullet || '*'\n\n if (marker !== '*' && marker !== '+' && marker !== '-') {\n throw new Error(\n 'Cannot serialize items with `' +\n marker +\n '` for `options.bullet`, expected `*`, `+`, or `-`'\n )\n }\n\n return marker\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\nimport {checkBullet} from './check-bullet.js'\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bullet'], null | undefined>}\n */\nexport function checkBulletOther(state) {\n const bullet = checkBullet(state)\n const bulletOther = state.options.bulletOther\n\n if (!bulletOther) {\n return bullet === '*' ? '-' : '*'\n }\n\n if (bulletOther !== '*' && bulletOther !== '+' && bulletOther !== '-') {\n throw new Error(\n 'Cannot serialize items with `' +\n bulletOther +\n '` for `options.bulletOther`, expected `*`, `+`, or `-`'\n )\n }\n\n if (bulletOther === bullet) {\n throw new Error(\n 'Expected `bullet` (`' +\n bullet +\n '`) and `bulletOther` (`' +\n bulletOther +\n '`) to be different'\n )\n }\n\n return bulletOther\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bulletOrdered'], null | undefined>}\n */\nexport function checkBulletOrdered(state) {\n const marker = state.options.bulletOrdered || '.'\n\n if (marker !== '.' && marker !== ')') {\n throw new Error(\n 'Cannot serialize items with `' +\n marker +\n '` for `options.bulletOrdered`, expected `.` or `)`'\n )\n }\n\n return marker\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['rule'], null | undefined>}\n */\nexport function checkRule(state) {\n const marker = state.options.rule || '*'\n\n if (marker !== '*' && marker !== '-' && marker !== '_') {\n throw new Error(\n 'Cannot serialize rules with `' +\n marker +\n '` for `options.rule`, expected `*`, `-`, or `_`'\n )\n }\n\n return marker\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {List, Parents} from 'mdast'\n */\n\nimport {checkBullet} from '../util/check-bullet.js'\nimport {checkBulletOther} from '../util/check-bullet-other.js'\nimport {checkBulletOrdered} from '../util/check-bullet-ordered.js'\nimport {checkRule} from '../util/check-rule.js'\n\n/**\n * @param {List} node\n * @param {Parents | undefined} parent\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function list(node, parent, state, info) {\n const exit = state.enter('list')\n const bulletCurrent = state.bulletCurrent\n /** @type {string} */\n let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state)\n /** @type {string} */\n const bulletOther = node.ordered\n ? bullet === '.'\n ? ')'\n : '.'\n : checkBulletOther(state)\n let useDifferentMarker =\n parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false\n\n if (!node.ordered) {\n const firstListItem = node.children ? node.children[0] : undefined\n\n // If there’s an empty first list item directly in two list items,\n // we have to use a different bullet:\n //\n // ```markdown\n // * - *\n // ```\n //\n // …because otherwise it would become one big thematic break.\n if (\n // Bullet could be used as a thematic break marker:\n (bullet === '*' || bullet === '-') &&\n // Empty first list item:\n firstListItem &&\n (!firstListItem.children || !firstListItem.children[0]) &&\n // Directly in two other list items:\n state.stack[state.stack.length - 1] === 'list' &&\n state.stack[state.stack.length - 2] === 'listItem' &&\n state.stack[state.stack.length - 3] === 'list' &&\n state.stack[state.stack.length - 4] === 'listItem' &&\n // That are each the first child.\n state.indexStack[state.indexStack.length - 1] === 0 &&\n state.indexStack[state.indexStack.length - 2] === 0 &&\n state.indexStack[state.indexStack.length - 3] === 0\n ) {\n useDifferentMarker = true\n }\n\n // If there’s a thematic break at the start of the first list item,\n // we have to use a different bullet:\n //\n // ```markdown\n // * ---\n // ```\n //\n // …because otherwise it would become one big thematic break.\n if (checkRule(state) === bullet && firstListItem) {\n let index = -1\n\n while (++index < node.children.length) {\n const item = node.children[index]\n\n if (\n item &&\n item.type === 'listItem' &&\n item.children &&\n item.children[0] &&\n item.children[0].type === 'thematicBreak'\n ) {\n useDifferentMarker = true\n break\n }\n }\n }\n }\n\n if (useDifferentMarker) {\n bullet = bulletOther\n }\n\n state.bulletCurrent = bullet\n const value = state.containerFlow(node, info)\n state.bulletLastUsed = bullet\n state.bulletCurrent = bulletCurrent\n exit()\n return value\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['listItemIndent'], null | undefined>}\n */\nexport function checkListItemIndent(state) {\n const style = state.options.listItemIndent || 'one'\n\n if (style !== 'tab' && style !== 'one' && style !== 'mixed') {\n throw new Error(\n 'Cannot serialize items with `' +\n style +\n '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`'\n )\n }\n\n return style\n}\n","/**\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n * @import {ListItem, Parents} from 'mdast'\n */\n\nimport {checkBullet} from '../util/check-bullet.js'\nimport {checkListItemIndent} from '../util/check-list-item-indent.js'\n\n/**\n * @param {ListItem} node\n * @param {Parents | undefined} parent\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function listItem(node, parent, state, info) {\n const listItemIndent = checkListItemIndent(state)\n let bullet = state.bulletCurrent || checkBullet(state)\n\n // Add the marker value for ordered lists.\n if (parent && parent.type === 'list' && parent.ordered) {\n bullet =\n (typeof parent.start === 'number' && parent.start > -1\n ? parent.start\n : 1) +\n (state.options.incrementListMarker === false\n ? 0\n : parent.children.indexOf(node)) +\n bullet\n }\n\n let size = bullet.length + 1\n\n if (\n listItemIndent === 'tab' ||\n (listItemIndent === 'mixed' &&\n ((parent && parent.type === 'list' && parent.spread) || node.spread))\n ) {\n size = Math.ceil(size / 4) * 4\n }\n\n const tracker = state.createTracker(info)\n tracker.move(bullet + ' '.repeat(size - bullet.length))\n tracker.shift(size)\n const exit = state.enter('listItem')\n const value = state.indentLines(\n state.containerFlow(node, tracker.current()),\n map\n )\n exit()\n\n return value\n\n /** @type {Map} */\n function map(line, index, blank) {\n if (index) {\n return (blank ? '' : ' '.repeat(size)) + line\n }\n\n return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line\n }\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Paragraph, Parents} from 'mdast'\n */\n\n/**\n * @param {Paragraph} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function paragraph(node, _, state, info) {\n const exit = state.enter('paragraph')\n const subexit = state.enter('phrasing')\n const value = state.containerPhrasing(node, info)\n subexit()\n exit()\n return value\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record<string, unknown> | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test) ? anyFactory(test) : propsFactory(test)\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array<Props | TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array<Check>} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propsFactory(check) {\n const checkAsRecord = /** @type {Record<string, unknown>} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record<string, unknown>} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @typedef {import('mdast').Html} Html\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n */\n\nimport {convert} from 'unist-util-is'\n\n/**\n * Check if the given value is *phrasing content*.\n *\n * > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.\n *\n * @param node\n * Thing to check, typically `Node`.\n * @returns\n * Whether `value` is phrasing content.\n */\n\nexport const phrasing =\n /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */\n (\n convert([\n 'break',\n 'delete',\n 'emphasis',\n // To do: next major: removed since footnotes were added to GFM.\n 'footnote',\n 'footnoteReference',\n 'image',\n 'imageReference',\n 'inlineCode',\n // Enabled by `mdast-util-math`:\n 'inlineMath',\n 'link',\n 'linkReference',\n // Enabled by `mdast-util-mdx`:\n 'mdxJsxTextElement',\n // Enabled by `mdast-util-mdx`:\n 'mdxTextExpression',\n 'strong',\n 'text',\n // Enabled by `mdast-util-directive`:\n 'textDirective'\n ])\n )\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Root} from 'mdast'\n */\n\nimport {phrasing} from 'mdast-util-phrasing'\n\n/**\n * @param {Root} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function root(node, _, state, info) {\n // Note: `html` nodes are ambiguous.\n const hasPhrasing = node.children.some(function (d) {\n return phrasing(d)\n })\n\n const container = hasPhrasing ? state.containerPhrasing : state.containerFlow\n return container.call(state, node, info)\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['strong'], null | undefined>}\n */\nexport function checkStrong(state) {\n const marker = state.options.strong || '*'\n\n if (marker !== '*' && marker !== '_') {\n throw new Error(\n 'Cannot serialize strong with `' +\n marker +\n '` for `options.strong`, expected `*`, or `_`'\n )\n }\n\n return marker\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Strong} from 'mdast'\n */\n\nimport {checkStrong} from '../util/check-strong.js'\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {encodeInfo} from '../util/encode-info.js'\n\nstrong.peek = strongPeek\n\n/**\n * @param {Strong} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function strong(node, _, state, info) {\n const marker = checkStrong(state)\n const exit = state.enter('strong')\n const tracker = state.createTracker(info)\n const before = tracker.move(marker + marker)\n\n let between = tracker.move(\n state.containerPhrasing(node, {\n after: marker,\n before,\n ...tracker.current()\n })\n )\n const betweenHead = between.charCodeAt(0)\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n )\n\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1)\n }\n\n const betweenTail = between.charCodeAt(between.length - 1)\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)\n\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail)\n }\n\n const after = tracker.move(marker + marker)\n\n exit()\n\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n }\n return before + between + after\n}\n\n/**\n * @param {Strong} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nfunction strongPeek(_, _1, state) {\n return state.options.strong || '*'\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Text} from 'mdast'\n */\n\n/**\n * @param {Text} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function text(node, _, state, info) {\n return state.safe(node.value, info)\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['ruleRepetition'], null | undefined>}\n */\nexport function checkRuleRepetition(state) {\n const repetition = state.options.ruleRepetition || 3\n\n if (repetition < 3) {\n throw new Error(\n 'Cannot serialize rules with repetition `' +\n repetition +\n '` for `options.ruleRepetition`, expected `3` or more'\n )\n }\n\n return repetition\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Parents, ThematicBreak} from 'mdast'\n */\n\nimport {checkRuleRepetition} from '../util/check-rule-repetition.js'\nimport {checkRule} from '../util/check-rule.js'\n\n/**\n * @param {ThematicBreak} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nexport function thematicBreak(_, _1, state) {\n const value = (\n checkRule(state) + (state.options.ruleSpaces ? ' ' : '')\n ).repeat(checkRuleRepetition(state))\n\n return state.options.ruleSpaces ? value.slice(0, -1) : value\n}\n","import {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {definition} from './definition.js'\nimport {emphasis} from './emphasis.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {image} from './image.js'\nimport {imageReference} from './image-reference.js'\nimport {inlineCode} from './inline-code.js'\nimport {link} from './link.js'\nimport {linkReference} from './link-reference.js'\nimport {list} from './list.js'\nimport {listItem} from './list-item.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default (CommonMark) handlers.\n */\nexport const handle = {\n blockquote,\n break: hardBreak,\n code,\n definition,\n emphasis,\n hardBreak,\n heading,\n html,\n image,\n imageReference,\n inlineCode,\n link,\n linkReference,\n list,\n listItem,\n paragraph,\n root,\n strong,\n text,\n thematicBreak\n}\n","/**\n * @import {Join} from 'mdast-util-to-markdown'\n */\n\nimport {formatCodeAsIndented} from './util/format-code-as-indented.js'\nimport {formatHeadingAsSetext} from './util/format-heading-as-setext.js'\n\n/** @type {Array<Join>} */\nexport const join = [joinDefaults]\n\n/** @type {Join} */\nfunction joinDefaults(left, right, parent, state) {\n // Indented code after list or another indented code.\n if (\n right.type === 'code' &&\n formatCodeAsIndented(right, state) &&\n (left.type === 'list' ||\n (left.type === right.type && formatCodeAsIndented(left, state)))\n ) {\n return false\n }\n\n // Join children of a list or an item.\n // In which case, `parent` has a `spread` field.\n if ('spread' in parent && typeof parent.spread === 'boolean') {\n if (\n left.type === 'paragraph' &&\n // Two paragraphs.\n (left.type === right.type ||\n right.type === 'definition' ||\n // Paragraph followed by a setext heading.\n (right.type === 'heading' && formatHeadingAsSetext(right, state)))\n ) {\n return\n }\n\n return parent.spread ? 1 : 0\n }\n}\n","/**\n * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'\n */\n\n/**\n * List of constructs that occur in phrasing (paragraphs, headings), but cannot\n * contain things like attention (emphasis, strong), images, or links.\n * So they sort of cancel each other out.\n * Note: could use a better name.\n *\n * @type {Array<ConstructName>}\n */\nconst fullPhrasingSpans = [\n 'autolink',\n 'destinationLiteral',\n 'destinationRaw',\n 'reference',\n 'titleQuote',\n 'titleApostrophe'\n]\n\n/** @type {Array<Unsafe>} */\nexport const unsafe = [\n {character: '\\t', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n {character: '\\t', before: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n {\n character: '\\t',\n inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']\n },\n {\n character: '\\r',\n inConstruct: [\n 'codeFencedLangGraveAccent',\n 'codeFencedLangTilde',\n 'codeFencedMetaGraveAccent',\n 'codeFencedMetaTilde',\n 'destinationLiteral',\n 'headingAtx'\n ]\n },\n {\n character: '\\n',\n inConstruct: [\n 'codeFencedLangGraveAccent',\n 'codeFencedLangTilde',\n 'codeFencedMetaGraveAccent',\n 'codeFencedMetaTilde',\n 'destinationLiteral',\n 'headingAtx'\n ]\n },\n {character: ' ', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n {character: ' ', before: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n {\n character: ' ',\n inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']\n },\n // An exclamation mark can start an image, if it is followed by a link or\n // a link reference.\n {\n character: '!',\n after: '\\\\[',\n inConstruct: 'phrasing',\n notInConstruct: fullPhrasingSpans\n },\n // A quote can break out of a title.\n {character: '\"', inConstruct: 'titleQuote'},\n // A number sign could start an ATX heading if it starts a line.\n {atBreak: true, character: '#'},\n {character: '#', inConstruct: 'headingAtx', after: '(?:[\\r\\n]|$)'},\n // Dollar sign and percentage are not used in markdown.\n // An ampersand could start a character reference.\n {character: '&', after: '[#A-Za-z]', inConstruct: 'phrasing'},\n // An apostrophe can break out of a title.\n {character: \"'\", inConstruct: 'titleApostrophe'},\n // A left paren could break out of a destination raw.\n {character: '(', inConstruct: 'destinationRaw'},\n // A left paren followed by `]` could make something into a link or image.\n {\n before: '\\\\]',\n character: '(',\n inConstruct: 'phrasing',\n notInConstruct: fullPhrasingSpans\n },\n // A right paren could start a list item or break out of a destination\n // raw.\n {atBreak: true, before: '\\\\d+', character: ')'},\n {character: ')', inConstruct: 'destinationRaw'},\n // An asterisk can start thematic breaks, list items, emphasis, strong.\n {atBreak: true, character: '*', after: '(?:[ \\t\\r\\n*])'},\n {character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n // A plus sign could start a list item.\n {atBreak: true, character: '+', after: '(?:[ \\t\\r\\n])'},\n // A dash can start thematic breaks, list items, and setext heading\n // underlines.\n {atBreak: true, character: '-', after: '(?:[ \\t\\r\\n-])'},\n // A dot could start a list item.\n {atBreak: true, before: '\\\\d+', character: '.', after: '(?:[ \\t\\r\\n]|$)'},\n // Slash, colon, and semicolon are not used in markdown for constructs.\n // A less than can start html (flow or text) or an autolink.\n // HTML could start with an exclamation mark (declaration, cdata, comment),\n // slash (closing tag), question mark (instruction), or a letter (tag).\n // An autolink also starts with a letter.\n // Finally, it could break out of a destination literal.\n {atBreak: true, character: '<', after: '[!/?A-Za-z]'},\n {\n character: '<',\n after: '[!/?A-Za-z]',\n inConstruct: 'phrasing',\n notInConstruct: fullPhrasingSpans\n },\n {character: '<', inConstruct: 'destinationLiteral'},\n // An equals to can start setext heading underlines.\n {atBreak: true, character: '='},\n // A greater than can start block quotes and it can break out of a\n // destination literal.\n {atBreak: true, character: '>'},\n {character: '>', inConstruct: 'destinationLiteral'},\n // Question mark and at sign are not used in markdown for constructs.\n // A left bracket can start definitions, references, labels,\n {atBreak: true, character: '['},\n {character: '[', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n {character: '[', inConstruct: ['label', 'reference']},\n // A backslash can start an escape (when followed by punctuation) or a\n // hard break (when followed by an eol).\n // Note: typical escapes are handled in `safe`!\n {character: '\\\\', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n // A right bracket can exit labels.\n {character: ']', inConstruct: ['label', 'reference']},\n // Caret is not used in markdown for constructs.\n // An underscore can start emphasis, strong, or a thematic break.\n {atBreak: true, character: '_'},\n {character: '_', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n // A grave accent can start code (fenced or text), or it can break out of\n // a grave accent code fence.\n {atBreak: true, character: '`'},\n {\n character: '`',\n inConstruct: ['codeFencedLangGraveAccent', 'codeFencedMetaGraveAccent']\n },\n {character: '`', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n // Left brace, vertical bar, right brace are not used in markdown for\n // constructs.\n // A tilde can start code (fenced).\n {atBreak: true, character: '~'}\n]\n","/// <reference lib=\"dom\" />\n\n/* global document */\n\nconst element = document.createElement('i')\n\n/**\n * @param {string} value\n * @returns {string | false}\n */\nexport function decodeNamedCharacterReference(value) {\n const characterReference = '&' + value + ';'\n element.innerHTML = characterReference\n const character = element.textContent\n\n // Some named character references do not require the closing semicolon\n // (`¬`, for instance), which leads to situations where parsing the assumed\n // named reference of `¬it;` will result in the string `¬it;`.\n // When we encounter a trailing semicolon after parsing, and the character\n // reference to decode was not a semicolon (`;`), we can assume that the\n // matching was not complete.\n if (\n // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n // yield `null`.\n character.charCodeAt(character.length - 1) === 59 /* `;` */ &&\n value !== 'semi'\n ) {\n return false\n }\n\n // If the decoded string is equal to the input, the character reference was\n // not valid.\n // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n // yield `null`.\n return character === characterReference ? false : character\n}\n","/**\n * Turn the number (in string form as either hexa- or plain decimal) coming from\n * a numeric character reference into a character.\n *\n * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes\n * non-characters and control characters safe.\n *\n * @param {string} value\n * Value to decode.\n * @param {number} base\n * Numeric base.\n * @returns {string}\n * Character.\n */\nexport function decodeNumericCharacterReference(value, base) {\n const code = Number.parseInt(value, base);\n if (\n // C0 except for HT, LF, FF, CR, space.\n code < 9 || code === 11 || code > 13 && code < 32 ||\n // Control character (DEL) of C0, and C1 controls.\n code > 126 && code < 160 ||\n // Lone high surrogates and low surrogates.\n code > 55_295 && code < 57_344 ||\n // Noncharacters.\n code > 64_975 && code < 65_008 || /* eslint-disable no-bitwise */\n (code & 65_535) === 65_535 || (code & 65_535) === 65_534 || /* eslint-enable no-bitwise */\n // Out of range\n code > 1_114_111) {\n return \"\\uFFFD\";\n }\n return String.fromCodePoint(code);\n}","import { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nconst characterEscapeOrReference = /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi;\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * Value to decode.\n * @returns {string}\n * Decoded value.\n */\nexport function decodeString(value) {\n return value.replace(characterEscapeOrReference, decode);\n}\n\n/**\n * @param {string} $0\n * Match.\n * @param {string} $1\n * Character escape.\n * @param {string} $2\n * Character reference.\n * @returns {string}\n * Decoded value\n */\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1;\n }\n\n // Reference.\n const head = $2.charCodeAt(0);\n if (head === 35) {\n const head = $2.charCodeAt(1);\n const hex = head === 120 || head === 88;\n return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);\n }\n return decodeNamedCharacterReference($2) || $0;\n}","/**\n * @import {AssociationId} from '../types.js'\n */\n\nimport {decodeString} from 'micromark-util-decode-string'\n\n/**\n * Get an identifier from an association to match it to others.\n *\n * Associations are nodes that match to something else through an ID:\n * <https://github.com/syntax-tree/mdast#association>.\n *\n * The `label` of an association is the string value: character escapes and\n * references work, and casing is intact.\n * The `identifier` is used to match one association to another:\n * controversially, character escapes and references don’t work in this\n * matching: `©` does not match `©`, and `\\+` does not match `+`.\n *\n * But casing is ignored (and whitespace) is trimmed and collapsed: ` A\\nb`\n * matches `a b`.\n * So, we do prefer the label when figuring out how we’re going to serialize:\n * it has whitespace, casing, and we can ignore most useless character\n * escapes and all character references.\n *\n * @type {AssociationId}\n */\nexport function association(node) {\n if (node.label || !node.identifier) {\n return node.label || ''\n }\n\n return decodeString(node.identifier)\n}\n","/**\n * @import {CompilePattern} from '../types.js'\n */\n\n/**\n * @type {CompilePattern}\n */\nexport function compilePattern(pattern) {\n if (!pattern._compiled) {\n const before =\n (pattern.atBreak ? '[\\\\r\\\\n][\\\\t ]*' : '') +\n (pattern.before ? '(?:' + pattern.before + ')' : '')\n\n pattern._compiled = new RegExp(\n (before ? '(' + before + ')' : '') +\n (/[|\\\\{}()[\\]^$+*?.-]/.test(pattern.character) ? '\\\\' : '') +\n pattern.character +\n (pattern.after ? '(?:' + pattern.after + ')' : ''),\n 'g'\n )\n }\n\n return pattern._compiled\n}\n","/**\n * @import {Handle, Info, State} from 'mdast-util-to-markdown'\n * @import {PhrasingParents} from '../types.js'\n */\n\nimport {encodeCharacterReference} from './encode-character-reference.js'\n\n/**\n * Serialize the children of a parent that contains phrasing children.\n *\n * These children will be joined flush together.\n *\n * @param {PhrasingParents} parent\n * Parent of flow nodes.\n * @param {State} state\n * Info passed around about the current state.\n * @param {Info} info\n * Info on where we are in the document we are generating.\n * @returns {string}\n * Serialized children, joined together.\n */\nexport function containerPhrasing(parent, state, info) {\n const indexStack = state.indexStack\n const children = parent.children || []\n /** @type {Array<string>} */\n const results = []\n let index = -1\n let before = info.before\n /** @type {string | undefined} */\n let encodeAfter\n\n indexStack.push(-1)\n let tracker = state.createTracker(info)\n\n while (++index < children.length) {\n const child = children[index]\n /** @type {string} */\n let after\n\n indexStack[indexStack.length - 1] = index\n\n if (index + 1 < children.length) {\n /** @type {Handle} */\n // @ts-expect-error: hush, it’s actually a `zwitch`.\n let handle = state.handle.handlers[children[index + 1].type]\n /** @type {Handle} */\n // @ts-expect-error: hush, it’s actually a `zwitch`.\n if (handle && handle.peek) handle = handle.peek\n after = handle\n ? handle(children[index + 1], parent, state, {\n before: '',\n after: '',\n ...tracker.current()\n }).charAt(0)\n : ''\n } else {\n after = info.after\n }\n\n // In some cases, html (text) can be found in phrasing right after an eol.\n // When we’d serialize that, in most cases that would be seen as html\n // (flow).\n // As we can’t escape or so to prevent it from happening, we take a somewhat\n // reasonable approach: replace that eol with a space.\n // See: <https://github.com/syntax-tree/mdast-util-to-markdown/issues/15>\n if (\n results.length > 0 &&\n (before === '\\r' || before === '\\n') &&\n child.type === 'html'\n ) {\n results[results.length - 1] = results[results.length - 1].replace(\n /(\\r?\\n|\\r)$/,\n ' '\n )\n before = ' '\n\n // To do: does this work to reset tracker?\n tracker = state.createTracker(info)\n tracker.move(results.join(''))\n }\n\n let value = state.handle(child, parent, state, {\n ...tracker.current(),\n after,\n before\n })\n\n // If we had to encode the first character after the previous node and it’s\n // still the same character,\n // encode it.\n if (encodeAfter && encodeAfter === value.slice(0, 1)) {\n value =\n encodeCharacterReference(encodeAfter.charCodeAt(0)) + value.slice(1)\n }\n\n const encodingInfo = state.attentionEncodeSurroundingInfo\n state.attentionEncodeSurroundingInfo = undefined\n encodeAfter = undefined\n\n // If we have to encode the first character before the current node and\n // it’s still the same character,\n // encode it.\n if (encodingInfo) {\n if (\n results.length > 0 &&\n encodingInfo.before &&\n before === results[results.length - 1].slice(-1)\n ) {\n results[results.length - 1] =\n results[results.length - 1].slice(0, -1) +\n encodeCharacterReference(before.charCodeAt(0))\n }\n\n if (encodingInfo.after) encodeAfter = after\n }\n\n tracker.move(value)\n results.push(value)\n before = value.slice(-1)\n }\n\n indexStack.pop()\n\n return results.join('')\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {FlowChildren, FlowParents, TrackFields} from '../types.js'\n */\n\n/**\n * @param {FlowParents} parent\n * Parent of flow nodes.\n * @param {State} state\n * Info passed around about the current state.\n * @param {TrackFields} info\n * Info on where we are in the document we are generating.\n * @returns {string}\n * Serialized children, joined by (blank) lines.\n */\nexport function containerFlow(parent, state, info) {\n const indexStack = state.indexStack\n const children = parent.children || []\n const tracker = state.createTracker(info)\n /** @type {Array<string>} */\n const results = []\n let index = -1\n\n indexStack.push(-1)\n\n while (++index < children.length) {\n const child = children[index]\n\n indexStack[indexStack.length - 1] = index\n\n results.push(\n tracker.move(\n state.handle(child, parent, state, {\n before: '\\n',\n after: '\\n',\n ...tracker.current()\n })\n )\n )\n\n if (child.type !== 'list') {\n state.bulletLastUsed = undefined\n }\n\n if (index < children.length - 1) {\n results.push(\n tracker.move(between(child, children[index + 1], parent, state))\n )\n }\n }\n\n indexStack.pop()\n\n return results.join('')\n}\n\n/**\n * @param {FlowChildren} left\n * @param {FlowChildren} right\n * @param {FlowParents} parent\n * @param {State} state\n * @returns {string}\n */\nfunction between(left, right, parent, state) {\n let index = state.join.length\n\n while (index--) {\n const result = state.join[index](left, right, parent, state)\n\n if (result === true || result === 1) {\n break\n }\n\n if (typeof result === 'number') {\n return '\\n'.repeat(1 + result)\n }\n\n if (result === false) {\n return '\\n\\n<!---->\\n\\n'\n }\n }\n\n return '\\n\\n'\n}\n","/**\n * @import {IndentLines} from '../types.js'\n */\n\nconst eol = /\\r?\\n|\\r/g\n\n/**\n * @type {IndentLines}\n */\nexport function indentLines(value, map) {\n /** @type {Array<string>} */\n const result = []\n let start = 0\n let line = 0\n /** @type {RegExpExecArray | null} */\n let match\n\n while ((match = eol.exec(value))) {\n one(value.slice(start, match.index))\n result.push(match[0])\n start = match.index + match[0].length\n line++\n }\n\n one(value.slice(start))\n\n return result.join('')\n\n /**\n * @param {string} value\n */\n function one(value) {\n result.push(map(value, line, !value))\n }\n}\n","/**\n * @import {SafeConfig, State} from 'mdast-util-to-markdown'\n */\n\nimport {encodeCharacterReference} from './encode-character-reference.js'\nimport {patternInScope} from './pattern-in-scope.js'\n\n/**\n * Make a string safe for embedding in markdown constructs.\n *\n * In markdown, almost all punctuation characters can, in certain cases,\n * result in something.\n * Whether they do is highly subjective to where they happen and in what\n * they happen.\n *\n * To solve this, `mdast-util-to-markdown` tracks:\n *\n * * Characters before and after something;\n * * What “constructs” we are in.\n *\n * This information is then used by this function to escape or encode\n * special characters.\n *\n * @param {State} state\n * Info passed around about the current state.\n * @param {string | null | undefined} input\n * Raw value to make safe.\n * @param {SafeConfig} config\n * Configuration.\n * @returns {string}\n * Serialized markdown safe for embedding.\n */\nexport function safe(state, input, config) {\n const value = (config.before || '') + (input || '') + (config.after || '')\n /** @type {Array<number>} */\n const positions = []\n /** @type {Array<string>} */\n const result = []\n /** @type {Record<number, {before: boolean, after: boolean}>} */\n const infos = {}\n let index = -1\n\n while (++index < state.unsafe.length) {\n const pattern = state.unsafe[index]\n\n if (!patternInScope(state.stack, pattern)) {\n continue\n }\n\n const expression = state.compilePattern(pattern)\n /** @type {RegExpExecArray | null} */\n let match\n\n while ((match = expression.exec(value))) {\n const before = 'before' in pattern || Boolean(pattern.atBreak)\n const after = 'after' in pattern\n const position = match.index + (before ? match[1].length : 0)\n\n if (positions.includes(position)) {\n if (infos[position].before && !before) {\n infos[position].before = false\n }\n\n if (infos[position].after && !after) {\n infos[position].after = false\n }\n } else {\n positions.push(position)\n infos[position] = {before, after}\n }\n }\n }\n\n positions.sort(numerical)\n\n let start = config.before ? config.before.length : 0\n const end = value.length - (config.after ? config.after.length : 0)\n index = -1\n\n while (++index < positions.length) {\n const position = positions[index]\n\n // Character before or after matched:\n if (position < start || position >= end) {\n continue\n }\n\n // If this character is supposed to be escaped because it has a condition on\n // the next character, and the next character is definitly being escaped,\n // then skip this escape.\n if (\n (position + 1 < end &&\n positions[index + 1] === position + 1 &&\n infos[position].after &&\n !infos[position + 1].before &&\n !infos[position + 1].after) ||\n (positions[index - 1] === position - 1 &&\n infos[position].before &&\n !infos[position - 1].before &&\n !infos[position - 1].after)\n ) {\n continue\n }\n\n if (start !== position) {\n // If we have to use a character reference, an ampersand would be more\n // correct, but as backslashes only care about punctuation, either will\n // do the trick\n result.push(escapeBackslashes(value.slice(start, position), '\\\\'))\n }\n\n start = position\n\n if (\n /[!-/:-@[-`{-~]/.test(value.charAt(position)) &&\n (!config.encode || !config.encode.includes(value.charAt(position)))\n ) {\n // Character escape.\n result.push('\\\\')\n } else {\n // Character reference.\n result.push(encodeCharacterReference(value.charCodeAt(position)))\n start++\n }\n }\n\n result.push(escapeBackslashes(value.slice(start, end), config.after))\n\n return result.join('')\n}\n\n/**\n * @param {number} a\n * @param {number} b\n * @returns {number}\n */\nfunction numerical(a, b) {\n return a - b\n}\n\n/**\n * @param {string} value\n * @param {string} after\n * @returns {string}\n */\nfunction escapeBackslashes(value, after) {\n const expression = /\\\\(?=[!-/:-@[-`{-~])/g\n /** @type {Array<number>} */\n const positions = []\n /** @type {Array<string>} */\n const results = []\n const whole = value + after\n let index = -1\n let start = 0\n /** @type {RegExpExecArray | null} */\n let match\n\n while ((match = expression.exec(whole))) {\n positions.push(match.index)\n }\n\n while (++index < positions.length) {\n if (start !== positions[index]) {\n results.push(value.slice(start, positions[index]))\n }\n\n results.push('\\\\')\n start = positions[index]\n }\n\n results.push(value.slice(start))\n\n return results.join('')\n}\n","/**\n * @import {CreateTracker, TrackCurrent, TrackMove, TrackShift} from '../types.js'\n */\n\n/**\n * Track positional info in the output.\n *\n * @type {CreateTracker}\n */\nexport function track(config) {\n // Defaults are used to prevent crashes when older utilities somehow activate\n // this code.\n /* c8 ignore next 5 */\n const options = config || {}\n const now = options.now || {}\n let lineShift = options.lineShift || 0\n let line = now.line || 1\n let column = now.column || 1\n\n return {move, current, shift}\n\n /**\n * Get the current tracked info.\n *\n * @type {TrackCurrent}\n */\n function current() {\n return {now: {line, column}, lineShift}\n }\n\n /**\n * Define an increased line shift (the typical indent for lines).\n *\n * @type {TrackShift}\n */\n function shift(value) {\n lineShift += value\n }\n\n /**\n * Move past some generated markdown.\n *\n * @type {TrackMove}\n */\n function move(input) {\n // eslint-disable-next-line unicorn/prefer-default-parameters\n const value = input || ''\n const chunks = value.split(/\\r?\\n|\\r/g)\n const tail = chunks[chunks.length - 1]\n line += chunks.length - 1\n column =\n chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift\n return value\n }\n}\n","/**\n * @import {Info, Join, Options, SafeConfig, State} from 'mdast-util-to-markdown'\n * @import {Nodes} from 'mdast'\n * @import {Enter, FlowParents, PhrasingParents, TrackFields} from './types.js'\n */\n\nimport {zwitch} from 'zwitch'\nimport {configure} from './configure.js'\nimport {handle as handlers} from './handle/index.js'\nimport {join} from './join.js'\nimport {unsafe} from './unsafe.js'\nimport {association} from './util/association.js'\nimport {compilePattern} from './util/compile-pattern.js'\nimport {containerPhrasing} from './util/container-phrasing.js'\nimport {containerFlow} from './util/container-flow.js'\nimport {indentLines} from './util/indent-lines.js'\nimport {safe} from './util/safe.js'\nimport {track} from './util/track.js'\n\n/**\n * Turn an mdast syntax tree into markdown.\n *\n * @param {Nodes} tree\n * Tree to serialize.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized markdown representing `tree`.\n */\nexport function toMarkdown(tree, options) {\n const settings = options || {}\n /** @type {State} */\n const state = {\n associationId: association,\n containerPhrasing: containerPhrasingBound,\n containerFlow: containerFlowBound,\n createTracker: track,\n compilePattern,\n enter,\n // @ts-expect-error: GFM / frontmatter are typed in `mdast` but not defined\n // here.\n handlers: {...handlers},\n // @ts-expect-error: add `handle` in a second.\n handle: undefined,\n indentLines,\n indexStack: [],\n join: [...join],\n options: {},\n safe: safeBound,\n stack: [],\n unsafe: [...unsafe]\n }\n\n configure(state, settings)\n\n if (state.options.tightDefinitions) {\n state.join.push(joinDefinition)\n }\n\n state.handle = zwitch('type', {\n invalid,\n unknown,\n handlers: state.handlers\n })\n\n let result = state.handle(tree, undefined, state, {\n before: '\\n',\n after: '\\n',\n now: {line: 1, column: 1},\n lineShift: 0\n })\n\n if (\n result &&\n result.charCodeAt(result.length - 1) !== 10 &&\n result.charCodeAt(result.length - 1) !== 13\n ) {\n result += '\\n'\n }\n\n return result\n\n /** @type {Enter} */\n function enter(name) {\n state.stack.push(name)\n return exit\n\n /**\n * @returns {undefined}\n */\n function exit() {\n state.stack.pop()\n }\n }\n}\n\n/**\n * @param {unknown} value\n * @returns {never}\n */\nfunction invalid(value) {\n throw new Error('Cannot handle value `' + value + '`, expected node')\n}\n\n/**\n * @param {unknown} value\n * @returns {never}\n */\nfunction unknown(value) {\n // Always a node.\n const node = /** @type {Nodes} */ (value)\n throw new Error('Cannot handle unknown node `' + node.type + '`')\n}\n\n/** @type {Join} */\nfunction joinDefinition(left, right) {\n // No blank line between adjacent definitions.\n if (left.type === 'definition' && left.type === right.type) {\n return 0\n }\n}\n\n/**\n * Serialize the children of a parent that contains phrasing children.\n *\n * These children will be joined flush together.\n *\n * @this {State}\n * Info passed around about the current state.\n * @param {PhrasingParents} parent\n * Parent of flow nodes.\n * @param {Info} info\n * Info on where we are in the document we are generating.\n * @returns {string}\n * Serialized children, joined together.\n */\nfunction containerPhrasingBound(parent, info) {\n return containerPhrasing(parent, this, info)\n}\n\n/**\n * Serialize the children of a parent that contains flow children.\n *\n * These children will typically be joined by blank lines.\n * What they are joined by exactly is defined by `Join` functions.\n *\n * @this {State}\n * Info passed around about the current state.\n * @param {FlowParents} parent\n * Parent of flow nodes.\n * @param {TrackFields} info\n * Info on where we are in the document we are generating.\n * @returns {string}\n * Serialized children, joined by (blank) lines.\n */\nfunction containerFlowBound(parent, info) {\n return containerFlow(parent, this, info)\n}\n\n/**\n * Make a string safe for embedding in markdown constructs.\n *\n * In markdown, almost all punctuation characters can, in certain cases,\n * result in something.\n * Whether they do is highly subjective to where they happen and in what\n * they happen.\n *\n * To solve this, `mdast-util-to-markdown` tracks:\n *\n * * Characters before and after something;\n * * What “constructs” we are in.\n *\n * This information is then used by this function to escape or encode\n * special characters.\n *\n * @this {State}\n * Info passed around about the current state.\n * @param {string | null | undefined} value\n * Raw value to make safe.\n * @param {SafeConfig} config\n * Configuration.\n * @returns {string}\n * Serialized markdown safe for embedding.\n */\nfunction safeBound(value, config) {\n return safe(this, value, config)\n}\n","/**\n * @import {CompileContext, Extension as FromMarkdownExtension, Handle as FromMarkdownHandle} from 'mdast-util-from-markdown'\n * @import {MdxFlowExpression, MdxTextExpression} from 'mdast-util-mdx-expression'\n * @import {Handle as ToMarkdownHandle, Options as ToMarkdownExtension, State} from 'mdast-util-to-markdown'\n * @import {Parents} from 'mdast'\n */\n\nimport {ok as assert} from 'devlop'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable MDX expressions\n * in markdown.\n *\n * When using the micromark syntax extension with `addResult`, nodes will have\n * a `data.estree` field set to an ESTree `Program` node.\n *\n * @returns {FromMarkdownExtension}\n * Extension for `mdast-util-from-markdown` to enable MDX expressions.\n */\nexport function mdxExpressionFromMarkdown() {\n return {\n enter: {\n mdxFlowExpression: enterMdxFlowExpression,\n mdxTextExpression: enterMdxTextExpression\n },\n exit: {\n mdxFlowExpression: exitMdxExpression,\n mdxFlowExpressionChunk: exitMdxExpressionData,\n mdxTextExpression: exitMdxExpression,\n mdxTextExpressionChunk: exitMdxExpressionData\n }\n }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable MDX expressions\n * in markdown.\n *\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable MDX expressions.\n */\nexport function mdxExpressionToMarkdown() {\n return {\n handlers: {\n mdxFlowExpression: handleMdxExpression,\n mdxTextExpression: handleMdxExpression\n },\n unsafe: [\n {character: '{', inConstruct: ['phrasing']},\n {atBreak: true, character: '{'}\n ]\n }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterMdxFlowExpression(token) {\n this.enter({type: 'mdxFlowExpression', value: ''}, token)\n this.buffer()\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterMdxTextExpression(token) {\n this.enter({type: 'mdxTextExpression', value: ''}, token)\n this.buffer()\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitMdxExpression(token) {\n const value = this.resume()\n const estree = token.estree\n const node = this.stack[this.stack.length - 1]\n assert(node.type === 'mdxFlowExpression' || node.type === 'mdxTextExpression')\n this.exit(token)\n node.value = value\n\n if (estree) {\n node.data = {estree}\n }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitMdxExpressionData(token) {\n this.config.enter.data.call(this, token)\n this.config.exit.data.call(this, token)\n}\n\n/**\n * @type {ToMarkdownHandle}\n * @param {MdxFlowExpression | MdxTextExpression} node\n * Node.\n * @param {Parents | undefined} parent\n * Parent, if any.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {string}\n * Serialized markdown.\n */\nfunction handleMdxExpression(node, parent, state) {\n const value = node.value || ''\n const result = state.indentLines(value, function (line, index, blank) {\n // Tab-size to eat has to be the same as what we serialize as.\n // While in some places in markdown that’s 4, in JS it’s more common as 2.\n // Which is what’s also in `mdast-util-mdx-jsx`:\n // <https://github.com/syntax-tree/mdast-util-mdx-jsx/blob/40b951b/lib/index.js#L52>\n return (index === 0 || blank ? '' : ' ') + line\n })\n return '{' + result + '}'\n}\n","/**\n * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext\n * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension\n * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle\n *\n * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension\n *\n * @typedef {import('../index.js').MdxjsEsm} MdxjsEsm\n */\n\n// To do: next major: expose functions.\nimport {ok as assert} from 'devlop'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable MDX.js ESM in\n * markdown.\n *\n * When using the micromark syntax extension with `addResult`, nodes will have\n * a `data.estree` field set to an ESTree [`Program`][program] node.\n *\n * @returns {FromMarkdownExtension}\n * Extension for `mdast-util-from-markdown` to enable MDX.js ESM.\n */\nexport function mdxjsEsmFromMarkdown() {\n return {\n enter: {mdxjsEsm: enterMdxjsEsm},\n exit: {mdxjsEsm: exitMdxjsEsm, mdxjsEsmData: exitMdxjsEsmData}\n }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable MDX.js ESM in\n * markdown.\n *\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable MDX.js ESM.\n */\nexport function mdxjsEsmToMarkdown() {\n return {handlers: {mdxjsEsm: handleMdxjsEsm}}\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterMdxjsEsm(token) {\n this.enter({type: 'mdxjsEsm', value: ''}, token)\n this.buffer() // Capture EOLs\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitMdxjsEsm(token) {\n const value = this.resume()\n const node = this.stack[this.stack.length - 1]\n assert(node.type === 'mdxjsEsm')\n\n this.exit(token)\n\n const estree = token.estree\n\n node.value = value\n\n if (estree) {\n node.data = {estree}\n }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitMdxjsEsmData(token) {\n this.config.enter.data.call(this, token)\n this.config.exit.data.call(this, token)\n}\n\n/**\n * @type {ToMarkdownHandle}\n * @param {MdxjsEsm} node\n */\nfunction handleMdxjsEsm(node) {\n return node.value || ''\n}\n","/**\n * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension\n * @typedef {import('mdast-util-mdx-jsx').ToMarkdownOptions} ToMarkdownOptions\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension\n */\n\nimport {\n mdxExpressionFromMarkdown,\n mdxExpressionToMarkdown\n} from 'mdast-util-mdx-expression'\nimport {mdxJsxFromMarkdown, mdxJsxToMarkdown} from 'mdast-util-mdx-jsx'\nimport {mdxjsEsmFromMarkdown, mdxjsEsmToMarkdown} from 'mdast-util-mdxjs-esm'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable MDX (ESM, JSX,\n * expressions).\n *\n * @returns {Array<FromMarkdownExtension>}\n * Extension for `mdast-util-from-markdown` to enable MDX (ESM, JSX,\n * expressions).\n *\n * When using the syntax extensions with `addResult`, ESM and expression\n * nodes will have `data.estree` fields set to ESTree `Program` node.\n */\nexport function mdxFromMarkdown() {\n return [\n mdxExpressionFromMarkdown(),\n mdxJsxFromMarkdown(),\n mdxjsEsmFromMarkdown()\n ]\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable MDX (ESM, JSX,\n * expressions).\n *\n * @param {ToMarkdownOptions | null | undefined} [options]\n * Configuration (optional).\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable MDX (ESM, JSX,\n * expressions).\n */\nexport function mdxToMarkdown(options) {\n return {\n extensions: [\n mdxExpressionToMarkdown(),\n mdxJsxToMarkdown(options),\n mdxjsEsmToMarkdown()\n ]\n }\n}\n","export const extractImports = (ast) => {\n const imports: any = [];\n const visit = (node, parent, index) => {\n // If it's a text node with 'import' in its value\n if (\n node.type === 'text' &&\n node.value &&\n node.value.includes('import') &&\n node.value.includes('from')\n ) {\n if (\n parent &&\n Array.isArray(parent.children) &&\n typeof index === 'number'\n ) {\n // Remove the node from its original position\n parent.children.splice(index, 1);\n // Wrap it in a paragraph or keep as-is depending on your use case\n imports.push({\n type: 'paragraph',\n children: [node],\n });\n return; // Skip deeper recursion into removed node\n }\n }\n\n // Recurse through children if they exist\n if (node.children && Array.isArray(node.children)) {\n // Copy to avoid mutation issues when removing nodes\n const childrenCopy = [...node.children];\n for (let i = 0; i < childrenCopy.length; i++) {\n visit(childrenCopy[i], node, i);\n }\n }\n };\n\n visit(ast, null, null);\n\n // Prepend extracted imports to top-level children\n if (ast.type === 'root' && Array.isArray(ast.children)) {\n ast.children = [...imports, ...ast.children];\n }\n\n return ast;\n};\n","export const wrapComponent = (mdastChild) => {\n const generatedProps = mdastChild.attributes.reduce((acc, item) => {\n acc[item.name] = item.value;\n return acc;\n }, {});\n\n const wrappedComponent = {\n type: 'mdxJsxFlowElement',\n name: 'Figure',\n attributes: [],\n children: [\n { ...mdastChild },\n {\n type: 'mdxJsxFlowElement',\n name: 'Caption',\n attributes: [\n { name: 'attrAuthor', value: generatedProps.attrAuthor },\n { name: 'attrUrl', value: generatedProps.attrUrl },\n ],\n children: [{ type: 'text', value: generatedProps.caption }],\n },\n ],\n };\n return wrappedComponent;\n};\n","import { wrapComponent } from './wrapComponent';\n\nexport const handleTwoColumn = (MDAST) => {\n const newTwoColumn: any = [];\n for (const twoColumnChildren of MDAST.children) {\n if (\n twoColumnChildren.children.some(\n (e) => e.name === 'Chart' || e.name === 'Map',\n )\n ) {\n for (const columnChild of twoColumnChildren.children) {\n if (columnChild.name === 'Chart' || columnChild.name === 'Map') {\n newTwoColumn.push(wrapComponent(columnChild));\n }\n }\n } else {\n newTwoColumn.push({\n type: 'mdxJsxFlowElement',\n name: 'Prose',\n attributes: [],\n children: [...twoColumnChildren.children],\n });\n }\n }\n return newTwoColumn;\n};\n","import { handleTwoColumn } from './parseTwoColumn';\nimport { wrapComponent } from './wrapComponent';\n\nexport const groupByBreakIntoBlocks = (ast) => {\n const result: any = [];\n const proseWrapper = (children) => {\n return {\n type: 'mdxJsxFlowElement',\n name: 'Prose',\n children: [...children],\n };\n };\n\n const groupChildren = (children) => {\n const groups: any = [];\n let currentGroup: any = [];\n\n for (const child of children) {\n if (\n child.type === 'mdxJsxTextElement' ||\n child.type === 'mdxJsxFlowElement'\n ) {\n if (child.name === 'Break') {\n if (currentGroup.length > 0) {\n groups.push([proseWrapper(currentGroup)]);\n currentGroup = [];\n }\n } else if (\n child.name === 'Block' ||\n child.name === 'Chart' ||\n child.name === 'Map' ||\n child.name === 'MapBlock' || \n child.name === 'TwoColumn'\n ) {\n groups.push([proseWrapper(currentGroup)]);\n\n if (child.name === 'Chart' || child.name === 'Map') {\n groups.push([wrapComponent(child)]);\n } else if (child.name === 'TwoColumn') {\n const parsedColumn = handleTwoColumn(child);\n groups.push(parsedColumn);\n }\n currentGroup = [];\n }\n } else {\n currentGroup.push(child);\n }\n }\n\n if (currentGroup.length > 0) {\n groups.push([...currentGroup]);\n }\n return groups;\n };\n\n if (ast.type === 'root' && Array.isArray(ast.children)) {\n const groups = groupChildren(ast.children);\n\n for (const group of groups) {\n // Check for prose wrapper inside group If no prose wrapper\n // then wrap group inside prose object before adding to block element\n\n if (\n group.some((item) => {\n return item.name === 'Prose';\n })\n ) {\n result.push({\n type: 'mdxJsxFlowElement',\n name: 'Block',\n children: [...group],\n });\n } else {\n result.push({\n type: 'mdxJsxFlowElement',\n name: 'Block',\n children: [\n {\n type: 'mdxJsxFlowElement',\n name: 'Prose',\n children: [...group],\n },\n ],\n });\n }\n }\n }\n\n return result;\n};\n","import { toMarkdown } from 'mdast-util-to-markdown';\nimport { mdxToMarkdown } from 'mdast-util-mdx';\nimport { gfmToMarkdown } from 'mdast-util-gfm';\nimport { mdxJsxToMarkdown } from 'mdast-util-mdx-jsx';\nimport { extractImports } from './extractImports';\n\nimport { groupByBreakIntoBlocks } from './groupElements';\n\nconst blockItem = {\n type: 'mdxJsxFlowElement',\n name: 'Block',\n children: [],\n};\n\nconst proseItem = {\n type: 'mdxJsxFlowElement',\n name: 'Prose',\n children: [],\n};\n\n//TO DO: Create seperate block prose containers\n\nconst transformMdast = (node) => {\n // if (!node || typeof node !== 'object') return node;\n if (!node || node.type !== 'root' || !Array.isArray(node.children)) {\n return node;\n }\n // if (node.type === 'root') {\n // const newChildren: any = [];\n const newChildren: any[] = [];\n for (const child of node.children) {\n // Unwrap paragraphs that only contain a single JSX flow element.\n // This is a common pattern to avoid unwanted <p> tags around components.\n if (\n child.type === 'paragraph' &&\n child.children.length === 1 &&\n child.children[0].type === 'mdxJsxFlowElement'\n ) {\n newChildren.push(child.children[0]);\n } else {\n newChildren.push(child);\n }\n }\n\n // for (const child of node.children) {\n // if (child.type === 'paragraph') {\n // // Elevate each text/html child to the root\n // for (const sub of child.children) {\n // switch (sub.type) {\n // case 'text':\n // newChildren.push({\n // type: 'paragraph',\n // children: [sub],\n // });\n // break;\n // case 'html':\n // newChildren.push(sub);\n // break;\n // case 'mdxJsxTextElement':\n // newChildren.push(sub);\n // break;\n // case 'mdxJsxFlowElement':\n // newChildren.push(sub);\n // break;\n // default:\n // newChildren.push(sub);\n // break;\n // }\n // }\n // } else {\n // // Recurse into child\n // const transformed = transformMdast(child);\n // newChildren.push(transformed);\n // }\n // }\n\n // return { ...node, children: newChildren };\n // }\n\n // // Handle recursion for non-root nodes with children\n // if (Array.isArray(node.children)) {\n // return {\n // ...node,\n // children: node.children.map(transformMdast),\n // };\n // }\n\n // return node;\n return { ...node, children: newChildren };\n};\n\nexport const reserializedMdxContent = (MDAST) => {\n\n const seperatedMDAST = transformMdast(MDAST);\n\n const groupedMDSAT = groupByBreakIntoBlocks(seperatedMDAST);\n extractImports(seperatedMDAST);\n\n const newMDast = { ...seperatedMDAST, children: groupedMDSAT };\n const mdastToMdx = (mdast) => {\n return toMarkdown(mdast, {\n extensions: [mdxToMarkdown(), gfmToMarkdown(), mdxJsxToMarkdown()],\n });\n };\n\n return mdastToMdx(newMDast);\n};\n","'use client';\n\nimport React, { createContext, useContext } from 'react';\nimport { LexicalEditor, LexicalNode } from 'lexical';\n\ninterface ChartContextValue {\n parentEditor: LexicalEditor;\n lexicalNode: LexicalNode;\n}\n\nconst ChartContext = createContext<ChartContextValue | null>(null);\n\nexport const ChartContextProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: ChartContextValue;\n}) => {\n return <ChartContext.Provider value={value}>{children}</ChartContext.Provider>;\n};\n\nexport const useChartContext = () => {\n const context = useContext(ChartContext);\n if (!context) {\n throw new Error('useChartContext must be used within a ChartContextProvider');\n }\n return context;\n};","'use client';\n\nimport React, { createContext, useContext } from 'react';\nimport { LexicalEditor, LexicalNode } from 'lexical';\n\ninterface MapContextValue {\n parentEditor: LexicalEditor;\n lexicalNode: LexicalNode;\n}\n\nconst MapContext = createContext<MapContextValue | null>(null);\n\nexport const MapContextProvider = ({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: MapContextValue;\n}) => {\n return <MapContext.Provider value={value}>{children}</MapContext.Provider>;\n};\n\nexport const useMapContext = () => {\n const context = useContext(MapContext);\n if (!context) {\n throw new Error('useMapContext must be used within a MapContextProvider');\n }\n return context;\n};\n","export const inputValidation = () => {};\n\nexport const dateStringToregex = (format) => {\n const tokens = {\n '%d': '(0[1-9]|[12][0-9]|3[01])',\n '%m': '(0[1-9]|1[0-2])',\n '%Y': '\\\\d{4}',\n '%y': '\\\\d{2}',\n '%H': '([01][0-9]|2[0-3])',\n '%M': '([0-5][0-9])',\n '%S': '([0-5][0-9])',\n };\n\n const escape = (s) => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n let pattern = '';\n\n for (let i = 0; i < format.length; i++) {\n if (format[i] === '%' && i < format.length - 1) {\n const directive = format[i] + format[i + 1];\n pattern += tokens[directive] || escape(directive); // unknown: treat literally\n i++; // skip the directive's second char\n } else {\n pattern += escape(format[i]);\n }\n }\n\n return new RegExp(`^${pattern}$`);\n};\n\nexport const dateFormatValidation = (format, input) => {\n const regexToTest = dateStringToregex(format);\n\n //return false no errors if regex passes, return true there are erros if fails\n return regexToTest.test(input) ? false : true;\n};\n\nexport const handleChartDateValidation = (\n propName,\n draftInputs,\n setInputErrors,\n inputErrors,\n draft,\n onChange,\n chartProps,\n) => {\n if (propName === 'highlightStart' || propName === 'highlightEnd') {\n if (dateFormatValidation(draftInputs.draftDateFormat, draft) === false) {\n setInputErrors({\n highlightStart: dateFormatValidation(\n draftInputs.draftDateFormat,\n draftInputs.draftHighlightStart,\n ),\n highlightEnd: dateFormatValidation(\n draftInputs.draftDateFormat,\n draftInputs.draftHighlightEnd,\n ),\n });\n if (\n inputErrors.highlightStart == false &&\n inputErrors.highlightEnd == false\n ) {\n onChange({\n ...chartProps,\n dateFormat: draftInputs.draftDateFormat,\n highlightStart: draftInputs.draftHighlightStart,\n highlightEnd: draftInputs.draftHighlightEnd,\n });\n }\n } else {\n setInputErrors({\n highlightStart: dateFormatValidation(\n draftInputs.draftDateFormat,\n draftInputs.draftHighlightStart,\n ),\n highlightEnd: dateFormatValidation(\n draftInputs.draftDateFormat,\n draftInputs.draftHighlightEnd,\n ),\n });\n }\n } else if (propName === 'dateFormat') {\n setInputErrors({\n highlightStart: dateFormatValidation(draft, chartProps.highlightStart),\n highlightEnd: dateFormatValidation(draft, chartProps.highlightEnd),\n });\n } else if (\n inputErrors.highlightStart == false &&\n inputErrors.highlightEnd == false\n ) {\n onChange({\n ...chartProps,\n dateFormat: draftInputs.draftDateFormat,\n highlightStart: draftInputs.draftHighlightStart,\n highlightEnd: draftInputs.draftHighlightEnd,\n });\n }\n};\nexport const handleMapDateValidation = (\n propName,\n draftInputs,\n inputErrors,\n setInputErrors,\n draft,\n onChange,\n componentProps,\n) => {\n if (\n dateFormatValidation(draftInputs.defaultDateFormat, draft) === false ||\n draft === ''\n ) {\n setInputErrors({ ...inputErrors, [propName]: false });\n onChange({ ...componentProps, [propName]: draft });\n } else {\n setInputErrors({ ...inputErrors, [propName]: true });\n }\n};\n\nexport const handleMapArrayValidation = (\n propName,\n draftInputs,\n inputErrors,\n setInputErrors,\n draft,\n onChange,\n componentProps,\n) => {\n const numberPattern =\n /^\\[[+-]?(0|[1-9][0-9]*)(\\.[0-9]+)?(?:,\\s*[+-]?(0|[1-9][0-9]*)(\\.[0-9]+)?)*\\]$/;\n //This regex checks that the input is wrapped in [...]\n //Checks for no trailing decimal points ex: -91.\n //Checks that there is no leading 0 unless followed by a . ex 0.12 or 0 are acceptable\n const cleanedDraft = draft.replace(/\\s/g, '');\n if (numberPattern.test(cleanedDraft)) {\n const parsedValues = JSON.parse(cleanedDraft);\n const checkLong = (long) => (long <= 180 && long >= -180 ? true : false);\n const checkLat = (lat) => (lat <= 90 && lat >= -90 ? true : false);\n //validating upper and lower limits of long and lat\n if (checkLong(parsedValues[0]) && checkLat(parsedValues[1])) {\n setInputErrors({ ...inputErrors, [propName]: false });\n onChange({ ...componentProps, [propName]: draft });\n } else {\n setInputErrors({ ...inputErrors, [propName]: true });\n }\n } else {\n setInputErrors({ ...inputErrors, [propName]: true });\n }\n};\n","'use client';\n\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport {\n TextInput,\n TextInputMask,\n Textarea,\n Label,\n DatePicker,\n Checkbox,\n Select,\n} from '@trussworks/react-uswds';\nimport {\n handleMapDateValidation,\n handleMapArrayValidation,\n handleChartDateValidation,\n} from './inputValidation';\n\ninterface FieldProps {\n fieldName: string;\n value: string;\n hint?: string;\n onChange: (value: string) => void;\n isRequired?: boolean;\n isDate?: boolean;\n numeric?: boolean;\n onBlur?: (value: string) => void;\n onFocus?: (value: string) => void;\n type?: string;\n componentProps: any;\n propName: string;\n customClass?: string;\n placeHolder?: string;\n draftInputs?: any;\n inputErrors?: any;\n setDraftInputs?: (value: any) => void;\n setInputErrors?: (value: any) => void;\n options?: string[];\n}\nconst checkRequired = (isRequired, value) => {\n return isRequired && !value ? { validationStatus: 'error' } : '';\n};\n\nconst colorSchemes = [\n 'Blues',\n 'Greens',\n 'Greys',\n 'Oranges',\n 'Purples',\n 'Reds',\n 'Turbo',\n 'Viridis',\n 'Inferno',\n 'Magma',\n 'Plasma',\n 'Cividis',\n 'Warm',\n 'Cool',\n 'CubehelixDefault',\n];\n\nconst setInput = (props) => {\n const {\n value,\n isRequired,\n type,\n fieldName,\n hint,\n onChange,\n componentProps,\n propName,\n placeHolder,\n validateAgainst,\n draftInputs,\n setDraftInputs,\n inputErrors,\n setInputErrors,\n options,\n } = props;\n\nif (options && Array.isArray(options)) {\n return (\n <>\n <Label htmlFor={propName} className='margin-top-2'>\n {fieldName}\n </Label>\n <span className='usa-hint'>{hint}</span>\n <Select\n id={propName}\n name={propName}\n value={value}\n onChange={(e) =>\n onChange({ ...componentProps, [propName]: e.target.value })\n }\n {...checkRequired(isRequired, value)}\n >\n <option value=''>- Select option -</option>\n {options.map((option) => {\n // Check if option is a string or an object with value/label\n const value = typeof option === 'object' ? option.value : option;\n const label = typeof option === 'object' ? option.label : option;\n\n return (\n <option key={value} value={value}>\n {label}\n </option>\n );\n })}\n </Select>\n </>\n );\n }\n\n const cleanedType = type !== undefined && type.toLowerCase();\n\n const [draft, setDraft] = useState(value);\n\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n\n if (propName === 'dateFormat' && draft != draftInputs.draftDateFormat) {\n setDraftInputs({ ...draftInputs, draftDateFormat: draft });\n }\n if (\n propName === 'highlightStart' &&\n draft != draftInputs.draftHighlightStart\n ) {\n setDraftInputs({ ...draftInputs, draftHighlightStart: draft });\n }\n if (propName === 'highlightEnd' && draft != draftInputs.draftHighlightEnd) {\n setDraftInputs({ ...draftInputs, draftHighlightEnd: draft });\n }\n clearTimeout(timeoutRef.current);\n timeoutRef.current = setTimeout(() => {\n\n if (validateAgainst) {\n if (\n propName === 'dateFormat' ||\n propName === 'highlightStart' ||\n propName === 'highlightEnd'\n ) {\n handleChartDateValidation(\n propName,\n draftInputs,\n setInputErrors,\n inputErrors,\n draft,\n onChange,\n componentProps,\n );\n } else if (validateAgainst === 'defaultDateFormat') {\n handleMapDateValidation(\n propName,\n draftInputs,\n inputErrors,\n setInputErrors,\n draft,\n onChange,\n componentProps,\n );\n } else if (validateAgainst === 'centerFormat') {\n handleMapArrayValidation(\n propName,\n draftInputs,\n inputErrors,\n setInputErrors,\n draft,\n onChange,\n componentProps,\n );\n } else {\n onChange({ ...componentProps, [propName]: draft });\n }\n }\n }, 400);\n\n return () => clearTimeout(timeoutRef.current);\n }, [draft, draftInputs]);\n\n //Format date and submitted dates need to work or else the chart will throw an error.\n\n switch (cleanedType) {\n case 'date':\n return (\n //CHORE: Need to clean up or delete\n <>\n <Label htmlFor='input-type-text' className='margin-top-2'>\n {fieldName}\n </Label>\n\n <span className='usa-hint'>{hint}</span>\n\n <DatePicker\n defaultValue={value}\n onChange={(e) => console.log('DatePicker', e)}\n {...checkRequired(isRequired, value)}\n />\n </>\n );\n break;\n case 'checkbox':\n return (\n <Checkbox\n id={fieldName}\n name='checkbox'\n label={fieldName}\n onChange={(e) =>\n onChange({ ...componentProps, [propName]: e.target.value })\n }\n />\n );\n break;\n case 'select':\n return (\n <>\n <Label htmlFor='input-type-text' className='margin-top-2'>\n {fieldName}\n </Label>\n <span className='usa-hint'>{hint}</span>\n <Select\n id={fieldName}\n name={fieldName}\n onChange={(e) =>\n onChange({ ...componentProps, [propName]: e.target.value })\n }\n >\n {colorSchemes.map((scheme) => {\n return (\n <option key={scheme} value={scheme}>\n {scheme}\n </option>\n );\n })}\n </Select>\n </>\n );\n break;\n case 'area':\n return (\n <>\n <Label htmlFor='input-type-text' className='margin-top-2'>\n {fieldName}\n </Label>\n <span className='usa-hint'>{hint}</span>\n <Textarea\n id='input-type-text'\n name='input-type-text'\n value={value}\n onChange={(e) => {\n onChange({ ...componentProps, [propName]: e.target.value });\n }}\n className=''\n {...checkRequired(isRequired, value)}\n />\n </>\n );\n break;\n default:\n return (\n <>\n <Label htmlFor='input-type-text' className='margin-top-2'>\n {fieldName}\n </Label>\n\n <span className='usa-hint'>{hint}</span>\n <TextInput\n id='input-type-text'\n name='input-type-text'\n type='text'\n value={validateAgainst ? draft : value}\n onChange={(e) => {\n if (validateAgainst) {\n\n setDraft(e.target.value);\n } else {\n\n onChange({ ...componentProps, [propName]: e.target.value });\n }\n }}\n placeholder={placeHolder}\n {...checkRequired(isRequired, value)}\n validationStatus={\n validateAgainst && (inputErrors[propName] ? 'error' : undefined)\n }\n />\n </>\n );\n }\n};\nexport const InputField: React.FC<FieldProps> = (props) => {\n const { propName, customClass } = props;\n\n return (\n <div key={propName} className={customClass}>\n {setInput(props)}\n </div>\n );\n};\n","import type { DatasetData, StoryData, VedaData } from '@lib';\nimport type { DatasetMetadata, DatasetWithContent } from './content';\n\nexport function processTaxonomies(data): DatasetData | StoryData {\n const updatedTax = data.taxonomy.map((t) => {\n const updatedVals = t.values.map((v) => {\n return {\n id: v.replace(/ /g, '_').toLowerCase(),\n name: v,\n };\n });\n return { ...t, values: updatedVals };\n });\n return { ...data, taxonomy: updatedTax };\n}\n\nexport const transformToDatasetsList = (\n content: DatasetMetadata[],\n): DatasetData[] => {\n return content?.map((post) => ({\n ...post.metadata,\n }));\n};\n\nexport const transformToVedaData = (\n datasets: DatasetMetadata[] | undefined,\n): VedaData<DatasetData> => {\n const transformed = {};\n datasets?.map((dataset) => {\n const id = dataset.metadata.id;\n transformed[id] = {\n data: dataset.metadata,\n };\n });\n return transformed;\n};\n"],"names":["own","zwitch","key","options","settings","one","value","parameters","fn","handlers","id","configure","base","extension","index","list","map","left","right","blockquote","node","_","state","info","exit","tracker","line","blank","patternInScope","stack","pattern","listInScope","none","hardBreak","_1","longestStreak","substring","source","expected","count","max","formatCodeAsIndented","checkFence","marker","code","raw","suffix","sequence","subexit","checkQuote","definition","quote","checkEmphasis","encodeCharacterReference","markdownLineEndingOrSpace","unicodePunctuation","regexCheck","unicodeWhitespace","regex","check","classifyCharacter","encodeInfo","outside","inside","outsideKind","insideKind","emphasis","emphasisPeek","before","between","betweenHead","open","betweenTail","close","after","emptyOptions","toString","includeImageAlt","includeHtml","all","values","result","formatHeadingAsSetext","literalWithBreak","visit","EXIT","heading","rank","html","htmlPeek","image","imagePeek","imageReference","imageReferencePeek","type","alt","reference","inlineCode","inlineCodePeek","expression","match","position","formatLinkAsAutolink","link","linkPeek","linkReference","linkReferencePeek","text","checkBullet","checkBulletOther","bullet","bulletOther","checkBulletOrdered","checkRule","parent","bulletCurrent","useDifferentMarker","firstListItem","item","checkListItemIndent","style","listItem","listItemIndent","size","paragraph","convert","test","ok","castFactory","anyFactory","propsFactory","typeFactory","tests","checks","any","checkAsRecord","nodeAsRecord","testFunction","looksLikeANode","phrasing","root","d","checkStrong","strong","strongPeek","checkRuleRepetition","repetition","thematicBreak","handle","join","joinDefaults","fullPhrasingSpans","unsafe","element","decodeNamedCharacterReference","characterReference","character","decodeNumericCharacterReference","characterEscapeOrReference","decodeString","decode","$0","$1","$2","head","hex","association","compilePattern","containerPhrasing","indexStack","children","results","encodeAfter","child","encodingInfo","containerFlow","eol","indentLines","start","safe","input","config","positions","infos","numerical","end","escapeBackslashes","a","b","whole","track","now","lineShift","column","move","current","shift","chunks","tail","toMarkdown","tree","containerPhrasingBound","containerFlowBound","enter","safeBound","joinDefinition","invalid","unknown","name","mdxExpressionToMarkdown","handleMdxExpression","mdxjsEsmToMarkdown","handleMdxjsEsm","mdxToMarkdown","mdxJsxToMarkdown","extractImports","ast","imports","childrenCopy","i","wrapComponent","mdastChild","generatedProps","acc","handleTwoColumn","MDAST","newTwoColumn","twoColumnChildren","e","columnChild","groupByBreakIntoBlocks","proseWrapper","groupChildren","groups","currentGroup","parsedColumn","group","transformMdast","newChildren","reserializedMdxContent","seperatedMDAST","groupedMDSAT","newMDast","mdast","gfmToMarkdown","ChartContext","createContext","ChartContextProvider","jsx","useChartContext","context","useContext","MapContext","MapContextProvider","useMapContext","inputValidation","dateStringToregex","format","tokens","escape","s","directive","dateFormatValidation","handleChartDateValidation","propName","draftInputs","setInputErrors","inputErrors","draft","onChange","chartProps","handleMapDateValidation","componentProps","handleMapArrayValidation","numberPattern","cleanedDraft","parsedValues","checkLong","long","checkLat","lat","checkRequired","isRequired","colorSchemes","setInput","props","fieldName","hint","placeHolder","validateAgainst","setDraftInputs","jsxs","Fragment","Label","Select","option","label","cleanedType","setDraft","useState","timeoutRef","useRef","useEffect","DatePicker","Checkbox","scheme","Textarea","TextInput","InputField","customClass","processTaxonomies","data","updatedTax","updatedVals","v","transformToDatasetsList","content","post","transformToVedaData","datasets","transformed","dataset"],"mappings":";;;;;;;AAiDA,MAAMA,IAAM,CAAA,EAAG;AAcR,SAASC,GAAOC,GAAKC,GAAS;AACnC,QAAMC,IAAWD,KAAW,CAAA;AA8B5B,WAASE,EAAIC,MAAUC,GAAY;AAEjC,QAAIC,IAAKH,EAAI;AACb,UAAMI,IAAWJ,EAAI;AAErB,QAAIC,KAASN,EAAI,KAAKM,GAAOJ,CAAG,GAAG;AAEjC,YAAMQ,IAAK,OAAOJ,EAAMJ,CAAG,CAAC;AAE5B,MAAAM,IAAKR,EAAI,KAAKS,GAAUC,CAAE,IAAID,EAASC,CAAE,IAAIL,EAAI;AAAA,IACnD;AAEA,QAAIG;AACF,aAAOA,EAAG,KAAK,MAAMF,GAAO,GAAGC,CAAU;AAAA,EAE7C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B,CAAC,GACMD;AACT;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
(function(f,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("mdast-util-gfm"),require("mdast-util-mdx-jsx"),require("unist-util-visit"),require("react/jsx-runtime"),require("react"),require("@trussworks/react-uswds"),require("@teamimpact/veda-ui")):typeof define=="function"&&define.amd?define(["exports","mdast-util-gfm","mdast-util-mdx-jsx","unist-util-visit","react/jsx-runtime","react","@trussworks/react-uswds","@teamimpact/veda-ui"],F):(f=typeof globalThis<"u"?globalThis:f||self,F(f.MDXEditorUtils={},f.mdastUtilGfm,f.mdastUtilMdxJsx,f.unistUtilVisit,f.ReactJSXRuntime,f.React,f.reactUswds,f.vedaUi))})(this,function(f,F,_,D,m,P,C,p){"use strict";const I={}.hasOwnProperty;function xe(e,n){const t=n||{};function r(i,...c){let o=r.invalid;const l=r.handlers;if(i&&I.call(i,e)){const a=String(i[e]);o=I.call(l,a)?l[a]:r.unknown}if(o)return o.call(this,i,...c)}return r.handlers=t.handlers||{},r.invalid=t.invalid,r.unknown=t.unknown,r}const Ce={}.hasOwnProperty;function H(e,n){let t=-1,r;if(n.extensions)for(;++t<n.extensions.length;)H(e,n.extensions[t]);for(r in n)if(Ce.call(n,r))switch(r){case"extensions":break;case"unsafe":{z(e[r],n[r]);break}case"join":{z(e[r],n[r]);break}case"handlers":{ye(e[r],n[r]);break}default:e.options[r]=n[r]}return e}function z(e,n){n&&e.push(...n)}function ye(e,n){n&&Object.assign(e,n)}function we(e,n,t,r){const i=t.enter("blockquote"),c=t.createTracker(r);c.move("> "),c.shift(2);const o=t.indentLines(t.containerFlow(e,c.current()),ve);return i(),o}function ve(e,n,t){return">"+(t?"":" ")+e}function q(e,n){return $(e,n.inConstruct,!0)&&!$(e,n.notInConstruct,!1)}function $(e,n,t){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return t;let r=-1;for(;++r<n.length;)if(e.includes(n[r]))return!0;return!1}function V(e,n,t,r){let i=-1;for(;++i<t.unsafe.length;)if(t.unsafe[i].character===`
|
2
|
+
`&&q(t.stack,t.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
3
|
+
`}function Pe(e,n){const t=String(e);let r=t.indexOf(n),i=r,c=0,o=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++c>o&&(o=c):c=1,i=r+n.length,r=t.indexOf(n,i);return o}function M(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Ae(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function Fe(e,n,t,r){const i=Ae(t),c=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(M(e,t)){const h=t.enter("codeIndented"),d=t.indentLines(c,Se);return h(),d}const l=t.createTracker(r),a=i.repeat(Math.max(Pe(c,i)+1,3)),s=t.enter("codeFenced");let u=l.move(a);if(e.lang){const h=t.enter(`codeFencedLang${o}`);u+=l.move(t.safe(e.lang,{before:u,after:" ",encode:["`"],...l.current()})),h()}if(e.lang&&e.meta){const h=t.enter(`codeFencedMeta${o}`);u+=l.move(" "),u+=l.move(t.safe(e.meta,{before:u,after:`
|
4
|
+
`,encode:["`"],...l.current()})),h()}return u+=l.move(`
|
5
|
+
`),c&&(u+=l.move(c+`
|
6
|
+
`)),u+=l.move(a),s(),u}function Se(e,n,t){return(t?"":" ")+e}function j(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function Te(e,n,t,r){const i=j(t),c=i==='"'?"Quote":"Apostrophe",o=t.enter("definition");let l=t.enter("label");const a=t.createTracker(r);let s=a.move("[");return s+=a.move(t.safe(t.associationId(e),{before:s,after:"]",...a.current()})),s+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=t.enter("destinationLiteral"),s+=a.move("<"),s+=a.move(t.safe(e.url,{before:s,after:">",...a.current()})),s+=a.move(">")):(l=t.enter("destinationRaw"),s+=a.move(t.safe(e.url,{before:s,after:e.title?" ":`
|
7
|
+
`,...a.current()}))),l(),e.title&&(l=t.enter(`title${c}`),s+=a.move(" "+i),s+=a.move(t.safe(e.title,{before:s,after:i,...a.current()})),s+=a.move(i),l()),o(),s}function Ee(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function v(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Me(e){return e!==null&&(e<0||e===32)}const je=G(/\p{P}|\p{S}/u),Be=G(/\s/);function G(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function J(e){if(e===null||Me(e)||Be(e))return 1;if(je(e))return 2}function S(e,n,t){const r=J(e),i=J(n);return r===void 0?i===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}N.peek=Le;function N(e,n,t,r){const i=Ee(t),c=t.enter("emphasis"),o=t.createTracker(r),l=o.move(i);let a=o.move(t.containerPhrasing(e,{after:i,before:l,...o.current()}));const s=a.charCodeAt(0),u=S(r.before.charCodeAt(r.before.length-1),s,i);u.inside&&(a=v(s)+a.slice(1));const h=a.charCodeAt(a.length-1),d=S(r.after.charCodeAt(0),h,i);d.inside&&(a=a.slice(0,-1)+v(h));const k=o.move(i);return c(),t.attentionEncodeSurroundingInfo={after:d.outside,before:u.outside},l+a+k}function Le(e,n,t){return t.options.emphasis||"*"}const Oe={};function Q(e,n){const t=Oe,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return R(e,r,i)}function R(e,n,t){if(_e(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return W(e.children,n,t)}return Array.isArray(e)?W(e,n,t):""}function W(e,n,t){const r=[];let i=-1;for(;++i<e.length;)r[i]=R(e[i],n,t);return r.join("")}function _e(e){return!!(e&&typeof e=="object")}function X(e,n){let t=!1;return D.visit(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return t=!0,D.EXIT}),!!((!e.depth||e.depth<3)&&Q(e)&&(n.options.setext||t))}function De(e,n,t,r){const i=Math.max(Math.min(6,e.depth||1),1),c=t.createTracker(r);if(X(e,t)){const u=t.enter("headingSetext"),h=t.enter("phrasing"),d=t.containerPhrasing(e,{...c.current(),before:`
|
8
|
+
`,after:`
|
9
|
+
`});return h(),u(),d+`
|
10
|
+
`+(i===1?"=":"-").repeat(d.length-(Math.max(d.lastIndexOf("\r"),d.lastIndexOf(`
|
11
|
+
`))+1))}const o="#".repeat(i),l=t.enter("headingAtx"),a=t.enter("phrasing");c.move(o+" ");let s=t.containerPhrasing(e,{before:"# ",after:`
|
12
|
+
`,...c.current()});return/^[\t ]/.test(s)&&(s=v(s.charCodeAt(0))+s.slice(1)),s=s?o+" "+s:o,t.options.closeAtx&&(s+=" "+o),a(),l(),s}Z.peek=Ie;function Z(e){return e.value||""}function Ie(){return"<"}K.peek=He;function K(e,n,t,r){const i=j(t),c=i==='"'?"Quote":"Apostrophe",o=t.enter("image");let l=t.enter("label");const a=t.createTracker(r);let s=a.move("![");return s+=a.move(t.safe(e.alt,{before:s,after:"]",...a.current()})),s+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=t.enter("destinationLiteral"),s+=a.move("<"),s+=a.move(t.safe(e.url,{before:s,after:">",...a.current()})),s+=a.move(">")):(l=t.enter("destinationRaw"),s+=a.move(t.safe(e.url,{before:s,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=t.enter(`title${c}`),s+=a.move(" "+i),s+=a.move(t.safe(e.title,{before:s,after:i,...a.current()})),s+=a.move(i),l()),s+=a.move(")"),o(),s}function He(){return"!"}Y.peek=ze;function Y(e,n,t,r){const i=e.referenceType,c=t.enter("imageReference");let o=t.enter("label");const l=t.createTracker(r);let a=l.move("![");const s=t.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(s+"]["),o();const u=t.stack;t.stack=[],o=t.enter("reference");const h=t.safe(t.associationId(e),{before:a,after:"]",...l.current()});return o(),t.stack=u,c(),i==="full"||!s||s!==h?a+=l.move(h+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function ze(){return"!"}U.peek=qe;function U(e,n,t){let r=e.value||"",i="`",c=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++c<t.unsafe.length;){const o=t.unsafe[c],l=t.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(r);){let s=a.index;r.charCodeAt(s)===10&&r.charCodeAt(s-1)===13&&s--,r=r.slice(0,s)+" "+r.slice(a.index+1)}}return i+r+i}function qe(){return"`"}function ee(e,n){const t=Q(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(t===e.url||"mailto:"+t===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}te.peek=$e;function te(e,n,t,r){const i=j(t),c=i==='"'?"Quote":"Apostrophe",o=t.createTracker(r);let l,a;if(ee(e,t)){const u=t.stack;t.stack=[],l=t.enter("autolink");let h=o.move("<");return h+=o.move(t.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),l(),t.stack=u,h}l=t.enter("link"),a=t.enter("label");let s=o.move("[");return s+=o.move(t.containerPhrasing(e,{before:s,after:"](",...o.current()})),s+=o.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=t.enter("destinationLiteral"),s+=o.move("<"),s+=o.move(t.safe(e.url,{before:s,after:">",...o.current()})),s+=o.move(">")):(a=t.enter("destinationRaw"),s+=o.move(t.safe(e.url,{before:s,after:e.title?" ":")",...o.current()}))),a(),e.title&&(a=t.enter(`title${c}`),s+=o.move(" "+i),s+=o.move(t.safe(e.title,{before:s,after:i,...o.current()})),s+=o.move(i),a()),s+=o.move(")"),l(),s}function $e(e,n,t){return ee(e,t)?"<":"["}ne.peek=Ve;function ne(e,n,t,r){const i=e.referenceType,c=t.enter("linkReference");let o=t.enter("label");const l=t.createTracker(r);let a=l.move("[");const s=t.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(s+"]["),o();const u=t.stack;t.stack=[],o=t.enter("reference");const h=t.safe(t.associationId(e),{before:a,after:"]",...l.current()});return o(),t.stack=u,c(),i==="full"||!s||s!==h?a+=l.move(h+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function Ve(){return"["}function B(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function Ge(e){const n=B(e),t=e.options.bulletOther;if(!t)return n==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+t+"`) to be different");return t}function Je(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function re(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function Ne(e,n,t,r){const i=t.enter("list"),c=t.bulletCurrent;let o=e.ordered?Je(t):B(t);const l=e.ordered?o==="."?")":".":Ge(t);let a=n&&t.bulletLastUsed?o===t.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(a=!0),re(t)===o&&u){let h=-1;for(;++h<e.children.length;){const d=e.children[h];if(d&&d.type==="listItem"&&d.children&&d.children[0]&&d.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=l),t.bulletCurrent=o;const s=t.containerFlow(e,r);return t.bulletLastUsed=o,t.bulletCurrent=c,i(),s}function Qe(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function Re(e,n,t,r){const i=Qe(t);let c=t.bulletCurrent||B(t);n&&n.type==="list"&&n.ordered&&(c=(typeof n.start=="number"&&n.start>-1?n.start:1)+(t.options.incrementListMarker===!1?0:n.children.indexOf(e))+c);let o=c.length+1;(i==="tab"||i==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=t.createTracker(r);l.move(c+" ".repeat(o-c.length)),l.shift(o);const a=t.enter("listItem"),s=t.indentLines(t.containerFlow(e,l.current()),u);return a(),s;function u(h,d,k){return d?(k?"":" ".repeat(o))+h:(k?c:c+" ".repeat(o-c.length))+h}}function We(e,n,t,r){const i=t.enter("paragraph"),c=t.enter("phrasing"),o=t.containerPhrasing(e,r);return c(),i(),o}const ie=function(e){if(e==null)return Ye;if(typeof e=="function")return T(e);if(typeof e=="object")return Array.isArray(e)?Xe(e):Ze(e);if(typeof e=="string")return Ke(e);throw new Error("Expected function, string, or object as test")};function Xe(e){const n=[];let t=-1;for(;++t<e.length;)n[t]=ie(e[t]);return T(r);function r(...i){let c=-1;for(;++c<n.length;)if(n[c].apply(this,i))return!0;return!1}}function Ze(e){const n=e;return T(t);function t(r){const i=r;let c;for(c in e)if(i[c]!==n[c])return!1;return!0}}function Ke(e){return T(n);function n(t){return t&&t.type===e}}function T(e){return n;function n(t,r,i){return!!(Ue(t)&&e.call(this,t,typeof r=="number"?r:void 0,i||void 0))}}function Ye(){return!0}function Ue(e){return e!==null&&typeof e=="object"&&"type"in e}const et=ie(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function tt(e,n,t,r){return(e.children.some(function(o){return et(o)})?t.containerPhrasing:t.containerFlow).call(t,e,r)}function nt(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}oe.peek=rt;function oe(e,n,t,r){const i=nt(t),c=t.enter("strong"),o=t.createTracker(r),l=o.move(i+i);let a=o.move(t.containerPhrasing(e,{after:i,before:l,...o.current()}));const s=a.charCodeAt(0),u=S(r.before.charCodeAt(r.before.length-1),s,i);u.inside&&(a=v(s)+a.slice(1));const h=a.charCodeAt(a.length-1),d=S(r.after.charCodeAt(0),h,i);d.inside&&(a=a.slice(0,-1)+v(h));const k=o.move(i+i);return c(),t.attentionEncodeSurroundingInfo={after:d.outside,before:u.outside},l+a+k}function rt(e,n,t){return t.options.strong||"*"}function it(e,n,t,r){return t.safe(e.value,r)}function ot(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function ct(e,n,t){const r=(re(t)+(t.options.ruleSpaces?" ":"")).repeat(ot(t));return t.options.ruleSpaces?r.slice(0,-1):r}const at={blockquote:we,break:V,code:Fe,definition:Te,emphasis:N,hardBreak:V,heading:De,html:Z,image:K,imageReference:Y,inlineCode:U,link:te,linkReference:ne,list:Ne,listItem:Re,paragraph:We,root:tt,strong:oe,text:it,thematicBreak:ct},lt=[st];function st(e,n,t,r){if(n.type==="code"&&M(n,r)&&(e.type==="list"||e.type===n.type&&M(e,r)))return!1;if("spread"in t&&typeof t.spread=="boolean")return e.type==="paragraph"&&(e.type===n.type||n.type==="definition"||n.type==="heading"&&X(n,r))?void 0:t.spread?1:0}const A=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],ut=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
13
|
+
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:A},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
14
|
+
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:A},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
15
|
+
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:A},{atBreak:!0,character:"+",after:`(?:[ \r
|
16
|
+
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
17
|
+
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
18
|
+
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:A},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:A},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:A},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:A},{atBreak:!0,character:"~"}],ce=document.createElement("i");function ft(e){const n="&"+e+";";ce.innerHTML=n;const t=ce.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function ht(e,n){const t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}const dt=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function mt(e){return e.replace(dt,pt)}function pt(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),c=i===120||i===88;return ht(t.slice(c?2:1),c?16:10)}return ft(t)||e}function gt(e){return e.label||!e.identifier?e.label||"":mt(e.identifier)}function kt(e){if(!e._compiled){const n=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((n?"("+n+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function bt(e,n,t){const r=n.indexStack,i=e.children||[],c=[];let o=-1,l=t.before,a;r.push(-1);let s=n.createTracker(t);for(;++o<i.length;){const u=i[o];let h;if(r[r.length-1]=o,o+1<i.length){let b=n.handle.handlers[i[o+1].type];b&&b.peek&&(b=b.peek),h=b?b(i[o+1],e,n,{before:"",after:"",...s.current()}).charAt(0):""}else h=t.after;c.length>0&&(l==="\r"||l===`
|
19
|
+
`)&&u.type==="html"&&(c[c.length-1]=c[c.length-1].replace(/(\r?\n|\r)$/," "),l=" ",s=n.createTracker(t),s.move(c.join("")));let d=n.handle(u,e,n,{...s.current(),after:h,before:l});a&&a===d.slice(0,1)&&(d=v(a.charCodeAt(0))+d.slice(1));const k=n.attentionEncodeSurroundingInfo;n.attentionEncodeSurroundingInfo=void 0,a=void 0,k&&(c.length>0&&k.before&&l===c[c.length-1].slice(-1)&&(c[c.length-1]=c[c.length-1].slice(0,-1)+v(l.charCodeAt(0))),k.after&&(a=h)),s.move(d),c.push(d),l=d.slice(-1)}return r.pop(),c.join("")}function xt(e,n,t){const r=n.indexStack,i=e.children||[],c=n.createTracker(t),o=[];let l=-1;for(r.push(-1);++l<i.length;){const a=i[l];r[r.length-1]=l,o.push(c.move(n.handle(a,e,n,{before:`
|
20
|
+
`,after:`
|
21
|
+
`,...c.current()}))),a.type!=="list"&&(n.bulletLastUsed=void 0),l<i.length-1&&o.push(c.move(Ct(a,i[l+1],e,n)))}return r.pop(),o.join("")}function Ct(e,n,t,r){let i=r.join.length;for(;i--;){const c=r.join[i](e,n,t,r);if(c===!0||c===1)break;if(typeof c=="number")return`
|
22
|
+
`.repeat(1+c);if(c===!1)return`
|
23
|
+
|
24
|
+
<!---->
|
25
|
+
|
26
|
+
`}return`
|
27
|
+
|
28
|
+
`}const yt=/\r?\n|\r/g;function wt(e,n){const t=[];let r=0,i=0,c;for(;c=yt.exec(e);)o(e.slice(r,c.index)),t.push(c[0]),r=c.index+c[0].length,i++;return o(e.slice(r)),t.join("");function o(l){t.push(n(l,i,!l))}}function vt(e,n,t){const r=(t.before||"")+(n||"")+(t.after||""),i=[],c=[],o={};let l=-1;for(;++l<e.unsafe.length;){const u=e.unsafe[l];if(!q(e.stack,u))continue;const h=e.compilePattern(u);let d;for(;d=h.exec(r);){const k="before"in u||!!u.atBreak,b="after"in u,y=d.index+(k?d[1].length:0);i.includes(y)?(o[y].before&&!k&&(o[y].before=!1),o[y].after&&!b&&(o[y].after=!1)):(i.push(y),o[y]={before:k,after:b})}}i.sort(Pt);let a=t.before?t.before.length:0;const s=r.length-(t.after?t.after.length:0);for(l=-1;++l<i.length;){const u=i[l];u<a||u>=s||u+1<s&&i[l+1]===u+1&&o[u].after&&!o[u+1].before&&!o[u+1].after||i[l-1]===u-1&&o[u].before&&!o[u-1].before&&!o[u-1].after||(a!==u&&c.push(ae(r.slice(a,u),"\\")),a=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!t.encode||!t.encode.includes(r.charAt(u)))?c.push("\\"):(c.push(v(r.charCodeAt(u))),a++))}return c.push(ae(r.slice(a,s),t.after)),c.join("")}function Pt(e,n){return e-n}function ae(e,n){const t=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],c=e+n;let o=-1,l=0,a;for(;a=t.exec(c);)r.push(a.index);for(;++o<r.length;)l!==r[o]&&i.push(e.slice(l,r[o])),i.push("\\"),l=r[o];return i.push(e.slice(l)),i.join("")}function At(e){const n=e||{},t=n.now||{};let r=n.lineShift||0,i=t.line||1,c=t.column||1;return{move:a,current:o,shift:l};function o(){return{now:{line:i,column:c},lineShift:r}}function l(s){r+=s}function a(s){const u=s||"",h=u.split(/\r?\n|\r/g),d=h[h.length-1];return i+=h.length-1,c=h.length===1?c+d.length:1+d.length+r,u}}function Ft(e,n){const t=n||{},r={associationId:gt,containerPhrasing:Mt,containerFlow:jt,createTracker:At,compilePattern:kt,enter:c,handlers:{...at},handle:void 0,indentLines:wt,indexStack:[],join:[...lt],options:{},safe:Bt,stack:[],unsafe:[...ut]};H(r,t),r.options.tightDefinitions&&r.join.push(Et),r.handle=xe("type",{invalid:St,unknown:Tt,handlers:r.handlers});let i=r.handle(e,void 0,r,{before:`
|
29
|
+
`,after:`
|
30
|
+
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
31
|
+
`),i;function c(o){return r.stack.push(o),l;function l(){r.stack.pop()}}}function St(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function Tt(e){const n=e;throw new Error("Cannot handle unknown node `"+n.type+"`")}function Et(e,n){if(e.type==="definition"&&e.type===n.type)return 0}function Mt(e,n){return bt(e,this,n)}function jt(e,n){return xt(e,this,n)}function Bt(e,n){return vt(this,e,n)}function Lt(){return{handlers:{mdxFlowExpression:le,mdxTextExpression:le},unsafe:[{character:"{",inConstruct:["phrasing"]},{atBreak:!0,character:"{"}]}}function le(e,n,t){const r=e.value||"";return"{"+t.indentLines(r,function(c,o,l){return(o===0||l?"":" ")+c})+"}"}function Ot(){return{handlers:{mdxjsEsm:_t}}}function _t(e){return e.value||""}function Dt(e){return{extensions:[Lt(),_.mdxJsxToMarkdown(e),Ot()]}}const se=e=>{const n=[],t=(r,i,c)=>{if(r.type==="text"&&r.value&&r.value.includes("import")&&r.value.includes("from")&&i&&Array.isArray(i.children)&&typeof c=="number"){i.children.splice(c,1),n.push({type:"paragraph",children:[r]});return}if(r.children&&Array.isArray(r.children)){const o=[...r.children];for(let l=0;l<o.length;l++)t(o[l],r,l)}};return t(e,null,null),e.type==="root"&&Array.isArray(e.children)&&(e.children=[...n,...e.children]),e},L=e=>{const n=e.attributes.reduce((r,i)=>(r[i.name]=i.value,r),{});return{type:"mdxJsxFlowElement",name:"Figure",attributes:[],children:[{...e},{type:"mdxJsxFlowElement",name:"Caption",attributes:[{name:"attrAuthor",value:n.attrAuthor},{name:"attrUrl",value:n.attrUrl}],children:[{type:"text",value:n.caption}]}]}},ue=e=>{const n=[];for(const t of e.children)if(t.children.some(r=>r.name==="Chart"||r.name==="Map"))for(const r of t.children)(r.name==="Chart"||r.name==="Map")&&n.push(L(r));else n.push({type:"mdxJsxFlowElement",name:"Prose",attributes:[],children:[...t.children]});return n},fe=e=>{const n=[],t=i=>({type:"mdxJsxFlowElement",name:"Prose",children:[...i]}),r=i=>{const c=[];let o=[];for(const l of i)if(l.type==="mdxJsxTextElement"||l.type==="mdxJsxFlowElement"){if(l.name==="Break")o.length>0&&(c.push([t(o)]),o=[]);else if(l.name==="Block"||l.name==="Chart"||l.name==="Map"||l.name==="MapBlock"||l.name==="TwoColumn"){if(c.push([t(o)]),l.name==="Chart"||l.name==="Map")c.push([L(l)]);else if(l.name==="TwoColumn"){const a=ue(l);c.push(a)}o=[]}}else o.push(l);return o.length>0&&c.push([...o]),c};if(e.type==="root"&&Array.isArray(e.children)){const i=r(e.children);for(const c of i)c.some(o=>o.name==="Prose")?n.push({type:"mdxJsxFlowElement",name:"Block",children:[...c]}):n.push({type:"mdxJsxFlowElement",name:"Block",children:[{type:"mdxJsxFlowElement",name:"Prose",children:[...c]}]})}return n},It=e=>{if(!e||e.type!=="root"||!Array.isArray(e.children))return e;const n=[];for(const t of e.children)t.type==="paragraph"&&t.children.length===1&&t.children[0].type==="mdxJsxFlowElement"?n.push(t.children[0]):n.push(t);return{...e,children:n}},Ht=e=>{const n=It(e),t=fe(n);se(n);const r={...n,children:t};return(c=>Ft(c,{extensions:[Dt(),F.gfmToMarkdown(),_.mdxJsxToMarkdown()]}))(r)},he=P.createContext(null),zt=({children:e,value:n})=>m.jsx(he.Provider,{value:n,children:e}),qt=()=>{const e=P.useContext(he);if(!e)throw new Error("useChartContext must be used within a ChartContextProvider");return e},de=P.createContext(null),$t=({children:e,value:n})=>m.jsx(de.Provider,{value:n,children:e}),Vt=()=>{const e=P.useContext(de);if(!e)throw new Error("useMapContext must be used within a MapContextProvider");return e},Gt=()=>{},me=e=>{const n={"%d":"(0[1-9]|[12][0-9]|3[01])","%m":"(0[1-9]|1[0-2])","%Y":"\\d{4}","%y":"\\d{2}","%H":"([01][0-9]|2[0-3])","%M":"([0-5][0-9])","%S":"([0-5][0-9])"},t=i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");let r="";for(let i=0;i<e.length;i++)if(e[i]==="%"&&i<e.length-1){const c=e[i]+e[i+1];r+=n[c]||t(c),i++}else r+=t(e[i]);return new RegExp(`^${r}$`)},w=(e,n)=>!me(e).test(n),pe=(e,n,t,r,i,c,o)=>{e==="highlightStart"||e==="highlightEnd"?w(n.draftDateFormat,i)===!1?(t({highlightStart:w(n.draftDateFormat,n.draftHighlightStart),highlightEnd:w(n.draftDateFormat,n.draftHighlightEnd)}),r.highlightStart==!1&&r.highlightEnd==!1&&c({...o,dateFormat:n.draftDateFormat,highlightStart:n.draftHighlightStart,highlightEnd:n.draftHighlightEnd})):t({highlightStart:w(n.draftDateFormat,n.draftHighlightStart),highlightEnd:w(n.draftDateFormat,n.draftHighlightEnd)}):e==="dateFormat"?t({highlightStart:w(i,o.highlightStart),highlightEnd:w(i,o.highlightEnd)}):r.highlightStart==!1&&r.highlightEnd==!1&&c({...o,dateFormat:n.draftDateFormat,highlightStart:n.draftHighlightStart,highlightEnd:n.draftHighlightEnd})},ge=(e,n,t,r,i,c,o)=>{w(n.defaultDateFormat,i)===!1||i===""?(r({...t,[e]:!1}),c({...o,[e]:i})):r({...t,[e]:!0})},ke=(e,n,t,r,i,c,o)=>{const l=/^\[[+-]?(0|[1-9][0-9]*)(\.[0-9]+)?(?:,\s*[+-]?(0|[1-9][0-9]*)(\.[0-9]+)?)*\]$/,a=i.replace(/\s/g,"");if(l.test(a)){const s=JSON.parse(a),u=d=>d<=180&&d>=-180,h=d=>d<=90&&d>=-90;u(s[0])&&h(s[1])?(r({...t,[e]:!1}),c({...o,[e]:i})):r({...t,[e]:!0})}else r({...t,[e]:!0})},E=(e,n)=>e&&!n?{validationStatus:"error"}:"",Jt=["Blues","Greens","Greys","Oranges","Purples","Reds","Turbo","Viridis","Inferno","Magma","Plasma","Cividis","Warm","Cool","CubehelixDefault"],Nt=e=>{const{value:n,isRequired:t,type:r,fieldName:i,hint:c,onChange:o,componentProps:l,propName:a,placeHolder:s,validateAgainst:u,draftInputs:h,setDraftInputs:d,inputErrors:k,setInputErrors:b,options:y}=e;if(y&&Array.isArray(y))return m.jsxs(m.Fragment,{children:[m.jsx(C.Label,{htmlFor:a,className:"margin-top-2",children:i}),m.jsx("span",{className:"usa-hint",children:c}),m.jsxs(C.Select,{id:a,name:a,value:n,onChange:g=>o({...l,[a]:g.target.value}),...E(t,n),children:[m.jsx("option",{value:"",children:"- Select option -"}),y.map(g=>{const be=typeof g=="object"?g.value:g,Yt=typeof g=="object"?g.label:g;return m.jsx("option",{value:be,children:Yt},be)})]})]});const Zt=r!==void 0&&r.toLowerCase(),[x,Kt]=P.useState(n),O=P.useRef(null);switch(P.useEffect(()=>(a==="dateFormat"&&x!=h.draftDateFormat&&d({...h,draftDateFormat:x}),a==="highlightStart"&&x!=h.draftHighlightStart&&d({...h,draftHighlightStart:x}),a==="highlightEnd"&&x!=h.draftHighlightEnd&&d({...h,draftHighlightEnd:x}),clearTimeout(O.current),O.current=setTimeout(()=>{u&&(a==="dateFormat"||a==="highlightStart"||a==="highlightEnd"?pe(a,h,b,k,x,o,l):u==="defaultDateFormat"?ge(a,h,k,b,x,o,l):u==="centerFormat"?ke(a,h,k,b,x,o,l):o({...l,[a]:x}))},400),()=>clearTimeout(O.current)),[x,h]),Zt){case"date":return m.jsxs(m.Fragment,{children:[m.jsx(C.Label,{htmlFor:"input-type-text",className:"margin-top-2",children:i}),m.jsx("span",{className:"usa-hint",children:c}),m.jsx(C.DatePicker,{defaultValue:n,onChange:g=>console.log("DatePicker",g),...E(t,n)})]});case"checkbox":return m.jsx(C.Checkbox,{id:i,name:"checkbox",label:i,onChange:g=>o({...l,[a]:g.target.value})});case"select":return m.jsxs(m.Fragment,{children:[m.jsx(C.Label,{htmlFor:"input-type-text",className:"margin-top-2",children:i}),m.jsx("span",{className:"usa-hint",children:c}),m.jsx(C.Select,{id:i,name:i,onChange:g=>o({...l,[a]:g.target.value}),children:Jt.map(g=>m.jsx("option",{value:g,children:g},g))})]});case"area":return m.jsxs(m.Fragment,{children:[m.jsx(C.Label,{htmlFor:"input-type-text",className:"margin-top-2",children:i}),m.jsx("span",{className:"usa-hint",children:c}),m.jsx(C.Textarea,{id:"input-type-text",name:"input-type-text",value:n,onChange:g=>{o({...l,[a]:g.target.value})},className:"",...E(t,n)})]});default:return m.jsxs(m.Fragment,{children:[m.jsx(C.Label,{htmlFor:"input-type-text",className:"margin-top-2",children:i}),m.jsx("span",{className:"usa-hint",children:c}),m.jsx(C.TextInput,{id:"input-type-text",name:"input-type-text",type:"text",value:u?x:n,onChange:g=>{u?Kt(g.target.value):o({...l,[a]:g.target.value})},placeholder:s,...E(t,n),validationStatus:u&&(k[a]?"error":void 0)})]})}},Qt=e=>{const{propName:n,customClass:t}=e;return m.jsx("div",{className:t,children:Nt(e)},n)};function Rt(e){const n=e.taxonomy.map(t=>{const r=t.values.map(i=>({id:i.replace(/ /g,"_").toLowerCase(),name:i}));return{...t,values:r}});return{...e,taxonomy:n}}const Wt=e=>e?.map(n=>({...n.metadata})),Xt=e=>{const n={};return e?.map(t=>{const r=t.metadata.id;n[r]={data:t.metadata}}),n};Object.defineProperty(f,"Block",{enumerable:!0,get:()=>p.Block}),Object.defineProperty(f,"Caption",{enumerable:!0,get:()=>p.Caption}),Object.defineProperty(f,"CatalogContent",{enumerable:!0,get:()=>p.CatalogContent}),Object.defineProperty(f,"Chapter",{enumerable:!0,get:()=>p.Chapter}),Object.defineProperty(f,"Chart",{enumerable:!0,get:()=>p.Chart}),Object.defineProperty(f,"CompareImage",{enumerable:!0,get:()=>p.CompareImage}),Object.defineProperty(f,"DatasetSelectorModal",{enumerable:!0,get:()=>p.DatasetSelectorModal}),Object.defineProperty(f,"DevseedUiThemeProvider",{enumerable:!0,get:()=>p.DevseedUiThemeProvider}),Object.defineProperty(f,"ExplorationAndAnalysis",{enumerable:!0,get:()=>p.ExplorationAndAnalysis}),Object.defineProperty(f,"Figure",{enumerable:!0,get:()=>p.Figure}),Object.defineProperty(f,"Image",{enumerable:!0,get:()=>p.Image}),Object.defineProperty(f,"LegacyGlobalStyles",{enumerable:!0,get:()=>p.LegacyGlobalStyles}),Object.defineProperty(f,"MapBlock",{enumerable:!0,get:()=>p.MapBlock}),Object.defineProperty(f,"PageFooter",{enumerable:!0,get:()=>p.PageFooter}),Object.defineProperty(f,"PageHeader",{enumerable:!0,get:()=>p.PageHeader}),Object.defineProperty(f,"PageHero",{enumerable:!0,get:()=>p.PageHero}),Object.defineProperty(f,"Prose",{enumerable:!0,get:()=>p.Prose}),Object.defineProperty(f,"ReactQueryProvider",{enumerable:!0,get:()=>p.ReactQueryProvider}),Object.defineProperty(f,"ScrollytellingBlock",{enumerable:!0,get:()=>p.ScrollytellingBlock}),Object.defineProperty(f,"StoriesHubContent",{enumerable:!0,get:()=>p.StoriesHubContent}),Object.defineProperty(f,"VedaUIProvider",{enumerable:!0,get:()=>p.VedaUIProvider}),Object.defineProperty(f,"externalDatasetsAtom",{enumerable:!0,get:()=>p.externalDatasetsAtom}),Object.defineProperty(f,"timelineDatasetsAtom",{enumerable:!0,get:()=>p.timelineDatasetsAtom}),Object.defineProperty(f,"useFiltersWithQS",{enumerable:!0,get:()=>p.useFiltersWithQS}),Object.defineProperty(f,"useTimelineDatasetAtom",{enumerable:!0,get:()=>p.useTimelineDatasetAtom}),f.ChartContextProvider=zt,f.InputField=Qt,f.MapContextProvider=$t,f.dateFormatValidation=w,f.dateStringToregex=me,f.extractImports=se,f.groupByBreakIntoBlocks=fe,f.handleChartDateValidation=pe,f.handleMapArrayValidation=ke,f.handleMapDateValidation=ge,f.handleTwoColumn=ue,f.inputValidation=Gt,f.processTaxonomies=Rt,f.reserializedMdxContent=Ht,f.transformToDatasetsList=Wt,f.transformToVedaData=Xt,f.useChartContext=qt,f.useMapContext=Vt,f.wrapComponent=L,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
32
|
+
//# sourceMappingURL=index.umd.js.map
|