js-yaml
Version:
YAML 1.2 parser and serializer
1 lines • 278 kB
Source Map (JSON)
{"version":3,"file":"js-yaml.esm.min.mjs","names":[],"sources":["../../src/tag.ts","../../src/tag/scalar/str.ts","../../src/tag/scalar/null_core.ts","../../src/tag/scalar/null_json.ts","../../src/tag/scalar/null_yaml11.ts","../../src/tag/scalar/bool_core.ts","../../src/tag/scalar/bool_json.ts","../../src/tag/scalar/bool_yaml11.ts","../../src/tag/scalar/int_core.ts","../../src/tag/scalar/int_json.ts","../../src/tag/scalar/int_yaml11.ts","../../src/tag/scalar/float_core.ts","../../src/tag/scalar/float_json.ts","../../src/tag/scalar/float_yaml11.ts","../../src/tag/scalar/merge.ts","../../src/tag/scalar/binary.ts","../../src/tag/scalar/timestamp.ts","../../src/tag/sequence/seq.ts","../../src/common/object.ts","../../src/tag/sequence/omap.ts","../../src/tag/sequence/pairs.ts","../../src/tag/mapping/map.ts","../../src/tag/mapping/set.ts","../../src/schema.ts","../../src/tag/mapping/real_map.ts","../../src/tag/mapping/legacy_map.ts","../../src/common/snippet.ts","../../src/common/exception.ts","../../src/parser/events.ts","../../src/parser/parser_scalar.ts","../../src/common/tagname.ts","../../src/parser/constructor.ts","../../src/parser/parser.ts","../../src/load.ts","../../src/ast/from_js.ts","../../src/ast/visit.ts","../../src/ast/styler_defaults.ts","../../src/ast/scalar_styler.ts","../../src/ast/presenter.ts","../../src/dump.ts","../../src/ast/from_events.ts","../../src/index.ts"],"sourcesContent":["/**\n * Returned by a scalar resolver when the source does not match its tag.\n *\n * @category Tags\n */\nconst NOT_RESOLVED: unique symbol = Symbol('NOT_RESOLVED')\n\n/**\n * Options for {@link defineScalarTag}.\n *\n * @category Tags\n */\ninterface ScalarTagOptions<Result> {\n /**\n * Whether this tag participates in resolving plain scalars without an\n * explicit tag. Default: `false`.\n */\n implicit?: boolean\n\n /**\n * Whether explicit tag names are matched by prefix instead of exact equality.\n * Default: `false`.\n */\n matchByTagPrefix?: boolean\n\n /**\n * Set of `source.charAt(0)` keys for which `resolve` may succeed (a superset\n * of what it really matches). A key is either a single character or '' (empty\n * source). `null` means \"no constraint, always try\". Used by the composer to\n * dispatch implicit scalars by first character without running every resolver.\n */\n implicitFirstChars?: readonly string[] | null\n\n /**\n * Construct a value from scalar text, or return {@link NOT_RESOLVED} when it\n * is invalid for this tag. `isExplicit` is true for an explicit tag and\n * `tagName` is the actual matched name.\n */\n resolve: (source: string, isExplicit: boolean, tagName: string) => Result | typeof NOT_RESOLVED\n\n /**\n * Selects this tag for a JavaScript value when dumping. Use `() => false`\n * for load-only tags.\n */\n identify: (data: any) => boolean\n\n /**\n * A scalar's printed form is text, so `represent` always yields a string.\n * The factory supplies a `String(data)` default when a tag omits it.\n */\n represent?: (data: any) => string\n\n /** Return the tag name to emit for a prefix-matching tag. Defaults to `tagName`. */\n representTagName?: (data: any) => string\n}\n\n/**\n * Normalized scalar tag returned by {@link defineScalarTag}.\n *\n * @category Tags\n */\ninterface ScalarTagDefinition<Result = unknown> extends Required<ScalarTagOptions<Result>> {\n /** Tag name used for schema lookup. */\n tagName: string\n\n /** YAML node kind handled by this tag. */\n nodeKind: 'scalar'\n}\n\n/**\n * Options for {@link defineSequenceTag}.\n *\n * @category Tags\n */\ninterface SequenceTagOptions<Carrier, Result = Carrier> {\n /**\n * Whether explicit tag names are matched by prefix instead of exact equality.\n * Default: `false`.\n */\n matchByTagPrefix?: boolean\n\n /** Create the carrier used while constructing a sequence. */\n create: (tagName: string) => Carrier\n\n /** Add an item to the carrier. Return a non-empty error message to reject it. */\n addItem: (carrier: Carrier, item: unknown, index: number) => void | string\n\n /** Convert the completed carrier to the result. Defaults to the identity function. */\n finalize?: (carrier: Carrier) => Result\n\n /**\n * Selects this tag for a JavaScript value when dumping. Use `() => false`\n * for load-only tags.\n */\n identify: (data: any) => boolean\n\n /** Return the array-like contents to dump. Defaults to the identity function. */\n represent?: (data: any) => ArrayLike<unknown>\n\n /** Return the tag name to emit for a prefix-matching tag. Defaults to `tagName`. */\n representTagName?: (data: any) => string\n}\n\n/**\n * Normalized sequence tag returned by {@link defineSequenceTag}.\n *\n * @category Tags\n */\ninterface SequenceTagDefinition<Carrier = unknown, Result = Carrier> extends Required<SequenceTagOptions<Carrier, Result>> {\n /** Tag name used for schema lookup. */\n tagName: string\n\n /** YAML node kind handled by this tag. */\n nodeKind: 'sequence'\n\n /** Sequence tags do not participate in implicit scalar resolution. */\n implicit: false\n\n /** Whether the carrier is also the final result (`finalize` was omitted). */\n carrierIsResult: boolean\n}\n\n/**\n * Options for {@link defineMappingTag}.\n *\n * @category Tags\n */\ninterface MappingTagOptions<Carrier, Result = Carrier> {\n /**\n * Whether explicit tag names are matched by prefix instead of exact equality.\n * Default: `false`.\n */\n matchByTagPrefix?: boolean\n\n /** Create the carrier used while constructing a mapping. */\n create: (tagName: string) => Carrier\n\n /**\n * Writes a pair. Returns '' on success, a non-empty error message otherwise\n * (key does not fit the representation, value rejected, ...). Always a string\n * so the hot path never allocates an exception wrapper.\n */\n addPair: (carrier: Carrier, key: unknown, value: unknown) => string\n\n /** Return whether the carrier contains a key, for duplicate and merge checks. */\n has: (carrier: Carrier, key: unknown) => boolean\n\n /** Return the keys of a completed result for YAML merge processing. */\n keys: (result: Result) => Iterable<unknown>\n\n /** Return a value from a completed result for YAML merge processing. */\n get: (result: Result, key: unknown) => unknown\n\n /** Convert the completed carrier to the result. Defaults to the identity function. */\n finalize?: (carrier: Carrier) => Result\n\n /**\n * Selects this tag for a JavaScript value when dumping. Use `() => false`\n * for load-only tags.\n */\n identify: (data: any) => boolean\n\n /** Return the mapping entries to dump. Defaults to the identity function. */\n represent?: (data: any) => Map<unknown, unknown>\n\n /** Return the tag name to emit for a prefix-matching tag. Defaults to `tagName`. */\n representTagName?: (data: any) => string\n}\n\n/**\n * Normalized mapping tag returned by {@link defineMappingTag}.\n *\n * @category Tags\n */\ninterface MappingTagDefinition<Carrier = unknown, Result = Carrier> extends Required<MappingTagOptions<Carrier, Result>> {\n /** Tag name used for schema lookup. */\n tagName: string\n\n /** YAML node kind handled by this tag. */\n nodeKind: 'mapping'\n\n /** Mapping tags do not participate in implicit scalar resolution. */\n implicit: false\n\n /** Whether the carrier is also the final result (`finalize` was omitted). */\n carrierIsResult: boolean\n}\n\n/**\n * Any normalized tag definition accepted by {@link Schema}.\n *\n * @category Tags\n */\ntype TagDefinition =\n | ScalarTagDefinition<any>\n | SequenceTagDefinition<any, any>\n | MappingTagDefinition<any, any>\n\n/**\n * Create a normalized scalar tag definition.\n *\n * @category Tags\n */\nfunction defineScalarTag<Result> (tagName: string, options: ScalarTagOptions<Result>): ScalarTagDefinition<Result> {\n return {\n tagName,\n nodeKind: 'scalar',\n implicit: options.implicit ?? false,\n matchByTagPrefix: options.matchByTagPrefix ?? false,\n implicitFirstChars: options.implicitFirstChars ?? null,\n resolve: options.resolve,\n identify: options.identify,\n represent: options.represent ?? (data => String(data)),\n representTagName: options.representTagName ?? (() => tagName)\n }\n}\n\n/**\n * Create a normalized sequence tag definition.\n *\n * @category Tags\n */\nfunction defineSequenceTag<Carrier, Result = Carrier> (tagName: string, options: SequenceTagOptions<Carrier, Result>): SequenceTagDefinition<Carrier, Result> {\n const carrierIsResult = options.finalize === undefined\n\n return {\n tagName,\n nodeKind: 'sequence',\n implicit: false,\n matchByTagPrefix: options.matchByTagPrefix ?? false,\n create: options.create,\n addItem: options.addItem,\n finalize: options.finalize ?? (carrier => carrier as unknown as Result),\n carrierIsResult,\n identify: options.identify,\n represent: options.represent ?? (data => data as ArrayLike<unknown>),\n representTagName: options.representTagName ?? (() => tagName)\n }\n}\n\n/**\n * Create a normalized mapping tag definition.\n *\n * @category Tags\n */\nfunction defineMappingTag<Carrier, Result = Carrier> (tagName: string, options: MappingTagOptions<Carrier, Result>): MappingTagDefinition<Carrier, Result> {\n const carrierIsResult = options.finalize === undefined\n\n return {\n tagName,\n nodeKind: 'mapping',\n implicit: false,\n matchByTagPrefix: options.matchByTagPrefix ?? false,\n create: options.create,\n addPair: options.addPair,\n has: options.has,\n keys: options.keys,\n get: options.get,\n finalize: options.finalize ?? (carrier => carrier as unknown as Result),\n carrierIsResult,\n identify: options.identify,\n represent: options.represent ?? (data => data as Map<unknown, unknown>),\n representTagName: options.representTagName ?? (() => tagName)\n }\n}\n\nexport {\n NOT_RESOLVED,\n defineScalarTag,\n defineSequenceTag,\n defineMappingTag,\n\n type ScalarTagDefinition,\n type SequenceTagDefinition,\n type MappingTagDefinition,\n type TagDefinition,\n type ScalarTagOptions,\n type SequenceTagOptions,\n type MappingTagOptions\n}\n","import { defineScalarTag } from '../../tag.ts'\n\n/** @category Tags */\nconst strTag = defineScalarTag('tag:yaml.org,2002:str', {\n resolve: (source) => source,\n identify: (data) => typeof data === 'string'\n})\n\nexport { strTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst NULL_VALUES = ['', '~', 'null', 'Null', 'NULL']\n\n/** @category Tags */\nconst nullCoreTag = defineScalarTag('tag:yaml.org,2002:null', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: '' (empty), '~', 'null'/'Null'/'NULL'.\n implicitFirstChars: ['', '~', 'n', 'N'],\n resolve: (source) => {\n if (NULL_VALUES.indexOf(source) !== -1) return null\n\n return NOT_RESOLVED\n },\n identify: (object) => object === null,\n represent: () => 'null'\n})\n\nexport { nullCoreTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\n/** @category Tags */\nconst nullJsonTag = defineScalarTag('tag:yaml.org,2002:null', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: null.\n implicitFirstChars: ['n'],\n resolve: (source, isExplicit) => {\n if (source === 'null' || (isExplicit && source === '')) return null\n\n return NOT_RESOLVED\n },\n identify: (object) => object === null,\n represent: () => 'null'\n})\n\nexport { nullJsonTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst NULL_VALUES = ['', '~', 'null', 'Null', 'NULL']\n\n/** @category Tags */\nconst nullYaml11Tag = defineScalarTag('tag:yaml.org,2002:null', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: '' (empty), '~', 'null'/'Null'/'NULL'.\n implicitFirstChars: ['', '~', 'n', 'N'],\n resolve: (source) => {\n if (NULL_VALUES.indexOf(source) !== -1) return null\n\n return NOT_RESOLVED\n },\n identify: (object) => object === null,\n represent: () => 'null'\n})\n\nexport { nullYaml11Tag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst TRUE_VALUES = ['true', 'True', 'TRUE']\nconst FALSE_VALUES = ['false', 'False', 'FALSE']\n\n/** @category Tags */\nconst boolCoreTag = defineScalarTag('tag:yaml.org,2002:bool', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: true/True/TRUE, false/False/FALSE.\n implicitFirstChars: ['t', 'T', 'f', 'F'],\n resolve: (source) => {\n if (TRUE_VALUES.indexOf(source) !== -1) return true\n if (FALSE_VALUES.indexOf(source) !== -1) return false\n\n return NOT_RESOLVED\n },\n identify: (object) => Object.prototype.toString.call(object) === '[object Boolean]',\n represent: (object) => object ? 'true' : 'false'\n})\n\nexport { boolCoreTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst TRUE_VALUES = ['true']\nconst FALSE_VALUES = ['false']\n\n/** @category Tags */\nconst boolJsonTag = defineScalarTag('tag:yaml.org,2002:bool', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: true, false.\n implicitFirstChars: ['t', 'f'],\n resolve: (source) => {\n if (TRUE_VALUES.indexOf(source) !== -1) return true\n if (FALSE_VALUES.indexOf(source) !== -1) return false\n\n return NOT_RESOLVED\n },\n identify: (object) => Object.prototype.toString.call(object) === '[object Boolean]',\n represent: (object) => object ? 'true' : 'false'\n})\n\nexport { boolJsonTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst TRUE_VALUES = ['true', 'True', 'TRUE', 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON']\nconst FALSE_VALUES = ['false', 'False', 'FALSE', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF']\n\n/** @category Tags */\nconst boolYaml11Tag = defineScalarTag('tag:yaml.org,2002:bool', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs.\n implicitFirstChars: ['y', 'Y', 'n', 'N', 't', 'T', 'f', 'F', 'o', 'O'],\n resolve: (source) => {\n if (TRUE_VALUES.indexOf(source) !== -1) return true\n if (FALSE_VALUES.indexOf(source) !== -1) return false\n\n return NOT_RESOLVED\n },\n identify: (object) => Object.prototype.toString.call(object) === '[object Boolean]',\n represent: (object) => object ? 'true' : 'false'\n})\n\nexport { boolYaml11Tag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\n// YAML 1.2 Core schema implicit resolution:\n// [-+]? [0-9]+ | 0o [0-7]+ | 0x [0-9a-fA-F]+\nconst YAML_INTEGER_IMPLICIT_PATTERN = new RegExp(\n // 0o123\n '^(?:0o[0-7]+' +\n // 0x1A\n '|0x[0-9a-fA-F]+' +\n // 12345\n '|[-+]?[0-9]+)$')\n\n// Explicit `!!int` validation is separate from Core implicit resolution.\nconst YAML_INTEGER_EXPLICIT_PATTERN = new RegExp(\n // 0b1010\n '^(?:[-+]?0b[0-1]+' +\n // 0o123\n '|[-+]?0o[0-7]+' +\n // 0x1A\n '|[-+]?0x[0-9a-fA-F]+' +\n // 12345\n '|[-+]?[0-9]+)$')\n\nfunction parseYamlInteger (source: string) {\n let value = source\n let sign = 1\n\n if (value[0] === '-' || value[0] === '+') {\n if (value[0] === '-') sign = -1\n value = value.slice(1)\n }\n\n if (value.startsWith('0b')) return sign * parseInt(value.slice(2), 2)\n if (value.startsWith('0o')) return sign * parseInt(value.slice(2), 8)\n if (value.startsWith('0x')) return sign * parseInt(value.slice(2), 16)\n\n return sign * parseInt(value, 10)\n}\n\nfunction resolveYamlInteger (source: string, isExplicit: boolean) {\n if (isExplicit) {\n if (!YAML_INTEGER_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED\n } else if (!YAML_INTEGER_IMPLICIT_PATTERN.test(source)) {\n return NOT_RESOLVED\n }\n\n const result = parseYamlInteger(source)\n return Number.isFinite(result) ? result : NOT_RESOLVED\n}\n\n/** @category Tags */\nconst intCoreTag = defineScalarTag('tag:yaml.org,2002:int', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: optional sign + decimal digit.\n implicitFirstChars: ['-', '+', ...'0123456789'],\n resolve: resolveYamlInteger,\n identify: (object) =>\n // No ancient boxed numbers support\n Number.isInteger(object) &&\n // Negative zero => !!float\n !Object.is(object, -0) &&\n // Exponential form => !!float, round-trip for !!int 1e21 will be broken\n object.toString(10).indexOf('e') < 0,\n represent: (object: number) => object.toString(10)\n})\n\nexport { intCoreTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\n// YAML 1.2 JSON schema implicit resolution:\n// -? ( 0 | [1-9] [0-9]* )\nconst YAML_INTEGER_IMPLICIT_PATTERN = new RegExp(\n '^-?(?:0|[1-9][0-9]*)$')\n\n// Explicit `!!int` validation is separate from JSON implicit resolution.\nconst YAML_INTEGER_EXPLICIT_PATTERN = new RegExp(\n // 0b1010\n '^(?:[-+]?0b[0-1]+' +\n // 0o123\n '|[-+]?0o[0-7]+' +\n // 0x1A\n '|[-+]?0x[0-9a-fA-F]+' +\n // 12345\n '|[-+]?[0-9]+)$')\n\nfunction parseYamlInteger (source: string) {\n let value = source\n let sign = 1\n\n if (value[0] === '-' || value[0] === '+') {\n if (value[0] === '-') sign = -1\n value = value.slice(1)\n }\n\n if (value.startsWith('0b')) return sign * parseInt(value.slice(2), 2)\n if (value.startsWith('0o')) return sign * parseInt(value.slice(2), 8)\n if (value.startsWith('0x')) return sign * parseInt(value.slice(2), 16)\n\n return sign * parseInt(value, 10)\n}\n\nfunction resolveYamlInteger (source: string, isExplicit: boolean) {\n if (isExplicit) {\n if (!YAML_INTEGER_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED\n } else if (!YAML_INTEGER_IMPLICIT_PATTERN.test(source)) {\n return NOT_RESOLVED\n }\n\n const result = parseYamlInteger(source)\n return Number.isFinite(result) ? result : NOT_RESOLVED\n}\n\n/** @category Tags */\nconst intJsonTag = defineScalarTag('tag:yaml.org,2002:int', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: optional '-' or digit.\n implicitFirstChars: ['-', ...'0123456789'],\n resolve: resolveYamlInteger,\n identify: (object) =>\n // No ancient boxed numbers support\n Number.isInteger(object) &&\n // Negative zero => !!float\n !Object.is(object, -0) &&\n // Exponential form => !!float, round-trip for !!int 1e21 will be broken\n object.toString(10).indexOf('e') < 0,\n represent: (object: number) => object.toString(10)\n})\n\nexport { intJsonTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst YAML_INTEGER_PATTERN = new RegExp(\n // 0b1010\n '^(?:[-+]?0b[0-1_]+' +\n // 0123\n '|[-+]?0[0-7_]+' +\n // 0x1A\n '|[-+]?0x[0-9a-fA-F_]+' +\n // 1:23\n '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+' +\n // 12345\n '|[-+]?(?:0|[1-9][0-9_]*))$')\n\nfunction parseYamlInteger (source: string) {\n let value = source.replace(/_/g, '')\n let sign = 1\n\n if (value[0] === '-' || value[0] === '+') {\n if (value[0] === '-') sign = -1\n value = value.slice(1)\n }\n\n if (value.startsWith('0b')) return sign * parseInt(value.slice(2), 2)\n if (value.startsWith('0x')) return sign * parseInt(value.slice(2), 16)\n\n if (value.includes(':')) {\n let result = 0\n for (const part of value.split(':')) result = result * 60 + Number(part)\n return sign * result\n }\n\n if (value !== '0' && value[0] === '0') return sign * parseInt(value, 8)\n\n return sign * parseInt(value, 10)\n}\n\nfunction resolveYamlInteger (source: string) {\n if (!YAML_INTEGER_PATTERN.test(source)) return NOT_RESOLVED\n\n const result = parseYamlInteger(source)\n return Number.isFinite(result) ? result : NOT_RESOLVED\n}\n\n/** @category Tags */\nconst intYaml11Tag = defineScalarTag('tag:yaml.org,2002:int', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: optional sign + decimal digit.\n implicitFirstChars: ['-', '+', ...'0123456789'],\n resolve: resolveYamlInteger,\n identify: (object) =>\n // No ancient boxed numbers support\n Number.isInteger(object) &&\n // Negative zero => !!float\n !Object.is(object, -0) &&\n // Exponential form => !!float, round-trip for !!int 1e21 will be broken\n object.toString(10).indexOf('e') < 0,\n represent: (object: number) => object.toString(10)\n})\n\nexport { intYaml11Tag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst YAML_FLOAT_PATTERN = new RegExp(\n // 2.5e4, 2.5 and integers\n '^(?:[-+]?[0-9]+(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?' +\n // .2e4, .2\n '|[-+]?\\\\.[0-9]+(?:[eE][-+]?[0-9]+)?' +\n // .inf\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$')\n\nconst YAML_FLOAT_SPECIAL_PATTERN = new RegExp(\n '^(?:' +\n // .inf\n '[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$')\n\nfunction resolveYamlFloat (source: string) {\n if (!YAML_FLOAT_PATTERN.test(source)) return NOT_RESOLVED\n\n let value = source.toLowerCase()\n const sign = value[0] === '-' ? -1 : 1\n\n if ('+-'.includes(value[0])) value = value.slice(1)\n\n if (value === '.inf') return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY\n if (value === '.nan') return NaN\n\n const result = sign * parseFloat(value)\n\n if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN.test(source)) return result\n return NOT_RESOLVED\n}\n\nfunction representYamlFloat (object: number) {\n if (isNaN(object)) return '.nan'\n if (object === Number.POSITIVE_INFINITY) return '.inf'\n if (object === Number.NEGATIVE_INFINITY) return '-.inf'\n if (Object.is(object, -0)) return '-0.0'\n\n const result = object.toString(10)\n return /^[-+]?[0-9]+e/.test(result) ? result.replace('e', '.e') : result\n}\n\n/** @category Tags */\nconst floatCoreTag = defineScalarTag('tag:yaml.org,2002:float', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: optional sign, '.', or digit\n // ('.inf'/'.nan' start with '.').\n implicitFirstChars: ['-', '+', '.', ...'0123456789'],\n resolve: resolveYamlFloat,\n identify: (object) =>\n // No ancient boxed numbers support\n typeof object === 'number' &&\n (\n // We land here all numbers, not handled (declined) by !!int `.identify`\n // The same condition as for !!int, but reversed.\n\n // Filter out integers...\n !Number.isInteger(object) ||\n // but allow negative zero\n Object.is(object, -0) ||\n // and integers with exponential form\n object.toString(10).indexOf('e') >= 0\n ),\n represent: representYamlFloat\n})\n\nexport { floatCoreTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\n// YAML 1.2 JSON schema implicit resolution:\n// -? ( 0 | [1-9] [0-9]* ) ( \\. [0-9]* )? ( [eE] [-+]? [0-9]+ )?\nconst YAML_FLOAT_IMPLICIT_PATTERN = new RegExp(\n // 2.5e4, 2.5 and integers\n '^-?(?:0|[1-9][0-9]*)(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$')\n\n// Explicit `!!float` validation is separate from JSON implicit resolution.\nconst YAML_FLOAT_EXPLICIT_PATTERN = new RegExp(\n // 2.5e4, 2.5 and integers\n '^(?:[-+]?[0-9]+(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?' +\n // .2e4, .2\n '|[-+]?\\\\.[0-9]+(?:[eE][-+]?[0-9]+)?' +\n // .inf\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$')\n\nfunction resolveYamlFloat (source: string, isExplicit: boolean) {\n if (isExplicit) {\n if (!YAML_FLOAT_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED\n\n let value = source.toLowerCase()\n const sign = value[0] === '-' ? -1 : 1\n\n if ('+-'.includes(value[0])) value = value.slice(1)\n\n if (value === '.inf') return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY\n if (value === '.nan') return NaN\n\n const result = sign * parseFloat(value)\n return Number.isFinite(result) ? result : NOT_RESOLVED\n }\n\n if (!YAML_FLOAT_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED\n\n const result = Number(source)\n\n if (Number.isFinite(result)) return result\n return NOT_RESOLVED\n}\n\nfunction representYamlFloat (object: number) {\n if (isNaN(object)) return '.nan'\n if (object === Number.POSITIVE_INFINITY) return '.inf'\n if (object === Number.NEGATIVE_INFINITY) return '-.inf'\n if (Object.is(object, -0)) return '-0.0'\n\n const result = object.toString(10)\n return /^[-+]?[0-9]+e/.test(result) ? result.replace('e', '.e') : result\n}\n\n/** @category Tags */\nconst floatJsonTag = defineScalarTag('tag:yaml.org,2002:float', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: optional '-' or digit.\n implicitFirstChars: ['-', ...'0123456789'],\n resolve: resolveYamlFloat,\n identify: (object) =>\n // No ancient boxed numbers support\n typeof object === 'number' &&\n (\n // We land here all numbers, not handled (declined) by !!int `.identify`\n // The same condition as for !!int, but reversed.\n\n // Filter out integers...\n !Number.isInteger(object) ||\n // but allow negative zero\n Object.is(object, -0) ||\n // and integers with exponential form\n object.toString(10).indexOf('e') >= 0\n ),\n represent: representYamlFloat\n})\n\nexport { floatJsonTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst YAML_FLOAT_PATTERN = new RegExp(\n // 2.5e4, 2.5 and integers\n '^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\\\.[0-9_]*)(?:[eE][-+][0-9]+)?' +\n // 190:20:30.15\n '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*' +\n // .inf\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$')\n\nconst YAML_FLOAT_SPECIAL_PATTERN = new RegExp(\n '^(?:' +\n // .inf\n '[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$')\n\nfunction resolveYamlFloat (source: string) {\n if (!YAML_FLOAT_PATTERN.test(source)) return NOT_RESOLVED\n\n let value = source.toLowerCase().replace(/_/g, '')\n const sign = value[0] === '-' ? -1 : 1\n\n if ('+-'.includes(value[0])) value = value.slice(1)\n\n if (value === '.inf') return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY\n if (value === '.nan') return NaN\n\n let result = 0\n\n if (value.includes(':')) {\n for (const part of value.split(':')) result = result * 60 + Number(part)\n result *= sign\n } else {\n result = sign * parseFloat(value)\n }\n\n if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN.test(source)) return result\n return NOT_RESOLVED\n}\n\nfunction representYamlFloat (object: number) {\n if (isNaN(object)) return '.nan'\n if (object === Number.POSITIVE_INFINITY) return '.inf'\n if (object === Number.NEGATIVE_INFINITY) return '-.inf'\n if (Object.is(object, -0)) return '-0.0'\n\n const result = object.toString(10)\n return /^[-+]?[0-9]+e/.test(result) ? result.replace('e', '.e') : result\n}\n\n/** @category Tags */\nconst floatYaml11Tag = defineScalarTag('tag:yaml.org,2002:float', {\n implicit: true,\n // Superset of source.charAt(0) over all matched inputs: optional sign, '.', or digit\n // ('.inf'/'.nan' start with '.').\n implicitFirstChars: ['-', '+', '.', ...'0123456789'],\n resolve: resolveYamlFloat,\n identify: (object) =>\n // No ancient boxed numbers support\n typeof object === 'number' &&\n (\n // We land here all numbers, not handled (declined) by !!int `.identify`\n // The same condition as for !!int, but reversed.\n\n // Filter out integers...\n !Number.isInteger(object) ||\n // but allow negative zero\n Object.is(object, -0) ||\n // and integers with exponential form\n object.toString(10).indexOf('e') >= 0\n ),\n represent: representYamlFloat\n})\n\nexport { floatYaml11Tag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\n/**\n * Enables merge keys in {@link CORE_SCHEMA} when added with\n * {@link Schema.withTags}.\n *\n * @category Tags\n */\nconst mergeTag = defineScalarTag('tag:yaml.org,2002:merge', {\n implicit: true,\n // source.charAt(0) over matched implicit inputs: '<' ('<<').\n implicitFirstChars: ['<'],\n // Merge semantics live in the tag, not in the value: the constructor acts on\n // a key tagged `!!merge`, so `<<` anywhere else is just this string.\n resolve: (source, isExplicit) => {\n if (source === '<<' || (isExplicit && source === '')) return '<<'\n return NOT_RESOLVED\n },\n identify: () => false\n})\n\nexport { mergeTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/\n\nfunction resolveYamlBinary (source: string) {\n // Strip allowed whitespace first, so validation stays a plain base64 check.\n const input = source.replace(/\\s/g, '')\n if (input.length % 4 !== 0 || !BASE64_PATTERN.test(input)) return NOT_RESOLVED\n\n const binary = atob(input)\n const result = new Uint8Array(binary.length)\n for (let index = 0; index < binary.length; index++) {\n result[index] = binary.charCodeAt(index)\n }\n return result\n}\n\nfunction representYamlBinary (object: Uint8Array) {\n let binary = ''\n for (let index = 0; index < object.length; index++) {\n binary += String.fromCharCode(object[index])\n }\n return btoa(binary)\n}\n\n/**\n * The `!!binary` tag, represented as a `Uint8Array`.\n *\n * @category Tags\n */\nconst binaryTag = defineScalarTag('tag:yaml.org,2002:binary', {\n resolve: resolveYamlBinary,\n identify: (object) => Object.prototype.toString.call(object) === '[object Uint8Array]',\n represent: representYamlBinary\n})\n\nexport { binaryTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst YAML_DATE_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$')\n\nconst YAML_TIMESTAMP_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' +\n '-([0-9][0-9]?)' +\n '-([0-9][0-9]?)' +\n '(?:[Tt]|[ \\\\t]+)' +\n '([0-9][0-9]?)' +\n ':([0-9][0-9])' +\n ':([0-9][0-9])' +\n '(?:\\\\.([0-9]*))?' +\n '(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)' +\n '(?::([0-9][0-9]))?))?$')\n\nfunction makeUtcDate (\n year: number,\n month: number,\n day: number,\n hour = 0,\n minute = 0,\n second = 0,\n fraction = 0\n) {\n const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction))\n\n // Date.UTC() treats years 0..99 as 1900..1999. Restore the parsed YAML year\n // before validating calendar normalization, e.g. reject 0001-02-29.\n date.setUTCFullYear(year, month, day)\n\n return date\n}\n\nfunction resolveYamlTimestamp (source: string) {\n let match = YAML_DATE_REGEXP.exec(source)\n if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source)\n if (match === null) return NOT_RESOLVED\n\n const year = +(match[1])\n const month = +(match[2]) - 1\n const day = +(match[3])\n\n // Date-only form (`YYYY-MM-DD`) has no time captures.\n if (!match[4]) {\n const date = makeUtcDate(year, month, day)\n // Reject dates that JS would normalize, e.g. 2023-02-29 -> 2023-03-01.\n if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) {\n return NOT_RESOLVED\n }\n return date\n }\n\n const hour = +(match[4])\n const minute = +(match[5])\n const second = +(match[6])\n let fraction = 0\n\n // Reject times that JS would normalize into the next minute/hour/day.\n if (hour > 23 || minute > 59 || second > 59) return NOT_RESOLVED\n\n if (match[7]) {\n let value = match[7].slice(0, 3)\n while (value.length < 3) value += '0'\n fraction = +value\n }\n\n const date = makeUtcDate(year, month, day, hour, minute, second, fraction)\n\n // Reject invalid calendar dates before applying timezone offset.\n if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) {\n return NOT_RESOLVED\n }\n\n if (match[9]) {\n const offsetHour = +(match[10])\n const offsetMinute = +(match[11] || 0)\n // Reject timezone offsets that JS date arithmetic would otherwise accept.\n if (offsetHour > 23 || offsetMinute > 59) return NOT_RESOLVED\n\n const offset = (offsetHour * 60 + offsetMinute) * 60000\n date.setTime(date.getTime() - (match[9] === '-' ? -offset : offset))\n }\n\n return date\n}\n\n/**\n * The YAML 1.1 `!!timestamp` tag, represented as a JavaScript `Date`.\n *\n * @category Tags\n */\nconst timestampTag = defineScalarTag('tag:yaml.org,2002:timestamp', {\n implicit: true,\n // Both patterns start with a 4-digit year, so source.charAt(0) is always a digit.\n implicitFirstChars: [...'0123456789'],\n resolve: resolveYamlTimestamp,\n identify: (object) => object instanceof Date,\n represent: (object: Date) => object.toISOString()\n})\n\nexport { timestampTag }\n","import { defineSequenceTag } from '../../tag.ts'\n\n/** @category Tags */\nconst seqTag = defineSequenceTag('tag:yaml.org,2002:seq', {\n create: () => [] as unknown[],\n addItem: (container, item) => {\n container.push(item)\n },\n identify: Array.isArray\n})\n\nexport { seqTag }\n","function isPlainObject (data: unknown): boolean {\n if (data === null || typeof data !== 'object' || Array.isArray(data)) return false\n const prototype = Object.getPrototypeOf(data)\n return prototype === null || prototype === Object.prototype\n}\n\n// Project `object` onto `keys`. Absent keys are skipped (so the result can be\n// safely spread over defaults without clobbering them with `undefined`), hence\n// the `Partial` return.\nfunction pick<T extends object, K extends keyof T> (object: T, keys: readonly K[]): Partial<Pick<T, K>> {\n const result: Partial<Pick<T, K>> = {}\n for (const key of keys) {\n if (object[key] !== undefined) result[key] = object[key]\n }\n return result\n}\n\nexport {\n isPlainObject,\n pick\n}\n","import { defineSequenceTag } from '../../tag.ts'\nimport { isPlainObject } from '../../common/object.ts'\n\n/**\n * Provided only for YAML 1.1 compatibility and supported by the loader only.\n * JavaScript has no dedicated class to represent this type, so it cannot be\n * identified and dumped.\n *\n * ```yaml\n * !!omap\n * - one: 1\n * - two: 2\n * ```\n *\n * is loaded as\n *\n * ```javascript\n * [\n * { one: 1 },\n * { two: 2 }\n * ]\n * ```\n *\n * @category Tags\n */\nconst omapTag = defineSequenceTag('tag:yaml.org,2002:omap', {\n create: (): { list: unknown[]; seen: Set<unknown> } => ({ list: [], seen: new Set() }),\n addItem: (carrier, item) => {\n let key: unknown\n\n if (item instanceof Map) {\n if (item.size !== 1) return 'cannot resolve an ordered map item'\n key = item.keys().next().value\n } else if (isPlainObject(item)) {\n const itemKeys = Object.keys(item as Record<string, unknown>)\n if (itemKeys.length !== 1) return 'cannot resolve an ordered map item'\n key = itemKeys[0]\n } else {\n return 'cannot resolve an ordered map item'\n }\n\n if (carrier.seen.has(key)) return 'duplicate key in ordered map'\n carrier.seen.add(key)\n carrier.list.push(item)\n return ''\n },\n finalize: (carrier): unknown[] => carrier.list,\n identify: () => false\n})\n\nexport { omapTag }\n","import { defineSequenceTag } from '../../tag.ts'\n\n/**\n * Provided only for YAML 1.1 compatibility and supported by the loader only.\n * JavaScript has no dedicated class to represent this type, so it cannot be\n * identified and dumped.\n *\n * ```yaml\n * !!pairs\n * - one: 1\n * - two: 2\n * ```\n *\n * is loaded as\n *\n * ```javascript\n * [\n * ['one', 1],\n * ['two', 2]\n * ]\n * ```\n *\n * @category Tags\n */\nconst pairsTag = defineSequenceTag('tag:yaml.org,2002:pairs', {\n create: () => [] as [unknown, unknown][],\n addItem: (container, item) => {\n if (item instanceof Map) {\n if (item.size !== 1) return 'cannot resolve a pairs item'\n\n container.push(item.entries().next().value!)\n return ''\n }\n\n if (Object.prototype.toString.call(item) !== '[object Object]') {\n return 'cannot resolve a pairs item'\n }\n\n const object = item as Record<string, unknown>\n const keys = Object.keys(object)\n\n if (keys.length !== 1) return 'cannot resolve a pairs item'\n\n container.push([keys[0], object[keys[0]]])\n return ''\n },\n identify: () => false\n})\n\nexport { pairsTag }\n","import { defineMappingTag } from '../../tag.ts'\nimport { isPlainObject } from '../../common/object.ts'\n\n/**\n * This is the default mapping implementation. It uses `{}` objects and has only\n * partial functionality due to language limitations. This choice was made\n * because users expect to get JavaScript objects, and it was left unchanged to\n * avoid too many breaking changes in the v5 release.\n *\n * Side effects:\n *\n * - `Object.hasOwn()` checks or `for...of` loops are required for safe use (to\n * avoid falling through to prototypes).\n * - Only scalar string keys are supported properly.\n * - Other scalar keys, such as `null` and numbers, are converted to strings.\n * This is historical behaviour, and it can cause side effects such as\n * problems with `!!merge`.\n *\n * Note that non-string scalar keys may be deprecated in future versions.\n *\n * Ideally, use {@link realMapTag} instead.\n *\n * @category Tags\n */\nconst mapTag = defineMappingTag('tag:yaml.org,2002:map', {\n create: (): Record<string, unknown> => ({}),\n identify: isPlainObject,\n // Dump side: wrap the plain object into the canonical `Map` form the writer\n // walks. Shallow — keys/values stay references to the originals.\n represent: (o: Record<string, unknown>) => {\n const map = new Map<string, unknown>()\n for (const key of Object.keys(o)) map.set(key, o[key])\n return map\n },\n addPair: (container, key, value) => {\n if (key !== null && typeof key === 'object') {\n return 'object-based map does not support complex keys'\n }\n const normalizedKey = String(key)\n if (normalizedKey === '__proto__') {\n // Define as an own data property so a literal `__proto__` key stays data\n // and never invokes the prototype setter.\n Object.defineProperty(container, normalizedKey, {\n value, enumerable: true, configurable: true, writable: true\n })\n } else {\n container[normalizedKey] = value\n }\n return ''\n },\n // hasOwn, not `in`: a plain object inherits `toString` and friends.\n has: (container, key) => {\n if (key !== null && typeof key === 'object') return false\n return Object.prototype.hasOwnProperty.call(container, String(key))\n },\n keys: (container) => Object.keys(container),\n get: (container, key) => {\n const normalizedKey = String(key)\n // key is from `keys()` only. Strong check is not needed, but leave for sure.\n if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null\n return container[normalizedKey]\n }\n})\n\nexport { mapTag, isPlainObject }\n","import { defineMappingTag } from '../../tag.ts'\n\n/**\n * The YAML 1.1 `!!set` tag, represented as a JavaScript `Set`.\n *\n * @category Tags\n */\nconst setTag = defineMappingTag('tag:yaml.org,2002:set', {\n create: () => new Set<unknown>(),\n identify: (data) => data instanceof Set,\n represent: (data: Set<unknown>) => {\n const map = new Map<unknown, null>()\n for (const key of data) map.set(key, null)\n return map\n },\n addPair: (container, key, value) => {\n if (value !== null) return 'cannot resolve a set item'\n container.add(key)\n return ''\n },\n has: (container, key) => container.has(key),\n keys: (container) => container.keys(),\n get: () => null\n})\n\nexport { setTag }\n","import {\n NOT_RESOLVED,\n type MappingTagDefinition,\n type ScalarTagDefinition,\n type SequenceTagDefinition,\n type TagDefinition\n} from './tag.ts'\nimport { strTag } from './tag/scalar/str.ts'\nimport { nullCoreTag } from './tag/scalar/null_core.ts'\nimport { nullJsonTag } from './tag/scalar/null_json.ts'\nimport { nullYaml11Tag } from './tag/scalar/null_yaml11.ts'\nimport { boolCoreTag } from './tag/scalar/bool_core.ts'\nimport { boolJsonTag } from './tag/scalar/bool_json.ts'\nimport { boolYaml11Tag } from './tag/scalar/bool_yaml11.ts'\nimport { intCoreTag } from './tag/scalar/int_core.ts'\nimport { intJsonTag } from './tag/scalar/int_json.ts'\nimport { intYaml11Tag } from './tag/scalar/int_yaml11.ts'\nimport { floatCoreTag } from './tag/scalar/float_core.ts'\nimport { floatJsonTag } from './tag/scalar/float_json.ts'\nimport { floatYaml11Tag } from './tag/scalar/float_yaml11.ts'\nimport { mergeTag } from './tag/scalar/merge.ts'\nimport { binaryTag } from './tag/scalar/binary.ts'\nimport { timestampTag } from './tag/scalar/timestamp.ts'\nimport { seqTag } from './tag/sequence/seq.ts'\nimport { omapTag } from './tag/sequence/omap.ts'\nimport { pairsTag } from './tag/sequence/pairs.ts'\nimport { mapTag } from './tag/mapping/map.ts'\nimport { setTag } from './tag/mapping/set.ts'\n\ninterface TagDefinitionMap {\n scalar: Record<string, ScalarTagDefinition>\n sequence: Record<string, SequenceTagDefinition>\n mapping: Record<string, MappingTagDefinition>\n}\n\ninterface TagDefinitionListMap {\n scalar: ScalarTagDefinition[]\n sequence: SequenceTagDefinition[]\n mapping: MappingTagDefinition[]\n}\n\nfunction createTagDefinitionMap (): TagDefinitionMap {\n return {\n scalar: Object.create(null),\n sequence: Object.create(null),\n mapping: Object.create(null)\n }\n}\n\nfunction createTagDefinitionListMap (): TagDefinitionListMap {\n return {\n scalar: [],\n sequence: [],\n mapping: []\n }\n}\n\nfunction compileTags (tags: readonly TagDefinition[]) {\n const result: TagDefinition[] = []\n\n for (const tag of tags) {\n let index = result.length\n\n for (let previousIndex = 0; previousIndex < result.length; previousIndex++) {\n const previous = result[previousIndex]\n\n if (previous.nodeKind === tag.nodeKind &&\n previous.tagName === tag.tagName &&\n previous.matchByTagPrefix === tag.matchByTagPrefix) {\n index = previousIndex\n break\n }\n }\n\n result[index] = tag\n }\n\n return result\n}\n\n/**\n * Controls tag resolution when loading and type selection when dumping.\n *\n * @category Schemas\n */\nclass Schema {\n readonly tags: readonly TagDefinition[]\n /** @internal */\n readonly implicitScalarTags: readonly ScalarTagDefinition[]\n\n /**\n * Dispatch implicit scalar resolvers by `source.charAt(0)`. Each bucket holds\n * the resolvers that may match that key, in schema order; a key absent from\n * the map uses\n * {@link Schema.implicitScalarAnyFirstChar}\n * (resolvers that declared no first-char constraint, so they apply to any\n * first character).\n */\n private readonly implicitScalarByFirstChar: ReadonlyMap<string, readonly ScalarTagDefinition[]>\n private readonly implicitScalarAnyFirstChar: readonly ScalarTagDefinition[]\n\n /**\n * The default scalar tag (`!!str`), resolved once so the composer's fallback\n * for unresolved plain scalars avoids a keyed lookup per scalar.\n *\n * @internal\n */\n readonly defaultScalarTag: ScalarTagDefinition\n\n /**\n * The default container tags (`!!seq` / `!!map`), used by the dumper: when a\n * value is identified by its default tag, the tag is implicit and not\n * printed. Undefined if the schema does not define them (then such values\n * can't be dumped).\n *\n * @internal\n */\n readonly defaultSequenceTag: SequenceTagDefinition | undefined\n /** @internal */\n readonly defaultMappingTag: MappingTagDefinition | undefined\n private readonly exact: TagDefinitionMap\n private readonly prefix: TagDefinitionListMap\n\n constructor (tags: readonly TagDefinition[]) {\n const compiledTags = compileTags(tags)\n const implicitScalarTags: ScalarTagDefinition[] = []\n const exact = createTagDefinitionMap()\n const prefix = createTagDefinitionListMap()\n\n for (const tag of compiledTags) {\n if (tag.nodeKind === 'scalar' && tag.implicit) {\n if (tag.matchByTagPrefix) {\n throw new Error('Implicit scalar tags cannot match by tag prefix')\n }\n\n implicitScalarTags.push(tag)\n }\n\n switch (tag.nodeKind) {\n case 'scalar':\n if (tag.matchByTagPrefix) prefix.scalar.push(tag)\n else exact.scalar[tag.tagName] = tag\n break\n case 'sequence':\n if (tag.matchByTagPrefix) prefix.sequence.push(tag)\n else exact.sequence[tag.tagName] = tag\n break\n case 'mapping':\n if (tag.matchByTagPrefix) prefix.mapping.push(tag)\n else exact.mapping[tag.tagName] = tag\n break\n }\n }\n\n const implicitScalarAnyFirstChar = implicitScalarTags.filter(tag => tag.implicitFirstChars === null)\n\n const keys = new Set<string>()\n for (const tag of implicitScalarTags) {\n if (tag.implicitFirstChars !== null) {\n for (const key of tag.implicitFirstChars) keys.add(key)\n }\n }\n\n const implicitScalarByFirstChar = new Map<string, ScalarTagDefinition[]>()\n for (const key of keys) {\n implicitScalarByFirstChar.set(key, implicitScalarTags.filter(tag =>\n tag.implicitFirstChars === null || tag.implicitFirstChars.indexOf(key) !== -1))\n }\n\n const defaultScalarTag = exact.scalar['tag:yaml.org,2002:str']\n if (!defaultScalarTag) throw new Error('schema does not define the default scalar tag (tag:yaml.org,2002:str)')\n\n this.tags = compiledTags\n this.implicitScalarTags = implicitScalarTags\n this.implicitScalarByFirstChar = implicitScalarByFirstChar\n this.implicitScalarAnyFirstChar = implicitScalarAnyFirstChar\n this.defaultScalarTag = defaultScalarTag\n this.defaultSequenceTag = exact.sequence['tag:yaml.org,2002:seq']\n this.defaultMappingTag = exact.mapping['tag:yaml.org,2002:map']\n this.exact = exact\n this.prefix = prefix\n }\n\n /** @internal */\n lookupScalarTag (tagName: string): ScalarTagDefinition | undefined {\n const exactTag = this.exact.scalar[tagName]\n if (exactTag) return exactTag\n\n for (const tag of this.prefix.scalar) {\n if (tagName.startsWith(tag.tagName)) return tag\n }\n\n return undefined\n }\n\n /** @internal */\n lookupSequenceTag (tagName: string): SequenceTagDefinition | undefined {\n const exactTag = this.exact.sequence[tagName]\n if (exactTag) return exactTag\n\n for (const tag of this.prefix.sequence) {\n if (tagName.startsWith(tag.tagName)) return tag\n }\n\n return undefined\n }\n\n /** @internal */\n lookupMappingTag (tagName: string): MappingTagDefinition | undefined {\n const exactTag = this.exact.mapping[tagName]\n if (exactTag) return exactTag\n\n for (const tag of this.prefix.mapping) {\n if (tagName.startsWith(tag.tagName)) return tag\n }\n\n return undefined\n }\n\n /** @internal */\n resolveImplicitScalarTag (source: string): { value: unknown, tag: ScalarTagDefinition } {\n const candidates = this.implicitScalarByFirstChar.get(source.charAt(0)) ??\n this.implicitScalarAnyFirstChar\n\n for (const tag of candidates) {\n const value = tag.resolve(source, false, tag.tagName)\n if (value !== NOT_RESOLVED) return { value, tag }\n }\n\n const tag = this.defaultScalarTag\n return { value: tag.resolve(source, false, tag.tagName), tag }\n }\n\n /**\n * Creates a new schema with the specified tags added. If a tag already\n * exists, it is replaced by the specified tag.\n *\n * @example\n *\n * ```javascript\n * import { CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml'\n *\n * const schema = CORE_SCHEMA.withTags(mergeTag, realMapTag)\n * ```\n */\n withTags (...tags: Array<TagDefinition | readonly TagDefinition[]>): Schema {\n let flatTags: TagDefinition[] = []\n for (const tag of tags) flatTags = flatTags.concat(tag)\n\n return new Schema([...this.tags, ...flatTags])\n }\n}\n\n/**\n * The YAML 1.2 Failsafe Schema: strings, sequences, and mappings.\n *\n * @category Schemas\n */\nconst FAILSAFE_SCHEMA = new Schema([\n strTag,\n seqTag,\n mapTag\n])\n\n/**\n * The YAML 1.2 JSON Schema. It uses JSON scalar forms while retaining YAML\n * collection syntax.\n *\n * @category Schemas\n */\nconst JSON_SCHEMA = new Schema([\n ...FAILSAFE_SCHEMA.tags,\n nullJsonTag,\n boolJsonTag,\n intJsonTag,\n floatJsonTag\n])\n\n/**\n * The default schema for the loaders. Note, {@link CORE_SCHEMA} comes\n * without the `!!merge` tag. You can easily enable it if needed.\n *\n * @example\n * Enable {@link mergeTag}:\n *\n * ```javascript\n * import { load, CORE_SCHEMA, mergeTag } from 'js-yaml'\n *\n * try {\n * load(data, { schema: CORE_SCHEMA.withTags(mergeTag) })\n * } catch (e) {\n * console.error(e)\n * }\n * ```\n *\n * @category Schemas\n */\nconst CORE_SCHEMA = new Schema([\n ...FAILSAFE_SCHEMA.tags,\n nullCoreTag,\n boolCoreTag,\n intCoreTag,\n floatCoreTag\n])\n\n/**\n * YAML 1.1-compatible schema.\n *\n * @category Schemas\n */\nconst YAML11_SCHEMA = new Schema([\n ...FAILSAFE_SCHEMA.tags,\n nullYaml11Tag,\n boolYaml11Tag,\n intYaml11Tag,\n floatYaml11Tag,\n timestampTag,\n mergeTag,\n binaryTag,\n omapTag,\n pairsTag,\n setTag\n])\n\n/**\n * The dumper schema for maximum compatibility. It combines all supported type\n * variants from YAML 1.1 and YAML 1.2 so strings matching any of them are\n * quoted. This makes the generated YAML more compatible with other parsers.\n *\n * The schema is based on YAML 1.1, but extends `!!int` and `!!float` to accept\n * both YAML 1.1 and Core Schema forms, since Core Schema supports some forms\n * that YAML 1.1 does not.\n *\n * @category Schemas\n */\nconst DUMP_SCHEMA = YAML11_SCHEMA.withTags(\n {\n ...intYaml11Tag,\n resolve: (source, isExplicit, tagName) => {\n const result = intYaml11Tag.resolve(source, isExplicit, tagName)\n return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result\n }\n },\n {\n ...floatYaml11Tag,\n resolve: (source, isExplicit, tagName) => {\n const result = floatYaml11Tag.resolve(source, isExplicit, tagName)\n return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result\n }\n }\n)\n\nexport {\n Schema,\n FAILSAFE_SCHEMA,\n JSON_SCHEMA,\n CORE_SCHEMA,\n YAML11_SCHEMA,\n DUMP_SCHEMA\n}\n","import { defineMappingTag } from '../../tag.ts'\nimport { isPlainObject } from '../../common/object.ts'\n\n/**\n * Recommended when non-string keys are actually needed. It uses native\n * JavaScript `Map` objects, so keys keep their constructed types instead of\n * being converted to strings.\n *\n * It is not the default to avoid widespread breaking changes in existing\n * projects. `Map` has a different access API and does not pass deep equality\n * checks against `{}`-based fixtures. Alongside the other changes in v5,\n * making it the default was considered too disruptive.\n *\n * If these differences are acceptable for your project, we recommend using\n * {@link realMapTag} to guarantee the absence of problems and side effects.\n *\n * @example\n * Enable {@link realMapTag}:\n *\n * ```javascript\n * import { load, CORE_SCHEMA, realMapTag } from 'js-yaml'\n *\n * try {\n * load(data, { schema: CORE_SCHEMA.withTags(realMapTag) })\n * } catch (e) {\n * console.error(e)\n * }\n * ```\n *\n * @category Tags\n */\nconst realMapTag = defineMappingTag('tag:yaml.org,2002:map', {\n create: () => new Map<unknown, unknown>(),\n addPair: (container: Map<unknown, unknown>, key, value) => {\n container.set(key, value)\n return ''\n },\n has: (container: Map<unknown, unknown>, key) => container.has(key),\n keys: (container: Map<unknown, unknown>) => container.keys(),\n get: (container: Map<unknown, unknown>, key) => container.get(key),\n // Dump side: handle both a real `Map` and a plain object, so this tag fully\n // replaces the default map representation when dumping too.\n identify: (data) => data instanceof Map || isPlainObject(data),\n // Dump side: the canonical mapping form is a `Map`. A real `Map` passes\n // through untouched (keys keep their type); a plain object is wrapped\n // shallowly. Lossless — nothing is stringified.\n represent: (data) => {\n if (data instanceof Map) return data\n const map = new Map<unknown, unknown>()\n const obj = data as Record<string, unknown>\n for (const key of Object.keys(obj)) map.set(key, obj[key])\n return map\n }\n})\n\nexport { realMapTag }\n","import { defineMappingTag } from '../../tag.ts'\nimport { isPlainObject } from '../../common/object.ts'\n\n// Coerce a constructed key into the string identity a `{}` representation uses.\n// Returns null for a nested array key (an array element that is itself an\n// array), which would otherwise blow up exponentially when stringified via\n// aliases.\nfunction normalizeKey (key: unknown): string | null {\n if (Array.isArray(key)) {\n const array = Array.prototype.slice.call(key) as unknown[]\n\n for (let index = 0; index < array.length; index++) {\n if (Array.isArray(array[index])) return null\n\n if (typeof array[index] === 'object' &&\n Object.prototype.toString.call(array[index]) === '[object Object]') {\n array[index] = '[object Object]'\n }\n }\n\n return String(array)\n }\n\n if (typeof key === 'object' &&\n Object.prototype.toString.call(key) === '[object Object]') {\n return '[object Object]'\n }\n\n return String(key)\n}\n\n/**\n * This implementation exists solely to reproduce v4 behavior exactly. Its use\n * is strongly discouraged. If complex or non-string keys are needed, use\n * {@link realMapTag} instead.\n *\n * @category Tags\n */\nconst legacyMapTag = defineMappingTag('tag:yaml.org,2002:map', {\n create: (): Record<string, unknown> => ({}),\n identify: isPlainObject,\n // Dump side: wrap the plain object into the canonical `Map` form the writer\n // walks. Shallow — keys/values stay references to the originals.\n represent: (o: Record<string, unknown>) => {\n const map = new Map<string, unknown>()\n for (const key of Object.keys(o)) map.set(key, o[key])\n return map\n },\n addPair: (container, key, value) => {\n const normalizedKey = normalizeKey(key)\n if (normalizedKey === null) return 'nested arrays are not supported inside keys'\n if (normalizedKey === '__proto__') {\n // Define as an own data property so a literal `__proto__` key stays data\n // and never invokes the prototype setter.\n Object.defineProperty(container, normalizedKey, {\n value, enumerable: true, configurable: true, writable: true\n })\n } else {\n container[normalizedKey] = value\n }\n return ''\n },\n // hasOwn, not `in`: a plain object inherits `toString` and friends.\n has: (container, key) => {\n const normalizedKey = normalizeKey(key)\n return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey)\n },\n keys: (container) => Object.keys(container),\n get: (container, key) => {\n const normalizedKey = String(key)\n // key is from `keys()` only. Strong check is not needed, but leave for sure.\n if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null\n return container[normalizedKey]\n }\n})\n\nexport { legacyMapTag, isPlainObject }\n","export interface SnippetMark {\n name?: string | null\n buffer: string\n position: number\n line: number\n column: number\n snippet?: string | null\n}\n\ninterface SnippetOptions {\n maxLength?: number\n indent?: number\n linesBefore?: number\n linesAfter?: number\n}\n\nconst DEFAULT_SNIPPET_OPTIONS: Required<SnippetOptions> = {\n maxLength: 79,\n indent: 1,\n linesBefore: 3,\n linesAfter: 2\n}\n\n// get snippet for a single line, respecting maxLength\nfunction getLine (buffer: string, lineStart: number, lineEnd: number, position: number, maxLineLength: number) {\n let head = ''\n let tail = ''\n const maxHalfLength = Math.floor(maxLineLength / 2) - 1\n\n if (position - lineStart > maxHalfLength) {\n head = ' ... '\n lineStart = position - maxHalfLength + head.length\n }\n\n if (lineEnd - position > maxHalfLength) {\n tail = ' ...'\n lineEnd = position + maxHalfLength - tail.length\n }\n\n return {\n str: head + buffer.slice(lineStart, lineEnd).replace(/\\t/g, '→') + tail,\n pos: position - lineStart + head.length // relative position\n }\n}\n\nfunction padStart (string: string, max: number) {\n // max() protects from negativa value, to avoid exception.\n return ' '.repeat(Math.max(max - string.length, 0)) + string\n}\n\nfunction makeSnippet (mark: SnippetMark, options?: SnippetOptions) {\n if (!mark.buffer) return null\n\n const opts = { ...DEFAULT_SNIPPET_OPTIONS, ...options }\n\n const re = /\\r?\\n|\\r|\\0/g\n const lineStarts = [0]\n const lineEnds: number[] = []\n let match: RegExpExecArray | null\n let foundLineNo = -1\n\n while ((match = re.exec(mark.buffer))) {\n lineEnds.push(match.index)\n lineStarts.push(match.index + match[0].length)\n\n if (mark.position <= match.index && foundLineNo < 0) {\n foundLineNo = lineStarts.length - 2\n }\n }\n\n if (foundLineNo < 0) foundLineNo = lineStarts.length - 1\n\n let result = ''\n const lineNoLength = Math.min(mark.line + opts.linesAfter, lineEnds.length).toString().length\n const maxLineLength = opts.maxLength - (opts.indent + lineNoLength + 3)\n\n for (let i = 1; i <= opts.linesBefore; i++) {\n if (foundLineNo - i < 0) break\n const line = getLine(\n mark.buffer,\n lineStarts[foundLineNo - i],\n lineEnds[foundLineNo - i],\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),\n maxLineLength\n )\n result = `${' '.repeat(opts.indent)}${padStart((mark.line - i + 1).toString(), lineNoLength)} | ${line.str}\\n${result}`\n }\n\n const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength)\n result += `${' '.repeat(opts.indent)}${padStart((mark.line + 1).toString(), lineNoLength)} | ${line.str}\\n`\n result += `${'-'.repeat(opts.indent + lineNoLength + 3 + line.pos)}^\\n`\n\n for (let i = 1; i <= opts.linesAfter; i++) {\n if (foundLineNo + i >= lineEnds.length) break\n const line = getLine(\n mark.buffer,\n lineStarts[foundLineNo + i],\n lineEnds[foundLineNo + i],\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),\n maxLineLength\n )\n result += `${' '.repeat(opts.indent)}${padStart((mark.line + i + 1).toString(), lineNoLength)} | ${line.str}\\n`\n }\n\n return result.replace(/\\n$/, '')\n}\n\nexport default makeSnippet\n","import makeSnippet, { type SnippetMark } from './snippet.ts'\n\n// YAML error class. http://stackoverflow.com/questions/8458984\n//\nfunction formatError (exception: YAMLException, compact?: boolean) {\n let where = ''\n\n if (!exception.mark) return exception.reason\n\n if (exception.mark.name) {\n where += `in \"${exception.mark.name}\" `\n }\n\n where += `(${exception.mark.line + 1}:${exception.mark.column + 1})`\n\n if (!compact && exception.mark.snippet) {\n where += `\\n\\n${exception.mark.snippet}`\n }\n\n return `${exception.reason} ${where}`\n}\n\n/**\n * A YAML error. Unlike an ordinary `Error`, it adds a source snippet showing\n * the location of the problem to the error message, when available.\n *\n * @category Main\n */\nclass YAMLException extends Error {\n reason: string\n mark?: SnippetMark\n\n /**\n * Optional `mark` contains source snippet data. Usually, use\n * {@link YAMLException.throwAt} instead of passing it directly.\n */\n constructor (reason: string, mark?: SnippetMark) {\n super()\n\n this.name = 'YAMLException'\n this.reason = reason\n this.mark = mark\n this.message = formatError(this, false)\n\n // Guard for ancient browsers\n if (Error.captureStackTrace) {\n // Include stack trace in error object,\n Error.captureStackTrace(this, this.constructor)\n }\n }\n\n /**\n * Returns the formatted error, omitting the source snippet in compact mode.\n */\n toString (compact?: boolean) {\n return `${this.name}: ${formatError(this, compact)}`\n }\n\n /**\n * Builds a YAMLException with a source snippet and throws it. `source` is\n * the raw input text; `position` is an offset into it.\n */\n static throwAt (source: string, position: number, message: string, filename = ''): never {\n let line = 0\n let lineStart = 0\n\n for (let index = 0; index < position; index++) {\n const ch = source.charCodeAt(index)\n\n if (ch === 0x0A/* LF */) {\n line++\n lineStart = index + 1\n } else if (ch === 0x0D/* CR */) {\n line++\n if (source.charCodeAt(index + 1) === 0x0A/* LF */) index++\n lineStart = index + 1\n }\n }\n\n const mark: SnippetMark = {\n name: filename,\n buffer: source,\n position,\n line,\n column: position - lineStart\n }\n\n mark.snippet = makeSnippet(mark)\n throw new YAMLException(message, mark)\n }\n}\n\nexport { YAMLException }\n","/** @category Events */\nconst EVENT_ID = {\n DOCUMENT: 1,\n SEQUENCE: 2,\n MAPPING: 3,\n SCALAR: 4,\n ALIAS: 5,\n POP: 6\n} as const\n\n/** @category Events */\ntype EventId = typeof EVENT_ID[keyof typeof EVENT_ID]\n\n/** @category Nodes */\nconst SCALAR_STYLE = {\n PLAIN: 1,\n SINGLE_QUOTED: 2,\n DOUBLE_QUOTED: 3,\n LITERAL_BLOCK: 4,\n FOLDED_BLOCK: 5\n} as const\n\n/** @category Nodes */\ntype ScalarStyle = typeof SCALAR_STYLE[keyof typeof SCALAR_STYLE]\n\n/** @category Nodes */\nconst COLLECTION_STYLE = {\n BLOCK: 1,\n FLOW: 2\n} as const\n\n/** @category Nodes */\ntype CollectionStyle = typeof COLLECTION_STYLE[keyof typeof COLLECTION_STYLE]\n\n/** @category Nodes */\nconst CHOMPING_MODE = {\n CLIP: 1,\n STRIP: 2,\n KEEP: 3\n} as const\n\n/** @category Nodes */\ntype ChompingMode = typeof CHOMPING_MODE[keyof typeof CHOMPING_MODE]\n\n/** @category Events */\ntype DocumentDirective =\n { kind: 'yaml', version: string } |\n { kind: 'tag', handle: string, prefix: string }\n\ntype TagHandlers = Record<string, string>\n\n/** @category Events */\ninterface DocumentEvent {\n type: typeof EVENT_ID.DOCUMENT\n explicitStart: boolean\n explicitEnd: boolean\n directives: DocumentDirective[]\n}\n\n/** @category Events */\ninterface SequenceEvent {\n type: typeof EVENT_ID.SEQUENCE\n start: number\n anchorStart: number\n anchorEnd: number\n tagStart: number\n tagEnd: number\n style: CollectionStyle\n}\n\n/** @category Events */\ninterface MappingEvent {\n type: typeof EVENT_ID.MAPPING\n start: number\n anchorStart: number\n anchorEnd: number\n tagStart: number\n tagEnd: number\n style: CollectionStyle\n}\n\n/**\n * A scalar whose decoded value can be read with {@link getScalarValue}.\n *\n * @category Events\n */\ninterface ScalarEvent {\n type: typeof EVENT_ID.SCALAR\n valueStart: number\n valueEnd: number\n anchorStart: number\n anchorEnd: number\n tagStart: number\n tagEnd: number\n style: ScalarStyle\n chomping: ChompingMode\n indent: number\n fast: boolean\n}\n\n/** @category Events */\ninterface AliasEvent {\n type: typeof EVENT_ID.ALIAS\n anchorStart: number\n anchorEnd: number\n}\n\n/**\n * Closes the most recently opened document, sequence, or mapping.\n *\n * @category Events\n */\ninterface PopEvent {\n type: typeof EVENT_ID.POP\n}\n\n/**\n * Source ranges are zero-based and end-exclusive; `-1` means absent.\n *\n * @category Events\n */\ntype Event =\n DocumentEvent |\n SequenceEvent |\n MappingEvent |\n ScalarEvent |\n AliasEvent |\n PopEvent\n\nexport {\n EVENT_ID,\n SCALAR_STYLE,\n COLLECTION_STYLE,\n CHOMPING_MODE,\n\n type EventId,\n type ScalarStyle,\n type CollectionStyle,\n type ChompingMode,\n\n type DocumentDirective,\n type TagHandlers,\n type DocumentEvent,\n type SequenceEvent,\n type MappingEvent,\n type ScalarEvent,\n type AliasEvent,\n type PopEvent,\n type Event\n}\n","import {\n SCALAR_STYLE,\n CHOMPING_MODE,\n type ScalarEvent\n} from './events.ts'\n\nconst NO_RANGE = -1\n\n// --- character helpers (mirrors src/loader.ts, kept self-contained here) ---\n\nfunction simpleEscapeSequence (c: number) {\n switch (c) {\n case 0x30/* 0 */: return '\\x00'\n case 0x61/* a */: return '\\x07'\n case 0x62/* b */: return '\\x08'\n case 0x74/* t */: return '\\x09'\n case 0x09/* Tab */: return '\\x09'\n case 0x6E/* n */: return '\\x0A'\n case 0x76/* v */: return '\\x0B'\n case 0x66/* f */: return '\\x0C'\n case 0x72/* r */: return '\\x0D'\n case 0x65/* e */: return '\\x1B'\n case 0x20/* Space */: return ' '\n case 0x22/* \" */: return '\\x22'\n case 0x2F/* / */: return '/'\n case 0x5C/* \\ */: return '\\x5C'\n case 0x4E/* N */: return '\\x85'\n case 0x5F/* _ */: return '\\xA0'\n case 0x4C/* L */: return '\\u2028'\n case 0x50/* P */: return '\\u2029'\n default: return ''\n }\n}\n\nconst simpleEscapeCheck = new Array(256)\nconst simpleEscapeMap = new Array(256)\nfor (let i = 0; i < 256; i++) {\n simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0\n simpleEscapeMap[i] = simpleEscapeSequence(i)\n}\n\nfunction charFromCodepoint (c: number) {\n if (c <= 0xFFFF) {\n return String.fromCharCode(c)\n }\n return String.fromCharCode(\n ((c - 0x010000) >> 10) + 0xD800,\n ((c - 0x010000) & 0x03FF) + 0xDC00\n )\n}\n\nfunction fromHexCode (c: number) {\n if (c >= 0x30/* 0 */ && c <= 0x39/* 9 */) return c - 0x30\n const lc = c | 0x20\n // Double-quoted scalar ranges are validated by parser.ts before cooking.\n return lc - 0x61 + 10\n}\n\nfunction escapedHexLen (c: number) {\n if (c === 0x78/* x */) return 2\n if (c === 0x75/* u */) return 4\n // Double-quoted scalar ranges are validated by parser.ts before cooking.\n return 8\n}\n\n// --- line folding helpers ---\n\n// Skip a run of line breaks plus the leading whitespace of the following\n// lines, returning the number of line breaks consumed and the new position.\nfunction skipFoldedBreaks (input: string, position: number, end: number) {\n let breaks = 0\n\n while (position < end) {\n const ch = input.charCodeAt(position)\n\n if (ch === 0x0A/* LF */) {\n breaks++\n position++\n } else if (ch === 0x0D/* CR */) {\n breaks++\n position++\n if (input.charCodeAt(position) === 0x0A/* LF */) position++\n } else if (ch === 0x20/* Space */ || ch === 0x09/* Tab */) {\n position++\n } else {\n break\n }\n }\n\n return { position, breaks }\n}\n\n// Folding of line breaks between content chunks: a single break becomes a\n// space, several breaks become (count - 1) newlines.\nfunction foldedBreaks (count: number) {\n if (count === 1) return ' '\n // Called only after skipFoldedBreaks() consumed at least one line break.\n return '\\n'.repeat(count - 1)\n}\n\n// --- per-style extractors ---\n\nfunction getPlainValue (input: string, start: number, end: number) {\n let result = ''\n let position = start\n let captureStart = start\n let captureEnd = start\n\n while (position < end) {\n const ch = input.charCodeAt(position)\n\n if (ch === 0x0A/* LF */ || ch === 0x0D/* CR */) {\n result += input.slice(captureStart, captureEnd)\n const fold = skipFoldedBreaks(input, position, end)\n result += foldedBreaks(fold.breaks)\n position = captureStart = captureEnd = fold.position\n } else {\n position++\n if (ch !== 0x20/* Space */ && ch !== 0x09/* Tab */) captureEnd = position\n }\n }\n\n return result + input.slice(captureStart, captureEnd)\n}\n\nfunction getSingleQuotedValue (input: string, start: number, end: number) {\n let result = ''\n let position = start\n let captureStart = start\n let captureEnd = start\n\n while (position < end) {\n const ch = input.charCodeAt(position)\n\n if (ch === 0x27/* ' */) {\n // Within the stored range every quote is part of an escaped '' pair.\n result += input.slice(captureStart, position) + \"'\"\n position += 2\n captureStart = captureEnd = position\n } else if (ch === 0x0A/* LF */ || ch === 0x0D/* CR */) {\n result += input.slice(captureStart, captureEnd)\n const fold = skipFoldedBreaks(input, position, end)\n result += foldedBreaks(fold.breaks)\n position = captureStart = captureEnd = fold.position\n } else {\n position++\n if (ch !== 0x20/* Space */ && ch !== 0x09/* Tab */) captureEnd = position\n }\n }\n\n // Whitespace right before the closing quote is significant (it is only\n // stripped when followed by a line break).\n return result + input.slice(captureStart, end)\n}\n\nfunction getDoubleQuotedValue (input: string, start: number, end: number) {\n let result = ''\n let position = start\n let captureStart = start\n let captureEnd = start\n\n while (position < end) {\n const ch = input.charCodeAt(position)\n\n if (ch === 0x5C/* \\ */) {\n result += input.slice(captureStart, position)\n position++\n const escaped = input.charCodeAt(position)\n\n if (escaped === 0x0A/* LF */ || escaped === 0x0D/* CR */) {\n // Escaped line break: a line continuation that joins with nothing.\n position = skipFoldedBreaks(input, position, end).position\n } else if (escaped < 256 && simpleEscapeCheck[escaped]) {\n result += simpleEscapeMap[escaped]\n position++\n } else {\n // parser.ts has already rejected unknown escapes and invalid hex digits.\n let hexLength = escapedHexLen(escaped)\n let hexResult = 0\n\n for (; hexLength > 0; hexLength--) {\n position++\n const digit = fromHexCode(input.charCodeAt(position))\n hexResult = (hexResult << 4) + digit\n }\n\n result += charFromCodepoint(hexResult)\n position++\n }\n\n captureStart = captureEnd = position\n } else if (ch === 0x0A/* LF */ || ch === 0x0D/* CR */) {\n result += input.slice(captureStart, captureEnd)\n const fold = skipFoldedBreaks(input, position, end)\n result += foldedBreaks(fold.breaks)\n position = captureStart = captureEnd = fold.position\n } else {\n position++\n if (ch !== 0x20/* Space */ && ch !== 0x09/* Tab */) captureEnd = position\n }\n }\n\n return result + input.slice(captureStart, end)\n}\n\nfunction getBlockValue (\n input: string,\n start: number,\n end: number,\n indent: number,\n chomping: number,\n folded: boolean\n) {\n const textIndent = indent < 0 ? 0 : indent\n // The range starts at column 0 of the first line and includes every line\n // break, including those of trailing blank lines.\n const region = input.slice(start, end).replace(/\\r\\n?/g, '\\n')\n // An empty range is a block with no lines at all (e.g. an empty `|+`) and\n // must stay empty; a naive split would invent a phantom blank line. Otherwise\n // a trailing line break leaves a trailing '' from split() that is not a real\n // line (just the terminator of the last one), so drop it. Interior blank\n // lines are kept.\n const lines = region === ''\n ? []\n : (region.endsWith('\\n') ? region.slice(0, -1) : region).split('\\n')\n\n let result = ''\n let didReadContent = false\n let emptyLines = 0\n let atMoreIndented = false\n\n for (const line of lines) {\n // Whitespace beyond the content indentation is part of the content, so the\n // indentation scan stops at textIndent. A line is empty only when nothing\n // remains after the (capped) indentation.\n // indent < 0 means no content line was detected (a wholly blank block), so\n // every line is an empty line.\n let column = 0\n while (column < textIndent && line.charCodeAt(column) === 0x20/* Space */) column++\n\n if (indent < 0 || column >= line.length) {\n emptyLines++\n continue\n }\n\n const content = line.slice(textIndent)\n const first = content.charCodeAt(0)\n\n if (folded) {\n if (first === 0x20/* Space */ || first === 0x09/* Tab */) {\n // More-indented lines are not folded.\n atMoreIndented = true\n result += '\\n'.repeat(didReadContent ? 1 + emptyLines : emptyLines)\n } else if (atMoreIndented) {\n atMoreIndented = false\n result += '\\n'.repeat(emptyLines + 1)\n } else if (emptyLines === 0) {\n if (didReadContent) result += ' '\n } else {\n result += '\\n'.repeat(emptyLines)\n }\n } else {\n result += '\\n'.repeat(didReadContent ? 1 + emptyLines : emptyLines)\n }\n\n result += content\n didReadContent = true\n emptyLines = 0\n }\n\n if (chomping === CHOMPING_MODE.KEEP) {\n result += '\\n'.repeat(didReadContent ? 1 + emptyLines : emptyLines)\n } else if (chomping !== CHOMPING_MODE.STRIP) {\n if (didReadContent) result += '\\n'\n }\n\n return result\n}\n\n/**\n * Decodes the scalar referenced by event offsets in `input`.\n *\n * @category Events\n */\nfunction getScalarValue (input: string, scalar: ScalarEvent): string {\n if (scalar.valueStart === NO_RANGE) return ''\n\n const { valueStart, valueEnd } = scalar\n\n // Fast path: the parser marked this scalar as a verbatim slice of the input\n // (single-line plain / quoted with no escapes or folded breaks), so the\n // per-style char loop below would just reproduce the slice.\n if (scalar.fast) return input.slice(valueStart, valueEnd)\n\n switch (scalar.style) {\n case SCALAR_STYLE.SINGLE_QUOTED:\n return getSingleQuotedValue(input, valueStart, valueEnd)\n case SCALAR_STYLE.DOUBLE_QUOTED:\n return getDoubleQuotedValue(input, valueStart, valueEnd)\n case SCALAR_STYLE.LITERAL_BLOCK:\n return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false)\n case SCALAR_STYLE.FOLDED_BLOCK:\n return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true)\n default:\n return getPlainValue(input, valueStart, valueEnd)\n }\n}\n\nexport {\n getScalarValue\n}\n","const DEFAULT_TAG_HANDLERS: Readonly<Record<string, string>> = Object.assign(\n Object.create(null),\n {\n '!': '!',\n '!!': 'tag:yaml.org,2002:'\n }\n)\n\nfunction tagPercentEncode (source: string) {\n return encodeURI(source).replace(/!/g, '%21')\n}\n\nfunction tagNameFull (rawTag: string, tagHandlers?: Readonly<Record<string, string>>) {\n if (rawTag.startsWith('!<') && rawTag.endsWith('>')) {\n return decodeURIComponent(rawTag.slice(2, -1))\n }\n\n const handleEnd = rawTag.indexOf('!', 1)\n const handle = handleEnd === -1 ? '!' : rawTag.slice(0, handleEnd + 1)\n const prefix = tagHandlers?.[handle] ?? DEFAULT_TAG_HANDLERS[handle] ?? handle\n\n return decodeURIComponent(prefix) + decodeURIComponent(rawTag.slice(handle.length))\n}\n\nfunction tagNameShort (fullTag: string) {\n let tag = fullTag\n\n if (tag.charCodeAt(0) === 0x21) {\n tag = tag.slice(1)\n return `!${tagPercentEncode(tag)}`\n }\n\n if (tag.slice(0, 18) === 'tag:yaml.org,2002:') {\n return `!!${tagPercentEncode(tag.slice(18))}`\n }\n\n return `!<${tagPercentEncode(tag)}>`\n}\n\nexport {\n tagNameFull,\n tagNameShort\n}\n","import {\n EVENT_ID,\n SCALAR_STYLE,\n type Event,\n type TagHandlers,\n type MappingEvent,\n type ScalarEvent,\n type SequenceEvent\n} from './events.ts'\nimport { getScalarValue } from './parser_scalar.ts'\nimport { CORE_SCHEMA, type Schema } from '../schema.ts'\nimport {\n NOT_RESOLVED,\n type MappingTagDefinition,\n type ScalarTagDefinition,\n type SequenceTagDefinition\n} from '../tag.ts'\nimport { YAMLException } from '../common/exception.ts'\nimport { tagNameFull } from '../common/tagname.ts'\n\nconst NO_RANGE = -1\n\nconst MERGE_TAG_NAME = 'tag:yaml.org,2002:merge'\n\ninterface DocumentFrame {\n kind: 'document'\n position: number\n value: unknown\n hasValue: boolean\n}\n\ninterface SequenceFrame {\n kind: 'sequence'\n position: number\n value: any\n tag: SequenceTagDefinition<any, any>\n anchor: Anchor | null\n index: number\n}\n\ninterface MappingFrame {\n kind: 'mapping'\n position: number\n value: any\n tag: MappingTagDefinition<any, any>\n anchor: Anchor | null\n key: unknown\n keyPosition: number\n hasKey: boolean\n // The key slot drops its tag, but `<<` is recognized by tag, not by value.\n keyIsMerge: boolean\n // Keys brought in by a merge that an explicit pair is still allowed to\n // override. Lazily allocated: stays null for mappings without `<<`.\n overridable: Set<unknown> | null\n}\n\ntype Frame = DocumentFrame | SequenceFrame | MappingFrame\n\ntype AnyTag = ScalarTagDefinition | SequenceTagDefinition<any, any> | MappingTagDefinition<any, any>\n\ninterface ValueAndTag {\n value: unknown\n tag: AnyTag\n}\n\ninterface Anchor {\n value: unknown\n tag: AnyTag\n isValueFinal: boolean\n}\n\n/** @category Events */\ninterface ConstructorOptions {\n /** Source text referenced by offsets in `events`. */\n source: string\n filename?: string\n\n /**\n * Schema to use.\n *\n * @defaultValue {@link CORE_SCHEMA}\n */\n schema?: Schema\n\n /**\n * Enables compatibility with `JSON.parse` behavior. Duplicate keys in a\n * mapping override values instead of throwing an error.\n *\n * @defaultValue `false`\n */\n json?: boolean\n\n /**\n * Maximum total number of keys processed by merge (`<<`) across one load\n * call. Each member of a merge sequence also counts as one key. Set to `-1`\n * to disable the limit.\n *\n * @defaultValue `10000`\n */\n maxTotalMergeKeys?: number\n\n /**\n * Maximum number of alias nodes (`*ref`) per document. Set to `0` to reject\n * all aliases, or to `-1` for no limit.\n *\n * @defaultValue `-1`\n */\n maxAliases?: number\n}\n\n// `source` is input data, not config — so it has no default here.\nconst DEFAULT_CONSTRUCTOR_OPTIONS: Required<Omit<ConstructorOptions, 'source'>> = {\n filename: '',\n schema: CORE_SCHEMA,\n json: false,\n maxTotalMergeKeys: 10000,\n maxAliases: -1\n}\n\ninterface ConstructorState extends Required<ConstructorOptions> {\n events: Event[]\n documents: unknown[]\n eventIndex: number\n position: number\n frames: Frame[]\n anchors: Map<string, Anchor>\n // Mapping tag each sequence element was built with, keyed by the element\n // itself. Needed by `<<` merge, which sees only the finished element values.\n nodeTags: Map<unknown, MappingTagDefinition<any, any>>\n tagHandlers: TagHandlers\n totalMergeKeys: number\n aliasCount: number\n}\n\nfunction eventPosition (event: Event) {\n if ('tagStart' in event && event.tagStart !== NO_RANGE) return event.tagStart\n if ('anchorStart' in event && event.anchorStart !== NO_RANGE) return event.anchorStart\n if ('valueStart' in event && event.valueStart !== NO_RANGE) return event.valueStart\n if ('start' in event) return event.start\n return 0\n}\n\nfunction throwError (state: ConstructorState, message: string): never {\n YAMLException.throwAt(state.source, state.position, message, state.filename)\n}\n\nfunction finalizeCollection (\n state: ConstructorState,\n position: number,\n tag: SequenceTagDefinition<any, any> | MappingTagDefinition<any, any>,\n carrier: unknown\n) {\n try {\n return tag.finalize(carrier)\n } catch (error) {\n if (error instanceof YAMLException) throw error\n YAMLException.throwAt(\n state.source,\n position,\n error instanceof Error ? error.message : String(error),\n state.filename\n )\n }\n}\n\nfunction constructScalar (\n state: ConstructorState,\n event: ScalarEvent\n): ValueAndTag {\n const source = getScalarValue(state.source, event)\n const rawTag = event.tagStart === NO_RANGE\n ? ''\n : state.source.slice(event.tagStart, event.tagEnd)\n const strTag = state.schema.defaultScalarTag\n\n if (rawTag !== '') {\n if (rawTag === '!') return { value: source, tag: strTag }\n\n const tagName = tagNameFull(rawTag, state.tagHandlers)\n const scalarTag = state.schema.lookupScalarTag(tagName)\n\n if (scalarTag) {\n const result = scalarTag.resolve(source, true, tagName)\n\n if (result === NOT_RESOLVED) {\n throwError(state, `cannot resolve a node with !<${tagName}> explicit tag`)\n }\n\n return { value: result, tag: scalarTag }\n }\n\n // An empty node carrying a collection tag (e.g. `!!map`, `!!seq`) is emitted\n // by the parser as a scalar event, since there is no collection syntax to key\n // off. Resolve it here by the explicit tag's kind into an empty collection.\n const collectionTagDef =\n state.schema.lookupMappingTag(tagName) ??\n state.schema.lookupSequenceTag(tagName)\n\n if (collectionTagDef) {\n if (source !== '') {\n throwError(state, `cannot resolve a node with !<${tagName}> explicit tag`)\n }\n\n const carrier = collectionTagDef.create(tagName)\n const value = collectionTagDef.carrierIsResult\n ? carrier\n : finalizeCollection(state, state.position, collectionTagDef, carrier)\n return { value, tag: collectionTagDef }\n }\n\n throwError(state, `unknown scalar tag !<${tagName}>`)\n }\n\n if (event.style === SCALAR_STYLE.PLAIN) {\n return state.schema.resolveImplicitScalarTag(source)\n }\n\n return { value: strTag.resolve(source, false, strTag.tagName), tag: strTag }\n}\n\nfunction collectionTagName (\n state: ConstructorState,\n event: SequenceEvent | MappingEvent,\n defaultTagName: string\n) {\n const rawTag = event.tagStart === NO_RANGE\n ? ''\n : state.source.slice(event.tagStart, event.tagEnd)\n const tagName = rawTag === '' || rawTag === '!'\n ? defaultTagName\n : tagNameFull(rawTag, state.tagHandlers)\n\n return tagName\n}\n\n// A merge source must be a mapping; every mapping tag exposes the read side.\nfunction isMappingTag (tag: AnyTag): tag is MappingTagDefinition<any, any> {\n return tag.nodeKind === 'mapping'\n}\n\nfunction chargeMergeWork (state: ConstructorState) {\n state.totalMergeKeys++\n\n if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {\n throwError(state, `merge keys exceeded maxTotalMergeKeys (${state.maxTotalMergeKeys})`)\n }\n}\n\n// Fold the keys of one mapping source into the target frame, honoring merge\n// precedence: an already-present key (explicit or from an earlier source) wins.\nfunction mergeKeys (state: ConstructorState, frame: MappingFrame, source: unknown, sourceTag: MappingTagDefinition<any, any>) {\n // Count the source mapping itself to bound sequences of empty mappings.\n chargeMergeWork(state)\n\n for (const sourceKey of sourceTag.keys(source)) {\n chargeMergeWork(state)\n\n if (frame.tag.has(frame.value, sourceKey)) continue\n\n const err = frame.tag.addPair(frame.value, sourceKey, sourceTag.get(source, sourceKey))\n if (err) throwError(state, err)\n\n frame.overridable ??= new Set()\n frame.overridable.add(sourceKey)\n }\n}\n\n// The value of a `<<` key: either a mapping (fold its keys) or a sequence of\n// mappings (fold each). Sequence elements arrive as bare values, so the tag each\n// was built with comes from `nodeTags`; a miss means it is not a mapping (a\n// scalar, a nested sequence, or a value some sequence tag synthesized itself).\nfunction mergeSource (state: ConstructorState, frame: MappingFrame, source: unknown, sourceTag: AnyTag) {\n state.position = frame.keyPosition\n\n if (isMappingTag(sourceTag)) {\n mergeKeys(state, frame, source, sourceTag)\n } else if (sourceTag.nodeKind === 'sequence' && Array.isArray(source)) {\n // The current merge budget is sufficient; this hard cap only further limits\n // the attack vector, so there is no reason to expose it as a public option.\n if (source.length > 100) {\n throwError(state, 'abnormal merge sequence size')\n }\n\n for (const element of source) {\n const elementTag = state.nodeTags.get(element)\n if (!elementTag) {\n throwError(state, 'cannot merge mappings; the provided source object is unacceptable')\n }\n mergeKeys(state, frame, element, elementTag)\n }\n } else {\n throwError(state, 'cannot merge mappings; the provided source object is unacceptable')\n }\n}\n\nfunction addMappingValue (state: ConstructorState, frame: MappingFrame, key: unknown, value: unknown, tag: AnyTag) {\n state.position = frame.keyPosition\n\n // `<<` is intercepted before dedup, so a repeated merge key is allowed.\n if (frame.keyIsMerge) {\n mergeSource(state, frame, value, tag)\n return\n }\n\n if (!state.json && frame.tag.has(frame.value, key) && !frame.overridable?.has(key)) {\n throwError(state, 'duplicated mapping key')\n }\n\n const err = frame.tag.addPair(frame.value, key, value)\n if (err) throwError(state, err)\n frame.overridable?.delete(key)\n}\n\nfunction addValue (state: ConstructorState, value: unknown, tag: AnyTag) {\n const frame = state.frames[state.frames.length - 1]!\n\n if (frame.kind === 'document') {\n frame.value = value\n frame.hasValue = true\n } else if (frame.kind === 'sequence') {\n // Any element may later be folded in by a `<<` merge, which by then has no\n // way to tell what built it.\n if (isMappingTag(tag)) state.nodeTags.set(value, tag)\n const err = frame.tag.addItem(frame.value, value, frame.index++)\n if (err) throwError(state, err)\n } else if (frame.hasKey) {\n const key = frame.key\n frame.key = undefined\n frame.hasKey = false\n addMappingValue(state, frame, key, value, tag)\n } else {\n frame.key = value\n frame.keyPosition = state.position\n frame.hasKey = true\n frame.keyIsMerge = tag.tagName === MERGE_TAG_NAME\n }\n}\n\nfunction storeAnchor (\n state: ConstructorState,\n event: ScalarEvent | SequenceEvent | MappingEvent,\n value: unknown,\n tag: AnyTag,\n isValueFinal: boolean\n): Anchor | null {\n if (event.anchorStart !== NO_RANGE) {\n const anchor = {\n value,\n tag,\n isValueFinal\n }\n state.anchors.set(state.source.slice(event.anchorStart, event.anchorEnd), anchor)\n return anchor\n }\n\n return null\n}\n\n/**\n * Constructs JavaScript documents directly from parser events, without an\n * intermediate AST.\n *\n * @category Events\n */\nfunction constructFromEvents (events: Event[], options: ConstructorOptions): unknown[] {\n const state: ConstructorState = {\n ...DEFAULT_CONSTRUCTOR_OPTIONS,\n ...options,\n events,\n documents: [],\n eventIndex: 0,\n position: 0,\n frames: [],\n anchors: new Map(),\n nodeTags: new Map(),\n tagHandlers: Object.create(null),\n totalMergeKeys: 0,\n aliasCount: 0\n }\n\n while (state.eventIndex < state.events.length) {\n const event = state.events[state.eventIndex++]\n state.position = eventPosition(event)\n\n switch (event.type) {\n case EVENT_ID.DOCUMENT:\n state.anchors = new Map()\n state.nodeTags = new Map()\n state.aliasCount = 0\n state.tagHandlers = Object.create(null)\n for (const directive of event.directives) {\n if (directive.kind === 'tag') state.tagHandlers[directive.handle] = directive.prefix\n }\n state.frames.push({ kind: 'document', position: state.position, value: undefined, hasValue: false })\n break\n\n case EVENT_ID.SCALAR: {\n const { value, tag } = constructScalar(state, event)\n storeAnchor(state, event, value, tag, true)\n addValue(state, value, tag)\n break\n }\n\n case EVENT_ID.SEQUENCE: {\n const tagName = collectionTagName(state, event, 'tag:yaml.org,2002:seq')\n const tag = state.schema.lookupSequenceTag(tagName)\n if (!tag) throwError(state, `unknown sequence tag !<${tagName}>`)\n\n const value = tag.create(tagName)\n const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult)\n\n state.frames.push({\n kind: 'sequence', position: state.position, value, tag, anchor, index: 0\n })\n break\n }\n\n case EVENT_ID.MAPPING: {\n const tagName = collectionTagName(state, event, 'tag:yaml.org,2002:map')\n const tag = state.schema.lookupMappingTag(tagName)\n if (!tag) throwError(state, `unknown mapping tag !<${tagName}>`)\n\n const value = tag.create(tagName)\n const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult)\n state.frames.push({\n kind: 'mapping',\n position: state.position,\n value,\n tag,\n anchor,\n key: undefined,\n keyPosition: state.position,\n hasKey: false,\n keyIsMerge: false,\n overridable: null\n })\n break\n }\n\n case EVENT_ID.ALIAS: {\n if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) {\n throwError(state, `aliases exceeded maxAliases (${state.maxAliases})`)\n }\n\n const name = state.source.slice(event.anchorStart, event.anchorEnd)\n const anchor = state.anchors.get(name)\n if (!anchor) {\n throwError(state, `unidentified alias \"${name}\"`)\n }\n if (!anchor.isValueFinal) {\n throwError(state, `recursive alias \"${name}\" is not supported for tag ${anchor.tag.tagName} because it uses finalize()`)\n }\n addValue(state, anchor.value, anchor.tag)\n break\n }\n\n case EVENT_ID.POP: {\n const frame = state.frames.pop()!\n\n if (frame.kind === 'mapping' && frame.hasKey) {\n state.position = frame.keyPosition\n throwError(state, 'incomplete mapping pair in event stream')\n }\n\n if (frame.kind === 'document') {\n state.documents.push(frame.value)\n } else {\n const value = frame.tag.carrierIsResult\n ? frame.value\n : finalizeCollection(state, frame.position, frame.tag, frame.value)\n if (frame.anchor) {\n frame.anchor.value = value\n frame.anchor.isValueFinal = true\n }\n addValue(state, value, frame.tag)\n }\n break\n }\n }\n }\n\n return state.documents\n}\n\nexport {\n constructFromEvents,\n DEFAULT_CONSTRUCTOR_OPTIONS,\n type ConstructorOptions\n}\n","import {\n EVENT_ID,\n SCALAR_STYLE,\n COLLECTION_STYLE,\n CHOMPING_MODE,\n type Event,\n type ScalarStyle,\n type CollectionStyle,\n type ChompingMode,\n type DocumentDirective,\n type TagHandlers\n} from './events.ts'\nimport { YAMLException } from '../common/exception.ts'\n\nconst NO_RANGE = -1\nconst HAS_OWN = Object.prototype.hasOwnProperty\n\nconst CONTEXT_FLOW_IN = 1\nconst CONTEXT_FLOW_OUT = 2\nconst CONTEXT_BLOCK_IN = 3\nconst CONTEXT_BLOCK_OUT = 4\n\n// eslint-disable-next-line no-control-regex\nconst PATTERN_NON_PRINTABLE = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/\n// eslint-disable-next-line no-useless-escape\nconst PATTERN_FLOW_INDICATORS = /[,\\[\\]{}]/\n// YAML 1.2.2, [91] c-tag-handle.\n// eslint-disable-next-line no-useless-escape\nconst PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/\n// YAML 1.2.2, [39] ns-uri-char.\n// eslint-disable-next-line no-useless-escape\nconst NS_URI_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\\-#;/?:@&=+$,_.!~*'()\\[\\]])`\n// YAML 1.2.2, [40] ns-tag-char = ns-uri-char - \"!\" - c-flow-indicator.\n// eslint-disable-next-line no-useless-escape\nconst NS_TAG_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\\-#;/?:@&=+$.~*'()_])`\nconst PATTERN_TAG_URI = new RegExp(`^(?:${NS_URI_CHAR})*$`)\n// YAML 1.2.2, [99] c-ns-shorthand-tag suffix part.\nconst PATTERN_TAG_SUFFIX = new RegExp(`^(?:${NS_TAG_CHAR})+$`)\n// YAML 1.2.2, [93] ns-tag-prefix.\nconst PATTERN_TAG_PREFIX = new RegExp(`^(?:!(?:${NS_URI_CHAR})*|${NS_TAG_CHAR}(?:${NS_URI_CHAR})*)$`)\n\ntype NodeContext =\n typeof CONTEXT_FLOW_IN | typeof CONTEXT_FLOW_OUT |\n typeof CONTEXT_BLOCK_IN | typeof CONTEXT_BLOCK_OUT\n\ninterface NodeProperties {\n anchorStart: number\n anchorEnd: number\n tagStart: number\n tagEnd: number\n}\n\ninterface ParserSnapshot {\n position: number\n line: number\n lineStart: number\n lineIndent: number\n firstTabInLine: number\n eventsLength: number\n}\n\n/** @category Events */\ninterface ParserOptions {\n /**\n * File path used in error messages.\n *\n * @defaultValue `null`\n */\n filename?: string\n\n /**\n * Maximum nesting depth for collections. Aliases are not taken into account.\n *\n * @defaultValue `100`\n */\n maxDepth?: number\n}\n\nconst DEFAULT_PARSER_OPTIONS: Required<ParserOptions> = {\n filename: '',\n maxDepth: 100\n}\n\ninterface ParserState extends Required<ParserOptions> {\n input: string\n length: number\n position: number\n line: number\n lineStart: number\n lineIndent: number\n firstTabInLine: number\n depth: number\n directives: DocumentDirective[]\n tagHandlers: TagHandlers\n events: Event[]\n}\n\nfunction addDocumentEvent (\n state: ParserState,\n explicitStart: boolean,\n explicitEnd: boolean\n) {\n state.events.push({\n type: EVENT_ID.DOCUMENT,\n explicitStart,\n explicitEnd,\n directives: state.directives\n })\n}\n\nfunction addSequenceEvent (\n state: ParserState,\n start: number,\n anchorStart: number,\n anchorEnd: number,\n tagStart: number,\n tagEnd: number,\n style: CollectionStyle\n) {\n state.events.push({\n type: EVENT_ID.SEQUENCE,\n start,\n anchorStart,\n anchorEnd,\n tagStart,\n tagEnd,\n style\n })\n}\n\nfunction addMappingEvent (\n state: ParserState,\n start: number,\n anchorStart: number,\n anchorEnd: number,\n tagStart: number,\n tagEnd: number,\n style: CollectionStyle\n) {\n state.events.push({\n type: EVENT_ID.MAPPING,\n start,\n anchorStart,\n anchorEnd,\n tagStart,\n tagEnd,\n style\n })\n}\n\nfunction insertFlowPairMappingEvent (state: ParserState, snapshot: ParserSnapshot) {\n state.events.splice(snapshot.eventsLength, 0, {\n type: EVENT_ID.MAPPING,\n start: snapshot.position,\n anchorStart: NO_RANGE,\n anchorEnd: NO_RANGE,\n tagStart: NO_RANGE,\n tagEnd: NO_RANGE,\n style: COLLECTION_STYLE.FLOW\n })\n}\n\nfunction addScalarEvent (\n state: ParserState,\n valueStart: number,\n valueEnd: number,\n anchorStart: number,\n anchorEnd: number,\n tagStart: number,\n tagEnd: number,\n style: ScalarStyle,\n chomping: ChompingMode = CHOMPING_MODE.CLIP,\n indent = -1,\n fast = false\n) {\n state.events.push({\n type: EVENT_ID.SCALAR,\n valueStart,\n valueEnd,\n anchorStart,\n anchorEnd,\n tagStart,\n tagEnd,\n style,\n chomping,\n indent,\n fast\n })\n}\n\nfunction addAliasEvent (\n state: ParserState,\n anchorStart: number,\n anchorEnd: number\n) {\n state.events.push({\n type: EVENT_ID.ALIAS,\n anchorStart,\n anchorEnd\n })\n}\n\nfunction addPopEvent (state: ParserState) {\n state.events.push({ type: EVENT_ID.POP })\n}\n\nfunction addEmptyScalarEvent (state: ParserState) {\n addScalarEvent(\n state,\n NO_RANGE,\n NO_RANGE,\n NO_RANGE,\n NO_RANGE,\n NO_RANGE,\n NO_RANGE,\n SCALAR_STYLE.PLAIN\n )\n}\n\nfunction emptyProperties (): NodeProperties {\n return {\n anchorStart: NO_RANGE,\n anchorEnd: NO_RANGE,\n tagStart: NO_RANGE,\n tagEnd: NO_RANGE\n }\n}\n\nfunction snapshotState (state: ParserState): ParserSnapshot {\n return {\n position: state.position,\n line: state.line,\n lineStart: state.lineStart,\n lineIndent: state.lineIndent,\n firstTabInLine: state.firstTabInLine,\n eventsLength: state.events.length\n }\n}\n\nfunction restoreState (state: ParserState, snapshot: ParserSnapshot) {\n state.position = snapshot.position\n state.line = snapshot.line\n state.lineStart = snapshot.lineStart\n state.lineIndent = snapshot.lineIndent\n state.firstTabInLine = snapshot.firstTabInLine\n state.events.length = snapshot.eventsLength\n}\n\nfunction throwError (state: ParserState, message: string): never {\n YAMLException.throwAt(state.input.slice(0, state.length), state.position, message, state.filename)\n}\n\nfunction isEol (c: number) {\n return c === 0x0A/* LF */ || c === 0x0D/* CR */\n}\n\nfunction isWhiteSpace (c: number) {\n return c === 0x09/* Tab */ || c === 0x20/* Space */\n}\n\nfunction isWsOrEol (c: number) {\n return isWhiteSpace(c) || isEol(c)\n}\n\nfunction isWsOrEolOrEnd (c: number) {\n return c === 0 || isWsOrEol(c)\n}\n\nfunction isFlowIndicator (c: number) {\n return c === 0x2C/* , */ ||\n c === 0x5B/* [ */ ||\n c === 0x5D/* ] */ ||\n c === 0x7B/* { */ ||\n c === 0x7D/* } */\n}\n\nfunction fromDecimalCode (c: number) {\n return c >= 0x30/* 0 */ && c <= 0x39/* 9 */ ? c - 0x30 : -1\n}\n\nfunction fromHexCode (c: number) {\n if (c >= 0x30/* 0 */ && c <= 0x39/* 9 */) return c - 0x30\n const lc = c | 0x20\n if (lc >= 0x61/* a */ && lc <= 0x66/* f */) return lc - 0x61 + 10\n return -1\n}\n\nfunction escapedHexLen (c: number) {\n if (c === 0x78/* x */) return 2\n if (c === 0x75/* u */) return 4\n if (c === 0x55/* U */) return 8\n return 0\n}\n\nfunction isSimpleEscape (c: number) {\n return c === 0x30/* 0 */ ||\n c === 0x61/* a */ ||\n c === 0x62/* b */ ||\n c === 0x74/* t */ ||\n c === 0x09/* Tab */ ||\n c === 0x6E/* n */ ||\n c === 0x76/* v */ ||\n c === 0x66/* f */ ||\n c === 0x72/* r */ ||\n c === 0x65/* e */ ||\n c === 0x20/* Space */ ||\n c === 0x22/* \" */ ||\n c === 0x2F/* / */ ||\n c === 0x5C/* \\ */ ||\n c === 0x4E/* N */ ||\n c === 0x5F/* _ */ ||\n c === 0x4C/* L */ ||\n c === 0x50/* P */\n}\n\n// Precondition: state.position points at LF or CR.\nfunction consumeLineBreak (state: ParserState) {\n const ch = state.input.charCodeAt(state.position)\n\n if (ch === 0x0A/* LF */) {\n state.position++\n } else {\n state.position++\n if (state.input.charCodeAt(state.position) === 0x0A/* LF */) state.position++\n }\n\n state.line++\n state.lineStart = state.position\n state.lineIndent = 0\n state.firstTabInLine = -1\n}\n\nfunction skipSeparationSpace (state: ParserState, allowComments: boolean) {\n let lineBreaks = 0\n let ch = state.input.charCodeAt(state.position)\n let hasSeparation = state.position === state.lineStart ||\n isWsOrEol(state.input.charCodeAt(state.position - 1))\n\n while (ch !== 0) {\n while (isWhiteSpace(ch)) {\n hasSeparation = true\n if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {\n state.firstTabInLine = state.position\n }\n ch = state.input.charCodeAt(++state.position)\n }\n\n if (allowComments && hasSeparation && ch === 0x23/* # */) {\n do { ch = state.input.charCodeAt(++state.position) }\n while (!isEol(ch) && ch !== 0)\n }\n\n if (!isEol(ch)) break\n\n consumeLineBreak(state)\n lineBreaks++\n hasSeparation = true\n ch = state.input.charCodeAt(state.position)\n\n while (ch === 0x20/* Space */) {\n state.lineIndent++\n ch = state.input.charCodeAt(++state.position)\n }\n }\n\n return lineBreaks\n}\n\nfunction testDocumentSeparator (state: ParserState, position = state.position) {\n const ch = state.input.charCodeAt(position)\n\n if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&\n ch === state.input.charCodeAt(position + 1) &&\n ch === state.input.charCodeAt(position + 2)) {\n const following = state.input.charCodeAt(position + 3)\n return following === 0 || isWsOrEol(following)\n }\n\n return false\n}\n\nfunction skipByteOrderMark (state: ParserState) {\n if (state.position === state.lineStart &&\n state.input.charCodeAt(state.position) === 0xFEFF) {\n state.position++\n state.lineStart = state.position\n }\n}\n\nfunction testDocumentBoundary (state: ParserState) {\n if (state.position !== state.lineStart) return false\n\n // Fast path: most document boundaries do not have a BOM.\n if (testDocumentSeparator(state)) return true\n if (state.input.charCodeAt(state.position) !== 0xFEFF) return false\n\n // BOM-prefixed boundaries are rare, so snapshot/restore overhead is negligible.\n const snapshot = snapshotState(state)\n\n skipByteOrderMark(state)\n skipSeparationSpace(state, true)\n\n const ch = state.input.charCodeAt(state.position)\n const result = state.position === state.lineStart &&\n (ch === 0x25/* % */ || (ch === 0x2D/* - */ && testDocumentSeparator(state)))\n\n restoreState(state, snapshot)\n return result\n}\n\nfunction skipUntilLineEnd (state: ParserState) {\n let ch = state.input.charCodeAt(state.position)\n\n while (ch !== 0 && !isEol(ch)) {\n ch = state.input.charCodeAt(++state.position)\n }\n}\n\nfunction checkPrintable (state: ParserState, start: number, end: number) {\n if (PATTERN_NON_PRINTABLE.test(state.input.slice(start, end))) {\n throwError(state, 'the stream contains non-printable characters')\n }\n}\n\nfunction readTagProperty (state: ParserState, props: NodeProperties, inFlow: boolean) {\n if (state.input.charCodeAt(state.position) !== 0x21/* ! */) return false\n if (props.tagStart !== NO_RANGE) throwError(state, 'duplication of a tag property')\n\n const start = state.position\n let isVerbatim = false\n let isNamed = false\n let tagHandle = '!'\n let ch = state.input.charCodeAt(++state.position)\n\n if (ch === 0x3C/* < */) {\n isVerbatim = true\n ch = state.input.charCodeAt(++state.position)\n } else if (ch === 0x21/* ! */) {\n isNamed = true\n tagHandle = '!!'\n ch = state.input.charCodeAt(++state.position)\n }\n\n let suffixStart = state.position\n let tagName\n\n if (isVerbatim) {\n while (ch !== 0 && ch !== 0x3E/* > */) ch = state.input.charCodeAt(++state.position)\n if (ch !== 0x3E/* > */) throwError(state, 'unexpected end of the stream within a verbatim tag')\n tagName = state.input.slice(suffixStart, state.position)\n state.position++\n } else {\n while (ch !== 0 && !isWsOrEol(ch) && !(inFlow && isFlowIndicator(ch))) {\n if (ch === 0x21/* ! */) {\n if (!isNamed) {\n tagHandle = state.input.slice(suffixStart - 1, state.position + 1)\n if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, 'named tag handle cannot contain such characters')\n isNamed = true\n suffixStart = state.position + 1\n } else {\n throwError(state, 'tag suffix cannot contain exclamation marks')\n }\n }\n\n ch = state.input.charCodeAt(++state.position)\n }\n\n tagName = state.input.slice(suffixStart, state.position)\n if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, 'tag suffix cannot contain flow indicator characters')\n }\n\n if (tagName && !(isVerbatim ? PATTERN_TAG_URI.test(tagName) : PATTERN_TAG_SUFFIX.test(tagName))) {\n throwError(state, `tag name cannot contain such characters: ${tagName}`)\n }\n try {\n decodeURIComponent(tagName)\n } catch {\n throwError(state, `tag name is malformed: ${tagName}`)\n }\n\n if (!isVerbatim && tagHandle !== '!' && tagHandle !== '!!' && !HAS_OWN.call(state.tagHandlers, tagHandle)) {\n throwError(state, `undeclared tag handle \"${tagHandle}\"`)\n }\n\n props.tagStart = start\n props.tagEnd = state.position\n return true\n}\n\nfunction readAnchorProperty (state: ParserState, props: NodeProperties) {\n if (state.input.charCodeAt(state.position) !== 0x26/* & */) return false\n if (props.anchorStart !== NO_RANGE) throwError(state, 'duplication of an anchor property')\n\n state.position++\n const start = state.position\n\n while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) {\n state.position++\n }\n\n if (state.position === start) throwError(state, 'name of an anchor node must contain at least one character')\n\n props.anchorStart = start\n props.anchorEnd = state.position\n return true\n}\n\nfunction readAlias (state: ParserState, props: NodeProperties) {\n if (state.input.charCodeAt(state.position) !== 0x2A/* * */) return false\n if (props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE) {\n throwError(state, 'alias node should not have any properties')\n }\n\n state.position++\n const start = state.position\n\n while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) {\n state.position++\n }\n\n if (state.position === start) throwError(state, 'name of an alias node must contain at least one character')\n\n addAliasEvent(state, start, state.position)\n return true\n}\n\nfunction readFlowScalarBreak (state: ParserState, nodeIndent: number) {\n skipSeparationSpace(state, false)\n\n if (state.lineIndent < nodeIndent) {\n throwError(state, 'deficient indentation')\n }\n}\n\nfunction readSingleQuotedScalar (state: ParserState, nodeIndent: number, props: NodeProperties) {\n if (state.input.charCodeAt(state.position) !== 0x27/* ' */) return false\n\n state.position++\n const start = state.position\n // A single-quoted scalar is sliceable verbatim when it has no '' escape pairs\n // and no folded line breaks (see getScalarValue fast path).\n let simple = true\n\n while (state.input.charCodeAt(state.position) !== 0) {\n const ch = state.input.charCodeAt(state.position)\n\n if (ch === 0x27/* ' */) {\n if (state.input.charCodeAt(state.position + 1) === 0x27/* ' */) {\n simple = false\n state.position += 2\n continue\n }\n\n const end = state.position\n state.position++\n addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.SINGLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple)\n return true\n }\n\n if (isEol(ch)) {\n simple = false\n readFlowScalarBreak(state, nodeIndent)\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a single quoted scalar')\n } else if (ch !== 0x09/* Tab */ && ch < 0x20) {\n throwError(state, 'expected valid JSON character')\n } else {\n state.position++\n }\n }\n\n throwError(state, 'unexpected end of the stream within a single quoted scalar')\n}\n\nfunction readDoubleQuotedScalar (state: ParserState, nodeIndent: number, props: NodeProperties) {\n if (state.input.charCodeAt(state.position) !== 0x22/* \" */) return false\n\n state.position++\n const start = state.position\n // A double-quoted scalar is sliceable verbatim when it has no \\ escapes and\n // no folded line breaks (see getScalarValue fast path).\n let simple = true\n\n while (state.input.charCodeAt(state.position) !== 0) {\n const ch = state.input.charCodeAt(state.position)\n\n if (ch === 0x22/* \" */) {\n const end = state.position\n state.position++\n addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.DOUBLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple)\n return true\n }\n\n if (ch === 0x5C/* \\ */) {\n simple = false\n const escaped = state.input.charCodeAt(++state.position)\n\n if (isEol(escaped)) {\n readFlowScalarBreak(state, nodeIndent)\n } else if (isSimpleEscape(escaped)) {\n state.position++\n } else {\n let hexLength = escapedHexLen(escaped)\n\n if (hexLength === 0) throwError(state, 'unknown escape sequence')\n\n while (hexLength-- > 0) {\n state.position++\n if (fromHexCode(state.input.charCodeAt(state.position)) < 0) {\n throwError(state, 'expected hexadecimal character')\n }\n }\n state.position++\n }\n } else if (isEol(ch)) {\n simple = false\n readFlowScalarBreak(state, nodeIndent)\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a double quoted scalar')\n } else if (ch !== 0x09/* Tab */ && ch < 0x20) {\n throwError(state, 'expected valid JSON character')\n } else {\n state.position++\n }\n }\n\n throwError(state, 'unexpected end of the stream within a double quoted scalar')\n}\n\nfunction readBlockScalar (state: ParserState, parentIndent: number, props: NodeProperties) {\n const ch = state.input.charCodeAt(state.position)\n let chomping: ChompingMode = CHOMPING_MODE.CLIP\n let indent = -1\n let detectedIndent = false\n\n if (ch !== 0x7C/* | */ && ch !== 0x3E/* > */) return false\n\n const style = ch === 0x7C/* | */ ? SCALAR_STYLE.LITERAL_BLOCK : SCALAR_STYLE.FOLDED_BLOCK\n state.position++\n\n while (state.input.charCodeAt(state.position) !== 0) {\n const current = state.input.charCodeAt(state.position)\n const digit = fromDecimalCode(current)\n\n if (current === 0x2B/* + */ || current === 0x2D/* - */) {\n if (chomping !== CHOMPING_MODE.CLIP) throwError(state, 'repeat of a chomping mode identifier')\n chomping = current === 0x2B/* + */ ? CHOMPING_MODE.KEEP : CHOMPING_MODE.STRIP\n state.position++\n } else if (digit >= 0) {\n if (digit === 0) {\n throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one')\n }\n if (detectedIndent) throwError(state, 'repeat of an indentation width identifier')\n indent = parentIndent + digit - 1\n detectedIndent = true\n state.position++\n } else {\n break\n }\n }\n\n let hadWhitespace = false\n while (isWhiteSpace(state.input.charCodeAt(state.position))) {\n hadWhitespace = true\n state.position++\n }\n if (hadWhitespace && state.input.charCodeAt(state.position) === 0x23/* # */) skipUntilLineEnd(state)\n\n if (isEol(state.input.charCodeAt(state.position))) {\n consumeLineBreak(state)\n } else if (state.input.charCodeAt(state.position) !== 0) {\n throwError(state, 'a line break is expected')\n }\n\n let contentIndent = detectedIndent ? indent : -1\n let maxLeadingIndent = 0\n const valueStart = state.position\n let valueEnd = state.position\n\n while (state.input.charCodeAt(state.position) !== 0) {\n const linePosition = state.position\n let column = 0\n\n while (state.input.charCodeAt(linePosition + column) === 0x20/* Space */) column++\n\n const first = state.input.charCodeAt(linePosition + column)\n if (first === 0) {\n // End of input acts as a line terminator, but there is no line break to\n // include here. A final all-spaces line still counts: when the block has a\n // content indent, the spaces beyond it are real content; in a wholly blank\n // block (contentIndent < 0) the spaces form a blank line that chomping must\n // see, exactly as it would if the line ended with a break. Capture the line\n // in both cases; otherwise the block ends at the start of this empty line.\n if (contentIndent >= 0) {\n if (column > contentIndent) valueEnd = linePosition + column\n } else if (column > 0) {\n valueEnd = linePosition + column\n }\n break\n }\n if (testDocumentBoundary(state)) break\n\n if (!detectedIndent && contentIndent === -1 && isEol(first)) {\n maxLeadingIndent = Math.max(maxLeadingIndent, column)\n }\n\n if (!detectedIndent && contentIndent === -1 && !isEol(first)) {\n if (first === 0x09/* Tab */ && column < parentIndent) {\n state.position = linePosition + column\n throwError(state, 'tab characters must not be used in indentation')\n }\n if (column < maxLeadingIndent) {\n state.position = linePosition + column\n throwError(state, 'bad indentation of a mapping entry')\n }\n }\n\n if (contentIndent === -1 && first !== 0 && !isEol(first) && column < parentIndent) {\n state.lineIndent = column\n state.position = linePosition + column\n break\n }\n\n if (!detectedIndent && first !== 0 && !isEol(first) && contentIndent === -1) {\n contentIndent = column\n }\n\n const requiredIndent = contentIndent === -1 ? parentIndent + 1 : contentIndent\n if (first !== 0 && !isEol(first) && column < requiredIndent) {\n state.lineIndent = column\n state.position = linePosition + column\n break\n }\n\n skipUntilLineEnd(state)\n valueEnd = state.position\n if (isEol(state.input.charCodeAt(state.position))) {\n consumeLineBreak(state)\n // Include the line break in the range so trailing blank lines are\n // preserved. This is what lets cook tell apart an empty `|+` (range \"\",\n // value \"\") from a `|+` with one blank line (range \"\\n\", value \"\\n\").\n // De-indent and chomping are applied later in getScalarValue.\n valueEnd = state.position\n }\n }\n\n checkPrintable(state, valueStart, valueEnd)\n addScalarEvent(\n state,\n valueStart,\n valueEnd,\n props.anchorStart,\n props.anchorEnd,\n props.tagStart,\n props.tagEnd,\n style,\n chomping,\n contentIndent\n )\n return true\n}\n\nfunction canStartPlainScalar (state: ParserState, nodeContext: NodeContext) {\n const ch = state.input.charCodeAt(state.position)\n const inFlow = nodeContext === CONTEXT_FLOW_IN\n\n if (ch === 0 ||\n isWsOrEol(ch) ||\n ch === 0x23/* # */ ||\n ch === 0x26/* & */ ||\n ch === 0x2A/* * */ ||\n ch === 0x21/* ! */ ||\n ch === 0x7C/* | */ ||\n ch === 0x3E/* > */ ||\n ch === 0x27/* ' */ ||\n ch === 0x22/* \" */ ||\n ch === 0x25/* % */ ||\n ch === 0x40/* @ */ ||\n ch === 0x60/* ` */ ||\n (inFlow && isFlowIndicator(ch))) {\n return false\n }\n\n if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {\n const following = state.input.charCodeAt(state.position + 1)\n if (isWsOrEolOrEnd(following) || (inFlow && isFlowIndicator(following))) return false\n }\n\n return true\n}\n\nfunction readPlainScalar (state: ParserState, nodeIndent: number, nodeContext: NodeContext, props: NodeProperties) {\n if (!canStartPlainScalar(state, nodeContext)) return false\n\n const start = state.position\n let end = state.position\n let ch = state.input.charCodeAt(state.position)\n const inFlow = nodeContext === CONTEXT_FLOW_IN\n // A single-line plain scalar is sliceable verbatim: the parser already trims\n // trailing whitespace from the range, so no folding is needed (see\n // getScalarValue fast path). Folded line breaks make it non-simple.\n let multiline = false\n\n while (ch !== 0) {\n if (testDocumentBoundary(state)) break\n\n if (ch === 0x3A/* : */) {\n const following = state.input.charCodeAt(state.position + 1)\n if (isWsOrEolOrEnd(following) || (inFlow && isFlowIndicator(following))) break\n } else if (ch === 0x23/* # */) {\n const preceding = state.input.charCodeAt(state.position - 1)\n if (isWsOrEol(preceding)) break\n } else if (inFlow && isFlowIndicator(ch)) {\n break\n } else if (isEol(ch)) {\n const savedPosition = state.position\n const savedLine = state.line\n const savedLineStart = state.lineStart\n const savedLineIndent = state.lineIndent\n\n skipSeparationSpace(state, false)\n\n if (state.lineIndent >= nodeIndent) {\n multiline = true\n ch = state.input.charCodeAt(state.position)\n continue\n }\n\n state.position = savedPosition\n state.line = savedLine\n state.lineStart = savedLineStart\n state.lineIndent = savedLineIndent\n break\n }\n\n if (!isWhiteSpace(ch)) end = state.position + 1\n ch = state.input.charCodeAt(++state.position)\n }\n\n if (end === start) return false\n\n checkPrintable(state, start, end)\n addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN, CHOMPING_MODE.CLIP, -1, !multiline)\n return true\n}\n\nfunction findBlockMappingColon (state: ParserState) {\n let position = state.position\n let flowLevel = 0\n\n while (position < state.length) {\n const ch = state.input.charCodeAt(position)\n\n if (isEol(ch)) return -1\n if (ch === 0x23/* # */ && isWsOrEol(state.input.charCodeAt(position - 1))) return -1\n\n if ((ch === 0x2A/* * */ || ch === 0x26/* & */) && position === state.position) {\n do { position++ }\n while (state.input.charCodeAt(position) !== 0 &&\n !isWsOrEol(state.input.charCodeAt(position)) &&\n !isFlowIndicator(state.input.charCodeAt(position)))\n continue\n }\n\n if (ch === 0x5B/* [ */ || ch === 0x7B/* { */) {\n flowLevel++\n } else if (ch === 0x5D/* ] */ || ch === 0x7D/* } */) {\n if (flowLevel > 0) flowLevel--\n } else if (flowLevel === 0 && ch === 0x3A/* : */ && isWsOrEol(state.input.charCodeAt(position + 1))) {\n return position\n }\n\n if ((flowLevel > 0 || position === state.position) &&\n (ch === 0x27/* ' */ || ch === 0x22/* \" */)) {\n const quote = ch\n position++\n\n while (position < state.length && state.input.charCodeAt(position) !== quote) {\n if (state.input.charCodeAt(position) === 0x5C/* \\ */ && quote === 0x22/* \" */) position++\n position++\n }\n }\n\n position++\n }\n\n return -1\n}\n\nfunction skipFlowSeparationSpace (state: ParserState, nodeIndent: number) {\n const startLine = state.line\n skipSeparationSpace(state, true)\n\n if ((state.line > startLine && state.lineIndent < nodeIndent) ||\n (state.firstTabInLine !== -1 && state.lineIndent < nodeIndent)) {\n throwError(state, 'deficient indentation')\n }\n}\n\nfunction readFlowCollection (state: ParserState, nodeIndent: number, props: NodeProperties) {\n const ch = state.input.charCodeAt(state.position)\n const isMapping = ch === 0x7B/* { */\n const start = state.position\n let readNext = true\n\n if (ch !== 0x5B/* [ */ && ch !== 0x7B/* { */) return false\n\n const terminator = isMapping ? 0x7D/* } */ : 0x5D/* ] */\n\n if (isMapping) {\n addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW)\n } else {\n addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW)\n }\n\n state.position++\n\n while (state.input.charCodeAt(state.position) !== 0) {\n skipFlowSeparationSpace(state, nodeIndent)\n\n let ch = state.input.charCodeAt(state.position)\n\n if (ch === terminator) {\n state.position++\n addPopEvent(state)\n return true\n } else if (!readNext) {\n throwError(state, 'missed comma between flow collection entries')\n } else if (ch === 0x2C/* , */) {\n throwError(state, \"expected the node content, but found ','\")\n }\n\n let isPair = false\n let isExplicitPair = false\n\n if (ch === 0x3F/* ? */ && isWsOrEol(state.input.charCodeAt(state.position + 1))) {\n isPair = isExplicitPair = true\n state.position += 1\n skipFlowSeparationSpace(state, nodeIndent)\n }\n\n const entryLine = state.line\n const entryStart = snapshotState(state)\n\n const keyWasRead = parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)\n skipFlowSeparationSpace(state, nodeIndent)\n\n ch = state.input.charCodeAt(state.position)\n\n if ((isMapping || isExplicitPair || state.line === entryLine) && ch === 0x3A/* : */) {\n isPair = true\n state.position++\n skipFlowSeparationSpace(state, nodeIndent)\n if (!isMapping) {\n insertFlowPairMappingEvent(state, entryStart)\n if (!keyWasRead) addEmptyScalarEvent(state)\n } else if (!keyWasRead) {\n addEmptyScalarEvent(state)\n }\n if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) {\n addEmptyScalarEvent(state)\n }\n skipFlowSeparationSpace(state, nodeIndent)\n if (!isMapping) addPopEvent(state)\n } else if (isMapping && isPair) {\n if (!keyWasRead) addEmptyScalarEvent(state)\n addEmptyScalarEvent(state)\n } else if (isMapping) {\n addEmptyScalarEvent(state)\n } else if (isPair) {\n insertFlowPairMappingEvent(state, entryStart)\n if (!keyWasRead) addEmptyScalarEvent(state)\n addEmptyScalarEvent(state)\n addPopEvent(state)\n }\n\n ch = state.input.charCodeAt(state.position)\n\n if (ch === 0x2C/* , */) {\n readNext = true\n state.position++\n } else {\n readNext = false\n }\n }\n\n throwError(state, 'unexpected end of the stream within a flow collection')\n}\n\nfunction readBlockSequence (state: ParserState, nodeIndent: number, props: NodeProperties) {\n if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 0x2D/* - */ || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {\n return false\n }\n\n addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK)\n\n while (state.input.charCodeAt(state.position) === 0x2D/* - */ && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {\n if (state.firstTabInLine !== -1) {\n state.position = state.firstTabInLine\n throwError(state, 'tab characters must not be used in indentation')\n }\n\n const entryLine = state.line\n state.position++\n\n const hadBreak = skipSeparationSpace(state, true) > 0\n if (state.firstTabInLine !== -1 &&\n state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {\n throwError(state, 'bad indentation of a sequence entry')\n }\n\n if (hadBreak && state.lineIndent <= nodeIndent) {\n addEmptyScalarEvent(state)\n } else {\n parseNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true)\n }\n\n skipSeparationSpace(state, true)\n\n if (state.lineIndent < nodeIndent || state.position >= state.length) break\n if (state.lineIndent > nodeIndent) throwError(state, 'bad indentation of a sequence entry')\n if (state.line === entryLine &&\n state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {\n throwError(state, 'bad indentation of a sequence entry')\n }\n }\n\n addPopEvent(state)\n return true\n}\n\nfunction readBlockMapping (state: ParserState, nodeIndent: number, flowIndent: number, props: NodeProperties) {\n let atExplicitKey = false\n let detected = false\n let mappingOpened = false\n let pendingExplicitKey = false\n\n if (state.firstTabInLine !== -1) return false\n\n let ch = state.input.charCodeAt(state.position)\n\n while (ch !== 0) {\n if (!atExplicitKey && state.firstTabInLine !== -1) {\n state.position = state.firstTabInLine\n throwError(state, 'tab characters must not be used in indentation')\n }\n\n const following = state.input.charCodeAt(state.position + 1)\n const entryLine = state.line\n\n if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && isWsOrEolOrEnd(following)) {\n if (!mappingOpened) {\n addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK)\n mappingOpened = true\n }\n\n if (ch === 0x3F/* ? */) {\n if (atExplicitKey) addEmptyScalarEvent(state)\n detected = true\n atExplicitKey = true\n } else if (atExplicitKey) {\n atExplicitKey = false\n } else {\n addEmptyScalarEvent(state)\n detected = true\n atExplicitKey = false\n }\n\n state.position += 1\n pendingExplicitKey = true\n } else {\n // An explicit key awaiting its value, followed by an implicit key, means\n // the explicit key's value is empty. Emit it now (append-only) so it is\n // ordered before the implicit key node read just below.\n if (atExplicitKey) {\n addEmptyScalarEvent(state)\n atExplicitKey = false\n }\n\n const beforeKey = snapshotState(state)\n\n if (!parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {\n break\n }\n\n if (state.line === entryLine) {\n ch = state.input.charCodeAt(state.position)\n\n while (isWhiteSpace(ch)) {\n ch = state.input.charCodeAt(++state.position)\n }\n\n if (ch === 0x3A/* : */) {\n ch = state.input.charCodeAt(++state.position)\n\n if (!isWsOrEolOrEnd(ch)) {\n throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping')\n }\n\n if (!mappingOpened) {\n restoreState(state, beforeKey)\n addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK)\n mappingOpened = true\n // The key, the `:` and the space after it were already validated\n // above, before the rollback. Re-reading the same input cannot\n // fail, so just consume it again without error checks.\n parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)\n\n ch = state.input.charCodeAt(state.position)\n while (isWhiteSpace(ch)) {\n ch = state.input.charCodeAt(++state.position)\n }\n\n state.position++\n }\n\n detected = true\n atExplicitKey = false\n pendingExplicitKey = false\n } else if (detected) {\n throwError(state, \"expected ':' after a mapping key\")\n } else {\n // Not a mapping. If outer properties are pending, roll back so the\n // caller re-reads this node with them attached (events are append-only).\n if (props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE) {\n restoreState(state, beforeKey)\n return false\n }\n return true\n }\n } else if (detected) {\n throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key')\n } else {\n if (props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE) {\n restoreState(state, beforeKey)\n return false\n }\n return true\n }\n }\n\n if (parseNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, pendingExplicitKey)) {\n pendingExplicitKey = false\n }\n\n if (!atExplicitKey) {\n if (pendingExplicitKey) {\n addEmptyScalarEvent(state)\n pendingExplicitKey = false\n }\n }\n\n skipSeparationSpace(state, true)\n ch = state.input.charCodeAt(state.position)\n\n if ((state.line === entryLine || state.lineIndent > nodeIndent) && ch !== 0) {\n throwError(state, 'bad indentation of a mapping entry')\n } else if (state.lineIndent < nodeIndent) {\n break\n }\n }\n\n if (!detected) return false\n if (atExplicitKey) addEmptyScalarEvent(state)\n if (mappingOpened) addPopEvent(state)\n return true\n}\n\nfunction parseNode (\n state: ParserState,\n parentIndent: number,\n nodeContext: NodeContext,\n allowToSeek: boolean,\n allowCompact: boolean,\n allowPropertyMapping = true\n): boolean {\n if (state.depth >= state.maxDepth) {\n throwError(state, `nesting exceeded maxDepth (${state.maxDepth})`)\n }\n\n state.depth++\n\n let indentStatus = 1\n let atNewLine = false\n let hasContent = false\n let propertyStart: ParserSnapshot | null = null\n const props = emptyProperties()\n\n let allowBlockScalars = nodeContext === CONTEXT_BLOCK_OUT || nodeContext === CONTEXT_BLOCK_IN\n let allowBlockCollections = allowBlockScalars\n const allowBlockStyles = allowBlockScalars\n\n if (allowToSeek && skipSeparationSpace(state, true)) {\n atNewLine = true\n\n if (state.lineIndent > parentIndent) {\n indentStatus = 1\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0\n } else {\n indentStatus = -1\n }\n }\n\n if (indentStatus === 1) {\n while (true) {\n const ch = state.input.charCodeAt(state.position)\n const propertyState = snapshotState(state)\n\n if (atNewLine &&\n indentStatus !== 1 &&\n (ch === 0x21/* ! */ || ch === 0x26/* & */)) {\n break\n }\n\n if (atNewLine &&\n allowBlockStyles &&\n (props.tagStart !== NO_RANGE || props.anchorStart !== NO_RANGE) &&\n (ch === 0x21/* ! */ || ch === 0x26/* & */)) {\n const fallbackState = snapshotState(state)\n const flowIndent = parentIndent + 1\n const mappingIndent = state.position - state.lineStart\n\n if (readBlockMapping(state, mappingIndent, flowIndent, props) &&\n state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) {\n state.depth--\n return true\n }\n\n restoreState(state, fallbackState)\n }\n\n if (atNewLine &&\n ((ch === 0x21/* ! */ && props.tagStart !== NO_RANGE) ||\n (ch === 0x26/* & */ && props.anchorStart !== NO_RANGE))) {\n break\n }\n\n if (!readTagProperty(state, props, nodeContext === CONTEXT_FLOW_IN) && !readAnchorProperty(state, props)) {\n break\n }\n\n if (propertyStart === null) propertyStart = propertyState\n\n if (skipSeparationSpace(state, true)) {\n atNewLine = true\n allowBlockCollections = allowBlockStyles\n\n if (state.lineIndent > parentIndent) {\n indentStatus = 1\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0\n } else {\n indentStatus = -1\n }\n } else {\n allowBlockCollections = false\n }\n }\n }\n\n if (allowBlockCollections) {\n allowBlockCollections = atNewLine || allowCompact\n }\n\n if (indentStatus === 1 || nodeContext === CONTEXT_BLOCK_OUT) {\n const flowIndent = nodeContext === CONTEXT_FLOW_IN || nodeContext === CONTEXT_FLOW_OUT\n ? parentIndent\n : parentIndent + 1\n const blockIndent = state.position - state.lineStart\n\n if (indentStatus === 1) {\n if ((allowBlockCollections &&\n (readBlockSequence(state, blockIndent, props) ||\n readBlockMapping(state, blockIndent, flowIndent, props))) ||\n readFlowCollection(state, flowIndent, props)) {\n hasContent = true\n } else {\n const ch = state.input.charCodeAt(state.position)\n\n if (propertyStart !== null && allowPropertyMapping && allowBlockStyles && !allowBlockCollections &&\n ch !== 0x7C/* | */ && ch !== 0x3E/* > */) {\n const fallbackState = snapshotState(state)\n const propertyIndent = propertyStart.position - propertyStart.lineStart\n\n restoreState(state, propertyStart)\n\n if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) &&\n state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) {\n hasContent = true\n } else {\n restoreState(state, fallbackState)\n }\n }\n\n if (!hasContent &&\n ((allowBlockScalars && readBlockScalar(state, flowIndent, props)) ||\n readSingleQuotedScalar(state, flowIndent, props) ||\n readDoubleQuotedScalar(state, flowIndent, props) ||\n readAlias(state, props) ||\n readPlainScalar(state, flowIndent, nodeContext, props))) {\n hasContent = true\n }\n }\n } else if (indentStatus === 0) {\n hasContent = allowBlockCollections && readBlockSequence(state, blockIndent, props)\n }\n }\n\n allowBlockScalars = allowBlockScalars && !hasContent\n\n if (!hasContent && (props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE || allowBlockScalars)) {\n addScalarEvent(\n state,\n NO_RANGE,\n NO_RANGE,\n props.anchorStart,\n props.anchorEnd,\n props.tagStart,\n props.tagEnd,\n SCALAR_STYLE.PLAIN\n )\n hasContent = true\n }\n\n state.depth--\n return hasContent || props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE\n}\n\nfunction readDirective (state: ParserState) {\n if (state.lineIndent > 0 || state.input.charCodeAt(state.position) !== 0x25/* % */) return false\n\n state.position++\n const nameStart = state.position\n\n while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++\n\n const name = state.input.slice(nameStart, state.position)\n const args: string[] = []\n\n if (name.length === 0) throwError(state, 'directive name must not be less than one character in length')\n\n while (state.input.charCodeAt(state.position) !== 0 && !isEol(state.input.charCodeAt(state.position))) {\n while (isWhiteSpace(state.input.charCodeAt(state.position))) state.position++\n if (state.input.charCodeAt(state.position) === 0x23/* # */ || isEol(state.input.charCodeAt(state.position)) || state.input.charCodeAt(state.position) === 0) break\n\n const start = state.position\n while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++\n args.push(state.input.slice(start, state.position))\n }\n\n if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state)\n\n if (name === 'YAML') {\n if (state.directives.some(directive => directive.kind === 'yaml')) throwError(state, 'duplication of %YAML directive')\n if (args.length !== 1) throwError(state, 'YAML directive accepts exactly one argument')\n\n const match = /^([0-9]+)\\.([0-9]+)$/.exec(args[0])\n if (match === null) throwError(state, 'ill-formed argument of the YAML directive')\n if (parseInt(match[1], 10) !== 1) throwError(state, 'unacceptable YAML version of the document')\n\n state.directives.push({ kind: 'yaml', version: args[0] })\n } else if (name === 'TAG') {\n if (args.length !== 2) throwError(state, 'TAG directive accepts exactly two arguments')\n\n const [handle, prefix] = args\n if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, 'ill-formed tag handle (first argument) of the TAG directive')\n if (HAS_OWN.call(state.tagHandlers, handle)) throwError(state, `there is a previously declared suffix for \"${handle}\" tag handle`)\n if (!PATTERN_TAG_PREFIX.test(prefix)) throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive')\n try {\n decodeURIComponent(prefix)\n } catch {\n throwError(state, `tag prefix is malformed: ${prefix}`)\n }\n\n state.tagHandlers[handle] = prefix\n state.directives.push({ kind: 'tag', handle, prefix })\n }\n\n return true\n}\n\nfunction readDocument (state: ParserState) {\n state.directives = []\n state.tagHandlers = Object.create(null)\n let hasDirectives = false\n\n skipSeparationSpace(state, true)\n\n while (readDirective(state)) {\n hasDirectives = true\n skipSeparationSpace(state, true)\n }\n\n let explicitStart = false\n let explicitEnd = false\n let allowCompact = true\n\n if (state.lineIndent === 0 &&\n state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&\n state.input.charCodeAt(state.position + 2) === 0x2D/* - */ &&\n isWsOrEolOrEnd(state.input.charCodeAt(state.position + 3))) {\n explicitStart = true\n const markerLine = state.line\n state.position += 3\n skipSeparationSpace(state, true)\n allowCompact = state.line > markerLine\n } else if (hasDirectives) {\n throwError(state, 'directives end mark is expected')\n }\n\n const documentEventIndex = state.events.length\n if (!explicitStart &&\n state.position === state.lineStart &&\n state.input.charCodeAt(state.position) === 0x2E/* . */ &&\n testDocumentSeparator(state)) {\n state.position += 3\n skipSeparationSpace(state, true)\n return\n }\n\n addDocumentEvent(state, explicitStart, false)\n if (!parseNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, allowCompact, allowCompact)) {\n addEmptyScalarEvent(state)\n }\n skipSeparationSpace(state, true)\n\n if (state.position === state.lineStart && testDocumentSeparator(state)) {\n explicitEnd = state.input.charCodeAt(state.position) === 0x2E/* . */\n if (explicitEnd) {\n const markerLine = state.line\n state.position += 3\n skipSeparationSpace(state, true)\n if (state.line === markerLine && state.position < state.length) {\n throwError(state, 'end of the stream or a document separator is expected')\n }\n }\n }\n\n const documentEvent = state.events[documentEventIndex]\n if (documentEvent?.type === EVENT_ID.DOCUMENT) documentEvent.explicitEnd = explicitEnd\n\n addPopEvent(state)\n\n if (!explicitEnd &&\n state.position < state.length &&\n !testDocumentBoundary(state)) {\n throwError(state, 'end of the stream or a document separator is expected')\n }\n}\n\n/**\n * Parses YAML into a flat event stream referencing source text by offsets.\n *\n * @category Events\n */\nfunction parseEvents (input: string, options: ParserOptions): Event[] {\n const length = input.length\n const state: ParserState = {\n ...DEFAULT_PARSER_OPTIONS,\n ...options,\n input: `${input}\\0`,\n length,\n position: 0,\n line: 0,\n lineStart: 0,\n lineIndent: 0,\n firstTabInLine: -1,\n depth: 0,\n directives: [],\n tagHandlers: Object.create(null),\n events: []\n }\n\n const nullpos = input.indexOf('\\0')\n if (nullpos !== -1) YAMLException.throwAt(input, nullpos, 'null byte is not allowed in input', state.filename)\n\n while (state.position < state.length) {\n skipByteOrderMark(state)\n skipSeparationSpace(state, true)\n if (state.position >= state.length) break\n const documentStart = state.position\n readDocument(state)\n if (state.position === documentStart) {\n // Internal progress guard: if readDocument() ever returns without\n // consuming input, stop here instead of looping forever.\n /* c8 ignore next */\n throwError(state, 'can not read a document')\n }\n }\n\n return state.events\n}\n\nexport {\n parseEvents,\n DEFAULT_PARSER_OPTIONS,\n type ParserOptions\n}\n","import { YAMLException } from './common/exception.ts'\nimport { pick } from './common/object.ts'\nimport {\n constructFromEvents,\n DEFAULT_CONSTRUCTOR_OPTIONS,\n type ConstructorOptions\n} from './parser/constructor.ts'\nimport {\n parseEvents,\n DEFAULT_PARSER_OPTIONS,\n type ParserOptions\n} from './parser/parser.ts'\n\n// `source` is supplied by `loadDocuments` itself, not by the public caller.\n/** @category Main */\ninterface LoadOptions extends ParserOptions, Omit<ConstructorOptions, 'source'> {}\n\n/** @inline */\ntype LoadAllIterator = (document: unknown) => void\n\nconst DEFAULT_LOAD_OPTIONS: Required<LoadOptions> = {\n ...DEFAULT_PARSER_OPTIONS,\n ...DEFAULT_CONSTRUCTOR_OPTIONS\n}\n\nfunction loadDocuments (input: string, options: LoadOptions = {}) {\n const opts = { ...DEFAULT_LOAD_OPTIONS, ...options }\n const source = String(input)\n\n const PARSER_OPT_KEYS = Object.keys(DEFAULT_PARSER_OPTIONS) as\n (keyof typeof DEFAULT_PARSER_OPTIONS)[]\n const CONSTRUCTOR_OPT_KEYS = Object.keys(DEFAULT_CONSTRUCTOR_OPTIONS) as\n (keyof typeof DEFAULT_CONSTRUCTOR_OPTIONS)[]\n\n const events = parseEvents(source, pick(opts, PARSER_OPT_KEYS))\n return constructFromEvents(events, { ...pick(opts, CONSTRUCTOR_OPT_KEYS), source })\n}\n\n/**\n * Same as {@link load}, but understands multi-document sources.\n * Returns an array of documents.\n *\n * @category Main\n */\nfunction loadAll (input: string, options?: LoadOptions): unknown[]\n\n/**\n * @deprecated Iterator is not supported.\n */\nfunction loadAll (input: string, iterator: null, options?: LoadOptions): unknown[]\n\n/**\n * @deprecated Iterator is not supported.\n */\nfunction loadAll (input: string, iterator: LoadAllIterator, options?: LoadOptions): void\nfunction loadAll (\n input: string,\n iteratorOrOptions?: LoadAllIterator | LoadOptions | null,\n options?: LoadOptions\n) {\n let iterator: LoadAllIterator | null = null\n\n if (typeof iteratorOrOptions === 'function') {\n iterator = iteratorOrOptions\n } else if (iteratorOrOptions !== null && typeof iteratorOrOptions === 'object') {\n options = iteratorOrOptions\n }\n\n const documents = loadDocuments(input, options)\n\n if (iterator === null) return documents\n for (const document of documents) iterator(document)\n}\n\n/**\n * Parses `string` as a single YAML document. Throws {@link YAMLException} on\n * error. This function does not understand multi-document or empty sources; it\n * throws an exception on those.\n *\n * > [!NOTE]\n * > 1. When processing untrusted input, see the\n * > [security considerations](../docs/safety.md).\n * > 2. All exceptions MUST be caught, not just {@link YAMLException}.\n * > 3. The default {@link CORE_SCHEMA} comes without the `!!merge` tag. You can\n * > easily enable it if needed.\n * > 4. The default {@link mapTag} is `{}`-object based, with known limitations\n * > (see description). For full compatibility use {@link realMapTag}\n * > instead (it uses native JS `Map`).\n *\n * @example\n * Enable {@link mergeTag} and {@link realMapTag}:\n *\n * ```javascript\n * import { load, CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml'\n *\n * try {\n * load(data, { schema: CORE_SCHEMA.withTags(mergeTag, realMapTag) })\n * } catch (e) {\n * console.error(e)\n * }\n * ```\n *\n * @category Main\n */\nfunction load (input: string, options?: LoadOptions) {\n const documents = loadDocuments(input, options)\n\n if (documents.length === 0) throw new YAMLException('expected a document, but the input is empty')\n if (documents.length === 1) return documents[0]\n\n throw new YAMLException('expected a single document in the stream, but found more')\n}\n\nexport {\n load,\n loadAll,\n type LoadOptions\n}\n","// JS value graph → AST. Knows tags (`identify` / `represent`). A single\n// identity-`Map` walk handles dedup: a repeat occurrence of an object (including\n// a cycle) becomes an `alias`, and the first occurrence gets an `anchor`.\n\nimport { YAMLException } from '../common/exception.ts'\nimport { type Schema } from '../schema.ts'\nimport { type TagDefinition } from '../tag.ts'\nimport { tagNameShort } from '../common/tagname.ts'\nimport { COLLECTION_STYLE, SCALAR_STYLE } from '../parser/events.ts'\nimport {\n type Document,\n type Node,\n type ScalarNode,\n type SequenceNode,\n type MappingNode\n} from './nodes.ts'\n\n/** @category AST */\ninterface FromJsOptions {\n /** Inlines duplicate objects instead of converting them into references. */\n noRefs?: boolean\n\n /**\n * Skips unrepresentable values instead of throwing. Invalid mapping pairs\n * and sequence items are skipped; `undefined` sequence items become `null`.\n */\n skipInvalid?: boolean\n}\n\n// A match candidate. `implicitTag` means the tag is not printed (implicit\n// scalars and the default str/seq/map tags).\ninterface RepresentType {\n tag: TagDefinition\n implicitTag: boolean\n}\n\n// Returned by `build` when no tag matched.\nconst INVALID = Symbol('INVALID')\n\ninterface FromJsState {\n representTypes: RepresentType[]\n noRefs: boolean\n skipInvalid: boolean\n\n // Already-built collection values → their node, for anchor/alias dedup.\n refs: Map<unknown, Node>\n refCounter: number\n}\n\nfunction buildRepresentTypes (schema: Schema): RepresentType[] {\n const defaultTags = new Set<TagDefinition>([\n schema.defaultScalarTag,\n schema.defaultSequenceTag,\n schema.defaultMappingTag\n ].filter((t): t is TagDefinition => t !== undefined))\n\n // Default container/str tags go last so a more specific tag identifying the\n // same JS value (e.g. a custom tag on a plain object) wins.\n const implicitScalars = schema.implicitScalarTags\n const explicitTags = schema.tags.filter(t =>\n !(t.nodeKind === 'scalar' && t.implicit) && !defaultTags.has(t))\n const defaultTagsLast = schema.tags.filter(t => defaultTags.has(t))\n\n return [\n ...implicitScalars.map(tag => ({ tag, implicitTag: true })),\n ...explicitTags.map(tag => ({ tag, implicitTag: false })),\n ...defaultTagsLast.map(tag => ({ tag, implicitTag: true }))\n ]\n}\n\n// First tag whose `identify` accepts `object`.\nfunction matchTag (state: FromJsState, object: unknown): { tag: TagDefinition, tagName: string, implicitTag: boolean } | null {\n for (let index = 0, length = state.representTypes.length; index < length; index += 1) {\n const { tag, implicitTag } = state.representTypes[index]\n\n if (tag.identify(object)) {\n let tagName: string\n if (tag.matchByTagPrefix) {\n tagName = tag.representTagName(object)\n } else {\n tagName = tag.tagName\n }\n return { tag, tagName, implicitTag }\n }\n }\n\n return null\n}\n\n// Build a node for `object`, or INVALID when no tag matches. `undefined` never\n// throws (caller decides: null in a sequence, skip in a mapping, '' at root);\n// any other unrepresentable value throws unless `skipInvalid`.\nfunction build (state: FromJsState, object: unknown): Node | typeof INVALID {\n if (!state.noRefs && object !== null && typeof object === 'object') {\n const existing = state.refs.get(object)\n if (existing) {\n if (existing.anchor === undefined) existing.anchor = `ref_${state.refCounter++}`\n return { kind: 'alias', anchor: existing.anchor }\n }\n }\n\n const matched = matchTag(state, object)\n\n if (!matched) {\n if (object === undefined) return INVALID\n if (state.skipInvalid) return INVALID\n throw new YAMLException(`unacceptable kind of an object to dump ${Object.prototype.toString.call(object)}`)\n }\n\n const { tag, tagName, implicitTag } = matched\n const nodeTagName = implicitTag ? tagName : tagNameShort(tagName)\n\n if (tag.nodeKind === 'scalar') {\n const node: ScalarNode = {\n kind: 'scalar',\n tag: nodeTagName,\n tagged: !implicitTag,\n style: SCALAR_STYLE.PLAIN,\n value: tag.represent(object)\n }\n return node\n }\n\n if (tag.nodeKind === 'sequence') {\n const container = tag.represent(object)\n const node: SequenceNode = {\n kind: 'sequence',\n tag: nodeTagName,\n tagged: !implicitTag,\n style: COLLECTION_STYLE.BLOCK,\n items: []\n }\n if (!state.noRefs) state.refs.set(object, node)\n\n for (let index = 0, length = container.length; index < length; index += 1) {\n let item = build(state, container[index])\n // An invalid element becomes null; a still-invalid null then skips/throws.\n if (item === INVALID && container[index] === undefined) item = build(state, null)\n if (item === INVALID) continue\n node.items.push(item)\n }\n return node\n }\n\n // mapping — the canonical form is always a `Map`.\n const map = tag.represent(object)\n const node: MappingNode = {\n kind: 'mapping',\n tag: nodeTagName,\n tagged: !implicitTag,\n style: COLLECTION_STYLE.BLOCK,\n items: []\n }\n if (!state.noRefs) state.refs.set(object, node)\n\n for (const [objectKey, objectValue] of map) {\n const key = build(state, objectKey)\n if (key === INVALID) continue // invalid key skips the pair\n const value = build(state, objectValue)\n if (value === INVALID) continue // invalid value skips the pair\n node.items.push({ key, value })\n }\n return node\n}\n\n/**\n * Convert JS object to AST. A JS value is one YAML document. An unrepresentable\n * root becomes an empty document, which the presenter renders as an empty\n * string.\n *\n * @category AST\n */\nfunction jsToAst (input: unknown, schema: Schema, options: FromJsOptions = {}): Document[] {\n const state: FromJsState = {\n representTypes: buildRepresentTypes(schema),\n noRefs: options.noRefs ?? false,\n skipInvalid: options.skipInvalid ?? false,\n refs: new Map(),\n refCounter: 0\n }\n\n const root = build(state, input)\n return [{ contents: root === INVALID ? null : root, directives: [] }]\n}\n\nexport {\n jsToAst,\n type FromJsOptions\n}\n","// Depth-first AST traversal. Mirrors the `kind` walk of the presenter and the\n// `from_*` builders, but stays read-oriented: nodes are plain objects, so a\n// visitor mutates them in place. Control signals let it prune or stop the walk.\n\nimport {\n type Node,\n type Document\n} from './nodes.ts'\n\n// Returned by a visitor to control the walk; anything else (incl. `undefined`)\n// descends as usual.\n/**\n * Return from a visitor to stop the whole traversal.\n *\n * @category AST\n */\nconst VISIT_BREAK = Symbol('visit:break')\n\n/**\n * Return from a visitor to skip the current node's children.\n *\n * @category AST\n */\nconst VISIT_SKIP = Symbol('visit:skip')\n\n/** @inline */\ntype VisitControl = typeof VISIT_BREAK | typeof VISIT_SKIP | undefined | void\n\n/**\n * Traversal-derived position of the current node. Kept off the node itself: a\n * node may sit in several places (alias/dedup reuse), so depth/role belong to\n * the walk, not the node. {@link VisitContext.parent} `kind` +\n * {@link VisitContext.isKey} pin the exact slot.\n *\n * @category AST\n */\ninterface VisitContext {\n /** 0 = document content root */\n depth: number\n\n /** Enclosing sequence/mapping, null at the root */\n parent: Node | null\n\n /** Node sits in a mapping key position */\n isKey: boolean\n}\n\n/** @category AST */\ntype Visitor = (node: Node, ctx: VisitContext) => VisitControl\n\n// Returns `true` once `VISIT_BREAK` was seen, so callers can unwind the walk.\nfunction visitNode (node: Node, visitor: Visitor, ctx: VisitContext): boolean {\n const control = visitor(node, ctx)\n if (control === VISIT_BREAK) return true\n if (control === VISIT_SKIP) return false\n\n const depth = ctx.depth + 1\n\n switch (node.kind) {\n case 'sequence':\n for (const item of node.items) {\n if (visitNode(item, visitor, { depth, parent: node, isKey: false })) return true\n }\n break\n case 'mapping':\n for (const { key, value } of node.items) {\n if (visitNode(key, visitor, { depth, parent: node, isKey: true })) return true\n if (visitNode(value, visitor, { depth, parent: node, isKey: false })) return true\n }\n break\n }\n\n return false\n}\n\n/**\n * Walk every node in the documents, calling {@link Visitor} once per\n * node (pre-order).\n *\n * @category AST\n */\nfunction visit (documents: Document[], visitor: Visitor): void {\n for (const doc of documents) {\n if (doc.contents && visitNode(doc.contents, visitor, { depth: 0, parent: null, isKey: false })) return\n }\n}\n\nexport {\n visit,\n VISIT_BREAK,\n VISIT_SKIP,\n type Visitor,\n type VisitContext\n}\n","import { SCALAR_STYLE, type ScalarStyle } from '../parser/events.ts'\nimport { type ScalarLayout } from './scalar_styler.ts'\n\nfunction hasBit (mask: number, bit: number): boolean { return (mask & (1 << bit)) !== 0 }\n\n// This should eventually be a presenter option, but collection styling,\n// especially key layout, must be designed first to decide whether scalar and\n// collection width limits should share an option or be configured separately.\nconst MIN_SCALAR_CONTENT_WIDTH = 40\n\n/**\n * Default scalar styling rules in application order.\n * See [Scalar styling](../../docs/scalar_styling.md) for usage details.\n *\n * @category AST\n */\nconst DEFAULT_SCALAR_STYLE_RULES = {\n applyQuoteFlowKeysOption,\n doubleQuoteForInvisibles,\n doubleQuoteWhitespaceOnly,\n applyForceQuotesOption,\n tryLongOrMultilineAsBlock,\n quoteInvalidPlain,\n fallbackToDoubleQuoted\n} as const\n\nfunction _preferredQuotedStyle (layout: ScalarLayout): ScalarStyle {\n if (layout.presenterOptions.quoteStyle === 'single' &&\n hasBit(layout.allowedStylesMask, SCALAR_STYLE.SINGLE_QUOTED)) {\n return SCALAR_STYLE.SINGLE_QUOTED\n }\n\n return SCALAR_STYLE.DOUBLE_QUOTED\n}\n\nfunction applyQuoteFlowKeysOption (layout: ScalarLayout): void {\n if (!layout.presenterOptions.quoteFlowKeys) return\n\n // quoteFlowKeys applies only to plain scalar keys in flow mappings.\n if (!layout.isKey || !layout.flowOnly || layout.style !== SCALAR_STYLE.PLAIN) return\n\n layout.style = SCALAR_STYLE.DOUBLE_QUOTED\n}\n\nfunction doubleQuoteForInvisibles (layout: ScalarLayout): void {\n if (layout.style === SCALAR_STYLE.PLAIN &&\n /[\\t\\x7F-\\xA0\\u2028\\u2029\\uFEFF\\uFFFE\\uFFFF]/.test(layout.node.value)) {\n layout.style = SCALAR_STYLE.DOUBLE_QUOTED\n }\n}\n\nfunction doubleQuoteWhitespaceOnly (layout: ScalarLayout): void {\n // Block styles normally make multiline structure easier to see, but\n // whitespace-only content turns that structure into visually empty lines,\n // so force double quotes for this special case.\n if (layout.style === SCALAR_STYLE.PLAIN && /^\\s+$/.test(layout.node.value)) {\n layout.style = SCALAR_STYLE.DOUBLE_QUOTED\n }\n}\n\nfunction applyForceQuotesOption (layout: ScalarLayout): void {\n if (!layout.presenterOptions.forceQuotes) return\n\n // forceQuotes applies only to plain values, not to mapping keys.\n if (layout.isKey || layout.style !== SCALAR_STYLE.PLAIN) return\n\n layout.style = layout.node.value.includes('\\n')\n ? SCALAR_STYLE.DOUBLE_QUOTED\n : _preferredQuotedStyle(layout)\n}\n\nfunction tryLongOrMultilineAsBlock (layout: ScalarLayout): void {\n if (layout.style !== SCALAR_STYLE.PLAIN || layout.isKey) return\n\n const value = layout.node.value\n const multiline = value.indexOf('\\n') !== -1\n\n // Literal and folded block style bits are always set together, so checking\n // either one is sufficient.\n if (!hasBit(layout.allowedStylesMask, SCALAR_STYLE.LITERAL_BLOCK)) {\n if (multiline) layout.style = SCALAR_STYLE.DOUBLE_QUOTED\n return\n }\n\n const w = layout.presenterOptions.lineWidth\n\n if (w === -1) {\n if (multiline) layout.style = SCALAR_STYLE.LITERAL_BLOCK\n return\n }\n\n const availableWidth = Math.max(\n Math.min(w, MIN_SCALAR_CONTENT_WIDTH),\n w - layout.shiftOfContent\n )\n\n let position = 0\n let shouldFold = false\n\n // Check whether at least one line exceeds the width budget\n // and can be split at a space.\n while (position <= value.length) {\n let lineEnd = value.length\n\n const nextLineBreak = value.indexOf('\\n', position)\n\n if (nextLineBreak !== -1) lineEnd = nextLineBreak\n\n const line = value.slice(position, lineEnd)\n\n if (line.length > availableWidth &&\n line[0] !== ' ' &&\n / [^ \\t]/.test(line)) {\n shouldFold = true\n }\n\n if (nextLineBreak === -1) break\n position = nextLineBreak + 1\n }\n\n if (shouldFold) {\n layout.style = SCALAR_STYLE.FOLDED_BLOCK\n } else if (multiline) {\n layout.style = SCALAR_STYLE.LITERAL_BLOCK\n }\n}\n\nfunction quoteInvalidPlain (layout: ScalarLayout): void {\n if (layout.style === SCALAR_STYLE.PLAIN &&\n !hasBit(layout.allowedStylesMask, SCALAR_STYLE.PLAIN)) {\n layout.style = _preferredQuotedStyle(layout)\n }\n}\n\nfunction fallbackToDoubleQuoted (layout: ScalarLayout): void {\n if (!hasBit(layout.allowedStylesMask, layout.style)) {\n layout.style = SCALAR_STYLE.DOUBLE_QUOTED\n }\n}\n\nexport { MIN_SCALAR_CONTENT_WIDTH, DEFAULT_SCALAR_STYLE_RULES }\n","import { SCALAR_STYLE, type ScalarStyle } from '../parser/events.ts'\nimport { type Node, type ScalarNode } from './nodes.ts'\nimport { type PresenterOptions } from './presenter.ts'\nimport { MIN_SCALAR_CONTENT_WIDTH } from './styler_defaults.ts'\n\n/** Scalar presentation state passed to styling rules. @category AST */\ninterface ScalarLayout {\n readonly node: Readonly<ScalarNode>\n readonly parent: Readonly<Node> | null\n readonly level: number\n readonly isKey: boolean\n readonly flowOnly: boolean\n readonly shiftOfParent: number\n readonly shiftOfContent: number\n readonly shiftOfFirstLine: number\n readonly presenterOptions: Readonly<Required<PresenterOptions>>\n /**\n * Bit mask of allowed styles; each bit corresponds to a {@link SCALAR_STYLE}\n * value.\n */\n allowedStylesMask: number\n /**\n * Selected output style, which styling rules may modify. To avoid overriding\n * earlier decisions, a rule should normally modify it only while it is\n * {@link SCALAR_STYLE.PLAIN}.\n */\n style: ScalarStyle\n}\n\n/** Function signature for scalar styling rules. @category AST */\ntype ScalarStyleRule = (layout: ScalarLayout) => void\n\nfunction setBit (mask: number, bit: number): number { return mask | (1 << bit) }\n\n// YAML 1.2.2 character productions.\n// https://yaml.org/spec/1.2.2/#51-character-set\nconst SRC_C_PRINTABLE = '[\\\\x09\\\\x0A\\\\x0D\\\\x20-\\\\x7E\\\\x85\\\\xA0-\\\\uD7FF\\\\uE000-\\\\uFFFD\\\\u{10000}-\\\\u{10FFFF}]'\nconst SRC_B_CHAR = '[\\\\n\\\\r]'\nconst SRC_C_BYTE_ORDER_MARK = '\\\\uFEFF'\nconst SRC_S_WHITE = '[ \\\\t]'\nconst SRC_NB_CHAR = `(?:(?!(?:${SRC_B_CHAR}|${SRC_C_BYTE_ORDER_MARK}))${SRC_C_PRINTABLE})`\nconst SRC_NS_CHAR = `(?:(?!${SRC_S_WHITE})${SRC_NB_CHAR})`\n\n// YAML 1.2.2 [2] nb-json.\nconst SRC_NB_JSON = '[\\\\x09\\\\x20-\\\\uD7FF\\\\uE000-\\\\uFFFF\\\\u{10000}-\\\\u{10FFFF}]'\n\n// YAML 1.2.2 indicator productions.\n// https://yaml.org/spec/1.2.2/#54-indicator-characters\nconst SRC_C_INDICATOR = '[-?:,\\\\[\\\\]{}#&*!|>\\'\"%@`]'\nconst SRC_C_FLOW_INDICATOR = '[,\\\\[\\\\]{}]'\n\n// YAML 1.2.2 [127]-[129] ns-plain-safe(c).\n// https://yaml.org/spec/1.2.2/#733-plain-style\nconst SRC_NS_PLAIN_SAFE_FLOW_OUT = SRC_NS_CHAR\nconst SRC_NS_PLAIN_SAFE_FLOW_IN = `(?:(?!${SRC_C_FLOW_INDICATOR})${SRC_NS_CHAR})`\n\n// YAML 1.2.2 [126] ns-plain-first(c).\nconst SRC_NS_PLAIN_FIRST_FLOW_OUT =\n `(?:(?:(?!${SRC_C_INDICATOR})${SRC_NS_CHAR})|[?:-](?=${SRC_NS_PLAIN_SAFE_FLOW_OUT}))`\nconst SRC_NS_PLAIN_FIRST_FLOW_IN =\n `(?:(?:(?!${SRC_C_INDICATOR})${SRC_NS_CHAR})|[?:-](?=${SRC_NS_PLAIN_SAFE_FLOW_IN}))`\n\n// YAML 1.2.2 [130] ns-plain-char(c).\n// The production itself requires lookbehind, so these regexps require ES2018 lookbehind support.\n// const SRC_NS_PLAIN_CHAR_FLOW_OUT =\n// `(?:(?:(?![:#])${SRC_NS_PLAIN_SAFE_FLOW_OUT})|(?<=${SRC_NS_CHAR})#|:(?=${SRC_NS_PLAIN_SAFE_FLOW_OUT}))`\n// const SRC_NS_PLAIN_CHAR_FLOW_IN =\n// `(?:(?:(?![:#])${SRC_NS_PLAIN_SAFE_FLOW_IN})|(?<=${SRC_NS_CHAR})#|:(?=${SRC_NS_PLAIN_SAFE_FLOW_IN}))`\n\n// ES2015-compatible alternative without lookbehind: consume each run of hashes\n// together with the preceding non-hash ns-plain-char.\nconst SRC_NS_PLAIN_CHAR_FLOW_OUT =\n `(?:(?:(?![:#])${SRC_NS_PLAIN_SAFE_FLOW_OUT})|:(?=${SRC_NS_PLAIN_SAFE_FLOW_OUT}))#*`\nconst SRC_NS_PLAIN_CHAR_FLOW_IN =\n `(?:(?:(?![:#])${SRC_NS_PLAIN_SAFE_FLOW_IN})|:(?=${SRC_NS_PLAIN_SAFE_FLOW_IN}))#*`\n\n// YAML 1.2.2 [132] nb-ns-plain-in-line(c).\nconst SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT = `(?:${SRC_S_WHITE}*${SRC_NS_PLAIN_CHAR_FLOW_OUT})*`\nconst SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN = `(?:${SRC_S_WHITE}*${SRC_NS_PLAIN_CHAR_FLOW_IN})*`\n\n// YAML 1.2.2 [133] ns-plain-one-line(c).\nconst SRC_NS_PLAIN_ONE_LINE_FLOW_OUT =\n `${SRC_NS_PLAIN_FIRST_FLOW_OUT}#*${SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT}`\nconst SRC_NS_PLAIN_ONE_LINE_FLOW_IN =\n `${SRC_NS_PLAIN_FIRST_FLOW_IN}#*${SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN}`\nconst SRC_NS_PLAIN_ONE_LINE_BLOCK_KEY = SRC_NS_PLAIN_ONE_LINE_FLOW_OUT\nconst SRC_NS_PLAIN_ONE_LINE_FLOW_KEY = SRC_NS_PLAIN_ONE_LINE_FLOW_IN\n\n// YAML 1.2.2 [134] s-ns-plain-next-line(n,c).\n// ScalarNode.value contains the folded value, not the source text: one source\n// line break became a space, while k > 1 breaks became k - 1 LF characters.\n// The space case is already accepted by [132]; each remaining run of LFs\n// therefore represents a transition to the next non-empty content line in [134].\nconst SRC_S_NS_PLAIN_NEXT_LINE_FLOW_OUT =\n `\\\\n+${SRC_NS_PLAIN_CHAR_FLOW_OUT}${SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT}`\nconst SRC_S_NS_PLAIN_NEXT_LINE_FLOW_IN =\n `\\\\n+${SRC_NS_PLAIN_CHAR_FLOW_IN}${SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN}`\n\n// YAML 1.2.2 [135] ns-plain-multi-line(n,c).\nconst SRC_NS_PLAIN_MULTI_LINE_FLOW_OUT =\n `${SRC_NS_PLAIN_ONE_LINE_FLOW_OUT}(?:${SRC_S_NS_PLAIN_NEXT_LINE_FLOW_OUT})*`\nconst SRC_NS_PLAIN_MULTI_LINE_FLOW_IN =\n `${SRC_NS_PLAIN_ONE_LINE_FLOW_IN}(?:${SRC_S_NS_PLAIN_NEXT_LINE_FLOW_IN})*`\n\n// YAML 1.2.2 [131] ns-plain(n,c).\nconst NS_PLAIN_FLOW_OUT = new RegExp(`^(?:${SRC_NS_PLAIN_MULTI_LINE_FLOW_OUT})$`, 'u')\nconst NS_PLAIN_FLOW_IN = new RegExp(`^(?:${SRC_NS_PLAIN_MULTI_LINE_FLOW_IN})$`, 'u')\nconst NS_PLAIN_BLOCK_KEY = new RegExp(`^(?:${SRC_NS_PLAIN_ONE_LINE_BLOCK_KEY})$`, 'u')\nconst NS_PLAIN_FLOW_KEY = new RegExp(`^(?:${SRC_NS_PLAIN_ONE_LINE_FLOW_KEY})$`, 'u')\n\n// YAML 1.2.2 [118]-[125], projected to ScalarNode.value: doubled quotes\n// are already decoded, and flow folding represents content line feeds as LF.\nconst NB_SINGLE_ONE_LINE = new RegExp(`^(?:${SRC_NB_JSON})*$`, 'u')\nconst NB_SINGLE_MULTI_LINE = new RegExp(`^(?:${SRC_NB_JSON}|\\\\n)*$`, 'u')\n\n// YAML 1.2.2 [170]-[182], projected to ScalarNode.value: source line breaks\n// are normalized to LF; every other content character must be nb-char.\nconst BLOCK_SCALAR_CONTENT = new RegExp(`^(?:${SRC_NB_CHAR}|\\\\n)*$`, 'u')\n\n// YAML 1.2.2 [206] c-forbidden.\n// https://yaml.org/spec/1.2.2/#912-document-markers\nconst C_FORBIDDEN_FIRST_LINE = /^(?:---|\\.\\.\\.)(?=$|[ \\t\\n\\r])/\nconst C_FORBIDDEN_CONTENT = /^(?:---|\\.\\.\\.)(?=$|[ \\t\\n\\r])/m\n\nfunction canUsePlain (layout: ScalarLayout): boolean {\n const str = layout.node.value\n\n // Allow null to be rendered as an empty scalar; its tag is checked below.\n if (str !== '') {\n const nsPlain = layout.isKey\n ? (layout.flowOnly ? NS_PLAIN_FLOW_KEY : NS_PLAIN_BLOCK_KEY)\n : (layout.flowOnly ? NS_PLAIN_FLOW_IN : NS_PLAIN_FLOW_OUT)\n\n if (!nsPlain.test(str)) return false\n if (layout.shiftOfFirstLine === 0 && C_FORBIDDEN_FIRST_LINE.test(str)) return false\n\n if (layout.shiftOfContent === 0) {\n const firstLineBreak = str.indexOf('\\n')\n\n if (firstLineBreak !== -1) {\n const content = str.slice(firstLineBreak + 1)\n\n if (C_FORBIDDEN_CONTENT.test(content)) return false\n }\n }\n }\n\n // Outside the plain-syntax BNF: preserve the node tag under implicit resolution.\n const resolvedTag = layout.presenterOptions.schema.resolveImplicitScalarTag(str).tag.tagName\n\n if (!layout.node.tagged && resolvedTag !== layout.node.tag) return false\n\n // Outside YAML 1.2.2: preserve YAML 1.1 !!value semantics.\n // https://yaml.org/type/value.html\n if (!layout.node.tagged && str === '=' &&\n resolvedTag === layout.presenterOptions.schema.defaultScalarTag.tagName) return false\n\n return true\n}\n\nfunction canUseSingleQuoted (layout: ScalarLayout): boolean {\n const str = layout.node.value\n const nbSingleText = layout.isKey ? NB_SINGLE_ONE_LINE : NB_SINGLE_MULTI_LINE\n\n if (!nbSingleText.test(str)) return false\n\n // [123]-[125] exclude trailing and leading s-white around a folded break;\n // single-quoted style has no escape that could preserve it.\n if (/[ \\t]\\n|\\n[ \\t]/.test(str)) return false\n\n // A decoded LF is rendered through flow folding. At zero continuation\n // indentation, c-forbidden would terminate the quoted scalar.\n if (!layout.isKey && layout.shiftOfContent === 0) {\n const firstLineBreak = str.indexOf('\\n')\n\n if (firstLineBreak !== -1 &&\n C_FORBIDDEN_CONTENT.test(str.slice(firstLineBreak + 1))) return false\n }\n\n return true\n}\n\nfunction canUseBlock (layout: ScalarLayout): boolean {\n if (layout.flowOnly || !BLOCK_SCALAR_CONTENT.test(layout.node.value)) return false\n\n const contentIndent = layout.shiftOfContent - layout.shiftOfParent\n\n if (contentIndent < 1) return false\n\n // A leading space requires [163] c-indentation-indicator. Its value is 1-9.\n if (contentIndent > 9 && /^\\n* /.test(layout.node.value)) return false\n\n // Block content starts on its own line, so every zero-indented content line\n // is subject to [206] c-forbidden.\n if (layout.shiftOfContent === 0 && C_FORBIDDEN_CONTENT.test(layout.node.value)) return false\n\n return true\n}\n\nfunction detectAllowedStyles (layout: ScalarLayout): void {\n // [107] Double-quoted style can express arbitrary strings through escape sequences.\n let mask = setBit(0, SCALAR_STYLE.DOUBLE_QUOTED)\n\n if (canUsePlain(layout)) mask = setBit(mask, SCALAR_STYLE.PLAIN)\n if (canUseSingleQuoted(layout)) mask = setBit(mask, SCALAR_STYLE.SINGLE_QUOTED)\n\n if (canUseBlock(layout)) {\n mask = setBit(setBit(mask, SCALAR_STYLE.LITERAL_BLOCK), SCALAR_STYLE.FOLDED_BLOCK)\n }\n\n layout.allowedStylesMask = mask\n}\n\nfunction renderScalar (layout: ScalarLayout): string {\n switch (layout.style) {\n case SCALAR_STYLE.PLAIN:\n return renderPlain(layout)\n case SCALAR_STYLE.SINGLE_QUOTED:\n return renderSingleQuoted(layout)\n case SCALAR_STYLE.LITERAL_BLOCK:\n return renderLiteralBlock(layout)\n case SCALAR_STYLE.FOLDED_BLOCK:\n return renderFoldedBlock(layout)\n case SCALAR_STYLE.DOUBLE_QUOTED:\n return renderDoubleQuoted(layout)\n }\n}\n\nfunction renderPlain (layout: ScalarLayout): string {\n return encodeFlowBreaks(layout.node.value, layout.shiftOfContent)\n}\n\nfunction renderSingleQuoted (layout: ScalarLayout): string {\n const value = encodeFlowBreaks(layout.node.value, layout.shiftOfContent)\n return `'${value.replace(/'/g, \"''\")}'`\n}\n\nfunction renderLiteralBlock (layout: ScalarLayout): string {\n const value = layout.node.value\n\n return '|' + blockHeader(value, layout.shiftOfParent, layout.shiftOfContent) +\n dropEndingNewline(indentString(value, layout.shiftOfContent))\n}\n\nfunction renderFoldedBlock (layout: ScalarLayout): string {\n const value = layout.node.value\n const w = layout.presenterOptions.lineWidth\n let availableWidth = Infinity\n\n if (w !== -1) {\n availableWidth = Math.max(\n Math.min(w, MIN_SCALAR_CONTENT_WIDTH),\n w - layout.shiftOfContent\n )\n }\n\n return '>' + blockHeader(value, layout.shiftOfParent, layout.shiftOfContent) +\n dropEndingNewline(indentString(\n foldBlockScalar(value, availableWidth),\n layout.shiftOfContent\n ))\n}\n\nfunction renderDoubleQuoted (layout: ScalarLayout): string {\n return `\"${escapeString(layout.node.value)}\"`\n}\n\n// Flow scalars fold line breaks: a run of k source line breaks reparses to k-1\n// literal LF characters. Encode each run of p literal LF characters as p+1\n// breaks and indent the following content line.\nfunction encodeFlowBreaks (string: string, shiftOfContent: number): string {\n let nextLF = string.indexOf('\\n')\n if (nextLF === -1) return string\n\n const pad = ' '.repeat(shiftOfContent)\n let result = string.slice(0, nextLF)\n\n const lineRe = /(\\n+)([^\\n]*)/g\n lineRe.lastIndex = nextLF\n let match\n\n while ((match = lineRe.exec(string))) {\n const breaks = match[1].length\n const line = match[2]\n result += '\\n'.repeat(breaks + 1) + pad + line\n }\n\n return result\n}\n\n// Indents every line in a string. Empty lines (\\n only) are not indented.\nfunction indentString (string: string, spaces: number): string {\n const indent = ' '.repeat(spaces)\n let position = 0\n let result = ''\n const length = string.length\n\n while (position < length) {\n let line\n const next = string.indexOf('\\n', position)\n\n if (next === -1) {\n line = string.slice(position)\n position = length\n } else {\n line = string.slice(position, next + 1)\n position = next + 1\n }\n\n if (line.length && line !== '\\n') result += indent\n\n result += line\n }\n\n return result\n}\n\nfunction needIndentIndicator (string: string): boolean {\n return /^\\n* /.test(string)\n}\n\nfunction blockHeader (string: string, shiftOfParent: number, shiftOfContent: number): string {\n const indentIndicator = needIndentIndicator(string)\n ? String(shiftOfContent - shiftOfParent)\n : ''\n\n // The string '\\n' counts as a trailing empty line.\n const clip = string[string.length - 1] === '\\n'\n const keep = clip && (string[string.length - 2] === '\\n' || string === '\\n')\n const chomp = keep ? '+' : (clip ? '' : '-')\n\n return `${indentIndicator}${chomp}\\n`\n}\n\n// The presenter adds its own trailing newline.\nfunction dropEndingNewline (string: string): string {\n return string[string.length - 1] === '\\n' ? string.slice(0, -1) : string\n}\n\nfunction isMoreIndented (char: string): boolean {\n return char === ' ' || char === '\\t'\n}\n\nfunction foldLine (line: string, width: number): string {\n if (line === '' || isMoreIndented(line[0])) return line\n\n const breakRe = / [^ \\t]/g\n let match\n let start = 0\n let end\n let curr = 0\n let next = 0\n let result = ''\n\n while ((match = breakRe.exec(line))) {\n next = match.index\n\n if (next - start > width) {\n end = (curr > start) ? curr : next\n result += `\\n${line.slice(start, end)}`\n start = end + 1\n }\n\n curr = next\n }\n\n result += '\\n'\n\n if (line.length - start > width && curr > start) {\n result += `${line.slice(start, curr)}\\n${line.slice(curr + 1)}`\n } else {\n result += line.slice(start)\n }\n\n return result.slice(1)\n}\n\nfunction foldBlockScalar (string: string, width: number): string {\n const lineRe = /(\\n+)([^\\n]*)/g\n\n let nextLF = string.indexOf('\\n')\n if (nextLF === -1) nextLF = string.length\n lineRe.lastIndex = nextLF\n\n let result = foldLine(string.slice(0, nextLF), width)\n let prevMoreIndented = string[0] === '\\n' || isMoreIndented(string[0])\n let moreIndented\n let match\n\n while ((match = lineRe.exec(string))) {\n const prefix = match[1]\n const line = match[2]\n\n moreIndented = line !== '' && isMoreIndented(line[0])\n result += prefix +\n ((!prevMoreIndented && !moreIndented && line !== '') ? '\\n' : '') +\n foldLine(line, width)\n prevMoreIndented = moreIndented\n }\n\n return result\n}\n\n// Characters escaped in Double-Quoted Style:\n//\n// - the inverse of YAML 1.2.2 [1] c-printable;\n// - TAB, LF and CR, which c-printable includes;\n// - NEL, NBSP, LS, PS and BOM, which are escaped to make invisible content\n// visible;\n// - double quote and backslash, which must be escaped because they have\n// syntactic meaning.\n//\n// In Unicode mode, the surrogate range matches unpaired surrogates but does not\n// match either code unit of a valid surrogate pair.\n// https://yaml.org/spec/1.2.2/#rule-c-printable\nconst CHARACTERS_TO_ESCAPE =\n /[\"\\\\\\x00-\\x1F\\x7F-\\xA0\\u2028\\u2029\\uD800-\\uDFFF\\uFEFF\\uFFFE\\uFFFF]/gu\n\nfunction escapeCharacter (character: string): string {\n switch (character) {\n case '\\x00': return '\\\\0'\n case '\\x07': return '\\\\a'\n case '\\x08': return '\\\\b'\n case '\\x09': return '\\\\t'\n case '\\x0A': return '\\\\n'\n case '\\x0B': return '\\\\v'\n case '\\x0C': return '\\\\f'\n case '\\x0D': return '\\\\r'\n case '\\x1B': return '\\\\e'\n case '\"': return '\\\\\"'\n case '\\\\': return '\\\\\\\\'\n case '\\x85': return '\\\\N'\n case '\\xA0': return '\\\\_'\n case '\\u2028': return '\\\\L'\n case '\\u2029': return '\\\\P'\n }\n\n const code = character.charCodeAt(0)\n const hex = code.toString(16).toUpperCase()\n\n if (code <= 0xFF) return `\\\\x${'0'.repeat(2 - hex.length)}${hex}`\n\n return `\\\\u${'0'.repeat(4 - hex.length)}${hex}`\n}\n\nfunction escapeString (string: string): string {\n return string.replace(CHARACTERS_TO_ESCAPE, escapeCharacter)\n}\n\nexport {\n detectAllowedStyles,\n renderScalar,\n type ScalarLayout,\n type ScalarStyleRule\n}\n","// AST → text. Walks the node `kind`; the scalar machinery (style selection,\n// quoting, folding) is driven by node text, not by sniffing a JS value.\n\nimport { YAMLException } from '../common/exception.ts'\nimport { tagNameShort } from '../common/tagname.ts'\nimport { COLLECTION_STYLE, SCALAR_STYLE } from '../parser/events.ts'\nimport { type Schema } from '../schema.ts'\nimport {\n type Node,\n type Document,\n type ScalarNode,\n type SequenceNode,\n type MappingNode\n} from './nodes.ts'\nimport {\n detectAllowedStyles,\n renderScalar,\n type ScalarLayout,\n type ScalarStyleRule\n} from './scalar_styler.ts'\nimport { DEFAULT_SCALAR_STYLE_RULES } from './styler_defaults.ts'\n\nconst CHAR_LINE_FEED = 0x0A /* LF */\n\n/** @category AST */\ninterface PresenterOptions {\n /** Schema used when selecting a safe scalar style. */\n schema: Schema\n\n /**\n * Indentation width in spaces.\n *\n * @defaultValue `2`\n */\n indent?: number\n\n /**\n * Does not add an indentation level to array elements when enabled.\n *\n * @defaultValue `false`\n */\n seqNoIndent?: boolean\n\n /**\n * Allows a nested collection to start on the same line after `-`.\n *\n * @defaultValue `true`\n */\n seqInlineFirst?: boolean\n\n /**\n * Preferred line width for folding. Unbreakable and more-indented lines may\n * exceed it. Set to `-1` for unlimited width.\n *\n * @defaultValue `80`\n */\n lineWidth?: number\n\n /**\n * Adds spaces inside flow collection brackets: `{a: 1}` becomes `{ a: 1 }`.\n *\n * @defaultValue `false`\n */\n flowBracketPadding?: boolean\n\n /**\n * Omits the space after commas in flow collections: `[1, 2]` becomes\n * `[1,2]`.\n *\n * @defaultValue `false`\n */\n flowSkipCommaSpace?: boolean\n\n /**\n * Omits the space after `:` in flow mappings: `{\"a\": 1}` becomes `{\"a\":1}`.\n *\n * This forces `quoteFlowKeys`; otherwise `a:1` would be parsed as a single\n * plain scalar instead of a mapping entry.\n *\n * @defaultValue `false`\n */\n flowSkipColonSpace?: boolean\n\n /**\n * Quotes flow mapping keys: `{a: 1}` becomes `{\"a\": 1}`.\n *\n * @defaultValue `false`\n */\n quoteFlowKeys?: boolean\n\n /**\n * Quoting style to use when a string needs quotes.\n *\n * @defaultValue `'single'`\n */\n quoteStyle?: 'single' | 'double'\n\n /**\n * Quotes all non-key strings using {@link quoteStyle}.\n *\n * @defaultValue `false`\n */\n forceQuotes?: boolean\n\n /**\n * Customizes how strings are rendered as plain, quoted, literal, or folded\n * scalars. Rules are applied in array order; providing this option replaces\n * the {@link DEFAULT_SCALAR_STYLE_RULES default rules}.\n *\n * @defaultValue `Object.values(DEFAULT_SCALAR_STYLE_RULES)`\n */\n scalarStyleRules?: readonly ScalarStyleRule[]\n\n /**\n * Prints an explicit tag before an anchor: `&ref_0 !!set` becomes\n * `!!set &ref_0`.\n *\n * @defaultValue `false`\n */\n tagBeforeAnchor?: boolean\n}\n\nconst DEFAULT_PRESENTER_OPTIONS: Required<Omit<PresenterOptions, 'schema'>> = {\n indent: 2,\n seqNoIndent: false,\n seqInlineFirst: true,\n lineWidth: 80,\n flowBracketPadding: false,\n flowSkipCommaSpace: false,\n flowSkipColonSpace: false,\n quoteFlowKeys: false,\n quoteStyle: 'single',\n forceQuotes: false,\n scalarStyleRules: Object.keys(DEFAULT_SCALAR_STYLE_RULES)\n .map(name => Reflect.get(DEFAULT_SCALAR_STYLE_RULES, name)),\n tagBeforeAnchor: false\n}\n\ninterface PresenterState extends Required<PresenterOptions> {\n defaultScalarTagName: string\n openEnded: boolean\n}\n\nfunction nodeTagShort (node: ScalarNode | SequenceNode | MappingNode) {\n return node.tagged ? node.tag : tagNameShort(node.tag)\n}\n\nfunction createPresenterState (options: PresenterOptions): PresenterState {\n const opts = {\n ...DEFAULT_PRESENTER_OPTIONS,\n ...options\n }\n\n if (opts.flowSkipColonSpace) {\n opts.quoteFlowKeys = true\n }\n\n return {\n ...opts,\n defaultScalarTagName: opts.schema.defaultScalarTag.tagName,\n openEnded: false\n }\n}\n\nfunction generateNextLine (state: PresenterState, level: number) {\n return `\\n${' '.repeat(state.indent * level)}`\n}\n\nfunction scalarLayout (state: PresenterState, node: ScalarNode, parent: Readonly<Node> | null, level: number,\n isKey: boolean, flowOnly: boolean): ScalarLayout {\n const shiftOfParent = level === 0 ? -1 : state.indent * (level - 1)\n const shiftOfContent = state.indent * Math.max(1, level)\n\n return {\n node,\n parent,\n level,\n isKey,\n flowOnly,\n shiftOfParent,\n shiftOfContent,\n shiftOfFirstLine: level === 0 ? 0 : state.indent * level,\n presenterOptions: state,\n allowedStylesMask: 0,\n style: node.style\n }\n}\n\nfunction writeFlowSequence (state: PresenterState, level: number, node: SequenceNode) {\n let result = ''\n\n for (let index = 0, length = node.items.length; index < length; index += 1) {\n const item = writeNode(state, level, node.items[index], node, {}).text\n if (index > 0) result += `,${!state.flowSkipCommaSpace ? ' ' : ''}`\n result += item\n }\n\n const pad = state.flowBracketPadding && node.items.length > 0 ? ' ' : ''\n return `[${pad}${result}${pad}]`\n}\n\nfunction writeBlockSequence (state: PresenterState, level: number, node: SequenceNode, compact: boolean) {\n let result = ''\n\n for (let index = 0, length = node.items.length; index < length; index += 1) {\n const item = writeNode(state, level + 1, node.items[index], node,\n { block: true, compact: state.seqInlineFirst, isblockseq: true }).text\n\n if (!compact || result !== '') {\n result += generateNextLine(state, level)\n }\n\n // No trailing space when the value renders empty (e.g. null → '').\n if (item === '' || CHAR_LINE_FEED === item.charCodeAt(0)) {\n result += '-'\n } else {\n result += '- '\n }\n\n result += item\n }\n\n return result\n}\n\nfunction writeFlowMapping (state: PresenterState, level: number, node: MappingNode) {\n let result = ''\n\n for (const { key, value } of node.items) {\n let pairBuffer = ''\n if (result !== '') pairBuffer += `,${!state.flowSkipCommaSpace ? ' ' : ''}`\n\n const keyRender = writeNode(state, level, key, node, { iskey: true })\n const keyText = keyRender.text\n\n const valueText = writeNode(state, level, value, node, {}).text\n // No separating space when the value renders empty (e.g. null → '').\n const sep = state.flowSkipColonSpace || valueText === '' ? '' : ' '\n\n // An alias or a property-only scalar must be separated from `:` because the\n // colon can otherwise be consumed as part of the alias/anchor/tag name.\n const keyIsBareProps = key.kind === 'scalar' && keyRender.noBody &&\n (key.tagged || key.anchor !== undefined)\n const keyColonSep = key.kind === 'alias' || keyIsBareProps ? ' ' : ''\n\n pairBuffer += `${keyText}${keyColonSep}:${sep}${valueText}`\n\n result += pairBuffer\n }\n\n const pad = state.flowBracketPadding && result !== '' ? ' ' : ''\n return `{${pad}${result}${pad}}`\n}\n\nfunction writeBlockMapping (state: PresenterState, level: number, node: MappingNode, compact: boolean) {\n let result = ''\n\n for (let index = 0, length = node.items.length; index < length; index += 1) {\n let pairBuffer = ''\n\n if (!compact || result !== '') {\n pairBuffer += generateNextLine(state, level)\n }\n\n const { key, value } = node.items[index]\n\n // A block key — a block collection (mapping/sequence) or a block scalar\n // (literal/folded) — can't sit on a `key:` line, so it's written with block\n // context and the pair takes the explicit `? key / : value` form. A simple\n // scalar key stays inline (flow-vs-block is invisible there).\n const keyIsBlock =\n ((key.kind === 'mapping' || key.kind === 'sequence') &&\n key.style === COLLECTION_STYLE.BLOCK && key.items.length !== 0) ||\n (key.kind === 'scalar' &&\n (key.style === SCALAR_STYLE.LITERAL_BLOCK || key.style === SCALAR_STYLE.FOLDED_BLOCK))\n\n // The `?`/`:` indicators shift content right like a `-`, so a block key or\n // value that stays on the indicator line keeps its indentation under\n // seqNoIndent (`isblockseq`). One that drops to its own line (tag/anchor)\n // collapses to the parent indent, so leave the flag off there.\n const keyRender = keyIsBlock\n ? writeNode(state, level + 1, key, node,\n { block: true, compact: true, isblockseq: !cannotBeCompact(state, key, level + 1) })\n : writeNode(state, level + 1, key, node, { block: true, compact: true, iskey: true })\n const keyText = keyRender.text\n\n // Block key, over-long key, or multiline scalar key forces explicit form.\n // Multiline isn't a spec requirement — just matches pyyaml's simple-key rule.\n const keyHasLineBreak = key.kind === 'scalar' && key.value.indexOf('\\n') !== -1\n\n // YAML limits an implicit key to 1024 Unicode code points. `length` counts\n // UTF-16 code units, never fewer than code points, so it is a cheap safe\n // precheck. The `u` regexp then counts each [\\s\\S] match as one code point.\n const keyIsTooLong = keyText.length > 1024 && /^[\\s\\S]{1025}/u.test(keyText)\n const explicitPair = keyIsBlock || keyHasLineBreak || keyIsTooLong\n\n if (explicitPair) {\n if (keyText && CHAR_LINE_FEED === keyText.charCodeAt(0)) {\n pairBuffer += '?'\n } else {\n pairBuffer += '? '\n }\n }\n\n pairBuffer += keyText\n\n if (explicitPair) {\n pairBuffer += generateNextLine(state, level)\n }\n\n const valueText = writeNode(state, level + 1, value, node,\n { block: true, compact: explicitPair, isblockseq: explicitPair && !cannotBeCompact(state, value, level + 1) }).text\n\n // Keep a space before the colon when the key text ends in a leading\n // property rather than scalar content, so the colon can't be read as part\n // of it. Two cases: an inline alias key (`*b : v`), and an empty scalar key\n // whose whole text is its anchor/tag (`&a :`, `!!str :`) — without the\n // space `&a:` reparses as an anchored value, dropping the null key.\n const keyIsBareProps = key.kind === 'scalar' && keyRender.noBody &&\n (key.tagged || key.anchor !== undefined)\n const keyColonSep = !explicitPair && (key.kind === 'alias' || keyIsBareProps) ? ' ' : ''\n\n // No trailing space when the value renders empty (e.g. null → '').\n if (valueText === '' || CHAR_LINE_FEED === valueText.charCodeAt(0)) {\n pairBuffer += `${keyColonSep}:`\n } else {\n pairBuffer += `${keyColonSep}: `\n }\n\n pairBuffer += valueText\n\n result += pairBuffer\n }\n\n return result\n}\n\n// Where a node sits relative to its parent — drives layout/style decisions.\n// All flags default to false (the flow-context, non-key, non-compact case).\ninterface NodeContext {\n block?: boolean // block context (vs flow); propagates downward\n compact?: boolean // may start on the current line (no leading newline)\n iskey?: boolean // node is a mapping key\n isblockseq?: boolean // content follows an indicator (`-`, or `?`/`:` in an\n // explicit pair) that already shifted it right; keeps\n // its indentation under seqNoIndent\n}\n\ninterface NodeRender {\n text: string\n noBody: boolean\n}\n\n// A node can't sit compact on its parent's indicator (`-`/`?`/`:`) line when it\n// carries leading props (tag/anchor) that would collide with the indicator, or\n// when the indent step is too narrow for the 2-char indicator. Such a node drops\n// to its own line; a block collection that does so also collapses its seqNoIndent\n// indentation back to the parent.\nfunction cannotBeCompact (state: PresenterState, node: Node, level: number) {\n if (node.kind === 'alias') return true\n return node.tagged || node.anchor !== undefined || (state.indent < 2 && level > 0)\n}\n\nfunction writeNode (state: PresenterState, level: number, node: Node,\n parent: Readonly<Node> | null, ctx: NodeContext): NodeRender {\n if (node.kind === 'alias') {\n state.openEnded = false\n return { text: `*${node.anchor}`, noBody: false }\n }\n\n const { block = false, iskey = false, isblockseq = false } = ctx\n let compact = ctx.compact ?? false\n\n const hasAnchor = node.anchor !== undefined\n\n if (cannotBeCompact(state, node, level)) {\n compact = false\n }\n\n let body: string\n let shouldPrintTag = node.tagged\n const useBlockCollection = block &&\n (node.kind === 'mapping' || node.kind === 'sequence') &&\n node.style === COLLECTION_STYLE.BLOCK && node.items.length !== 0\n\n if (node.kind === 'mapping') {\n if (useBlockCollection) {\n body = writeBlockMapping(state, level, node, compact)\n } else {\n body = writeFlowMapping(state, level, node)\n }\n } else if (node.kind === 'sequence') {\n if (useBlockCollection) {\n if (state.seqNoIndent && !isblockseq && level > 0) {\n body = writeBlockSequence(state, level - 1, node, compact)\n } else {\n body = writeBlockSequence(state, level, node, compact)\n }\n } else {\n body = writeFlowSequence(state, level, node)\n }\n } else {\n const layout = scalarLayout(state, node, parent, level, iskey, !block)\n\n detectAllowedStyles(layout)\n for (const rule of state.scalarStyleRules) rule(layout)\n\n body = renderScalar(layout)\n state.openEnded =\n (layout.style === SCALAR_STYLE.LITERAL_BLOCK || layout.style === SCALAR_STYLE.FOLDED_BLOCK) &&\n (node.value === '\\n' || node.value.endsWith('\\n\\n'))\n\n // A flow sequence entry cannot be completely empty. Print the semantic tag\n // as the node property that explicitly indicates the entry's existence.\n shouldPrintTag = node.tagged ||\n (body === '' && layout.flowOnly && parent?.kind === 'sequence' && !hasAnchor) ||\n (layout.style !== SCALAR_STYLE.PLAIN && node.tag !== state.defaultScalarTagName)\n }\n\n // A flow collection ends with its closing indicator, not with its last child.\n if ((node.kind === 'mapping' || node.kind === 'sequence') && !useBlockCollection) {\n state.openEnded = false\n }\n\n // An indicator plus its mandatory separator occupies 2 columns. For wider\n // indentation, pad a compact block collection so its first item starts at\n // the same column as the following items.\n if (useBlockCollection && compact && level > 0 && state.indent > 2) {\n body = `${' '.repeat(state.indent - 2)}${body}`\n }\n\n const noBody = body === ''\n let text = body\n\n if (shouldPrintTag || hasAnchor) {\n const props: string[] = []\n const tag = shouldPrintTag ? nodeTagShort(node) : null\n const anchor = hasAnchor ? `&${node.anchor}` : null\n\n if (state.tagBeforeAnchor) {\n if (tag !== null) props.push(tag)\n if (anchor !== null) props.push(anchor)\n } else {\n if (anchor !== null) props.push(anchor)\n if (tag !== null) props.push(tag)\n }\n\n // No separator when the body is empty (e.g. `&anchor` on a null node) or\n // already starts on its own line.\n const sep = body === '' || body.charCodeAt(0) === CHAR_LINE_FEED ? '' : ' '\n text = `${props.join(' ')}${sep}${body}`\n }\n\n return { text, noBody }\n}\n\n// A bare (untagged, unanchored) non-empty block collection: writeNode renders it\n// in compact form with its first item on the opening line. That works mid-stream,\n// but right after a `---` the first item must drop to the next line. A tag/anchor\n// already forces the body onto its own line, so those stay on the `---` line.\nfunction rootStartsOwnLine (node: Node) {\n return (node.kind === 'sequence' || node.kind === 'mapping') &&\n node.style === COLLECTION_STYLE.BLOCK &&\n node.items.length !== 0 &&\n !node.tagged &&\n node.anchor === undefined\n}\n\nfunction writeDocumentDirectives (doc: Document) {\n let result = ''\n\n for (const directive of doc.directives) {\n if (directive.kind === 'yaml') {\n result += `%YAML ${directive.version}\\n`\n continue\n }\n\n const { handle, prefix } = directive\n result += `%TAG ${handle} ${prefix}\\n`\n }\n\n return result\n}\n\n/**\n * Build YAML from AST.\n *\n * @category AST\n */\nfunction present (documents: Document[], options: PresenterOptions): string {\n const state = createPresenterState(options)\n let result = ''\n let previousEnded = false\n\n for (let index = 0; index < documents.length; index += 1) {\n const doc = documents[index]\n state.openEnded = false\n const directives = writeDocumentDirectives(doc)\n const hasDirectives = directives !== ''\n const marker = doc.explicitStart || hasDirectives || (index > 0 && !previousEnded)\n\n result += directives\n\n if (doc.contents === null) {\n if (marker) result += '---\\n'\n } else if (marker) {\n const body = writeNode(state, 0, doc.contents, null, { block: true, compact: true }).text\n // Content shares the `---` line, except: an empty render (no separator at\n // all), a bare block collection (wraps to the next line), or directives\n // forcing `---` onto its own line.\n const sep = body === '' ? '' : (hasDirectives || rootStartsOwnLine(doc.contents) ? '\\n' : ' ')\n result += `---${sep}${body}\\n`\n } else {\n result += writeNode(state, 0, doc.contents, null, { block: true, compact: true }).text + '\\n'\n }\n\n previousEnded = doc.explicitEnd || state.openEnded\n if (previousEnded) {\n result += '...\\n'\n }\n }\n\n return result\n}\n\nexport {\n DEFAULT_PRESENTER_OPTIONS,\n present,\n type PresenterOptions\n}\n","import { DUMP_SCHEMA, type Schema } from './schema.ts'\nimport { COLLECTION_STYLE } from './parser/events.ts'\nimport { jsToAst } from './ast/from_js.ts'\nimport { visit, VISIT_SKIP } from './ast/visit.ts'\nimport { type Document } from './ast/nodes.ts'\nimport {\n DEFAULT_PRESENTER_OPTIONS,\n present,\n type PresenterOptions\n} from './ast/presenter.ts'\nimport { pick } from './common/object.ts'\n\n/** @category Main */\ninterface DumpOptions extends Omit<PresenterOptions, 'schema'> {\n /**\n * Schema to use.\n *\n * @defaultValue {@link DUMP_SCHEMA}\n */\n schema?: Schema\n\n /**\n * Skips invalid types instead of throwing. Invalid mapping pairs and sequence\n * items are skipped; `undefined` sequence items are serialized as `null`.\n *\n * @defaultValue `false`\n */\n skipInvalid?: boolean\n\n /**\n * Inlines duplicate objects instead of converting them into references.\n *\n * @defaultValue `false`\n */\n noRefs?: boolean\n\n /**\n * Nesting level at which collections switch from block to flow style. Set to\n * `-1` to never switch automatically.\n *\n * @defaultValue `-1`\n */\n flowLevel?: number\n\n /**\n * Sorts mapping keys when `true`. A function can be provided to define the\n * sort order.\n *\n * @defaultValue `false`\n * @deprecated Use {@link transform} to reorder mapping items.\n */\n sortKeys?: boolean | ((a: any, b: any) => number)\n\n /**\n * Mutates the generated AST before it is rendered.\n *\n * @example Sort mapping keys:\n *\n * ```typescript\n * import { dump, visit } from 'js-yaml'\n *\n * dump(value, {\n * transform: documents => visit(documents, node => {\n * if (node.kind === 'mapping') node.items.sort((a, b) => {\n * const x = a.key.kind === 'scalar' ? a.key.value : ''\n * const y = b.key.kind === 'scalar' ? b.key.value : ''\n * return x.localeCompare(y)\n * })\n * })\n * })\n * ```\n */\n transform?: (documents: Document[]) => void\n}\n\nconst DEFAULT_DUMP_OPTIONS: Required<DumpOptions> = {\n ...DEFAULT_PRESENTER_OPTIONS,\n schema: DUMP_SCHEMA,\n skipInvalid: false,\n noRefs: false,\n flowLevel: -1,\n sortKeys: false,\n transform: () => {}\n}\n\nfunction defaultCompareFn (a: any, b: any) {\n const x = String(a)\n const y = String(b)\n\n if (x < y) return -1\n if (x > y) return 1\n return 0\n}\n\n/**\n * Serializes JS object as a YAML document. By default it can dump every\n * supported YAML type, so it throws an exception if you try to dump regexps or\n * functions. However, you can disable exceptions by setting the\n * {@link DumpOptions.skipInvalid} option to `true`.\n *\n * @category Main\n */\nfunction dump (input: any, options: DumpOptions = {}) {\n const opts = { ...DEFAULT_DUMP_OPTIONS, ...options }\n\n const documents = jsToAst(input, opts.schema, {\n noRefs: opts.noRefs,\n skipInvalid: opts.skipInvalid\n })\n\n // flowLevel: every node at this depth switches to flow; the presenter forces\n // everything below into flow too, so the walk stops there.\n if (opts.flowLevel >= 0) {\n visit(documents, (node, ctx) => {\n if (ctx.depth < opts.flowLevel) return\n if (node.kind === 'sequence' || node.kind === 'mapping') {\n node.style = COLLECTION_STYLE.FLOW\n }\n return VISIT_SKIP\n })\n }\n\n if (opts.sortKeys) {\n const compareFn = opts.sortKeys === true ? defaultCompareFn : opts.sortKeys\n\n visit(documents, node => {\n if (node.kind !== 'mapping') return\n\n node.items.sort((a, b) => compareFn(\n a.key.kind === 'scalar' ? a.key.value : '',\n b.key.kind === 'scalar' ? b.key.value : ''\n ))\n })\n }\n\n opts.transform(documents)\n\n const PRESENTER_OPT_KEYS = Object.keys(DEFAULT_PRESENTER_OPTIONS) as\n (keyof typeof DEFAULT_PRESENTER_OPTIONS)[]\n\n return present(documents, { ...pick(opts, PRESENTER_OPT_KEYS), schema: opts.schema })\n}\n\nexport {\n dump,\n\n type DumpOptions\n}\n","// Parser events → AST. The second entry into the AST world (the first being\n// `jsToAst`): instead of building JS values like the constructor, it mirrors the\n// same document/sequence/mapping frame walk and emits `Node`s that keep the\n// original styles, tags and anchors, so parsed YAML can be re-dumped faithfully.\n\nimport {\n EVENT_ID,\n SCALAR_STYLE,\n type CollectionStyle,\n type Event,\n type MappingEvent,\n type ScalarEvent,\n type SequenceEvent\n} from '../parser/events.ts'\nimport { getScalarValue } from '../parser/parser_scalar.ts'\nimport { type Schema } from '../schema.ts'\nimport {\n type Node,\n type Document,\n type ScalarNode,\n type SequenceNode,\n type MappingNode,\n type AliasNode\n} from './nodes.ts'\n\nconst NO_RANGE = -1\n\ninterface DocumentFrame {\n kind: 'document'\n doc: Document\n}\n\ninterface SequenceFrame {\n kind: 'sequence'\n node: SequenceNode\n}\n\ninterface MappingFrame {\n kind: 'mapping'\n node: MappingNode\n key: Node | null\n}\n\ntype Frame = DocumentFrame | SequenceFrame | MappingFrame\n\n/** @category AST */\ninterface FromEventsOptions {\n /** Source text referenced by offsets in `events`. */\n source: string\n\n /** Schema used to resolve implicit scalar tags. */\n schema: Schema\n}\n\ninterface FromEventsState {\n source: string\n schema: Schema\n eventIndex: number\n position: number\n frames: Frame[]\n documents: Document[]\n}\n\nfunction eventPosition (event: Event) {\n if ('tagStart' in event && event.tagStart !== NO_RANGE) return event.tagStart\n if ('anchorStart' in event && event.anchorStart !== NO_RANGE) return event.anchorStart\n if ('valueStart' in event && event.valueStart !== NO_RANGE) return event.valueStart\n if ('start' in event) return event.start\n return 0\n}\n\nfunction rawTag (state: FromEventsState, event: ScalarEvent | SequenceEvent | MappingEvent) {\n return event.tagStart === NO_RANGE\n ? ''\n : state.source.slice(event.tagStart, event.tagEnd)\n}\n\nfunction anchorName (state: FromEventsState, event: ScalarEvent | SequenceEvent | MappingEvent) {\n return event.anchorStart === NO_RANGE\n ? undefined\n : state.source.slice(event.anchorStart, event.anchorEnd)\n}\n\nfunction buildScalar (state: FromEventsState, event: ScalarEvent): ScalarNode {\n const value = getScalarValue(state.source, event)\n const raw = rawTag(state, event)\n\n let tag: string\n let tagged = false\n if (raw !== '') {\n tagged = true\n tag = raw\n } else if (event.style === SCALAR_STYLE.PLAIN) {\n tag = state.schema.resolveImplicitScalarTag(value).tag.tagName\n } else {\n tag = state.schema.defaultScalarTag.tagName\n }\n\n return { kind: 'scalar', tag, tagged, style: event.style, anchor: anchorName(state, event), value }\n}\n\nfunction buildCollection (\n state: FromEventsState,\n event: SequenceEvent | MappingEvent,\n defaultTagName: string\n): { tag: string, tagged: boolean, style: CollectionStyle, anchor?: string } {\n const raw = rawTag(state, event)\n\n let tag: string\n let tagged = false\n if (raw === '') {\n tag = defaultTagName\n } else {\n tag = raw\n tagged = true\n }\n\n return { tag, tagged, style: event.style, anchor: anchorName(state, event) }\n}\n\nfunction addNode (state: FromEventsState, node: Node) {\n const frame = state.frames[state.frames.length - 1]\n\n if (frame.kind === 'document') {\n frame.doc.contents = node\n } else if (frame.kind === 'sequence') {\n frame.node.items.push(node)\n } else if (frame.key) {\n frame.node.items.push({ key: frame.key, value: node })\n frame.key = null\n } else {\n frame.key = node\n }\n}\n\n/**\n * Builds an AST from parser events\n *\n * @category AST\n */\nfunction eventsToAst (events: Event[], options: FromEventsOptions): Document[] {\n const state: FromEventsState = {\n source: options.source,\n schema: options.schema,\n eventIndex: 0,\n position: 0,\n frames: [],\n documents: []\n }\n\n while (state.eventIndex < events.length) {\n const event = events[state.eventIndex++]\n state.position = eventPosition(event)\n\n switch (event.type) {\n case EVENT_ID.DOCUMENT: {\n const doc: Document = {\n contents: null,\n explicitStart: event.explicitStart,\n explicitEnd: event.explicitEnd,\n directives: event.directives\n }\n state.frames.push({ kind: 'document', doc })\n break\n }\n\n case EVENT_ID.SCALAR:\n addNode(state, buildScalar(state, event))\n break\n\n case EVENT_ID.SEQUENCE: {\n const { tag, tagged, style, anchor } = buildCollection(state, event, 'tag:yaml.org,2002:seq')\n const node: SequenceNode = { kind: 'sequence', tag, tagged, style, anchor, items: [] }\n state.frames.push({ kind: 'sequence', node })\n break\n }\n\n case EVENT_ID.MAPPING: {\n const { tag, tagged, style, anchor } = buildCollection(state, event, 'tag:yaml.org,2002:map')\n const node: MappingNode = { kind: 'mapping', tag, tagged, style, anchor, items: [] }\n state.frames.push({ kind: 'mapping', node, key: null })\n break\n }\n\n case EVENT_ID.ALIAS: {\n const name = state.source.slice(event.anchorStart, event.anchorEnd)\n const node: AliasNode = { kind: 'alias', anchor: name }\n addNode(state, node)\n break\n }\n\n case EVENT_ID.POP: {\n const frame = state.frames.pop()!\n if (frame.kind === 'mapping' && frame.key) {\n throw new Error('incomplete mapping pair in event stream')\n }\n if (frame.kind === 'document') {\n state.documents.push(frame.doc)\n } else {\n addNode(state, frame.node)\n }\n break\n }\n }\n }\n\n return state.documents\n}\n\nexport {\n eventsToAst,\n type FromEventsOptions\n}\n","export {\n Schema,\n FAILSAFE_SCHEMA,\n JSON_SCHEMA,\n CORE_SCHEMA,\n YAML11_SCHEMA,\n DUMP_SCHEMA\n} from './schema.ts'\n\nexport {\n NOT_RESOLVED,\n defineScalarTag,\n defineSequenceTag,\n defineMappingTag,\n type ScalarTagDefinition,\n type SequenceTagDefinition,\n type MappingTagDefinition,\n type TagDefinition,\n type ScalarTagOptions,\n type SequenceTagOptions,\n type MappingTagOptions\n} from './tag.ts'\n\nexport { strTag } from './tag/scalar/str.ts'\nexport { nullCoreTag } from './tag/scalar/null_core.ts'\nexport { nullJsonTag } from './tag/scalar/null_json.ts'\nexport { nullYaml11Tag } from './tag/scalar/null_yaml11.ts'\nexport { boolCoreTag } from './tag/scalar/bool_core.ts'\nexport { boolJsonTag } from './tag/scalar/bool_json.ts'\nexport { boolYaml11Tag } from './tag/scalar/bool_yaml11.ts'\nexport { intCoreTag } from './tag/scalar/int_core.ts'\nexport { intJsonTag } from './tag/scalar/int_json.ts'\nexport { intYaml11Tag } from './tag/scalar/int_yaml11.ts'\nexport { floatCoreTag } from './tag/scalar/float_core.ts'\nexport { floatJsonTag } from './tag/scalar/float_json.ts'\nexport { floatYaml11Tag } from './tag/scalar/float_yaml11.ts'\nexport { mergeTag } from './tag/scalar/merge.ts'\nexport { binaryTag } from './tag/scalar/binary.ts'\nexport { timestampTag } from './tag/scalar/timestamp.ts'\n\nexport { seqTag } from './tag/sequence/seq.ts'\nexport { omapTag } from './tag/sequence/omap.ts'\nexport { pairsTag } from './tag/sequence/pairs.ts'\n\nexport { mapTag } from './tag/mapping/map.ts'\nexport { realMapTag } from './tag/mapping/real_map.ts'\nexport { legacyMapTag } from './tag/mapping/legacy_map.ts'\nexport { setTag } from './tag/mapping/set.ts'\n\nexport { load, loadAll, type LoadOptions } from './load.ts'\nexport { dump, type DumpOptions } from './dump.ts'\nexport { YAMLException } from './common/exception.ts'\n\nexport {\n EVENT_ID,\n SCALAR_STYLE,\n COLLECTION_STYLE,\n CHOMPING_MODE,\n type EventId,\n type ScalarStyle,\n type CollectionStyle,\n type ChompingMode,\n\n type DocumentDirective,\n type DocumentEvent,\n type SequenceEvent,\n type MappingEvent,\n type ScalarEvent,\n type AliasEvent,\n type PopEvent,\n type Event\n} from './parser/events.ts'\n\nexport {\n parseEvents,\n type ParserOptions\n} from './parser/parser.ts'\n\nexport { getScalarValue } from './parser/parser_scalar.ts'\n\nexport {\n constructFromEvents,\n type ConstructorOptions\n} from './parser/constructor.ts'\n\nexport { eventsToAst, type FromEventsOptions } from './ast/from_events.ts'\nexport { jsToAst, type FromJsOptions } from './ast/from_js.ts'\nexport { present, type PresenterOptions } from './ast/presenter.ts'\nexport { type ScalarLayout, type ScalarStyleRule } from './ast/scalar_styler.ts'\nexport { DEFAULT_SCALAR_STYLE_RULES } from './ast/styler_defaults.ts'\n\nexport {\n visit,\n VISIT_BREAK,\n VISIT_SKIP,\n type Visitor,\n type VisitContext\n} from './ast/visit.ts'\n\nexport {\n type Node,\n type Document,\n type NodeBase,\n type ScalarNode,\n type SequenceNode,\n type MappingNode,\n type AliasNode\n} from './ast/nodes.ts'\n\n// Deprecated compatibility exports\n\nimport { EVENT_ID, SCALAR_STYLE, COLLECTION_STYLE, CHOMPING_MODE } from './parser/events.ts'\n\n/** @deprecated Use `EVENT_ID.DOCUMENT` instead. @internal */\nexport const EVENT_DOCUMENT = EVENT_ID.DOCUMENT\n/** @deprecated Use `EVENT_ID.SEQUENCE` instead. @internal */\nexport const EVENT_SEQUENCE = EVENT_ID.SEQUENCE\n/** @deprecated Use `EVENT_ID.MAPPING` instead. @internal */\nexport const EVENT_MAPPING = EVENT_ID.MAPPING\n/** @deprecated Use `EVENT_ID.SCALAR` instead. @internal */\nexport const EVENT_SCALAR = EVENT_ID.SCALAR\n/** @deprecated Use `EVENT_ID.ALIAS` instead. @internal */\nexport const EVENT_ALIAS = EVENT_ID.ALIAS\n/** @deprecated Use `EVENT_ID.POP` instead. @internal */\nexport const EVENT_POP = EVENT_ID.POP\n/** @deprecated Use `SCALAR_STYLE.PLAIN` instead. @internal */\nexport const SCALAR_STYLE_PLAIN = SCALAR_STYLE.PLAIN\n/** @deprecated Use `SCALAR_STYLE.SINGLE_QUOTED` instead. @internal */\nexport const SCALAR_STYLE_SINGLE_QUOTED = SCALAR_STYLE.SINGLE_QUOTED\n/** @deprecated Use `SCALAR_STYLE.DOUBLE_QUOTED` instead. @internal */\nexport const SCALAR_STYLE_DOUBLE_QUOTED = SCALAR_STYLE.DOUBLE_QUOTED\n/** @deprecated Use `SCALAR_STYLE.LITERAL_BLOCK` instead. @internal */\nexport const SCALAR_STYLE_LITERAL_BLOCK = SCALAR_STYLE.LITERAL_BLOCK\n/** @deprecated Use `SCALAR_STYLE.FOLDED_BLOCK` instead. @internal */\nexport const SCALAR_STYLE_FOLDED_BLOCK = SCALAR_STYLE.FOLDED_BLOCK\n/** @deprecated Use `COLLECTION_STYLE.BLOCK` instead. @internal */\nexport const COLLECTION_STYLE_BLOCK = COLLECTION_STYLE.BLOCK\n/** @deprecated Use `COLLECTION_STYLE.FLOW` instead. @internal */\nexport const COLLECTION_STYLE_FLOW = COLLECTION_STYLE.FLOW\n/** @deprecated Use `CHOMPING_MODE.CLIP` instead. @internal */\nexport const CHOMPING_CLIP = CHOMPING_MODE.CLIP\n/** @deprecated Use `CHOMPING_MODE.STRIP` instead. @internal */\nexport const CHOMPING_STRIP = CHOMPING_MODE.STRIP\n/** @deprecated Use `CHOMPING_MODE.KEEP` instead. @internal */\nexport const CHOMPING_KEEP = CHOMPING_MODE.KEEP\n"],"mappings":";;AAKA,IAAM,IAA8B,OAAO,cAAc;AAsMzD,SAAS,EAAyB,GAAiB,GAAgE;;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