@hyperbook/markdown 0.8.0 → 0.8.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/Markdown.tsx", "../src/Code.tsx", "../src/Link.tsx", "../src/Table.tsx", "../src/Headings.tsx", "../src/Image.tsx", "../src/remarkRemoveComments.ts", "../src/remarkCustomHeadingIds.ts", "../src/useRemarkSync.ts", "../src/useToc.ts", "../src/remarkHeadings.ts"],
4
- "sourcesContent": ["export * from \"./Markdown\";\nexport * from \"./useToc\";\n", "import remarkDirective from \"remark-directive\";\nimport remarkDirectiveRehype from \"remark-directive-rehype\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport remarkGemoji from \"remark-gemoji\";\nimport remarkUnwrapImages from \"remark-unwrap-images\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport { useDirectives } from \"@hyperbook/provider\";\nimport { Drawer } from \"@hyperbook/drawer\";\nimport { Code } from \"./Code\";\nimport { Link } from \"./Link\";\nimport { Table, Td, Th, Tr } from \"./Table\";\nimport { Headings } from \"./Headings\";\nimport { Image } from \"./Image\";\n\nimport \"./index.css\";\nimport { remarkRemoveComments } from \"./remarkRemoveComments\";\nimport { remarkCustomHeadingIds } from \"./remarkCustomHeadingIds\";\nimport { useRemarkSync } from \"./useRemarkSync\";\nimport { useToc } from \"./useToc\";\nimport { Fragment, useState } from \"react\";\n\nexport type MarkdownProps = {\n children: string;\n showToc?: boolean;\n};\n\nexport const Markdown = ({ children, showToc = true }: MarkdownProps) => {\n const directives = useDirectives();\n\n const toc = useToc(children);\n const [isTocOpen, setIsTocOpen] = useState(false);\n const reactContent = useRemarkSync(children, {\n rehypeReactOptions: {\n passNode: true,\n components: {\n ...directives,\n a: Link,\n code: Code,\n td: Td,\n th: Th,\n table: Table,\n tr: Tr,\n h1: Headings(1),\n h2: Headings(2),\n h3: Headings(3),\n h4: Headings(4),\n h5: Headings(5),\n h6: Headings(6),\n img: Image,\n },\n },\n remarkPlugins: [\n remarkRemoveComments,\n remarkCustomHeadingIds,\n remarkGfm,\n remarkDirective,\n remarkDirectiveRehype,\n remarkMath,\n remarkGemoji,\n remarkUnwrapImages,\n ],\n rehypePlugins: [\n rehypeKatex,\n [rehypeHighlight, { ignoreMissing: true, plainText: [\"mermaid\"] }],\n ],\n });\n\n return (\n <div className=\"hyperbook-markdown\">\n {showToc && (\n <Fragment>\n <button\n className={isTocOpen ? \"toc-toggle open\" : \"toc-toggle\"}\n onClick={() => setIsTocOpen(!isTocOpen)}\n title=\"Table of Contents\"\n >\n <div className=\"bar1\"></div>\n <div className=\"bar2\"></div>\n <div className=\"bar3\"></div>\n <div className=\"bar4\"></div>\n </button>\n <Drawer\n isOpen={isTocOpen}\n onClose={() => setIsTocOpen(false)}\n position=\"right\"\n >\n <div id=\"toc-sidebar\">\n <nav className=\"toc\">\n <ul>\n {toc.map((h, i) => (\n <li key={i} className={`level-${h.level}`}>\n <a href={`#${h.anchor}`}>{h.label}</a>\n </li>\n ))}\n </ul>\n </nav>\n </div>\n </Drawer>\n </Fragment>\n )}\n {reactContent}\n </div>\n );\n};\n", "import { useDirectives } from \"@hyperbook/provider\";\nimport { ComponentType, Fragment, useRef, useState } from \"react\";\n\nconst MdContentCopy = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n height=\"1em\"\n width=\"1em\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z\" />\n </svg>\n );\n};\n\nconst MdDone = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n height=\"1em\"\n width=\"1em\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z\" />\n </svg>\n );\n};\n\nconst copyNoNavigator = (text: string) => {\n const isIos = navigator.userAgent.match(/ipad|iphone/i);\n const textarea = document.createElement(\"textarea\");\n\n // create textarea\n textarea.value = text;\n\n // ios will zoom in on the input if the font-size is < 16px\n textarea.style.fontSize = \"20px\";\n document.body.appendChild(textarea);\n\n // select text\n if (isIos) {\n const range = document.createRange();\n range.selectNodeContents(textarea);\n\n const selection = window.getSelection();\n if (selection) {\n selection.removeAllRanges();\n selection.addRange(range);\n }\n textarea.setSelectionRange(0, 999999);\n } else {\n textarea.select();\n }\n\n // copy selection\n document.execCommand(\"copy\");\n\n // cleanup\n document.body.removeChild(textarea);\n};\n\nexport const Code: ComponentType<JSX.IntrinsicElements[\"code\"]> = ({\n children,\n className,\n}) => {\n const directives = useDirectives();\n if (className === \"language-mermaid\" && directives[\"mermaid\"]) {\n const Mermaid = directives[\"mermaid\"];\n return <Mermaid children={children} />;\n }\n\n const ref = useRef<HTMLElement>(null);\n const [copied, setCopied] = useState(false);\n const copyCode = () => {\n if (ref.current) {\n const text = ref.current.innerText;\n if (navigator.clipboard) {\n navigator.clipboard\n .writeText(text)\n .then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n })\n .catch(() => {\n copyNoNavigator(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n });\n } else {\n copyNoNavigator(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }\n }\n };\n\n return !className ? (\n <span className=\"inline\">\n <code ref={ref} className={className}>\n {children}\n </code>\n <button className=\"copy\" onClick={copyCode} aria-label=\"Copy Code\">\n {copied ? <MdDone /> : <MdContentCopy />}\n </button>\n </span>\n ) : (\n <Fragment>\n <code ref={ref} className={className}>\n {children}\n </code>\n <button className=\"copy\" onClick={copyCode} aria-label=\"Copy Code\">\n {copied ? <MdDone /> : <MdContentCopy />}\n </button>\n </Fragment>\n );\n};\n", "import { useConfig, useLink } from \"@hyperbook/provider\";\nimport { ComponentType, ReactNode, useEffect, useState } from \"react\";\n\n// see: https://css-tricks.com/better-line-breaks-for-long-urls/\nfunction formatUrl(url: ReactNode) {\n if (typeof url !== \"string\") {\n return url;\n }\n // Split the URL into an array to distinguish double slashes from single slashes\n var doubleSlash = url.split(\"//\");\n\n // Format the strings on either side of double slashes separately\n var formatted = doubleSlash\n .map(\n (str) =>\n // Insert a word break opportunity after a colon\n str\n .replace(/(?<after>:)/giu, \"$1<wbr>\")\n // Before a single slash, tilde, period, comma, hyphen, underline, question mark, number sign, or percent symbol\n .replace(/(?<before>[/~.,\\-_?#%])/giu, \"<wbr>$1\")\n // Before and after an equals sign or ampersand\n .replace(/(?<beforeAndAfter>[=&])/giu, \"<wbr>$1<wbr>\")\n // Reconnect the strings with word break opportunities after double slashes\n )\n .join(\"//<wbr>\");\n\n return formatted;\n}\n\nexport const Link: ComponentType<JSX.IntrinsicElements[\"a\"]> = ({\n href,\n title,\n children,\n}) => {\n const L = useLink();\n const config = useConfig();\n const [isExternal, setIsExternal] = useState(false);\n\n useEffect(() => {\n if (href) {\n const tmp = document.createElement(\"a\");\n tmp.href = href;\n if (tmp.host !== window.location.host) {\n setIsExternal(true);\n } else if (\n config.basePath &&\n !window.location.pathname?.startsWith(config.basePath)\n ) {\n setIsExternal(true);\n } else {\n setIsExternal(false);\n }\n }\n }, [href, config]);\n\n if (isExternal) {\n <L href={href} title={title} target=\"_blank\">\n {formatUrl(children)}\n </L>;\n }\n\n return (\n <L href={href} title={title}>\n {formatUrl(children)}\n </L>\n );\n};\n", "import { ComponentType, ReactNode } from \"react\";\n\nlet tableHeaders: ReactNode[] = [];\nlet tdIndex = 0;\n\nexport const Table: ComponentType<JSX.IntrinsicElements[\"table\"]> = ({\n children,\n style,\n}) => {\n tableHeaders = [];\n return <table style={style}>{children}</table>;\n};\n\nexport const Tr: ComponentType<JSX.IntrinsicElements[\"tr\"]> = ({\n children,\n style,\n}) => {\n tdIndex = 0;\n return <tr style={style}>{children}</tr>;\n};\n\nexport const Td: ComponentType<JSX.IntrinsicElements[\"td\"]> = ({\n children,\n style,\n}) => {\n return (\n <td data-label={tableHeaders[tdIndex++]} style={style}>\n {children}\n </td>\n );\n};\n\nexport const Th: ComponentType<JSX.IntrinsicElements[\"th\"]> = ({\n children,\n style,\n}) => {\n tableHeaders.push(children);\n return <th style={style}>{children}</th>;\n};\n", "import { useBookmark, useConfig } from \"@hyperbook/provider\";\nimport { ComponentType } from \"react\";\n\nexport const makeAnchor = (heading: string) => {\n // If we have a heading, make it lower case\n let anchor = heading.toLowerCase();\n\n // Clean anchor (replace special characters whitespaces).\n // Alternatively, use encodeURIComponent() if you don't care about\n // pretty anchor links\n anchor = anchor.replace(/[^a-zA-Z0-9 ]/g, \"\");\n anchor = anchor.replace(/ /g, \"-\");\n\n return anchor;\n};\n\nexport const Headings =\n (level: number): ComponentType<JSX.IntrinsicElements[\"h1\"]> =>\n ({ children, id }) => {\n const config = useConfig();\n const bookmarksConfig = config?.elements?.bookmarks;\n // Access actual (string) value of heading\n const heading = children?.[0] || \"\";\n\n // If we have a heading, make it lower case\n let anchor = typeof heading === \"string\" ? makeAnchor(heading) : \"\";\n\n const label = typeof heading === \"string\" ? heading : anchor;\n\n const [bookmark, toggleBookmark] = useBookmark(anchor, label);\n\n // Utility\n const container = (children: React.ReactNode): JSX.Element => (\n <>\n <a className=\"heading\" id={id ?? anchor} href={`#${id ?? anchor}`}>\n <span>{children}</span>\n </a>\n {bookmarksConfig !== false && (\n <button\n className={bookmark ? \"bookmark active\" : \"bookmark\"}\n onClick={() => toggleBookmark()}\n title=\"Bookmark\"\n >\n \uD83D\uDD16\n </button>\n )}\n </>\n );\n\n switch (level) {\n case 1:\n return <h1>{container(children)}</h1>;\n case 2:\n return <h2>{container(children)}</h2>;\n case 3:\n return <h3>{container(children)}</h3>;\n case 4:\n return <h4>{container(children)}</h4>;\n case 5:\n return <h5>{container(children)}</h5>;\n\n default:\n return <h6>{container(children)}</h6>;\n }\n };\n", "import { useMakeUrl } from \"@hyperbook/provider\";\nimport { ComponentType, useState } from \"react\";\n\nexport const Image: ComponentType<JSX.IntrinsicElements[\"img\"]> = ({\n src,\n title,\n alt,\n}) => {\n const makeUrl = useMakeUrl();\n const [full, setFull] = useState(false);\n src = makeUrl(src, \"public\");\n\n return (\n <figure className={full ? \"lightbox\" : undefined}>\n <img src={src} alt={alt} onClick={() => setFull((f) => !f)} />\n {title && <figcaption>{title}</figcaption>}\n </figure>\n );\n};\n", "//@ts-nocheck\nimport { visit, SKIP } from \"unist-util-visit\";\nimport { Transformer } from \"unified\";\nimport { BuildVisitor } from \"unist-util-visit/complex-types\";\n\nexport const remarkRemoveComments: () => Transformer = () => (tree) => {\n const htmlCommentRegex = /<!--([\\s\\S]*?)-->/g;\n\n const handler: BuildVisitor = (node, index, parent) => {\n const isComment = node.value.match(htmlCommentRegex);\n\n if (isComment) {\n // remove node\n parent.children.splice(index, 1);\n // Do not traverse `node`, continue at the node *now* at `index`. http://unifiedjs.com/learn/recipe/remove-node/\n return [SKIP, index];\n }\n };\n\n visit(tree, \"html\", handler);\n\n visit(tree, \"jsx\", handler);\n};\n", "import { visit } from \"unist-util-visit\";\nimport { Transformer } from \"unified\";\n\nexport const remarkCustomHeadingIds: () => Transformer = () => {\n return function (node) {\n visit(node, \"heading\", (node) => {\n let lastChild = node.children[node.children.length - 1];\n if (lastChild && lastChild.type === \"text\") {\n let string = lastChild.value.replace(/ +$/, \"\");\n let matched = string.match(/ {#([^]+?)}$/);\n\n if (matched) {\n let id = matched[1];\n if (!!id.length) {\n if (!node.data) {\n node.data = {};\n }\n if (!node.data.hProperties) {\n node.data.hProperties = {};\n }\n node.data.id = node.data.hProperties.id = id;\n\n string = string.substring(0, matched.index);\n lastChild.value = string;\n }\n }\n }\n });\n };\n};\n", "import { Fragment, ReactElement, createElement } from \"react\";\nimport { unified, PluggableList } from \"unified\";\nimport remarkParse from \"remark-parse\";\nimport { Options as RemarkRehypeOptions } from \"mdast-util-to-hast\";\nimport remarkToRehype from \"remark-rehype\";\nimport rehypeReact, { Options as RehypeReactOptions } from \"rehype-react\";\n\ntype PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\nexport interface UseRemarkSyncOptions {\n remarkToRehypeOptions?: RemarkRehypeOptions;\n rehypeReactOptions?: PartialBy<RehypeReactOptions, \"createElement\">;\n remarkPlugins?: PluggableList;\n rehypePlugins?: PluggableList;\n}\n\nexport const useRemarkSync = (\n source: string,\n {\n remarkToRehypeOptions,\n rehypeReactOptions,\n remarkPlugins = [],\n rehypePlugins = [],\n }: UseRemarkSyncOptions = {}\n): ReactElement =>\n unified()\n .use(remarkParse)\n .use(remarkPlugins)\n .use(remarkToRehype, remarkToRehypeOptions)\n .use(rehypePlugins)\n .use(rehypeReact, {\n createElement,\n Fragment,\n ...rehypeReactOptions,\n } as RehypeReactOptions)\n .processSync(source).result as ReactElement;\n", "import remarkParse from \"remark-parse\";\nimport remarkStringify from \"remark-stringify\";\nimport { unified } from \"unified\";\nimport { remarkCustomHeadingIds } from \"./remarkCustomHeadingIds\";\nimport { Heading, remarkHeadings } from \"./remarkHeadings\";\n\nexport const useToc = (markdown: string): Heading[] => {\n return unified()\n .use(remarkCustomHeadingIds)\n .use(remarkParse)\n .use(remarkStringify)\n .use(remarkHeadings)\n .processSync(markdown).data.headings;\n};\n", "import { Plugin } from \"unified\";\nimport { Root as MdastRoot, Heading as AstHeading } from \"mdast\";\nimport { Root as HastRoot } from \"hast\";\nimport { visit } from \"unist-util-visit\";\nimport { toString } from \"mdast-util-to-string\";\n\nexport interface Heading {\n level: number;\n label: string;\n anchor: string;\n}\n\nconst getAnchor = (heading: AstHeading): string => {\n // If we have a heading, make it lower case\n if (heading?.data?.id) {\n return heading.data.id as string;\n }\n\n let anchor = toString(heading, { includeImageAlt: false }).toLowerCase();\n\n // Clean anchor (replace special characters whitespaces).\n // Alternatively, use encodeURIComponent() if you don't care about\n // pretty anchor links\n anchor = anchor.replace(/[^a-zA-Z0-9 ]/g, \"\");\n anchor = anchor.replace(/ /g, \"-\");\n\n return anchor;\n};\n\nconst headings = (root: MdastRoot) => {\n const headingList: Heading[] = [];\n\n visit(root, \"heading\", (node: AstHeading) => {\n const heading: Heading = {\n level: node.depth,\n label: toString(node, { includeImageAlt: false }),\n anchor: getAnchor(node),\n };\n\n headingList.push(heading);\n });\n\n return headingList;\n};\n\nexport const remarkHeadings: Plugin<[], MdastRoot, HastRoot> = () => {\n return (tree, file) => {\n file.data.headings = headings(tree);\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,8BAA4B;AAC5B,qCAAkC;AAClC,wBAAsB;AACtB,yBAAuB;AACvB,2BAAyB;AACzB,kCAA+B;AAC/B,0BAAwB;AACxB,8BAA4B;AAC5B,IAAAA,mBAA8B;AAC9B,oBAAuB;;;ACTvB,sBAA8B;AAC9B,mBAA0D;AAItD;AAFJ,IAAM,gBAAgB,MAAM;AAC1B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,QAAO;AAAA,MACP,MAAK;AAAA,MACL,aAAY;AAAA,MACZ,QAAO;AAAA,MACP,OAAM;AAAA,MACN,SAAQ;AAAA,MAER;AAAA,oDAAC,UAAK,GAAE,iBAAgB,MAAK,QAAO;AAAA,QACpC,4CAAC,UAAK,GAAE,mIAAkI;AAAA;AAAA;AAAA,EAC5I;AAEJ;AAEA,IAAM,SAAS,MAAM;AACnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AA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,WAAW,CAAC,SAAS,EAAE,CAAC;AAAA,IACnE;AAAA,EACF,CAAC;AAED,SACE,8CAAC,SAAI,WAAU,sBACZ;AAAA,eACC,8CAAC,0BACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,YAAY,oBAAoB;AAAA,UAC3C,SAAS,MAAM,aAAa,CAAC,SAAS;AAAA,UACtC,OAAM;AAAA,UAEN;AAAA,yDAAC,SAAI,WAAU,QAAO;AAAA,YACtB,6CAAC,SAAI,WAAU,QAAO;AAAA,YACtB,6CAAC,SAAI,WAAU,QAAO;AAAA,YACtB,6CAAC,SAAI,WAAU,QAAO;AAAA;AAAA;AAAA,MACxB;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,QAAQ;AAAA,UACR,SAAS,MAAM,aAAa,KAAK;AAAA,UACjC,UAAS;AAAA,UAET,uDAAC,SAAI,IAAG,eACN,uDAAC,SAAI,WAAU,OACb,uDAAC,QACE,cAAI,IAAI,CAAC,GAAG,MACX,6CAAC,QAAW,WAAW,SAAS,EAAE,SAChC,uDAAC,OAAE,MAAM,IAAI,EAAE,UAAW,YAAE,OAAM,KAD3B,CAET,CACD,GACH,GACF,GACF;AAAA;AAAA,MACF;AAAA,OACF;AAAA,IAED;AAAA,KACH;AAEJ;",
6
- "names": ["import_provider", "import_provider", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_provider", "import_jsx_runtime", "children", "import_provider", "import_react", "import_jsx_runtime", "import_unist_util_visit", "node", "import_react", "remarkParse", "remarkToRehype", "rehypeReact", "import_remark_parse", "import_unified", "import_unist_util_visit", "remarkParse", "remarkStringify", "import_react", "import_jsx_runtime", "remarkGfm", "remarkDirective", "remarkDirectiveRehype", "remarkMath", "remarkGemoji", "remarkUnwrapImages", "rehypeKatex", "rehypeHighlight"]
3
+ "sources": ["../../../node_modules/.pnpm/is-buffer@2.0.5/node_modules/is-buffer/index.js", "../../../node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.js", "../src/index.ts", "../src/Markdown.tsx", "../src/Code.tsx", "../src/Link.tsx", "../src/Table.tsx", "../src/Headings.tsx", "../src/Image.tsx", "../src/remarkRemoveComments.ts", "../src/remarkCustomHeadingIds.ts", "../src/useRemarkSync.ts", "../../../node_modules/.pnpm/bail@2.0.2/node_modules/bail/index.js", "../../../node_modules/.pnpm/unified@10.1.2/node_modules/unified/lib/index.js", "../../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js", "../../../node_modules/.pnpm/trough@2.1.0/node_modules/trough/index.js", "../../../node_modules/.pnpm/vfile@5.3.7/node_modules/vfile/lib/index.js", "../../../node_modules/.pnpm/unist-util-stringify-position@3.0.3/node_modules/unist-util-stringify-position/lib/index.js", "../../../node_modules/.pnpm/vfile-message@3.1.4/node_modules/vfile-message/lib/index.js", "../../../node_modules/.pnpm/vfile@5.3.7/node_modules/vfile/lib/minpath.browser.js", "../../../node_modules/.pnpm/vfile@5.3.7/node_modules/vfile/lib/minproc.browser.js", "../../../node_modules/.pnpm/vfile@5.3.7/node_modules/vfile/lib/minurl.shared.js", "../../../node_modules/.pnpm/vfile@5.3.7/node_modules/vfile/lib/minurl.browser.js", "../src/useToc.ts", "../src/remarkHeadings.ts"],
4
+ "sourcesContent": ["/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n", "'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n", "export * from \"./Markdown\";\nexport * from \"./useToc\";\n", "import remarkDirective from \"remark-directive\";\nimport remarkDirectiveRehype from \"remark-directive-rehype\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport remarkGemoji from \"remark-gemoji\";\nimport remarkUnwrapImages from \"remark-unwrap-images\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport { useDirectives } from \"@hyperbook/provider\";\nimport { Drawer } from \"@hyperbook/drawer\";\nimport { Code } from \"./Code\";\nimport { Link } from \"./Link\";\nimport { Table, Td, Th, Tr } from \"./Table\";\nimport { Headings } from \"./Headings\";\nimport { Image } from \"./Image\";\n\nimport \"./index.css\";\nimport { remarkRemoveComments } from \"./remarkRemoveComments\";\nimport { remarkCustomHeadingIds } from \"./remarkCustomHeadingIds\";\nimport { useRemarkSync } from \"./useRemarkSync\";\nimport { useToc } from \"./useToc\";\nimport { Fragment, useState } from \"react\";\n\nexport type MarkdownProps = {\n children: string;\n showToc?: boolean;\n};\n\nexport const Markdown = ({ children, showToc = true }: MarkdownProps) => {\n const directives = useDirectives();\n\n const toc = useToc(children);\n const [isTocOpen, setIsTocOpen] = useState(false);\n const reactContent = useRemarkSync(children, {\n rehypeReactOptions: {\n passNode: true,\n components: {\n ...directives,\n a: Link,\n code: Code,\n td: Td,\n th: Th,\n table: Table,\n tr: Tr,\n h1: Headings(1),\n h2: Headings(2),\n h3: Headings(3),\n h4: Headings(4),\n h5: Headings(5),\n h6: Headings(6),\n img: Image,\n },\n },\n remarkPlugins: [\n remarkRemoveComments,\n remarkCustomHeadingIds,\n remarkGfm,\n remarkDirective,\n remarkDirectiveRehype,\n remarkMath,\n remarkGemoji,\n remarkUnwrapImages,\n ],\n rehypePlugins: [\n rehypeKatex,\n [rehypeHighlight, { ignoreMissing: true, plainText: [\"mermaid\"] }],\n ],\n });\n\n return (\n <div className=\"hyperbook-markdown\">\n {showToc && (\n <Fragment>\n <button\n className={isTocOpen ? \"toc-toggle open\" : \"toc-toggle\"}\n onClick={() => setIsTocOpen(!isTocOpen)}\n title=\"Table of Contents\"\n >\n <div className=\"bar1\"></div>\n <div className=\"bar2\"></div>\n <div className=\"bar3\"></div>\n <div className=\"bar4\"></div>\n </button>\n <Drawer\n isOpen={isTocOpen}\n onClose={() => setIsTocOpen(false)}\n position=\"right\"\n >\n <div id=\"toc-sidebar\">\n <nav className=\"toc\">\n <ul>\n {toc.map((h, i) => (\n <li key={i} className={`level-${h.level}`}>\n <a href={`#${h.anchor}`}>{h.label}</a>\n </li>\n ))}\n </ul>\n </nav>\n </div>\n </Drawer>\n </Fragment>\n )}\n {reactContent}\n </div>\n );\n};\n", "import { useDirectives } from \"@hyperbook/provider\";\nimport { ComponentType, Fragment, useRef, useState } from \"react\";\n\nconst MdContentCopy = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n height=\"1em\"\n width=\"1em\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z\" />\n </svg>\n );\n};\n\nconst MdDone = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n height=\"1em\"\n width=\"1em\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z\" />\n </svg>\n );\n};\n\nconst copyNoNavigator = (text: string) => {\n const isIos = navigator.userAgent.match(/ipad|iphone/i);\n const textarea = document.createElement(\"textarea\");\n\n // create textarea\n textarea.value = text;\n\n // ios will zoom in on the input if the font-size is < 16px\n textarea.style.fontSize = \"20px\";\n document.body.appendChild(textarea);\n\n // select text\n if (isIos) {\n const range = document.createRange();\n range.selectNodeContents(textarea);\n\n const selection = window.getSelection();\n if (selection) {\n selection.removeAllRanges();\n selection.addRange(range);\n }\n textarea.setSelectionRange(0, 999999);\n } else {\n textarea.select();\n }\n\n // copy selection\n document.execCommand(\"copy\");\n\n // cleanup\n document.body.removeChild(textarea);\n};\n\nexport const Code: ComponentType<JSX.IntrinsicElements[\"code\"]> = ({\n children,\n className,\n}) => {\n const directives = useDirectives();\n if (className === \"language-mermaid\" && directives[\"mermaid\"]) {\n const Mermaid = directives[\"mermaid\"];\n return <Mermaid children={children} />;\n }\n\n const ref = useRef<HTMLElement>(null);\n const [copied, setCopied] = useState(false);\n const copyCode = () => {\n if (ref.current) {\n const text = ref.current.innerText;\n if (navigator.clipboard) {\n navigator.clipboard\n .writeText(text)\n .then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n })\n .catch(() => {\n copyNoNavigator(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n });\n } else {\n copyNoNavigator(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }\n }\n };\n\n return !className ? (\n <span className=\"inline\">\n <code ref={ref} className={className}>\n {children}\n </code>\n <button className=\"copy\" onClick={copyCode} aria-label=\"Copy Code\">\n {copied ? <MdDone /> : <MdContentCopy />}\n </button>\n </span>\n ) : (\n <Fragment>\n <code ref={ref} className={className}>\n {children}\n </code>\n <button className=\"copy\" onClick={copyCode} aria-label=\"Copy Code\">\n {copied ? <MdDone /> : <MdContentCopy />}\n </button>\n </Fragment>\n );\n};\n", "import { useConfig, useLink } from \"@hyperbook/provider\";\nimport { ComponentType, ReactNode, useEffect, useState } from \"react\";\n\n// see: https://css-tricks.com/better-line-breaks-for-long-urls/\nfunction formatUrl(url: ReactNode) {\n if (typeof url !== \"string\") {\n return url;\n }\n // Split the URL into an array to distinguish double slashes from single slashes\n var doubleSlash = url.split(\"//\");\n\n // Format the strings on either side of double slashes separately\n var formatted = doubleSlash\n .map(\n (str) =>\n // Insert a word break opportunity after a colon\n str\n .replace(/(?<after>:)/giu, \"$1<wbr>\")\n // Before a single slash, tilde, period, comma, hyphen, underline, question mark, number sign, or percent symbol\n .replace(/(?<before>[/~.,\\-_?#%])/giu, \"<wbr>$1\")\n // Before and after an equals sign or ampersand\n .replace(/(?<beforeAndAfter>[=&])/giu, \"<wbr>$1<wbr>\")\n // Reconnect the strings with word break opportunities after double slashes\n )\n .join(\"//<wbr>\");\n\n return formatted;\n}\n\nexport const Link: ComponentType<JSX.IntrinsicElements[\"a\"]> = ({\n href,\n title,\n children,\n}) => {\n const L = useLink();\n const config = useConfig();\n const [isExternal, setIsExternal] = useState(false);\n\n useEffect(() => {\n if (href) {\n const tmp = document.createElement(\"a\");\n tmp.href = href;\n if (tmp.host !== window.location.host) {\n setIsExternal(true);\n } else if (\n config.basePath &&\n !window.location.pathname?.startsWith(config.basePath)\n ) {\n setIsExternal(true);\n } else {\n setIsExternal(false);\n }\n }\n }, [href, config]);\n\n if (isExternal) {\n <L href={href} title={title} target=\"_blank\">\n {formatUrl(children)}\n </L>;\n }\n\n return (\n <L href={href} title={title}>\n {formatUrl(children)}\n </L>\n );\n};\n", "import { ComponentType, ReactNode } from \"react\";\n\nlet tableHeaders: ReactNode[] = [];\nlet tdIndex = 0;\n\nexport const Table: ComponentType<JSX.IntrinsicElements[\"table\"]> = ({\n children,\n style,\n}) => {\n tableHeaders = [];\n return <table style={style}>{children}</table>;\n};\n\nexport const Tr: ComponentType<JSX.IntrinsicElements[\"tr\"]> = ({\n children,\n style,\n}) => {\n tdIndex = 0;\n return <tr style={style}>{children}</tr>;\n};\n\nexport const Td: ComponentType<JSX.IntrinsicElements[\"td\"]> = ({\n children,\n style,\n}) => {\n return (\n <td data-label={tableHeaders[tdIndex++]} style={style}>\n {children}\n </td>\n );\n};\n\nexport const Th: ComponentType<JSX.IntrinsicElements[\"th\"]> = ({\n children,\n style,\n}) => {\n tableHeaders.push(children);\n return <th style={style}>{children}</th>;\n};\n", "import { useBookmark, useConfig } from \"@hyperbook/provider\";\nimport { ComponentType } from \"react\";\n\nexport const makeAnchor = (heading: string) => {\n // If we have a heading, make it lower case\n let anchor = heading.toLowerCase();\n\n // Clean anchor (replace special characters whitespaces).\n // Alternatively, use encodeURIComponent() if you don't care about\n // pretty anchor links\n anchor = anchor.replace(/[^a-zA-Z0-9 ]/g, \"\");\n anchor = anchor.replace(/ /g, \"-\");\n\n return anchor;\n};\n\nexport const Headings =\n (level: number): ComponentType<JSX.IntrinsicElements[\"h1\"]> =>\n ({ children, id }) => {\n const config = useConfig();\n const bookmarksConfig = config?.elements?.bookmarks;\n // Access actual (string) value of heading\n const heading = children?.[0] || \"\";\n\n // If we have a heading, make it lower case\n let anchor = typeof heading === \"string\" ? makeAnchor(heading) : \"\";\n\n const label = typeof heading === \"string\" ? heading : anchor;\n\n const [bookmark, toggleBookmark] = useBookmark(anchor, label);\n\n // Utility\n const container = (children: React.ReactNode): JSX.Element => (\n <>\n <a className=\"heading\" id={id ?? anchor} href={`#${id ?? anchor}`}>\n <span>{children}</span>\n </a>\n {bookmarksConfig !== false && (\n <button\n className={bookmark ? \"bookmark active\" : \"bookmark\"}\n onClick={() => toggleBookmark()}\n title=\"Bookmark\"\n >\n \uD83D\uDD16\n </button>\n )}\n </>\n );\n\n switch (level) {\n case 1:\n return <h1>{container(children)}</h1>;\n case 2:\n return <h2>{container(children)}</h2>;\n case 3:\n return <h3>{container(children)}</h3>;\n case 4:\n return <h4>{container(children)}</h4>;\n case 5:\n return <h5>{container(children)}</h5>;\n\n default:\n return <h6>{container(children)}</h6>;\n }\n };\n", "import { useMakeUrl } from \"@hyperbook/provider\";\nimport { ComponentType, useState } from \"react\";\n\nexport const Image: ComponentType<JSX.IntrinsicElements[\"img\"]> = ({\n src,\n title,\n alt,\n}) => {\n const makeUrl = useMakeUrl();\n const [full, setFull] = useState(false);\n src = makeUrl(src, \"public\");\n\n return (\n <figure className={full ? \"lightbox\" : undefined}>\n <img src={src} alt={alt} onClick={() => setFull((f) => !f)} />\n {title && <figcaption>{title}</figcaption>}\n </figure>\n );\n};\n", "//@ts-nocheck\nimport { visit, SKIP } from \"unist-util-visit\";\nimport { Transformer } from \"unified\";\nimport { BuildVisitor } from \"unist-util-visit/complex-types\";\n\nexport const remarkRemoveComments: () => Transformer = () => (tree) => {\n const htmlCommentRegex = /<!--([\\s\\S]*?)-->/g;\n\n const handler: BuildVisitor = (node, index, parent) => {\n const isComment = node.value.match(htmlCommentRegex);\n\n if (isComment) {\n // remove node\n parent.children.splice(index, 1);\n // Do not traverse `node`, continue at the node *now* at `index`. http://unifiedjs.com/learn/recipe/remove-node/\n return [SKIP, index];\n }\n };\n\n visit(tree, \"html\", handler);\n\n visit(tree, \"jsx\", handler);\n};\n", "import { visit } from \"unist-util-visit\";\nimport { Transformer } from \"unified\";\n\nexport const remarkCustomHeadingIds: () => Transformer = () => {\n return function (node) {\n visit(node, \"heading\", (node) => {\n let lastChild = node.children[node.children.length - 1];\n if (lastChild && lastChild.type === \"text\") {\n let string = lastChild.value.replace(/ +$/, \"\");\n let matched = string.match(/ {#([^]+?)}$/);\n\n if (matched) {\n let id = matched[1];\n if (!!id.length) {\n if (!node.data) {\n node.data = {};\n }\n if (!node.data.hProperties) {\n node.data.hProperties = {};\n }\n node.data.id = node.data.hProperties.id = id;\n\n string = string.substring(0, matched.index);\n lastChild.value = string;\n }\n }\n }\n });\n };\n};\n", "import { Fragment, ReactElement, createElement } from \"react\";\nimport { PluggableList, unified } from \"unified\";\nimport remarkParse from \"remark-parse\";\nimport { Options as RemarkRehypeOptions } from \"mdast-util-to-hast\";\nimport remarkToRehype from \"remark-rehype\";\nimport rehypeReact, { Options as RehypeReactOptions } from \"rehype-react\";\n\ntype PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\nexport interface UseRemarkSyncOptions {\n remarkToRehypeOptions?: RemarkRehypeOptions;\n rehypeReactOptions?: PartialBy<RehypeReactOptions, \"createElement\">;\n remarkPlugins?: PluggableList;\n rehypePlugins?: PluggableList;\n}\n\nexport const useRemarkSync = (\n source: string,\n {\n remarkToRehypeOptions,\n rehypeReactOptions,\n remarkPlugins = [],\n rehypePlugins = [],\n }: UseRemarkSyncOptions = {}\n): ReactElement =>\n unified()\n .use(remarkParse)\n .use(remarkPlugins)\n .use(remarkToRehype, remarkToRehypeOptions)\n .use(rehypePlugins)\n .use(rehypeReact, {\n createElement,\n Fragment,\n ...rehypeReactOptions,\n } as RehypeReactOptions)\n .processSync(source).result as ReactElement;\n", "/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('vfile').VFileCompatible} VFileCompatible\n * @typedef {import('vfile').VFileValue} VFileValue\n * @typedef {import('..').Processor} Processor\n * @typedef {import('..').Plugin} Plugin\n * @typedef {import('..').Preset} Preset\n * @typedef {import('..').Pluggable} Pluggable\n * @typedef {import('..').PluggableList} PluggableList\n * @typedef {import('..').Transformer} Transformer\n * @typedef {import('..').Parser} Parser\n * @typedef {import('..').Compiler} Compiler\n * @typedef {import('..').RunCallback} RunCallback\n * @typedef {import('..').ProcessCallback} ProcessCallback\n *\n * @typedef Context\n * @property {Node} tree\n * @property {VFile} file\n */\n\nimport {bail} from 'bail'\nimport isBuffer from 'is-buffer'\nimport extend from 'extend'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\n\n// Expose a frozen processor.\nexport const unified = base().freeze()\n\nconst own = {}.hasOwnProperty\n\n// Function to create the first processor.\n/**\n * @returns {Processor}\n */\nfunction base() {\n const transformers = trough()\n /** @type {Processor['attachers']} */\n const attachers = []\n /** @type {Record<string, unknown>} */\n let namespace = {}\n /** @type {boolean|undefined} */\n let frozen\n let freezeIndex = -1\n\n // Data management.\n // @ts-expect-error: overloads are handled.\n processor.data = data\n processor.Parser = undefined\n processor.Compiler = undefined\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n // @ts-expect-error: overloads are handled.\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n // @ts-expect-error: overloads are handled.\n processor.run = run\n processor.runSync = runSync\n // @ts-expect-error: overloads are handled.\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n /** @type {Processor} */\n function processor() {\n const destination = base()\n let index = -1\n\n while (++index < attachers.length) {\n destination.use(...attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n /**\n * @param {string|Record<string, unknown>} [key]\n * @param {unknown} [value]\n * @returns {unknown}\n */\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n namespace[key] = value\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n /** @type {Processor['freeze']} */\n function freeze() {\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n const [attacher, ...options] = attachers[freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n /** @type {Transformer|void} */\n const transformer = attacher.call(processor, ...options)\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Number.POSITIVE_INFINITY\n\n return processor\n }\n\n /**\n * @param {Pluggable|null|undefined} [value]\n * @param {...unknown} options\n * @returns {Processor}\n */\n function use(value, ...options) {\n /** @type {Record<string, unknown>|undefined} */\n let settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, ...options)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = Object.assign(namespace.settings || {}, settings)\n }\n\n return processor\n\n /**\n * @param {import('..').Pluggable<unknown[]>} value\n * @returns {void}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...options] = value\n addPlugin(plugin, ...options)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {void}\n */\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = Object.assign(settings || {}, result.settings)\n }\n }\n\n /**\n * @param {PluggableList|null|undefined} [plugins]\n * @returns {void}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {...unknown} [value]\n * @returns {void}\n */\n function addPlugin(plugin, value) {\n let index = -1\n /** @type {Processor['attachers'][number]|undefined} */\n let entry\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entry = attachers[index]\n break\n }\n }\n\n if (entry) {\n if (isPlainObj(entry[1]) && isPlainObj(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n // @ts-expect-error: fine.\n attachers.push([...arguments])\n }\n }\n }\n\n /** @type {Processor['parse']} */\n function parse(doc) {\n processor.freeze()\n const file = vfile(doc)\n const Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n // @ts-expect-error: `newable` checks this.\n return new Parser(String(file), file).parse()\n }\n\n // @ts-expect-error: `newable` checks this.\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n /** @type {Processor['stringify']} */\n function stringify(node, doc) {\n processor.freeze()\n const file = vfile(doc)\n const Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n // @ts-expect-error: `newable` checks this.\n return new Compiler(node, file).compile()\n }\n\n // @ts-expect-error: `newable` checks this.\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n /**\n * @param {Node} node\n * @param {VFileCompatible|RunCallback} [doc]\n * @param {RunCallback} [callback]\n * @returns {Promise<Node>|void}\n */\n function run(node, doc, callback) {\n assertNode(node)\n processor.freeze()\n\n if (!callback && typeof doc === 'function') {\n callback = doc\n doc = undefined\n }\n\n if (!callback) {\n return new Promise(executor)\n }\n\n executor(null, callback)\n\n /**\n * @param {null|((node: Node) => void)} resolve\n * @param {(error: Error) => void} reject\n * @returns {void}\n */\n function executor(resolve, reject) {\n // @ts-expect-error: `doc` can\u2019t be a callback anymore, we checked.\n transformers.run(node, vfile(doc), done)\n\n /**\n * @param {Error|null} error\n * @param {Node} tree\n * @param {VFile} file\n * @returns {void}\n */\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n // @ts-expect-error: `callback` is defined if `resolve` is not.\n callback(null, tree, file)\n }\n }\n }\n }\n\n /** @type {Processor['runSync']} */\n function runSync(node, file) {\n /** @type {Node|undefined} */\n let result\n /** @type {boolean|undefined} */\n let complete\n\n processor.run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n // @ts-expect-error: we either bailed on an error or have a tree.\n return result\n\n /**\n * @param {Error|null} [error]\n * @param {Node} [tree]\n * @returns {void}\n */\n function done(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * @param {VFileCompatible} doc\n * @param {ProcessCallback} [callback]\n * @returns {Promise<VFile>|undefined}\n */\n function process(doc, callback) {\n processor.freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!callback) {\n return new Promise(executor)\n }\n\n executor(null, callback)\n\n /**\n * @param {null|((file: VFile) => void)} resolve\n * @param {(error?: Error|null|undefined) => void} reject\n * @returns {void}\n */\n function executor(resolve, reject) {\n const file = vfile(doc)\n\n processor.run(processor.parse(file), file, (error, tree, file) => {\n if (error || !tree || !file) {\n done(error)\n } else {\n /** @type {unknown} */\n const result = processor.stringify(tree, file)\n\n if (result === undefined || result === null) {\n // Empty.\n } else if (looksLikeAVFileValue(result)) {\n file.value = result\n } else {\n file.result = result\n }\n\n done(error, file)\n }\n })\n\n /**\n * @param {Error|null|undefined} [error]\n * @param {VFile|undefined} [file]\n * @returns {void}\n */\n function done(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n // @ts-expect-error: `callback` is defined if `resolve` is not.\n callback(null, file)\n }\n }\n }\n }\n\n /** @type {Processor['processSync']} */\n function processSync(doc) {\n /** @type {boolean|undefined} */\n let complete\n\n processor.freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n\n const file = vfile(doc)\n\n processor.process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n /**\n * @param {Error|null|undefined} [error]\n * @returns {void}\n */\n function done(error) {\n complete = true\n bail(error)\n }\n }\n}\n\n/**\n * Check if `value` is a constructor.\n *\n * @param {unknown} value\n * @param {string} name\n * @returns {boolean}\n */\nfunction newable(value, name) {\n return (\n typeof value === 'function' &&\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n value.prototype &&\n // A function with keys in its prototype is probably a constructor.\n // Classes\u2019 prototype methods are not enumerable, so we check if some value\n // exists in the prototype.\n // type-coverage:ignore-next-line\n (keys(value.prototype) || name in value.prototype)\n )\n}\n\n/**\n * Check if `value` is an object with keys.\n *\n * @param {Record<string, unknown>} value\n * @returns {boolean}\n */\nfunction keys(value) {\n /** @type {string} */\n let key\n\n for (key in value) {\n if (own.call(value, key)) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `Parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `Compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {VFileCompatible} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {VFileCompatible} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is VFileValue}\n */\nfunction looksLikeAVFileValue(value) {\n return typeof value === 'string' || isBuffer(value)\n}\n", "export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n", "/**\n * @typedef {(error?: Error|null|undefined, ...output: Array<any>) => void} Callback\n * @typedef {(...input: Array<any>) => any} Middleware\n *\n * @typedef {(...input: Array<any>) => void} Run\n * Call all middleware.\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add `fn` (middleware) to the list.\n * @typedef {{run: Run, use: Use}} Pipeline\n * Middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n */\nexport function trough() {\n /** @type {Array<Middleware>} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we\u2019re done.\n *\n * @param {Error|null|undefined} error\n * @param {Array<any>} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware`.\n * Can be sync or async; return a promise, receive a callback, or return new\n * values and errors.\n *\n * @param {Middleware} middleware\n * @param {Callback} callback\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array<any>} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result instanceof Promise) {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Point} Point\n * @typedef {import('./minurl.shared.js').URL} URL\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Value} Value\n */\n\n/**\n * @typedef {Record<string, unknown> & {type: string, position?: Position | undefined}} NodeLike\n *\n * @typedef {'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex'} BufferEncoding\n * Encodings supported by the buffer class.\n *\n * This is a copy of the types from Node, copied to prevent Node globals from\n * being needed.\n * Copied from: <https://github.com/DefinitelyTyped/DefinitelyTyped/blob/90a4ec8/types/node/buffer.d.ts#L170>\n *\n * @typedef {Options | URL | Value | VFile} Compatible\n * Things that can be passed to the constructor.\n *\n * @typedef VFileCoreOptions\n * Set multiple values.\n * @property {Value | null | undefined} [value]\n * Set `value`.\n * @property {string | null | undefined} [cwd]\n * Set `cwd`.\n * @property {Array<string> | null | undefined} [history]\n * Set `history`.\n * @property {URL | string | null | undefined} [path]\n * Set `path`.\n * @property {string | null | undefined} [basename]\n * Set `basename`.\n * @property {string | null | undefined} [stem]\n * Set `stem`.\n * @property {string | null | undefined} [extname]\n * Set `extname`.\n * @property {string | null | undefined} [dirname]\n * Set `dirname`.\n * @property {Data | null | undefined} [data]\n * Set `data`.\n *\n * @typedef Map\n * Raw source map.\n *\n * See:\n * <https://github.com/mozilla/source-map/blob/58819f0/source-map.d.ts#L15-L23>.\n * @property {number} version\n * Which version of the source map spec this map is following.\n * @property {Array<string>} sources\n * An array of URLs to the original source files.\n * @property {Array<string>} names\n * An array of identifiers which can be referenced by individual mappings.\n * @property {string | undefined} [sourceRoot]\n * The URL root from which all sources are relative.\n * @property {Array<string> | undefined} [sourcesContent]\n * An array of contents of the original source files.\n * @property {string} mappings\n * A string of base64 VLQs which contain the actual mappings.\n * @property {string} file\n * The generated file this source map is associated with.\n *\n * @typedef {{[key: string]: unknown} & VFileCoreOptions} Options\n * Configuration.\n *\n * A bunch of keys that will be shallow copied over to the new file.\n *\n * @typedef {Record<string, unknown>} ReporterSettings\n * Configuration for reporters.\n */\n\n/**\n * @template {ReporterSettings} Settings\n * Options type.\n * @callback Reporter\n * Type for a reporter.\n * @param {Array<VFile>} files\n * Files to report.\n * @param {Settings} options\n * Configuration.\n * @returns {string}\n * Report.\n */\n\nimport bufferLike from 'is-buffer'\nimport {VFileMessage} from 'vfile-message'\nimport {path} from './minpath.js'\nimport {proc} from './minproc.js'\nimport {urlToPath, isUrl} from './minurl.js'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n *\n * @type {Array<'basename' | 'dirname' | 'extname' | 'history' | 'path' | 'stem'>}\n */\nconst order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * `options` is treated as:\n *\n * * `string` or `Buffer` \u2014 `{value: options}`\n * * `URL` \u2014 `{path: options}`\n * * `VFile` \u2014 shallow copies its data over to the new file\n * * `object` \u2014 all fields are shallow copied over to the new file\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * You cannot set `dirname` or `extname` without setting either `history`,\n * `path`, `basename`, or `stem` too.\n *\n * @param {Compatible | null | undefined} [value]\n * File value.\n * @returns\n * New instance.\n */\n constructor(value) {\n /** @type {Options | VFile} */\n let options\n\n if (!value) {\n options = {}\n } else if (typeof value === 'string' || buffer(value)) {\n options = {value}\n } else if (isUrl(value)) {\n options = {path: value}\n } else {\n options = value\n }\n\n /**\n * Place to store custom information (default: `{}`).\n *\n * It\u2019s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n *\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of messages associated with the file.\n *\n * @type {Array<VFileMessage>}\n */\n this.messages = []\n\n /**\n * List of filepaths the file moved between.\n *\n * The first is the original path and the last is the current path.\n *\n * @type {Array<string>}\n */\n this.history = []\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n *\n * @type {string}\n */\n this.cwd = proc.cwd()\n\n /* eslint-disable no-unused-expressions */\n /**\n * Raw value.\n *\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are \u201Cwell-known\u201D.\n // As in, used in several tools.\n\n /**\n * Whether a file was saved to disk.\n *\n * This is used by vfile reporters.\n *\n * @type {boolean}\n */\n this.stored\n\n /**\n * Custom, non-string, compiled, representation.\n *\n * This is used by unified to store non-string results.\n * One example is when turning markdown into React nodes.\n *\n * @type {unknown}\n */\n this.result\n\n /**\n * Source map.\n *\n * This type is equivalent to the `RawSourceMap` type from the `source-map`\n * module.\n *\n * @type {Map | null | undefined}\n */\n this.map\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const prop = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (\n prop in options &&\n options[prop] !== undefined &&\n options[prop] !== null\n ) {\n // @ts-expect-error: TS doesn\u2019t understand basic reality.\n this[prop] = prop === 'history' ? [...options[prop]] : options[prop]\n }\n }\n\n /** @type {string} */\n let prop\n\n // Set non-path related properties.\n for (prop in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(prop)) {\n // @ts-expect-error: fine to set other things.\n this[prop] = options[prop]\n }\n }\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n *\n * @returns {string}\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n *\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n *\n * @param {string | URL} path\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the parent path (example: `'~'`).\n */\n get dirname() {\n return typeof this.path === 'string' ? path.dirname(this.path) : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n *\n * Cannot be set if there\u2019s no `path` yet.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = path.join(dirname || '', this.basename)\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n */\n get basename() {\n return typeof this.path === 'string' ? path.basename(this.path) : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = path.join(this.dirname || '', basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n */\n get extname() {\n return typeof this.path === 'string' ? path.extname(this.path) : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there\u2019s no `path` yet.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.charCodeAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = path.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n */\n get stem() {\n return typeof this.path === 'string'\n ? path.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = path.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n /**\n * Serialize the file.\n *\n * @param {BufferEncoding | null | undefined} [encoding='utf8']\n * Character encoding to understand `value` as when it\u2019s a `Buffer`\n * (default: `'utf8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n return (this.value || '').toString(encoding || undefined)\n }\n\n /**\n * Create a warning message associated with the file.\n *\n * Its `fatal` is set to `false` and `file` is set to the current file path.\n * Its added to `file.messages`.\n *\n * @param {string | Error | VFileMessage} reason\n * Reason for message, uses the stack and message of the error if given.\n * @param {Node | NodeLike | Position | Point | null | undefined} [place]\n * Place in file where the message occurred.\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n message(reason, place, origin) {\n const message = new VFileMessage(reason, place, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Create an info message associated with the file.\n *\n * Its `fatal` is set to `null` and `file` is set to the current file path.\n * Its added to `file.messages`.\n *\n * @param {string | Error | VFileMessage} reason\n * Reason for message, uses the stack and message of the error if given.\n * @param {Node | NodeLike | Position | Point | null | undefined} [place]\n * Place in file where the message occurred.\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n info(reason, place, origin) {\n const message = this.message(reason, place, origin)\n\n message.fatal = null\n\n return message\n }\n\n /**\n * Create a fatal error associated with the file.\n *\n * Its `fatal` is set to `true` and `file` is set to the current file path.\n * Its added to `file.messages`.\n *\n * > \uD83D\uDC49 **Note**: a fatal error means that a file is no longer processable.\n *\n * @param {string | Error | VFileMessage} reason\n * Reason for message, uses the stack and message of the error if given.\n * @param {Node | NodeLike | Position | Point | null | undefined} [place]\n * Place in file where the message occurred.\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {never}\n * Message.\n * @throws {VFileMessage}\n * Message.\n */\n fail(reason, place, origin) {\n const message = this.message(reason, place, origin)\n\n message.fatal = true\n\n throw message\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n * File path part.\n * @param {string} name\n * Part name.\n * @returns {void}\n * Nothing.\n */\nfunction assertPart(part, name) {\n if (part && part.includes(path.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + path.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n * Thing.\n * @param {string} name\n * Part name.\n * @returns {asserts part is string}\n * Nothing.\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n * Path.\n * @param {string} name\n * Dependency name.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n\n/**\n * Assert `value` is a buffer.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Buffer}\n * Whether `value` is a Node.js buffer.\n */\nfunction buffer(value) {\n return bufferLike(value)\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n */\n\n/**\n * Serialize the positional info of a point, position (start and end points),\n * or node.\n *\n * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value]\n * Node, position, or point.\n * @returns {string}\n * Pretty printed positional info of a node (`string`).\n *\n * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)\n * or a point `l:c` (when given `point`), where `l` stands for line, `c` for\n * column, `s` for `start`, and `e` for end.\n * An empty string (`''`) is returned if the given value is neither `node`,\n * `position`, nor `point`.\n */\nexport function stringifyPosition(value) {\n // Nothing.\n if (!value || typeof value !== 'object') {\n return ''\n }\n\n // Node.\n if ('position' in value || 'type' in value) {\n return position(value.position)\n }\n\n // Position.\n if ('start' in value || 'end' in value) {\n return position(value)\n }\n\n // Point.\n if ('line' in value || 'column' in value) {\n return point(value)\n }\n\n // ?\n return ''\n}\n\n/**\n * @param {Point | PointLike | null | undefined} point\n * @returns {string}\n */\nfunction point(point) {\n return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position | PositionLike | null | undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number | null | undefined} value\n * @returns {number}\n */\nfunction index(value) {\n return value && typeof value === 'number' ? value : 1\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Point} Point\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {stringifyPosition} from 'unist-util-stringify-position'\n\n/**\n * Message.\n */\nexport class VFileMessage extends Error {\n /**\n * Create a message for `reason` at `place` from `origin`.\n *\n * When an error is passed in as `reason`, the `stack` is copied.\n *\n * @param {string | Error | VFileMessage} reason\n * Reason for message, uses the stack and message of the error if given.\n *\n * > \uD83D\uDC49 **Note**: you should use markdown.\n * @param {Node | NodeLike | Position | Point | null | undefined} [place]\n * Place in file where the message occurred.\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns\n * Instance of `VFileMessage`.\n */\n // To do: next major: expose `undefined` everywhere instead of `null`.\n constructor(reason, place, origin) {\n /** @type {[string | null, string | null]} */\n const parts = [null, null]\n /** @type {Position} */\n let position = {\n // @ts-expect-error: we always follows the structure of `position`.\n start: {line: null, column: null},\n // @ts-expect-error: \"\n end: {line: null, column: null}\n }\n\n super()\n\n if (typeof place === 'string') {\n origin = place\n place = undefined\n }\n\n if (typeof origin === 'string') {\n const index = origin.indexOf(':')\n\n if (index === -1) {\n parts[1] = origin\n } else {\n parts[0] = origin.slice(0, index)\n parts[1] = origin.slice(index + 1)\n }\n }\n\n if (place) {\n // Node.\n if ('type' in place || 'position' in place) {\n if (place.position) {\n // To do: next major: deep clone.\n // @ts-expect-error: looks like a position.\n position = place.position\n }\n }\n // Position.\n else if ('start' in place || 'end' in place) {\n // @ts-expect-error: looks like a position.\n // To do: next major: deep clone.\n position = place\n }\n // Point.\n else if ('line' in place || 'column' in place) {\n // To do: next major: deep clone.\n position.start = place\n }\n }\n\n // Fields from `Error`.\n /**\n * Serialized positional info of error.\n *\n * On normal errors, this would be something like `ParseError`, buit in\n * `VFile` messages we use this space to show where an error happened.\n */\n this.name = stringifyPosition(place) || '1:1'\n\n /**\n * Reason for message.\n *\n * @type {string}\n */\n this.message = typeof reason === 'object' ? reason.message : reason\n\n /**\n * Stack of message.\n *\n * This is used by normal errors to show where something happened in\n * programming code, irrelevant for `VFile` messages,\n *\n * @type {string}\n */\n this.stack = ''\n\n if (typeof reason === 'object' && reason.stack) {\n this.stack = reason.stack\n }\n\n /**\n * Reason for message.\n *\n * > \uD83D\uDC49 **Note**: you should use markdown.\n *\n * @type {string}\n */\n this.reason = this.message\n\n /* eslint-disable no-unused-expressions */\n /**\n * State of problem.\n *\n * * `true` \u2014 marks associated file as no longer processable (error)\n * * `false` \u2014 necessitates a (potential) change (warning)\n * * `null | undefined` \u2014 for things that might not need changing (info)\n *\n * @type {boolean | null | undefined}\n */\n this.fatal\n\n /**\n * Starting line of error.\n *\n * @type {number | null}\n */\n this.line = position.start.line\n\n /**\n * Starting column of error.\n *\n * @type {number | null}\n */\n this.column = position.start.column\n\n /**\n * Full unist position.\n *\n * @type {Position | null}\n */\n this.position = position\n\n /**\n * Namespace of message (example: `'my-package'`).\n *\n * @type {string | null}\n */\n this.source = parts[0]\n\n /**\n * Category of message (example: `'my-rule'`).\n *\n * @type {string | null}\n */\n this.ruleId = parts[1]\n\n /**\n * Path of a file (used throughout the `VFile` ecosystem).\n *\n * @type {string | null}\n */\n this.file\n\n // The following fields are \u201Cwell known\u201D.\n // Not standard.\n // Feel free to add other non-standard fields to your messages.\n\n /**\n * Specify the source value that\u2019s being reported, which is deemed\n * incorrect.\n *\n * @type {string | null}\n */\n this.actual\n\n /**\n * Suggest acceptable values that can be used instead of `actual`.\n *\n * @type {Array<string> | null}\n */\n this.expected\n\n /**\n * Link to docs for the message.\n *\n * > \uD83D\uDC49 **Note**: this must be an absolute URL that can be passed as `x`\n * > to `new URL(x)`.\n *\n * @type {string | null}\n */\n this.url\n\n /**\n * Long form description of the message (you should use markdown).\n *\n * @type {string | null}\n */\n this.note\n /* eslint-enable no-unused-expressions */\n }\n}\n\nVFileMessage.prototype.file = ''\nVFileMessage.prototype.name = ''\nVFileMessage.prototype.reason = ''\nVFileMessage.prototype.message = ''\nVFileMessage.prototype.stack = ''\nVFileMessage.prototype.fatal = null\nVFileMessage.prototype.column = null\nVFileMessage.prototype.line = null\nVFileMessage.prototype.source = null\nVFileMessage.prototype.ruleId = null\nVFileMessage.prototype.position = null\n", "// A derivative work based on:\n// <https://github.com/browserify/path-browserify>.\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node\u2019s internal `path` module:\n// <https://github.com/nodejs/node/blob/master/lib/path.js>.\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const path = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * Get the basename from a path.\n *\n * @param {string} path\n * File path.\n * @param {string | undefined} [ext]\n * Extension to strip.\n * @returns {string}\n * Stem or basename.\n */\nfunction basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') {\n throw new TypeError('\"ext\" argument must be a string')\n }\n\n assertPath(path)\n let start = 0\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let seenNonSlash\n\n if (ext === undefined || ext.length === 0 || ext.length > path.length) {\n while (index--) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // path component.\n seenNonSlash = true\n end = index + 1\n }\n }\n\n return end < 0 ? '' : path.slice(start, end)\n }\n\n if (ext === path) {\n return ''\n }\n\n let firstNonSlashEnd = -1\n let extIndex = ext.length - 1\n\n while (index--) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else {\n if (firstNonSlashEnd < 0) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching.\n seenNonSlash = true\n firstNonSlashEnd = index + 1\n }\n\n if (extIndex > -1) {\n // Try to match the explicit extension.\n if (path.charCodeAt(index) === ext.charCodeAt(extIndex--)) {\n if (extIndex < 0) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = index\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIndex = -1\n end = firstNonSlashEnd\n }\n }\n }\n }\n\n if (start === end) {\n end = firstNonSlashEnd\n } else if (end < 0) {\n end = path.length\n }\n\n return path.slice(start, end)\n}\n\n/**\n * Get the dirname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\nfunction dirname(path) {\n assertPath(path)\n\n if (path.length === 0) {\n return '.'\n }\n\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n // Prefix `--` is important to not run on `0`.\n while (--index) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n if (unmatchedSlash) {\n end = index\n break\n }\n } else if (!unmatchedSlash) {\n // We saw the first non-path separator\n unmatchedSlash = true\n }\n }\n\n return end < 0\n ? path.charCodeAt(0) === 47 /* `/` */\n ? '/'\n : '.'\n : end === 1 && path.charCodeAt(0) === 47 /* `/` */\n ? '//'\n : path.slice(0, end)\n}\n\n/**\n * Get an extname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * Extname.\n */\nfunction extname(path) {\n assertPath(path)\n\n let index = path.length\n\n let end = -1\n let startPart = 0\n let startDot = -1\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find.\n let preDotState = 0\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n while (index--) {\n const code = path.charCodeAt(index)\n\n if (code === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (unmatchedSlash) {\n startPart = index + 1\n break\n }\n\n continue\n }\n\n if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // extension.\n unmatchedSlash = true\n end = index + 1\n }\n\n if (code === 46 /* `.` */) {\n // If this is our first dot, mark it as the start of our extension.\n if (startDot < 0) {\n startDot = index\n } else if (preDotState !== 1) {\n preDotState = 1\n }\n } else if (startDot > -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension.\n preDotState = -1\n }\n }\n\n if (\n startDot < 0 ||\n end < 0 ||\n // We saw a non-dot character immediately before the dot.\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly `..`.\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n ) {\n return ''\n }\n\n return path.slice(startDot, end)\n}\n\n/**\n * Join segments from a path.\n *\n * @param {Array<string>} segments\n * Path segments.\n * @returns {string}\n * File path.\n */\nfunction join(...segments) {\n let index = -1\n /** @type {string | undefined} */\n let joined\n\n while (++index < segments.length) {\n assertPath(segments[index])\n\n if (segments[index]) {\n joined =\n joined === undefined ? segments[index] : joined + '/' + segments[index]\n }\n }\n\n return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Normalize a basic file path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\n// Note: `normalize` is not exposed as `path.normalize`, so some code is\n// manually removed from it.\nfunction normalize(path) {\n assertPath(path)\n\n const absolute = path.charCodeAt(0) === 47 /* `/` */\n\n // Normalize the path according to POSIX rules.\n let value = normalizeString(path, !absolute)\n\n if (value.length === 0 && !absolute) {\n value = '.'\n }\n\n if (value.length > 0 && path.charCodeAt(path.length - 1) === 47 /* / */) {\n value += '/'\n }\n\n return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n * File path.\n * @param {boolean} allowAboveRoot\n * Whether `..` can move above root.\n * @returns {string}\n * File path.\n */\nfunction normalizeString(path, allowAboveRoot) {\n let result = ''\n let lastSegmentLength = 0\n let lastSlash = -1\n let dots = 0\n let index = -1\n /** @type {number | undefined} */\n let code\n /** @type {number} */\n let lastSlashIndex\n\n while (++index <= path.length) {\n if (index < path.length) {\n code = path.charCodeAt(index)\n } else if (code === 47 /* `/` */) {\n break\n } else {\n code = 47 /* `/` */\n }\n\n if (code === 47 /* `/` */) {\n if (lastSlash === index - 1 || dots === 1) {\n // Empty.\n } else if (lastSlash !== index - 1 && dots === 2) {\n if (\n result.length < 2 ||\n lastSegmentLength !== 2 ||\n result.charCodeAt(result.length - 1) !== 46 /* `.` */ ||\n result.charCodeAt(result.length - 2) !== 46 /* `.` */\n ) {\n if (result.length > 2) {\n lastSlashIndex = result.lastIndexOf('/')\n\n if (lastSlashIndex !== result.length - 1) {\n if (lastSlashIndex < 0) {\n result = ''\n lastSegmentLength = 0\n } else {\n result = result.slice(0, lastSlashIndex)\n lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n }\n\n lastSlash = index\n dots = 0\n continue\n }\n } else if (result.length > 0) {\n result = ''\n lastSegmentLength = 0\n lastSlash = index\n dots = 0\n continue\n }\n }\n\n if (allowAboveRoot) {\n result = result.length > 0 ? result + '/..' : '..'\n lastSegmentLength = 2\n }\n } else {\n if (result.length > 0) {\n result += '/' + path.slice(lastSlash + 1, index)\n } else {\n result = path.slice(lastSlash + 1, index)\n }\n\n lastSegmentLength = index - lastSlash - 1\n }\n\n lastSlash = index\n dots = 0\n } else if (code === 46 /* `.` */ && dots > -1) {\n dots++\n } else {\n dots = -1\n }\n }\n\n return result\n}\n\n/**\n * Make sure `path` is a string.\n *\n * @param {string} path\n * File path.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n 'Path must be a string. Received ' + JSON.stringify(path)\n )\n }\n}\n\n/* eslint-enable max-depth, complexity */\n", "// Somewhat based on:\n// <https://github.com/defunctzombie/node-process/blob/master/browser.js>.\n// But I don\u2019t think one tiny line of code can be copyrighted. \uD83D\uDE05\nexport const proc = {cwd}\n\nfunction cwd() {\n return '/'\n}\n", "/**\n * @typedef URL\n * @property {string} hash\n * @property {string} host\n * @property {string} hostname\n * @property {string} href\n * @property {string} origin\n * @property {string} password\n * @property {string} pathname\n * @property {string} port\n * @property {string} protocol\n * @property {string} search\n * @property {any} searchParams\n * @property {string} username\n * @property {() => string} toString\n * @property {() => string} toJSON\n */\n\n/**\n * Check if `fileUrlOrPath` looks like a URL.\n *\n * @param {unknown} fileUrlOrPath\n * File path or URL.\n * @returns {fileUrlOrPath is URL}\n * Whether it\u2019s a URL.\n */\n// From: <https://github.com/nodejs/node/blob/fcf8ba4/lib/internal/url.js#L1501>\nexport function isUrl(fileUrlOrPath) {\n return (\n fileUrlOrPath !== null &&\n typeof fileUrlOrPath === 'object' &&\n // @ts-expect-error: indexable.\n fileUrlOrPath.href &&\n // @ts-expect-error: indexable.\n fileUrlOrPath.origin\n )\n}\n", "/// <reference lib=\"dom\" />\n\nimport {isUrl} from './minurl.shared.js'\n\n// See: <https://github.com/nodejs/node/blob/fcf8ba4/lib/internal/url.js>\n\n/**\n * @param {string | URL} path\n * File URL.\n * @returns {string}\n * File URL.\n */\nexport function urlToPath(path) {\n if (typeof path === 'string') {\n path = new URL(path)\n } else if (!isUrl(path)) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'The \"path\" argument must be of type string or an instance of URL. Received `' +\n path +\n '`'\n )\n error.code = 'ERR_INVALID_ARG_TYPE'\n throw error\n }\n\n if (path.protocol !== 'file:') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError('The URL must be of scheme file')\n error.code = 'ERR_INVALID_URL_SCHEME'\n throw error\n }\n\n return getPathFromURLPosix(path)\n}\n\n/**\n * Get a path from a POSIX URL.\n *\n * @param {URL} url\n * URL.\n * @returns {string}\n * File path.\n */\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL host must be \"localhost\" or empty on darwin'\n )\n error.code = 'ERR_INVALID_FILE_URL_HOST'\n throw error\n }\n\n const pathname = url.pathname\n let index = -1\n\n while (++index < pathname.length) {\n if (\n pathname.charCodeAt(index) === 37 /* `%` */ &&\n pathname.charCodeAt(index + 1) === 50 /* `2` */\n ) {\n const third = pathname.charCodeAt(index + 2)\n if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL path must not include encoded / characters'\n )\n error.code = 'ERR_INVALID_FILE_URL_PATH'\n throw error\n }\n }\n }\n\n return decodeURIComponent(pathname)\n}\n\nexport {isUrl} from './minurl.shared.js'\n", "import remarkParse from \"remark-parse\";\nimport remarkStringify from \"remark-stringify\";\nimport { unified } from \"unified\";\nimport { remarkCustomHeadingIds } from \"./remarkCustomHeadingIds\";\nimport { Heading, remarkHeadings } from \"./remarkHeadings\";\n\nexport const useToc = (markdown: string): Heading[] => {\n return unified()\n .use(remarkCustomHeadingIds)\n .use(remarkParse)\n .use(remarkStringify)\n .use(remarkHeadings)\n .processSync(markdown).data.headings;\n};\n", "import { Plugin } from \"unified\";\nimport { Root as MdastRoot, Heading as AstHeading } from \"mdast\";\nimport { Root as HastRoot } from \"hast\";\nimport { visit } from \"unist-util-visit\";\nimport { toString } from \"mdast-util-to-string\";\n\nexport interface Heading {\n level: number;\n label: string;\n anchor: string;\n}\n\nconst getAnchor = (heading: AstHeading): string => {\n // If we have a heading, make it lower case\n if (heading?.data?.id) {\n return heading.data.id as string;\n }\n\n let anchor = toString(heading, { includeImageAlt: false }).toLowerCase();\n\n // Clean anchor (replace special characters whitespaces).\n // Alternatively, use encodeURIComponent() if you don't care about\n // pretty anchor links\n anchor = anchor.replace(/[^a-zA-Z0-9 ]/g, \"\");\n anchor = anchor.replace(/ /g, \"-\");\n\n return anchor;\n};\n\nconst headings = (root: MdastRoot) => {\n const headingList: Heading[] = [];\n\n visit(root, \"heading\", (node: AstHeading) => {\n const heading: Heading = {\n level: node.depth,\n label: toString(node, { includeImageAlt: false }),\n anchor: getAnchor(node),\n };\n\n headingList.push(heading);\n });\n\n return headingList;\n};\n\nexport const remarkHeadings: Plugin<[], MdastRoot, HastRoot> = () => {\n return (tree, file) => {\n file.data.headings = headings(tree);\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,sFAAAA,SAAA;AAOA,IAAAA,QAAO,UAAU,SAASC,UAAU,KAAK;AACvC,aAAO,OAAO,QAAQ,IAAI,eAAe,QACvC,OAAO,IAAI,YAAY,aAAa,cAAc,IAAI,YAAY,SAAS,GAAG;AAAA,IAClF;AAAA;AAAA;;;ACVA;AAAA,gFAAA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AAA,MACA,qBAAAC;AAAA,MACA,4BAAAC;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb,oBAAAC;AAAA,MACA,CAAC,wBAAAC,SAAiB,EAAE,eAAe,MAAM,WAAW,CAAC,SAAS,EAAE,CAAC;AAAA,IACnE;AAAA,EACF,CAAC;AAED,SACE,8CAAC,SAAI,WAAU,sBACZ;AAAA,eACC,8CAAC,0BACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,YAAY,oBAAoB;AAAA,UAC3C,SAAS,MAAM,aAAa,CAAC,SAAS;AAAA,UACtC,OAAM;AAAA,UAEN;AAAA,yDAAC,SAAI,WAAU,QAAO;AAAA,YACtB,6CAAC,SAAI,WAAU,QAAO;AAAA,YACtB,6CAAC,SAAI,WAAU,QAAO;AAAA,YACtB,6CAAC,SAAI,WAAU,QAAO;AAAA;AAAA;AAAA,MACxB;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,QAAQ;AAAA,UACR,SAAS,MAAM,aAAa,KAAK;AAAA,UACjC,UAAS;AAAA,UAET,uDAAC,SAAI,IAAG,eACN,uDAAC,SAAI,WAAU,OACb,uDAAC,QACE,cAAI,IAAI,CAAC,GAAG,MACX,6CAAC,QAAW,WAAW,SAAS,EAAE,SAChC,uDAAC,OAAE,MAAM,IAAI,EAAE,UAAW,YAAE,OAAM,KAD3B,CAET,CACD,GACH,GACF,GACF;AAAA;AAAA,MACF;AAAA,OACF;AAAA,IAED;AAAA,KACH;AAEJ;",
6
+ "names": ["module", "isBuffer", "module", "isArray", "isPlainObject", "setProperty", "getProperty", "extend", "import_provider", "import_provider", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_provider", "import_jsx_runtime", "children", "import_provider", "import_react", "import_jsx_runtime", "index", "import_unist_util_visit", "node", "import_react", "import_is_buffer", "index", "point", "position", "index", "path", "index", "path", "index", "index", "prop", "path", "dirname", "assertPath", "basename", "extname", "bufferLike", "index", "extend", "value", "options", "file", "isBuffer", "remarkParse", "remarkToRehype", "rehypeReact", "import_remark_parse", "import_unist_util_visit", "remarkParse", "remarkStringify", "import_react", "import_jsx_runtime", "remarkGfm", "remarkDirective", "remarkDirectiveRehype", "remarkMath", "remarkGemoji", "remarkUnwrapImages", "rehypeKatex", "rehypeHighlight"]
7
7
  }