@ox-content/vite-plugin 0.12.0 → 0.13.0

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 +1 @@
1
- {"version":3,"file":"index.cjs","names":["node_process","node_process","rehypeParse","rehypeStringify","parseFrontmatter","transformMermaidStatic","path","path","path","escapeHtml","path","fs","path","rehypeParse","rehypeStringify","extractTitle","path","getUrlPath","collectMarkdownFiles","fs","oxContent","fs","path","path","fs","renderPage","extractTitle","getUrlPath","collectMarkdownFiles","path","escapeHtml","path"],"sources":["../src/environment.ts","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/visit.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/directives.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/anchors.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/applyReviver.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/toJS.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Node.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Alias.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/createNode.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Collection.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyComment.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/foldFlowLines.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyString.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringify.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyPair.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/log.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/merge.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/addPairToJSMap.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Pair.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyCollection.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLMap.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/map.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLSeq.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/seq.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/string.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/null.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/bool.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyNumber.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/float.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/int.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/schema.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/json/schema.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/float.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/int.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/set.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/tags.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/Schema.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyDocument.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/Document.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/errors.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-props.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-contains-newline.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-flow-indent-check.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-map-includes.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-map.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-seq.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-end.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-collection.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-collection.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-node.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-doc.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/composer.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-stringify.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-visit.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/lexer.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/line-counter.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/parser.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/public-api.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/index.js","../src/highlight.ts","../src/plugins/mermaid-protect.ts","../src/transform.ts","../src/nav-generator.ts","../src/docs.ts","../src/og-image/renderer.ts","../src/og-image/browser.ts","../src/og-image/template.ts","../src/og-image/cache.ts","../src/og-image/index.ts","../src/plugins/index.ts","../src/island/parse.ts","../src/theme.ts","../src/ssg.ts","../src/search.ts","../src/dev-server.ts","../src/og-viewer.ts","../src/jsx-runtime.ts","../src/page-context.ts","../src/theme-renderer.ts","../src/index.ts"],"sourcesContent":["/**\n * Vite Environment API integration for Ox Content.\n *\n * Creates a dedicated environment for Markdown processing,\n * enabling SSG-style rendering with separate client/server contexts.\n */\n\nimport type { EnvironmentOptions } from \"vite\";\nimport type { ResolvedOptions } from \"./types\";\n\n/**\n * Creates the Markdown processing environment configuration.\n *\n * This environment is used for:\n * - Server-side rendering of Markdown files\n * - Static site generation\n * - Pre-rendering at build time\n *\n * @example\n * ```ts\n * // In your vite.config.ts\n * export default defineConfig({\n * environments: {\n * markdown: createMarkdownEnvironment({\n * srcDir: 'content',\n * gfm: true,\n * }),\n * },\n * });\n * ```\n */\nexport function createMarkdownEnvironment(options: ResolvedOptions): EnvironmentOptions {\n return {\n // Consumer type for this environment\n consumer: \"server\",\n\n // Build configuration\n build: {\n // Output to a separate directory\n outDir: `${options.outDir}/.markdown`,\n\n // Emit assets for SSG\n emitAssets: true,\n\n // Create manifest for asset tracking\n manifest: true,\n\n // SSR-like externalization\n rollupOptions: {\n external: [\n // Externalize Node.js built-ins\n /^node:/,\n // Externalize native modules\n /\\.node$/,\n ],\n },\n },\n\n // Resolve configuration\n resolve: {\n // Handle .md files\n extensions: [\".md\", \".markdown\"],\n\n // Conditions for module resolution\n conditions: [\"markdown\", \"node\", \"import\"],\n\n // Don't dedupe - each environment gets its own modules\n dedupe: [],\n },\n\n // Optimize dependencies\n optimizeDeps: {\n // Include ox-content dependencies\n include: [],\n // Exclude native modules\n exclude: [\"@ox-content/napi\"],\n },\n };\n}\n\n/**\n * Environment-specific module transformer.\n *\n * This is called during the transform phase to process\n * Markdown files within the environment context.\n */\nexport interface EnvironmentTransformContext {\n /**\n * Current environment name.\n */\n environment: string;\n\n /**\n * Whether we're in development mode.\n */\n isDev: boolean;\n\n /**\n * Whether this is a server-side render.\n */\n isSSR: boolean;\n\n /**\n * The resolved Vite config.\n */\n config: unknown;\n}\n\n/**\n * Creates environment-aware transform options.\n */\nexport function createTransformOptions(\n ctx: EnvironmentTransformContext,\n options: ResolvedOptions,\n): ResolvedOptions {\n return {\n ...options,\n // Adjust options based on environment\n highlight: ctx.isSSR ? options.highlight : false,\n ogImage: ctx.isSSR ? options.ogImage : false,\n };\n}\n\n/**\n * Runs pre-render for SSG.\n *\n * This function is called during build to pre-render all Markdown files.\n */\nexport async function prerender(\n files: string[],\n _options: ResolvedOptions,\n): Promise<Map<string, string>> {\n const results = new Map<string, string>();\n\n for (const file of files) {\n // In production, this would use the Ox Content parser\n // For now, we just mark the file as needing processing\n results.set(file, `/* Pre-rendered: ${file} */`);\n }\n\n return results;\n}\n\n/**\n * Environment plugin factory.\n *\n * Creates plugins specific to the Markdown environment.\n */\nexport function createEnvironmentPlugins(_options: ResolvedOptions) {\n return [\n {\n name: \"ox-content:markdown-env\",\n\n // Only apply to markdown environment\n applyToEnvironment(name: string) {\n return name === \"markdown\";\n },\n\n // Transform within the environment\n transform(code: string, id: string) {\n if (!id.endsWith(\".md\")) {\n return null;\n }\n\n // Environment-specific transformation\n return {\n code: `\n // Transformed in markdown environment\n ${code}\n `,\n };\n },\n },\n ];\n}\n","'use strict';\n\nconst ALIAS = Symbol.for('yaml.alias');\nconst DOC = Symbol.for('yaml.document');\nconst MAP = Symbol.for('yaml.map');\nconst PAIR = Symbol.for('yaml.pair');\nconst SCALAR = Symbol.for('yaml.scalar');\nconst SEQ = Symbol.for('yaml.seq');\nconst NODE_TYPE = Symbol.for('yaml.node.type');\nconst isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;\nconst isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;\nconst isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;\nconst isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;\nconst isScalar = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR;\nconst isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;\nfunction isCollection(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case MAP:\n case SEQ:\n return true;\n }\n return false;\n}\nfunction isNode(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case ALIAS:\n case MAP:\n case SCALAR:\n case SEQ:\n return true;\n }\n return false;\n}\nconst hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;\n\nexports.ALIAS = ALIAS;\nexports.DOC = DOC;\nexports.MAP = MAP;\nexports.NODE_TYPE = NODE_TYPE;\nexports.PAIR = PAIR;\nexports.SCALAR = SCALAR;\nexports.SEQ = SEQ;\nexports.hasAnchor = hasAnchor;\nexports.isAlias = isAlias;\nexports.isCollection = isCollection;\nexports.isDocument = isDocument;\nexports.isMap = isMap;\nexports.isNode = isNode;\nexports.isPair = isPair;\nexports.isScalar = isScalar;\nexports.isSeq = isSeq;\n","'use strict';\n\nvar identity = require('./nodes/identity.js');\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove node');\n/**\n * Apply a visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nfunction visit(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n visit_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisit.SKIP = SKIP;\n/** Remove the current node */\nvisit.REMOVE = REMOVE;\nfunction visit_(key, node, visitor, path) {\n const ctrl = callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visit_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = visit_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = visit_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = visit_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\n/**\n * Apply an async visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `Promise`: Must resolve to one of the following values\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nasync function visitAsync(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n await visitAsync_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisitAsync.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisitAsync.SKIP = SKIP;\n/** Remove the current node */\nvisitAsync.REMOVE = REMOVE;\nasync function visitAsync_(key, node, visitor, path) {\n const ctrl = await callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visitAsync_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = await visitAsync_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = await visitAsync_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = await visitAsync_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\nfunction initVisitor(visitor) {\n if (typeof visitor === 'object' &&\n (visitor.Collection || visitor.Node || visitor.Value)) {\n return Object.assign({\n Alias: visitor.Node,\n Map: visitor.Node,\n Scalar: visitor.Node,\n Seq: visitor.Node\n }, visitor.Value && {\n Map: visitor.Value,\n Scalar: visitor.Value,\n Seq: visitor.Value\n }, visitor.Collection && {\n Map: visitor.Collection,\n Seq: visitor.Collection\n }, visitor);\n }\n return visitor;\n}\nfunction callVisitor(key, node, visitor, path) {\n if (typeof visitor === 'function')\n return visitor(key, node, path);\n if (identity.isMap(node))\n return visitor.Map?.(key, node, path);\n if (identity.isSeq(node))\n return visitor.Seq?.(key, node, path);\n if (identity.isPair(node))\n return visitor.Pair?.(key, node, path);\n if (identity.isScalar(node))\n return visitor.Scalar?.(key, node, path);\n if (identity.isAlias(node))\n return visitor.Alias?.(key, node, path);\n return undefined;\n}\nfunction replaceNode(key, path, node) {\n const parent = path[path.length - 1];\n if (identity.isCollection(parent)) {\n parent.items[key] = node;\n }\n else if (identity.isPair(parent)) {\n if (key === 'key')\n parent.key = node;\n else\n parent.value = node;\n }\n else if (identity.isDocument(parent)) {\n parent.contents = node;\n }\n else {\n const pt = identity.isAlias(parent) ? 'alias' : 'scalar';\n throw new Error(`Cannot replace node with ${pt} parent`);\n }\n}\n\nexports.visit = visit;\nexports.visitAsync = visitAsync;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\nconst escapeChars = {\n '!': '%21',\n ',': '%2C',\n '[': '%5B',\n ']': '%5D',\n '{': '%7B',\n '}': '%7D'\n};\nconst escapeTagName = (tn) => tn.replace(/[!,[\\]{}]/g, ch => escapeChars[ch]);\nclass Directives {\n constructor(yaml, tags) {\n /**\n * The directives-end/doc-start marker `---`. If `null`, a marker may still be\n * included in the document's stringified representation.\n */\n this.docStart = null;\n /** The doc-end marker `...`. */\n this.docEnd = false;\n this.yaml = Object.assign({}, Directives.defaultYaml, yaml);\n this.tags = Object.assign({}, Directives.defaultTags, tags);\n }\n clone() {\n const copy = new Directives(this.yaml, this.tags);\n copy.docStart = this.docStart;\n return copy;\n }\n /**\n * During parsing, get a Directives instance for the current document and\n * update the stream state according to the current version's spec.\n */\n atDocument() {\n const res = new Directives(this.yaml, this.tags);\n switch (this.yaml.version) {\n case '1.1':\n this.atNextDocument = true;\n break;\n case '1.2':\n this.atNextDocument = false;\n this.yaml = {\n explicit: Directives.defaultYaml.explicit,\n version: '1.2'\n };\n this.tags = Object.assign({}, Directives.defaultTags);\n break;\n }\n return res;\n }\n /**\n * @param onError - May be called even if the action was successful\n * @returns `true` on success\n */\n add(line, onError) {\n if (this.atNextDocument) {\n this.yaml = { explicit: Directives.defaultYaml.explicit, version: '1.1' };\n this.tags = Object.assign({}, Directives.defaultTags);\n this.atNextDocument = false;\n }\n const parts = line.trim().split(/[ \\t]+/);\n const name = parts.shift();\n switch (name) {\n case '%TAG': {\n if (parts.length !== 2) {\n onError(0, '%TAG directive should contain exactly two parts');\n if (parts.length < 2)\n return false;\n }\n const [handle, prefix] = parts;\n this.tags[handle] = prefix;\n return true;\n }\n case '%YAML': {\n this.yaml.explicit = true;\n if (parts.length !== 1) {\n onError(0, '%YAML directive should contain exactly one part');\n return false;\n }\n const [version] = parts;\n if (version === '1.1' || version === '1.2') {\n this.yaml.version = version;\n return true;\n }\n else {\n const isValid = /^\\d+\\.\\d+$/.test(version);\n onError(6, `Unsupported YAML version ${version}`, isValid);\n return false;\n }\n }\n default:\n onError(0, `Unknown directive ${name}`, true);\n return false;\n }\n }\n /**\n * Resolves a tag, matching handles to those defined in %TAG directives.\n *\n * @returns Resolved tag, which may also be the non-specific tag `'!'` or a\n * `'!local'` tag, or `null` if unresolvable.\n */\n tagName(source, onError) {\n if (source === '!')\n return '!'; // non-specific tag\n if (source[0] !== '!') {\n onError(`Not a valid tag: ${source}`);\n return null;\n }\n if (source[1] === '<') {\n const verbatim = source.slice(2, -1);\n if (verbatim === '!' || verbatim === '!!') {\n onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);\n return null;\n }\n if (source[source.length - 1] !== '>')\n onError('Verbatim tags must end with a >');\n return verbatim;\n }\n const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);\n if (!suffix)\n onError(`The ${source} tag has no suffix`);\n const prefix = this.tags[handle];\n if (prefix) {\n try {\n return prefix + decodeURIComponent(suffix);\n }\n catch (error) {\n onError(String(error));\n return null;\n }\n }\n if (handle === '!')\n return source; // local tag\n onError(`Could not resolve tag: ${source}`);\n return null;\n }\n /**\n * Given a fully resolved tag, returns its printable string form,\n * taking into account current tag prefixes and defaults.\n */\n tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }\n toString(doc) {\n const lines = this.yaml.explicit\n ? [`%YAML ${this.yaml.version || '1.2'}`]\n : [];\n const tagEntries = Object.entries(this.tags);\n let tagNames;\n if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {\n const tags = {};\n visit.visit(doc.contents, (_key, node) => {\n if (identity.isNode(node) && node.tag)\n tags[node.tag] = true;\n });\n tagNames = Object.keys(tags);\n }\n else\n tagNames = [];\n for (const [handle, prefix] of tagEntries) {\n if (handle === '!!' && prefix === 'tag:yaml.org,2002:')\n continue;\n if (!doc || tagNames.some(tn => tn.startsWith(prefix)))\n lines.push(`%TAG ${handle} ${prefix}`);\n }\n return lines.join('\\n');\n }\n}\nDirectives.defaultYaml = { explicit: false, version: '1.2' };\nDirectives.defaultTags = { '!!': 'tag:yaml.org,2002:' };\n\nexports.Directives = Directives;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\n/**\n * Verify that the input string is a valid anchor.\n *\n * Will throw on errors.\n */\nfunction anchorIsValid(anchor) {\n if (/[\\x00-\\x19\\s,[\\]{}]/.test(anchor)) {\n const sa = JSON.stringify(anchor);\n const msg = `Anchor must not contain whitespace or control characters: ${sa}`;\n throw new Error(msg);\n }\n return true;\n}\nfunction anchorNames(root) {\n const anchors = new Set();\n visit.visit(root, {\n Value(_key, node) {\n if (node.anchor)\n anchors.add(node.anchor);\n }\n });\n return anchors;\n}\n/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */\nfunction findNewAnchor(prefix, exclude) {\n for (let i = 1; true; ++i) {\n const name = `${prefix}${i}`;\n if (!exclude.has(name))\n return name;\n }\n}\nfunction createNodeAnchors(doc, prefix) {\n const aliasObjects = [];\n const sourceObjects = new Map();\n let prevAnchors = null;\n return {\n onAnchor: (source) => {\n aliasObjects.push(source);\n prevAnchors ?? (prevAnchors = anchorNames(doc));\n const anchor = findNewAnchor(prefix, prevAnchors);\n prevAnchors.add(anchor);\n return anchor;\n },\n /**\n * With circular references, the source node is only resolved after all\n * of its child nodes are. This is why anchors are set only after all of\n * the nodes have been created.\n */\n setAnchors: () => {\n for (const source of aliasObjects) {\n const ref = sourceObjects.get(source);\n if (typeof ref === 'object' &&\n ref.anchor &&\n (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {\n ref.node.anchor = ref.anchor;\n }\n else {\n const error = new Error('Failed to resolve repeated object (this should not happen)');\n error.source = source;\n throw error;\n }\n }\n },\n sourceObjects\n };\n}\n\nexports.anchorIsValid = anchorIsValid;\nexports.anchorNames = anchorNames;\nexports.createNodeAnchors = createNodeAnchors;\nexports.findNewAnchor = findNewAnchor;\n","'use strict';\n\n/**\n * Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,\n * in section 24.5.1.1 \"Runtime Semantics: InternalizeJSONProperty\" of the\n * 2021 edition: https://tc39.es/ecma262/#sec-json.parse\n *\n * Includes extensions for handling Map and Set objects.\n */\nfunction applyReviver(reviver, obj, key, val) {\n if (val && typeof val === 'object') {\n if (Array.isArray(val)) {\n for (let i = 0, len = val.length; i < len; ++i) {\n const v0 = val[i];\n const v1 = applyReviver(reviver, val, String(i), v0);\n // eslint-disable-next-line @typescript-eslint/no-array-delete\n if (v1 === undefined)\n delete val[i];\n else if (v1 !== v0)\n val[i] = v1;\n }\n }\n else if (val instanceof Map) {\n for (const k of Array.from(val.keys())) {\n const v0 = val.get(k);\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n val.delete(k);\n else if (v1 !== v0)\n val.set(k, v1);\n }\n }\n else if (val instanceof Set) {\n for (const v0 of Array.from(val)) {\n const v1 = applyReviver(reviver, val, v0, v0);\n if (v1 === undefined)\n val.delete(v0);\n else if (v1 !== v0) {\n val.delete(v0);\n val.add(v1);\n }\n }\n }\n else {\n for (const [k, v0] of Object.entries(val)) {\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n delete val[k];\n else if (v1 !== v0)\n val[k] = v1;\n }\n }\n }\n return reviver.call(obj, key, val);\n}\n\nexports.applyReviver = applyReviver;\n","'use strict';\n\nvar identity = require('./identity.js');\n\n/**\n * Recursively convert any node or its contents to native JavaScript\n *\n * @param value - The input value\n * @param arg - If `value` defines a `toJSON()` method, use this\n * as its first argument\n * @param ctx - Conversion context, originally set in Document#toJS(). If\n * `{ keep: true }` is not set, output should be suitable for JSON\n * stringification.\n */\nfunction toJS(value, arg, ctx) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n if (Array.isArray(value))\n return value.map((v, i) => toJS(v, String(i), ctx));\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n if (!ctx || !identity.hasAnchor(value))\n return value.toJSON(arg, ctx);\n const data = { aliasCount: 0, count: 1, res: undefined };\n ctx.anchors.set(value, data);\n ctx.onCreate = res => {\n data.res = res;\n delete ctx.onCreate;\n };\n const res = value.toJSON(arg, ctx);\n if (ctx.onCreate)\n ctx.onCreate(res);\n return res;\n }\n if (typeof value === 'bigint' && !ctx?.keep)\n return Number(value);\n return value;\n}\n\nexports.toJS = toJS;\n","'use strict';\n\nvar applyReviver = require('../doc/applyReviver.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nclass NodeBase {\n constructor(type) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: type });\n }\n /** Create a copy of this node. */\n clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** A plain JavaScript representation of this node. */\n toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n if (!identity.isDocument(doc))\n throw new TypeError('A document argument is required');\n const ctx = {\n anchors: new Map(),\n doc,\n keep: true,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this, '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n}\n\nexports.NodeBase = NodeBase;\n","'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar visit = require('../visit.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nclass Alias extends Node.NodeBase {\n constructor(source) {\n super(identity.ALIAS);\n this.source = source;\n Object.defineProperty(this, 'tag', {\n set() {\n throw new Error('Alias nodes cannot have tags');\n }\n });\n }\n /**\n * Resolve the value of this alias within `doc`, finding the last\n * instance of the `source` anchor before this node.\n */\n resolve(doc, ctx) {\n let nodes;\n if (ctx?.aliasResolveCache) {\n nodes = ctx.aliasResolveCache;\n }\n else {\n nodes = [];\n visit.visit(doc, {\n Node: (_key, node) => {\n if (identity.isAlias(node) || identity.hasAnchor(node))\n nodes.push(node);\n }\n });\n if (ctx)\n ctx.aliasResolveCache = nodes;\n }\n let found = undefined;\n for (const node of nodes) {\n if (node === this)\n break;\n if (node.anchor === this.source)\n found = node;\n }\n return found;\n }\n toJSON(_arg, ctx) {\n if (!ctx)\n return { source: this.source };\n const { anchors, doc, maxAliasCount } = ctx;\n const source = this.resolve(doc, ctx);\n if (!source) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new ReferenceError(msg);\n }\n let data = anchors.get(source);\n if (!data) {\n // Resolve anchors for Node.prototype.toJS()\n toJS.toJS(source, null, ctx);\n data = anchors.get(source);\n }\n /* istanbul ignore if */\n if (data?.res === undefined) {\n const msg = 'This should not happen: Alias anchor was not resolved?';\n throw new ReferenceError(msg);\n }\n if (maxAliasCount >= 0) {\n data.count += 1;\n if (data.aliasCount === 0)\n data.aliasCount = getAliasCount(doc, source, anchors);\n if (data.count * data.aliasCount > maxAliasCount) {\n const msg = 'Excessive alias count indicates a resource exhaustion attack';\n throw new ReferenceError(msg);\n }\n }\n return data.res;\n }\n toString(ctx, _onComment, _onChompKeep) {\n const src = `*${this.source}`;\n if (ctx) {\n anchors.anchorIsValid(this.source);\n if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new Error(msg);\n }\n if (ctx.implicitKey)\n return `${src} `;\n }\n return src;\n }\n}\nfunction getAliasCount(doc, node, anchors) {\n if (identity.isAlias(node)) {\n const source = node.resolve(doc);\n const anchor = anchors && source && anchors.get(source);\n return anchor ? anchor.count * anchor.aliasCount : 0;\n }\n else if (identity.isCollection(node)) {\n let count = 0;\n for (const item of node.items) {\n const c = getAliasCount(doc, item, anchors);\n if (c > count)\n count = c;\n }\n return count;\n }\n else if (identity.isPair(node)) {\n const kc = getAliasCount(doc, node.key, anchors);\n const vc = getAliasCount(doc, node.value, anchors);\n return Math.max(kc, vc);\n }\n return 1;\n}\n\nexports.Alias = Alias;\n","'use strict';\n\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nconst isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');\nclass Scalar extends Node.NodeBase {\n constructor(value) {\n super(identity.SCALAR);\n this.value = value;\n }\n toJSON(arg, ctx) {\n return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);\n }\n toString() {\n return String(this.value);\n }\n}\nScalar.BLOCK_FOLDED = 'BLOCK_FOLDED';\nScalar.BLOCK_LITERAL = 'BLOCK_LITERAL';\nScalar.PLAIN = 'PLAIN';\nScalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';\nScalar.QUOTE_SINGLE = 'QUOTE_SINGLE';\n\nexports.Scalar = Scalar;\nexports.isScalarValue = isScalarValue;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\n\nconst defaultTagPrefix = 'tag:yaml.org,2002:';\nfunction findTagObject(value, tagName, tags) {\n if (tagName) {\n const match = tags.filter(t => t.tag === tagName);\n const tagObj = match.find(t => !t.format) ?? match[0];\n if (!tagObj)\n throw new Error(`Tag ${tagName} not found`);\n return tagObj;\n }\n return tags.find(t => t.identify?.(value) && !t.format);\n}\nfunction createNode(value, tagName, ctx) {\n if (identity.isDocument(value))\n value = value.contents;\n if (identity.isNode(value))\n return value;\n if (identity.isPair(value)) {\n const map = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);\n map.items.push(value);\n return map;\n }\n if (value instanceof String ||\n value instanceof Number ||\n value instanceof Boolean ||\n (typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere\n ) {\n // https://tc39.es/ecma262/#sec-serializejsonproperty\n value = value.valueOf();\n }\n const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;\n // Detect duplicate references to the same object & use Alias nodes for all\n // after first. The `ref` wrapper allows for circular references to resolve.\n let ref = undefined;\n if (aliasDuplicateObjects && value && typeof value === 'object') {\n ref = sourceObjects.get(value);\n if (ref) {\n ref.anchor ?? (ref.anchor = onAnchor(value));\n return new Alias.Alias(ref.anchor);\n }\n else {\n ref = { anchor: null, node: null };\n sourceObjects.set(value, ref);\n }\n }\n if (tagName?.startsWith('!!'))\n tagName = defaultTagPrefix + tagName.slice(2);\n let tagObj = findTagObject(value, tagName, schema.tags);\n if (!tagObj) {\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n value = value.toJSON();\n }\n if (!value || typeof value !== 'object') {\n const node = new Scalar.Scalar(value);\n if (ref)\n ref.node = node;\n return node;\n }\n tagObj =\n value instanceof Map\n ? schema[identity.MAP]\n : Symbol.iterator in Object(value)\n ? schema[identity.SEQ]\n : schema[identity.MAP];\n }\n if (onTagObj) {\n onTagObj(tagObj);\n delete ctx.onTagObj;\n }\n const node = tagObj?.createNode\n ? tagObj.createNode(ctx.schema, value, ctx)\n : typeof tagObj?.nodeClass?.from === 'function'\n ? tagObj.nodeClass.from(ctx.schema, value, ctx)\n : new Scalar.Scalar(value);\n if (tagName)\n node.tag = tagName;\n else if (!tagObj.default)\n node.tag = tagObj.tag;\n if (ref)\n ref.node = node;\n return node;\n}\n\nexports.createNode = createNode;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\n\nfunction collectionFromPath(schema, path, value) {\n let v = value;\n for (let i = path.length - 1; i >= 0; --i) {\n const k = path[i];\n if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {\n const a = [];\n a[k] = v;\n v = a;\n }\n else {\n v = new Map([[k, v]]);\n }\n }\n return createNode.createNode(v, undefined, {\n aliasDuplicateObjects: false,\n keepUndefined: false,\n onAnchor: () => {\n throw new Error('This should not happen, please report a bug.');\n },\n schema,\n sourceObjects: new Map()\n });\n}\n// Type guard is intentionally a little wrong so as to be more useful,\n// as it does not cover untypable empty non-string iterables (e.g. []).\nconst isEmptyPath = (path) => path == null ||\n (typeof path === 'object' && !!path[Symbol.iterator]().next().done);\nclass Collection extends Node.NodeBase {\n constructor(type, schema) {\n super(type);\n Object.defineProperty(this, 'schema', {\n value: schema,\n configurable: true,\n enumerable: false,\n writable: true\n });\n }\n /**\n * Create a copy of this collection.\n *\n * @param schema - If defined, overwrites the original's schema\n */\n clone(schema) {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (schema)\n copy.schema = schema;\n copy.items = copy.items.map(it => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /**\n * Adds a value to the collection. For `!!map` and `!!omap` the value must\n * be a Pair instance or a `{ key, value }` object, which may not have a key\n * that already exists in the map.\n */\n addIn(path, value) {\n if (isEmptyPath(path))\n this.add(value);\n else {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.addIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n /**\n * Removes a value from the collection.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.delete(key);\n const node = this.get(key, true);\n if (identity.isCollection(node))\n return node.deleteIn(rest);\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (rest.length === 0)\n return !keepScalar && identity.isScalar(node) ? node.value : node;\n else\n return identity.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;\n }\n hasAllNullValues(allowScalar) {\n return this.items.every(node => {\n if (!identity.isPair(node))\n return false;\n const n = node.value;\n return (n == null ||\n (allowScalar &&\n identity.isScalar(n) &&\n n.value == null &&\n !n.commentBefore &&\n !n.comment &&\n !n.tag));\n });\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n */\n hasIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.has(key);\n const node = this.get(key, true);\n return identity.isCollection(node) ? node.hasIn(rest) : false;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n const [key, ...rest] = path;\n if (rest.length === 0) {\n this.set(key, value);\n }\n else {\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.setIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n}\n\nexports.Collection = Collection;\nexports.collectionFromPath = collectionFromPath;\nexports.isEmptyPath = isEmptyPath;\n","'use strict';\n\n/**\n * Stringifies a comment.\n *\n * Empty comment lines are left empty,\n * lines consisting of a single space are replaced by `#`,\n * and all other lines are prefixed with a `#`.\n */\nconst stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');\nfunction indentComment(comment, indent) {\n if (/^\\n+$/.test(comment))\n return comment.substring(1);\n return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;\n}\nconst lineComment = (str, indent, comment) => str.endsWith('\\n')\n ? indentComment(comment, indent)\n : comment.includes('\\n')\n ? '\\n' + indentComment(comment, indent)\n : (str.endsWith(' ') ? '' : ' ') + comment;\n\nexports.indentComment = indentComment;\nexports.lineComment = lineComment;\nexports.stringifyComment = stringifyComment;\n","'use strict';\n\nconst FOLD_FLOW = 'flow';\nconst FOLD_BLOCK = 'block';\nconst FOLD_QUOTED = 'quoted';\n/**\n * Tries to keep input at up to `lineWidth` characters, splitting only on spaces\n * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are\n * terminated with `\\n` and started with `indent`.\n */\nfunction foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {\n if (!lineWidth || lineWidth < 0)\n return text;\n if (lineWidth < minContentWidth)\n minContentWidth = 0;\n const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);\n if (text.length <= endStep)\n return text;\n const folds = [];\n const escapedFolds = {};\n let end = lineWidth - indent.length;\n if (typeof indentAtStart === 'number') {\n if (indentAtStart > lineWidth - Math.max(2, minContentWidth))\n folds.push(0);\n else\n end = lineWidth - indentAtStart;\n }\n let split = undefined;\n let prev = undefined;\n let overflow = false;\n let i = -1;\n let escStart = -1;\n let escEnd = -1;\n if (mode === FOLD_BLOCK) {\n i = consumeMoreIndentedLines(text, i, indent.length);\n if (i !== -1)\n end = i + endStep;\n }\n for (let ch; (ch = text[(i += 1)]);) {\n if (mode === FOLD_QUOTED && ch === '\\\\') {\n escStart = i;\n switch (text[i + 1]) {\n case 'x':\n i += 3;\n break;\n case 'u':\n i += 5;\n break;\n case 'U':\n i += 9;\n break;\n default:\n i += 1;\n }\n escEnd = i;\n }\n if (ch === '\\n') {\n if (mode === FOLD_BLOCK)\n i = consumeMoreIndentedLines(text, i, indent.length);\n end = i + indent.length + endStep;\n split = undefined;\n }\n else {\n if (ch === ' ' &&\n prev &&\n prev !== ' ' &&\n prev !== '\\n' &&\n prev !== '\\t') {\n // space surrounded by non-space can be replaced with newline + indent\n const next = text[i + 1];\n if (next && next !== ' ' && next !== '\\n' && next !== '\\t')\n split = i;\n }\n if (i >= end) {\n if (split) {\n folds.push(split);\n end = split + endStep;\n split = undefined;\n }\n else if (mode === FOLD_QUOTED) {\n // white-space collected at end may stretch past lineWidth\n while (prev === ' ' || prev === '\\t') {\n prev = ch;\n ch = text[(i += 1)];\n overflow = true;\n }\n // Account for newline escape, but don't break preceding escape\n const j = i > escEnd + 1 ? i - 2 : escStart - 1;\n // Bail out if lineWidth & minContentWidth are shorter than an escape string\n if (escapedFolds[j])\n return text;\n folds.push(j);\n escapedFolds[j] = true;\n end = j + endStep;\n split = undefined;\n }\n else {\n overflow = true;\n }\n }\n }\n prev = ch;\n }\n if (overflow && onOverflow)\n onOverflow();\n if (folds.length === 0)\n return text;\n if (onFold)\n onFold();\n let res = text.slice(0, folds[0]);\n for (let i = 0; i < folds.length; ++i) {\n const fold = folds[i];\n const end = folds[i + 1] || text.length;\n if (fold === 0)\n res = `\\n${indent}${text.slice(0, end)}`;\n else {\n if (mode === FOLD_QUOTED && escapedFolds[fold])\n res += `${text[fold]}\\\\`;\n res += `\\n${indent}${text.slice(fold + 1, end)}`;\n }\n }\n return res;\n}\n/**\n * Presumes `i + 1` is at the start of a line\n * @returns index of last newline in more-indented block\n */\nfunction consumeMoreIndentedLines(text, i, indent) {\n let end = i;\n let start = i + 1;\n let ch = text[start];\n while (ch === ' ' || ch === '\\t') {\n if (i < start + indent) {\n ch = text[++i];\n }\n else {\n do {\n ch = text[++i];\n } while (ch && ch !== '\\n');\n end = i;\n start = i + 1;\n ch = text[start];\n }\n }\n return end;\n}\n\nexports.FOLD_BLOCK = FOLD_BLOCK;\nexports.FOLD_FLOW = FOLD_FLOW;\nexports.FOLD_QUOTED = FOLD_QUOTED;\nexports.foldFlowLines = foldFlowLines;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar foldFlowLines = require('./foldFlowLines.js');\n\nconst getFoldOptions = (ctx, isBlock) => ({\n indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,\n lineWidth: ctx.options.lineWidth,\n minContentWidth: ctx.options.minContentWidth\n});\n// Also checks for lines starting with %, as parsing the output as YAML 1.1 will\n// presume that's starting a new document.\nconst containsDocumentMarker = (str) => /^(%|---|\\.\\.\\.)/m.test(str);\nfunction lineLengthOverLimit(str, lineWidth, indentLength) {\n if (!lineWidth || lineWidth < 0)\n return false;\n const limit = lineWidth - indentLength;\n const strLen = str.length;\n if (strLen <= limit)\n return false;\n for (let i = 0, start = 0; i < strLen; ++i) {\n if (str[i] === '\\n') {\n if (i - start > limit)\n return true;\n start = i + 1;\n if (strLen - start <= limit)\n return false;\n }\n }\n return true;\n}\nfunction doubleQuotedString(value, ctx) {\n const json = JSON.stringify(value);\n if (ctx.options.doubleQuotedAsJSON)\n return json;\n const { implicitKey } = ctx;\n const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n let str = '';\n let start = 0;\n for (let i = 0, ch = json[i]; ch; ch = json[++i]) {\n if (ch === ' ' && json[i + 1] === '\\\\' && json[i + 2] === 'n') {\n // space before newline needs to be escaped to not be folded\n str += json.slice(start, i) + '\\\\ ';\n i += 1;\n start = i;\n ch = '\\\\';\n }\n if (ch === '\\\\')\n switch (json[i + 1]) {\n case 'u':\n {\n str += json.slice(start, i);\n const code = json.substr(i + 2, 4);\n switch (code) {\n case '0000':\n str += '\\\\0';\n break;\n case '0007':\n str += '\\\\a';\n break;\n case '000b':\n str += '\\\\v';\n break;\n case '001b':\n str += '\\\\e';\n break;\n case '0085':\n str += '\\\\N';\n break;\n case '00a0':\n str += '\\\\_';\n break;\n case '2028':\n str += '\\\\L';\n break;\n case '2029':\n str += '\\\\P';\n break;\n default:\n if (code.substr(0, 2) === '00')\n str += '\\\\x' + code.substr(2);\n else\n str += json.substr(i, 6);\n }\n i += 5;\n start = i + 1;\n }\n break;\n case 'n':\n if (implicitKey ||\n json[i + 2] === '\"' ||\n json.length < minMultiLineLength) {\n i += 1;\n }\n else {\n // folding will eat first newline\n str += json.slice(start, i) + '\\n\\n';\n while (json[i + 2] === '\\\\' &&\n json[i + 3] === 'n' &&\n json[i + 4] !== '\"') {\n str += '\\n';\n i += 2;\n }\n str += indent;\n // space after newline needs to be escaped to not be folded\n if (json[i + 2] === ' ')\n str += '\\\\';\n i += 1;\n start = i + 1;\n }\n break;\n default:\n i += 1;\n }\n }\n str = start ? str + json.slice(start) : json;\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));\n}\nfunction singleQuotedString(value, ctx) {\n if (ctx.options.singleQuote === false ||\n (ctx.implicitKey && value.includes('\\n')) ||\n /[ \\t]\\n|\\n[ \\t]/.test(value) // single quoted string can't have leading or trailing whitespace around newline\n )\n return doubleQuotedString(value, ctx);\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n const res = \"'\" + value.replace(/'/g, \"''\").replace(/\\n+/g, `$&\\n${indent}`) + \"'\";\n return ctx.implicitKey\n ? res\n : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction quotedString(value, ctx) {\n const { singleQuote } = ctx.options;\n let qs;\n if (singleQuote === false)\n qs = doubleQuotedString;\n else {\n const hasDouble = value.includes('\"');\n const hasSingle = value.includes(\"'\");\n if (hasDouble && !hasSingle)\n qs = singleQuotedString;\n else if (hasSingle && !hasDouble)\n qs = doubleQuotedString;\n else\n qs = singleQuote ? singleQuotedString : doubleQuotedString;\n }\n return qs(value, ctx);\n}\n// The negative lookbehind avoids a polynomial search,\n// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind\nlet blockEndNewlines;\ntry {\n blockEndNewlines = new RegExp('(^|(?<!\\n))\\n+(?!\\n|$)', 'g');\n}\ncatch {\n blockEndNewlines = /\\n+(?!\\n|$)/g;\n}\nfunction blockString({ comment, type, value }, ctx, onComment, onChompKeep) {\n const { blockQuote, commentString, lineWidth } = ctx.options;\n // 1. Block can't end in whitespace unless the last line is non-empty.\n // 2. Strings consisting of only whitespace are best rendered explicitly.\n if (!blockQuote || /\\n[\\t ]+$/.test(value)) {\n return quotedString(value, ctx);\n }\n const indent = ctx.indent ||\n (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');\n const literal = blockQuote === 'literal'\n ? true\n : blockQuote === 'folded' || type === Scalar.Scalar.BLOCK_FOLDED\n ? false\n : type === Scalar.Scalar.BLOCK_LITERAL\n ? true\n : !lineLengthOverLimit(value, lineWidth, indent.length);\n if (!value)\n return literal ? '|\\n' : '>\\n';\n // determine chomping from whitespace at value end\n let chomp;\n let endStart;\n for (endStart = value.length; endStart > 0; --endStart) {\n const ch = value[endStart - 1];\n if (ch !== '\\n' && ch !== '\\t' && ch !== ' ')\n break;\n }\n let end = value.substring(endStart);\n const endNlPos = end.indexOf('\\n');\n if (endNlPos === -1) {\n chomp = '-'; // strip\n }\n else if (value === end || endNlPos !== end.length - 1) {\n chomp = '+'; // keep\n if (onChompKeep)\n onChompKeep();\n }\n else {\n chomp = ''; // clip\n }\n if (end) {\n value = value.slice(0, -end.length);\n if (end[end.length - 1] === '\\n')\n end = end.slice(0, -1);\n end = end.replace(blockEndNewlines, `$&${indent}`);\n }\n // determine indent indicator from whitespace at value start\n let startWithSpace = false;\n let startEnd;\n let startNlPos = -1;\n for (startEnd = 0; startEnd < value.length; ++startEnd) {\n const ch = value[startEnd];\n if (ch === ' ')\n startWithSpace = true;\n else if (ch === '\\n')\n startNlPos = startEnd;\n else\n break;\n }\n let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);\n if (start) {\n value = value.substring(start.length);\n start = start.replace(/\\n+/g, `$&${indent}`);\n }\n const indentSize = indent ? '2' : '1'; // root is at -1\n // Leading | or > is added later\n let header = (startWithSpace ? indentSize : '') + chomp;\n if (comment) {\n header += ' ' + commentString(comment.replace(/ ?[\\r\\n]+/g, ' '));\n if (onComment)\n onComment();\n }\n if (!literal) {\n const foldedValue = value\n .replace(/\\n+/g, '\\n$&')\n .replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g, '$1$2') // more-indented lines aren't folded\n // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent\n .replace(/\\n+/g, `$&${indent}`);\n let literalFallback = false;\n const foldOptions = getFoldOptions(ctx, true);\n if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {\n foldOptions.onOverflow = () => {\n literalFallback = true;\n };\n }\n const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);\n if (!literalFallback)\n return `>${header}\\n${indent}${body}`;\n }\n value = value.replace(/\\n+/g, `$&${indent}`);\n return `|${header}\\n${indent}${start}${value}${end}`;\n}\nfunction plainString(item, ctx, onComment, onChompKeep) {\n const { type, value } = item;\n const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;\n if ((implicitKey && value.includes('\\n')) ||\n (inFlow && /[[\\]{},]/.test(value))) {\n return quotedString(value, ctx);\n }\n if (/^[\\n\\t ,[\\]{}#&*!|>'\"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(value)) {\n // not allowed:\n // - '-' or '?'\n // - start with an indicator character (except [?:-]) or /[?-] /\n // - '\\n ', ': ' or ' \\n' anywhere\n // - '#' not preceded by a non-space char\n // - end with ' ' or ':'\n return implicitKey || inFlow || !value.includes('\\n')\n ? quotedString(value, ctx)\n : blockString(item, ctx, onComment, onChompKeep);\n }\n if (!implicitKey &&\n !inFlow &&\n type !== Scalar.Scalar.PLAIN &&\n value.includes('\\n')) {\n // Where allowed & type not set explicitly, prefer block style for multiline strings\n return blockString(item, ctx, onComment, onChompKeep);\n }\n if (containsDocumentMarker(value)) {\n if (indent === '') {\n ctx.forceBlockIndent = true;\n return blockString(item, ctx, onComment, onChompKeep);\n }\n else if (implicitKey && indent === indentStep) {\n return quotedString(value, ctx);\n }\n }\n const str = value.replace(/\\n+/g, `$&\\n${indent}`);\n // Verify that output will be parsed as a string, as e.g. plain numbers and\n // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),\n // and others in v1.1.\n if (actualString) {\n const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);\n const { compat, tags } = ctx.doc.schema;\n if (tags.some(test) || compat?.some(test))\n return quotedString(value, ctx);\n }\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction stringifyString(item, ctx, onComment, onChompKeep) {\n const { implicitKey, inFlow } = ctx;\n const ss = typeof item.value === 'string'\n ? item\n : Object.assign({}, item, { value: String(item.value) });\n let { type } = item;\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n // force double quotes on control characters & unpaired surrogates\n if (/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(ss.value))\n type = Scalar.Scalar.QUOTE_DOUBLE;\n }\n const _stringify = (_type) => {\n switch (_type) {\n case Scalar.Scalar.BLOCK_FOLDED:\n case Scalar.Scalar.BLOCK_LITERAL:\n return implicitKey || inFlow\n ? quotedString(ss.value, ctx) // blocks are not valid inside flow containers\n : blockString(ss, ctx, onComment, onChompKeep);\n case Scalar.Scalar.QUOTE_DOUBLE:\n return doubleQuotedString(ss.value, ctx);\n case Scalar.Scalar.QUOTE_SINGLE:\n return singleQuotedString(ss.value, ctx);\n case Scalar.Scalar.PLAIN:\n return plainString(ss, ctx, onComment, onChompKeep);\n default:\n return null;\n }\n };\n let res = _stringify(type);\n if (res === null) {\n const { defaultKeyType, defaultStringType } = ctx.options;\n const t = (implicitKey && defaultKeyType) || defaultStringType;\n res = _stringify(t);\n if (res === null)\n throw new Error(`Unsupported default string type ${t}`);\n }\n return res;\n}\n\nexports.stringifyString = stringifyString;\n","'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar identity = require('../nodes/identity.js');\nvar stringifyComment = require('./stringifyComment.js');\nvar stringifyString = require('./stringifyString.js');\n\nfunction createStringifyContext(doc, options) {\n const opt = Object.assign({\n blockQuote: true,\n commentString: stringifyComment.stringifyComment,\n defaultKeyType: null,\n defaultStringType: 'PLAIN',\n directives: null,\n doubleQuotedAsJSON: false,\n doubleQuotedMinMultiLineLength: 40,\n falseStr: 'false',\n flowCollectionPadding: true,\n indentSeq: true,\n lineWidth: 80,\n minContentWidth: 20,\n nullStr: 'null',\n simpleKeys: false,\n singleQuote: null,\n trueStr: 'true',\n verifyAliasOrder: true\n }, doc.schema.toStringOptions, options);\n let inFlow;\n switch (opt.collectionStyle) {\n case 'block':\n inFlow = false;\n break;\n case 'flow':\n inFlow = true;\n break;\n default:\n inFlow = null;\n }\n return {\n anchors: new Set(),\n doc,\n flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',\n indent: '',\n indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',\n inFlow,\n options: opt\n };\n}\nfunction getTagObject(tags, item) {\n if (item.tag) {\n const match = tags.filter(t => t.tag === item.tag);\n if (match.length > 0)\n return match.find(t => t.format === item.format) ?? match[0];\n }\n let tagObj = undefined;\n let obj;\n if (identity.isScalar(item)) {\n obj = item.value;\n let match = tags.filter(t => t.identify?.(obj));\n if (match.length > 1) {\n const testMatch = match.filter(t => t.test);\n if (testMatch.length > 0)\n match = testMatch;\n }\n tagObj =\n match.find(t => t.format === item.format) ?? match.find(t => !t.format);\n }\n else {\n obj = item;\n tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);\n }\n if (!tagObj) {\n const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);\n throw new Error(`Tag not resolved for ${name} value`);\n }\n return tagObj;\n}\n// needs to be called before value stringifier to allow for circular anchor refs\nfunction stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {\n if (!doc.directives)\n return '';\n const props = [];\n const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;\n if (anchor && anchors.anchorIsValid(anchor)) {\n anchors$1.add(anchor);\n props.push(`&${anchor}`);\n }\n const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);\n if (tag)\n props.push(doc.directives.tagString(tag));\n return props.join(' ');\n}\nfunction stringify(item, ctx, onComment, onChompKeep) {\n if (identity.isPair(item))\n return item.toString(ctx, onComment, onChompKeep);\n if (identity.isAlias(item)) {\n if (ctx.doc.directives)\n return item.toString(ctx);\n if (ctx.resolvedAliases?.has(item)) {\n throw new TypeError(`Cannot stringify circular structure without alias nodes`);\n }\n else {\n if (ctx.resolvedAliases)\n ctx.resolvedAliases.add(item);\n else\n ctx.resolvedAliases = new Set([item]);\n item = item.resolve(ctx.doc);\n }\n }\n let tagObj = undefined;\n const node = identity.isNode(item)\n ? item\n : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });\n tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));\n const props = stringifyProps(node, tagObj, ctx);\n if (props.length > 0)\n ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;\n const str = typeof tagObj.stringify === 'function'\n ? tagObj.stringify(node, ctx, onComment, onChompKeep)\n : identity.isScalar(node)\n ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep)\n : node.toString(ctx, onComment, onChompKeep);\n if (!props)\n return str;\n return identity.isScalar(node) || str[0] === '{' || str[0] === '['\n ? `${props} ${str}`\n : `${props}\\n${ctx.indent}${str}`;\n}\n\nexports.createStringifyContext = createStringifyContext;\nexports.stringify = stringify;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyPair({ key, value }, ctx, onComment, onChompKeep) {\n const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;\n let keyComment = (identity.isNode(key) && key.comment) || null;\n if (simpleKeys) {\n if (keyComment) {\n throw new Error('With simple keys, key nodes cannot have comments');\n }\n if (identity.isCollection(key) || (!identity.isNode(key) && typeof key === 'object')) {\n const msg = 'With simple keys, collection cannot be used as a key value';\n throw new Error(msg);\n }\n }\n let explicitKey = !simpleKeys &&\n (!key ||\n (keyComment && value == null && !ctx.inFlow) ||\n identity.isCollection(key) ||\n (identity.isScalar(key)\n ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL\n : typeof key === 'object'));\n ctx = Object.assign({}, ctx, {\n allNullValues: false,\n implicitKey: !explicitKey && (simpleKeys || !allNullValues),\n indent: indent + indentStep\n });\n let keyCommentDone = false;\n let chompKeep = false;\n let str = stringify.stringify(key, ctx, () => (keyCommentDone = true), () => (chompKeep = true));\n if (!explicitKey && !ctx.inFlow && str.length > 1024) {\n if (simpleKeys)\n throw new Error('With simple keys, single line scalar must not span more than 1024 characters');\n explicitKey = true;\n }\n if (ctx.inFlow) {\n if (allNullValues || value == null) {\n if (keyCommentDone && onComment)\n onComment();\n return str === '' ? '?' : explicitKey ? `? ${str}` : str;\n }\n }\n else if ((allNullValues && !simpleKeys) || (value == null && explicitKey)) {\n str = `? ${str}`;\n if (keyComment && !keyCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n }\n if (keyCommentDone)\n keyComment = null;\n if (explicitKey) {\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n str = `? ${str}\\n${indent}:`;\n }\n else {\n str = `${str}:`;\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n let vsb, vcb, valueComment;\n if (identity.isNode(value)) {\n vsb = !!value.spaceBefore;\n vcb = value.commentBefore;\n valueComment = value.comment;\n }\n else {\n vsb = false;\n vcb = null;\n valueComment = null;\n if (value && typeof value === 'object')\n value = doc.createNode(value);\n }\n ctx.implicitKey = false;\n if (!explicitKey && !keyComment && identity.isScalar(value))\n ctx.indentAtStart = str.length + 1;\n chompKeep = false;\n if (!indentSeq &&\n indentStep.length >= 2 &&\n !ctx.inFlow &&\n !explicitKey &&\n identity.isSeq(value) &&\n !value.flow &&\n !value.tag &&\n !value.anchor) {\n // If indentSeq === false, consider '- ' as part of indentation where possible\n ctx.indent = ctx.indent.substring(2);\n }\n let valueCommentDone = false;\n const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));\n let ws = ' ';\n if (keyComment || vsb || vcb) {\n ws = vsb ? '\\n' : '';\n if (vcb) {\n const cs = commentString(vcb);\n ws += `\\n${stringifyComment.indentComment(cs, ctx.indent)}`;\n }\n if (valueStr === '' && !ctx.inFlow) {\n if (ws === '\\n' && valueComment)\n ws = '\\n\\n';\n }\n else {\n ws += `\\n${ctx.indent}`;\n }\n }\n else if (!explicitKey && identity.isCollection(value)) {\n const vs0 = valueStr[0];\n const nl0 = valueStr.indexOf('\\n');\n const hasNewline = nl0 !== -1;\n const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;\n if (hasNewline || !flow) {\n let hasPropsLine = false;\n if (hasNewline && (vs0 === '&' || vs0 === '!')) {\n let sp0 = valueStr.indexOf(' ');\n if (vs0 === '&' &&\n sp0 !== -1 &&\n sp0 < nl0 &&\n valueStr[sp0 + 1] === '!') {\n sp0 = valueStr.indexOf(' ', sp0 + 1);\n }\n if (sp0 === -1 || nl0 < sp0)\n hasPropsLine = true;\n }\n if (!hasPropsLine)\n ws = `\\n${ctx.indent}`;\n }\n }\n else if (valueStr === '' || valueStr[0] === '\\n') {\n ws = '';\n }\n str += ws + valueStr;\n if (ctx.inFlow) {\n if (valueCommentDone && onComment)\n onComment();\n }\n else if (valueComment && !valueCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(valueComment));\n }\n else if (chompKeep && onChompKeep) {\n onChompKeep();\n }\n return str;\n}\n\nexports.stringifyPair = stringifyPair;\n","'use strict';\n\nvar node_process = require('process');\n\nfunction debug(logLevel, ...messages) {\n if (logLevel === 'debug')\n console.log(...messages);\n}\nfunction warn(logLevel, warning) {\n if (logLevel === 'debug' || logLevel === 'warn') {\n if (typeof node_process.emitWarning === 'function')\n node_process.emitWarning(warning);\n else\n console.warn(warning);\n }\n}\n\nexports.debug = debug;\nexports.warn = warn;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Scalar = require('../../nodes/Scalar.js');\n\n// If the value associated with a merge key is a single mapping node, each of\n// its key/value pairs is inserted into the current mapping, unless the key\n// already exists in it. If the value associated with the merge key is a\n// sequence, then this sequence is expected to contain mapping nodes and each\n// of these nodes is merged in turn according to its order in the sequence.\n// Keys in mapping nodes earlier in the sequence override keys specified in\n// later mapping nodes. -- http://yaml.org/type/merge.html\nconst MERGE_KEY = '<<';\nconst merge = {\n identify: value => value === MERGE_KEY ||\n (typeof value === 'symbol' && value.description === MERGE_KEY),\n default: 'key',\n tag: 'tag:yaml.org,2002:merge',\n test: /^<<$/,\n resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {\n addToJSMap: addMergeToJSMap\n }),\n stringify: () => MERGE_KEY\n};\nconst isMergeKey = (ctx, key) => (merge.identify(key) ||\n (identity.isScalar(key) &&\n (!key.type || key.type === Scalar.Scalar.PLAIN) &&\n merge.identify(key.value))) &&\n ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);\nfunction addMergeToJSMap(ctx, map, value) {\n value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;\n if (identity.isSeq(value))\n for (const it of value.items)\n mergeValue(ctx, map, it);\n else if (Array.isArray(value))\n for (const it of value)\n mergeValue(ctx, map, it);\n else\n mergeValue(ctx, map, value);\n}\nfunction mergeValue(ctx, map, value) {\n const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;\n if (!identity.isMap(source))\n throw new Error('Merge sources must be maps or map aliases');\n const srcMap = source.toJSON(null, ctx, Map);\n for (const [key, value] of srcMap) {\n if (map instanceof Map) {\n if (!map.has(key))\n map.set(key, value);\n }\n else if (map instanceof Set) {\n map.add(key);\n }\n else if (!Object.prototype.hasOwnProperty.call(map, key)) {\n Object.defineProperty(map, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n }\n return map;\n}\n\nexports.addMergeToJSMap = addMergeToJSMap;\nexports.isMergeKey = isMergeKey;\nexports.merge = merge;\n","'use strict';\n\nvar log = require('../log.js');\nvar merge = require('../schema/yaml-1.1/merge.js');\nvar stringify = require('../stringify/stringify.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nfunction addPairToJSMap(ctx, map, { key, value }) {\n if (identity.isNode(key) && key.addToJSMap)\n key.addToJSMap(ctx, map, value);\n // TODO: Should drop this special case for bare << handling\n else if (merge.isMergeKey(ctx, key))\n merge.addMergeToJSMap(ctx, map, value);\n else {\n const jsKey = toJS.toJS(key, '', ctx);\n if (map instanceof Map) {\n map.set(jsKey, toJS.toJS(value, jsKey, ctx));\n }\n else if (map instanceof Set) {\n map.add(jsKey);\n }\n else {\n const stringKey = stringifyKey(key, jsKey, ctx);\n const jsValue = toJS.toJS(value, stringKey, ctx);\n if (stringKey in map)\n Object.defineProperty(map, stringKey, {\n value: jsValue,\n writable: true,\n enumerable: true,\n configurable: true\n });\n else\n map[stringKey] = jsValue;\n }\n }\n return map;\n}\nfunction stringifyKey(key, jsKey, ctx) {\n if (jsKey === null)\n return '';\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n if (typeof jsKey !== 'object')\n return String(jsKey);\n if (identity.isNode(key) && ctx?.doc) {\n const strCtx = stringify.createStringifyContext(ctx.doc, {});\n strCtx.anchors = new Set();\n for (const node of ctx.anchors.keys())\n strCtx.anchors.add(node.anchor);\n strCtx.inFlow = true;\n strCtx.inStringifyKey = true;\n const strKey = key.toString(strCtx);\n if (!ctx.mapKeyWarned) {\n let jsonStr = JSON.stringify(strKey);\n if (jsonStr.length > 40)\n jsonStr = jsonStr.substring(0, 36) + '...\"';\n log.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);\n ctx.mapKeyWarned = true;\n }\n return strKey;\n }\n return JSON.stringify(jsKey);\n}\n\nexports.addPairToJSMap = addPairToJSMap;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyPair = require('../stringify/stringifyPair.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar identity = require('./identity.js');\n\nfunction createPair(key, value, ctx) {\n const k = createNode.createNode(key, undefined, ctx);\n const v = createNode.createNode(value, undefined, ctx);\n return new Pair(k, v);\n}\nclass Pair {\n constructor(key, value = null) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.PAIR });\n this.key = key;\n this.value = value;\n }\n clone(schema) {\n let { key, value } = this;\n if (identity.isNode(key))\n key = key.clone(schema);\n if (identity.isNode(value))\n value = value.clone(schema);\n return new Pair(key, value);\n }\n toJSON(_, ctx) {\n const pair = ctx?.mapAsMap ? new Map() : {};\n return addPairToJSMap.addPairToJSMap(ctx, pair, this);\n }\n toString(ctx, onComment, onChompKeep) {\n return ctx?.doc\n ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)\n : JSON.stringify(this);\n }\n}\n\nexports.Pair = Pair;\nexports.createPair = createPair;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyCollection(collection, ctx, options) {\n const flow = ctx.inFlow ?? collection.flow;\n const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;\n return stringify(collection, ctx, options);\n}\nfunction stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {\n const { indent, options: { commentString } } = ctx;\n const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });\n let chompKeep = false; // flag for the preceding node's status\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (!chompKeep && item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, chompKeep);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (!chompKeep && ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);\n }\n }\n chompKeep = false;\n let str = stringify.stringify(item, itemCtx, () => (comment = null), () => (chompKeep = true));\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n if (chompKeep && comment)\n chompKeep = false;\n lines.push(blockItemPrefix + str);\n }\n let str;\n if (lines.length === 0) {\n str = flowChars.start + flowChars.end;\n }\n else {\n str = lines[0];\n for (let i = 1; i < lines.length; ++i) {\n const line = lines[i];\n str += line ? `\\n${indent}${line}` : '\\n';\n }\n }\n if (comment) {\n str += '\\n' + stringifyComment.indentComment(commentString(comment), indent);\n if (onComment)\n onComment();\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n}\nfunction stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {\n const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;\n itemIndent += indentStep;\n const itemCtx = Object.assign({}, ctx, {\n indent: itemIndent,\n inFlow: true,\n type: null\n });\n let reqNewline = false;\n let linesAtValue = 0;\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, false);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, false);\n if (ik.comment)\n reqNewline = true;\n }\n const iv = identity.isNode(item.value) ? item.value : null;\n if (iv) {\n if (iv.comment)\n comment = iv.comment;\n if (iv.commentBefore)\n reqNewline = true;\n }\n else if (item.value == null && ik?.comment) {\n comment = ik.comment;\n }\n }\n if (comment)\n reqNewline = true;\n let str = stringify.stringify(item, itemCtx, () => (comment = null));\n if (i < items.length - 1)\n str += ',';\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n if (!reqNewline && (lines.length > linesAtValue || str.includes('\\n')))\n reqNewline = true;\n lines.push(str);\n linesAtValue = lines.length;\n }\n const { start, end } = flowChars;\n if (lines.length === 0) {\n return start + end;\n }\n else {\n if (!reqNewline) {\n const len = lines.reduce((sum, line) => sum + line.length + 2, 2);\n reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;\n }\n if (reqNewline) {\n let str = start;\n for (const line of lines)\n str += line ? `\\n${indentStep}${indent}${line}` : '\\n';\n return `${str}\\n${indent}${end}`;\n }\n else {\n return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;\n }\n }\n}\nfunction addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {\n if (comment && chompKeep)\n comment = comment.replace(/^\\n+/, '');\n if (comment) {\n const ic = stringifyComment.indentComment(commentString(comment), indent);\n lines.push(ic.trimStart()); // Avoid double indent on first line\n }\n}\n\nexports.stringifyCollection = stringifyCollection;\n","'use strict';\n\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Pair = require('./Pair.js');\nvar Scalar = require('./Scalar.js');\n\nfunction findPair(items, key) {\n const k = identity.isScalar(key) ? key.value : key;\n for (const it of items) {\n if (identity.isPair(it)) {\n if (it.key === key || it.key === k)\n return it;\n if (identity.isScalar(it.key) && it.key.value === k)\n return it;\n }\n }\n return undefined;\n}\nclass YAMLMap extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:map';\n }\n constructor(schema) {\n super(identity.MAP, schema);\n this.items = [];\n }\n /**\n * A generic collection parsing method that can be extended\n * to other node classes that inherit from YAMLMap\n */\n static from(schema, obj, ctx) {\n const { keepUndefined, replacer } = ctx;\n const map = new this(schema);\n const add = (key, value) => {\n if (typeof replacer === 'function')\n value = replacer.call(obj, key, value);\n else if (Array.isArray(replacer) && !replacer.includes(key))\n return;\n if (value !== undefined || keepUndefined)\n map.items.push(Pair.createPair(key, value, ctx));\n };\n if (obj instanceof Map) {\n for (const [key, value] of obj)\n add(key, value);\n }\n else if (obj && typeof obj === 'object') {\n for (const key of Object.keys(obj))\n add(key, obj[key]);\n }\n if (typeof schema.sortMapEntries === 'function') {\n map.items.sort(schema.sortMapEntries);\n }\n return map;\n }\n /**\n * Adds a value to the collection.\n *\n * @param overwrite - If not set `true`, using a key that is already in the\n * collection will throw. Otherwise, overwrites the previous value.\n */\n add(pair, overwrite) {\n let _pair;\n if (identity.isPair(pair))\n _pair = pair;\n else if (!pair || typeof pair !== 'object' || !('key' in pair)) {\n // In TypeScript, this never happens.\n _pair = new Pair.Pair(pair, pair?.value);\n }\n else\n _pair = new Pair.Pair(pair.key, pair.value);\n const prev = findPair(this.items, _pair.key);\n const sortEntries = this.schema?.sortMapEntries;\n if (prev) {\n if (!overwrite)\n throw new Error(`Key ${_pair.key} already set`);\n // For scalars, keep the old node & its comments and anchors\n if (identity.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))\n prev.value.value = _pair.value;\n else\n prev.value = _pair.value;\n }\n else if (sortEntries) {\n const i = this.items.findIndex(item => sortEntries(_pair, item) < 0);\n if (i === -1)\n this.items.push(_pair);\n else\n this.items.splice(i, 0, _pair);\n }\n else {\n this.items.push(_pair);\n }\n }\n delete(key) {\n const it = findPair(this.items, key);\n if (!it)\n return false;\n const del = this.items.splice(this.items.indexOf(it), 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const it = findPair(this.items, key);\n const node = it?.value;\n return (!keepScalar && identity.isScalar(node) ? node.value : node) ?? undefined;\n }\n has(key) {\n return !!findPair(this.items, key);\n }\n set(key, value) {\n this.add(new Pair.Pair(key, value), true);\n }\n /**\n * @param ctx - Conversion context, originally set in Document#toJS()\n * @param {Class} Type - If set, forces the returned collection type\n * @returns Instance of Type, Map, or Object\n */\n toJSON(_, ctx, Type) {\n const map = Type ? new Type() : ctx?.mapAsMap ? new Map() : {};\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const item of this.items)\n addPairToJSMap.addPairToJSMap(ctx, map, item);\n return map;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n for (const item of this.items) {\n if (!identity.isPair(item))\n throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);\n }\n if (!ctx.allNullValues && this.hasAllNullValues(false))\n ctx = Object.assign({}, ctx, { allNullValues: true });\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '',\n flowChars: { start: '{', end: '}' },\n itemIndent: ctx.indent || '',\n onChompKeep,\n onComment\n });\n }\n}\n\nexports.YAMLMap = YAMLMap;\nexports.findPair = findPair;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nconst map = {\n collection: 'map',\n default: true,\n nodeClass: YAMLMap.YAMLMap,\n tag: 'tag:yaml.org,2002:map',\n resolve(map, onError) {\n if (!identity.isMap(map))\n onError('Expected a mapping for this tag');\n return map;\n },\n createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)\n};\n\nexports.map = map;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Scalar = require('./Scalar.js');\nvar toJS = require('./toJS.js');\n\nclass YAMLSeq extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:seq';\n }\n constructor(schema) {\n super(identity.SEQ, schema);\n this.items = [];\n }\n add(value) {\n this.items.push(value);\n }\n /**\n * Removes a value from the collection.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n *\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return false;\n const del = this.items.splice(idx, 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return undefined;\n const it = this.items[idx];\n return !keepScalar && identity.isScalar(it) ? it.value : it;\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n */\n has(key) {\n const idx = asItemIndex(key);\n return typeof idx === 'number' && idx < this.items.length;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n *\n * If `key` does not contain a representation of an integer, this will throw.\n * It may be wrapped in a `Scalar`.\n */\n set(key, value) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n throw new Error(`Expected a valid index, not ${key}.`);\n const prev = this.items[idx];\n if (identity.isScalar(prev) && Scalar.isScalarValue(value))\n prev.value = value;\n else\n this.items[idx] = value;\n }\n toJSON(_, ctx) {\n const seq = [];\n if (ctx?.onCreate)\n ctx.onCreate(seq);\n let i = 0;\n for (const item of this.items)\n seq.push(toJS.toJS(item, String(i++), ctx));\n return seq;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '- ',\n flowChars: { start: '[', end: ']' },\n itemIndent: (ctx.indent || '') + ' ',\n onChompKeep,\n onComment\n });\n }\n static from(schema, obj, ctx) {\n const { replacer } = ctx;\n const seq = new this(schema);\n if (obj && Symbol.iterator in Object(obj)) {\n let i = 0;\n for (let it of obj) {\n if (typeof replacer === 'function') {\n const key = obj instanceof Set ? it : String(i++);\n it = replacer.call(obj, key, it);\n }\n seq.items.push(createNode.createNode(it, undefined, ctx));\n }\n }\n return seq;\n }\n}\nfunction asItemIndex(key) {\n let idx = identity.isScalar(key) ? key.value : key;\n if (idx && typeof idx === 'string')\n idx = Number(idx);\n return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0\n ? idx\n : null;\n}\n\nexports.YAMLSeq = YAMLSeq;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nconst seq = {\n collection: 'seq',\n default: true,\n nodeClass: YAMLSeq.YAMLSeq,\n tag: 'tag:yaml.org,2002:seq',\n resolve(seq, onError) {\n if (!identity.isSeq(seq))\n onError('Expected a sequence for this tag');\n return seq;\n },\n createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)\n};\n\nexports.seq = seq;\n","'use strict';\n\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst string = {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify(item, ctx, onComment, onChompKeep) {\n ctx = Object.assign({ actualString: true }, ctx);\n return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);\n }\n};\n\nexports.string = string;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst nullTag = {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^(?:~|[Nn]ull|NULL)?$/,\n resolve: () => new Scalar.Scalar(null),\n stringify: ({ source }, ctx) => typeof source === 'string' && nullTag.test.test(source)\n ? source\n : ctx.options.nullStr\n};\n\nexports.nullTag = nullTag;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst boolTag = {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,\n resolve: str => new Scalar.Scalar(str[0] === 't' || str[0] === 'T'),\n stringify({ source, value }, ctx) {\n if (source && boolTag.test.test(source)) {\n const sv = source[0] === 't' || source[0] === 'T';\n if (value === sv)\n return source;\n }\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n }\n};\n\nexports.boolTag = boolTag;\n","'use strict';\n\nfunction stringifyNumber({ format, minFractionDigits, tag, value }) {\n if (typeof value === 'bigint')\n return String(value);\n const num = typeof value === 'number' ? value : Number(value);\n if (!isFinite(num))\n return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';\n let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);\n if (!format &&\n minFractionDigits &&\n (!tag || tag === 'tag:yaml.org,2002:float') &&\n /^\\d/.test(n)) {\n let i = n.indexOf('.');\n if (i < 0) {\n i = n.length;\n n += '.';\n }\n let d = minFractionDigits - (n.length - i - 1);\n while (d-- > 0)\n n += '0';\n }\n return n;\n}\n\nexports.stringifyNumber = stringifyNumber;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: str => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,\n resolve: str => parseFloat(str),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str));\n const dot = str.indexOf('.');\n if (dot !== -1 && str[str.length - 1] === '0')\n node.minFractionDigits = str.length - dot - 1;\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nconst intResolve = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix));\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value) && value >= 0)\n return prefix + value.toString(radix);\n return stringifyNumber.stringifyNumber(node);\n}\nconst intOct = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^0o[0-7]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),\n stringify: node => intStringify(node, 8, '0o')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^0x[0-9a-fA-F]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intHex = intHex;\nexports.intOct = intOct;\n","'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.boolTag,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float\n];\n\nexports.schema = schema;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar map = require('../common/map.js');\nvar seq = require('../common/seq.js');\n\nfunction intIdentify(value) {\n return typeof value === 'bigint' || Number.isInteger(value);\n}\nconst stringifyJSON = ({ value }) => JSON.stringify(value);\nconst jsonScalars = [\n {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify: stringifyJSON\n },\n {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^null$/,\n resolve: () => null,\n stringify: stringifyJSON\n },\n {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^true$|^false$/,\n resolve: str => str === 'true',\n stringify: stringifyJSON\n },\n {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^-?(?:0|[1-9][0-9]*)$/,\n resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),\n stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)\n },\n {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,\n resolve: str => parseFloat(str),\n stringify: stringifyJSON\n }\n];\nconst jsonError = {\n default: true,\n tag: '',\n test: /^/,\n resolve(str, onError) {\n onError(`Unresolved plain scalar ${JSON.stringify(str)}`);\n return str;\n }\n};\nconst schema = [map.map, seq.seq].concat(jsonScalars, jsonError);\n\nexports.schema = schema;\n","'use strict';\n\nvar node_buffer = require('buffer');\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst binary = {\n identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array\n default: false,\n tag: 'tag:yaml.org,2002:binary',\n /**\n * Returns a Buffer in node and an Uint8Array in browsers\n *\n * To use the resulting buffer as an image, you'll want to do something like:\n *\n * const blob = new Blob([buffer], { type: 'image/jpeg' })\n * document.querySelector('#photo').src = URL.createObjectURL(blob)\n */\n resolve(src, onError) {\n if (typeof node_buffer.Buffer === 'function') {\n return node_buffer.Buffer.from(src, 'base64');\n }\n else if (typeof atob === 'function') {\n // On IE 11, atob() can't handle newlines\n const str = atob(src.replace(/[\\n\\r]/g, ''));\n const buffer = new Uint8Array(str.length);\n for (let i = 0; i < str.length; ++i)\n buffer[i] = str.charCodeAt(i);\n return buffer;\n }\n else {\n onError('This environment does not support reading binary tags; either Buffer or atob is required');\n return src;\n }\n },\n stringify({ comment, type, value }, ctx, onComment, onChompKeep) {\n if (!value)\n return '';\n const buf = value; // checked earlier by binary.identify()\n let str;\n if (typeof node_buffer.Buffer === 'function') {\n str =\n buf instanceof node_buffer.Buffer\n ? buf.toString('base64')\n : node_buffer.Buffer.from(buf.buffer).toString('base64');\n }\n else if (typeof btoa === 'function') {\n let s = '';\n for (let i = 0; i < buf.length; ++i)\n s += String.fromCharCode(buf[i]);\n str = btoa(s);\n }\n else {\n throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');\n }\n type ?? (type = Scalar.Scalar.BLOCK_LITERAL);\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);\n const n = Math.ceil(str.length / lineWidth);\n const lines = new Array(n);\n for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {\n lines[i] = str.substr(o, lineWidth);\n }\n str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? '\\n' : ' ');\n }\n return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);\n }\n};\n\nexports.binary = binary;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar Scalar = require('../../nodes/Scalar.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nfunction resolvePairs(seq, onError) {\n if (identity.isSeq(seq)) {\n for (let i = 0; i < seq.items.length; ++i) {\n let item = seq.items[i];\n if (identity.isPair(item))\n continue;\n else if (identity.isMap(item)) {\n if (item.items.length > 1)\n onError('Each pair must have its own sequence indicator');\n const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));\n if (item.commentBefore)\n pair.key.commentBefore = pair.key.commentBefore\n ? `${item.commentBefore}\\n${pair.key.commentBefore}`\n : item.commentBefore;\n if (item.comment) {\n const cn = pair.value ?? pair.key;\n cn.comment = cn.comment\n ? `${item.comment}\\n${cn.comment}`\n : item.comment;\n }\n item = pair;\n }\n seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item);\n }\n }\n else\n onError('Expected a sequence for this tag');\n return seq;\n}\nfunction createPairs(schema, iterable, ctx) {\n const { replacer } = ctx;\n const pairs = new YAMLSeq.YAMLSeq(schema);\n pairs.tag = 'tag:yaml.org,2002:pairs';\n let i = 0;\n if (iterable && Symbol.iterator in Object(iterable))\n for (let it of iterable) {\n if (typeof replacer === 'function')\n it = replacer.call(iterable, String(i++), it);\n let key, value;\n if (Array.isArray(it)) {\n if (it.length === 2) {\n key = it[0];\n value = it[1];\n }\n else\n throw new TypeError(`Expected [key, value] tuple: ${it}`);\n }\n else if (it && it instanceof Object) {\n const keys = Object.keys(it);\n if (keys.length === 1) {\n key = keys[0];\n value = it[key];\n }\n else {\n throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);\n }\n }\n else {\n key = it;\n }\n pairs.items.push(Pair.createPair(key, value, ctx));\n }\n return pairs;\n}\nconst pairs = {\n collection: 'seq',\n default: false,\n tag: 'tag:yaml.org,2002:pairs',\n resolve: resolvePairs,\n createNode: createPairs\n};\n\nexports.createPairs = createPairs;\nexports.pairs = pairs;\nexports.resolvePairs = resolvePairs;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar toJS = require('../../nodes/toJS.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\nvar pairs = require('./pairs.js');\n\nclass YAMLOMap extends YAMLSeq.YAMLSeq {\n constructor() {\n super();\n this.add = YAMLMap.YAMLMap.prototype.add.bind(this);\n this.delete = YAMLMap.YAMLMap.prototype.delete.bind(this);\n this.get = YAMLMap.YAMLMap.prototype.get.bind(this);\n this.has = YAMLMap.YAMLMap.prototype.has.bind(this);\n this.set = YAMLMap.YAMLMap.prototype.set.bind(this);\n this.tag = YAMLOMap.tag;\n }\n /**\n * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,\n * but TypeScript won't allow widening the signature of a child method.\n */\n toJSON(_, ctx) {\n if (!ctx)\n return super.toJSON(_);\n const map = new Map();\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const pair of this.items) {\n let key, value;\n if (identity.isPair(pair)) {\n key = toJS.toJS(pair.key, '', ctx);\n value = toJS.toJS(pair.value, key, ctx);\n }\n else {\n key = toJS.toJS(pair, '', ctx);\n }\n if (map.has(key))\n throw new Error('Ordered maps must not include duplicate keys');\n map.set(key, value);\n }\n return map;\n }\n static from(schema, iterable, ctx) {\n const pairs$1 = pairs.createPairs(schema, iterable, ctx);\n const omap = new this();\n omap.items = pairs$1.items;\n return omap;\n }\n}\nYAMLOMap.tag = 'tag:yaml.org,2002:omap';\nconst omap = {\n collection: 'seq',\n identify: value => value instanceof Map,\n nodeClass: YAMLOMap,\n default: false,\n tag: 'tag:yaml.org,2002:omap',\n resolve(seq, onError) {\n const pairs$1 = pairs.resolvePairs(seq, onError);\n const seenKeys = [];\n for (const { key } of pairs$1.items) {\n if (identity.isScalar(key)) {\n if (seenKeys.includes(key.value)) {\n onError(`Ordered maps must not include duplicate keys: ${key.value}`);\n }\n else {\n seenKeys.push(key.value);\n }\n }\n }\n return Object.assign(new YAMLOMap(), pairs$1);\n },\n createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)\n};\n\nexports.YAMLOMap = YAMLOMap;\nexports.omap = omap;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nfunction boolStringify({ value, source }, ctx) {\n const boolObj = value ? trueTag : falseTag;\n if (source && boolObj.test.test(source))\n return source;\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n}\nconst trueTag = {\n identify: value => value === true,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,\n resolve: () => new Scalar.Scalar(true),\n stringify: boolStringify\n};\nconst falseTag = {\n identify: value => value === false,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,\n resolve: () => new Scalar.Scalar(false),\n stringify: boolStringify\n};\n\nexports.falseTag = falseTag;\nexports.trueTag = trueTag;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: (str) => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,\n resolve: (str) => parseFloat(str.replace(/_/g, '')),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str.replace(/_/g, '')));\n const dot = str.indexOf('.');\n if (dot !== -1) {\n const f = str.substring(dot + 1).replace(/_/g, '');\n if (f[f.length - 1] === '0')\n node.minFractionDigits = f.length;\n }\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nfunction intResolve(str, offset, radix, { intAsBigInt }) {\n const sign = str[0];\n if (sign === '-' || sign === '+')\n offset += 1;\n str = str.substring(offset).replace(/_/g, '');\n if (intAsBigInt) {\n switch (radix) {\n case 2:\n str = `0b${str}`;\n break;\n case 8:\n str = `0o${str}`;\n break;\n case 16:\n str = `0x${str}`;\n break;\n }\n const n = BigInt(str);\n return sign === '-' ? BigInt(-1) * n : n;\n }\n const n = parseInt(str, radix);\n return sign === '-' ? -1 * n : n;\n}\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value)) {\n const str = value.toString(radix);\n return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;\n }\n return stringifyNumber.stringifyNumber(node);\n}\nconst intBin = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'BIN',\n test: /^[-+]?0b[0-1_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),\n stringify: node => intStringify(node, 2, '0b')\n};\nconst intOct = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^[-+]?0[0-7_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),\n stringify: node => intStringify(node, 8, '0')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9][0-9_]*$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^[-+]?0x[0-9a-fA-F_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intBin = intBin;\nexports.intHex = intHex;\nexports.intOct = intOct;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nclass YAMLSet extends YAMLMap.YAMLMap {\n constructor(schema) {\n super(schema);\n this.tag = YAMLSet.tag;\n }\n add(key) {\n let pair;\n if (identity.isPair(key))\n pair = key;\n else if (key &&\n typeof key === 'object' &&\n 'key' in key &&\n 'value' in key &&\n key.value === null)\n pair = new Pair.Pair(key.key, null);\n else\n pair = new Pair.Pair(key, null);\n const prev = YAMLMap.findPair(this.items, pair.key);\n if (!prev)\n this.items.push(pair);\n }\n /**\n * If `keepPair` is `true`, returns the Pair matching `key`.\n * Otherwise, returns the value of that Pair's key.\n */\n get(key, keepPair) {\n const pair = YAMLMap.findPair(this.items, key);\n return !keepPair && identity.isPair(pair)\n ? identity.isScalar(pair.key)\n ? pair.key.value\n : pair.key\n : pair;\n }\n set(key, value) {\n if (typeof value !== 'boolean')\n throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);\n const prev = YAMLMap.findPair(this.items, key);\n if (prev && !value) {\n this.items.splice(this.items.indexOf(prev), 1);\n }\n else if (!prev && value) {\n this.items.push(new Pair.Pair(key));\n }\n }\n toJSON(_, ctx) {\n return super.toJSON(_, ctx, Set);\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n if (this.hasAllNullValues(true))\n return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);\n else\n throw new Error('Set items must all have null values');\n }\n static from(schema, iterable, ctx) {\n const { replacer } = ctx;\n const set = new this(schema);\n if (iterable && Symbol.iterator in Object(iterable))\n for (let value of iterable) {\n if (typeof replacer === 'function')\n value = replacer.call(iterable, value, value);\n set.items.push(Pair.createPair(value, null, ctx));\n }\n return set;\n }\n}\nYAMLSet.tag = 'tag:yaml.org,2002:set';\nconst set = {\n collection: 'map',\n identify: value => value instanceof Set,\n nodeClass: YAMLSet,\n default: false,\n tag: 'tag:yaml.org,2002:set',\n createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),\n resolve(map, onError) {\n if (identity.isMap(map)) {\n if (map.hasAllNullValues(true))\n return Object.assign(new YAMLSet(), map);\n else\n onError('Set items must all have null values');\n }\n else\n onError('Expected a mapping for this tag');\n return map;\n }\n};\n\nexports.YAMLSet = YAMLSet;\nexports.set = set;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\n/** Internal types handle bigint as number, because TS can't figure it out. */\nfunction parseSexagesimal(str, asBigInt) {\n const sign = str[0];\n const parts = sign === '-' || sign === '+' ? str.substring(1) : str;\n const num = (n) => asBigInt ? BigInt(n) : Number(n);\n const res = parts\n .replace(/_/g, '')\n .split(':')\n .reduce((res, p) => res * num(60) + num(p), num(0));\n return (sign === '-' ? num(-1) * res : res);\n}\n/**\n * hhhh:mm:ss.sss\n *\n * Internal types handle bigint as number, because TS can't figure it out.\n */\nfunction stringifySexagesimal(node) {\n let { value } = node;\n let num = (n) => n;\n if (typeof value === 'bigint')\n num = n => BigInt(n);\n else if (isNaN(value) || !isFinite(value))\n return stringifyNumber.stringifyNumber(node);\n let sign = '';\n if (value < 0) {\n sign = '-';\n value *= num(-1);\n }\n const _60 = num(60);\n const parts = [value % _60]; // seconds, including ms\n if (value < 60) {\n parts.unshift(0); // at least one : is required\n }\n else {\n value = (value - parts[0]) / _60;\n parts.unshift(value % _60); // minutes\n if (value >= 60) {\n value = (value - parts[0]) / _60;\n parts.unshift(value); // hours\n }\n }\n return (sign +\n parts\n .map(n => String(n).padStart(2, '0'))\n .join(':')\n .replace(/000000\\d*$/, '') // % 60 may introduce error\n );\n}\nconst intTime = {\n identify: value => typeof value === 'bigint' || Number.isInteger(value),\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,\n resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),\n stringify: stringifySexagesimal\n};\nconst floatTime = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,\n resolve: str => parseSexagesimal(str, false),\n stringify: stringifySexagesimal\n};\nconst timestamp = {\n identify: value => value instanceof Date,\n default: true,\n tag: 'tag:yaml.org,2002:timestamp',\n // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part\n // may be omitted altogether, resulting in a date format. In such a case, the time part is\n // assumed to be 00:00:00Z (start of day, UTC).\n test: RegExp('^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd\n '(?:' + // time is optional\n '(?:t|T|[ \\\\t]+)' + // t | T | whitespace\n '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?\n '(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30\n ')?$'),\n resolve(str) {\n const match = str.match(timestamp.test);\n if (!match)\n throw new Error('!!timestamp expects a date, starting with yyyy-mm-dd');\n const [, year, month, day, hour, minute, second] = match.map(Number);\n const millisec = match[7] ? Number((match[7] + '00').substr(1, 3)) : 0;\n let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);\n const tz = match[8];\n if (tz && tz !== 'Z') {\n let d = parseSexagesimal(tz, false);\n if (Math.abs(d) < 30)\n d *= 60;\n date -= 60000 * d;\n }\n return new Date(date);\n },\n stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\\.000Z$/, '') ?? ''\n};\n\nexports.floatTime = floatTime;\nexports.intTime = intTime;\nexports.timestamp = timestamp;\n","'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar binary = require('./binary.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\nvar merge = require('./merge.js');\nvar omap = require('./omap.js');\nvar pairs = require('./pairs.js');\nvar set = require('./set.js');\nvar timestamp = require('./timestamp.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.trueTag,\n bool.falseTag,\n int.intBin,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float,\n binary.binary,\n merge.merge,\n omap.omap,\n pairs.pairs,\n set.set,\n timestamp.intTime,\n timestamp.floatTime,\n timestamp.timestamp\n];\n\nexports.schema = schema;\n","'use strict';\n\nvar map = require('./common/map.js');\nvar _null = require('./common/null.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar bool = require('./core/bool.js');\nvar float = require('./core/float.js');\nvar int = require('./core/int.js');\nvar schema = require('./core/schema.js');\nvar schema$1 = require('./json/schema.js');\nvar binary = require('./yaml-1.1/binary.js');\nvar merge = require('./yaml-1.1/merge.js');\nvar omap = require('./yaml-1.1/omap.js');\nvar pairs = require('./yaml-1.1/pairs.js');\nvar schema$2 = require('./yaml-1.1/schema.js');\nvar set = require('./yaml-1.1/set.js');\nvar timestamp = require('./yaml-1.1/timestamp.js');\n\nconst schemas = new Map([\n ['core', schema.schema],\n ['failsafe', [map.map, seq.seq, string.string]],\n ['json', schema$1.schema],\n ['yaml11', schema$2.schema],\n ['yaml-1.1', schema$2.schema]\n]);\nconst tagsByName = {\n binary: binary.binary,\n bool: bool.boolTag,\n float: float.float,\n floatExp: float.floatExp,\n floatNaN: float.floatNaN,\n floatTime: timestamp.floatTime,\n int: int.int,\n intHex: int.intHex,\n intOct: int.intOct,\n intTime: timestamp.intTime,\n map: map.map,\n merge: merge.merge,\n null: _null.nullTag,\n omap: omap.omap,\n pairs: pairs.pairs,\n seq: seq.seq,\n set: set.set,\n timestamp: timestamp.timestamp\n};\nconst coreKnownTags = {\n 'tag:yaml.org,2002:binary': binary.binary,\n 'tag:yaml.org,2002:merge': merge.merge,\n 'tag:yaml.org,2002:omap': omap.omap,\n 'tag:yaml.org,2002:pairs': pairs.pairs,\n 'tag:yaml.org,2002:set': set.set,\n 'tag:yaml.org,2002:timestamp': timestamp.timestamp\n};\nfunction getTags(customTags, schemaName, addMergeTag) {\n const schemaTags = schemas.get(schemaName);\n if (schemaTags && !customTags) {\n return addMergeTag && !schemaTags.includes(merge.merge)\n ? schemaTags.concat(merge.merge)\n : schemaTags.slice();\n }\n let tags = schemaTags;\n if (!tags) {\n if (Array.isArray(customTags))\n tags = [];\n else {\n const keys = Array.from(schemas.keys())\n .filter(key => key !== 'yaml11')\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown schema \"${schemaName}\"; use one of ${keys} or define customTags array`);\n }\n }\n if (Array.isArray(customTags)) {\n for (const tag of customTags)\n tags = tags.concat(tag);\n }\n else if (typeof customTags === 'function') {\n tags = customTags(tags.slice());\n }\n if (addMergeTag)\n tags = tags.concat(merge.merge);\n return tags.reduce((tags, tag) => {\n const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;\n if (!tagObj) {\n const tagName = JSON.stringify(tag);\n const keys = Object.keys(tagsByName)\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);\n }\n if (!tags.includes(tagObj))\n tags.push(tagObj);\n return tags;\n }, []);\n}\n\nexports.coreKnownTags = coreKnownTags;\nexports.getTags = getTags;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar map = require('./common/map.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar tags = require('./tags.js');\n\nconst sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;\nclass Schema {\n constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {\n this.compat = Array.isArray(compat)\n ? tags.getTags(compat, 'compat')\n : compat\n ? tags.getTags(null, compat)\n : null;\n this.name = (typeof schema === 'string' && schema) || 'core';\n this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};\n this.tags = tags.getTags(customTags, this.name, merge);\n this.toStringOptions = toStringDefaults ?? null;\n Object.defineProperty(this, identity.MAP, { value: map.map });\n Object.defineProperty(this, identity.SCALAR, { value: string.string });\n Object.defineProperty(this, identity.SEQ, { value: seq.seq });\n // Used by createMap()\n this.sortMapEntries =\n typeof sortMapEntries === 'function'\n ? sortMapEntries\n : sortMapEntries === true\n ? sortMapEntriesByKey\n : null;\n }\n clone() {\n const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));\n copy.tags = this.tags.slice();\n return copy;\n }\n}\n\nexports.Schema = Schema;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyDocument(doc, options) {\n const lines = [];\n let hasDirectives = options.directives === true;\n if (options.directives !== false && doc.directives) {\n const dir = doc.directives.toString(doc);\n if (dir) {\n lines.push(dir);\n hasDirectives = true;\n }\n else if (doc.directives.docStart)\n hasDirectives = true;\n }\n if (hasDirectives)\n lines.push('---');\n const ctx = stringify.createStringifyContext(doc, options);\n const { commentString } = ctx.options;\n if (doc.commentBefore) {\n if (lines.length !== 1)\n lines.unshift('');\n const cs = commentString(doc.commentBefore);\n lines.unshift(stringifyComment.indentComment(cs, ''));\n }\n let chompKeep = false;\n let contentComment = null;\n if (doc.contents) {\n if (identity.isNode(doc.contents)) {\n if (doc.contents.spaceBefore && hasDirectives)\n lines.push('');\n if (doc.contents.commentBefore) {\n const cs = commentString(doc.contents.commentBefore);\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n // top-level block scalars need to be indented if followed by a comment\n ctx.forceBlockIndent = !!doc.comment;\n contentComment = doc.contents.comment;\n }\n const onChompKeep = contentComment ? undefined : () => (chompKeep = true);\n let body = stringify.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);\n if (contentComment)\n body += stringifyComment.lineComment(body, '', commentString(contentComment));\n if ((body[0] === '|' || body[0] === '>') &&\n lines[lines.length - 1] === '---') {\n // Top-level block scalars with a preceding doc marker ought to use the\n // same line for their header.\n lines[lines.length - 1] = `--- ${body}`;\n }\n else\n lines.push(body);\n }\n else {\n lines.push(stringify.stringify(doc.contents, ctx));\n }\n if (doc.directives?.docEnd) {\n if (doc.comment) {\n const cs = commentString(doc.comment);\n if (cs.includes('\\n')) {\n lines.push('...');\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n else {\n lines.push(`... ${cs}`);\n }\n }\n else {\n lines.push('...');\n }\n }\n else {\n let dc = doc.comment;\n if (dc && chompKeep)\n dc = dc.replace(/^\\n+/, '');\n if (dc) {\n if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')\n lines.push('');\n lines.push(stringifyComment.indentComment(commentString(dc), ''));\n }\n }\n return lines.join('\\n') + '\\n';\n}\n\nexports.stringifyDocument = stringifyDocument;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar Collection = require('../nodes/Collection.js');\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar toJS = require('../nodes/toJS.js');\nvar Schema = require('../schema/Schema.js');\nvar stringifyDocument = require('../stringify/stringifyDocument.js');\nvar anchors = require('./anchors.js');\nvar applyReviver = require('./applyReviver.js');\nvar createNode = require('./createNode.js');\nvar directives = require('./directives.js');\n\nclass Document {\n constructor(value, replacer, options) {\n /** A comment before this Document */\n this.commentBefore = null;\n /** A comment immediately after this Document */\n this.comment = null;\n /** Errors encountered during parsing. */\n this.errors = [];\n /** Warnings encountered during parsing. */\n this.warnings = [];\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.DOC });\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const opt = Object.assign({\n intAsBigInt: false,\n keepSourceTokens: false,\n logLevel: 'warn',\n prettyErrors: true,\n strict: true,\n stringKeys: false,\n uniqueKeys: true,\n version: '1.2'\n }, options);\n this.options = opt;\n let { version } = opt;\n if (options?._directives) {\n this.directives = options._directives.atDocument();\n if (this.directives.yaml.explicit)\n version = this.directives.yaml.version;\n }\n else\n this.directives = new directives.Directives({ version });\n this.setSchema(version, options);\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents =\n value === undefined ? null : this.createNode(value, _replacer, options);\n }\n /**\n * Create a deep copy of this Document and its contents.\n *\n * Custom Node values that inherit from `Object` still refer to their original instances.\n */\n clone() {\n const copy = Object.create(Document.prototype, {\n [identity.NODE_TYPE]: { value: identity.DOC }\n });\n copy.commentBefore = this.commentBefore;\n copy.comment = this.comment;\n copy.errors = this.errors.slice();\n copy.warnings = this.warnings.slice();\n copy.options = Object.assign({}, this.options);\n if (this.directives)\n copy.directives = this.directives.clone();\n copy.schema = this.schema.clone();\n // @ts-expect-error We can't really know that this matches Contents.\n copy.contents = identity.isNode(this.contents)\n ? this.contents.clone(copy.schema)\n : this.contents;\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** Adds a value to the document. */\n add(value) {\n if (assertCollection(this.contents))\n this.contents.add(value);\n }\n /** Adds a value to the document. */\n addIn(path, value) {\n if (assertCollection(this.contents))\n this.contents.addIn(path, value);\n }\n /**\n * Create a new `Alias` node, ensuring that the target `node` has the required anchor.\n *\n * If `node` already has an anchor, `name` is ignored.\n * Otherwise, the `node.anchor` value will be set to `name`,\n * or if an anchor with that name is already present in the document,\n * `name` will be used as a prefix for a new unique anchor.\n * If `name` is undefined, the generated anchor will use 'a' as a prefix.\n */\n createAlias(node, name) {\n if (!node.anchor) {\n const prev = anchors.anchorNames(this);\n node.anchor =\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n !name || prev.has(name) ? anchors.findNewAnchor(name || 'a', prev) : name;\n }\n return new Alias.Alias(node.anchor);\n }\n createNode(value, replacer, options) {\n let _replacer = undefined;\n if (typeof replacer === 'function') {\n value = replacer.call({ '': value }, '', value);\n _replacer = replacer;\n }\n else if (Array.isArray(replacer)) {\n const keyToStr = (v) => typeof v === 'number' || v instanceof String || v instanceof Number;\n const asStr = replacer.filter(keyToStr).map(String);\n if (asStr.length > 0)\n replacer = replacer.concat(asStr);\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};\n const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this, \n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n anchorPrefix || 'a');\n const ctx = {\n aliasDuplicateObjects: aliasDuplicateObjects ?? true,\n keepUndefined: keepUndefined ?? false,\n onAnchor,\n onTagObj,\n replacer: _replacer,\n schema: this.schema,\n sourceObjects\n };\n const node = createNode.createNode(value, tag, ctx);\n if (flow && identity.isCollection(node))\n node.flow = true;\n setAnchors();\n return node;\n }\n /**\n * Convert a key and a value into a `Pair` using the current schema,\n * recursively wrapping all values as `Scalar` or `Collection` nodes.\n */\n createPair(key, value, options = {}) {\n const k = this.createNode(key, null, options);\n const v = this.createNode(value, null, options);\n return new Pair.Pair(k, v);\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n return assertCollection(this.contents) ? this.contents.delete(key) : false;\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n if (Collection.isEmptyPath(path)) {\n if (this.contents == null)\n return false;\n // @ts-expect-error Presumed impossible if Strict extends false\n this.contents = null;\n return true;\n }\n return assertCollection(this.contents)\n ? this.contents.deleteIn(path)\n : false;\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n get(key, keepScalar) {\n return identity.isCollection(this.contents)\n ? this.contents.get(key, keepScalar)\n : undefined;\n }\n /**\n * Returns item at `path`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n if (Collection.isEmptyPath(path))\n return !keepScalar && identity.isScalar(this.contents)\n ? this.contents.value\n : this.contents;\n return identity.isCollection(this.contents)\n ? this.contents.getIn(path, keepScalar)\n : undefined;\n }\n /**\n * Checks if the document includes a value with the key `key`.\n */\n has(key) {\n return identity.isCollection(this.contents) ? this.contents.has(key) : false;\n }\n /**\n * Checks if the document includes a value at `path`.\n */\n hasIn(path) {\n if (Collection.isEmptyPath(path))\n return this.contents !== undefined;\n return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n set(key, value) {\n if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, [key], value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.set(key, value);\n }\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n if (Collection.isEmptyPath(path)) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = value;\n }\n else if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.setIn(path, value);\n }\n }\n /**\n * Change the YAML version and schema used by the document.\n * A `null` version disables support for directives, explicit tags, anchors, and aliases.\n * It also requires the `schema` option to be given as a `Schema` instance value.\n *\n * Overrides all previously set schema options.\n */\n setSchema(version, options = {}) {\n if (typeof version === 'number')\n version = String(version);\n let opt;\n switch (version) {\n case '1.1':\n if (this.directives)\n this.directives.yaml.version = '1.1';\n else\n this.directives = new directives.Directives({ version: '1.1' });\n opt = { resolveKnownTags: false, schema: 'yaml-1.1' };\n break;\n case '1.2':\n case 'next':\n if (this.directives)\n this.directives.yaml.version = version;\n else\n this.directives = new directives.Directives({ version });\n opt = { resolveKnownTags: true, schema: 'core' };\n break;\n case null:\n if (this.directives)\n delete this.directives;\n opt = null;\n break;\n default: {\n const sv = JSON.stringify(version);\n throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);\n }\n }\n // Not using `instanceof Schema` to allow for duck typing\n if (options.schema instanceof Object)\n this.schema = options.schema;\n else if (opt)\n this.schema = new Schema.Schema(Object.assign(opt, options));\n else\n throw new Error(`With a null YAML version, the { schema: Schema } option is required`);\n }\n // json & jsonArg are only used from toJSON()\n toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n const ctx = {\n anchors: new Map(),\n doc: this,\n keep: !json,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this.contents, jsonArg ?? '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n /**\n * A JSON representation of the document `contents`.\n *\n * @param jsonArg Used by `JSON.stringify` to indicate the array index or\n * property name.\n */\n toJSON(jsonArg, onAnchor) {\n return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });\n }\n /** A YAML representation of the document. */\n toString(options = {}) {\n if (this.errors.length > 0)\n throw new Error('Document with errors cannot be stringified');\n if ('indent' in options &&\n (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {\n const s = JSON.stringify(options.indent);\n throw new Error(`\"indent\" option must be a positive integer, not ${s}`);\n }\n return stringifyDocument.stringifyDocument(this, options);\n }\n}\nfunction assertCollection(contents) {\n if (identity.isCollection(contents))\n return true;\n throw new Error('Expected a YAML collection as document contents');\n}\n\nexports.Document = Document;\n","'use strict';\n\nclass YAMLError extends Error {\n constructor(name, pos, code, message) {\n super();\n this.name = name;\n this.code = code;\n this.message = message;\n this.pos = pos;\n }\n}\nclass YAMLParseError extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLParseError', pos, code, message);\n }\n}\nclass YAMLWarning extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLWarning', pos, code, message);\n }\n}\nconst prettifyError = (src, lc) => (error) => {\n if (error.pos[0] === -1)\n return;\n error.linePos = error.pos.map(pos => lc.linePos(pos));\n const { line, col } = error.linePos[0];\n error.message += ` at line ${line}, column ${col}`;\n let ci = col - 1;\n let lineStr = src\n .substring(lc.lineStarts[line - 1], lc.lineStarts[line])\n .replace(/[\\n\\r]+$/, '');\n // Trim to max 80 chars, keeping col position near the middle\n if (ci >= 60 && lineStr.length > 80) {\n const trimStart = Math.min(ci - 39, lineStr.length - 79);\n lineStr = '…' + lineStr.substring(trimStart);\n ci -= trimStart - 1;\n }\n if (lineStr.length > 80)\n lineStr = lineStr.substring(0, 79) + '…';\n // Include previous line in context if pointing at line start\n if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {\n // Regexp won't match if start is trimmed\n let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);\n if (prev.length > 80)\n prev = prev.substring(0, 79) + '…\\n';\n lineStr = prev + lineStr;\n }\n if (/[^ ]/.test(lineStr)) {\n let count = 1;\n const end = error.linePos[1];\n if (end?.line === line && end.col > col) {\n count = Math.max(1, Math.min(end.col - col, 80 - ci));\n }\n const pointer = ' '.repeat(ci) + '^'.repeat(count);\n error.message += `:\\n\\n${lineStr}\\n${pointer}\\n`;\n }\n};\n\nexports.YAMLError = YAMLError;\nexports.YAMLParseError = YAMLParseError;\nexports.YAMLWarning = YAMLWarning;\nexports.prettifyError = prettifyError;\n","'use strict';\n\nfunction resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {\n let spaceBefore = false;\n let atNewline = startOnNewline;\n let hasSpace = startOnNewline;\n let comment = '';\n let commentSep = '';\n let hasNewline = false;\n let reqSpace = false;\n let tab = null;\n let anchor = null;\n let tag = null;\n let newlineAfterProp = null;\n let comma = null;\n let found = null;\n let start = null;\n for (const token of tokens) {\n if (reqSpace) {\n if (token.type !== 'space' &&\n token.type !== 'newline' &&\n token.type !== 'comma')\n onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n reqSpace = false;\n }\n if (tab) {\n if (atNewline && token.type !== 'comment' && token.type !== 'newline') {\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n }\n tab = null;\n }\n switch (token.type) {\n case 'space':\n // At the doc level, tabs at line start may be parsed\n // as leading white space rather than indentation.\n // In a flow collection, only the parser handles indent.\n if (!flow &&\n (indicator !== 'doc-start' || next?.type !== 'flow-collection') &&\n token.source.includes('\\t')) {\n tab = token;\n }\n hasSpace = true;\n break;\n case 'comment': {\n if (!hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = token.source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += commentSep + cb;\n commentSep = '';\n atNewline = false;\n break;\n }\n case 'newline':\n if (atNewline) {\n if (comment)\n comment += token.source;\n else if (!found || indicator !== 'seq-item-ind')\n spaceBefore = true;\n }\n else\n commentSep += token.source;\n atNewline = true;\n hasNewline = true;\n if (anchor || tag)\n newlineAfterProp = token;\n hasSpace = true;\n break;\n case 'anchor':\n if (anchor)\n onError(token, 'MULTIPLE_ANCHORS', 'A node can have at most one anchor');\n if (token.source.endsWith(':'))\n onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);\n anchor = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n case 'tag': {\n if (tag)\n onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');\n tag = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n }\n case indicator:\n // Could here handle preceding comments differently\n if (anchor || tag)\n onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`);\n if (found)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);\n found = token;\n atNewline =\n indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';\n hasSpace = false;\n break;\n case 'comma':\n if (flow) {\n if (comma)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected , in ${flow}`);\n comma = token;\n atNewline = false;\n hasSpace = false;\n break;\n }\n // else fallthrough\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.type} token`);\n atNewline = false;\n hasSpace = false;\n }\n }\n const last = tokens[tokens.length - 1];\n const end = last ? last.offset + last.source.length : offset;\n if (reqSpace &&\n next &&\n next.type !== 'space' &&\n next.type !== 'newline' &&\n next.type !== 'comma' &&\n (next.type !== 'scalar' || next.source !== '')) {\n onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n }\n if (tab &&\n ((atNewline && tab.indent <= parentIndent) ||\n next?.type === 'block-map' ||\n next?.type === 'block-seq'))\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n return {\n comma,\n found,\n spaceBefore,\n comment,\n hasNewline,\n anchor,\n tag,\n newlineAfterProp,\n end,\n start: start ?? end\n };\n}\n\nexports.resolveProps = resolveProps;\n","'use strict';\n\nfunction containsNewline(key) {\n if (!key)\n return null;\n switch (key.type) {\n case 'alias':\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n if (key.source.includes('\\n'))\n return true;\n if (key.end)\n for (const st of key.end)\n if (st.type === 'newline')\n return true;\n return false;\n case 'flow-collection':\n for (const it of key.items) {\n for (const st of it.start)\n if (st.type === 'newline')\n return true;\n if (it.sep)\n for (const st of it.sep)\n if (st.type === 'newline')\n return true;\n if (containsNewline(it.key) || containsNewline(it.value))\n return true;\n }\n return false;\n default:\n return true;\n }\n}\n\nexports.containsNewline = containsNewline;\n","'use strict';\n\nvar utilContainsNewline = require('./util-contains-newline.js');\n\nfunction flowIndentCheck(indent, fc, onError) {\n if (fc?.type === 'flow-collection') {\n const end = fc.end[0];\n if (end.indent === indent &&\n (end.source === ']' || end.source === '}') &&\n utilContainsNewline.containsNewline(fc)) {\n const msg = 'Flow end indicator should be more indented than parent';\n onError(end, 'BAD_INDENT', msg, true);\n }\n }\n}\n\nexports.flowIndentCheck = flowIndentCheck;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\n\nfunction mapIncludes(ctx, items, search) {\n const { uniqueKeys } = ctx.options;\n if (uniqueKeys === false)\n return false;\n const isEqual = typeof uniqueKeys === 'function'\n ? uniqueKeys\n : (a, b) => a === b || (identity.isScalar(a) && identity.isScalar(b) && a.value === b.value);\n return items.some(pair => isEqual(pair.key, search));\n}\n\nexports.mapIncludes = mapIncludes;\n","'use strict';\n\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst startColMsg = 'All mapping items must start at the same column';\nfunction resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLMap.YAMLMap;\n const map = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n let offset = bm.offset;\n let commentEnd = null;\n for (const collItem of bm.items) {\n const { start, key, sep, value } = collItem;\n // key properties\n const keyProps = resolveProps.resolveProps(start, {\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: bm.indent,\n startOnNewline: true\n });\n const implicitKey = !keyProps.found;\n if (implicitKey) {\n if (key) {\n if (key.type === 'block-seq')\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'A block sequence may not be used as an implicit map key');\n else if ('indent' in key && key.indent !== bm.indent)\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n if (!keyProps.anchor && !keyProps.tag && !sep) {\n commentEnd = keyProps.end;\n if (keyProps.comment) {\n if (map.comment)\n map.comment += '\\n' + keyProps.comment;\n else\n map.comment = keyProps.comment;\n }\n continue;\n }\n if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {\n onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');\n }\n }\n else if (keyProps.found?.indent !== bm.indent) {\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n // key value\n ctx.atKey = true;\n const keyStart = keyProps.end;\n const keyNode = key\n ? composeNode(ctx, key, keyProps, onError)\n : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);\n ctx.atKey = false;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: bm.indent,\n startOnNewline: !key || key.type === 'block-scalar'\n });\n offset = valueProps.end;\n if (valueProps.found) {\n if (implicitKey) {\n if (value?.type === 'block-map' && !valueProps.hasNewline)\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');\n if (ctx.options.strict &&\n keyProps.start < valueProps.found.offset - 1024)\n onError(keyNode.range, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit block mapping key');\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : composeEmptyNode(ctx, offset, sep, null, valueProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);\n offset = valueNode.range[2];\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n else {\n // key with no value\n if (implicitKey)\n onError(keyNode.range, 'MISSING_CHAR', 'Implicit map keys need to be followed by map values');\n if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n }\n if (commentEnd && commentEnd < offset)\n onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');\n map.range = [bm.offset, offset, commentEnd ?? offset];\n return map;\n}\n\nexports.resolveBlockMap = resolveBlockMap;\n","'use strict';\n\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\n\nfunction resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLSeq.YAMLSeq;\n const seq = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = bs.offset;\n let commentEnd = null;\n for (const { start, value } of bs.items) {\n const props = resolveProps.resolveProps(start, {\n indicator: 'seq-item-ind',\n next: value,\n offset,\n onError,\n parentIndent: bs.indent,\n startOnNewline: true\n });\n if (!props.found) {\n if (props.anchor || props.tag || value) {\n if (value?.type === 'block-seq')\n onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');\n else\n onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');\n }\n else {\n commentEnd = props.end;\n if (props.comment)\n seq.comment = props.comment;\n continue;\n }\n }\n const node = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, start, null, props, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);\n offset = node.range[2];\n seq.items.push(node);\n }\n seq.range = [bs.offset, offset, commentEnd ?? offset];\n return seq;\n}\n\nexports.resolveBlockSeq = resolveBlockSeq;\n","'use strict';\n\nfunction resolveEnd(end, offset, reqSpace, onError) {\n let comment = '';\n if (end) {\n let hasSpace = false;\n let sep = '';\n for (const token of end) {\n const { source, type } = token;\n switch (type) {\n case 'space':\n hasSpace = true;\n break;\n case 'comment': {\n if (reqSpace && !hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += sep + cb;\n sep = '';\n break;\n }\n case 'newline':\n if (comment)\n sep += source;\n hasSpace = true;\n break;\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${type} at node end`);\n }\n offset += source.length;\n }\n }\n return { comment, offset };\n}\n\nexports.resolveEnd = resolveEnd;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst blockMsg = 'Block collections are not allowed within flow collections';\nconst isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');\nfunction resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {\n const isMap = fc.start.source === '{';\n const fcName = isMap ? 'flow map' : 'flow sequence';\n const NodeClass = (tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq));\n const coll = new NodeClass(ctx.schema);\n coll.flow = true;\n const atRoot = ctx.atRoot;\n if (atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = fc.offset + fc.start.source.length;\n for (let i = 0; i < fc.items.length; ++i) {\n const collItem = fc.items[i];\n const { start, key, sep, value } = collItem;\n const props = resolveProps.resolveProps(start, {\n flow: fcName,\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (!props.found) {\n if (!props.anchor && !props.tag && !sep && !value) {\n if (i === 0 && props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n else if (i < fc.items.length - 1)\n onError(props.start, 'UNEXPECTED_TOKEN', `Unexpected empty item in ${fcName}`);\n if (props.comment) {\n if (coll.comment)\n coll.comment += '\\n' + props.comment;\n else\n coll.comment = props.comment;\n }\n offset = props.end;\n continue;\n }\n if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key))\n onError(key, // checked by containsNewline()\n 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n }\n if (i === 0) {\n if (props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n }\n else {\n if (!props.comma)\n onError(props.start, 'MISSING_CHAR', `Missing , between ${fcName} items`);\n if (props.comment) {\n let prevItemComment = '';\n loop: for (const st of start) {\n switch (st.type) {\n case 'comma':\n case 'space':\n break;\n case 'comment':\n prevItemComment = st.source.substring(1);\n break loop;\n default:\n break loop;\n }\n }\n if (prevItemComment) {\n let prev = coll.items[coll.items.length - 1];\n if (identity.isPair(prev))\n prev = prev.value ?? prev.key;\n if (prev.comment)\n prev.comment += '\\n' + prevItemComment;\n else\n prev.comment = prevItemComment;\n props.comment = props.comment.substring(prevItemComment.length + 1);\n }\n }\n }\n if (!isMap && !sep && !props.found) {\n // item is a value in a seq\n // → key & sep are empty, start does not include ? or :\n const valueNode = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, sep, null, props, onError);\n coll.items.push(valueNode);\n offset = valueNode.range[2];\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else {\n // item is a key+value pair\n // key value\n ctx.atKey = true;\n const keyStart = props.end;\n const keyNode = key\n ? composeNode(ctx, key, props, onError)\n : composeEmptyNode(ctx, keyStart, start, null, props, onError);\n if (isBlock(key))\n onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);\n ctx.atKey = false;\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n flow: fcName,\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (valueProps.found) {\n if (!isMap && !props.found && ctx.options.strict) {\n if (sep)\n for (const st of sep) {\n if (st === valueProps.found)\n break;\n if (st.type === 'newline') {\n onError(st, 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n break;\n }\n }\n if (props.start < valueProps.found.offset - 1024)\n onError(valueProps.found, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit flow sequence key');\n }\n }\n else if (value) {\n if ('source' in value && value.source?.[0] === ':')\n onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);\n else\n onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : valueProps.found\n ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError)\n : null;\n if (valueNode) {\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n if (isMap) {\n const map = coll;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n map.items.push(pair);\n }\n else {\n const map = new YAMLMap.YAMLMap(ctx.schema);\n map.flow = true;\n map.items.push(pair);\n const endRange = (valueNode ?? keyNode).range;\n map.range = [keyNode.range[0], endRange[1], endRange[2]];\n coll.items.push(map);\n }\n offset = valueNode ? valueNode.range[2] : valueProps.end;\n }\n }\n const expectedEnd = isMap ? '}' : ']';\n const [ce, ...ee] = fc.end;\n let cePos = offset;\n if (ce?.source === expectedEnd)\n cePos = ce.offset + ce.source.length;\n else {\n const name = fcName[0].toUpperCase() + fcName.substring(1);\n const msg = atRoot\n ? `${name} must end with a ${expectedEnd}`\n : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`;\n onError(offset, atRoot ? 'MISSING_CHAR' : 'BAD_INDENT', msg);\n if (ce && ce.source.length !== 1)\n ee.unshift(ce);\n }\n if (ee.length > 0) {\n const end = resolveEnd.resolveEnd(ee, cePos, ctx.options.strict, onError);\n if (end.comment) {\n if (coll.comment)\n coll.comment += '\\n' + end.comment;\n else\n coll.comment = end.comment;\n }\n coll.range = [fc.offset, cePos, end.offset];\n }\n else {\n coll.range = [fc.offset, cePos, cePos];\n }\n return coll;\n}\n\nexports.resolveFlowCollection = resolveFlowCollection;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveBlockMap = require('./resolve-block-map.js');\nvar resolveBlockSeq = require('./resolve-block-seq.js');\nvar resolveFlowCollection = require('./resolve-flow-collection.js');\n\nfunction resolveCollection(CN, ctx, token, onError, tagName, tag) {\n const coll = token.type === 'block-map'\n ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag)\n : token.type === 'block-seq'\n ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag)\n : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag);\n const Coll = coll.constructor;\n // If we got a tagName matching the class, or the tag name is '!',\n // then use the tagName from the node class used to create it.\n if (tagName === '!' || tagName === Coll.tagName) {\n coll.tag = Coll.tagName;\n return coll;\n }\n if (tagName)\n coll.tag = tagName;\n return coll;\n}\nfunction composeCollection(CN, ctx, token, props, onError) {\n const tagToken = props.tag;\n const tagName = !tagToken\n ? null\n : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));\n if (token.type === 'block-seq') {\n const { anchor, newlineAfterProp: nl } = props;\n const lastProp = anchor && tagToken\n ? anchor.offset > tagToken.offset\n ? anchor\n : tagToken\n : (anchor ?? tagToken);\n if (lastProp && (!nl || nl.offset < lastProp.offset)) {\n const message = 'Missing newline after block sequence props';\n onError(lastProp, 'MISSING_CHAR', message);\n }\n }\n const expType = token.type === 'block-map'\n ? 'map'\n : token.type === 'block-seq'\n ? 'seq'\n : token.start.source === '{'\n ? 'map'\n : 'seq';\n // shortcut: check if it's a generic YAMLMap or YAMLSeq\n // before jumping into the custom tag logic.\n if (!tagToken ||\n !tagName ||\n tagName === '!' ||\n (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||\n (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);\n if (!tag) {\n const kt = ctx.schema.knownTags[tagName];\n if (kt?.collection === expType) {\n ctx.schema.tags.push(Object.assign({}, kt, { default: false }));\n tag = kt;\n }\n else {\n if (kt) {\n onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);\n }\n else {\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);\n }\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n }\n const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);\n const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;\n const node = identity.isNode(res)\n ? res\n : new Scalar.Scalar(res);\n node.range = coll.range;\n node.tag = tagName;\n if (tag?.format)\n node.format = tag.format;\n return node;\n}\n\nexports.composeCollection = composeCollection;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\n\nfunction resolveBlockScalar(ctx, scalar, onError) {\n const start = scalar.offset;\n const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);\n if (!header)\n return { value: '', type: null, comment: '', range: [start, start, start] };\n const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;\n const lines = scalar.source ? splitLines(scalar.source) : [];\n // determine the end of content & start of chomping\n let chompStart = lines.length;\n for (let i = lines.length - 1; i >= 0; --i) {\n const content = lines[i][1];\n if (content === '' || content === '\\r')\n chompStart = i;\n else\n break;\n }\n // shortcut for empty contents\n if (chompStart === 0) {\n const value = header.chomp === '+' && lines.length > 0\n ? '\\n'.repeat(Math.max(1, lines.length - 1))\n : '';\n let end = start + header.length;\n if (scalar.source)\n end += scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n }\n // find the indentation level to trim from start\n let trimIndent = scalar.indent + header.indent;\n let offset = scalar.offset + header.length;\n let contentStart = 0;\n for (let i = 0; i < chompStart; ++i) {\n const [indent, content] = lines[i];\n if (content === '' || content === '\\r') {\n if (header.indent === 0 && indent.length > trimIndent)\n trimIndent = indent.length;\n }\n else {\n if (indent.length < trimIndent) {\n const message = 'Block scalars with more-indented leading empty lines must use an explicit indentation indicator';\n onError(offset + indent.length, 'MISSING_CHAR', message);\n }\n if (header.indent === 0)\n trimIndent = indent.length;\n contentStart = i;\n if (trimIndent === 0 && !ctx.atRoot) {\n const message = 'Block scalar values in collections must be indented';\n onError(offset, 'BAD_INDENT', message);\n }\n break;\n }\n offset += indent.length + content.length + 1;\n }\n // include trailing more-indented empty lines in content\n for (let i = lines.length - 1; i >= chompStart; --i) {\n if (lines[i][0].length > trimIndent)\n chompStart = i + 1;\n }\n let value = '';\n let sep = '';\n let prevMoreIndented = false;\n // leading whitespace is kept intact\n for (let i = 0; i < contentStart; ++i)\n value += lines[i][0].slice(trimIndent) + '\\n';\n for (let i = contentStart; i < chompStart; ++i) {\n let [indent, content] = lines[i];\n offset += indent.length + content.length + 1;\n const crlf = content[content.length - 1] === '\\r';\n if (crlf)\n content = content.slice(0, -1);\n /* istanbul ignore if already caught in lexer */\n if (content && indent.length < trimIndent) {\n const src = header.indent\n ? 'explicit indentation indicator'\n : 'first line';\n const message = `Block scalar lines must not be less indented than their ${src}`;\n onError(offset - content.length - (crlf ? 2 : 1), 'BAD_INDENT', message);\n indent = '';\n }\n if (type === Scalar.Scalar.BLOCK_LITERAL) {\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n }\n else if (indent.length > trimIndent || content[0] === '\\t') {\n // more-indented content within a folded block\n if (sep === ' ')\n sep = '\\n';\n else if (!prevMoreIndented && sep === '\\n')\n sep = '\\n\\n';\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n prevMoreIndented = true;\n }\n else if (content === '') {\n // empty line\n if (sep === '\\n')\n value += '\\n';\n else\n sep = '\\n';\n }\n else {\n value += sep + content;\n sep = ' ';\n prevMoreIndented = false;\n }\n }\n switch (header.chomp) {\n case '-':\n break;\n case '+':\n for (let i = chompStart; i < lines.length; ++i)\n value += '\\n' + lines[i][0].slice(trimIndent);\n if (value[value.length - 1] !== '\\n')\n value += '\\n';\n break;\n default:\n value += '\\n';\n }\n const end = start + header.length + scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n}\nfunction parseBlockScalarHeader({ offset, props }, strict, onError) {\n /* istanbul ignore if should not happen */\n if (props[0].type !== 'block-scalar-header') {\n onError(props[0], 'IMPOSSIBLE', 'Block scalar header not found');\n return null;\n }\n const { source } = props[0];\n const mode = source[0];\n let indent = 0;\n let chomp = '';\n let error = -1;\n for (let i = 1; i < source.length; ++i) {\n const ch = source[i];\n if (!chomp && (ch === '-' || ch === '+'))\n chomp = ch;\n else {\n const n = Number(ch);\n if (!indent && n)\n indent = n;\n else if (error === -1)\n error = offset + i;\n }\n }\n if (error !== -1)\n onError(error, 'UNEXPECTED_TOKEN', `Block scalar header includes extra characters: ${source}`);\n let hasSpace = false;\n let comment = '';\n let length = source.length;\n for (let i = 1; i < props.length; ++i) {\n const token = props[i];\n switch (token.type) {\n case 'space':\n hasSpace = true;\n // fallthrough\n case 'newline':\n length += token.source.length;\n break;\n case 'comment':\n if (strict && !hasSpace) {\n const message = 'Comments must be separated from other tokens by white space characters';\n onError(token, 'MISSING_CHAR', message);\n }\n length += token.source.length;\n comment = token.source.substring(1);\n break;\n case 'error':\n onError(token, 'UNEXPECTED_TOKEN', token.message);\n length += token.source.length;\n break;\n /* istanbul ignore next should not happen */\n default: {\n const message = `Unexpected token in block scalar header: ${token.type}`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n const ts = token.source;\n if (ts && typeof ts === 'string')\n length += ts.length;\n }\n }\n }\n return { mode, indent, chomp, comment, length };\n}\n/** @returns Array of lines split up as `[indent, content]` */\nfunction splitLines(source) {\n const split = source.split(/\\n( *)/);\n const first = split[0];\n const m = first.match(/^( *)/);\n const line0 = m?.[1]\n ? [m[1], first.slice(m[1].length)]\n : ['', first];\n const lines = [line0];\n for (let i = 1; i < split.length; i += 2)\n lines.push([split[i], split[i + 1]]);\n return lines;\n}\n\nexports.resolveBlockScalar = resolveBlockScalar;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction resolveFlowScalar(scalar, strict, onError) {\n const { offset, type, source, end } = scalar;\n let _type;\n let value;\n const _onError = (rel, code, msg) => onError(offset + rel, code, msg);\n switch (type) {\n case 'scalar':\n _type = Scalar.Scalar.PLAIN;\n value = plainValue(source, _onError);\n break;\n case 'single-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_SINGLE;\n value = singleQuotedValue(source, _onError);\n break;\n case 'double-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_DOUBLE;\n value = doubleQuotedValue(source, _onError);\n break;\n /* istanbul ignore next should not happen */\n default:\n onError(scalar, 'UNEXPECTED_TOKEN', `Expected a flow scalar value, but found: ${type}`);\n return {\n value: '',\n type: null,\n comment: '',\n range: [offset, offset + source.length, offset + source.length]\n };\n }\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);\n return {\n value,\n type: _type,\n comment: re.comment,\n range: [offset, valueEnd, re.offset]\n };\n}\nfunction plainValue(source, onError) {\n let badChar = '';\n switch (source[0]) {\n /* istanbul ignore next should not happen */\n case '\\t':\n badChar = 'a tab character';\n break;\n case ',':\n badChar = 'flow indicator character ,';\n break;\n case '%':\n badChar = 'directive indicator character %';\n break;\n case '|':\n case '>': {\n badChar = `block scalar indicator ${source[0]}`;\n break;\n }\n case '@':\n case '`': {\n badChar = `reserved character ${source[0]}`;\n break;\n }\n }\n if (badChar)\n onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);\n return foldLines(source);\n}\nfunction singleQuotedValue(source, onError) {\n if (source[source.length - 1] !== \"'\" || source.length === 1)\n onError(source.length, 'MISSING_CHAR', \"Missing closing 'quote\");\n return foldLines(source.slice(1, -1)).replace(/''/g, \"'\");\n}\nfunction foldLines(source) {\n /**\n * The negative lookbehind here and in the `re` RegExp is to\n * prevent causing a polynomial search time in certain cases.\n *\n * The try-catch is for Safari, which doesn't support this yet:\n * https://caniuse.com/js-regexp-lookbehind\n */\n let first, line;\n try {\n first = new RegExp('(.*?)(?<![ \\t])[ \\t]*\\r?\\n', 'sy');\n line = new RegExp('[ \\t]*(.*?)(?:(?<![ \\t])[ \\t]*)?\\r?\\n', 'sy');\n }\n catch {\n first = /(.*?)[ \\t]*\\r?\\n/sy;\n line = /[ \\t]*(.*?)[ \\t]*\\r?\\n/sy;\n }\n let match = first.exec(source);\n if (!match)\n return source;\n let res = match[1];\n let sep = ' ';\n let pos = first.lastIndex;\n line.lastIndex = pos;\n while ((match = line.exec(source))) {\n if (match[1] === '') {\n if (sep === '\\n')\n res += sep;\n else\n sep = '\\n';\n }\n else {\n res += sep + match[1];\n sep = ' ';\n }\n pos = line.lastIndex;\n }\n const last = /[ \\t]*(.*)/sy;\n last.lastIndex = pos;\n match = last.exec(source);\n return res + sep + (match?.[1] ?? '');\n}\nfunction doubleQuotedValue(source, onError) {\n let res = '';\n for (let i = 1; i < source.length - 1; ++i) {\n const ch = source[i];\n if (ch === '\\r' && source[i + 1] === '\\n')\n continue;\n if (ch === '\\n') {\n const { fold, offset } = foldNewline(source, i);\n res += fold;\n i = offset;\n }\n else if (ch === '\\\\') {\n let next = source[++i];\n const cc = escapeCodes[next];\n if (cc)\n res += cc;\n else if (next === '\\n') {\n // skip escaped newlines, but still trim the following line\n next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === '\\r' && source[i + 1] === '\\n') {\n // skip escaped CRLF newlines, but still trim the following line\n next = source[++i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === 'x' || next === 'u' || next === 'U') {\n const length = { x: 2, u: 4, U: 8 }[next];\n res += parseCharCode(source, i + 1, length, onError);\n i += length;\n }\n else {\n const raw = source.substr(i - 1, 2);\n onError(i - 1, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n res += raw;\n }\n }\n else if (ch === ' ' || ch === '\\t') {\n // trim trailing whitespace\n const wsStart = i;\n let next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n if (next !== '\\n' && !(next === '\\r' && source[i + 2] === '\\n'))\n res += i > wsStart ? source.slice(wsStart, i + 1) : ch;\n }\n else {\n res += ch;\n }\n }\n if (source[source.length - 1] !== '\"' || source.length === 1)\n onError(source.length, 'MISSING_CHAR', 'Missing closing \"quote');\n return res;\n}\n/**\n * Fold a single newline into a space, multiple newlines to N - 1 newlines.\n * Presumes `source[offset] === '\\n'`\n */\nfunction foldNewline(source, offset) {\n let fold = '';\n let ch = source[offset + 1];\n while (ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r') {\n if (ch === '\\r' && source[offset + 2] !== '\\n')\n break;\n if (ch === '\\n')\n fold += '\\n';\n offset += 1;\n ch = source[offset + 1];\n }\n if (!fold)\n fold = ' ';\n return { fold, offset };\n}\nconst escapeCodes = {\n '0': '\\0', // null character\n a: '\\x07', // bell character\n b: '\\b', // backspace\n e: '\\x1b', // escape character\n f: '\\f', // form feed\n n: '\\n', // line feed\n r: '\\r', // carriage return\n t: '\\t', // horizontal tab\n v: '\\v', // vertical tab\n N: '\\u0085', // Unicode next line\n _: '\\u00a0', // Unicode non-breaking space\n L: '\\u2028', // Unicode line separator\n P: '\\u2029', // Unicode paragraph separator\n ' ': ' ',\n '\"': '\"',\n '/': '/',\n '\\\\': '\\\\',\n '\\t': '\\t'\n};\nfunction parseCharCode(source, offset, length, onError) {\n const cc = source.substr(offset, length);\n const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);\n const code = ok ? parseInt(cc, 16) : NaN;\n if (isNaN(code)) {\n const raw = source.substr(offset - 2, length + 2);\n onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n return raw;\n }\n return String.fromCodePoint(code);\n}\n\nexports.resolveFlowScalar = resolveFlowScalar;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveBlockScalar = require('./resolve-block-scalar.js');\nvar resolveFlowScalar = require('./resolve-flow-scalar.js');\n\nfunction composeScalar(ctx, token, tagToken, onError) {\n const { value, type, comment, range } = token.type === 'block-scalar'\n ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)\n : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);\n const tagName = tagToken\n ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))\n : null;\n let tag;\n if (ctx.options.stringKeys && ctx.atKey) {\n tag = ctx.schema[identity.SCALAR];\n }\n else if (tagName)\n tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);\n else if (token.type === 'scalar')\n tag = findScalarTagByTest(ctx, value, token, onError);\n else\n tag = ctx.schema[identity.SCALAR];\n let scalar;\n try {\n const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);\n scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);\n }\n catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);\n scalar = new Scalar.Scalar(value);\n }\n scalar.range = range;\n scalar.source = value;\n if (type)\n scalar.type = type;\n if (tagName)\n scalar.tag = tagName;\n if (tag.format)\n scalar.format = tag.format;\n if (comment)\n scalar.comment = comment;\n return scalar;\n}\nfunction findScalarTagByName(schema, value, tagName, tagToken, onError) {\n if (tagName === '!')\n return schema[identity.SCALAR]; // non-specific tag\n const matchWithTest = [];\n for (const tag of schema.tags) {\n if (!tag.collection && tag.tag === tagName) {\n if (tag.default && tag.test)\n matchWithTest.push(tag);\n else\n return tag;\n }\n }\n for (const tag of matchWithTest)\n if (tag.test?.test(value))\n return tag;\n const kt = schema.knownTags[tagName];\n if (kt && !kt.collection) {\n // Ensure that the known tag is available for stringifying,\n // but does not get used by default.\n schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));\n return kt;\n }\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');\n return schema[identity.SCALAR];\n}\nfunction findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {\n const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&\n tag.test?.test(value)) || schema[identity.SCALAR];\n if (schema.compat) {\n const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??\n schema[identity.SCALAR];\n if (tag.tag !== compat.tag) {\n const ts = directives.tagString(tag.tag);\n const cs = directives.tagString(compat.tag);\n const msg = `Value may be parsed as either ${ts} or ${cs}`;\n onError(token, 'TAG_RESOLVE_FAILED', msg, true);\n }\n }\n return tag;\n}\n\nexports.composeScalar = composeScalar;\n","'use strict';\n\nfunction emptyScalarPosition(offset, before, pos) {\n if (before) {\n pos ?? (pos = before.length);\n for (let i = pos - 1; i >= 0; --i) {\n let st = before[i];\n switch (st.type) {\n case 'space':\n case 'comment':\n case 'newline':\n offset -= st.source.length;\n continue;\n }\n // Technically, an empty scalar is immediately after the last non-empty\n // node, but it's more useful to place it after any whitespace.\n st = before[++i];\n while (st?.type === 'space') {\n offset += st.source.length;\n st = before[++i];\n }\n break;\n }\n }\n return offset;\n}\n\nexports.emptyScalarPosition = emptyScalarPosition;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar composeCollection = require('./compose-collection.js');\nvar composeScalar = require('./compose-scalar.js');\nvar resolveEnd = require('./resolve-end.js');\nvar utilEmptyScalarPosition = require('./util-empty-scalar-position.js');\n\nconst CN = { composeNode, composeEmptyNode };\nfunction composeNode(ctx, token, props, onError) {\n const atKey = ctx.atKey;\n const { spaceBefore, comment, anchor, tag } = props;\n let node;\n let isSrcToken = true;\n switch (token.type) {\n case 'alias':\n node = composeAlias(ctx, token, onError);\n if (anchor || tag)\n onError(token, 'ALIAS_PROPS', 'An alias node must not specify any properties');\n break;\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'block-scalar':\n node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n break;\n case 'block-map':\n case 'block-seq':\n case 'flow-collection':\n node = composeCollection.composeCollection(CN, ctx, token, props, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n break;\n default: {\n const message = token.type === 'error'\n ? token.message\n : `Unsupported token (type: ${token.type})`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);\n isSrcToken = false;\n }\n }\n if (anchor && node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n if (atKey &&\n ctx.options.stringKeys &&\n (!identity.isScalar(node) ||\n typeof node.value !== 'string' ||\n (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {\n const msg = 'With stringKeys, all keys must be strings';\n onError(tag ?? token, 'NON_STRING_KEY', msg);\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n if (token.type === 'scalar' && token.source === '')\n node.comment = comment;\n else\n node.commentBefore = comment;\n }\n // @ts-expect-error Type checking misses meaning of isSrcToken\n if (ctx.options.keepSourceTokens && isSrcToken)\n node.srcToken = token;\n return node;\n}\nfunction composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {\n const token = {\n type: 'scalar',\n offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos),\n indent: -1,\n source: ''\n };\n const node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor) {\n node.anchor = anchor.source.substring(1);\n if (node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n node.comment = comment;\n node.range[2] = end;\n }\n return node;\n}\nfunction composeAlias({ options }, { offset, source, end }, onError) {\n const alias = new Alias.Alias(source.substring(1));\n if (alias.source === '')\n onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');\n if (alias.source.endsWith(':'))\n onError(offset + source.length - 1, 'BAD_ALIAS', 'Alias ending in : is ambiguous', true);\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);\n alias.range = [offset, valueEnd, re.offset];\n if (re.comment)\n alias.comment = re.comment;\n return alias;\n}\n\nexports.composeEmptyNode = composeEmptyNode;\nexports.composeNode = composeNode;\n","'use strict';\n\nvar Document = require('../doc/Document.js');\nvar composeNode = require('./compose-node.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\n\nfunction composeDoc(options, directives, { offset, start, value, end }, onError) {\n const opts = Object.assign({ _directives: directives }, options);\n const doc = new Document.Document(undefined, opts);\n const ctx = {\n atKey: false,\n atRoot: true,\n directives: doc.directives,\n options: doc.options,\n schema: doc.schema\n };\n const props = resolveProps.resolveProps(start, {\n indicator: 'doc-start',\n next: value ?? end?.[0],\n offset,\n onError,\n parentIndent: 0,\n startOnNewline: true\n });\n if (props.found) {\n doc.directives.docStart = true;\n if (value &&\n (value.type === 'block-map' || value.type === 'block-seq') &&\n !props.hasNewline)\n onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');\n }\n // @ts-expect-error If Contents is set, let's trust the user\n doc.contents = value\n ? composeNode.composeNode(ctx, value, props, onError)\n : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);\n const contentEnd = doc.contents.range[2];\n const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);\n if (re.comment)\n doc.comment = re.comment;\n doc.range = [offset, contentEnd, re.offset];\n return doc;\n}\n\nexports.composeDoc = composeDoc;\n","'use strict';\n\nvar node_process = require('process');\nvar directives = require('../doc/directives.js');\nvar Document = require('../doc/Document.js');\nvar errors = require('../errors.js');\nvar identity = require('../nodes/identity.js');\nvar composeDoc = require('./compose-doc.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction getErrorPos(src) {\n if (typeof src === 'number')\n return [src, src + 1];\n if (Array.isArray(src))\n return src.length === 2 ? src : [src[0], src[1]];\n const { offset, source } = src;\n return [offset, offset + (typeof source === 'string' ? source.length : 1)];\n}\nfunction parsePrelude(prelude) {\n let comment = '';\n let atComment = false;\n let afterEmptyLine = false;\n for (let i = 0; i < prelude.length; ++i) {\n const source = prelude[i];\n switch (source[0]) {\n case '#':\n comment +=\n (comment === '' ? '' : afterEmptyLine ? '\\n\\n' : '\\n') +\n (source.substring(1) || ' ');\n atComment = true;\n afterEmptyLine = false;\n break;\n case '%':\n if (prelude[i + 1]?.[0] !== '#')\n i += 1;\n atComment = false;\n break;\n default:\n // This may be wrong after doc-end, but in that case it doesn't matter\n if (!atComment)\n afterEmptyLine = true;\n atComment = false;\n }\n }\n return { comment, afterEmptyLine };\n}\n/**\n * Compose a stream of CST nodes into a stream of YAML Documents.\n *\n * ```ts\n * import { Composer, Parser } from 'yaml'\n *\n * const src: string = ...\n * const tokens = new Parser().parse(src)\n * const docs = new Composer().compose(tokens)\n * ```\n */\nclass Composer {\n constructor(options = {}) {\n this.doc = null;\n this.atDirectives = false;\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n this.onError = (source, code, message, warning) => {\n const pos = getErrorPos(source);\n if (warning)\n this.warnings.push(new errors.YAMLWarning(pos, code, message));\n else\n this.errors.push(new errors.YAMLParseError(pos, code, message));\n };\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n this.directives = new directives.Directives({ version: options.version || '1.2' });\n this.options = options;\n }\n decorate(doc, afterDoc) {\n const { comment, afterEmptyLine } = parsePrelude(this.prelude);\n //console.log({ dc: doc.comment, prelude, comment })\n if (comment) {\n const dc = doc.contents;\n if (afterDoc) {\n doc.comment = doc.comment ? `${doc.comment}\\n${comment}` : comment;\n }\n else if (afterEmptyLine || doc.directives.docStart || !dc) {\n doc.commentBefore = comment;\n }\n else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {\n let it = dc.items[0];\n if (identity.isPair(it))\n it = it.key;\n const cb = it.commentBefore;\n it.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n else {\n const cb = dc.commentBefore;\n dc.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n }\n if (afterDoc) {\n Array.prototype.push.apply(doc.errors, this.errors);\n Array.prototype.push.apply(doc.warnings, this.warnings);\n }\n else {\n doc.errors = this.errors;\n doc.warnings = this.warnings;\n }\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n }\n /**\n * Current stream status information.\n *\n * Mostly useful at the end of input for an empty stream.\n */\n streamInfo() {\n return {\n comment: parsePrelude(this.prelude).comment,\n directives: this.directives,\n errors: this.errors,\n warnings: this.warnings\n };\n }\n /**\n * Compose tokens into documents.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *compose(tokens, forceDoc = false, endOffset = -1) {\n for (const token of tokens)\n yield* this.next(token);\n yield* this.end(forceDoc, endOffset);\n }\n /** Advance the composer by one CST token. */\n *next(token) {\n if (node_process.env.LOG_STREAM)\n console.dir(token, { depth: null });\n switch (token.type) {\n case 'directive':\n this.directives.add(token.source, (offset, message, warning) => {\n const pos = getErrorPos(token);\n pos[0] += offset;\n this.onError(pos, 'BAD_DIRECTIVE', message, warning);\n });\n this.prelude.push(token.source);\n this.atDirectives = true;\n break;\n case 'document': {\n const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);\n if (this.atDirectives && !doc.directives.docStart)\n this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');\n this.decorate(doc, false);\n if (this.doc)\n yield this.doc;\n this.doc = doc;\n this.atDirectives = false;\n break;\n }\n case 'byte-order-mark':\n case 'space':\n break;\n case 'comment':\n case 'newline':\n this.prelude.push(token.source);\n break;\n case 'error': {\n const msg = token.source\n ? `${token.message}: ${JSON.stringify(token.source)}`\n : token.message;\n const error = new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);\n if (this.atDirectives || !this.doc)\n this.errors.push(error);\n else\n this.doc.errors.push(error);\n break;\n }\n case 'doc-end': {\n if (!this.doc) {\n const msg = 'Unexpected doc-end without preceding document';\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));\n break;\n }\n this.doc.directives.docEnd = true;\n const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);\n this.decorate(this.doc, true);\n if (end.comment) {\n const dc = this.doc.comment;\n this.doc.comment = dc ? `${dc}\\n${end.comment}` : end.comment;\n }\n this.doc.range[2] = end.offset;\n break;\n }\n default:\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));\n }\n }\n /**\n * Call at end of input to yield any remaining document.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *end(forceDoc = false, endOffset = -1) {\n if (this.doc) {\n this.decorate(this.doc, true);\n yield this.doc;\n this.doc = null;\n }\n else if (forceDoc) {\n const opts = Object.assign({ _directives: this.directives }, this.options);\n const doc = new Document.Document(undefined, opts);\n if (this.atDirectives)\n this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');\n doc.range = [0, endOffset, endOffset];\n this.decorate(doc, false);\n yield doc;\n }\n }\n}\n\nexports.Composer = Composer;\n","'use strict';\n\nvar resolveBlockScalar = require('../compose/resolve-block-scalar.js');\nvar resolveFlowScalar = require('../compose/resolve-flow-scalar.js');\nvar errors = require('../errors.js');\nvar stringifyString = require('../stringify/stringifyString.js');\n\nfunction resolveAsScalar(token, strict = true, onError) {\n if (token) {\n const _onError = (pos, code, message) => {\n const offset = typeof pos === 'number' ? pos : Array.isArray(pos) ? pos[0] : pos.offset;\n if (onError)\n onError(offset, code, message);\n else\n throw new errors.YAMLParseError([offset, offset + 1], code, message);\n };\n switch (token.type) {\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);\n case 'block-scalar':\n return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);\n }\n }\n return null;\n}\n/**\n * Create a new scalar token with `value`\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.end Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.indent The indent level of the token.\n * @param context.inFlow Is this scalar within a flow collection? This may affect the resolved type of the token's value.\n * @param context.offset The offset position of the token.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction createScalarToken(value, context) {\n const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey,\n indent: indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n const end = context.end ?? [\n { type: 'newline', offset: -1, indent, source: '\\n' }\n ];\n switch (source[0]) {\n case '|':\n case '>': {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, end))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n return { type: 'block-scalar', offset, indent, props, source: body };\n }\n case '\"':\n return { type: 'double-quoted-scalar', offset, indent, source, end };\n case \"'\":\n return { type: 'single-quoted-scalar', offset, indent, source, end };\n default:\n return { type: 'scalar', offset, indent, source, end };\n }\n}\n/**\n * Set the value of `token` to the given string `value`, overwriting any previous contents and type that it may have.\n *\n * Best efforts are made to retain any comments previously associated with the `token`,\n * though all contents within a collection's `items` will be overwritten.\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param token Any token. If it does not include an `indent` value, the value will be stringified as if it were an implicit key.\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.afterKey In most cases, values after a key should have an additional level of indentation.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.inFlow Being within a flow collection may affect the resolved type of the token's value.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction setScalarValue(token, value, context = {}) {\n let { afterKey = false, implicitKey = false, inFlow = false, type } = context;\n let indent = 'indent' in token ? token.indent : null;\n if (afterKey && typeof indent === 'number')\n indent += 2;\n if (!type)\n switch (token.type) {\n case 'single-quoted-scalar':\n type = 'QUOTE_SINGLE';\n break;\n case 'double-quoted-scalar':\n type = 'QUOTE_DOUBLE';\n break;\n case 'block-scalar': {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n type = header.source[0] === '>' ? 'BLOCK_FOLDED' : 'BLOCK_LITERAL';\n break;\n }\n default:\n type = 'PLAIN';\n }\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey: implicitKey || indent === null,\n indent: indent !== null && indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n switch (source[0]) {\n case '|':\n case '>':\n setBlockScalarValue(token, source);\n break;\n case '\"':\n setFlowScalarValue(token, source, 'double-quoted-scalar');\n break;\n case \"'\":\n setFlowScalarValue(token, source, 'single-quoted-scalar');\n break;\n default:\n setFlowScalarValue(token, source, 'scalar');\n }\n}\nfunction setBlockScalarValue(token, source) {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n if (token.type === 'block-scalar') {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n header.source = head;\n token.source = body;\n }\n else {\n const { offset } = token;\n const indent = 'indent' in token ? token.indent : -1;\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, 'end' in token ? token.end : undefined))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type: 'block-scalar', indent, props, source: body });\n }\n}\n/** @returns `true` if last token is a newline */\nfunction addEndtoBlockProps(props, end) {\n if (end)\n for (const st of end)\n switch (st.type) {\n case 'space':\n case 'comment':\n props.push(st);\n break;\n case 'newline':\n props.push(st);\n return true;\n }\n return false;\n}\nfunction setFlowScalarValue(token, source, type) {\n switch (token.type) {\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n token.type = type;\n token.source = source;\n break;\n case 'block-scalar': {\n const end = token.props.slice(1);\n let oa = source.length;\n if (token.props[0].type === 'block-scalar-header')\n oa -= token.props[0].source.length;\n for (const tok of end)\n tok.offset += oa;\n delete token.props;\n Object.assign(token, { type, source, end });\n break;\n }\n case 'block-map':\n case 'block-seq': {\n const offset = token.offset + source.length;\n const nl = { type: 'newline', offset, indent: token.indent, source: '\\n' };\n delete token.items;\n Object.assign(token, { type, source, end: [nl] });\n break;\n }\n default: {\n const indent = 'indent' in token ? token.indent : -1;\n const end = 'end' in token && Array.isArray(token.end)\n ? token.end.filter(st => st.type === 'space' ||\n st.type === 'comment' ||\n st.type === 'newline')\n : [];\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type, indent, source, end });\n }\n }\n}\n\nexports.createScalarToken = createScalarToken;\nexports.resolveAsScalar = resolveAsScalar;\nexports.setScalarValue = setScalarValue;\n","'use strict';\n\n/**\n * Stringify a CST document, token, or collection item\n *\n * Fair warning: This applies no validation whatsoever, and\n * simply concatenates the sources in their logical order.\n */\nconst stringify = (cst) => 'type' in cst ? stringifyToken(cst) : stringifyItem(cst);\nfunction stringifyToken(token) {\n switch (token.type) {\n case 'block-scalar': {\n let res = '';\n for (const tok of token.props)\n res += stringifyToken(tok);\n return res + token.source;\n }\n case 'block-map':\n case 'block-seq': {\n let res = '';\n for (const item of token.items)\n res += stringifyItem(item);\n return res;\n }\n case 'flow-collection': {\n let res = token.start.source;\n for (const item of token.items)\n res += stringifyItem(item);\n for (const st of token.end)\n res += st.source;\n return res;\n }\n case 'document': {\n let res = stringifyItem(token);\n if (token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n default: {\n let res = token.source;\n if ('end' in token && token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n }\n}\nfunction stringifyItem({ start, key, sep, value }) {\n let res = '';\n for (const st of start)\n res += st.source;\n if (key)\n res += stringifyToken(key);\n if (sep)\n for (const st of sep)\n res += st.source;\n if (value)\n res += stringifyToken(value);\n return res;\n}\n\nexports.stringify = stringify;\n","'use strict';\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove item');\n/**\n * Apply a visitor to a CST document or item.\n *\n * Walks through the tree (depth-first) starting from the root, calling a\n * `visitor` function with two arguments when entering each item:\n * - `item`: The current item, which included the following members:\n * - `start: SourceToken[]` – Source tokens before the key or value,\n * possibly including its anchor or tag.\n * - `key?: Token | null` – Set for pair values. May then be `null`, if\n * the key before the `:` separator is empty.\n * - `sep?: SourceToken[]` – Source tokens between the key and the value,\n * which should include the `:` map value indicator if `value` is set.\n * - `value?: Token` – The value of a sequence item, or of a map pair.\n * - `path`: The steps from the root to the current node, as an array of\n * `['key' | 'value', number]` tuples.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this token, continue with\n * next sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current item, then continue with the next one\n * - `number`: Set the index of the next step. This is useful especially if\n * the index of the current token has changed.\n * - `function`: Define the next visitor for this item. After the original\n * visitor is called on item entry, next visitors are called after handling\n * a non-empty `key` and when exiting the item.\n */\nfunction visit(cst, visitor) {\n if ('type' in cst && cst.type === 'document')\n cst = { start: cst.start, value: cst.value };\n _visit(Object.freeze([]), cst, visitor);\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current item */\nvisit.SKIP = SKIP;\n/** Remove the current item */\nvisit.REMOVE = REMOVE;\n/** Find the item at `path` from `cst` as the root */\nvisit.itemAtPath = (cst, path) => {\n let item = cst;\n for (const [field, index] of path) {\n const tok = item?.[field];\n if (tok && 'items' in tok) {\n item = tok.items[index];\n }\n else\n return undefined;\n }\n return item;\n};\n/**\n * Get the immediate parent collection of the item at `path` from `cst` as the root.\n *\n * Throws an error if the collection is not found, which should never happen if the item itself exists.\n */\nvisit.parentCollection = (cst, path) => {\n const parent = visit.itemAtPath(cst, path.slice(0, -1));\n const field = path[path.length - 1][0];\n const coll = parent?.[field];\n if (coll && 'items' in coll)\n return coll;\n throw new Error('Parent collection not found');\n};\nfunction _visit(path, item, visitor) {\n let ctrl = visitor(item, path);\n if (typeof ctrl === 'symbol')\n return ctrl;\n for (const field of ['key', 'value']) {\n const token = item[field];\n if (token && 'items' in token) {\n for (let i = 0; i < token.items.length; ++i) {\n const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n token.items.splice(i, 1);\n i -= 1;\n }\n }\n if (typeof ctrl === 'function' && field === 'key')\n ctrl = ctrl(item, path);\n }\n }\n return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;\n}\n\nexports.visit = visit;\n","'use strict';\n\nvar cstScalar = require('./cst-scalar.js');\nvar cstStringify = require('./cst-stringify.js');\nvar cstVisit = require('./cst-visit.js');\n\n/** The byte order mark */\nconst BOM = '\\u{FEFF}';\n/** Start of doc-mode */\nconst DOCUMENT = '\\x02'; // C0: Start of Text\n/** Unexpected end of flow-mode */\nconst FLOW_END = '\\x18'; // C0: Cancel\n/** Next token is a scalar value */\nconst SCALAR = '\\x1f'; // C0: Unit Separator\n/** @returns `true` if `token` is a flow or block collection */\nconst isCollection = (token) => !!token && 'items' in token;\n/** @returns `true` if `token` is a flow or block scalar; not an alias */\nconst isScalar = (token) => !!token &&\n (token.type === 'scalar' ||\n token.type === 'single-quoted-scalar' ||\n token.type === 'double-quoted-scalar' ||\n token.type === 'block-scalar');\n/* istanbul ignore next */\n/** Get a printable representation of a lexer token */\nfunction prettyToken(token) {\n switch (token) {\n case BOM:\n return '<BOM>';\n case DOCUMENT:\n return '<DOC>';\n case FLOW_END:\n return '<FLOW_END>';\n case SCALAR:\n return '<SCALAR>';\n default:\n return JSON.stringify(token);\n }\n}\n/** Identify the type of a lexer token. May return `null` for unknown tokens. */\nfunction tokenType(source) {\n switch (source) {\n case BOM:\n return 'byte-order-mark';\n case DOCUMENT:\n return 'doc-mode';\n case FLOW_END:\n return 'flow-error-end';\n case SCALAR:\n return 'scalar';\n case '---':\n return 'doc-start';\n case '...':\n return 'doc-end';\n case '':\n case '\\n':\n case '\\r\\n':\n return 'newline';\n case '-':\n return 'seq-item-ind';\n case '?':\n return 'explicit-key-ind';\n case ':':\n return 'map-value-ind';\n case '{':\n return 'flow-map-start';\n case '}':\n return 'flow-map-end';\n case '[':\n return 'flow-seq-start';\n case ']':\n return 'flow-seq-end';\n case ',':\n return 'comma';\n }\n switch (source[0]) {\n case ' ':\n case '\\t':\n return 'space';\n case '#':\n return 'comment';\n case '%':\n return 'directive-line';\n case '*':\n return 'alias';\n case '&':\n return 'anchor';\n case '!':\n return 'tag';\n case \"'\":\n return 'single-quoted-scalar';\n case '\"':\n return 'double-quoted-scalar';\n case '|':\n case '>':\n return 'block-scalar-header';\n }\n return null;\n}\n\nexports.createScalarToken = cstScalar.createScalarToken;\nexports.resolveAsScalar = cstScalar.resolveAsScalar;\nexports.setScalarValue = cstScalar.setScalarValue;\nexports.stringify = cstStringify.stringify;\nexports.visit = cstVisit.visit;\nexports.BOM = BOM;\nexports.DOCUMENT = DOCUMENT;\nexports.FLOW_END = FLOW_END;\nexports.SCALAR = SCALAR;\nexports.isCollection = isCollection;\nexports.isScalar = isScalar;\nexports.prettyToken = prettyToken;\nexports.tokenType = tokenType;\n","'use strict';\n\nvar cst = require('./cst.js');\n\n/*\nSTART -> stream\n\nstream\n directive -> line-end -> stream\n indent + line-end -> stream\n [else] -> line-start\n\nline-end\n comment -> line-end\n newline -> .\n input-end -> END\n\nline-start\n doc-start -> doc\n doc-end -> stream\n [else] -> indent -> block-start\n\nblock-start\n seq-item-start -> block-start\n explicit-key-start -> block-start\n map-value-start -> block-start\n [else] -> doc\n\ndoc\n line-end -> line-start\n spaces -> doc\n anchor -> doc\n tag -> doc\n flow-start -> flow -> doc\n flow-end -> error -> doc\n seq-item-start -> error -> doc\n explicit-key-start -> error -> doc\n map-value-start -> doc\n alias -> doc\n quote-start -> quoted-scalar -> doc\n block-scalar-header -> line-end -> block-scalar(min) -> line-start\n [else] -> plain-scalar(false, min) -> doc\n\nflow\n line-end -> flow\n spaces -> flow\n anchor -> flow\n tag -> flow\n flow-start -> flow -> flow\n flow-end -> .\n seq-item-start -> error -> flow\n explicit-key-start -> flow\n map-value-start -> flow\n alias -> flow\n quote-start -> quoted-scalar -> flow\n comma -> flow\n [else] -> plain-scalar(true, 0) -> flow\n\nquoted-scalar\n quote-end -> .\n [else] -> quoted-scalar\n\nblock-scalar(min)\n newline + peek(indent < min) -> .\n [else] -> block-scalar(min)\n\nplain-scalar(is-flow, min)\n scalar-end(is-flow) -> .\n peek(newline + (indent < min)) -> .\n [else] -> plain-scalar(min)\n*/\nfunction isEmpty(ch) {\n switch (ch) {\n case undefined:\n case ' ':\n case '\\n':\n case '\\r':\n case '\\t':\n return true;\n default:\n return false;\n }\n}\nconst hexDigits = new Set('0123456789ABCDEFabcdef');\nconst tagChars = new Set(\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()\");\nconst flowIndicatorChars = new Set(',[]{}');\nconst invalidAnchorChars = new Set(' ,[]{}\\n\\r\\t');\nconst isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);\n/**\n * Splits an input string into lexical tokens, i.e. smaller strings that are\n * easily identifiable by `tokens.tokenType()`.\n *\n * Lexing starts always in a \"stream\" context. Incomplete input may be buffered\n * until a complete token can be emitted.\n *\n * In addition to slices of the original input, the following control characters\n * may also be emitted:\n *\n * - `\\x02` (Start of Text): A document starts with the next token\n * - `\\x18` (Cancel): Unexpected end of flow-mode (indicates an error)\n * - `\\x1f` (Unit Separator): Next token is a scalar value\n * - `\\u{FEFF}` (Byte order mark): Emitted separately outside documents\n */\nclass Lexer {\n constructor() {\n /**\n * Flag indicating whether the end of the current buffer marks the end of\n * all input\n */\n this.atEnd = false;\n /**\n * Explicit indent set in block scalar header, as an offset from the current\n * minimum indent, so e.g. set to 1 from a header `|2+`. Set to -1 if not\n * explicitly set.\n */\n this.blockScalarIndent = -1;\n /**\n * Block scalars that include a + (keep) chomping indicator in their header\n * include trailing empty lines, which are otherwise excluded from the\n * scalar's contents.\n */\n this.blockScalarKeep = false;\n /** Current input */\n this.buffer = '';\n /**\n * Flag noting whether the map value indicator : can immediately follow this\n * node within a flow context.\n */\n this.flowKey = false;\n /** Count of surrounding flow collection levels. */\n this.flowLevel = 0;\n /**\n * Minimum level of indentation required for next lines to be parsed as a\n * part of the current scalar value.\n */\n this.indentNext = 0;\n /** Indentation level of the current line. */\n this.indentValue = 0;\n /** Position of the next \\n character. */\n this.lineEndPos = null;\n /** Stores the state of the lexer if reaching the end of incpomplete input */\n this.next = null;\n /** A pointer to `buffer`; the current position of the lexer. */\n this.pos = 0;\n }\n /**\n * Generate YAML tokens from the `source` string. If `incomplete`,\n * a part of the last line may be left as a buffer for the next call.\n *\n * @returns A generator of lexical tokens\n */\n *lex(source, incomplete = false) {\n if (source) {\n if (typeof source !== 'string')\n throw TypeError('source is not a string');\n this.buffer = this.buffer ? this.buffer + source : source;\n this.lineEndPos = null;\n }\n this.atEnd = !incomplete;\n let next = this.next ?? 'stream';\n while (next && (incomplete || this.hasChars(1)))\n next = yield* this.parseNext(next);\n }\n atLineEnd() {\n let i = this.pos;\n let ch = this.buffer[i];\n while (ch === ' ' || ch === '\\t')\n ch = this.buffer[++i];\n if (!ch || ch === '#' || ch === '\\n')\n return true;\n if (ch === '\\r')\n return this.buffer[i + 1] === '\\n';\n return false;\n }\n charAt(n) {\n return this.buffer[this.pos + n];\n }\n continueScalar(offset) {\n let ch = this.buffer[offset];\n if (this.indentNext > 0) {\n let indent = 0;\n while (ch === ' ')\n ch = this.buffer[++indent + offset];\n if (ch === '\\r') {\n const next = this.buffer[indent + offset + 1];\n if (next === '\\n' || (!next && !this.atEnd))\n return offset + indent + 1;\n }\n return ch === '\\n' || indent >= this.indentNext || (!ch && !this.atEnd)\n ? offset + indent\n : -1;\n }\n if (ch === '-' || ch === '.') {\n const dt = this.buffer.substr(offset, 3);\n if ((dt === '---' || dt === '...') && isEmpty(this.buffer[offset + 3]))\n return -1;\n }\n return offset;\n }\n getLine() {\n let end = this.lineEndPos;\n if (typeof end !== 'number' || (end !== -1 && end < this.pos)) {\n end = this.buffer.indexOf('\\n', this.pos);\n this.lineEndPos = end;\n }\n if (end === -1)\n return this.atEnd ? this.buffer.substring(this.pos) : null;\n if (this.buffer[end - 1] === '\\r')\n end -= 1;\n return this.buffer.substring(this.pos, end);\n }\n hasChars(n) {\n return this.pos + n <= this.buffer.length;\n }\n setNext(state) {\n this.buffer = this.buffer.substring(this.pos);\n this.pos = 0;\n this.lineEndPos = null;\n this.next = state;\n return null;\n }\n peek(n) {\n return this.buffer.substr(this.pos, n);\n }\n *parseNext(next) {\n switch (next) {\n case 'stream':\n return yield* this.parseStream();\n case 'line-start':\n return yield* this.parseLineStart();\n case 'block-start':\n return yield* this.parseBlockStart();\n case 'doc':\n return yield* this.parseDocument();\n case 'flow':\n return yield* this.parseFlowCollection();\n case 'quoted-scalar':\n return yield* this.parseQuotedScalar();\n case 'block-scalar':\n return yield* this.parseBlockScalar();\n case 'plain-scalar':\n return yield* this.parsePlainScalar();\n }\n }\n *parseStream() {\n let line = this.getLine();\n if (line === null)\n return this.setNext('stream');\n if (line[0] === cst.BOM) {\n yield* this.pushCount(1);\n line = line.substring(1);\n }\n if (line[0] === '%') {\n let dirEnd = line.length;\n let cs = line.indexOf('#');\n while (cs !== -1) {\n const ch = line[cs - 1];\n if (ch === ' ' || ch === '\\t') {\n dirEnd = cs - 1;\n break;\n }\n else {\n cs = line.indexOf('#', cs + 1);\n }\n }\n while (true) {\n const ch = line[dirEnd - 1];\n if (ch === ' ' || ch === '\\t')\n dirEnd -= 1;\n else\n break;\n }\n const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));\n yield* this.pushCount(line.length - n); // possible comment\n this.pushNewline();\n return 'stream';\n }\n if (this.atLineEnd()) {\n const sp = yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - sp);\n yield* this.pushNewline();\n return 'stream';\n }\n yield cst.DOCUMENT;\n return yield* this.parseLineStart();\n }\n *parseLineStart() {\n const ch = this.charAt(0);\n if (!ch && !this.atEnd)\n return this.setNext('line-start');\n if (ch === '-' || ch === '.') {\n if (!this.atEnd && !this.hasChars(4))\n return this.setNext('line-start');\n const s = this.peek(3);\n if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {\n yield* this.pushCount(3);\n this.indentValue = 0;\n this.indentNext = 0;\n return s === '---' ? 'doc' : 'stream';\n }\n }\n this.indentValue = yield* this.pushSpaces(false);\n if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1)))\n this.indentNext = this.indentValue;\n return yield* this.parseBlockStart();\n }\n *parseBlockStart() {\n const [ch0, ch1] = this.peek(2);\n if (!ch1 && !this.atEnd)\n return this.setNext('block-start');\n if ((ch0 === '-' || ch0 === '?' || ch0 === ':') && isEmpty(ch1)) {\n const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));\n this.indentNext = this.indentValue + 1;\n this.indentValue += n;\n return yield* this.parseBlockStart();\n }\n return 'doc';\n }\n *parseDocument() {\n yield* this.pushSpaces(true);\n const line = this.getLine();\n if (line === null)\n return this.setNext('doc');\n let n = yield* this.pushIndicators();\n switch (line[n]) {\n case '#':\n yield* this.pushCount(line.length - n);\n // fallthrough\n case undefined:\n yield* this.pushNewline();\n return yield* this.parseLineStart();\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel = 1;\n return 'flow';\n case '}':\n case ']':\n // this is an error\n yield* this.pushCount(1);\n return 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'doc';\n case '\"':\n case \"'\":\n return yield* this.parseQuotedScalar();\n case '|':\n case '>':\n n += yield* this.parseBlockScalarHeader();\n n += yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - n);\n yield* this.pushNewline();\n return yield* this.parseBlockScalar();\n default:\n return yield* this.parsePlainScalar();\n }\n }\n *parseFlowCollection() {\n let nl, sp;\n let indent = -1;\n do {\n nl = yield* this.pushNewline();\n if (nl > 0) {\n sp = yield* this.pushSpaces(false);\n this.indentValue = indent = sp;\n }\n else {\n sp = 0;\n }\n sp += yield* this.pushSpaces(true);\n } while (nl + sp > 0);\n const line = this.getLine();\n if (line === null)\n return this.setNext('flow');\n if ((indent !== -1 && indent < this.indentNext && line[0] !== '#') ||\n (indent === 0 &&\n (line.startsWith('---') || line.startsWith('...')) &&\n isEmpty(line[3]))) {\n // Allowing for the terminal ] or } at the same (rather than greater)\n // indent level as the initial [ or { is technically invalid, but\n // failing here would be surprising to users.\n const atFlowEndMarker = indent === this.indentNext - 1 &&\n this.flowLevel === 1 &&\n (line[0] === ']' || line[0] === '}');\n if (!atFlowEndMarker) {\n // this is an error\n this.flowLevel = 0;\n yield cst.FLOW_END;\n return yield* this.parseLineStart();\n }\n }\n let n = 0;\n while (line[n] === ',') {\n n += yield* this.pushCount(1);\n n += yield* this.pushSpaces(true);\n this.flowKey = false;\n }\n n += yield* this.pushIndicators();\n switch (line[n]) {\n case undefined:\n return 'flow';\n case '#':\n yield* this.pushCount(line.length - n);\n return 'flow';\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel += 1;\n return 'flow';\n case '}':\n case ']':\n yield* this.pushCount(1);\n this.flowKey = true;\n this.flowLevel -= 1;\n return this.flowLevel ? 'flow' : 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'flow';\n case '\"':\n case \"'\":\n this.flowKey = true;\n return yield* this.parseQuotedScalar();\n case ':': {\n const next = this.charAt(1);\n if (this.flowKey || isEmpty(next) || next === ',') {\n this.flowKey = false;\n yield* this.pushCount(1);\n yield* this.pushSpaces(true);\n return 'flow';\n }\n }\n // fallthrough\n default:\n this.flowKey = false;\n return yield* this.parsePlainScalar();\n }\n }\n *parseQuotedScalar() {\n const quote = this.charAt(0);\n let end = this.buffer.indexOf(quote, this.pos + 1);\n if (quote === \"'\") {\n while (end !== -1 && this.buffer[end + 1] === \"'\")\n end = this.buffer.indexOf(\"'\", end + 2);\n }\n else {\n // double-quote\n while (end !== -1) {\n let n = 0;\n while (this.buffer[end - 1 - n] === '\\\\')\n n += 1;\n if (n % 2 === 0)\n break;\n end = this.buffer.indexOf('\"', end + 1);\n }\n }\n // Only looking for newlines within the quotes\n const qb = this.buffer.substring(0, end);\n let nl = qb.indexOf('\\n', this.pos);\n if (nl !== -1) {\n while (nl !== -1) {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = qb.indexOf('\\n', cs);\n }\n if (nl !== -1) {\n // this is an error caused by an unexpected unindent\n end = nl - (qb[nl - 1] === '\\r' ? 2 : 1);\n }\n }\n if (end === -1) {\n if (!this.atEnd)\n return this.setNext('quoted-scalar');\n end = this.buffer.length;\n }\n yield* this.pushToIndex(end + 1, false);\n return this.flowLevel ? 'flow' : 'doc';\n }\n *parseBlockScalarHeader() {\n this.blockScalarIndent = -1;\n this.blockScalarKeep = false;\n let i = this.pos;\n while (true) {\n const ch = this.buffer[++i];\n if (ch === '+')\n this.blockScalarKeep = true;\n else if (ch > '0' && ch <= '9')\n this.blockScalarIndent = Number(ch) - 1;\n else if (ch !== '-')\n break;\n }\n return yield* this.pushUntil(ch => isEmpty(ch) || ch === '#');\n }\n *parseBlockScalar() {\n let nl = this.pos - 1; // may be -1 if this.pos === 0\n let indent = 0;\n let ch;\n loop: for (let i = this.pos; (ch = this.buffer[i]); ++i) {\n switch (ch) {\n case ' ':\n indent += 1;\n break;\n case '\\n':\n nl = i;\n indent = 0;\n break;\n case '\\r': {\n const next = this.buffer[i + 1];\n if (!next && !this.atEnd)\n return this.setNext('block-scalar');\n if (next === '\\n')\n break;\n } // fallthrough\n default:\n break loop;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('block-scalar');\n if (indent >= this.indentNext) {\n if (this.blockScalarIndent === -1)\n this.indentNext = indent;\n else {\n this.indentNext =\n this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);\n }\n do {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = this.buffer.indexOf('\\n', cs);\n } while (nl !== -1);\n if (nl === -1) {\n if (!this.atEnd)\n return this.setNext('block-scalar');\n nl = this.buffer.length;\n }\n }\n // Trailing insufficiently indented tabs are invalid.\n // To catch that during parsing, we include them in the block scalar value.\n let i = nl + 1;\n ch = this.buffer[i];\n while (ch === ' ')\n ch = this.buffer[++i];\n if (ch === '\\t') {\n while (ch === '\\t' || ch === ' ' || ch === '\\r' || ch === '\\n')\n ch = this.buffer[++i];\n nl = i - 1;\n }\n else if (!this.blockScalarKeep) {\n do {\n let i = nl - 1;\n let ch = this.buffer[i];\n if (ch === '\\r')\n ch = this.buffer[--i];\n const lastChar = i; // Drop the line if last char not more indented\n while (ch === ' ')\n ch = this.buffer[--i];\n if (ch === '\\n' && i >= this.pos && i + 1 + indent > lastChar)\n nl = i;\n else\n break;\n } while (true);\n }\n yield cst.SCALAR;\n yield* this.pushToIndex(nl + 1, true);\n return yield* this.parseLineStart();\n }\n *parsePlainScalar() {\n const inFlow = this.flowLevel > 0;\n let end = this.pos - 1;\n let i = this.pos - 1;\n let ch;\n while ((ch = this.buffer[++i])) {\n if (ch === ':') {\n const next = this.buffer[i + 1];\n if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))\n break;\n end = i;\n }\n else if (isEmpty(ch)) {\n let next = this.buffer[i + 1];\n if (ch === '\\r') {\n if (next === '\\n') {\n i += 1;\n ch = '\\n';\n next = this.buffer[i + 1];\n }\n else\n end = i;\n }\n if (next === '#' || (inFlow && flowIndicatorChars.has(next)))\n break;\n if (ch === '\\n') {\n const cs = this.continueScalar(i + 1);\n if (cs === -1)\n break;\n i = Math.max(i, cs - 2); // to advance, but still account for ' #'\n }\n }\n else {\n if (inFlow && flowIndicatorChars.has(ch))\n break;\n end = i;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('plain-scalar');\n yield cst.SCALAR;\n yield* this.pushToIndex(end + 1, true);\n return inFlow ? 'flow' : 'doc';\n }\n *pushCount(n) {\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos += n;\n return n;\n }\n return 0;\n }\n *pushToIndex(i, allowEmpty) {\n const s = this.buffer.slice(this.pos, i);\n if (s) {\n yield s;\n this.pos += s.length;\n return s.length;\n }\n else if (allowEmpty)\n yield '';\n return 0;\n }\n *pushIndicators() {\n switch (this.charAt(0)) {\n case '!':\n return ((yield* this.pushTag()) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n case '&':\n return ((yield* this.pushUntil(isNotAnchorChar)) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n case '-': // this is an error\n case '?': // this is an error outside flow collections\n case ':': {\n const inFlow = this.flowLevel > 0;\n const ch1 = this.charAt(1);\n if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {\n if (!inFlow)\n this.indentNext = this.indentValue + 1;\n else if (this.flowKey)\n this.flowKey = false;\n return ((yield* this.pushCount(1)) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n }\n }\n }\n return 0;\n }\n *pushTag() {\n if (this.charAt(1) === '<') {\n let i = this.pos + 2;\n let ch = this.buffer[i];\n while (!isEmpty(ch) && ch !== '>')\n ch = this.buffer[++i];\n return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);\n }\n else {\n let i = this.pos + 1;\n let ch = this.buffer[i];\n while (ch) {\n if (tagChars.has(ch))\n ch = this.buffer[++i];\n else if (ch === '%' &&\n hexDigits.has(this.buffer[i + 1]) &&\n hexDigits.has(this.buffer[i + 2])) {\n ch = this.buffer[(i += 3)];\n }\n else\n break;\n }\n return yield* this.pushToIndex(i, false);\n }\n }\n *pushNewline() {\n const ch = this.buffer[this.pos];\n if (ch === '\\n')\n return yield* this.pushCount(1);\n else if (ch === '\\r' && this.charAt(1) === '\\n')\n return yield* this.pushCount(2);\n else\n return 0;\n }\n *pushSpaces(allowTabs) {\n let i = this.pos - 1;\n let ch;\n do {\n ch = this.buffer[++i];\n } while (ch === ' ' || (allowTabs && ch === '\\t'));\n const n = i - this.pos;\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos = i;\n }\n return n;\n }\n *pushUntil(test) {\n let i = this.pos;\n let ch = this.buffer[i];\n while (!test(ch))\n ch = this.buffer[++i];\n return yield* this.pushToIndex(i, false);\n }\n}\n\nexports.Lexer = Lexer;\n","'use strict';\n\n/**\n * Tracks newlines during parsing in order to provide an efficient API for\n * determining the one-indexed `{ line, col }` position for any offset\n * within the input.\n */\nclass LineCounter {\n constructor() {\n this.lineStarts = [];\n /**\n * Should be called in ascending order. Otherwise, call\n * `lineCounter.lineStarts.sort()` before calling `linePos()`.\n */\n this.addNewLine = (offset) => this.lineStarts.push(offset);\n /**\n * Performs a binary search and returns the 1-indexed { line, col }\n * position of `offset`. If `line === 0`, `addNewLine` has never been\n * called or `offset` is before the first known newline.\n */\n this.linePos = (offset) => {\n let low = 0;\n let high = this.lineStarts.length;\n while (low < high) {\n const mid = (low + high) >> 1; // Math.floor((low + high) / 2)\n if (this.lineStarts[mid] < offset)\n low = mid + 1;\n else\n high = mid;\n }\n if (this.lineStarts[low] === offset)\n return { line: low + 1, col: 1 };\n if (low === 0)\n return { line: 0, col: offset };\n const start = this.lineStarts[low - 1];\n return { line: low, col: offset - start + 1 };\n };\n }\n}\n\nexports.LineCounter = LineCounter;\n","'use strict';\n\nvar node_process = require('process');\nvar cst = require('./cst.js');\nvar lexer = require('./lexer.js');\n\nfunction includesToken(list, type) {\n for (let i = 0; i < list.length; ++i)\n if (list[i].type === type)\n return true;\n return false;\n}\nfunction findNonEmptyIndex(list) {\n for (let i = 0; i < list.length; ++i) {\n switch (list[i].type) {\n case 'space':\n case 'comment':\n case 'newline':\n break;\n default:\n return i;\n }\n }\n return -1;\n}\nfunction isFlowToken(token) {\n switch (token?.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'flow-collection':\n return true;\n default:\n return false;\n }\n}\nfunction getPrevProps(parent) {\n switch (parent.type) {\n case 'document':\n return parent.start;\n case 'block-map': {\n const it = parent.items[parent.items.length - 1];\n return it.sep ?? it.start;\n }\n case 'block-seq':\n return parent.items[parent.items.length - 1].start;\n /* istanbul ignore next should not happen */\n default:\n return [];\n }\n}\n/** Note: May modify input array */\nfunction getFirstKeyStartProps(prev) {\n if (prev.length === 0)\n return [];\n let i = prev.length;\n loop: while (--i >= 0) {\n switch (prev[i].type) {\n case 'doc-start':\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n case 'newline':\n break loop;\n }\n }\n while (prev[++i]?.type === 'space') {\n /* loop */\n }\n return prev.splice(i, prev.length);\n}\nfunction fixFlowSeqItems(fc) {\n if (fc.start.type === 'flow-seq-start') {\n for (const it of fc.items) {\n if (it.sep &&\n !it.value &&\n !includesToken(it.start, 'explicit-key-ind') &&\n !includesToken(it.sep, 'map-value-ind')) {\n if (it.key)\n it.value = it.key;\n delete it.key;\n if (isFlowToken(it.value)) {\n if (it.value.end)\n Array.prototype.push.apply(it.value.end, it.sep);\n else\n it.value.end = it.sep;\n }\n else\n Array.prototype.push.apply(it.start, it.sep);\n delete it.sep;\n }\n }\n }\n}\n/**\n * A YAML concrete syntax tree (CST) parser\n *\n * ```ts\n * const src: string = ...\n * for (const token of new Parser().parse(src)) {\n * // token: Token\n * }\n * ```\n *\n * To use the parser with a user-provided lexer:\n *\n * ```ts\n * function* parse(source: string, lexer: Lexer) {\n * const parser = new Parser()\n * for (const lexeme of lexer.lex(source))\n * yield* parser.next(lexeme)\n * yield* parser.end()\n * }\n *\n * const src: string = ...\n * const lexer = new Lexer()\n * for (const token of parse(src, lexer)) {\n * // token: Token\n * }\n * ```\n */\nclass Parser {\n /**\n * @param onNewLine - If defined, called separately with the start position of\n * each new line (in `parse()`, including the start of input).\n */\n constructor(onNewLine) {\n /** If true, space and sequence indicators count as indentation */\n this.atNewLine = true;\n /** If true, next token is a scalar value */\n this.atScalar = false;\n /** Current indentation level */\n this.indent = 0;\n /** Current offset since the start of parsing */\n this.offset = 0;\n /** On the same line with a block map key */\n this.onKeyLine = false;\n /** Top indicates the node that's currently being built */\n this.stack = [];\n /** The source of the current token, set in parse() */\n this.source = '';\n /** The type of the current token, set in parse() */\n this.type = '';\n // Must be defined after `next()`\n this.lexer = new lexer.Lexer();\n this.onNewLine = onNewLine;\n }\n /**\n * Parse `source` as a YAML stream.\n * If `incomplete`, a part of the last line may be left as a buffer for the next call.\n *\n * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.\n *\n * @returns A generator of tokens representing each directive, document, and other structure.\n */\n *parse(source, incomplete = false) {\n if (this.onNewLine && this.offset === 0)\n this.onNewLine(0);\n for (const lexeme of this.lexer.lex(source, incomplete))\n yield* this.next(lexeme);\n if (!incomplete)\n yield* this.end();\n }\n /**\n * Advance the parser by the `source` of one lexical token.\n */\n *next(source) {\n this.source = source;\n if (node_process.env.LOG_TOKENS)\n console.log('|', cst.prettyToken(source));\n if (this.atScalar) {\n this.atScalar = false;\n yield* this.step();\n this.offset += source.length;\n return;\n }\n const type = cst.tokenType(source);\n if (!type) {\n const message = `Not a YAML token: ${source}`;\n yield* this.pop({ type: 'error', offset: this.offset, message, source });\n this.offset += source.length;\n }\n else if (type === 'scalar') {\n this.atNewLine = false;\n this.atScalar = true;\n this.type = 'scalar';\n }\n else {\n this.type = type;\n yield* this.step();\n switch (type) {\n case 'newline':\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine)\n this.onNewLine(this.offset + source.length);\n break;\n case 'space':\n if (this.atNewLine && source[0] === ' ')\n this.indent += source.length;\n break;\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n if (this.atNewLine)\n this.indent += source.length;\n break;\n case 'doc-mode':\n case 'flow-error-end':\n return;\n default:\n this.atNewLine = false;\n }\n this.offset += source.length;\n }\n }\n /** Call at end of input to push out any remaining constructions */\n *end() {\n while (this.stack.length > 0)\n yield* this.pop();\n }\n get sourceToken() {\n const st = {\n type: this.type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n return st;\n }\n *step() {\n const top = this.peek(1);\n if (this.type === 'doc-end' && top?.type !== 'doc-end') {\n while (this.stack.length > 0)\n yield* this.pop();\n this.stack.push({\n type: 'doc-end',\n offset: this.offset,\n source: this.source\n });\n return;\n }\n if (!top)\n return yield* this.stream();\n switch (top.type) {\n case 'document':\n return yield* this.document(top);\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return yield* this.scalar(top);\n case 'block-scalar':\n return yield* this.blockScalar(top);\n case 'block-map':\n return yield* this.blockMap(top);\n case 'block-seq':\n return yield* this.blockSequence(top);\n case 'flow-collection':\n return yield* this.flowCollection(top);\n case 'doc-end':\n return yield* this.documentEnd(top);\n }\n /* istanbul ignore next should not happen */\n yield* this.pop();\n }\n peek(n) {\n return this.stack[this.stack.length - n];\n }\n *pop(error) {\n const token = error ?? this.stack.pop();\n /* istanbul ignore if should not happen */\n if (!token) {\n const message = 'Tried to pop an empty stack';\n yield { type: 'error', offset: this.offset, source: '', message };\n }\n else if (this.stack.length === 0) {\n yield token;\n }\n else {\n const top = this.peek(1);\n if (token.type === 'block-scalar') {\n // Block scalars use their parent rather than header indent\n token.indent = 'indent' in top ? top.indent : 0;\n }\n else if (token.type === 'flow-collection' && top.type === 'document') {\n // Ignore all indent for top-level flow collections\n token.indent = 0;\n }\n if (token.type === 'flow-collection')\n fixFlowSeqItems(token);\n switch (top.type) {\n case 'document':\n top.value = token;\n break;\n case 'block-scalar':\n top.props.push(token); // error\n break;\n case 'block-map': {\n const it = top.items[top.items.length - 1];\n if (it.value) {\n top.items.push({ start: [], key: token, sep: [] });\n this.onKeyLine = true;\n return;\n }\n else if (it.sep) {\n it.value = token;\n }\n else {\n Object.assign(it, { key: token, sep: [] });\n this.onKeyLine = !it.explicitKey;\n return;\n }\n break;\n }\n case 'block-seq': {\n const it = top.items[top.items.length - 1];\n if (it.value)\n top.items.push({ start: [], value: token });\n else\n it.value = token;\n break;\n }\n case 'flow-collection': {\n const it = top.items[top.items.length - 1];\n if (!it || it.value)\n top.items.push({ start: [], key: token, sep: [] });\n else if (it.sep)\n it.value = token;\n else\n Object.assign(it, { key: token, sep: [] });\n return;\n }\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.pop(token);\n }\n if ((top.type === 'document' ||\n top.type === 'block-map' ||\n top.type === 'block-seq') &&\n (token.type === 'block-map' || token.type === 'block-seq')) {\n const last = token.items[token.items.length - 1];\n if (last &&\n !last.sep &&\n !last.value &&\n last.start.length > 0 &&\n findNonEmptyIndex(last.start) === -1 &&\n (token.indent === 0 ||\n last.start.every(st => st.type !== 'comment' || st.indent < token.indent))) {\n if (top.type === 'document')\n top.end = last.start;\n else\n top.items.push({ start: last.start });\n token.items.splice(-1, 1);\n }\n }\n }\n }\n *stream() {\n switch (this.type) {\n case 'directive-line':\n yield { type: 'directive', offset: this.offset, source: this.source };\n return;\n case 'byte-order-mark':\n case 'space':\n case 'comment':\n case 'newline':\n yield this.sourceToken;\n return;\n case 'doc-mode':\n case 'doc-start': {\n const doc = {\n type: 'document',\n offset: this.offset,\n start: []\n };\n if (this.type === 'doc-start')\n doc.start.push(this.sourceToken);\n this.stack.push(doc);\n return;\n }\n }\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML stream`,\n source: this.source\n };\n }\n *document(doc) {\n if (doc.value)\n return yield* this.lineEnd(doc);\n switch (this.type) {\n case 'doc-start': {\n if (findNonEmptyIndex(doc.start) !== -1) {\n yield* this.pop();\n yield* this.step();\n }\n else\n doc.start.push(this.sourceToken);\n return;\n }\n case 'anchor':\n case 'tag':\n case 'space':\n case 'comment':\n case 'newline':\n doc.start.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(doc);\n if (bv)\n this.stack.push(bv);\n else {\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML document`,\n source: this.source\n };\n }\n }\n *scalar(scalar) {\n if (this.type === 'map-value-ind') {\n const prev = getPrevProps(this.peek(2));\n const start = getFirstKeyStartProps(prev);\n let sep;\n if (scalar.end) {\n sep = scalar.end;\n sep.push(this.sourceToken);\n delete scalar.end;\n }\n else\n sep = [this.sourceToken];\n const map = {\n type: 'block-map',\n offset: scalar.offset,\n indent: scalar.indent,\n items: [{ start, key: scalar, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else\n yield* this.lineEnd(scalar);\n }\n *blockScalar(scalar) {\n switch (this.type) {\n case 'space':\n case 'comment':\n case 'newline':\n scalar.props.push(this.sourceToken);\n return;\n case 'scalar':\n scalar.source = this.source;\n // block-scalar source includes trailing newline\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n yield* this.pop();\n break;\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.step();\n }\n }\n *blockMap(map) {\n const it = map.items[map.items.length - 1];\n // it.sep is true-ish if pair already has key or : separator\n switch (this.type) {\n case 'newline':\n this.onKeyLine = false;\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'space':\n case 'comment':\n if (it.value) {\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n if (this.atIndentedComment(it.start, map.indent)) {\n const prev = map.items[map.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n Array.prototype.push.apply(end, it.start);\n end.push(this.sourceToken);\n map.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n }\n if (this.indent >= map.indent) {\n const atMapIndent = !this.onKeyLine && this.indent === map.indent;\n const atNextItem = atMapIndent &&\n (it.sep || it.explicitKey) &&\n this.type !== 'seq-item-ind';\n // For empty nodes, assign newline-separated not indented empty tokens to following node\n let start = [];\n if (atNextItem && it.sep && !it.value) {\n const nl = [];\n for (let i = 0; i < it.sep.length; ++i) {\n const st = it.sep[i];\n switch (st.type) {\n case 'newline':\n nl.push(i);\n break;\n case 'space':\n break;\n case 'comment':\n if (st.indent > map.indent)\n nl.length = 0;\n break;\n default:\n nl.length = 0;\n }\n }\n if (nl.length >= 2)\n start = it.sep.splice(nl[1]);\n }\n switch (this.type) {\n case 'anchor':\n case 'tag':\n if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'explicit-key-ind':\n if (!it.sep && !it.explicitKey) {\n it.start.push(this.sourceToken);\n it.explicitKey = true;\n }\n else if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start, explicitKey: true });\n }\n else {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken], explicitKey: true }]\n });\n }\n this.onKeyLine = true;\n return;\n case 'map-value-ind':\n if (it.explicitKey) {\n if (!it.sep) {\n if (includesToken(it.start, 'newline')) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else {\n const start = getFirstKeyStartProps(it.start);\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n }\n else if (it.value) {\n map.items.push({ start: [], key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n else if (isFlowToken(it.key) &&\n !includesToken(it.sep, 'newline')) {\n const start = getFirstKeyStartProps(it.start);\n const key = it.key;\n const sep = it.sep;\n sep.push(this.sourceToken);\n // @ts-expect-error type guard is wrong here\n delete it.key;\n // @ts-expect-error type guard is wrong here\n delete it.sep;\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key, sep }]\n });\n }\n else if (start.length > 0) {\n // Not actually at next item\n it.sep = it.sep.concat(start, this.sourceToken);\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n else {\n if (!it.sep) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else if (it.value || atNextItem) {\n map.items.push({ start, key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [], key: null, sep: [this.sourceToken] }]\n });\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n this.onKeyLine = true;\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (atNextItem || it.value) {\n map.items.push({ start, key: fs, sep: [] });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n this.stack.push(fs);\n }\n else {\n Object.assign(it, { key: fs, sep: [] });\n this.onKeyLine = true;\n }\n return;\n }\n default: {\n const bv = this.startBlockValue(map);\n if (bv) {\n if (bv.type === 'block-seq') {\n if (!it.explicitKey &&\n it.sep &&\n !includesToken(it.sep, 'newline')) {\n yield* this.pop({\n type: 'error',\n offset: this.offset,\n message: 'Unexpected block-seq-ind on same line with key',\n source: this.source\n });\n return;\n }\n }\n else if (atMapIndent) {\n map.items.push({ start });\n }\n this.stack.push(bv);\n return;\n }\n }\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *blockSequence(seq) {\n const it = seq.items[seq.items.length - 1];\n switch (this.type) {\n case 'newline':\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n seq.items.push({ start: [this.sourceToken] });\n }\n else\n it.start.push(this.sourceToken);\n return;\n case 'space':\n case 'comment':\n if (it.value)\n seq.items.push({ start: [this.sourceToken] });\n else {\n if (this.atIndentedComment(it.start, seq.indent)) {\n const prev = seq.items[seq.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n Array.prototype.push.apply(end, it.start);\n end.push(this.sourceToken);\n seq.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n case 'anchor':\n case 'tag':\n if (it.value || this.indent <= seq.indent)\n break;\n it.start.push(this.sourceToken);\n return;\n case 'seq-item-ind':\n if (this.indent !== seq.indent)\n break;\n if (it.value || includesToken(it.start, 'seq-item-ind'))\n seq.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n }\n if (this.indent > seq.indent) {\n const bv = this.startBlockValue(seq);\n if (bv) {\n this.stack.push(bv);\n return;\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *flowCollection(fc) {\n const it = fc.items[fc.items.length - 1];\n if (this.type === 'flow-error-end') {\n let top;\n do {\n yield* this.pop();\n top = this.peek(1);\n } while (top?.type === 'flow-collection');\n }\n else if (fc.end.length === 0) {\n switch (this.type) {\n case 'comma':\n case 'explicit-key-ind':\n if (!it || it.sep)\n fc.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n case 'map-value-ind':\n if (!it || it.value)\n fc.items.push({ start: [], key: null, sep: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n return;\n case 'space':\n case 'comment':\n case 'newline':\n case 'anchor':\n case 'tag':\n if (!it || it.value)\n fc.items.push({ start: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n it.start.push(this.sourceToken);\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (!it || it.value)\n fc.items.push({ start: [], key: fs, sep: [] });\n else if (it.sep)\n this.stack.push(fs);\n else\n Object.assign(it, { key: fs, sep: [] });\n return;\n }\n case 'flow-map-end':\n case 'flow-seq-end':\n fc.end.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(fc);\n /* istanbul ignore else should not happen */\n if (bv)\n this.stack.push(bv);\n else {\n yield* this.pop();\n yield* this.step();\n }\n }\n else {\n const parent = this.peek(2);\n if (parent.type === 'block-map' &&\n ((this.type === 'map-value-ind' && parent.indent === fc.indent) ||\n (this.type === 'newline' &&\n !parent.items[parent.items.length - 1].sep))) {\n yield* this.pop();\n yield* this.step();\n }\n else if (this.type === 'map-value-ind' &&\n parent.type !== 'flow-collection') {\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n fixFlowSeqItems(fc);\n const sep = fc.end.splice(1, fc.end.length);\n sep.push(this.sourceToken);\n const map = {\n type: 'block-map',\n offset: fc.offset,\n indent: fc.indent,\n items: [{ start, key: fc, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else {\n yield* this.lineEnd(fc);\n }\n }\n }\n flowScalar(type) {\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n return {\n type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n }\n startBlockValue(parent) {\n switch (this.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return this.flowScalar(this.type);\n case 'block-scalar-header':\n return {\n type: 'block-scalar',\n offset: this.offset,\n indent: this.indent,\n props: [this.sourceToken],\n source: ''\n };\n case 'flow-map-start':\n case 'flow-seq-start':\n return {\n type: 'flow-collection',\n offset: this.offset,\n indent: this.indent,\n start: this.sourceToken,\n items: [],\n end: []\n };\n case 'seq-item-ind':\n return {\n type: 'block-seq',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken] }]\n };\n case 'explicit-key-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n start.push(this.sourceToken);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, explicitKey: true }]\n };\n }\n case 'map-value-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n };\n }\n }\n return null;\n }\n atIndentedComment(start, indent) {\n if (this.type !== 'comment')\n return false;\n if (this.indent <= indent)\n return false;\n return start.every(st => st.type === 'newline' || st.type === 'space');\n }\n *documentEnd(docEnd) {\n if (this.type !== 'doc-mode') {\n if (docEnd.end)\n docEnd.end.push(this.sourceToken);\n else\n docEnd.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n *lineEnd(token) {\n switch (this.type) {\n case 'comma':\n case 'doc-start':\n case 'doc-end':\n case 'flow-seq-end':\n case 'flow-map-end':\n case 'map-value-ind':\n yield* this.pop();\n yield* this.step();\n break;\n case 'newline':\n this.onKeyLine = false;\n // fallthrough\n case 'space':\n case 'comment':\n default:\n // all other values are errors\n if (token.end)\n token.end.push(this.sourceToken);\n else\n token.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n}\n\nexports.Parser = Parser;\n","'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar errors = require('./errors.js');\nvar log = require('./log.js');\nvar identity = require('./nodes/identity.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\n\nfunction parseOptions(options) {\n const prettyErrors = options.prettyErrors !== false;\n const lineCounter$1 = options.lineCounter || (prettyErrors && new lineCounter.LineCounter()) || null;\n return { lineCounter: lineCounter$1, prettyErrors };\n}\n/**\n * Parse the input as a stream of YAML documents.\n *\n * Documents should be separated from each other by `...` or `---` marker lines.\n *\n * @returns If an empty `docs` array is returned, it will be of type\n * EmptyStream and contain additional stream information. In\n * TypeScript, you should use `'empty' in docs` as a type guard for it.\n */\nfunction parseAllDocuments(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n const docs = Array.from(composer$1.compose(parser$1.parse(source)));\n if (prettyErrors && lineCounter)\n for (const doc of docs) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n if (docs.length > 0)\n return docs;\n return Object.assign([], { empty: true }, composer$1.streamInfo());\n}\n/** Parse an input string into a single YAML.Document */\nfunction parseDocument(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n // `doc` is always set by compose.end(true) at the very latest\n let doc = null;\n for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {\n if (!doc)\n doc = _doc;\n else if (doc.options.logLevel !== 'silent') {\n doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));\n break;\n }\n }\n if (prettyErrors && lineCounter) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n return doc;\n}\nfunction parse(src, reviver, options) {\n let _reviver = undefined;\n if (typeof reviver === 'function') {\n _reviver = reviver;\n }\n else if (options === undefined && reviver && typeof reviver === 'object') {\n options = reviver;\n }\n const doc = parseDocument(src, options);\n if (!doc)\n return null;\n doc.warnings.forEach(warning => log.warn(doc.options.logLevel, warning));\n if (doc.errors.length > 0) {\n if (doc.options.logLevel !== 'silent')\n throw doc.errors[0];\n else\n doc.errors = [];\n }\n return doc.toJS(Object.assign({ reviver: _reviver }, options));\n}\nfunction stringify(value, replacer, options) {\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n }\n if (typeof options === 'string')\n options = options.length;\n if (typeof options === 'number') {\n const indent = Math.round(options);\n options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };\n }\n if (value === undefined) {\n const { keepUndefined } = options ?? replacer ?? {};\n if (!keepUndefined)\n return undefined;\n }\n if (identity.isDocument(value) && !_replacer)\n return value.toString(options);\n return new Document.Document(value, _replacer, options).toString(options);\n}\n\nexports.parse = parse;\nexports.parseAllDocuments = parseAllDocuments;\nexports.parseDocument = parseDocument;\nexports.stringify = stringify;\n","'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar Schema = require('./schema/Schema.js');\nvar errors = require('./errors.js');\nvar Alias = require('./nodes/Alias.js');\nvar identity = require('./nodes/identity.js');\nvar Pair = require('./nodes/Pair.js');\nvar Scalar = require('./nodes/Scalar.js');\nvar YAMLMap = require('./nodes/YAMLMap.js');\nvar YAMLSeq = require('./nodes/YAMLSeq.js');\nvar cst = require('./parse/cst.js');\nvar lexer = require('./parse/lexer.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\nvar publicApi = require('./public-api.js');\nvar visit = require('./visit.js');\n\n\n\nexports.Composer = composer.Composer;\nexports.Document = Document.Document;\nexports.Schema = Schema.Schema;\nexports.YAMLError = errors.YAMLError;\nexports.YAMLParseError = errors.YAMLParseError;\nexports.YAMLWarning = errors.YAMLWarning;\nexports.Alias = Alias.Alias;\nexports.isAlias = identity.isAlias;\nexports.isCollection = identity.isCollection;\nexports.isDocument = identity.isDocument;\nexports.isMap = identity.isMap;\nexports.isNode = identity.isNode;\nexports.isPair = identity.isPair;\nexports.isScalar = identity.isScalar;\nexports.isSeq = identity.isSeq;\nexports.Pair = Pair.Pair;\nexports.Scalar = Scalar.Scalar;\nexports.YAMLMap = YAMLMap.YAMLMap;\nexports.YAMLSeq = YAMLSeq.YAMLSeq;\nexports.CST = cst;\nexports.Lexer = lexer.Lexer;\nexports.LineCounter = lineCounter.LineCounter;\nexports.Parser = parser.Parser;\nexports.parse = publicApi.parse;\nexports.parseAllDocuments = publicApi.parseAllDocuments;\nexports.parseDocument = publicApi.parseDocument;\nexports.stringify = publicApi.stringify;\nexports.visit = visit.visit;\nexports.visitAsync = visit.visitAsync;\n","/**\n * Syntax highlighting with Shiki via rehype.\n */\n\nimport { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport rehypeStringify from \"rehype-stringify\";\nimport type { Root, Element } from \"hast\";\nimport { createHighlighter, type Highlighter, type BundledTheme } from \"shiki\";\n\n// Cached highlighter instance\nlet highlighterPromise: Promise<Highlighter> | null = null;\n\n/**\n * Get or create the Shiki highlighter.\n */\nasync function getHighlighter(theme: string): Promise<Highlighter> {\n if (!highlighterPromise) {\n highlighterPromise = createHighlighter({\n themes: [theme as BundledTheme],\n langs: [\n \"javascript\",\n \"typescript\",\n \"jsx\",\n \"tsx\",\n \"vue\",\n \"svelte\",\n \"html\",\n \"css\",\n \"scss\",\n \"json\",\n \"yaml\",\n \"markdown\",\n \"bash\",\n \"shell\",\n \"rust\",\n \"python\",\n \"go\",\n \"java\",\n \"c\",\n \"cpp\",\n \"sql\",\n \"graphql\",\n \"diff\",\n \"toml\",\n ],\n });\n }\n return highlighterPromise;\n}\n\n/**\n * Rehype plugin for syntax highlighting with Shiki.\n */\nfunction rehypeShikiHighlight(options: { theme: string }) {\n const { theme } = options;\n\n return async (tree: Root) => {\n const highlighter = await getHighlighter(theme);\n\n // Find all pre > code elements\n const visit = async (node: Root | Element) => {\n if (\"children\" in node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n\n if (child.type === \"element\" && child.tagName === \"pre\") {\n const codeElement = child.children.find(\n (c): c is Element => c.type === \"element\" && c.tagName === \"code\",\n );\n\n if (codeElement) {\n // Extract language from class\n const className = codeElement.properties?.className;\n let lang = \"text\";\n\n if (Array.isArray(className)) {\n const langClass = className.find(\n (c: string | number) => typeof c === \"string\" && c.startsWith(\"language-\"),\n );\n if (langClass && typeof langClass === \"string\") {\n lang = langClass.replace(\"language-\", \"\");\n }\n }\n\n // Get code text\n const codeText = getTextContent(codeElement);\n\n // Highlight with Shiki\n try {\n const highlighted = highlighter.codeToHtml(codeText, {\n lang: lang as any,\n theme: theme as BundledTheme,\n });\n\n // Parse the highlighted HTML and replace the pre element\n const parsed = unified().use(rehypeParse, { fragment: true }).parse(highlighted);\n\n // Replace the pre element with the highlighted one\n if (parsed.children[0]) {\n node.children[i] = parsed.children[0] as Element;\n }\n } catch {\n // If highlighting fails, keep the original\n }\n }\n } else if (child.type === \"element\") {\n await visit(child);\n }\n }\n }\n };\n\n await visit(tree);\n };\n}\n\n/**\n * Extract text content from a hast node.\n */\nfunction getTextContent(node: Element | Root): string {\n let text = \"\";\n\n if (\"children\" in node) {\n for (const child of node.children) {\n if (child.type === \"text\") {\n text += child.value;\n } else if (child.type === \"element\") {\n text += getTextContent(child);\n }\n }\n }\n\n return text;\n}\n\n/**\n * Apply syntax highlighting to HTML using Shiki.\n */\nexport async function highlightCode(html: string, theme: string = \"github-dark\"): Promise<string> {\n const result = await unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeShikiHighlight, { theme })\n .use(rehypeStringify)\n .process(html);\n\n return String(result);\n}\n","/**\n * Protects mermaid SVG content from rehype HTML5 parser corruption.\n *\n * rehypeParse + rehypeStringify converts `<br />` in SVG foreignObject\n * to `<br></br>`, which HTML5 interprets as 2 <br> elements.\n * Each rehype pass doubles them: 1 → 2 → 4 → 8 → 16.\n *\n * This module extracts ox-mermaid SVG blocks into placeholders before\n * rehype processing and restores them after.\n */\n\nexport interface MermaidSvgProtection {\n html: string;\n svgs: Map<string, string>;\n}\n\n/**\n * Extract `<div class=\"ox-mermaid\">...</div>` blocks and replace\n * with HTML comment placeholders that rehype will preserve.\n */\nexport function protectMermaidSvgs(html: string): MermaidSvgProtection {\n const svgs = new Map<string, string>();\n let result = html;\n let idx = 0;\n\n while (true) {\n const marker = `<div class=\"ox-mermaid\">`;\n const start = result.indexOf(marker, idx);\n if (start === -1) break;\n\n // Find the matching </div> by counting nested divs\n let depth = 0;\n let pos = start;\n let endPos = -1;\n\n while (pos < result.length) {\n const openIdx = result.indexOf(\"<div\", pos);\n const closeIdx = result.indexOf(\"</div>\", pos);\n if (closeIdx === -1) break;\n\n if (openIdx !== -1 && openIdx < closeIdx) {\n depth++;\n pos = openIdx + 4;\n } else {\n depth--;\n if (depth === 0) {\n endPos = closeIdx + 6;\n break;\n }\n pos = closeIdx + 6;\n }\n }\n\n if (endPos === -1) break;\n\n const svgContent = result.substring(start, endPos);\n const placeholder = `<!--ox-mermaid-${svgs.size}-->`;\n svgs.set(placeholder, svgContent);\n result = result.substring(0, start) + placeholder + result.substring(endPos);\n idx = start + placeholder.length;\n }\n\n return { html: result, svgs };\n}\n\n/**\n * Restore protected mermaid SVG blocks from placeholders.\n */\nexport function restoreMermaidSvgs(html: string, svgs: Map<string, string>): string {\n let result = html;\n for (const [placeholder, content] of svgs) {\n result = result.replace(placeholder, content);\n }\n return result;\n}\n","/**\n * Markdown Transformation Engine\n *\n * This module handles the complete transformation pipeline for Markdown files,\n * converting raw Markdown content into JavaScript modules that can be imported\n * by web applications. The transformation process includes:\n *\n * 1. **Parsing**: Uses Rust-based parser via NAPI bindings for high performance\n * 2. **Rendering**: Converts parsed AST to semantic HTML\n * 3. **Enhancement**: Applies syntax highlighting, Mermaid diagram rendering, etc.\n * 4. **Code Generation**: Generates JavaScript/TypeScript module code\n *\n * The generated modules export:\n * - `html`: Rendered HTML content\n * - `frontmatter`: Parsed YAML metadata\n * - `toc`: Hierarchical table of contents\n * - `render`: Client-side render function for dynamic updates\n *\n * @example\n * ```typescript\n * import { transformMarkdown } from './transform';\n *\n * const content = await transformMarkdown(\n * '# Hello\\n\\nWorld',\n * 'path/to/file.md',\n * resolvedOptions\n * );\n *\n * console.log(content.html); // '<h1>Hello</h1><p>World</p>'\n * console.log(content.toc); // [{ depth: 1, text: 'Hello', slug: 'hello', children: [] }]\n * ```\n */\n\nimport YAML from \"yaml\";\nimport type { ResolvedOptions, TransformResult, TocEntry } from \"./types\";\nimport { highlightCode } from \"./highlight\";\nimport { transformMermaidStatic } from \"./plugins/mermaid\";\nimport { protectMermaidSvgs, restoreMermaidSvgs } from \"./plugins/mermaid-protect\";\n\n/**\n * NAPI bindings for Rust-based Markdown processing.\n *\n * Provides access to compiled Rust functions for high-performance\n * Markdown parsing and rendering operations.\n */\ninterface NapiBindings {\n /**\n * Simple Markdown parser and renderer in one step.\n * Faster for simple use cases but lacks advanced features.\n *\n * @param source - Raw Markdown content\n * @param options - Parser configuration (GFM flag)\n * @returns Rendered HTML and parsing errors\n */\n parseAndRender: (\n source: string,\n options?: { gfm?: boolean },\n ) => { html: string; errors: string[] };\n\n /**\n * Full-featured Markdown transformation pipeline.\n * Handles frontmatter extraction, TOC generation, and advanced parsing.\n *\n * @param source - Raw Markdown content (may include frontmatter)\n * @param options - Comprehensive transformation options\n * @returns Transformed result with HTML, metadata, and TOC\n */\n transform: (\n source: string,\n options?: JsTransformOptions,\n ) => {\n html: string;\n frontmatter: string;\n toc: { depth: number; text: string; slug: string }[];\n errors: string[];\n };\n\n /**\n * Generates an OG image as SVG.\n *\n * @param data - OG image data (title, description, etc.)\n * @param config - Optional OG image configuration\n * @returns SVG string\n */\n generateOgImageSvg: (data: OgImageData, config?: OgImageConfig) => string;\n}\n\n/**\n * OG image data for generating social media preview images.\n */\nexport interface OgImageData {\n /** Page title */\n title: string;\n /** Page description */\n description?: string;\n /** Site name */\n siteName?: string;\n /** Author name */\n author?: string;\n}\n\n/**\n * OG image configuration.\n */\nexport interface OgImageConfig {\n /** Image width in pixels */\n width?: number;\n /** Image height in pixels */\n height?: number;\n /** Background color (hex) */\n backgroundColor?: string;\n /** Text color (hex) */\n textColor?: string;\n /** Title font size */\n titleFontSize?: number;\n /** Description font size */\n descriptionFontSize?: number;\n}\n\n/**\n * Options for Rust-based Markdown transformation.\n *\n * Controls which Markdown extensions and features are enabled\n * during parsing and rendering.\n */\ninterface JsTransformOptions {\n /**\n * Enable GitHub Flavored Markdown extensions.\n * Includes tables, task lists, strikethrough, and autolinks.\n * @default false\n */\n gfm?: boolean;\n\n /**\n * Enable footnotes syntax ([^1]: definition).\n * @default false\n */\n footnotes?: boolean;\n\n /**\n * Enable task list syntax (- [ ] unchecked, - [x] checked).\n * @default false\n */\n taskLists?: boolean;\n\n /**\n * Enable table rendering (GFM extension).\n * Requires GFM to be enabled for full functionality.\n * @default false\n */\n tables?: boolean;\n\n /**\n * Enable strikethrough syntax (~~text~~).\n * Requires GFM to be enabled.\n * @default false\n */\n strikethrough?: boolean;\n\n /**\n * Enable automatic link conversion (URLs become clickable).\n * @default false\n */\n autolinks?: boolean;\n\n /**\n * Maximum heading depth for table of contents.\n * Headings deeper than this level are excluded from TOC.\n * @default 3\n * @min 1\n * @max 6\n */\n tocMaxDepth?: number;\n\n /**\n * Convert `.md` links to `.html` links for SSG output.\n * @default false\n */\n convertMdLinks?: boolean;\n\n /**\n * Base URL for absolute link conversion (e.g., \"/\" or \"/docs/\").\n * @default \"/\"\n */\n baseUrl?: string;\n\n /**\n * Source file path for relative link resolution.\n * Used to determine if the current file is an index file.\n */\n sourcePath?: string;\n}\n\n/**\n * Cached NAPI bindings instance.\n * Loaded on first use and reused for subsequent transformations.\n * @internal\n */\nlet napiBindings: NapiBindings | null | undefined;\n\n/**\n * Flag to prevent repeated NAPI loading attempts.\n * Set to true after first load attempt (success or failure).\n * @internal\n */\nlet napiLoadAttempted = false;\n\n/**\n * Lazily loads and caches NAPI bindings.\n *\n * This function uses lazy loading to defer the import of NAPI bindings\n * until they're actually needed. The bindings are loaded only once and\n * cached for subsequent uses. If loading fails (e.g., bindings not built),\n * the failure is cached to avoid repeated load attempts.\n *\n * ## Performance Considerations\n *\n * The first call to this function may have a slight performance penalty\n * due to module loading. Subsequent calls use the cached result and are\n * essentially zero-cost.\n *\n * ## Error Handling\n *\n * If NAPI bindings are not available (not built, wrong architecture, etc.),\n * this function returns `null`. The caller should handle this gracefully\n * or provide fallback behavior.\n *\n * @returns Promise resolving to NAPI bindings or null if unavailable\n *\n * @example\n * ```typescript\n * // Simple check with fallback\n * const napi = await loadNapiBindings();\n * if (!napi) {\n * console.warn('NAPI bindings not available, using fallback');\n * return fallbackRender(content);\n * }\n *\n * // Use Rust implementation\n * const result = napi.transform(content, { gfm: true });\n * ```\n *\n * @internal\n */\nasync function loadNapiBindings(): Promise<NapiBindings | null> {\n // Return cached result (success or failure)\n if (napiLoadAttempted) {\n return napiBindings ?? null;\n }\n\n // Mark attempt as made to prevent retry loops\n napiLoadAttempted = true;\n\n try {\n // Dynamic import to handle cases where NAPI isn't built\n const mod = await import(\"@ox-content/napi\");\n napiBindings = mod;\n return mod;\n } catch (error) {\n // NAPI not available (not built, missing dependencies, etc.)\n // Log for debugging but don't throw - allow graceful degradation\n if (process.env.DEBUG) {\n console.debug(\"[ox-content] NAPI bindings load failed:\", error);\n }\n napiBindings = null;\n return null;\n }\n}\n\n/**\n * Transforms Markdown content into a JavaScript module.\n *\n * This is the primary entry point for transforming Markdown files. It handles\n * the complete transformation pipeline including parsing, rendering, syntax\n * highlighting, and code generation.\n *\n * ## Pipeline Steps\n *\n * 1. **Parse & Render**: Uses Rust-based parser via NAPI for high performance\n * 2. **Extract Metadata**: Parses YAML frontmatter and generates table of contents\n * 3. **Enhance HTML**: Applies syntax highlighting and Mermaid diagram rendering\n * 4. **Generate Code**: Creates importable JavaScript module\n *\n * ## Generated Module Exports\n *\n * - `html` (string): Rendered HTML content with all enhancements applied\n * - `frontmatter` (object): Parsed YAML frontmatter as JavaScript object\n * - `toc` (array): Hierarchical table of contents entries\n * - `render` (function): Client-side render function for dynamic updates\n *\n * ## Markdown Features Supported\n *\n * The supported features depend on parser options:\n * - **Commonmark**: Headings, paragraphs, lists, code blocks, links, images\n * - **GFM Extensions**: Tables, task lists, strikethrough, autolinks\n * - **Enhancements**: Syntax highlighting, Mermaid diagrams, TOC generation\n * - **Metadata**: YAML frontmatter parsing\n *\n * ## Performance\n *\n * Uses Rust-based parsing via NAPI bindings for optimal performance. Falls back\n * gracefully if Rust bindings are unavailable.\n *\n * @param source - Raw Markdown source code (may include YAML frontmatter)\n * @param filePath - File path for source attribution and relative link resolution\n * @param options - Resolved plugin options controlling transformation behavior\n *\n * @returns Promise resolving to transformation result with HTML and metadata\n *\n * @throws Error if NAPI bindings are unavailable (can be handled gracefully)\n *\n * @example\n * ```typescript\n * import { transformMarkdown } from './transform';\n * import { resolveOptions } from './index';\n *\n * // Transform a Markdown file with YAML frontmatter\n * const markdown = `---\n * title: Getting Started\n * author: john\n * ---\n *\n * # Getting Started\n *\n * Welcome! This guide explains [transformMarkdown] function.\n *\n * ## Installation\n *\n * \\`\\`\\`bash\n * npm install @ox-content/vite-plugin\n * \\`\\`\\`\n * `;\n *\n * const options = resolveOptions({\n * highlight: true,\n * highlightTheme: 'github-dark',\n * toc: true,\n * gfm: true,\n * mermaid: true,\n * });\n *\n * const result = await transformMarkdown(markdown, 'docs/getting-started.md', options);\n *\n * // Generated module exports\n * console.log(result.html); // Rendered HTML with syntax highlighting\n * console.log(result.frontmatter); // { title: 'Getting Started', author: 'john' }\n * console.log(result.toc); // [{ depth: 1, text: 'Getting Started', ... }]\n * console.log(result.code); // ES module export statement\n * ```\n */\n/**\n * SSG-specific transform options.\n */\nexport interface SsgTransformOptions {\n /** Convert `.md` links to `.html` links */\n convertMdLinks?: boolean;\n /** Base URL for absolute link conversion */\n baseUrl?: string;\n /** Source file path for relative link resolution */\n sourcePath?: string;\n}\n\nexport async function transformMarkdown(\n source: string,\n filePath: string,\n options: ResolvedOptions,\n ssgOptions?: SsgTransformOptions,\n): Promise<TransformResult> {\n const napi = await loadNapiBindings();\n\n if (!napi) {\n throw new Error(\n \"[ox-content] NAPI bindings not available. Please ensure @ox-content/napi is built.\",\n );\n }\n\n // Parse frontmatter using YAML on TypeScript side for proper nested object support\n const { content: markdownContent, frontmatter } = parseFrontmatter(source);\n\n // Use Rust-based transformation (pass content without frontmatter)\n const result = napi.transform(markdownContent, {\n gfm: options.gfm,\n footnotes: options.footnotes,\n taskLists: options.taskLists,\n tables: options.tables,\n strikethrough: options.strikethrough,\n tocMaxDepth: options.tocMaxDepth,\n convertMdLinks: ssgOptions?.convertMdLinks,\n baseUrl: ssgOptions?.baseUrl,\n sourcePath: ssgOptions?.sourcePath ?? filePath,\n });\n\n if (result.errors.length > 0) {\n console.warn(\"[ox-content] Transform warnings:\", result.errors);\n }\n\n let html = result.html;\n\n // Convert flat TOC from Rust to nested TOC\n const flatToc: TocEntry[] = result.toc.map((item) => ({\n ...item,\n children: [],\n }));\n const toc = options.toc ? buildTocTree(flatToc) : [];\n\n // Transform mermaid diagrams before highlighting to avoid entity re-encoding\n if (options.mermaid) {\n html = await transformMermaidStatic(html);\n }\n\n // Protect mermaid SVGs from rehype processing (which corrupts <br /> in foreignObjects)\n const { html: protectedHtml, svgs } = protectMermaidSvgs(html);\n html = protectedHtml;\n\n // Apply syntax highlighting if enabled\n if (options.highlight) {\n html = await highlightCode(html, options.highlightTheme);\n }\n\n // Restore protected SVGs\n html = restoreMermaidSvgs(html, svgs);\n\n // Generate JavaScript module code\n const code = generateModuleCode(html, frontmatter, toc, filePath, options);\n\n return {\n code,\n html,\n frontmatter,\n toc,\n };\n}\n\n/**\n * Parses YAML frontmatter from Markdown content.\n * Uses proper YAML parser for full nested object support.\n */\nfunction parseFrontmatter(source: string): {\n content: string;\n frontmatter: Record<string, unknown>;\n} {\n // Check for frontmatter delimiter\n if (!source.startsWith(\"---\")) {\n return { content: source, frontmatter: {} };\n }\n\n // Find the closing delimiter\n const rest = source.slice(3);\n const endIndex = rest.indexOf(\"\\n---\");\n\n if (endIndex === -1) {\n return { content: source, frontmatter: {} };\n }\n\n const frontmatterStr = rest.slice(0, endIndex).trim();\n const content = rest.slice(endIndex + 4).trimStart();\n\n try {\n const frontmatter = YAML.parse(frontmatterStr) as Record<string, unknown>;\n return { content, frontmatter: frontmatter || {} };\n } catch (error) {\n console.warn(\"[ox-content] Failed to parse frontmatter:\", error);\n return { content, frontmatter: {} };\n }\n}\n\n/**\n * Builds nested TOC tree from flat list.\n */\nfunction buildTocTree(entries: TocEntry[]): TocEntry[] {\n const root: TocEntry[] = [];\n const stack: TocEntry[] = [];\n\n for (const entry of entries) {\n // Pop stack until we find a parent with smaller depth\n while (stack.length > 0 && stack[stack.length - 1].depth >= entry.depth) {\n stack.pop();\n }\n\n if (stack.length === 0) {\n root.push(entry);\n } else {\n stack[stack.length - 1].children.push(entry);\n }\n\n stack.push(entry);\n }\n\n return root;\n}\n\n/**\n * Generates the JavaScript module code.\n */\nfunction generateModuleCode(\n html: string,\n frontmatter: Record<string, unknown>,\n toc: TocEntry[],\n filePath: string,\n _options: ResolvedOptions,\n): string {\n const htmlJson = JSON.stringify(html);\n const frontmatterJson = JSON.stringify(frontmatter);\n const tocJson = JSON.stringify(toc);\n\n return `\n// Generated by @ox-content/vite-plugin\n// Source: ${filePath}\n\n/**\n * Rendered HTML content.\n */\nexport const html = ${htmlJson};\n\n/**\n * Parsed frontmatter.\n */\nexport const frontmatter = ${frontmatterJson};\n\n/**\n * Table of contents.\n */\nexport const toc = ${tocJson};\n\n/**\n * Default export with all data.\n */\nexport default {\n html,\n frontmatter,\n toc,\n};\n\n// HMR support\nif (import.meta.hot) {\n import.meta.hot.accept((newModule) => {\n if (newModule) {\n // Trigger re-render with new content\n import.meta.hot.invalidate();\n }\n });\n}\n`;\n}\n\n/**\n * Extracts imports from Markdown content.\n *\n * Supports importing components for interactive islands.\n */\nexport function extractImports(content: string): string[] {\n const importRegex = /^import\\s+.+\\s+from\\s+['\"](.+)['\"]/gm;\n const imports: string[] = [];\n let match;\n\n while ((match = importRegex.exec(content)) !== null) {\n imports.push(match[1]);\n }\n\n return imports;\n}\n\n/**\n * Generates an OG image SVG using the Rust-based generator.\n *\n * This function uses the Rust NAPI bindings to generate SVG-based\n * OG images for social media previews. The SVG can be served directly\n * or converted to PNG/JPEG for broader compatibility.\n *\n * In the future, custom JS templates can be provided to override\n * the default Rust-based template.\n *\n * @param data - OG image data (title, description, etc.)\n * @param config - Optional OG image configuration\n * @returns SVG string or null if NAPI bindings are unavailable\n */\nexport async function generateOgImageSvg(\n data: OgImageData,\n config?: OgImageConfig,\n): Promise<string | null> {\n const napi = await loadNapiBindings();\n if (!napi) {\n return null;\n }\n\n // Convert config to NAPI format (camelCase to snake_case)\n const napiConfig = config\n ? {\n width: config.width,\n height: config.height,\n backgroundColor: config.backgroundColor,\n textColor: config.textColor,\n titleFontSize: config.titleFontSize,\n descriptionFontSize: config.descriptionFontSize,\n }\n : undefined;\n\n return napi.generateOgImageSvg(data, napiConfig);\n}\n","/**\n * Navigation Metadata Generator for API Documentation\n *\n * This module provides utilities for generating sidebar navigation structures\n * from extracted documentation. It automatically:\n *\n * - **Extracts file information**: Gets display names and file paths\n * - **Formats names**: Converts technical names to readable titles\n * - **Generates TypeScript**: Creates importable nav.ts files\n * - **Maintains hierarchy**: Supports nested navigation structures\n *\n * ## Generated Navigation Format\n *\n * The generated navigation is TypeScript-based for type safety and IDE support:\n *\n * ```typescript\n * export const apiNav: NavItem[] = [\n * { title: 'Overview', path: '/api/index' },\n * { title: 'Transform', path: '/api/transform' },\n * { title: 'Types', path: '/api/types' },\n * // ... auto-generated from documentation\n * ] as const;\n * ```\n *\n * ## Integration\n *\n * The generated nav.ts file can be imported directly:\n *\n * ```typescript\n * // In your Vue/React component\n * import { apiNav } from '../api/nav';\n *\n * const apiItems = apiNav.map(item => ({\n * ...item,\n * file: () => import(`../api/${item.path.split('/').pop()}.md`)\n * }));\n * ```\n *\n * @example\n * ```typescript\n * import { generateNavMetadata, generateNavCode } from './nav-generator';\n *\n * const extracted = [\n * { file: 'transform.ts', entries: [...] },\n * { file: 'types.ts', entries: [...] },\n * ];\n *\n * const navItems = generateNavMetadata(extracted);\n * // => [\n * // { title: 'Transform', path: '/api/transform' },\n * // { title: 'Types', path: '/api/types' },\n * // ]\n *\n * const code = generateNavCode(navItems);\n * // => TypeScript code ready to write to nav.ts\n * ```\n */\n\nimport path from \"path\";\nimport type { ExtractedDocs, NavItem } from \"./types\";\n\n/**\n * Generates sidebar navigation metadata from extracted documentation.\n *\n * Takes an array of extracted documentation and produces a flat navigation\n * structure suitable for sidebar menus. Items are:\n * - Sorted alphabetically by display name\n * - Formatted with readable titles\n * - Prefixed with the specified base path\n *\n * ## Naming Conventions\n *\n * - `transform.ts` → `{ title: 'Transform', path: '/api/transform' }`\n * - `nav-generator.ts` → `{ title: 'Nav Generator', path: '/api/nav-generator' }`\n * - `index.ts` or `index-module.ts` → `{ title: 'Overview', path: '/api/index' }`\n * - `types.ts` → `{ title: 'Types', path: '/api/types' }`\n *\n * ## Sorting\n *\n * Items are sorted alphabetically by display title for consistent ordering.\n * Special item 'Overview' sorts naturally with others (O comes after most letters).\n *\n * ## Path Generation\n *\n * The generated paths are used to import corresponding Markdown files:\n * - Path `/api/transform` → Import from `../api/transform.md`\n * - Path `/api/index` → Import from `../api/index.md`\n *\n * @param docs - Array of extracted documentation (file + entries)\n * @param basePath - Base path prefix for navigation URLs (default: '/api')\n * Use '/api' for main API docs, '/helpers' for utilities, etc.\n *\n * @returns Array of navigation items ready to use or export to TypeScript\n *\n * @example\n * ```typescript\n * const navItems = generateNavMetadata(\n * [\n * { file: 'transform.ts', entries: [...] },\n * { file: 'docs.ts', entries: [...] },\n * { file: 'types.ts', entries: [...] },\n * ],\n * '/api'\n * );\n *\n * // Returns:\n * // [\n * // { title: 'Docs', path: '/api/docs' },\n * // { title: 'Transform', path: '/api/transform' },\n * // { title: 'Types', path: '/api/types' },\n * // ]\n * ```\n *\n * @see generateNavCode For converting these items to TypeScript code\n */\nexport function generateNavMetadata(docs: ExtractedDocs[], basePath: string = \"/api\"): NavItem[] {\n // Sort docs by filename for consistent ordering\n const sortedDocs = [...docs].sort((a, b) => {\n const aName = getDocDisplayName(a.file);\n const bName = getDocDisplayName(b.file);\n return aName.localeCompare(bName);\n });\n\n return sortedDocs.map((doc) => ({\n title: getDocDisplayName(doc.file),\n path: `${basePath}/${getDocFileName(doc.file)}`,\n }));\n}\n\n/**\n * Gets the human-readable display name for a documentation file.\n *\n * Transforms file paths and names into proper title case:\n * - Extracts base name (e.g., 'transform.ts' → 'transform')\n * - Converts kebab-case to Title Case (e.g., 'nav-generator' → 'Nav Generator')\n * - Converts camelCase to Title Case (e.g., 'transformMarkdown' → 'Transform Markdown')\n * - Handles special cases (index → 'Overview')\n *\n * ## Examples\n *\n * - `'/path/to/transform.ts'` → `'Transform'`\n * - `'nav-generator.ts'` → `'Nav Generator'`\n * - `'index.ts'` → `'Overview'`\n * - `'index-module.ts'` → `'Overview'`\n * - `'myFunction.ts'` → `'My Function'` (with camelCase handling)\n *\n * @param filePath - Full or relative file path\n * @returns Formatted display name suitable for UI labels\n *\n * @internal\n */\nfunction getDocDisplayName(filePath: string): string {\n const fileName = path.basename(filePath, path.extname(filePath));\n\n // Handle special cases\n if (fileName === \"index\" || fileName === \"index-module\") {\n return \"Overview\";\n }\n\n // Convert kebab-case and snake_case to Title Case\n // Also handles camelCase transitions\n return fileName\n .replace(/[-_]([a-z])/g, (_, char) => \" \" + char.toUpperCase())\n .replace(/^[a-z]/, (char) => char.toUpperCase());\n}\n\n/**\n * Gets the file name (without extension) for use in navigation paths.\n *\n * This handles filename conflicts that may occur during generation:\n * - Preserves most names as-is\n * - Special handling for index files to maintain consistency\n *\n * @param filePath - Source file path\n * @returns File name without extension, ready for URL paths\n *\n * @internal\n */\nfunction getDocFileName(filePath: string): string {\n const fileName = path.basename(filePath, path.extname(filePath));\n\n // Handle filename conflicts\n // The docs generator renames 'index' to 'index-module' to avoid conflicts\n if (fileName === \"index\") {\n return \"index\";\n }\n\n return fileName;\n}\n\n/**\n * Generates TypeScript code for navigation metadata export.\n *\n * Creates a complete, self-contained TypeScript file that:\n * - Defines the NavItem interface\n * - Exports navigation items as a const\n * - Uses `as const` for type-safe literal types\n * - Includes auto-generation notice\n *\n * The generated code is production-ready and suitable for direct import\n * in Vue, React, or vanilla TypeScript applications.\n *\n * ## Generated Code Example\n *\n * ```typescript\n * export interface NavItem {\n * title: string;\n * path: string;\n * children?: NavItem[];\n * }\n *\n * export const apiNav: NavItem[] = [\n * { \"title\": \"Docs\", \"path\": \"/api/docs\" },\n * { \"title\": \"Transform\", \"path\": \"/api/transform\" },\n * // ...\n * ] as const;\n * ```\n *\n * ## Features\n *\n * - **Type Safety**: Includes NavItem interface definition\n * - **Readonly**: Uses `as const` to ensure immutability\n * - **IDE Support**: Full IntelliSense and autocomplete\n * - **Self-Documenting**: Includes notice that file is auto-generated\n *\n * @param navItems - Array of navigation items to export\n * @param exportName - Name of the exported const (default: 'apiNav')\n * Use custom names for different navigation sections\n *\n * @returns Complete TypeScript source code as string,\n * ready to write to a .ts file\n *\n * @example\n * ```typescript\n * const navItems = [\n * { title: 'Home', path: '/api/index' },\n * { title: 'Transform', path: '/api/transform' },\n * ];\n *\n * const code = generateNavCode(navItems, 'apiNav');\n * await fs.promises.writeFile('docs/api/nav.ts', code, 'utf-8');\n * ```\n *\n * @see generateNavMetadata For generating NavItem arrays from extracted docs\n */\nexport function generateNavCode(navItems: NavItem[], exportName: string = \"apiNav\"): string {\n const json = JSON.stringify(navItems, null, 2);\n return `/**\n * Auto-generated API documentation navigation.\n * This file is automatically generated by the docs plugin.\n * Do not edit manually.\n */\n\nexport interface NavItem {\n title: string;\n path: string;\n children?: NavItem[];\n}\n\nexport const ${exportName}: NavItem[] = ${json} as const;\n`;\n}\n","/**\n * Source Documentation Extraction and Generation\n *\n * This module provides comprehensive tools for extracting JSDoc/TSDoc comments\n * from TypeScript/JavaScript source files and automatically generating Markdown\n * documentation.\n *\n * ## Features\n *\n * - **Automatic Extraction**: Parses JSDoc comments from functions, classes, interfaces, and types\n * - **Flexible Filtering**: Include/exclude patterns for selective documentation\n * - **Markdown Generation**: Converts extracted docs to organized Markdown files\n * - **Navigation Generation**: Auto-generates sidebar navigation metadata\n * - **GitHub Links**: Includes clickable links to source code on GitHub\n *\n * ## Supported JSDoc Tags\n *\n * - `@param {type} name - description` - Function parameter documentation\n * - `@returns {type} description` - Return value documentation\n * - `@example` - Code examples (multi-line blocks)\n * - `@private` - Mark item as private (excluded from docs if private=false)\n * - `@default value` - Default parameter value\n * - Custom tags are preserved in the `tags` field\n *\n * ## Usage Flow\n *\n * 1. Call `extractDocs()` to parse source files\n * 2. Call `generateMarkdown()` to create Markdown content\n * 3. Call `writeDocs()` to write files to output directory\n * 4. Generated nav.ts can be imported for sidebar navigation\n *\n * @example\n * ```typescript\n * import { extractDocs, generateMarkdown, writeDocs } from './docs';\n *\n * const docsOptions = {\n * enabled: true,\n * src: ['./src'],\n * out: './docs/api',\n * include: ['**\\/*.ts'],\n * exclude: ['**\\/*.test.ts'],\n * groupBy: 'file',\n * githubUrl: 'https://github.com/user/project',\n * };\n *\n * const extracted = await extractDocs(['./src'], docsOptions);\n * const markdown = generateMarkdown(extracted, docsOptions);\n * await writeDocs(markdown, './docs/api', extracted, docsOptions);\n * ```\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { ResolvedDocsOptions, ExtractedDocs, DocEntry, ParamDoc } from \"./types\";\nimport { generateNavMetadata, generateNavCode } from \"./nav-generator\";\n/**\n * Regex pattern for matching JSDoc comment blocks.\n *\n * Matches block comments that start at the beginning of a line\n * (with optional leading whitespace). This pattern avoids false matches\n * with block comments inside strings like glob patterns.\n *\n * @internal\n */\nconst JSDOC_BLOCK = /^[ \\t]*\\/\\*\\*\\s*([\\s\\S]*?)\\s*\\*\\//gm;\n\n/**\n * Regex pattern for matching function declarations.\n * Matches: `function name`, `export function name`, `async function name`\n * @internal\n */\nconst _FUNCTION_DECL = /(?:export\\s+)?(?:async\\s+)?function\\s+(\\w+)/;\n\n/**\n * Regex pattern for matching const arrow/async functions.\n * Matches: `const name = () => {}`, `const name = async () => {}`\n * @internal\n */\nconst _CONST_FUNC = /(?:export\\s+)?const\\s+(\\w+)\\s*=\\s*(?:async\\s*)?\\(/;\n\n/**\n * Regex pattern for matching class declarations.\n * Matches: `class Name`, `export class Name`\n * @internal\n */\nconst _CLASS_DECL = /(?:export\\s+)?class\\s+(\\w+)/;\n\n/**\n * Regex pattern for matching interface declarations.\n * Matches: `interface Name`, `export interface Name`\n * @internal\n */\nconst _INTERFACE_DECL = /(?:export\\s+)?interface\\s+(\\w+)/;\n\n/**\n * Regex pattern for matching type alias declarations.\n * Matches: `type Name = ...`, `export type Name = ...`\n * @internal\n */\nconst _TYPE_DECL = /(?:export\\s+)?type\\s+(\\w+)/;\n\n/**\n * Extracts JSDoc documentation from source files in specified directories.\n *\n * This function recursively searches directories for source files matching\n * the include/exclude patterns, then extracts all documented items (functions,\n * classes, interfaces, types) from those files.\n *\n * ## Process\n *\n * 1. **File Discovery**: Recursively walks directories, applying filters\n * 2. **File Reading**: Loads each matching file's content\n * 3. **JSDoc Extraction**: Parses JSDoc comments using regex patterns\n * 4. **Declaration Matching**: Pairs JSDoc comments with source declarations\n * 5. **Result Collection**: Aggregates extracted documentation by file\n *\n * ## Include/Exclude Patterns\n *\n * Patterns support:\n * - `**` - Match any directory structure\n * - `*` - Match any filename\n * - Standard glob patterns (e.g., `**\\/*.test.ts`)\n *\n * ## Performance Considerations\n *\n * - Uses filesystem I/O which can be slow for large codebases\n * - Consider using more specific include patterns to reduce file scanning\n * - Results are not cached; call once per build/dev session\n *\n * @param srcDirs - Array of source directory paths to scan\n * @param options - Documentation extraction options (filters, grouping, etc.)\n *\n * @returns Promise resolving to array of extracted documentation by file.\n * Each ExtractedDocs object contains file path and array of DocEntry items.\n *\n * @example\n * ```typescript\n * const docs = await extractDocs(\n * ['./packages/vite-plugin/src'],\n * {\n * enabled: true,\n * src: [],\n * out: 'docs',\n * include: ['**\\/*.ts'],\n * exclude: ['**\\/*.test.ts', '**\\/*.spec.ts'],\n * format: 'markdown',\n * private: false,\n * toc: true,\n * groupBy: 'file',\n * generateNav: true,\n * }\n * );\n *\n * // Returns:\n * // [\n * // {\n * // file: '/path/to/transform.ts',\n * // entries: [\n * // { name: 'transformMarkdown', kind: 'function', ... },\n * // { name: 'loadNapiBindings', kind: 'function', ... },\n * // ]\n * // },\n * // ...\n * // ]\n * ```\n */\nexport async function extractDocs(\n srcDirs: string[],\n options: ResolvedDocsOptions,\n): Promise<ExtractedDocs[]> {\n const results: ExtractedDocs[] = [];\n\n for (const srcDir of srcDirs) {\n const files = await findFiles(srcDir, options);\n\n for (const file of files) {\n const content = await fs.promises.readFile(file, \"utf-8\");\n const entries = extractFromContent(content, file, options);\n\n if (entries.length > 0) {\n results.push({ file, entries });\n }\n }\n }\n\n return results;\n}\n\n/**\n * Recursively finds all source files matching include/exclude patterns.\n *\n * @internal\n */\nasync function findFiles(dir: string, options: ResolvedDocsOptions): Promise<string[]> {\n const files: string[] = [];\n\n async function walk(currentDir: string) {\n let entries;\n try {\n entries = await fs.promises.readdir(currentDir, { withFileTypes: true });\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = path.join(currentDir, entry.name);\n\n if (entry.isDirectory()) {\n if (!isExcluded(fullPath, options.exclude)) {\n await walk(fullPath);\n }\n } else if (entry.isFile()) {\n if (isIncluded(fullPath, options.include) && !isExcluded(fullPath, options.exclude)) {\n files.push(fullPath);\n }\n }\n }\n }\n\n await walk(dir);\n return files;\n}\n\nfunction isIncluded(file: string, patterns: string[]): boolean {\n return patterns.some((pattern) => {\n if (pattern.includes(\"**\")) {\n const ext = pattern.split(\".\").pop();\n return file.endsWith(`.${ext}`);\n }\n return file.endsWith(pattern.replace(\"*\", \"\"));\n });\n}\n\nfunction isExcluded(file: string, patterns: string[]): boolean {\n return patterns.some((pattern) => {\n if (pattern.includes(\"node_modules\")) {\n return file.includes(\"node_modules\");\n }\n if (pattern.includes(\".test.\") || pattern.includes(\".spec.\")) {\n return file.includes(\".test.\") || file.includes(\".spec.\");\n }\n return false;\n });\n}\n\n/**\n * Extracts documentation entries from file content.\n */\nfunction extractFromContent(\n content: string,\n file: string,\n options: ResolvedDocsOptions,\n): DocEntry[] {\n const entries: DocEntry[] = [];\n\n let match: RegExpExecArray | null;\n JSDOC_BLOCK.lastIndex = 0;\n\n while ((match = JSDOC_BLOCK.exec(content)) !== null) {\n const jsdocContent = match[1];\n const jsdocEnd = match.index + match[0].length;\n\n const afterJsdoc = content.slice(jsdocEnd).trim();\n const lineNumber = content.slice(0, match.index).split(\"\\n\").length;\n\n const entry = parseJsdocBlock(jsdocContent, afterJsdoc, file, lineNumber);\n\n if (entry && (options.private || !entry.private)) {\n entries.push(entry);\n }\n }\n\n return entries;\n}\n\n/**\n * Extracts the complete function signature for display.\n *\n * Captures the full function declaration from `export/async/function name(...): ReturnType`\n * or `export const name = (...): ReturnType => {}`, handling multi-line signatures.\n *\n * @param signature - Multi-line function declaration text\n * @returns Cleaned function signature or undefined if not found\n *\n * @internal\n */\nfunction extractFunctionSignature(signature: string): string | undefined {\n // Match function declarations: export/async function, export const, etc.\n // Capture everything from the start until the opening brace or arrow\n const match = signature.match(\n /(?:export\\s+)?(?:async\\s+)?(?:function\\s+\\w+|\\w+\\s*=\\s*(?:async\\s*)?\\()\\([^{]*?\\)(?:\\s*:\\s*[^{;]+)?/s,\n );\n\n if (match) {\n let sig = match[0].trim();\n // Clean up excessive whitespace while preserving structure\n // Replace multiple spaces with single space, but keep newlines in readable format\n sig = sig\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line)\n .join(\"\\n \");\n return sig;\n }\n\n return undefined;\n}\n\n/**\n * Extracts parameter and return types from a TypeScript function signature.\n *\n * Parses function signatures to extract:\n * - Parameter names and their type annotations\n * - Return type annotation\n *\n * Handles various function declaration styles:\n * - `function name(param: type): ReturnType`\n * - `const name = (param: type): ReturnType => {}`\n * - `export async function name(param: type): Promise<ReturnType>`\n *\n * @param signature - Multi-line function signature text\n * @param params - Array of parameter docs with names already extracted\n * @returns Object with extracted parameter types and return type\n *\n * @internal\n */\nfunction extractTypesFromSignature(\n signature: string,\n _params: ParamDoc[],\n): { paramTypes: string[]; returnType?: string } {\n const paramTypes: string[] = [];\n\n // Extract the parameter list from the signature\n // Match everything between the first `(` and the closing `)` before `=>` or `{`\n const paramListMatch = signature.match(/\\(([^)]*)\\)(?:\\s*:\\s*([^{=>]+))?/s);\n\n if (paramListMatch && paramListMatch[1]) {\n const paramListStr = paramListMatch[1];\n\n // Split by comma, but be careful about nested generics\n const paramParts = splitParameters(paramListStr);\n\n for (const part of paramParts) {\n const trimmed = part.trim();\n if (!trimmed) continue;\n\n // Extract type from \"name: type\" or \"name: type = default\"\n // Handle nested generics properly\n const typeMatch = /:\\s*(.+?)(?:\\s*=|$)/.exec(trimmed);\n if (typeMatch) {\n let typeStr = typeMatch[1].trim();\n // Remove trailing equals and everything after it (default value)\n if (typeStr.includes(\"=\")) {\n typeStr = typeStr.split(\"=\")[0].trim();\n }\n paramTypes.push(typeStr);\n }\n }\n }\n\n // Extract return type\n let returnType: string | undefined;\n\n // Look for return type annotation `: Type` or `: Promise<Type>`\n // This comes after the closing parenthesis\n // Need to handle nested angle brackets in generics\n const returnTypeMatch = signature.match(/\\)\\s*:\\s*(.+?)(?={|$)/);\n if (returnTypeMatch) {\n returnType = returnTypeMatch[1].trim();\n }\n\n return {\n paramTypes,\n returnType,\n };\n}\n\n/**\n * Splits function parameters while respecting nested angle brackets (generics).\n *\n * Handles cases like:\n * - `a: string, b: number` → `[\"a: string\", \"b: number\"]`\n * - `a: Promise<string>, b: Record<string, any>` → `[\"a: Promise<string>\", \"b: Record<string, any>\"]`\n *\n * @param paramListStr - String containing all parameters\n * @returns Array of individual parameter strings\n *\n * @internal\n */\nfunction splitParameters(paramListStr: string): string[] {\n const parts: string[] = [];\n let current = \"\";\n let depth = 0; // Track nested angle brackets\n\n for (const char of paramListStr) {\n if (char === \"<\") {\n depth++;\n current += char;\n } else if (char === \">\") {\n depth--;\n current += char;\n } else if (char === \",\" && depth === 0) {\n parts.push(current);\n current = \"\";\n } else {\n current += char;\n }\n }\n\n if (current) {\n parts.push(current);\n }\n\n return parts;\n}\n\n/**\n * Parses a JSDoc block and the following declaration.\n * Only matches if the declaration is immediately after the JSDoc (with only whitespace/keywords between).\n */\nfunction parseJsdocBlock(\n jsdoc: string,\n declaration: string,\n file: string,\n line: number,\n): DocEntry | null {\n const params: ParamDoc[] = [];\n const examples: string[] = [];\n const tags: Record<string, string> = {};\n let description = \"\";\n let returns: { type: string; description: string } | undefined;\n let isPrivate = false;\n\n // Split lines and remove JSDoc markers but preserve indentation for code examples\n const rawLines = jsdoc.split(\"\\n\").map((l) => l.replace(/^\\s*\\*\\s?/, \"\"));\n const cleanedLines = rawLines.map((l) => l.trim()).filter((l) => l);\n\n let currentExample = \"\";\n let inExample = false;\n let rawLineIndex = 0;\n\n for (const lineText of cleanedLines) {\n // Find the corresponding raw line to get original indentation for examples\n while (rawLineIndex < rawLines.length && rawLines[rawLineIndex].trim() !== lineText) {\n rawLineIndex++;\n }\n const rawLine = rawLineIndex < rawLines.length ? rawLines[rawLineIndex] : lineText;\n rawLineIndex++;\n\n if (lineText.startsWith(\"@\")) {\n if (inExample) {\n examples.push(currentExample.trim());\n currentExample = \"\";\n inExample = false;\n }\n\n const tagMatch = /@(\\w+)\\s*(?:\\{([^}]*)\\})?(.*)/.exec(lineText);\n if (tagMatch) {\n const [, tagName, tagType, tagRest] = tagMatch;\n\n switch (tagName) {\n case \"param\":\n const paramMatch = /(\\w+)\\s*-?\\s*(.*)/.exec(tagRest.trim());\n if (paramMatch) {\n params.push({\n name: paramMatch[1],\n type: tagType || \"unknown\",\n description: paramMatch[2],\n });\n }\n break;\n case \"returns\":\n case \"return\":\n returns = {\n type: tagType || \"unknown\",\n description: tagRest.trim(),\n };\n break;\n case \"example\":\n inExample = true;\n break;\n case \"private\":\n isPrivate = true;\n break;\n default:\n tags[tagName] = tagRest.trim();\n }\n }\n } else if (inExample) {\n // Use raw line to preserve indentation in code examples\n currentExample += rawLine + \"\\n\";\n } else if (!description) {\n description = lineText;\n } else {\n description += \"\\n\" + lineText;\n }\n }\n\n if (inExample && currentExample) {\n examples.push(currentExample.trim());\n }\n\n // Only look at the first few lines after the JSDoc to find the declaration\n // This prevents module-level JSDoc from matching distant declarations\n const firstFewLines = declaration.split(\"\\n\").slice(0, 5).join(\"\\n\");\n\n let name = \"\";\n let kind: DocEntry[\"kind\"] = \"function\";\n\n // Use anchored patterns to match at the start (after optional whitespace/keywords)\n const ANCHORED_FUNCTION = /^(?:export\\s+)?(?:async\\s+)?function\\s+(\\w+)/;\n const ANCHORED_CONST_FUNC = /^(?:export\\s+)?const\\s+(\\w+)\\s*=\\s*(?:async\\s*)?\\(/;\n const ANCHORED_CLASS = /^(?:export\\s+)?class\\s+(\\w+)/;\n const ANCHORED_INTERFACE = /^(?:export\\s+)?interface\\s+(\\w+)/;\n const ANCHORED_TYPE = /^(?:export\\s+)?type\\s+(\\w+)/;\n\n let declMatch: RegExpExecArray | null;\n\n if ((declMatch = ANCHORED_FUNCTION.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"function\";\n } else if ((declMatch = ANCHORED_CONST_FUNC.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"function\";\n } else if ((declMatch = ANCHORED_CLASS.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"class\";\n } else if ((declMatch = ANCHORED_INTERFACE.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"interface\";\n } else if ((declMatch = ANCHORED_TYPE.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"type\";\n }\n\n if (!name) return null;\n\n // Extract full signature and types from function signature if needed\n let signature: string | undefined;\n if (kind === \"function\") {\n const signatureTypes = extractTypesFromSignature(firstFewLines, params);\n\n // Update params with extracted types if JSDoc types were missing\n if (signatureTypes.paramTypes.length > 0) {\n for (let i = 0; i < params.length && i < signatureTypes.paramTypes.length; i++) {\n if (params[i].type === \"unknown\") {\n params[i].type = signatureTypes.paramTypes[i];\n }\n }\n }\n\n // Update return type if JSDoc return type was missing\n if (signatureTypes.returnType && (!returns || returns.type === \"unknown\")) {\n if (returns) {\n returns.type = signatureTypes.returnType;\n } else {\n returns = {\n type: signatureTypes.returnType,\n description: \"\",\n };\n }\n }\n\n // Extract the complete function signature\n signature = extractFunctionSignature(firstFewLines);\n }\n\n return {\n name,\n kind,\n description,\n params: params.length > 0 ? params : undefined,\n returns,\n examples: examples.length > 0 ? examples : undefined,\n tags: Object.keys(tags).length > 0 ? tags : undefined,\n private: isPrivate,\n file,\n line,\n signature,\n };\n}\n\n/**\n * Generates Markdown documentation from extracted docs.\n */\nexport function generateMarkdown(\n docs: ExtractedDocs[],\n options: ResolvedDocsOptions,\n): Record<string, string> {\n const result: Record<string, string> = {};\n const symbolMap = buildSymbolMap(docs);\n\n if (options.groupBy === \"file\") {\n const docToFile = new Map<ExtractedDocs, string>();\n\n for (const doc of docs) {\n let fileName = path.basename(doc.file, path.extname(doc.file));\n // Avoid conflict with the main index.md\n if (fileName === \"index\") {\n fileName = \"index-module\";\n }\n docToFile.set(doc, fileName);\n\n const markdown = generateFileMarkdown(doc, options, fileName, symbolMap);\n result[`${fileName}.md`] = markdown;\n }\n\n result[\"index.md\"] = generateIndex(docs, docToFile);\n } else {\n const byKind = new Map<string, DocEntry[]>();\n\n for (const doc of docs) {\n for (const entry of doc.entries) {\n const existing = byKind.get(entry.kind) || [];\n existing.push(entry);\n byKind.set(entry.kind, existing);\n }\n }\n\n for (const [kind, entries] of byKind) {\n result[`${kind}s.md`] = generateCategoryMarkdown(kind, entries, options, symbolMap);\n }\n\n result[\"index.md\"] = generateCategoryIndex(byKind);\n }\n\n return result;\n}\n\nfunction generateFileMarkdown(\n doc: ExtractedDocs,\n options: ResolvedDocsOptions,\n currentFileName: string,\n symbolMap: Map<string, SymbolLocation>,\n): string {\n const displayName = path.basename(doc.file);\n let md = `# ${displayName}\\n\\n`;\n\n // Add source link if githubUrl is provided\n if (options.githubUrl) {\n const sourceLink = generateSourceLink(doc.file, options.githubUrl);\n if (sourceLink) {\n md += sourceLink + \"\\n\\n\";\n }\n }\n\n // Pass symbol map for cross-file link resolution\n for (const entry of doc.entries) {\n md += generateEntryMarkdown(entry, options, currentFileName, symbolMap);\n }\n\n return md;\n}\n\nfunction generateEntryMarkdown(\n entry: DocEntry,\n options?: ResolvedDocsOptions,\n currentFileName?: string,\n symbolMap?: Map<string, SymbolLocation>,\n): string {\n let md = `## ${entry.name}\\n\\n`;\n\n md += `\\`${entry.kind}\\`\\n\\n`;\n\n if (entry.description) {\n // Convert symbol links [SymbolName] to markdown links\n const processedDescription =\n currentFileName && symbolMap\n ? convertSymbolLinks(entry.description, currentFileName, symbolMap)\n : entry.description;\n md += `${processedDescription}\\n\\n`;\n }\n\n // Add source link if githubUrl is provided\n if (options?.githubUrl) {\n const sourceLink = generateSourceLink(entry.file, options.githubUrl, entry.line);\n if (sourceLink) {\n md += sourceLink + \"\\n\\n\";\n }\n }\n\n // Add function signature if available\n if (entry.signature && entry.kind === \"function\") {\n md += \"```typescript\\n\";\n md += entry.signature + \"\\n\";\n md += \"```\\n\\n\";\n }\n\n if (entry.params && entry.params.length > 0) {\n md += \"### Parameters\\n\\n\";\n md += \"| Name | Type | Description |\\n\";\n md += \"|------|------|-------------|\\n\";\n for (const param of entry.params) {\n md += `| \\`${param.name}\\` | \\`${param.type}\\` | ${param.description} |\\n`;\n }\n md += \"\\n\";\n }\n\n if (entry.returns) {\n md += \"### Returns\\n\\n\";\n md += `\\`${entry.returns.type}\\` - ${entry.returns.description}\\n\\n`;\n }\n\n if (entry.examples && entry.examples.length > 0) {\n md += \"### Examples\\n\\n\";\n for (const example of entry.examples) {\n md += \"```ts\\n\";\n md += example.replace(/^```\\w*\\n?/, \"\").replace(/\\n?```$/, \"\");\n md += \"\\n```\\n\\n\";\n }\n }\n\n md += \"---\\n\\n\";\n\n return md;\n}\n\nfunction generateIndex(docs: ExtractedDocs[], docToFile?: Map<ExtractedDocs, string>): string {\n let md = \"# API Documentation\\n\\n\";\n md += \"Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\\n\\n\";\n\n md += \"## Modules\\n\\n\";\n\n for (const doc of docs) {\n const displayName = path.basename(doc.file, path.extname(doc.file));\n let fileName = displayName;\n\n if (docToFile && docToFile.has(doc)) {\n fileName = docToFile.get(doc)!;\n } else if (fileName === \"index\") {\n fileName = \"index-module\";\n }\n\n md += `### [${displayName}](./${fileName}.md)\\n\\n`;\n\n for (const entry of doc.entries) {\n const desc = entry.description?.slice(0, 80) || \"\";\n const ellipsis = entry.description && entry.description.length > 80 ? \"...\" : \"\";\n md += `- \\`${entry.kind}\\` **${entry.name}** - ${desc}${ellipsis}\\n`;\n }\n md += \"\\n\";\n }\n\n return md;\n}\n\nfunction generateCategoryMarkdown(\n kind: string,\n entries: DocEntry[],\n options: ResolvedDocsOptions,\n symbolMap: Map<string, SymbolLocation>,\n): string {\n const categoryFileName = `${kind}s`;\n let md = `# ${kind.charAt(0).toUpperCase() + kind.slice(1)}s\\n\\n`;\n\n for (const entry of entries) {\n md += generateEntryMarkdown(entry, options, categoryFileName, symbolMap);\n }\n\n return md;\n}\n\nfunction generateCategoryIndex(byKind: Map<string, DocEntry[]>): string {\n let md = \"# API Documentation\\n\\n\";\n md += \"Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\\n\\n\";\n\n for (const [kind, entries] of byKind) {\n const kindTitle = kind.charAt(0).toUpperCase() + kind.slice(1) + \"s\";\n md += `## [${kindTitle}](./${kind}s.md)\\n\\n`;\n\n for (const entry of entries) {\n const desc = entry.description?.slice(0, 60) || \"\";\n md += `- **${entry.name}** - ${desc}...\\n`;\n }\n md += \"\\n\";\n }\n\n return md;\n}\n\n/**\n * Symbol location info for cross-file linking.\n */\ninterface SymbolLocation {\n name: string;\n file: string;\n fileName: string;\n}\n\n/**\n * Converts symbol links [SymbolName] to markdown links.\n *\n * Processes description text to convert cargo-docs-style symbol references\n * `[SymbolName]` into clickable markdown links pointing to the appropriate\n * documentation page.\n *\n * ## Examples\n *\n * Input: \"See [transformMarkdown] for usage\" (same file)\n * Output: \"See [transformMarkdown](#transformmarkdown) for usage\"\n *\n * Input: \"Uses [NavItem] interface\" (different file: types.ts)\n * Output: \"Uses [NavItem](./types.md#navitem) interface\"\n *\n * @param text - Description text containing symbol references\n * @param currentFileName - Current file name (without extension) for same-file detection\n * @param symbolMap - Map of symbol names to their file locations\n * @returns Text with symbol references converted to markdown links\n *\n * @internal\n */\nfunction convertSymbolLinks(\n text: string,\n currentFileName: string,\n symbolMap: Map<string, SymbolLocation>,\n): string {\n // Match [SymbolName] pattern where SymbolName starts with uppercase or underscore\n // Negative lookahead (?!\\() ensures we don't match [Name] that's already part of [Name](url)\n return text.replace(/\\[([A-Z_]\\w*)\\](?!\\()/g, (match, symbolName) => {\n const location = symbolMap.get(symbolName);\n if (!location) {\n // Symbol not found, keep original text\n return match;\n }\n\n if (location.fileName === currentFileName) {\n // Same file - use anchor only\n return `[${symbolName}](#${symbolName.toLowerCase()})`;\n } else {\n // Different file - use cross-file link\n return `[${symbolName}](./${location.fileName}.md#${symbolName.toLowerCase()})`;\n }\n });\n}\n\n/**\n * Builds a map of all symbols to their file locations.\n */\nfunction buildSymbolMap(docs: ExtractedDocs[]): Map<string, SymbolLocation> {\n const map = new Map<string, SymbolLocation>();\n\n for (const doc of docs) {\n let fileName = path.basename(doc.file, path.extname(doc.file));\n if (fileName === \"index\") {\n fileName = \"index-module\";\n }\n\n for (const entry of doc.entries) {\n map.set(entry.name, {\n name: entry.name,\n file: doc.file,\n fileName,\n });\n }\n }\n\n return map;\n}\n\n/**\n * Writes generated documentation to the output directory.\n */\nexport async function writeDocs(\n docs: Record<string, string>,\n outDir: string,\n extractedDocs?: ExtractedDocs[],\n options?: ResolvedDocsOptions,\n): Promise<void> {\n await fs.promises.mkdir(outDir, { recursive: true });\n\n for (const [fileName, content] of Object.entries(docs)) {\n const filePath = path.join(outDir, fileName);\n await fs.promises.writeFile(filePath, content, \"utf-8\");\n }\n\n // Generate and write navigation metadata if enabled\n if (extractedDocs && options?.generateNav && options.groupBy === \"file\") {\n const navItems = generateNavMetadata(extractedDocs, \"/api\");\n const navCode = generateNavCode(navItems, \"apiNav\");\n const navFilePath = path.join(outDir, \"nav.ts\");\n await fs.promises.writeFile(navFilePath, navCode, \"utf-8\");\n }\n}\n\n/**\n * Resolves docs options with defaults.\n */\n/**\n * Generates a GitHub source link for a file and optional line number.\n *\n * @param filePath - Full path to the source file\n * @param githubUrl - Base GitHub repository URL\n * @param lineNumber - Optional line number to link to\n * @returns Markdown link to source code\n */\nfunction generateSourceLink(filePath: string, githubUrl: string, lineNumber?: number): string {\n // Convert absolute path to relative path from repository root\n // Match common project directory patterns: npm/, packages/, crates/, src/\n const relativePath = filePath.replace(/^.*?\\/(npm|packages|crates|src)\\//, \"$1/\");\n\n const fragment = lineNumber ? `#L${lineNumber}` : \"\";\n const link = `${githubUrl}/blob/main/${relativePath}${fragment}`;\n\n return `**[Source](${link})**`;\n}\n\nexport function resolveDocsOptions(\n options: import(\"./types\").DocsOptions | false | undefined,\n): ResolvedDocsOptions | false {\n if (options === false) {\n return false;\n }\n\n const opts = options || {};\n\n return {\n enabled: opts.enabled ?? true,\n src: opts.src ?? [\"./src\"],\n out: opts.out ?? \"docs/api\",\n include: opts.include ?? [\"**/*.ts\", \"**/*.tsx\"],\n exclude: opts.exclude ?? [\"**/*.test.*\", \"**/*.spec.*\", \"node_modules\"],\n format: opts.format ?? \"markdown\",\n private: opts.private ?? false,\n toc: false,\n groupBy: opts.groupBy ?? \"file\",\n githubUrl: opts.githubUrl,\n generateNav: opts.generateNav ?? true,\n };\n}\n","/**\n * HTML → PNG renderer using Chromium screenshots via Playwright.\n */\n\nimport * as path from \"path\";\nimport type { Page } from \"playwright\";\n\n/**\n * Wraps template HTML in a minimal document with viewport locked to given dimensions.\n */\nfunction wrapHtml(bodyHtml: string, width: number, height: number, useBaseUrl: boolean): string {\n const baseTag = useBaseUrl ? `\\n<base href=\"http://localhost/\">` : \"\";\n return `<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">${baseTag}\n<style>\n* { margin: 0; padding: 0; box-sizing: border-box; }\nhtml, body { width: ${width}px; height: ${height}px; overflow: hidden; }\n</style>\n</head>\n<body>${bodyHtml}</body>\n</html>`;\n}\n\n/**\n * Renders an HTML string to a PNG buffer using Chromium.\n *\n * @param page - Playwright page instance\n * @param html - HTML string from template function\n * @param width - Image width\n * @param height - Image height\n * @param publicDir - Optional public directory for serving local assets (images, fonts, etc.)\n * @returns PNG buffer\n */\nexport async function renderHtmlToPng(\n page: Page,\n html: string,\n width: number,\n height: number,\n publicDir?: string,\n): Promise<Buffer> {\n await page.setViewportSize({ width, height });\n\n // Serve local assets from the public directory\n if (publicDir) {\n const fs = await import(\"fs/promises\");\n await page.route(\"**/*\", async (route) => {\n const url = new URL(route.request().url());\n // Only intercept paths that look like local assets (not data: or blob:)\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n await route.continue();\n return;\n }\n const filePath = path.join(publicDir, url.pathname);\n try {\n const body = await fs.readFile(filePath);\n const ext = path.extname(filePath).toLowerCase();\n const mimeTypes: Record<string, string> = {\n \".svg\": \"image/svg+xml\",\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".woff\": \"font/woff\",\n \".woff2\": \"font/woff2\",\n \".ttf\": \"font/ttf\",\n \".css\": \"text/css\",\n \".js\": \"application/javascript\",\n };\n await route.fulfill({\n body,\n contentType: mimeTypes[ext] || \"application/octet-stream\",\n });\n } catch {\n await route.continue();\n }\n });\n }\n\n const fullHtml = wrapHtml(html, width, height, !!publicDir);\n await page.setContent(fullHtml, { waitUntil: \"networkidle\" });\n\n const screenshot = await page.screenshot({\n type: \"png\",\n clip: { x: 0, y: 0, width, height },\n });\n\n return Buffer.from(screenshot);\n}\n","/**\n * Chromium browser session with automatic cleanup via Explicit Resource Management.\n *\n * Usage:\n * await using session = await openBrowser();\n * const png = await session.renderPage(html, 1200, 630);\n * // browser.close() is called automatically when session goes out of scope\n */\n\nimport type { Page } from \"playwright\";\nimport { renderHtmlToPng } from \"./renderer\";\n\n/**\n * A browser session that can render HTML pages to PNG.\n * Implements AsyncDisposable for automatic cleanup via `await using`.\n */\nexport interface OgBrowserSession extends AsyncDisposable {\n renderPage(html: string, width: number, height: number, publicDir?: string): Promise<Buffer>;\n}\n\n/**\n * Opens a Chromium browser and returns a session for rendering OG images.\n * Returns null if Playwright/Chromium is not available.\n *\n * The session implements AsyncDisposable — use `await using` for automatic cleanup:\n * ```ts\n * await using session = await openBrowser();\n * if (!session) return;\n * const png = await session.renderPage(html, 1200, 630);\n * ```\n */\nexport async function openBrowser(): Promise<OgBrowserSession | null> {\n try {\n const { chromium } = await import(\"playwright\");\n const browser = await chromium.launch({\n headless: true,\n args: [\n \"--no-sandbox\",\n \"--disable-setuid-sandbox\",\n \"--disable-dev-shm-usage\",\n \"--disable-gpu\",\n ],\n });\n\n return {\n async renderPage(\n html: string,\n width: number,\n height: number,\n publicDir?: string,\n ): Promise<Buffer> {\n const page: Page = await browser.newPage();\n try {\n return await renderHtmlToPng(page, html, width, height, publicDir);\n } finally {\n await page.close();\n }\n },\n\n async [Symbol.asyncDispose]() {\n try {\n await browser.close();\n } catch {\n // Ignore close errors\n }\n },\n };\n } catch (err) {\n console.warn(\n \"[ox-content:og-image] Chromium not available, skipping OG image generation.\",\n err instanceof Error ? err.message : err,\n );\n return null;\n }\n}\n","/**\n * Default OG image template.\n *\n * Uses inline HTML/CSS for a gradient background with title, description,\n * siteName, and tags. No external dependencies required.\n */\n\nimport type { OgImageTemplateFn, OgImageTemplateProps } from \"./types\";\n\n/**\n * Escapes HTML special characters.\n */\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\");\n}\n\n/**\n * Returns the built-in default template function.\n */\nexport function getDefaultTemplate(): OgImageTemplateFn {\n return function defaultTemplate(props: OgImageTemplateProps): string {\n const { title, description, siteName, tags } = props;\n\n const tagsHtml = tags?.length\n ? `<div style=\"display:flex;gap:8px;flex-wrap:wrap;margin-top:auto;\">\n ${tags.map((tag) => `<span style=\"background:rgba(255,255,255,0.15);color:#e2e8f0;padding:4px 12px;border-radius:16px;font-size:14px;\">${escapeHtml(tag)}</span>`).join(\"\")}\n </div>`\n : \"\";\n\n return `<div style=\"width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;padding:60px 80px;background:linear-gradient(135deg,#1a1a2e 0%,#16213e 50%,#0f3460 100%);font-family:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;\">\n <div style=\"display:flex;flex-direction:column;gap:16px;flex:1;justify-content:center;\">\n <h1 style=\"font-size:56px;font-weight:700;color:#ffffff;line-height:1.2;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;\">${escapeHtml(title)}</h1>\n ${description ? `<p style=\"font-size:24px;color:#94a3b8;line-height:1.5;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;\">${escapeHtml(description)}</p>` : \"\"}\n </div>\n <div style=\"display:flex;align-items:flex-end;justify-content:space-between;margin-top:auto;\">\n ${siteName ? `<span style=\"font-size:20px;color:#64748b;font-weight:500;\">${escapeHtml(siteName)}</span>` : \"\"}\n ${tagsHtml}\n </div>\n</div>`;\n };\n}\n","/**\n * Content-hash based caching for OG images.\n *\n * Uses SHA256 of (template source + props + options) to determine\n * if a re-render is needed. Cache dir: .cache/og-images\n */\n\nimport * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport * as crypto from \"crypto\";\n\n/**\n * Computes a cache key from template + props + options.\n */\nexport function computeCacheKey(\n templateSource: string,\n props: Record<string, unknown>,\n width: number,\n height: number,\n): string {\n const data = JSON.stringify({ templateSource, props, width, height });\n return crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\n/**\n * Checks if a cached PNG exists for the given key.\n * Returns the cached file path if found, null otherwise.\n */\nexport async function getCached(cacheDir: string, key: string): Promise<Buffer | null> {\n const filePath = path.join(cacheDir, `${key}.png`);\n try {\n return await fs.readFile(filePath);\n } catch {\n return null;\n }\n}\n\n/**\n * Writes a PNG buffer to the cache.\n */\nexport async function writeCache(cacheDir: string, key: string, png: Buffer): Promise<void> {\n await fs.mkdir(cacheDir, { recursive: true });\n const filePath = path.join(cacheDir, `${key}.png`);\n await fs.writeFile(filePath, png);\n}\n","/**\n * Public API for Chromium-based OG image generation.\n *\n * Orchestrates browser lifecycle, template resolution, caching,\n * and batch rendering with concurrency control.\n */\n\nimport * as path from \"path\";\nimport * as crypto from \"crypto\";\nimport { openBrowser } from \"./browser\";\nimport type { OgBrowserSession } from \"./browser\";\nimport { getDefaultTemplate } from \"./template\";\nimport { computeCacheKey, getCached, writeCache } from \"./cache\";\nimport type {\n OgImageOptions,\n ResolvedOgImageOptions,\n OgImageTemplateProps,\n OgImageTemplateFn,\n} from \"./types\";\n\nexport type {\n OgImageOptions,\n ResolvedOgImageOptions,\n OgImageTemplateProps,\n OgImageTemplateFn,\n} from \"./types\";\n\nexport type { OgBrowserSession } from \"./browser\";\n\n/**\n * Resolves user-provided OG image options with defaults.\n */\nexport function resolveOgImageOptions(options: OgImageOptions | undefined): ResolvedOgImageOptions {\n return {\n template: options?.template,\n vuePlugin: options?.vuePlugin ?? \"vitejs\",\n width: options?.width ?? 1200,\n height: options?.height ?? 630,\n cache: options?.cache ?? true,\n concurrency: options?.concurrency ?? 1,\n };\n}\n\n/**\n * A single page entry for batch OG image generation.\n */\nexport interface OgImagePageEntry {\n /** Props to pass to the template */\n props: OgImageTemplateProps;\n /** Absolute path to write the output PNG */\n outputPath: string;\n}\n\n/**\n * Result of OG image generation for a single page.\n */\nexport interface OgImageResult {\n outputPath: string;\n cached: boolean;\n error?: string;\n}\n\n/**\n * Resolves the template function from options.\n *\n * Dispatches by file extension:\n * - `.vue` → Vue SFC (SSR via vue/server-renderer)\n * - `.svelte` → Svelte SFC (SSR via svelte/server)\n * - `.tsx`/`.jsx` → React Server Component (SSR via react-dom/server)\n * - others → TypeScript template (direct function export)\n */\nasync function resolveTemplate(\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<OgImageTemplateFn> {\n if (!options.template) {\n return getDefaultTemplate();\n }\n\n const templatePath = path.resolve(root, options.template);\n\n // Verify file exists\n const fs = await import(\"fs/promises\");\n try {\n await fs.access(templatePath);\n } catch {\n throw new Error(`[ox-content:og-image] Template file not found: ${templatePath}`);\n }\n\n const ext = path.extname(templatePath).toLowerCase();\n\n switch (ext) {\n case \".vue\":\n return resolveVueTemplate(templatePath, options, root);\n case \".svelte\":\n return resolveSvelteTemplate(templatePath, root);\n case \".tsx\":\n case \".jsx\":\n return resolveReactTemplate(templatePath, root);\n default:\n return resolveTsTemplate(templatePath, options, root);\n }\n}\n\n/**\n * Resolves a plain TypeScript template (existing behavior).\n */\nasync function resolveTsTemplate(\n templatePath: string,\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<OgImageTemplateFn> {\n const fs = await import(\"fs/promises\");\n const { rolldown } = await import(\"rolldown\");\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n await fs.mkdir(cacheDir, { recursive: true });\n\n const outfile = path.join(cacheDir, \"_template.mjs\");\n\n const bundle = await rolldown({\n input: templatePath,\n platform: \"node\",\n });\n await bundle.write({\n file: outfile,\n format: \"esm\",\n });\n await bundle.close();\n\n const mod = await import(`${outfile}?t=${Date.now()}`);\n const templateFn = mod.default;\n\n if (typeof templateFn !== \"function\") {\n throw new Error(\n `[ox-content:og-image] Template must default-export a function: ${options.template}`,\n );\n }\n\n return templateFn as OgImageTemplateFn;\n}\n\n/**\n * Resolves a Vue SFC template via SSR.\n *\n * Compiles the SFC with @vue/compiler-sfc (or @vizejs/vite-plugin),\n * bundles with rolldown, then wraps with createSSRApp + renderToString.\n */\nasync function resolveVueTemplate(\n templatePath: string,\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<OgImageTemplateFn> {\n const fs = await import(\"fs/promises\");\n const { rolldown } = await import(\"rolldown\");\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n await fs.mkdir(cacheDir, { recursive: true });\n\n const outfile = path.join(cacheDir, \"_template_vue.mjs\");\n\n const plugins =\n options.vuePlugin === \"vizejs\" ? await getVizejsPlugin() : [createVueCompilerPlugin()];\n\n const bundle = await rolldown({\n input: templatePath,\n platform: \"node\",\n external: [\"vue\", \"vue/server-renderer\"],\n plugins,\n });\n await bundle.write({\n file: outfile,\n format: \"esm\",\n });\n await bundle.close();\n\n const mod = await import(`${outfile}?t=${Date.now()}`);\n const Component = mod.default;\n\n if (!Component) {\n throw new Error(\n `[ox-content:og-image] Vue template must have a default export: ${templatePath}`,\n );\n }\n\n // Extract CSS from SFC <style> blocks (Vue SSR does not include styles).\n // OG image templates render in complete isolation, so scoping is unnecessary.\n // We use raw CSS content to avoid scope ID mismatches between compilers\n // (e.g., vizejs and @vue/compiler-sfc may produce different scope hashes).\n let extractedCss = ((mod as Record<string, unknown>).__vize_css__ as string) || \"\";\n if (!extractedCss) {\n try {\n let compilerSfc: typeof import(\"@vue/compiler-sfc\");\n try {\n compilerSfc = await import(\"@vue/compiler-sfc\");\n } catch {\n compilerSfc = null as never;\n }\n if (compilerSfc) {\n const sfcSource = await fs.readFile(templatePath, \"utf-8\");\n const { descriptor } = compilerSfc.parse(sfcSource, { filename: templatePath });\n for (const style of descriptor.styles) {\n extractedCss += style.content;\n }\n }\n } catch {\n // CSS extraction is best-effort\n }\n }\n\n // Import Vue SSR utilities\n const { createSSRApp } = await import(\"vue\");\n const { renderToString } = await import(\"vue/server-renderer\");\n\n return async (props) => {\n const app = createSSRApp(Component, props);\n const html = await renderToString(app);\n if (extractedCss) {\n return `<style>${extractedCss}</style>${html}`;\n }\n return html;\n };\n}\n\n/**\n * Creates a rolldown plugin that compiles Vue SFCs using @vue/compiler-sfc.\n */\nfunction createVueCompilerPlugin(): import(\"rolldown\").Plugin {\n return {\n name: \"ox-content-vue-sfc\",\n async transform(code, id) {\n if (!id.endsWith(\".vue\")) return null;\n\n let compilerSfc: typeof import(\"@vue/compiler-sfc\");\n try {\n compilerSfc = await import(\"@vue/compiler-sfc\");\n } catch {\n throw new Error(\n \"[ox-content:og-image] @vue/compiler-sfc is required for .vue templates. \" +\n \"Install it with: pnpm add -D @vue/compiler-sfc\",\n );\n }\n\n const { descriptor } = compilerSfc.parse(code, { filename: id });\n\n // Compile <script setup> or <script>\n let scriptCode: string;\n if (descriptor.scriptSetup || descriptor.script) {\n const compiled = compilerSfc.compileScript(descriptor, {\n id,\n inlineTemplate: true,\n });\n scriptCode = compiled.content;\n } else {\n // Template-only SFC: compile template separately\n if (!descriptor.template) {\n throw new Error(\n `[ox-content:og-image] Vue SFC must have a <template> or <script>: ${id}`,\n );\n }\n const templateResult = compilerSfc.compileTemplate({\n source: descriptor.template.content,\n filename: id,\n id,\n });\n if (templateResult.errors.length > 0) {\n throw new Error(\n `[ox-content:og-image] Vue template compilation errors in ${id}: ${templateResult.errors.map(String).join(\", \")}`,\n );\n }\n scriptCode = `${templateResult.code}\\nexport default { render }`;\n }\n\n // Determine if the compiled output contains TypeScript\n const isTs = !!(descriptor.scriptSetup?.lang === \"ts\" || descriptor.script?.lang === \"ts\");\n\n return { code: scriptCode, moduleType: isTs ? \"ts\" : \"js\" };\n },\n };\n}\n\n/**\n * Loads @vizejs/vite-plugin as a rolldown plugin for Vue SFC compilation.\n */\nasync function getVizejsPlugin(): Promise<import(\"rolldown\").Plugin[]> {\n try {\n const vizejs = await import(\"@vizejs/vite-plugin\");\n const plugin = vizejs.default?.() ?? vizejs;\n return Array.isArray(plugin) ? plugin : [plugin];\n } catch {\n throw new Error(\n \"[ox-content:og-image] @vizejs/vite-plugin is required when vuePlugin is 'vizejs'. \" +\n \"Install it with: pnpm add -D @vizejs/vite-plugin\",\n );\n }\n}\n\n/**\n * Resolves a Svelte SFC template via SSR.\n *\n * Compiles the SFC with svelte/compiler (server mode + runes),\n * bundles with rolldown, then wraps with svelte/server render().\n */\nasync function resolveSvelteTemplate(\n templatePath: string,\n root: string,\n): Promise<OgImageTemplateFn> {\n const fs = await import(\"fs/promises\");\n const { rolldown } = await import(\"rolldown\");\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n await fs.mkdir(cacheDir, { recursive: true });\n\n const outfile = path.join(cacheDir, \"_template_svelte.mjs\");\n\n const bundle = await rolldown({\n input: templatePath,\n platform: \"node\",\n external: [\"svelte\", \"svelte/server\", \"svelte/internal\", \"svelte/internal/server\"],\n plugins: [createSvelteCompilerPlugin()],\n });\n await bundle.write({\n file: outfile,\n format: \"esm\",\n });\n await bundle.close();\n\n const mod = await import(`${outfile}?t=${Date.now()}`);\n const Component = mod.default;\n\n if (!Component) {\n throw new Error(\n `[ox-content:og-image] Svelte template must have a default export: ${templatePath}`,\n );\n }\n\n // Import Svelte SSR utility\n const { render } = (await import(\"svelte/server\")) as {\n render: (component: unknown, options: { props: Record<string, unknown> }) => { body: string };\n };\n\n return async (props) => {\n const { body } = render(Component, { props });\n return body;\n };\n}\n\n/**\n * Creates a rolldown plugin that compiles Svelte SFCs using svelte/compiler.\n */\nfunction createSvelteCompilerPlugin(): import(\"rolldown\").Plugin {\n return {\n name: \"ox-content-svelte-sfc\",\n async transform(code, id) {\n if (!id.endsWith(\".svelte\")) return null;\n\n let svelteCompiler: typeof import(\"svelte/compiler\");\n try {\n svelteCompiler = await import(\"svelte/compiler\");\n } catch {\n throw new Error(\n \"[ox-content:og-image] svelte is required for .svelte templates. \" +\n \"Install it with: pnpm add -D svelte\",\n );\n }\n\n const result = svelteCompiler.compile(code, {\n generate: \"server\",\n runes: true,\n filename: id,\n });\n\n return { code: result.js.code };\n },\n };\n}\n\n/**\n * Resolves a React (.tsx/.jsx) template via SSR.\n *\n * Bundles with rolldown (JSX transform), then wraps with\n * react-dom/server renderToReadableStream for async Server Component support.\n */\nasync function resolveReactTemplate(\n templatePath: string,\n root: string,\n): Promise<OgImageTemplateFn> {\n const fs = await import(\"fs/promises\");\n const { rolldown } = await import(\"rolldown\");\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n await fs.mkdir(cacheDir, { recursive: true });\n\n const outfile = path.join(cacheDir, \"_template_react.mjs\");\n\n const bundle = await rolldown({\n input: templatePath,\n platform: \"node\",\n external: [\n \"react\",\n \"react/jsx-runtime\",\n \"react/jsx-dev-runtime\",\n \"react-dom\",\n \"react-dom/server\",\n ],\n transform: {\n jsx: \"react-jsx\",\n },\n });\n await bundle.write({\n file: outfile,\n format: \"esm\",\n });\n await bundle.close();\n\n const mod = await import(`${outfile}?t=${Date.now()}`);\n const Component = mod.default;\n\n if (!Component) {\n throw new Error(\n `[ox-content:og-image] React template must have a default export: ${templatePath}`,\n );\n }\n\n // Import React SSR utilities\n let React: typeof import(\"react\");\n let ReactDOMServer: typeof import(\"react-dom/server\");\n try {\n React = await import(\"react\");\n ReactDOMServer = await import(\"react-dom/server\");\n } catch {\n throw new Error(\n \"[ox-content:og-image] react and react-dom are required for .tsx/.jsx templates. \" +\n \"Install them with: pnpm add -D react react-dom\",\n );\n }\n\n return async (props) => {\n const element = React.createElement(Component, props);\n // Use renderToReadableStream for async Server Component support\n const stream = await ReactDOMServer.renderToReadableStream(element);\n const reader = stream.getReader();\n const chunks: Uint8Array[] = [];\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n chunks.push(value);\n }\n const decoder = new TextDecoder();\n return (\n chunks.map((chunk) => decoder.decode(chunk, { stream: true })).join(\"\") + decoder.decode()\n );\n };\n}\n\n/**\n * Computes a stable template source identifier for cache keys.\n *\n * For custom templates, hashes the file content so cache invalidates\n * when the template changes. For the default template, returns a fixed string.\n */\nasync function computeTemplateSource(\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<string> {\n if (!options.template) {\n return \"__default__\";\n }\n\n const fs = await import(\"fs/promises\");\n const templatePath = path.resolve(root, options.template);\n const content = await fs.readFile(templatePath, \"utf-8\");\n return crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\n/**\n * Generates OG images for a batch of pages.\n *\n * Manages the full lifecycle: resolve template → launch browser (with `using`) →\n * render each page (with caching and concurrency).\n *\n * All errors are non-fatal: failures are reported in results but never throw.\n */\nexport async function generateOgImages(\n pages: OgImagePageEntry[],\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<OgImageResult[]> {\n if (pages.length === 0) return [];\n\n // Resolve template\n const templateFn = await resolveTemplate(options, root);\n\n // Compute template source for cache key\n const templateSource = await computeTemplateSource(options, root);\n\n // Cache directory\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n\n // Try to serve all from cache first if caching is enabled\n if (options.cache) {\n const allCached = await tryServeAllFromCache(pages, templateSource, options, cacheDir);\n if (allCached) return allCached;\n }\n\n // Launch browser\n await using session = await openBrowser();\n if (!session) {\n return pages.map((p) => ({\n outputPath: p.outputPath,\n cached: false,\n error: \"Chromium not available\",\n }));\n }\n\n const results: OgImageResult[] = [];\n\n // Resolve public directory for serving local assets in templates\n const publicDir = path.join(root, \"public\");\n\n // Process pages with concurrency control\n const concurrency = Math.max(1, options.concurrency);\n\n for (let i = 0; i < pages.length; i += concurrency) {\n const batch = pages.slice(i, i + concurrency);\n const batchResults = await Promise.all(\n batch.map((entry) =>\n renderSinglePage(entry, templateFn, templateSource, options, cacheDir, session, publicDir),\n ),\n );\n results.push(...batchResults);\n }\n\n return results;\n}\n\n/**\n * Tries to serve all pages from cache.\n * Returns results if ALL pages are cached, null otherwise.\n */\nasync function tryServeAllFromCache(\n pages: OgImagePageEntry[],\n templateSource: string,\n options: ResolvedOgImageOptions,\n cacheDir: string,\n): Promise<OgImageResult[] | null> {\n const fs = await import(\"fs/promises\");\n const results: OgImageResult[] = [];\n\n for (const entry of pages) {\n const key = computeCacheKey(\n templateSource,\n entry.props as unknown as Record<string, unknown>,\n options.width,\n options.height,\n );\n const cached = await getCached(cacheDir, key);\n if (!cached) return null; // At least one miss, need browser\n\n // Write cached file to output\n await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });\n await fs.writeFile(entry.outputPath, cached);\n results.push({ outputPath: entry.outputPath, cached: true });\n }\n\n return results;\n}\n\n/**\n * Renders a single page to PNG, with cache support.\n */\nasync function renderSinglePage(\n entry: OgImagePageEntry,\n templateFn: OgImageTemplateFn,\n templateSource: string,\n options: ResolvedOgImageOptions,\n cacheDir: string,\n session: OgBrowserSession,\n publicDir?: string,\n): Promise<OgImageResult> {\n const fs = await import(\"fs/promises\");\n\n try {\n // Check cache\n if (options.cache) {\n const key = computeCacheKey(\n templateSource,\n entry.props as unknown as Record<string, unknown>,\n options.width,\n options.height,\n );\n const cached = await getCached(cacheDir, key);\n if (cached) {\n await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });\n await fs.writeFile(entry.outputPath, cached);\n return { outputPath: entry.outputPath, cached: true };\n }\n }\n\n // Render template to HTML (may be async for SFC templates)\n const html = await templateFn(entry.props);\n\n // Render HTML to PNG via session (page create/close handled internally)\n const png = await session.renderPage(html, options.width, options.height, publicDir);\n\n // Write output\n await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });\n await fs.writeFile(entry.outputPath, png);\n\n // Write cache\n if (options.cache) {\n const key = computeCacheKey(\n templateSource,\n entry.props as unknown as Record<string, unknown>,\n options.width,\n options.height,\n );\n await writeCache(cacheDir, key, png);\n }\n\n return { outputPath: entry.outputPath, cached: false };\n } catch (err) {\n return {\n outputPath: entry.outputPath,\n cached: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n}\n","/**\n * ox-content Built-in Plugins\n *\n * All plugins are designed with No-JavaScript-First principle.\n * They generate static HTML at build time and require no client-side JS.\n */\n\nexport { transformTabs, generateTabsCSS, resetTabGroupCounter } from \"./tabs\";\n\nexport { transformYouTube, extractVideoId, type YouTubeOptions } from \"./youtube\";\n\nexport {\n transformGitHub,\n fetchRepoData,\n collectGitHubRepos,\n prefetchGitHubRepos,\n type GitHubRepoData,\n type GitHubOptions,\n} from \"./github\";\n\nexport {\n transformOgp,\n fetchOgpData,\n collectOgpUrls,\n prefetchOgpData,\n type OgpData,\n type OgpOptions,\n} from \"./ogp\";\n\nexport { transformMermaidStatic, mermaidClientScript, type MermaidOptions } from \"./mermaid\";\n\n/**\n * Transform all plugin components in HTML.\n * Call this during SSG build to process all plugins at once.\n */\nexport interface TransformAllOptions {\n tabs?: boolean;\n youtube?: boolean;\n github?: boolean;\n ogp?: boolean;\n mermaid?: boolean;\n githubToken?: string;\n}\n\n/**\n * Transform all enabled plugins in HTML content.\n */\nexport async function transformAllPlugins(\n html: string,\n options: TransformAllOptions = {},\n): Promise<string> {\n const {\n tabs = true,\n youtube = true,\n github = true,\n ogp = true,\n mermaid = true,\n githubToken,\n } = options;\n\n let result = html;\n\n // Order matters: process in dependency order\n\n // 1. Tabs (no external dependencies)\n if (tabs) {\n const { transformTabs } = await import(\"./tabs\");\n result = await transformTabs(result);\n }\n\n // 2. YouTube (no external dependencies)\n if (youtube) {\n const { transformYouTube } = await import(\"./youtube\");\n result = await transformYouTube(result);\n }\n\n // 3. GitHub (requires API calls)\n if (github) {\n const { transformGitHub } = await import(\"./github\");\n result = await transformGitHub(result, undefined, { token: githubToken });\n }\n\n // 4. OGP (requires fetch calls)\n if (ogp) {\n const { transformOgp } = await import(\"./ogp\");\n result = await transformOgp(result);\n }\n\n // 5. Mermaid (requires mermaid library)\n if (mermaid) {\n const { transformMermaidStatic } = await import(\"./mermaid\");\n result = await transformMermaidStatic(result);\n }\n\n return result;\n}\n","/**\n * Island Parser\n *\n * Detects <Island> components in HTML and transforms them\n * into hydration-ready elements with data attributes.\n */\n\nimport { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport rehypeStringify from \"rehype-stringify\";\nimport type { Root, Element } from \"hast\";\n\nexport type LoadStrategy = \"eager\" | \"idle\" | \"visible\" | \"media\";\n\nexport interface IslandInfo {\n component: string;\n load: LoadStrategy;\n mediaQuery?: string;\n props: Record<string, unknown>;\n}\n\nexport interface ParseIslandsResult {\n html: string;\n islands: IslandInfo[];\n}\n\n/**\n * Get element attribute value.\n */\nfunction getAttribute(el: Element, name: string): string | undefined {\n const value = el.properties?.[name];\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.join(\" \");\n return undefined;\n}\n\n/**\n * Parse JSX-style props from attributes.\n */\nfunction parseProps(el: Element): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n\n if (!el.properties) return props;\n\n for (const [key, value] of Object.entries(el.properties)) {\n // Skip special attributes\n if ([\"load\", \"media\", \"className\", \"class\"].includes(key)) continue;\n\n // Handle JSX-style props like {0} or {true}\n if (typeof value === \"string\") {\n // Try to parse as JSON/JS value if it looks like one\n const trimmed = value.trim();\n if (trimmed.startsWith(\"{\") && trimmed.endsWith(\"}\")) {\n const inner = trimmed.slice(1, -1);\n try {\n // Try JSON parse first\n props[key] = JSON.parse(inner);\n } catch {\n // Try evaluating simple expressions\n if (inner === \"true\") props[key] = true;\n else if (inner === \"false\") props[key] = false;\n else if (inner === \"null\") props[key] = null;\n else if (!Number.isNaN(Number(inner))) props[key] = Number(inner);\n else props[key] = value;\n }\n } else {\n props[key] = value;\n }\n } else if (typeof value === \"number\" || typeof value === \"boolean\") {\n props[key] = value;\n } else if (Array.isArray(value)) {\n props[key] = value;\n }\n }\n\n return props;\n}\n\n/**\n * Find the component element inside <Island>.\n */\nfunction findComponentElement(children: Element[\"children\"]): Element | null {\n for (const child of children) {\n if (child.type === \"element\") {\n // Skip text/whitespace, look for actual component\n if (child.tagName !== \"br\" && child.tagName !== \"span\") {\n return child;\n }\n }\n }\n return null;\n}\n\n/**\n * Get component name from child element.\n */\nfunction getComponentName(el: Element): string {\n // PascalCase tag names are components\n const tagName = el.tagName;\n if (tagName && /^[A-Z]/.test(tagName)) {\n return tagName;\n }\n // Check for data-component attribute\n return getAttribute(el, \"data-component\") || tagName;\n}\n\nlet islandCounter = 0;\n\n/**\n * Reset island counter (for testing).\n */\nexport function resetIslandCounter(): void {\n islandCounter = 0;\n}\n\n/**\n * Rehype plugin to transform Island components.\n */\nfunction rehypeIslands(collectedIslands: IslandInfo[]) {\n return (tree: Root) => {\n const visit = (node: Root | Element) => {\n if (\"children\" in node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n\n if (child.type === \"element\") {\n // Check for <Island> component\n if (child.tagName.toLowerCase() === \"island\") {\n const load = (getAttribute(child, \"load\") as LoadStrategy) || \"eager\";\n const mediaQuery = getAttribute(child, \"media\");\n\n // Find the component inside\n const componentEl = findComponentElement(child.children);\n\n if (componentEl) {\n const componentName = getComponentName(componentEl);\n const componentProps = parseProps(componentEl);\n\n // Collect island info\n const islandInfo: IslandInfo = {\n component: componentName,\n load,\n mediaQuery,\n props: componentProps,\n };\n collectedIslands.push(islandInfo);\n\n // Create island wrapper with data attributes\n const islandId = `ox-island-${islandCounter++}`;\n\n const islandElement: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: {\n id: islandId,\n \"data-ox-island\": componentName,\n \"data-ox-load\": load,\n ...(mediaQuery && { \"data-ox-media\": mediaQuery }),\n \"data-ox-props\": JSON.stringify(componentProps),\n className: [\"ox-island\"],\n },\n children: [\n // Keep original content as fallback/placeholder\n ...componentEl.children,\n ],\n };\n\n node.children[i] = islandElement;\n }\n } else {\n visit(child);\n }\n }\n }\n }\n };\n\n visit(tree);\n };\n}\n\n/**\n * Transform Island components in HTML.\n *\n * Converts:\n * ```html\n * <Island load=\"visible\">\n * <Counter initial={0} />\n * </Island>\n * ```\n *\n * To:\n * ```html\n * <div id=\"ox-island-0\"\n * data-ox-island=\"Counter\"\n * data-ox-load=\"visible\"\n * data-ox-props='{\"initial\":0}'\n * class=\"ox-island\">\n * <!-- fallback content -->\n * </div>\n * ```\n */\nexport async function transformIslands(html: string): Promise<ParseIslandsResult> {\n const islands: IslandInfo[] = [];\n\n const result = await unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeIslands, islands)\n .use(rehypeStringify)\n .process(html);\n\n return {\n html: String(result),\n islands,\n };\n}\n\n/**\n * Check if HTML contains any Island components.\n */\nexport function hasIslands(html: string): boolean {\n return /<island[\\s>]/i.test(html);\n}\n\n/**\n * Extract island info without transforming HTML.\n * Useful for analysis/bundling purposes.\n */\nexport async function extractIslandInfo(html: string): Promise<IslandInfo[]> {\n const { islands } = await transformIslands(html);\n return islands;\n}\n\n/**\n * Generate client-side hydration script.\n * This is a minimal script that imports and initializes islands.\n */\nexport function generateHydrationScript(components: string[]): string {\n if (components.length === 0) return \"\";\n\n const imports = components.map((name) => `import ${name} from './${name}';`).join(\"\\n\");\n\n return `\nimport { initIslands } from '@ox-content/islands';\n${imports}\n\nconst components = {\n ${components.join(\",\\n \")}\n};\n\n// Initialize with your framework's hydration\n// This example uses Vue, adapt for React/Svelte/etc.\nimport { createApp, h } from 'vue';\n\ninitIslands((el, props) => {\n const name = el.dataset.oxIsland;\n const Component = components[name];\n if (!Component) {\n console.warn(\\`[ox-islands] Unknown component: \\${name}\\`);\n return;\n }\n\n const app = createApp({ render: () => h(Component, props) });\n app.mount(el);\n\n return () => app.unmount();\n});\n`;\n}\n","/**\n * Theme API for ox-content SSG\n *\n * Provides VitePress-like theming with default theme + customization.\n */\n\n/**\n * Theme color configuration.\n */\nexport interface ThemeColors {\n /** Primary accent color */\n primary?: string;\n /** Primary color on hover */\n primaryHover?: string;\n /** Background color */\n background?: string;\n /** Alternative background color (sidebar, code blocks) */\n backgroundAlt?: string;\n /** Main text color */\n text?: string;\n /** Muted/secondary text color */\n textMuted?: string;\n /** Border color */\n border?: string;\n /** Code block background color */\n codeBackground?: string;\n /** Code block text color */\n codeText?: string;\n}\n\n/**\n * Theme layout configuration.\n */\nexport interface ThemeLayout {\n /** Sidebar width (CSS value, e.g., \"260px\") */\n sidebarWidth?: string;\n /** Header height (CSS value, e.g., \"60px\") */\n headerHeight?: string;\n /** Maximum content width (CSS value, e.g., \"960px\") */\n maxContentWidth?: string;\n}\n\n/**\n * Theme font configuration.\n */\nexport interface ThemeFonts {\n /** Sans-serif font stack */\n sans?: string;\n /** Monospace font stack */\n mono?: string;\n}\n\n/**\n * Theme header configuration.\n */\nexport interface ThemeHeader {\n /** Logo image URL */\n logo?: string;\n /** Logo width in pixels */\n logoWidth?: number;\n /** Logo height in pixels */\n logoHeight?: number;\n}\n\n/**\n * Theme footer configuration.\n */\nexport interface ThemeFooter {\n /** Footer message (supports HTML) */\n message?: string;\n /** Copyright text (supports HTML) */\n copyright?: string;\n}\n\n/**\n * Social links configuration.\n */\nexport interface SocialLinks {\n /** GitHub URL */\n github?: string;\n /** Twitter/X URL */\n twitter?: string;\n /** Discord URL */\n discord?: string;\n}\n\n/**\n * Embedded HTML content for specific positions in the page layout.\n */\nexport interface ThemeEmbed {\n /** Content to embed into <head> */\n head?: string;\n /** Content before header */\n headerBefore?: string;\n /** Content after header */\n headerAfter?: string;\n /** Content before sidebar navigation */\n sidebarBefore?: string;\n /** Content after sidebar navigation */\n sidebarAfter?: string;\n /** Content before main content */\n contentBefore?: string;\n /** Content after main content */\n contentAfter?: string;\n /** Content before footer */\n footerBefore?: string;\n /** Custom footer content (replaces default footer) */\n footer?: string;\n}\n\n/**\n * Complete theme configuration.\n */\nexport interface ThemeConfig {\n /** Theme name for identification */\n name?: string;\n /** Base theme to extend */\n extends?: ThemeConfig;\n /** Light mode colors (maps to CSS variables) */\n colors?: ThemeColors;\n /** Dark mode colors (maps to CSS variables) */\n darkColors?: ThemeColors;\n /** Font configuration (maps to CSS variables) */\n fonts?: ThemeFonts;\n /** Layout configuration (maps to CSS variables) */\n layout?: ThemeLayout;\n /** Header configuration */\n header?: ThemeHeader;\n /** Footer configuration */\n footer?: ThemeFooter;\n /** Social links configuration */\n socialLinks?: SocialLinks;\n /** Embedded HTML content at specific positions */\n embed?: ThemeEmbed;\n /** Additional custom CSS */\n css?: string;\n /** Additional custom JavaScript */\n js?: string;\n}\n\n/**\n * Resolved theme configuration (after merging with defaults).\n */\nexport interface ResolvedThemeConfig {\n name: string;\n colors: ThemeColors;\n darkColors: ThemeColors;\n fonts: ThemeFonts;\n layout: ThemeLayout;\n header: ThemeHeader;\n footer: ThemeFooter;\n socialLinks: SocialLinks;\n embed: ThemeEmbed;\n css: string;\n js: string;\n}\n\n/**\n * Default theme configuration.\n * Based on the current ox-content SSG styles.\n */\nexport const defaultTheme: ThemeConfig = {\n name: \"default\",\n colors: {\n primary: \"#e04d0a\",\n primaryHover: \"#f5602a\",\n background: \"#ffffff\",\n backgroundAlt: \"#f8f9fa\",\n text: \"#1a1a1a\",\n textMuted: \"#666666\",\n border: \"#e5e7eb\",\n codeBackground: \"#1e293b\",\n codeText: \"#e2e8f0\",\n },\n darkColors: {\n primary: \"#f5714a\",\n primaryHover: \"#ff8a66\",\n background: \"#141414\",\n backgroundAlt: \"#141414\",\n text: \"#e5e5e5\",\n textMuted: \"#a3a3a3\",\n border: \"#2a2a2a\",\n codeBackground: \"#1a1a1a\",\n codeText: \"#e5e5e5\",\n },\n fonts: {\n sans: 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n mono: 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace',\n },\n layout: {\n sidebarWidth: \"260px\",\n headerHeight: \"60px\",\n maxContentWidth: \"960px\",\n },\n header: {\n logo: undefined,\n logoWidth: 28,\n logoHeight: 28,\n },\n footer: {\n message: undefined,\n copyright: undefined,\n },\n socialLinks: {},\n embed: {},\n css: \"\",\n js: \"\",\n};\n\n/**\n * Deep merge two objects.\n */\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n const result = { ...target };\n\n for (const key of Object.keys(source) as (keyof T)[]) {\n const sourceValue = source[key];\n const targetValue = target[key];\n\n if (\n sourceValue !== undefined &&\n typeof sourceValue === \"object\" &&\n sourceValue !== null &&\n !Array.isArray(sourceValue) &&\n typeof targetValue === \"object\" &&\n targetValue !== null &&\n !Array.isArray(targetValue)\n ) {\n result[key] = deepMerge(\n targetValue as Record<string, unknown>,\n sourceValue as Record<string, unknown>,\n ) as T[keyof T];\n } else if (sourceValue !== undefined) {\n result[key] = sourceValue as T[keyof T];\n }\n }\n\n return result;\n}\n\n/**\n * Defines a theme configuration with type checking.\n *\n * @example\n * ```ts\n * const myTheme = defineTheme({\n * extends: defaultTheme,\n * colors: {\n * primary: '#3498db',\n * },\n * footer: {\n * copyright: '2025 My Company',\n * },\n * });\n * ```\n */\nexport function defineTheme(config: ThemeConfig): ThemeConfig {\n return config;\n}\n\n/**\n * Merges multiple theme configurations.\n * Later themes override earlier ones.\n *\n * @example\n * ```ts\n * const merged = mergeThemes(defaultTheme, customTheme, overrides);\n * ```\n */\nexport function mergeThemes(...themes: ThemeConfig[]): ThemeConfig {\n if (themes.length === 0) {\n return { ...defaultTheme };\n }\n\n let result: ThemeConfig = {};\n\n for (const theme of themes) {\n result = deepMerge(\n result as Record<string, unknown>,\n theme as Record<string, unknown>,\n ) as ThemeConfig;\n }\n\n return result;\n}\n\n/**\n * Resolves a theme configuration by merging with its extends chain and defaults.\n */\nexport function resolveTheme(config?: ThemeConfig): ResolvedThemeConfig {\n if (!config) {\n return resolveTheme(defaultTheme);\n }\n\n // Build the extends chain\n const chain: ThemeConfig[] = [];\n let current: ThemeConfig | undefined = config;\n\n while (current) {\n chain.unshift(current);\n current = current.extends;\n }\n\n // Always start with default theme\n if (chain[0] !== defaultTheme && chain[0]?.name !== \"default\") {\n chain.unshift(defaultTheme);\n }\n\n // Merge all themes in the chain\n const merged = mergeThemes(...chain);\n\n // Return resolved config with all required fields\n return {\n name: merged.name ?? \"custom\",\n colors: merged.colors ?? defaultTheme.colors!,\n darkColors: merged.darkColors ?? defaultTheme.darkColors!,\n fonts: merged.fonts ?? defaultTheme.fonts!,\n layout: merged.layout ?? defaultTheme.layout!,\n header: merged.header ?? defaultTheme.header!,\n footer: merged.footer ?? defaultTheme.footer!,\n socialLinks: merged.socialLinks ?? defaultTheme.socialLinks!,\n embed: merged.embed ?? {},\n css: merged.css ?? \"\",\n js: merged.js ?? \"\",\n };\n}\n\n/**\n * Converts resolved theme to the format expected by Rust NAPI.\n */\nexport function themeToNapi(theme: ResolvedThemeConfig): NapiThemeConfig {\n return {\n colors: theme.colors.primary\n ? {\n primary: theme.colors.primary,\n primaryHover: theme.colors.primaryHover,\n background: theme.colors.background,\n backgroundAlt: theme.colors.backgroundAlt,\n text: theme.colors.text,\n textMuted: theme.colors.textMuted,\n border: theme.colors.border,\n codeBackground: theme.colors.codeBackground,\n codeText: theme.colors.codeText,\n }\n : undefined,\n darkColors: theme.darkColors.primary\n ? {\n primary: theme.darkColors.primary,\n primaryHover: theme.darkColors.primaryHover,\n background: theme.darkColors.background,\n backgroundAlt: theme.darkColors.backgroundAlt,\n text: theme.darkColors.text,\n textMuted: theme.darkColors.textMuted,\n border: theme.darkColors.border,\n codeBackground: theme.darkColors.codeBackground,\n codeText: theme.darkColors.codeText,\n }\n : undefined,\n fonts: theme.fonts.sans\n ? {\n sans: theme.fonts.sans,\n mono: theme.fonts.mono,\n }\n : undefined,\n layout: theme.layout.sidebarWidth\n ? {\n sidebarWidth: theme.layout.sidebarWidth,\n headerHeight: theme.layout.headerHeight,\n maxContentWidth: theme.layout.maxContentWidth,\n }\n : undefined,\n header: theme.header.logo\n ? {\n logo: theme.header.logo,\n logoWidth: theme.header.logoWidth,\n logoHeight: theme.header.logoHeight,\n }\n : undefined,\n footer:\n theme.footer.message || theme.footer.copyright\n ? {\n message: theme.footer.message,\n copyright: theme.footer.copyright,\n }\n : undefined,\n socialLinks:\n theme.socialLinks.github || theme.socialLinks.twitter || theme.socialLinks.discord\n ? {\n github: theme.socialLinks.github,\n twitter: theme.socialLinks.twitter,\n discord: theme.socialLinks.discord,\n }\n : undefined,\n embed: Object.keys(theme.embed).length > 0 ? theme.embed : undefined,\n css: theme.css || undefined,\n js: theme.js || undefined,\n };\n}\n\n/**\n * NAPI-compatible theme colors type.\n */\nexport interface NapiThemeColors {\n primary?: string;\n primaryHover?: string;\n background?: string;\n backgroundAlt?: string;\n text?: string;\n textMuted?: string;\n border?: string;\n codeBackground?: string;\n codeText?: string;\n}\n\n/**\n * NAPI-compatible theme fonts type.\n */\nexport interface NapiThemeFonts {\n sans?: string;\n mono?: string;\n}\n\n/**\n * NAPI-compatible theme layout type.\n */\nexport interface NapiThemeLayout {\n sidebarWidth?: string;\n headerHeight?: string;\n maxContentWidth?: string;\n}\n\n/**\n * NAPI-compatible theme header type.\n */\nexport interface NapiThemeHeader {\n logo?: string;\n logoWidth?: number;\n logoHeight?: number;\n}\n\n/**\n * NAPI-compatible theme footer type.\n */\nexport interface NapiThemeFooter {\n message?: string;\n copyright?: string;\n}\n\n/**\n * NAPI-compatible social links type.\n */\nexport interface NapiSocialLinks {\n github?: string;\n twitter?: string;\n discord?: string;\n}\n\n/**\n * NAPI-compatible theme embed type.\n */\nexport interface NapiThemeEmbed {\n head?: string;\n headerBefore?: string;\n headerAfter?: string;\n sidebarBefore?: string;\n sidebarAfter?: string;\n contentBefore?: string;\n contentAfter?: string;\n footerBefore?: string;\n footer?: string;\n}\n\n/**\n * NAPI-compatible theme configuration type.\n */\nexport interface NapiThemeConfig {\n colors?: NapiThemeColors;\n darkColors?: NapiThemeColors;\n fonts?: NapiThemeFonts;\n layout?: NapiThemeLayout;\n header?: NapiThemeHeader;\n footer?: NapiThemeFooter;\n socialLinks?: NapiSocialLinks;\n embed?: NapiThemeEmbed;\n css?: string;\n js?: string;\n}\n","/**\n * SSG (Static Site Generation) module for ox-content\n */\n\nimport * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport { glob } from \"glob\";\nimport { transformMarkdown } from \"./transform\";\nimport { generateOgImages } from \"./og-image\";\nimport type { OgImagePageEntry } from \"./og-image\";\nimport { transformAllPlugins } from \"./plugins\";\nimport type { TransformAllOptions } from \"./plugins\";\nimport { protectMermaidSvgs, restoreMermaidSvgs } from \"./plugins/mermaid-protect\";\nimport { transformIslands, hasIslands } from \"./island\";\nimport type {\n ResolvedOptions,\n ResolvedSsgOptions,\n SsgOptions,\n TocEntry,\n HeroConfig,\n FeatureConfig,\n} from \"./types\";\nimport { resolveTheme, themeToNapi } from \"./theme\";\nimport type { ResolvedThemeConfig } from \"./theme\";\n\n/**\n * Navigation item for SSG.\n */\nexport interface SsgNavItem {\n title: string;\n path: string;\n href: string;\n children?: SsgNavItem[];\n}\n\n/**\n * Entry page configuration for SSG (passed to Rust).\n */\nexport interface SsgEntryPageConfig {\n hero?: HeroConfig;\n features?: FeatureConfig[];\n}\n\n/**\n * Page data for SSG.\n */\nexport interface SsgPageData {\n title: string;\n description?: string;\n content: string;\n toc: TocEntry[];\n frontmatter: Record<string, unknown>;\n path: string;\n href: string;\n /** Entry page configuration (if layout: entry) */\n entryPage?: SsgEntryPageConfig;\n}\n\n/**\n * Default HTML template for SSG pages with navigation.\n */\nexport const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>{{title}}{{#siteName}} - {{siteName}}{{/siteName}}</title>\n {{#description}}<meta name=\"description\" content=\"{{description}}\">{{/description}}\n <!-- Open Graph -->\n <meta property=\"og:type\" content=\"website\">\n <meta property=\"og:title\" content=\"{{title}}{{#siteName}} - {{siteName}}{{/siteName}}\">\n {{#description}}<meta property=\"og:description\" content=\"{{description}}\">{{/description}}\n {{#ogImage}}<meta property=\"og:image\" content=\"{{ogImage}}\">{{/ogImage}}\n <!-- Twitter Card -->\n {{#ogImage}}<meta name=\"twitter:card\" content=\"summary_large_image\">{{/ogImage}}\n {{^ogImage}}<meta name=\"twitter:card\" content=\"summary\">{{/ogImage}}\n <meta name=\"twitter:title\" content=\"{{title}}{{#siteName}} - {{siteName}}{{/siteName}}\">\n {{#description}}<meta name=\"twitter:description\" content=\"{{description}}\">{{/description}}\n {{#ogImage}}<meta name=\"twitter:image\" content=\"{{ogImage}}\">{{/ogImage}}\n <style>\n :root {\n --sidebar-width: 260px;\n --header-height: 60px;\n --max-content-width: 960px;\n --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n --color-bg: #ffffff;\n --color-bg-alt: #f8f9fa;\n --color-text: #1a1a1a;\n --color-text-muted: #666666;\n --color-border: #e5e7eb;\n --color-primary: #b7410e;\n --color-primary-hover: #ce5937;\n --color-code-bg: #1e293b;\n --color-code-text: #e2e8f0;\n }\n [data-theme=\"dark\"] {\n --color-bg: #141414;\n --color-bg-alt: #141414;\n --color-text: #e5e5e5;\n --color-text-muted: #a3a3a3;\n --color-border: #2a2a2a;\n --color-primary: #c9714a;\n --color-primary-hover: #d4845f;\n --color-code-bg: #1a1a1a;\n --color-code-text: #e5e5e5;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --color-bg: #141414;\n --color-bg-alt: #141414;\n --color-text: #e5e5e5;\n --color-text-muted: #a3a3a3;\n --color-border: #2a2a2a;\n --color-primary: #c9714a;\n --color-primary-hover: #d4845f;\n --color-code-bg: #1a1a1a;\n --color-code-text: #e5e5e5;\n }\n }\n * { box-sizing: border-box; margin: 0; padding: 0; }\n html { scroll-behavior: smooth; }\n body {\n font-family: var(--font-sans);\n line-height: 1.7;\n color: var(--color-text);\n background: var(--color-bg);\n }\n a { color: var(--color-primary); text-decoration: none; }\n a:hover { color: var(--color-primary-hover); text-decoration: underline; }\n\n /* Header */\n .header {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: var(--header-height);\n background: var(--color-bg);\n border-bottom: 1px solid var(--color-border);\n display: flex;\n align-items: center;\n padding: 0 1.5rem;\n z-index: 100;\n }\n .header-title {\n font-size: 1.25rem;\n font-weight: 600;\n color: var(--color-text);\n }\n .header-title:hover { text-decoration: none; }\n .menu-toggle {\n display: none;\n background: none;\n border: none;\n cursor: pointer;\n padding: 0.5rem;\n margin-right: 0.75rem;\n }\n .menu-toggle svg { display: block; }\n .menu-toggle path { stroke: var(--color-text); }\n .header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }\n .search-button {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--color-bg-alt);\n border: 1px solid var(--color-border);\n border-radius: 6px;\n color: var(--color-text-muted);\n cursor: pointer;\n font-size: 0.875rem;\n transition: border-color 0.15s, color 0.15s;\n }\n .search-button:hover { border-color: var(--color-primary); color: var(--color-text); }\n .search-button svg { width: 16px; height: 16px; }\n .search-button kbd {\n padding: 0.125rem 0.375rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n font-family: var(--font-mono);\n font-size: 0.75rem;\n }\n @media (max-width: 640px) {\n .search-button span, .search-button kbd { display: none; }\n .search-button { padding: 0.5rem; }\n }\n .search-modal-overlay {\n display: none;\n position: fixed;\n inset: 0;\n z-index: 200;\n background: rgba(0,0,0,0.6);\n backdrop-filter: blur(4px);\n justify-content: center;\n padding-top: 10vh;\n }\n .search-modal-overlay.open { display: flex; }\n .search-modal {\n width: 100%;\n max-width: 560px;\n margin: 0 1rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);\n max-height: 70vh;\n display: flex;\n flex-direction: column;\n }\n .search-header {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n padding: 1rem;\n border-bottom: 1px solid var(--color-border);\n }\n .search-header svg { flex-shrink: 0; color: var(--color-text-muted); }\n .search-input {\n flex: 1;\n background: none;\n border: none;\n outline: none;\n font-size: 1rem;\n color: var(--color-text);\n }\n .search-input::placeholder { color: var(--color-text-muted); }\n .search-close {\n padding: 0.25rem 0.5rem;\n background: var(--color-bg-alt);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n color: var(--color-text-muted);\n font-family: var(--font-mono);\n font-size: 0.75rem;\n cursor: pointer;\n }\n .search-results {\n flex: 1;\n overflow-y: auto;\n padding: 0.5rem;\n }\n .search-result {\n display: block;\n padding: 0.75rem 1rem;\n border-radius: 8px;\n color: var(--color-text);\n text-decoration: none;\n }\n .search-result:hover, .search-result.selected { background: var(--color-bg-alt); text-decoration: none; }\n .search-result-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.25rem; }\n .search-result-snippet { font-size: 0.8125rem; color: var(--color-text-muted); }\n .search-empty { padding: 2rem 1rem; text-align: center; color: var(--color-text-muted); }\n .search-footer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 1rem;\n padding: 0.75rem 1rem;\n border-top: 1px solid var(--color-border);\n background: var(--color-bg-alt);\n font-size: 0.75rem;\n color: var(--color-text-muted);\n }\n .search-footer kbd {\n padding: 0.125rem 0.375rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n font-family: var(--font-mono);\n }\n .theme-toggle {\n background: none;\n border: none;\n cursor: pointer;\n padding: 0.5rem;\n border-radius: 6px;\n color: var(--color-text-muted);\n transition: background 0.15s, color 0.15s;\n }\n .theme-toggle:hover { background: var(--color-bg-alt); color: var(--color-text); }\n .theme-toggle svg { display: block; width: 20px; height: 20px; }\n .theme-toggle .icon-sun { display: none; }\n .theme-toggle .icon-moon { display: block; }\n [data-theme=\"dark\"] .theme-toggle .icon-sun { display: block; }\n [data-theme=\"dark\"] .theme-toggle .icon-moon { display: none; }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) .theme-toggle .icon-sun { display: block; }\n :root:not([data-theme=\"light\"]) .theme-toggle .icon-moon { display: none; }\n }\n\n /* Layout */\n .layout {\n display: flex;\n padding-top: var(--header-height);\n min-height: 100vh;\n }\n\n /* Sidebar */\n .sidebar {\n position: fixed;\n top: var(--header-height);\n left: 0;\n bottom: 0;\n width: var(--sidebar-width);\n background: var(--color-bg-alt);\n border-right: 1px solid var(--color-border);\n overflow-y: auto;\n padding: 1.5rem 1rem;\n }\n .nav-section { margin-bottom: 1.5rem; }\n .nav-title {\n font-size: 0.75rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--color-text-muted);\n margin-bottom: 0.5rem;\n padding: 0 0.75rem;\n }\n .nav-list { list-style: none; }\n .nav-item { margin: 0.125rem 0; }\n .nav-link {\n display: block;\n padding: 0.5rem 0.75rem;\n border-radius: 6px;\n color: var(--color-text);\n font-size: 0.875rem;\n transition: background 0.15s;\n }\n .nav-link:hover {\n background: var(--color-border);\n text-decoration: none;\n }\n .nav-link.active {\n background: var(--color-primary);\n color: white;\n }\n\n /* Main content */\n .main {\n flex: 1;\n margin-left: var(--sidebar-width);\n padding: 2rem;\n min-width: 0;\n overflow-x: hidden;\n }\n .content {\n max-width: var(--max-content-width);\n margin: 0 auto;\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n /* TOC (right sidebar) */\n .toc {\n position: fixed;\n top: calc(var(--header-height) + 2rem);\n right: 2rem;\n width: 200px;\n font-size: 0.8125rem;\n }\n .toc-title {\n font-weight: 600;\n margin-bottom: 0.75rem;\n color: var(--color-text-muted);\n }\n .toc-list { list-style: none; }\n .toc-item { margin: 0.375rem 0; }\n .toc-link {\n color: var(--color-text-muted);\n display: block;\n padding-left: calc((var(--depth, 1) - 1) * 0.75rem);\n }\n .toc-link:hover { color: var(--color-primary); }\n @media (max-width: 1200px) { .toc { display: none; } }\n\n /* Typography */\n .content h1 { font-size: 2.25rem; margin-bottom: 1rem; line-height: 1.2; }\n .content h2 { font-size: 1.5rem; margin-top: 2.5rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-border); }\n .content h3 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }\n .content h4 { font-size: 1rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }\n .content p { margin-bottom: 1rem; }\n .content ul, .content ol { margin: 1rem 0; padding-left: 1.5rem; }\n .content li { margin: 0.375rem 0; }\n .content blockquote {\n border-left: 4px solid var(--color-primary);\n padding: 0.5rem 1rem;\n margin: 1rem 0;\n background: var(--color-bg-alt);\n border-radius: 0 6px 6px 0;\n }\n .content code {\n font-family: var(--font-mono);\n font-size: 0.875em;\n background: var(--color-bg-alt);\n padding: 0.2em 0.4em;\n border-radius: 4px;\n word-break: break-all;\n }\n .content pre {\n background: var(--color-code-bg);\n color: var(--color-code-text);\n padding: 1rem 1.25rem;\n border-radius: 8px;\n overflow-x: auto;\n margin: 1.5rem 0;\n line-height: 1.5;\n }\n .content pre code {\n background: transparent;\n padding: 0;\n font-size: 0.8125rem;\n }\n .content table {\n width: 100%;\n border-collapse: collapse;\n margin: 1.5rem 0;\n font-size: 0.875rem;\n }\n .content th, .content td {\n border: 1px solid var(--color-border);\n padding: 0.75rem 1rem;\n text-align: left;\n }\n .content th { background: var(--color-bg-alt); font-weight: 600; }\n .content img { max-width: 100%; height: auto; border-radius: 8px; display: block; }\n .content img[alt*=\"Logo\"] { max-width: 200px; display: block; margin: 1rem 0; }\n .content img[alt*=\"Architecture\"] { max-width: 600px; }\n .content img[alt*=\"Benchmark\"] { max-width: 680px; }\n .content hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }\n\n /* Responsive */\n @media (max-width: 768px) {\n .menu-toggle { display: block; }\n .sidebar {\n transform: translateX(-100%);\n transition: transform 0.3s ease;\n z-index: 99;\n width: 280px;\n }\n .sidebar.open { transform: translateX(0); }\n .main { margin-left: 0; padding: 1rem 0.75rem; }\n .content { padding: 0 0.25rem; }\n .content h1 { font-size: 1.5rem; line-height: 1.3; margin-bottom: 0.75rem; }\n .content h2 { font-size: 1.2rem; margin-top: 2rem; }\n .content h3 { font-size: 1.1rem; }\n .content p { font-size: 0.9375rem; margin-bottom: 0.875rem; }\n .content ul, .content ol { padding-left: 1.25rem; font-size: 0.9375rem; }\n .content pre {\n padding: 0.75rem;\n font-size: 0.75rem;\n margin: 1rem -0.75rem;\n border-radius: 0;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n .content code { font-size: 0.8125em; }\n .content table {\n display: block;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n font-size: 0.8125rem;\n margin: 1rem -0.75rem;\n width: calc(100% + 1.5rem);\n }\n .content th, .content td { padding: 0.5rem 0.75rem; white-space: nowrap; }\n .content img { margin: 1rem 0; }\n .content img[alt*=\"Logo\"] { max-width: 150px; }\n .content img[alt*=\"Architecture\"] { max-width: 100%; }\n .content img[alt*=\"Benchmark\"] { max-width: 100%; }\n .content blockquote { padding: 0.5rem 0.75rem; margin: 1rem 0; font-size: 0.9375rem; }\n .header { padding: 0 1rem; }\n .header-title { font-size: 1rem; }\n .header-title img { width: 24px; height: 24px; }\n .overlay {\n display: none;\n position: fixed;\n inset: 0;\n background: rgba(0,0,0,0.5);\n z-index: 98;\n }\n .overlay.open { display: block; }\n }\n\n /* Extra small devices */\n @media (max-width: 480px) {\n .main { padding: 0.75rem 0.5rem; }\n .content h1 { font-size: 1.35rem; }\n .content pre { font-size: 0.6875rem; padding: 0.625rem; }\n .content table { font-size: 0.75rem; }\n .content th, .content td { padding: 0.375rem 0.5rem; }\n }\n </style>\n</head>\n<body>\n <header class=\"header\">\n <button class=\"menu-toggle\" aria-label=\"Toggle menu\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\">\n <path d=\"M3 12h18M3 6h18M3 18h18\"/>\n </svg>\n </button>\n <a href=\"{{base}}index.html\" class=\"header-title\">\n <img src=\"{{base}}logo.svg\" alt=\"\" width=\"28\" height=\"28\" style=\"margin-right: 8px; vertical-align: middle;\" />\n {{siteName}}\n </a>\n <div class=\"header-actions\">\n <button class=\"search-button\" aria-label=\"Search\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.3-4.3\"/>\n </svg>\n <span>Search</span>\n <kbd>/</kbd>\n </button>\n <button class=\"theme-toggle\" aria-label=\"Toggle theme\">\n <svg class=\"icon-sun\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"5\"/><path d=\"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42\"/>\n </svg>\n <svg class=\"icon-moon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\"/>\n </svg>\n </button>\n </div>\n </header>\n <div class=\"search-modal-overlay\">\n <div class=\"search-modal\">\n <div class=\"search-header\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.3-4.3\"/>\n </svg>\n <input type=\"text\" class=\"search-input\" placeholder=\"Search documentation...\" />\n <button class=\"search-close\">Esc</button>\n </div>\n <div class=\"search-results\"></div>\n <div class=\"search-footer\">\n <span><kbd>↑</kbd><kbd>↓</kbd> to navigate</span>\n <span><kbd>Enter</kbd> to select</span>\n <span><kbd>Esc</kbd> to close</span>\n </div>\n </div>\n </div>\n <div class=\"overlay\"></div>\n <div class=\"layout\">\n <aside class=\"sidebar\">\n <nav>\n{{navigation}}\n </nav>\n </aside>\n <main class=\"main\">\n <article class=\"content\">\n{{content}}\n </article>\n </main>\n{{#hasToc}}\n <aside class=\"toc\">\n <div class=\"toc-title\">On this page</div>\n <ul class=\"toc-list\">\n{{toc}}\n </ul>\n </aside>\n{{/hasToc}}\n </div>\n <script>\n // Menu toggle\n const toggle = document.querySelector('.menu-toggle');\n const sidebar = document.querySelector('.sidebar');\n const overlay = document.querySelector('.overlay');\n if (toggle && sidebar && overlay) {\n const close = () => { sidebar.classList.remove('open'); overlay.classList.remove('open'); };\n toggle.addEventListener('click', () => {\n sidebar.classList.toggle('open');\n overlay.classList.toggle('open');\n });\n overlay.addEventListener('click', close);\n sidebar.querySelectorAll('a').forEach(a => a.addEventListener('click', close));\n }\n\n // Theme toggle\n const themeToggle = document.querySelector('.theme-toggle');\n const getPreferredTheme = () => {\n const stored = localStorage.getItem('theme');\n if (stored) return stored;\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n };\n const setTheme = (theme) => {\n document.documentElement.setAttribute('data-theme', theme);\n localStorage.setItem('theme', theme);\n };\n // Initialize theme\n setTheme(getPreferredTheme());\n if (themeToggle) {\n themeToggle.addEventListener('click', () => {\n const current = document.documentElement.getAttribute('data-theme') || getPreferredTheme();\n setTheme(current === 'dark' ? 'light' : 'dark');\n });\n }\n\n // Search functionality\n const searchButton = document.querySelector('.search-button');\n const searchOverlay = document.querySelector('.search-modal-overlay');\n const searchInput = document.querySelector('.search-input');\n const searchResults = document.querySelector('.search-results');\n const searchClose = document.querySelector('.search-close');\n let searchIndex = null;\n let selectedIndex = 0;\n let results = [];\n\n const openSearch = () => {\n searchOverlay.classList.add('open');\n searchInput.focus();\n };\n const closeSearch = () => {\n searchOverlay.classList.remove('open');\n searchInput.value = '';\n searchResults.innerHTML = '';\n selectedIndex = 0;\n results = [];\n };\n\n // Load search index\n const loadSearchIndex = async () => {\n if (searchIndex) return;\n try {\n const res = await fetch('{{base}}search-index.json');\n searchIndex = await res.json();\n } catch (e) {\n console.warn('Failed to load search index:', e);\n }\n };\n\n // Tokenize query\n const tokenize = (text) => {\n const tokens = [];\n let current = '';\n for (const char of text) {\n const isCjk = /[\\\\u4E00-\\\\u9FFF\\\\u3400-\\\\u4DBF\\\\u3040-\\\\u309F\\\\u30A0-\\\\u30FF\\\\uAC00-\\\\uD7AF]/.test(char);\n if (isCjk) {\n if (current) { tokens.push(current.toLowerCase()); current = ''; }\n tokens.push(char);\n } else if (/[a-zA-Z0-9_]/.test(char)) {\n current += char;\n } else if (current) {\n tokens.push(current.toLowerCase());\n current = '';\n }\n }\n if (current) tokens.push(current.toLowerCase());\n return tokens;\n };\n\n // Perform search\n const performSearch = async (query) => {\n if (!query.trim()) {\n searchResults.innerHTML = '';\n results = [];\n return;\n }\n await loadSearchIndex();\n if (!searchIndex) {\n searchResults.innerHTML = '<div class=\"search-empty\">Search index not available</div>';\n return;\n }\n\n const tokens = tokenize(query);\n if (!tokens.length) {\n searchResults.innerHTML = '';\n results = [];\n return;\n }\n\n const k1 = 1.2, b = 0.75;\n const docScores = new Map();\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n const isLast = i === tokens.length - 1;\n let matchingTerms = [];\n if (isLast && token.length >= 2) {\n matchingTerms = Object.keys(searchIndex.index).filter(t => t.startsWith(token));\n } else if (searchIndex.index[token]) {\n matchingTerms = [token];\n }\n\n for (const term of matchingTerms) {\n const postings = searchIndex.index[term] || [];\n const df = searchIndex.df[term] || 1;\n const idf = Math.log((searchIndex.doc_count - df + 0.5) / (df + 0.5) + 1.0);\n\n for (const posting of postings) {\n const doc = searchIndex.documents[posting.doc_idx];\n if (!doc) continue;\n const boost = posting.field === 'Title' ? 10 : posting.field === 'Heading' ? 5 : 1;\n const tf = posting.tf;\n const docLen = doc.body.length;\n const score = idf * ((tf * (k1 + 1)) / (tf + k1 * (1 - b + b * docLen / searchIndex.avg_dl))) * boost;\n\n if (!docScores.has(posting.doc_idx)) {\n docScores.set(posting.doc_idx, { score: 0, matches: new Set() });\n }\n const entry = docScores.get(posting.doc_idx);\n entry.score += score;\n entry.matches.add(term);\n }\n }\n }\n\n results = Array.from(docScores.entries())\n .map(([docIdx, data]) => {\n const doc = searchIndex.documents[docIdx];\n let snippet = '';\n if (doc.body) {\n const bodyLower = doc.body.toLowerCase();\n let firstPos = -1;\n for (const match of data.matches) {\n const pos = bodyLower.indexOf(match);\n if (pos !== -1 && (firstPos === -1 || pos < firstPos)) firstPos = pos;\n }\n const start = Math.max(0, firstPos - 50);\n const end = Math.min(doc.body.length, start + 150);\n snippet = doc.body.slice(start, end);\n if (start > 0) snippet = '...' + snippet;\n if (end < doc.body.length) snippet += '...';\n }\n return { ...doc, score: data.score, snippet };\n })\n .sort((a, b) => b.score - a.score)\n .slice(0, 10);\n\n selectedIndex = 0;\n renderResults();\n };\n\n const renderResults = () => {\n if (!results.length) {\n searchResults.innerHTML = '<div class=\"search-empty\">No results found</div>';\n return;\n }\n searchResults.innerHTML = results.map((r, i) =>\n '<a href=\"' + r.url + '\" class=\"search-result' + (i === selectedIndex ? ' selected' : '') + '\">' +\n '<div class=\"search-result-title\">' + r.title + '</div>' +\n (r.snippet ? '<div class=\"search-result-snippet\">' + r.snippet + '</div>' : '') +\n '</a>'\n ).join('');\n };\n\n // Event listeners\n if (searchButton) searchButton.addEventListener('click', openSearch);\n if (searchClose) searchClose.addEventListener('click', closeSearch);\n if (searchOverlay) searchOverlay.addEventListener('click', (e) => { if (e.target === searchOverlay) closeSearch(); });\n\n let searchTimeout = null;\n if (searchInput) {\n searchInput.addEventListener('input', () => {\n if (searchTimeout) clearTimeout(searchTimeout);\n searchTimeout = setTimeout(() => performSearch(searchInput.value), 150);\n });\n searchInput.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') closeSearch();\n else if (e.key === 'ArrowDown') {\n e.preventDefault();\n if (selectedIndex < results.length - 1) { selectedIndex++; renderResults(); }\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n if (selectedIndex > 0) { selectedIndex--; renderResults(); }\n } else if (e.key === 'Enter' && results[selectedIndex]) {\n e.preventDefault();\n window.location.href = results[selectedIndex].url;\n }\n });\n }\n\n // Global keyboard shortcut (/ or Cmd+K)\n document.addEventListener('keydown', (e) => {\n if ((e.key === '/' && !(e.target instanceof HTMLInputElement)) ||\n ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k')) {\n e.preventDefault();\n openSearch();\n }\n });\n </script>\n</body>\n</html>`;\n\n/**\n * Bare HTML template (no navigation, no styles).\n */\nexport const BARE_HTML_TEMPLATE = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>{{title}}</title>\n</head>\n<body>\n{{content}}\n</body>\n</html>`;\n\n/**\n * Resolves SSG options with defaults.\n */\nexport function resolveSsgOptions(ssg: SsgOptions | boolean | undefined): ResolvedSsgOptions {\n if (ssg === false) {\n return {\n enabled: false,\n extension: \".html\",\n clean: false,\n bare: false,\n generateOgImage: false,\n };\n }\n\n if (ssg === true || ssg === undefined) {\n return {\n enabled: true,\n extension: \".html\",\n clean: false,\n bare: false,\n generateOgImage: false,\n theme: resolveTheme(undefined),\n };\n }\n\n return {\n enabled: ssg.enabled ?? true,\n extension: ssg.extension ?? \".html\",\n clean: ssg.clean ?? false,\n bare: ssg.bare ?? false,\n siteName: ssg.siteName,\n ogImage: ssg.ogImage,\n generateOgImage: ssg.generateOgImage ?? false,\n siteUrl: ssg.siteUrl,\n theme: resolveTheme(ssg.theme),\n };\n}\n\n/**\n * Simple mustache-like template rendering.\n */\nfunction renderTemplate(template: string, data: Record<string, unknown>): string {\n let result = template;\n\n // Handle conditionals: {{#key}}content{{/key}}\n result = result.replace(/\\{\\{#(\\w+)\\}\\}([\\s\\S]*?)\\{\\{\\/\\1\\}\\}/g, (_, key, content) => {\n return data[key] ? content : \"\";\n });\n\n // Handle inverted conditionals: {{^key}}content{{/key}}\n result = result.replace(/\\{\\{\\^(\\w+)\\}\\}([\\s\\S]*?)\\{\\{\\/\\1\\}\\}/g, (_, key, content) => {\n return data[key] ? \"\" : content;\n });\n\n // Handle simple replacements: {{key}}\n result = result.replace(/\\{\\{(\\w+)\\}\\}/g, (_, key) => {\n const value = data[key];\n if (value === undefined || value === null) return \"\";\n if (typeof value === \"object\") return JSON.stringify(value);\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n return \"\";\n });\n\n return result;\n}\n\n/**\n * Extracts title from content or frontmatter.\n */\nexport function extractTitle(content: string, frontmatter: Record<string, unknown>): string {\n if (frontmatter.title && typeof frontmatter.title === \"string\") {\n return frontmatter.title;\n }\n\n const h1Match = content.match(/<h1[^>]*>([^<]+)<\\/h1>/i);\n if (h1Match) {\n return h1Match[1].trim();\n }\n\n return \"Untitled\";\n}\n\n/**\n * Generates navigation HTML from nav groups.\n */\nfunction _generateNavHtml(navGroups: NavGroup[], currentPath: string): string {\n return navGroups\n .map((group) => {\n const items = group.items\n .map((item) => {\n const isActive = item.path === currentPath;\n const activeClass = isActive ? \" active\" : \"\";\n return ` <li class=\"nav-item\"><a href=\"${item.href}\" class=\"nav-link${activeClass}\">${item.title}</a></li>`;\n })\n .join(\"\\n\");\n\n return ` <div class=\"nav-section\">\n <div class=\"nav-title\">${group.title}</div>\n <ul class=\"nav-list\">\n${items}\n </ul>\n </div>`;\n })\n .join(\"\\n\");\n}\n\n/**\n * Generates TOC HTML from toc entries.\n */\nfunction _generateTocHtml(toc: TocEntry[]): string {\n const flattenToc = (entries: TocEntry[], depth = 1): string[] => {\n const items: string[] = [];\n for (const entry of entries) {\n items.push(\n ` <li class=\"toc-item\"><a href=\"#${entry.slug}\" class=\"toc-link\" style=\"--depth: ${depth}\">${entry.text}</a></li>`,\n );\n if (entry.children && entry.children.length > 0) {\n items.push(...flattenToc(entry.children, depth + 1));\n }\n }\n return items;\n };\n return flattenToc(toc).join(\"\\n\");\n}\n\n/**\n * Generates bare HTML page (no navigation, no styles).\n */\nexport function generateBareHtmlPage(content: string, title: string): string {\n return renderTemplate(BARE_HTML_TEMPLATE, {\n title,\n content,\n });\n}\n\n/**\n * Generates HTML page with navigation using Rust NAPI bindings.\n */\nexport async function generateHtmlPage(\n pageData: SsgPageData,\n navGroups: NavGroup[],\n siteName: string,\n base: string,\n ogImage?: string,\n theme?: ResolvedThemeConfig,\n): Promise<string> {\n const mod = await import(\"@ox-content/napi\");\n\n // Convert TocEntry to the format expected by Rust\n const tocForRust = pageData.toc.map((entry) => ({\n depth: entry.depth,\n text: entry.text,\n slug: entry.slug,\n }));\n\n // Convert NavGroup to the format expected by Rust\n const navGroupsForRust = navGroups.map((group) => ({\n title: group.title,\n items: group.items.map((item) => ({\n title: item.title,\n path: item.path,\n href: item.href,\n })),\n }));\n\n // Convert theme to NAPI format if provided\n const themeForRust = theme ? themeToNapi(theme) : undefined;\n\n // Convert entry page to NAPI format if provided\n const entryPageForRust = pageData.entryPage\n ? {\n hero: pageData.entryPage.hero\n ? {\n name: pageData.entryPage.hero.name,\n text: pageData.entryPage.hero.text,\n tagline: pageData.entryPage.hero.tagline,\n image: pageData.entryPage.hero.image\n ? {\n src: pageData.entryPage.hero.image.src,\n alt: pageData.entryPage.hero.image.alt,\n width: pageData.entryPage.hero.image.width,\n height: pageData.entryPage.hero.image.height,\n }\n : undefined,\n actions: pageData.entryPage.hero.actions?.map((a) => ({\n theme: a.theme,\n text: a.text,\n link: a.link,\n })),\n }\n : undefined,\n features: pageData.entryPage.features?.map((f) => ({\n icon: f.icon,\n title: f.title,\n details: f.details,\n link: f.link,\n linkText: f.linkText,\n })),\n }\n : undefined;\n\n return mod.generateSsgHtml(\n {\n title: pageData.title,\n description: pageData.description,\n content: pageData.content,\n toc: tocForRust,\n path: pageData.path,\n entryPage: entryPageForRust,\n },\n navGroupsForRust,\n {\n siteName,\n base,\n ogImage,\n theme: themeForRust,\n },\n );\n}\n\n/**\n * Converts a markdown file path to its corresponding HTML output path.\n */\nexport function getOutputPath(\n inputPath: string,\n srcDir: string,\n outDir: string,\n extension: string,\n): string {\n const relativePath = path.relative(srcDir, inputPath);\n const baseName = relativePath.replace(/\\.(?:md|markdown)$/i, extension);\n\n if (baseName.endsWith(`index${extension}`)) {\n return path.join(outDir, baseName);\n }\n\n const dirName = baseName.replace(new RegExp(`\\\\${extension}$`), \"\");\n return path.join(outDir, dirName, `index${extension}`);\n}\n\n/**\n * Converts a markdown file path to a relative URL path.\n */\nexport function getUrlPath(inputPath: string, srcDir: string): string {\n const relativePath = path.relative(srcDir, inputPath);\n const baseName = relativePath.replace(/\\.(?:md|markdown)$/i, \"\");\n\n if (baseName === \"index\" || baseName.endsWith(\"/index\")) {\n return baseName.replace(/\\/?index$/, \"\") || \"/\";\n }\n\n return baseName;\n}\n\n/**\n * Converts a markdown file path to an href.\n */\nexport function getHref(\n inputPath: string,\n srcDir: string,\n base: string,\n extension: string,\n): string {\n const urlPath = getUrlPath(inputPath, srcDir);\n if (urlPath === \"/\" || urlPath === \"\") {\n return `${base}index${extension}`;\n }\n return `${base}${urlPath}/index${extension}`;\n}\n\n/**\n * Gets the OG image output path for a given markdown file.\n */\nfunction getOgImagePath(inputPath: string, srcDir: string, outDir: string): string {\n const relativePath = path.relative(srcDir, inputPath);\n const baseName = relativePath.replace(/\\.(?:md|markdown)$/i, \"\");\n\n if (baseName === \"index\" || baseName.endsWith(\"/index\")) {\n const dirPath = baseName.replace(/\\/?index$/, \"\") || \"\";\n return path.join(outDir, dirPath, \"og-image.png\");\n }\n\n return path.join(outDir, baseName, \"og-image.png\");\n}\n\n/**\n * Gets the OG image URL for use in meta tags.\n * If siteUrl is provided, returns an absolute URL (required for SNS sharing).\n */\nfunction getOgImageUrl(inputPath: string, srcDir: string, base: string, siteUrl?: string): string {\n const urlPath = getUrlPath(inputPath, srcDir);\n let relativePath: string;\n if (urlPath === \"/\" || urlPath === \"\") {\n relativePath = `${base}og-image.png`;\n } else {\n relativePath = `${base}${urlPath}/og-image.png`;\n }\n\n // Return absolute URL if siteUrl is provided\n if (siteUrl) {\n const cleanSiteUrl = siteUrl.replace(/\\/$/, \"\");\n return `${cleanSiteUrl}${relativePath}`;\n }\n\n return relativePath;\n}\n\n/**\n * Gets display title from file path.\n */\nfunction getDisplayTitle(filePath: string): string {\n const fileName = path.basename(filePath, path.extname(filePath));\n\n if (fileName === \"index\") {\n const dirName = path.basename(path.dirname(filePath));\n if (dirName && dirName !== \".\") {\n return formatTitle(dirName);\n }\n return \"Home\";\n }\n\n return formatTitle(fileName);\n}\n\n/**\n * Formats a file/dir name as a title.\n */\nexport function formatTitle(name: string): string {\n return name\n .replace(/[-_]([a-z])/g, (_, char) => \" \" + char.toUpperCase())\n .replace(/^[a-z]/, (char) => char.toUpperCase());\n}\n\n/**\n * Collects all markdown files from the source directory.\n */\nexport async function collectMarkdownFiles(srcDir: string): Promise<string[]> {\n const pattern = path.join(srcDir, \"**/*.{md,markdown}\");\n const files = await glob(pattern, {\n nodir: true,\n ignore: [\"**/node_modules/**\", \"**/dist/**\", \"**/.git/**\"],\n });\n return files.sort();\n}\n\n/**\n * Navigation group for hierarchical navigation.\n */\nexport interface NavGroup {\n title: string;\n items: SsgNavItem[];\n}\n\n/**\n * Builds navigation items from markdown files, grouped by directory.\n */\nexport function buildNavItems(\n markdownFiles: string[],\n srcDir: string,\n base: string,\n extension: string,\n): NavGroup[] {\n const groups = new Map<string, SsgNavItem[]>();\n\n // Define the order of groups (api at the bottom)\n const groupOrder = [\"\", \"examples\", \"packages\", \"api\"];\n\n for (const file of markdownFiles) {\n const relativePath = path.relative(srcDir, file);\n const parts = relativePath.split(path.sep);\n\n // Determine group: first directory or '' for root files\n let groupKey = \"\";\n if (parts.length > 1) {\n groupKey = parts[0];\n }\n\n if (!groups.has(groupKey)) {\n groups.set(groupKey, []);\n }\n\n const urlPath = getUrlPath(file, srcDir);\n\n // Use \"Overview\" for root index.md, otherwise use getDisplayTitle\n let title: string;\n if (urlPath === \"/\" || urlPath === \"\") {\n title = \"Overview\";\n } else {\n title = getDisplayTitle(file);\n }\n\n groups.get(groupKey)!.push({\n title,\n path: urlPath,\n href: getHref(file, srcDir, base, extension),\n });\n }\n\n // Sort items within each group: index files first, then alphabetically\n const sortItems = (items: SsgNavItem[]) => {\n return items.sort((a, b) => {\n // Root index (Overview) comes first\n const aIsRoot = a.path === \"/\" || a.path === \"\";\n const bIsRoot = b.path === \"/\" || b.path === \"\";\n if (aIsRoot && !bIsRoot) return -1;\n if (!aIsRoot && bIsRoot) return 1;\n // Otherwise, maintain alphabetical order by title\n return a.title.localeCompare(b.title);\n });\n };\n\n // Convert to array and sort by group order\n const result: NavGroup[] = [];\n\n for (const key of groupOrder) {\n const items = groups.get(key);\n if (items && items.length > 0) {\n result.push({\n title: key === \"\" ? \"Guide\" : formatTitle(key),\n items: sortItems(items),\n });\n groups.delete(key);\n }\n }\n\n // Add any remaining groups\n for (const [key, items] of groups) {\n if (items.length > 0) {\n result.push({\n title: formatTitle(key),\n items: sortItems(items),\n });\n }\n }\n\n return result;\n}\n\n/**\n * Builds all markdown files to static HTML.\n */\nexport async function buildSsg(\n options: ResolvedOptions,\n root: string,\n): Promise<{ files: string[]; errors: string[] }> {\n const ssgOptions = options.ssg;\n if (!ssgOptions.enabled) {\n return { files: [], errors: [] };\n }\n\n const srcDir = path.resolve(root, options.srcDir);\n const outDir = path.resolve(root, options.outDir);\n const base = options.base.endsWith(\"/\") ? options.base : options.base + \"/\";\n const generatedFiles: string[] = [];\n const errors: string[] = [];\n\n // Clean output directory if requested\n if (ssgOptions.clean) {\n try {\n await fs.rm(outDir, { recursive: true, force: true });\n } catch {\n // Ignore if directory doesn't exist\n }\n }\n\n // Collect markdown files\n const markdownFiles = await collectMarkdownFiles(srcDir);\n\n // Build navigation\n const navItems = buildNavItems(markdownFiles, srcDir, base, ssgOptions.extension);\n\n // Get site name from options or package.json\n let siteName = ssgOptions.siteName ?? \"Documentation\";\n if (!ssgOptions.siteName) {\n try {\n const pkgPath = path.join(root, \"package.json\");\n const pkg = JSON.parse(await fs.readFile(pkgPath, \"utf-8\"));\n if (pkg.name) {\n siteName = formatTitle(pkg.name);\n }\n } catch {\n // Use default\n }\n }\n\n // Collect OG image entries for batch rendering\n const ogImageEntries: OgImagePageEntry[] = [];\n // Parallel array tracking the inputPath for each ogImageEntry (same index)\n const ogImageInputPaths: string[] = [];\n // Map from inputPath to OG image URL (filled after batch render)\n const ogImageUrlMap = new Map<string, string>();\n\n // Determine if OG images should be generated\n const shouldGenerateOgImages =\n (options.ogImage || ssgOptions.generateOgImage) && !ssgOptions.bare;\n\n // Collect page metadata for OG image generation\n interface PageProcessResult {\n inputPath: string;\n transformedHtml: string;\n title: string;\n description?: string;\n frontmatter: Record<string, unknown>;\n toc: TocEntry[];\n }\n const pageResults: PageProcessResult[] = [];\n\n // Process each file: transform markdown and collect metadata\n for (const inputPath of markdownFiles) {\n try {\n const content = await fs.readFile(inputPath, \"utf-8\");\n // Pass SSG options to transform for .md -> .html link conversion in Rust\n // The sourcePath is used to determine if the file is an index file for correct relative link resolution\n const result = await transformMarkdown(content, inputPath, options, {\n convertMdLinks: true,\n baseUrl: base,\n sourcePath: inputPath,\n });\n\n // Apply built-in plugin transformations (No-JS First)\n let transformedHtml = result.html;\n\n // Protect mermaid SVGs from rehype processing in plugins\n const { html: protectedHtml, svgs: mermaidSvgs } = protectMermaidSvgs(transformedHtml);\n transformedHtml = protectedHtml;\n\n // Transform Tabs, YouTube, GitHub, OGP, Mermaid plugins\n const pluginOptions: TransformAllOptions = {\n tabs: true,\n youtube: true,\n github: true,\n ogp: true,\n mermaid: true,\n githubToken: process.env.GITHUB_TOKEN,\n };\n transformedHtml = await transformAllPlugins(transformedHtml, pluginOptions);\n\n // Transform Island components\n if (hasIslands(transformedHtml)) {\n const islandResult = await transformIslands(transformedHtml);\n transformedHtml = islandResult.html;\n }\n\n // Restore protected mermaid SVGs\n transformedHtml = restoreMermaidSvgs(transformedHtml, mermaidSvgs);\n\n const title = extractTitle(transformedHtml, result.frontmatter);\n const description = result.frontmatter.description as string | undefined;\n\n pageResults.push({\n inputPath,\n transformedHtml,\n title,\n description,\n frontmatter: result.frontmatter,\n toc: result.toc,\n });\n\n // Collect OG image entry if generation is enabled\n if (shouldGenerateOgImages) {\n const ogImageOutputPath = getOgImagePath(inputPath, srcDir, outDir);\n const { layout: _layout, ...frontmatterRest } = result.frontmatter;\n ogImageEntries.push({\n props: {\n ...frontmatterRest,\n title,\n description,\n siteName,\n },\n outputPath: ogImageOutputPath,\n });\n ogImageInputPaths.push(inputPath);\n // Pre-compute URL so HTML can reference it\n ogImageUrlMap.set(inputPath, getOgImageUrl(inputPath, srcDir, base, ssgOptions.siteUrl));\n }\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n errors.push(`Failed to process ${inputPath}: ${errorMessage}`);\n }\n }\n\n // Batch generate OG images (Chromium-based)\n if (shouldGenerateOgImages && ogImageEntries.length > 0) {\n try {\n const ogResults = await generateOgImages(ogImageEntries, options.ogImageOptions, root);\n let ogSuccessCount = 0;\n for (let i = 0; i < ogResults.length; i++) {\n const result = ogResults[i];\n if (result.error) {\n errors.push(`OG image failed for ${result.outputPath}: ${result.error}`);\n // Remove failed entries so og:image / twitter:image meta tags are not emitted\n ogImageUrlMap.delete(ogImageInputPaths[i]);\n } else {\n generatedFiles.push(result.outputPath);\n ogSuccessCount++;\n }\n }\n if (ogSuccessCount > 0) {\n const cachedCount = ogResults.filter((r) => r.cached && !r.error).length;\n console.log(\n `[ox-content:og-image] Generated ${ogSuccessCount} OG images` +\n (cachedCount > 0 ? ` (${cachedCount} from cache)` : \"\"),\n );\n }\n } catch (err) {\n // Non-fatal: OG image failures never block the SSG build\n const errorMessage = err instanceof Error ? err.message : String(err);\n console.warn(`[ox-content:og-image] Batch generation failed: ${errorMessage}`);\n // Clear all entries so og:image / twitter:image meta tags are not emitted\n ogImageUrlMap.clear();\n }\n }\n\n // Generate HTML pages\n for (const pageResult of pageResults) {\n try {\n const { inputPath, transformedHtml, title, description, frontmatter, toc } = pageResult;\n\n // Determine OG image URL for this page\n let pageOgImage = ssgOptions.ogImage; // fallback to static URL\n if (shouldGenerateOgImages && ogImageUrlMap.has(inputPath)) {\n pageOgImage = ogImageUrlMap.get(inputPath);\n }\n\n // Check if this is an entry page (layout: entry)\n let entryPage: SsgEntryPageConfig | undefined;\n if (frontmatter.layout === \"entry\") {\n entryPage = {\n hero: frontmatter.hero as HeroConfig | undefined,\n features: frontmatter.features as FeatureConfig[] | undefined,\n };\n }\n\n // Generate HTML based on bare option\n let html: string;\n if (ssgOptions.bare) {\n html = generateBareHtmlPage(transformedHtml, title);\n } else {\n const pageData: SsgPageData = {\n title,\n description,\n content: transformedHtml,\n toc,\n frontmatter,\n path: getUrlPath(inputPath, srcDir),\n href: getHref(inputPath, srcDir, base, ssgOptions.extension),\n entryPage,\n };\n html = await generateHtmlPage(\n pageData,\n navItems,\n siteName,\n base,\n pageOgImage,\n ssgOptions.theme,\n );\n }\n\n // Write output file\n const outputPath = getOutputPath(inputPath, srcDir, outDir, ssgOptions.extension);\n\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.writeFile(outputPath, html, \"utf-8\");\n\n generatedFiles.push(outputPath);\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n errors.push(`Failed to generate HTML for ${pageResult.inputPath}: ${errorMessage}`);\n }\n }\n\n return { files: generatedFiles, errors };\n}\n","/**\n * Full-text search functionality for Ox Content.\n *\n * Generates search index at build time and provides client-side search.\n */\n\nimport * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport type { SearchOptions, ResolvedSearchOptions, SearchDocument } from \"./types\";\n\n// Import Rust bindings\nlet oxContent: typeof import(\"@ox-content/napi\") | null = null;\n\nasync function getOxContent() {\n if (!oxContent) {\n try {\n oxContent = await import(\"@ox-content/napi\");\n } catch {\n console.warn(\"[ox-content] Native bindings not available, search disabled\");\n return null;\n }\n }\n return oxContent;\n}\n\n/**\n * Resolves search options with defaults.\n */\nexport function resolveSearchOptions(\n options: SearchOptions | boolean | undefined,\n): ResolvedSearchOptions {\n if (options === false) {\n return {\n enabled: false,\n limit: 10,\n prefix: true,\n placeholder: \"Search documentation...\",\n hotkey: \"/\",\n };\n }\n\n const opts = typeof options === \"object\" ? options : {};\n\n return {\n enabled: opts.enabled ?? true,\n limit: opts.limit ?? 10,\n prefix: opts.prefix ?? true,\n placeholder: opts.placeholder ?? \"Search documentation...\",\n hotkey: opts.hotkey ?? \"/\",\n };\n}\n\n/**\n * Collects all Markdown files from a directory.\n */\nasync function collectMarkdownFiles(dir: string): Promise<string[]> {\n const files: string[] = [];\n\n async function walk(currentDir: string) {\n try {\n const entries = await fs.readdir(currentDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(currentDir, entry.name);\n\n if (entry.isDirectory() && !entry.name.startsWith(\".\") && entry.name !== \"node_modules\") {\n await walk(fullPath);\n } else if (entry.isFile() && entry.name.endsWith(\".md\")) {\n files.push(fullPath);\n }\n }\n } catch {\n // Ignore errors\n }\n }\n\n await walk(dir);\n return files;\n}\n\n/**\n * Builds the search index from Markdown files.\n */\nexport async function buildSearchIndex(srcDir: string, base: string): Promise<string> {\n const napi = await getOxContent();\n\n if (!napi) {\n return JSON.stringify({\n documents: [],\n index: {},\n df: {},\n avg_dl: 0,\n doc_count: 0,\n });\n }\n\n const files = await collectMarkdownFiles(srcDir);\n const documents: SearchDocument[] = [];\n\n for (const file of files) {\n try {\n const content = await fs.readFile(file, \"utf-8\");\n const relativePath = path.relative(srcDir, file);\n const url = base + relativePath.replace(/\\.md$/, \"\").replace(/\\\\/g, \"/\");\n const id = relativePath.replace(/\\.md$/, \"\").replace(/\\\\/g, \"/\");\n\n // Use Rust bindings to extract search content (if available)\n const extractSearchContent = (napi as any).extractSearchContent;\n if (!extractSearchContent) {\n console.warn(\"[ox-content] Search not available: extractSearchContent not implemented\");\n return \"[]\";\n }\n const doc = extractSearchContent(content, id, url, { gfm: true });\n\n documents.push({\n id: doc.id,\n title: doc.title,\n url: doc.url,\n body: doc.body,\n headings: doc.headings,\n code: doc.code,\n });\n } catch {\n // Skip files that can't be processed\n }\n }\n\n // Build the index using Rust bindings (if available)\n const buildSearchIndex = (napi as any).buildSearchIndex;\n if (!buildSearchIndex) {\n console.warn(\"[ox-content] Search not available: buildSearchIndex not implemented\");\n return JSON.stringify(documents);\n }\n return buildSearchIndex(documents);\n}\n\n/**\n * Writes the search index to a file.\n */\nexport async function writeSearchIndex(indexJson: string, outDir: string): Promise<void> {\n const indexPath = path.join(outDir, \"search-index.json\");\n\n // Ensure output directory exists\n await fs.mkdir(outDir, { recursive: true });\n\n // Write the index\n await fs.writeFile(indexPath, indexJson, \"utf-8\");\n}\n\n/**\n * Client-side search module code.\n * This is injected into the bundle as a virtual module.\n */\nexport function generateSearchModule(options: ResolvedSearchOptions, indexPath: string): string {\n return `\n// Search module generated by ox-content\nconst searchOptions = ${JSON.stringify(options)};\n\nlet searchIndex = null;\nlet indexPromise = null;\n\n// Tokenizer for queries\nfunction tokenizeQuery(text) {\n const tokens = [];\n let current = '';\n\n for (const char of text) {\n const isCjk = /[\\\\u4E00-\\\\u9FFF\\\\u3400-\\\\u4DBF\\\\u3040-\\\\u309F\\\\u30A0-\\\\u30FF\\\\uAC00-\\\\uD7AF]/.test(char);\n\n if (isCjk) {\n if (current) {\n tokens.push(current.toLowerCase());\n current = '';\n }\n tokens.push(char);\n } else if (/[a-zA-Z0-9_]/.test(char)) {\n current += char;\n } else if (current) {\n tokens.push(current.toLowerCase());\n current = '';\n }\n }\n\n if (current) {\n tokens.push(current.toLowerCase());\n }\n\n return tokens;\n}\n\n// BM25 scoring\nfunction computeIdf(df, docCount) {\n return Math.log((docCount - df + 0.5) / (df + 0.5) + 1.0);\n}\n\nfunction getFieldBoost(field) {\n switch (field) {\n case 'Title': return 10.0;\n case 'Heading': return 5.0;\n case 'Body': return 1.0;\n case 'Code': return 0.5;\n default: return 1.0;\n }\n}\n\n// Load the index\nasync function loadIndex() {\n if (searchIndex) return searchIndex;\n if (indexPromise) return indexPromise;\n\n indexPromise = fetch('${indexPath}')\n .then(res => res.json())\n .then(data => {\n searchIndex = data;\n return data;\n })\n .catch(err => {\n console.error('[ox-content] Failed to load search index:', err);\n return null;\n });\n\n return indexPromise;\n}\n\n// Search function\nexport async function search(query, options = {}) {\n const index = await loadIndex();\n\n if (!index || !query.trim()) {\n return [];\n }\n\n const limit = options.limit ?? searchOptions.limit;\n const prefix = options.prefix ?? searchOptions.prefix;\n const tokens = tokenizeQuery(query);\n\n if (tokens.length === 0) {\n return [];\n }\n\n const k1 = 1.2;\n const b = 0.75;\n const docScores = new Map();\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n const isLast = i === tokens.length - 1;\n\n // Find matching terms\n let matchingTerms = [];\n if (prefix && isLast && token.length >= 2) {\n matchingTerms = Object.keys(index.index).filter(term => term.startsWith(token));\n } else if (index.index[token]) {\n matchingTerms = [token];\n }\n\n for (const term of matchingTerms) {\n const postings = index.index[term] || [];\n const df = index.df[term] || 1;\n const idf = computeIdf(df, index.doc_count);\n\n for (const posting of postings) {\n const doc = index.documents[posting.doc_idx];\n if (!doc) continue;\n\n const docLen = doc.body.length;\n const tf = posting.tf;\n const boost = getFieldBoost(posting.field);\n\n const score = idf * ((tf * (k1 + 1.0)) / (tf + k1 * (1.0 - b + b * docLen / index.avg_dl))) * boost;\n\n if (!docScores.has(posting.doc_idx)) {\n docScores.set(posting.doc_idx, { score: 0, matches: new Set() });\n }\n const entry = docScores.get(posting.doc_idx);\n entry.score += score;\n entry.matches.add(term);\n }\n }\n }\n\n // Convert to results\n const results = Array.from(docScores.entries())\n .map(([docIdx, data]) => {\n const doc = index.documents[docIdx];\n const matches = Array.from(data.matches);\n\n // Generate snippet\n let snippet = '';\n if (doc.body) {\n const bodyLower = doc.body.toLowerCase();\n let firstPos = -1;\n for (const match of matches) {\n const pos = bodyLower.indexOf(match);\n if (pos !== -1 && (firstPos === -1 || pos < firstPos)) {\n firstPos = pos;\n }\n }\n\n const start = Math.max(0, firstPos - 50);\n const end = Math.min(doc.body.length, start + 150);\n snippet = doc.body.slice(start, end);\n if (start > 0) snippet = '...' + snippet;\n if (end < doc.body.length) snippet = snippet + '...';\n }\n\n return {\n id: doc.id,\n title: doc.title,\n url: doc.url,\n score: data.score,\n matches,\n snippet,\n };\n })\n .sort((a, b) => b.score - a.score)\n .slice(0, limit);\n\n return results;\n}\n\nexport { searchOptions };\nexport default { search, searchOptions, loadIndex };\n`;\n}\n","/**\n * Dev server middleware for ox-content SSG.\n *\n * Serves fully-rendered HTML pages (with navigation, theme, etc.)\n * during `vite dev`, matching the SSG build output.\n */\n\nimport * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport type { Connect } from \"vite\";\nimport { transformMarkdown } from \"./transform\";\nimport { transformAllPlugins } from \"./plugins\";\nimport { resetTabGroupCounter } from \"./plugins\";\nimport { protectMermaidSvgs, restoreMermaidSvgs } from \"./plugins/mermaid-protect\";\nimport { transformIslands, hasIslands, resetIslandCounter } from \"./island\";\nimport {\n collectMarkdownFiles,\n buildNavItems,\n extractTitle,\n getUrlPath,\n generateHtmlPage,\n formatTitle,\n} from \"./ssg\";\nimport type { NavGroup, SsgPageData, SsgEntryPageConfig } from \"./ssg\";\nimport type { ResolvedOptions } from \"./types\";\nimport type { HeroConfig, FeatureConfig } from \"./types\";\n\n/** File extensions to skip in the middleware. */\nconst SKIP_EXTENSIONS = new Set([\n \".js\",\n \".ts\",\n \".css\",\n \".scss\",\n \".less\",\n \".svg\",\n \".png\",\n \".jpg\",\n \".jpeg\",\n \".gif\",\n \".webp\",\n \".ico\",\n \".woff\",\n \".woff2\",\n \".ttf\",\n \".eot\",\n \".json\",\n \".map\",\n \".mp4\",\n \".webm\",\n \".mp3\",\n \".pdf\",\n]);\n\n/** Vite internal URL prefixes to skip. */\nconst VITE_INTERNAL_PREFIXES = [\"/@vite/\", \"/@fs/\", \"/@id/\", \"/__\"];\n\n/**\n * Check if a request URL should be skipped by the dev server middleware.\n */\nfunction shouldSkip(url: string): boolean {\n // Skip Vite internal URLs\n for (const prefix of VITE_INTERNAL_PREFIXES) {\n if (url.startsWith(prefix)) return true;\n }\n\n // Skip node_modules\n if (url.includes(\"/node_modules/\")) return true;\n\n // Skip requests with known static file extensions\n const extMatch = url.match(/\\.([a-zA-Z0-9]+)(?:\\?|$)/);\n if (extMatch) {\n const ext = \".\" + extMatch[1].toLowerCase();\n if (SKIP_EXTENSIONS.has(ext)) return true;\n }\n\n return false;\n}\n\n/**\n * Resolve a request URL to a markdown file path.\n * Returns null if no matching file exists.\n */\nasync function resolveMarkdownFile(url: string, srcDir: string): Promise<string | null> {\n // Remove query string and hash\n let pathname = url.split(\"?\")[0].split(\"#\")[0];\n\n // Remove trailing /index.html\n if (pathname.endsWith(\"/index.html\")) {\n pathname = pathname.slice(0, -\"/index.html\".length) || \"/\";\n }\n\n // Remove trailing slash (except for root)\n if (pathname !== \"/\" && pathname.endsWith(\"/\")) {\n pathname = pathname.slice(0, -1);\n }\n\n // Map URL to potential markdown file path\n let relativePath: string;\n if (pathname === \"/\") {\n relativePath = \"index.md\";\n } else {\n // Remove leading slash\n relativePath = pathname.slice(1) + \".md\";\n }\n\n const filePath = path.join(srcDir, relativePath);\n\n try {\n await fs.access(filePath);\n return filePath;\n } catch {\n // Try as directory index\n const indexPath = path.join(srcDir, pathname === \"/\" ? \"\" : pathname.slice(1), \"index.md\");\n try {\n await fs.access(indexPath);\n return indexPath;\n } catch {\n return null;\n }\n }\n}\n\n/**\n * Inject Vite HMR client script into the HTML.\n */\nfunction injectViteHmrClient(html: string): string {\n const hmrScript = `<script type=\"module\" src=\"/@vite/client\"></script>\n<script type=\"module\">\nif (import.meta.hot) {\n import.meta.hot.on('ox-content:update', () => {\n location.reload();\n });\n}\n</script>`;\n\n return html.replace(\"</head>\", hmrScript + \"\\n</head>\");\n}\n\n/**\n * Dev server state for caching.\n */\ninterface DevServerCache {\n /** Cached navigation groups. Invalidated on file add/unlink. */\n navGroups: NavGroup[] | null;\n /** Cached rendered HTML keyed by absolute file path. */\n pages: Map<string, string>;\n /** Cached site name. Computed once. */\n siteName: string | null;\n}\n\n/**\n * Create a dev server cache instance.\n */\nexport function createDevServerCache(): DevServerCache {\n return {\n navGroups: null,\n pages: new Map(),\n siteName: null,\n };\n}\n\n/**\n * Invalidate navigation cache (called on file add/unlink).\n */\nexport function invalidateNavCache(cache: DevServerCache): void {\n cache.navGroups = null;\n // Also clear all page caches since navigation HTML is embedded in pages\n cache.pages.clear();\n}\n\n/**\n * Invalidate page cache for a specific file (called on file change).\n */\nexport function invalidatePageCache(cache: DevServerCache, filePath: string): void {\n cache.pages.delete(filePath);\n}\n\n/**\n * Resolve site name from options or package.json.\n */\nasync function resolveSiteName(options: ResolvedOptions, root: string): Promise<string> {\n if (options.ssg.siteName) {\n return options.ssg.siteName;\n }\n\n try {\n const pkgPath = path.join(root, \"package.json\");\n const pkg = JSON.parse(await fs.readFile(pkgPath, \"utf-8\"));\n if (pkg.name) {\n return formatTitle(pkg.name);\n }\n } catch {\n // Use default\n }\n\n return \"Documentation\";\n}\n\n/**\n * Render a single markdown page to full HTML.\n */\nasync function renderPage(\n filePath: string,\n options: ResolvedOptions,\n navGroups: NavGroup[],\n siteName: string,\n base: string,\n root: string,\n): Promise<string> {\n const srcDir = path.resolve(root, options.srcDir);\n\n // Reset counters for clean render\n resetTabGroupCounter();\n resetIslandCounter();\n\n // Read markdown content\n const content = await fs.readFile(filePath, \"utf-8\");\n\n // Transform markdown to HTML\n const result = await transformMarkdown(content, filePath, options, {\n convertMdLinks: true,\n baseUrl: base,\n sourcePath: filePath,\n });\n\n let transformedHtml = result.html;\n\n // Protect mermaid SVGs from rehype processing\n const { html: protectedHtml, svgs: mermaidSvgs } = protectMermaidSvgs(transformedHtml);\n transformedHtml = protectedHtml;\n\n // Transform all plugins\n transformedHtml = await transformAllPlugins(transformedHtml, {\n tabs: true,\n youtube: true,\n github: true,\n ogp: true,\n mermaid: true,\n githubToken: process.env.GITHUB_TOKEN,\n });\n\n // Transform Island components\n if (hasIslands(transformedHtml)) {\n const islandResult = await transformIslands(transformedHtml);\n transformedHtml = islandResult.html;\n }\n\n // Restore protected mermaid SVGs\n transformedHtml = restoreMermaidSvgs(transformedHtml, mermaidSvgs);\n\n // Extract title\n const title = extractTitle(transformedHtml, result.frontmatter);\n const description = result.frontmatter.description as string | undefined;\n\n // Check if this is an entry page\n let entryPage: SsgEntryPageConfig | undefined;\n if (result.frontmatter.layout === \"entry\") {\n entryPage = {\n hero: result.frontmatter.hero as HeroConfig | undefined,\n features: result.frontmatter.features as FeatureConfig[] | undefined,\n };\n }\n\n // Build page data\n const pageData: SsgPageData = {\n title,\n description,\n content: transformedHtml,\n toc: result.toc,\n frontmatter: result.frontmatter,\n path: getUrlPath(filePath, srcDir),\n href: getUrlPath(filePath, srcDir) || \"/\",\n entryPage,\n };\n\n // Generate full HTML page\n let html = await generateHtmlPage(\n pageData,\n navGroups,\n siteName,\n base,\n options.ssg.ogImage,\n options.ssg.theme,\n );\n\n // Inject Vite HMR client for live reload\n html = injectViteHmrClient(html);\n\n return html;\n}\n\n/**\n * Create the dev server middleware for SSG page serving.\n */\nexport function createDevServerMiddleware(\n options: ResolvedOptions,\n root: string,\n cache: DevServerCache,\n): Connect.NextHandleFunction {\n const srcDir = path.resolve(root, options.srcDir);\n const base = options.base.endsWith(\"/\") ? options.base : options.base + \"/\";\n\n return async (req, res, next) => {\n const url = req.url;\n if (!url) return next();\n\n // Strip base from URL for routing\n let routeUrl = url;\n if (base !== \"/\" && routeUrl.startsWith(base)) {\n routeUrl = \"/\" + routeUrl.slice(base.length);\n }\n\n // Skip non-page requests\n if (shouldSkip(routeUrl)) return next();\n\n // Resolve markdown file\n const filePath = await resolveMarkdownFile(routeUrl, srcDir);\n if (!filePath) return next();\n\n try {\n // Check page cache\n const cached = cache.pages.get(filePath);\n if (cached) {\n res.setHeader(\"Content-Type\", \"text/html\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.end(cached);\n return;\n }\n\n // Resolve site name (cached after first call)\n if (!cache.siteName) {\n cache.siteName = await resolveSiteName(options, root);\n }\n\n // Build navigation if not cached\n if (!cache.navGroups) {\n const markdownFiles = await collectMarkdownFiles(srcDir);\n cache.navGroups = buildNavItems(markdownFiles, srcDir, base, \".html\");\n }\n\n // Render the page\n const html = await renderPage(filePath, options, cache.navGroups, cache.siteName, base, root);\n\n // Cache the result\n cache.pages.set(filePath, html);\n\n res.setHeader(\"Content-Type\", \"text/html\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.end(html);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n console.error(`[ox-content:dev] Failed to render ${filePath}:`, message);\n next();\n }\n };\n}\n","/**\n * OG Viewer - Dev tool for previewing Open Graph metadata\n *\n * Accessible at /__og-viewer during development.\n * Shows all pages with their OG metadata, validation warnings,\n * and social card previews.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { glob } from \"glob\";\nimport type { Plugin } from \"vite\";\nimport type { ResolvedOptions } from \"./types\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\ninterface PageOgData {\n path: string;\n urlPath: string;\n title: string;\n description: string;\n author: string;\n tags: string[];\n ogImageUrl: string;\n warnings: { level: \"error\" | \"warning\"; message: string }[];\n}\n\n// =============================================================================\n// Data Collection\n// =============================================================================\n\nfunction parseFrontmatter(content: string): Record<string, unknown> {\n const match = content.match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---/);\n if (!match) return {};\n\n const yaml = match[1];\n const result: Record<string, unknown> = {};\n\n for (const line of yaml.split(\"\\n\")) {\n const kv = line.match(/^(\\w[\\w-]*):\\s*(.*)$/);\n if (!kv) continue;\n const [, key, rawValue] = kv;\n let value: unknown = rawValue.trim();\n\n // Handle arrays (simple inline: [a, b])\n if (typeof value === \"string\" && value.startsWith(\"[\") && value.endsWith(\"]\")) {\n value = value\n .slice(1, -1)\n .split(\",\")\n .map((s) => s.trim().replace(/^['\"]|['\"]$/g, \"\"))\n .filter(Boolean);\n }\n // Strip quotes\n else if (typeof value === \"string\" && /^['\"].*['\"]$/.test(value)) {\n value = value.slice(1, -1);\n }\n // Booleans\n else if (value === \"true\") value = true;\n else if (value === \"false\") value = false;\n\n result[key] = value;\n }\n\n return result;\n}\n\nfunction extractTitle(content: string, frontmatter: Record<string, unknown>): string {\n if (typeof frontmatter.title === \"string\" && frontmatter.title) {\n return frontmatter.title;\n }\n // Fallback: first # heading\n const match = content.match(/^#\\s+(.+)$/m);\n return match ? match[1].trim() : \"\";\n}\n\nfunction getUrlPath(filePath: string, srcDir: string): string {\n let rel = path.relative(srcDir, filePath).replace(/\\\\/g, \"/\");\n rel = rel.replace(/\\.md$/, \"\");\n if (rel === \"index\") return \"/\";\n if (rel.endsWith(\"/index\")) rel = rel.slice(0, -\"/index\".length);\n return \"/\" + rel;\n}\n\nfunction computeOgImageUrl(\n urlPath: string,\n base: string,\n siteUrl?: string,\n generateOgImage?: boolean,\n staticOgImage?: string,\n): string {\n if (!generateOgImage) return staticOgImage || \"\";\n\n const cleanBase = base.endsWith(\"/\") ? base : base + \"/\";\n let relativePath: string;\n if (urlPath === \"/\") {\n relativePath = `${cleanBase}og-image.png`;\n } else {\n relativePath = `${cleanBase}${urlPath.replace(/^\\//, \"\")}/og-image.png`;\n }\n\n if (siteUrl) {\n const cleanSiteUrl = siteUrl.replace(/\\/$/, \"\");\n return `${cleanSiteUrl}${relativePath}`;\n }\n return relativePath;\n}\n\nfunction validatePage(\n page: { title: string; description: string; ogImageUrl: string },\n options: ResolvedOptions,\n): { level: \"error\" | \"warning\"; message: string }[] {\n const warnings: { level: \"error\" | \"warning\"; message: string }[] = [];\n\n if (!page.title) {\n warnings.push({ level: \"error\", message: \"title is missing\" });\n } else if (page.title.length > 70) {\n warnings.push({ level: \"warning\", message: `title is too long (${page.title.length}/70)` });\n }\n\n if (!page.description) {\n warnings.push({ level: \"warning\", message: \"description is missing\" });\n } else if (page.description.length > 200) {\n warnings.push({\n level: \"warning\",\n message: `description is too long (${page.description.length}/200)`,\n });\n }\n\n const generateOgImage = options.ogImage || options.ssg.generateOgImage;\n if (generateOgImage && !options.ssg.siteUrl) {\n warnings.push({ level: \"warning\", message: \"ogImage enabled but siteUrl is not set\" });\n }\n\n return warnings;\n}\n\nasync function collectPages(options: ResolvedOptions, root: string): Promise<PageOgData[]> {\n const srcDir = path.resolve(root, options.srcDir);\n const files = await glob(\"**/*.md\", { cwd: srcDir, absolute: true });\n\n const pages: PageOgData[] = [];\n const generateOgImage = options.ogImage || options.ssg.generateOgImage;\n\n for (const file of files.sort()) {\n const content = fs.readFileSync(file, \"utf-8\");\n const frontmatter = parseFrontmatter(content);\n\n // Skip entry layout pages (they are landing pages, not content pages)\n if (frontmatter.layout === \"entry\") continue;\n\n const title = extractTitle(content, frontmatter);\n const description = typeof frontmatter.description === \"string\" ? frontmatter.description : \"\";\n const author = typeof frontmatter.author === \"string\" ? frontmatter.author : \"\";\n const tags = Array.isArray(frontmatter.tags)\n ? (frontmatter.tags as string[])\n : typeof frontmatter.tags === \"string\"\n ? [frontmatter.tags]\n : [];\n\n const urlPath = getUrlPath(file, srcDir);\n const ogImageUrl = computeOgImageUrl(\n urlPath,\n options.base,\n options.ssg.siteUrl,\n generateOgImage,\n options.ssg.ogImage,\n );\n\n const page = {\n path: path.relative(srcDir, file),\n urlPath,\n title,\n description,\n author,\n tags,\n ogImageUrl,\n warnings: [] as PageOgData[\"warnings\"],\n };\n page.warnings = validatePage(page, options);\n pages.push(page);\n }\n\n return pages;\n}\n\n// =============================================================================\n// HTML Rendering\n// =============================================================================\n\nfunction renderViewerHtml(pages: PageOgData[], options: ResolvedOptions): string {\n const generateOgImage = options.ogImage || options.ssg.generateOgImage;\n const totalWarnings = pages.reduce(\n (sum, p) => sum + p.warnings.filter((w) => w.level === \"warning\").length,\n 0,\n );\n const totalErrors = pages.reduce(\n (sum, p) => sum + p.warnings.filter((w) => w.level === \"error\").length,\n 0,\n );\n\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>OG Viewer - ox-content</title>\n <style>\n :root {\n --bg: #ffffff;\n --bg-card: #f8f9fa;\n --bg-preview: #ffffff;\n --text: #1a1a2e;\n --text-muted: #6b7280;\n --border: #e5e7eb;\n --accent: #e8590c;\n --accent-light: #fff4e6;\n --error: #dc2626;\n --error-bg: #fef2f2;\n --warning: #d97706;\n --warning-bg: #fffbeb;\n --success: #16a34a;\n --tag-bg: #f0f0f0;\n --shadow: 0 1px 3px rgba(0,0,0,0.08);\n --radius: 8px;\n }\n @media (prefers-color-scheme: dark) {\n :root {\n --bg: #0f172a;\n --bg-card: #1e293b;\n --bg-preview: #334155;\n --text: #e2e8f0;\n --text-muted: #94a3b8;\n --border: #334155;\n --accent: #fb923c;\n --accent-light: #431407;\n --error: #f87171;\n --error-bg: #450a0a;\n --warning: #fbbf24;\n --warning-bg: #451a03;\n --success: #4ade80;\n --tag-bg: #334155;\n --shadow: 0 1px 3px rgba(0,0,0,0.3);\n }\n }\n * { margin: 0; padding: 0; box-sizing: border-box; }\n body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }\n .header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }\n .header svg { width: 28px; height: 28px; color: var(--accent); }\n .header h1 { font-size: 18px; font-weight: 600; }\n .header h1 span { color: var(--text-muted); font-weight: 400; }\n .header-actions { margin-left: auto; }\n .btn { padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--text); cursor: pointer; font-size: 13px; transition: all 0.15s; }\n .btn:hover { border-color: var(--accent); color: var(--accent); }\n .summary { padding: 12px 24px; display: flex; gap: 20px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted); flex-wrap: wrap; align-items: center; }\n .summary-item { display: flex; align-items: center; gap: 4px; }\n .summary-item strong { color: var(--text); }\n .summary-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }\n .dot-error { background: var(--error); }\n .dot-warning { background: var(--warning); }\n .dot-success { background: var(--success); }\n .toolbar { padding: 12px 24px; display: flex; gap: 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }\n .filter-btn { padding: 4px 12px; border: 1px solid var(--border); border-radius: 16px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; transition: all 0.15s; }\n .filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }\n .search-input { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 13px; flex: 1; min-width: 200px; }\n .search-input::placeholder { color: var(--text-muted); }\n .container { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1200px; margin: 0 auto; }\n .card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); box-shadow: var(--shadow); overflow: hidden; }\n .card-header { padding: 16px; border-bottom: 1px solid var(--border); }\n .card-path { font-size: 12px; color: var(--text-muted); font-family: monospace; margin-bottom: 4px; }\n .card-title { font-size: 16px; font-weight: 600; }\n .card-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; }\n .card-meta { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }\n .tag { padding: 2px 8px; background: var(--tag-bg); border-radius: 4px; font-size: 11px; color: var(--text-muted); }\n .card-warnings { padding: 8px 16px; display: flex; flex-direction: column; gap: 4px; }\n .warning-item { font-size: 12px; padding: 4px 8px; border-radius: 4px; }\n .warning-item.error { background: var(--error-bg); color: var(--error); }\n .warning-item.warning { background: var(--warning-bg); color: var(--warning); }\n .card-previews { padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }\n @media (max-width: 768px) { .card-previews { grid-template-columns: 1fr; } }\n .preview { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }\n .preview-label { padding: 6px 10px; font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.5px; }\n .preview-card { background: var(--bg-preview); }\n .preview-img { width: 100%; aspect-ratio: 1200/630; background: linear-gradient(135deg, var(--accent-light), var(--bg-card)); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 12px; overflow: hidden; }\n .preview-img img { width: 100%; height: 100%; object-fit: cover; }\n .preview-body { padding: 10px 12px; }\n .preview-url { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .preview-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n .preview-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n .empty { text-align: center; padding: 60px; color: var(--text-muted); }\n .spin { animation: spin 0.6s linear infinite; }\n @keyframes spin { to { transform: rotate(360deg); } }\n </style>\n</head>\n<body>\n <div class=\"header\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\"/></svg>\n <h1>OG Viewer <span>/ ox-content</span></h1>\n <div class=\"header-actions\">\n <button class=\"btn\" id=\"refresh-btn\" onclick=\"refresh()\">Refresh</button>\n </div>\n </div>\n <div class=\"summary\" id=\"summary\">\n <div class=\"summary-item\"><strong id=\"s-pages\">${pages.length}</strong>&nbsp;pages</div>\n <div class=\"summary-item\"><span class=\"summary-dot dot-error\"></span>&nbsp;<strong id=\"s-errors\">${totalErrors}</strong>&nbsp;errors</div>\n <div class=\"summary-item\"><span class=\"summary-dot dot-warning\"></span>&nbsp;<strong id=\"s-warnings\">${totalWarnings}</strong>&nbsp;warnings</div>\n <div class=\"summary-item\"><span class=\"summary-dot ${generateOgImage ? \"dot-success\" : \"dot-warning\"}\"></span>&nbsp;ogImage: <strong>${generateOgImage ? \"enabled\" : \"disabled\"}</strong></div>\n </div>\n <div class=\"toolbar\">\n <button class=\"filter-btn active\" data-filter=\"all\" onclick=\"setFilter('all')\">All</button>\n <button class=\"filter-btn\" data-filter=\"warnings\" onclick=\"setFilter('warnings')\">Warnings</button>\n <button class=\"filter-btn\" data-filter=\"errors\" onclick=\"setFilter('errors')\">Errors</button>\n <input class=\"search-input\" type=\"text\" placeholder=\"Search pages...\" oninput=\"applyFilters()\" id=\"search-input\">\n </div>\n <div class=\"container\" id=\"container\"></div>\n\n <script>\n let pages = ${JSON.stringify(pages)};\n let currentFilter = 'all';\n\n function setFilter(f) {\n currentFilter = f;\n document.querySelectorAll('.filter-btn').forEach(b => b.classList.toggle('active', b.dataset.filter === f));\n applyFilters();\n }\n\n function applyFilters() {\n const q = document.getElementById('search-input').value.toLowerCase();\n const filtered = pages.filter(p => {\n if (currentFilter === 'errors' && !p.warnings.some(w => w.level === 'error')) return false;\n if (currentFilter === 'warnings' && !p.warnings.length) return false;\n if (q && !p.path.toLowerCase().includes(q) && !p.title.toLowerCase().includes(q) && !p.description.toLowerCase().includes(q)) return false;\n return true;\n });\n renderCards(filtered);\n }\n\n function esc(s) {\n const d = document.createElement('div');\n d.textContent = s;\n return d.innerHTML;\n }\n\n function renderCards(list) {\n const c = document.getElementById('container');\n if (!list.length) {\n c.innerHTML = '<div class=\"empty\">No pages match the current filter.</div>';\n return;\n }\n c.innerHTML = list.map(p => {\n const warnings = p.warnings.map(w =>\n '<div class=\"warning-item ' + w.level + '\">' + (w.level === 'error' ? '\\\\u2716' : '\\\\u26A0') + ' ' + esc(w.message) + '</div>'\n ).join('');\n const tags = p.tags.map(t => '<span class=\"tag\">' + esc(t) + '</span>').join('');\n const author = p.author ? '<span class=\"tag\">by ' + esc(p.author) + '</span>' : '';\n const imgHtml = p.ogImageUrl\n ? '<img src=\"' + esc(p.ogImageUrl) + '\" onerror=\"this.parentNode.innerHTML=\\\\'No OG image\\\\'\">'\n : 'No OG image';\n const siteHost = ${JSON.stringify(options.ssg.siteUrl || \"example.com\")};\n return '<div class=\"card\">'\n + '<div class=\"card-header\">'\n + '<div class=\"card-path\">' + esc(p.path) + ' &rarr; ' + esc(p.urlPath) + '</div>'\n + '<div class=\"card-title\">' + (esc(p.title) || '<em style=\"color:var(--error)\">No title</em>') + '</div>'\n + (p.description ? '<div class=\"card-desc\">' + esc(p.description) + '</div>' : '')\n + (tags || author ? '<div class=\"card-meta\">' + author + tags + '</div>' : '')\n + '</div>'\n + (warnings ? '<div class=\"card-warnings\">' + warnings + '</div>' : '')\n + '<div class=\"card-previews\">'\n + '<div class=\"preview\"><div class=\"preview-label\">Twitter (summary_large_image)</div><div class=\"preview-card\"><div class=\"preview-img\">' + imgHtml + '</div><div class=\"preview-body\"><div class=\"preview-url\">' + esc(siteHost) + '</div><div class=\"preview-title\">' + esc(p.title) + '</div><div class=\"preview-desc\">' + esc(p.description) + '</div></div></div></div>'\n + '<div class=\"preview\"><div class=\"preview-label\">Facebook (Open Graph)</div><div class=\"preview-card\"><div class=\"preview-img\">' + imgHtml + '</div><div class=\"preview-body\"><div class=\"preview-url\">' + esc(siteHost) + '</div><div class=\"preview-title\">' + esc(p.title) + '</div><div class=\"preview-desc\">' + esc(p.description) + '</div></div></div></div>'\n + '</div>'\n + '</div>';\n }).join('');\n }\n\n async function refresh() {\n const btn = document.getElementById('refresh-btn');\n btn.textContent = 'Refreshing...';\n btn.disabled = true;\n try {\n const res = await fetch('/__og-viewer/api/pages');\n pages = await res.json();\n updateSummary();\n applyFilters();\n } catch(e) {\n console.error('Refresh failed:', e);\n } finally {\n btn.textContent = 'Refresh';\n btn.disabled = false;\n }\n }\n\n function updateSummary() {\n document.getElementById('s-pages').textContent = pages.length;\n document.getElementById('s-errors').textContent = pages.reduce((s,p) => s + p.warnings.filter(w => w.level === 'error').length, 0);\n document.getElementById('s-warnings').textContent = pages.reduce((s,p) => s + p.warnings.filter(w => w.level === 'warning').length, 0);\n }\n\n renderCards(pages);\n </script>\n</body>\n</html>`;\n}\n\n// =============================================================================\n// Plugin\n// =============================================================================\n\nexport function createOgViewerPlugin(options: ResolvedOptions): Plugin {\n return {\n name: \"ox-content:og-viewer\",\n apply: \"serve\",\n\n configureServer(server) {\n server.middlewares.use(async (req, res, next) => {\n if (req.url === \"/__og-viewer\" || req.url === \"/__og-viewer/\") {\n const root = server.config.root || process.cwd();\n try {\n const pages = await collectPages(options, root);\n const html = renderViewerHtml(pages, options);\n res.setHeader(\"Content-Type\", \"text/html; charset=utf-8\");\n res.end(html);\n } catch (err) {\n res.statusCode = 500;\n res.end(`OG Viewer error: ${err instanceof Error ? err.message : String(err)}`);\n }\n return;\n }\n\n if (req.url === \"/__og-viewer/api/pages\") {\n const root = server.config.root || process.cwd();\n try {\n const pages = await collectPages(options, root);\n res.setHeader(\"Content-Type\", \"application/json; charset=utf-8\");\n res.end(JSON.stringify(pages));\n } catch (err) {\n res.statusCode = 500;\n res.end(JSON.stringify({ error: String(err) }));\n }\n return;\n }\n\n next();\n });\n },\n };\n}\n","/**\n * Custom JSX Runtime for Static HTML Generation\n *\n * This module provides a JSX runtime that outputs static HTML strings.\n * No React, no hydration, no client-side JavaScript - just pure HTML.\n *\n * @example\n * ```tsx\n * // tsconfig.json or vite.config.ts\n * {\n * \"compilerOptions\": {\n * \"jsx\": \"react-jsx\",\n * \"jsxImportSource\": \"@ox-content/vite-plugin\"\n * }\n * }\n *\n * // MyComponent.tsx\n * export function Hero({ title }: { title: string }) {\n * return (\n * <section class=\"hero\">\n * <h1>{title}</h1>\n * </section>\n * );\n * }\n * ```\n */\n\n// Self-closing tags that don't need closing tags\nconst VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\n// Attributes that should be rendered as boolean\nconst BOOLEAN_ATTRS = new Set([\n \"allowfullscreen\",\n \"async\",\n \"autofocus\",\n \"autoplay\",\n \"checked\",\n \"controls\",\n \"default\",\n \"defer\",\n \"disabled\",\n \"formnovalidate\",\n \"hidden\",\n \"inert\",\n \"ismap\",\n \"itemscope\",\n \"loop\",\n \"multiple\",\n \"muted\",\n \"nomodule\",\n \"novalidate\",\n \"open\",\n \"playsinline\",\n \"readonly\",\n \"required\",\n \"reversed\",\n \"selected\",\n]);\n\n/**\n * Escapes HTML special characters to prevent XSS.\n */\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#x27;\");\n}\n\n/**\n * Converts a camelCase attribute name to kebab-case for HTML.\n * Special handling for data-* and aria-* attributes.\n */\nfunction toHtmlAttr(name: string): string {\n // className -> class\n if (name === \"className\") return \"class\";\n // htmlFor -> for\n if (name === \"htmlFor\") return \"for\";\n // Keep data-* and aria-* as-is\n if (name.startsWith(\"data\") || name.startsWith(\"aria\")) {\n return name.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n }\n return name;\n}\n\n/**\n * Renders an attribute value to a string.\n */\nfunction renderAttr(name: string, value: unknown): string {\n const htmlName = toHtmlAttr(name);\n\n // Skip undefined, null, and false values\n if (value === undefined || value === null || value === false) {\n return \"\";\n }\n\n // Boolean attributes\n if (BOOLEAN_ATTRS.has(htmlName)) {\n return value ? ` ${htmlName}` : \"\";\n }\n\n // Style object to string\n if (name === \"style\" && typeof value === \"object\") {\n const styleStr = Object.entries(value as Record<string, string | number>)\n .map(([k, v]) => {\n const prop = k.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n return `${prop}:${v}`;\n })\n .join(\";\");\n return ` style=\"${escapeHtml(styleStr)}\"`;\n }\n\n // Regular attribute\n return ` ${htmlName}=\"${escapeHtml(String(value as string | number | boolean))}\"`;\n}\n\n/**\n * JSX element type - either a string (intrinsic) or a function component.\n */\nexport type JSXElementType = string | ((props: Record<string, unknown>) => JSXNode);\n\n/**\n * Valid JSX child types.\n */\nexport type JSXChild = string | number | boolean | null | undefined | JSXNode | JSXChild[];\n\n/**\n * JSX node - the result of JSX expressions.\n */\nexport interface JSXNode {\n __html: string;\n}\n\n/**\n * Props with children.\n */\nexport interface JSXProps {\n children?: JSXChild;\n [key: string]: unknown;\n}\n\n/**\n * Renders children to HTML string.\n */\nfunction renderChildren(children: JSXChild): string {\n if (children === null || children === undefined || children === false) {\n return \"\";\n }\n\n if (children === true) {\n return \"\";\n }\n\n if (typeof children === \"string\") {\n return escapeHtml(children);\n }\n\n if (typeof children === \"number\") {\n return String(children);\n }\n\n if (Array.isArray(children)) {\n return children.map(renderChildren).join(\"\");\n }\n\n if (typeof children === \"object\" && \"__html\" in children) {\n return children.__html;\n }\n\n return \"\";\n}\n\n/**\n * Creates a JSX element.\n * This is the core function called by the JSX transform.\n */\nexport function jsx(type: JSXElementType, props: JSXProps, _key?: string): JSXNode {\n const { children, ...restProps } = props;\n\n // Function component\n if (typeof type === \"function\") {\n return type({ ...restProps, children });\n }\n\n // Intrinsic element (HTML tag)\n const tag = type;\n let html = `<${tag}`;\n\n // Render attributes\n for (const [name, value] of Object.entries(restProps)) {\n // Skip internal props\n if (name === \"key\" || name === \"ref\") continue;\n html += renderAttr(name, value);\n }\n\n // Self-closing tags\n if (VOID_ELEMENTS.has(tag)) {\n html += \" />\";\n return { __html: html };\n }\n\n html += \">\";\n\n // Render children\n if (children !== undefined) {\n html += renderChildren(children);\n }\n\n html += `</${tag}>`;\n\n return { __html: html };\n}\n\n/**\n * Creates a JSX element with static children.\n * Called by the JSX transform for elements with multiple children.\n */\nexport function jsxs(type: JSXElementType, props: JSXProps, key?: string): JSXNode {\n return jsx(type, props, key);\n}\n\n/**\n * Fragment component - renders children without a wrapper element.\n */\nexport function Fragment({ children }: { children?: JSXChild }): JSXNode {\n return { __html: renderChildren(children) };\n}\n\n/**\n * Renders a JSX node to an HTML string.\n */\nexport function renderToString(node: JSXNode): string {\n return node.__html;\n}\n\n/**\n * Creates raw HTML without escaping.\n * Use with caution - only for trusted content.\n *\n * @example\n * ```tsx\n * <div>{raw('<strong>Bold</strong>')}</div>\n * ```\n */\nexport function raw(html: string): JSXNode {\n return { __html: html };\n}\n\n/**\n * Conditionally renders content.\n *\n * @example\n * ```tsx\n * {when(isLoggedIn, <UserMenu />)}\n * ```\n */\nexport function when(condition: boolean, content: JSXNode): JSXNode {\n return condition ? content : { __html: \"\" };\n}\n\n/**\n * Maps over an array and renders each item.\n *\n * @example\n * ```tsx\n * {each(items, (item) => <li>{item.name}</li>)}\n * ```\n */\nexport function each<T>(items: T[], render: (item: T, index: number) => JSXNode): JSXNode {\n const html = items.map((item, i) => render(item, i).__html).join(\"\");\n return { __html: html };\n}\n\n// Default export for convenience\nexport default {\n jsx,\n jsxs,\n Fragment,\n renderToString,\n raw,\n when,\n each,\n};\n","/**\n * Page Context for Static HTML Generation\n *\n * Provides a way to access page props (frontmatter, content, etc.)\n * from theme components during static rendering.\n *\n * @example\n * ```tsx\n * // theme/Layout.tsx\n * import { usePageProps, PageProps } from '@ox-content/vite-plugin';\n *\n * export function Layout({ children }: { children: JSX.Element }) {\n * const page = usePageProps<MyPageProps>();\n * return (\n * <html>\n * <head>\n * <title>{page.title}</title>\n * </head>\n * <body>\n * <header>{page.title}</header>\n * <main>{children}</main>\n * </body>\n * </html>\n * );\n * }\n * ```\n */\n\nimport type { TocEntry } from \"./types\";\n\n/**\n * Base page props available for all pages.\n */\nexport interface BasePageProps {\n /** Page title from frontmatter or first heading */\n title: string;\n /** Page description from frontmatter */\n description?: string;\n /** Rendered HTML content */\n html: string;\n /** Table of contents entries */\n toc: TocEntry[];\n /** Source file path (relative to docs root) */\n path: string;\n /** Output URL path */\n url: string;\n /** Raw frontmatter object */\n frontmatter: Record<string, unknown>;\n /** Layout name from frontmatter */\n layout?: string;\n}\n\n/**\n * Extended page props with custom frontmatter.\n */\nexport type PageProps<T extends Record<string, unknown> = Record<string, unknown>> =\n BasePageProps & {\n /** Custom frontmatter fields */\n frontmatter: T & Record<string, unknown>;\n };\n\n/**\n * Site-wide configuration available in context.\n */\nexport interface SiteConfig {\n /** Site name */\n name: string;\n /** Base URL path */\n base: string;\n /** All pages in the site */\n pages: BasePageProps[];\n /** Navigation groups */\n nav: NavGroup[];\n}\n\n/**\n * Navigation group.\n */\nexport interface NavGroup {\n title: string;\n items: NavItem[];\n}\n\n/**\n * Navigation item.\n */\nexport interface NavItem {\n title: string;\n path: string;\n href: string;\n}\n\n/**\n * Complete render context.\n */\nexport interface RenderContext<T extends Record<string, unknown> = Record<string, unknown>> {\n /** Current page props */\n page: PageProps<T>;\n /** Site configuration */\n site: SiteConfig;\n}\n\n// Internal context storage (set during render)\nlet currentContext: RenderContext | null = null;\n\n/**\n * Sets the current render context.\n * Called internally during page rendering.\n * @internal\n */\nexport function setRenderContext(ctx: RenderContext): void {\n currentContext = ctx;\n}\n\n/**\n * Clears the current render context.\n * Called internally after page rendering.\n * @internal\n */\nexport function clearRenderContext(): void {\n currentContext = null;\n}\n\n/**\n * Gets the current page props.\n *\n * @returns The current page props\n * @throws Error if called outside of a render context\n *\n * @example\n * ```tsx\n * function PageTitle() {\n * const page = usePageProps();\n * return <h1>{page.title}</h1>;\n * }\n * ```\n */\nexport function usePageProps<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(): PageProps<T> {\n if (!currentContext) {\n throw new Error(\n \"[ox-content] usePageProps() must be called during page rendering. \" +\n \"Make sure you are using it inside a theme component.\",\n );\n }\n return currentContext.page as PageProps<T>;\n}\n\n/**\n * Gets the site configuration.\n *\n * @returns The site configuration\n * @throws Error if called outside of a render context\n *\n * @example\n * ```tsx\n * function SiteHeader() {\n * const site = useSiteConfig();\n * return <header>{site.name}</header>;\n * }\n * ```\n */\nexport function useSiteConfig(): SiteConfig {\n if (!currentContext) {\n throw new Error(\n \"[ox-content] useSiteConfig() must be called during page rendering. \" +\n \"Make sure you are using it inside a theme component.\",\n );\n }\n return currentContext.site;\n}\n\n/**\n * Gets the full render context.\n *\n * @returns The complete render context\n * @throws Error if called outside of a render context\n *\n * @example\n * ```tsx\n * function Layout({ children }) {\n * const ctx = useRenderContext();\n * return (\n * <html>\n * <head><title>{ctx.page.title} - {ctx.site.name}</title></head>\n * <body>{children}</body>\n * </html>\n * );\n * }\n * ```\n */\nexport function useRenderContext<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(): RenderContext<T> {\n if (!currentContext) {\n throw new Error(\n \"[ox-content] useRenderContext() must be called during page rendering. \" +\n \"Make sure you are using it inside a theme component.\",\n );\n }\n return currentContext as RenderContext<T>;\n}\n\n/**\n * Gets the navigation groups.\n *\n * @example\n * ```tsx\n * function Sidebar() {\n * const nav = useNav();\n * return (\n * <nav>\n * {each(nav, (group) => (\n * <div>\n * <h3>{group.title}</h3>\n * <ul>\n * {each(group.items, (item) => (\n * <li><a href={item.href}>{item.title}</a></li>\n * ))}\n * </ul>\n * </div>\n * ))}\n * </nav>\n * );\n * }\n * ```\n */\nexport function useNav(): NavGroup[] {\n return useSiteConfig().nav;\n}\n\n/**\n * Checks if the given path is the current page.\n *\n * @example\n * ```tsx\n * function NavLink({ href, children }) {\n * const isActive = useIsActive(href);\n * return <a href={href} class={isActive ? 'active' : ''}>{children}</a>;\n * }\n * ```\n */\nexport function useIsActive(path: string): boolean {\n const page = usePageProps();\n return page.path === path || page.url === path;\n}\n\n// Type generation helpers\n\n/**\n * Schema for frontmatter type generation.\n */\nexport interface FrontmatterSchema {\n /** Field name */\n name: string;\n /** TypeScript type */\n type: string;\n /** Whether the field is optional */\n optional: boolean;\n /** JSDoc description */\n description?: string;\n}\n\n/**\n * Infers TypeScript types from frontmatter values.\n */\nexport function inferType(value: unknown): string {\n if (value === null) return \"null\";\n if (value === undefined) return \"undefined\";\n if (typeof value === \"string\") return \"string\";\n if (typeof value === \"number\") return \"number\";\n if (typeof value === \"boolean\") return \"boolean\";\n if (Array.isArray(value)) {\n if (value.length === 0) return \"unknown[]\";\n const itemTypes = [...new Set(value.map(inferType))];\n if (itemTypes.length === 1) return `${itemTypes[0]}[]`;\n return `(${itemTypes.join(\" | \")})[]`;\n }\n if (typeof value === \"object\") {\n const entries = Object.entries(value as Record<string, unknown>);\n if (entries.length === 0) return \"Record<string, unknown>\";\n const props = entries.map(([k, v]) => `${k}: ${inferType(v)}`).join(\"; \");\n return `{ ${props} }`;\n }\n return \"unknown\";\n}\n\n/**\n * Generates TypeScript interface from frontmatter samples.\n */\nexport function generateFrontmatterTypes(\n samples: Record<string, unknown>[],\n interfaceName = \"PageFrontmatter\",\n): string {\n // Collect all fields and their types across all samples\n const fields = new Map<string, { types: Set<string>; count: number }>();\n\n for (const sample of samples) {\n for (const [key, value] of Object.entries(sample)) {\n const existing = fields.get(key) ?? { types: new Set(), count: 0 };\n existing.types.add(inferType(value));\n existing.count++;\n fields.set(key, existing);\n }\n }\n\n // Generate interface\n const lines: string[] = [\n \"/**\",\n \" * Auto-generated frontmatter type based on your pages.\",\n \" * DO NOT EDIT - this file is generated by ox-content.\",\n \" */\",\n \"\",\n `export interface ${interfaceName} {`,\n ];\n\n for (const [name, { types, count }] of fields) {\n const isOptional = count < samples.length;\n const typeStr = [...types].join(\" | \");\n const optionalMark = isOptional ? \"?\" : \"\";\n lines.push(` ${name}${optionalMark}: ${typeStr};`);\n }\n\n lines.push(\"}\");\n lines.push(\"\");\n lines.push(\n `export type PageProps = import('@ox-content/vite-plugin').PageProps<${interfaceName}>;`,\n );\n lines.push(\"\");\n\n return lines.join(\"\\n\");\n}\n","/**\n * Theme Renderer for Static HTML Generation\n *\n * Renders JSX theme components to static HTML strings.\n * No client-side JavaScript is included by default.\n */\n\nimport { renderToString, raw, type JSXNode } from \"./jsx-runtime\";\nimport {\n setRenderContext,\n clearRenderContext,\n generateFrontmatterTypes,\n type RenderContext,\n type PageProps,\n type SiteConfig,\n type NavGroup,\n} from \"./page-context\";\nimport type { TocEntry } from \"./types\";\nimport { writeFile, mkdir } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\n/**\n * Theme component type.\n */\nexport type ThemeComponent = (props: ThemeProps) => JSXNode;\n\n/**\n * Props passed to the theme component.\n */\nexport interface ThemeProps {\n /** Rendered page content as JSX */\n children: JSXNode;\n}\n\n/**\n * Page data for rendering.\n */\nexport interface PageData {\n /** Page title */\n title: string;\n /** Page description */\n description?: string;\n /** Rendered HTML content */\n html: string;\n /** Table of contents */\n toc: TocEntry[];\n /** Source file path */\n path: string;\n /** Output URL path */\n url: string;\n /** Frontmatter */\n frontmatter: Record<string, unknown>;\n /** Layout name */\n layout?: string;\n}\n\n/**\n * Theme render options.\n */\nexport interface ThemeRenderOptions {\n /** Theme component to use */\n theme: ThemeComponent;\n /** Site name */\n siteName: string;\n /** Base URL path */\n base: string;\n /** Navigation groups */\n nav: NavGroup[];\n /** All pages (for site context) */\n pages: PageData[];\n /** Output directory for type definitions */\n typesOutDir?: string;\n}\n\n/**\n * Renders a page using the theme component.\n *\n * @param page - Page data to render\n * @param options - Theme render options\n * @returns Rendered HTML string\n */\nexport function renderPage(page: PageData, options: ThemeRenderOptions): string {\n const { theme, siteName, base, nav, pages } = options;\n\n // Build page props\n const pageProps: PageProps = {\n title: page.title,\n description: page.description,\n html: page.html,\n toc: page.toc,\n path: page.path,\n url: page.url,\n frontmatter: page.frontmatter,\n layout: page.layout,\n };\n\n // Build site config\n const siteConfig: SiteConfig = {\n name: siteName,\n base,\n nav,\n pages: pages.map((p) => ({\n title: p.title,\n description: p.description,\n html: p.html,\n toc: p.toc,\n path: p.path,\n url: p.url,\n frontmatter: p.frontmatter,\n layout: p.layout,\n })),\n };\n\n // Set render context\n const context: RenderContext = {\n page: pageProps,\n site: siteConfig,\n };\n\n setRenderContext(context);\n\n try {\n // Render theme with page content\n const contentNode = raw(page.html);\n const result = theme({ children: contentNode });\n\n // Get HTML string\n const html = renderToString(result);\n\n // Add doctype if not present\n if (!html.trimStart().toLowerCase().startsWith(\"<!doctype\")) {\n return `<!DOCTYPE html>\\n${html}`;\n }\n\n return html;\n } finally {\n clearRenderContext();\n }\n}\n\n/**\n * Renders all pages and generates type definitions.\n *\n * @param pages - All pages to render\n * @param options - Theme render options\n * @returns Map of output paths to rendered HTML\n */\nexport async function renderAllPages(\n pages: PageData[],\n options: ThemeRenderOptions,\n): Promise<Map<string, string>> {\n const results = new Map<string, string>();\n\n // Render each page\n for (const page of pages) {\n const html = renderPage(page, { ...options, pages });\n results.set(page.url, html);\n }\n\n // Generate type definitions if output directory is specified\n if (options.typesOutDir) {\n await generateTypes(pages, options.typesOutDir);\n }\n\n return results;\n}\n\n/**\n * Generates TypeScript type definitions from page frontmatter.\n *\n * @param pages - All pages\n * @param outDir - Output directory for types\n */\nexport async function generateTypes(pages: PageData[], outDir: string): Promise<void> {\n // Collect all frontmatter samples\n const samples = pages.map((p) => p.frontmatter);\n\n // Generate types\n const types = generateFrontmatterTypes(samples);\n\n // Write to file\n const typesPath = join(outDir, \"page-props.d.ts\");\n await mkdir(dirname(typesPath), { recursive: true });\n await writeFile(typesPath, types, \"utf-8\");\n}\n\n/**\n * Default theme component.\n * A minimal theme that renders page content with basic styling.\n */\nexport function DefaultTheme({ children }: ThemeProps): JSXNode {\n // Use hooks inside the component\n const { usePageProps, useSiteConfig } = require(\"./page-context\");\n const page = usePageProps();\n const site = useSiteConfig();\n\n return {\n __html: `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${escapeHtml(page.title)} - ${escapeHtml(site.name)}</title>\n ${page.description ? `<meta name=\"description\" content=\"${escapeHtml(page.description)}\">` : \"\"}\n <style>\n :root {\n --octc-color-primary: #e04d0a;\n --octc-color-text: #1a1a1a;\n --octc-color-bg: #ffffff;\n }\n body {\n font-family: system-ui, sans-serif;\n line-height: 1.6;\n color: var(--octc-color-text);\n background: var(--octc-color-bg);\n max-width: 800px;\n margin: 0 auto;\n padding: 2rem;\n }\n a { color: var(--octc-color-primary); }\n </style>\n</head>\n<body>\n <header>\n <h1>${escapeHtml(site.name)}</h1>\n </header>\n <main>\n ${children.__html}\n </main>\n</body>\n</html>`,\n };\n}\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\");\n}\n\n/**\n * Creates a theme with layout switching support.\n *\n * @example\n * ```tsx\n * import { createTheme } from '@ox-content/vite-plugin';\n * import { DefaultLayout } from './layouts/Default';\n * import { EntryLayout } from './layouts/Entry';\n *\n * export default createTheme({\n * layouts: {\n * default: DefaultLayout,\n * entry: EntryLayout,\n * },\n * });\n * ```\n */\nexport function createTheme(config: {\n layouts: Record<string, ThemeComponent>;\n defaultLayout?: string;\n}): ThemeComponent {\n const { layouts, defaultLayout = \"default\" } = config;\n\n return function ThemeWithLayouts({ children }: ThemeProps): JSXNode {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const { usePageProps } = require(\"./page-context\");\n const page = usePageProps();\n\n // Get layout from frontmatter or use default\n const layoutName = page.layout ?? defaultLayout;\n const Layout = layouts[layoutName] ?? layouts[defaultLayout];\n\n if (!Layout) {\n throw new Error(\n `[ox-content] Layout \"${layoutName}\" not found. ` +\n `Available layouts: ${Object.keys(layouts).join(\", \")}`,\n );\n }\n\n return Layout({ children });\n };\n}\n","/**\n * Vite Plugin for Ox Content\n *\n * Uses Vite's Environment API for SSG-focused Markdown processing.\n * Provides separate environments for client and server rendering.\n */\n\nimport * as path from \"path\";\nimport type { Plugin, ViteDevServer, ResolvedConfig } from \"vite\";\nimport { createMarkdownEnvironment } from \"./environment\";\nimport { transformMarkdown } from \"./transform\";\nimport { extractDocs, generateMarkdown, writeDocs, resolveDocsOptions } from \"./docs\";\nimport { buildSsg, resolveSsgOptions } from \"./ssg\";\nimport {\n resolveSearchOptions,\n buildSearchIndex,\n writeSearchIndex,\n generateSearchModule,\n} from \"./search\";\nimport { resolveOgImageOptions } from \"./og-image\";\nimport {\n createDevServerMiddleware,\n createDevServerCache,\n invalidateNavCache,\n invalidatePageCache,\n} from \"./dev-server\";\nimport { createOgViewerPlugin } from \"./og-viewer\";\nimport type { OxContentOptions, ResolvedOptions } from \"./types\";\n\nexport type { OxContentOptions } from \"./types\";\nexport type {\n DocsOptions,\n ResolvedDocsOptions,\n DocEntry,\n ParamDoc,\n ReturnDoc,\n ExtractedDocs,\n SsgOptions,\n ResolvedSsgOptions,\n SearchOptions,\n ResolvedSearchOptions,\n SearchDocument,\n SearchResult,\n // Entry page types\n HeroAction,\n HeroImage,\n HeroConfig,\n FeatureConfig,\n EntryPageConfig,\n} from \"./types\";\n\n/**\n * Creates the Ox Content Vite plugin.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import { oxContent } from '@ox-content/vite-plugin';\n *\n * export default defineConfig({\n * plugins: [\n * oxContent({\n * srcDir: 'content',\n * gfm: true,\n * }),\n * ],\n * });\n * ```\n */\nexport function oxContent(options: OxContentOptions = {}): Plugin[] {\n const resolvedOptions = resolveOptions(options);\n let config: ResolvedConfig;\n let _server: ViteDevServer | undefined;\n\n const mainPlugin: Plugin = {\n name: \"ox-content\",\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n\n configureServer(devServer) {\n _server = devServer;\n\n // Add middleware for serving Markdown files\n devServer.middlewares.use(async (req, res, next) => {\n const url = req.url;\n if (!url || !url.endsWith(\".md\")) {\n return next();\n }\n\n // Let Vite handle the transformation\n next();\n });\n },\n\n resolveId(id) {\n // Handle virtual modules for Markdown imports\n if (id.startsWith(\"virtual:ox-content/\")) {\n return \"\\0\" + id;\n }\n\n // Resolve .md files\n if (id.endsWith(\".md\")) {\n return id;\n }\n\n return null;\n },\n\n async load(id) {\n // Handle virtual modules\n if (id.startsWith(\"\\0virtual:ox-content/\")) {\n const path = id.slice(\"\\0virtual:ox-content/\".length);\n return generateVirtualModule(path, resolvedOptions);\n }\n\n return null;\n },\n\n async transform(code, id) {\n if (!id.endsWith(\".md\")) {\n return null;\n }\n\n // Transform Markdown to JavaScript module\n const result = await transformMarkdown(code, id, resolvedOptions);\n\n return {\n code: result.code,\n map: null,\n };\n },\n\n // Hot Module Replacement support\n async handleHotUpdate({ file, server }) {\n if (file.endsWith(\".md\")) {\n // Notify client about the update\n server.ws.send({\n type: \"custom\",\n event: \"ox-content:update\",\n data: { file },\n });\n\n // Return empty array to prevent default HMR\n // We handle it ourselves\n const modules = server.moduleGraph.getModulesByFile(file);\n return modules ? Array.from(modules) : [];\n }\n },\n };\n\n // Environment API plugin for SSG\n const environmentPlugin: Plugin = {\n name: \"ox-content:environment\",\n\n config() {\n return {\n environments: {\n // Markdown processing environment\n markdown: createMarkdownEnvironment(resolvedOptions),\n },\n };\n },\n };\n\n // Docs generation plugin (builtin, opt-out)\n const docsPlugin: Plugin = {\n name: \"ox-content:docs\",\n\n async buildStart() {\n const docsOptions = resolvedOptions.docs;\n if (!docsOptions || !docsOptions.enabled) {\n return;\n }\n\n // Generate docs at build start\n const root = config?.root || process.cwd();\n const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));\n const outDir = path.resolve(root, docsOptions.out);\n\n try {\n const extracted = await extractDocs(srcDirs, docsOptions);\n\n if (extracted.length > 0) {\n const generated = generateMarkdown(extracted, docsOptions);\n await writeDocs(generated, outDir, extracted, docsOptions);\n\n console.log(\n `[ox-content] Generated ${Object.keys(generated).length} documentation files to ${docsOptions.out}`,\n );\n }\n } catch (err) {\n console.warn(\"[ox-content] Failed to generate documentation:\", err);\n }\n },\n\n configureServer(devServer) {\n const docsOptions = resolvedOptions.docs;\n if (!docsOptions || !docsOptions.enabled) {\n return;\n }\n\n // Watch source directories for changes\n const root = config?.root || process.cwd();\n const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));\n\n for (const srcDir of srcDirs) {\n devServer.watcher.add(srcDir);\n }\n\n // Regenerate docs on file changes\n devServer.watcher.on(\"change\", async (file) => {\n const isSourceFile = srcDirs.some(\n (srcDir) => file.startsWith(srcDir) && (file.endsWith(\".ts\") || file.endsWith(\".tsx\")),\n );\n\n if (isSourceFile) {\n const outDir = path.resolve(root, docsOptions.out);\n\n try {\n const extracted = await extractDocs(srcDirs, docsOptions);\n if (extracted.length > 0) {\n const generated = generateMarkdown(extracted, docsOptions);\n await writeDocs(generated, outDir, extracted, docsOptions);\n }\n } catch {\n // Ignore errors during dev\n }\n }\n });\n },\n };\n\n // SSG plugin (builtin, opt-in by default)\n const ssgDevCache = createDevServerCache();\n const ssgPlugin: Plugin = {\n name: \"ox-content:ssg\",\n\n configureServer(devServer) {\n const ssgOptions = resolvedOptions.ssg;\n if (!ssgOptions.enabled) return;\n\n const root = config?.root || process.cwd();\n const srcDir = path.resolve(root, resolvedOptions.srcDir);\n\n // Register dev server middleware\n devServer.middlewares.use(createDevServerMiddleware(resolvedOptions, root, ssgDevCache));\n\n // Watch for .md file add/unlink to invalidate nav cache\n devServer.watcher.on(\"add\", (file: string) => {\n if (file.startsWith(srcDir) && file.endsWith(\".md\")) {\n invalidateNavCache(ssgDevCache);\n }\n });\n devServer.watcher.on(\"unlink\", (file: string) => {\n if (file.startsWith(srcDir) && file.endsWith(\".md\")) {\n invalidateNavCache(ssgDevCache);\n }\n });\n\n // Watch for .md file changes to invalidate page cache\n devServer.watcher.on(\"change\", (file: string) => {\n if (file.startsWith(srcDir) && file.endsWith(\".md\")) {\n invalidatePageCache(ssgDevCache, file);\n }\n });\n },\n\n async closeBundle() {\n const ssgOptions = resolvedOptions.ssg;\n if (!ssgOptions.enabled) {\n return;\n }\n\n const root = config?.root || process.cwd();\n\n try {\n const result = await buildSsg(resolvedOptions, root);\n\n if (result.files.length > 0) {\n console.log(`[ox-content] Generated ${result.files.length} HTML files`);\n }\n\n if (result.errors.length > 0) {\n for (const error of result.errors) {\n console.warn(`[ox-content] ${error}`);\n }\n }\n } catch (err) {\n console.error(\"[ox-content] SSG build failed:\", err);\n }\n },\n };\n\n // Search plugin\n let searchIndexJson = \"\";\n const searchPlugin: Plugin = {\n name: \"ox-content:search\",\n\n resolveId(id) {\n if (id === \"virtual:ox-content/search\") {\n return \"\\0virtual:ox-content/search\";\n }\n return null;\n },\n\n async load(id) {\n if (id === \"\\0virtual:ox-content/search\") {\n const searchOptions = resolvedOptions.search;\n if (!searchOptions.enabled) {\n return \"export const search = () => []; export const searchOptions = { enabled: false }; export default { search, searchOptions };\";\n }\n\n const indexPath = resolvedOptions.base + \"search-index.json\";\n return generateSearchModule(searchOptions, indexPath);\n }\n return null;\n },\n\n async buildStart() {\n const searchOptions = resolvedOptions.search;\n if (!searchOptions.enabled) {\n return;\n }\n\n const root = config?.root || process.cwd();\n const srcDir = path.resolve(root, resolvedOptions.srcDir);\n\n try {\n searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base);\n console.log(\"[ox-content] Search index built\");\n } catch (err) {\n console.warn(\"[ox-content] Failed to build search index:\", err);\n }\n },\n\n async closeBundle() {\n const searchOptions = resolvedOptions.search;\n if (!searchOptions.enabled || !searchIndexJson) {\n return;\n }\n\n const root = config?.root || process.cwd();\n const outDir = path.resolve(root, resolvedOptions.outDir);\n\n try {\n await writeSearchIndex(searchIndexJson, outDir);\n console.log(\"[ox-content] Search index written to\", path.join(outDir, \"search-index.json\"));\n } catch (err) {\n console.warn(\"[ox-content] Failed to write search index:\", err);\n }\n },\n };\n\n const plugins: Plugin[] = [mainPlugin, environmentPlugin, docsPlugin, ssgPlugin, searchPlugin];\n\n if (resolvedOptions.ogViewer) {\n plugins.push(createOgViewerPlugin(resolvedOptions));\n }\n\n return plugins;\n}\n\n/**\n * Resolves plugin options with defaults.\n */\nfunction resolveOptions(options: OxContentOptions): ResolvedOptions {\n return {\n srcDir: options.srcDir ?? \"content\",\n outDir: options.outDir ?? \"dist\",\n base: options.base ?? \"/\",\n ssg: resolveSsgOptions(options.ssg),\n gfm: options.gfm ?? true,\n footnotes: options.footnotes ?? true,\n tables: options.tables ?? true,\n taskLists: options.taskLists ?? true,\n strikethrough: options.strikethrough ?? true,\n highlight: options.highlight ?? false,\n highlightTheme: options.highlightTheme ?? \"github-dark\",\n mermaid: options.mermaid ?? false,\n frontmatter: options.frontmatter ?? true,\n toc: options.toc ?? true,\n tocMaxDepth: options.tocMaxDepth ?? 3,\n ogImage: options.ogImage ?? false,\n ogImageOptions: resolveOgImageOptions(options.ogImageOptions),\n transformers: options.transformers ?? [],\n docs: resolveDocsOptions(options.docs),\n search: resolveSearchOptions(options.search),\n ogViewer: options.ogViewer ?? true,\n };\n}\n\n/**\n * Generates virtual module content.\n */\nfunction generateVirtualModule(path: string, options: ResolvedOptions): string {\n if (path === \"config\") {\n return `export default ${JSON.stringify(options)};`;\n }\n\n if (path === \"runtime\") {\n return `\n export function useMarkdown() {\n return {\n render: (content) => {\n // Client-side rendering if needed\n return content;\n },\n };\n }\n `;\n }\n\n return \"export default {};\";\n}\n\n// Re-export types and utilities\nexport { createMarkdownEnvironment } from \"./environment\";\nexport { transformMarkdown } from \"./transform\";\nexport { extractDocs, generateMarkdown, writeDocs, resolveDocsOptions } from \"./docs\";\nexport { buildSsg, resolveSsgOptions, DEFAULT_HTML_TEMPLATE } from \"./ssg\";\nexport { resolveSearchOptions, buildSearchIndex, writeSearchIndex } from \"./search\";\nexport { defineTheme, defaultTheme, mergeThemes, resolveTheme } from \"./theme\";\nexport type {\n ThemeConfig,\n ThemeColors,\n ThemeLayout,\n ThemeFonts,\n ThemeHeader,\n ThemeFooter,\n SocialLinks,\n ThemeEmbed,\n ResolvedThemeConfig,\n} from \"./theme\";\nexport * from \"./types\";\n\n// JSX Runtime\nexport { jsx, jsxs, Fragment, renderToString, raw, when, each } from \"./jsx-runtime\";\nexport type { JSXNode, JSXChild, JSXProps, JSXElementType } from \"./jsx-runtime\";\n\n// Page Context\nexport {\n usePageProps,\n useSiteConfig,\n useRenderContext,\n useNav,\n useIsActive,\n setRenderContext,\n clearRenderContext,\n generateFrontmatterTypes,\n inferType,\n} from \"./page-context\";\nexport type {\n BasePageProps,\n PageProps,\n SiteConfig,\n NavGroup,\n NavItem,\n RenderContext,\n FrontmatterSchema,\n} from \"./page-context\";\n\n// Theme Renderer\nexport {\n renderPage,\n renderAllPages,\n generateTypes,\n DefaultTheme,\n createTheme,\n} from \"./theme-renderer\";\nexport type { ThemeComponent, ThemeProps, PageData, ThemeRenderOptions } from \"./theme-renderer\";\n\n// Built-in Plugins (No-JS First)\nexport {\n transformTabs,\n generateTabsCSS,\n transformYouTube,\n extractVideoId,\n transformGitHub,\n fetchRepoData,\n collectGitHubRepos,\n prefetchGitHubRepos,\n transformOgp,\n fetchOgpData,\n collectOgpUrls,\n prefetchOgpData,\n transformMermaidStatic,\n mermaidClientScript,\n transformAllPlugins,\n} from \"./plugins\";\nexport type {\n YouTubeOptions,\n GitHubRepoData,\n GitHubOptions,\n OgpData,\n OgpOptions,\n MermaidOptions,\n TransformAllOptions,\n} from \"./plugins\";\n\n// Island Architecture\nexport { transformIslands, hasIslands, extractIslandInfo, generateHydrationScript } from \"./island\";\nexport type { LoadStrategy, IslandInfo, ParseIslandsResult } from \"./island\";\n\n// OG Image\nexport { resolveOgImageOptions, generateOgImages } from \"./og-image\";\nexport type {\n OgImageOptions as OgImagePluginOptions,\n ResolvedOgImageOptions,\n OgImageTemplateProps,\n OgImageTemplateFn,\n OgImagePageEntry,\n OgImageResult,\n OgBrowserSession,\n} from \"./og-image\";\n"],"x_google_ignoreList":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,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Q,qBAAqB,QAAQ,OAAO;EAC5C,UAAU,QAAQ,YAAY;EAC/B;;;;;AAMH,SAAS,sBAAsB,MAAc,SAAkC;AAC7E,KAAI,SAAS,SACX,QAAO,kBAAkB,KAAK,UAAU,QAAQ,CAAC;AAGnD,KAAI,SAAS,UACX,QAAO;;;;;;;;;;AAYT,QAAO"}
1
+ {"version":3,"file":"index.cjs","names":["node_process","node_process","rehypeParse","rehypeStringify","parseFrontmatter","transformMermaidStatic","path","path","path","escapeHtml","path","fs","path","rehypeParse","rehypeStringify","extractTitle","path","getUrlPath","collectMarkdownFiles","fs","oxContent","fs","path","path","fs","renderPage","extractTitle","getUrlPath","collectMarkdownFiles","path","escapeHtml","path"],"sources":["../src/environment.ts","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/visit.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/directives.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/anchors.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/applyReviver.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/toJS.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Node.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Alias.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/createNode.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Collection.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyComment.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/foldFlowLines.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyString.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringify.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyPair.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/log.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/merge.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/addPairToJSMap.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Pair.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyCollection.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLMap.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/map.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLSeq.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/seq.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/string.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/null.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/bool.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyNumber.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/float.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/int.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/schema.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/json/schema.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/float.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/int.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/set.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/tags.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/Schema.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyDocument.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/Document.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/errors.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-props.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-contains-newline.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-flow-indent-check.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-map-includes.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-map.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-seq.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-end.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-collection.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-collection.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-node.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-doc.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/composer.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-scalar.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-stringify.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-visit.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/lexer.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/line-counter.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/parser.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/public-api.js","../../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/index.js","../src/highlight.ts","../src/plugins/mermaid-protect.ts","../src/transform.ts","../src/nav-generator.ts","../src/docs.ts","../src/og-image/renderer.ts","../src/og-image/browser.ts","../src/og-image/template.ts","../src/og-image/cache.ts","../src/og-image/index.ts","../src/plugins/index.ts","../src/island/parse.ts","../src/theme.ts","../src/ssg.ts","../src/search.ts","../src/dev-server.ts","../src/og-viewer.ts","../src/jsx-runtime.ts","../src/page-context.ts","../src/theme-renderer.ts","../src/index.ts"],"sourcesContent":["/**\n * Vite Environment API integration for Ox Content.\n *\n * Creates a dedicated environment for Markdown processing,\n * enabling SSG-style rendering with separate client/server contexts.\n */\n\nimport type { EnvironmentOptions } from \"vite\";\nimport type { ResolvedOptions } from \"./types\";\n\n/**\n * Creates the Markdown processing environment configuration.\n *\n * This environment is used for:\n * - Server-side rendering of Markdown files\n * - Static site generation\n * - Pre-rendering at build time\n *\n * @example\n * ```ts\n * // In your vite.config.ts\n * export default defineConfig({\n * environments: {\n * markdown: createMarkdownEnvironment({\n * srcDir: 'content',\n * gfm: true,\n * }),\n * },\n * });\n * ```\n */\nexport function createMarkdownEnvironment(options: ResolvedOptions): EnvironmentOptions {\n return {\n // Consumer type for this environment\n consumer: \"server\",\n\n // Build configuration\n build: {\n // Output to a separate directory\n outDir: `${options.outDir}/.markdown`,\n\n // Emit assets for SSG\n emitAssets: true,\n\n // Create manifest for asset tracking\n manifest: true,\n\n // SSR-like externalization\n rollupOptions: {\n external: [\n // Externalize Node.js built-ins\n /^node:/,\n // Externalize native modules\n /\\.node$/,\n ],\n },\n },\n\n // Resolve configuration\n resolve: {\n // Handle .md files\n extensions: [\".md\", \".markdown\"],\n\n // Conditions for module resolution\n conditions: [\"markdown\", \"node\", \"import\"],\n\n // Don't dedupe - each environment gets its own modules\n dedupe: [],\n },\n\n // Optimize dependencies\n optimizeDeps: {\n // Include ox-content dependencies\n include: [],\n // Exclude native modules\n exclude: [\"@ox-content/napi\"],\n },\n };\n}\n\n/**\n * Environment-specific module transformer.\n *\n * This is called during the transform phase to process\n * Markdown files within the environment context.\n */\nexport interface EnvironmentTransformContext {\n /**\n * Current environment name.\n */\n environment: string;\n\n /**\n * Whether we're in development mode.\n */\n isDev: boolean;\n\n /**\n * Whether this is a server-side render.\n */\n isSSR: boolean;\n\n /**\n * The resolved Vite config.\n */\n config: unknown;\n}\n\n/**\n * Creates environment-aware transform options.\n */\nexport function createTransformOptions(\n ctx: EnvironmentTransformContext,\n options: ResolvedOptions,\n): ResolvedOptions {\n return {\n ...options,\n // Adjust options based on environment\n highlight: ctx.isSSR ? options.highlight : false,\n ogImage: ctx.isSSR ? options.ogImage : false,\n };\n}\n\n/**\n * Runs pre-render for SSG.\n *\n * This function is called during build to pre-render all Markdown files.\n */\nexport async function prerender(\n files: string[],\n _options: ResolvedOptions,\n): Promise<Map<string, string>> {\n const results = new Map<string, string>();\n\n for (const file of files) {\n // In production, this would use the Ox Content parser\n // For now, we just mark the file as needing processing\n results.set(file, `/* Pre-rendered: ${file} */`);\n }\n\n return results;\n}\n\n/**\n * Environment plugin factory.\n *\n * Creates plugins specific to the Markdown environment.\n */\nexport function createEnvironmentPlugins(_options: ResolvedOptions) {\n return [\n {\n name: \"ox-content:markdown-env\",\n\n // Only apply to markdown environment\n applyToEnvironment(name: string) {\n return name === \"markdown\";\n },\n\n // Transform within the environment\n transform(code: string, id: string) {\n if (!id.endsWith(\".md\")) {\n return null;\n }\n\n // Environment-specific transformation\n return {\n code: `\n // Transformed in markdown environment\n ${code}\n `,\n };\n },\n },\n ];\n}\n","'use strict';\n\nconst ALIAS = Symbol.for('yaml.alias');\nconst DOC = Symbol.for('yaml.document');\nconst MAP = Symbol.for('yaml.map');\nconst PAIR = Symbol.for('yaml.pair');\nconst SCALAR = Symbol.for('yaml.scalar');\nconst SEQ = Symbol.for('yaml.seq');\nconst NODE_TYPE = Symbol.for('yaml.node.type');\nconst isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;\nconst isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;\nconst isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;\nconst isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;\nconst isScalar = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR;\nconst isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;\nfunction isCollection(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case MAP:\n case SEQ:\n return true;\n }\n return false;\n}\nfunction isNode(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case ALIAS:\n case MAP:\n case SCALAR:\n case SEQ:\n return true;\n }\n return false;\n}\nconst hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;\n\nexports.ALIAS = ALIAS;\nexports.DOC = DOC;\nexports.MAP = MAP;\nexports.NODE_TYPE = NODE_TYPE;\nexports.PAIR = PAIR;\nexports.SCALAR = SCALAR;\nexports.SEQ = SEQ;\nexports.hasAnchor = hasAnchor;\nexports.isAlias = isAlias;\nexports.isCollection = isCollection;\nexports.isDocument = isDocument;\nexports.isMap = isMap;\nexports.isNode = isNode;\nexports.isPair = isPair;\nexports.isScalar = isScalar;\nexports.isSeq = isSeq;\n","'use strict';\n\nvar identity = require('./nodes/identity.js');\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove node');\n/**\n * Apply a visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nfunction visit(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n visit_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisit.SKIP = SKIP;\n/** Remove the current node */\nvisit.REMOVE = REMOVE;\nfunction visit_(key, node, visitor, path) {\n const ctrl = callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visit_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = visit_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = visit_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = visit_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\n/**\n * Apply an async visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `Promise`: Must resolve to one of the following values\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nasync function visitAsync(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n await visitAsync_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisitAsync.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisitAsync.SKIP = SKIP;\n/** Remove the current node */\nvisitAsync.REMOVE = REMOVE;\nasync function visitAsync_(key, node, visitor, path) {\n const ctrl = await callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visitAsync_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = await visitAsync_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = await visitAsync_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = await visitAsync_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\nfunction initVisitor(visitor) {\n if (typeof visitor === 'object' &&\n (visitor.Collection || visitor.Node || visitor.Value)) {\n return Object.assign({\n Alias: visitor.Node,\n Map: visitor.Node,\n Scalar: visitor.Node,\n Seq: visitor.Node\n }, visitor.Value && {\n Map: visitor.Value,\n Scalar: visitor.Value,\n Seq: visitor.Value\n }, visitor.Collection && {\n Map: visitor.Collection,\n Seq: visitor.Collection\n }, visitor);\n }\n return visitor;\n}\nfunction callVisitor(key, node, visitor, path) {\n if (typeof visitor === 'function')\n return visitor(key, node, path);\n if (identity.isMap(node))\n return visitor.Map?.(key, node, path);\n if (identity.isSeq(node))\n return visitor.Seq?.(key, node, path);\n if (identity.isPair(node))\n return visitor.Pair?.(key, node, path);\n if (identity.isScalar(node))\n return visitor.Scalar?.(key, node, path);\n if (identity.isAlias(node))\n return visitor.Alias?.(key, node, path);\n return undefined;\n}\nfunction replaceNode(key, path, node) {\n const parent = path[path.length - 1];\n if (identity.isCollection(parent)) {\n parent.items[key] = node;\n }\n else if (identity.isPair(parent)) {\n if (key === 'key')\n parent.key = node;\n else\n parent.value = node;\n }\n else if (identity.isDocument(parent)) {\n parent.contents = node;\n }\n else {\n const pt = identity.isAlias(parent) ? 'alias' : 'scalar';\n throw new Error(`Cannot replace node with ${pt} parent`);\n }\n}\n\nexports.visit = visit;\nexports.visitAsync = visitAsync;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\nconst escapeChars = {\n '!': '%21',\n ',': '%2C',\n '[': '%5B',\n ']': '%5D',\n '{': '%7B',\n '}': '%7D'\n};\nconst escapeTagName = (tn) => tn.replace(/[!,[\\]{}]/g, ch => escapeChars[ch]);\nclass Directives {\n constructor(yaml, tags) {\n /**\n * The directives-end/doc-start marker `---`. If `null`, a marker may still be\n * included in the document's stringified representation.\n */\n this.docStart = null;\n /** The doc-end marker `...`. */\n this.docEnd = false;\n this.yaml = Object.assign({}, Directives.defaultYaml, yaml);\n this.tags = Object.assign({}, Directives.defaultTags, tags);\n }\n clone() {\n const copy = new Directives(this.yaml, this.tags);\n copy.docStart = this.docStart;\n return copy;\n }\n /**\n * During parsing, get a Directives instance for the current document and\n * update the stream state according to the current version's spec.\n */\n atDocument() {\n const res = new Directives(this.yaml, this.tags);\n switch (this.yaml.version) {\n case '1.1':\n this.atNextDocument = true;\n break;\n case '1.2':\n this.atNextDocument = false;\n this.yaml = {\n explicit: Directives.defaultYaml.explicit,\n version: '1.2'\n };\n this.tags = Object.assign({}, Directives.defaultTags);\n break;\n }\n return res;\n }\n /**\n * @param onError - May be called even if the action was successful\n * @returns `true` on success\n */\n add(line, onError) {\n if (this.atNextDocument) {\n this.yaml = { explicit: Directives.defaultYaml.explicit, version: '1.1' };\n this.tags = Object.assign({}, Directives.defaultTags);\n this.atNextDocument = false;\n }\n const parts = line.trim().split(/[ \\t]+/);\n const name = parts.shift();\n switch (name) {\n case '%TAG': {\n if (parts.length !== 2) {\n onError(0, '%TAG directive should contain exactly two parts');\n if (parts.length < 2)\n return false;\n }\n const [handle, prefix] = parts;\n this.tags[handle] = prefix;\n return true;\n }\n case '%YAML': {\n this.yaml.explicit = true;\n if (parts.length !== 1) {\n onError(0, '%YAML directive should contain exactly one part');\n return false;\n }\n const [version] = parts;\n if (version === '1.1' || version === '1.2') {\n this.yaml.version = version;\n return true;\n }\n else {\n const isValid = /^\\d+\\.\\d+$/.test(version);\n onError(6, `Unsupported YAML version ${version}`, isValid);\n return false;\n }\n }\n default:\n onError(0, `Unknown directive ${name}`, true);\n return false;\n }\n }\n /**\n * Resolves a tag, matching handles to those defined in %TAG directives.\n *\n * @returns Resolved tag, which may also be the non-specific tag `'!'` or a\n * `'!local'` tag, or `null` if unresolvable.\n */\n tagName(source, onError) {\n if (source === '!')\n return '!'; // non-specific tag\n if (source[0] !== '!') {\n onError(`Not a valid tag: ${source}`);\n return null;\n }\n if (source[1] === '<') {\n const verbatim = source.slice(2, -1);\n if (verbatim === '!' || verbatim === '!!') {\n onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);\n return null;\n }\n if (source[source.length - 1] !== '>')\n onError('Verbatim tags must end with a >');\n return verbatim;\n }\n const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);\n if (!suffix)\n onError(`The ${source} tag has no suffix`);\n const prefix = this.tags[handle];\n if (prefix) {\n try {\n return prefix + decodeURIComponent(suffix);\n }\n catch (error) {\n onError(String(error));\n return null;\n }\n }\n if (handle === '!')\n return source; // local tag\n onError(`Could not resolve tag: ${source}`);\n return null;\n }\n /**\n * Given a fully resolved tag, returns its printable string form,\n * taking into account current tag prefixes and defaults.\n */\n tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }\n toString(doc) {\n const lines = this.yaml.explicit\n ? [`%YAML ${this.yaml.version || '1.2'}`]\n : [];\n const tagEntries = Object.entries(this.tags);\n let tagNames;\n if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {\n const tags = {};\n visit.visit(doc.contents, (_key, node) => {\n if (identity.isNode(node) && node.tag)\n tags[node.tag] = true;\n });\n tagNames = Object.keys(tags);\n }\n else\n tagNames = [];\n for (const [handle, prefix] of tagEntries) {\n if (handle === '!!' && prefix === 'tag:yaml.org,2002:')\n continue;\n if (!doc || tagNames.some(tn => tn.startsWith(prefix)))\n lines.push(`%TAG ${handle} ${prefix}`);\n }\n return lines.join('\\n');\n }\n}\nDirectives.defaultYaml = { explicit: false, version: '1.2' };\nDirectives.defaultTags = { '!!': 'tag:yaml.org,2002:' };\n\nexports.Directives = Directives;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\n/**\n * Verify that the input string is a valid anchor.\n *\n * Will throw on errors.\n */\nfunction anchorIsValid(anchor) {\n if (/[\\x00-\\x19\\s,[\\]{}]/.test(anchor)) {\n const sa = JSON.stringify(anchor);\n const msg = `Anchor must not contain whitespace or control characters: ${sa}`;\n throw new Error(msg);\n }\n return true;\n}\nfunction anchorNames(root) {\n const anchors = new Set();\n visit.visit(root, {\n Value(_key, node) {\n if (node.anchor)\n anchors.add(node.anchor);\n }\n });\n return anchors;\n}\n/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */\nfunction findNewAnchor(prefix, exclude) {\n for (let i = 1; true; ++i) {\n const name = `${prefix}${i}`;\n if (!exclude.has(name))\n return name;\n }\n}\nfunction createNodeAnchors(doc, prefix) {\n const aliasObjects = [];\n const sourceObjects = new Map();\n let prevAnchors = null;\n return {\n onAnchor: (source) => {\n aliasObjects.push(source);\n prevAnchors ?? (prevAnchors = anchorNames(doc));\n const anchor = findNewAnchor(prefix, prevAnchors);\n prevAnchors.add(anchor);\n return anchor;\n },\n /**\n * With circular references, the source node is only resolved after all\n * of its child nodes are. This is why anchors are set only after all of\n * the nodes have been created.\n */\n setAnchors: () => {\n for (const source of aliasObjects) {\n const ref = sourceObjects.get(source);\n if (typeof ref === 'object' &&\n ref.anchor &&\n (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {\n ref.node.anchor = ref.anchor;\n }\n else {\n const error = new Error('Failed to resolve repeated object (this should not happen)');\n error.source = source;\n throw error;\n }\n }\n },\n sourceObjects\n };\n}\n\nexports.anchorIsValid = anchorIsValid;\nexports.anchorNames = anchorNames;\nexports.createNodeAnchors = createNodeAnchors;\nexports.findNewAnchor = findNewAnchor;\n","'use strict';\n\n/**\n * Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,\n * in section 24.5.1.1 \"Runtime Semantics: InternalizeJSONProperty\" of the\n * 2021 edition: https://tc39.es/ecma262/#sec-json.parse\n *\n * Includes extensions for handling Map and Set objects.\n */\nfunction applyReviver(reviver, obj, key, val) {\n if (val && typeof val === 'object') {\n if (Array.isArray(val)) {\n for (let i = 0, len = val.length; i < len; ++i) {\n const v0 = val[i];\n const v1 = applyReviver(reviver, val, String(i), v0);\n // eslint-disable-next-line @typescript-eslint/no-array-delete\n if (v1 === undefined)\n delete val[i];\n else if (v1 !== v0)\n val[i] = v1;\n }\n }\n else if (val instanceof Map) {\n for (const k of Array.from(val.keys())) {\n const v0 = val.get(k);\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n val.delete(k);\n else if (v1 !== v0)\n val.set(k, v1);\n }\n }\n else if (val instanceof Set) {\n for (const v0 of Array.from(val)) {\n const v1 = applyReviver(reviver, val, v0, v0);\n if (v1 === undefined)\n val.delete(v0);\n else if (v1 !== v0) {\n val.delete(v0);\n val.add(v1);\n }\n }\n }\n else {\n for (const [k, v0] of Object.entries(val)) {\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n delete val[k];\n else if (v1 !== v0)\n val[k] = v1;\n }\n }\n }\n return reviver.call(obj, key, val);\n}\n\nexports.applyReviver = applyReviver;\n","'use strict';\n\nvar identity = require('./identity.js');\n\n/**\n * Recursively convert any node or its contents to native JavaScript\n *\n * @param value - The input value\n * @param arg - If `value` defines a `toJSON()` method, use this\n * as its first argument\n * @param ctx - Conversion context, originally set in Document#toJS(). If\n * `{ keep: true }` is not set, output should be suitable for JSON\n * stringification.\n */\nfunction toJS(value, arg, ctx) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n if (Array.isArray(value))\n return value.map((v, i) => toJS(v, String(i), ctx));\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n if (!ctx || !identity.hasAnchor(value))\n return value.toJSON(arg, ctx);\n const data = { aliasCount: 0, count: 1, res: undefined };\n ctx.anchors.set(value, data);\n ctx.onCreate = res => {\n data.res = res;\n delete ctx.onCreate;\n };\n const res = value.toJSON(arg, ctx);\n if (ctx.onCreate)\n ctx.onCreate(res);\n return res;\n }\n if (typeof value === 'bigint' && !ctx?.keep)\n return Number(value);\n return value;\n}\n\nexports.toJS = toJS;\n","'use strict';\n\nvar applyReviver = require('../doc/applyReviver.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nclass NodeBase {\n constructor(type) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: type });\n }\n /** Create a copy of this node. */\n clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** A plain JavaScript representation of this node. */\n toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n if (!identity.isDocument(doc))\n throw new TypeError('A document argument is required');\n const ctx = {\n anchors: new Map(),\n doc,\n keep: true,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this, '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n}\n\nexports.NodeBase = NodeBase;\n","'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar visit = require('../visit.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nclass Alias extends Node.NodeBase {\n constructor(source) {\n super(identity.ALIAS);\n this.source = source;\n Object.defineProperty(this, 'tag', {\n set() {\n throw new Error('Alias nodes cannot have tags');\n }\n });\n }\n /**\n * Resolve the value of this alias within `doc`, finding the last\n * instance of the `source` anchor before this node.\n */\n resolve(doc, ctx) {\n let nodes;\n if (ctx?.aliasResolveCache) {\n nodes = ctx.aliasResolveCache;\n }\n else {\n nodes = [];\n visit.visit(doc, {\n Node: (_key, node) => {\n if (identity.isAlias(node) || identity.hasAnchor(node))\n nodes.push(node);\n }\n });\n if (ctx)\n ctx.aliasResolveCache = nodes;\n }\n let found = undefined;\n for (const node of nodes) {\n if (node === this)\n break;\n if (node.anchor === this.source)\n found = node;\n }\n return found;\n }\n toJSON(_arg, ctx) {\n if (!ctx)\n return { source: this.source };\n const { anchors, doc, maxAliasCount } = ctx;\n const source = this.resolve(doc, ctx);\n if (!source) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new ReferenceError(msg);\n }\n let data = anchors.get(source);\n if (!data) {\n // Resolve anchors for Node.prototype.toJS()\n toJS.toJS(source, null, ctx);\n data = anchors.get(source);\n }\n /* istanbul ignore if */\n if (data?.res === undefined) {\n const msg = 'This should not happen: Alias anchor was not resolved?';\n throw new ReferenceError(msg);\n }\n if (maxAliasCount >= 0) {\n data.count += 1;\n if (data.aliasCount === 0)\n data.aliasCount = getAliasCount(doc, source, anchors);\n if (data.count * data.aliasCount > maxAliasCount) {\n const msg = 'Excessive alias count indicates a resource exhaustion attack';\n throw new ReferenceError(msg);\n }\n }\n return data.res;\n }\n toString(ctx, _onComment, _onChompKeep) {\n const src = `*${this.source}`;\n if (ctx) {\n anchors.anchorIsValid(this.source);\n if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new Error(msg);\n }\n if (ctx.implicitKey)\n return `${src} `;\n }\n return src;\n }\n}\nfunction getAliasCount(doc, node, anchors) {\n if (identity.isAlias(node)) {\n const source = node.resolve(doc);\n const anchor = anchors && source && anchors.get(source);\n return anchor ? anchor.count * anchor.aliasCount : 0;\n }\n else if (identity.isCollection(node)) {\n let count = 0;\n for (const item of node.items) {\n const c = getAliasCount(doc, item, anchors);\n if (c > count)\n count = c;\n }\n return count;\n }\n else if (identity.isPair(node)) {\n const kc = getAliasCount(doc, node.key, anchors);\n const vc = getAliasCount(doc, node.value, anchors);\n return Math.max(kc, vc);\n }\n return 1;\n}\n\nexports.Alias = Alias;\n","'use strict';\n\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nconst isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');\nclass Scalar extends Node.NodeBase {\n constructor(value) {\n super(identity.SCALAR);\n this.value = value;\n }\n toJSON(arg, ctx) {\n return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);\n }\n toString() {\n return String(this.value);\n }\n}\nScalar.BLOCK_FOLDED = 'BLOCK_FOLDED';\nScalar.BLOCK_LITERAL = 'BLOCK_LITERAL';\nScalar.PLAIN = 'PLAIN';\nScalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';\nScalar.QUOTE_SINGLE = 'QUOTE_SINGLE';\n\nexports.Scalar = Scalar;\nexports.isScalarValue = isScalarValue;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\n\nconst defaultTagPrefix = 'tag:yaml.org,2002:';\nfunction findTagObject(value, tagName, tags) {\n if (tagName) {\n const match = tags.filter(t => t.tag === tagName);\n const tagObj = match.find(t => !t.format) ?? match[0];\n if (!tagObj)\n throw new Error(`Tag ${tagName} not found`);\n return tagObj;\n }\n return tags.find(t => t.identify?.(value) && !t.format);\n}\nfunction createNode(value, tagName, ctx) {\n if (identity.isDocument(value))\n value = value.contents;\n if (identity.isNode(value))\n return value;\n if (identity.isPair(value)) {\n const map = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);\n map.items.push(value);\n return map;\n }\n if (value instanceof String ||\n value instanceof Number ||\n value instanceof Boolean ||\n (typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere\n ) {\n // https://tc39.es/ecma262/#sec-serializejsonproperty\n value = value.valueOf();\n }\n const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;\n // Detect duplicate references to the same object & use Alias nodes for all\n // after first. The `ref` wrapper allows for circular references to resolve.\n let ref = undefined;\n if (aliasDuplicateObjects && value && typeof value === 'object') {\n ref = sourceObjects.get(value);\n if (ref) {\n ref.anchor ?? (ref.anchor = onAnchor(value));\n return new Alias.Alias(ref.anchor);\n }\n else {\n ref = { anchor: null, node: null };\n sourceObjects.set(value, ref);\n }\n }\n if (tagName?.startsWith('!!'))\n tagName = defaultTagPrefix + tagName.slice(2);\n let tagObj = findTagObject(value, tagName, schema.tags);\n if (!tagObj) {\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n value = value.toJSON();\n }\n if (!value || typeof value !== 'object') {\n const node = new Scalar.Scalar(value);\n if (ref)\n ref.node = node;\n return node;\n }\n tagObj =\n value instanceof Map\n ? schema[identity.MAP]\n : Symbol.iterator in Object(value)\n ? schema[identity.SEQ]\n : schema[identity.MAP];\n }\n if (onTagObj) {\n onTagObj(tagObj);\n delete ctx.onTagObj;\n }\n const node = tagObj?.createNode\n ? tagObj.createNode(ctx.schema, value, ctx)\n : typeof tagObj?.nodeClass?.from === 'function'\n ? tagObj.nodeClass.from(ctx.schema, value, ctx)\n : new Scalar.Scalar(value);\n if (tagName)\n node.tag = tagName;\n else if (!tagObj.default)\n node.tag = tagObj.tag;\n if (ref)\n ref.node = node;\n return node;\n}\n\nexports.createNode = createNode;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\n\nfunction collectionFromPath(schema, path, value) {\n let v = value;\n for (let i = path.length - 1; i >= 0; --i) {\n const k = path[i];\n if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {\n const a = [];\n a[k] = v;\n v = a;\n }\n else {\n v = new Map([[k, v]]);\n }\n }\n return createNode.createNode(v, undefined, {\n aliasDuplicateObjects: false,\n keepUndefined: false,\n onAnchor: () => {\n throw new Error('This should not happen, please report a bug.');\n },\n schema,\n sourceObjects: new Map()\n });\n}\n// Type guard is intentionally a little wrong so as to be more useful,\n// as it does not cover untypable empty non-string iterables (e.g. []).\nconst isEmptyPath = (path) => path == null ||\n (typeof path === 'object' && !!path[Symbol.iterator]().next().done);\nclass Collection extends Node.NodeBase {\n constructor(type, schema) {\n super(type);\n Object.defineProperty(this, 'schema', {\n value: schema,\n configurable: true,\n enumerable: false,\n writable: true\n });\n }\n /**\n * Create a copy of this collection.\n *\n * @param schema - If defined, overwrites the original's schema\n */\n clone(schema) {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (schema)\n copy.schema = schema;\n copy.items = copy.items.map(it => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /**\n * Adds a value to the collection. For `!!map` and `!!omap` the value must\n * be a Pair instance or a `{ key, value }` object, which may not have a key\n * that already exists in the map.\n */\n addIn(path, value) {\n if (isEmptyPath(path))\n this.add(value);\n else {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.addIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n /**\n * Removes a value from the collection.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.delete(key);\n const node = this.get(key, true);\n if (identity.isCollection(node))\n return node.deleteIn(rest);\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (rest.length === 0)\n return !keepScalar && identity.isScalar(node) ? node.value : node;\n else\n return identity.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;\n }\n hasAllNullValues(allowScalar) {\n return this.items.every(node => {\n if (!identity.isPair(node))\n return false;\n const n = node.value;\n return (n == null ||\n (allowScalar &&\n identity.isScalar(n) &&\n n.value == null &&\n !n.commentBefore &&\n !n.comment &&\n !n.tag));\n });\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n */\n hasIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.has(key);\n const node = this.get(key, true);\n return identity.isCollection(node) ? node.hasIn(rest) : false;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n const [key, ...rest] = path;\n if (rest.length === 0) {\n this.set(key, value);\n }\n else {\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.setIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n}\n\nexports.Collection = Collection;\nexports.collectionFromPath = collectionFromPath;\nexports.isEmptyPath = isEmptyPath;\n","'use strict';\n\n/**\n * Stringifies a comment.\n *\n * Empty comment lines are left empty,\n * lines consisting of a single space are replaced by `#`,\n * and all other lines are prefixed with a `#`.\n */\nconst stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');\nfunction indentComment(comment, indent) {\n if (/^\\n+$/.test(comment))\n return comment.substring(1);\n return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;\n}\nconst lineComment = (str, indent, comment) => str.endsWith('\\n')\n ? indentComment(comment, indent)\n : comment.includes('\\n')\n ? '\\n' + indentComment(comment, indent)\n : (str.endsWith(' ') ? '' : ' ') + comment;\n\nexports.indentComment = indentComment;\nexports.lineComment = lineComment;\nexports.stringifyComment = stringifyComment;\n","'use strict';\n\nconst FOLD_FLOW = 'flow';\nconst FOLD_BLOCK = 'block';\nconst FOLD_QUOTED = 'quoted';\n/**\n * Tries to keep input at up to `lineWidth` characters, splitting only on spaces\n * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are\n * terminated with `\\n` and started with `indent`.\n */\nfunction foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {\n if (!lineWidth || lineWidth < 0)\n return text;\n if (lineWidth < minContentWidth)\n minContentWidth = 0;\n const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);\n if (text.length <= endStep)\n return text;\n const folds = [];\n const escapedFolds = {};\n let end = lineWidth - indent.length;\n if (typeof indentAtStart === 'number') {\n if (indentAtStart > lineWidth - Math.max(2, minContentWidth))\n folds.push(0);\n else\n end = lineWidth - indentAtStart;\n }\n let split = undefined;\n let prev = undefined;\n let overflow = false;\n let i = -1;\n let escStart = -1;\n let escEnd = -1;\n if (mode === FOLD_BLOCK) {\n i = consumeMoreIndentedLines(text, i, indent.length);\n if (i !== -1)\n end = i + endStep;\n }\n for (let ch; (ch = text[(i += 1)]);) {\n if (mode === FOLD_QUOTED && ch === '\\\\') {\n escStart = i;\n switch (text[i + 1]) {\n case 'x':\n i += 3;\n break;\n case 'u':\n i += 5;\n break;\n case 'U':\n i += 9;\n break;\n default:\n i += 1;\n }\n escEnd = i;\n }\n if (ch === '\\n') {\n if (mode === FOLD_BLOCK)\n i = consumeMoreIndentedLines(text, i, indent.length);\n end = i + indent.length + endStep;\n split = undefined;\n }\n else {\n if (ch === ' ' &&\n prev &&\n prev !== ' ' &&\n prev !== '\\n' &&\n prev !== '\\t') {\n // space surrounded by non-space can be replaced with newline + indent\n const next = text[i + 1];\n if (next && next !== ' ' && next !== '\\n' && next !== '\\t')\n split = i;\n }\n if (i >= end) {\n if (split) {\n folds.push(split);\n end = split + endStep;\n split = undefined;\n }\n else if (mode === FOLD_QUOTED) {\n // white-space collected at end may stretch past lineWidth\n while (prev === ' ' || prev === '\\t') {\n prev = ch;\n ch = text[(i += 1)];\n overflow = true;\n }\n // Account for newline escape, but don't break preceding escape\n const j = i > escEnd + 1 ? i - 2 : escStart - 1;\n // Bail out if lineWidth & minContentWidth are shorter than an escape string\n if (escapedFolds[j])\n return text;\n folds.push(j);\n escapedFolds[j] = true;\n end = j + endStep;\n split = undefined;\n }\n else {\n overflow = true;\n }\n }\n }\n prev = ch;\n }\n if (overflow && onOverflow)\n onOverflow();\n if (folds.length === 0)\n return text;\n if (onFold)\n onFold();\n let res = text.slice(0, folds[0]);\n for (let i = 0; i < folds.length; ++i) {\n const fold = folds[i];\n const end = folds[i + 1] || text.length;\n if (fold === 0)\n res = `\\n${indent}${text.slice(0, end)}`;\n else {\n if (mode === FOLD_QUOTED && escapedFolds[fold])\n res += `${text[fold]}\\\\`;\n res += `\\n${indent}${text.slice(fold + 1, end)}`;\n }\n }\n return res;\n}\n/**\n * Presumes `i + 1` is at the start of a line\n * @returns index of last newline in more-indented block\n */\nfunction consumeMoreIndentedLines(text, i, indent) {\n let end = i;\n let start = i + 1;\n let ch = text[start];\n while (ch === ' ' || ch === '\\t') {\n if (i < start + indent) {\n ch = text[++i];\n }\n else {\n do {\n ch = text[++i];\n } while (ch && ch !== '\\n');\n end = i;\n start = i + 1;\n ch = text[start];\n }\n }\n return end;\n}\n\nexports.FOLD_BLOCK = FOLD_BLOCK;\nexports.FOLD_FLOW = FOLD_FLOW;\nexports.FOLD_QUOTED = FOLD_QUOTED;\nexports.foldFlowLines = foldFlowLines;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar foldFlowLines = require('./foldFlowLines.js');\n\nconst getFoldOptions = (ctx, isBlock) => ({\n indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,\n lineWidth: ctx.options.lineWidth,\n minContentWidth: ctx.options.minContentWidth\n});\n// Also checks for lines starting with %, as parsing the output as YAML 1.1 will\n// presume that's starting a new document.\nconst containsDocumentMarker = (str) => /^(%|---|\\.\\.\\.)/m.test(str);\nfunction lineLengthOverLimit(str, lineWidth, indentLength) {\n if (!lineWidth || lineWidth < 0)\n return false;\n const limit = lineWidth - indentLength;\n const strLen = str.length;\n if (strLen <= limit)\n return false;\n for (let i = 0, start = 0; i < strLen; ++i) {\n if (str[i] === '\\n') {\n if (i - start > limit)\n return true;\n start = i + 1;\n if (strLen - start <= limit)\n return false;\n }\n }\n return true;\n}\nfunction doubleQuotedString(value, ctx) {\n const json = JSON.stringify(value);\n if (ctx.options.doubleQuotedAsJSON)\n return json;\n const { implicitKey } = ctx;\n const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n let str = '';\n let start = 0;\n for (let i = 0, ch = json[i]; ch; ch = json[++i]) {\n if (ch === ' ' && json[i + 1] === '\\\\' && json[i + 2] === 'n') {\n // space before newline needs to be escaped to not be folded\n str += json.slice(start, i) + '\\\\ ';\n i += 1;\n start = i;\n ch = '\\\\';\n }\n if (ch === '\\\\')\n switch (json[i + 1]) {\n case 'u':\n {\n str += json.slice(start, i);\n const code = json.substr(i + 2, 4);\n switch (code) {\n case '0000':\n str += '\\\\0';\n break;\n case '0007':\n str += '\\\\a';\n break;\n case '000b':\n str += '\\\\v';\n break;\n case '001b':\n str += '\\\\e';\n break;\n case '0085':\n str += '\\\\N';\n break;\n case '00a0':\n str += '\\\\_';\n break;\n case '2028':\n str += '\\\\L';\n break;\n case '2029':\n str += '\\\\P';\n break;\n default:\n if (code.substr(0, 2) === '00')\n str += '\\\\x' + code.substr(2);\n else\n str += json.substr(i, 6);\n }\n i += 5;\n start = i + 1;\n }\n break;\n case 'n':\n if (implicitKey ||\n json[i + 2] === '\"' ||\n json.length < minMultiLineLength) {\n i += 1;\n }\n else {\n // folding will eat first newline\n str += json.slice(start, i) + '\\n\\n';\n while (json[i + 2] === '\\\\' &&\n json[i + 3] === 'n' &&\n json[i + 4] !== '\"') {\n str += '\\n';\n i += 2;\n }\n str += indent;\n // space after newline needs to be escaped to not be folded\n if (json[i + 2] === ' ')\n str += '\\\\';\n i += 1;\n start = i + 1;\n }\n break;\n default:\n i += 1;\n }\n }\n str = start ? str + json.slice(start) : json;\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));\n}\nfunction singleQuotedString(value, ctx) {\n if (ctx.options.singleQuote === false ||\n (ctx.implicitKey && value.includes('\\n')) ||\n /[ \\t]\\n|\\n[ \\t]/.test(value) // single quoted string can't have leading or trailing whitespace around newline\n )\n return doubleQuotedString(value, ctx);\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n const res = \"'\" + value.replace(/'/g, \"''\").replace(/\\n+/g, `$&\\n${indent}`) + \"'\";\n return ctx.implicitKey\n ? res\n : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction quotedString(value, ctx) {\n const { singleQuote } = ctx.options;\n let qs;\n if (singleQuote === false)\n qs = doubleQuotedString;\n else {\n const hasDouble = value.includes('\"');\n const hasSingle = value.includes(\"'\");\n if (hasDouble && !hasSingle)\n qs = singleQuotedString;\n else if (hasSingle && !hasDouble)\n qs = doubleQuotedString;\n else\n qs = singleQuote ? singleQuotedString : doubleQuotedString;\n }\n return qs(value, ctx);\n}\n// The negative lookbehind avoids a polynomial search,\n// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind\nlet blockEndNewlines;\ntry {\n blockEndNewlines = new RegExp('(^|(?<!\\n))\\n+(?!\\n|$)', 'g');\n}\ncatch {\n blockEndNewlines = /\\n+(?!\\n|$)/g;\n}\nfunction blockString({ comment, type, value }, ctx, onComment, onChompKeep) {\n const { blockQuote, commentString, lineWidth } = ctx.options;\n // 1. Block can't end in whitespace unless the last line is non-empty.\n // 2. Strings consisting of only whitespace are best rendered explicitly.\n if (!blockQuote || /\\n[\\t ]+$/.test(value)) {\n return quotedString(value, ctx);\n }\n const indent = ctx.indent ||\n (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');\n const literal = blockQuote === 'literal'\n ? true\n : blockQuote === 'folded' || type === Scalar.Scalar.BLOCK_FOLDED\n ? false\n : type === Scalar.Scalar.BLOCK_LITERAL\n ? true\n : !lineLengthOverLimit(value, lineWidth, indent.length);\n if (!value)\n return literal ? '|\\n' : '>\\n';\n // determine chomping from whitespace at value end\n let chomp;\n let endStart;\n for (endStart = value.length; endStart > 0; --endStart) {\n const ch = value[endStart - 1];\n if (ch !== '\\n' && ch !== '\\t' && ch !== ' ')\n break;\n }\n let end = value.substring(endStart);\n const endNlPos = end.indexOf('\\n');\n if (endNlPos === -1) {\n chomp = '-'; // strip\n }\n else if (value === end || endNlPos !== end.length - 1) {\n chomp = '+'; // keep\n if (onChompKeep)\n onChompKeep();\n }\n else {\n chomp = ''; // clip\n }\n if (end) {\n value = value.slice(0, -end.length);\n if (end[end.length - 1] === '\\n')\n end = end.slice(0, -1);\n end = end.replace(blockEndNewlines, `$&${indent}`);\n }\n // determine indent indicator from whitespace at value start\n let startWithSpace = false;\n let startEnd;\n let startNlPos = -1;\n for (startEnd = 0; startEnd < value.length; ++startEnd) {\n const ch = value[startEnd];\n if (ch === ' ')\n startWithSpace = true;\n else if (ch === '\\n')\n startNlPos = startEnd;\n else\n break;\n }\n let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);\n if (start) {\n value = value.substring(start.length);\n start = start.replace(/\\n+/g, `$&${indent}`);\n }\n const indentSize = indent ? '2' : '1'; // root is at -1\n // Leading | or > is added later\n let header = (startWithSpace ? indentSize : '') + chomp;\n if (comment) {\n header += ' ' + commentString(comment.replace(/ ?[\\r\\n]+/g, ' '));\n if (onComment)\n onComment();\n }\n if (!literal) {\n const foldedValue = value\n .replace(/\\n+/g, '\\n$&')\n .replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g, '$1$2') // more-indented lines aren't folded\n // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent\n .replace(/\\n+/g, `$&${indent}`);\n let literalFallback = false;\n const foldOptions = getFoldOptions(ctx, true);\n if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {\n foldOptions.onOverflow = () => {\n literalFallback = true;\n };\n }\n const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);\n if (!literalFallback)\n return `>${header}\\n${indent}${body}`;\n }\n value = value.replace(/\\n+/g, `$&${indent}`);\n return `|${header}\\n${indent}${start}${value}${end}`;\n}\nfunction plainString(item, ctx, onComment, onChompKeep) {\n const { type, value } = item;\n const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;\n if ((implicitKey && value.includes('\\n')) ||\n (inFlow && /[[\\]{},]/.test(value))) {\n return quotedString(value, ctx);\n }\n if (/^[\\n\\t ,[\\]{}#&*!|>'\"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(value)) {\n // not allowed:\n // - '-' or '?'\n // - start with an indicator character (except [?:-]) or /[?-] /\n // - '\\n ', ': ' or ' \\n' anywhere\n // - '#' not preceded by a non-space char\n // - end with ' ' or ':'\n return implicitKey || inFlow || !value.includes('\\n')\n ? quotedString(value, ctx)\n : blockString(item, ctx, onComment, onChompKeep);\n }\n if (!implicitKey &&\n !inFlow &&\n type !== Scalar.Scalar.PLAIN &&\n value.includes('\\n')) {\n // Where allowed & type not set explicitly, prefer block style for multiline strings\n return blockString(item, ctx, onComment, onChompKeep);\n }\n if (containsDocumentMarker(value)) {\n if (indent === '') {\n ctx.forceBlockIndent = true;\n return blockString(item, ctx, onComment, onChompKeep);\n }\n else if (implicitKey && indent === indentStep) {\n return quotedString(value, ctx);\n }\n }\n const str = value.replace(/\\n+/g, `$&\\n${indent}`);\n // Verify that output will be parsed as a string, as e.g. plain numbers and\n // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),\n // and others in v1.1.\n if (actualString) {\n const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);\n const { compat, tags } = ctx.doc.schema;\n if (tags.some(test) || compat?.some(test))\n return quotedString(value, ctx);\n }\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction stringifyString(item, ctx, onComment, onChompKeep) {\n const { implicitKey, inFlow } = ctx;\n const ss = typeof item.value === 'string'\n ? item\n : Object.assign({}, item, { value: String(item.value) });\n let { type } = item;\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n // force double quotes on control characters & unpaired surrogates\n if (/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(ss.value))\n type = Scalar.Scalar.QUOTE_DOUBLE;\n }\n const _stringify = (_type) => {\n switch (_type) {\n case Scalar.Scalar.BLOCK_FOLDED:\n case Scalar.Scalar.BLOCK_LITERAL:\n return implicitKey || inFlow\n ? quotedString(ss.value, ctx) // blocks are not valid inside flow containers\n : blockString(ss, ctx, onComment, onChompKeep);\n case Scalar.Scalar.QUOTE_DOUBLE:\n return doubleQuotedString(ss.value, ctx);\n case Scalar.Scalar.QUOTE_SINGLE:\n return singleQuotedString(ss.value, ctx);\n case Scalar.Scalar.PLAIN:\n return plainString(ss, ctx, onComment, onChompKeep);\n default:\n return null;\n }\n };\n let res = _stringify(type);\n if (res === null) {\n const { defaultKeyType, defaultStringType } = ctx.options;\n const t = (implicitKey && defaultKeyType) || defaultStringType;\n res = _stringify(t);\n if (res === null)\n throw new Error(`Unsupported default string type ${t}`);\n }\n return res;\n}\n\nexports.stringifyString = stringifyString;\n","'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar identity = require('../nodes/identity.js');\nvar stringifyComment = require('./stringifyComment.js');\nvar stringifyString = require('./stringifyString.js');\n\nfunction createStringifyContext(doc, options) {\n const opt = Object.assign({\n blockQuote: true,\n commentString: stringifyComment.stringifyComment,\n defaultKeyType: null,\n defaultStringType: 'PLAIN',\n directives: null,\n doubleQuotedAsJSON: false,\n doubleQuotedMinMultiLineLength: 40,\n falseStr: 'false',\n flowCollectionPadding: true,\n indentSeq: true,\n lineWidth: 80,\n minContentWidth: 20,\n nullStr: 'null',\n simpleKeys: false,\n singleQuote: null,\n trueStr: 'true',\n verifyAliasOrder: true\n }, doc.schema.toStringOptions, options);\n let inFlow;\n switch (opt.collectionStyle) {\n case 'block':\n inFlow = false;\n break;\n case 'flow':\n inFlow = true;\n break;\n default:\n inFlow = null;\n }\n return {\n anchors: new Set(),\n doc,\n flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',\n indent: '',\n indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',\n inFlow,\n options: opt\n };\n}\nfunction getTagObject(tags, item) {\n if (item.tag) {\n const match = tags.filter(t => t.tag === item.tag);\n if (match.length > 0)\n return match.find(t => t.format === item.format) ?? match[0];\n }\n let tagObj = undefined;\n let obj;\n if (identity.isScalar(item)) {\n obj = item.value;\n let match = tags.filter(t => t.identify?.(obj));\n if (match.length > 1) {\n const testMatch = match.filter(t => t.test);\n if (testMatch.length > 0)\n match = testMatch;\n }\n tagObj =\n match.find(t => t.format === item.format) ?? match.find(t => !t.format);\n }\n else {\n obj = item;\n tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);\n }\n if (!tagObj) {\n const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);\n throw new Error(`Tag not resolved for ${name} value`);\n }\n return tagObj;\n}\n// needs to be called before value stringifier to allow for circular anchor refs\nfunction stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {\n if (!doc.directives)\n return '';\n const props = [];\n const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;\n if (anchor && anchors.anchorIsValid(anchor)) {\n anchors$1.add(anchor);\n props.push(`&${anchor}`);\n }\n const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);\n if (tag)\n props.push(doc.directives.tagString(tag));\n return props.join(' ');\n}\nfunction stringify(item, ctx, onComment, onChompKeep) {\n if (identity.isPair(item))\n return item.toString(ctx, onComment, onChompKeep);\n if (identity.isAlias(item)) {\n if (ctx.doc.directives)\n return item.toString(ctx);\n if (ctx.resolvedAliases?.has(item)) {\n throw new TypeError(`Cannot stringify circular structure without alias nodes`);\n }\n else {\n if (ctx.resolvedAliases)\n ctx.resolvedAliases.add(item);\n else\n ctx.resolvedAliases = new Set([item]);\n item = item.resolve(ctx.doc);\n }\n }\n let tagObj = undefined;\n const node = identity.isNode(item)\n ? item\n : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });\n tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));\n const props = stringifyProps(node, tagObj, ctx);\n if (props.length > 0)\n ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;\n const str = typeof tagObj.stringify === 'function'\n ? tagObj.stringify(node, ctx, onComment, onChompKeep)\n : identity.isScalar(node)\n ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep)\n : node.toString(ctx, onComment, onChompKeep);\n if (!props)\n return str;\n return identity.isScalar(node) || str[0] === '{' || str[0] === '['\n ? `${props} ${str}`\n : `${props}\\n${ctx.indent}${str}`;\n}\n\nexports.createStringifyContext = createStringifyContext;\nexports.stringify = stringify;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyPair({ key, value }, ctx, onComment, onChompKeep) {\n const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;\n let keyComment = (identity.isNode(key) && key.comment) || null;\n if (simpleKeys) {\n if (keyComment) {\n throw new Error('With simple keys, key nodes cannot have comments');\n }\n if (identity.isCollection(key) || (!identity.isNode(key) && typeof key === 'object')) {\n const msg = 'With simple keys, collection cannot be used as a key value';\n throw new Error(msg);\n }\n }\n let explicitKey = !simpleKeys &&\n (!key ||\n (keyComment && value == null && !ctx.inFlow) ||\n identity.isCollection(key) ||\n (identity.isScalar(key)\n ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL\n : typeof key === 'object'));\n ctx = Object.assign({}, ctx, {\n allNullValues: false,\n implicitKey: !explicitKey && (simpleKeys || !allNullValues),\n indent: indent + indentStep\n });\n let keyCommentDone = false;\n let chompKeep = false;\n let str = stringify.stringify(key, ctx, () => (keyCommentDone = true), () => (chompKeep = true));\n if (!explicitKey && !ctx.inFlow && str.length > 1024) {\n if (simpleKeys)\n throw new Error('With simple keys, single line scalar must not span more than 1024 characters');\n explicitKey = true;\n }\n if (ctx.inFlow) {\n if (allNullValues || value == null) {\n if (keyCommentDone && onComment)\n onComment();\n return str === '' ? '?' : explicitKey ? `? ${str}` : str;\n }\n }\n else if ((allNullValues && !simpleKeys) || (value == null && explicitKey)) {\n str = `? ${str}`;\n if (keyComment && !keyCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n }\n if (keyCommentDone)\n keyComment = null;\n if (explicitKey) {\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n str = `? ${str}\\n${indent}:`;\n }\n else {\n str = `${str}:`;\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n let vsb, vcb, valueComment;\n if (identity.isNode(value)) {\n vsb = !!value.spaceBefore;\n vcb = value.commentBefore;\n valueComment = value.comment;\n }\n else {\n vsb = false;\n vcb = null;\n valueComment = null;\n if (value && typeof value === 'object')\n value = doc.createNode(value);\n }\n ctx.implicitKey = false;\n if (!explicitKey && !keyComment && identity.isScalar(value))\n ctx.indentAtStart = str.length + 1;\n chompKeep = false;\n if (!indentSeq &&\n indentStep.length >= 2 &&\n !ctx.inFlow &&\n !explicitKey &&\n identity.isSeq(value) &&\n !value.flow &&\n !value.tag &&\n !value.anchor) {\n // If indentSeq === false, consider '- ' as part of indentation where possible\n ctx.indent = ctx.indent.substring(2);\n }\n let valueCommentDone = false;\n const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));\n let ws = ' ';\n if (keyComment || vsb || vcb) {\n ws = vsb ? '\\n' : '';\n if (vcb) {\n const cs = commentString(vcb);\n ws += `\\n${stringifyComment.indentComment(cs, ctx.indent)}`;\n }\n if (valueStr === '' && !ctx.inFlow) {\n if (ws === '\\n' && valueComment)\n ws = '\\n\\n';\n }\n else {\n ws += `\\n${ctx.indent}`;\n }\n }\n else if (!explicitKey && identity.isCollection(value)) {\n const vs0 = valueStr[0];\n const nl0 = valueStr.indexOf('\\n');\n const hasNewline = nl0 !== -1;\n const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;\n if (hasNewline || !flow) {\n let hasPropsLine = false;\n if (hasNewline && (vs0 === '&' || vs0 === '!')) {\n let sp0 = valueStr.indexOf(' ');\n if (vs0 === '&' &&\n sp0 !== -1 &&\n sp0 < nl0 &&\n valueStr[sp0 + 1] === '!') {\n sp0 = valueStr.indexOf(' ', sp0 + 1);\n }\n if (sp0 === -1 || nl0 < sp0)\n hasPropsLine = true;\n }\n if (!hasPropsLine)\n ws = `\\n${ctx.indent}`;\n }\n }\n else if (valueStr === '' || valueStr[0] === '\\n') {\n ws = '';\n }\n str += ws + valueStr;\n if (ctx.inFlow) {\n if (valueCommentDone && onComment)\n onComment();\n }\n else if (valueComment && !valueCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(valueComment));\n }\n else if (chompKeep && onChompKeep) {\n onChompKeep();\n }\n return str;\n}\n\nexports.stringifyPair = stringifyPair;\n","'use strict';\n\nvar node_process = require('process');\n\nfunction debug(logLevel, ...messages) {\n if (logLevel === 'debug')\n console.log(...messages);\n}\nfunction warn(logLevel, warning) {\n if (logLevel === 'debug' || logLevel === 'warn') {\n if (typeof node_process.emitWarning === 'function')\n node_process.emitWarning(warning);\n else\n console.warn(warning);\n }\n}\n\nexports.debug = debug;\nexports.warn = warn;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Scalar = require('../../nodes/Scalar.js');\n\n// If the value associated with a merge key is a single mapping node, each of\n// its key/value pairs is inserted into the current mapping, unless the key\n// already exists in it. If the value associated with the merge key is a\n// sequence, then this sequence is expected to contain mapping nodes and each\n// of these nodes is merged in turn according to its order in the sequence.\n// Keys in mapping nodes earlier in the sequence override keys specified in\n// later mapping nodes. -- http://yaml.org/type/merge.html\nconst MERGE_KEY = '<<';\nconst merge = {\n identify: value => value === MERGE_KEY ||\n (typeof value === 'symbol' && value.description === MERGE_KEY),\n default: 'key',\n tag: 'tag:yaml.org,2002:merge',\n test: /^<<$/,\n resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {\n addToJSMap: addMergeToJSMap\n }),\n stringify: () => MERGE_KEY\n};\nconst isMergeKey = (ctx, key) => (merge.identify(key) ||\n (identity.isScalar(key) &&\n (!key.type || key.type === Scalar.Scalar.PLAIN) &&\n merge.identify(key.value))) &&\n ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);\nfunction addMergeToJSMap(ctx, map, value) {\n value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;\n if (identity.isSeq(value))\n for (const it of value.items)\n mergeValue(ctx, map, it);\n else if (Array.isArray(value))\n for (const it of value)\n mergeValue(ctx, map, it);\n else\n mergeValue(ctx, map, value);\n}\nfunction mergeValue(ctx, map, value) {\n const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;\n if (!identity.isMap(source))\n throw new Error('Merge sources must be maps or map aliases');\n const srcMap = source.toJSON(null, ctx, Map);\n for (const [key, value] of srcMap) {\n if (map instanceof Map) {\n if (!map.has(key))\n map.set(key, value);\n }\n else if (map instanceof Set) {\n map.add(key);\n }\n else if (!Object.prototype.hasOwnProperty.call(map, key)) {\n Object.defineProperty(map, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n }\n return map;\n}\n\nexports.addMergeToJSMap = addMergeToJSMap;\nexports.isMergeKey = isMergeKey;\nexports.merge = merge;\n","'use strict';\n\nvar log = require('../log.js');\nvar merge = require('../schema/yaml-1.1/merge.js');\nvar stringify = require('../stringify/stringify.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nfunction addPairToJSMap(ctx, map, { key, value }) {\n if (identity.isNode(key) && key.addToJSMap)\n key.addToJSMap(ctx, map, value);\n // TODO: Should drop this special case for bare << handling\n else if (merge.isMergeKey(ctx, key))\n merge.addMergeToJSMap(ctx, map, value);\n else {\n const jsKey = toJS.toJS(key, '', ctx);\n if (map instanceof Map) {\n map.set(jsKey, toJS.toJS(value, jsKey, ctx));\n }\n else if (map instanceof Set) {\n map.add(jsKey);\n }\n else {\n const stringKey = stringifyKey(key, jsKey, ctx);\n const jsValue = toJS.toJS(value, stringKey, ctx);\n if (stringKey in map)\n Object.defineProperty(map, stringKey, {\n value: jsValue,\n writable: true,\n enumerable: true,\n configurable: true\n });\n else\n map[stringKey] = jsValue;\n }\n }\n return map;\n}\nfunction stringifyKey(key, jsKey, ctx) {\n if (jsKey === null)\n return '';\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n if (typeof jsKey !== 'object')\n return String(jsKey);\n if (identity.isNode(key) && ctx?.doc) {\n const strCtx = stringify.createStringifyContext(ctx.doc, {});\n strCtx.anchors = new Set();\n for (const node of ctx.anchors.keys())\n strCtx.anchors.add(node.anchor);\n strCtx.inFlow = true;\n strCtx.inStringifyKey = true;\n const strKey = key.toString(strCtx);\n if (!ctx.mapKeyWarned) {\n let jsonStr = JSON.stringify(strKey);\n if (jsonStr.length > 40)\n jsonStr = jsonStr.substring(0, 36) + '...\"';\n log.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);\n ctx.mapKeyWarned = true;\n }\n return strKey;\n }\n return JSON.stringify(jsKey);\n}\n\nexports.addPairToJSMap = addPairToJSMap;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyPair = require('../stringify/stringifyPair.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar identity = require('./identity.js');\n\nfunction createPair(key, value, ctx) {\n const k = createNode.createNode(key, undefined, ctx);\n const v = createNode.createNode(value, undefined, ctx);\n return new Pair(k, v);\n}\nclass Pair {\n constructor(key, value = null) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.PAIR });\n this.key = key;\n this.value = value;\n }\n clone(schema) {\n let { key, value } = this;\n if (identity.isNode(key))\n key = key.clone(schema);\n if (identity.isNode(value))\n value = value.clone(schema);\n return new Pair(key, value);\n }\n toJSON(_, ctx) {\n const pair = ctx?.mapAsMap ? new Map() : {};\n return addPairToJSMap.addPairToJSMap(ctx, pair, this);\n }\n toString(ctx, onComment, onChompKeep) {\n return ctx?.doc\n ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)\n : JSON.stringify(this);\n }\n}\n\nexports.Pair = Pair;\nexports.createPair = createPair;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyCollection(collection, ctx, options) {\n const flow = ctx.inFlow ?? collection.flow;\n const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;\n return stringify(collection, ctx, options);\n}\nfunction stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {\n const { indent, options: { commentString } } = ctx;\n const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });\n let chompKeep = false; // flag for the preceding node's status\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (!chompKeep && item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, chompKeep);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (!chompKeep && ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);\n }\n }\n chompKeep = false;\n let str = stringify.stringify(item, itemCtx, () => (comment = null), () => (chompKeep = true));\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n if (chompKeep && comment)\n chompKeep = false;\n lines.push(blockItemPrefix + str);\n }\n let str;\n if (lines.length === 0) {\n str = flowChars.start + flowChars.end;\n }\n else {\n str = lines[0];\n for (let i = 1; i < lines.length; ++i) {\n const line = lines[i];\n str += line ? `\\n${indent}${line}` : '\\n';\n }\n }\n if (comment) {\n str += '\\n' + stringifyComment.indentComment(commentString(comment), indent);\n if (onComment)\n onComment();\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n}\nfunction stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {\n const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;\n itemIndent += indentStep;\n const itemCtx = Object.assign({}, ctx, {\n indent: itemIndent,\n inFlow: true,\n type: null\n });\n let reqNewline = false;\n let linesAtValue = 0;\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, false);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, false);\n if (ik.comment)\n reqNewline = true;\n }\n const iv = identity.isNode(item.value) ? item.value : null;\n if (iv) {\n if (iv.comment)\n comment = iv.comment;\n if (iv.commentBefore)\n reqNewline = true;\n }\n else if (item.value == null && ik?.comment) {\n comment = ik.comment;\n }\n }\n if (comment)\n reqNewline = true;\n let str = stringify.stringify(item, itemCtx, () => (comment = null));\n if (i < items.length - 1)\n str += ',';\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n if (!reqNewline && (lines.length > linesAtValue || str.includes('\\n')))\n reqNewline = true;\n lines.push(str);\n linesAtValue = lines.length;\n }\n const { start, end } = flowChars;\n if (lines.length === 0) {\n return start + end;\n }\n else {\n if (!reqNewline) {\n const len = lines.reduce((sum, line) => sum + line.length + 2, 2);\n reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;\n }\n if (reqNewline) {\n let str = start;\n for (const line of lines)\n str += line ? `\\n${indentStep}${indent}${line}` : '\\n';\n return `${str}\\n${indent}${end}`;\n }\n else {\n return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;\n }\n }\n}\nfunction addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {\n if (comment && chompKeep)\n comment = comment.replace(/^\\n+/, '');\n if (comment) {\n const ic = stringifyComment.indentComment(commentString(comment), indent);\n lines.push(ic.trimStart()); // Avoid double indent on first line\n }\n}\n\nexports.stringifyCollection = stringifyCollection;\n","'use strict';\n\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Pair = require('./Pair.js');\nvar Scalar = require('./Scalar.js');\n\nfunction findPair(items, key) {\n const k = identity.isScalar(key) ? key.value : key;\n for (const it of items) {\n if (identity.isPair(it)) {\n if (it.key === key || it.key === k)\n return it;\n if (identity.isScalar(it.key) && it.key.value === k)\n return it;\n }\n }\n return undefined;\n}\nclass YAMLMap extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:map';\n }\n constructor(schema) {\n super(identity.MAP, schema);\n this.items = [];\n }\n /**\n * A generic collection parsing method that can be extended\n * to other node classes that inherit from YAMLMap\n */\n static from(schema, obj, ctx) {\n const { keepUndefined, replacer } = ctx;\n const map = new this(schema);\n const add = (key, value) => {\n if (typeof replacer === 'function')\n value = replacer.call(obj, key, value);\n else if (Array.isArray(replacer) && !replacer.includes(key))\n return;\n if (value !== undefined || keepUndefined)\n map.items.push(Pair.createPair(key, value, ctx));\n };\n if (obj instanceof Map) {\n for (const [key, value] of obj)\n add(key, value);\n }\n else if (obj && typeof obj === 'object') {\n for (const key of Object.keys(obj))\n add(key, obj[key]);\n }\n if (typeof schema.sortMapEntries === 'function') {\n map.items.sort(schema.sortMapEntries);\n }\n return map;\n }\n /**\n * Adds a value to the collection.\n *\n * @param overwrite - If not set `true`, using a key that is already in the\n * collection will throw. Otherwise, overwrites the previous value.\n */\n add(pair, overwrite) {\n let _pair;\n if (identity.isPair(pair))\n _pair = pair;\n else if (!pair || typeof pair !== 'object' || !('key' in pair)) {\n // In TypeScript, this never happens.\n _pair = new Pair.Pair(pair, pair?.value);\n }\n else\n _pair = new Pair.Pair(pair.key, pair.value);\n const prev = findPair(this.items, _pair.key);\n const sortEntries = this.schema?.sortMapEntries;\n if (prev) {\n if (!overwrite)\n throw new Error(`Key ${_pair.key} already set`);\n // For scalars, keep the old node & its comments and anchors\n if (identity.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))\n prev.value.value = _pair.value;\n else\n prev.value = _pair.value;\n }\n else if (sortEntries) {\n const i = this.items.findIndex(item => sortEntries(_pair, item) < 0);\n if (i === -1)\n this.items.push(_pair);\n else\n this.items.splice(i, 0, _pair);\n }\n else {\n this.items.push(_pair);\n }\n }\n delete(key) {\n const it = findPair(this.items, key);\n if (!it)\n return false;\n const del = this.items.splice(this.items.indexOf(it), 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const it = findPair(this.items, key);\n const node = it?.value;\n return (!keepScalar && identity.isScalar(node) ? node.value : node) ?? undefined;\n }\n has(key) {\n return !!findPair(this.items, key);\n }\n set(key, value) {\n this.add(new Pair.Pair(key, value), true);\n }\n /**\n * @param ctx - Conversion context, originally set in Document#toJS()\n * @param {Class} Type - If set, forces the returned collection type\n * @returns Instance of Type, Map, or Object\n */\n toJSON(_, ctx, Type) {\n const map = Type ? new Type() : ctx?.mapAsMap ? new Map() : {};\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const item of this.items)\n addPairToJSMap.addPairToJSMap(ctx, map, item);\n return map;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n for (const item of this.items) {\n if (!identity.isPair(item))\n throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);\n }\n if (!ctx.allNullValues && this.hasAllNullValues(false))\n ctx = Object.assign({}, ctx, { allNullValues: true });\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '',\n flowChars: { start: '{', end: '}' },\n itemIndent: ctx.indent || '',\n onChompKeep,\n onComment\n });\n }\n}\n\nexports.YAMLMap = YAMLMap;\nexports.findPair = findPair;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nconst map = {\n collection: 'map',\n default: true,\n nodeClass: YAMLMap.YAMLMap,\n tag: 'tag:yaml.org,2002:map',\n resolve(map, onError) {\n if (!identity.isMap(map))\n onError('Expected a mapping for this tag');\n return map;\n },\n createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)\n};\n\nexports.map = map;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Scalar = require('./Scalar.js');\nvar toJS = require('./toJS.js');\n\nclass YAMLSeq extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:seq';\n }\n constructor(schema) {\n super(identity.SEQ, schema);\n this.items = [];\n }\n add(value) {\n this.items.push(value);\n }\n /**\n * Removes a value from the collection.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n *\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return false;\n const del = this.items.splice(idx, 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return undefined;\n const it = this.items[idx];\n return !keepScalar && identity.isScalar(it) ? it.value : it;\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n */\n has(key) {\n const idx = asItemIndex(key);\n return typeof idx === 'number' && idx < this.items.length;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n *\n * If `key` does not contain a representation of an integer, this will throw.\n * It may be wrapped in a `Scalar`.\n */\n set(key, value) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n throw new Error(`Expected a valid index, not ${key}.`);\n const prev = this.items[idx];\n if (identity.isScalar(prev) && Scalar.isScalarValue(value))\n prev.value = value;\n else\n this.items[idx] = value;\n }\n toJSON(_, ctx) {\n const seq = [];\n if (ctx?.onCreate)\n ctx.onCreate(seq);\n let i = 0;\n for (const item of this.items)\n seq.push(toJS.toJS(item, String(i++), ctx));\n return seq;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '- ',\n flowChars: { start: '[', end: ']' },\n itemIndent: (ctx.indent || '') + ' ',\n onChompKeep,\n onComment\n });\n }\n static from(schema, obj, ctx) {\n const { replacer } = ctx;\n const seq = new this(schema);\n if (obj && Symbol.iterator in Object(obj)) {\n let i = 0;\n for (let it of obj) {\n if (typeof replacer === 'function') {\n const key = obj instanceof Set ? it : String(i++);\n it = replacer.call(obj, key, it);\n }\n seq.items.push(createNode.createNode(it, undefined, ctx));\n }\n }\n return seq;\n }\n}\nfunction asItemIndex(key) {\n let idx = identity.isScalar(key) ? key.value : key;\n if (idx && typeof idx === 'string')\n idx = Number(idx);\n return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0\n ? idx\n : null;\n}\n\nexports.YAMLSeq = YAMLSeq;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nconst seq = {\n collection: 'seq',\n default: true,\n nodeClass: YAMLSeq.YAMLSeq,\n tag: 'tag:yaml.org,2002:seq',\n resolve(seq, onError) {\n if (!identity.isSeq(seq))\n onError('Expected a sequence for this tag');\n return seq;\n },\n createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)\n};\n\nexports.seq = seq;\n","'use strict';\n\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst string = {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify(item, ctx, onComment, onChompKeep) {\n ctx = Object.assign({ actualString: true }, ctx);\n return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);\n }\n};\n\nexports.string = string;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst nullTag = {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^(?:~|[Nn]ull|NULL)?$/,\n resolve: () => new Scalar.Scalar(null),\n stringify: ({ source }, ctx) => typeof source === 'string' && nullTag.test.test(source)\n ? source\n : ctx.options.nullStr\n};\n\nexports.nullTag = nullTag;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst boolTag = {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,\n resolve: str => new Scalar.Scalar(str[0] === 't' || str[0] === 'T'),\n stringify({ source, value }, ctx) {\n if (source && boolTag.test.test(source)) {\n const sv = source[0] === 't' || source[0] === 'T';\n if (value === sv)\n return source;\n }\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n }\n};\n\nexports.boolTag = boolTag;\n","'use strict';\n\nfunction stringifyNumber({ format, minFractionDigits, tag, value }) {\n if (typeof value === 'bigint')\n return String(value);\n const num = typeof value === 'number' ? value : Number(value);\n if (!isFinite(num))\n return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';\n let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);\n if (!format &&\n minFractionDigits &&\n (!tag || tag === 'tag:yaml.org,2002:float') &&\n /^\\d/.test(n)) {\n let i = n.indexOf('.');\n if (i < 0) {\n i = n.length;\n n += '.';\n }\n let d = minFractionDigits - (n.length - i - 1);\n while (d-- > 0)\n n += '0';\n }\n return n;\n}\n\nexports.stringifyNumber = stringifyNumber;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: str => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,\n resolve: str => parseFloat(str),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str));\n const dot = str.indexOf('.');\n if (dot !== -1 && str[str.length - 1] === '0')\n node.minFractionDigits = str.length - dot - 1;\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nconst intResolve = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix));\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value) && value >= 0)\n return prefix + value.toString(radix);\n return stringifyNumber.stringifyNumber(node);\n}\nconst intOct = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^0o[0-7]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),\n stringify: node => intStringify(node, 8, '0o')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^0x[0-9a-fA-F]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intHex = intHex;\nexports.intOct = intOct;\n","'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.boolTag,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float\n];\n\nexports.schema = schema;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar map = require('../common/map.js');\nvar seq = require('../common/seq.js');\n\nfunction intIdentify(value) {\n return typeof value === 'bigint' || Number.isInteger(value);\n}\nconst stringifyJSON = ({ value }) => JSON.stringify(value);\nconst jsonScalars = [\n {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify: stringifyJSON\n },\n {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^null$/,\n resolve: () => null,\n stringify: stringifyJSON\n },\n {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^true$|^false$/,\n resolve: str => str === 'true',\n stringify: stringifyJSON\n },\n {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^-?(?:0|[1-9][0-9]*)$/,\n resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),\n stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)\n },\n {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,\n resolve: str => parseFloat(str),\n stringify: stringifyJSON\n }\n];\nconst jsonError = {\n default: true,\n tag: '',\n test: /^/,\n resolve(str, onError) {\n onError(`Unresolved plain scalar ${JSON.stringify(str)}`);\n return str;\n }\n};\nconst schema = [map.map, seq.seq].concat(jsonScalars, jsonError);\n\nexports.schema = schema;\n","'use strict';\n\nvar node_buffer = require('buffer');\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst binary = {\n identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array\n default: false,\n tag: 'tag:yaml.org,2002:binary',\n /**\n * Returns a Buffer in node and an Uint8Array in browsers\n *\n * To use the resulting buffer as an image, you'll want to do something like:\n *\n * const blob = new Blob([buffer], { type: 'image/jpeg' })\n * document.querySelector('#photo').src = URL.createObjectURL(blob)\n */\n resolve(src, onError) {\n if (typeof node_buffer.Buffer === 'function') {\n return node_buffer.Buffer.from(src, 'base64');\n }\n else if (typeof atob === 'function') {\n // On IE 11, atob() can't handle newlines\n const str = atob(src.replace(/[\\n\\r]/g, ''));\n const buffer = new Uint8Array(str.length);\n for (let i = 0; i < str.length; ++i)\n buffer[i] = str.charCodeAt(i);\n return buffer;\n }\n else {\n onError('This environment does not support reading binary tags; either Buffer or atob is required');\n return src;\n }\n },\n stringify({ comment, type, value }, ctx, onComment, onChompKeep) {\n if (!value)\n return '';\n const buf = value; // checked earlier by binary.identify()\n let str;\n if (typeof node_buffer.Buffer === 'function') {\n str =\n buf instanceof node_buffer.Buffer\n ? buf.toString('base64')\n : node_buffer.Buffer.from(buf.buffer).toString('base64');\n }\n else if (typeof btoa === 'function') {\n let s = '';\n for (let i = 0; i < buf.length; ++i)\n s += String.fromCharCode(buf[i]);\n str = btoa(s);\n }\n else {\n throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');\n }\n type ?? (type = Scalar.Scalar.BLOCK_LITERAL);\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);\n const n = Math.ceil(str.length / lineWidth);\n const lines = new Array(n);\n for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {\n lines[i] = str.substr(o, lineWidth);\n }\n str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? '\\n' : ' ');\n }\n return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);\n }\n};\n\nexports.binary = binary;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar Scalar = require('../../nodes/Scalar.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nfunction resolvePairs(seq, onError) {\n if (identity.isSeq(seq)) {\n for (let i = 0; i < seq.items.length; ++i) {\n let item = seq.items[i];\n if (identity.isPair(item))\n continue;\n else if (identity.isMap(item)) {\n if (item.items.length > 1)\n onError('Each pair must have its own sequence indicator');\n const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));\n if (item.commentBefore)\n pair.key.commentBefore = pair.key.commentBefore\n ? `${item.commentBefore}\\n${pair.key.commentBefore}`\n : item.commentBefore;\n if (item.comment) {\n const cn = pair.value ?? pair.key;\n cn.comment = cn.comment\n ? `${item.comment}\\n${cn.comment}`\n : item.comment;\n }\n item = pair;\n }\n seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item);\n }\n }\n else\n onError('Expected a sequence for this tag');\n return seq;\n}\nfunction createPairs(schema, iterable, ctx) {\n const { replacer } = ctx;\n const pairs = new YAMLSeq.YAMLSeq(schema);\n pairs.tag = 'tag:yaml.org,2002:pairs';\n let i = 0;\n if (iterable && Symbol.iterator in Object(iterable))\n for (let it of iterable) {\n if (typeof replacer === 'function')\n it = replacer.call(iterable, String(i++), it);\n let key, value;\n if (Array.isArray(it)) {\n if (it.length === 2) {\n key = it[0];\n value = it[1];\n }\n else\n throw new TypeError(`Expected [key, value] tuple: ${it}`);\n }\n else if (it && it instanceof Object) {\n const keys = Object.keys(it);\n if (keys.length === 1) {\n key = keys[0];\n value = it[key];\n }\n else {\n throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);\n }\n }\n else {\n key = it;\n }\n pairs.items.push(Pair.createPair(key, value, ctx));\n }\n return pairs;\n}\nconst pairs = {\n collection: 'seq',\n default: false,\n tag: 'tag:yaml.org,2002:pairs',\n resolve: resolvePairs,\n createNode: createPairs\n};\n\nexports.createPairs = createPairs;\nexports.pairs = pairs;\nexports.resolvePairs = resolvePairs;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar toJS = require('../../nodes/toJS.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\nvar pairs = require('./pairs.js');\n\nclass YAMLOMap extends YAMLSeq.YAMLSeq {\n constructor() {\n super();\n this.add = YAMLMap.YAMLMap.prototype.add.bind(this);\n this.delete = YAMLMap.YAMLMap.prototype.delete.bind(this);\n this.get = YAMLMap.YAMLMap.prototype.get.bind(this);\n this.has = YAMLMap.YAMLMap.prototype.has.bind(this);\n this.set = YAMLMap.YAMLMap.prototype.set.bind(this);\n this.tag = YAMLOMap.tag;\n }\n /**\n * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,\n * but TypeScript won't allow widening the signature of a child method.\n */\n toJSON(_, ctx) {\n if (!ctx)\n return super.toJSON(_);\n const map = new Map();\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const pair of this.items) {\n let key, value;\n if (identity.isPair(pair)) {\n key = toJS.toJS(pair.key, '', ctx);\n value = toJS.toJS(pair.value, key, ctx);\n }\n else {\n key = toJS.toJS(pair, '', ctx);\n }\n if (map.has(key))\n throw new Error('Ordered maps must not include duplicate keys');\n map.set(key, value);\n }\n return map;\n }\n static from(schema, iterable, ctx) {\n const pairs$1 = pairs.createPairs(schema, iterable, ctx);\n const omap = new this();\n omap.items = pairs$1.items;\n return omap;\n }\n}\nYAMLOMap.tag = 'tag:yaml.org,2002:omap';\nconst omap = {\n collection: 'seq',\n identify: value => value instanceof Map,\n nodeClass: YAMLOMap,\n default: false,\n tag: 'tag:yaml.org,2002:omap',\n resolve(seq, onError) {\n const pairs$1 = pairs.resolvePairs(seq, onError);\n const seenKeys = [];\n for (const { key } of pairs$1.items) {\n if (identity.isScalar(key)) {\n if (seenKeys.includes(key.value)) {\n onError(`Ordered maps must not include duplicate keys: ${key.value}`);\n }\n else {\n seenKeys.push(key.value);\n }\n }\n }\n return Object.assign(new YAMLOMap(), pairs$1);\n },\n createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)\n};\n\nexports.YAMLOMap = YAMLOMap;\nexports.omap = omap;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nfunction boolStringify({ value, source }, ctx) {\n const boolObj = value ? trueTag : falseTag;\n if (source && boolObj.test.test(source))\n return source;\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n}\nconst trueTag = {\n identify: value => value === true,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,\n resolve: () => new Scalar.Scalar(true),\n stringify: boolStringify\n};\nconst falseTag = {\n identify: value => value === false,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,\n resolve: () => new Scalar.Scalar(false),\n stringify: boolStringify\n};\n\nexports.falseTag = falseTag;\nexports.trueTag = trueTag;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: (str) => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,\n resolve: (str) => parseFloat(str.replace(/_/g, '')),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str.replace(/_/g, '')));\n const dot = str.indexOf('.');\n if (dot !== -1) {\n const f = str.substring(dot + 1).replace(/_/g, '');\n if (f[f.length - 1] === '0')\n node.minFractionDigits = f.length;\n }\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nfunction intResolve(str, offset, radix, { intAsBigInt }) {\n const sign = str[0];\n if (sign === '-' || sign === '+')\n offset += 1;\n str = str.substring(offset).replace(/_/g, '');\n if (intAsBigInt) {\n switch (radix) {\n case 2:\n str = `0b${str}`;\n break;\n case 8:\n str = `0o${str}`;\n break;\n case 16:\n str = `0x${str}`;\n break;\n }\n const n = BigInt(str);\n return sign === '-' ? BigInt(-1) * n : n;\n }\n const n = parseInt(str, radix);\n return sign === '-' ? -1 * n : n;\n}\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value)) {\n const str = value.toString(radix);\n return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;\n }\n return stringifyNumber.stringifyNumber(node);\n}\nconst intBin = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'BIN',\n test: /^[-+]?0b[0-1_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),\n stringify: node => intStringify(node, 2, '0b')\n};\nconst intOct = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^[-+]?0[0-7_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),\n stringify: node => intStringify(node, 8, '0')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9][0-9_]*$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^[-+]?0x[0-9a-fA-F_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intBin = intBin;\nexports.intHex = intHex;\nexports.intOct = intOct;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nclass YAMLSet extends YAMLMap.YAMLMap {\n constructor(schema) {\n super(schema);\n this.tag = YAMLSet.tag;\n }\n add(key) {\n let pair;\n if (identity.isPair(key))\n pair = key;\n else if (key &&\n typeof key === 'object' &&\n 'key' in key &&\n 'value' in key &&\n key.value === null)\n pair = new Pair.Pair(key.key, null);\n else\n pair = new Pair.Pair(key, null);\n const prev = YAMLMap.findPair(this.items, pair.key);\n if (!prev)\n this.items.push(pair);\n }\n /**\n * If `keepPair` is `true`, returns the Pair matching `key`.\n * Otherwise, returns the value of that Pair's key.\n */\n get(key, keepPair) {\n const pair = YAMLMap.findPair(this.items, key);\n return !keepPair && identity.isPair(pair)\n ? identity.isScalar(pair.key)\n ? pair.key.value\n : pair.key\n : pair;\n }\n set(key, value) {\n if (typeof value !== 'boolean')\n throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);\n const prev = YAMLMap.findPair(this.items, key);\n if (prev && !value) {\n this.items.splice(this.items.indexOf(prev), 1);\n }\n else if (!prev && value) {\n this.items.push(new Pair.Pair(key));\n }\n }\n toJSON(_, ctx) {\n return super.toJSON(_, ctx, Set);\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n if (this.hasAllNullValues(true))\n return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);\n else\n throw new Error('Set items must all have null values');\n }\n static from(schema, iterable, ctx) {\n const { replacer } = ctx;\n const set = new this(schema);\n if (iterable && Symbol.iterator in Object(iterable))\n for (let value of iterable) {\n if (typeof replacer === 'function')\n value = replacer.call(iterable, value, value);\n set.items.push(Pair.createPair(value, null, ctx));\n }\n return set;\n }\n}\nYAMLSet.tag = 'tag:yaml.org,2002:set';\nconst set = {\n collection: 'map',\n identify: value => value instanceof Set,\n nodeClass: YAMLSet,\n default: false,\n tag: 'tag:yaml.org,2002:set',\n createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),\n resolve(map, onError) {\n if (identity.isMap(map)) {\n if (map.hasAllNullValues(true))\n return Object.assign(new YAMLSet(), map);\n else\n onError('Set items must all have null values');\n }\n else\n onError('Expected a mapping for this tag');\n return map;\n }\n};\n\nexports.YAMLSet = YAMLSet;\nexports.set = set;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\n/** Internal types handle bigint as number, because TS can't figure it out. */\nfunction parseSexagesimal(str, asBigInt) {\n const sign = str[0];\n const parts = sign === '-' || sign === '+' ? str.substring(1) : str;\n const num = (n) => asBigInt ? BigInt(n) : Number(n);\n const res = parts\n .replace(/_/g, '')\n .split(':')\n .reduce((res, p) => res * num(60) + num(p), num(0));\n return (sign === '-' ? num(-1) * res : res);\n}\n/**\n * hhhh:mm:ss.sss\n *\n * Internal types handle bigint as number, because TS can't figure it out.\n */\nfunction stringifySexagesimal(node) {\n let { value } = node;\n let num = (n) => n;\n if (typeof value === 'bigint')\n num = n => BigInt(n);\n else if (isNaN(value) || !isFinite(value))\n return stringifyNumber.stringifyNumber(node);\n let sign = '';\n if (value < 0) {\n sign = '-';\n value *= num(-1);\n }\n const _60 = num(60);\n const parts = [value % _60]; // seconds, including ms\n if (value < 60) {\n parts.unshift(0); // at least one : is required\n }\n else {\n value = (value - parts[0]) / _60;\n parts.unshift(value % _60); // minutes\n if (value >= 60) {\n value = (value - parts[0]) / _60;\n parts.unshift(value); // hours\n }\n }\n return (sign +\n parts\n .map(n => String(n).padStart(2, '0'))\n .join(':')\n .replace(/000000\\d*$/, '') // % 60 may introduce error\n );\n}\nconst intTime = {\n identify: value => typeof value === 'bigint' || Number.isInteger(value),\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,\n resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),\n stringify: stringifySexagesimal\n};\nconst floatTime = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,\n resolve: str => parseSexagesimal(str, false),\n stringify: stringifySexagesimal\n};\nconst timestamp = {\n identify: value => value instanceof Date,\n default: true,\n tag: 'tag:yaml.org,2002:timestamp',\n // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part\n // may be omitted altogether, resulting in a date format. In such a case, the time part is\n // assumed to be 00:00:00Z (start of day, UTC).\n test: RegExp('^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd\n '(?:' + // time is optional\n '(?:t|T|[ \\\\t]+)' + // t | T | whitespace\n '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?\n '(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30\n ')?$'),\n resolve(str) {\n const match = str.match(timestamp.test);\n if (!match)\n throw new Error('!!timestamp expects a date, starting with yyyy-mm-dd');\n const [, year, month, day, hour, minute, second] = match.map(Number);\n const millisec = match[7] ? Number((match[7] + '00').substr(1, 3)) : 0;\n let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);\n const tz = match[8];\n if (tz && tz !== 'Z') {\n let d = parseSexagesimal(tz, false);\n if (Math.abs(d) < 30)\n d *= 60;\n date -= 60000 * d;\n }\n return new Date(date);\n },\n stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\\.000Z$/, '') ?? ''\n};\n\nexports.floatTime = floatTime;\nexports.intTime = intTime;\nexports.timestamp = timestamp;\n","'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar binary = require('./binary.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\nvar merge = require('./merge.js');\nvar omap = require('./omap.js');\nvar pairs = require('./pairs.js');\nvar set = require('./set.js');\nvar timestamp = require('./timestamp.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.trueTag,\n bool.falseTag,\n int.intBin,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float,\n binary.binary,\n merge.merge,\n omap.omap,\n pairs.pairs,\n set.set,\n timestamp.intTime,\n timestamp.floatTime,\n timestamp.timestamp\n];\n\nexports.schema = schema;\n","'use strict';\n\nvar map = require('./common/map.js');\nvar _null = require('./common/null.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar bool = require('./core/bool.js');\nvar float = require('./core/float.js');\nvar int = require('./core/int.js');\nvar schema = require('./core/schema.js');\nvar schema$1 = require('./json/schema.js');\nvar binary = require('./yaml-1.1/binary.js');\nvar merge = require('./yaml-1.1/merge.js');\nvar omap = require('./yaml-1.1/omap.js');\nvar pairs = require('./yaml-1.1/pairs.js');\nvar schema$2 = require('./yaml-1.1/schema.js');\nvar set = require('./yaml-1.1/set.js');\nvar timestamp = require('./yaml-1.1/timestamp.js');\n\nconst schemas = new Map([\n ['core', schema.schema],\n ['failsafe', [map.map, seq.seq, string.string]],\n ['json', schema$1.schema],\n ['yaml11', schema$2.schema],\n ['yaml-1.1', schema$2.schema]\n]);\nconst tagsByName = {\n binary: binary.binary,\n bool: bool.boolTag,\n float: float.float,\n floatExp: float.floatExp,\n floatNaN: float.floatNaN,\n floatTime: timestamp.floatTime,\n int: int.int,\n intHex: int.intHex,\n intOct: int.intOct,\n intTime: timestamp.intTime,\n map: map.map,\n merge: merge.merge,\n null: _null.nullTag,\n omap: omap.omap,\n pairs: pairs.pairs,\n seq: seq.seq,\n set: set.set,\n timestamp: timestamp.timestamp\n};\nconst coreKnownTags = {\n 'tag:yaml.org,2002:binary': binary.binary,\n 'tag:yaml.org,2002:merge': merge.merge,\n 'tag:yaml.org,2002:omap': omap.omap,\n 'tag:yaml.org,2002:pairs': pairs.pairs,\n 'tag:yaml.org,2002:set': set.set,\n 'tag:yaml.org,2002:timestamp': timestamp.timestamp\n};\nfunction getTags(customTags, schemaName, addMergeTag) {\n const schemaTags = schemas.get(schemaName);\n if (schemaTags && !customTags) {\n return addMergeTag && !schemaTags.includes(merge.merge)\n ? schemaTags.concat(merge.merge)\n : schemaTags.slice();\n }\n let tags = schemaTags;\n if (!tags) {\n if (Array.isArray(customTags))\n tags = [];\n else {\n const keys = Array.from(schemas.keys())\n .filter(key => key !== 'yaml11')\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown schema \"${schemaName}\"; use one of ${keys} or define customTags array`);\n }\n }\n if (Array.isArray(customTags)) {\n for (const tag of customTags)\n tags = tags.concat(tag);\n }\n else if (typeof customTags === 'function') {\n tags = customTags(tags.slice());\n }\n if (addMergeTag)\n tags = tags.concat(merge.merge);\n return tags.reduce((tags, tag) => {\n const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;\n if (!tagObj) {\n const tagName = JSON.stringify(tag);\n const keys = Object.keys(tagsByName)\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);\n }\n if (!tags.includes(tagObj))\n tags.push(tagObj);\n return tags;\n }, []);\n}\n\nexports.coreKnownTags = coreKnownTags;\nexports.getTags = getTags;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar map = require('./common/map.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar tags = require('./tags.js');\n\nconst sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;\nclass Schema {\n constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {\n this.compat = Array.isArray(compat)\n ? tags.getTags(compat, 'compat')\n : compat\n ? tags.getTags(null, compat)\n : null;\n this.name = (typeof schema === 'string' && schema) || 'core';\n this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};\n this.tags = tags.getTags(customTags, this.name, merge);\n this.toStringOptions = toStringDefaults ?? null;\n Object.defineProperty(this, identity.MAP, { value: map.map });\n Object.defineProperty(this, identity.SCALAR, { value: string.string });\n Object.defineProperty(this, identity.SEQ, { value: seq.seq });\n // Used by createMap()\n this.sortMapEntries =\n typeof sortMapEntries === 'function'\n ? sortMapEntries\n : sortMapEntries === true\n ? sortMapEntriesByKey\n : null;\n }\n clone() {\n const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));\n copy.tags = this.tags.slice();\n return copy;\n }\n}\n\nexports.Schema = Schema;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyDocument(doc, options) {\n const lines = [];\n let hasDirectives = options.directives === true;\n if (options.directives !== false && doc.directives) {\n const dir = doc.directives.toString(doc);\n if (dir) {\n lines.push(dir);\n hasDirectives = true;\n }\n else if (doc.directives.docStart)\n hasDirectives = true;\n }\n if (hasDirectives)\n lines.push('---');\n const ctx = stringify.createStringifyContext(doc, options);\n const { commentString } = ctx.options;\n if (doc.commentBefore) {\n if (lines.length !== 1)\n lines.unshift('');\n const cs = commentString(doc.commentBefore);\n lines.unshift(stringifyComment.indentComment(cs, ''));\n }\n let chompKeep = false;\n let contentComment = null;\n if (doc.contents) {\n if (identity.isNode(doc.contents)) {\n if (doc.contents.spaceBefore && hasDirectives)\n lines.push('');\n if (doc.contents.commentBefore) {\n const cs = commentString(doc.contents.commentBefore);\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n // top-level block scalars need to be indented if followed by a comment\n ctx.forceBlockIndent = !!doc.comment;\n contentComment = doc.contents.comment;\n }\n const onChompKeep = contentComment ? undefined : () => (chompKeep = true);\n let body = stringify.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);\n if (contentComment)\n body += stringifyComment.lineComment(body, '', commentString(contentComment));\n if ((body[0] === '|' || body[0] === '>') &&\n lines[lines.length - 1] === '---') {\n // Top-level block scalars with a preceding doc marker ought to use the\n // same line for their header.\n lines[lines.length - 1] = `--- ${body}`;\n }\n else\n lines.push(body);\n }\n else {\n lines.push(stringify.stringify(doc.contents, ctx));\n }\n if (doc.directives?.docEnd) {\n if (doc.comment) {\n const cs = commentString(doc.comment);\n if (cs.includes('\\n')) {\n lines.push('...');\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n else {\n lines.push(`... ${cs}`);\n }\n }\n else {\n lines.push('...');\n }\n }\n else {\n let dc = doc.comment;\n if (dc && chompKeep)\n dc = dc.replace(/^\\n+/, '');\n if (dc) {\n if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')\n lines.push('');\n lines.push(stringifyComment.indentComment(commentString(dc), ''));\n }\n }\n return lines.join('\\n') + '\\n';\n}\n\nexports.stringifyDocument = stringifyDocument;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar Collection = require('../nodes/Collection.js');\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar toJS = require('../nodes/toJS.js');\nvar Schema = require('../schema/Schema.js');\nvar stringifyDocument = require('../stringify/stringifyDocument.js');\nvar anchors = require('./anchors.js');\nvar applyReviver = require('./applyReviver.js');\nvar createNode = require('./createNode.js');\nvar directives = require('./directives.js');\n\nclass Document {\n constructor(value, replacer, options) {\n /** A comment before this Document */\n this.commentBefore = null;\n /** A comment immediately after this Document */\n this.comment = null;\n /** Errors encountered during parsing. */\n this.errors = [];\n /** Warnings encountered during parsing. */\n this.warnings = [];\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.DOC });\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const opt = Object.assign({\n intAsBigInt: false,\n keepSourceTokens: false,\n logLevel: 'warn',\n prettyErrors: true,\n strict: true,\n stringKeys: false,\n uniqueKeys: true,\n version: '1.2'\n }, options);\n this.options = opt;\n let { version } = opt;\n if (options?._directives) {\n this.directives = options._directives.atDocument();\n if (this.directives.yaml.explicit)\n version = this.directives.yaml.version;\n }\n else\n this.directives = new directives.Directives({ version });\n this.setSchema(version, options);\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents =\n value === undefined ? null : this.createNode(value, _replacer, options);\n }\n /**\n * Create a deep copy of this Document and its contents.\n *\n * Custom Node values that inherit from `Object` still refer to their original instances.\n */\n clone() {\n const copy = Object.create(Document.prototype, {\n [identity.NODE_TYPE]: { value: identity.DOC }\n });\n copy.commentBefore = this.commentBefore;\n copy.comment = this.comment;\n copy.errors = this.errors.slice();\n copy.warnings = this.warnings.slice();\n copy.options = Object.assign({}, this.options);\n if (this.directives)\n copy.directives = this.directives.clone();\n copy.schema = this.schema.clone();\n // @ts-expect-error We can't really know that this matches Contents.\n copy.contents = identity.isNode(this.contents)\n ? this.contents.clone(copy.schema)\n : this.contents;\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** Adds a value to the document. */\n add(value) {\n if (assertCollection(this.contents))\n this.contents.add(value);\n }\n /** Adds a value to the document. */\n addIn(path, value) {\n if (assertCollection(this.contents))\n this.contents.addIn(path, value);\n }\n /**\n * Create a new `Alias` node, ensuring that the target `node` has the required anchor.\n *\n * If `node` already has an anchor, `name` is ignored.\n * Otherwise, the `node.anchor` value will be set to `name`,\n * or if an anchor with that name is already present in the document,\n * `name` will be used as a prefix for a new unique anchor.\n * If `name` is undefined, the generated anchor will use 'a' as a prefix.\n */\n createAlias(node, name) {\n if (!node.anchor) {\n const prev = anchors.anchorNames(this);\n node.anchor =\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n !name || prev.has(name) ? anchors.findNewAnchor(name || 'a', prev) : name;\n }\n return new Alias.Alias(node.anchor);\n }\n createNode(value, replacer, options) {\n let _replacer = undefined;\n if (typeof replacer === 'function') {\n value = replacer.call({ '': value }, '', value);\n _replacer = replacer;\n }\n else if (Array.isArray(replacer)) {\n const keyToStr = (v) => typeof v === 'number' || v instanceof String || v instanceof Number;\n const asStr = replacer.filter(keyToStr).map(String);\n if (asStr.length > 0)\n replacer = replacer.concat(asStr);\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};\n const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this, \n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n anchorPrefix || 'a');\n const ctx = {\n aliasDuplicateObjects: aliasDuplicateObjects ?? true,\n keepUndefined: keepUndefined ?? false,\n onAnchor,\n onTagObj,\n replacer: _replacer,\n schema: this.schema,\n sourceObjects\n };\n const node = createNode.createNode(value, tag, ctx);\n if (flow && identity.isCollection(node))\n node.flow = true;\n setAnchors();\n return node;\n }\n /**\n * Convert a key and a value into a `Pair` using the current schema,\n * recursively wrapping all values as `Scalar` or `Collection` nodes.\n */\n createPair(key, value, options = {}) {\n const k = this.createNode(key, null, options);\n const v = this.createNode(value, null, options);\n return new Pair.Pair(k, v);\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n return assertCollection(this.contents) ? this.contents.delete(key) : false;\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n if (Collection.isEmptyPath(path)) {\n if (this.contents == null)\n return false;\n // @ts-expect-error Presumed impossible if Strict extends false\n this.contents = null;\n return true;\n }\n return assertCollection(this.contents)\n ? this.contents.deleteIn(path)\n : false;\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n get(key, keepScalar) {\n return identity.isCollection(this.contents)\n ? this.contents.get(key, keepScalar)\n : undefined;\n }\n /**\n * Returns item at `path`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n if (Collection.isEmptyPath(path))\n return !keepScalar && identity.isScalar(this.contents)\n ? this.contents.value\n : this.contents;\n return identity.isCollection(this.contents)\n ? this.contents.getIn(path, keepScalar)\n : undefined;\n }\n /**\n * Checks if the document includes a value with the key `key`.\n */\n has(key) {\n return identity.isCollection(this.contents) ? this.contents.has(key) : false;\n }\n /**\n * Checks if the document includes a value at `path`.\n */\n hasIn(path) {\n if (Collection.isEmptyPath(path))\n return this.contents !== undefined;\n return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n set(key, value) {\n if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, [key], value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.set(key, value);\n }\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n if (Collection.isEmptyPath(path)) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = value;\n }\n else if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.setIn(path, value);\n }\n }\n /**\n * Change the YAML version and schema used by the document.\n * A `null` version disables support for directives, explicit tags, anchors, and aliases.\n * It also requires the `schema` option to be given as a `Schema` instance value.\n *\n * Overrides all previously set schema options.\n */\n setSchema(version, options = {}) {\n if (typeof version === 'number')\n version = String(version);\n let opt;\n switch (version) {\n case '1.1':\n if (this.directives)\n this.directives.yaml.version = '1.1';\n else\n this.directives = new directives.Directives({ version: '1.1' });\n opt = { resolveKnownTags: false, schema: 'yaml-1.1' };\n break;\n case '1.2':\n case 'next':\n if (this.directives)\n this.directives.yaml.version = version;\n else\n this.directives = new directives.Directives({ version });\n opt = { resolveKnownTags: true, schema: 'core' };\n break;\n case null:\n if (this.directives)\n delete this.directives;\n opt = null;\n break;\n default: {\n const sv = JSON.stringify(version);\n throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);\n }\n }\n // Not using `instanceof Schema` to allow for duck typing\n if (options.schema instanceof Object)\n this.schema = options.schema;\n else if (opt)\n this.schema = new Schema.Schema(Object.assign(opt, options));\n else\n throw new Error(`With a null YAML version, the { schema: Schema } option is required`);\n }\n // json & jsonArg are only used from toJSON()\n toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n const ctx = {\n anchors: new Map(),\n doc: this,\n keep: !json,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this.contents, jsonArg ?? '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n /**\n * A JSON representation of the document `contents`.\n *\n * @param jsonArg Used by `JSON.stringify` to indicate the array index or\n * property name.\n */\n toJSON(jsonArg, onAnchor) {\n return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });\n }\n /** A YAML representation of the document. */\n toString(options = {}) {\n if (this.errors.length > 0)\n throw new Error('Document with errors cannot be stringified');\n if ('indent' in options &&\n (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {\n const s = JSON.stringify(options.indent);\n throw new Error(`\"indent\" option must be a positive integer, not ${s}`);\n }\n return stringifyDocument.stringifyDocument(this, options);\n }\n}\nfunction assertCollection(contents) {\n if (identity.isCollection(contents))\n return true;\n throw new Error('Expected a YAML collection as document contents');\n}\n\nexports.Document = Document;\n","'use strict';\n\nclass YAMLError extends Error {\n constructor(name, pos, code, message) {\n super();\n this.name = name;\n this.code = code;\n this.message = message;\n this.pos = pos;\n }\n}\nclass YAMLParseError extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLParseError', pos, code, message);\n }\n}\nclass YAMLWarning extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLWarning', pos, code, message);\n }\n}\nconst prettifyError = (src, lc) => (error) => {\n if (error.pos[0] === -1)\n return;\n error.linePos = error.pos.map(pos => lc.linePos(pos));\n const { line, col } = error.linePos[0];\n error.message += ` at line ${line}, column ${col}`;\n let ci = col - 1;\n let lineStr = src\n .substring(lc.lineStarts[line - 1], lc.lineStarts[line])\n .replace(/[\\n\\r]+$/, '');\n // Trim to max 80 chars, keeping col position near the middle\n if (ci >= 60 && lineStr.length > 80) {\n const trimStart = Math.min(ci - 39, lineStr.length - 79);\n lineStr = '…' + lineStr.substring(trimStart);\n ci -= trimStart - 1;\n }\n if (lineStr.length > 80)\n lineStr = lineStr.substring(0, 79) + '…';\n // Include previous line in context if pointing at line start\n if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {\n // Regexp won't match if start is trimmed\n let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);\n if (prev.length > 80)\n prev = prev.substring(0, 79) + '…\\n';\n lineStr = prev + lineStr;\n }\n if (/[^ ]/.test(lineStr)) {\n let count = 1;\n const end = error.linePos[1];\n if (end?.line === line && end.col > col) {\n count = Math.max(1, Math.min(end.col - col, 80 - ci));\n }\n const pointer = ' '.repeat(ci) + '^'.repeat(count);\n error.message += `:\\n\\n${lineStr}\\n${pointer}\\n`;\n }\n};\n\nexports.YAMLError = YAMLError;\nexports.YAMLParseError = YAMLParseError;\nexports.YAMLWarning = YAMLWarning;\nexports.prettifyError = prettifyError;\n","'use strict';\n\nfunction resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {\n let spaceBefore = false;\n let atNewline = startOnNewline;\n let hasSpace = startOnNewline;\n let comment = '';\n let commentSep = '';\n let hasNewline = false;\n let reqSpace = false;\n let tab = null;\n let anchor = null;\n let tag = null;\n let newlineAfterProp = null;\n let comma = null;\n let found = null;\n let start = null;\n for (const token of tokens) {\n if (reqSpace) {\n if (token.type !== 'space' &&\n token.type !== 'newline' &&\n token.type !== 'comma')\n onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n reqSpace = false;\n }\n if (tab) {\n if (atNewline && token.type !== 'comment' && token.type !== 'newline') {\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n }\n tab = null;\n }\n switch (token.type) {\n case 'space':\n // At the doc level, tabs at line start may be parsed\n // as leading white space rather than indentation.\n // In a flow collection, only the parser handles indent.\n if (!flow &&\n (indicator !== 'doc-start' || next?.type !== 'flow-collection') &&\n token.source.includes('\\t')) {\n tab = token;\n }\n hasSpace = true;\n break;\n case 'comment': {\n if (!hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = token.source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += commentSep + cb;\n commentSep = '';\n atNewline = false;\n break;\n }\n case 'newline':\n if (atNewline) {\n if (comment)\n comment += token.source;\n else if (!found || indicator !== 'seq-item-ind')\n spaceBefore = true;\n }\n else\n commentSep += token.source;\n atNewline = true;\n hasNewline = true;\n if (anchor || tag)\n newlineAfterProp = token;\n hasSpace = true;\n break;\n case 'anchor':\n if (anchor)\n onError(token, 'MULTIPLE_ANCHORS', 'A node can have at most one anchor');\n if (token.source.endsWith(':'))\n onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);\n anchor = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n case 'tag': {\n if (tag)\n onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');\n tag = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n }\n case indicator:\n // Could here handle preceding comments differently\n if (anchor || tag)\n onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`);\n if (found)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);\n found = token;\n atNewline =\n indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';\n hasSpace = false;\n break;\n case 'comma':\n if (flow) {\n if (comma)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected , in ${flow}`);\n comma = token;\n atNewline = false;\n hasSpace = false;\n break;\n }\n // else fallthrough\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.type} token`);\n atNewline = false;\n hasSpace = false;\n }\n }\n const last = tokens[tokens.length - 1];\n const end = last ? last.offset + last.source.length : offset;\n if (reqSpace &&\n next &&\n next.type !== 'space' &&\n next.type !== 'newline' &&\n next.type !== 'comma' &&\n (next.type !== 'scalar' || next.source !== '')) {\n onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n }\n if (tab &&\n ((atNewline && tab.indent <= parentIndent) ||\n next?.type === 'block-map' ||\n next?.type === 'block-seq'))\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n return {\n comma,\n found,\n spaceBefore,\n comment,\n hasNewline,\n anchor,\n tag,\n newlineAfterProp,\n end,\n start: start ?? end\n };\n}\n\nexports.resolveProps = resolveProps;\n","'use strict';\n\nfunction containsNewline(key) {\n if (!key)\n return null;\n switch (key.type) {\n case 'alias':\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n if (key.source.includes('\\n'))\n return true;\n if (key.end)\n for (const st of key.end)\n if (st.type === 'newline')\n return true;\n return false;\n case 'flow-collection':\n for (const it of key.items) {\n for (const st of it.start)\n if (st.type === 'newline')\n return true;\n if (it.sep)\n for (const st of it.sep)\n if (st.type === 'newline')\n return true;\n if (containsNewline(it.key) || containsNewline(it.value))\n return true;\n }\n return false;\n default:\n return true;\n }\n}\n\nexports.containsNewline = containsNewline;\n","'use strict';\n\nvar utilContainsNewline = require('./util-contains-newline.js');\n\nfunction flowIndentCheck(indent, fc, onError) {\n if (fc?.type === 'flow-collection') {\n const end = fc.end[0];\n if (end.indent === indent &&\n (end.source === ']' || end.source === '}') &&\n utilContainsNewline.containsNewline(fc)) {\n const msg = 'Flow end indicator should be more indented than parent';\n onError(end, 'BAD_INDENT', msg, true);\n }\n }\n}\n\nexports.flowIndentCheck = flowIndentCheck;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\n\nfunction mapIncludes(ctx, items, search) {\n const { uniqueKeys } = ctx.options;\n if (uniqueKeys === false)\n return false;\n const isEqual = typeof uniqueKeys === 'function'\n ? uniqueKeys\n : (a, b) => a === b || (identity.isScalar(a) && identity.isScalar(b) && a.value === b.value);\n return items.some(pair => isEqual(pair.key, search));\n}\n\nexports.mapIncludes = mapIncludes;\n","'use strict';\n\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst startColMsg = 'All mapping items must start at the same column';\nfunction resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLMap.YAMLMap;\n const map = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n let offset = bm.offset;\n let commentEnd = null;\n for (const collItem of bm.items) {\n const { start, key, sep, value } = collItem;\n // key properties\n const keyProps = resolveProps.resolveProps(start, {\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: bm.indent,\n startOnNewline: true\n });\n const implicitKey = !keyProps.found;\n if (implicitKey) {\n if (key) {\n if (key.type === 'block-seq')\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'A block sequence may not be used as an implicit map key');\n else if ('indent' in key && key.indent !== bm.indent)\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n if (!keyProps.anchor && !keyProps.tag && !sep) {\n commentEnd = keyProps.end;\n if (keyProps.comment) {\n if (map.comment)\n map.comment += '\\n' + keyProps.comment;\n else\n map.comment = keyProps.comment;\n }\n continue;\n }\n if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {\n onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');\n }\n }\n else if (keyProps.found?.indent !== bm.indent) {\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n // key value\n ctx.atKey = true;\n const keyStart = keyProps.end;\n const keyNode = key\n ? composeNode(ctx, key, keyProps, onError)\n : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);\n ctx.atKey = false;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: bm.indent,\n startOnNewline: !key || key.type === 'block-scalar'\n });\n offset = valueProps.end;\n if (valueProps.found) {\n if (implicitKey) {\n if (value?.type === 'block-map' && !valueProps.hasNewline)\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');\n if (ctx.options.strict &&\n keyProps.start < valueProps.found.offset - 1024)\n onError(keyNode.range, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit block mapping key');\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : composeEmptyNode(ctx, offset, sep, null, valueProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);\n offset = valueNode.range[2];\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n else {\n // key with no value\n if (implicitKey)\n onError(keyNode.range, 'MISSING_CHAR', 'Implicit map keys need to be followed by map values');\n if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n }\n if (commentEnd && commentEnd < offset)\n onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');\n map.range = [bm.offset, offset, commentEnd ?? offset];\n return map;\n}\n\nexports.resolveBlockMap = resolveBlockMap;\n","'use strict';\n\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\n\nfunction resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLSeq.YAMLSeq;\n const seq = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = bs.offset;\n let commentEnd = null;\n for (const { start, value } of bs.items) {\n const props = resolveProps.resolveProps(start, {\n indicator: 'seq-item-ind',\n next: value,\n offset,\n onError,\n parentIndent: bs.indent,\n startOnNewline: true\n });\n if (!props.found) {\n if (props.anchor || props.tag || value) {\n if (value?.type === 'block-seq')\n onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');\n else\n onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');\n }\n else {\n commentEnd = props.end;\n if (props.comment)\n seq.comment = props.comment;\n continue;\n }\n }\n const node = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, start, null, props, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);\n offset = node.range[2];\n seq.items.push(node);\n }\n seq.range = [bs.offset, offset, commentEnd ?? offset];\n return seq;\n}\n\nexports.resolveBlockSeq = resolveBlockSeq;\n","'use strict';\n\nfunction resolveEnd(end, offset, reqSpace, onError) {\n let comment = '';\n if (end) {\n let hasSpace = false;\n let sep = '';\n for (const token of end) {\n const { source, type } = token;\n switch (type) {\n case 'space':\n hasSpace = true;\n break;\n case 'comment': {\n if (reqSpace && !hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += sep + cb;\n sep = '';\n break;\n }\n case 'newline':\n if (comment)\n sep += source;\n hasSpace = true;\n break;\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${type} at node end`);\n }\n offset += source.length;\n }\n }\n return { comment, offset };\n}\n\nexports.resolveEnd = resolveEnd;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst blockMsg = 'Block collections are not allowed within flow collections';\nconst isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');\nfunction resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {\n const isMap = fc.start.source === '{';\n const fcName = isMap ? 'flow map' : 'flow sequence';\n const NodeClass = (tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq));\n const coll = new NodeClass(ctx.schema);\n coll.flow = true;\n const atRoot = ctx.atRoot;\n if (atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = fc.offset + fc.start.source.length;\n for (let i = 0; i < fc.items.length; ++i) {\n const collItem = fc.items[i];\n const { start, key, sep, value } = collItem;\n const props = resolveProps.resolveProps(start, {\n flow: fcName,\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (!props.found) {\n if (!props.anchor && !props.tag && !sep && !value) {\n if (i === 0 && props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n else if (i < fc.items.length - 1)\n onError(props.start, 'UNEXPECTED_TOKEN', `Unexpected empty item in ${fcName}`);\n if (props.comment) {\n if (coll.comment)\n coll.comment += '\\n' + props.comment;\n else\n coll.comment = props.comment;\n }\n offset = props.end;\n continue;\n }\n if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key))\n onError(key, // checked by containsNewline()\n 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n }\n if (i === 0) {\n if (props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n }\n else {\n if (!props.comma)\n onError(props.start, 'MISSING_CHAR', `Missing , between ${fcName} items`);\n if (props.comment) {\n let prevItemComment = '';\n loop: for (const st of start) {\n switch (st.type) {\n case 'comma':\n case 'space':\n break;\n case 'comment':\n prevItemComment = st.source.substring(1);\n break loop;\n default:\n break loop;\n }\n }\n if (prevItemComment) {\n let prev = coll.items[coll.items.length - 1];\n if (identity.isPair(prev))\n prev = prev.value ?? prev.key;\n if (prev.comment)\n prev.comment += '\\n' + prevItemComment;\n else\n prev.comment = prevItemComment;\n props.comment = props.comment.substring(prevItemComment.length + 1);\n }\n }\n }\n if (!isMap && !sep && !props.found) {\n // item is a value in a seq\n // → key & sep are empty, start does not include ? or :\n const valueNode = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, sep, null, props, onError);\n coll.items.push(valueNode);\n offset = valueNode.range[2];\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else {\n // item is a key+value pair\n // key value\n ctx.atKey = true;\n const keyStart = props.end;\n const keyNode = key\n ? composeNode(ctx, key, props, onError)\n : composeEmptyNode(ctx, keyStart, start, null, props, onError);\n if (isBlock(key))\n onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);\n ctx.atKey = false;\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n flow: fcName,\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (valueProps.found) {\n if (!isMap && !props.found && ctx.options.strict) {\n if (sep)\n for (const st of sep) {\n if (st === valueProps.found)\n break;\n if (st.type === 'newline') {\n onError(st, 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n break;\n }\n }\n if (props.start < valueProps.found.offset - 1024)\n onError(valueProps.found, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit flow sequence key');\n }\n }\n else if (value) {\n if ('source' in value && value.source?.[0] === ':')\n onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);\n else\n onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : valueProps.found\n ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError)\n : null;\n if (valueNode) {\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n if (isMap) {\n const map = coll;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n map.items.push(pair);\n }\n else {\n const map = new YAMLMap.YAMLMap(ctx.schema);\n map.flow = true;\n map.items.push(pair);\n const endRange = (valueNode ?? keyNode).range;\n map.range = [keyNode.range[0], endRange[1], endRange[2]];\n coll.items.push(map);\n }\n offset = valueNode ? valueNode.range[2] : valueProps.end;\n }\n }\n const expectedEnd = isMap ? '}' : ']';\n const [ce, ...ee] = fc.end;\n let cePos = offset;\n if (ce?.source === expectedEnd)\n cePos = ce.offset + ce.source.length;\n else {\n const name = fcName[0].toUpperCase() + fcName.substring(1);\n const msg = atRoot\n ? `${name} must end with a ${expectedEnd}`\n : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`;\n onError(offset, atRoot ? 'MISSING_CHAR' : 'BAD_INDENT', msg);\n if (ce && ce.source.length !== 1)\n ee.unshift(ce);\n }\n if (ee.length > 0) {\n const end = resolveEnd.resolveEnd(ee, cePos, ctx.options.strict, onError);\n if (end.comment) {\n if (coll.comment)\n coll.comment += '\\n' + end.comment;\n else\n coll.comment = end.comment;\n }\n coll.range = [fc.offset, cePos, end.offset];\n }\n else {\n coll.range = [fc.offset, cePos, cePos];\n }\n return coll;\n}\n\nexports.resolveFlowCollection = resolveFlowCollection;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveBlockMap = require('./resolve-block-map.js');\nvar resolveBlockSeq = require('./resolve-block-seq.js');\nvar resolveFlowCollection = require('./resolve-flow-collection.js');\n\nfunction resolveCollection(CN, ctx, token, onError, tagName, tag) {\n const coll = token.type === 'block-map'\n ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag)\n : token.type === 'block-seq'\n ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag)\n : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag);\n const Coll = coll.constructor;\n // If we got a tagName matching the class, or the tag name is '!',\n // then use the tagName from the node class used to create it.\n if (tagName === '!' || tagName === Coll.tagName) {\n coll.tag = Coll.tagName;\n return coll;\n }\n if (tagName)\n coll.tag = tagName;\n return coll;\n}\nfunction composeCollection(CN, ctx, token, props, onError) {\n const tagToken = props.tag;\n const tagName = !tagToken\n ? null\n : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));\n if (token.type === 'block-seq') {\n const { anchor, newlineAfterProp: nl } = props;\n const lastProp = anchor && tagToken\n ? anchor.offset > tagToken.offset\n ? anchor\n : tagToken\n : (anchor ?? tagToken);\n if (lastProp && (!nl || nl.offset < lastProp.offset)) {\n const message = 'Missing newline after block sequence props';\n onError(lastProp, 'MISSING_CHAR', message);\n }\n }\n const expType = token.type === 'block-map'\n ? 'map'\n : token.type === 'block-seq'\n ? 'seq'\n : token.start.source === '{'\n ? 'map'\n : 'seq';\n // shortcut: check if it's a generic YAMLMap or YAMLSeq\n // before jumping into the custom tag logic.\n if (!tagToken ||\n !tagName ||\n tagName === '!' ||\n (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||\n (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);\n if (!tag) {\n const kt = ctx.schema.knownTags[tagName];\n if (kt?.collection === expType) {\n ctx.schema.tags.push(Object.assign({}, kt, { default: false }));\n tag = kt;\n }\n else {\n if (kt) {\n onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);\n }\n else {\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);\n }\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n }\n const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);\n const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;\n const node = identity.isNode(res)\n ? res\n : new Scalar.Scalar(res);\n node.range = coll.range;\n node.tag = tagName;\n if (tag?.format)\n node.format = tag.format;\n return node;\n}\n\nexports.composeCollection = composeCollection;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\n\nfunction resolveBlockScalar(ctx, scalar, onError) {\n const start = scalar.offset;\n const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);\n if (!header)\n return { value: '', type: null, comment: '', range: [start, start, start] };\n const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;\n const lines = scalar.source ? splitLines(scalar.source) : [];\n // determine the end of content & start of chomping\n let chompStart = lines.length;\n for (let i = lines.length - 1; i >= 0; --i) {\n const content = lines[i][1];\n if (content === '' || content === '\\r')\n chompStart = i;\n else\n break;\n }\n // shortcut for empty contents\n if (chompStart === 0) {\n const value = header.chomp === '+' && lines.length > 0\n ? '\\n'.repeat(Math.max(1, lines.length - 1))\n : '';\n let end = start + header.length;\n if (scalar.source)\n end += scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n }\n // find the indentation level to trim from start\n let trimIndent = scalar.indent + header.indent;\n let offset = scalar.offset + header.length;\n let contentStart = 0;\n for (let i = 0; i < chompStart; ++i) {\n const [indent, content] = lines[i];\n if (content === '' || content === '\\r') {\n if (header.indent === 0 && indent.length > trimIndent)\n trimIndent = indent.length;\n }\n else {\n if (indent.length < trimIndent) {\n const message = 'Block scalars with more-indented leading empty lines must use an explicit indentation indicator';\n onError(offset + indent.length, 'MISSING_CHAR', message);\n }\n if (header.indent === 0)\n trimIndent = indent.length;\n contentStart = i;\n if (trimIndent === 0 && !ctx.atRoot) {\n const message = 'Block scalar values in collections must be indented';\n onError(offset, 'BAD_INDENT', message);\n }\n break;\n }\n offset += indent.length + content.length + 1;\n }\n // include trailing more-indented empty lines in content\n for (let i = lines.length - 1; i >= chompStart; --i) {\n if (lines[i][0].length > trimIndent)\n chompStart = i + 1;\n }\n let value = '';\n let sep = '';\n let prevMoreIndented = false;\n // leading whitespace is kept intact\n for (let i = 0; i < contentStart; ++i)\n value += lines[i][0].slice(trimIndent) + '\\n';\n for (let i = contentStart; i < chompStart; ++i) {\n let [indent, content] = lines[i];\n offset += indent.length + content.length + 1;\n const crlf = content[content.length - 1] === '\\r';\n if (crlf)\n content = content.slice(0, -1);\n /* istanbul ignore if already caught in lexer */\n if (content && indent.length < trimIndent) {\n const src = header.indent\n ? 'explicit indentation indicator'\n : 'first line';\n const message = `Block scalar lines must not be less indented than their ${src}`;\n onError(offset - content.length - (crlf ? 2 : 1), 'BAD_INDENT', message);\n indent = '';\n }\n if (type === Scalar.Scalar.BLOCK_LITERAL) {\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n }\n else if (indent.length > trimIndent || content[0] === '\\t') {\n // more-indented content within a folded block\n if (sep === ' ')\n sep = '\\n';\n else if (!prevMoreIndented && sep === '\\n')\n sep = '\\n\\n';\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n prevMoreIndented = true;\n }\n else if (content === '') {\n // empty line\n if (sep === '\\n')\n value += '\\n';\n else\n sep = '\\n';\n }\n else {\n value += sep + content;\n sep = ' ';\n prevMoreIndented = false;\n }\n }\n switch (header.chomp) {\n case '-':\n break;\n case '+':\n for (let i = chompStart; i < lines.length; ++i)\n value += '\\n' + lines[i][0].slice(trimIndent);\n if (value[value.length - 1] !== '\\n')\n value += '\\n';\n break;\n default:\n value += '\\n';\n }\n const end = start + header.length + scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n}\nfunction parseBlockScalarHeader({ offset, props }, strict, onError) {\n /* istanbul ignore if should not happen */\n if (props[0].type !== 'block-scalar-header') {\n onError(props[0], 'IMPOSSIBLE', 'Block scalar header not found');\n return null;\n }\n const { source } = props[0];\n const mode = source[0];\n let indent = 0;\n let chomp = '';\n let error = -1;\n for (let i = 1; i < source.length; ++i) {\n const ch = source[i];\n if (!chomp && (ch === '-' || ch === '+'))\n chomp = ch;\n else {\n const n = Number(ch);\n if (!indent && n)\n indent = n;\n else if (error === -1)\n error = offset + i;\n }\n }\n if (error !== -1)\n onError(error, 'UNEXPECTED_TOKEN', `Block scalar header includes extra characters: ${source}`);\n let hasSpace = false;\n let comment = '';\n let length = source.length;\n for (let i = 1; i < props.length; ++i) {\n const token = props[i];\n switch (token.type) {\n case 'space':\n hasSpace = true;\n // fallthrough\n case 'newline':\n length += token.source.length;\n break;\n case 'comment':\n if (strict && !hasSpace) {\n const message = 'Comments must be separated from other tokens by white space characters';\n onError(token, 'MISSING_CHAR', message);\n }\n length += token.source.length;\n comment = token.source.substring(1);\n break;\n case 'error':\n onError(token, 'UNEXPECTED_TOKEN', token.message);\n length += token.source.length;\n break;\n /* istanbul ignore next should not happen */\n default: {\n const message = `Unexpected token in block scalar header: ${token.type}`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n const ts = token.source;\n if (ts && typeof ts === 'string')\n length += ts.length;\n }\n }\n }\n return { mode, indent, chomp, comment, length };\n}\n/** @returns Array of lines split up as `[indent, content]` */\nfunction splitLines(source) {\n const split = source.split(/\\n( *)/);\n const first = split[0];\n const m = first.match(/^( *)/);\n const line0 = m?.[1]\n ? [m[1], first.slice(m[1].length)]\n : ['', first];\n const lines = [line0];\n for (let i = 1; i < split.length; i += 2)\n lines.push([split[i], split[i + 1]]);\n return lines;\n}\n\nexports.resolveBlockScalar = resolveBlockScalar;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction resolveFlowScalar(scalar, strict, onError) {\n const { offset, type, source, end } = scalar;\n let _type;\n let value;\n const _onError = (rel, code, msg) => onError(offset + rel, code, msg);\n switch (type) {\n case 'scalar':\n _type = Scalar.Scalar.PLAIN;\n value = plainValue(source, _onError);\n break;\n case 'single-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_SINGLE;\n value = singleQuotedValue(source, _onError);\n break;\n case 'double-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_DOUBLE;\n value = doubleQuotedValue(source, _onError);\n break;\n /* istanbul ignore next should not happen */\n default:\n onError(scalar, 'UNEXPECTED_TOKEN', `Expected a flow scalar value, but found: ${type}`);\n return {\n value: '',\n type: null,\n comment: '',\n range: [offset, offset + source.length, offset + source.length]\n };\n }\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);\n return {\n value,\n type: _type,\n comment: re.comment,\n range: [offset, valueEnd, re.offset]\n };\n}\nfunction plainValue(source, onError) {\n let badChar = '';\n switch (source[0]) {\n /* istanbul ignore next should not happen */\n case '\\t':\n badChar = 'a tab character';\n break;\n case ',':\n badChar = 'flow indicator character ,';\n break;\n case '%':\n badChar = 'directive indicator character %';\n break;\n case '|':\n case '>': {\n badChar = `block scalar indicator ${source[0]}`;\n break;\n }\n case '@':\n case '`': {\n badChar = `reserved character ${source[0]}`;\n break;\n }\n }\n if (badChar)\n onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);\n return foldLines(source);\n}\nfunction singleQuotedValue(source, onError) {\n if (source[source.length - 1] !== \"'\" || source.length === 1)\n onError(source.length, 'MISSING_CHAR', \"Missing closing 'quote\");\n return foldLines(source.slice(1, -1)).replace(/''/g, \"'\");\n}\nfunction foldLines(source) {\n /**\n * The negative lookbehind here and in the `re` RegExp is to\n * prevent causing a polynomial search time in certain cases.\n *\n * The try-catch is for Safari, which doesn't support this yet:\n * https://caniuse.com/js-regexp-lookbehind\n */\n let first, line;\n try {\n first = new RegExp('(.*?)(?<![ \\t])[ \\t]*\\r?\\n', 'sy');\n line = new RegExp('[ \\t]*(.*?)(?:(?<![ \\t])[ \\t]*)?\\r?\\n', 'sy');\n }\n catch {\n first = /(.*?)[ \\t]*\\r?\\n/sy;\n line = /[ \\t]*(.*?)[ \\t]*\\r?\\n/sy;\n }\n let match = first.exec(source);\n if (!match)\n return source;\n let res = match[1];\n let sep = ' ';\n let pos = first.lastIndex;\n line.lastIndex = pos;\n while ((match = line.exec(source))) {\n if (match[1] === '') {\n if (sep === '\\n')\n res += sep;\n else\n sep = '\\n';\n }\n else {\n res += sep + match[1];\n sep = ' ';\n }\n pos = line.lastIndex;\n }\n const last = /[ \\t]*(.*)/sy;\n last.lastIndex = pos;\n match = last.exec(source);\n return res + sep + (match?.[1] ?? '');\n}\nfunction doubleQuotedValue(source, onError) {\n let res = '';\n for (let i = 1; i < source.length - 1; ++i) {\n const ch = source[i];\n if (ch === '\\r' && source[i + 1] === '\\n')\n continue;\n if (ch === '\\n') {\n const { fold, offset } = foldNewline(source, i);\n res += fold;\n i = offset;\n }\n else if (ch === '\\\\') {\n let next = source[++i];\n const cc = escapeCodes[next];\n if (cc)\n res += cc;\n else if (next === '\\n') {\n // skip escaped newlines, but still trim the following line\n next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === '\\r' && source[i + 1] === '\\n') {\n // skip escaped CRLF newlines, but still trim the following line\n next = source[++i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === 'x' || next === 'u' || next === 'U') {\n const length = { x: 2, u: 4, U: 8 }[next];\n res += parseCharCode(source, i + 1, length, onError);\n i += length;\n }\n else {\n const raw = source.substr(i - 1, 2);\n onError(i - 1, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n res += raw;\n }\n }\n else if (ch === ' ' || ch === '\\t') {\n // trim trailing whitespace\n const wsStart = i;\n let next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n if (next !== '\\n' && !(next === '\\r' && source[i + 2] === '\\n'))\n res += i > wsStart ? source.slice(wsStart, i + 1) : ch;\n }\n else {\n res += ch;\n }\n }\n if (source[source.length - 1] !== '\"' || source.length === 1)\n onError(source.length, 'MISSING_CHAR', 'Missing closing \"quote');\n return res;\n}\n/**\n * Fold a single newline into a space, multiple newlines to N - 1 newlines.\n * Presumes `source[offset] === '\\n'`\n */\nfunction foldNewline(source, offset) {\n let fold = '';\n let ch = source[offset + 1];\n while (ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r') {\n if (ch === '\\r' && source[offset + 2] !== '\\n')\n break;\n if (ch === '\\n')\n fold += '\\n';\n offset += 1;\n ch = source[offset + 1];\n }\n if (!fold)\n fold = ' ';\n return { fold, offset };\n}\nconst escapeCodes = {\n '0': '\\0', // null character\n a: '\\x07', // bell character\n b: '\\b', // backspace\n e: '\\x1b', // escape character\n f: '\\f', // form feed\n n: '\\n', // line feed\n r: '\\r', // carriage return\n t: '\\t', // horizontal tab\n v: '\\v', // vertical tab\n N: '\\u0085', // Unicode next line\n _: '\\u00a0', // Unicode non-breaking space\n L: '\\u2028', // Unicode line separator\n P: '\\u2029', // Unicode paragraph separator\n ' ': ' ',\n '\"': '\"',\n '/': '/',\n '\\\\': '\\\\',\n '\\t': '\\t'\n};\nfunction parseCharCode(source, offset, length, onError) {\n const cc = source.substr(offset, length);\n const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);\n const code = ok ? parseInt(cc, 16) : NaN;\n if (isNaN(code)) {\n const raw = source.substr(offset - 2, length + 2);\n onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n return raw;\n }\n return String.fromCodePoint(code);\n}\n\nexports.resolveFlowScalar = resolveFlowScalar;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveBlockScalar = require('./resolve-block-scalar.js');\nvar resolveFlowScalar = require('./resolve-flow-scalar.js');\n\nfunction composeScalar(ctx, token, tagToken, onError) {\n const { value, type, comment, range } = token.type === 'block-scalar'\n ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)\n : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);\n const tagName = tagToken\n ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))\n : null;\n let tag;\n if (ctx.options.stringKeys && ctx.atKey) {\n tag = ctx.schema[identity.SCALAR];\n }\n else if (tagName)\n tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);\n else if (token.type === 'scalar')\n tag = findScalarTagByTest(ctx, value, token, onError);\n else\n tag = ctx.schema[identity.SCALAR];\n let scalar;\n try {\n const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);\n scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);\n }\n catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);\n scalar = new Scalar.Scalar(value);\n }\n scalar.range = range;\n scalar.source = value;\n if (type)\n scalar.type = type;\n if (tagName)\n scalar.tag = tagName;\n if (tag.format)\n scalar.format = tag.format;\n if (comment)\n scalar.comment = comment;\n return scalar;\n}\nfunction findScalarTagByName(schema, value, tagName, tagToken, onError) {\n if (tagName === '!')\n return schema[identity.SCALAR]; // non-specific tag\n const matchWithTest = [];\n for (const tag of schema.tags) {\n if (!tag.collection && tag.tag === tagName) {\n if (tag.default && tag.test)\n matchWithTest.push(tag);\n else\n return tag;\n }\n }\n for (const tag of matchWithTest)\n if (tag.test?.test(value))\n return tag;\n const kt = schema.knownTags[tagName];\n if (kt && !kt.collection) {\n // Ensure that the known tag is available for stringifying,\n // but does not get used by default.\n schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));\n return kt;\n }\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');\n return schema[identity.SCALAR];\n}\nfunction findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {\n const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&\n tag.test?.test(value)) || schema[identity.SCALAR];\n if (schema.compat) {\n const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??\n schema[identity.SCALAR];\n if (tag.tag !== compat.tag) {\n const ts = directives.tagString(tag.tag);\n const cs = directives.tagString(compat.tag);\n const msg = `Value may be parsed as either ${ts} or ${cs}`;\n onError(token, 'TAG_RESOLVE_FAILED', msg, true);\n }\n }\n return tag;\n}\n\nexports.composeScalar = composeScalar;\n","'use strict';\n\nfunction emptyScalarPosition(offset, before, pos) {\n if (before) {\n pos ?? (pos = before.length);\n for (let i = pos - 1; i >= 0; --i) {\n let st = before[i];\n switch (st.type) {\n case 'space':\n case 'comment':\n case 'newline':\n offset -= st.source.length;\n continue;\n }\n // Technically, an empty scalar is immediately after the last non-empty\n // node, but it's more useful to place it after any whitespace.\n st = before[++i];\n while (st?.type === 'space') {\n offset += st.source.length;\n st = before[++i];\n }\n break;\n }\n }\n return offset;\n}\n\nexports.emptyScalarPosition = emptyScalarPosition;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar composeCollection = require('./compose-collection.js');\nvar composeScalar = require('./compose-scalar.js');\nvar resolveEnd = require('./resolve-end.js');\nvar utilEmptyScalarPosition = require('./util-empty-scalar-position.js');\n\nconst CN = { composeNode, composeEmptyNode };\nfunction composeNode(ctx, token, props, onError) {\n const atKey = ctx.atKey;\n const { spaceBefore, comment, anchor, tag } = props;\n let node;\n let isSrcToken = true;\n switch (token.type) {\n case 'alias':\n node = composeAlias(ctx, token, onError);\n if (anchor || tag)\n onError(token, 'ALIAS_PROPS', 'An alias node must not specify any properties');\n break;\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'block-scalar':\n node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n break;\n case 'block-map':\n case 'block-seq':\n case 'flow-collection':\n node = composeCollection.composeCollection(CN, ctx, token, props, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n break;\n default: {\n const message = token.type === 'error'\n ? token.message\n : `Unsupported token (type: ${token.type})`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);\n isSrcToken = false;\n }\n }\n if (anchor && node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n if (atKey &&\n ctx.options.stringKeys &&\n (!identity.isScalar(node) ||\n typeof node.value !== 'string' ||\n (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {\n const msg = 'With stringKeys, all keys must be strings';\n onError(tag ?? token, 'NON_STRING_KEY', msg);\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n if (token.type === 'scalar' && token.source === '')\n node.comment = comment;\n else\n node.commentBefore = comment;\n }\n // @ts-expect-error Type checking misses meaning of isSrcToken\n if (ctx.options.keepSourceTokens && isSrcToken)\n node.srcToken = token;\n return node;\n}\nfunction composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {\n const token = {\n type: 'scalar',\n offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos),\n indent: -1,\n source: ''\n };\n const node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor) {\n node.anchor = anchor.source.substring(1);\n if (node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n node.comment = comment;\n node.range[2] = end;\n }\n return node;\n}\nfunction composeAlias({ options }, { offset, source, end }, onError) {\n const alias = new Alias.Alias(source.substring(1));\n if (alias.source === '')\n onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');\n if (alias.source.endsWith(':'))\n onError(offset + source.length - 1, 'BAD_ALIAS', 'Alias ending in : is ambiguous', true);\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);\n alias.range = [offset, valueEnd, re.offset];\n if (re.comment)\n alias.comment = re.comment;\n return alias;\n}\n\nexports.composeEmptyNode = composeEmptyNode;\nexports.composeNode = composeNode;\n","'use strict';\n\nvar Document = require('../doc/Document.js');\nvar composeNode = require('./compose-node.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\n\nfunction composeDoc(options, directives, { offset, start, value, end }, onError) {\n const opts = Object.assign({ _directives: directives }, options);\n const doc = new Document.Document(undefined, opts);\n const ctx = {\n atKey: false,\n atRoot: true,\n directives: doc.directives,\n options: doc.options,\n schema: doc.schema\n };\n const props = resolveProps.resolveProps(start, {\n indicator: 'doc-start',\n next: value ?? end?.[0],\n offset,\n onError,\n parentIndent: 0,\n startOnNewline: true\n });\n if (props.found) {\n doc.directives.docStart = true;\n if (value &&\n (value.type === 'block-map' || value.type === 'block-seq') &&\n !props.hasNewline)\n onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');\n }\n // @ts-expect-error If Contents is set, let's trust the user\n doc.contents = value\n ? composeNode.composeNode(ctx, value, props, onError)\n : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);\n const contentEnd = doc.contents.range[2];\n const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);\n if (re.comment)\n doc.comment = re.comment;\n doc.range = [offset, contentEnd, re.offset];\n return doc;\n}\n\nexports.composeDoc = composeDoc;\n","'use strict';\n\nvar node_process = require('process');\nvar directives = require('../doc/directives.js');\nvar Document = require('../doc/Document.js');\nvar errors = require('../errors.js');\nvar identity = require('../nodes/identity.js');\nvar composeDoc = require('./compose-doc.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction getErrorPos(src) {\n if (typeof src === 'number')\n return [src, src + 1];\n if (Array.isArray(src))\n return src.length === 2 ? src : [src[0], src[1]];\n const { offset, source } = src;\n return [offset, offset + (typeof source === 'string' ? source.length : 1)];\n}\nfunction parsePrelude(prelude) {\n let comment = '';\n let atComment = false;\n let afterEmptyLine = false;\n for (let i = 0; i < prelude.length; ++i) {\n const source = prelude[i];\n switch (source[0]) {\n case '#':\n comment +=\n (comment === '' ? '' : afterEmptyLine ? '\\n\\n' : '\\n') +\n (source.substring(1) || ' ');\n atComment = true;\n afterEmptyLine = false;\n break;\n case '%':\n if (prelude[i + 1]?.[0] !== '#')\n i += 1;\n atComment = false;\n break;\n default:\n // This may be wrong after doc-end, but in that case it doesn't matter\n if (!atComment)\n afterEmptyLine = true;\n atComment = false;\n }\n }\n return { comment, afterEmptyLine };\n}\n/**\n * Compose a stream of CST nodes into a stream of YAML Documents.\n *\n * ```ts\n * import { Composer, Parser } from 'yaml'\n *\n * const src: string = ...\n * const tokens = new Parser().parse(src)\n * const docs = new Composer().compose(tokens)\n * ```\n */\nclass Composer {\n constructor(options = {}) {\n this.doc = null;\n this.atDirectives = false;\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n this.onError = (source, code, message, warning) => {\n const pos = getErrorPos(source);\n if (warning)\n this.warnings.push(new errors.YAMLWarning(pos, code, message));\n else\n this.errors.push(new errors.YAMLParseError(pos, code, message));\n };\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n this.directives = new directives.Directives({ version: options.version || '1.2' });\n this.options = options;\n }\n decorate(doc, afterDoc) {\n const { comment, afterEmptyLine } = parsePrelude(this.prelude);\n //console.log({ dc: doc.comment, prelude, comment })\n if (comment) {\n const dc = doc.contents;\n if (afterDoc) {\n doc.comment = doc.comment ? `${doc.comment}\\n${comment}` : comment;\n }\n else if (afterEmptyLine || doc.directives.docStart || !dc) {\n doc.commentBefore = comment;\n }\n else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {\n let it = dc.items[0];\n if (identity.isPair(it))\n it = it.key;\n const cb = it.commentBefore;\n it.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n else {\n const cb = dc.commentBefore;\n dc.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n }\n if (afterDoc) {\n Array.prototype.push.apply(doc.errors, this.errors);\n Array.prototype.push.apply(doc.warnings, this.warnings);\n }\n else {\n doc.errors = this.errors;\n doc.warnings = this.warnings;\n }\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n }\n /**\n * Current stream status information.\n *\n * Mostly useful at the end of input for an empty stream.\n */\n streamInfo() {\n return {\n comment: parsePrelude(this.prelude).comment,\n directives: this.directives,\n errors: this.errors,\n warnings: this.warnings\n };\n }\n /**\n * Compose tokens into documents.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *compose(tokens, forceDoc = false, endOffset = -1) {\n for (const token of tokens)\n yield* this.next(token);\n yield* this.end(forceDoc, endOffset);\n }\n /** Advance the composer by one CST token. */\n *next(token) {\n if (node_process.env.LOG_STREAM)\n console.dir(token, { depth: null });\n switch (token.type) {\n case 'directive':\n this.directives.add(token.source, (offset, message, warning) => {\n const pos = getErrorPos(token);\n pos[0] += offset;\n this.onError(pos, 'BAD_DIRECTIVE', message, warning);\n });\n this.prelude.push(token.source);\n this.atDirectives = true;\n break;\n case 'document': {\n const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);\n if (this.atDirectives && !doc.directives.docStart)\n this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');\n this.decorate(doc, false);\n if (this.doc)\n yield this.doc;\n this.doc = doc;\n this.atDirectives = false;\n break;\n }\n case 'byte-order-mark':\n case 'space':\n break;\n case 'comment':\n case 'newline':\n this.prelude.push(token.source);\n break;\n case 'error': {\n const msg = token.source\n ? `${token.message}: ${JSON.stringify(token.source)}`\n : token.message;\n const error = new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);\n if (this.atDirectives || !this.doc)\n this.errors.push(error);\n else\n this.doc.errors.push(error);\n break;\n }\n case 'doc-end': {\n if (!this.doc) {\n const msg = 'Unexpected doc-end without preceding document';\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));\n break;\n }\n this.doc.directives.docEnd = true;\n const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);\n this.decorate(this.doc, true);\n if (end.comment) {\n const dc = this.doc.comment;\n this.doc.comment = dc ? `${dc}\\n${end.comment}` : end.comment;\n }\n this.doc.range[2] = end.offset;\n break;\n }\n default:\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));\n }\n }\n /**\n * Call at end of input to yield any remaining document.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *end(forceDoc = false, endOffset = -1) {\n if (this.doc) {\n this.decorate(this.doc, true);\n yield this.doc;\n this.doc = null;\n }\n else if (forceDoc) {\n const opts = Object.assign({ _directives: this.directives }, this.options);\n const doc = new Document.Document(undefined, opts);\n if (this.atDirectives)\n this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');\n doc.range = [0, endOffset, endOffset];\n this.decorate(doc, false);\n yield doc;\n }\n }\n}\n\nexports.Composer = Composer;\n","'use strict';\n\nvar resolveBlockScalar = require('../compose/resolve-block-scalar.js');\nvar resolveFlowScalar = require('../compose/resolve-flow-scalar.js');\nvar errors = require('../errors.js');\nvar stringifyString = require('../stringify/stringifyString.js');\n\nfunction resolveAsScalar(token, strict = true, onError) {\n if (token) {\n const _onError = (pos, code, message) => {\n const offset = typeof pos === 'number' ? pos : Array.isArray(pos) ? pos[0] : pos.offset;\n if (onError)\n onError(offset, code, message);\n else\n throw new errors.YAMLParseError([offset, offset + 1], code, message);\n };\n switch (token.type) {\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);\n case 'block-scalar':\n return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);\n }\n }\n return null;\n}\n/**\n * Create a new scalar token with `value`\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.end Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.indent The indent level of the token.\n * @param context.inFlow Is this scalar within a flow collection? This may affect the resolved type of the token's value.\n * @param context.offset The offset position of the token.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction createScalarToken(value, context) {\n const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey,\n indent: indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n const end = context.end ?? [\n { type: 'newline', offset: -1, indent, source: '\\n' }\n ];\n switch (source[0]) {\n case '|':\n case '>': {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, end))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n return { type: 'block-scalar', offset, indent, props, source: body };\n }\n case '\"':\n return { type: 'double-quoted-scalar', offset, indent, source, end };\n case \"'\":\n return { type: 'single-quoted-scalar', offset, indent, source, end };\n default:\n return { type: 'scalar', offset, indent, source, end };\n }\n}\n/**\n * Set the value of `token` to the given string `value`, overwriting any previous contents and type that it may have.\n *\n * Best efforts are made to retain any comments previously associated with the `token`,\n * though all contents within a collection's `items` will be overwritten.\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param token Any token. If it does not include an `indent` value, the value will be stringified as if it were an implicit key.\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.afterKey In most cases, values after a key should have an additional level of indentation.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.inFlow Being within a flow collection may affect the resolved type of the token's value.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction setScalarValue(token, value, context = {}) {\n let { afterKey = false, implicitKey = false, inFlow = false, type } = context;\n let indent = 'indent' in token ? token.indent : null;\n if (afterKey && typeof indent === 'number')\n indent += 2;\n if (!type)\n switch (token.type) {\n case 'single-quoted-scalar':\n type = 'QUOTE_SINGLE';\n break;\n case 'double-quoted-scalar':\n type = 'QUOTE_DOUBLE';\n break;\n case 'block-scalar': {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n type = header.source[0] === '>' ? 'BLOCK_FOLDED' : 'BLOCK_LITERAL';\n break;\n }\n default:\n type = 'PLAIN';\n }\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey: implicitKey || indent === null,\n indent: indent !== null && indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n switch (source[0]) {\n case '|':\n case '>':\n setBlockScalarValue(token, source);\n break;\n case '\"':\n setFlowScalarValue(token, source, 'double-quoted-scalar');\n break;\n case \"'\":\n setFlowScalarValue(token, source, 'single-quoted-scalar');\n break;\n default:\n setFlowScalarValue(token, source, 'scalar');\n }\n}\nfunction setBlockScalarValue(token, source) {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n if (token.type === 'block-scalar') {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n header.source = head;\n token.source = body;\n }\n else {\n const { offset } = token;\n const indent = 'indent' in token ? token.indent : -1;\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, 'end' in token ? token.end : undefined))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type: 'block-scalar', indent, props, source: body });\n }\n}\n/** @returns `true` if last token is a newline */\nfunction addEndtoBlockProps(props, end) {\n if (end)\n for (const st of end)\n switch (st.type) {\n case 'space':\n case 'comment':\n props.push(st);\n break;\n case 'newline':\n props.push(st);\n return true;\n }\n return false;\n}\nfunction setFlowScalarValue(token, source, type) {\n switch (token.type) {\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n token.type = type;\n token.source = source;\n break;\n case 'block-scalar': {\n const end = token.props.slice(1);\n let oa = source.length;\n if (token.props[0].type === 'block-scalar-header')\n oa -= token.props[0].source.length;\n for (const tok of end)\n tok.offset += oa;\n delete token.props;\n Object.assign(token, { type, source, end });\n break;\n }\n case 'block-map':\n case 'block-seq': {\n const offset = token.offset + source.length;\n const nl = { type: 'newline', offset, indent: token.indent, source: '\\n' };\n delete token.items;\n Object.assign(token, { type, source, end: [nl] });\n break;\n }\n default: {\n const indent = 'indent' in token ? token.indent : -1;\n const end = 'end' in token && Array.isArray(token.end)\n ? token.end.filter(st => st.type === 'space' ||\n st.type === 'comment' ||\n st.type === 'newline')\n : [];\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type, indent, source, end });\n }\n }\n}\n\nexports.createScalarToken = createScalarToken;\nexports.resolveAsScalar = resolveAsScalar;\nexports.setScalarValue = setScalarValue;\n","'use strict';\n\n/**\n * Stringify a CST document, token, or collection item\n *\n * Fair warning: This applies no validation whatsoever, and\n * simply concatenates the sources in their logical order.\n */\nconst stringify = (cst) => 'type' in cst ? stringifyToken(cst) : stringifyItem(cst);\nfunction stringifyToken(token) {\n switch (token.type) {\n case 'block-scalar': {\n let res = '';\n for (const tok of token.props)\n res += stringifyToken(tok);\n return res + token.source;\n }\n case 'block-map':\n case 'block-seq': {\n let res = '';\n for (const item of token.items)\n res += stringifyItem(item);\n return res;\n }\n case 'flow-collection': {\n let res = token.start.source;\n for (const item of token.items)\n res += stringifyItem(item);\n for (const st of token.end)\n res += st.source;\n return res;\n }\n case 'document': {\n let res = stringifyItem(token);\n if (token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n default: {\n let res = token.source;\n if ('end' in token && token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n }\n}\nfunction stringifyItem({ start, key, sep, value }) {\n let res = '';\n for (const st of start)\n res += st.source;\n if (key)\n res += stringifyToken(key);\n if (sep)\n for (const st of sep)\n res += st.source;\n if (value)\n res += stringifyToken(value);\n return res;\n}\n\nexports.stringify = stringify;\n","'use strict';\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove item');\n/**\n * Apply a visitor to a CST document or item.\n *\n * Walks through the tree (depth-first) starting from the root, calling a\n * `visitor` function with two arguments when entering each item:\n * - `item`: The current item, which included the following members:\n * - `start: SourceToken[]` – Source tokens before the key or value,\n * possibly including its anchor or tag.\n * - `key?: Token | null` – Set for pair values. May then be `null`, if\n * the key before the `:` separator is empty.\n * - `sep?: SourceToken[]` – Source tokens between the key and the value,\n * which should include the `:` map value indicator if `value` is set.\n * - `value?: Token` – The value of a sequence item, or of a map pair.\n * - `path`: The steps from the root to the current node, as an array of\n * `['key' | 'value', number]` tuples.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this token, continue with\n * next sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current item, then continue with the next one\n * - `number`: Set the index of the next step. This is useful especially if\n * the index of the current token has changed.\n * - `function`: Define the next visitor for this item. After the original\n * visitor is called on item entry, next visitors are called after handling\n * a non-empty `key` and when exiting the item.\n */\nfunction visit(cst, visitor) {\n if ('type' in cst && cst.type === 'document')\n cst = { start: cst.start, value: cst.value };\n _visit(Object.freeze([]), cst, visitor);\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current item */\nvisit.SKIP = SKIP;\n/** Remove the current item */\nvisit.REMOVE = REMOVE;\n/** Find the item at `path` from `cst` as the root */\nvisit.itemAtPath = (cst, path) => {\n let item = cst;\n for (const [field, index] of path) {\n const tok = item?.[field];\n if (tok && 'items' in tok) {\n item = tok.items[index];\n }\n else\n return undefined;\n }\n return item;\n};\n/**\n * Get the immediate parent collection of the item at `path` from `cst` as the root.\n *\n * Throws an error if the collection is not found, which should never happen if the item itself exists.\n */\nvisit.parentCollection = (cst, path) => {\n const parent = visit.itemAtPath(cst, path.slice(0, -1));\n const field = path[path.length - 1][0];\n const coll = parent?.[field];\n if (coll && 'items' in coll)\n return coll;\n throw new Error('Parent collection not found');\n};\nfunction _visit(path, item, visitor) {\n let ctrl = visitor(item, path);\n if (typeof ctrl === 'symbol')\n return ctrl;\n for (const field of ['key', 'value']) {\n const token = item[field];\n if (token && 'items' in token) {\n for (let i = 0; i < token.items.length; ++i) {\n const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n token.items.splice(i, 1);\n i -= 1;\n }\n }\n if (typeof ctrl === 'function' && field === 'key')\n ctrl = ctrl(item, path);\n }\n }\n return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;\n}\n\nexports.visit = visit;\n","'use strict';\n\nvar cstScalar = require('./cst-scalar.js');\nvar cstStringify = require('./cst-stringify.js');\nvar cstVisit = require('./cst-visit.js');\n\n/** The byte order mark */\nconst BOM = '\\u{FEFF}';\n/** Start of doc-mode */\nconst DOCUMENT = '\\x02'; // C0: Start of Text\n/** Unexpected end of flow-mode */\nconst FLOW_END = '\\x18'; // C0: Cancel\n/** Next token is a scalar value */\nconst SCALAR = '\\x1f'; // C0: Unit Separator\n/** @returns `true` if `token` is a flow or block collection */\nconst isCollection = (token) => !!token && 'items' in token;\n/** @returns `true` if `token` is a flow or block scalar; not an alias */\nconst isScalar = (token) => !!token &&\n (token.type === 'scalar' ||\n token.type === 'single-quoted-scalar' ||\n token.type === 'double-quoted-scalar' ||\n token.type === 'block-scalar');\n/* istanbul ignore next */\n/** Get a printable representation of a lexer token */\nfunction prettyToken(token) {\n switch (token) {\n case BOM:\n return '<BOM>';\n case DOCUMENT:\n return '<DOC>';\n case FLOW_END:\n return '<FLOW_END>';\n case SCALAR:\n return '<SCALAR>';\n default:\n return JSON.stringify(token);\n }\n}\n/** Identify the type of a lexer token. May return `null` for unknown tokens. */\nfunction tokenType(source) {\n switch (source) {\n case BOM:\n return 'byte-order-mark';\n case DOCUMENT:\n return 'doc-mode';\n case FLOW_END:\n return 'flow-error-end';\n case SCALAR:\n return 'scalar';\n case '---':\n return 'doc-start';\n case '...':\n return 'doc-end';\n case '':\n case '\\n':\n case '\\r\\n':\n return 'newline';\n case '-':\n return 'seq-item-ind';\n case '?':\n return 'explicit-key-ind';\n case ':':\n return 'map-value-ind';\n case '{':\n return 'flow-map-start';\n case '}':\n return 'flow-map-end';\n case '[':\n return 'flow-seq-start';\n case ']':\n return 'flow-seq-end';\n case ',':\n return 'comma';\n }\n switch (source[0]) {\n case ' ':\n case '\\t':\n return 'space';\n case '#':\n return 'comment';\n case '%':\n return 'directive-line';\n case '*':\n return 'alias';\n case '&':\n return 'anchor';\n case '!':\n return 'tag';\n case \"'\":\n return 'single-quoted-scalar';\n case '\"':\n return 'double-quoted-scalar';\n case '|':\n case '>':\n return 'block-scalar-header';\n }\n return null;\n}\n\nexports.createScalarToken = cstScalar.createScalarToken;\nexports.resolveAsScalar = cstScalar.resolveAsScalar;\nexports.setScalarValue = cstScalar.setScalarValue;\nexports.stringify = cstStringify.stringify;\nexports.visit = cstVisit.visit;\nexports.BOM = BOM;\nexports.DOCUMENT = DOCUMENT;\nexports.FLOW_END = FLOW_END;\nexports.SCALAR = SCALAR;\nexports.isCollection = isCollection;\nexports.isScalar = isScalar;\nexports.prettyToken = prettyToken;\nexports.tokenType = tokenType;\n","'use strict';\n\nvar cst = require('./cst.js');\n\n/*\nSTART -> stream\n\nstream\n directive -> line-end -> stream\n indent + line-end -> stream\n [else] -> line-start\n\nline-end\n comment -> line-end\n newline -> .\n input-end -> END\n\nline-start\n doc-start -> doc\n doc-end -> stream\n [else] -> indent -> block-start\n\nblock-start\n seq-item-start -> block-start\n explicit-key-start -> block-start\n map-value-start -> block-start\n [else] -> doc\n\ndoc\n line-end -> line-start\n spaces -> doc\n anchor -> doc\n tag -> doc\n flow-start -> flow -> doc\n flow-end -> error -> doc\n seq-item-start -> error -> doc\n explicit-key-start -> error -> doc\n map-value-start -> doc\n alias -> doc\n quote-start -> quoted-scalar -> doc\n block-scalar-header -> line-end -> block-scalar(min) -> line-start\n [else] -> plain-scalar(false, min) -> doc\n\nflow\n line-end -> flow\n spaces -> flow\n anchor -> flow\n tag -> flow\n flow-start -> flow -> flow\n flow-end -> .\n seq-item-start -> error -> flow\n explicit-key-start -> flow\n map-value-start -> flow\n alias -> flow\n quote-start -> quoted-scalar -> flow\n comma -> flow\n [else] -> plain-scalar(true, 0) -> flow\n\nquoted-scalar\n quote-end -> .\n [else] -> quoted-scalar\n\nblock-scalar(min)\n newline + peek(indent < min) -> .\n [else] -> block-scalar(min)\n\nplain-scalar(is-flow, min)\n scalar-end(is-flow) -> .\n peek(newline + (indent < min)) -> .\n [else] -> plain-scalar(min)\n*/\nfunction isEmpty(ch) {\n switch (ch) {\n case undefined:\n case ' ':\n case '\\n':\n case '\\r':\n case '\\t':\n return true;\n default:\n return false;\n }\n}\nconst hexDigits = new Set('0123456789ABCDEFabcdef');\nconst tagChars = new Set(\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()\");\nconst flowIndicatorChars = new Set(',[]{}');\nconst invalidAnchorChars = new Set(' ,[]{}\\n\\r\\t');\nconst isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);\n/**\n * Splits an input string into lexical tokens, i.e. smaller strings that are\n * easily identifiable by `tokens.tokenType()`.\n *\n * Lexing starts always in a \"stream\" context. Incomplete input may be buffered\n * until a complete token can be emitted.\n *\n * In addition to slices of the original input, the following control characters\n * may also be emitted:\n *\n * - `\\x02` (Start of Text): A document starts with the next token\n * - `\\x18` (Cancel): Unexpected end of flow-mode (indicates an error)\n * - `\\x1f` (Unit Separator): Next token is a scalar value\n * - `\\u{FEFF}` (Byte order mark): Emitted separately outside documents\n */\nclass Lexer {\n constructor() {\n /**\n * Flag indicating whether the end of the current buffer marks the end of\n * all input\n */\n this.atEnd = false;\n /**\n * Explicit indent set in block scalar header, as an offset from the current\n * minimum indent, so e.g. set to 1 from a header `|2+`. Set to -1 if not\n * explicitly set.\n */\n this.blockScalarIndent = -1;\n /**\n * Block scalars that include a + (keep) chomping indicator in their header\n * include trailing empty lines, which are otherwise excluded from the\n * scalar's contents.\n */\n this.blockScalarKeep = false;\n /** Current input */\n this.buffer = '';\n /**\n * Flag noting whether the map value indicator : can immediately follow this\n * node within a flow context.\n */\n this.flowKey = false;\n /** Count of surrounding flow collection levels. */\n this.flowLevel = 0;\n /**\n * Minimum level of indentation required for next lines to be parsed as a\n * part of the current scalar value.\n */\n this.indentNext = 0;\n /** Indentation level of the current line. */\n this.indentValue = 0;\n /** Position of the next \\n character. */\n this.lineEndPos = null;\n /** Stores the state of the lexer if reaching the end of incpomplete input */\n this.next = null;\n /** A pointer to `buffer`; the current position of the lexer. */\n this.pos = 0;\n }\n /**\n * Generate YAML tokens from the `source` string. If `incomplete`,\n * a part of the last line may be left as a buffer for the next call.\n *\n * @returns A generator of lexical tokens\n */\n *lex(source, incomplete = false) {\n if (source) {\n if (typeof source !== 'string')\n throw TypeError('source is not a string');\n this.buffer = this.buffer ? this.buffer + source : source;\n this.lineEndPos = null;\n }\n this.atEnd = !incomplete;\n let next = this.next ?? 'stream';\n while (next && (incomplete || this.hasChars(1)))\n next = yield* this.parseNext(next);\n }\n atLineEnd() {\n let i = this.pos;\n let ch = this.buffer[i];\n while (ch === ' ' || ch === '\\t')\n ch = this.buffer[++i];\n if (!ch || ch === '#' || ch === '\\n')\n return true;\n if (ch === '\\r')\n return this.buffer[i + 1] === '\\n';\n return false;\n }\n charAt(n) {\n return this.buffer[this.pos + n];\n }\n continueScalar(offset) {\n let ch = this.buffer[offset];\n if (this.indentNext > 0) {\n let indent = 0;\n while (ch === ' ')\n ch = this.buffer[++indent + offset];\n if (ch === '\\r') {\n const next = this.buffer[indent + offset + 1];\n if (next === '\\n' || (!next && !this.atEnd))\n return offset + indent + 1;\n }\n return ch === '\\n' || indent >= this.indentNext || (!ch && !this.atEnd)\n ? offset + indent\n : -1;\n }\n if (ch === '-' || ch === '.') {\n const dt = this.buffer.substr(offset, 3);\n if ((dt === '---' || dt === '...') && isEmpty(this.buffer[offset + 3]))\n return -1;\n }\n return offset;\n }\n getLine() {\n let end = this.lineEndPos;\n if (typeof end !== 'number' || (end !== -1 && end < this.pos)) {\n end = this.buffer.indexOf('\\n', this.pos);\n this.lineEndPos = end;\n }\n if (end === -1)\n return this.atEnd ? this.buffer.substring(this.pos) : null;\n if (this.buffer[end - 1] === '\\r')\n end -= 1;\n return this.buffer.substring(this.pos, end);\n }\n hasChars(n) {\n return this.pos + n <= this.buffer.length;\n }\n setNext(state) {\n this.buffer = this.buffer.substring(this.pos);\n this.pos = 0;\n this.lineEndPos = null;\n this.next = state;\n return null;\n }\n peek(n) {\n return this.buffer.substr(this.pos, n);\n }\n *parseNext(next) {\n switch (next) {\n case 'stream':\n return yield* this.parseStream();\n case 'line-start':\n return yield* this.parseLineStart();\n case 'block-start':\n return yield* this.parseBlockStart();\n case 'doc':\n return yield* this.parseDocument();\n case 'flow':\n return yield* this.parseFlowCollection();\n case 'quoted-scalar':\n return yield* this.parseQuotedScalar();\n case 'block-scalar':\n return yield* this.parseBlockScalar();\n case 'plain-scalar':\n return yield* this.parsePlainScalar();\n }\n }\n *parseStream() {\n let line = this.getLine();\n if (line === null)\n return this.setNext('stream');\n if (line[0] === cst.BOM) {\n yield* this.pushCount(1);\n line = line.substring(1);\n }\n if (line[0] === '%') {\n let dirEnd = line.length;\n let cs = line.indexOf('#');\n while (cs !== -1) {\n const ch = line[cs - 1];\n if (ch === ' ' || ch === '\\t') {\n dirEnd = cs - 1;\n break;\n }\n else {\n cs = line.indexOf('#', cs + 1);\n }\n }\n while (true) {\n const ch = line[dirEnd - 1];\n if (ch === ' ' || ch === '\\t')\n dirEnd -= 1;\n else\n break;\n }\n const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));\n yield* this.pushCount(line.length - n); // possible comment\n this.pushNewline();\n return 'stream';\n }\n if (this.atLineEnd()) {\n const sp = yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - sp);\n yield* this.pushNewline();\n return 'stream';\n }\n yield cst.DOCUMENT;\n return yield* this.parseLineStart();\n }\n *parseLineStart() {\n const ch = this.charAt(0);\n if (!ch && !this.atEnd)\n return this.setNext('line-start');\n if (ch === '-' || ch === '.') {\n if (!this.atEnd && !this.hasChars(4))\n return this.setNext('line-start');\n const s = this.peek(3);\n if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {\n yield* this.pushCount(3);\n this.indentValue = 0;\n this.indentNext = 0;\n return s === '---' ? 'doc' : 'stream';\n }\n }\n this.indentValue = yield* this.pushSpaces(false);\n if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1)))\n this.indentNext = this.indentValue;\n return yield* this.parseBlockStart();\n }\n *parseBlockStart() {\n const [ch0, ch1] = this.peek(2);\n if (!ch1 && !this.atEnd)\n return this.setNext('block-start');\n if ((ch0 === '-' || ch0 === '?' || ch0 === ':') && isEmpty(ch1)) {\n const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));\n this.indentNext = this.indentValue + 1;\n this.indentValue += n;\n return yield* this.parseBlockStart();\n }\n return 'doc';\n }\n *parseDocument() {\n yield* this.pushSpaces(true);\n const line = this.getLine();\n if (line === null)\n return this.setNext('doc');\n let n = yield* this.pushIndicators();\n switch (line[n]) {\n case '#':\n yield* this.pushCount(line.length - n);\n // fallthrough\n case undefined:\n yield* this.pushNewline();\n return yield* this.parseLineStart();\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel = 1;\n return 'flow';\n case '}':\n case ']':\n // this is an error\n yield* this.pushCount(1);\n return 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'doc';\n case '\"':\n case \"'\":\n return yield* this.parseQuotedScalar();\n case '|':\n case '>':\n n += yield* this.parseBlockScalarHeader();\n n += yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - n);\n yield* this.pushNewline();\n return yield* this.parseBlockScalar();\n default:\n return yield* this.parsePlainScalar();\n }\n }\n *parseFlowCollection() {\n let nl, sp;\n let indent = -1;\n do {\n nl = yield* this.pushNewline();\n if (nl > 0) {\n sp = yield* this.pushSpaces(false);\n this.indentValue = indent = sp;\n }\n else {\n sp = 0;\n }\n sp += yield* this.pushSpaces(true);\n } while (nl + sp > 0);\n const line = this.getLine();\n if (line === null)\n return this.setNext('flow');\n if ((indent !== -1 && indent < this.indentNext && line[0] !== '#') ||\n (indent === 0 &&\n (line.startsWith('---') || line.startsWith('...')) &&\n isEmpty(line[3]))) {\n // Allowing for the terminal ] or } at the same (rather than greater)\n // indent level as the initial [ or { is technically invalid, but\n // failing here would be surprising to users.\n const atFlowEndMarker = indent === this.indentNext - 1 &&\n this.flowLevel === 1 &&\n (line[0] === ']' || line[0] === '}');\n if (!atFlowEndMarker) {\n // this is an error\n this.flowLevel = 0;\n yield cst.FLOW_END;\n return yield* this.parseLineStart();\n }\n }\n let n = 0;\n while (line[n] === ',') {\n n += yield* this.pushCount(1);\n n += yield* this.pushSpaces(true);\n this.flowKey = false;\n }\n n += yield* this.pushIndicators();\n switch (line[n]) {\n case undefined:\n return 'flow';\n case '#':\n yield* this.pushCount(line.length - n);\n return 'flow';\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel += 1;\n return 'flow';\n case '}':\n case ']':\n yield* this.pushCount(1);\n this.flowKey = true;\n this.flowLevel -= 1;\n return this.flowLevel ? 'flow' : 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'flow';\n case '\"':\n case \"'\":\n this.flowKey = true;\n return yield* this.parseQuotedScalar();\n case ':': {\n const next = this.charAt(1);\n if (this.flowKey || isEmpty(next) || next === ',') {\n this.flowKey = false;\n yield* this.pushCount(1);\n yield* this.pushSpaces(true);\n return 'flow';\n }\n }\n // fallthrough\n default:\n this.flowKey = false;\n return yield* this.parsePlainScalar();\n }\n }\n *parseQuotedScalar() {\n const quote = this.charAt(0);\n let end = this.buffer.indexOf(quote, this.pos + 1);\n if (quote === \"'\") {\n while (end !== -1 && this.buffer[end + 1] === \"'\")\n end = this.buffer.indexOf(\"'\", end + 2);\n }\n else {\n // double-quote\n while (end !== -1) {\n let n = 0;\n while (this.buffer[end - 1 - n] === '\\\\')\n n += 1;\n if (n % 2 === 0)\n break;\n end = this.buffer.indexOf('\"', end + 1);\n }\n }\n // Only looking for newlines within the quotes\n const qb = this.buffer.substring(0, end);\n let nl = qb.indexOf('\\n', this.pos);\n if (nl !== -1) {\n while (nl !== -1) {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = qb.indexOf('\\n', cs);\n }\n if (nl !== -1) {\n // this is an error caused by an unexpected unindent\n end = nl - (qb[nl - 1] === '\\r' ? 2 : 1);\n }\n }\n if (end === -1) {\n if (!this.atEnd)\n return this.setNext('quoted-scalar');\n end = this.buffer.length;\n }\n yield* this.pushToIndex(end + 1, false);\n return this.flowLevel ? 'flow' : 'doc';\n }\n *parseBlockScalarHeader() {\n this.blockScalarIndent = -1;\n this.blockScalarKeep = false;\n let i = this.pos;\n while (true) {\n const ch = this.buffer[++i];\n if (ch === '+')\n this.blockScalarKeep = true;\n else if (ch > '0' && ch <= '9')\n this.blockScalarIndent = Number(ch) - 1;\n else if (ch !== '-')\n break;\n }\n return yield* this.pushUntil(ch => isEmpty(ch) || ch === '#');\n }\n *parseBlockScalar() {\n let nl = this.pos - 1; // may be -1 if this.pos === 0\n let indent = 0;\n let ch;\n loop: for (let i = this.pos; (ch = this.buffer[i]); ++i) {\n switch (ch) {\n case ' ':\n indent += 1;\n break;\n case '\\n':\n nl = i;\n indent = 0;\n break;\n case '\\r': {\n const next = this.buffer[i + 1];\n if (!next && !this.atEnd)\n return this.setNext('block-scalar');\n if (next === '\\n')\n break;\n } // fallthrough\n default:\n break loop;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('block-scalar');\n if (indent >= this.indentNext) {\n if (this.blockScalarIndent === -1)\n this.indentNext = indent;\n else {\n this.indentNext =\n this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);\n }\n do {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = this.buffer.indexOf('\\n', cs);\n } while (nl !== -1);\n if (nl === -1) {\n if (!this.atEnd)\n return this.setNext('block-scalar');\n nl = this.buffer.length;\n }\n }\n // Trailing insufficiently indented tabs are invalid.\n // To catch that during parsing, we include them in the block scalar value.\n let i = nl + 1;\n ch = this.buffer[i];\n while (ch === ' ')\n ch = this.buffer[++i];\n if (ch === '\\t') {\n while (ch === '\\t' || ch === ' ' || ch === '\\r' || ch === '\\n')\n ch = this.buffer[++i];\n nl = i - 1;\n }\n else if (!this.blockScalarKeep) {\n do {\n let i = nl - 1;\n let ch = this.buffer[i];\n if (ch === '\\r')\n ch = this.buffer[--i];\n const lastChar = i; // Drop the line if last char not more indented\n while (ch === ' ')\n ch = this.buffer[--i];\n if (ch === '\\n' && i >= this.pos && i + 1 + indent > lastChar)\n nl = i;\n else\n break;\n } while (true);\n }\n yield cst.SCALAR;\n yield* this.pushToIndex(nl + 1, true);\n return yield* this.parseLineStart();\n }\n *parsePlainScalar() {\n const inFlow = this.flowLevel > 0;\n let end = this.pos - 1;\n let i = this.pos - 1;\n let ch;\n while ((ch = this.buffer[++i])) {\n if (ch === ':') {\n const next = this.buffer[i + 1];\n if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))\n break;\n end = i;\n }\n else if (isEmpty(ch)) {\n let next = this.buffer[i + 1];\n if (ch === '\\r') {\n if (next === '\\n') {\n i += 1;\n ch = '\\n';\n next = this.buffer[i + 1];\n }\n else\n end = i;\n }\n if (next === '#' || (inFlow && flowIndicatorChars.has(next)))\n break;\n if (ch === '\\n') {\n const cs = this.continueScalar(i + 1);\n if (cs === -1)\n break;\n i = Math.max(i, cs - 2); // to advance, but still account for ' #'\n }\n }\n else {\n if (inFlow && flowIndicatorChars.has(ch))\n break;\n end = i;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('plain-scalar');\n yield cst.SCALAR;\n yield* this.pushToIndex(end + 1, true);\n return inFlow ? 'flow' : 'doc';\n }\n *pushCount(n) {\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos += n;\n return n;\n }\n return 0;\n }\n *pushToIndex(i, allowEmpty) {\n const s = this.buffer.slice(this.pos, i);\n if (s) {\n yield s;\n this.pos += s.length;\n return s.length;\n }\n else if (allowEmpty)\n yield '';\n return 0;\n }\n *pushIndicators() {\n switch (this.charAt(0)) {\n case '!':\n return ((yield* this.pushTag()) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n case '&':\n return ((yield* this.pushUntil(isNotAnchorChar)) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n case '-': // this is an error\n case '?': // this is an error outside flow collections\n case ':': {\n const inFlow = this.flowLevel > 0;\n const ch1 = this.charAt(1);\n if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {\n if (!inFlow)\n this.indentNext = this.indentValue + 1;\n else if (this.flowKey)\n this.flowKey = false;\n return ((yield* this.pushCount(1)) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n }\n }\n }\n return 0;\n }\n *pushTag() {\n if (this.charAt(1) === '<') {\n let i = this.pos + 2;\n let ch = this.buffer[i];\n while (!isEmpty(ch) && ch !== '>')\n ch = this.buffer[++i];\n return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);\n }\n else {\n let i = this.pos + 1;\n let ch = this.buffer[i];\n while (ch) {\n if (tagChars.has(ch))\n ch = this.buffer[++i];\n else if (ch === '%' &&\n hexDigits.has(this.buffer[i + 1]) &&\n hexDigits.has(this.buffer[i + 2])) {\n ch = this.buffer[(i += 3)];\n }\n else\n break;\n }\n return yield* this.pushToIndex(i, false);\n }\n }\n *pushNewline() {\n const ch = this.buffer[this.pos];\n if (ch === '\\n')\n return yield* this.pushCount(1);\n else if (ch === '\\r' && this.charAt(1) === '\\n')\n return yield* this.pushCount(2);\n else\n return 0;\n }\n *pushSpaces(allowTabs) {\n let i = this.pos - 1;\n let ch;\n do {\n ch = this.buffer[++i];\n } while (ch === ' ' || (allowTabs && ch === '\\t'));\n const n = i - this.pos;\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos = i;\n }\n return n;\n }\n *pushUntil(test) {\n let i = this.pos;\n let ch = this.buffer[i];\n while (!test(ch))\n ch = this.buffer[++i];\n return yield* this.pushToIndex(i, false);\n }\n}\n\nexports.Lexer = Lexer;\n","'use strict';\n\n/**\n * Tracks newlines during parsing in order to provide an efficient API for\n * determining the one-indexed `{ line, col }` position for any offset\n * within the input.\n */\nclass LineCounter {\n constructor() {\n this.lineStarts = [];\n /**\n * Should be called in ascending order. Otherwise, call\n * `lineCounter.lineStarts.sort()` before calling `linePos()`.\n */\n this.addNewLine = (offset) => this.lineStarts.push(offset);\n /**\n * Performs a binary search and returns the 1-indexed { line, col }\n * position of `offset`. If `line === 0`, `addNewLine` has never been\n * called or `offset` is before the first known newline.\n */\n this.linePos = (offset) => {\n let low = 0;\n let high = this.lineStarts.length;\n while (low < high) {\n const mid = (low + high) >> 1; // Math.floor((low + high) / 2)\n if (this.lineStarts[mid] < offset)\n low = mid + 1;\n else\n high = mid;\n }\n if (this.lineStarts[low] === offset)\n return { line: low + 1, col: 1 };\n if (low === 0)\n return { line: 0, col: offset };\n const start = this.lineStarts[low - 1];\n return { line: low, col: offset - start + 1 };\n };\n }\n}\n\nexports.LineCounter = LineCounter;\n","'use strict';\n\nvar node_process = require('process');\nvar cst = require('./cst.js');\nvar lexer = require('./lexer.js');\n\nfunction includesToken(list, type) {\n for (let i = 0; i < list.length; ++i)\n if (list[i].type === type)\n return true;\n return false;\n}\nfunction findNonEmptyIndex(list) {\n for (let i = 0; i < list.length; ++i) {\n switch (list[i].type) {\n case 'space':\n case 'comment':\n case 'newline':\n break;\n default:\n return i;\n }\n }\n return -1;\n}\nfunction isFlowToken(token) {\n switch (token?.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'flow-collection':\n return true;\n default:\n return false;\n }\n}\nfunction getPrevProps(parent) {\n switch (parent.type) {\n case 'document':\n return parent.start;\n case 'block-map': {\n const it = parent.items[parent.items.length - 1];\n return it.sep ?? it.start;\n }\n case 'block-seq':\n return parent.items[parent.items.length - 1].start;\n /* istanbul ignore next should not happen */\n default:\n return [];\n }\n}\n/** Note: May modify input array */\nfunction getFirstKeyStartProps(prev) {\n if (prev.length === 0)\n return [];\n let i = prev.length;\n loop: while (--i >= 0) {\n switch (prev[i].type) {\n case 'doc-start':\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n case 'newline':\n break loop;\n }\n }\n while (prev[++i]?.type === 'space') {\n /* loop */\n }\n return prev.splice(i, prev.length);\n}\nfunction fixFlowSeqItems(fc) {\n if (fc.start.type === 'flow-seq-start') {\n for (const it of fc.items) {\n if (it.sep &&\n !it.value &&\n !includesToken(it.start, 'explicit-key-ind') &&\n !includesToken(it.sep, 'map-value-ind')) {\n if (it.key)\n it.value = it.key;\n delete it.key;\n if (isFlowToken(it.value)) {\n if (it.value.end)\n Array.prototype.push.apply(it.value.end, it.sep);\n else\n it.value.end = it.sep;\n }\n else\n Array.prototype.push.apply(it.start, it.sep);\n delete it.sep;\n }\n }\n }\n}\n/**\n * A YAML concrete syntax tree (CST) parser\n *\n * ```ts\n * const src: string = ...\n * for (const token of new Parser().parse(src)) {\n * // token: Token\n * }\n * ```\n *\n * To use the parser with a user-provided lexer:\n *\n * ```ts\n * function* parse(source: string, lexer: Lexer) {\n * const parser = new Parser()\n * for (const lexeme of lexer.lex(source))\n * yield* parser.next(lexeme)\n * yield* parser.end()\n * }\n *\n * const src: string = ...\n * const lexer = new Lexer()\n * for (const token of parse(src, lexer)) {\n * // token: Token\n * }\n * ```\n */\nclass Parser {\n /**\n * @param onNewLine - If defined, called separately with the start position of\n * each new line (in `parse()`, including the start of input).\n */\n constructor(onNewLine) {\n /** If true, space and sequence indicators count as indentation */\n this.atNewLine = true;\n /** If true, next token is a scalar value */\n this.atScalar = false;\n /** Current indentation level */\n this.indent = 0;\n /** Current offset since the start of parsing */\n this.offset = 0;\n /** On the same line with a block map key */\n this.onKeyLine = false;\n /** Top indicates the node that's currently being built */\n this.stack = [];\n /** The source of the current token, set in parse() */\n this.source = '';\n /** The type of the current token, set in parse() */\n this.type = '';\n // Must be defined after `next()`\n this.lexer = new lexer.Lexer();\n this.onNewLine = onNewLine;\n }\n /**\n * Parse `source` as a YAML stream.\n * If `incomplete`, a part of the last line may be left as a buffer for the next call.\n *\n * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.\n *\n * @returns A generator of tokens representing each directive, document, and other structure.\n */\n *parse(source, incomplete = false) {\n if (this.onNewLine && this.offset === 0)\n this.onNewLine(0);\n for (const lexeme of this.lexer.lex(source, incomplete))\n yield* this.next(lexeme);\n if (!incomplete)\n yield* this.end();\n }\n /**\n * Advance the parser by the `source` of one lexical token.\n */\n *next(source) {\n this.source = source;\n if (node_process.env.LOG_TOKENS)\n console.log('|', cst.prettyToken(source));\n if (this.atScalar) {\n this.atScalar = false;\n yield* this.step();\n this.offset += source.length;\n return;\n }\n const type = cst.tokenType(source);\n if (!type) {\n const message = `Not a YAML token: ${source}`;\n yield* this.pop({ type: 'error', offset: this.offset, message, source });\n this.offset += source.length;\n }\n else if (type === 'scalar') {\n this.atNewLine = false;\n this.atScalar = true;\n this.type = 'scalar';\n }\n else {\n this.type = type;\n yield* this.step();\n switch (type) {\n case 'newline':\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine)\n this.onNewLine(this.offset + source.length);\n break;\n case 'space':\n if (this.atNewLine && source[0] === ' ')\n this.indent += source.length;\n break;\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n if (this.atNewLine)\n this.indent += source.length;\n break;\n case 'doc-mode':\n case 'flow-error-end':\n return;\n default:\n this.atNewLine = false;\n }\n this.offset += source.length;\n }\n }\n /** Call at end of input to push out any remaining constructions */\n *end() {\n while (this.stack.length > 0)\n yield* this.pop();\n }\n get sourceToken() {\n const st = {\n type: this.type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n return st;\n }\n *step() {\n const top = this.peek(1);\n if (this.type === 'doc-end' && top?.type !== 'doc-end') {\n while (this.stack.length > 0)\n yield* this.pop();\n this.stack.push({\n type: 'doc-end',\n offset: this.offset,\n source: this.source\n });\n return;\n }\n if (!top)\n return yield* this.stream();\n switch (top.type) {\n case 'document':\n return yield* this.document(top);\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return yield* this.scalar(top);\n case 'block-scalar':\n return yield* this.blockScalar(top);\n case 'block-map':\n return yield* this.blockMap(top);\n case 'block-seq':\n return yield* this.blockSequence(top);\n case 'flow-collection':\n return yield* this.flowCollection(top);\n case 'doc-end':\n return yield* this.documentEnd(top);\n }\n /* istanbul ignore next should not happen */\n yield* this.pop();\n }\n peek(n) {\n return this.stack[this.stack.length - n];\n }\n *pop(error) {\n const token = error ?? this.stack.pop();\n /* istanbul ignore if should not happen */\n if (!token) {\n const message = 'Tried to pop an empty stack';\n yield { type: 'error', offset: this.offset, source: '', message };\n }\n else if (this.stack.length === 0) {\n yield token;\n }\n else {\n const top = this.peek(1);\n if (token.type === 'block-scalar') {\n // Block scalars use their parent rather than header indent\n token.indent = 'indent' in top ? top.indent : 0;\n }\n else if (token.type === 'flow-collection' && top.type === 'document') {\n // Ignore all indent for top-level flow collections\n token.indent = 0;\n }\n if (token.type === 'flow-collection')\n fixFlowSeqItems(token);\n switch (top.type) {\n case 'document':\n top.value = token;\n break;\n case 'block-scalar':\n top.props.push(token); // error\n break;\n case 'block-map': {\n const it = top.items[top.items.length - 1];\n if (it.value) {\n top.items.push({ start: [], key: token, sep: [] });\n this.onKeyLine = true;\n return;\n }\n else if (it.sep) {\n it.value = token;\n }\n else {\n Object.assign(it, { key: token, sep: [] });\n this.onKeyLine = !it.explicitKey;\n return;\n }\n break;\n }\n case 'block-seq': {\n const it = top.items[top.items.length - 1];\n if (it.value)\n top.items.push({ start: [], value: token });\n else\n it.value = token;\n break;\n }\n case 'flow-collection': {\n const it = top.items[top.items.length - 1];\n if (!it || it.value)\n top.items.push({ start: [], key: token, sep: [] });\n else if (it.sep)\n it.value = token;\n else\n Object.assign(it, { key: token, sep: [] });\n return;\n }\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.pop(token);\n }\n if ((top.type === 'document' ||\n top.type === 'block-map' ||\n top.type === 'block-seq') &&\n (token.type === 'block-map' || token.type === 'block-seq')) {\n const last = token.items[token.items.length - 1];\n if (last &&\n !last.sep &&\n !last.value &&\n last.start.length > 0 &&\n findNonEmptyIndex(last.start) === -1 &&\n (token.indent === 0 ||\n last.start.every(st => st.type !== 'comment' || st.indent < token.indent))) {\n if (top.type === 'document')\n top.end = last.start;\n else\n top.items.push({ start: last.start });\n token.items.splice(-1, 1);\n }\n }\n }\n }\n *stream() {\n switch (this.type) {\n case 'directive-line':\n yield { type: 'directive', offset: this.offset, source: this.source };\n return;\n case 'byte-order-mark':\n case 'space':\n case 'comment':\n case 'newline':\n yield this.sourceToken;\n return;\n case 'doc-mode':\n case 'doc-start': {\n const doc = {\n type: 'document',\n offset: this.offset,\n start: []\n };\n if (this.type === 'doc-start')\n doc.start.push(this.sourceToken);\n this.stack.push(doc);\n return;\n }\n }\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML stream`,\n source: this.source\n };\n }\n *document(doc) {\n if (doc.value)\n return yield* this.lineEnd(doc);\n switch (this.type) {\n case 'doc-start': {\n if (findNonEmptyIndex(doc.start) !== -1) {\n yield* this.pop();\n yield* this.step();\n }\n else\n doc.start.push(this.sourceToken);\n return;\n }\n case 'anchor':\n case 'tag':\n case 'space':\n case 'comment':\n case 'newline':\n doc.start.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(doc);\n if (bv)\n this.stack.push(bv);\n else {\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML document`,\n source: this.source\n };\n }\n }\n *scalar(scalar) {\n if (this.type === 'map-value-ind') {\n const prev = getPrevProps(this.peek(2));\n const start = getFirstKeyStartProps(prev);\n let sep;\n if (scalar.end) {\n sep = scalar.end;\n sep.push(this.sourceToken);\n delete scalar.end;\n }\n else\n sep = [this.sourceToken];\n const map = {\n type: 'block-map',\n offset: scalar.offset,\n indent: scalar.indent,\n items: [{ start, key: scalar, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else\n yield* this.lineEnd(scalar);\n }\n *blockScalar(scalar) {\n switch (this.type) {\n case 'space':\n case 'comment':\n case 'newline':\n scalar.props.push(this.sourceToken);\n return;\n case 'scalar':\n scalar.source = this.source;\n // block-scalar source includes trailing newline\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n yield* this.pop();\n break;\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.step();\n }\n }\n *blockMap(map) {\n const it = map.items[map.items.length - 1];\n // it.sep is true-ish if pair already has key or : separator\n switch (this.type) {\n case 'newline':\n this.onKeyLine = false;\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'space':\n case 'comment':\n if (it.value) {\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n if (this.atIndentedComment(it.start, map.indent)) {\n const prev = map.items[map.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n Array.prototype.push.apply(end, it.start);\n end.push(this.sourceToken);\n map.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n }\n if (this.indent >= map.indent) {\n const atMapIndent = !this.onKeyLine && this.indent === map.indent;\n const atNextItem = atMapIndent &&\n (it.sep || it.explicitKey) &&\n this.type !== 'seq-item-ind';\n // For empty nodes, assign newline-separated not indented empty tokens to following node\n let start = [];\n if (atNextItem && it.sep && !it.value) {\n const nl = [];\n for (let i = 0; i < it.sep.length; ++i) {\n const st = it.sep[i];\n switch (st.type) {\n case 'newline':\n nl.push(i);\n break;\n case 'space':\n break;\n case 'comment':\n if (st.indent > map.indent)\n nl.length = 0;\n break;\n default:\n nl.length = 0;\n }\n }\n if (nl.length >= 2)\n start = it.sep.splice(nl[1]);\n }\n switch (this.type) {\n case 'anchor':\n case 'tag':\n if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'explicit-key-ind':\n if (!it.sep && !it.explicitKey) {\n it.start.push(this.sourceToken);\n it.explicitKey = true;\n }\n else if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start, explicitKey: true });\n }\n else {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken], explicitKey: true }]\n });\n }\n this.onKeyLine = true;\n return;\n case 'map-value-ind':\n if (it.explicitKey) {\n if (!it.sep) {\n if (includesToken(it.start, 'newline')) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else {\n const start = getFirstKeyStartProps(it.start);\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n }\n else if (it.value) {\n map.items.push({ start: [], key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n else if (isFlowToken(it.key) &&\n !includesToken(it.sep, 'newline')) {\n const start = getFirstKeyStartProps(it.start);\n const key = it.key;\n const sep = it.sep;\n sep.push(this.sourceToken);\n // @ts-expect-error type guard is wrong here\n delete it.key;\n // @ts-expect-error type guard is wrong here\n delete it.sep;\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key, sep }]\n });\n }\n else if (start.length > 0) {\n // Not actually at next item\n it.sep = it.sep.concat(start, this.sourceToken);\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n else {\n if (!it.sep) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else if (it.value || atNextItem) {\n map.items.push({ start, key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [], key: null, sep: [this.sourceToken] }]\n });\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n this.onKeyLine = true;\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (atNextItem || it.value) {\n map.items.push({ start, key: fs, sep: [] });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n this.stack.push(fs);\n }\n else {\n Object.assign(it, { key: fs, sep: [] });\n this.onKeyLine = true;\n }\n return;\n }\n default: {\n const bv = this.startBlockValue(map);\n if (bv) {\n if (bv.type === 'block-seq') {\n if (!it.explicitKey &&\n it.sep &&\n !includesToken(it.sep, 'newline')) {\n yield* this.pop({\n type: 'error',\n offset: this.offset,\n message: 'Unexpected block-seq-ind on same line with key',\n source: this.source\n });\n return;\n }\n }\n else if (atMapIndent) {\n map.items.push({ start });\n }\n this.stack.push(bv);\n return;\n }\n }\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *blockSequence(seq) {\n const it = seq.items[seq.items.length - 1];\n switch (this.type) {\n case 'newline':\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n seq.items.push({ start: [this.sourceToken] });\n }\n else\n it.start.push(this.sourceToken);\n return;\n case 'space':\n case 'comment':\n if (it.value)\n seq.items.push({ start: [this.sourceToken] });\n else {\n if (this.atIndentedComment(it.start, seq.indent)) {\n const prev = seq.items[seq.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n Array.prototype.push.apply(end, it.start);\n end.push(this.sourceToken);\n seq.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n case 'anchor':\n case 'tag':\n if (it.value || this.indent <= seq.indent)\n break;\n it.start.push(this.sourceToken);\n return;\n case 'seq-item-ind':\n if (this.indent !== seq.indent)\n break;\n if (it.value || includesToken(it.start, 'seq-item-ind'))\n seq.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n }\n if (this.indent > seq.indent) {\n const bv = this.startBlockValue(seq);\n if (bv) {\n this.stack.push(bv);\n return;\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *flowCollection(fc) {\n const it = fc.items[fc.items.length - 1];\n if (this.type === 'flow-error-end') {\n let top;\n do {\n yield* this.pop();\n top = this.peek(1);\n } while (top?.type === 'flow-collection');\n }\n else if (fc.end.length === 0) {\n switch (this.type) {\n case 'comma':\n case 'explicit-key-ind':\n if (!it || it.sep)\n fc.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n case 'map-value-ind':\n if (!it || it.value)\n fc.items.push({ start: [], key: null, sep: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n return;\n case 'space':\n case 'comment':\n case 'newline':\n case 'anchor':\n case 'tag':\n if (!it || it.value)\n fc.items.push({ start: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n it.start.push(this.sourceToken);\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (!it || it.value)\n fc.items.push({ start: [], key: fs, sep: [] });\n else if (it.sep)\n this.stack.push(fs);\n else\n Object.assign(it, { key: fs, sep: [] });\n return;\n }\n case 'flow-map-end':\n case 'flow-seq-end':\n fc.end.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(fc);\n /* istanbul ignore else should not happen */\n if (bv)\n this.stack.push(bv);\n else {\n yield* this.pop();\n yield* this.step();\n }\n }\n else {\n const parent = this.peek(2);\n if (parent.type === 'block-map' &&\n ((this.type === 'map-value-ind' && parent.indent === fc.indent) ||\n (this.type === 'newline' &&\n !parent.items[parent.items.length - 1].sep))) {\n yield* this.pop();\n yield* this.step();\n }\n else if (this.type === 'map-value-ind' &&\n parent.type !== 'flow-collection') {\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n fixFlowSeqItems(fc);\n const sep = fc.end.splice(1, fc.end.length);\n sep.push(this.sourceToken);\n const map = {\n type: 'block-map',\n offset: fc.offset,\n indent: fc.indent,\n items: [{ start, key: fc, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else {\n yield* this.lineEnd(fc);\n }\n }\n }\n flowScalar(type) {\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n return {\n type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n }\n startBlockValue(parent) {\n switch (this.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return this.flowScalar(this.type);\n case 'block-scalar-header':\n return {\n type: 'block-scalar',\n offset: this.offset,\n indent: this.indent,\n props: [this.sourceToken],\n source: ''\n };\n case 'flow-map-start':\n case 'flow-seq-start':\n return {\n type: 'flow-collection',\n offset: this.offset,\n indent: this.indent,\n start: this.sourceToken,\n items: [],\n end: []\n };\n case 'seq-item-ind':\n return {\n type: 'block-seq',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken] }]\n };\n case 'explicit-key-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n start.push(this.sourceToken);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, explicitKey: true }]\n };\n }\n case 'map-value-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n };\n }\n }\n return null;\n }\n atIndentedComment(start, indent) {\n if (this.type !== 'comment')\n return false;\n if (this.indent <= indent)\n return false;\n return start.every(st => st.type === 'newline' || st.type === 'space');\n }\n *documentEnd(docEnd) {\n if (this.type !== 'doc-mode') {\n if (docEnd.end)\n docEnd.end.push(this.sourceToken);\n else\n docEnd.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n *lineEnd(token) {\n switch (this.type) {\n case 'comma':\n case 'doc-start':\n case 'doc-end':\n case 'flow-seq-end':\n case 'flow-map-end':\n case 'map-value-ind':\n yield* this.pop();\n yield* this.step();\n break;\n case 'newline':\n this.onKeyLine = false;\n // fallthrough\n case 'space':\n case 'comment':\n default:\n // all other values are errors\n if (token.end)\n token.end.push(this.sourceToken);\n else\n token.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n}\n\nexports.Parser = Parser;\n","'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar errors = require('./errors.js');\nvar log = require('./log.js');\nvar identity = require('./nodes/identity.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\n\nfunction parseOptions(options) {\n const prettyErrors = options.prettyErrors !== false;\n const lineCounter$1 = options.lineCounter || (prettyErrors && new lineCounter.LineCounter()) || null;\n return { lineCounter: lineCounter$1, prettyErrors };\n}\n/**\n * Parse the input as a stream of YAML documents.\n *\n * Documents should be separated from each other by `...` or `---` marker lines.\n *\n * @returns If an empty `docs` array is returned, it will be of type\n * EmptyStream and contain additional stream information. In\n * TypeScript, you should use `'empty' in docs` as a type guard for it.\n */\nfunction parseAllDocuments(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n const docs = Array.from(composer$1.compose(parser$1.parse(source)));\n if (prettyErrors && lineCounter)\n for (const doc of docs) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n if (docs.length > 0)\n return docs;\n return Object.assign([], { empty: true }, composer$1.streamInfo());\n}\n/** Parse an input string into a single YAML.Document */\nfunction parseDocument(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n // `doc` is always set by compose.end(true) at the very latest\n let doc = null;\n for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {\n if (!doc)\n doc = _doc;\n else if (doc.options.logLevel !== 'silent') {\n doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));\n break;\n }\n }\n if (prettyErrors && lineCounter) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n return doc;\n}\nfunction parse(src, reviver, options) {\n let _reviver = undefined;\n if (typeof reviver === 'function') {\n _reviver = reviver;\n }\n else if (options === undefined && reviver && typeof reviver === 'object') {\n options = reviver;\n }\n const doc = parseDocument(src, options);\n if (!doc)\n return null;\n doc.warnings.forEach(warning => log.warn(doc.options.logLevel, warning));\n if (doc.errors.length > 0) {\n if (doc.options.logLevel !== 'silent')\n throw doc.errors[0];\n else\n doc.errors = [];\n }\n return doc.toJS(Object.assign({ reviver: _reviver }, options));\n}\nfunction stringify(value, replacer, options) {\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n }\n if (typeof options === 'string')\n options = options.length;\n if (typeof options === 'number') {\n const indent = Math.round(options);\n options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };\n }\n if (value === undefined) {\n const { keepUndefined } = options ?? replacer ?? {};\n if (!keepUndefined)\n return undefined;\n }\n if (identity.isDocument(value) && !_replacer)\n return value.toString(options);\n return new Document.Document(value, _replacer, options).toString(options);\n}\n\nexports.parse = parse;\nexports.parseAllDocuments = parseAllDocuments;\nexports.parseDocument = parseDocument;\nexports.stringify = stringify;\n","'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar Schema = require('./schema/Schema.js');\nvar errors = require('./errors.js');\nvar Alias = require('./nodes/Alias.js');\nvar identity = require('./nodes/identity.js');\nvar Pair = require('./nodes/Pair.js');\nvar Scalar = require('./nodes/Scalar.js');\nvar YAMLMap = require('./nodes/YAMLMap.js');\nvar YAMLSeq = require('./nodes/YAMLSeq.js');\nvar cst = require('./parse/cst.js');\nvar lexer = require('./parse/lexer.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\nvar publicApi = require('./public-api.js');\nvar visit = require('./visit.js');\n\n\n\nexports.Composer = composer.Composer;\nexports.Document = Document.Document;\nexports.Schema = Schema.Schema;\nexports.YAMLError = errors.YAMLError;\nexports.YAMLParseError = errors.YAMLParseError;\nexports.YAMLWarning = errors.YAMLWarning;\nexports.Alias = Alias.Alias;\nexports.isAlias = identity.isAlias;\nexports.isCollection = identity.isCollection;\nexports.isDocument = identity.isDocument;\nexports.isMap = identity.isMap;\nexports.isNode = identity.isNode;\nexports.isPair = identity.isPair;\nexports.isScalar = identity.isScalar;\nexports.isSeq = identity.isSeq;\nexports.Pair = Pair.Pair;\nexports.Scalar = Scalar.Scalar;\nexports.YAMLMap = YAMLMap.YAMLMap;\nexports.YAMLSeq = YAMLSeq.YAMLSeq;\nexports.CST = cst;\nexports.Lexer = lexer.Lexer;\nexports.LineCounter = lineCounter.LineCounter;\nexports.Parser = parser.Parser;\nexports.parse = publicApi.parse;\nexports.parseAllDocuments = publicApi.parseAllDocuments;\nexports.parseDocument = publicApi.parseDocument;\nexports.stringify = publicApi.stringify;\nexports.visit = visit.visit;\nexports.visitAsync = visit.visitAsync;\n","/**\n * Syntax highlighting with Shiki via rehype.\n */\n\nimport { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport rehypeStringify from \"rehype-stringify\";\nimport type { Root, Element } from \"hast\";\nimport {\n createHighlighter,\n type Highlighter,\n type BundledTheme,\n type LanguageRegistration,\n} from \"shiki\";\n\nconst BUILTIN_LANGS = [\n \"javascript\",\n \"typescript\",\n \"jsx\",\n \"tsx\",\n \"vue\",\n \"svelte\",\n \"html\",\n \"css\",\n \"scss\",\n \"json\",\n \"yaml\",\n \"markdown\",\n \"bash\",\n \"shell\",\n \"rust\",\n \"python\",\n \"go\",\n \"java\",\n \"c\",\n \"cpp\",\n \"sql\",\n \"graphql\",\n \"diff\",\n \"toml\",\n] as const;\n\n// Cached highlighter instance\nlet highlighterPromise: Promise<Highlighter> | null = null;\n\n/**\n * Get or create the Shiki highlighter.\n */\nasync function getHighlighter(\n theme: string,\n customLangs: LanguageRegistration[] = [],\n): Promise<Highlighter> {\n if (!highlighterPromise) {\n highlighterPromise = createHighlighter({\n themes: [theme as BundledTheme],\n langs: [...BUILTIN_LANGS, ...customLangs],\n });\n }\n return highlighterPromise;\n}\n\n/**\n * Rehype plugin for syntax highlighting with Shiki.\n */\nfunction rehypeShikiHighlight(options: { theme: string; langs?: LanguageRegistration[] }) {\n const { theme, langs } = options;\n\n return async (tree: Root) => {\n const highlighter = await getHighlighter(theme, langs);\n\n // Find all pre > code elements\n const visit = async (node: Root | Element) => {\n if (\"children\" in node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n\n if (child.type === \"element\" && child.tagName === \"pre\") {\n const codeElement = child.children.find(\n (c): c is Element => c.type === \"element\" && c.tagName === \"code\",\n );\n\n if (codeElement) {\n // Extract language from class\n const className = codeElement.properties?.className;\n let lang = \"text\";\n\n if (Array.isArray(className)) {\n const langClass = className.find(\n (c: string | number) => typeof c === \"string\" && c.startsWith(\"language-\"),\n );\n if (langClass && typeof langClass === \"string\") {\n lang = langClass.replace(\"language-\", \"\");\n }\n }\n\n // Get code text\n const codeText = getTextContent(codeElement);\n\n // Highlight with Shiki\n try {\n const highlighted = highlighter.codeToHtml(codeText, {\n lang: lang as any,\n theme: theme as BundledTheme,\n });\n\n // Parse the highlighted HTML and replace the pre element\n const parsed = unified().use(rehypeParse, { fragment: true }).parse(highlighted);\n\n // Replace the pre element with the highlighted one\n if (parsed.children[0]) {\n node.children[i] = parsed.children[0] as Element;\n }\n } catch {\n // If highlighting fails, keep the original\n }\n }\n } else if (child.type === \"element\") {\n await visit(child);\n }\n }\n }\n };\n\n await visit(tree);\n };\n}\n\n/**\n * Extract text content from a hast node.\n */\nfunction getTextContent(node: Element | Root): string {\n let text = \"\";\n\n if (\"children\" in node) {\n for (const child of node.children) {\n if (child.type === \"text\") {\n text += child.value;\n } else if (child.type === \"element\") {\n text += getTextContent(child);\n }\n }\n }\n\n return text;\n}\n\n/**\n * Apply syntax highlighting to HTML using Shiki.\n */\nexport async function highlightCode(\n html: string,\n theme: string = \"github-dark\",\n langs: LanguageRegistration[] = [],\n): Promise<string> {\n const result = await unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeShikiHighlight, { theme, langs })\n .use(rehypeStringify)\n .process(html);\n\n return String(result);\n}\n","/**\n * Protects mermaid SVG content from rehype HTML5 parser corruption.\n *\n * rehypeParse + rehypeStringify converts `<br />` in SVG foreignObject\n * to `<br></br>`, which HTML5 interprets as 2 <br> elements.\n * Each rehype pass doubles them: 1 → 2 → 4 → 8 → 16.\n *\n * This module extracts ox-mermaid SVG blocks into placeholders before\n * rehype processing and restores them after.\n */\n\nexport interface MermaidSvgProtection {\n html: string;\n svgs: Map<string, string>;\n}\n\n/**\n * Extract `<div class=\"ox-mermaid\">...</div>` blocks and replace\n * with HTML comment placeholders that rehype will preserve.\n */\nexport function protectMermaidSvgs(html: string): MermaidSvgProtection {\n const svgs = new Map<string, string>();\n let result = html;\n let idx = 0;\n\n while (true) {\n const marker = `<div class=\"ox-mermaid\">`;\n const start = result.indexOf(marker, idx);\n if (start === -1) break;\n\n // Find the matching </div> by counting nested divs\n let depth = 0;\n let pos = start;\n let endPos = -1;\n\n while (pos < result.length) {\n const openIdx = result.indexOf(\"<div\", pos);\n const closeIdx = result.indexOf(\"</div>\", pos);\n if (closeIdx === -1) break;\n\n if (openIdx !== -1 && openIdx < closeIdx) {\n depth++;\n pos = openIdx + 4;\n } else {\n depth--;\n if (depth === 0) {\n endPos = closeIdx + 6;\n break;\n }\n pos = closeIdx + 6;\n }\n }\n\n if (endPos === -1) break;\n\n const svgContent = result.substring(start, endPos);\n const placeholder = `<!--ox-mermaid-${svgs.size}-->`;\n svgs.set(placeholder, svgContent);\n result = result.substring(0, start) + placeholder + result.substring(endPos);\n idx = start + placeholder.length;\n }\n\n return { html: result, svgs };\n}\n\n/**\n * Restore protected mermaid SVG blocks from placeholders.\n */\nexport function restoreMermaidSvgs(html: string, svgs: Map<string, string>): string {\n let result = html;\n for (const [placeholder, content] of svgs) {\n result = result.replace(placeholder, content);\n }\n return result;\n}\n","/**\n * Markdown Transformation Engine\n *\n * This module handles the complete transformation pipeline for Markdown files,\n * converting raw Markdown content into JavaScript modules that can be imported\n * by web applications. The transformation process includes:\n *\n * 1. **Parsing**: Uses Rust-based parser via NAPI bindings for high performance\n * 2. **Rendering**: Converts parsed AST to semantic HTML\n * 3. **Enhancement**: Applies syntax highlighting, Mermaid diagram rendering, etc.\n * 4. **Code Generation**: Generates JavaScript/TypeScript module code\n *\n * The generated modules export:\n * - `html`: Rendered HTML content\n * - `frontmatter`: Parsed YAML metadata\n * - `toc`: Hierarchical table of contents\n * - `render`: Client-side render function for dynamic updates\n *\n * @example\n * ```typescript\n * import { transformMarkdown } from './transform';\n *\n * const content = await transformMarkdown(\n * '# Hello\\n\\nWorld',\n * 'path/to/file.md',\n * resolvedOptions\n * );\n *\n * console.log(content.html); // '<h1>Hello</h1><p>World</p>'\n * console.log(content.toc); // [{ depth: 1, text: 'Hello', slug: 'hello', children: [] }]\n * ```\n */\n\nimport YAML from \"yaml\";\nimport type { ResolvedOptions, TransformResult, TocEntry } from \"./types\";\nimport { highlightCode } from \"./highlight\";\nimport { transformMermaidStatic } from \"./plugins/mermaid\";\nimport { protectMermaidSvgs, restoreMermaidSvgs } from \"./plugins/mermaid-protect\";\n\n/**\n * NAPI bindings for Rust-based Markdown processing.\n *\n * Provides access to compiled Rust functions for high-performance\n * Markdown parsing and rendering operations.\n */\ninterface NapiBindings {\n /**\n * Simple Markdown parser and renderer in one step.\n * Faster for simple use cases but lacks advanced features.\n *\n * @param source - Raw Markdown content\n * @param options - Parser configuration (GFM flag)\n * @returns Rendered HTML and parsing errors\n */\n parseAndRender: (\n source: string,\n options?: { gfm?: boolean },\n ) => { html: string; errors: string[] };\n\n /**\n * Full-featured Markdown transformation pipeline.\n * Handles frontmatter extraction, TOC generation, and advanced parsing.\n *\n * @param source - Raw Markdown content (may include frontmatter)\n * @param options - Comprehensive transformation options\n * @returns Transformed result with HTML, metadata, and TOC\n */\n transform: (\n source: string,\n options?: JsTransformOptions,\n ) => {\n html: string;\n frontmatter: string;\n toc: { depth: number; text: string; slug: string }[];\n errors: string[];\n };\n\n /**\n * Generates an OG image as SVG.\n *\n * @param data - OG image data (title, description, etc.)\n * @param config - Optional OG image configuration\n * @returns SVG string\n */\n generateOgImageSvg: (data: OgImageData, config?: OgImageConfig) => string;\n}\n\n/**\n * OG image data for generating social media preview images.\n */\nexport interface OgImageData {\n /** Page title */\n title: string;\n /** Page description */\n description?: string;\n /** Site name */\n siteName?: string;\n /** Author name */\n author?: string;\n}\n\n/**\n * OG image configuration.\n */\nexport interface OgImageConfig {\n /** Image width in pixels */\n width?: number;\n /** Image height in pixels */\n height?: number;\n /** Background color (hex) */\n backgroundColor?: string;\n /** Text color (hex) */\n textColor?: string;\n /** Title font size */\n titleFontSize?: number;\n /** Description font size */\n descriptionFontSize?: number;\n}\n\n/**\n * Options for Rust-based Markdown transformation.\n *\n * Controls which Markdown extensions and features are enabled\n * during parsing and rendering.\n */\ninterface JsTransformOptions {\n /**\n * Enable GitHub Flavored Markdown extensions.\n * Includes tables, task lists, strikethrough, and autolinks.\n * @default false\n */\n gfm?: boolean;\n\n /**\n * Enable footnotes syntax ([^1]: definition).\n * @default false\n */\n footnotes?: boolean;\n\n /**\n * Enable task list syntax (- [ ] unchecked, - [x] checked).\n * @default false\n */\n taskLists?: boolean;\n\n /**\n * Enable table rendering (GFM extension).\n * Requires GFM to be enabled for full functionality.\n * @default false\n */\n tables?: boolean;\n\n /**\n * Enable strikethrough syntax (~~text~~).\n * Requires GFM to be enabled.\n * @default false\n */\n strikethrough?: boolean;\n\n /**\n * Enable automatic link conversion (URLs become clickable).\n * @default false\n */\n autolinks?: boolean;\n\n /**\n * Maximum heading depth for table of contents.\n * Headings deeper than this level are excluded from TOC.\n * @default 3\n * @min 1\n * @max 6\n */\n tocMaxDepth?: number;\n\n /**\n * Convert `.md` links to `.html` links for SSG output.\n * @default false\n */\n convertMdLinks?: boolean;\n\n /**\n * Base URL for absolute link conversion (e.g., \"/\" or \"/docs/\").\n * @default \"/\"\n */\n baseUrl?: string;\n\n /**\n * Source file path for relative link resolution.\n * Used to determine if the current file is an index file.\n */\n sourcePath?: string;\n}\n\n/**\n * Cached NAPI bindings instance.\n * Loaded on first use and reused for subsequent transformations.\n * @internal\n */\nlet napiBindings: NapiBindings | null | undefined;\n\n/**\n * Flag to prevent repeated NAPI loading attempts.\n * Set to true after first load attempt (success or failure).\n * @internal\n */\nlet napiLoadAttempted = false;\n\n/**\n * Lazily loads and caches NAPI bindings.\n *\n * This function uses lazy loading to defer the import of NAPI bindings\n * until they're actually needed. The bindings are loaded only once and\n * cached for subsequent uses. If loading fails (e.g., bindings not built),\n * the failure is cached to avoid repeated load attempts.\n *\n * ## Performance Considerations\n *\n * The first call to this function may have a slight performance penalty\n * due to module loading. Subsequent calls use the cached result and are\n * essentially zero-cost.\n *\n * ## Error Handling\n *\n * If NAPI bindings are not available (not built, wrong architecture, etc.),\n * this function returns `null`. The caller should handle this gracefully\n * or provide fallback behavior.\n *\n * @returns Promise resolving to NAPI bindings or null if unavailable\n *\n * @example\n * ```typescript\n * // Simple check with fallback\n * const napi = await loadNapiBindings();\n * if (!napi) {\n * console.warn('NAPI bindings not available, using fallback');\n * return fallbackRender(content);\n * }\n *\n * // Use Rust implementation\n * const result = napi.transform(content, { gfm: true });\n * ```\n *\n * @internal\n */\nasync function loadNapiBindings(): Promise<NapiBindings | null> {\n // Return cached result (success or failure)\n if (napiLoadAttempted) {\n return napiBindings ?? null;\n }\n\n // Mark attempt as made to prevent retry loops\n napiLoadAttempted = true;\n\n try {\n // Dynamic import to handle cases where NAPI isn't built\n const mod = await import(\"@ox-content/napi\");\n napiBindings = mod;\n return mod;\n } catch (error) {\n // NAPI not available (not built, missing dependencies, etc.)\n // Log for debugging but don't throw - allow graceful degradation\n if (process.env.DEBUG) {\n console.debug(\"[ox-content] NAPI bindings load failed:\", error);\n }\n napiBindings = null;\n return null;\n }\n}\n\n/**\n * Transforms Markdown content into a JavaScript module.\n *\n * This is the primary entry point for transforming Markdown files. It handles\n * the complete transformation pipeline including parsing, rendering, syntax\n * highlighting, and code generation.\n *\n * ## Pipeline Steps\n *\n * 1. **Parse & Render**: Uses Rust-based parser via NAPI for high performance\n * 2. **Extract Metadata**: Parses YAML frontmatter and generates table of contents\n * 3. **Enhance HTML**: Applies syntax highlighting and Mermaid diagram rendering\n * 4. **Generate Code**: Creates importable JavaScript module\n *\n * ## Generated Module Exports\n *\n * - `html` (string): Rendered HTML content with all enhancements applied\n * - `frontmatter` (object): Parsed YAML frontmatter as JavaScript object\n * - `toc` (array): Hierarchical table of contents entries\n * - `render` (function): Client-side render function for dynamic updates\n *\n * ## Markdown Features Supported\n *\n * The supported features depend on parser options:\n * - **Commonmark**: Headings, paragraphs, lists, code blocks, links, images\n * - **GFM Extensions**: Tables, task lists, strikethrough, autolinks\n * - **Enhancements**: Syntax highlighting, Mermaid diagrams, TOC generation\n * - **Metadata**: YAML frontmatter parsing\n *\n * ## Performance\n *\n * Uses Rust-based parsing via NAPI bindings for optimal performance. Falls back\n * gracefully if Rust bindings are unavailable.\n *\n * @param source - Raw Markdown source code (may include YAML frontmatter)\n * @param filePath - File path for source attribution and relative link resolution\n * @param options - Resolved plugin options controlling transformation behavior\n *\n * @returns Promise resolving to transformation result with HTML and metadata\n *\n * @throws Error if NAPI bindings are unavailable (can be handled gracefully)\n *\n * @example\n * ```typescript\n * import { transformMarkdown } from './transform';\n * import { resolveOptions } from './index';\n *\n * // Transform a Markdown file with YAML frontmatter\n * const markdown = `---\n * title: Getting Started\n * author: john\n * ---\n *\n * # Getting Started\n *\n * Welcome! This guide explains [transformMarkdown] function.\n *\n * ## Installation\n *\n * \\`\\`\\`bash\n * npm install @ox-content/vite-plugin\n * \\`\\`\\`\n * `;\n *\n * const options = resolveOptions({\n * highlight: true,\n * highlightTheme: 'github-dark',\n * toc: true,\n * gfm: true,\n * mermaid: true,\n * });\n *\n * const result = await transformMarkdown(markdown, 'docs/getting-started.md', options);\n *\n * // Generated module exports\n * console.log(result.html); // Rendered HTML with syntax highlighting\n * console.log(result.frontmatter); // { title: 'Getting Started', author: 'john' }\n * console.log(result.toc); // [{ depth: 1, text: 'Getting Started', ... }]\n * console.log(result.code); // ES module export statement\n * ```\n */\n/**\n * SSG-specific transform options.\n */\nexport interface SsgTransformOptions {\n /** Convert `.md` links to `.html` links */\n convertMdLinks?: boolean;\n /** Base URL for absolute link conversion */\n baseUrl?: string;\n /** Source file path for relative link resolution */\n sourcePath?: string;\n}\n\nexport async function transformMarkdown(\n source: string,\n filePath: string,\n options: ResolvedOptions,\n ssgOptions?: SsgTransformOptions,\n): Promise<TransformResult> {\n const napi = await loadNapiBindings();\n\n if (!napi) {\n throw new Error(\n \"[ox-content] NAPI bindings not available. Please ensure @ox-content/napi is built.\",\n );\n }\n\n // Parse frontmatter using YAML on TypeScript side for proper nested object support\n const { content: markdownContent, frontmatter } = parseFrontmatter(source);\n\n // Use Rust-based transformation (pass content without frontmatter)\n const result = napi.transform(markdownContent, {\n gfm: options.gfm,\n footnotes: options.footnotes,\n taskLists: options.taskLists,\n tables: options.tables,\n strikethrough: options.strikethrough,\n tocMaxDepth: options.tocMaxDepth,\n convertMdLinks: ssgOptions?.convertMdLinks,\n baseUrl: ssgOptions?.baseUrl,\n sourcePath: ssgOptions?.sourcePath ?? filePath,\n });\n\n if (result.errors.length > 0) {\n console.warn(\"[ox-content] Transform warnings:\", result.errors);\n }\n\n let html = result.html;\n\n // Convert flat TOC from Rust to nested TOC\n const flatToc: TocEntry[] = result.toc.map((item) => ({\n ...item,\n children: [],\n }));\n const toc = options.toc ? buildTocTree(flatToc) : [];\n\n // Transform mermaid diagrams before highlighting to avoid entity re-encoding\n if (options.mermaid) {\n html = await transformMermaidStatic(html);\n }\n\n // Protect mermaid SVGs from rehype processing (which corrupts <br /> in foreignObjects)\n const { html: protectedHtml, svgs } = protectMermaidSvgs(html);\n html = protectedHtml;\n\n // Apply syntax highlighting if enabled\n if (options.highlight) {\n html = await highlightCode(html, options.highlightTheme, options.highlightLangs);\n }\n\n // Restore protected SVGs\n html = restoreMermaidSvgs(html, svgs);\n\n // Generate JavaScript module code\n const code = generateModuleCode(html, frontmatter, toc, filePath, options);\n\n return {\n code,\n html,\n frontmatter,\n toc,\n };\n}\n\n/**\n * Parses YAML frontmatter from Markdown content.\n * Uses proper YAML parser for full nested object support.\n */\nfunction parseFrontmatter(source: string): {\n content: string;\n frontmatter: Record<string, unknown>;\n} {\n // Check for frontmatter delimiter\n if (!source.startsWith(\"---\")) {\n return { content: source, frontmatter: {} };\n }\n\n // Find the closing delimiter\n const rest = source.slice(3);\n const endIndex = rest.indexOf(\"\\n---\");\n\n if (endIndex === -1) {\n return { content: source, frontmatter: {} };\n }\n\n const frontmatterStr = rest.slice(0, endIndex).trim();\n const content = rest.slice(endIndex + 4).trimStart();\n\n try {\n const frontmatter = YAML.parse(frontmatterStr) as Record<string, unknown>;\n return { content, frontmatter: frontmatter || {} };\n } catch (error) {\n console.warn(\"[ox-content] Failed to parse frontmatter:\", error);\n return { content, frontmatter: {} };\n }\n}\n\n/**\n * Builds nested TOC tree from flat list.\n */\nfunction buildTocTree(entries: TocEntry[]): TocEntry[] {\n const root: TocEntry[] = [];\n const stack: TocEntry[] = [];\n\n for (const entry of entries) {\n // Pop stack until we find a parent with smaller depth\n while (stack.length > 0 && stack[stack.length - 1].depth >= entry.depth) {\n stack.pop();\n }\n\n if (stack.length === 0) {\n root.push(entry);\n } else {\n stack[stack.length - 1].children.push(entry);\n }\n\n stack.push(entry);\n }\n\n return root;\n}\n\n/**\n * Generates the JavaScript module code.\n */\nfunction generateModuleCode(\n html: string,\n frontmatter: Record<string, unknown>,\n toc: TocEntry[],\n filePath: string,\n _options: ResolvedOptions,\n): string {\n const htmlJson = JSON.stringify(html);\n const frontmatterJson = JSON.stringify(frontmatter);\n const tocJson = JSON.stringify(toc);\n\n return `\n// Generated by @ox-content/vite-plugin\n// Source: ${filePath}\n\n/**\n * Rendered HTML content.\n */\nexport const html = ${htmlJson};\n\n/**\n * Parsed frontmatter.\n */\nexport const frontmatter = ${frontmatterJson};\n\n/**\n * Table of contents.\n */\nexport const toc = ${tocJson};\n\n/**\n * Default export with all data.\n */\nexport default {\n html,\n frontmatter,\n toc,\n};\n\n// HMR support\nif (import.meta.hot) {\n import.meta.hot.accept((newModule) => {\n if (newModule) {\n // Trigger re-render with new content\n import.meta.hot.invalidate();\n }\n });\n}\n`;\n}\n\n/**\n * Extracts imports from Markdown content.\n *\n * Supports importing components for interactive islands.\n */\nexport function extractImports(content: string): string[] {\n const importRegex = /^import\\s+.+\\s+from\\s+['\"](.+)['\"]/gm;\n const imports: string[] = [];\n let match;\n\n while ((match = importRegex.exec(content)) !== null) {\n imports.push(match[1]);\n }\n\n return imports;\n}\n\n/**\n * Generates an OG image SVG using the Rust-based generator.\n *\n * This function uses the Rust NAPI bindings to generate SVG-based\n * OG images for social media previews. The SVG can be served directly\n * or converted to PNG/JPEG for broader compatibility.\n *\n * In the future, custom JS templates can be provided to override\n * the default Rust-based template.\n *\n * @param data - OG image data (title, description, etc.)\n * @param config - Optional OG image configuration\n * @returns SVG string or null if NAPI bindings are unavailable\n */\nexport async function generateOgImageSvg(\n data: OgImageData,\n config?: OgImageConfig,\n): Promise<string | null> {\n const napi = await loadNapiBindings();\n if (!napi) {\n return null;\n }\n\n // Convert config to NAPI format (camelCase to snake_case)\n const napiConfig = config\n ? {\n width: config.width,\n height: config.height,\n backgroundColor: config.backgroundColor,\n textColor: config.textColor,\n titleFontSize: config.titleFontSize,\n descriptionFontSize: config.descriptionFontSize,\n }\n : undefined;\n\n return napi.generateOgImageSvg(data, napiConfig);\n}\n","/**\n * Navigation Metadata Generator for API Documentation\n *\n * This module provides utilities for generating sidebar navigation structures\n * from extracted documentation. It automatically:\n *\n * - **Extracts file information**: Gets display names and file paths\n * - **Formats names**: Converts technical names to readable titles\n * - **Generates TypeScript**: Creates importable nav.ts files\n * - **Maintains hierarchy**: Supports nested navigation structures\n *\n * ## Generated Navigation Format\n *\n * The generated navigation is TypeScript-based for type safety and IDE support:\n *\n * ```typescript\n * export const apiNav: NavItem[] = [\n * { title: 'Overview', path: '/api/index' },\n * { title: 'Transform', path: '/api/transform' },\n * { title: 'Types', path: '/api/types' },\n * // ... auto-generated from documentation\n * ] as const;\n * ```\n *\n * ## Integration\n *\n * The generated nav.ts file can be imported directly:\n *\n * ```typescript\n * // In your Vue/React component\n * import { apiNav } from '../api/nav';\n *\n * const apiItems = apiNav.map(item => ({\n * ...item,\n * file: () => import(`../api/${item.path.split('/').pop()}.md`)\n * }));\n * ```\n *\n * @example\n * ```typescript\n * import { generateNavMetadata, generateNavCode } from './nav-generator';\n *\n * const extracted = [\n * { file: 'transform.ts', entries: [...] },\n * { file: 'types.ts', entries: [...] },\n * ];\n *\n * const navItems = generateNavMetadata(extracted);\n * // => [\n * // { title: 'Transform', path: '/api/transform' },\n * // { title: 'Types', path: '/api/types' },\n * // ]\n *\n * const code = generateNavCode(navItems);\n * // => TypeScript code ready to write to nav.ts\n * ```\n */\n\nimport path from \"path\";\nimport type { ExtractedDocs, NavItem } from \"./types\";\n\n/**\n * Generates sidebar navigation metadata from extracted documentation.\n *\n * Takes an array of extracted documentation and produces a flat navigation\n * structure suitable for sidebar menus. Items are:\n * - Sorted alphabetically by display name\n * - Formatted with readable titles\n * - Prefixed with the specified base path\n *\n * ## Naming Conventions\n *\n * - `transform.ts` → `{ title: 'Transform', path: '/api/transform' }`\n * - `nav-generator.ts` → `{ title: 'Nav Generator', path: '/api/nav-generator' }`\n * - `index.ts` or `index-module.ts` → `{ title: 'Overview', path: '/api/index' }`\n * - `types.ts` → `{ title: 'Types', path: '/api/types' }`\n *\n * ## Sorting\n *\n * Items are sorted alphabetically by display title for consistent ordering.\n * Special item 'Overview' sorts naturally with others (O comes after most letters).\n *\n * ## Path Generation\n *\n * The generated paths are used to import corresponding Markdown files:\n * - Path `/api/transform` → Import from `../api/transform.md`\n * - Path `/api/index` → Import from `../api/index.md`\n *\n * @param docs - Array of extracted documentation (file + entries)\n * @param basePath - Base path prefix for navigation URLs (default: '/api')\n * Use '/api' for main API docs, '/helpers' for utilities, etc.\n *\n * @returns Array of navigation items ready to use or export to TypeScript\n *\n * @example\n * ```typescript\n * const navItems = generateNavMetadata(\n * [\n * { file: 'transform.ts', entries: [...] },\n * { file: 'docs.ts', entries: [...] },\n * { file: 'types.ts', entries: [...] },\n * ],\n * '/api'\n * );\n *\n * // Returns:\n * // [\n * // { title: 'Docs', path: '/api/docs' },\n * // { title: 'Transform', path: '/api/transform' },\n * // { title: 'Types', path: '/api/types' },\n * // ]\n * ```\n *\n * @see generateNavCode For converting these items to TypeScript code\n */\nexport function generateNavMetadata(docs: ExtractedDocs[], basePath: string = \"/api\"): NavItem[] {\n // Sort docs by filename for consistent ordering\n const sortedDocs = [...docs].sort((a, b) => {\n const aName = getDocDisplayName(a.file);\n const bName = getDocDisplayName(b.file);\n return aName.localeCompare(bName);\n });\n\n return sortedDocs.map((doc) => ({\n title: getDocDisplayName(doc.file),\n path: `${basePath}/${getDocFileName(doc.file)}`,\n }));\n}\n\n/**\n * Gets the human-readable display name for a documentation file.\n *\n * Transforms file paths and names into proper title case:\n * - Extracts base name (e.g., 'transform.ts' → 'transform')\n * - Converts kebab-case to Title Case (e.g., 'nav-generator' → 'Nav Generator')\n * - Converts camelCase to Title Case (e.g., 'transformMarkdown' → 'Transform Markdown')\n * - Handles special cases (index → 'Overview')\n *\n * ## Examples\n *\n * - `'/path/to/transform.ts'` → `'Transform'`\n * - `'nav-generator.ts'` → `'Nav Generator'`\n * - `'index.ts'` → `'Overview'`\n * - `'index-module.ts'` → `'Overview'`\n * - `'myFunction.ts'` → `'My Function'` (with camelCase handling)\n *\n * @param filePath - Full or relative file path\n * @returns Formatted display name suitable for UI labels\n *\n * @internal\n */\nfunction getDocDisplayName(filePath: string): string {\n const fileName = path.basename(filePath, path.extname(filePath));\n\n // Handle special cases\n if (fileName === \"index\" || fileName === \"index-module\") {\n return \"Overview\";\n }\n\n // Convert kebab-case and snake_case to Title Case\n // Also handles camelCase transitions\n return fileName\n .replace(/[-_]([a-z])/g, (_, char) => \" \" + char.toUpperCase())\n .replace(/^[a-z]/, (char) => char.toUpperCase());\n}\n\n/**\n * Gets the file name (without extension) for use in navigation paths.\n *\n * This handles filename conflicts that may occur during generation:\n * - Preserves most names as-is\n * - Special handling for index files to maintain consistency\n *\n * @param filePath - Source file path\n * @returns File name without extension, ready for URL paths\n *\n * @internal\n */\nfunction getDocFileName(filePath: string): string {\n const fileName = path.basename(filePath, path.extname(filePath));\n\n // Handle filename conflicts\n // The docs generator renames 'index' to 'index-module' to avoid conflicts\n if (fileName === \"index\") {\n return \"index\";\n }\n\n return fileName;\n}\n\n/**\n * Generates TypeScript code for navigation metadata export.\n *\n * Creates a complete, self-contained TypeScript file that:\n * - Defines the NavItem interface\n * - Exports navigation items as a const\n * - Uses `as const` for type-safe literal types\n * - Includes auto-generation notice\n *\n * The generated code is production-ready and suitable for direct import\n * in Vue, React, or vanilla TypeScript applications.\n *\n * ## Generated Code Example\n *\n * ```typescript\n * export interface NavItem {\n * title: string;\n * path: string;\n * children?: NavItem[];\n * }\n *\n * export const apiNav: NavItem[] = [\n * { \"title\": \"Docs\", \"path\": \"/api/docs\" },\n * { \"title\": \"Transform\", \"path\": \"/api/transform\" },\n * // ...\n * ] as const;\n * ```\n *\n * ## Features\n *\n * - **Type Safety**: Includes NavItem interface definition\n * - **Readonly**: Uses `as const` to ensure immutability\n * - **IDE Support**: Full IntelliSense and autocomplete\n * - **Self-Documenting**: Includes notice that file is auto-generated\n *\n * @param navItems - Array of navigation items to export\n * @param exportName - Name of the exported const (default: 'apiNav')\n * Use custom names for different navigation sections\n *\n * @returns Complete TypeScript source code as string,\n * ready to write to a .ts file\n *\n * @example\n * ```typescript\n * const navItems = [\n * { title: 'Home', path: '/api/index' },\n * { title: 'Transform', path: '/api/transform' },\n * ];\n *\n * const code = generateNavCode(navItems, 'apiNav');\n * await fs.promises.writeFile('docs/api/nav.ts', code, 'utf-8');\n * ```\n *\n * @see generateNavMetadata For generating NavItem arrays from extracted docs\n */\nexport function generateNavCode(navItems: NavItem[], exportName: string = \"apiNav\"): string {\n const json = JSON.stringify(navItems, null, 2);\n return `/**\n * Auto-generated API documentation navigation.\n * This file is automatically generated by the docs plugin.\n * Do not edit manually.\n */\n\nexport interface NavItem {\n title: string;\n path: string;\n children?: NavItem[];\n}\n\nexport const ${exportName}: NavItem[] = ${json} as const;\n`;\n}\n","/**\n * Source Documentation Extraction and Generation\n *\n * This module provides comprehensive tools for extracting JSDoc/TSDoc comments\n * from TypeScript/JavaScript source files and automatically generating Markdown\n * documentation.\n *\n * ## Features\n *\n * - **Automatic Extraction**: Parses JSDoc comments from functions, classes, interfaces, and types\n * - **Flexible Filtering**: Include/exclude patterns for selective documentation\n * - **Markdown Generation**: Converts extracted docs to organized Markdown files\n * - **Navigation Generation**: Auto-generates sidebar navigation metadata\n * - **GitHub Links**: Includes clickable links to source code on GitHub\n *\n * ## Supported JSDoc Tags\n *\n * - `@param {type} name - description` - Function parameter documentation\n * - `@returns {type} description` - Return value documentation\n * - `@example` - Code examples (multi-line blocks)\n * - `@private` - Mark item as private (excluded from docs if private=false)\n * - `@default value` - Default parameter value\n * - Custom tags are preserved in the `tags` field\n *\n * ## Usage Flow\n *\n * 1. Call `extractDocs()` to parse source files\n * 2. Call `generateMarkdown()` to create Markdown content\n * 3. Call `writeDocs()` to write files to output directory\n * 4. Generated nav.ts can be imported for sidebar navigation\n *\n * @example\n * ```typescript\n * import { extractDocs, generateMarkdown, writeDocs } from './docs';\n *\n * const docsOptions = {\n * enabled: true,\n * src: ['./src'],\n * out: './docs/api',\n * include: ['**\\/*.ts'],\n * exclude: ['**\\/*.test.ts'],\n * groupBy: 'file',\n * githubUrl: 'https://github.com/user/project',\n * };\n *\n * const extracted = await extractDocs(['./src'], docsOptions);\n * const markdown = generateMarkdown(extracted, docsOptions);\n * await writeDocs(markdown, './docs/api', extracted, docsOptions);\n * ```\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { ResolvedDocsOptions, ExtractedDocs, DocEntry, ParamDoc } from \"./types\";\nimport { generateNavMetadata, generateNavCode } from \"./nav-generator\";\n/**\n * Regex pattern for matching JSDoc comment blocks.\n *\n * Matches block comments that start at the beginning of a line\n * (with optional leading whitespace). This pattern avoids false matches\n * with block comments inside strings like glob patterns.\n *\n * @internal\n */\nconst JSDOC_BLOCK = /^[ \\t]*\\/\\*\\*\\s*([\\s\\S]*?)\\s*\\*\\//gm;\n\n/**\n * Regex pattern for matching function declarations.\n * Matches: `function name`, `export function name`, `async function name`\n * @internal\n */\nconst _FUNCTION_DECL = /(?:export\\s+)?(?:async\\s+)?function\\s+(\\w+)/;\n\n/**\n * Regex pattern for matching const arrow/async functions.\n * Matches: `const name = () => {}`, `const name = async () => {}`\n * @internal\n */\nconst _CONST_FUNC = /(?:export\\s+)?const\\s+(\\w+)\\s*=\\s*(?:async\\s*)?\\(/;\n\n/**\n * Regex pattern for matching class declarations.\n * Matches: `class Name`, `export class Name`\n * @internal\n */\nconst _CLASS_DECL = /(?:export\\s+)?class\\s+(\\w+)/;\n\n/**\n * Regex pattern for matching interface declarations.\n * Matches: `interface Name`, `export interface Name`\n * @internal\n */\nconst _INTERFACE_DECL = /(?:export\\s+)?interface\\s+(\\w+)/;\n\n/**\n * Regex pattern for matching type alias declarations.\n * Matches: `type Name = ...`, `export type Name = ...`\n * @internal\n */\nconst _TYPE_DECL = /(?:export\\s+)?type\\s+(\\w+)/;\n\n/**\n * Extracts JSDoc documentation from source files in specified directories.\n *\n * This function recursively searches directories for source files matching\n * the include/exclude patterns, then extracts all documented items (functions,\n * classes, interfaces, types) from those files.\n *\n * ## Process\n *\n * 1. **File Discovery**: Recursively walks directories, applying filters\n * 2. **File Reading**: Loads each matching file's content\n * 3. **JSDoc Extraction**: Parses JSDoc comments using regex patterns\n * 4. **Declaration Matching**: Pairs JSDoc comments with source declarations\n * 5. **Result Collection**: Aggregates extracted documentation by file\n *\n * ## Include/Exclude Patterns\n *\n * Patterns support:\n * - `**` - Match any directory structure\n * - `*` - Match any filename\n * - Standard glob patterns (e.g., `**\\/*.test.ts`)\n *\n * ## Performance Considerations\n *\n * - Uses filesystem I/O which can be slow for large codebases\n * - Consider using more specific include patterns to reduce file scanning\n * - Results are not cached; call once per build/dev session\n *\n * @param srcDirs - Array of source directory paths to scan\n * @param options - Documentation extraction options (filters, grouping, etc.)\n *\n * @returns Promise resolving to array of extracted documentation by file.\n * Each ExtractedDocs object contains file path and array of DocEntry items.\n *\n * @example\n * ```typescript\n * const docs = await extractDocs(\n * ['./packages/vite-plugin/src'],\n * {\n * enabled: true,\n * src: [],\n * out: 'docs',\n * include: ['**\\/*.ts'],\n * exclude: ['**\\/*.test.ts', '**\\/*.spec.ts'],\n * format: 'markdown',\n * private: false,\n * toc: true,\n * groupBy: 'file',\n * generateNav: true,\n * }\n * );\n *\n * // Returns:\n * // [\n * // {\n * // file: '/path/to/transform.ts',\n * // entries: [\n * // { name: 'transformMarkdown', kind: 'function', ... },\n * // { name: 'loadNapiBindings', kind: 'function', ... },\n * // ]\n * // },\n * // ...\n * // ]\n * ```\n */\nexport async function extractDocs(\n srcDirs: string[],\n options: ResolvedDocsOptions,\n): Promise<ExtractedDocs[]> {\n const results: ExtractedDocs[] = [];\n\n for (const srcDir of srcDirs) {\n const files = await findFiles(srcDir, options);\n\n for (const file of files) {\n const content = await fs.promises.readFile(file, \"utf-8\");\n const entries = extractFromContent(content, file, options);\n\n if (entries.length > 0) {\n results.push({ file, entries });\n }\n }\n }\n\n return results;\n}\n\n/**\n * Recursively finds all source files matching include/exclude patterns.\n *\n * @internal\n */\nasync function findFiles(dir: string, options: ResolvedDocsOptions): Promise<string[]> {\n const files: string[] = [];\n\n async function walk(currentDir: string) {\n let entries;\n try {\n entries = await fs.promises.readdir(currentDir, { withFileTypes: true });\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = path.join(currentDir, entry.name);\n\n if (entry.isDirectory()) {\n if (!isExcluded(fullPath, options.exclude)) {\n await walk(fullPath);\n }\n } else if (entry.isFile()) {\n if (isIncluded(fullPath, options.include) && !isExcluded(fullPath, options.exclude)) {\n files.push(fullPath);\n }\n }\n }\n }\n\n await walk(dir);\n return files;\n}\n\nfunction isIncluded(file: string, patterns: string[]): boolean {\n return patterns.some((pattern) => {\n if (pattern.includes(\"**\")) {\n const ext = pattern.split(\".\").pop();\n return file.endsWith(`.${ext}`);\n }\n return file.endsWith(pattern.replace(\"*\", \"\"));\n });\n}\n\nfunction isExcluded(file: string, patterns: string[]): boolean {\n return patterns.some((pattern) => {\n if (pattern.includes(\"node_modules\")) {\n return file.includes(\"node_modules\");\n }\n if (pattern.includes(\".test.\") || pattern.includes(\".spec.\")) {\n return file.includes(\".test.\") || file.includes(\".spec.\");\n }\n return false;\n });\n}\n\n/**\n * Extracts documentation entries from file content.\n */\nfunction extractFromContent(\n content: string,\n file: string,\n options: ResolvedDocsOptions,\n): DocEntry[] {\n const entries: DocEntry[] = [];\n\n let match: RegExpExecArray | null;\n JSDOC_BLOCK.lastIndex = 0;\n\n while ((match = JSDOC_BLOCK.exec(content)) !== null) {\n const jsdocContent = match[1];\n const jsdocEnd = match.index + match[0].length;\n\n const afterJsdoc = content.slice(jsdocEnd).trim();\n const lineNumber = content.slice(0, match.index).split(\"\\n\").length;\n\n const entry = parseJsdocBlock(jsdocContent, afterJsdoc, file, lineNumber);\n\n if (entry && (options.private || !entry.private)) {\n entries.push(entry);\n }\n }\n\n return entries;\n}\n\n/**\n * Extracts the complete function signature for display.\n *\n * Captures the full function declaration from `export/async/function name(...): ReturnType`\n * or `export const name = (...): ReturnType => {}`, handling multi-line signatures.\n *\n * @param signature - Multi-line function declaration text\n * @returns Cleaned function signature or undefined if not found\n *\n * @internal\n */\nfunction extractFunctionSignature(signature: string): string | undefined {\n // Match function declarations: export/async function, export const, etc.\n // Capture everything from the start until the opening brace or arrow\n const match = signature.match(\n /(?:export\\s+)?(?:async\\s+)?(?:function\\s+\\w+|\\w+\\s*=\\s*(?:async\\s*)?\\()\\([^{]*?\\)(?:\\s*:\\s*[^{;]+)?/s,\n );\n\n if (match) {\n let sig = match[0].trim();\n // Clean up excessive whitespace while preserving structure\n // Replace multiple spaces with single space, but keep newlines in readable format\n sig = sig\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line)\n .join(\"\\n \");\n return sig;\n }\n\n return undefined;\n}\n\n/**\n * Extracts parameter and return types from a TypeScript function signature.\n *\n * Parses function signatures to extract:\n * - Parameter names and their type annotations\n * - Return type annotation\n *\n * Handles various function declaration styles:\n * - `function name(param: type): ReturnType`\n * - `const name = (param: type): ReturnType => {}`\n * - `export async function name(param: type): Promise<ReturnType>`\n *\n * @param signature - Multi-line function signature text\n * @param params - Array of parameter docs with names already extracted\n * @returns Object with extracted parameter types and return type\n *\n * @internal\n */\nfunction extractTypesFromSignature(\n signature: string,\n _params: ParamDoc[],\n): { paramTypes: string[]; returnType?: string } {\n const paramTypes: string[] = [];\n\n // Extract the parameter list from the signature\n // Match everything between the first `(` and the closing `)` before `=>` or `{`\n const paramListMatch = signature.match(/\\(([^)]*)\\)(?:\\s*:\\s*([^{=>]+))?/s);\n\n if (paramListMatch && paramListMatch[1]) {\n const paramListStr = paramListMatch[1];\n\n // Split by comma, but be careful about nested generics\n const paramParts = splitParameters(paramListStr);\n\n for (const part of paramParts) {\n const trimmed = part.trim();\n if (!trimmed) continue;\n\n // Extract type from \"name: type\" or \"name: type = default\"\n // Handle nested generics properly\n const typeMatch = /:\\s*(.+?)(?:\\s*=|$)/.exec(trimmed);\n if (typeMatch) {\n let typeStr = typeMatch[1].trim();\n // Remove trailing equals and everything after it (default value)\n if (typeStr.includes(\"=\")) {\n typeStr = typeStr.split(\"=\")[0].trim();\n }\n paramTypes.push(typeStr);\n }\n }\n }\n\n // Extract return type\n let returnType: string | undefined;\n\n // Look for return type annotation `: Type` or `: Promise<Type>`\n // This comes after the closing parenthesis\n // Need to handle nested angle brackets in generics\n const returnTypeMatch = signature.match(/\\)\\s*:\\s*(.+?)(?={|$)/);\n if (returnTypeMatch) {\n returnType = returnTypeMatch[1].trim();\n }\n\n return {\n paramTypes,\n returnType,\n };\n}\n\n/**\n * Splits function parameters while respecting nested angle brackets (generics).\n *\n * Handles cases like:\n * - `a: string, b: number` → `[\"a: string\", \"b: number\"]`\n * - `a: Promise<string>, b: Record<string, any>` → `[\"a: Promise<string>\", \"b: Record<string, any>\"]`\n *\n * @param paramListStr - String containing all parameters\n * @returns Array of individual parameter strings\n *\n * @internal\n */\nfunction splitParameters(paramListStr: string): string[] {\n const parts: string[] = [];\n let current = \"\";\n let depth = 0; // Track nested angle brackets\n\n for (const char of paramListStr) {\n if (char === \"<\") {\n depth++;\n current += char;\n } else if (char === \">\") {\n depth--;\n current += char;\n } else if (char === \",\" && depth === 0) {\n parts.push(current);\n current = \"\";\n } else {\n current += char;\n }\n }\n\n if (current) {\n parts.push(current);\n }\n\n return parts;\n}\n\n/**\n * Parses a JSDoc block and the following declaration.\n * Only matches if the declaration is immediately after the JSDoc (with only whitespace/keywords between).\n */\nfunction parseJsdocBlock(\n jsdoc: string,\n declaration: string,\n file: string,\n line: number,\n): DocEntry | null {\n const params: ParamDoc[] = [];\n const examples: string[] = [];\n const tags: Record<string, string> = {};\n let description = \"\";\n let returns: { type: string; description: string } | undefined;\n let isPrivate = false;\n\n // Split lines and remove JSDoc markers but preserve indentation for code examples\n const rawLines = jsdoc.split(\"\\n\").map((l) => l.replace(/^\\s*\\*\\s?/, \"\"));\n const cleanedLines = rawLines.map((l) => l.trim()).filter((l) => l);\n\n let currentExample = \"\";\n let inExample = false;\n let rawLineIndex = 0;\n\n for (const lineText of cleanedLines) {\n // Find the corresponding raw line to get original indentation for examples\n while (rawLineIndex < rawLines.length && rawLines[rawLineIndex].trim() !== lineText) {\n rawLineIndex++;\n }\n const rawLine = rawLineIndex < rawLines.length ? rawLines[rawLineIndex] : lineText;\n rawLineIndex++;\n\n if (lineText.startsWith(\"@\")) {\n if (inExample) {\n examples.push(currentExample.trim());\n currentExample = \"\";\n inExample = false;\n }\n\n const tagMatch = /@(\\w+)\\s*(?:\\{([^}]*)\\})?(.*)/.exec(lineText);\n if (tagMatch) {\n const [, tagName, tagType, tagRest] = tagMatch;\n\n switch (tagName) {\n case \"param\":\n const paramMatch = /(\\w+)\\s*-?\\s*(.*)/.exec(tagRest.trim());\n if (paramMatch) {\n params.push({\n name: paramMatch[1],\n type: tagType || \"unknown\",\n description: paramMatch[2],\n });\n }\n break;\n case \"returns\":\n case \"return\":\n returns = {\n type: tagType || \"unknown\",\n description: tagRest.trim(),\n };\n break;\n case \"example\":\n inExample = true;\n break;\n case \"private\":\n isPrivate = true;\n break;\n default:\n tags[tagName] = tagRest.trim();\n }\n }\n } else if (inExample) {\n // Use raw line to preserve indentation in code examples\n currentExample += rawLine + \"\\n\";\n } else if (!description) {\n description = lineText;\n } else {\n description += \"\\n\" + lineText;\n }\n }\n\n if (inExample && currentExample) {\n examples.push(currentExample.trim());\n }\n\n // Only look at the first few lines after the JSDoc to find the declaration\n // This prevents module-level JSDoc from matching distant declarations\n const firstFewLines = declaration.split(\"\\n\").slice(0, 5).join(\"\\n\");\n\n let name = \"\";\n let kind: DocEntry[\"kind\"] = \"function\";\n\n // Use anchored patterns to match at the start (after optional whitespace/keywords)\n const ANCHORED_FUNCTION = /^(?:export\\s+)?(?:async\\s+)?function\\s+(\\w+)/;\n const ANCHORED_CONST_FUNC = /^(?:export\\s+)?const\\s+(\\w+)\\s*=\\s*(?:async\\s*)?\\(/;\n const ANCHORED_CLASS = /^(?:export\\s+)?class\\s+(\\w+)/;\n const ANCHORED_INTERFACE = /^(?:export\\s+)?interface\\s+(\\w+)/;\n const ANCHORED_TYPE = /^(?:export\\s+)?type\\s+(\\w+)/;\n\n let declMatch: RegExpExecArray | null;\n\n if ((declMatch = ANCHORED_FUNCTION.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"function\";\n } else if ((declMatch = ANCHORED_CONST_FUNC.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"function\";\n } else if ((declMatch = ANCHORED_CLASS.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"class\";\n } else if ((declMatch = ANCHORED_INTERFACE.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"interface\";\n } else if ((declMatch = ANCHORED_TYPE.exec(firstFewLines))) {\n name = declMatch[1];\n kind = \"type\";\n }\n\n if (!name) return null;\n\n // Extract full signature and types from function signature if needed\n let signature: string | undefined;\n if (kind === \"function\") {\n const signatureTypes = extractTypesFromSignature(firstFewLines, params);\n\n // Update params with extracted types if JSDoc types were missing\n if (signatureTypes.paramTypes.length > 0) {\n for (let i = 0; i < params.length && i < signatureTypes.paramTypes.length; i++) {\n if (params[i].type === \"unknown\") {\n params[i].type = signatureTypes.paramTypes[i];\n }\n }\n }\n\n // Update return type if JSDoc return type was missing\n if (signatureTypes.returnType && (!returns || returns.type === \"unknown\")) {\n if (returns) {\n returns.type = signatureTypes.returnType;\n } else {\n returns = {\n type: signatureTypes.returnType,\n description: \"\",\n };\n }\n }\n\n // Extract the complete function signature\n signature = extractFunctionSignature(firstFewLines);\n }\n\n return {\n name,\n kind,\n description,\n params: params.length > 0 ? params : undefined,\n returns,\n examples: examples.length > 0 ? examples : undefined,\n tags: Object.keys(tags).length > 0 ? tags : undefined,\n private: isPrivate,\n file,\n line,\n signature,\n };\n}\n\n/**\n * Generates Markdown documentation from extracted docs.\n */\nexport function generateMarkdown(\n docs: ExtractedDocs[],\n options: ResolvedDocsOptions,\n): Record<string, string> {\n const result: Record<string, string> = {};\n const symbolMap = buildSymbolMap(docs);\n\n if (options.groupBy === \"file\") {\n const docToFile = new Map<ExtractedDocs, string>();\n\n for (const doc of docs) {\n let fileName = path.basename(doc.file, path.extname(doc.file));\n // Avoid conflict with the main index.md\n if (fileName === \"index\") {\n fileName = \"index-module\";\n }\n docToFile.set(doc, fileName);\n\n const markdown = generateFileMarkdown(doc, options, fileName, symbolMap);\n result[`${fileName}.md`] = markdown;\n }\n\n result[\"index.md\"] = generateIndex(docs, docToFile);\n } else {\n const byKind = new Map<string, DocEntry[]>();\n\n for (const doc of docs) {\n for (const entry of doc.entries) {\n const existing = byKind.get(entry.kind) || [];\n existing.push(entry);\n byKind.set(entry.kind, existing);\n }\n }\n\n for (const [kind, entries] of byKind) {\n result[`${kind}s.md`] = generateCategoryMarkdown(kind, entries, options, symbolMap);\n }\n\n result[\"index.md\"] = generateCategoryIndex(byKind);\n }\n\n return result;\n}\n\nfunction generateFileMarkdown(\n doc: ExtractedDocs,\n options: ResolvedDocsOptions,\n currentFileName: string,\n symbolMap: Map<string, SymbolLocation>,\n): string {\n const displayName = path.basename(doc.file);\n let md = `# ${displayName}\\n\\n`;\n\n // Add source link if githubUrl is provided\n if (options.githubUrl) {\n const sourceLink = generateSourceLink(doc.file, options.githubUrl);\n if (sourceLink) {\n md += sourceLink + \"\\n\\n\";\n }\n }\n\n // Pass symbol map for cross-file link resolution\n for (const entry of doc.entries) {\n md += generateEntryMarkdown(entry, options, currentFileName, symbolMap);\n }\n\n return md;\n}\n\nfunction generateEntryMarkdown(\n entry: DocEntry,\n options?: ResolvedDocsOptions,\n currentFileName?: string,\n symbolMap?: Map<string, SymbolLocation>,\n): string {\n let md = `## ${entry.name}\\n\\n`;\n\n md += `\\`${entry.kind}\\`\\n\\n`;\n\n if (entry.description) {\n // Convert symbol links [SymbolName] to markdown links\n const processedDescription =\n currentFileName && symbolMap\n ? convertSymbolLinks(entry.description, currentFileName, symbolMap)\n : entry.description;\n md += `${processedDescription}\\n\\n`;\n }\n\n // Add source link if githubUrl is provided\n if (options?.githubUrl) {\n const sourceLink = generateSourceLink(entry.file, options.githubUrl, entry.line);\n if (sourceLink) {\n md += sourceLink + \"\\n\\n\";\n }\n }\n\n // Add function signature if available\n if (entry.signature && entry.kind === \"function\") {\n md += \"```typescript\\n\";\n md += entry.signature + \"\\n\";\n md += \"```\\n\\n\";\n }\n\n if (entry.params && entry.params.length > 0) {\n md += \"### Parameters\\n\\n\";\n md += \"| Name | Type | Description |\\n\";\n md += \"|------|------|-------------|\\n\";\n for (const param of entry.params) {\n md += `| \\`${param.name}\\` | \\`${param.type}\\` | ${param.description} |\\n`;\n }\n md += \"\\n\";\n }\n\n if (entry.returns) {\n md += \"### Returns\\n\\n\";\n md += `\\`${entry.returns.type}\\` - ${entry.returns.description}\\n\\n`;\n }\n\n if (entry.examples && entry.examples.length > 0) {\n md += \"### Examples\\n\\n\";\n for (const example of entry.examples) {\n md += \"```ts\\n\";\n md += example.replace(/^```\\w*\\n?/, \"\").replace(/\\n?```$/, \"\");\n md += \"\\n```\\n\\n\";\n }\n }\n\n md += \"---\\n\\n\";\n\n return md;\n}\n\nfunction generateIndex(docs: ExtractedDocs[], docToFile?: Map<ExtractedDocs, string>): string {\n let md = \"# API Documentation\\n\\n\";\n md += \"Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\\n\\n\";\n\n md += \"## Modules\\n\\n\";\n\n for (const doc of docs) {\n const displayName = path.basename(doc.file, path.extname(doc.file));\n let fileName = displayName;\n\n if (docToFile && docToFile.has(doc)) {\n fileName = docToFile.get(doc)!;\n } else if (fileName === \"index\") {\n fileName = \"index-module\";\n }\n\n md += `### [${displayName}](./${fileName}.md)\\n\\n`;\n\n for (const entry of doc.entries) {\n const desc = entry.description?.slice(0, 80) || \"\";\n const ellipsis = entry.description && entry.description.length > 80 ? \"...\" : \"\";\n md += `- \\`${entry.kind}\\` **${entry.name}** - ${desc}${ellipsis}\\n`;\n }\n md += \"\\n\";\n }\n\n return md;\n}\n\nfunction generateCategoryMarkdown(\n kind: string,\n entries: DocEntry[],\n options: ResolvedDocsOptions,\n symbolMap: Map<string, SymbolLocation>,\n): string {\n const categoryFileName = `${kind}s`;\n let md = `# ${kind.charAt(0).toUpperCase() + kind.slice(1)}s\\n\\n`;\n\n for (const entry of entries) {\n md += generateEntryMarkdown(entry, options, categoryFileName, symbolMap);\n }\n\n return md;\n}\n\nfunction generateCategoryIndex(byKind: Map<string, DocEntry[]>): string {\n let md = \"# API Documentation\\n\\n\";\n md += \"Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\\n\\n\";\n\n for (const [kind, entries] of byKind) {\n const kindTitle = kind.charAt(0).toUpperCase() + kind.slice(1) + \"s\";\n md += `## [${kindTitle}](./${kind}s.md)\\n\\n`;\n\n for (const entry of entries) {\n const desc = entry.description?.slice(0, 60) || \"\";\n md += `- **${entry.name}** - ${desc}...\\n`;\n }\n md += \"\\n\";\n }\n\n return md;\n}\n\n/**\n * Symbol location info for cross-file linking.\n */\ninterface SymbolLocation {\n name: string;\n file: string;\n fileName: string;\n}\n\n/**\n * Converts symbol links [SymbolName] to markdown links.\n *\n * Processes description text to convert cargo-docs-style symbol references\n * `[SymbolName]` into clickable markdown links pointing to the appropriate\n * documentation page.\n *\n * ## Examples\n *\n * Input: \"See [transformMarkdown] for usage\" (same file)\n * Output: \"See [transformMarkdown](#transformmarkdown) for usage\"\n *\n * Input: \"Uses [NavItem] interface\" (different file: types.ts)\n * Output: \"Uses [NavItem](./types.md#navitem) interface\"\n *\n * @param text - Description text containing symbol references\n * @param currentFileName - Current file name (without extension) for same-file detection\n * @param symbolMap - Map of symbol names to their file locations\n * @returns Text with symbol references converted to markdown links\n *\n * @internal\n */\nfunction convertSymbolLinks(\n text: string,\n currentFileName: string,\n symbolMap: Map<string, SymbolLocation>,\n): string {\n // Match [SymbolName] pattern where SymbolName starts with uppercase or underscore\n // Negative lookahead (?!\\() ensures we don't match [Name] that's already part of [Name](url)\n return text.replace(/\\[([A-Z_]\\w*)\\](?!\\()/g, (match, symbolName) => {\n const location = symbolMap.get(symbolName);\n if (!location) {\n // Symbol not found, keep original text\n return match;\n }\n\n if (location.fileName === currentFileName) {\n // Same file - use anchor only\n return `[${symbolName}](#${symbolName.toLowerCase()})`;\n } else {\n // Different file - use cross-file link\n return `[${symbolName}](./${location.fileName}.md#${symbolName.toLowerCase()})`;\n }\n });\n}\n\n/**\n * Builds a map of all symbols to their file locations.\n */\nfunction buildSymbolMap(docs: ExtractedDocs[]): Map<string, SymbolLocation> {\n const map = new Map<string, SymbolLocation>();\n\n for (const doc of docs) {\n let fileName = path.basename(doc.file, path.extname(doc.file));\n if (fileName === \"index\") {\n fileName = \"index-module\";\n }\n\n for (const entry of doc.entries) {\n map.set(entry.name, {\n name: entry.name,\n file: doc.file,\n fileName,\n });\n }\n }\n\n return map;\n}\n\n/**\n * Writes generated documentation to the output directory.\n */\nexport async function writeDocs(\n docs: Record<string, string>,\n outDir: string,\n extractedDocs?: ExtractedDocs[],\n options?: ResolvedDocsOptions,\n): Promise<void> {\n await fs.promises.mkdir(outDir, { recursive: true });\n\n for (const [fileName, content] of Object.entries(docs)) {\n const filePath = path.join(outDir, fileName);\n await fs.promises.writeFile(filePath, content, \"utf-8\");\n }\n\n // Generate and write navigation metadata if enabled\n if (extractedDocs && options?.generateNav && options.groupBy === \"file\") {\n const navItems = generateNavMetadata(extractedDocs, \"/api\");\n const navCode = generateNavCode(navItems, \"apiNav\");\n const navFilePath = path.join(outDir, \"nav.ts\");\n await fs.promises.writeFile(navFilePath, navCode, \"utf-8\");\n }\n}\n\n/**\n * Resolves docs options with defaults.\n */\n/**\n * Generates a GitHub source link for a file and optional line number.\n *\n * @param filePath - Full path to the source file\n * @param githubUrl - Base GitHub repository URL\n * @param lineNumber - Optional line number to link to\n * @returns Markdown link to source code\n */\nfunction generateSourceLink(filePath: string, githubUrl: string, lineNumber?: number): string {\n // Convert absolute path to relative path from repository root\n // Match common project directory patterns: npm/, packages/, crates/, src/\n const relativePath = filePath.replace(/^.*?\\/(npm|packages|crates|src)\\//, \"$1/\");\n\n const fragment = lineNumber ? `#L${lineNumber}` : \"\";\n const link = `${githubUrl}/blob/main/${relativePath}${fragment}`;\n\n return `**[Source](${link})**`;\n}\n\nexport function resolveDocsOptions(\n options: import(\"./types\").DocsOptions | false | undefined,\n): ResolvedDocsOptions | false {\n if (options === false) {\n return false;\n }\n\n const opts = options || {};\n\n return {\n enabled: opts.enabled ?? true,\n src: opts.src ?? [\"./src\"],\n out: opts.out ?? \"docs/api\",\n include: opts.include ?? [\"**/*.ts\", \"**/*.tsx\"],\n exclude: opts.exclude ?? [\"**/*.test.*\", \"**/*.spec.*\", \"node_modules\"],\n format: opts.format ?? \"markdown\",\n private: opts.private ?? false,\n toc: false,\n groupBy: opts.groupBy ?? \"file\",\n githubUrl: opts.githubUrl,\n generateNav: opts.generateNav ?? true,\n };\n}\n","/**\n * HTML → PNG renderer using Chromium screenshots via Playwright.\n */\n\nimport * as path from \"path\";\nimport type { Page } from \"playwright\";\n\n/**\n * Wraps template HTML in a minimal document with viewport locked to given dimensions.\n */\nfunction wrapHtml(bodyHtml: string, width: number, height: number, useBaseUrl: boolean): string {\n const baseTag = useBaseUrl ? `\\n<base href=\"http://localhost/\">` : \"\";\n return `<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">${baseTag}\n<style>\n* { margin: 0; padding: 0; box-sizing: border-box; }\nhtml, body { width: ${width}px; height: ${height}px; overflow: hidden; }\n</style>\n</head>\n<body>${bodyHtml}</body>\n</html>`;\n}\n\n/**\n * Renders an HTML string to a PNG buffer using Chromium.\n *\n * @param page - Playwright page instance\n * @param html - HTML string from template function\n * @param width - Image width\n * @param height - Image height\n * @param publicDir - Optional public directory for serving local assets (images, fonts, etc.)\n * @returns PNG buffer\n */\nexport async function renderHtmlToPng(\n page: Page,\n html: string,\n width: number,\n height: number,\n publicDir?: string,\n): Promise<Buffer> {\n await page.setViewportSize({ width, height });\n\n // Serve local assets from the public directory\n if (publicDir) {\n const fs = await import(\"fs/promises\");\n await page.route(\"**/*\", async (route) => {\n const url = new URL(route.request().url());\n // Only intercept paths that look like local assets (not data: or blob:)\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n await route.continue();\n return;\n }\n const filePath = path.join(publicDir, url.pathname);\n try {\n const body = await fs.readFile(filePath);\n const ext = path.extname(filePath).toLowerCase();\n const mimeTypes: Record<string, string> = {\n \".svg\": \"image/svg+xml\",\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".woff\": \"font/woff\",\n \".woff2\": \"font/woff2\",\n \".ttf\": \"font/ttf\",\n \".css\": \"text/css\",\n \".js\": \"application/javascript\",\n };\n await route.fulfill({\n body,\n contentType: mimeTypes[ext] || \"application/octet-stream\",\n });\n } catch {\n await route.continue();\n }\n });\n }\n\n const fullHtml = wrapHtml(html, width, height, !!publicDir);\n await page.setContent(fullHtml, { waitUntil: \"networkidle\" });\n\n const screenshot = await page.screenshot({\n type: \"png\",\n clip: { x: 0, y: 0, width, height },\n });\n\n return Buffer.from(screenshot);\n}\n","/**\n * Chromium browser session with automatic cleanup via Explicit Resource Management.\n *\n * Usage:\n * await using session = await openBrowser();\n * const png = await session.renderPage(html, 1200, 630);\n * // browser.close() is called automatically when session goes out of scope\n */\n\nimport type { Page } from \"playwright\";\nimport { renderHtmlToPng } from \"./renderer\";\n\n/**\n * A browser session that can render HTML pages to PNG.\n * Implements AsyncDisposable for automatic cleanup via `await using`.\n */\nexport interface OgBrowserSession extends AsyncDisposable {\n renderPage(html: string, width: number, height: number, publicDir?: string): Promise<Buffer>;\n}\n\n/**\n * Opens a Chromium browser and returns a session for rendering OG images.\n * Returns null if Playwright/Chromium is not available.\n *\n * The session implements AsyncDisposable — use `await using` for automatic cleanup:\n * ```ts\n * await using session = await openBrowser();\n * if (!session) return;\n * const png = await session.renderPage(html, 1200, 630);\n * ```\n */\nexport async function openBrowser(): Promise<OgBrowserSession | null> {\n try {\n const { chromium } = await import(\"playwright\");\n const browser = await chromium.launch({\n headless: true,\n args: [\n \"--no-sandbox\",\n \"--disable-setuid-sandbox\",\n \"--disable-dev-shm-usage\",\n \"--disable-gpu\",\n ],\n });\n\n return {\n async renderPage(\n html: string,\n width: number,\n height: number,\n publicDir?: string,\n ): Promise<Buffer> {\n const page: Page = await browser.newPage();\n try {\n return await renderHtmlToPng(page, html, width, height, publicDir);\n } finally {\n await page.close();\n }\n },\n\n async [Symbol.asyncDispose]() {\n try {\n await browser.close();\n } catch {\n // Ignore close errors\n }\n },\n };\n } catch (err) {\n console.warn(\n \"[ox-content:og-image] Chromium not available, skipping OG image generation.\",\n err instanceof Error ? err.message : err,\n );\n return null;\n }\n}\n","/**\n * Default OG image template.\n *\n * Uses inline HTML/CSS for a gradient background with title, description,\n * siteName, and tags. No external dependencies required.\n */\n\nimport type { OgImageTemplateFn, OgImageTemplateProps } from \"./types\";\n\n/**\n * Escapes HTML special characters.\n */\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\");\n}\n\n/**\n * Returns the built-in default template function.\n */\nexport function getDefaultTemplate(): OgImageTemplateFn {\n return function defaultTemplate(props: OgImageTemplateProps): string {\n const { title, description, siteName, tags } = props;\n\n const tagsHtml = tags?.length\n ? `<div style=\"display:flex;gap:8px;flex-wrap:wrap;margin-top:auto;\">\n ${tags.map((tag) => `<span style=\"background:rgba(255,255,255,0.15);color:#e2e8f0;padding:4px 12px;border-radius:16px;font-size:14px;\">${escapeHtml(tag)}</span>`).join(\"\")}\n </div>`\n : \"\";\n\n return `<div style=\"width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;padding:60px 80px;background:linear-gradient(135deg,#1a1a2e 0%,#16213e 50%,#0f3460 100%);font-family:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;\">\n <div style=\"display:flex;flex-direction:column;gap:16px;flex:1;justify-content:center;\">\n <h1 style=\"font-size:56px;font-weight:700;color:#ffffff;line-height:1.2;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;\">${escapeHtml(title)}</h1>\n ${description ? `<p style=\"font-size:24px;color:#94a3b8;line-height:1.5;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;\">${escapeHtml(description)}</p>` : \"\"}\n </div>\n <div style=\"display:flex;align-items:flex-end;justify-content:space-between;margin-top:auto;\">\n ${siteName ? `<span style=\"font-size:20px;color:#64748b;font-weight:500;\">${escapeHtml(siteName)}</span>` : \"\"}\n ${tagsHtml}\n </div>\n</div>`;\n };\n}\n","/**\n * Content-hash based caching for OG images.\n *\n * Uses SHA256 of (template source + props + options) to determine\n * if a re-render is needed. Cache dir: .cache/og-images\n */\n\nimport * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport * as crypto from \"crypto\";\n\n/**\n * Computes a cache key from template + props + options.\n */\nexport function computeCacheKey(\n templateSource: string,\n props: Record<string, unknown>,\n width: number,\n height: number,\n): string {\n const data = JSON.stringify({ templateSource, props, width, height });\n return crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\n/**\n * Checks if a cached PNG exists for the given key.\n * Returns the cached file path if found, null otherwise.\n */\nexport async function getCached(cacheDir: string, key: string): Promise<Buffer | null> {\n const filePath = path.join(cacheDir, `${key}.png`);\n try {\n return await fs.readFile(filePath);\n } catch {\n return null;\n }\n}\n\n/**\n * Writes a PNG buffer to the cache.\n */\nexport async function writeCache(cacheDir: string, key: string, png: Buffer): Promise<void> {\n await fs.mkdir(cacheDir, { recursive: true });\n const filePath = path.join(cacheDir, `${key}.png`);\n await fs.writeFile(filePath, png);\n}\n","/**\n * Public API for Chromium-based OG image generation.\n *\n * Orchestrates browser lifecycle, template resolution, caching,\n * and batch rendering with concurrency control.\n */\n\nimport * as path from \"path\";\nimport * as crypto from \"crypto\";\nimport { openBrowser } from \"./browser\";\nimport type { OgBrowserSession } from \"./browser\";\nimport { getDefaultTemplate } from \"./template\";\nimport { computeCacheKey, getCached, writeCache } from \"./cache\";\nimport type {\n OgImageOptions,\n ResolvedOgImageOptions,\n OgImageTemplateProps,\n OgImageTemplateFn,\n} from \"./types\";\n\nexport type {\n OgImageOptions,\n ResolvedOgImageOptions,\n OgImageTemplateProps,\n OgImageTemplateFn,\n} from \"./types\";\n\nexport type { OgBrowserSession } from \"./browser\";\n\n/**\n * Resolves user-provided OG image options with defaults.\n */\nexport function resolveOgImageOptions(options: OgImageOptions | undefined): ResolvedOgImageOptions {\n return {\n template: options?.template,\n vuePlugin: options?.vuePlugin ?? \"vitejs\",\n width: options?.width ?? 1200,\n height: options?.height ?? 630,\n cache: options?.cache ?? true,\n concurrency: options?.concurrency ?? 1,\n };\n}\n\n/**\n * A single page entry for batch OG image generation.\n */\nexport interface OgImagePageEntry {\n /** Props to pass to the template */\n props: OgImageTemplateProps;\n /** Absolute path to write the output PNG */\n outputPath: string;\n}\n\n/**\n * Result of OG image generation for a single page.\n */\nexport interface OgImageResult {\n outputPath: string;\n cached: boolean;\n error?: string;\n}\n\n/**\n * Resolves the template function from options.\n *\n * Dispatches by file extension:\n * - `.vue` → Vue SFC (SSR via vue/server-renderer)\n * - `.svelte` → Svelte SFC (SSR via svelte/server)\n * - `.tsx`/`.jsx` → React Server Component (SSR via react-dom/server)\n * - others → TypeScript template (direct function export)\n */\nasync function resolveTemplate(\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<OgImageTemplateFn> {\n if (!options.template) {\n return getDefaultTemplate();\n }\n\n const templatePath = path.resolve(root, options.template);\n\n // Verify file exists\n const fs = await import(\"fs/promises\");\n try {\n await fs.access(templatePath);\n } catch {\n throw new Error(`[ox-content:og-image] Template file not found: ${templatePath}`);\n }\n\n const ext = path.extname(templatePath).toLowerCase();\n\n switch (ext) {\n case \".vue\":\n return resolveVueTemplate(templatePath, options, root);\n case \".svelte\":\n return resolveSvelteTemplate(templatePath, root);\n case \".tsx\":\n case \".jsx\":\n return resolveReactTemplate(templatePath, root);\n default:\n return resolveTsTemplate(templatePath, options, root);\n }\n}\n\n/**\n * Resolves a plain TypeScript template (existing behavior).\n */\nasync function resolveTsTemplate(\n templatePath: string,\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<OgImageTemplateFn> {\n const fs = await import(\"fs/promises\");\n const { rolldown } = await import(\"rolldown\");\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n await fs.mkdir(cacheDir, { recursive: true });\n\n const outfile = path.join(cacheDir, \"_template.mjs\");\n\n const bundle = await rolldown({\n input: templatePath,\n platform: \"node\",\n });\n await bundle.write({\n file: outfile,\n format: \"esm\",\n });\n await bundle.close();\n\n const mod = await import(`${outfile}?t=${Date.now()}`);\n const templateFn = mod.default;\n\n if (typeof templateFn !== \"function\") {\n throw new Error(\n `[ox-content:og-image] Template must default-export a function: ${options.template}`,\n );\n }\n\n return templateFn as OgImageTemplateFn;\n}\n\n/**\n * Resolves a Vue SFC template via SSR.\n *\n * Compiles the SFC with @vue/compiler-sfc (or @vizejs/vite-plugin),\n * bundles with rolldown, then wraps with createSSRApp + renderToString.\n */\nasync function resolveVueTemplate(\n templatePath: string,\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<OgImageTemplateFn> {\n const fs = await import(\"fs/promises\");\n const { rolldown } = await import(\"rolldown\");\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n await fs.mkdir(cacheDir, { recursive: true });\n\n const outfile = path.join(cacheDir, \"_template_vue.mjs\");\n\n const plugins =\n options.vuePlugin === \"vizejs\" ? await getVizejsPlugin() : [createVueCompilerPlugin()];\n\n const bundle = await rolldown({\n input: templatePath,\n platform: \"node\",\n external: [\"vue\", \"vue/server-renderer\"],\n plugins,\n });\n await bundle.write({\n file: outfile,\n format: \"esm\",\n });\n await bundle.close();\n\n const mod = await import(`${outfile}?t=${Date.now()}`);\n const Component = mod.default;\n\n if (!Component) {\n throw new Error(\n `[ox-content:og-image] Vue template must have a default export: ${templatePath}`,\n );\n }\n\n // Extract CSS from SFC <style> blocks (Vue SSR does not include styles).\n // OG image templates render in complete isolation, so scoping is unnecessary.\n // We use raw CSS content to avoid scope ID mismatches between compilers\n // (e.g., vizejs and @vue/compiler-sfc may produce different scope hashes).\n let extractedCss = ((mod as Record<string, unknown>).__vize_css__ as string) || \"\";\n if (!extractedCss) {\n try {\n let compilerSfc: typeof import(\"@vue/compiler-sfc\");\n try {\n compilerSfc = await import(\"@vue/compiler-sfc\");\n } catch {\n compilerSfc = null as never;\n }\n if (compilerSfc) {\n const sfcSource = await fs.readFile(templatePath, \"utf-8\");\n const { descriptor } = compilerSfc.parse(sfcSource, { filename: templatePath });\n for (const style of descriptor.styles) {\n extractedCss += style.content;\n }\n }\n } catch {\n // CSS extraction is best-effort\n }\n }\n\n // Import Vue SSR utilities\n const { createSSRApp } = await import(\"vue\");\n const { renderToString } = await import(\"vue/server-renderer\");\n\n return async (props) => {\n const app = createSSRApp(Component, props);\n const html = await renderToString(app);\n if (extractedCss) {\n return `<style>${extractedCss}</style>${html}`;\n }\n return html;\n };\n}\n\n/**\n * Creates a rolldown plugin that compiles Vue SFCs using @vue/compiler-sfc.\n */\nfunction createVueCompilerPlugin(): import(\"rolldown\").Plugin {\n return {\n name: \"ox-content-vue-sfc\",\n async transform(code, id) {\n if (!id.endsWith(\".vue\")) return null;\n\n let compilerSfc: typeof import(\"@vue/compiler-sfc\");\n try {\n compilerSfc = await import(\"@vue/compiler-sfc\");\n } catch {\n throw new Error(\n \"[ox-content:og-image] @vue/compiler-sfc is required for .vue templates. \" +\n \"Install it with: pnpm add -D @vue/compiler-sfc\",\n );\n }\n\n const { descriptor } = compilerSfc.parse(code, { filename: id });\n\n // Compile <script setup> or <script>\n let scriptCode: string;\n if (descriptor.scriptSetup || descriptor.script) {\n const compiled = compilerSfc.compileScript(descriptor, {\n id,\n inlineTemplate: true,\n });\n scriptCode = compiled.content;\n } else {\n // Template-only SFC: compile template separately\n if (!descriptor.template) {\n throw new Error(\n `[ox-content:og-image] Vue SFC must have a <template> or <script>: ${id}`,\n );\n }\n const templateResult = compilerSfc.compileTemplate({\n source: descriptor.template.content,\n filename: id,\n id,\n });\n if (templateResult.errors.length > 0) {\n throw new Error(\n `[ox-content:og-image] Vue template compilation errors in ${id}: ${templateResult.errors.map(String).join(\", \")}`,\n );\n }\n scriptCode = `${templateResult.code}\\nexport default { render }`;\n }\n\n // Determine if the compiled output contains TypeScript\n const isTs = !!(descriptor.scriptSetup?.lang === \"ts\" || descriptor.script?.lang === \"ts\");\n\n return { code: scriptCode, moduleType: isTs ? \"ts\" : \"js\" };\n },\n };\n}\n\n/**\n * Loads @vizejs/vite-plugin as a rolldown plugin for Vue SFC compilation.\n */\nasync function getVizejsPlugin(): Promise<import(\"rolldown\").Plugin[]> {\n try {\n const vizejs = await import(\"@vizejs/vite-plugin\");\n const plugin = vizejs.default?.() ?? vizejs;\n return Array.isArray(plugin) ? plugin : [plugin];\n } catch {\n throw new Error(\n \"[ox-content:og-image] @vizejs/vite-plugin is required when vuePlugin is 'vizejs'. \" +\n \"Install it with: pnpm add -D @vizejs/vite-plugin\",\n );\n }\n}\n\n/**\n * Resolves a Svelte SFC template via SSR.\n *\n * Compiles the SFC with svelte/compiler (server mode + runes),\n * bundles with rolldown, then wraps with svelte/server render().\n */\nasync function resolveSvelteTemplate(\n templatePath: string,\n root: string,\n): Promise<OgImageTemplateFn> {\n const fs = await import(\"fs/promises\");\n const { rolldown } = await import(\"rolldown\");\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n await fs.mkdir(cacheDir, { recursive: true });\n\n const outfile = path.join(cacheDir, \"_template_svelte.mjs\");\n\n const bundle = await rolldown({\n input: templatePath,\n platform: \"node\",\n external: [\"svelte\", \"svelte/server\", \"svelte/internal\", \"svelte/internal/server\"],\n plugins: [createSvelteCompilerPlugin()],\n });\n await bundle.write({\n file: outfile,\n format: \"esm\",\n });\n await bundle.close();\n\n const mod = await import(`${outfile}?t=${Date.now()}`);\n const Component = mod.default;\n\n if (!Component) {\n throw new Error(\n `[ox-content:og-image] Svelte template must have a default export: ${templatePath}`,\n );\n }\n\n // Import Svelte SSR utility\n const { render } = (await import(\"svelte/server\")) as {\n render: (component: unknown, options: { props: Record<string, unknown> }) => { body: string };\n };\n\n return async (props) => {\n const { body } = render(Component, { props });\n return body;\n };\n}\n\n/**\n * Creates a rolldown plugin that compiles Svelte SFCs using svelte/compiler.\n */\nfunction createSvelteCompilerPlugin(): import(\"rolldown\").Plugin {\n return {\n name: \"ox-content-svelte-sfc\",\n async transform(code, id) {\n if (!id.endsWith(\".svelte\")) return null;\n\n let svelteCompiler: typeof import(\"svelte/compiler\");\n try {\n svelteCompiler = await import(\"svelte/compiler\");\n } catch {\n throw new Error(\n \"[ox-content:og-image] svelte is required for .svelte templates. \" +\n \"Install it with: pnpm add -D svelte\",\n );\n }\n\n const result = svelteCompiler.compile(code, {\n generate: \"server\",\n runes: true,\n filename: id,\n });\n\n return { code: result.js.code };\n },\n };\n}\n\n/**\n * Resolves a React (.tsx/.jsx) template via SSR.\n *\n * Bundles with rolldown (JSX transform), then wraps with\n * react-dom/server renderToReadableStream for async Server Component support.\n */\nasync function resolveReactTemplate(\n templatePath: string,\n root: string,\n): Promise<OgImageTemplateFn> {\n const fs = await import(\"fs/promises\");\n const { rolldown } = await import(\"rolldown\");\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n await fs.mkdir(cacheDir, { recursive: true });\n\n const outfile = path.join(cacheDir, \"_template_react.mjs\");\n\n const bundle = await rolldown({\n input: templatePath,\n platform: \"node\",\n external: [\n \"react\",\n \"react/jsx-runtime\",\n \"react/jsx-dev-runtime\",\n \"react-dom\",\n \"react-dom/server\",\n ],\n transform: {\n jsx: \"react-jsx\",\n },\n });\n await bundle.write({\n file: outfile,\n format: \"esm\",\n });\n await bundle.close();\n\n const mod = await import(`${outfile}?t=${Date.now()}`);\n const Component = mod.default;\n\n if (!Component) {\n throw new Error(\n `[ox-content:og-image] React template must have a default export: ${templatePath}`,\n );\n }\n\n // Import React SSR utilities\n let React: typeof import(\"react\");\n let ReactDOMServer: typeof import(\"react-dom/server\");\n try {\n React = await import(\"react\");\n ReactDOMServer = await import(\"react-dom/server\");\n } catch {\n throw new Error(\n \"[ox-content:og-image] react and react-dom are required for .tsx/.jsx templates. \" +\n \"Install them with: pnpm add -D react react-dom\",\n );\n }\n\n return async (props) => {\n const element = React.createElement(Component, props);\n // Use renderToReadableStream for async Server Component support\n const stream = await ReactDOMServer.renderToReadableStream(element);\n const reader = stream.getReader();\n const chunks: Uint8Array[] = [];\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n chunks.push(value);\n }\n const decoder = new TextDecoder();\n return (\n chunks.map((chunk) => decoder.decode(chunk, { stream: true })).join(\"\") + decoder.decode()\n );\n };\n}\n\n/**\n * Computes a stable template source identifier for cache keys.\n *\n * For custom templates, hashes the file content so cache invalidates\n * when the template changes. For the default template, returns a fixed string.\n */\nasync function computeTemplateSource(\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<string> {\n if (!options.template) {\n return \"__default__\";\n }\n\n const fs = await import(\"fs/promises\");\n const templatePath = path.resolve(root, options.template);\n const content = await fs.readFile(templatePath, \"utf-8\");\n return crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\n/**\n * Generates OG images for a batch of pages.\n *\n * Manages the full lifecycle: resolve template → launch browser (with `using`) →\n * render each page (with caching and concurrency).\n *\n * All errors are non-fatal: failures are reported in results but never throw.\n */\nexport async function generateOgImages(\n pages: OgImagePageEntry[],\n options: ResolvedOgImageOptions,\n root: string,\n): Promise<OgImageResult[]> {\n if (pages.length === 0) return [];\n\n // Resolve template\n const templateFn = await resolveTemplate(options, root);\n\n // Compute template source for cache key\n const templateSource = await computeTemplateSource(options, root);\n\n // Cache directory\n const cacheDir = path.join(root, \".cache\", \"og-images\");\n\n // Try to serve all from cache first if caching is enabled\n if (options.cache) {\n const allCached = await tryServeAllFromCache(pages, templateSource, options, cacheDir);\n if (allCached) return allCached;\n }\n\n // Launch browser\n await using session = await openBrowser();\n if (!session) {\n return pages.map((p) => ({\n outputPath: p.outputPath,\n cached: false,\n error: \"Chromium not available\",\n }));\n }\n\n const results: OgImageResult[] = [];\n\n // Resolve public directory for serving local assets in templates\n const publicDir = path.join(root, \"public\");\n\n // Process pages with concurrency control\n const concurrency = Math.max(1, options.concurrency);\n\n for (let i = 0; i < pages.length; i += concurrency) {\n const batch = pages.slice(i, i + concurrency);\n const batchResults = await Promise.all(\n batch.map((entry) =>\n renderSinglePage(entry, templateFn, templateSource, options, cacheDir, session, publicDir),\n ),\n );\n results.push(...batchResults);\n }\n\n return results;\n}\n\n/**\n * Tries to serve all pages from cache.\n * Returns results if ALL pages are cached, null otherwise.\n */\nasync function tryServeAllFromCache(\n pages: OgImagePageEntry[],\n templateSource: string,\n options: ResolvedOgImageOptions,\n cacheDir: string,\n): Promise<OgImageResult[] | null> {\n const fs = await import(\"fs/promises\");\n const results: OgImageResult[] = [];\n\n for (const entry of pages) {\n const key = computeCacheKey(\n templateSource,\n entry.props as unknown as Record<string, unknown>,\n options.width,\n options.height,\n );\n const cached = await getCached(cacheDir, key);\n if (!cached) return null; // At least one miss, need browser\n\n // Write cached file to output\n await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });\n await fs.writeFile(entry.outputPath, cached);\n results.push({ outputPath: entry.outputPath, cached: true });\n }\n\n return results;\n}\n\n/**\n * Renders a single page to PNG, with cache support.\n */\nasync function renderSinglePage(\n entry: OgImagePageEntry,\n templateFn: OgImageTemplateFn,\n templateSource: string,\n options: ResolvedOgImageOptions,\n cacheDir: string,\n session: OgBrowserSession,\n publicDir?: string,\n): Promise<OgImageResult> {\n const fs = await import(\"fs/promises\");\n\n try {\n // Check cache\n if (options.cache) {\n const key = computeCacheKey(\n templateSource,\n entry.props as unknown as Record<string, unknown>,\n options.width,\n options.height,\n );\n const cached = await getCached(cacheDir, key);\n if (cached) {\n await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });\n await fs.writeFile(entry.outputPath, cached);\n return { outputPath: entry.outputPath, cached: true };\n }\n }\n\n // Render template to HTML (may be async for SFC templates)\n const html = await templateFn(entry.props);\n\n // Render HTML to PNG via session (page create/close handled internally)\n const png = await session.renderPage(html, options.width, options.height, publicDir);\n\n // Write output\n await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });\n await fs.writeFile(entry.outputPath, png);\n\n // Write cache\n if (options.cache) {\n const key = computeCacheKey(\n templateSource,\n entry.props as unknown as Record<string, unknown>,\n options.width,\n options.height,\n );\n await writeCache(cacheDir, key, png);\n }\n\n return { outputPath: entry.outputPath, cached: false };\n } catch (err) {\n return {\n outputPath: entry.outputPath,\n cached: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n}\n","/**\n * ox-content Built-in Plugins\n *\n * All plugins are designed with No-JavaScript-First principle.\n * They generate static HTML at build time and require no client-side JS.\n */\n\nexport { transformTabs, generateTabsCSS, resetTabGroupCounter } from \"./tabs\";\n\nexport { transformYouTube, extractVideoId, type YouTubeOptions } from \"./youtube\";\n\nexport {\n transformGitHub,\n fetchRepoData,\n collectGitHubRepos,\n prefetchGitHubRepos,\n type GitHubRepoData,\n type GitHubOptions,\n} from \"./github\";\n\nexport {\n transformOgp,\n fetchOgpData,\n collectOgpUrls,\n prefetchOgpData,\n type OgpData,\n type OgpOptions,\n} from \"./ogp\";\n\nexport { transformMermaidStatic, mermaidClientScript, type MermaidOptions } from \"./mermaid\";\n\n/**\n * Transform all plugin components in HTML.\n * Call this during SSG build to process all plugins at once.\n */\nexport interface TransformAllOptions {\n tabs?: boolean;\n youtube?: boolean;\n github?: boolean;\n ogp?: boolean;\n mermaid?: boolean;\n githubToken?: string;\n}\n\n/**\n * Transform all enabled plugins in HTML content.\n */\nexport async function transformAllPlugins(\n html: string,\n options: TransformAllOptions = {},\n): Promise<string> {\n const {\n tabs = true,\n youtube = true,\n github = true,\n ogp = true,\n mermaid = true,\n githubToken,\n } = options;\n\n let result = html;\n\n // Order matters: process in dependency order\n\n // 1. Tabs (no external dependencies)\n if (tabs) {\n const { transformTabs } = await import(\"./tabs\");\n result = await transformTabs(result);\n }\n\n // 2. YouTube (no external dependencies)\n if (youtube) {\n const { transformYouTube } = await import(\"./youtube\");\n result = await transformYouTube(result);\n }\n\n // 3. GitHub (requires API calls)\n if (github) {\n const { transformGitHub } = await import(\"./github\");\n result = await transformGitHub(result, undefined, { token: githubToken });\n }\n\n // 4. OGP (requires fetch calls)\n if (ogp) {\n const { transformOgp } = await import(\"./ogp\");\n result = await transformOgp(result);\n }\n\n // 5. Mermaid (requires mermaid library)\n if (mermaid) {\n const { transformMermaidStatic } = await import(\"./mermaid\");\n result = await transformMermaidStatic(result);\n }\n\n return result;\n}\n","/**\n * Island Parser\n *\n * Detects <Island> components in HTML and transforms them\n * into hydration-ready elements with data attributes.\n */\n\nimport { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport rehypeStringify from \"rehype-stringify\";\nimport type { Root, Element } from \"hast\";\n\nexport type LoadStrategy = \"eager\" | \"idle\" | \"visible\" | \"media\";\n\nexport interface IslandInfo {\n component: string;\n load: LoadStrategy;\n mediaQuery?: string;\n props: Record<string, unknown>;\n}\n\nexport interface ParseIslandsResult {\n html: string;\n islands: IslandInfo[];\n}\n\n/**\n * Get element attribute value.\n */\nfunction getAttribute(el: Element, name: string): string | undefined {\n const value = el.properties?.[name];\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.join(\" \");\n return undefined;\n}\n\n/**\n * Parse JSX-style props from attributes.\n */\nfunction parseProps(el: Element): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n\n if (!el.properties) return props;\n\n for (const [key, value] of Object.entries(el.properties)) {\n // Skip special attributes\n if ([\"load\", \"media\", \"className\", \"class\"].includes(key)) continue;\n\n // Handle JSX-style props like {0} or {true}\n if (typeof value === \"string\") {\n // Try to parse as JSON/JS value if it looks like one\n const trimmed = value.trim();\n if (trimmed.startsWith(\"{\") && trimmed.endsWith(\"}\")) {\n const inner = trimmed.slice(1, -1);\n try {\n // Try JSON parse first\n props[key] = JSON.parse(inner);\n } catch {\n // Try evaluating simple expressions\n if (inner === \"true\") props[key] = true;\n else if (inner === \"false\") props[key] = false;\n else if (inner === \"null\") props[key] = null;\n else if (!Number.isNaN(Number(inner))) props[key] = Number(inner);\n else props[key] = value;\n }\n } else {\n props[key] = value;\n }\n } else if (typeof value === \"number\" || typeof value === \"boolean\") {\n props[key] = value;\n } else if (Array.isArray(value)) {\n props[key] = value;\n }\n }\n\n return props;\n}\n\n/**\n * Find the component element inside <Island>.\n */\nfunction findComponentElement(children: Element[\"children\"]): Element | null {\n for (const child of children) {\n if (child.type === \"element\") {\n // Skip text/whitespace, look for actual component\n if (child.tagName !== \"br\" && child.tagName !== \"span\") {\n return child;\n }\n }\n }\n return null;\n}\n\n/**\n * Get component name from child element.\n */\nfunction getComponentName(el: Element): string {\n // PascalCase tag names are components\n const tagName = el.tagName;\n if (tagName && /^[A-Z]/.test(tagName)) {\n return tagName;\n }\n // Check for data-component attribute\n return getAttribute(el, \"data-component\") || tagName;\n}\n\nlet islandCounter = 0;\n\n/**\n * Reset island counter (for testing).\n */\nexport function resetIslandCounter(): void {\n islandCounter = 0;\n}\n\n/**\n * Rehype plugin to transform Island components.\n */\nfunction rehypeIslands(collectedIslands: IslandInfo[]) {\n return (tree: Root) => {\n const visit = (node: Root | Element) => {\n if (\"children\" in node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n\n if (child.type === \"element\") {\n // Check for <Island> component\n if (child.tagName.toLowerCase() === \"island\") {\n const load = (getAttribute(child, \"load\") as LoadStrategy) || \"eager\";\n const mediaQuery = getAttribute(child, \"media\");\n\n // Find the component inside\n const componentEl = findComponentElement(child.children);\n\n if (componentEl) {\n const componentName = getComponentName(componentEl);\n const componentProps = parseProps(componentEl);\n\n // Collect island info\n const islandInfo: IslandInfo = {\n component: componentName,\n load,\n mediaQuery,\n props: componentProps,\n };\n collectedIslands.push(islandInfo);\n\n // Create island wrapper with data attributes\n const islandId = `ox-island-${islandCounter++}`;\n\n const islandElement: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: {\n id: islandId,\n \"data-ox-island\": componentName,\n \"data-ox-load\": load,\n ...(mediaQuery && { \"data-ox-media\": mediaQuery }),\n \"data-ox-props\": JSON.stringify(componentProps),\n className: [\"ox-island\"],\n },\n children: [\n // Keep original content as fallback/placeholder\n ...componentEl.children,\n ],\n };\n\n node.children[i] = islandElement;\n }\n } else {\n visit(child);\n }\n }\n }\n }\n };\n\n visit(tree);\n };\n}\n\n/**\n * Transform Island components in HTML.\n *\n * Converts:\n * ```html\n * <Island load=\"visible\">\n * <Counter initial={0} />\n * </Island>\n * ```\n *\n * To:\n * ```html\n * <div id=\"ox-island-0\"\n * data-ox-island=\"Counter\"\n * data-ox-load=\"visible\"\n * data-ox-props='{\"initial\":0}'\n * class=\"ox-island\">\n * <!-- fallback content -->\n * </div>\n * ```\n */\nexport async function transformIslands(html: string): Promise<ParseIslandsResult> {\n const islands: IslandInfo[] = [];\n\n const result = await unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeIslands, islands)\n .use(rehypeStringify)\n .process(html);\n\n return {\n html: String(result),\n islands,\n };\n}\n\n/**\n * Check if HTML contains any Island components.\n */\nexport function hasIslands(html: string): boolean {\n return /<island[\\s>]/i.test(html);\n}\n\n/**\n * Extract island info without transforming HTML.\n * Useful for analysis/bundling purposes.\n */\nexport async function extractIslandInfo(html: string): Promise<IslandInfo[]> {\n const { islands } = await transformIslands(html);\n return islands;\n}\n\n/**\n * Generate client-side hydration script.\n * This is a minimal script that imports and initializes islands.\n */\nexport function generateHydrationScript(components: string[]): string {\n if (components.length === 0) return \"\";\n\n const imports = components.map((name) => `import ${name} from './${name}';`).join(\"\\n\");\n\n return `\nimport { initIslands } from '@ox-content/islands';\n${imports}\n\nconst components = {\n ${components.join(\",\\n \")}\n};\n\n// Initialize with your framework's hydration\n// This example uses Vue, adapt for React/Svelte/etc.\nimport { createApp, h } from 'vue';\n\ninitIslands((el, props) => {\n const name = el.dataset.oxIsland;\n const Component = components[name];\n if (!Component) {\n console.warn(\\`[ox-islands] Unknown component: \\${name}\\`);\n return;\n }\n\n const app = createApp({ render: () => h(Component, props) });\n app.mount(el);\n\n return () => app.unmount();\n});\n`;\n}\n","/**\n * Theme API for ox-content SSG\n *\n * Provides VitePress-like theming with default theme + customization.\n */\n\n/**\n * Theme color configuration.\n */\nexport interface ThemeColors {\n /** Primary accent color */\n primary?: string;\n /** Primary color on hover */\n primaryHover?: string;\n /** Background color */\n background?: string;\n /** Alternative background color (sidebar, code blocks) */\n backgroundAlt?: string;\n /** Main text color */\n text?: string;\n /** Muted/secondary text color */\n textMuted?: string;\n /** Border color */\n border?: string;\n /** Code block background color */\n codeBackground?: string;\n /** Code block text color */\n codeText?: string;\n}\n\n/**\n * Theme layout configuration.\n */\nexport interface ThemeLayout {\n /** Sidebar width (CSS value, e.g., \"260px\") */\n sidebarWidth?: string;\n /** Header height (CSS value, e.g., \"60px\") */\n headerHeight?: string;\n /** Maximum content width (CSS value, e.g., \"960px\") */\n maxContentWidth?: string;\n}\n\n/**\n * Theme font configuration.\n */\nexport interface ThemeFonts {\n /** Sans-serif font stack */\n sans?: string;\n /** Monospace font stack */\n mono?: string;\n}\n\n/**\n * Theme header configuration.\n */\nexport interface ThemeHeader {\n /** Logo image URL */\n logo?: string;\n /** Logo width in pixels */\n logoWidth?: number;\n /** Logo height in pixels */\n logoHeight?: number;\n}\n\n/**\n * Theme footer configuration.\n */\nexport interface ThemeFooter {\n /** Footer message (supports HTML) */\n message?: string;\n /** Copyright text (supports HTML) */\n copyright?: string;\n}\n\n/**\n * Social links configuration.\n */\nexport interface SocialLinks {\n /** GitHub URL */\n github?: string;\n /** Twitter/X URL */\n twitter?: string;\n /** Discord URL */\n discord?: string;\n}\n\n/**\n * Embedded HTML content for specific positions in the page layout.\n */\nexport interface ThemeEmbed {\n /** Content to embed into <head> */\n head?: string;\n /** Content before header */\n headerBefore?: string;\n /** Content after header */\n headerAfter?: string;\n /** Content before sidebar navigation */\n sidebarBefore?: string;\n /** Content after sidebar navigation */\n sidebarAfter?: string;\n /** Content before main content */\n contentBefore?: string;\n /** Content after main content */\n contentAfter?: string;\n /** Content before footer */\n footerBefore?: string;\n /** Custom footer content (replaces default footer) */\n footer?: string;\n}\n\n/**\n * Complete theme configuration.\n */\nexport interface ThemeConfig {\n /** Theme name for identification */\n name?: string;\n /** Base theme to extend */\n extends?: ThemeConfig;\n /** Light mode colors (maps to CSS variables) */\n colors?: ThemeColors;\n /** Dark mode colors (maps to CSS variables) */\n darkColors?: ThemeColors;\n /** Font configuration (maps to CSS variables) */\n fonts?: ThemeFonts;\n /** Layout configuration (maps to CSS variables) */\n layout?: ThemeLayout;\n /** Header configuration */\n header?: ThemeHeader;\n /** Footer configuration */\n footer?: ThemeFooter;\n /** Social links configuration */\n socialLinks?: SocialLinks;\n /** Embedded HTML content at specific positions */\n embed?: ThemeEmbed;\n /** Additional custom CSS */\n css?: string;\n /** Additional custom JavaScript */\n js?: string;\n}\n\n/**\n * Resolved theme configuration (after merging with defaults).\n */\nexport interface ResolvedThemeConfig {\n name: string;\n colors: ThemeColors;\n darkColors: ThemeColors;\n fonts: ThemeFonts;\n layout: ThemeLayout;\n header: ThemeHeader;\n footer: ThemeFooter;\n socialLinks: SocialLinks;\n embed: ThemeEmbed;\n css: string;\n js: string;\n}\n\n/**\n * Default theme configuration.\n * Based on the current ox-content SSG styles.\n */\nexport const defaultTheme: ThemeConfig = {\n name: \"default\",\n colors: {\n primary: \"#e04d0a\",\n primaryHover: \"#f5602a\",\n background: \"#ffffff\",\n backgroundAlt: \"#f8f9fa\",\n text: \"#1a1a1a\",\n textMuted: \"#666666\",\n border: \"#e5e7eb\",\n codeBackground: \"#1e293b\",\n codeText: \"#e2e8f0\",\n },\n darkColors: {\n primary: \"#f5714a\",\n primaryHover: \"#ff8a66\",\n background: \"#141414\",\n backgroundAlt: \"#141414\",\n text: \"#e5e5e5\",\n textMuted: \"#a3a3a3\",\n border: \"#2a2a2a\",\n codeBackground: \"#1a1a1a\",\n codeText: \"#e5e5e5\",\n },\n fonts: {\n sans: 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n mono: 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace',\n },\n layout: {\n sidebarWidth: \"260px\",\n headerHeight: \"60px\",\n maxContentWidth: \"960px\",\n },\n header: {\n logo: undefined,\n logoWidth: 28,\n logoHeight: 28,\n },\n footer: {\n message: undefined,\n copyright: undefined,\n },\n socialLinks: {},\n embed: {},\n css: \"\",\n js: \"\",\n};\n\n/**\n * Deep merge two objects.\n */\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n const result = { ...target };\n\n for (const key of Object.keys(source) as (keyof T)[]) {\n const sourceValue = source[key];\n const targetValue = target[key];\n\n if (\n sourceValue !== undefined &&\n typeof sourceValue === \"object\" &&\n sourceValue !== null &&\n !Array.isArray(sourceValue) &&\n typeof targetValue === \"object\" &&\n targetValue !== null &&\n !Array.isArray(targetValue)\n ) {\n result[key] = deepMerge(\n targetValue as Record<string, unknown>,\n sourceValue as Record<string, unknown>,\n ) as T[keyof T];\n } else if (sourceValue !== undefined) {\n result[key] = sourceValue as T[keyof T];\n }\n }\n\n return result;\n}\n\n/**\n * Defines a theme configuration with type checking.\n *\n * @example\n * ```ts\n * const myTheme = defineTheme({\n * extends: defaultTheme,\n * colors: {\n * primary: '#3498db',\n * },\n * footer: {\n * copyright: '2025 My Company',\n * },\n * });\n * ```\n */\nexport function defineTheme(config: ThemeConfig): ThemeConfig {\n return config;\n}\n\n/**\n * Merges multiple theme configurations.\n * Later themes override earlier ones.\n *\n * @example\n * ```ts\n * const merged = mergeThemes(defaultTheme, customTheme, overrides);\n * ```\n */\nexport function mergeThemes(...themes: ThemeConfig[]): ThemeConfig {\n if (themes.length === 0) {\n return { ...defaultTheme };\n }\n\n let result: ThemeConfig = {};\n\n for (const theme of themes) {\n result = deepMerge(\n result as Record<string, unknown>,\n theme as Record<string, unknown>,\n ) as ThemeConfig;\n }\n\n return result;\n}\n\n/**\n * Resolves a theme configuration by merging with its extends chain and defaults.\n */\nexport function resolveTheme(config?: ThemeConfig): ResolvedThemeConfig {\n if (!config) {\n return resolveTheme(defaultTheme);\n }\n\n // Build the extends chain\n const chain: ThemeConfig[] = [];\n let current: ThemeConfig | undefined = config;\n\n while (current) {\n chain.unshift(current);\n current = current.extends;\n }\n\n // Always start with default theme\n if (chain[0] !== defaultTheme && chain[0]?.name !== \"default\") {\n chain.unshift(defaultTheme);\n }\n\n // Merge all themes in the chain\n const merged = mergeThemes(...chain);\n\n // Return resolved config with all required fields\n return {\n name: merged.name ?? \"custom\",\n colors: merged.colors ?? defaultTheme.colors!,\n darkColors: merged.darkColors ?? defaultTheme.darkColors!,\n fonts: merged.fonts ?? defaultTheme.fonts!,\n layout: merged.layout ?? defaultTheme.layout!,\n header: merged.header ?? defaultTheme.header!,\n footer: merged.footer ?? defaultTheme.footer!,\n socialLinks: merged.socialLinks ?? defaultTheme.socialLinks!,\n embed: merged.embed ?? {},\n css: merged.css ?? \"\",\n js: merged.js ?? \"\",\n };\n}\n\n/**\n * Converts resolved theme to the format expected by Rust NAPI.\n */\nexport function themeToNapi(theme: ResolvedThemeConfig): NapiThemeConfig {\n return {\n colors: theme.colors.primary\n ? {\n primary: theme.colors.primary,\n primaryHover: theme.colors.primaryHover,\n background: theme.colors.background,\n backgroundAlt: theme.colors.backgroundAlt,\n text: theme.colors.text,\n textMuted: theme.colors.textMuted,\n border: theme.colors.border,\n codeBackground: theme.colors.codeBackground,\n codeText: theme.colors.codeText,\n }\n : undefined,\n darkColors: theme.darkColors.primary\n ? {\n primary: theme.darkColors.primary,\n primaryHover: theme.darkColors.primaryHover,\n background: theme.darkColors.background,\n backgroundAlt: theme.darkColors.backgroundAlt,\n text: theme.darkColors.text,\n textMuted: theme.darkColors.textMuted,\n border: theme.darkColors.border,\n codeBackground: theme.darkColors.codeBackground,\n codeText: theme.darkColors.codeText,\n }\n : undefined,\n fonts: theme.fonts.sans\n ? {\n sans: theme.fonts.sans,\n mono: theme.fonts.mono,\n }\n : undefined,\n layout: theme.layout.sidebarWidth\n ? {\n sidebarWidth: theme.layout.sidebarWidth,\n headerHeight: theme.layout.headerHeight,\n maxContentWidth: theme.layout.maxContentWidth,\n }\n : undefined,\n header: theme.header.logo\n ? {\n logo: theme.header.logo,\n logoWidth: theme.header.logoWidth,\n logoHeight: theme.header.logoHeight,\n }\n : undefined,\n footer:\n theme.footer.message || theme.footer.copyright\n ? {\n message: theme.footer.message,\n copyright: theme.footer.copyright,\n }\n : undefined,\n socialLinks:\n theme.socialLinks.github || theme.socialLinks.twitter || theme.socialLinks.discord\n ? {\n github: theme.socialLinks.github,\n twitter: theme.socialLinks.twitter,\n discord: theme.socialLinks.discord,\n }\n : undefined,\n embed: Object.keys(theme.embed).length > 0 ? theme.embed : undefined,\n css: theme.css || undefined,\n js: theme.js || undefined,\n };\n}\n\n/**\n * NAPI-compatible theme colors type.\n */\nexport interface NapiThemeColors {\n primary?: string;\n primaryHover?: string;\n background?: string;\n backgroundAlt?: string;\n text?: string;\n textMuted?: string;\n border?: string;\n codeBackground?: string;\n codeText?: string;\n}\n\n/**\n * NAPI-compatible theme fonts type.\n */\nexport interface NapiThemeFonts {\n sans?: string;\n mono?: string;\n}\n\n/**\n * NAPI-compatible theme layout type.\n */\nexport interface NapiThemeLayout {\n sidebarWidth?: string;\n headerHeight?: string;\n maxContentWidth?: string;\n}\n\n/**\n * NAPI-compatible theme header type.\n */\nexport interface NapiThemeHeader {\n logo?: string;\n logoWidth?: number;\n logoHeight?: number;\n}\n\n/**\n * NAPI-compatible theme footer type.\n */\nexport interface NapiThemeFooter {\n message?: string;\n copyright?: string;\n}\n\n/**\n * NAPI-compatible social links type.\n */\nexport interface NapiSocialLinks {\n github?: string;\n twitter?: string;\n discord?: string;\n}\n\n/**\n * NAPI-compatible theme embed type.\n */\nexport interface NapiThemeEmbed {\n head?: string;\n headerBefore?: string;\n headerAfter?: string;\n sidebarBefore?: string;\n sidebarAfter?: string;\n contentBefore?: string;\n contentAfter?: string;\n footerBefore?: string;\n footer?: string;\n}\n\n/**\n * NAPI-compatible theme configuration type.\n */\nexport interface NapiThemeConfig {\n colors?: NapiThemeColors;\n darkColors?: NapiThemeColors;\n fonts?: NapiThemeFonts;\n layout?: NapiThemeLayout;\n header?: NapiThemeHeader;\n footer?: NapiThemeFooter;\n socialLinks?: NapiSocialLinks;\n embed?: NapiThemeEmbed;\n css?: string;\n js?: string;\n}\n","/**\n * SSG (Static Site Generation) module for ox-content\n */\n\nimport * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport { glob } from \"glob\";\nimport { transformMarkdown } from \"./transform\";\nimport { generateOgImages } from \"./og-image\";\nimport type { OgImagePageEntry } from \"./og-image\";\nimport { transformAllPlugins } from \"./plugins\";\nimport type { TransformAllOptions } from \"./plugins\";\nimport { protectMermaidSvgs, restoreMermaidSvgs } from \"./plugins/mermaid-protect\";\nimport { transformIslands, hasIslands } from \"./island\";\nimport type {\n ResolvedOptions,\n ResolvedSsgOptions,\n SsgOptions,\n TocEntry,\n HeroConfig,\n FeatureConfig,\n} from \"./types\";\nimport { resolveTheme, themeToNapi } from \"./theme\";\nimport type { ResolvedThemeConfig } from \"./theme\";\n\n/**\n * Navigation item for SSG.\n */\nexport interface SsgNavItem {\n title: string;\n path: string;\n href: string;\n children?: SsgNavItem[];\n}\n\n/**\n * Entry page configuration for SSG (passed to Rust).\n */\nexport interface SsgEntryPageConfig {\n hero?: HeroConfig;\n features?: FeatureConfig[];\n}\n\n/**\n * Page data for SSG.\n */\nexport interface SsgPageData {\n title: string;\n description?: string;\n content: string;\n toc: TocEntry[];\n frontmatter: Record<string, unknown>;\n path: string;\n href: string;\n /** Entry page configuration (if layout: entry) */\n entryPage?: SsgEntryPageConfig;\n}\n\n/**\n * Default HTML template for SSG pages with navigation.\n */\nexport const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>{{title}}{{#siteName}} - {{siteName}}{{/siteName}}</title>\n {{#description}}<meta name=\"description\" content=\"{{description}}\">{{/description}}\n <!-- Open Graph -->\n <meta property=\"og:type\" content=\"website\">\n <meta property=\"og:title\" content=\"{{title}}{{#siteName}} - {{siteName}}{{/siteName}}\">\n {{#description}}<meta property=\"og:description\" content=\"{{description}}\">{{/description}}\n {{#ogImage}}<meta property=\"og:image\" content=\"{{ogImage}}\">{{/ogImage}}\n <!-- Twitter Card -->\n {{#ogImage}}<meta name=\"twitter:card\" content=\"summary_large_image\">{{/ogImage}}\n {{^ogImage}}<meta name=\"twitter:card\" content=\"summary\">{{/ogImage}}\n <meta name=\"twitter:title\" content=\"{{title}}{{#siteName}} - {{siteName}}{{/siteName}}\">\n {{#description}}<meta name=\"twitter:description\" content=\"{{description}}\">{{/description}}\n {{#ogImage}}<meta name=\"twitter:image\" content=\"{{ogImage}}\">{{/ogImage}}\n <style>\n :root {\n --sidebar-width: 260px;\n --header-height: 60px;\n --max-content-width: 960px;\n --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n --color-bg: #ffffff;\n --color-bg-alt: #f8f9fa;\n --color-text: #1a1a1a;\n --color-text-muted: #666666;\n --color-border: #e5e7eb;\n --color-primary: #b7410e;\n --color-primary-hover: #ce5937;\n --color-code-bg: #1e293b;\n --color-code-text: #e2e8f0;\n }\n [data-theme=\"dark\"] {\n --color-bg: #141414;\n --color-bg-alt: #141414;\n --color-text: #e5e5e5;\n --color-text-muted: #a3a3a3;\n --color-border: #2a2a2a;\n --color-primary: #c9714a;\n --color-primary-hover: #d4845f;\n --color-code-bg: #1a1a1a;\n --color-code-text: #e5e5e5;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --color-bg: #141414;\n --color-bg-alt: #141414;\n --color-text: #e5e5e5;\n --color-text-muted: #a3a3a3;\n --color-border: #2a2a2a;\n --color-primary: #c9714a;\n --color-primary-hover: #d4845f;\n --color-code-bg: #1a1a1a;\n --color-code-text: #e5e5e5;\n }\n }\n * { box-sizing: border-box; margin: 0; padding: 0; }\n html { scroll-behavior: smooth; }\n body {\n font-family: var(--font-sans);\n line-height: 1.7;\n color: var(--color-text);\n background: var(--color-bg);\n }\n a { color: var(--color-primary); text-decoration: none; }\n a:hover { color: var(--color-primary-hover); text-decoration: underline; }\n\n /* Header */\n .header {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: var(--header-height);\n background: var(--color-bg);\n border-bottom: 1px solid var(--color-border);\n display: flex;\n align-items: center;\n padding: 0 1.5rem;\n z-index: 100;\n }\n .header-title {\n font-size: 1.25rem;\n font-weight: 600;\n color: var(--color-text);\n }\n .header-title:hover { text-decoration: none; }\n .menu-toggle {\n display: none;\n background: none;\n border: none;\n cursor: pointer;\n padding: 0.5rem;\n margin-right: 0.75rem;\n }\n .menu-toggle svg { display: block; }\n .menu-toggle path { stroke: var(--color-text); }\n .header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }\n .search-button {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--color-bg-alt);\n border: 1px solid var(--color-border);\n border-radius: 6px;\n color: var(--color-text-muted);\n cursor: pointer;\n font-size: 0.875rem;\n transition: border-color 0.15s, color 0.15s;\n }\n .search-button:hover { border-color: var(--color-primary); color: var(--color-text); }\n .search-button svg { width: 16px; height: 16px; }\n .search-button kbd {\n padding: 0.125rem 0.375rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n font-family: var(--font-mono);\n font-size: 0.75rem;\n }\n @media (max-width: 640px) {\n .search-button span, .search-button kbd { display: none; }\n .search-button { padding: 0.5rem; }\n }\n .search-modal-overlay {\n display: none;\n position: fixed;\n inset: 0;\n z-index: 200;\n background: rgba(0,0,0,0.6);\n backdrop-filter: blur(4px);\n justify-content: center;\n padding-top: 10vh;\n }\n .search-modal-overlay.open { display: flex; }\n .search-modal {\n width: 100%;\n max-width: 560px;\n margin: 0 1rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);\n max-height: 70vh;\n display: flex;\n flex-direction: column;\n }\n .search-header {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n padding: 1rem;\n border-bottom: 1px solid var(--color-border);\n }\n .search-header svg { flex-shrink: 0; color: var(--color-text-muted); }\n .search-input {\n flex: 1;\n background: none;\n border: none;\n outline: none;\n font-size: 1rem;\n color: var(--color-text);\n }\n .search-input::placeholder { color: var(--color-text-muted); }\n .search-close {\n padding: 0.25rem 0.5rem;\n background: var(--color-bg-alt);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n color: var(--color-text-muted);\n font-family: var(--font-mono);\n font-size: 0.75rem;\n cursor: pointer;\n }\n .search-results {\n flex: 1;\n overflow-y: auto;\n padding: 0.5rem;\n }\n .search-result {\n display: block;\n padding: 0.75rem 1rem;\n border-radius: 8px;\n color: var(--color-text);\n text-decoration: none;\n }\n .search-result:hover, .search-result.selected { background: var(--color-bg-alt); text-decoration: none; }\n .search-result-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.25rem; }\n .search-result-snippet { font-size: 0.8125rem; color: var(--color-text-muted); }\n .search-empty { padding: 2rem 1rem; text-align: center; color: var(--color-text-muted); }\n .search-footer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 1rem;\n padding: 0.75rem 1rem;\n border-top: 1px solid var(--color-border);\n background: var(--color-bg-alt);\n font-size: 0.75rem;\n color: var(--color-text-muted);\n }\n .search-footer kbd {\n padding: 0.125rem 0.375rem;\n background: var(--color-bg);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n font-family: var(--font-mono);\n }\n .theme-toggle {\n background: none;\n border: none;\n cursor: pointer;\n padding: 0.5rem;\n border-radius: 6px;\n color: var(--color-text-muted);\n transition: background 0.15s, color 0.15s;\n }\n .theme-toggle:hover { background: var(--color-bg-alt); color: var(--color-text); }\n .theme-toggle svg { display: block; width: 20px; height: 20px; }\n .theme-toggle .icon-sun { display: none; }\n .theme-toggle .icon-moon { display: block; }\n [data-theme=\"dark\"] .theme-toggle .icon-sun { display: block; }\n [data-theme=\"dark\"] .theme-toggle .icon-moon { display: none; }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) .theme-toggle .icon-sun { display: block; }\n :root:not([data-theme=\"light\"]) .theme-toggle .icon-moon { display: none; }\n }\n\n /* Layout */\n .layout {\n display: flex;\n padding-top: var(--header-height);\n min-height: 100vh;\n }\n\n /* Sidebar */\n .sidebar {\n position: fixed;\n top: var(--header-height);\n left: 0;\n bottom: 0;\n width: var(--sidebar-width);\n background: var(--color-bg-alt);\n border-right: 1px solid var(--color-border);\n overflow-y: auto;\n padding: 1.5rem 1rem;\n }\n .nav-section { margin-bottom: 1.5rem; }\n .nav-title {\n font-size: 0.75rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--color-text-muted);\n margin-bottom: 0.5rem;\n padding: 0 0.75rem;\n }\n .nav-list { list-style: none; }\n .nav-item { margin: 0.125rem 0; }\n .nav-link {\n display: block;\n padding: 0.5rem 0.75rem;\n border-radius: 6px;\n color: var(--color-text);\n font-size: 0.875rem;\n transition: background 0.15s;\n }\n .nav-link:hover {\n background: var(--color-border);\n text-decoration: none;\n }\n .nav-link.active {\n background: var(--color-primary);\n color: white;\n }\n\n /* Main content */\n .main {\n flex: 1;\n margin-left: var(--sidebar-width);\n padding: 2rem;\n min-width: 0;\n overflow-x: hidden;\n }\n .content {\n max-width: var(--max-content-width);\n margin: 0 auto;\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n /* TOC (right sidebar) */\n .toc {\n position: fixed;\n top: calc(var(--header-height) + 2rem);\n right: 2rem;\n width: 200px;\n font-size: 0.8125rem;\n }\n .toc-title {\n font-weight: 600;\n margin-bottom: 0.75rem;\n color: var(--color-text-muted);\n }\n .toc-list { list-style: none; }\n .toc-item { margin: 0.375rem 0; }\n .toc-link {\n color: var(--color-text-muted);\n display: block;\n padding-left: calc((var(--depth, 1) - 1) * 0.75rem);\n }\n .toc-link:hover { color: var(--color-primary); }\n @media (max-width: 1200px) { .toc { display: none; } }\n\n /* Typography */\n .content h1 { font-size: 2.25rem; margin-bottom: 1rem; line-height: 1.2; }\n .content h2 { font-size: 1.5rem; margin-top: 2.5rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-border); }\n .content h3 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }\n .content h4 { font-size: 1rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }\n .content p { margin-bottom: 1rem; }\n .content ul, .content ol { margin: 1rem 0; padding-left: 1.5rem; }\n .content li { margin: 0.375rem 0; }\n .content blockquote {\n border-left: 4px solid var(--color-primary);\n padding: 0.5rem 1rem;\n margin: 1rem 0;\n background: var(--color-bg-alt);\n border-radius: 0 6px 6px 0;\n }\n .content code {\n font-family: var(--font-mono);\n font-size: 0.875em;\n background: var(--color-bg-alt);\n padding: 0.2em 0.4em;\n border-radius: 4px;\n word-break: break-all;\n }\n .content pre {\n background: var(--color-code-bg);\n color: var(--color-code-text);\n padding: 1rem 1.25rem;\n border-radius: 8px;\n overflow-x: auto;\n margin: 1.5rem 0;\n line-height: 1.5;\n }\n .content pre code {\n background: transparent;\n padding: 0;\n font-size: 0.8125rem;\n }\n .content table {\n width: 100%;\n border-collapse: collapse;\n margin: 1.5rem 0;\n font-size: 0.875rem;\n }\n .content th, .content td {\n border: 1px solid var(--color-border);\n padding: 0.75rem 1rem;\n text-align: left;\n }\n .content th { background: var(--color-bg-alt); font-weight: 600; }\n .content img { max-width: 100%; height: auto; border-radius: 8px; display: block; }\n .content img[alt*=\"Logo\"] { max-width: 200px; display: block; margin: 1rem 0; }\n .content img[alt*=\"Architecture\"] { max-width: 600px; }\n .content img[alt*=\"Benchmark\"] { max-width: 680px; }\n .content hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }\n\n /* Responsive */\n @media (max-width: 768px) {\n .menu-toggle { display: block; }\n .sidebar {\n transform: translateX(-100%);\n transition: transform 0.3s ease;\n z-index: 99;\n width: 280px;\n }\n .sidebar.open { transform: translateX(0); }\n .main { margin-left: 0; padding: 1rem 0.75rem; }\n .content { padding: 0 0.25rem; }\n .content h1 { font-size: 1.5rem; line-height: 1.3; margin-bottom: 0.75rem; }\n .content h2 { font-size: 1.2rem; margin-top: 2rem; }\n .content h3 { font-size: 1.1rem; }\n .content p { font-size: 0.9375rem; margin-bottom: 0.875rem; }\n .content ul, .content ol { padding-left: 1.25rem; font-size: 0.9375rem; }\n .content pre {\n padding: 0.75rem;\n font-size: 0.75rem;\n margin: 1rem -0.75rem;\n border-radius: 0;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n .content code { font-size: 0.8125em; }\n .content table {\n display: block;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n font-size: 0.8125rem;\n margin: 1rem -0.75rem;\n width: calc(100% + 1.5rem);\n }\n .content th, .content td { padding: 0.5rem 0.75rem; white-space: nowrap; }\n .content img { margin: 1rem 0; }\n .content img[alt*=\"Logo\"] { max-width: 150px; }\n .content img[alt*=\"Architecture\"] { max-width: 100%; }\n .content img[alt*=\"Benchmark\"] { max-width: 100%; }\n .content blockquote { padding: 0.5rem 0.75rem; margin: 1rem 0; font-size: 0.9375rem; }\n .header { padding: 0 1rem; }\n .header-title { font-size: 1rem; }\n .header-title img { width: 24px; height: 24px; }\n .overlay {\n display: none;\n position: fixed;\n inset: 0;\n background: rgba(0,0,0,0.5);\n z-index: 98;\n }\n .overlay.open { display: block; }\n }\n\n /* Extra small devices */\n @media (max-width: 480px) {\n .main { padding: 0.75rem 0.5rem; }\n .content h1 { font-size: 1.35rem; }\n .content pre { font-size: 0.6875rem; padding: 0.625rem; }\n .content table { font-size: 0.75rem; }\n .content th, .content td { padding: 0.375rem 0.5rem; }\n }\n </style>\n</head>\n<body>\n <header class=\"header\">\n <button class=\"menu-toggle\" aria-label=\"Toggle menu\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\">\n <path d=\"M3 12h18M3 6h18M3 18h18\"/>\n </svg>\n </button>\n <a href=\"{{base}}index.html\" class=\"header-title\">\n <img src=\"{{base}}logo.svg\" alt=\"\" width=\"28\" height=\"28\" style=\"margin-right: 8px; vertical-align: middle;\" />\n {{siteName}}\n </a>\n <div class=\"header-actions\">\n <button class=\"search-button\" aria-label=\"Search\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.3-4.3\"/>\n </svg>\n <span>Search</span>\n <kbd>/</kbd>\n </button>\n <button class=\"theme-toggle\" aria-label=\"Toggle theme\">\n <svg class=\"icon-sun\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"5\"/><path d=\"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42\"/>\n </svg>\n <svg class=\"icon-moon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\"/>\n </svg>\n </button>\n </div>\n </header>\n <div class=\"search-modal-overlay\">\n <div class=\"search-modal\">\n <div class=\"search-header\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.3-4.3\"/>\n </svg>\n <input type=\"text\" class=\"search-input\" placeholder=\"Search documentation...\" />\n <button class=\"search-close\">Esc</button>\n </div>\n <div class=\"search-results\"></div>\n <div class=\"search-footer\">\n <span><kbd>↑</kbd><kbd>↓</kbd> to navigate</span>\n <span><kbd>Enter</kbd> to select</span>\n <span><kbd>Esc</kbd> to close</span>\n </div>\n </div>\n </div>\n <div class=\"overlay\"></div>\n <div class=\"layout\">\n <aside class=\"sidebar\">\n <nav>\n{{navigation}}\n </nav>\n </aside>\n <main class=\"main\">\n <article class=\"content\">\n{{content}}\n </article>\n </main>\n{{#hasToc}}\n <aside class=\"toc\">\n <div class=\"toc-title\">On this page</div>\n <ul class=\"toc-list\">\n{{toc}}\n </ul>\n </aside>\n{{/hasToc}}\n </div>\n <script>\n // Menu toggle\n const toggle = document.querySelector('.menu-toggle');\n const sidebar = document.querySelector('.sidebar');\n const overlay = document.querySelector('.overlay');\n if (toggle && sidebar && overlay) {\n const close = () => { sidebar.classList.remove('open'); overlay.classList.remove('open'); };\n toggle.addEventListener('click', () => {\n sidebar.classList.toggle('open');\n overlay.classList.toggle('open');\n });\n overlay.addEventListener('click', close);\n sidebar.querySelectorAll('a').forEach(a => a.addEventListener('click', close));\n }\n\n // Theme toggle\n const themeToggle = document.querySelector('.theme-toggle');\n const getPreferredTheme = () => {\n const stored = localStorage.getItem('theme');\n if (stored) return stored;\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n };\n const setTheme = (theme) => {\n document.documentElement.setAttribute('data-theme', theme);\n localStorage.setItem('theme', theme);\n };\n // Initialize theme\n setTheme(getPreferredTheme());\n if (themeToggle) {\n themeToggle.addEventListener('click', () => {\n const current = document.documentElement.getAttribute('data-theme') || getPreferredTheme();\n setTheme(current === 'dark' ? 'light' : 'dark');\n });\n }\n\n // Search functionality\n const searchButton = document.querySelector('.search-button');\n const searchOverlay = document.querySelector('.search-modal-overlay');\n const searchInput = document.querySelector('.search-input');\n const searchResults = document.querySelector('.search-results');\n const searchClose = document.querySelector('.search-close');\n let searchIndex = null;\n let selectedIndex = 0;\n let results = [];\n\n const openSearch = () => {\n searchOverlay.classList.add('open');\n searchInput.focus();\n };\n const closeSearch = () => {\n searchOverlay.classList.remove('open');\n searchInput.value = '';\n searchResults.innerHTML = '';\n selectedIndex = 0;\n results = [];\n };\n\n // Load search index\n const loadSearchIndex = async () => {\n if (searchIndex) return;\n try {\n const res = await fetch('{{base}}search-index.json');\n searchIndex = await res.json();\n } catch (e) {\n console.warn('Failed to load search index:', e);\n }\n };\n\n // Tokenize query\n const tokenize = (text) => {\n const tokens = [];\n let current = '';\n for (const char of text) {\n const isCjk = /[\\\\u4E00-\\\\u9FFF\\\\u3400-\\\\u4DBF\\\\u3040-\\\\u309F\\\\u30A0-\\\\u30FF\\\\uAC00-\\\\uD7AF]/.test(char);\n if (isCjk) {\n if (current) { tokens.push(current.toLowerCase()); current = ''; }\n tokens.push(char);\n } else if (/[a-zA-Z0-9_]/.test(char)) {\n current += char;\n } else if (current) {\n tokens.push(current.toLowerCase());\n current = '';\n }\n }\n if (current) tokens.push(current.toLowerCase());\n return tokens;\n };\n\n // Perform search\n const performSearch = async (query) => {\n if (!query.trim()) {\n searchResults.innerHTML = '';\n results = [];\n return;\n }\n await loadSearchIndex();\n if (!searchIndex) {\n searchResults.innerHTML = '<div class=\"search-empty\">Search index not available</div>';\n return;\n }\n\n const tokens = tokenize(query);\n if (!tokens.length) {\n searchResults.innerHTML = '';\n results = [];\n return;\n }\n\n const k1 = 1.2, b = 0.75;\n const docScores = new Map();\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n const isLast = i === tokens.length - 1;\n let matchingTerms = [];\n if (isLast && token.length >= 2) {\n matchingTerms = Object.keys(searchIndex.index).filter(t => t.startsWith(token));\n } else if (searchIndex.index[token]) {\n matchingTerms = [token];\n }\n\n for (const term of matchingTerms) {\n const postings = searchIndex.index[term] || [];\n const df = searchIndex.df[term] || 1;\n const idf = Math.log((searchIndex.doc_count - df + 0.5) / (df + 0.5) + 1.0);\n\n for (const posting of postings) {\n const doc = searchIndex.documents[posting.doc_idx];\n if (!doc) continue;\n const boost = posting.field === 'Title' ? 10 : posting.field === 'Heading' ? 5 : 1;\n const tf = posting.tf;\n const docLen = doc.body.length;\n const score = idf * ((tf * (k1 + 1)) / (tf + k1 * (1 - b + b * docLen / searchIndex.avg_dl))) * boost;\n\n if (!docScores.has(posting.doc_idx)) {\n docScores.set(posting.doc_idx, { score: 0, matches: new Set() });\n }\n const entry = docScores.get(posting.doc_idx);\n entry.score += score;\n entry.matches.add(term);\n }\n }\n }\n\n results = Array.from(docScores.entries())\n .map(([docIdx, data]) => {\n const doc = searchIndex.documents[docIdx];\n let snippet = '';\n if (doc.body) {\n const bodyLower = doc.body.toLowerCase();\n let firstPos = -1;\n for (const match of data.matches) {\n const pos = bodyLower.indexOf(match);\n if (pos !== -1 && (firstPos === -1 || pos < firstPos)) firstPos = pos;\n }\n const start = Math.max(0, firstPos - 50);\n const end = Math.min(doc.body.length, start + 150);\n snippet = doc.body.slice(start, end);\n if (start > 0) snippet = '...' + snippet;\n if (end < doc.body.length) snippet += '...';\n }\n return { ...doc, score: data.score, snippet };\n })\n .sort((a, b) => b.score - a.score)\n .slice(0, 10);\n\n selectedIndex = 0;\n renderResults();\n };\n\n const renderResults = () => {\n if (!results.length) {\n searchResults.innerHTML = '<div class=\"search-empty\">No results found</div>';\n return;\n }\n searchResults.innerHTML = results.map((r, i) =>\n '<a href=\"' + r.url + '\" class=\"search-result' + (i === selectedIndex ? ' selected' : '') + '\">' +\n '<div class=\"search-result-title\">' + r.title + '</div>' +\n (r.snippet ? '<div class=\"search-result-snippet\">' + r.snippet + '</div>' : '') +\n '</a>'\n ).join('');\n };\n\n // Event listeners\n if (searchButton) searchButton.addEventListener('click', openSearch);\n if (searchClose) searchClose.addEventListener('click', closeSearch);\n if (searchOverlay) searchOverlay.addEventListener('click', (e) => { if (e.target === searchOverlay) closeSearch(); });\n\n let searchTimeout = null;\n if (searchInput) {\n searchInput.addEventListener('input', () => {\n if (searchTimeout) clearTimeout(searchTimeout);\n searchTimeout = setTimeout(() => performSearch(searchInput.value), 150);\n });\n searchInput.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') closeSearch();\n else if (e.key === 'ArrowDown') {\n e.preventDefault();\n if (selectedIndex < results.length - 1) { selectedIndex++; renderResults(); }\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n if (selectedIndex > 0) { selectedIndex--; renderResults(); }\n } else if (e.key === 'Enter' && results[selectedIndex]) {\n e.preventDefault();\n window.location.href = results[selectedIndex].url;\n }\n });\n }\n\n // Global keyboard shortcut (/ or Cmd+K)\n document.addEventListener('keydown', (e) => {\n if ((e.key === '/' && !(e.target instanceof HTMLInputElement)) ||\n ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k')) {\n e.preventDefault();\n openSearch();\n }\n });\n </script>\n</body>\n</html>`;\n\n/**\n * Bare HTML template (no navigation, no styles).\n */\nexport const BARE_HTML_TEMPLATE = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>{{title}}</title>\n</head>\n<body>\n{{content}}\n</body>\n</html>`;\n\n/**\n * Resolves SSG options with defaults.\n */\nexport function resolveSsgOptions(ssg: SsgOptions | boolean | undefined): ResolvedSsgOptions {\n if (ssg === false) {\n return {\n enabled: false,\n extension: \".html\",\n clean: false,\n bare: false,\n generateOgImage: false,\n };\n }\n\n if (ssg === true || ssg === undefined) {\n return {\n enabled: true,\n extension: \".html\",\n clean: false,\n bare: false,\n generateOgImage: false,\n theme: resolveTheme(undefined),\n };\n }\n\n return {\n enabled: ssg.enabled ?? true,\n extension: ssg.extension ?? \".html\",\n clean: ssg.clean ?? false,\n bare: ssg.bare ?? false,\n siteName: ssg.siteName,\n ogImage: ssg.ogImage,\n generateOgImage: ssg.generateOgImage ?? false,\n siteUrl: ssg.siteUrl,\n theme: resolveTheme(ssg.theme),\n };\n}\n\n/**\n * Simple mustache-like template rendering.\n */\nfunction renderTemplate(template: string, data: Record<string, unknown>): string {\n let result = template;\n\n // Handle conditionals: {{#key}}content{{/key}}\n result = result.replace(/\\{\\{#(\\w+)\\}\\}([\\s\\S]*?)\\{\\{\\/\\1\\}\\}/g, (_, key, content) => {\n return data[key] ? content : \"\";\n });\n\n // Handle inverted conditionals: {{^key}}content{{/key}}\n result = result.replace(/\\{\\{\\^(\\w+)\\}\\}([\\s\\S]*?)\\{\\{\\/\\1\\}\\}/g, (_, key, content) => {\n return data[key] ? \"\" : content;\n });\n\n // Handle simple replacements: {{key}}\n result = result.replace(/\\{\\{(\\w+)\\}\\}/g, (_, key) => {\n const value = data[key];\n if (value === undefined || value === null) return \"\";\n if (typeof value === \"object\") return JSON.stringify(value);\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n return \"\";\n });\n\n return result;\n}\n\n/**\n * Extracts title from content or frontmatter.\n */\nexport function extractTitle(content: string, frontmatter: Record<string, unknown>): string {\n if (frontmatter.title && typeof frontmatter.title === \"string\") {\n return frontmatter.title;\n }\n\n const h1Match = content.match(/<h1[^>]*>([^<]+)<\\/h1>/i);\n if (h1Match) {\n return h1Match[1].trim();\n }\n\n return \"Untitled\";\n}\n\n/**\n * Generates navigation HTML from nav groups.\n */\nfunction _generateNavHtml(navGroups: NavGroup[], currentPath: string): string {\n return navGroups\n .map((group) => {\n const items = group.items\n .map((item) => {\n const isActive = item.path === currentPath;\n const activeClass = isActive ? \" active\" : \"\";\n return ` <li class=\"nav-item\"><a href=\"${item.href}\" class=\"nav-link${activeClass}\">${item.title}</a></li>`;\n })\n .join(\"\\n\");\n\n return ` <div class=\"nav-section\">\n <div class=\"nav-title\">${group.title}</div>\n <ul class=\"nav-list\">\n${items}\n </ul>\n </div>`;\n })\n .join(\"\\n\");\n}\n\n/**\n * Generates TOC HTML from toc entries.\n */\nfunction _generateTocHtml(toc: TocEntry[]): string {\n const flattenToc = (entries: TocEntry[], depth = 1): string[] => {\n const items: string[] = [];\n for (const entry of entries) {\n items.push(\n ` <li class=\"toc-item\"><a href=\"#${entry.slug}\" class=\"toc-link\" style=\"--depth: ${depth}\">${entry.text}</a></li>`,\n );\n if (entry.children && entry.children.length > 0) {\n items.push(...flattenToc(entry.children, depth + 1));\n }\n }\n return items;\n };\n return flattenToc(toc).join(\"\\n\");\n}\n\n/**\n * Generates bare HTML page (no navigation, no styles).\n */\nexport function generateBareHtmlPage(content: string, title: string): string {\n return renderTemplate(BARE_HTML_TEMPLATE, {\n title,\n content,\n });\n}\n\n/**\n * Generates HTML page with navigation using Rust NAPI bindings.\n */\nexport async function generateHtmlPage(\n pageData: SsgPageData,\n navGroups: NavGroup[],\n siteName: string,\n base: string,\n ogImage?: string,\n theme?: ResolvedThemeConfig,\n): Promise<string> {\n const mod = await import(\"@ox-content/napi\");\n\n // Convert TocEntry to the format expected by Rust\n const tocForRust = pageData.toc.map((entry) => ({\n depth: entry.depth,\n text: entry.text,\n slug: entry.slug,\n }));\n\n // Convert NavGroup to the format expected by Rust\n const navGroupsForRust = navGroups.map((group) => ({\n title: group.title,\n items: group.items.map((item) => ({\n title: item.title,\n path: item.path,\n href: item.href,\n })),\n }));\n\n // Convert theme to NAPI format if provided\n const themeForRust = theme ? themeToNapi(theme) : undefined;\n\n // Convert entry page to NAPI format if provided\n const entryPageForRust = pageData.entryPage\n ? {\n hero: pageData.entryPage.hero\n ? {\n name: pageData.entryPage.hero.name,\n text: pageData.entryPage.hero.text,\n tagline: pageData.entryPage.hero.tagline,\n image: pageData.entryPage.hero.image\n ? {\n src: pageData.entryPage.hero.image.src,\n alt: pageData.entryPage.hero.image.alt,\n width: pageData.entryPage.hero.image.width,\n height: pageData.entryPage.hero.image.height,\n }\n : undefined,\n actions: pageData.entryPage.hero.actions?.map((a) => ({\n theme: a.theme,\n text: a.text,\n link: a.link,\n })),\n }\n : undefined,\n features: pageData.entryPage.features?.map((f) => ({\n icon: f.icon,\n title: f.title,\n details: f.details,\n link: f.link,\n linkText: f.linkText,\n })),\n }\n : undefined;\n\n return mod.generateSsgHtml(\n {\n title: pageData.title,\n description: pageData.description,\n content: pageData.content,\n toc: tocForRust,\n path: pageData.path,\n entryPage: entryPageForRust,\n },\n navGroupsForRust,\n {\n siteName,\n base,\n ogImage,\n theme: themeForRust,\n },\n );\n}\n\n/**\n * Converts a markdown file path to its corresponding HTML output path.\n */\nexport function getOutputPath(\n inputPath: string,\n srcDir: string,\n outDir: string,\n extension: string,\n): string {\n const relativePath = path.relative(srcDir, inputPath);\n const baseName = relativePath.replace(/\\.(?:md|markdown)$/i, extension);\n\n if (baseName.endsWith(`index${extension}`)) {\n return path.join(outDir, baseName);\n }\n\n const dirName = baseName.replace(new RegExp(`\\\\${extension}$`), \"\");\n return path.join(outDir, dirName, `index${extension}`);\n}\n\n/**\n * Converts a markdown file path to a relative URL path.\n */\nexport function getUrlPath(inputPath: string, srcDir: string): string {\n const relativePath = path.relative(srcDir, inputPath);\n const baseName = relativePath.replace(/\\.(?:md|markdown)$/i, \"\");\n\n if (baseName === \"index\" || baseName.endsWith(\"/index\")) {\n return baseName.replace(/\\/?index$/, \"\") || \"/\";\n }\n\n return baseName;\n}\n\n/**\n * Converts a markdown file path to an href.\n */\nexport function getHref(\n inputPath: string,\n srcDir: string,\n base: string,\n extension: string,\n): string {\n const urlPath = getUrlPath(inputPath, srcDir);\n if (urlPath === \"/\" || urlPath === \"\") {\n return `${base}index${extension}`;\n }\n return `${base}${urlPath}/index${extension}`;\n}\n\n/**\n * Gets the OG image output path for a given markdown file.\n */\nfunction getOgImagePath(inputPath: string, srcDir: string, outDir: string): string {\n const relativePath = path.relative(srcDir, inputPath);\n const baseName = relativePath.replace(/\\.(?:md|markdown)$/i, \"\");\n\n if (baseName === \"index\" || baseName.endsWith(\"/index\")) {\n const dirPath = baseName.replace(/\\/?index$/, \"\") || \"\";\n return path.join(outDir, dirPath, \"og-image.png\");\n }\n\n return path.join(outDir, baseName, \"og-image.png\");\n}\n\n/**\n * Gets the OG image URL for use in meta tags.\n * If siteUrl is provided, returns an absolute URL (required for SNS sharing).\n */\nfunction getOgImageUrl(inputPath: string, srcDir: string, base: string, siteUrl?: string): string {\n const urlPath = getUrlPath(inputPath, srcDir);\n let relativePath: string;\n if (urlPath === \"/\" || urlPath === \"\") {\n relativePath = `${base}og-image.png`;\n } else {\n relativePath = `${base}${urlPath}/og-image.png`;\n }\n\n // Return absolute URL if siteUrl is provided\n if (siteUrl) {\n const cleanSiteUrl = siteUrl.replace(/\\/$/, \"\");\n return `${cleanSiteUrl}${relativePath}`;\n }\n\n return relativePath;\n}\n\n/**\n * Gets display title from file path.\n */\nfunction getDisplayTitle(filePath: string): string {\n const fileName = path.basename(filePath, path.extname(filePath));\n\n if (fileName === \"index\") {\n const dirName = path.basename(path.dirname(filePath));\n if (dirName && dirName !== \".\") {\n return formatTitle(dirName);\n }\n return \"Home\";\n }\n\n return formatTitle(fileName);\n}\n\n/**\n * Formats a file/dir name as a title.\n */\nexport function formatTitle(name: string): string {\n return name\n .replace(/[-_]([a-z])/g, (_, char) => \" \" + char.toUpperCase())\n .replace(/^[a-z]/, (char) => char.toUpperCase());\n}\n\n/**\n * Collects all markdown files from the source directory.\n */\nexport async function collectMarkdownFiles(srcDir: string): Promise<string[]> {\n const pattern = path.join(srcDir, \"**/*.{md,markdown}\");\n const files = await glob(pattern, {\n nodir: true,\n ignore: [\"**/node_modules/**\", \"**/dist/**\", \"**/.git/**\"],\n });\n return files.sort();\n}\n\n/**\n * Navigation group for hierarchical navigation.\n */\nexport interface NavGroup {\n title: string;\n items: SsgNavItem[];\n}\n\n/**\n * Builds navigation items from markdown files, grouped by directory.\n */\nexport function buildNavItems(\n markdownFiles: string[],\n srcDir: string,\n base: string,\n extension: string,\n): NavGroup[] {\n const groups = new Map<string, SsgNavItem[]>();\n\n // Define the order of groups (api at the bottom)\n const groupOrder = [\"\", \"examples\", \"packages\", \"api\"];\n\n for (const file of markdownFiles) {\n const relativePath = path.relative(srcDir, file);\n const parts = relativePath.split(path.sep);\n\n // Determine group: first directory or '' for root files\n let groupKey = \"\";\n if (parts.length > 1) {\n groupKey = parts[0];\n }\n\n if (!groups.has(groupKey)) {\n groups.set(groupKey, []);\n }\n\n const urlPath = getUrlPath(file, srcDir);\n\n // Use \"Overview\" for root index.md, otherwise use getDisplayTitle\n let title: string;\n if (urlPath === \"/\" || urlPath === \"\") {\n title = \"Overview\";\n } else {\n title = getDisplayTitle(file);\n }\n\n groups.get(groupKey)!.push({\n title,\n path: urlPath,\n href: getHref(file, srcDir, base, extension),\n });\n }\n\n // Sort items within each group: index files first, then alphabetically\n const sortItems = (items: SsgNavItem[]) => {\n return items.sort((a, b) => {\n // Root index (Overview) comes first\n const aIsRoot = a.path === \"/\" || a.path === \"\";\n const bIsRoot = b.path === \"/\" || b.path === \"\";\n if (aIsRoot && !bIsRoot) return -1;\n if (!aIsRoot && bIsRoot) return 1;\n // Otherwise, maintain alphabetical order by title\n return a.title.localeCompare(b.title);\n });\n };\n\n // Convert to array and sort by group order\n const result: NavGroup[] = [];\n\n for (const key of groupOrder) {\n const items = groups.get(key);\n if (items && items.length > 0) {\n result.push({\n title: key === \"\" ? \"Guide\" : formatTitle(key),\n items: sortItems(items),\n });\n groups.delete(key);\n }\n }\n\n // Add any remaining groups\n for (const [key, items] of groups) {\n if (items.length > 0) {\n result.push({\n title: formatTitle(key),\n items: sortItems(items),\n });\n }\n }\n\n return result;\n}\n\n/**\n * Builds all markdown files to static HTML.\n */\nexport async function buildSsg(\n options: ResolvedOptions,\n root: string,\n): Promise<{ files: string[]; errors: string[] }> {\n const ssgOptions = options.ssg;\n if (!ssgOptions.enabled) {\n return { files: [], errors: [] };\n }\n\n const srcDir = path.resolve(root, options.srcDir);\n const outDir = path.resolve(root, options.outDir);\n const base = options.base.endsWith(\"/\") ? options.base : options.base + \"/\";\n const generatedFiles: string[] = [];\n const errors: string[] = [];\n\n // Clean output directory if requested\n if (ssgOptions.clean) {\n try {\n await fs.rm(outDir, { recursive: true, force: true });\n } catch {\n // Ignore if directory doesn't exist\n }\n }\n\n // Collect markdown files\n const markdownFiles = await collectMarkdownFiles(srcDir);\n\n // Build navigation\n const navItems = buildNavItems(markdownFiles, srcDir, base, ssgOptions.extension);\n\n // Get site name from options or package.json\n let siteName = ssgOptions.siteName ?? \"Documentation\";\n if (!ssgOptions.siteName) {\n try {\n const pkgPath = path.join(root, \"package.json\");\n const pkg = JSON.parse(await fs.readFile(pkgPath, \"utf-8\"));\n if (pkg.name) {\n siteName = formatTitle(pkg.name);\n }\n } catch {\n // Use default\n }\n }\n\n // Collect OG image entries for batch rendering\n const ogImageEntries: OgImagePageEntry[] = [];\n // Parallel array tracking the inputPath for each ogImageEntry (same index)\n const ogImageInputPaths: string[] = [];\n // Map from inputPath to OG image URL (filled after batch render)\n const ogImageUrlMap = new Map<string, string>();\n\n // Determine if OG images should be generated\n const shouldGenerateOgImages =\n (options.ogImage || ssgOptions.generateOgImage) && !ssgOptions.bare;\n\n // Collect page metadata for OG image generation\n interface PageProcessResult {\n inputPath: string;\n transformedHtml: string;\n title: string;\n description?: string;\n frontmatter: Record<string, unknown>;\n toc: TocEntry[];\n }\n const pageResults: PageProcessResult[] = [];\n\n // Process each file: transform markdown and collect metadata\n for (const inputPath of markdownFiles) {\n try {\n const content = await fs.readFile(inputPath, \"utf-8\");\n // Pass SSG options to transform for .md -> .html link conversion in Rust\n // The sourcePath is used to determine if the file is an index file for correct relative link resolution\n const result = await transformMarkdown(content, inputPath, options, {\n convertMdLinks: true,\n baseUrl: base,\n sourcePath: inputPath,\n });\n\n // Apply built-in plugin transformations (No-JS First)\n let transformedHtml = result.html;\n\n // Protect mermaid SVGs from rehype processing in plugins\n const { html: protectedHtml, svgs: mermaidSvgs } = protectMermaidSvgs(transformedHtml);\n transformedHtml = protectedHtml;\n\n // Transform Tabs, YouTube, GitHub, OGP, Mermaid plugins\n const pluginOptions: TransformAllOptions = {\n tabs: true,\n youtube: true,\n github: true,\n ogp: true,\n mermaid: true,\n githubToken: process.env.GITHUB_TOKEN,\n };\n transformedHtml = await transformAllPlugins(transformedHtml, pluginOptions);\n\n // Transform Island components\n if (hasIslands(transformedHtml)) {\n const islandResult = await transformIslands(transformedHtml);\n transformedHtml = islandResult.html;\n }\n\n // Restore protected mermaid SVGs\n transformedHtml = restoreMermaidSvgs(transformedHtml, mermaidSvgs);\n\n const title = extractTitle(transformedHtml, result.frontmatter);\n const description = result.frontmatter.description as string | undefined;\n\n pageResults.push({\n inputPath,\n transformedHtml,\n title,\n description,\n frontmatter: result.frontmatter,\n toc: result.toc,\n });\n\n // Collect OG image entry if generation is enabled\n if (shouldGenerateOgImages) {\n const ogImageOutputPath = getOgImagePath(inputPath, srcDir, outDir);\n const { layout: _layout, ...frontmatterRest } = result.frontmatter;\n ogImageEntries.push({\n props: {\n ...frontmatterRest,\n title,\n description,\n siteName,\n },\n outputPath: ogImageOutputPath,\n });\n ogImageInputPaths.push(inputPath);\n // Pre-compute URL so HTML can reference it\n ogImageUrlMap.set(inputPath, getOgImageUrl(inputPath, srcDir, base, ssgOptions.siteUrl));\n }\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n errors.push(`Failed to process ${inputPath}: ${errorMessage}`);\n }\n }\n\n // Batch generate OG images (Chromium-based)\n if (shouldGenerateOgImages && ogImageEntries.length > 0) {\n try {\n const ogResults = await generateOgImages(ogImageEntries, options.ogImageOptions, root);\n let ogSuccessCount = 0;\n for (let i = 0; i < ogResults.length; i++) {\n const result = ogResults[i];\n if (result.error) {\n errors.push(`OG image failed for ${result.outputPath}: ${result.error}`);\n // Remove failed entries so og:image / twitter:image meta tags are not emitted\n ogImageUrlMap.delete(ogImageInputPaths[i]);\n } else {\n generatedFiles.push(result.outputPath);\n ogSuccessCount++;\n }\n }\n if (ogSuccessCount > 0) {\n const cachedCount = ogResults.filter((r) => r.cached && !r.error).length;\n console.log(\n `[ox-content:og-image] Generated ${ogSuccessCount} OG images` +\n (cachedCount > 0 ? ` (${cachedCount} from cache)` : \"\"),\n );\n }\n } catch (err) {\n // Non-fatal: OG image failures never block the SSG build\n const errorMessage = err instanceof Error ? err.message : String(err);\n console.warn(`[ox-content:og-image] Batch generation failed: ${errorMessage}`);\n // Clear all entries so og:image / twitter:image meta tags are not emitted\n ogImageUrlMap.clear();\n }\n }\n\n // Generate HTML pages\n for (const pageResult of pageResults) {\n try {\n const { inputPath, transformedHtml, title, description, frontmatter, toc } = pageResult;\n\n // Determine OG image URL for this page\n let pageOgImage = ssgOptions.ogImage; // fallback to static URL\n if (shouldGenerateOgImages && ogImageUrlMap.has(inputPath)) {\n pageOgImage = ogImageUrlMap.get(inputPath);\n }\n\n // Check if this is an entry page (layout: entry)\n let entryPage: SsgEntryPageConfig | undefined;\n if (frontmatter.layout === \"entry\") {\n entryPage = {\n hero: frontmatter.hero as HeroConfig | undefined,\n features: frontmatter.features as FeatureConfig[] | undefined,\n };\n }\n\n // Generate HTML based on bare option\n let html: string;\n if (ssgOptions.bare) {\n html = generateBareHtmlPage(transformedHtml, title);\n } else {\n const pageData: SsgPageData = {\n title,\n description,\n content: transformedHtml,\n toc,\n frontmatter,\n path: getUrlPath(inputPath, srcDir),\n href: getHref(inputPath, srcDir, base, ssgOptions.extension),\n entryPage,\n };\n html = await generateHtmlPage(\n pageData,\n navItems,\n siteName,\n base,\n pageOgImage,\n ssgOptions.theme,\n );\n }\n\n // Write output file\n const outputPath = getOutputPath(inputPath, srcDir, outDir, ssgOptions.extension);\n\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.writeFile(outputPath, html, \"utf-8\");\n\n generatedFiles.push(outputPath);\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n errors.push(`Failed to generate HTML for ${pageResult.inputPath}: ${errorMessage}`);\n }\n }\n\n return { files: generatedFiles, errors };\n}\n","/**\n * Full-text search functionality for Ox Content.\n *\n * Generates search index at build time and provides client-side search.\n */\n\nimport * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport type { SearchOptions, ResolvedSearchOptions, SearchDocument } from \"./types\";\n\n// Import Rust bindings\nlet oxContent: typeof import(\"@ox-content/napi\") | null = null;\n\nasync function getOxContent() {\n if (!oxContent) {\n try {\n oxContent = await import(\"@ox-content/napi\");\n } catch {\n console.warn(\"[ox-content] Native bindings not available, search disabled\");\n return null;\n }\n }\n return oxContent;\n}\n\n/**\n * Resolves search options with defaults.\n */\nexport function resolveSearchOptions(\n options: SearchOptions | boolean | undefined,\n): ResolvedSearchOptions {\n if (options === false) {\n return {\n enabled: false,\n limit: 10,\n prefix: true,\n placeholder: \"Search documentation...\",\n hotkey: \"/\",\n };\n }\n\n const opts = typeof options === \"object\" ? options : {};\n\n return {\n enabled: opts.enabled ?? true,\n limit: opts.limit ?? 10,\n prefix: opts.prefix ?? true,\n placeholder: opts.placeholder ?? \"Search documentation...\",\n hotkey: opts.hotkey ?? \"/\",\n };\n}\n\n/**\n * Collects all Markdown files from a directory.\n */\nasync function collectMarkdownFiles(dir: string): Promise<string[]> {\n const files: string[] = [];\n\n async function walk(currentDir: string) {\n try {\n const entries = await fs.readdir(currentDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(currentDir, entry.name);\n\n if (entry.isDirectory() && !entry.name.startsWith(\".\") && entry.name !== \"node_modules\") {\n await walk(fullPath);\n } else if (entry.isFile() && entry.name.endsWith(\".md\")) {\n files.push(fullPath);\n }\n }\n } catch {\n // Ignore errors\n }\n }\n\n await walk(dir);\n return files;\n}\n\n/**\n * Builds the search index from Markdown files.\n */\nexport async function buildSearchIndex(srcDir: string, base: string): Promise<string> {\n const napi = await getOxContent();\n\n if (!napi) {\n return JSON.stringify({\n documents: [],\n index: {},\n df: {},\n avg_dl: 0,\n doc_count: 0,\n });\n }\n\n const files = await collectMarkdownFiles(srcDir);\n const documents: SearchDocument[] = [];\n\n for (const file of files) {\n try {\n const content = await fs.readFile(file, \"utf-8\");\n const relativePath = path.relative(srcDir, file);\n const url = base + relativePath.replace(/\\.md$/, \"\").replace(/\\\\/g, \"/\");\n const id = relativePath.replace(/\\.md$/, \"\").replace(/\\\\/g, \"/\");\n\n // Use Rust bindings to extract search content (if available)\n const extractSearchContent = (napi as any).extractSearchContent;\n if (!extractSearchContent) {\n console.warn(\"[ox-content] Search not available: extractSearchContent not implemented\");\n return \"[]\";\n }\n const doc = extractSearchContent(content, id, url, { gfm: true });\n\n documents.push({\n id: doc.id,\n title: doc.title,\n url: doc.url,\n body: doc.body,\n headings: doc.headings,\n code: doc.code,\n });\n } catch {\n // Skip files that can't be processed\n }\n }\n\n // Build the index using Rust bindings (if available)\n const buildSearchIndex = (napi as any).buildSearchIndex;\n if (!buildSearchIndex) {\n console.warn(\"[ox-content] Search not available: buildSearchIndex not implemented\");\n return JSON.stringify(documents);\n }\n return buildSearchIndex(documents);\n}\n\n/**\n * Writes the search index to a file.\n */\nexport async function writeSearchIndex(indexJson: string, outDir: string): Promise<void> {\n const indexPath = path.join(outDir, \"search-index.json\");\n\n // Ensure output directory exists\n await fs.mkdir(outDir, { recursive: true });\n\n // Write the index\n await fs.writeFile(indexPath, indexJson, \"utf-8\");\n}\n\n/**\n * Client-side search module code.\n * This is injected into the bundle as a virtual module.\n */\nexport function generateSearchModule(options: ResolvedSearchOptions, indexPath: string): string {\n return `\n// Search module generated by ox-content\nconst searchOptions = ${JSON.stringify(options)};\n\nlet searchIndex = null;\nlet indexPromise = null;\n\n// Tokenizer for queries\nfunction tokenizeQuery(text) {\n const tokens = [];\n let current = '';\n\n for (const char of text) {\n const isCjk = /[\\\\u4E00-\\\\u9FFF\\\\u3400-\\\\u4DBF\\\\u3040-\\\\u309F\\\\u30A0-\\\\u30FF\\\\uAC00-\\\\uD7AF]/.test(char);\n\n if (isCjk) {\n if (current) {\n tokens.push(current.toLowerCase());\n current = '';\n }\n tokens.push(char);\n } else if (/[a-zA-Z0-9_]/.test(char)) {\n current += char;\n } else if (current) {\n tokens.push(current.toLowerCase());\n current = '';\n }\n }\n\n if (current) {\n tokens.push(current.toLowerCase());\n }\n\n return tokens;\n}\n\n// BM25 scoring\nfunction computeIdf(df, docCount) {\n return Math.log((docCount - df + 0.5) / (df + 0.5) + 1.0);\n}\n\nfunction getFieldBoost(field) {\n switch (field) {\n case 'Title': return 10.0;\n case 'Heading': return 5.0;\n case 'Body': return 1.0;\n case 'Code': return 0.5;\n default: return 1.0;\n }\n}\n\n// Load the index\nasync function loadIndex() {\n if (searchIndex) return searchIndex;\n if (indexPromise) return indexPromise;\n\n indexPromise = fetch('${indexPath}')\n .then(res => res.json())\n .then(data => {\n searchIndex = data;\n return data;\n })\n .catch(err => {\n console.error('[ox-content] Failed to load search index:', err);\n return null;\n });\n\n return indexPromise;\n}\n\n// Search function\nexport async function search(query, options = {}) {\n const index = await loadIndex();\n\n if (!index || !query.trim()) {\n return [];\n }\n\n const limit = options.limit ?? searchOptions.limit;\n const prefix = options.prefix ?? searchOptions.prefix;\n const tokens = tokenizeQuery(query);\n\n if (tokens.length === 0) {\n return [];\n }\n\n const k1 = 1.2;\n const b = 0.75;\n const docScores = new Map();\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n const isLast = i === tokens.length - 1;\n\n // Find matching terms\n let matchingTerms = [];\n if (prefix && isLast && token.length >= 2) {\n matchingTerms = Object.keys(index.index).filter(term => term.startsWith(token));\n } else if (index.index[token]) {\n matchingTerms = [token];\n }\n\n for (const term of matchingTerms) {\n const postings = index.index[term] || [];\n const df = index.df[term] || 1;\n const idf = computeIdf(df, index.doc_count);\n\n for (const posting of postings) {\n const doc = index.documents[posting.doc_idx];\n if (!doc) continue;\n\n const docLen = doc.body.length;\n const tf = posting.tf;\n const boost = getFieldBoost(posting.field);\n\n const score = idf * ((tf * (k1 + 1.0)) / (tf + k1 * (1.0 - b + b * docLen / index.avg_dl))) * boost;\n\n if (!docScores.has(posting.doc_idx)) {\n docScores.set(posting.doc_idx, { score: 0, matches: new Set() });\n }\n const entry = docScores.get(posting.doc_idx);\n entry.score += score;\n entry.matches.add(term);\n }\n }\n }\n\n // Convert to results\n const results = Array.from(docScores.entries())\n .map(([docIdx, data]) => {\n const doc = index.documents[docIdx];\n const matches = Array.from(data.matches);\n\n // Generate snippet\n let snippet = '';\n if (doc.body) {\n const bodyLower = doc.body.toLowerCase();\n let firstPos = -1;\n for (const match of matches) {\n const pos = bodyLower.indexOf(match);\n if (pos !== -1 && (firstPos === -1 || pos < firstPos)) {\n firstPos = pos;\n }\n }\n\n const start = Math.max(0, firstPos - 50);\n const end = Math.min(doc.body.length, start + 150);\n snippet = doc.body.slice(start, end);\n if (start > 0) snippet = '...' + snippet;\n if (end < doc.body.length) snippet = snippet + '...';\n }\n\n return {\n id: doc.id,\n title: doc.title,\n url: doc.url,\n score: data.score,\n matches,\n snippet,\n };\n })\n .sort((a, b) => b.score - a.score)\n .slice(0, limit);\n\n return results;\n}\n\nexport { searchOptions };\nexport default { search, searchOptions, loadIndex };\n`;\n}\n","/**\n * Dev server middleware for ox-content SSG.\n *\n * Serves fully-rendered HTML pages (with navigation, theme, etc.)\n * during `vite dev`, matching the SSG build output.\n */\n\nimport * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport type { Connect } from \"vite\";\nimport { transformMarkdown } from \"./transform\";\nimport { transformAllPlugins } from \"./plugins\";\nimport { resetTabGroupCounter } from \"./plugins\";\nimport { protectMermaidSvgs, restoreMermaidSvgs } from \"./plugins/mermaid-protect\";\nimport { transformIslands, hasIslands, resetIslandCounter } from \"./island\";\nimport {\n collectMarkdownFiles,\n buildNavItems,\n extractTitle,\n getUrlPath,\n generateHtmlPage,\n formatTitle,\n} from \"./ssg\";\nimport type { NavGroup, SsgPageData, SsgEntryPageConfig } from \"./ssg\";\nimport type { ResolvedOptions } from \"./types\";\nimport type { HeroConfig, FeatureConfig } from \"./types\";\n\n/** File extensions to skip in the middleware. */\nconst SKIP_EXTENSIONS = new Set([\n \".js\",\n \".ts\",\n \".css\",\n \".scss\",\n \".less\",\n \".svg\",\n \".png\",\n \".jpg\",\n \".jpeg\",\n \".gif\",\n \".webp\",\n \".ico\",\n \".woff\",\n \".woff2\",\n \".ttf\",\n \".eot\",\n \".json\",\n \".map\",\n \".mp4\",\n \".webm\",\n \".mp3\",\n \".pdf\",\n]);\n\n/** Vite internal URL prefixes to skip. */\nconst VITE_INTERNAL_PREFIXES = [\"/@vite/\", \"/@fs/\", \"/@id/\", \"/__\"];\n\n/**\n * Check if a request URL should be skipped by the dev server middleware.\n */\nfunction shouldSkip(url: string): boolean {\n // Skip Vite internal URLs\n for (const prefix of VITE_INTERNAL_PREFIXES) {\n if (url.startsWith(prefix)) return true;\n }\n\n // Skip node_modules\n if (url.includes(\"/node_modules/\")) return true;\n\n // Skip requests with known static file extensions\n const extMatch = url.match(/\\.([a-zA-Z0-9]+)(?:\\?|$)/);\n if (extMatch) {\n const ext = \".\" + extMatch[1].toLowerCase();\n if (SKIP_EXTENSIONS.has(ext)) return true;\n }\n\n return false;\n}\n\n/**\n * Resolve a request URL to a markdown file path.\n * Returns null if no matching file exists.\n */\nasync function resolveMarkdownFile(url: string, srcDir: string): Promise<string | null> {\n // Remove query string and hash\n let pathname = url.split(\"?\")[0].split(\"#\")[0];\n\n // Remove trailing /index.html\n if (pathname.endsWith(\"/index.html\")) {\n pathname = pathname.slice(0, -\"/index.html\".length) || \"/\";\n }\n\n // Remove trailing slash (except for root)\n if (pathname !== \"/\" && pathname.endsWith(\"/\")) {\n pathname = pathname.slice(0, -1);\n }\n\n // Map URL to potential markdown file path\n let relativePath: string;\n if (pathname === \"/\") {\n relativePath = \"index.md\";\n } else {\n // Remove leading slash\n relativePath = pathname.slice(1) + \".md\";\n }\n\n const filePath = path.join(srcDir, relativePath);\n\n try {\n await fs.access(filePath);\n return filePath;\n } catch {\n // Try as directory index\n const indexPath = path.join(srcDir, pathname === \"/\" ? \"\" : pathname.slice(1), \"index.md\");\n try {\n await fs.access(indexPath);\n return indexPath;\n } catch {\n return null;\n }\n }\n}\n\n/**\n * Inject Vite HMR client script into the HTML.\n */\nfunction injectViteHmrClient(html: string): string {\n const hmrScript = `<script type=\"module\" src=\"/@vite/client\"></script>\n<script type=\"module\">\nif (import.meta.hot) {\n import.meta.hot.on('ox-content:update', () => {\n location.reload();\n });\n}\n</script>`;\n\n return html.replace(\"</head>\", hmrScript + \"\\n</head>\");\n}\n\n/**\n * Dev server state for caching.\n */\ninterface DevServerCache {\n /** Cached navigation groups. Invalidated on file add/unlink. */\n navGroups: NavGroup[] | null;\n /** Cached rendered HTML keyed by absolute file path. */\n pages: Map<string, string>;\n /** Cached site name. Computed once. */\n siteName: string | null;\n}\n\n/**\n * Create a dev server cache instance.\n */\nexport function createDevServerCache(): DevServerCache {\n return {\n navGroups: null,\n pages: new Map(),\n siteName: null,\n };\n}\n\n/**\n * Invalidate navigation cache (called on file add/unlink).\n */\nexport function invalidateNavCache(cache: DevServerCache): void {\n cache.navGroups = null;\n // Also clear all page caches since navigation HTML is embedded in pages\n cache.pages.clear();\n}\n\n/**\n * Invalidate page cache for a specific file (called on file change).\n */\nexport function invalidatePageCache(cache: DevServerCache, filePath: string): void {\n cache.pages.delete(filePath);\n}\n\n/**\n * Resolve site name from options or package.json.\n */\nasync function resolveSiteName(options: ResolvedOptions, root: string): Promise<string> {\n if (options.ssg.siteName) {\n return options.ssg.siteName;\n }\n\n try {\n const pkgPath = path.join(root, \"package.json\");\n const pkg = JSON.parse(await fs.readFile(pkgPath, \"utf-8\"));\n if (pkg.name) {\n return formatTitle(pkg.name);\n }\n } catch {\n // Use default\n }\n\n return \"Documentation\";\n}\n\n/**\n * Render a single markdown page to full HTML.\n */\nasync function renderPage(\n filePath: string,\n options: ResolvedOptions,\n navGroups: NavGroup[],\n siteName: string,\n base: string,\n root: string,\n): Promise<string> {\n const srcDir = path.resolve(root, options.srcDir);\n\n // Reset counters for clean render\n resetTabGroupCounter();\n resetIslandCounter();\n\n // Read markdown content\n const content = await fs.readFile(filePath, \"utf-8\");\n\n // Transform markdown to HTML\n const result = await transformMarkdown(content, filePath, options, {\n convertMdLinks: true,\n baseUrl: base,\n sourcePath: filePath,\n });\n\n let transformedHtml = result.html;\n\n // Protect mermaid SVGs from rehype processing\n const { html: protectedHtml, svgs: mermaidSvgs } = protectMermaidSvgs(transformedHtml);\n transformedHtml = protectedHtml;\n\n // Transform all plugins\n transformedHtml = await transformAllPlugins(transformedHtml, {\n tabs: true,\n youtube: true,\n github: true,\n ogp: true,\n mermaid: true,\n githubToken: process.env.GITHUB_TOKEN,\n });\n\n // Transform Island components\n if (hasIslands(transformedHtml)) {\n const islandResult = await transformIslands(transformedHtml);\n transformedHtml = islandResult.html;\n }\n\n // Restore protected mermaid SVGs\n transformedHtml = restoreMermaidSvgs(transformedHtml, mermaidSvgs);\n\n // Extract title\n const title = extractTitle(transformedHtml, result.frontmatter);\n const description = result.frontmatter.description as string | undefined;\n\n // Check if this is an entry page\n let entryPage: SsgEntryPageConfig | undefined;\n if (result.frontmatter.layout === \"entry\") {\n entryPage = {\n hero: result.frontmatter.hero as HeroConfig | undefined,\n features: result.frontmatter.features as FeatureConfig[] | undefined,\n };\n }\n\n // Build page data\n const pageData: SsgPageData = {\n title,\n description,\n content: transformedHtml,\n toc: result.toc,\n frontmatter: result.frontmatter,\n path: getUrlPath(filePath, srcDir),\n href: getUrlPath(filePath, srcDir) || \"/\",\n entryPage,\n };\n\n // Generate full HTML page\n let html = await generateHtmlPage(\n pageData,\n navGroups,\n siteName,\n base,\n options.ssg.ogImage,\n options.ssg.theme,\n );\n\n // Inject Vite HMR client for live reload\n html = injectViteHmrClient(html);\n\n return html;\n}\n\n/**\n * Create the dev server middleware for SSG page serving.\n */\nexport function createDevServerMiddleware(\n options: ResolvedOptions,\n root: string,\n cache: DevServerCache,\n): Connect.NextHandleFunction {\n const srcDir = path.resolve(root, options.srcDir);\n const base = options.base.endsWith(\"/\") ? options.base : options.base + \"/\";\n\n return async (req, res, next) => {\n const url = req.url;\n if (!url) return next();\n\n // Strip base from URL for routing\n let routeUrl = url;\n if (base !== \"/\" && routeUrl.startsWith(base)) {\n routeUrl = \"/\" + routeUrl.slice(base.length);\n }\n\n // Skip non-page requests\n if (shouldSkip(routeUrl)) return next();\n\n // Resolve markdown file\n const filePath = await resolveMarkdownFile(routeUrl, srcDir);\n if (!filePath) return next();\n\n try {\n // Check page cache\n const cached = cache.pages.get(filePath);\n if (cached) {\n res.setHeader(\"Content-Type\", \"text/html\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.end(cached);\n return;\n }\n\n // Resolve site name (cached after first call)\n if (!cache.siteName) {\n cache.siteName = await resolveSiteName(options, root);\n }\n\n // Build navigation if not cached\n if (!cache.navGroups) {\n const markdownFiles = await collectMarkdownFiles(srcDir);\n cache.navGroups = buildNavItems(markdownFiles, srcDir, base, \".html\");\n }\n\n // Render the page\n const html = await renderPage(filePath, options, cache.navGroups, cache.siteName, base, root);\n\n // Cache the result\n cache.pages.set(filePath, html);\n\n res.setHeader(\"Content-Type\", \"text/html\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.end(html);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n console.error(`[ox-content:dev] Failed to render ${filePath}:`, message);\n next();\n }\n };\n}\n","/**\n * OG Viewer - Dev tool for previewing Open Graph metadata\n *\n * Accessible at /__og-viewer during development.\n * Shows all pages with their OG metadata, validation warnings,\n * and social card previews.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { glob } from \"glob\";\nimport type { Plugin } from \"vite\";\nimport type { ResolvedOptions } from \"./types\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\ninterface PageOgData {\n path: string;\n urlPath: string;\n title: string;\n description: string;\n author: string;\n tags: string[];\n ogImageUrl: string;\n warnings: { level: \"error\" | \"warning\"; message: string }[];\n}\n\n// =============================================================================\n// Data Collection\n// =============================================================================\n\nfunction parseFrontmatter(content: string): Record<string, unknown> {\n const match = content.match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---/);\n if (!match) return {};\n\n const yaml = match[1];\n const result: Record<string, unknown> = {};\n\n for (const line of yaml.split(\"\\n\")) {\n const kv = line.match(/^(\\w[\\w-]*):\\s*(.*)$/);\n if (!kv) continue;\n const [, key, rawValue] = kv;\n let value: unknown = rawValue.trim();\n\n // Handle arrays (simple inline: [a, b])\n if (typeof value === \"string\" && value.startsWith(\"[\") && value.endsWith(\"]\")) {\n value = value\n .slice(1, -1)\n .split(\",\")\n .map((s) => s.trim().replace(/^['\"]|['\"]$/g, \"\"))\n .filter(Boolean);\n }\n // Strip quotes\n else if (typeof value === \"string\" && /^['\"].*['\"]$/.test(value)) {\n value = value.slice(1, -1);\n }\n // Booleans\n else if (value === \"true\") value = true;\n else if (value === \"false\") value = false;\n\n result[key] = value;\n }\n\n return result;\n}\n\nfunction extractTitle(content: string, frontmatter: Record<string, unknown>): string {\n if (typeof frontmatter.title === \"string\" && frontmatter.title) {\n return frontmatter.title;\n }\n // Fallback: first # heading\n const match = content.match(/^#\\s+(.+)$/m);\n return match ? match[1].trim() : \"\";\n}\n\nfunction getUrlPath(filePath: string, srcDir: string): string {\n let rel = path.relative(srcDir, filePath).replace(/\\\\/g, \"/\");\n rel = rel.replace(/\\.md$/, \"\");\n if (rel === \"index\") return \"/\";\n if (rel.endsWith(\"/index\")) rel = rel.slice(0, -\"/index\".length);\n return \"/\" + rel;\n}\n\nfunction computeOgImageUrl(\n urlPath: string,\n base: string,\n siteUrl?: string,\n generateOgImage?: boolean,\n staticOgImage?: string,\n): string {\n if (!generateOgImage) return staticOgImage || \"\";\n\n const cleanBase = base.endsWith(\"/\") ? base : base + \"/\";\n let relativePath: string;\n if (urlPath === \"/\") {\n relativePath = `${cleanBase}og-image.png`;\n } else {\n relativePath = `${cleanBase}${urlPath.replace(/^\\//, \"\")}/og-image.png`;\n }\n\n if (siteUrl) {\n const cleanSiteUrl = siteUrl.replace(/\\/$/, \"\");\n return `${cleanSiteUrl}${relativePath}`;\n }\n return relativePath;\n}\n\nfunction validatePage(\n page: { title: string; description: string; ogImageUrl: string },\n options: ResolvedOptions,\n): { level: \"error\" | \"warning\"; message: string }[] {\n const warnings: { level: \"error\" | \"warning\"; message: string }[] = [];\n\n if (!page.title) {\n warnings.push({ level: \"error\", message: \"title is missing\" });\n } else if (page.title.length > 70) {\n warnings.push({ level: \"warning\", message: `title is too long (${page.title.length}/70)` });\n }\n\n if (!page.description) {\n warnings.push({ level: \"warning\", message: \"description is missing\" });\n } else if (page.description.length > 200) {\n warnings.push({\n level: \"warning\",\n message: `description is too long (${page.description.length}/200)`,\n });\n }\n\n const generateOgImage = options.ogImage || options.ssg.generateOgImage;\n if (generateOgImage && !options.ssg.siteUrl) {\n warnings.push({ level: \"warning\", message: \"ogImage enabled but siteUrl is not set\" });\n }\n\n return warnings;\n}\n\nasync function collectPages(options: ResolvedOptions, root: string): Promise<PageOgData[]> {\n const srcDir = path.resolve(root, options.srcDir);\n const files = await glob(\"**/*.md\", { cwd: srcDir, absolute: true });\n\n const pages: PageOgData[] = [];\n const generateOgImage = options.ogImage || options.ssg.generateOgImage;\n\n for (const file of files.sort()) {\n const content = fs.readFileSync(file, \"utf-8\");\n const frontmatter = parseFrontmatter(content);\n\n // Skip entry layout pages (they are landing pages, not content pages)\n if (frontmatter.layout === \"entry\") continue;\n\n const title = extractTitle(content, frontmatter);\n const description = typeof frontmatter.description === \"string\" ? frontmatter.description : \"\";\n const author = typeof frontmatter.author === \"string\" ? frontmatter.author : \"\";\n const tags = Array.isArray(frontmatter.tags)\n ? (frontmatter.tags as string[])\n : typeof frontmatter.tags === \"string\"\n ? [frontmatter.tags]\n : [];\n\n const urlPath = getUrlPath(file, srcDir);\n const ogImageUrl = computeOgImageUrl(\n urlPath,\n options.base,\n options.ssg.siteUrl,\n generateOgImage,\n options.ssg.ogImage,\n );\n\n const page = {\n path: path.relative(srcDir, file),\n urlPath,\n title,\n description,\n author,\n tags,\n ogImageUrl,\n warnings: [] as PageOgData[\"warnings\"],\n };\n page.warnings = validatePage(page, options);\n pages.push(page);\n }\n\n return pages;\n}\n\n// =============================================================================\n// HTML Rendering\n// =============================================================================\n\nfunction renderViewerHtml(pages: PageOgData[], options: ResolvedOptions): string {\n const generateOgImage = options.ogImage || options.ssg.generateOgImage;\n const totalWarnings = pages.reduce(\n (sum, p) => sum + p.warnings.filter((w) => w.level === \"warning\").length,\n 0,\n );\n const totalErrors = pages.reduce(\n (sum, p) => sum + p.warnings.filter((w) => w.level === \"error\").length,\n 0,\n );\n\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>OG Viewer - ox-content</title>\n <style>\n :root {\n --bg: #ffffff;\n --bg-card: #f8f9fa;\n --bg-preview: #ffffff;\n --text: #1a1a2e;\n --text-muted: #6b7280;\n --border: #e5e7eb;\n --accent: #e8590c;\n --accent-light: #fff4e6;\n --error: #dc2626;\n --error-bg: #fef2f2;\n --warning: #d97706;\n --warning-bg: #fffbeb;\n --success: #16a34a;\n --tag-bg: #f0f0f0;\n --shadow: 0 1px 3px rgba(0,0,0,0.08);\n --radius: 8px;\n }\n @media (prefers-color-scheme: dark) {\n :root {\n --bg: #0f172a;\n --bg-card: #1e293b;\n --bg-preview: #334155;\n --text: #e2e8f0;\n --text-muted: #94a3b8;\n --border: #334155;\n --accent: #fb923c;\n --accent-light: #431407;\n --error: #f87171;\n --error-bg: #450a0a;\n --warning: #fbbf24;\n --warning-bg: #451a03;\n --success: #4ade80;\n --tag-bg: #334155;\n --shadow: 0 1px 3px rgba(0,0,0,0.3);\n }\n }\n * { margin: 0; padding: 0; box-sizing: border-box; }\n body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }\n .header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }\n .header svg { width: 28px; height: 28px; color: var(--accent); }\n .header h1 { font-size: 18px; font-weight: 600; }\n .header h1 span { color: var(--text-muted); font-weight: 400; }\n .header-actions { margin-left: auto; }\n .btn { padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--text); cursor: pointer; font-size: 13px; transition: all 0.15s; }\n .btn:hover { border-color: var(--accent); color: var(--accent); }\n .summary { padding: 12px 24px; display: flex; gap: 20px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted); flex-wrap: wrap; align-items: center; }\n .summary-item { display: flex; align-items: center; gap: 4px; }\n .summary-item strong { color: var(--text); }\n .summary-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }\n .dot-error { background: var(--error); }\n .dot-warning { background: var(--warning); }\n .dot-success { background: var(--success); }\n .toolbar { padding: 12px 24px; display: flex; gap: 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }\n .filter-btn { padding: 4px 12px; border: 1px solid var(--border); border-radius: 16px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; transition: all 0.15s; }\n .filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }\n .search-input { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 13px; flex: 1; min-width: 200px; }\n .search-input::placeholder { color: var(--text-muted); }\n .container { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1200px; margin: 0 auto; }\n .card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); box-shadow: var(--shadow); overflow: hidden; }\n .card-header { padding: 16px; border-bottom: 1px solid var(--border); }\n .card-path { font-size: 12px; color: var(--text-muted); font-family: monospace; margin-bottom: 4px; }\n .card-title { font-size: 16px; font-weight: 600; }\n .card-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; }\n .card-meta { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }\n .tag { padding: 2px 8px; background: var(--tag-bg); border-radius: 4px; font-size: 11px; color: var(--text-muted); }\n .card-warnings { padding: 8px 16px; display: flex; flex-direction: column; gap: 4px; }\n .warning-item { font-size: 12px; padding: 4px 8px; border-radius: 4px; }\n .warning-item.error { background: var(--error-bg); color: var(--error); }\n .warning-item.warning { background: var(--warning-bg); color: var(--warning); }\n .card-previews { padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }\n @media (max-width: 768px) { .card-previews { grid-template-columns: 1fr; } }\n .preview { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }\n .preview-label { padding: 6px 10px; font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.5px; }\n .preview-card { background: var(--bg-preview); }\n .preview-img { width: 100%; aspect-ratio: 1200/630; background: linear-gradient(135deg, var(--accent-light), var(--bg-card)); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 12px; overflow: hidden; }\n .preview-img img { width: 100%; height: 100%; object-fit: cover; }\n .preview-body { padding: 10px 12px; }\n .preview-url { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .preview-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n .preview-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n .empty { text-align: center; padding: 60px; color: var(--text-muted); }\n .spin { animation: spin 0.6s linear infinite; }\n @keyframes spin { to { transform: rotate(360deg); } }\n </style>\n</head>\n<body>\n <div class=\"header\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\"/></svg>\n <h1>OG Viewer <span>/ ox-content</span></h1>\n <div class=\"header-actions\">\n <button class=\"btn\" id=\"refresh-btn\" onclick=\"refresh()\">Refresh</button>\n </div>\n </div>\n <div class=\"summary\" id=\"summary\">\n <div class=\"summary-item\"><strong id=\"s-pages\">${pages.length}</strong>&nbsp;pages</div>\n <div class=\"summary-item\"><span class=\"summary-dot dot-error\"></span>&nbsp;<strong id=\"s-errors\">${totalErrors}</strong>&nbsp;errors</div>\n <div class=\"summary-item\"><span class=\"summary-dot dot-warning\"></span>&nbsp;<strong id=\"s-warnings\">${totalWarnings}</strong>&nbsp;warnings</div>\n <div class=\"summary-item\"><span class=\"summary-dot ${generateOgImage ? \"dot-success\" : \"dot-warning\"}\"></span>&nbsp;ogImage: <strong>${generateOgImage ? \"enabled\" : \"disabled\"}</strong></div>\n </div>\n <div class=\"toolbar\">\n <button class=\"filter-btn active\" data-filter=\"all\" onclick=\"setFilter('all')\">All</button>\n <button class=\"filter-btn\" data-filter=\"warnings\" onclick=\"setFilter('warnings')\">Warnings</button>\n <button class=\"filter-btn\" data-filter=\"errors\" onclick=\"setFilter('errors')\">Errors</button>\n <input class=\"search-input\" type=\"text\" placeholder=\"Search pages...\" oninput=\"applyFilters()\" id=\"search-input\">\n </div>\n <div class=\"container\" id=\"container\"></div>\n\n <script>\n let pages = ${JSON.stringify(pages)};\n let currentFilter = 'all';\n\n function setFilter(f) {\n currentFilter = f;\n document.querySelectorAll('.filter-btn').forEach(b => b.classList.toggle('active', b.dataset.filter === f));\n applyFilters();\n }\n\n function applyFilters() {\n const q = document.getElementById('search-input').value.toLowerCase();\n const filtered = pages.filter(p => {\n if (currentFilter === 'errors' && !p.warnings.some(w => w.level === 'error')) return false;\n if (currentFilter === 'warnings' && !p.warnings.length) return false;\n if (q && !p.path.toLowerCase().includes(q) && !p.title.toLowerCase().includes(q) && !p.description.toLowerCase().includes(q)) return false;\n return true;\n });\n renderCards(filtered);\n }\n\n function esc(s) {\n const d = document.createElement('div');\n d.textContent = s;\n return d.innerHTML;\n }\n\n function renderCards(list) {\n const c = document.getElementById('container');\n if (!list.length) {\n c.innerHTML = '<div class=\"empty\">No pages match the current filter.</div>';\n return;\n }\n c.innerHTML = list.map(p => {\n const warnings = p.warnings.map(w =>\n '<div class=\"warning-item ' + w.level + '\">' + (w.level === 'error' ? '\\\\u2716' : '\\\\u26A0') + ' ' + esc(w.message) + '</div>'\n ).join('');\n const tags = p.tags.map(t => '<span class=\"tag\">' + esc(t) + '</span>').join('');\n const author = p.author ? '<span class=\"tag\">by ' + esc(p.author) + '</span>' : '';\n const imgHtml = p.ogImageUrl\n ? '<img src=\"' + esc(p.ogImageUrl) + '\" onerror=\"this.parentNode.innerHTML=\\\\'No OG image\\\\'\">'\n : 'No OG image';\n const siteHost = ${JSON.stringify(options.ssg.siteUrl || \"example.com\")};\n return '<div class=\"card\">'\n + '<div class=\"card-header\">'\n + '<div class=\"card-path\">' + esc(p.path) + ' &rarr; ' + esc(p.urlPath) + '</div>'\n + '<div class=\"card-title\">' + (esc(p.title) || '<em style=\"color:var(--error)\">No title</em>') + '</div>'\n + (p.description ? '<div class=\"card-desc\">' + esc(p.description) + '</div>' : '')\n + (tags || author ? '<div class=\"card-meta\">' + author + tags + '</div>' : '')\n + '</div>'\n + (warnings ? '<div class=\"card-warnings\">' + warnings + '</div>' : '')\n + '<div class=\"card-previews\">'\n + '<div class=\"preview\"><div class=\"preview-label\">Twitter (summary_large_image)</div><div class=\"preview-card\"><div class=\"preview-img\">' + imgHtml + '</div><div class=\"preview-body\"><div class=\"preview-url\">' + esc(siteHost) + '</div><div class=\"preview-title\">' + esc(p.title) + '</div><div class=\"preview-desc\">' + esc(p.description) + '</div></div></div></div>'\n + '<div class=\"preview\"><div class=\"preview-label\">Facebook (Open Graph)</div><div class=\"preview-card\"><div class=\"preview-img\">' + imgHtml + '</div><div class=\"preview-body\"><div class=\"preview-url\">' + esc(siteHost) + '</div><div class=\"preview-title\">' + esc(p.title) + '</div><div class=\"preview-desc\">' + esc(p.description) + '</div></div></div></div>'\n + '</div>'\n + '</div>';\n }).join('');\n }\n\n async function refresh() {\n const btn = document.getElementById('refresh-btn');\n btn.textContent = 'Refreshing...';\n btn.disabled = true;\n try {\n const res = await fetch('/__og-viewer/api/pages');\n pages = await res.json();\n updateSummary();\n applyFilters();\n } catch(e) {\n console.error('Refresh failed:', e);\n } finally {\n btn.textContent = 'Refresh';\n btn.disabled = false;\n }\n }\n\n function updateSummary() {\n document.getElementById('s-pages').textContent = pages.length;\n document.getElementById('s-errors').textContent = pages.reduce((s,p) => s + p.warnings.filter(w => w.level === 'error').length, 0);\n document.getElementById('s-warnings').textContent = pages.reduce((s,p) => s + p.warnings.filter(w => w.level === 'warning').length, 0);\n }\n\n renderCards(pages);\n </script>\n</body>\n</html>`;\n}\n\n// =============================================================================\n// Plugin\n// =============================================================================\n\nexport function createOgViewerPlugin(options: ResolvedOptions): Plugin {\n return {\n name: \"ox-content:og-viewer\",\n apply: \"serve\",\n\n configureServer(server) {\n server.middlewares.use(async (req, res, next) => {\n if (req.url === \"/__og-viewer\" || req.url === \"/__og-viewer/\") {\n const root = server.config.root || process.cwd();\n try {\n const pages = await collectPages(options, root);\n const html = renderViewerHtml(pages, options);\n res.setHeader(\"Content-Type\", \"text/html; charset=utf-8\");\n res.end(html);\n } catch (err) {\n res.statusCode = 500;\n res.end(`OG Viewer error: ${err instanceof Error ? err.message : String(err)}`);\n }\n return;\n }\n\n if (req.url === \"/__og-viewer/api/pages\") {\n const root = server.config.root || process.cwd();\n try {\n const pages = await collectPages(options, root);\n res.setHeader(\"Content-Type\", \"application/json; charset=utf-8\");\n res.end(JSON.stringify(pages));\n } catch (err) {\n res.statusCode = 500;\n res.end(JSON.stringify({ error: String(err) }));\n }\n return;\n }\n\n next();\n });\n },\n };\n}\n","/**\n * Custom JSX Runtime for Static HTML Generation\n *\n * This module provides a JSX runtime that outputs static HTML strings.\n * No React, no hydration, no client-side JavaScript - just pure HTML.\n *\n * @example\n * ```tsx\n * // tsconfig.json or vite.config.ts\n * {\n * \"compilerOptions\": {\n * \"jsx\": \"react-jsx\",\n * \"jsxImportSource\": \"@ox-content/vite-plugin\"\n * }\n * }\n *\n * // MyComponent.tsx\n * export function Hero({ title }: { title: string }) {\n * return (\n * <section class=\"hero\">\n * <h1>{title}</h1>\n * </section>\n * );\n * }\n * ```\n */\n\n// Self-closing tags that don't need closing tags\nconst VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\n// Attributes that should be rendered as boolean\nconst BOOLEAN_ATTRS = new Set([\n \"allowfullscreen\",\n \"async\",\n \"autofocus\",\n \"autoplay\",\n \"checked\",\n \"controls\",\n \"default\",\n \"defer\",\n \"disabled\",\n \"formnovalidate\",\n \"hidden\",\n \"inert\",\n \"ismap\",\n \"itemscope\",\n \"loop\",\n \"multiple\",\n \"muted\",\n \"nomodule\",\n \"novalidate\",\n \"open\",\n \"playsinline\",\n \"readonly\",\n \"required\",\n \"reversed\",\n \"selected\",\n]);\n\n/**\n * Escapes HTML special characters to prevent XSS.\n */\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#x27;\");\n}\n\n/**\n * Converts a camelCase attribute name to kebab-case for HTML.\n * Special handling for data-* and aria-* attributes.\n */\nfunction toHtmlAttr(name: string): string {\n // className -> class\n if (name === \"className\") return \"class\";\n // htmlFor -> for\n if (name === \"htmlFor\") return \"for\";\n // Keep data-* and aria-* as-is\n if (name.startsWith(\"data\") || name.startsWith(\"aria\")) {\n return name.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n }\n return name;\n}\n\n/**\n * Renders an attribute value to a string.\n */\nfunction renderAttr(name: string, value: unknown): string {\n const htmlName = toHtmlAttr(name);\n\n // Skip undefined, null, and false values\n if (value === undefined || value === null || value === false) {\n return \"\";\n }\n\n // Boolean attributes\n if (BOOLEAN_ATTRS.has(htmlName)) {\n return value ? ` ${htmlName}` : \"\";\n }\n\n // Style object to string\n if (name === \"style\" && typeof value === \"object\") {\n const styleStr = Object.entries(value as Record<string, string | number>)\n .map(([k, v]) => {\n const prop = k.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n return `${prop}:${v}`;\n })\n .join(\";\");\n return ` style=\"${escapeHtml(styleStr)}\"`;\n }\n\n // Regular attribute\n return ` ${htmlName}=\"${escapeHtml(String(value as string | number | boolean))}\"`;\n}\n\n/**\n * JSX element type - either a string (intrinsic) or a function component.\n */\nexport type JSXElementType = string | ((props: Record<string, unknown>) => JSXNode);\n\n/**\n * Valid JSX child types.\n */\nexport type JSXChild = string | number | boolean | null | undefined | JSXNode | JSXChild[];\n\n/**\n * JSX node - the result of JSX expressions.\n */\nexport interface JSXNode {\n __html: string;\n}\n\n/**\n * Props with children.\n */\nexport interface JSXProps {\n children?: JSXChild;\n [key: string]: unknown;\n}\n\n/**\n * Renders children to HTML string.\n */\nfunction renderChildren(children: JSXChild): string {\n if (children === null || children === undefined || children === false) {\n return \"\";\n }\n\n if (children === true) {\n return \"\";\n }\n\n if (typeof children === \"string\") {\n return escapeHtml(children);\n }\n\n if (typeof children === \"number\") {\n return String(children);\n }\n\n if (Array.isArray(children)) {\n return children.map(renderChildren).join(\"\");\n }\n\n if (typeof children === \"object\" && \"__html\" in children) {\n return children.__html;\n }\n\n return \"\";\n}\n\n/**\n * Creates a JSX element.\n * This is the core function called by the JSX transform.\n */\nexport function jsx(type: JSXElementType, props: JSXProps, _key?: string): JSXNode {\n const { children, ...restProps } = props;\n\n // Function component\n if (typeof type === \"function\") {\n return type({ ...restProps, children });\n }\n\n // Intrinsic element (HTML tag)\n const tag = type;\n let html = `<${tag}`;\n\n // Render attributes\n for (const [name, value] of Object.entries(restProps)) {\n // Skip internal props\n if (name === \"key\" || name === \"ref\") continue;\n html += renderAttr(name, value);\n }\n\n // Self-closing tags\n if (VOID_ELEMENTS.has(tag)) {\n html += \" />\";\n return { __html: html };\n }\n\n html += \">\";\n\n // Render children\n if (children !== undefined) {\n html += renderChildren(children);\n }\n\n html += `</${tag}>`;\n\n return { __html: html };\n}\n\n/**\n * Creates a JSX element with static children.\n * Called by the JSX transform for elements with multiple children.\n */\nexport function jsxs(type: JSXElementType, props: JSXProps, key?: string): JSXNode {\n return jsx(type, props, key);\n}\n\n/**\n * Fragment component - renders children without a wrapper element.\n */\nexport function Fragment({ children }: { children?: JSXChild }): JSXNode {\n return { __html: renderChildren(children) };\n}\n\n/**\n * Renders a JSX node to an HTML string.\n */\nexport function renderToString(node: JSXNode): string {\n return node.__html;\n}\n\n/**\n * Creates raw HTML without escaping.\n * Use with caution - only for trusted content.\n *\n * @example\n * ```tsx\n * <div>{raw('<strong>Bold</strong>')}</div>\n * ```\n */\nexport function raw(html: string): JSXNode {\n return { __html: html };\n}\n\n/**\n * Conditionally renders content.\n *\n * @example\n * ```tsx\n * {when(isLoggedIn, <UserMenu />)}\n * ```\n */\nexport function when(condition: boolean, content: JSXNode): JSXNode {\n return condition ? content : { __html: \"\" };\n}\n\n/**\n * Maps over an array and renders each item.\n *\n * @example\n * ```tsx\n * {each(items, (item) => <li>{item.name}</li>)}\n * ```\n */\nexport function each<T>(items: T[], render: (item: T, index: number) => JSXNode): JSXNode {\n const html = items.map((item, i) => render(item, i).__html).join(\"\");\n return { __html: html };\n}\n\n// Default export for convenience\nexport default {\n jsx,\n jsxs,\n Fragment,\n renderToString,\n raw,\n when,\n each,\n};\n","/**\n * Page Context for Static HTML Generation\n *\n * Provides a way to access page props (frontmatter, content, etc.)\n * from theme components during static rendering.\n *\n * @example\n * ```tsx\n * // theme/Layout.tsx\n * import { usePageProps, PageProps } from '@ox-content/vite-plugin';\n *\n * export function Layout({ children }: { children: JSX.Element }) {\n * const page = usePageProps<MyPageProps>();\n * return (\n * <html>\n * <head>\n * <title>{page.title}</title>\n * </head>\n * <body>\n * <header>{page.title}</header>\n * <main>{children}</main>\n * </body>\n * </html>\n * );\n * }\n * ```\n */\n\nimport type { TocEntry } from \"./types\";\n\n/**\n * Base page props available for all pages.\n */\nexport interface BasePageProps {\n /** Page title from frontmatter or first heading */\n title: string;\n /** Page description from frontmatter */\n description?: string;\n /** Rendered HTML content */\n html: string;\n /** Table of contents entries */\n toc: TocEntry[];\n /** Source file path (relative to docs root) */\n path: string;\n /** Output URL path */\n url: string;\n /** Raw frontmatter object */\n frontmatter: Record<string, unknown>;\n /** Layout name from frontmatter */\n layout?: string;\n}\n\n/**\n * Extended page props with custom frontmatter.\n */\nexport type PageProps<T extends Record<string, unknown> = Record<string, unknown>> =\n BasePageProps & {\n /** Custom frontmatter fields */\n frontmatter: T & Record<string, unknown>;\n };\n\n/**\n * Site-wide configuration available in context.\n */\nexport interface SiteConfig {\n /** Site name */\n name: string;\n /** Base URL path */\n base: string;\n /** All pages in the site */\n pages: BasePageProps[];\n /** Navigation groups */\n nav: NavGroup[];\n}\n\n/**\n * Navigation group.\n */\nexport interface NavGroup {\n title: string;\n items: NavItem[];\n}\n\n/**\n * Navigation item.\n */\nexport interface NavItem {\n title: string;\n path: string;\n href: string;\n}\n\n/**\n * Complete render context.\n */\nexport interface RenderContext<T extends Record<string, unknown> = Record<string, unknown>> {\n /** Current page props */\n page: PageProps<T>;\n /** Site configuration */\n site: SiteConfig;\n}\n\n// Internal context storage (set during render)\nlet currentContext: RenderContext | null = null;\n\n/**\n * Sets the current render context.\n * Called internally during page rendering.\n * @internal\n */\nexport function setRenderContext(ctx: RenderContext): void {\n currentContext = ctx;\n}\n\n/**\n * Clears the current render context.\n * Called internally after page rendering.\n * @internal\n */\nexport function clearRenderContext(): void {\n currentContext = null;\n}\n\n/**\n * Gets the current page props.\n *\n * @returns The current page props\n * @throws Error if called outside of a render context\n *\n * @example\n * ```tsx\n * function PageTitle() {\n * const page = usePageProps();\n * return <h1>{page.title}</h1>;\n * }\n * ```\n */\nexport function usePageProps<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(): PageProps<T> {\n if (!currentContext) {\n throw new Error(\n \"[ox-content] usePageProps() must be called during page rendering. \" +\n \"Make sure you are using it inside a theme component.\",\n );\n }\n return currentContext.page as PageProps<T>;\n}\n\n/**\n * Gets the site configuration.\n *\n * @returns The site configuration\n * @throws Error if called outside of a render context\n *\n * @example\n * ```tsx\n * function SiteHeader() {\n * const site = useSiteConfig();\n * return <header>{site.name}</header>;\n * }\n * ```\n */\nexport function useSiteConfig(): SiteConfig {\n if (!currentContext) {\n throw new Error(\n \"[ox-content] useSiteConfig() must be called during page rendering. \" +\n \"Make sure you are using it inside a theme component.\",\n );\n }\n return currentContext.site;\n}\n\n/**\n * Gets the full render context.\n *\n * @returns The complete render context\n * @throws Error if called outside of a render context\n *\n * @example\n * ```tsx\n * function Layout({ children }) {\n * const ctx = useRenderContext();\n * return (\n * <html>\n * <head><title>{ctx.page.title} - {ctx.site.name}</title></head>\n * <body>{children}</body>\n * </html>\n * );\n * }\n * ```\n */\nexport function useRenderContext<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(): RenderContext<T> {\n if (!currentContext) {\n throw new Error(\n \"[ox-content] useRenderContext() must be called during page rendering. \" +\n \"Make sure you are using it inside a theme component.\",\n );\n }\n return currentContext as RenderContext<T>;\n}\n\n/**\n * Gets the navigation groups.\n *\n * @example\n * ```tsx\n * function Sidebar() {\n * const nav = useNav();\n * return (\n * <nav>\n * {each(nav, (group) => (\n * <div>\n * <h3>{group.title}</h3>\n * <ul>\n * {each(group.items, (item) => (\n * <li><a href={item.href}>{item.title}</a></li>\n * ))}\n * </ul>\n * </div>\n * ))}\n * </nav>\n * );\n * }\n * ```\n */\nexport function useNav(): NavGroup[] {\n return useSiteConfig().nav;\n}\n\n/**\n * Checks if the given path is the current page.\n *\n * @example\n * ```tsx\n * function NavLink({ href, children }) {\n * const isActive = useIsActive(href);\n * return <a href={href} class={isActive ? 'active' : ''}>{children}</a>;\n * }\n * ```\n */\nexport function useIsActive(path: string): boolean {\n const page = usePageProps();\n return page.path === path || page.url === path;\n}\n\n// Type generation helpers\n\n/**\n * Schema for frontmatter type generation.\n */\nexport interface FrontmatterSchema {\n /** Field name */\n name: string;\n /** TypeScript type */\n type: string;\n /** Whether the field is optional */\n optional: boolean;\n /** JSDoc description */\n description?: string;\n}\n\n/**\n * Infers TypeScript types from frontmatter values.\n */\nexport function inferType(value: unknown): string {\n if (value === null) return \"null\";\n if (value === undefined) return \"undefined\";\n if (typeof value === \"string\") return \"string\";\n if (typeof value === \"number\") return \"number\";\n if (typeof value === \"boolean\") return \"boolean\";\n if (Array.isArray(value)) {\n if (value.length === 0) return \"unknown[]\";\n const itemTypes = [...new Set(value.map(inferType))];\n if (itemTypes.length === 1) return `${itemTypes[0]}[]`;\n return `(${itemTypes.join(\" | \")})[]`;\n }\n if (typeof value === \"object\") {\n const entries = Object.entries(value as Record<string, unknown>);\n if (entries.length === 0) return \"Record<string, unknown>\";\n const props = entries.map(([k, v]) => `${k}: ${inferType(v)}`).join(\"; \");\n return `{ ${props} }`;\n }\n return \"unknown\";\n}\n\n/**\n * Generates TypeScript interface from frontmatter samples.\n */\nexport function generateFrontmatterTypes(\n samples: Record<string, unknown>[],\n interfaceName = \"PageFrontmatter\",\n): string {\n // Collect all fields and their types across all samples\n const fields = new Map<string, { types: Set<string>; count: number }>();\n\n for (const sample of samples) {\n for (const [key, value] of Object.entries(sample)) {\n const existing = fields.get(key) ?? { types: new Set(), count: 0 };\n existing.types.add(inferType(value));\n existing.count++;\n fields.set(key, existing);\n }\n }\n\n // Generate interface\n const lines: string[] = [\n \"/**\",\n \" * Auto-generated frontmatter type based on your pages.\",\n \" * DO NOT EDIT - this file is generated by ox-content.\",\n \" */\",\n \"\",\n `export interface ${interfaceName} {`,\n ];\n\n for (const [name, { types, count }] of fields) {\n const isOptional = count < samples.length;\n const typeStr = [...types].join(\" | \");\n const optionalMark = isOptional ? \"?\" : \"\";\n lines.push(` ${name}${optionalMark}: ${typeStr};`);\n }\n\n lines.push(\"}\");\n lines.push(\"\");\n lines.push(\n `export type PageProps = import('@ox-content/vite-plugin').PageProps<${interfaceName}>;`,\n );\n lines.push(\"\");\n\n return lines.join(\"\\n\");\n}\n","/**\n * Theme Renderer for Static HTML Generation\n *\n * Renders JSX theme components to static HTML strings.\n * No client-side JavaScript is included by default.\n */\n\nimport { renderToString, raw, type JSXNode } from \"./jsx-runtime\";\nimport {\n setRenderContext,\n clearRenderContext,\n generateFrontmatterTypes,\n type RenderContext,\n type PageProps,\n type SiteConfig,\n type NavGroup,\n} from \"./page-context\";\nimport type { TocEntry } from \"./types\";\nimport { writeFile, mkdir } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\n/**\n * Theme component type.\n */\nexport type ThemeComponent = (props: ThemeProps) => JSXNode;\n\n/**\n * Props passed to the theme component.\n */\nexport interface ThemeProps {\n /** Rendered page content as JSX */\n children: JSXNode;\n}\n\n/**\n * Page data for rendering.\n */\nexport interface PageData {\n /** Page title */\n title: string;\n /** Page description */\n description?: string;\n /** Rendered HTML content */\n html: string;\n /** Table of contents */\n toc: TocEntry[];\n /** Source file path */\n path: string;\n /** Output URL path */\n url: string;\n /** Frontmatter */\n frontmatter: Record<string, unknown>;\n /** Layout name */\n layout?: string;\n}\n\n/**\n * Theme render options.\n */\nexport interface ThemeRenderOptions {\n /** Theme component to use */\n theme: ThemeComponent;\n /** Site name */\n siteName: string;\n /** Base URL path */\n base: string;\n /** Navigation groups */\n nav: NavGroup[];\n /** All pages (for site context) */\n pages: PageData[];\n /** Output directory for type definitions */\n typesOutDir?: string;\n}\n\n/**\n * Renders a page using the theme component.\n *\n * @param page - Page data to render\n * @param options - Theme render options\n * @returns Rendered HTML string\n */\nexport function renderPage(page: PageData, options: ThemeRenderOptions): string {\n const { theme, siteName, base, nav, pages } = options;\n\n // Build page props\n const pageProps: PageProps = {\n title: page.title,\n description: page.description,\n html: page.html,\n toc: page.toc,\n path: page.path,\n url: page.url,\n frontmatter: page.frontmatter,\n layout: page.layout,\n };\n\n // Build site config\n const siteConfig: SiteConfig = {\n name: siteName,\n base,\n nav,\n pages: pages.map((p) => ({\n title: p.title,\n description: p.description,\n html: p.html,\n toc: p.toc,\n path: p.path,\n url: p.url,\n frontmatter: p.frontmatter,\n layout: p.layout,\n })),\n };\n\n // Set render context\n const context: RenderContext = {\n page: pageProps,\n site: siteConfig,\n };\n\n setRenderContext(context);\n\n try {\n // Render theme with page content\n const contentNode = raw(page.html);\n const result = theme({ children: contentNode });\n\n // Get HTML string\n const html = renderToString(result);\n\n // Add doctype if not present\n if (!html.trimStart().toLowerCase().startsWith(\"<!doctype\")) {\n return `<!DOCTYPE html>\\n${html}`;\n }\n\n return html;\n } finally {\n clearRenderContext();\n }\n}\n\n/**\n * Renders all pages and generates type definitions.\n *\n * @param pages - All pages to render\n * @param options - Theme render options\n * @returns Map of output paths to rendered HTML\n */\nexport async function renderAllPages(\n pages: PageData[],\n options: ThemeRenderOptions,\n): Promise<Map<string, string>> {\n const results = new Map<string, string>();\n\n // Render each page\n for (const page of pages) {\n const html = renderPage(page, { ...options, pages });\n results.set(page.url, html);\n }\n\n // Generate type definitions if output directory is specified\n if (options.typesOutDir) {\n await generateTypes(pages, options.typesOutDir);\n }\n\n return results;\n}\n\n/**\n * Generates TypeScript type definitions from page frontmatter.\n *\n * @param pages - All pages\n * @param outDir - Output directory for types\n */\nexport async function generateTypes(pages: PageData[], outDir: string): Promise<void> {\n // Collect all frontmatter samples\n const samples = pages.map((p) => p.frontmatter);\n\n // Generate types\n const types = generateFrontmatterTypes(samples);\n\n // Write to file\n const typesPath = join(outDir, \"page-props.d.ts\");\n await mkdir(dirname(typesPath), { recursive: true });\n await writeFile(typesPath, types, \"utf-8\");\n}\n\n/**\n * Default theme component.\n * A minimal theme that renders page content with basic styling.\n */\nexport function DefaultTheme({ children }: ThemeProps): JSXNode {\n // Use hooks inside the component\n const { usePageProps, useSiteConfig } = require(\"./page-context\");\n const page = usePageProps();\n const site = useSiteConfig();\n\n return {\n __html: `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${escapeHtml(page.title)} - ${escapeHtml(site.name)}</title>\n ${page.description ? `<meta name=\"description\" content=\"${escapeHtml(page.description)}\">` : \"\"}\n <style>\n :root {\n --octc-color-primary: #e04d0a;\n --octc-color-text: #1a1a1a;\n --octc-color-bg: #ffffff;\n }\n body {\n font-family: system-ui, sans-serif;\n line-height: 1.6;\n color: var(--octc-color-text);\n background: var(--octc-color-bg);\n max-width: 800px;\n margin: 0 auto;\n padding: 2rem;\n }\n a { color: var(--octc-color-primary); }\n </style>\n</head>\n<body>\n <header>\n <h1>${escapeHtml(site.name)}</h1>\n </header>\n <main>\n ${children.__html}\n </main>\n</body>\n</html>`,\n };\n}\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\");\n}\n\n/**\n * Creates a theme with layout switching support.\n *\n * @example\n * ```tsx\n * import { createTheme } from '@ox-content/vite-plugin';\n * import { DefaultLayout } from './layouts/Default';\n * import { EntryLayout } from './layouts/Entry';\n *\n * export default createTheme({\n * layouts: {\n * default: DefaultLayout,\n * entry: EntryLayout,\n * },\n * });\n * ```\n */\nexport function createTheme(config: {\n layouts: Record<string, ThemeComponent>;\n defaultLayout?: string;\n}): ThemeComponent {\n const { layouts, defaultLayout = \"default\" } = config;\n\n return function ThemeWithLayouts({ children }: ThemeProps): JSXNode {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const { usePageProps } = require(\"./page-context\");\n const page = usePageProps();\n\n // Get layout from frontmatter or use default\n const layoutName = page.layout ?? defaultLayout;\n const Layout = layouts[layoutName] ?? layouts[defaultLayout];\n\n if (!Layout) {\n throw new Error(\n `[ox-content] Layout \"${layoutName}\" not found. ` +\n `Available layouts: ${Object.keys(layouts).join(\", \")}`,\n );\n }\n\n return Layout({ children });\n };\n}\n","/**\n * Vite Plugin for Ox Content\n *\n * Uses Vite's Environment API for SSG-focused Markdown processing.\n * Provides separate environments for client and server rendering.\n */\n\nimport * as path from \"path\";\nimport type { Plugin, ViteDevServer, ResolvedConfig } from \"vite\";\nimport { createMarkdownEnvironment } from \"./environment\";\nimport { transformMarkdown } from \"./transform\";\nimport { extractDocs, generateMarkdown, writeDocs, resolveDocsOptions } from \"./docs\";\nimport { buildSsg, resolveSsgOptions } from \"./ssg\";\nimport {\n resolveSearchOptions,\n buildSearchIndex,\n writeSearchIndex,\n generateSearchModule,\n} from \"./search\";\nimport { resolveOgImageOptions } from \"./og-image\";\nimport {\n createDevServerMiddleware,\n createDevServerCache,\n invalidateNavCache,\n invalidatePageCache,\n} from \"./dev-server\";\nimport { createOgViewerPlugin } from \"./og-viewer\";\nimport type { OxContentOptions, ResolvedOptions } from \"./types\";\n\nexport type { OxContentOptions } from \"./types\";\nexport type { LanguageRegistration } from \"shiki\";\nexport type {\n DocsOptions,\n ResolvedDocsOptions,\n DocEntry,\n ParamDoc,\n ReturnDoc,\n ExtractedDocs,\n SsgOptions,\n ResolvedSsgOptions,\n SearchOptions,\n ResolvedSearchOptions,\n SearchDocument,\n SearchResult,\n // Entry page types\n HeroAction,\n HeroImage,\n HeroConfig,\n FeatureConfig,\n EntryPageConfig,\n} from \"./types\";\n\n/**\n * Creates the Ox Content Vite plugin.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import { oxContent } from '@ox-content/vite-plugin';\n *\n * export default defineConfig({\n * plugins: [\n * oxContent({\n * srcDir: 'content',\n * gfm: true,\n * }),\n * ],\n * });\n * ```\n */\nexport function oxContent(options: OxContentOptions = {}): Plugin[] {\n const resolvedOptions = resolveOptions(options);\n let config: ResolvedConfig;\n let _server: ViteDevServer | undefined;\n\n const mainPlugin: Plugin = {\n name: \"ox-content\",\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n\n configureServer(devServer) {\n _server = devServer;\n\n // Add middleware for serving Markdown files\n devServer.middlewares.use(async (req, res, next) => {\n const url = req.url;\n if (!url || !url.endsWith(\".md\")) {\n return next();\n }\n\n // Let Vite handle the transformation\n next();\n });\n },\n\n resolveId(id) {\n // Handle virtual modules for Markdown imports\n if (id.startsWith(\"virtual:ox-content/\")) {\n return \"\\0\" + id;\n }\n\n // Resolve .md files\n if (id.endsWith(\".md\")) {\n return id;\n }\n\n return null;\n },\n\n async load(id) {\n // Handle virtual modules\n if (id.startsWith(\"\\0virtual:ox-content/\")) {\n const path = id.slice(\"\\0virtual:ox-content/\".length);\n return generateVirtualModule(path, resolvedOptions);\n }\n\n return null;\n },\n\n async transform(code, id) {\n if (!id.endsWith(\".md\")) {\n return null;\n }\n\n // Transform Markdown to JavaScript module\n const result = await transformMarkdown(code, id, resolvedOptions);\n\n return {\n code: result.code,\n map: null,\n };\n },\n\n // Hot Module Replacement support\n async handleHotUpdate({ file, server }) {\n if (file.endsWith(\".md\")) {\n // Notify client about the update\n server.ws.send({\n type: \"custom\",\n event: \"ox-content:update\",\n data: { file },\n });\n\n // Return empty array to prevent default HMR\n // We handle it ourselves\n const modules = server.moduleGraph.getModulesByFile(file);\n return modules ? Array.from(modules) : [];\n }\n },\n };\n\n // Environment API plugin for SSG\n const environmentPlugin: Plugin = {\n name: \"ox-content:environment\",\n\n config() {\n return {\n environments: {\n // Markdown processing environment\n markdown: createMarkdownEnvironment(resolvedOptions),\n },\n };\n },\n };\n\n // Docs generation plugin (builtin, opt-out)\n const docsPlugin: Plugin = {\n name: \"ox-content:docs\",\n\n async buildStart() {\n const docsOptions = resolvedOptions.docs;\n if (!docsOptions || !docsOptions.enabled) {\n return;\n }\n\n // Generate docs at build start\n const root = config?.root || process.cwd();\n const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));\n const outDir = path.resolve(root, docsOptions.out);\n\n try {\n const extracted = await extractDocs(srcDirs, docsOptions);\n\n if (extracted.length > 0) {\n const generated = generateMarkdown(extracted, docsOptions);\n await writeDocs(generated, outDir, extracted, docsOptions);\n\n console.log(\n `[ox-content] Generated ${Object.keys(generated).length} documentation files to ${docsOptions.out}`,\n );\n }\n } catch (err) {\n console.warn(\"[ox-content] Failed to generate documentation:\", err);\n }\n },\n\n configureServer(devServer) {\n const docsOptions = resolvedOptions.docs;\n if (!docsOptions || !docsOptions.enabled) {\n return;\n }\n\n // Watch source directories for changes\n const root = config?.root || process.cwd();\n const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));\n\n for (const srcDir of srcDirs) {\n devServer.watcher.add(srcDir);\n }\n\n // Regenerate docs on file changes\n devServer.watcher.on(\"change\", async (file) => {\n const isSourceFile = srcDirs.some(\n (srcDir) => file.startsWith(srcDir) && (file.endsWith(\".ts\") || file.endsWith(\".tsx\")),\n );\n\n if (isSourceFile) {\n const outDir = path.resolve(root, docsOptions.out);\n\n try {\n const extracted = await extractDocs(srcDirs, docsOptions);\n if (extracted.length > 0) {\n const generated = generateMarkdown(extracted, docsOptions);\n await writeDocs(generated, outDir, extracted, docsOptions);\n }\n } catch {\n // Ignore errors during dev\n }\n }\n });\n },\n };\n\n // SSG plugin (builtin, opt-in by default)\n const ssgDevCache = createDevServerCache();\n const ssgPlugin: Plugin = {\n name: \"ox-content:ssg\",\n\n configureServer(devServer) {\n const ssgOptions = resolvedOptions.ssg;\n if (!ssgOptions.enabled) return;\n\n const root = config?.root || process.cwd();\n const srcDir = path.resolve(root, resolvedOptions.srcDir);\n\n // Register dev server middleware\n devServer.middlewares.use(createDevServerMiddleware(resolvedOptions, root, ssgDevCache));\n\n // Watch for .md file add/unlink to invalidate nav cache\n devServer.watcher.on(\"add\", (file: string) => {\n if (file.startsWith(srcDir) && file.endsWith(\".md\")) {\n invalidateNavCache(ssgDevCache);\n }\n });\n devServer.watcher.on(\"unlink\", (file: string) => {\n if (file.startsWith(srcDir) && file.endsWith(\".md\")) {\n invalidateNavCache(ssgDevCache);\n }\n });\n\n // Watch for .md file changes to invalidate page cache\n devServer.watcher.on(\"change\", (file: string) => {\n if (file.startsWith(srcDir) && file.endsWith(\".md\")) {\n invalidatePageCache(ssgDevCache, file);\n }\n });\n },\n\n async closeBundle() {\n const ssgOptions = resolvedOptions.ssg;\n if (!ssgOptions.enabled) {\n return;\n }\n\n const root = config?.root || process.cwd();\n\n try {\n const result = await buildSsg(resolvedOptions, root);\n\n if (result.files.length > 0) {\n console.log(`[ox-content] Generated ${result.files.length} HTML files`);\n }\n\n if (result.errors.length > 0) {\n for (const error of result.errors) {\n console.warn(`[ox-content] ${error}`);\n }\n }\n } catch (err) {\n console.error(\"[ox-content] SSG build failed:\", err);\n }\n },\n };\n\n // Search plugin\n let searchIndexJson = \"\";\n const searchPlugin: Plugin = {\n name: \"ox-content:search\",\n\n resolveId(id) {\n if (id === \"virtual:ox-content/search\") {\n return \"\\0virtual:ox-content/search\";\n }\n return null;\n },\n\n async load(id) {\n if (id === \"\\0virtual:ox-content/search\") {\n const searchOptions = resolvedOptions.search;\n if (!searchOptions.enabled) {\n return \"export const search = () => []; export const searchOptions = { enabled: false }; export default { search, searchOptions };\";\n }\n\n const indexPath = resolvedOptions.base + \"search-index.json\";\n return generateSearchModule(searchOptions, indexPath);\n }\n return null;\n },\n\n async buildStart() {\n const searchOptions = resolvedOptions.search;\n if (!searchOptions.enabled) {\n return;\n }\n\n const root = config?.root || process.cwd();\n const srcDir = path.resolve(root, resolvedOptions.srcDir);\n\n try {\n searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base);\n console.log(\"[ox-content] Search index built\");\n } catch (err) {\n console.warn(\"[ox-content] Failed to build search index:\", err);\n }\n },\n\n async closeBundle() {\n const searchOptions = resolvedOptions.search;\n if (!searchOptions.enabled || !searchIndexJson) {\n return;\n }\n\n const root = config?.root || process.cwd();\n const outDir = path.resolve(root, resolvedOptions.outDir);\n\n try {\n await writeSearchIndex(searchIndexJson, outDir);\n console.log(\"[ox-content] Search index written to\", path.join(outDir, \"search-index.json\"));\n } catch (err) {\n console.warn(\"[ox-content] Failed to write search index:\", err);\n }\n },\n };\n\n const plugins: Plugin[] = [mainPlugin, environmentPlugin, docsPlugin, ssgPlugin, searchPlugin];\n\n if (resolvedOptions.ogViewer) {\n plugins.push(createOgViewerPlugin(resolvedOptions));\n }\n\n return plugins;\n}\n\n/**\n * Resolves plugin options with defaults.\n */\nfunction resolveOptions(options: OxContentOptions): ResolvedOptions {\n return {\n srcDir: options.srcDir ?? \"content\",\n outDir: options.outDir ?? \"dist\",\n base: options.base ?? \"/\",\n ssg: resolveSsgOptions(options.ssg),\n gfm: options.gfm ?? true,\n footnotes: options.footnotes ?? true,\n tables: options.tables ?? true,\n taskLists: options.taskLists ?? true,\n strikethrough: options.strikethrough ?? true,\n highlight: options.highlight ?? false,\n highlightTheme: options.highlightTheme ?? \"github-dark\",\n highlightLangs: options.highlightLangs ?? [],\n mermaid: options.mermaid ?? false,\n frontmatter: options.frontmatter ?? true,\n toc: options.toc ?? true,\n tocMaxDepth: options.tocMaxDepth ?? 3,\n ogImage: options.ogImage ?? false,\n ogImageOptions: resolveOgImageOptions(options.ogImageOptions),\n transformers: options.transformers ?? [],\n docs: resolveDocsOptions(options.docs),\n search: resolveSearchOptions(options.search),\n ogViewer: options.ogViewer ?? true,\n };\n}\n\n/**\n * Generates virtual module content.\n */\nfunction generateVirtualModule(path: string, options: ResolvedOptions): string {\n if (path === \"config\") {\n return `export default ${JSON.stringify(options)};`;\n }\n\n if (path === \"runtime\") {\n return `\n export function useMarkdown() {\n return {\n render: (content) => {\n // Client-side rendering if needed\n return content;\n },\n };\n }\n `;\n }\n\n return \"export default {};\";\n}\n\n// Re-export types and utilities\nexport { createMarkdownEnvironment } from \"./environment\";\nexport { transformMarkdown } from \"./transform\";\nexport { extractDocs, generateMarkdown, writeDocs, resolveDocsOptions } from \"./docs\";\nexport { buildSsg, resolveSsgOptions, DEFAULT_HTML_TEMPLATE } from \"./ssg\";\nexport { resolveSearchOptions, buildSearchIndex, writeSearchIndex } from \"./search\";\nexport { defineTheme, defaultTheme, mergeThemes, resolveTheme } from \"./theme\";\nexport type {\n ThemeConfig,\n ThemeColors,\n ThemeLayout,\n ThemeFonts,\n ThemeHeader,\n ThemeFooter,\n SocialLinks,\n ThemeEmbed,\n ResolvedThemeConfig,\n} from \"./theme\";\nexport * from \"./types\";\n\n// JSX Runtime\nexport { jsx, jsxs, Fragment, renderToString, raw, when, each } from \"./jsx-runtime\";\nexport type { JSXNode, JSXChild, JSXProps, JSXElementType } from \"./jsx-runtime\";\n\n// Page Context\nexport {\n usePageProps,\n useSiteConfig,\n useRenderContext,\n useNav,\n useIsActive,\n setRenderContext,\n clearRenderContext,\n generateFrontmatterTypes,\n inferType,\n} from \"./page-context\";\nexport type {\n BasePageProps,\n PageProps,\n SiteConfig,\n NavGroup,\n NavItem,\n RenderContext,\n FrontmatterSchema,\n} from \"./page-context\";\n\n// Theme Renderer\nexport {\n renderPage,\n renderAllPages,\n generateTypes,\n DefaultTheme,\n createTheme,\n} from \"./theme-renderer\";\nexport type { ThemeComponent, ThemeProps, PageData, ThemeRenderOptions } from \"./theme-renderer\";\n\n// Built-in Plugins (No-JS First)\nexport {\n transformTabs,\n generateTabsCSS,\n transformYouTube,\n extractVideoId,\n transformGitHub,\n fetchRepoData,\n collectGitHubRepos,\n prefetchGitHubRepos,\n transformOgp,\n fetchOgpData,\n collectOgpUrls,\n prefetchOgpData,\n transformMermaidStatic,\n mermaidClientScript,\n transformAllPlugins,\n} from \"./plugins\";\nexport type {\n YouTubeOptions,\n GitHubRepoData,\n GitHubOptions,\n OgpData,\n OgpOptions,\n MermaidOptions,\n TransformAllOptions,\n} from \"./plugins\";\n\n// Island Architecture\nexport { transformIslands, hasIslands, extractIslandInfo, generateHydrationScript } from \"./island\";\nexport type { LoadStrategy, IslandInfo, ParseIslandsResult } from \"./island\";\n\n// OG Image\nexport { resolveOgImageOptions, generateOgImages } from \"./og-image\";\nexport type {\n OgImageOptions as OgImagePluginOptions,\n ResolvedOgImageOptions,\n OgImageTemplateProps,\n OgImageTemplateFn,\n OgImagePageEntry,\n OgImageResult,\n OgBrowserSession,\n} from \"./og-image\";\n"],"x_google_ignoreList":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,0BAA0B,SAA8C;AACtF,QAAO;EAEL,UAAU;EAGV,OAAO;GAEL,QAAQ,GAAG,QAAQ,OAAO;GAG1B,YAAY;GAGZ,UAAU;GAGV,eAAe,EACb,UAAU,CAER,UAEA,UACD,EACF;GACF;EAGD,SAAS;GAEP,YAAY,CAAC,OAAO,YAAY;GAGhC,YAAY;IAAC;IAAY;IAAQ;IAAS;GAG1C,QAAQ,EAAE;GACX;EAGD,cAAc;GAEZ,SAAS,EAAE;GAEX,SAAS,CAAC,mBAAmB;GAC9B;EACF;;;;;;CC3EH,MAAM,QAAQ,OAAO,IAAI,aAAa;CACtC,MAAM,MAAM,OAAO,IAAI,gBAAgB;CACvC,MAAM,MAAM,OAAO,IAAI,WAAW;CAClC,MAAM,OAAO,OAAO,IAAI,YAAY;CACpC,MAAM,SAAS,OAAO,IAAI,cAAc;CACxC,MAAM,MAAM,OAAO,IAAI,WAAW;CAClC,MAAM,YAAY,OAAO,IAAI,iBAAiB;CAC9C,MAAM,WAAW,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,eAAe;CACpF,MAAM,cAAc,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,K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