@rohal12/twee-ts 1.18.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +23 -3
  2. package/THIRD_PARTY_NOTICES +111 -0
  3. package/UNLICENSE +24 -0
  4. package/dist/bin/twee-ts.js +689 -9335
  5. package/dist/bin/twee-ts.js.map +1 -1
  6. package/dist/diagnostic-text-BRddVulf.cjs +26463 -0
  7. package/dist/diagnostic-text-BRddVulf.cjs.map +1 -0
  8. package/dist/diagnostic-text-CebYCTPQ.js +26040 -0
  9. package/dist/diagnostic-text-CebYCTPQ.js.map +1 -0
  10. package/dist/index.cjs +86 -9026
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +192 -415
  13. package/dist/index.d.ts +192 -415
  14. package/dist/index.js +4 -9206
  15. package/dist/lint-VayZI_jp.js +288 -0
  16. package/dist/lint-VayZI_jp.js.map +1 -0
  17. package/dist/options-DuBkFyqi.d.cts +28 -0
  18. package/dist/options-nc5NpnSc.d.ts +28 -0
  19. package/dist/plugins/rollup.cjs +172 -0
  20. package/dist/plugins/rollup.cjs.map +1 -0
  21. package/dist/plugins/rollup.d.cts +46 -0
  22. package/dist/plugins/rollup.d.ts +7 -12
  23. package/dist/plugins/rollup.js +130 -65
  24. package/dist/plugins/rollup.js.map +1 -1
  25. package/dist/plugins/vite.cjs +1926 -0
  26. package/dist/plugins/vite.cjs.map +1 -0
  27. package/dist/plugins/vite.d.cts +15 -0
  28. package/dist/plugins/vite.d.ts +5 -12
  29. package/dist/plugins/vite.js +1771 -448
  30. package/dist/plugins/vite.js.map +1 -1
  31. package/dist/types-BvI6pg2y.d.cts +389 -0
  32. package/dist/types-BvI6pg2y.d.ts +389 -0
  33. package/dist/watch-targets-BI7jYrwa.js +486 -0
  34. package/dist/watch-targets-BI7jYrwa.js.map +1 -0
  35. package/dist/watch-targets-C0Anuw17.cjs +575 -0
  36. package/dist/watch-targets-C0Anuw17.cjs.map +1 -0
  37. package/package.json +80 -27
  38. package/schemas/twee-ts.config.schema.json +55 -17
  39. package/dist/index.js.map +0 -1
  40. package/dist/paths-CUv1qfz-.js +0 -6926
  41. package/dist/paths-CUv1qfz-.js.map +0 -1
  42. package/dist/types-D8Xfe0l8.d.ts +0 -71
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostic-text-CebYCTPQ.js","names":["EOF","isWhitespace","isHexDigit","bufferConstants","parsePath","_exhaustive","TokenType","Parser","ecma14BinaryProperties","Parser","tokTypes","isSurrogatePair","$","$","$$","$","$","$","TN","foreignContent.isIntegrationPoint","doctype.getDocumentMode","doctype.isConforming","foreignContent.causesExit","$","parse","tokTypes","parse","_exhaustive","readMarkup","_exhaustive","_exhaustive","NUMBER","lineAndColumn","rejected","items","_exhaustive","MAX_LINK_DEPTH","_exhaustive","MAX_LINK_DEPTH","fsConstants","fsWatch","VERSION","tokTypes","_exhaustive","_exhaustive","fsConstants","_exhaustive","_exhaustive","_unhandled","_exhaustive","CREATOR_NAME","CREATOR_NAME","_exhaustive","watch","_exhaustive"],"sources":["../src/css-imports.ts","../src/source-text.ts","../src/ifid.ts","../src/util.ts","../src/escape.ts","../src/twee-syntax.ts","../node_modules/.pnpm/acorn@8.19.0/node_modules/acorn/dist/acorn.mjs","../src/js-chars.ts","../src/js-syntax.ts","../src/javascript-strings.ts","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/common/unicode.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/common/error-codes.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/tokenizer/preprocessor.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/common/token.js","../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode-codepoint.js","../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/decode-shared.js","../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/generated/decode-data-html.js","../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/generated/decode-data-xml.js","../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/bin-trie-flags.js","../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/common/html.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/tokenizer/index.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/parser/open-element-stack.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/parser/formatting-element-list.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/tree-adapters/default.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/common/doctype.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/common/foreign-content.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/parser/index.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/serializer/index.js","../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/index.js","../src/code-context.ts","../src/errors.ts","../src/html-structure.ts","../src/link-markup.ts","../src/sugarcube-macros.ts","../src/word-count.ts","../src/json-decode.ts","../src/passage.ts","../src/story.ts","../src/media-types.ts","../src/path-identity.ts","../src/input-policy.ts","../src/folder-stream.ts","../src/filesystem.ts","../src/semver.ts","../src/format-decode.ts","../src/formats.ts","../src/atomic-write.ts","../src/format-cache.ts","../src/remote-formats.ts","../src/format-resolution.ts","../src/types.ts","../src/lexer.ts","../src/twee2-compat.ts","../src/parser.ts","../src/twine1-obfuscation.ts","../src/html-parser.ts","../src/loader.ts","../src/template.ts","../src/html-output-check.ts","../src/version.ts","../src/output-twine2.ts","../src/build-time.ts","../src/output-twine1.ts","../src/output-twee.ts","../src/modules.ts","../src/passage-omission.ts","../src/start-passage.ts","../src/config.ts","../src/compile-options.ts","../src/compiler.ts","../src/diagnostic-text.ts"],"sourcesContent":["/**\n * Which `@import` rules of the story stylesheet a browser ignores. CSS Cascade accepts an `@import` only before every\n * other valid at-rule and style rule, ignoring `@layer` statements; an `@import` anywhere else is invalid and dropped,\n * and the stylesheet is not told. The story's stylesheet passages and `.css` files are joined into one stylesheet, so\n * an import that opens a later source comes after the rules of the earlier ones, and a construct a source leaves open\n * (an unclosed comment, block or `url(`, a missing `;`) swallows the start of the next. Tweego joins them the same\n * way, so twee-ts keeps the text and reports the import instead.\n *\n * The joined stylesheet, exactly as the output joins it, is read as CSS Syntax Level 3 reads it: section 4 turns it\n * into tokens (comments, strings, escapes, `url()` and the rest) and section 5.4.1 consumes the list of rules. A rule\n * ends the place for imports when a browser would keep it:\n *\n * - a style rule with a block and a prelude that can be a selector (a prelude holding a token no selector holds, such\n * as `;`, `!`, `/`, a stray `)`, `]` or `}`, an at-keyword, a string, a url, a number or an unrestricted hash, or no\n * prelude, or no block, is dropped and ends nothing);\n * - `@namespace` with a name and a url, `@layer` with a block (and at most one name) and every at-rule some browser\n * supports (the names are in KNOWN_AT_RULES), with its block and a prelude of the shape that at-rule takes;\n * - an `@layer` statement after an `@import`, which browsers take for the end of the imports though the specification\n * ignores it; layer statements belong before the first import.\n *\n * An at-rule no browser knows, `@charset` wherever it stands (CSS Syntax treats it as an unknown at-rule; the\n * encoding is read from the bytes), `@import` without a url or string, and a rule whose prelude is not of the shape\n * its at-rule takes are dropped and end nothing. What this does not check counts as a rule, though browsers drop\n * it (so a warning may come after one of these, and a browser keeps the import):\n *\n * - selectors invalid by their grammar or meaning: a leading combinator (`> a {}`), a trailing comma (`a, {}`), an\n * unknown pseudo-class or a malformed one (`a:foo {}`, `a::: {}`), a custom property name (`--x: y {}`), a namespace\n * prefix that is not declared (`a|b {}`);\n * - preludes whose value is invalid: `@keyframes none` and `initial`, `@counter-style none` and `decimal` (reserved\n * names), `@font-feature-values {}`, `@function foo {}` (no function name), `@supports (a:b) foo {}`,\n * `@container 1px {}`, `@scope 1px {}`, `@page a, {}`, and the descriptors in the block of `@property`.\n *\n * The preludes of `@media`, `@container` and `@scope` are read by their own grammars, which browsers apply leniently.\n *\n * Each `@import` the sources write at their own top level, read on its own, that the joined stylesheet does not keep\n * as an import rule is reported with its source.\n *\n * The input is read as a stream of tokens, one at a time, so the memory it takes does not grow with the input but\n * with how deep it nests (a byte for each open bracket) and with the number of `@import` rules it holds.\n */\nimport type { Diagnostic } from './types.js';\n\n/** A stylesheet source of the story, with the name its diagnostics call it by. */\nexport interface StylesheetSource {\n readonly label: string;\n readonly text: string;\n}\n\n/** The stylesheet an output writes: the sources joined, and where each source's text starts in it. */\nexport interface JoinedStylesheet {\n readonly text: string;\n readonly parts: readonly { readonly start: number }[];\n}\n\n/** The sources joined with a line feed between them, as JSON output joins its `style`. */\nexport function joinWithLineFeeds(sources: readonly StylesheetSource[]): JoinedStylesheet {\n const parts: { start: number }[] = [];\n let text = '';\n for (const source of sources) {\n if (parts.length > 0) text += '\\n';\n parts.push({ start: text.length });\n text += source.text;\n }\n return { text, parts };\n}\n\ntype TokenType =\n | 'eof'\n | 'ws'\n | 'ident'\n | 'function'\n | 'atkeyword'\n | 'hash'\n | 'string'\n | 'badstring'\n | 'url'\n | 'badurl'\n | 'delim'\n | 'number'\n | 'percentage'\n | 'dimension'\n | 'cdo'\n | 'cdc'\n | 'colon'\n | 'semicolon'\n | 'comma'\n | 'lbracket'\n | 'rbracket'\n | 'lparen'\n | 'rparen'\n | 'lbrace'\n | 'rbrace';\n\n/**\n * A token: its type, where it starts, and its value: a name lower-cased (and cut at MAX_NAME characters, which no name\n * the rules compare it with reaches), a delimiter's character, `id` for a hash that is an ID.\n */\ninterface Token {\n readonly type: TokenType;\n readonly start: number;\n readonly value: string;\n}\n\nconst EOF: Token = { type: 'eof', start: -1, value: '' };\n\n/** The longest name kept: longer than any at-rule name, function name or keyword the rules compare it with. */\nconst MAX_NAME = 64;\n\n/** The characters a character class admits; the empty string (the end of the input) is in none. */\nconst isOneOf = (ch: string, set: string): boolean => ch !== '' && set.includes(ch);\nconst isWhitespace = (ch: string): boolean => isOneOf(ch, ' \\t\\n\\r\\f');\nconst isNewline = (ch: string): boolean => isOneOf(ch, '\\n\\r\\f');\nconst isDigit = (ch: string): boolean => ch >= '0' && ch <= '9';\nconst isHexDigit = (ch: string): boolean => isDigit(ch) || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F');\nconst isNameStart = (ch: string): boolean =>\n (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch === '_' || ch >= '\\u0080';\nconst isNameChar = (ch: string): boolean => isNameStart(ch) || isDigit(ch) || ch === '-';\n/** A code point a url token may not hold unescaped: controls other than tab, line feed, form feed and CR. */\nconst isNonPrintable = (ch: string): boolean =>\n ch !== '' && (ch <= '\\b' || ch === '\\v' || ch === '\\x7f' || (ch >= '\\x0e' && ch <= '\\x1f'));\n\n/** Whether a backslash at `i` and the code point after it are a valid escape (the end of the input is one). */\nconst validEscape = (css: string, i: number): boolean => css.charAt(i) === '\\\\' && !isNewline(css.charAt(i + 1));\n\n/** Whether an identifier starts at `i`. */\nfunction wouldStartIdent(css: string, i: number): boolean {\n const ch = css.charAt(i);\n if (ch === '-') {\n const next = css.charAt(i + 1);\n return isNameStart(next) || next === '-' || validEscape(css, i + 1);\n }\n return isNameStart(ch) || validEscape(css, i);\n}\n\n/** Whether a number starts at `i`. */\nfunction wouldStartNumber(css: string, i: number): boolean {\n const ch = css.charAt(i);\n if (ch === '+' || ch === '-') {\n return isDigit(css.charAt(i + 1)) || (css.charAt(i + 1) === '.' && isDigit(css.charAt(i + 2)));\n }\n if (ch === '.') return isDigit(css.charAt(i + 1));\n return isDigit(ch);\n}\n\n/** The character a hex escape spells; a number that is no character reads as U+FFFD. */\nfunction codePointName(code: number): string {\n return code === 0 || code > 0x10ffff || (code >= 0xd800 && code <= 0xdfff) ? '�' : String.fromCodePoint(code);\n}\n\n/** The escape after the backslash that ends at `i`: the character it spells and where it ends. */\nfunction consumeEscape(css: string, i: number): { readonly text: string; readonly end: number } {\n const ch = css.charAt(i);\n if (ch === '') return { text: '�', end: i };\n if (!isHexDigit(ch)) return { text: ch, end: i + 1 };\n let end = i;\n while (end - i < 6 && isHexDigit(css.charAt(end))) end += 1;\n const code = Number.parseInt(css.slice(i, end), 16);\n // One whitespace character after a hex escape belongs to it; a CR LF pair counts as one.\n if (css.startsWith('\\r\\n', end)) end += 2;\n else if (isWhitespace(css.charAt(end))) end += 1;\n return { text: codePointName(code), end };\n}\n\n/** An identifier sequence that starts at `i`: its value with the escapes decoded (cut at MAX_NAME), and where it ends. */\nfunction consumeIdentSequence(css: string, i: number): { readonly value: string; readonly end: number } {\n let value = '';\n let end = i;\n for (;;) {\n const ch = css.charAt(end);\n if (isNameChar(ch)) {\n if (value.length < MAX_NAME) value += ch;\n end += 1;\n } else if (validEscape(css, end)) {\n const escape = consumeEscape(css, end + 1);\n if (value.length < MAX_NAME) value += escape.text;\n end = escape.end;\n } else {\n return { value, end };\n }\n }\n}\n\n/** Where the number that starts at `i` ends. */\nfunction consumeNumber(css: string, i: number): number {\n let end = i;\n if (css.charAt(end) === '+' || css.charAt(end) === '-') end += 1;\n while (isDigit(css.charAt(end))) end += 1;\n if (css.charAt(end) === '.' && isDigit(css.charAt(end + 1))) {\n end += 1;\n while (isDigit(css.charAt(end))) end += 1;\n }\n if (css.charAt(end) === 'e' || css.charAt(end) === 'E') {\n const sign = css.charAt(end + 1) === '+' || css.charAt(end + 1) === '-' ? 1 : 0;\n if (isDigit(css.charAt(end + 1 + sign))) {\n end += 1 + sign;\n while (isDigit(css.charAt(end))) end += 1;\n }\n }\n return end;\n}\n\n/** The string that opens at `i`: a string token, or a bad string (ended by a newline), and where it ends. */\nfunction consumeString(css: string, i: number): { readonly type: 'string' | 'badstring'; readonly end: number } {\n const quote = css.charAt(i);\n let end = i + 1;\n for (;;) {\n const ch = css.charAt(end);\n if (ch === quote) return { type: 'string', end: end + 1 };\n if (ch === '') return { type: 'string', end };\n if (isNewline(ch)) return { type: 'badstring', end };\n if (ch !== '\\\\') {\n end += 1;\n } else if (css.charAt(end + 1) === '') {\n end += 1;\n } else if (isNewline(css.charAt(end + 1))) {\n // A backslash and a newline continue the string; a CR LF pair is one newline.\n end += css.startsWith('\\r\\n', end + 1) ? 3 : 2;\n } else {\n end = consumeEscape(css, end + 1).end;\n }\n }\n}\n\n/** Where the rest of a bad url ends: after the `)` that closes it, or at the end of the input. */\nfunction consumeBadUrlRemnants(css: string, i: number): number {\n let end = i;\n for (;;) {\n const ch = css.charAt(end);\n if (ch === ')') return end + 1;\n if (ch === '') return end;\n end = validEscape(css, end) ? consumeEscape(css, end + 1).end : end + 1;\n }\n}\n\n/** The url token whose contents start at `i` (after `url(`): a url, or a bad url, and where it ends. */\nfunction consumeUrl(css: string, i: number): { readonly type: 'url' | 'badurl'; readonly end: number } {\n let end = i;\n while (isWhitespace(css.charAt(end))) end += 1;\n for (;;) {\n const ch = css.charAt(end);\n if (ch === ')') return { type: 'url', end: end + 1 };\n if (ch === '') return { type: 'url', end };\n if (isWhitespace(ch)) {\n while (isWhitespace(css.charAt(end))) end += 1;\n const next = css.charAt(end);\n if (next === ')') return { type: 'url', end: end + 1 };\n if (next === '') return { type: 'url', end };\n return { type: 'badurl', end: consumeBadUrlRemnants(css, end) };\n }\n if (ch === '\"' || ch === \"'\" || ch === '(' || isNonPrintable(ch)) {\n return { type: 'badurl', end: consumeBadUrlRemnants(css, end) };\n }\n if (ch !== '\\\\') {\n end += 1;\n } else if (validEscape(css, end)) {\n end = consumeEscape(css, end + 1).end;\n } else {\n return { type: 'badurl', end: consumeBadUrlRemnants(css, end) };\n }\n }\n}\n\n/** The identifier, function, url or bad url that starts at `i` (an identifier sequence starts there). */\nfunction consumeIdentLike(css: string, i: number): { readonly token: Token; readonly end: number } {\n const { value, end } = consumeIdentSequence(css, i);\n const name = value.toLowerCase();\n if (css.charAt(end) !== '(') return { token: { type: 'ident', start: i, value: name }, end };\n if (name !== 'url') return { token: { type: 'function', start: i, value: name }, end: end + 1 };\n // `url(` followed by a quote (after any whitespace) is a function whose argument is a string; else a url token.\n let after = end + 1;\n while (isWhitespace(css.charAt(after)) && isWhitespace(css.charAt(after + 1))) after += 1;\n const quoted = css.charAt(after);\n if (quoted === '\"' || quoted === \"'\" || (isWhitespace(quoted) && ['\"', \"'\"].includes(css.charAt(after + 1)))) {\n return { token: { type: 'function', start: i, value: name }, end: end + 1 };\n }\n const url = consumeUrl(css, end + 1);\n return { token: { type: url.type, start: i, value: '' }, end: url.end };\n}\n\nconst PUNCTUATION: ReadonlyMap<string, TokenType> = new Map([\n ['(', 'lparen'],\n [')', 'rparen'],\n [',', 'comma'],\n [':', 'colon'],\n [';', 'semicolon'],\n ['[', 'lbracket'],\n [']', 'rbracket'],\n ['{', 'lbrace'],\n ['}', 'rbrace'],\n]);\n\n/**\n * The tokens of `css` (CSS Syntax Level 3, section 4), comments left out, one for each call; the end of the input\n * is the `eof` token, over and over.\n */\nfunction createTokenizer(css: string): () => Token {\n let i = 0;\n const emit = (type: TokenType, start: number, end: number, value = ''): Token => {\n i = end;\n return { type, start, value };\n };\n return (): Token => {\n for (;;) {\n if (i >= css.length) return EOF;\n const ch = css.charAt(i);\n const next = css.charAt(i + 1);\n const punctuation = PUNCTUATION.get(ch);\n if (ch === '/' && next === '*') {\n const close = css.indexOf('*/', i + 2);\n i = close === -1 ? css.length : close + 2;\n } else if (isWhitespace(ch)) {\n let end = i + 1;\n while (isWhitespace(css.charAt(end))) end += 1;\n return emit('ws', i, end);\n } else if (ch === '\"' || ch === \"'\") {\n const string = consumeString(css, i);\n return emit(string.type, i, string.end);\n } else if (ch === '#' && (isNameChar(next) || validEscape(css, i + 1))) {\n // A hash is an ID when an identifier starts after it; otherwise it can not be an ID selector.\n return emit('hash', i, consumeIdentSequence(css, i + 1).end, wouldStartIdent(css, i + 1) ? 'id' : '');\n } else if (punctuation !== undefined) {\n return emit(punctuation, i, i + 1);\n } else if (wouldStartNumber(css, i)) {\n const numberEnd = consumeNumber(css, i);\n if (wouldStartIdent(css, numberEnd)) return emit('dimension', i, consumeIdentSequence(css, numberEnd).end);\n if (css.charAt(numberEnd) === '%') return emit('percentage', i, numberEnd + 1);\n return emit('number', i, numberEnd);\n } else if (css.startsWith('<!--', i)) {\n return emit('cdo', i, i + 4);\n } else if (css.startsWith('-->', i)) {\n return emit('cdc', i, i + 3);\n } else if (ch === '@' && wouldStartIdent(css, i + 1)) {\n const name = consumeIdentSequence(css, i + 1);\n return emit('atkeyword', i, name.end, name.value.toLowerCase());\n } else if (wouldStartIdent(css, i)) {\n const identLike = consumeIdentLike(css, i);\n i = identLike.end;\n return identLike.token;\n } else {\n return emit('delim', i, i + 1, ch);\n }\n }\n };\n}\n\n/** The codes of the brackets a token opens and closes, for the stack of open blocks. */\nconst OPENS: ReadonlyMap<TokenType, number> = new Map([\n ['lparen', 1],\n ['function', 1],\n ['lbracket', 2],\n ['lbrace', 3],\n]);\nconst CLOSES: ReadonlyMap<TokenType, number> = new Map([\n ['rparen', 1],\n ['rbracket', 2],\n ['rbrace', 3],\n]);\n\n/** A stack of bytes that grows as it is used: a byte for each block that is open. */\nclass ByteStack {\n private bytes = new Uint8Array(64);\n size = 0;\n\n push(code: number): void {\n if (this.size === this.bytes.length) {\n const grown = new Uint8Array(this.bytes.length * 2);\n grown.set(this.bytes);\n this.bytes = grown;\n }\n this.bytes[this.size] = code;\n this.size += 1;\n }\n\n /** The code on top. */\n top(): number {\n return Number(this.bytes[this.size - 1]);\n }\n\n pop(): void {\n this.size -= 1;\n }\n}\n\n/** The delimiters a selector holds outside brackets: universal, class, combinators, namespace and nesting. */\nconst SELECTOR_DELIMS = '*.>+~|&';\n\n/** Whether a token can be at the top level of a selector (it is not whitespace). */\nfunction inSelector(token: Token): boolean {\n switch (token.type) {\n case 'ident':\n case 'function':\n case 'colon':\n case 'comma':\n case 'lbracket':\n return true;\n case 'hash':\n return token.value === 'id';\n case 'delim':\n return SELECTOR_DELIMS.includes(token.value);\n default:\n return false;\n }\n}\n\n/** Where a prelude is in a list of layer names, `a`, `a.b`, separated by commas. */\ntype LayerState = 'name' | 'after-name' | 'after-dot' | 'bad';\n\n/**\n * What the prelude of a rule is, kept as it is read: the tokens of the prelude are not kept, since a prelude may be\n * as long as the input. Whitespace and comments are no components.\n */\nclass Prelude {\n /** The number of components, up to 3. */\n count = 0;\n first: Token = EOF;\n /** Whether a whitespace separates the last component from the one before. */\n private gap = false;\n /** Whether every component is one a selector holds. */\n selectorOk = true;\n /** Whether every component is an identifier, a colon or a comma, as in the prelude of `@page`. */\n pageOk = true;\n private layerState: LayerState = 'name';\n /** The number of layer names, up to 2. */\n layerNames = 0;\n /** Whether the first and second components are as a `@namespace` prelude has them: a url or a string last. */\n private namespaceShape: 'start' | 'name' | 'done' | 'bad' = 'start';\n\n add(token: Token): void {\n if (token.type === 'ws') {\n this.gap = true;\n return;\n }\n const adjacent = !this.gap;\n this.gap = false;\n if (this.count < 3) this.count += 1;\n if (this.count === 1) this.first = token;\n if (!inSelector(token)) this.selectorOk = false;\n if (token.type !== 'ident' && token.type !== 'colon' && token.type !== 'comma') this.pageOk = false;\n this.layerState = this.nextLayerState(token, adjacent);\n this.namespaceShape = this.nextNamespaceShape(token);\n }\n\n private nextLayerState(token: Token, adjacent: boolean): LayerState {\n switch (this.layerState) {\n case 'name':\n if (token.type !== 'ident') return 'bad';\n this.layerNames = Math.min(this.layerNames + 1, 2);\n return 'after-name';\n case 'after-name':\n if (token.type === 'comma') return 'name';\n return token.type === 'delim' && token.value === '.' && adjacent ? 'after-dot' : 'bad';\n case 'after-dot':\n return token.type === 'ident' && adjacent ? 'after-name' : 'bad';\n case 'bad':\n return 'bad';\n }\n }\n\n private nextNamespaceShape(token: Token): 'start' | 'name' | 'done' | 'bad' {\n switch (this.namespaceShape) {\n case 'start':\n if (token.type === 'ident') return 'name';\n return isUrlOrString(token) ? 'done' : 'bad';\n case 'name':\n return isUrlOrString(token) ? 'done' : 'bad';\n case 'done':\n case 'bad':\n return 'bad';\n }\n }\n\n /** Whether the components are a list of layer names (none at all included). */\n get layerNamesOk(): boolean {\n return this.count === 0 || this.layerState === 'after-name';\n }\n\n /** Whether the components are the name (optional) and the url or string that `@namespace` takes. */\n get namespaceOk(): boolean {\n return this.namespaceShape === 'done';\n }\n\n /** Whether the components can be a selector. */\n get isSelector(): boolean {\n return this.count > 0 && this.selectorOk;\n }\n\n /** Whether the only component is an identifier. */\n get isOneIdent(): boolean {\n return this.count === 1 && this.first.type === 'ident';\n }\n\n /** Whether the only component is an identifier that starts with two dashes. */\n get isOneDashedIdent(): boolean {\n return this.isOneIdent && this.first.value.startsWith('--');\n }\n}\n\n/** Whether a token is a url or a string, the argument `@import` and `@namespace` take. */\nconst isUrlOrString = (token: Token): boolean =>\n token.type === 'string' || token.type === 'url' || (token.type === 'function' && token.value === 'url');\n\n/** Whether the prelude is a keyframes name: one identifier or string. */\nconst keyframesName = (p: Prelude): boolean => p.count === 1 && (p.first.type === 'ident' || p.first.type === 'string');\n\n/**\n * The names of the at-rules some browser supports, which end the place for imports (with their block), and what\n * their prelude must be for a browser to keep the rule. An at-rule no browser knows is dropped. A rule without a check\n * is kept with any prelude.\n */\nconst KNOWN_AT_RULES: ReadonlyMap<string, ((prelude: Prelude) => boolean) | undefined> = new Map<\n string,\n ((prelude: Prelude) => boolean) | undefined\n>([\n ['media', undefined],\n [\n 'supports',\n (p) => ['lparen', 'function'].includes(p.first.type) || (p.first.type === 'ident' && p.first.value === 'not'),\n ],\n ['font-face', (p) => p.count === 0],\n ['keyframes', keyframesName],\n ['-webkit-keyframes', keyframesName],\n ['-moz-keyframes', keyframesName],\n ['page', (p) => p.pageOk],\n ['property', (p) => p.isOneDashedIdent],\n ['container', (p) => p.count > 0],\n ['scope', undefined],\n ['counter-style', (p) => p.isOneIdent],\n ['starting-style', (p) => p.count === 0],\n ['font-palette-values', (p) => p.isOneDashedIdent],\n ['font-feature-values', undefined],\n // Firefox reads this in author stylesheets for `url-prefix()` only; the other conditions are dropped.\n ['-moz-document', (p) => p.count === 1 && p.first.type === 'function' && p.first.value === 'url-prefix'],\n ['view-transition', (p) => p.count === 0],\n ['position-try', (p) => p.isOneDashedIdent],\n ['function', undefined],\n]);\n\n/** What an at-rule is, as far as the position of `@import` is concerned. */\ntype AtRuleKind = 'import' | 'layer-statement' | 'rule' | 'dropped';\n\nfunction classifyAtRule(name: string, prelude: Prelude, hasBlock: boolean): AtRuleKind {\n switch (name) {\n case 'import':\n return !hasBlock && isUrlOrString(prelude.first) ? 'import' : 'dropped';\n case 'layer':\n if (!prelude.layerNamesOk) return 'dropped';\n if (hasBlock) return prelude.layerNames <= 1 ? 'rule' : 'dropped';\n return prelude.layerNames > 0 ? 'layer-statement' : 'dropped';\n case 'namespace':\n return !hasBlock && prelude.namespaceOk ? 'rule' : 'dropped';\n default: {\n const check = KNOWN_AT_RULES.get(name);\n return hasBlock && KNOWN_AT_RULES.has(name) && (check === undefined || check(prelude)) ? 'rule' : 'dropped';\n }\n }\n}\n\n/** What the list of rules reads from a stylesheet. */\ninterface Rules {\n /** Where the `@import` rules that a browser keeps start, in order. */\n readonly kept: readonly number[];\n /**\n * Where the `@import` rules written at the stylesheet's top level start, whether kept or not, and the `@import`\n * at-keywords inside the preludes of other rules, which those rules swallow, in order. An `@import` that is no\n * import rule by itself (no url or string, or a block) is not among them. Left empty unless asked for.\n */\n readonly written: readonly number[];\n}\n\n/**\n * The rules of a stylesheet (CSS Syntax Level 3, section 5.4.1), as far as `@import` is concerned, read token by\n * token.\n */\nfunction consumeRules(css: string, collectWritten: boolean): Rules {\n const nextToken = createTokenizer(css);\n let token = nextToken();\n const kept: number[] = [];\n const written: number[] = [];\n const closers = new ByteStack();\n\n /** Skips the block that the current token opens; the current token is then the first after it. */\n const skipBlock = (): void => {\n closers.size = 0;\n do {\n const closes = CLOSES.get(token.type);\n const opens = OPENS.get(token.type);\n if (token.type === 'eof') return;\n if (closes !== undefined && closes === closers.top()) closers.pop();\n else if (opens !== undefined) closers.push(opens);\n token = nextToken();\n } while (closers.size > 0);\n };\n\n /** Reads the prelude from the current token to the block that ends it, to a `;` when `statement`, or to the end. */\n const consumePrelude = (statement: boolean): { readonly prelude: Prelude; readonly hasBlock: boolean } => {\n const prelude = new Prelude();\n for (;;) {\n if (token.type === 'eof') return { prelude, hasBlock: false };\n if (token.type === 'lbrace') {\n skipBlock();\n return { prelude, hasBlock: true };\n }\n if (statement && token.type === 'semicolon') {\n token = nextToken();\n return { prelude, hasBlock: false };\n }\n if (collectWritten && token.type === 'atkeyword' && token.value === 'import') written.push(token.start);\n prelude.add(token);\n if (OPENS.has(token.type)) skipBlock();\n else token = nextToken();\n }\n };\n\n let ruleSeen = false;\n let importSeen = false;\n for (;;) {\n if (token.type === 'eof') break;\n if (token.type === 'ws' || token.type === 'cdo' || token.type === 'cdc') {\n token = nextToken();\n } else if (token.type !== 'atkeyword') {\n const { prelude, hasBlock } = consumePrelude(false);\n if (hasBlock && prelude.isSelector) ruleSeen = true;\n } else {\n const { value: name, start } = token;\n token = nextToken();\n const mark = written.length;\n const { prelude, hasBlock } = consumePrelude(true);\n const kind = classifyAtRule(name, prelude, hasBlock);\n if (kind === 'import') {\n // Before the at-keywords its prelude swallowed, to keep the positions in order.\n if (collectWritten) written.splice(mark, 0, start);\n if (!ruleSeen) {\n kept.push(start);\n importSeen = true;\n }\n } else if (kind === 'rule' || (kind === 'layer-statement' && importSeen)) {\n ruleSeen = true;\n }\n }\n }\n return { kept, written };\n}\n\n/** Whether `target` is in the ascending list. */\nfunction includesSorted(list: readonly number[], target: number): boolean {\n let low = 0;\n let high = list.length;\n while (low < high) {\n const middle = (low + high) >>> 1;\n if (Number(list[middle]) < target) low = middle + 1;\n else high = middle;\n }\n return Number(list[low]) === target;\n}\n\n/**\n * A warning for each source whose `@import` rules a browser ignores in the stylesheet the output writes (`joined`,\n * made of the sources): those that come after a rule of the stylesheet, and those that an earlier construct swallows.\n * The imported stylesheet is never requested.\n */\nexport function ineffectiveImportDiagnostics(\n sources: readonly StylesheetSource[],\n joined: JoinedStylesheet,\n): Diagnostic[] {\n // A single source is the whole stylesheet, so one reading serves both.\n const single = sources.length === 1 && joined.parts[0]?.start === 0 && joined.text === sources[0]?.text;\n const { kept, written: writtenBySingle } = consumeRules(joined.text, single);\n return sources.flatMap(({ label, text }, index): Diagnostic[] => {\n const start = Number(joined.parts[index]?.start);\n // The imports the source writes at its own top level, read on its own, that the stylesheet does not keep.\n const written = single ? writtenBySingle : consumeRules(text, true).written;\n const count = written.filter((at) => !includesSorted(kept, start + at)).length;\n if (count === 0) return [];\n return [\n {\n level: 'warning',\n message:\n `${label} has ${count === 1 ? 'an @import rule' : `${count} @import rules`} that browsers ignore in the ` +\n `story stylesheet: ${count === 1 ? 'it comes' : 'they come'} after other rules, or ` +\n `${count === 1 ? 'is' : 'are'} part of a rule that is not finished (a \";\" or \"}\" is missing before or ` +\n 'after), so the imported stylesheet is never loaded. ' +\n 'Only @layer statements may come before an @import. ' +\n 'Move the import to the start of the first stylesheet, or add the file as a head module.',\n },\n ];\n });\n}\n","/**\n * Source text normalization shared by every input path (files, in-memory sources, `parseTwee`), and the quoting of\n * source characters in diagnostics.\n */\n\n/**\n * Strip a leading UTF-8 byte order mark and convert CRLF and bare CR line endings to LF.\n * Idempotent, so text that is already normalized passes through unchanged.\n */\nexport function normalizeSourceText(text: string): string {\n const withoutBOM = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;\n return withoutBOM.replace(/\\r\\n?/g, '\\n');\n}\n\n/**\n * The character of `text` at the UTF-16 index `index`, for quoting in a diagnostic: the whole code point where a\n * surrogate pair starts there, and a lone surrogate written as `\\uXXXX`, so that the message stays a well-formed\n * string. Empty past the end of `text`.\n */\nexport function quotableCharacterAt(text: string, index: number): string {\n const cp = text.codePointAt(index);\n return cp === undefined ? '' : escapeLoneSurrogates(String.fromCodePoint(cp));\n}\n\n/** A surrogate that is not part of a pair. */\nconst LONE_SURROGATE = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/g;\n\n/** `text` with each lone surrogate written as `\\uXXXX`: a well-formed string for a diagnostic. */\nexport function escapeLoneSurrogates(text: string): string {\n return text.replace(LONE_SURROGATE, (unit) => `\\\\u${unit.charCodeAt(0).toString(16).toUpperCase()}`);\n}\n","/**\n * IFID (Interactive Fiction IDentifier) generation and validation.\n * Ported from ifid.go.\n */\nimport { randomUUID } from 'node:crypto';\nimport type { IFID } from './types.js';\nimport { quotableCharacterAt } from './source-text.js';\n\n/** Generate a new IFID (UUID v4, uppercase). */\nexport function generateIFID(): IFID {\n return normalizeIFID(randomUUID());\n}\n\n/**\n * Validate and brand an IFID string. Throws on invalid input.\n * Returns the IFID in the form the story model stores: the uppercase bare UUID (a `UUID://…//` wrapper is\n * removed).\n */\nexport function createIFID(value: string): IFID {\n const err = validateIFID(value);\n if (err) throw new Error(`Invalid IFID: ${err}`);\n return normalizeIFID(value);\n}\n\n/** Length of the `UUID://...//` wrapper around a 36-character UUID. */\nconst WRAPPED_LENGTH = 45;\n\n/**\n * Bring an IFID into the form the story model stores and every output writes: the uppercase\n * bare UUID. A valid `UUID://...//` wrapped IFID loses its wrapper; outputs that need the wrapper\n * (the Treaty of Babel comment) add exactly one. Twine 2 IFIDs use only capital letters, so the\n * value is uppercased, as Tweego does. An invalid value is only uppercased, so that validation\n * reports it as written.\n */\nexport function normalizeIFID(value: string): IFID {\n if (isStoredForm(value)) return value;\n // Uppercasing is idempotent for every code point and the bare UUID of a valid wrapped IFID is uppercase\n // hex, so the value passed on is in the stored form and the second call returns it.\n const upper = value.toUpperCase();\n return normalizeIFID(isWrappedIFID(upper) ? upper.slice(7, 43) : upper);\n}\n\n/** Whether `value` is a valid IFID in its `UUID://...//` wrapper. */\nfunction isWrappedIFID(value: string): boolean {\n return value.length === WRAPPED_LENGTH && validateIFID(value) === null;\n}\n\n/**\n * Whether `value` is in the form the story model stores (see {@link normalizeIFID}): it has no lowercase\n * letters and is not a wrapped IFID. This is the one place a string becomes an `IFID`.\n */\nfunction isStoredForm(value: string): value is IFID {\n return value === value.toUpperCase() && !isWrappedIFID(value);\n}\n\n/**\n * Validate an IFID string.\n * Accepts both bare UUIDs and UUID://...// wrapped format.\n * Returns null if valid, or an error message string.\n */\nexport function validateIFID(ifid: string): string | null {\n let uuid = ifid;\n\n switch (ifid.length) {\n case 36:\n break;\n case 45: {\n if (ifid.slice(0, 7).toUpperCase() !== 'UUID://' || ifid.slice(43) !== '//') {\n return 'invalid IFID UUID://...// format';\n }\n uuid = ifid.slice(7, 43);\n break;\n }\n default:\n return `invalid IFID length: ${ifid.length}`;\n }\n\n for (let i = 0; i < uuid.length; i++) {\n const ch = uuid.charAt(i);\n switch (i) {\n case 8:\n case 13:\n case 18:\n case 23:\n if (ch !== '-') {\n return `invalid IFID character '${quotableCharacterAt(uuid, i)}' at position ${i + 1}`;\n }\n break;\n case 14:\n if (ch < '1' || ch > '5') {\n return `invalid version '${quotableCharacterAt(uuid, i)}' at position ${i + 1}`;\n }\n break;\n case 19:\n if (!['8', '9', 'a', 'A', 'b', 'B'].includes(ch)) {\n return `invalid variant '${quotableCharacterAt(uuid, i)}' at position ${i + 1}`;\n }\n break;\n default:\n if (!/^[0-9a-fA-F]$/.test(ch)) {\n return `invalid IFID hex value '${quotableCharacterAt(uuid, i)}' at position ${i + 1}`;\n }\n break;\n }\n }\n\n return null;\n}\n","/**\n * Shared file I/O utilities.\n */\nimport { constants as bufferConstants } from 'node:buffer';\nimport { readFileSync, statSync } from 'node:fs';\nimport { parse as parsePath } from 'node:path';\nimport type { Diagnostic } from './types.js';\nimport { normalizeSourceText } from './source-text.js';\n\n/** Whether `value` is an object other than an array, whose properties can be read by name. */\nexport function isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Append every item to `target` (when there is one), one at a time: spreading them as arguments (`push(...items)`)\n * overflows the call stack once there are more than the engine takes, which input can make happen.\n */\nexport function pushAll<T>(target: T[] | undefined, items: Iterable<T>): void {\n if (target === undefined) return;\n for (const item of items) target.push(item);\n}\n\n/**\n * The known key that `key` most likely stands for: one that differs from it only in letter case, `-` or `_`\n * (`formatID`, `output-mode`), or undefined.\n */\nexport function similarKey(key: string, known: readonly string[]): string | undefined {\n const fold = (k: string): string => k.toLowerCase().replace(/[-_]/g, '');\n return known.find((candidate) => fold(candidate) === fold(key));\n}\n\n/** Text decoded from bytes, with the warning when the bytes were not valid UTF-8. */\nexport interface DecodedText {\n readonly text: string;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** The charset assumed for text that is not valid UTF-8, as Tweego assumes it. */\nconst FALLBACK_CHARSET = 'windows-1252';\n\n/**\n * Throws on invalid UTF-8 instead of replacing bytes with U+FFFD. `ignoreBOM` keeps a leading BOM in the\n * text, as `readFileSync(file, 'utf-8')` did, so {@link normalizeSourceText} strips exactly one.\n */\nconst utf8Decoder = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });\n\n/**\n * The code points of the Windows-1252 bytes 0x80 to 0x9F, from the WHATWG Encoding Standard. The five bytes\n * Windows-1252 leaves undefined map to the C1 control with the same number, as the standard and Go's charmap\n * do. Every other byte is the code point with the same number.\n *\n * Decoded by hand, because Node's `TextDecoder('windows-1252')` decodes as ISO-8859-1 in some releases\n * (Node 22.18 turns 0x80 into U+0080 instead of €), and builds without ICU lack it.\n */\nconst WINDOWS_1252_C1 = [\n 0x20ac, 0x81, 0x201a, 0x192, 0x201e, 0x2026, 0x2020, 0x2021, 0x2c6, 0x2030, 0x160, 0x2039, 0x152, 0x8d, 0x17d, 0x8f,\n 0x90, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x2dc, 0x2122, 0x161, 0x203a, 0x153, 0x9d, 0x17e, 0x178,\n] as const;\n\n/** The character of each byte value. */\nconst WINDOWS_1252_CHARS = Array.from({ length: 256 }, (_, b) =>\n String.fromCharCode(b >= 0x80 && b <= 0x9f ? (WINDOWS_1252_C1[b - 0x80] ?? b) : b),\n);\n\nfunction decodeWindows1252(bytes: Uint8Array): string {\n return Array.from(bytes, (b) => WINDOWS_1252_CHARS[b] ?? '').join('');\n}\n\n/** Byte order marks that name an encoding other than UTF-8. */\nconst UTF16LE_BOM = [0xff, 0xfe] as const;\nconst UTF16BE_BOM = [0xfe, 0xff] as const;\nconst UTF32LE_BOM = [0xff, 0xfe, 0x00, 0x00] as const;\nconst UTF32BE_BOM = [0x00, 0x00, 0xfe, 0xff] as const;\n\nfunction startsWith(bytes: Uint8Array, prefix: readonly number[]): boolean {\n return prefix.every((b, i) => bytes[i] === b);\n}\n\n/** Bytes that cannot be decoded in the encoding their byte order mark names, or name an unsupported one. */\nexport class TextDecodeError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'TextDecodeError';\n }\n}\n\n/** Little-endian UTF-16, which Node decodes without ICU (big-endian needs ICU, so it is swapped first). */\nconst utf16Decoder = new TextDecoder('utf-16le', { fatal: true, ignoreBOM: true });\n\n/** UTF-16 text, its byte order mark kept as for UTF-8; a TextDecodeError naming the file when it is invalid. */\nfunction decodeUTF16(bytes: Uint8Array, bigEndian: boolean, filename: string): string {\n const name = bigEndian ? 'UTF-16BE' : 'UTF-16LE';\n if (bytes.length % 2 !== 0) {\n throw new TextDecodeError(`read ${filename}: Invalid ${name}: an odd number of bytes.`);\n }\n // A swapped copy, so the caller's bytes are left alone.\n const littleEndian = bigEndian ? bytes.map((_, i) => bytes[i ^ 1] ?? 0) : bytes;\n try {\n return utf16Decoder.decode(littleEndian);\n } catch (cause) {\n throw new TextDecodeError(`read ${filename}: Invalid ${name}: an unpaired surrogate.`, { cause });\n }\n}\n\n/**\n * Decode bytes read from `filename` as text:\n *\n * - after a UTF-16 byte order mark (FF FE or FE FF, as PowerShell 5's `>` and Notepad write), as UTF-16; bytes\n * that are not valid UTF-16 throw a {@link TextDecodeError};\n * - after a UTF-32 byte order mark, a {@link TextDecodeError}: UTF-32 is not supported;\n * - otherwise as UTF-8. Bytes that are not valid UTF-8 are decoded as Windows-1252 instead, with a warning naming\n * the file, as Tweego does (`fileReadAllWithEncoding` in io.go), so a legacy file keeps its non-ASCII\n * characters instead of losing them to U+FFFD.\n *\n * The text is returned as decoded: a leading BOM and CR line endings are kept (see {@link normalizeSourceText}).\n * More bytes than a string holds characters throw an `ERR_FS_FILE_TOO_LARGE` error.\n */\nexport function decodeText(bytes: Uint8Array, filename: string): DecodedText {\n checkTextSize(bytes.length, MAX_STRING_LENGTH);\n if (startsWith(bytes, UTF32LE_BOM) || startsWith(bytes, UTF32BE_BOM)) {\n throw new TextDecodeError(`read ${filename}: UTF-32 text is not supported; save the file as UTF-8.`);\n }\n if (startsWith(bytes, UTF16LE_BOM)) return { text: decodeUTF16(bytes, false, filename), diagnostics: [] };\n if (startsWith(bytes, UTF16BE_BOM)) return { text: decodeUTF16(bytes, true, filename), diagnostics: [] };\n try {\n return { text: utf8Decoder.decode(bytes), diagnostics: [] };\n } catch {\n return {\n text: decodeWindows1252(bytes),\n diagnostics: [\n {\n level: 'warning',\n message: `read ${filename}: Invalid UTF-8; assuming charset is ${FALLBACK_CHARSET}.`,\n file: filename,\n },\n ],\n };\n }\n}\n\n/**\n * Read a text file: decode it with {@link decodeText} (UTF-16 after a UTF-16 byte order mark, else UTF-8, or\n * Windows-1252 when it is not valid UTF-8), strip a leading BOM and convert CRLF and bare CR line endings to LF.\n * This is the one path every file read as text goes through: sources, modules, the head file, story formats and\n * the config file.\n *\n * @param diagnostics Receives the warning when the file is not valid UTF-8. Without it, the file is decoded\n * the same way and the warning is dropped.\n * @throws When the file cannot be read or is larger than a string can hold (`ERR_FS_FILE_TOO_LARGE`), or a\n * {@link TextDecodeError} when it cannot be decoded.\n */\nexport function readUTF8(filename: string, diagnostics?: Diagnostic[]): string {\n // Checked before reading, so a file too large to hold as text fails at once rather than after reading it.\n checkTextSize(statSync(filename).size, MAX_STRING_LENGTH);\n const decoded = decodeText(readFileSync(filename), filename);\n pushAll(diagnostics, decoded.diagnostics);\n return normalizeSourceText(decoded.text);\n}\n\n/** Read a file as base64. */\nexport function readBase64(filename: string): string {\n // Base64 writes 4 characters for every 3 bytes.\n checkTextSize(statSync(filename).size, Math.floor(MAX_STRING_LENGTH / 4) * 3, ' as base64');\n return readFileSync(filename).toString('base64');\n}\n\n/** The most UTF-16 code units a JavaScript string holds in this engine (2^29 - 24 in V8). */\nexport const MAX_STRING_LENGTH = bufferConstants.MAX_STRING_LENGTH;\n\n/**\n * Throws, as Node.js does for a file too large to read (`ERR_FS_FILE_TOO_LARGE`), when `size` bytes are more than\n * `limit`: text decoded from more bytes than a string holds code units may not fit in one (UTF-8 and Windows-1252\n * give at most one code unit per byte), and the engine's own error would not say so.\n */\nfunction checkTextSize(size: number, limit: number, as = ''): void {\n if (size <= limit) return;\n const error = new Error(\n `File size (${String(size)} bytes) is greater than the ${String(limit)} bytes twee-ts can read${as}, ` +\n `as a JavaScript string holds at most ${String(MAX_STRING_LENGTH)} characters`,\n );\n throw Object.assign(error, { code: 'ERR_FS_FILE_TOO_LARGE' });\n}\n\n/**\n * The base name of a file up to its first dot, as Tweego names media passages and font families\n * (`strings.Split(filepath.Base(filename), \".\")[0]`): `bg.night.png` gives `bg`. A name that starts with dots\n * keeps them and ends at the next dot (`.hidden.png` gives `.hidden`), where Tweego would give an empty name.\n */\nexport function fileStem(filename: string): string {\n const base = parsePath(filename).base;\n let leadingDots = 0;\n while (base[leadingDots] === '.') leadingDots++;\n const dot = base.indexOf('.', leadingDots);\n return dot === -1 ? base : base.slice(0, dot);\n}\n","/**\n * HTML, attribute, tiddler, and twee escaping/unescaping utilities.\n * Ported from escaping.go.\n *\n * The HTML escapers also write a carriage return as the character reference `&#13;`: the HTML parser turns a raw\n * CR (and CRLF) into a line feed before tokenizing, but keeps the CR of a reference, in text and attribute values.\n */\nimport type { CssContext, JavaScriptContext } from './code-context.js';\nimport { pushAll } from './util.js';\n\n/** The character references the HTML escapers write; any other character is written as a numeric reference. */\nconst HTML_REFERENCES: Readonly<Record<string, string>> = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;',\n};\n\nfunction reference(ch: string): string {\n return HTML_REFERENCES[ch] ?? `&#${ch.charCodeAt(0)};`;\n}\n\n/** Escape the minimum characters required for HTML attribute values. */\nexport function attrEscape(s: string): string {\n return s.replace(/[&\"'\\r]/g, reference);\n}\n\n/** Escape for HTML attribute values including < and > (for spec-compliant output). */\nexport function fullAttrEscape(s: string): string {\n return htmlEscape(s);\n}\n\n/** Escape the minimum characters required for general HTML content. */\nexport function htmlEscape(s: string): string {\n return s.replace(/[&<>\"'\\r]/g, reference);\n}\n\n/** The escapes of the Twine 1 tiddler format, before the HTML escaping of the rest. */\nconst TIDDLER_ESCAPES: Readonly<Record<string, string>> = { '\\\\': '\\\\s', '\\t': '\\\\t', '\\n': '\\\\n' };\n\n/** Escape for Twine 1 tiddler format. */\nexport function tiddlerEscape(s: string): string {\n return s.replace(/[\\\\\\t\\n&<>\"\\r]/g, (ch) => TIDDLER_ESCAPES[ch] ?? reference(ch));\n}\n\n/**\n * Where a value is written into an HTML document, as parse5 reports it for the place it is written (see\n * `html-structure.ts`). The escaper for each context keeps the value the document's reader gets there.\n */\nexport type InsertionContext =\n /**\n * Text whose character references are decoded: element text, RCDATA (`title`, `textarea`), and the fallback\n * content of `noscript`, `iframe`, `noembed` and `noframes`, shown as HTML where the feature is off.\n * `dropsLeadingNewline` for the start of a `pre`, `listing` or `textarea` element, where the parser drops a line\n * feed (even one written as a character reference).\n */\n | { readonly kind: 'text'; readonly dropsLeadingNewline: boolean }\n /** An attribute value. `url` for an attribute whose value is a URL (`href`, `src`, …). */\n | { readonly kind: 'attribute'; readonly quote: '\"' | \"'\" | ''; readonly url: boolean }\n | { readonly kind: 'comment' }\n /**\n * The text of a JavaScript `script` element (`module` for a module script). `escapable` when the script text\n * before the value holds a `<!--`, so that the HTML tokenizer may be in a script data escaped state there.\n */\n | { readonly kind: 'script'; readonly module: boolean; readonly js: JavaScriptContext; readonly escapable: boolean }\n /** The text of a JSON data block (`<script type=\"application/json\">` and other `+json` types). */\n | { readonly kind: 'json'; readonly js: JavaScriptContext; readonly escapable: boolean }\n /** The text of a `style` element. */\n | { readonly kind: 'style'; readonly css: CssContext }\n /**\n * Text that is neither decoded nor read by anything twee-ts can escape for: another data block (`script` of a\n * non-JavaScript type), `xmp`, `plaintext`, and CDATA sections in SVG or MathML.\n */\n | { readonly kind: 'raw-text'; readonly element: string }\n /** Inside a tag (a tag or attribute name) or a doctype, or in a token the parser drops. */\n | { readonly kind: 'markup' };\n\n/**\n * Escape `value` for `context`, so that the reader of that place gets `value`, or `undefined` for a context where no\n * escaping can do that. In a comment the value is not readable, so it is only kept from ending the comment.\n *\n * - text and quoted attribute values: `htmlEscape()` (the escaping Twine 2 gives the story name everywhere);\n * unquoted attribute values also escape whitespace, `=` and `` ` ``, and must not be empty; a URL attribute\n * value is percent-encoded first (`encodeURIComponent()`), so that it stays one URL component.\n * - JavaScript strings and template literals: the Twine 2 HTML escaping is kept (SugarCube reads the story name\n * back with `Util.unescape()`), and `\\`, line breaks, U+2028 and U+2029 (and `` ` `` and `$` in a template) are\n * escaped for JavaScript, so the literal is still valid and holds the HTML-escaped value.\n * - JSON strings and CSS strings: escaped for JSON or CSS only (nothing there decodes HTML references), with `<`\n * escaped so that no `</script` or `</style` can end the element.\n */\nexport function escapeForContext(value: string, context: InsertionContext): string | undefined {\n switch (context.kind) {\n case 'text':\n return htmlEscape(value);\n case 'attribute': {\n const text = context.url ? encodeURIComponent(value.toWellFormed()) : value;\n if (context.quote !== '') return htmlEscape(text);\n return text.length === 0 ? undefined : unquotedAttrEscape(text);\n }\n case 'comment':\n return htmlCommentTextEscape(value);\n case 'script':\n return escapeForJavaScript(value, context.js);\n case 'json':\n return context.js.kind === 'string' && context.js.quote === '\"' ? jsonStringEscape(value) : undefined;\n case 'style':\n // In CSS code outside a string or comment, no escaping keeps the value.\n if (context.css.kind === 'string')\n return cssStringEscape(value).replace(/['<]/g, (ch) => (ch === '<' ? '\\\\3c ' : \"\\\\'\"));\n return context.css.kind === 'comment' ? htmlEscape(value).replace(/\\*\\//g, '* /') : undefined;\n case 'raw-text':\n case 'markup':\n return undefined;\n default: {\n const _exhaustive: never = context;\n throw new Error(`Unhandled insertion context: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n\n/**\n * Escape for a JavaScript string, template literal or comment. In a regular expression, in code outside literals, or\n * in source acorn cannot read, no escaping keeps the value.\n */\nfunction escapeForJavaScript(value: string, context: JavaScriptContext): string | undefined {\n if (context.kind === 'string') return htmlEscape(javaScriptStringBodyEscape(value));\n if (context.kind === 'template') return htmlEscape(javaScriptStringBodyEscape(value).replace(/[`$]/g, '\\\\$&'));\n if (context.kind === 'block-comment') return htmlEscape(value).replace(/\\*\\//g, '* /');\n return context.kind === 'line-comment' ? htmlEscape(value).replace(/[\\n\\r\\u2028\\u2029]/g, ' ') : undefined;\n}\n\n/**\n * Escape `\\`, line breaks, U+2028 and U+2029 for the inside of a JavaScript string or template literal, as `\\uXXXX`\n * (which every literal reads the same way).\n */\nfunction javaScriptStringBodyEscape(s: string): string {\n return s.replace(/[\\\\\\n\\r\\u2028\\u2029]/g, (ch) => `\\\\u${ch.charCodeAt(0).toString(16).padStart(4, '0')}`);\n}\n\n/** Escape for an unquoted attribute value: `htmlEscape()`, and whitespace, `=` and `` ` `` as references. */\nfunction unquotedAttrEscape(s: string): string {\n return htmlEscape(s).replace(/[\\t\\n\\f =`]/g, (ch) => `&#${ch.charCodeAt(0)};`);\n}\n\n/**\n * Escape text for the inside of an HTML comment: `htmlEscape()`, so it holds no `>` that could end the comment, and\n * `-` as `&#45;` where it starts or ends the text or is followed by another, so it forms no `--` with the text\n * around it.\n */\nfunction htmlCommentTextEscape(s: string): string {\n return htmlEscape(s).replace(/^-|-(?=-)|-$/g, '&#45;');\n}\n\n/** Escape for the inside of a double-quoted JSON string written into a `script` element. */\nfunction jsonStringEscape(s: string): string {\n return JSON.stringify(s)\n .slice(1, -1)\n .replace(/[<\\u2028\\u2029]/g, (ch) => `\\\\u${ch.charCodeAt(0).toString(16).padStart(4, '0')}`);\n}\n\n/** Unescape from Twine 1 tiddler format. */\nexport function tiddlerUnescape(s: string): string {\n if (s.length === 0) return s;\n return s.replace(/\\\\n/g, '\\n').replace(/\\\\t/g, '\\t').replace(/\\\\s/g, '\\\\');\n}\n\nconst JS_STRING_ESCAPES: Readonly<Record<string, string>> = {\n '\\\\': '\\\\\\\\',\n '\"': '\\\\\"',\n \"'\": \"\\\\'\",\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',\n '<': '\\\\x3C',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n};\n\n/**\n * Escape a string for the inside of a single- or double-quoted JavaScript string literal, including one written\n * into an HTML `<script>` element. Besides backslashes, quotes and line breaks (with U+2028 and U+2029, which end\n * a string literal in JavaScript before ES2019), every `<` becomes `\\x3C`, so the literal holds no `</script`\n * that would end the element and no `<!--` or `<script` that would change where it ends. The string's value is\n * unchanged.\n */\nexport function jsStringEscape(s: string): string {\n if (s.length === 0) return s;\n return s.replace(/[\\\\\"'\\n\\r\\t<\\u2028\\u2029]/g, (ch) => JS_STRING_ESCAPES[ch] ?? ch);\n}\n\n/**\n * Escape a string for the inside of a double-quoted CSS string (such as a `font-family` name): `\\` and `\"` get\n * a backslash, and line breaks and other control characters become hex escapes followed by a space (`\\a ` for a\n * line feed), since a raw line break ends a CSS string and a backslash before one is a line continuation.\n */\nexport function cssStringEscape(s: string): string {\n if (s.length === 0) return s;\n return s.replace(/[\\\\\"\\u0000-\\u001f\\u007f]/g, (ch) =>\n ch === '\\\\' || ch === '\"' ? `\\\\${ch}` : `\\\\${ch.charCodeAt(0).toString(16)} `,\n );\n}\n\n/** Sanitize a string for safe inclusion in a CSS or JS block comment. */\nexport function commentSanitize(s: string): string {\n return s.replace(/\\*\\//g, '* /');\n}\n\n/** Sanitize a string for safe inclusion in an HTML comment: break up `-->` and `--!>`, which both end one. */\nexport function htmlCommentSanitize(s: string): string {\n return s.replace(/--(!?)>/g, '--$1 >');\n}\n\n/**\n * Escape JavaScript for the content of an HTML `<script>` element, so that the HTML parser reads all of it as\n * the element's text and ends the element at the end tag written after it.\n *\n * - Every `</script` (in any letter case) becomes `<\\/script`. HTML ends a script element at the first\n * `</script` followed by whitespace, `/` or `>`, wherever it is in the JavaScript, even inside a string.\n * - Every `<!--` becomes `<\\!--`, but only if the text would otherwise end in the HTML tokenizer's \"script\n * data double escaped\" state: after a `<!--` and then a `<script` start tag with no `-->` between them, the\n * end tag after the text would not end the element.\n *\n * Inserting a backslash after `<` keeps the value of every string, template, and regular expression literal\n * and every comment where these sequences can be written (`\\/` and `\\!` are identity escapes; a backslash\n * already before the `<` escapes the `<`, as it did before); `<\\/script` is also how minifiers such as Terser\n * write inline scripts. It only changes code that uses them outside literals (`a </script/ b`, an HTML-like `<!--`\n * comment that is escaped because of a later `<script`), the raw text of a tagged template, and a `<!--` in a\n * regular expression with the `u` or `v` flag. The result is unchanged by escaping it again.\n */\nexport function scriptContentEscape(s: string): string {\n const escaped = s.replace(/<(?=\\/script)/gi, '<\\\\');\n return endsDoubleEscaped(escaped) ? escaped.replace(/<(?=!--)/g, '<\\\\') : escaped;\n}\n\n/** A place where `scriptContentEscape()` or `styleContentEscape()` writes a backslash after a `<`. */\nexport interface EscapeSite {\n /** The offset of the `<` in the unescaped text. */\n readonly offset: number;\n /** The sequence escaped there: `</script`, `</style` (in any letter case) or `<!--`. */\n readonly sequence: string;\n}\n\n/** The places where `scriptContentEscape(s)` writes a backslash, in order. */\nexport function scriptEscapeSites(s: string): EscapeSite[] {\n const sites = [...s.matchAll(/<\\/script/gi)].map((m) => ({ offset: m.index, sequence: m[0] }));\n if (endsDoubleEscaped(s.replace(/<(?=\\/script)/gi, '<\\\\'))) {\n pushAll(\n sites,\n [...s.matchAll(/<!--/g)].map((m) => ({ offset: m.index, sequence: m[0] })),\n );\n }\n return sites.sort((a, b) => a.offset - b.offset);\n}\n\n/** The places where `styleContentEscape(s)` writes a backslash, in order. */\nexport function styleEscapeSites(s: string): EscapeSite[] {\n return [...s.matchAll(/<\\/style/gi)].map((m) => ({ offset: m.index, sequence: m[0] }));\n}\n\n/**\n * Whether the HTML tokenizer, reading `s` as script element content with no `</script` in it, ends in the\n * \"script data double escaped\" state, where an end tag after `s` would not end the element.\n * See https://html.spec.whatwg.org/multipage/parsing.html#script-data-escaped-state.\n */\nfunction endsDoubleEscaped(s: string): boolean {\n const scriptStartTag = /<script[\\t\\n\\f\\r />]/gi;\n // The first `<script` start tag at or after an offset. Offsets only grow, so a match found from an earlier offset\n // is still the first one while it lies at or after the new one, and no match stays no match: each part of `s` is\n // searched once, which keeps the whole walk linear.\n let found: RegExpExecArray | null | undefined;\n const scriptStartFrom = (from: number): RegExpExecArray | null => {\n if (found === null || (found !== undefined && found.index >= from)) return found;\n scriptStartTag.lastIndex = from;\n found = scriptStartTag.exec(s);\n return found;\n };\n let pos = 0;\n for (;;) {\n // Script data: a `<!--` enters the escaped state.\n const open = s.indexOf('<!--', pos);\n if (open === -1) return false;\n // Escaped: a `-->` leaves it (the dashes of `<!--` count, so `<!-->` leaves at once); a `<script` start\n // tag enters the double escaped state.\n const escapedFrom = open + 2;\n const close = s.indexOf('-->', escapedFrom);\n const start = scriptStartFrom(escapedFrom);\n if (start === null || (close !== -1 && close < start.index)) {\n if (close === -1) return false;\n pos = close + 3;\n continue;\n }\n // Double escaped: only a `</script` (none are left) or a `-->` leaves it.\n const end = s.indexOf('-->', start.index + start[0].length);\n if (end === -1) return true;\n pos = end + 3;\n }\n}\n\n/**\n * Escape CSS for the content of an HTML `<style>` element: every `</style` (in any letter case) becomes\n * `<\\/style`, since HTML ends a style element at the first `</style` followed by whitespace, `/` or `>`.\n * `\\/` stands for `/` in CSS strings and URLs, and comments don't matter; `</style` anywhere else isn't valid\n * CSS anyway.\n */\nexport function styleContentEscape(s: string): string {\n return s.replace(/<(?=\\/style)/gi, '<\\\\');\n}\n\n/** Apply ROT13 encoding to a string (only affects [A-Za-z]). */\nexport function rot13(s: string): string {\n if (s.length === 0) return s;\n return s.replace(/[A-Za-z]/g, (ch) => {\n const base = ch <= 'Z' ? 65 : 97;\n return String.fromCharCode(((ch.charCodeAt(0) - base + 13) % 26) + base);\n });\n}\n","/**\n * The rules of Twee notation that more than one part of twee-ts needs: what whitespace is, how names and tags\n * are escaped, which line is a passage header, and how source text is normalized before it is read. The\n * reader (`lexer.ts`, `parser.ts`) and the writer (`output-twee.ts`, which checks its output by reading it\n * back with the reader) both use only these, so the two cannot disagree.\n *\n * Twee semantics follow Tweego (Go): whitespace is Go's `unicode.IsSpace`, trimming is `bytes.TrimSpace` and\n * splitting tags is `strings.Fields`. The intended differences from Tweego are listed in\n * docs/tweego-differences.md.\n */\n\n// --- Whitespace ---\n\n/**\n * Whether a UTF-16 code unit is white space as Go's `unicode.IsSpace` defines it: tab, line feed, vertical\n * tab, form feed, carriage return, space, U+0085 (NEL), U+00A0 (NBSP), and the other Unicode White_Space\n * characters (U+1680, U+2000–U+200A, U+2028, U+2029, U+202F, U+205F, U+3000). All of them are in the Basic\n * Multilingual Plane, so a surrogate is never white space.\n *\n * This differs from JavaScript's `\\s` and `String.prototype.trim()`, which include U+FEFF and leave out\n * U+0085.\n */\nexport function isTweeSpace(unit: number): boolean {\n if (unit <= 0xff) {\n return (unit >= 0x09 && unit <= 0x0d) || unit === 0x20 || unit === 0x85 || unit === 0xa0;\n }\n return (\n unit === 0x1680 ||\n (unit >= 0x2000 && unit <= 0x200a) ||\n unit === 0x2028 ||\n unit === 0x2029 ||\n unit === 0x202f ||\n unit === 0x205f ||\n unit === 0x3000\n );\n}\n\n/** `s` without white space (see `isTweeSpace`) at either end, as Go's `bytes.TrimSpace`. */\nexport function trimTweeSpace(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && isTweeSpace(s.charCodeAt(start))) start++;\n while (end > start && isTweeSpace(s.charCodeAt(end - 1))) end--;\n return s.slice(start, end);\n}\n\n/** The runs of non-white-space characters in `s` (see `isTweeSpace`), as Go's `strings.Fields`. */\nexport function splitTweeFields(s: string): string[] {\n const fields: string[] = [];\n let start = -1;\n for (let i = 0; i <= s.length; i++) {\n const space = i === s.length || isTweeSpace(s.charCodeAt(i));\n if (space && start !== -1) {\n fields.push(s.slice(start, i));\n start = -1;\n } else if (!space && start === -1) {\n start = i;\n }\n }\n return fields;\n}\n\n/** Whether `s` is one tag as a Twee header reads it: not empty and without white space (see `isTweeSpace`). */\nexport function isTweeTag(s: string): boolean {\n return (\n s.length > 0 &&\n splitTweeFields(s).length === 1 &&\n !isTweeSpace(s.charCodeAt(0)) &&\n !isTweeSpace(s.charCodeAt(s.length - 1))\n );\n}\n\n// --- Escaping in passage headers ---\n\n/**\n * Escape a passage name or tag list for a Twee 3 header: a backslash goes before each `\\`, `[`, `]`, `{` and\n * `}` (Tweego's `tweeEscapeString`).\n */\nexport function tweeEscape(s: string): string {\n return s.replace(/[\\\\[\\]{}]/g, (ch) => '\\\\' + ch);\n}\n\nexport interface Unescaped {\n readonly text: string;\n /** Whether `s` ended in a backslash that escapes nothing; it is dropped, as in Tweego. */\n readonly danglingBackslash: boolean;\n}\n\n/**\n * Unescape a passage name or tag list from a Twee header: a backslash yields the character after it, whatever\n * it is (the Twee 3 specification: `\\q` yields `q`). A backslash at the very end escapes nothing and is\n * dropped, as Tweego's `tweeUnescapeBytes` drops it; `danglingBackslash` says so, so the caller can warn.\n */\nexport function tweeUnescape(s: string): Unescaped {\n let text = '';\n let chunk = 0;\n for (let i = s.indexOf('\\\\'); i !== -1; i = s.indexOf('\\\\', i + 2)) {\n text += s.slice(chunk, i);\n if (i + 1 >= s.length) return { text, danglingBackslash: true };\n chunk = i + 1;\n }\n return { text: text + s.slice(chunk), danglingBackslash: false };\n}\n\n// --- Passage headers and source text ---\n\n/** The delimiter that starts a passage header line. */\nconst HEADER_DELIMITER = '::';\n\n/** Byte order marks at the start of the text, or at the start of a line directly before a header's `::`. */\nconst BOMS_TO_REMOVE = /^\\ufeff+|(?<=\\n)\\ufeff+(?=::)/g;\n\n/**\n * Normalize Twee source text before it is read: CRLF and CR line endings become LF, the byte order marks at\n * the start of the text are removed, and so are those at the start of a later line that are directly followed\n * by `::`. Concatenating files (`cat a.tw b.tw`) leaves the BOM of every later file in front of its first\n * passage header, which would otherwise not be read as a header. (Tweego removes only the BOM at the start of\n * a file; this is an intended difference.) A U+FEFF anywhere else is passage text and kept. Idempotent.\n */\nexport function normalizeTweeSource(text: string): string {\n return text.replace(/\\r\\n?/g, '\\n').replace(BOMS_TO_REMOVE, '');\n}\n\n/** The lines of `text`, split at LF, CRLF and CR, as normalization ends them. */\nexport function sourceLines(text: string): string[] {\n return text.split(/\\r\\n?|\\n/);\n}\n\n/**\n * Whether a line of source text reads as a passage header: it starts with `::`, after any byte order marks\n * (which normalization removes there; see `normalizeTweeSource`).\n */\nexport function isHeaderLine(line: string): boolean {\n let i = 0;\n while (line.charCodeAt(i) === 0xfeff) i++;\n return line.startsWith(HEADER_DELIMITER, i);\n}\n\n/**\n * Remove the trailing blank lines of passage content, which the Twee 3 specification requires a reader to drop\n * even when it does not trim: the lines after the last line that holds anything but white space (see\n * `isTweeSpace`). Content that is all white space becomes empty. Leading white space and the white space at\n * the end of the last line with content are kept. Linear time.\n */\nexport function stripTrailingBlankLines(text: string): string {\n let last = text.length - 1;\n while (last >= 0 && isTweeSpace(text.charCodeAt(last))) last--;\n if (last < 0) return '';\n const lineEnd = text.indexOf('\\n', last);\n return lineEnd === -1 ? text : text.slice(0, lineEnd);\n}\n","// This file was generated. Do not modify manually!\nvar astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 31, 4, 33, 15, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 7, 0, 259, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 481, 1, 61, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 12, 2, 9, 1, 3, 0, 33, 1, 1357, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];\n\n// This file was generated. Do not modify manually!\nvar astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 13, 65, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 18, 21, 18, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 18, 0, 182, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 22, 0, 239, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 111, 6, 206, 13, 310, 2314, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7386, 37, 33, 96, 114, 14, 913, 15, 50, 7710, 3, 2, 6, 2, 1, 2, 296, 10, 0, 30, 2, 3, 0, 15, 4, 8, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 340, 2, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 129, 15, 6, 55, 50, 49, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4382, 2, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489, 39815, 11327];\n\n// This file was generated. Do not modify manually!\nvar nonASCIIidentifierChars = \"\\u200c\\u200d\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7-\\u05c9\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u07fd\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u0897-\\u089f\\u08ca-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u09fe\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0afa-\\u0aff\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b53-\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c04\\u0c3c\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0cf3\\u0d00-\\u0d03\\u0d3b\\u0d3c\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d81-\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0ebc\\u0ec8-\\u0ece\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u180f-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1abf-\\u1af0\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf4\\u1cf7-\\u1cf9\\u1dc0-\\u1dff\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\u30fb\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua82c\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua8ff-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\\uff65\";\n\n// This file was generated. Do not modify manually!\nvar nonASCIIidentifierStartChars = \"\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0558\\u0559\\u0560-\\u0588\\u058b\\u058c\\u05d0-\\u05ea\\u05ef-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086a\\u0870-\\u0887\\u0889-\\u088f\\u08a0-\\u08c9\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09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e86-\\u0e8a\\u0e8c-\\u0ea3\\u0ea5\\u0ea7-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u1711\\u171f-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1878\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4c\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c8a\\u1c90-\\u1cba\\u1cbd-\\u1cbf\\u1ce9-\\u1cec\\u1cee-\\u1cf3\\u1cf5\\u1cf6\\u1cfa\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u208f-\\u209f\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u31a0-\\u31bf\\u31f0-\\u31ff\\u3400-\\u4dbf\\u4e00-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7dd\\ua7e2\\ua7f1-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua8fe\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab69\\uab6c\\uab6d\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\";\n\n// These are a run-length and offset encoded representation of the\n// >0xffff code points that are a valid part of identifiers. The\n// offset starts at 0x10000, and each pair of numbers represents an\n// offset to the next range, and then a size of the range.\n\n// Reserved word lists for various dialects of the language\n\nvar reservedWords = {\n 3: \"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile\",\n 5: \"class enum extends super const export import\",\n 6: \"enum\",\n strict: \"implements interface let package private protected public static yield\",\n strictBind: \"eval arguments\"\n};\n\n// And the keywords\n\nvar ecma5AndLessKeywords = \"break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this\";\n\nvar keywords$1 = {\n 5: ecma5AndLessKeywords,\n \"5module\": ecma5AndLessKeywords + \" export import\",\n 6: ecma5AndLessKeywords + \" const class extends export import super\"\n};\n\nvar keywordRelationalOperator = /^in(stanceof)?$/;\n\n// ## Character categories\n\nvar nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\");\nvar nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\");\n\n// This has a complexity linear to the value of the code. The\n// assumption is that looking up astral identifier characters is\n// rare.\nfunction isInAstralSet(code, set) {\n var pos = 0x10000;\n for (var i = 0; i < set.length; i += 2) {\n pos += set[i];\n if (pos > code) { return false }\n pos += set[i + 1];\n if (pos >= code) { return true }\n }\n return false\n}\n\n// Test whether a given character code starts an identifier.\n\nfunction isIdentifierStart(code, astral) {\n if (code < 65) { return code === 36 }\n if (code < 91) { return true }\n if (code < 97) { return code === 95 }\n if (code < 123) { return true }\n if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }\n if (astral === false) { return false }\n return isInAstralSet(code, astralIdentifierStartCodes)\n}\n\n// Test whether a given character is part of an identifier.\n\nfunction isIdentifierChar(code, astral) {\n if (code < 48) { return code === 36 }\n if (code < 58) { return true }\n if (code < 65) { return false }\n if (code < 91) { return true }\n if (code < 97) { return code === 95 }\n if (code < 123) { return true }\n if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }\n if (astral === false) { return false }\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)\n}\n\n// ## Token types\n\n// The assignment of fine-grained, information-carrying type objects\n// allows the tokenizer to store the information it has about a\n// token in a way that is very cheap for the parser to look up.\n\n// All token type variables start with an underscore, to make them\n// easy to recognize.\n\n// The `beforeExpr` property is used to disambiguate between regular\n// expressions and divisions. It is set on all token types that can\n// be followed by an expression (thus, a slash after them would be a\n// regular expression).\n//\n// The `startsExpr` property is used to check if the token ends a\n// `yield` expression. It is set on all token types that either can\n// directly start an expression (like a quotation mark) or can\n// continue an expression (like the body of a string).\n//\n// `isLoop` marks a keyword as starting a loop, which is important\n// to know when parsing a label, in order to allow or disallow\n// continue jumps to that label.\n\nvar TokenType = function TokenType(label, conf) {\n if ( conf === void 0 ) conf = {};\n\n this.label = label;\n this.keyword = conf.keyword;\n this.beforeExpr = !!conf.beforeExpr;\n this.startsExpr = !!conf.startsExpr;\n this.isLoop = !!conf.isLoop;\n this.isAssign = !!conf.isAssign;\n this.prefix = !!conf.prefix;\n this.postfix = !!conf.postfix;\n this.binop = conf.binop || null;\n this.updateContext = null;\n};\n\nfunction binop(name, prec) {\n return new TokenType(name, {beforeExpr: true, binop: prec})\n}\nvar beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};\n\n// Map keyword names to token types.\n\nvar keywords = {};\n\n// Succinct definitions of keyword token types\nfunction kw(name, options) {\n if ( options === void 0 ) options = {};\n\n options.keyword = name;\n return keywords[name] = new TokenType(name, options)\n}\n\nvar types$1 = {\n num: new TokenType(\"num\", startsExpr),\n regexp: new TokenType(\"regexp\", startsExpr),\n string: new TokenType(\"string\", startsExpr),\n name: new TokenType(\"name\", startsExpr),\n privateId: new TokenType(\"privateId\", startsExpr),\n eof: new TokenType(\"eof\"),\n\n // Punctuation token types.\n bracketL: new TokenType(\"[\", {beforeExpr: true, startsExpr: true}),\n bracketR: new TokenType(\"]\"),\n braceL: new TokenType(\"{\", {beforeExpr: true, startsExpr: true}),\n braceR: new TokenType(\"}\"),\n parenL: new TokenType(\"(\", {beforeExpr: true, startsExpr: true}),\n parenR: new TokenType(\")\"),\n comma: new TokenType(\",\", beforeExpr),\n semi: new TokenType(\";\", beforeExpr),\n colon: new TokenType(\":\", beforeExpr),\n dot: new TokenType(\".\"),\n question: new TokenType(\"?\", beforeExpr),\n questionDot: new TokenType(\"?.\"),\n arrow: new TokenType(\"=>\", beforeExpr),\n template: new TokenType(\"template\"),\n invalidTemplate: new TokenType(\"invalidTemplate\"),\n ellipsis: new TokenType(\"...\", beforeExpr),\n backQuote: new TokenType(\"`\", startsExpr),\n dollarBraceL: new TokenType(\"${\", {beforeExpr: true, startsExpr: true}),\n\n // Operators. These carry several kinds of properties to help the\n // parser use them properly (the presence of these properties is\n // what categorizes them as operators).\n //\n // `binop`, when present, specifies that this operator is a binary\n // operator, and will refer to its precedence.\n //\n // `prefix` and `postfix` mark the operator as a prefix or postfix\n // unary operator.\n //\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\n // binary operators with a very low precedence, that should result\n // in AssignmentExpression nodes.\n\n eq: new TokenType(\"=\", {beforeExpr: true, isAssign: true}),\n assign: new TokenType(\"_=\", {beforeExpr: true, isAssign: true}),\n incDec: new TokenType(\"++/--\", {prefix: true, postfix: true, startsExpr: true}),\n prefix: new TokenType(\"!/~\", {beforeExpr: true, prefix: true, startsExpr: true}),\n logicalOR: binop(\"||\", 1),\n logicalAND: binop(\"&&\", 2),\n bitwiseOR: binop(\"|\", 3),\n bitwiseXOR: binop(\"^\", 4),\n bitwiseAND: binop(\"&\", 5),\n equality: binop(\"==/!=/===/!==\", 6),\n relational: binop(\"</>/<=/>=\", 7),\n bitShift: binop(\"<</>>/>>>\", 8),\n plusMin: new TokenType(\"+/-\", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),\n modulo: binop(\"%\", 10),\n star: binop(\"*\", 10),\n slash: binop(\"/\", 10),\n starstar: new TokenType(\"**\", {beforeExpr: true}),\n coalesce: binop(\"??\", 1),\n\n // Keyword token types.\n _break: kw(\"break\"),\n _case: kw(\"case\", beforeExpr),\n _catch: kw(\"catch\"),\n _continue: kw(\"continue\"),\n _debugger: kw(\"debugger\"),\n _default: kw(\"default\", beforeExpr),\n _do: kw(\"do\", {isLoop: true, beforeExpr: true}),\n _else: kw(\"else\", beforeExpr),\n _finally: kw(\"finally\"),\n _for: kw(\"for\", {isLoop: true}),\n _function: kw(\"function\", startsExpr),\n _if: kw(\"if\"),\n _return: kw(\"return\", beforeExpr),\n _switch: kw(\"switch\"),\n _throw: kw(\"throw\", beforeExpr),\n _try: kw(\"try\"),\n _var: kw(\"var\"),\n _const: kw(\"const\"),\n _while: kw(\"while\", {isLoop: true}),\n _with: kw(\"with\"),\n _new: kw(\"new\", {beforeExpr: true, startsExpr: true}),\n _this: kw(\"this\", startsExpr),\n _super: kw(\"super\", startsExpr),\n _class: kw(\"class\", startsExpr),\n _extends: kw(\"extends\", beforeExpr),\n _export: kw(\"export\"),\n _import: kw(\"import\", startsExpr),\n _null: kw(\"null\", startsExpr),\n _true: kw(\"true\", startsExpr),\n _false: kw(\"false\", startsExpr),\n _in: kw(\"in\", {beforeExpr: true, binop: 7}),\n _instanceof: kw(\"instanceof\", {beforeExpr: true, binop: 7}),\n _typeof: kw(\"typeof\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _void: kw(\"void\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _delete: kw(\"delete\", {beforeExpr: true, prefix: true, startsExpr: true})\n};\n\n// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\n\nvar lineBreak = /\\r\\n?|\\n|\\u2028|\\u2029/;\nvar lineBreakG = new RegExp(lineBreak.source, \"g\");\n\nfunction isNewLine(code) {\n return code === 10 || code === 13 || code === 0x2028 || code === 0x2029\n}\n\nfunction nextLineBreak(code, from, end) {\n if ( end === void 0 ) end = code.length;\n\n for (var i = from; i < end; i++) {\n var next = code.charCodeAt(i);\n if (isNewLine(next))\n { return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1 }\n }\n return -1\n}\n\nvar nonASCIIwhitespace = /[\\u1680\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/;\n\nvar skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g;\n\nvar ref = Object.prototype;\nvar hasOwnProperty = ref.hasOwnProperty;\nvar toString = ref.toString;\n\nvar hasOwn = Object.hasOwn || (function (obj, propName) { return (\n hasOwnProperty.call(obj, propName)\n); });\n\nvar isArray = Array.isArray || (function (obj) { return (\n toString.call(obj) === \"[object Array]\"\n); });\n\nvar regexpCache = Object.create(null);\n\nfunction wordsRegexp(words) {\n return regexpCache[words] || (regexpCache[words] = new RegExp(\"^(?:\" + words.replace(/ /g, \"|\") + \")$\"))\n}\n\nfunction codePointToString(code) {\n // UTF-16 Decoding\n if (code <= 0xFFFF) { return String.fromCharCode(code) }\n code -= 0x10000;\n return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)\n}\n\nvar loneSurrogate = /(?:[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])/;\n\n// These are used when `options.locations` is on, for the\n// `startLoc` and `endLoc` properties.\n\nvar Position = function Position(line, col) {\n this.line = line;\n this.column = col;\n};\n\nPosition.prototype.offset = function offset (n) {\n return new Position(this.line, this.column + n)\n};\n\nvar SourceLocation = function SourceLocation(p, start, end) {\n this.start = start;\n this.end = end;\n if (p.sourceFile !== null) { this.source = p.sourceFile; }\n};\n\n// The `getLineInfo` function is mostly useful when the\n// `locations` option is off (for performance reasons) and you\n// want to find the line/column position for a given character\n// offset. `input` should be the code string that the offset refers\n// into.\n\nfunction getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n var nextBreak = nextLineBreak(input, cur, offset);\n if (nextBreak < 0) { return new Position(line, offset - cur) }\n ++line;\n cur = nextBreak;\n }\n}\n\n// A second argument must be given to configure the parser process.\n// These options are recognized (only `ecmaVersion` is required):\n\nvar defaultOptions = {\n // `ecmaVersion` indicates the ECMAScript version to parse. Must be\n // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10\n // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `\"latest\"`\n // (the latest version the library supports). This influences\n // support for strict mode, the set of reserved words, and support\n // for new syntax features.\n ecmaVersion: null,\n // `sourceType` indicates the mode the code should be parsed in.\n // Can be either `\"script\"`, `\"module\"` or `\"commonjs\"`. This influences global\n // strict mode and parsing of `import` and `export` declarations.\n sourceType: \"script\",\n // When set to true, enable strict parsing mode even if `sourceType`\n // is `\"script\"`.\n strict: false,\n // `onInsertedSemicolon` can be a callback that will be called when\n // a semicolon is automatically inserted. It will be passed the\n // position of the inserted semicolon as an offset, and if\n // `locations` is enabled, it is given the location as a `{line,\n // column}` object as second argument.\n onInsertedSemicolon: null,\n // `onTrailingComma` is similar to `onInsertedSemicolon`, but for\n // trailing commas.\n onTrailingComma: null,\n // By default, reserved words are only enforced if ecmaVersion >= 5.\n // Set `allowReserved` to a boolean value to explicitly turn this on\n // an off. When this option has the value \"never\", reserved words\n // and keywords can also not be used as property names.\n allowReserved: null,\n // When enabled, a return at the top level is not considered an\n // error.\n allowReturnOutsideFunction: false,\n // When enabled, import/export statements are not constrained to\n // appearing at the top of the program, and an import.meta expression\n // in a script isn't considered an error.\n allowImportExportEverywhere: false,\n // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.\n // When enabled, await identifiers are allowed to appear at the top-level scope,\n // but they are still not allowed in non-async functions.\n allowAwaitOutsideFunction: null,\n // When enabled, super identifiers are not constrained to\n // appearing in methods and do not raise an error when they appear elsewhere.\n allowSuperOutsideMethod: null,\n // When enabled, hashbang directive in the beginning of file is\n // allowed and treated as a line comment. Enabled by default when\n // `ecmaVersion` >= 2023.\n allowHashBang: false,\n // By default, the parser will verify that private properties are\n // only used in places where they are valid and have been declared.\n // Set this to false to turn such checks off.\n checkPrivateFields: true,\n // When `locations` is on, `loc` properties holding objects with\n // `start` and `end` properties in `{line, column}` form (with\n // line being 1-based and column 0-based) will be attached to the\n // nodes.\n locations: false,\n // Pass an optional `{line, column}` object to use for the start of\n // the parse. This is mostly useful when using `parseExpressionAt`\n // with `locations: true`, to prevent the parser from having to\n // determine the line position at the start position.\n startLocation: null,\n // A function can be passed as `onToken` option, which will\n // cause Acorn to call that function with object in the same\n // format as tokens returned from `tokenizer().getToken()`. Note\n // that you are not allowed to call the parser from the\n // callback—that will corrupt its internal state.\n onToken: null,\n // A function can be passed as `onComment` option, which will\n // cause Acorn to call that function with `(block, text, start,\n // end)` parameters whenever a comment is skipped. `block` is a\n // boolean indicating whether this is a block (`/* */`) comment,\n // `text` is the content of the comment, and `start` and `end` are\n // character offsets that denote the start and end of the comment.\n // When the `locations` option is on, two more parameters are\n // passed, the full `{line, column}` locations of the start and\n // end of the comments. Note that you are not allowed to call the\n // parser from the callback—that will corrupt its internal state.\n // When this option has an array as value, objects representing the\n // comments are pushed to it.\n onComment: null,\n // Nodes have their start and end characters offsets recorded in\n // `start` and `end` properties (directly on the node, rather than\n // the `loc` object, which holds line/column data. To also add a\n // [semi-standardized][range] `range` property holding a `[start,\n // end]` array with the same numbers, set the `ranges` option to\n // `true`.\n //\n // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\n ranges: false,\n // It is possible to parse multiple files into a single AST by\n // passing the tree produced by parsing the first file as\n // `program` option in subsequent parses. This will add the\n // toplevel forms of the parsed file to the `Program` (top) node\n // of an existing parse tree.\n program: null,\n // When `locations` is on, you can pass this to record the source\n // file in every node's `loc` object.\n sourceFile: null,\n // This value, if given, is stored in every node, whether\n // `locations` is on or off.\n directSourceFile: null,\n // When enabled, parenthesized expressions are represented by\n // (non-standard) ParenthesizedExpression nodes\n preserveParens: false\n};\n\n// Interpret and default an options object\n\nvar warnedAboutEcmaVersion = false;\n\nfunction getOptions(opts) {\n var options = {};\n\n for (var opt in defaultOptions)\n { options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; }\n\n if (options.ecmaVersion === \"latest\") {\n options.ecmaVersion = 1e8;\n } else if (options.ecmaVersion == null) {\n if (!warnedAboutEcmaVersion && typeof console === \"object\" && console.warn) {\n warnedAboutEcmaVersion = true;\n console.warn(\"Since Acorn 8.0.0, options.ecmaVersion is required.\\nDefaulting to 2020, but this will stop working in the future.\");\n }\n options.ecmaVersion = 11;\n } else if (options.ecmaVersion >= 2015) {\n options.ecmaVersion -= 2009;\n }\n\n if (options.allowReserved == null)\n { options.allowReserved = options.ecmaVersion < 5; }\n\n if (!opts || opts.allowHashBang == null)\n { options.allowHashBang = options.ecmaVersion >= 14; }\n\n if (isArray(options.onToken)) {\n var tokens = options.onToken;\n options.onToken = function (token) { return tokens.push(token); };\n }\n if (isArray(options.onComment))\n { options.onComment = pushComment(options, options.onComment); }\n\n if (options.sourceType === \"commonjs\" && options.allowAwaitOutsideFunction)\n { throw new Error(\"Cannot use allowAwaitOutsideFunction with sourceType: commonjs\") }\n\n return options\n}\n\nfunction pushComment(options, array) {\n return function(block, text, start, end, startLoc, endLoc) {\n var comment = {\n type: block ? \"Block\" : \"Line\",\n value: text,\n start: start,\n end: end\n };\n if (options.locations)\n { comment.loc = new SourceLocation(this, startLoc, endLoc); }\n if (options.ranges)\n { comment.range = [start, end]; }\n array.push(comment);\n }\n}\n\n// Each scope gets a bitset that may contain these flags\nvar\n SCOPE_TOP = 1,\n SCOPE_FUNCTION = 2,\n SCOPE_ASYNC = 4,\n SCOPE_GENERATOR = 8,\n SCOPE_ARROW = 16,\n SCOPE_SIMPLE_CATCH = 32,\n SCOPE_SUPER = 64,\n SCOPE_DIRECT_SUPER = 128,\n SCOPE_CLASS_STATIC_BLOCK = 256,\n SCOPE_CLASS_FIELD_INIT = 512,\n SCOPE_SWITCH = 1024,\n SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;\n\nfunction functionFlags(async, generator) {\n return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)\n}\n\n// Used in checkLVal* and declareName to determine the type of a binding\nvar\n BIND_NONE = 0, // Not a binding\n BIND_VAR = 1, // Var-style binding\n BIND_LEXICAL = 2, // Let- or const-style binding\n BIND_FUNCTION = 3, // Function declaration\n BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding\n BIND_OUTSIDE = 5; // Special case for function names as bound inside the function\n\nvar Parser = function Parser(options, input, startPos) {\n this.options = options = getOptions(options);\n this.sourceFile = options.sourceFile;\n this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === \"module\" ? \"5module\" : 5]);\n var reserved = \"\";\n if (options.allowReserved !== true) {\n reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];\n if (options.sourceType === \"module\") { reserved += \" await\"; }\n }\n this.reservedWords = wordsRegexp(reserved);\n var reservedStrict = (reserved ? reserved + \" \" : \"\") + reservedWords.strict;\n this.reservedWordsStrict = wordsRegexp(reservedStrict);\n this.reservedWordsStrictBind = wordsRegexp(reservedStrict + \" \" + reservedWords.strictBind);\n this.input = String(input);\n\n // Used to signal to callers of `readWord1` whether the word\n // contained any escape sequences. This is needed because words with\n // escape sequences must not be interpreted as keywords.\n this.containsEsc = false;\n\n // Set up token state\n\n // The current position of the tokenizer in the input.\n this.pos = startPos || 0;\n this.curLine = 1;\n if (options.startLocation) {\n this.lineStart = this.pos - options.startLocation.column;\n this.curLine = options.startLocation.line;\n } else if (startPos) {\n this.lineStart = this.input.lastIndexOf(\"\\n\", startPos - 1) + 1;\n if (this.options.locations)\n { this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; }\n } else {\n this.lineStart = 0;\n }\n\n // Properties of the current token:\n // Its type\n this.type = types$1.eof;\n // For tokens that include more information than their type, the value\n this.value = null;\n // Its start and end offset\n this.start = this.end = this.pos;\n // And, if locations are used, the {line, column} object\n // corresponding to those offsets\n this.startLoc = this.endLoc = this.curPosition();\n\n // Position information for the previous token\n this.lastTokEndLoc = this.lastTokStartLoc = null;\n this.lastTokStart = this.lastTokEnd = this.pos;\n\n // The context stack is used to superficially track syntactic\n // context to predict whether a regular expression is allowed in a\n // given position.\n this.context = this.initialContext();\n this.exprAllowed = true;\n\n // Figure out if it's a module code.\n this.inModule = options.sourceType === \"module\";\n this.strict = this.inModule || options.strict === true || this.strictDirective(this.pos);\n\n // Used to signify the start of a potential arrow function\n this.potentialArrowAt = -1;\n this.potentialArrowInForAwait = false;\n\n // Positions to delayed-check that yield/await does not exist in default parameters.\n this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;\n // Labels in scope.\n this.labels = [];\n // Thus-far undefined exports.\n this.undefinedExports = Object.create(null);\n\n // If enabled, skip leading hashbang line.\n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === \"#!\")\n { this.skipLineComment(2); }\n\n // Scope tracking for duplicate variable names (see scope.js)\n this.scopeStack = [];\n this.enterScope(\n this.options.sourceType === \"commonjs\"\n // In commonjs, the top-level scope behaves like a function scope\n ? SCOPE_FUNCTION\n : SCOPE_TOP\n );\n\n // For RegExp validation\n this.regexpState = null;\n\n // The stack of private names.\n // Each element has two properties: 'declared' and 'used'.\n // When it exited from the outermost class definition, all used private names must be declared.\n this.privateNameStack = [];\n};\n\nvar prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowReturn: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },allowUsing: { configurable: true },inClassStaticBlock: { configurable: true } };\n\nParser.prototype.parse = function parse () {\n var this$1$1 = this;\n\n var node = this.options.program || this.startNode();\n this.nextToken();\n return this.catchStackOverflow(function () { return this$1$1.parseTopLevel(node); })\n};\n\nprototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };\n\nprototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };\n\nprototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };\n\nprototypeAccessors.canAwait.get = function () {\n for (var i = this.scopeStack.length - 1; i >= 0; i--) {\n var ref = this.scopeStack[i];\n var flags = ref.flags;\n if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) { return false }\n if (flags & SCOPE_FUNCTION) { return (flags & SCOPE_ASYNC) > 0 }\n }\n return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction\n};\n\nprototypeAccessors.allowReturn.get = function () {\n if (this.inFunction) { return true }\n if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { return true }\n return false\n};\n\nprototypeAccessors.allowSuper.get = function () {\n var ref = this.currentThisScope();\n var flags = ref.flags;\n return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod\n};\n\nprototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };\n\nprototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };\n\nprototypeAccessors.allowNewDotTarget.get = function () {\n for (var i = this.scopeStack.length - 1; i >= 0; i--) {\n var ref = this.scopeStack[i];\n var flags = ref.flags;\n if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) ||\n ((flags & SCOPE_FUNCTION) && !(flags & SCOPE_ARROW))) { return true }\n }\n return false\n};\n\nprototypeAccessors.allowUsing.get = function () {\n var ref = this.currentScope();\n var flags = ref.flags;\n if (flags & SCOPE_SWITCH) { return false }\n if (!this.inModule && flags & SCOPE_TOP) { return false }\n return true\n};\n\nprototypeAccessors.inClassStaticBlock.get = function () {\n return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0\n};\n\nParser.extend = function extend () {\n var plugins = [], len = arguments.length;\n while ( len-- ) plugins[ len ] = arguments[ len ];\n\n var cls = this;\n for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }\n return cls\n};\n\nParser.parse = function parse (input, options) {\n return new this(options, input).parse()\n};\n\nParser.parseExpressionAt = function parseExpressionAt (input, pos, options) {\n var parser = new this(options, input, pos);\n parser.nextToken();\n return parser.parseExpression()\n};\n\nParser.tokenizer = function tokenizer (input, options) {\n return new this(options, input)\n};\n\nObject.defineProperties( Parser.prototype, prototypeAccessors );\n\nvar pp$9 = Parser.prototype;\n\n// ## Parser utilities\n\nvar literal = /^(?:'((?:\\\\[^]|[^'\\\\])*?)'|\"((?:\\\\[^]|[^\"\\\\])*?)\")/;\npp$9.strictDirective = function(start) {\n if (this.options.ecmaVersion < 5) { return false }\n for (;;) {\n // Try to find string literal.\n skipWhiteSpace.lastIndex = start;\n start += skipWhiteSpace.exec(this.input)[0].length;\n var match = literal.exec(this.input.slice(start));\n if (!match) { return false }\n if ((match[1] || match[2]) === \"use strict\") {\n skipWhiteSpace.lastIndex = start + match[0].length;\n var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;\n var next = this.input.charAt(end);\n return next === \";\" || next === \"}\" ||\n (lineBreak.test(spaceAfter[0]) &&\n !(/[(`.[+\\-/*%<>=,?^&]/.test(next) ||\n next === \"!\" && this.input.charAt(end + 1) === \"=\" ||\n next === \"i\" && keywordOpAt(this, end)))\n }\n start += match[0].length;\n\n // Skip semicolon, if any.\n skipWhiteSpace.lastIndex = start;\n start += skipWhiteSpace.exec(this.input)[0].length;\n if (this.input[start] === \";\")\n { start++; }\n }\n};\n\n// Scan for `in` or `instanceof` at the given position, knowing that\n// there's an `i` there.\nfunction keywordOpAt(parser, pos) {\n var end = pos + 1, stop = Math.min(parser.input.length, pos + 11);\n while (end < stop) {\n var ch = parser.fullCharCodeAt(end);\n if (!isIdentifierChar(ch, true)) { break }\n end += ch <= 0xffff ? 1 : 2;\n }\n return end === pos + 2 && parser.input.slice(pos, end) === \"in\" ||\n end === pos + 10 && parser.input.slice(pos, end) === \"instanceof\"\n}\n\n// Predicate that tests whether the next token is of the given\n// type, and if yes, consumes it as a side effect.\n\npp$9.eat = function(type) {\n if (this.type === type) {\n this.next();\n return true\n } else {\n return false\n }\n};\n\n// Tests whether parsed token is a contextual keyword.\n\npp$9.isContextual = function(name) {\n return this.type === types$1.name && this.value === name && !this.containsEsc\n};\n\n// Consumes contextual keyword if possible.\n\npp$9.eatContextual = function(name) {\n if (!this.isContextual(name)) { return false }\n this.next();\n return true\n};\n\npp$9.catchStackOverflow = function(f) {\n try {\n return f()\n } catch (e) {\n if (e instanceof Error && (/\\bstack\\b.*\\b(exceeded|overflow)\\b/i.test(e.message) || /\\btoo much recursion\\b/i.test(e.message)))\n { this.raise(this.start, \"Not enough stack space to parse input\"); }\n else\n { throw e }\n }\n};\n\n// Asserts that following token is given contextual keyword.\n\npp$9.expectContextual = function(name) {\n if (!this.eatContextual(name)) { this.unexpected(); }\n};\n\n// Test whether a semicolon can be inserted at the current position.\n\npp$9.canInsertSemicolon = function() {\n return this.type === types$1.eof ||\n this.type === types$1.braceR ||\n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n};\n\npp$9.insertSemicolon = function() {\n if (this.canInsertSemicolon()) {\n if (this.options.onInsertedSemicolon)\n { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }\n return true\n }\n};\n\n// Consume a semicolon, or, failing that, see if we are allowed to\n// pretend that there is a semicolon at this position.\n\npp$9.semicolon = function() {\n if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }\n};\n\npp$9.afterTrailingComma = function(tokType, notNext) {\n if (this.type === tokType) {\n if (this.options.onTrailingComma)\n { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }\n if (!notNext)\n { this.next(); }\n return true\n }\n};\n\n// Expect a token of a given type. If found, consume it, otherwise,\n// raise an unexpected token error.\n\npp$9.expect = function(type) {\n this.eat(type) || this.unexpected();\n};\n\n// Raise an unexpected token error.\n\npp$9.unexpected = function(pos) {\n this.raise(pos != null ? pos : this.start, \"Unexpected token\");\n};\n\nvar DestructuringErrors = function DestructuringErrors() {\n this.shorthandAssign =\n this.trailingComma =\n this.parenthesizedAssign =\n this.parenthesizedBind =\n this.doubleProto =\n -1;\n};\n\npp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {\n if (!refDestructuringErrors) { return }\n if (refDestructuringErrors.trailingComma > -1)\n { this.raiseRecoverable(refDestructuringErrors.trailingComma, \"Comma is not permitted after the rest element\"); }\n var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;\n if (parens > -1) { this.raiseRecoverable(parens, isAssign ? \"Assigning to rvalue\" : \"Parenthesized pattern\"); }\n};\n\npp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {\n if (!refDestructuringErrors) { return false }\n var shorthandAssign = refDestructuringErrors.shorthandAssign;\n var doubleProto = refDestructuringErrors.doubleProto;\n if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }\n if (shorthandAssign >= 0)\n { this.raise(shorthandAssign, \"Shorthand property assignments are valid only in destructuring patterns\"); }\n if (doubleProto >= 0)\n { this.raiseRecoverable(doubleProto, \"Redefinition of __proto__ property\"); }\n};\n\npp$9.checkYieldAwaitInDefaultParams = function() {\n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))\n { this.raise(this.yieldPos, \"Yield expression cannot be a default value\"); }\n if (this.awaitPos)\n { this.raise(this.awaitPos, \"Await expression cannot be a default value\"); }\n};\n\npp$9.isSimpleAssignTarget = function(expr) {\n if (expr.type === \"ParenthesizedExpression\")\n { return this.isSimpleAssignTarget(expr.expression) }\n return expr.type === \"Identifier\" || expr.type === \"MemberExpression\"\n};\n\nvar pp$8 = Parser.prototype;\n\n// ### Statement parsing\n\n// Parse a program. Initializes the parser, reads any number of\n// statements, and wraps them in a Program node. Optionally takes a\n// `program` argument. If present, the statements will be appended\n// to its body instead of creating a new node.\n\npp$8.parseTopLevel = function(node) {\n var exports$1 = Object.create(null);\n if (!node.body) { node.body = []; }\n while (this.type !== types$1.eof) {\n var stmt = this.parseStatement(null, true, exports$1);\n node.body.push(stmt);\n }\n if (this.inModule)\n { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)\n {\n var name = list[i];\n\n this.raiseRecoverable(this.undefinedExports[name].start, (\"Export '\" + name + \"' is not defined\"));\n } }\n this.adaptDirectivePrologue(node.body);\n this.next();\n node.sourceType = this.options.sourceType === \"commonjs\" ? \"script\" : this.options.sourceType;\n return this.finishNode(node, \"Program\")\n};\n\nvar loopLabel = {kind: \"loop\"}, switchLabel = {kind: \"switch\"};\n\npp$8.isLet = function(context) {\n if (this.options.ecmaVersion < 6 || !this.isContextual(\"let\")) { return false }\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next);\n // For ambiguous cases, determine if a LexicalDeclaration (or only a\n // Statement) is allowed here. If context is not empty then only a Statement\n // is allowed. However, `let [` is an explicit negative lookahead for\n // ExpressionStatement, so special-case it first.\n if (nextCh === 91 || nextCh === 92) { return true } // '[', '\\'\n if (context) { return false }\n\n if (nextCh === 123) { return true } // '{'\n if (isIdentifierStart(nextCh)) {\n var start = next;\n do { next += nextCh <= 0xffff ? 1 : 2; }\n while (isIdentifierChar(nextCh = this.fullCharCodeAt(next)))\n if (nextCh === 92) { return true }\n var ident = this.input.slice(start, next);\n if (!keywordRelationalOperator.test(ident)) { return true }\n }\n return false\n};\n\n// check 'async [no LineTerminator here] function'\n// - 'async /*foo*/ function' is OK.\n// - 'async /*\\n*/ function' is invalid.\npp$8.isAsyncFunction = function() {\n if (this.options.ecmaVersion < 8 || !this.isContextual(\"async\"))\n { return false }\n\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, after;\n return !lineBreak.test(this.input.slice(this.pos, next)) &&\n this.input.slice(next, next + 8) === \"function\" &&\n (next + 8 === this.input.length ||\n !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92 /* '\\' */))\n};\n\npp$8.isUsingKeyword = function(isAwaitUsing, isFor) {\n if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? \"await\" : \"using\"))\n { return false }\n\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length;\n\n if (lineBreak.test(this.input.slice(this.pos, next))) { return false }\n\n if (isAwaitUsing) {\n var usingEndPos = next + 5 /* using */, after;\n if (this.input.slice(next, usingEndPos) !== \"using\" ||\n usingEndPos === this.input.length ||\n isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) ||\n after === 92 /* '\\' */\n ) { return false }\n\n skipWhiteSpace.lastIndex = usingEndPos;\n var skipAfterUsing = skipWhiteSpace.exec(this.input);\n next = usingEndPos + skipAfterUsing[0].length;\n if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) { return false }\n }\n\n var ch = this.fullCharCodeAt(next);\n if (!isIdentifierStart(ch) && ch !== 92 /* '\\' */) { return false }\n var idStart = next;\n do { next += ch <= 0xffff ? 1 : 2; }\n while (isIdentifierChar(ch = this.fullCharCodeAt(next)))\n if (ch === 92) { return true }\n var id = this.input.slice(idStart, next);\n if (keywordRelationalOperator.test(id)) { return false }\n if (isFor && !isAwaitUsing && id === \"of\") {\n // Look ahead for using declaration with initializer, i.e., `for (using of = ...)`\n skipWhiteSpace.lastIndex = next;\n var skipAfterOf = skipWhiteSpace.exec(this.input);\n next = next + skipAfterOf[0].length;\n if (this.input.charCodeAt(next) !== 61 /* '=' */ ||\n // Check for ==, === and => operators\n (ch = this.input.charCodeAt(next + 1)) === 61 /* '=' */ || ch === 62 /* '>' */) {\n return false\n }\n }\n return true\n};\n\npp$8.isAwaitUsing = function(isFor) {\n return this.isUsingKeyword(true, isFor)\n};\n\npp$8.isUsing = function(isFor) {\n return this.isUsingKeyword(false, isFor)\n};\n\n// Parse a single statement.\n//\n// If expecting a statement and finding a slash operator, parse a\n// regular expression literal. This is to handle cases like\n// `if (foo) /blah/.exec(foo)`, where looking at the previous token\n// does not help.\n\npp$8.parseStatement = function(context, topLevel, exports$1) {\n var starttype = this.type, node = this.startNode(), kind;\n\n if (this.isLet(context)) {\n starttype = types$1._var;\n kind = \"let\";\n }\n\n // Most types of statements are recognized by the keyword they\n // start with. Many are trivial to parse, some require a bit of\n // complexity.\n\n switch (starttype) {\n case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)\n case types$1._debugger: return this.parseDebuggerStatement(node)\n case types$1._do: return this.parseDoStatement(node)\n case types$1._for: return this.parseForStatement(node)\n case types$1._function:\n // Function as sole body of either an if statement or a labeled statement\n // works, but not when it is part of a labeled statement that is the sole\n // body of an if statement.\n if ((context && (this.strict || context !== \"if\" && context !== \"label\")) && this.options.ecmaVersion >= 6) { this.unexpected(); }\n return this.parseFunctionStatement(node, false, !context)\n case types$1._class:\n if (context) { this.unexpected(); }\n return this.parseClass(node, true)\n case types$1._if: return this.parseIfStatement(node)\n case types$1._return: return this.parseReturnStatement(node)\n case types$1._switch: return this.parseSwitchStatement(node)\n case types$1._throw: return this.parseThrowStatement(node)\n case types$1._try: return this.parseTryStatement(node)\n case types$1._const: case types$1._var:\n kind = kind || this.value;\n if (context && kind !== \"var\") { this.unexpected(); }\n return this.parseVarStatement(node, kind)\n case types$1._while: return this.parseWhileStatement(node)\n case types$1._with: return this.parseWithStatement(node)\n case types$1.braceL: return this.parseBlock(true, node)\n case types$1.semi: return this.parseEmptyStatement(node)\n case types$1._export:\n case types$1._import:\n if (this.options.ecmaVersion > 10 && starttype === types$1._import) {\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);\n if (nextCh === 40 || nextCh === 46) // '(' or '.'\n { return this.parseExpressionStatement(node, this.parseExpression()) }\n }\n\n if (!this.options.allowImportExportEverywhere) {\n if (!topLevel)\n { this.raise(this.start, \"'import' and 'export' may only appear at the top level\"); }\n if (!this.inModule)\n { this.raise(this.start, \"'import' and 'export' may appear only with 'sourceType: module'\"); }\n }\n return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1)\n\n // If the statement does not start with a statement keyword or a\n // brace, it's an ExpressionStatement or LabeledStatement. We\n // simply start parsing an expression, and afterwards, if the\n // next token is a colon and the expression was a simple\n // Identifier node, we switch to interpreting it as a label.\n default:\n if (this.isAsyncFunction()) {\n if (context) { this.unexpected(); }\n this.next();\n return this.parseFunctionStatement(node, true, !context)\n }\n\n var usingKind = this.isAwaitUsing(false) ? \"await using\" : this.isUsing(false) ? \"using\" : null;\n if (usingKind) {\n if (!this.allowUsing) {\n this.raise(this.start, \"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement\");\n }\n if (context) {\n // Cases like `for (;;) using x = ...;`, `if (true) await using x = ...;`, etc. are not allowed.\n this.raise(this.start, \"Using declaration is not allowed in single-statement positions\");\n }\n if (usingKind === \"await using\") {\n if (!this.canAwait) {\n this.raise(this.start, \"Await using cannot appear outside of async function\");\n }\n this.next();\n }\n this.next();\n this.parseVar(node, false, usingKind);\n this.semicolon();\n return this.finishNode(node, \"VariableDeclaration\")\n }\n\n var maybeName = this.value, expr = this.parseExpression();\n if (starttype === types$1.name && expr.type === \"Identifier\" && this.eat(types$1.colon))\n { return this.parseLabeledStatement(node, maybeName, expr, context) }\n else { return this.parseExpressionStatement(node, expr) }\n }\n};\n\npp$8.parseBreakContinueStatement = function(node, keyword) {\n var isBreak = keyword === \"break\";\n this.next();\n if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }\n else if (this.type !== types$1.name) { this.unexpected(); }\n else {\n node.label = this.parseIdent();\n this.semicolon();\n }\n\n // Verify that there is an actual destination to break or\n // continue to.\n var i = 0;\n for (; i < this.labels.length; ++i) {\n var lab = this.labels[i];\n if (node.label == null || lab.name === node.label.name) {\n if (lab.kind != null && (isBreak || lab.kind === \"loop\")) { break }\n if (node.label && isBreak) { break }\n }\n }\n if (i === this.labels.length) { this.raise(node.start, \"Unsyntactic \" + keyword); }\n return this.finishNode(node, isBreak ? \"BreakStatement\" : \"ContinueStatement\")\n};\n\npp$8.parseDebuggerStatement = function(node) {\n this.next();\n this.semicolon();\n return this.finishNode(node, \"DebuggerStatement\")\n};\n\npp$8.parseDoStatement = function(node) {\n this.next();\n this.labels.push(loopLabel);\n node.body = this.parseStatement(\"do\");\n this.labels.pop();\n this.expect(types$1._while);\n node.test = this.parseParenExpression();\n if (this.options.ecmaVersion >= 6)\n { this.eat(types$1.semi); }\n else\n { this.semicolon(); }\n return this.finishNode(node, \"DoWhileStatement\")\n};\n\n// Disambiguating between a `for` and a `for`/`in` or `for`/`of`\n// loop is non-trivial. Basically, we have to parse the init `var`\n// statement or expression, disallowing the `in` operator (see\n// the second parameter to `parseExpression`), and then check\n// whether the next token is `in` or `of`. When there is no init\n// part (semicolon immediately after the opening parenthesis), it\n// is a regular `for` loop.\n\npp$8.parseForStatement = function(node) {\n this.next();\n var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual(\"await\")) ? this.lastTokStart : -1;\n this.labels.push(loopLabel);\n this.enterScope(0);\n this.expect(types$1.parenL);\n if (this.type === types$1.semi) {\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, null)\n }\n var isLet = this.isLet();\n if (this.type === types$1._var || this.type === types$1._const || isLet) {\n var init$1 = this.startNode(), kind = isLet ? \"let\" : this.value;\n this.next();\n this.parseVar(init$1, true, kind);\n this.finishNode(init$1, \"VariableDeclaration\");\n return this.parseForAfterInit(node, init$1, awaitAt)\n }\n var startsWithLet = this.isContextual(\"let\"), isForOf = false;\n\n var usingKind = this.isUsing(true) ? \"using\" : this.isAwaitUsing(true) ? \"await using\" : null;\n if (usingKind) {\n var init$2 = this.startNode();\n this.next();\n if (usingKind === \"await using\") {\n if (!this.canAwait) {\n this.raise(this.start, \"Await using cannot appear outside of async function\");\n }\n this.next();\n }\n this.parseVar(init$2, true, usingKind);\n this.finishNode(init$2, \"VariableDeclaration\");\n return this.parseForAfterInit(node, init$2, awaitAt)\n }\n var containsEsc = this.containsEsc;\n var refDestructuringErrors = new DestructuringErrors;\n var initPos = this.start;\n var init = awaitAt > -1\n ? this.parseExprSubscripts(refDestructuringErrors, \"await\")\n : this.parseExpression(true, refDestructuringErrors);\n if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) {\n if (awaitAt > -1) { // implies `ecmaVersion >= 9` (see declaration of awaitAt)\n if (this.type === types$1._in) { this.unexpected(awaitAt); }\n node.await = true;\n } else if (isForOf && this.options.ecmaVersion >= 8) {\n if (init.start === initPos && !containsEsc && init.type === \"Identifier\" && init.name === \"async\") { this.unexpected(); }\n else if (this.options.ecmaVersion >= 9) { node.await = false; }\n }\n if (startsWithLet && isForOf) { this.raise(init.start, \"The left-hand side of a for-of loop may not start with 'let'.\"); }\n this.toAssignable(init, false, refDestructuringErrors);\n this.checkLValPattern(init);\n return this.parseForIn(node, init)\n } else {\n this.checkExpressionErrors(refDestructuringErrors, true);\n }\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, init)\n};\n\n// Helper method to parse for loop after variable initialization\npp$8.parseForAfterInit = function(node, init, awaitAt) {\n if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) && init.declarations.length === 1) {\n if (this.type === types$1._in) {\n if ((init.kind === \"using\" || init.kind === \"await using\") && !init.declarations[0].init) {\n this.raise(this.start, \"Using declaration is not allowed in for-in loops\");\n }\n if (this.options.ecmaVersion >= 9 && awaitAt > -1) { this.unexpected(awaitAt); }\n } else if (this.options.ecmaVersion >= 9) { node.await = awaitAt > -1; }\n return this.parseForIn(node, init)\n }\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, init)\n};\n\npp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {\n this.next();\n return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)\n};\n\npp$8.parseIfStatement = function(node) {\n this.next();\n node.test = this.parseParenExpression();\n // allow function declarations in branches, but only in non-strict mode\n node.consequent = this.parseStatement(\"if\");\n node.alternate = this.eat(types$1._else) ? this.parseStatement(\"if\") : null;\n return this.finishNode(node, \"IfStatement\")\n};\n\npp$8.parseReturnStatement = function(node) {\n if (!this.allowReturn)\n { this.raise(this.start, \"'return' outside of function\"); }\n this.next();\n\n // In `return` (and `break`/`continue`), the keywords with\n // optional arguments, we eagerly look for a semicolon or the\n // possibility to insert one.\n\n if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }\n else { node.argument = this.parseExpression(); this.semicolon(); }\n return this.finishNode(node, \"ReturnStatement\")\n};\n\npp$8.parseSwitchStatement = function(node) {\n this.next();\n node.discriminant = this.parseParenExpression();\n node.cases = [];\n this.expect(types$1.braceL);\n this.labels.push(switchLabel);\n this.enterScope(SCOPE_SWITCH);\n\n // Statements under must be grouped (by label) in SwitchCase\n // nodes. `cur` is used to keep the node that we are currently\n // adding statements to.\n\n var cur;\n for (var sawDefault = false; this.type !== types$1.braceR;) {\n if (this.type === types$1._case || this.type === types$1._default) {\n var isCase = this.type === types$1._case;\n if (cur) { this.finishNode(cur, \"SwitchCase\"); }\n node.cases.push(cur = this.startNode());\n cur.consequent = [];\n this.next();\n if (isCase) {\n cur.test = this.parseExpression();\n } else {\n if (sawDefault) { this.raiseRecoverable(this.lastTokStart, \"Multiple default clauses\"); }\n sawDefault = true;\n cur.test = null;\n }\n this.expect(types$1.colon);\n } else {\n if (!cur) { this.unexpected(); }\n cur.consequent.push(this.parseStatement(null));\n }\n }\n this.exitScope();\n if (cur) { this.finishNode(cur, \"SwitchCase\"); }\n this.next(); // Closing brace\n this.labels.pop();\n return this.finishNode(node, \"SwitchStatement\")\n};\n\npp$8.parseThrowStatement = function(node) {\n this.next();\n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))\n { this.raise(this.lastTokEnd, \"Illegal newline after throw\"); }\n node.argument = this.parseExpression();\n this.semicolon();\n return this.finishNode(node, \"ThrowStatement\")\n};\n\n// Reused empty array added for node fields that are always empty.\n\nvar empty$1 = [];\n\npp$8.parseCatchClauseParam = function() {\n var param = this.parseBindingAtom();\n var simple = param.type === \"Identifier\";\n this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);\n this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);\n this.expect(types$1.parenR);\n\n return param\n};\n\npp$8.parseTryStatement = function(node) {\n this.next();\n node.block = this.parseBlock();\n node.handler = null;\n if (this.type === types$1._catch) {\n var clause = this.startNode();\n this.next();\n if (this.eat(types$1.parenL)) {\n clause.param = this.parseCatchClauseParam();\n } else {\n if (this.options.ecmaVersion < 10) { this.unexpected(); }\n clause.param = null;\n this.enterScope(0);\n }\n clause.body = this.parseBlock(false);\n this.exitScope();\n node.handler = this.finishNode(clause, \"CatchClause\");\n }\n node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;\n if (!node.handler && !node.finalizer)\n { this.raise(node.start, \"Missing catch or finally clause\"); }\n return this.finishNode(node, \"TryStatement\")\n};\n\npp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {\n this.next();\n this.parseVar(node, false, kind, allowMissingInitializer);\n this.semicolon();\n return this.finishNode(node, \"VariableDeclaration\")\n};\n\npp$8.parseWhileStatement = function(node) {\n this.next();\n node.test = this.parseParenExpression();\n this.labels.push(loopLabel);\n node.body = this.parseStatement(\"while\");\n this.labels.pop();\n return this.finishNode(node, \"WhileStatement\")\n};\n\npp$8.parseWithStatement = function(node) {\n if (this.strict) { this.raise(this.start, \"'with' in strict mode\"); }\n this.next();\n node.object = this.parseParenExpression();\n node.body = this.parseStatement(\"with\");\n return this.finishNode(node, \"WithStatement\")\n};\n\npp$8.parseEmptyStatement = function(node) {\n this.next();\n return this.finishNode(node, \"EmptyStatement\")\n};\n\npp$8.parseLabeledStatement = function(node, maybeName, expr, context) {\n for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)\n {\n var label = list[i$1];\n\n if (label.name === maybeName)\n { this.raise(expr.start, \"Label '\" + maybeName + \"' is already declared\");\n } }\n var kind = this.type.isLoop ? \"loop\" : this.type === types$1._switch ? \"switch\" : null;\n for (var i = this.labels.length - 1; i >= 0; i--) {\n var label$1 = this.labels[i];\n if (label$1.statementStart === node.start) {\n // Update information about previous labels on this node\n label$1.statementStart = this.start;\n label$1.kind = kind;\n } else { break }\n }\n this.labels.push({name: maybeName, kind: kind, statementStart: this.start});\n node.body = this.parseStatement(context ? context.indexOf(\"label\") === -1 ? context + \"label\" : context : \"label\");\n this.labels.pop();\n node.label = expr;\n return this.finishNode(node, \"LabeledStatement\")\n};\n\npp$8.parseExpressionStatement = function(node, expr) {\n node.expression = expr;\n this.semicolon();\n return this.finishNode(node, \"ExpressionStatement\")\n};\n\n// Parse a semicolon-enclosed block of statements, handling `\"use\n// strict\"` declarations when `allowStrict` is true (used for\n// function bodies).\n\npp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {\n if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;\n if ( node === void 0 ) node = this.startNode();\n\n node.body = [];\n this.expect(types$1.braceL);\n if (createNewLexicalScope) { this.enterScope(0); }\n while (this.type !== types$1.braceR) {\n var stmt = this.parseStatement(null);\n node.body.push(stmt);\n }\n if (exitStrict) { this.strict = false; }\n this.next();\n if (createNewLexicalScope) { this.exitScope(); }\n return this.finishNode(node, \"BlockStatement\")\n};\n\n// Parse a regular `for` loop. The disambiguation code in\n// `parseStatement` will already have parsed the init statement or\n// expression.\n\npp$8.parseFor = function(node, init) {\n node.init = init;\n this.expect(types$1.semi);\n node.test = this.type === types$1.semi ? null : this.parseExpression();\n this.expect(types$1.semi);\n node.update = this.type === types$1.parenR ? null : this.parseExpression();\n this.expect(types$1.parenR);\n node.body = this.parseStatement(\"for\");\n this.exitScope();\n this.labels.pop();\n return this.finishNode(node, \"ForStatement\")\n};\n\n// Parse a `for`/`in` and `for`/`of` loop, which are almost\n// same from parser's perspective.\n\npp$8.parseForIn = function(node, init) {\n var isForIn = this.type === types$1._in;\n this.next();\n\n if (\n init.type === \"VariableDeclaration\" &&\n init.declarations[0].init != null &&\n (\n !isForIn ||\n this.options.ecmaVersion < 8 ||\n this.strict ||\n init.kind !== \"var\" ||\n init.declarations[0].id.type !== \"Identifier\"\n )\n ) {\n this.raise(\n init.start,\n ((isForIn ? \"for-in\" : \"for-of\") + \" loop variable declaration may not have an initializer\")\n );\n }\n node.left = init;\n node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();\n this.expect(types$1.parenR);\n node.body = this.parseStatement(\"for\");\n this.exitScope();\n this.labels.pop();\n return this.finishNode(node, isForIn ? \"ForInStatement\" : \"ForOfStatement\")\n};\n\n// Parse a list of variable declarations.\n\npp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {\n node.declarations = [];\n node.kind = kind;\n for (;;) {\n var decl = this.startNode();\n this.parseVarId(decl, kind);\n if (this.eat(types$1.eq)) {\n decl.init = this.parseMaybeAssign(isFor);\n } else if (!allowMissingInitializer && kind === \"const\" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\")))) {\n this.unexpected();\n } else if (!allowMissingInitializer && (kind === \"using\" || kind === \"await using\") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual(\"of\")) {\n this.raise(this.lastTokEnd, (\"Missing initializer in \" + kind + \" declaration\"));\n } else if (!allowMissingInitializer && decl.id.type !== \"Identifier\" && !(isFor && (this.type === types$1._in || this.isContextual(\"of\")))) {\n this.raise(this.lastTokEnd, \"Complex binding patterns require an initialization value\");\n } else {\n decl.init = null;\n }\n node.declarations.push(this.finishNode(decl, \"VariableDeclarator\"));\n if (!this.eat(types$1.comma)) { break }\n }\n return node\n};\n\npp$8.parseVarId = function(decl, kind) {\n decl.id = kind === \"using\" || kind === \"await using\"\n ? this.parseIdent()\n : this.parseBindingAtom();\n\n this.checkLValPattern(decl.id, kind === \"var\" ? BIND_VAR : BIND_LEXICAL, false);\n};\n\nvar FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;\n\n// Parse a function declaration or literal (depending on the\n// `statement & FUNC_STATEMENT`).\n\n// Remove `allowExpressionBody` for 7.0.0, as it is only called with false\npp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {\n this.initFunction(node);\n if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {\n if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))\n { this.unexpected(); }\n node.generator = this.eat(types$1.star);\n }\n if (this.options.ecmaVersion >= 8)\n { node.async = !!isAsync; }\n\n if (statement & FUNC_STATEMENT) {\n node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();\n if (node.id && !(statement & FUNC_HANGING_STATEMENT))\n // If it is a regular function declaration in sloppy mode, then it is\n // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding\n // mode depends on properties of the current scope (see\n // treatFunctionsAsVar).\n { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }\n }\n\n var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n this.enterScope(functionFlags(node.async, node.generator));\n\n if (!(statement & FUNC_STATEMENT))\n { node.id = this.type === types$1.name ? this.parseIdent() : null; }\n\n this.parseFunctionParams(node);\n this.parseFunctionBody(node, allowExpressionBody, false, forInit);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, (statement & FUNC_STATEMENT) ? \"FunctionDeclaration\" : \"FunctionExpression\")\n};\n\npp$8.parseFunctionParams = function(node) {\n this.expect(types$1.parenL);\n node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);\n this.checkYieldAwaitInDefaultParams();\n};\n\n// Parse a class declaration or literal (depending on the\n// `isStatement` parameter).\n\npp$8.parseClass = function(node, isStatement) {\n this.next();\n\n // ecma-262 14.6 Class Definitions\n // A class definition is always strict mode code.\n var oldStrict = this.strict;\n this.strict = true;\n\n this.parseClassId(node, isStatement);\n this.parseClassSuper(node);\n var privateNameMap = this.enterClassBody();\n var classBody = this.startNode();\n var hadConstructor = false;\n classBody.body = [];\n this.expect(types$1.braceL);\n while (this.type !== types$1.braceR) {\n var element = this.parseClassElement(node.superClass !== null);\n if (element) {\n classBody.body.push(element);\n if (element.type === \"MethodDefinition\" && element.kind === \"constructor\") {\n if (hadConstructor) { this.raiseRecoverable(element.start, \"Duplicate constructor in the same class\"); }\n hadConstructor = true;\n } else if (element.key && element.key.type === \"PrivateIdentifier\" && isPrivateNameConflicted(privateNameMap, element)) {\n this.raiseRecoverable(element.key.start, (\"Identifier '#\" + (element.key.name) + \"' has already been declared\"));\n }\n }\n }\n this.strict = oldStrict;\n this.next();\n node.body = this.finishNode(classBody, \"ClassBody\");\n this.exitClassBody();\n return this.finishNode(node, isStatement ? \"ClassDeclaration\" : \"ClassExpression\")\n};\n\npp$8.parseClassElement = function(constructorAllowsSuper) {\n if (this.eat(types$1.semi)) { return null }\n\n var ecmaVersion = this.options.ecmaVersion;\n var node = this.startNode();\n var keyName = \"\";\n var isGenerator = false;\n var isAsync = false;\n var kind = \"method\";\n var isStatic = false;\n\n if (this.eatContextual(\"static\")) {\n // Parse static init block\n if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {\n this.parseClassStaticBlock(node);\n return node\n }\n if (this.isClassElementNameStart() || this.type === types$1.star) {\n isStatic = true;\n } else {\n keyName = \"static\";\n }\n }\n node.static = isStatic;\n if (!keyName && ecmaVersion >= 8 && this.eatContextual(\"async\")) {\n if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {\n isAsync = true;\n } else {\n keyName = \"async\";\n }\n }\n if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {\n isGenerator = true;\n }\n if (!keyName && !isAsync && !isGenerator) {\n var lastValue = this.value;\n if (this.eatContextual(\"get\") || this.eatContextual(\"set\")) {\n if (this.isClassElementNameStart()) {\n kind = lastValue;\n } else {\n keyName = lastValue;\n }\n }\n }\n\n // Parse element name\n if (keyName) {\n // 'async', 'get', 'set', or 'static' were not a keyword contextually.\n // The last token is any of those. Make it the element name.\n node.computed = false;\n node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);\n node.key.name = keyName;\n this.finishNode(node.key, \"Identifier\");\n } else {\n this.parseClassElementName(node);\n }\n\n // Parse element value\n if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== \"method\" || isGenerator || isAsync) {\n var isConstructor = !node.static && checkKeyName(node, \"constructor\");\n var allowsDirectSuper = isConstructor && constructorAllowsSuper;\n // Couldn't move this check into the 'parseClassMethod' method for backward compatibility.\n if (isConstructor && kind !== \"method\") { this.raise(node.key.start, \"Constructor can't have get/set modifier\"); }\n node.kind = isConstructor ? \"constructor\" : kind;\n this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);\n } else {\n this.parseClassField(node);\n }\n\n return node\n};\n\npp$8.isClassElementNameStart = function() {\n return (\n this.type === types$1.name ||\n this.type === types$1.privateId ||\n this.type === types$1.num ||\n this.type === types$1.string ||\n this.type === types$1.bracketL ||\n this.type.keyword\n )\n};\n\npp$8.parseClassElementName = function(element) {\n if (this.type === types$1.privateId) {\n if (this.value === \"constructor\") {\n this.raise(this.start, \"Classes can't have an element named '#constructor'\");\n }\n element.computed = false;\n element.key = this.parsePrivateIdent();\n } else {\n this.parsePropertyName(element);\n }\n};\n\npp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {\n // Check key and flags\n var key = method.key;\n if (method.kind === \"constructor\") {\n if (isGenerator) { this.raise(key.start, \"Constructor can't be a generator\"); }\n if (isAsync) { this.raise(key.start, \"Constructor can't be an async method\"); }\n } else if (method.static && checkKeyName(method, \"prototype\")) {\n this.raise(key.start, \"Classes may not have a static property named prototype\");\n }\n\n // Parse value\n var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);\n\n // Check value\n if (method.kind === \"get\" && value.params.length !== 0)\n { this.raiseRecoverable(value.start, \"getter should have no params\"); }\n if (method.kind === \"set\" && value.params.length !== 1)\n { this.raiseRecoverable(value.start, \"setter should have exactly one param\"); }\n if (method.kind === \"set\" && value.params[0].type === \"RestElement\")\n { this.raiseRecoverable(value.params[0].start, \"Setter cannot use rest params\"); }\n\n return this.finishNode(method, \"MethodDefinition\")\n};\n\npp$8.parseClassField = function(field) {\n if (checkKeyName(field, \"constructor\")) {\n this.raise(field.key.start, \"Classes can't have a field named 'constructor'\");\n } else if (field.static && checkKeyName(field, \"prototype\")) {\n this.raise(field.key.start, \"Classes can't have a static field named 'prototype'\");\n }\n\n if (this.eat(types$1.eq)) {\n // To raise SyntaxError if 'arguments' exists in the initializer.\n this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);\n field.value = this.parseMaybeAssign();\n this.exitScope();\n } else {\n field.value = null;\n }\n this.semicolon();\n\n return this.finishNode(field, \"PropertyDefinition\")\n};\n\npp$8.parseClassStaticBlock = function(node) {\n node.body = [];\n\n var oldLabels = this.labels;\n this.labels = [];\n this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);\n while (this.type !== types$1.braceR) {\n var stmt = this.parseStatement(null);\n node.body.push(stmt);\n }\n this.next();\n this.exitScope();\n this.labels = oldLabels;\n\n return this.finishNode(node, \"StaticBlock\")\n};\n\npp$8.parseClassId = function(node, isStatement) {\n if (this.type === types$1.name) {\n node.id = this.parseIdent();\n if (isStatement)\n { this.checkLValSimple(node.id, BIND_LEXICAL, false); }\n } else {\n if (isStatement === true)\n { this.unexpected(); }\n node.id = null;\n }\n};\n\npp$8.parseClassSuper = function(node) {\n node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;\n};\n\npp$8.enterClassBody = function() {\n var element = {declared: Object.create(null), used: []};\n this.privateNameStack.push(element);\n return element.declared\n};\n\npp$8.exitClassBody = function() {\n var ref = this.privateNameStack.pop();\n var declared = ref.declared;\n var used = ref.used;\n if (!this.options.checkPrivateFields) { return }\n var len = this.privateNameStack.length;\n var parent = len === 0 ? null : this.privateNameStack[len - 1];\n for (var i = 0; i < used.length; ++i) {\n var id = used[i];\n if (!hasOwn(declared, id.name)) {\n if (parent) {\n parent.used.push(id);\n } else {\n this.raiseRecoverable(id.start, (\"Private field '#\" + (id.name) + \"' must be declared in an enclosing class\"));\n }\n }\n }\n};\n\nfunction isPrivateNameConflicted(privateNameMap, element) {\n var name = element.key.name;\n var curr = privateNameMap[name];\n\n var next = \"true\";\n if (element.type === \"MethodDefinition\" && (element.kind === \"get\" || element.kind === \"set\")) {\n next = (element.static ? \"s\" : \"i\") + element.kind;\n }\n\n // `class { get #a(){}; static set #a(_){} }` is also conflict.\n if (\n curr === \"iget\" && next === \"iset\" ||\n curr === \"iset\" && next === \"iget\" ||\n curr === \"sget\" && next === \"sset\" ||\n curr === \"sset\" && next === \"sget\"\n ) {\n privateNameMap[name] = \"true\";\n return false\n } else if (!curr) {\n privateNameMap[name] = next;\n return false\n } else {\n return true\n }\n}\n\nfunction checkKeyName(node, name) {\n var computed = node.computed;\n var key = node.key;\n return !computed && (\n key.type === \"Identifier\" && key.name === name ||\n key.type === \"Literal\" && key.value === name\n )\n}\n\n// Parses module export declaration.\n\npp$8.parseExportAllDeclaration = function(node, exports$1) {\n if (this.options.ecmaVersion >= 11) {\n if (this.eatContextual(\"as\")) {\n node.exported = this.parseModuleExportName();\n this.checkExport(exports$1, node.exported, this.lastTokStart);\n } else {\n node.exported = null;\n }\n }\n this.expectContextual(\"from\");\n if (this.type !== types$1.string) { this.unexpected(); }\n node.source = this.parseExprAtom();\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n this.semicolon();\n return this.finishNode(node, \"ExportAllDeclaration\")\n};\n\npp$8.parseExport = function(node, exports$1) {\n this.next();\n // export * from '...'\n if (this.eat(types$1.star)) {\n return this.parseExportAllDeclaration(node, exports$1)\n }\n if (this.eat(types$1._default)) { // export default ...\n this.checkExport(exports$1, \"default\", this.lastTokStart);\n node.declaration = this.parseExportDefaultDeclaration();\n return this.finishNode(node, \"ExportDefaultDeclaration\")\n }\n // export var|const|let|function|class ...\n if (this.shouldParseExportStatement()) {\n node.declaration = this.parseExportDeclaration(node);\n if (node.declaration.type === \"VariableDeclaration\")\n { this.checkVariableExport(exports$1, node.declaration.declarations); }\n else\n { this.checkExport(exports$1, node.declaration.id, node.declaration.id.start); }\n node.specifiers = [];\n node.source = null;\n if (this.options.ecmaVersion >= 16)\n { node.attributes = []; }\n } else { // export { x, y as z } [from '...']\n node.declaration = null;\n node.specifiers = this.parseExportSpecifiers(exports$1);\n if (this.eatContextual(\"from\")) {\n if (this.type !== types$1.string) { this.unexpected(); }\n node.source = this.parseExprAtom();\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n } else {\n for (var i = 0, list = node.specifiers; i < list.length; i += 1) {\n // check for keywords used as local names\n var spec = list[i];\n\n this.checkUnreserved(spec.local);\n // check if export is defined\n this.checkLocalExport(spec.local);\n\n if (spec.local.type === \"Literal\") {\n this.raise(spec.local.start, \"A string literal cannot be used as an exported binding without `from`.\");\n }\n }\n\n node.source = null;\n if (this.options.ecmaVersion >= 16)\n { node.attributes = []; }\n }\n this.semicolon();\n }\n return this.finishNode(node, \"ExportNamedDeclaration\")\n};\n\npp$8.parseExportDeclaration = function(node) {\n return this.parseStatement(null)\n};\n\npp$8.parseExportDefaultDeclaration = function() {\n var isAsync;\n if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {\n var fNode = this.startNode();\n this.next();\n if (isAsync) { this.next(); }\n return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync)\n } else if (this.type === types$1._class) {\n var cNode = this.startNode();\n return this.parseClass(cNode, \"nullableID\")\n } else {\n var declaration = this.parseMaybeAssign();\n this.semicolon();\n return declaration\n }\n};\n\npp$8.checkExport = function(exports$1, name, pos) {\n if (!exports$1) { return }\n if (typeof name !== \"string\")\n { name = name.type === \"Identifier\" ? name.name : name.value; }\n if (hasOwn(exports$1, name))\n { this.raiseRecoverable(pos, \"Duplicate export '\" + name + \"'\"); }\n exports$1[name] = true;\n};\n\npp$8.checkPatternExport = function(exports$1, pat) {\n var type = pat.type;\n if (type === \"Identifier\")\n { this.checkExport(exports$1, pat, pat.start); }\n else if (type === \"ObjectPattern\")\n { for (var i = 0, list = pat.properties; i < list.length; i += 1)\n {\n var prop = list[i];\n\n this.checkPatternExport(exports$1, prop);\n } }\n else if (type === \"ArrayPattern\")\n { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {\n var elt = list$1[i$1];\n\n if (elt) { this.checkPatternExport(exports$1, elt); }\n } }\n else if (type === \"Property\")\n { this.checkPatternExport(exports$1, pat.value); }\n else if (type === \"AssignmentPattern\")\n { this.checkPatternExport(exports$1, pat.left); }\n else if (type === \"RestElement\")\n { this.checkPatternExport(exports$1, pat.argument); }\n};\n\npp$8.checkVariableExport = function(exports$1, decls) {\n if (!exports$1) { return }\n for (var i = 0, list = decls; i < list.length; i += 1)\n {\n var decl = list[i];\n\n this.checkPatternExport(exports$1, decl.id);\n }\n};\n\npp$8.shouldParseExportStatement = function() {\n return this.type.keyword === \"var\" ||\n this.type.keyword === \"const\" ||\n this.type.keyword === \"class\" ||\n this.type.keyword === \"function\" ||\n this.isLet() ||\n this.isAsyncFunction()\n};\n\n// Parses a comma-separated list of module exports.\n\npp$8.parseExportSpecifier = function(exports$1) {\n var node = this.startNode();\n node.local = this.parseModuleExportName();\n\n node.exported = this.eatContextual(\"as\") ? this.parseModuleExportName() : node.local;\n this.checkExport(\n exports$1,\n node.exported,\n node.exported.start\n );\n\n return this.finishNode(node, \"ExportSpecifier\")\n};\n\npp$8.parseExportSpecifiers = function(exports$1) {\n var nodes = [], first = true;\n // export { x, y as z } [from '...']\n this.expect(types$1.braceL);\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n nodes.push(this.parseExportSpecifier(exports$1));\n }\n return nodes\n};\n\n// Parses import declaration.\n\npp$8.parseImport = function(node) {\n this.next();\n\n // import '...'\n if (this.type === types$1.string) {\n node.specifiers = empty$1;\n node.source = this.parseExprAtom();\n } else {\n node.specifiers = this.parseImportSpecifiers();\n this.expectContextual(\"from\");\n node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();\n }\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n this.semicolon();\n return this.finishNode(node, \"ImportDeclaration\")\n};\n\n// Parses a comma-separated list of module imports.\n\npp$8.parseImportSpecifier = function() {\n var node = this.startNode();\n node.imported = this.parseModuleExportName();\n\n if (this.eatContextual(\"as\")) {\n node.local = this.parseIdent();\n } else {\n this.checkUnreserved(node.imported);\n node.local = node.imported;\n }\n this.checkLValSimple(node.local, BIND_LEXICAL);\n\n return this.finishNode(node, \"ImportSpecifier\")\n};\n\npp$8.parseImportDefaultSpecifier = function() {\n // import defaultObj, { x, y as z } from '...'\n var node = this.startNode();\n node.local = this.parseIdent();\n this.checkLValSimple(node.local, BIND_LEXICAL);\n return this.finishNode(node, \"ImportDefaultSpecifier\")\n};\n\npp$8.parseImportNamespaceSpecifier = function() {\n var node = this.startNode();\n this.next();\n this.expectContextual(\"as\");\n node.local = this.parseIdent();\n this.checkLValSimple(node.local, BIND_LEXICAL);\n return this.finishNode(node, \"ImportNamespaceSpecifier\")\n};\n\npp$8.parseImportSpecifiers = function() {\n var nodes = [], first = true;\n if (this.type === types$1.name) {\n nodes.push(this.parseImportDefaultSpecifier());\n if (!this.eat(types$1.comma)) { return nodes }\n }\n if (this.type === types$1.star) {\n nodes.push(this.parseImportNamespaceSpecifier());\n return nodes\n }\n this.expect(types$1.braceL);\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n nodes.push(this.parseImportSpecifier());\n }\n return nodes\n};\n\npp$8.parseWithClause = function() {\n var nodes = [];\n if (!this.eat(types$1._with)) {\n return nodes\n }\n this.expect(types$1.braceL);\n var attributeKeys = {};\n var first = true;\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n var attr = this.parseImportAttribute();\n var keyName = attr.key.type === \"Identifier\" ? attr.key.name : attr.key.value;\n if (hasOwn(attributeKeys, keyName))\n { this.raiseRecoverable(attr.key.start, \"Duplicate attribute key '\" + keyName + \"'\"); }\n attributeKeys[keyName] = true;\n nodes.push(attr);\n }\n return nodes\n};\n\npp$8.parseImportAttribute = function() {\n var node = this.startNode();\n node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== \"never\");\n this.expect(types$1.colon);\n if (this.type !== types$1.string) {\n this.unexpected();\n }\n node.value = this.parseExprAtom();\n return this.finishNode(node, \"ImportAttribute\")\n};\n\npp$8.parseModuleExportName = function() {\n if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {\n var stringLiteral = this.parseLiteral(this.value);\n if (loneSurrogate.test(stringLiteral.value)) {\n this.raise(stringLiteral.start, \"An export name cannot include a lone surrogate.\");\n }\n return stringLiteral\n }\n return this.parseIdent(true)\n};\n\n// Set `ExpressionStatement#directive` property for directive prologues.\npp$8.adaptDirectivePrologue = function(statements) {\n for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {\n statements[i].directive = statements[i].expression.raw.slice(1, -1);\n }\n};\npp$8.isDirectiveCandidate = function(statement) {\n return (\n this.options.ecmaVersion >= 5 &&\n statement.type === \"ExpressionStatement\" &&\n statement.expression.type === \"Literal\" &&\n typeof statement.expression.value === \"string\" &&\n // Reject parenthesized strings.\n (this.input[statement.start] === \"\\\"\" || this.input[statement.start] === \"'\")\n )\n};\n\nvar pp$7 = Parser.prototype;\n\n// Convert existing expression atom to assignable pattern\n// if possible.\n\npp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 6 && node) {\n switch (node.type) {\n case \"Identifier\":\n if (this.inAsync && node.name === \"await\")\n { this.raise(node.start, \"Cannot use 'await' as identifier inside an async function\"); }\n break\n\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n case \"AssignmentPattern\":\n case \"RestElement\":\n break\n\n case \"ObjectExpression\":\n node.type = \"ObjectPattern\";\n if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n for (var i = 0, list = node.properties; i < list.length; i += 1) {\n var prop = list[i];\n\n this.toAssignable(prop, isBinding);\n // Early error:\n // AssignmentRestProperty[Yield, Await] :\n // `...` DestructuringAssignmentTarget[Yield, Await]\n //\n // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.\n if (\n prop.type === \"RestElement\" &&\n (prop.argument.type === \"ArrayPattern\" || prop.argument.type === \"ObjectPattern\")\n ) {\n this.raise(prop.argument.start, \"Unexpected token\");\n }\n }\n break\n\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n if (node.kind !== \"init\") { this.raise(node.key.start, \"Object pattern can't contain getter or setter\"); }\n this.toAssignable(node.value, isBinding);\n break\n\n case \"ArrayExpression\":\n node.type = \"ArrayPattern\";\n if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n this.toAssignableList(node.elements, isBinding);\n break\n\n case \"SpreadElement\":\n node.type = \"RestElement\";\n this.toAssignable(node.argument, isBinding);\n if (node.argument.type === \"AssignmentPattern\")\n { this.raise(node.argument.start, \"Rest elements cannot have a default value\"); }\n break\n\n case \"AssignmentExpression\":\n if (node.operator !== \"=\") { this.raise(node.left.end, \"Only '=' operator can be used for specifying default value.\"); }\n node.type = \"AssignmentPattern\";\n delete node.operator;\n this.toAssignable(node.left, isBinding);\n break\n\n case \"ParenthesizedExpression\":\n this.toAssignable(node.expression, isBinding, refDestructuringErrors);\n break\n\n case \"ChainExpression\":\n this.raiseRecoverable(node.start, \"Optional chaining cannot appear in left-hand side\");\n break\n\n case \"MemberExpression\":\n if (!isBinding) { break }\n\n default:\n this.raise(node.start, \"Assigning to rvalue\");\n }\n } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n return node\n};\n\n// Convert list of expression atoms to binding list.\n\npp$7.toAssignableList = function(exprList, isBinding) {\n var end = exprList.length;\n for (var i = 0; i < end; i++) {\n var elt = exprList[i];\n if (elt) { this.toAssignable(elt, isBinding); }\n }\n if (end) {\n var last = exprList[end - 1];\n if (this.options.ecmaVersion === 6 && isBinding && last && last.type === \"RestElement\" && last.argument.type !== \"Identifier\")\n { this.unexpected(last.argument.start); }\n }\n return exprList\n};\n\n// Parses spread element.\n\npp$7.parseSpread = function(refDestructuringErrors) {\n var node = this.startNode();\n this.next();\n node.argument = this.parseMaybeAssign(false, refDestructuringErrors);\n return this.finishNode(node, \"SpreadElement\")\n};\n\npp$7.parseRestBinding = function() {\n var node = this.startNode();\n this.next();\n\n // RestElement inside of a function parameter must be an identifier\n if (this.options.ecmaVersion === 6 && this.type !== types$1.name)\n { this.unexpected(); }\n\n node.argument = this.parseBindingAtom();\n\n return this.finishNode(node, \"RestElement\")\n};\n\n// Parses lvalue (assignable) atom.\n\npp$7.parseBindingAtom = function() {\n if (this.options.ecmaVersion >= 6) {\n switch (this.type) {\n case types$1.bracketL:\n var node = this.startNode();\n this.next();\n node.elements = this.parseBindingList(types$1.bracketR, true, true);\n return this.finishNode(node, \"ArrayPattern\")\n\n case types$1.braceL:\n return this.parseObj(true)\n }\n }\n return this.parseIdent()\n};\n\npp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {\n var elts = [], first = true;\n while (!this.eat(close)) {\n if (first) { first = false; }\n else { this.expect(types$1.comma); }\n if (allowEmpty && this.type === types$1.comma) {\n elts.push(null);\n } else if (allowTrailingComma && this.afterTrailingComma(close)) {\n break\n } else if (this.type === types$1.ellipsis) {\n var rest = this.parseRestBinding();\n this.parseBindingListItem(rest);\n elts.push(rest);\n if (this.type === types$1.comma) { this.raiseRecoverable(this.start, \"Comma is not permitted after the rest element\"); }\n this.expect(close);\n break\n } else {\n elts.push(this.parseAssignableListItem(allowModifiers));\n }\n }\n return elts\n};\n\npp$7.parseAssignableListItem = function(allowModifiers) {\n var elem = this.parseMaybeDefault(this.start, this.startLoc);\n this.parseBindingListItem(elem);\n return elem\n};\n\npp$7.parseBindingListItem = function(param) {\n return param\n};\n\n// Parses assignment pattern around given atom if possible.\n\npp$7.parseMaybeDefault = function(startPos, startLoc, left) {\n left = left || this.parseBindingAtom();\n if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }\n var node = this.startNodeAt(startPos, startLoc);\n node.left = left;\n node.right = this.parseMaybeAssign();\n return this.finishNode(node, \"AssignmentPattern\")\n};\n\n// The following three functions all verify that a node is an lvalue —\n// something that can be bound, or assigned to. In order to do so, they perform\n// a variety of checks:\n//\n// - Check that none of the bound/assigned-to identifiers are reserved words.\n// - Record name declarations for bindings in the appropriate scope.\n// - Check duplicate argument names, if checkClashes is set.\n//\n// If a complex binding pattern is encountered (e.g., object and array\n// destructuring), the entire pattern is recursively checked.\n//\n// There are three versions of checkLVal*() appropriate for different\n// circumstances:\n//\n// - checkLValSimple() shall be used if the syntactic construct supports\n// nothing other than identifiers and member expressions. Parenthesized\n// expressions are also correctly handled. This is generally appropriate for\n// constructs for which the spec says\n//\n// > It is a Syntax Error if AssignmentTargetType of [the production] is not\n// > simple.\n//\n// It is also appropriate for checking if an identifier is valid and not\n// defined elsewhere, like import declarations or function/class identifiers.\n//\n// Examples where this is used include:\n// a += …;\n// import a from '…';\n// where a is the node to be checked.\n//\n// - checkLValPattern() shall be used if the syntactic construct supports\n// anything checkLValSimple() supports, as well as object and array\n// destructuring patterns. This is generally appropriate for constructs for\n// which the spec says\n//\n// > It is a Syntax Error if [the production] is neither an ObjectLiteral nor\n// > an ArrayLiteral and AssignmentTargetType of [the production] is not\n// > simple.\n//\n// Examples where this is used include:\n// (a = …);\n// const a = …;\n// try { … } catch (a) { … }\n// where a is the node to be checked.\n//\n// - checkLValInnerPattern() shall be used if the syntactic construct supports\n// anything checkLValPattern() supports, as well as default assignment\n// patterns, rest elements, and other constructs that may appear within an\n// object or array destructuring pattern.\n//\n// As a special case, function parameters also use checkLValInnerPattern(),\n// as they also support defaults and rest constructs.\n//\n// These functions deliberately support both assignment and binding constructs,\n// as the logic for both is exceedingly similar. If the node is the target of\n// an assignment, then bindingType should be set to BIND_NONE. Otherwise, it\n// should be set to the appropriate BIND_* constant, like BIND_VAR or\n// BIND_LEXICAL.\n//\n// If the function is called with a non-BIND_NONE bindingType, then\n// additionally a checkClashes object may be specified to allow checking for\n// duplicate argument names. checkClashes is ignored if the provided construct\n// is an assignment (i.e., bindingType is BIND_NONE).\n\npp$7.checkLValSimple = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n var isBind = bindingType !== BIND_NONE;\n\n switch (expr.type) {\n case \"Identifier\":\n if (this.strict && this.reservedWordsStrictBind.test(expr.name))\n { this.raiseRecoverable(expr.start, (isBind ? \"Binding \" : \"Assigning to \") + expr.name + \" in strict mode\"); }\n if (isBind) {\n if (bindingType === BIND_LEXICAL && expr.name === \"let\")\n { this.raiseRecoverable(expr.start, \"let is disallowed as a lexically bound name\"); }\n if (checkClashes) {\n if (hasOwn(checkClashes, expr.name))\n { this.raiseRecoverable(expr.start, \"Argument name clash\"); }\n checkClashes[expr.name] = true;\n }\n if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }\n }\n break\n\n case \"ChainExpression\":\n this.raiseRecoverable(expr.start, \"Optional chaining cannot appear in left-hand side\");\n break\n\n case \"MemberExpression\":\n if (isBind) { this.raiseRecoverable(expr.start, \"Binding member expression\"); }\n break\n\n case \"ParenthesizedExpression\":\n if (isBind) { this.raiseRecoverable(expr.start, \"Binding parenthesized expression\"); }\n return this.checkLValSimple(expr.expression, bindingType, checkClashes)\n\n default:\n this.raise(expr.start, (isBind ? \"Binding\" : \"Assigning to\") + \" rvalue\");\n }\n};\n\npp$7.checkLValPattern = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n switch (expr.type) {\n case \"ObjectPattern\":\n for (var i = 0, list = expr.properties; i < list.length; i += 1) {\n var prop = list[i];\n\n this.checkLValInnerPattern(prop, bindingType, checkClashes);\n }\n break\n\n case \"ArrayPattern\":\n for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {\n var elem = list$1[i$1];\n\n if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); }\n }\n break\n\n default:\n this.checkLValSimple(expr, bindingType, checkClashes);\n }\n};\n\npp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n switch (expr.type) {\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n this.checkLValInnerPattern(expr.value, bindingType, checkClashes);\n break\n\n case \"AssignmentPattern\":\n this.checkLValPattern(expr.left, bindingType, checkClashes);\n break\n\n case \"RestElement\":\n this.checkLValPattern(expr.argument, bindingType, checkClashes);\n break\n\n default:\n this.checkLValPattern(expr, bindingType, checkClashes);\n }\n};\n\n// The algorithm used to determine whether a regexp can appear at a\n// given point in the program is loosely based on sweet.js' approach.\n// See https://github.com/mozilla/sweet.js/wiki/design\n\n\nvar TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {\n this.token = token;\n this.isExpr = !!isExpr;\n this.preserveSpace = !!preserveSpace;\n this.override = override;\n this.generator = !!generator;\n};\n\nvar types = {\n b_stat: new TokContext(\"{\", false),\n b_expr: new TokContext(\"{\", true),\n b_tmpl: new TokContext(\"${\", false),\n p_stat: new TokContext(\"(\", false),\n p_expr: new TokContext(\"(\", true),\n q_tmpl: new TokContext(\"`\", true, true, function (p) { return p.tryReadTemplateToken(); }),\n f_stat: new TokContext(\"function\", false),\n f_expr: new TokContext(\"function\", true),\n f_expr_gen: new TokContext(\"function\", true, false, null, true),\n f_gen: new TokContext(\"function\", false, false, null, true)\n};\n\nvar pp$6 = Parser.prototype;\n\npp$6.initialContext = function() {\n return [types.b_stat]\n};\n\npp$6.curContext = function() {\n return this.context[this.context.length - 1]\n};\n\npp$6.braceIsBlock = function(prevType) {\n var parent = this.curContext();\n if (parent === types.f_expr || parent === types.f_stat)\n { return true }\n if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))\n { return !parent.isExpr }\n\n // The check for `tt.name && exprAllowed` detects whether we are\n // after a `yield` or `of` construct. See the `updateContext` for\n // `tt.name`.\n if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)\n { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }\n if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)\n { return true }\n if (prevType === types$1.braceL)\n { return parent === types.b_stat }\n if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)\n { return false }\n return !this.exprAllowed\n};\n\npp$6.inGeneratorContext = function() {\n for (var i = this.context.length - 1; i >= 1; i--) {\n var context = this.context[i];\n if (context.token === \"function\")\n { return context.generator }\n }\n return false\n};\n\npp$6.updateContext = function(prevType) {\n var update, type = this.type;\n if (type.keyword && prevType === types$1.dot)\n { this.exprAllowed = false; }\n else if (update = type.updateContext)\n { update.call(this, prevType); }\n else\n { this.exprAllowed = type.beforeExpr; }\n};\n\n// Used to handle edge cases when token context could not be inferred correctly during tokenization phase\n\npp$6.overrideContext = function(tokenCtx) {\n if (this.curContext() !== tokenCtx) {\n this.context[this.context.length - 1] = tokenCtx;\n }\n};\n\n// Token-specific context update code\n\ntypes$1.parenR.updateContext = types$1.braceR.updateContext = function() {\n if (this.context.length === 1) {\n this.exprAllowed = true;\n return\n }\n var out = this.context.pop();\n if (out === types.b_stat && this.curContext().token === \"function\") {\n out = this.context.pop();\n }\n this.exprAllowed = !out.isExpr;\n};\n\ntypes$1.braceL.updateContext = function(prevType) {\n this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);\n this.exprAllowed = true;\n};\n\ntypes$1.dollarBraceL.updateContext = function() {\n this.context.push(types.b_tmpl);\n this.exprAllowed = true;\n};\n\ntypes$1.parenL.updateContext = function(prevType) {\n var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;\n this.context.push(statementParens ? types.p_stat : types.p_expr);\n this.exprAllowed = true;\n};\n\ntypes$1.incDec.updateContext = function() {\n // tokExprAllowed stays unchanged\n};\n\ntypes$1._function.updateContext = types$1._class.updateContext = function(prevType) {\n if (prevType.beforeExpr && prevType !== types$1._else &&\n !(prevType === types$1.semi && this.curContext() !== types.p_stat) &&\n !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&\n !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))\n { this.context.push(types.f_expr); }\n else\n { this.context.push(types.f_stat); }\n this.exprAllowed = false;\n};\n\ntypes$1.colon.updateContext = function() {\n if (this.curContext().token === \"function\") { this.context.pop(); }\n this.exprAllowed = true;\n};\n\ntypes$1.backQuote.updateContext = function() {\n if (this.curContext() === types.q_tmpl)\n { this.context.pop(); }\n else\n { this.context.push(types.q_tmpl); }\n this.exprAllowed = false;\n};\n\ntypes$1.star.updateContext = function(prevType) {\n if (prevType === types$1._function) {\n var index = this.context.length - 1;\n if (this.context[index] === types.f_expr)\n { this.context[index] = types.f_expr_gen; }\n else\n { this.context[index] = types.f_gen; }\n }\n this.exprAllowed = true;\n};\n\ntypes$1.name.updateContext = function(prevType) {\n var allowed = false;\n if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {\n if (this.value === \"of\" && !this.exprAllowed ||\n this.value === \"yield\" && this.inGeneratorContext())\n { allowed = true; }\n }\n this.exprAllowed = allowed;\n};\n\n// A recursive descent parser operates by defining functions for all\n// syntactic elements, and recursively calling those, each function\n// advancing the input stream and returning an AST node. Precedence\n// of constructs (for example, the fact that `!x[1]` means `!(x[1])`\n// instead of `(!x)[1]` is handled by the fact that the parser\n// function that parses unary prefix operators is called first, and\n// in turn calls the function that parses `[]` subscripts — that\n// way, it'll receive the node for `x[1]` already parsed, and wraps\n// *that* in the unary operator node.\n//\n// Acorn uses an [operator precedence parser][opp] to handle binary\n// operator precedence, because it is much more compact than using\n// the technique outlined above, which uses different, nesting\n// functions to specify precedence, for all of the ten binary\n// precedence levels that JavaScript defines.\n//\n// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser\n\n\nvar pp$5 = Parser.prototype;\n\n// Check if property name clashes with already added.\n// Object/class getters and setters are not allowed to clash —\n// either with each other or with an init property — and in\n// strict mode, init properties are also not allowed to be repeated.\n\npp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 9 && prop.type === \"SpreadElement\")\n { return }\n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))\n { return }\n var key = prop.key;\n var name;\n switch (key.type) {\n case \"Identifier\": name = key.name; break\n case \"Literal\": name = String(key.value); break\n default: return\n }\n var kind = prop.kind;\n if (this.options.ecmaVersion >= 6) {\n if (name === \"__proto__\" && kind === \"init\") {\n if (propHash.proto) {\n if (refDestructuringErrors) {\n if (refDestructuringErrors.doubleProto < 0) {\n refDestructuringErrors.doubleProto = key.start;\n }\n } else {\n this.raiseRecoverable(key.start, \"Redefinition of __proto__ property\");\n }\n }\n propHash.proto = true;\n }\n return\n }\n name = \"$\" + name;\n var other = propHash[name];\n if (other) {\n var redefinition;\n if (kind === \"init\") {\n redefinition = this.strict && other.init || other.get || other.set;\n } else {\n redefinition = other.init || other[kind];\n }\n if (redefinition)\n { this.raiseRecoverable(key.start, \"Redefinition of property\"); }\n } else {\n other = propHash[name] = {\n init: false,\n get: false,\n set: false\n };\n }\n other[kind] = true;\n};\n\n// ### Expression parsing\n\n// These nest, from the most general expression type at the top to\n// 'atomic', nondivisible expression types at the bottom. Most of\n// the functions will simply let the function(s) below them parse,\n// and, *if* the syntactic construct they handle is present, wrap\n// the AST node that the inner parser gave them in another node.\n\n// Parse a full expression. The optional arguments are used to\n// forbid the `in` operator (in for loops initalization expressions)\n// and provide reference for storing '=' operator inside shorthand\n// property assignment in contexts where both object expression\n// and object pattern might appear (so it's possible to raise\n// delayed syntax error at correct position).\n\npp$5.parseExpression = function(forInit, refDestructuringErrors) {\n var this$1$1 = this;\n\n return this.catchStackOverflow(function () {\n var startPos = this$1$1.start, startLoc = this$1$1.startLoc;\n var expr = this$1$1.parseMaybeAssign(forInit, refDestructuringErrors);\n if (this$1$1.type === types$1.comma) {\n var node = this$1$1.startNodeAt(startPos, startLoc);\n node.expressions = [expr];\n while (this$1$1.eat(types$1.comma)) { node.expressions.push(this$1$1.parseMaybeAssign(forInit, refDestructuringErrors)); }\n return this$1$1.finishNode(node, \"SequenceExpression\")\n }\n return expr\n })\n};\n\n// Parse an assignment expression. This includes applications of\n// operators like `+=`.\n\npp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {\n if (this.isContextual(\"yield\")) {\n if (this.inGenerator) { return this.parseYield(forInit) }\n // The tokenizer will assume an expression is allowed after\n // `yield`, but this isn't that kind of yield\n else { this.exprAllowed = false; }\n }\n\n var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;\n if (refDestructuringErrors) {\n oldParenAssign = refDestructuringErrors.parenthesizedAssign;\n oldTrailingComma = refDestructuringErrors.trailingComma;\n oldDoubleProto = refDestructuringErrors.doubleProto;\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;\n } else {\n refDestructuringErrors = new DestructuringErrors;\n ownDestructuringErrors = true;\n }\n\n var startPos = this.start, startLoc = this.startLoc;\n if (this.type === types$1.parenL || this.type === types$1.name) {\n this.potentialArrowAt = this.start;\n this.potentialArrowInForAwait = forInit === \"await\";\n }\n var left = this.parseMaybeConditional(forInit, refDestructuringErrors);\n if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }\n if (this.type.isAssign) {\n var node = this.startNodeAt(startPos, startLoc);\n node.operator = this.value;\n if (this.type === types$1.eq)\n { left = this.toAssignable(left, false, refDestructuringErrors); }\n if (!ownDestructuringErrors) {\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;\n // reset these when detected inside this expression\n if (refDestructuringErrors.shorthandAssign >= left.start) { refDestructuringErrors.shorthandAssign = -1; }\n if (refDestructuringErrors.doubleProto >= left.start) { refDestructuringErrors.doubleProto = -1; }\n }\n if (this.type === types$1.eq)\n { this.checkLValPattern(left); }\n else\n { this.checkLValSimple(left); }\n node.left = left;\n this.next();\n node.right = this.parseMaybeAssign(forInit);\n if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }\n return this.finishNode(node, \"AssignmentExpression\")\n } else {\n if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }\n }\n if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }\n if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }\n return left\n};\n\n// Parse a ternary conditional (`?:`) operator.\n\npp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseExprOps(forInit, refDestructuringErrors);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n if (!(expr.type === \"ArrowFunctionExpression\" && expr.start === startPos) && this.eat(types$1.question)) {\n var node = this.startNodeAt(startPos, startLoc);\n node.test = expr;\n node.consequent = this.parseMaybeAssign();\n this.expect(types$1.colon);\n node.alternate = this.parseMaybeAssign(forInit);\n return this.finishNode(node, \"ConditionalExpression\")\n }\n return expr\n};\n\n// Start the precedence parser.\n\npp$5.parseExprOps = function(forInit, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n return expr.start === startPos && expr.type === \"ArrowFunctionExpression\" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)\n};\n\n// Parse binary operators with the operator precedence parsing\n// algorithm. `left` is the left-hand side of the operator.\n// `minPrec` provides context that allows the function to stop and\n// defer further parser to one of its callers when it encounters an\n// operator that has a lower precedence than the set it is parsing.\n\npp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {\n var prec = this.type.binop;\n if (prec != null && (!forInit || this.type !== types$1._in)) {\n if (prec > minPrec) {\n var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;\n var coalesce = this.type === types$1.coalesce;\n if (coalesce) {\n // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.\n // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.\n prec = types$1.logicalAND.binop;\n }\n var op = this.value;\n this.next();\n var startPos = this.start, startLoc = this.startLoc;\n var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);\n var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);\n if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {\n this.raiseRecoverable(this.start, \"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses\");\n }\n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)\n }\n }\n return left\n};\n\npp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {\n if (right.type === \"PrivateIdentifier\") { this.raise(right.start, \"Private identifier can only be left side of binary expression\"); }\n var node = this.startNodeAt(startPos, startLoc);\n node.left = left;\n node.operator = op;\n node.right = right;\n return this.finishNode(node, logical ? \"LogicalExpression\" : \"BinaryExpression\")\n};\n\n// Parse unary operators, both prefix and postfix.\n\npp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {\n var startPos = this.start, startLoc = this.startLoc, expr;\n if (this.isContextual(\"await\") && this.canAwait) {\n expr = this.parseAwait(forInit);\n sawUnary = true;\n } else if (this.type.prefix) {\n var node = this.startNode(), update = this.type === types$1.incDec;\n node.operator = this.value;\n node.prefix = true;\n this.next();\n node.argument = this.parseMaybeUnary(null, true, update, forInit);\n this.checkExpressionErrors(refDestructuringErrors, true);\n if (update) { this.checkLValSimple(node.argument); }\n else if (this.strict && node.operator === \"delete\" && isLocalVariableAccess(node.argument))\n { this.raiseRecoverable(node.start, \"Deleting local variable in strict mode\"); }\n else if (node.operator === \"delete\" && isPrivateFieldAccess(node.argument))\n { this.raiseRecoverable(node.start, \"Private fields can not be deleted\"); }\n else { sawUnary = true; }\n expr = this.finishNode(node, update ? \"UpdateExpression\" : \"UnaryExpression\");\n } else if (!sawUnary && this.type === types$1.privateId) {\n if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }\n expr = this.parsePrivateIdent();\n // only could be private fields in 'in', such as #x in obj\n if (this.type !== types$1._in) { this.unexpected(); }\n } else {\n expr = this.parseExprSubscripts(refDestructuringErrors, forInit);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n while (this.type.postfix && !this.canInsertSemicolon()) {\n var node$1 = this.startNodeAt(startPos, startLoc);\n node$1.operator = this.value;\n node$1.prefix = false;\n node$1.argument = expr;\n this.checkLValSimple(expr);\n this.next();\n expr = this.finishNode(node$1, \"UpdateExpression\");\n }\n }\n\n if (!incDec && !(expr.type === \"ArrowFunctionExpression\" && expr.start === startPos) && this.eat(types$1.starstar)) {\n if (sawUnary)\n { this.unexpected(this.lastTokStart); }\n else\n { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), \"**\", false) }\n } else {\n return expr\n }\n};\n\nfunction isLocalVariableAccess(node) {\n return (\n node.type === \"Identifier\" ||\n node.type === \"ParenthesizedExpression\" && isLocalVariableAccess(node.expression)\n )\n}\n\nfunction isPrivateFieldAccess(node) {\n return (\n node.type === \"MemberExpression\" && node.property.type === \"PrivateIdentifier\" ||\n node.type === \"ChainExpression\" && isPrivateFieldAccess(node.expression) ||\n node.type === \"ParenthesizedExpression\" && isPrivateFieldAccess(node.expression)\n )\n}\n\n// Parse call, dot, and `[]`-subscript expressions.\n\npp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {\n var startPos = this.start, startLoc = this.startLoc;\n var oldDoubleProto = -1, oldShorthandAssign = -1;\n if (refDestructuringErrors) {\n oldDoubleProto = refDestructuringErrors.doubleProto;\n oldShorthandAssign = refDestructuringErrors.shorthandAssign;\n refDestructuringErrors.doubleProto = refDestructuringErrors.shorthandAssign = -1;\n }\n var expr = this.parseExprAtom(refDestructuringErrors, forInit);\n if (expr.type === \"ArrowFunctionExpression\" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== \")\")\n { return expr }\n var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);\n if (refDestructuringErrors) {\n if (result.end > expr.end) {\n this.checkExpressionErrors(refDestructuringErrors, true);\n if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }\n if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }\n if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }\n }\n if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }\n if (oldShorthandAssign > -1) { refDestructuringErrors.shorthandAssign = oldShorthandAssign; }\n }\n return result\n};\n\npp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {\n var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === \"Identifier\" && base.name === \"async\" &&\n this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&\n this.potentialArrowAt === base.start;\n var optionalChained = false;\n\n while (true) {\n var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);\n\n if (element.optional) { optionalChained = true; }\n if (element.end === base.end || element.type === \"ArrowFunctionExpression\") {\n if (optionalChained) {\n var chainNode = this.startNodeAt(startPos, startLoc);\n chainNode.expression = element;\n element = this.finishNode(chainNode, \"ChainExpression\");\n }\n return element\n }\n\n base = element;\n maybeAsyncArrow = false;\n }\n};\n\npp$5.shouldParseAsyncArrow = function() {\n return !this.canInsertSemicolon() && this.eat(types$1.arrow)\n};\n\npp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)\n};\n\npp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {\n var optionalSupported = this.options.ecmaVersion >= 11;\n var optional = optionalSupported && this.eat(types$1.questionDot);\n if (noCalls && optional) { this.raise(this.lastTokStart, \"Optional chaining cannot appear in the callee of new expressions\"); }\n\n var computed = this.eat(types$1.bracketL);\n if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {\n var node = this.startNodeAt(startPos, startLoc);\n node.object = base;\n if (computed) {\n node.property = this.parseExpression();\n this.expect(types$1.bracketR);\n } else if (this.type === types$1.privateId && base.type !== \"Super\") {\n node.property = this.parsePrivateIdent();\n } else {\n node.property = this.parseIdent(this.options.allowReserved !== \"never\");\n }\n node.computed = !!computed;\n if (optionalSupported) {\n node.optional = optional;\n }\n base = this.finishNode(node, \"MemberExpression\");\n } else if (!noCalls && this.eat(types$1.parenL)) {\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);\n if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {\n this.checkPatternErrors(refDestructuringErrors, false);\n this.checkYieldAwaitInDefaultParams();\n if (this.awaitIdentPos > 0)\n { this.raise(this.awaitIdentPos, \"Cannot use 'await' as identifier inside an async function\"); }\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)\n }\n this.checkExpressionErrors(refDestructuringErrors, true);\n this.yieldPos = oldYieldPos || this.yieldPos;\n this.awaitPos = oldAwaitPos || this.awaitPos;\n this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;\n var node$1 = this.startNodeAt(startPos, startLoc);\n node$1.callee = base;\n node$1.arguments = exprList;\n if (optionalSupported) {\n node$1.optional = optional;\n }\n base = this.finishNode(node$1, \"CallExpression\");\n } else if (this.type === types$1.backQuote) {\n if (optional || optionalChained) {\n this.raise(this.start, \"Optional chaining cannot appear in the tag of tagged template expressions\");\n }\n var node$2 = this.startNodeAt(startPos, startLoc);\n node$2.tag = base;\n node$2.quasi = this.parseTemplate({isTagged: true});\n base = this.finishNode(node$2, \"TaggedTemplateExpression\");\n }\n return base\n};\n\n// Parse an atomic expression — either a single token that is an\n// expression, an expression started by a keyword like `function` or\n// `new`, or an expression wrapped in punctuation like `()`, `[]`,\n// or `{}`.\n\npp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {\n // If a division operator appears in an expression position, the\n // tokenizer got confused, and we force it to read a regexp instead.\n if (this.type === types$1.slash) { this.readRegexp(); }\n\n var node, canBeArrow = this.potentialArrowAt === this.start;\n switch (this.type) {\n case types$1._super:\n if (!this.allowSuper)\n { this.raise(this.start, \"'super' keyword outside a method\"); }\n node = this.startNode();\n this.next();\n if (this.type === types$1.parenL && !this.allowDirectSuper)\n { this.raise(node.start, \"super() call outside constructor of a subclass\"); }\n // The `super` keyword can appear at below:\n // SuperProperty:\n // super [ Expression ]\n // super . IdentifierName\n // SuperCall:\n // super ( Arguments )\n if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)\n { this.unexpected(); }\n return this.finishNode(node, \"Super\")\n\n case types$1._this:\n node = this.startNode();\n this.next();\n return this.finishNode(node, \"ThisExpression\")\n\n case types$1.name:\n var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;\n var id = this.parseIdent(false);\n if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === \"async\" && !this.canInsertSemicolon() && this.eat(types$1._function)) {\n this.overrideContext(types.f_expr);\n return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)\n }\n if (canBeArrow && !this.canInsertSemicolon()) {\n if (this.eat(types$1.arrow))\n { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && this.type === types$1.name && !containsEsc &&\n (!this.potentialArrowInForAwait || this.value !== \"of\" || this.containsEsc)) {\n id = this.parseIdent(false);\n if (this.canInsertSemicolon() || !this.eat(types$1.arrow))\n { this.unexpected(); }\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)\n }\n }\n return id\n\n case types$1.regexp:\n var value = this.value;\n node = this.parseLiteral(value.value);\n node.regex = {pattern: value.pattern, flags: value.flags};\n return node\n\n case types$1.num: case types$1.string:\n return this.parseLiteral(this.value)\n\n case types$1._null: case types$1._true: case types$1._false:\n node = this.startNode();\n node.value = this.type === types$1._null ? null : this.type === types$1._true;\n node.raw = this.type.keyword;\n this.next();\n return this.finishNode(node, \"Literal\")\n\n case types$1.parenL:\n var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);\n if (refDestructuringErrors) {\n if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))\n { refDestructuringErrors.parenthesizedAssign = start; }\n if (refDestructuringErrors.parenthesizedBind < 0)\n { refDestructuringErrors.parenthesizedBind = start; }\n }\n return expr\n\n case types$1.bracketL:\n node = this.startNode();\n this.next();\n node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);\n return this.finishNode(node, \"ArrayExpression\")\n\n case types$1.braceL:\n this.overrideContext(types.b_expr);\n return this.parseObj(false, refDestructuringErrors)\n\n case types$1._function:\n node = this.startNode();\n this.next();\n return this.parseFunction(node, 0)\n\n case types$1._class:\n return this.parseClass(this.startNode(), false)\n\n case types$1._new:\n return this.parseNew()\n\n case types$1.backQuote:\n return this.parseTemplate()\n\n case types$1._import:\n if (this.options.ecmaVersion >= 11) {\n return this.parseExprImport(forNew)\n } else {\n return this.unexpected()\n }\n\n default:\n return this.parseExprAtomDefault()\n }\n};\n\npp$5.parseExprAtomDefault = function() {\n this.unexpected();\n};\n\npp$5.parseExprImport = function(forNew) {\n var node = this.startNode();\n\n // Consume `import` as an identifier for `import.meta`.\n // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.\n if (this.containsEsc) { this.raiseRecoverable(this.start, \"Escape sequence in keyword import\"); }\n this.next();\n\n if (this.type === types$1.parenL && !forNew) {\n return this.parseDynamicImport(node)\n } else if (this.type === types$1.dot) {\n var meta = this.startNodeAt(node.start, node.loc && node.loc.start);\n meta.name = \"import\";\n node.meta = this.finishNode(meta, \"Identifier\");\n return this.parseImportMeta(node)\n } else {\n this.unexpected();\n }\n};\n\npp$5.parseDynamicImport = function(node) {\n this.next(); // skip `(`\n\n // Parse node.source.\n node.source = this.parseMaybeAssign();\n\n if (this.options.ecmaVersion >= 16) {\n if (!this.eat(types$1.parenR)) {\n this.expect(types$1.comma);\n if (!this.afterTrailingComma(types$1.parenR)) {\n node.options = this.parseMaybeAssign();\n if (!this.eat(types$1.parenR)) {\n this.expect(types$1.comma);\n if (!this.afterTrailingComma(types$1.parenR)) {\n this.unexpected();\n }\n }\n } else {\n node.options = null;\n }\n } else {\n node.options = null;\n }\n } else {\n // Verify ending.\n if (!this.eat(types$1.parenR)) {\n var errorPos = this.start;\n if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {\n this.raiseRecoverable(errorPos, \"Trailing comma is not allowed in import()\");\n } else {\n this.unexpected(errorPos);\n }\n }\n }\n\n return this.finishNode(node, \"ImportExpression\")\n};\n\npp$5.parseImportMeta = function(node) {\n this.next(); // skip `.`\n\n var containsEsc = this.containsEsc;\n node.property = this.parseIdent(true);\n\n if (node.property.name !== \"meta\")\n { this.raiseRecoverable(node.property.start, \"The only valid meta property for import is 'import.meta'\"); }\n if (containsEsc)\n { this.raiseRecoverable(node.start, \"'import.meta' must not contain escaped characters\"); }\n if (this.options.sourceType !== \"module\" && !this.options.allowImportExportEverywhere)\n { this.raiseRecoverable(node.start, \"Cannot use 'import.meta' outside a module\"); }\n\n return this.finishNode(node, \"MetaProperty\")\n};\n\npp$5.parseLiteral = function(value) {\n var node = this.startNode();\n node.value = value;\n node.raw = this.input.slice(this.start, this.end);\n if (node.raw.charCodeAt(node.raw.length - 1) === 110)\n { node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, \"\"); }\n this.next();\n return this.finishNode(node, \"Literal\")\n};\n\npp$5.parseParenExpression = function() {\n this.expect(types$1.parenL);\n var val = this.parseExpression();\n this.expect(types$1.parenR);\n return val\n};\n\npp$5.shouldParseArrow = function(exprList) {\n return !this.canInsertSemicolon()\n};\n\npp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {\n var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;\n if (this.options.ecmaVersion >= 6) {\n this.next();\n\n var innerStartPos = this.start, innerStartLoc = this.startLoc;\n var exprList = [], first = true, lastIsComma = false;\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;\n this.yieldPos = 0;\n this.awaitPos = 0;\n // Do not save awaitIdentPos to allow checking awaits nested in parameters\n while (this.type !== types$1.parenR) {\n first ? first = false : this.expect(types$1.comma);\n if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {\n lastIsComma = true;\n break\n } else if (this.type === types$1.ellipsis) {\n spreadStart = this.start;\n exprList.push(this.parseParenItem(this.parseRestBinding()));\n if (this.type === types$1.comma) {\n this.raiseRecoverable(\n this.start,\n \"Comma is not permitted after the rest element\"\n );\n }\n break\n } else {\n exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));\n }\n }\n var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;\n this.expect(types$1.parenR);\n\n if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, false);\n this.checkYieldAwaitInDefaultParams();\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n return this.parseParenArrowList(startPos, startLoc, exprList, forInit)\n }\n\n if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }\n if (spreadStart) { this.unexpected(spreadStart); }\n this.checkExpressionErrors(refDestructuringErrors, true);\n this.yieldPos = oldYieldPos || this.yieldPos;\n this.awaitPos = oldAwaitPos || this.awaitPos;\n\n if (exprList.length > 1) {\n val = this.startNodeAt(innerStartPos, innerStartLoc);\n val.expressions = exprList;\n this.finishNodeAt(val, \"SequenceExpression\", innerEndPos, innerEndLoc);\n } else {\n val = exprList[0];\n }\n } else {\n val = this.parseParenExpression();\n }\n\n if (this.options.preserveParens) {\n var par = this.startNodeAt(startPos, startLoc);\n par.expression = val;\n return this.finishNode(par, \"ParenthesizedExpression\")\n } else {\n return val\n }\n};\n\npp$5.parseParenItem = function(item) {\n return item\n};\n\npp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)\n};\n\n// New's precedence is slightly tricky. It must allow its argument to\n// be a `[]` or dot subscript expression, but not a call — at least,\n// not without wrapping it in parentheses. Thus, it uses the noCalls\n// argument to parseSubscripts to prevent it from consuming the\n// argument list.\n\nvar empty = [];\n\npp$5.parseNew = function() {\n if (this.containsEsc) { this.raiseRecoverable(this.start, \"Escape sequence in keyword new\"); }\n var node = this.startNode();\n this.next();\n if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {\n var meta = this.startNodeAt(node.start, node.loc && node.loc.start);\n meta.name = \"new\";\n node.meta = this.finishNode(meta, \"Identifier\");\n this.next();\n var containsEsc = this.containsEsc;\n node.property = this.parseIdent(true);\n if (node.property.name !== \"target\")\n { this.raiseRecoverable(node.property.start, \"The only valid meta property for new is 'new.target'\"); }\n if (containsEsc)\n { this.raiseRecoverable(node.start, \"'new.target' must not contain escaped characters\"); }\n if (!this.allowNewDotTarget)\n { this.raiseRecoverable(node.start, \"'new.target' can only be used in functions and class static block\"); }\n return this.finishNode(node, \"MetaProperty\")\n }\n var startPos = this.start, startLoc = this.startLoc;\n node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);\n if (node.callee.type === \"Super\")\n { this.raiseRecoverable(startPos, \"Invalid use of 'super'\"); }\n if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }\n else { node.arguments = empty; }\n return this.finishNode(node, \"NewExpression\")\n};\n\n// Parse template expression.\n\npp$5.parseTemplateElement = function(ref) {\n var isTagged = ref.isTagged;\n\n var elem = this.startNode();\n if (this.type === types$1.invalidTemplate) {\n if (!isTagged) {\n this.raiseRecoverable(this.start, \"Bad escape sequence in untagged template literal\");\n }\n elem.value = {\n raw: this.value.replace(/\\r\\n?/g, \"\\n\"),\n cooked: null\n };\n } else {\n elem.value = {\n raw: this.input.slice(this.start, this.end).replace(/\\r\\n?/g, \"\\n\"),\n cooked: this.value\n };\n }\n this.next();\n elem.tail = this.type === types$1.backQuote;\n return this.finishNode(elem, \"TemplateElement\")\n};\n\npp$5.parseTemplate = function(ref) {\n if ( ref === void 0 ) ref = {};\n var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;\n\n var node = this.startNode();\n this.next();\n node.expressions = [];\n var curElt = this.parseTemplateElement({isTagged: isTagged});\n node.quasis = [curElt];\n while (!curElt.tail) {\n if (this.type === types$1.eof) { this.raise(this.pos, \"Unterminated template literal\"); }\n this.expect(types$1.dollarBraceL);\n node.expressions.push(this.parseExpression());\n this.expect(types$1.braceR);\n node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));\n }\n this.next();\n return this.finishNode(node, \"TemplateLiteral\")\n};\n\npp$5.isAsyncProp = function(prop) {\n return !prop.computed && prop.key.type === \"Identifier\" && prop.key.name === \"async\" &&\n (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&\n !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n};\n\n// Parse an object literal or binding pattern.\n\npp$5.parseObj = function(isPattern, refDestructuringErrors) {\n var node = this.startNode(), first = true, propHash = {};\n node.properties = [];\n this.next();\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n var prop = this.parseProperty(isPattern, refDestructuringErrors);\n if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }\n node.properties.push(prop);\n }\n return this.finishNode(node, isPattern ? \"ObjectPattern\" : \"ObjectExpression\")\n};\n\npp$5.parseProperty = function(isPattern, refDestructuringErrors) {\n var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;\n if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {\n if (isPattern) {\n prop.argument = this.parseIdent(false);\n if (this.type === types$1.comma) {\n this.raiseRecoverable(this.start, \"Comma is not permitted after the rest element\");\n }\n return this.finishNode(prop, \"RestElement\")\n }\n // Parse argument.\n prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);\n // To disallow trailing comma via `this.toAssignable()`.\n if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {\n refDestructuringErrors.trailingComma = this.start;\n }\n // Finish\n return this.finishNode(prop, \"SpreadElement\")\n }\n if (this.options.ecmaVersion >= 6) {\n prop.method = false;\n prop.shorthand = false;\n if (isPattern || refDestructuringErrors) {\n startPos = this.start;\n startLoc = this.startLoc;\n }\n if (!isPattern)\n { isGenerator = this.eat(types$1.star); }\n }\n var containsEsc = this.containsEsc;\n this.parsePropertyName(prop);\n if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {\n isAsync = true;\n isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);\n this.parsePropertyName(prop);\n } else {\n isAsync = false;\n }\n this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);\n return this.finishNode(prop, \"Property\")\n};\n\npp$5.parseGetterSetter = function(prop) {\n var kind = prop.key.name;\n this.parsePropertyName(prop);\n prop.value = this.parseMethod(false);\n prop.kind = kind;\n var paramCount = prop.kind === \"get\" ? 0 : 1;\n if (prop.value.params.length !== paramCount) {\n var start = prop.value.start;\n if (prop.kind === \"get\")\n { this.raiseRecoverable(start, \"getter should have no params\"); }\n else\n { this.raiseRecoverable(start, \"setter should have exactly one param\"); }\n } else {\n if (prop.kind === \"set\" && prop.value.params[0].type === \"RestElement\")\n { this.raiseRecoverable(prop.value.params[0].start, \"Setter cannot use rest params\"); }\n }\n};\n\npp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {\n if ((isGenerator || isAsync) && this.type === types$1.colon)\n { this.unexpected(); }\n\n if (this.eat(types$1.colon)) {\n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);\n prop.kind = \"init\";\n } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {\n if (isPattern) { this.unexpected(); }\n prop.method = true;\n prop.value = this.parseMethod(isGenerator, isAsync);\n prop.kind = \"init\";\n } else if (!isPattern && !containsEsc &&\n this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === \"Identifier\" &&\n (prop.key.name === \"get\" || prop.key.name === \"set\") &&\n (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {\n if (isGenerator || isAsync) { this.unexpected(); }\n this.parseGetterSetter(prop);\n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === \"Identifier\") {\n if (isGenerator || isAsync) { this.unexpected(); }\n this.checkUnreserved(prop.key);\n if (prop.key.name === \"await\" && !this.awaitIdentPos)\n { this.awaitIdentPos = startPos; }\n if (isPattern) {\n prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));\n } else if (this.type === types$1.eq && refDestructuringErrors) {\n if (refDestructuringErrors.shorthandAssign < 0)\n { refDestructuringErrors.shorthandAssign = this.start; }\n prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));\n } else {\n prop.value = this.copyNode(prop.key);\n }\n prop.kind = \"init\";\n prop.shorthand = true;\n } else { this.unexpected(); }\n};\n\npp$5.parsePropertyName = function(prop) {\n if (this.options.ecmaVersion >= 6) {\n if (this.eat(types$1.bracketL)) {\n prop.computed = true;\n prop.key = this.parseMaybeAssign();\n this.expect(types$1.bracketR);\n return prop.key\n } else {\n prop.computed = false;\n }\n }\n return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== \"never\")\n};\n\n// Initialize empty function node.\n\npp$5.initFunction = function(node) {\n node.id = null;\n if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }\n if (this.options.ecmaVersion >= 8) { node.async = false; }\n};\n\n// Parse object or class method.\n\npp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {\n var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n\n this.initFunction(node);\n if (this.options.ecmaVersion >= 6)\n { node.generator = isGenerator; }\n if (this.options.ecmaVersion >= 8)\n { node.async = !!isAsync; }\n\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));\n\n this.expect(types$1.parenL);\n node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);\n this.checkYieldAwaitInDefaultParams();\n this.parseFunctionBody(node, false, true, false);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, \"FunctionExpression\")\n};\n\n// Parse arrow function expression with given parameters.\n\npp$5.parseArrowExpression = function(node, params, isAsync, forInit) {\n var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n\n this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);\n this.initFunction(node);\n if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }\n\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n\n node.params = this.toAssignableList(params, true);\n this.parseFunctionBody(node, true, false, forInit);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, \"ArrowFunctionExpression\")\n};\n\n// Parse function body and check parameters.\n\npp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {\n var isExpression = isArrowFunction && this.type !== types$1.braceL;\n var oldStrict = this.strict, useStrict = false;\n\n if (isExpression) {\n node.body = this.parseMaybeAssign(forInit);\n node.expression = true;\n this.checkParams(node, false);\n } else {\n var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);\n if (!oldStrict || nonSimple) {\n useStrict = this.strictDirective(this.end);\n // If this is a strict mode function, verify that argument names\n // are not repeated, and it does not try to bind the words `eval`\n // or `arguments`.\n if (useStrict && nonSimple)\n { this.raiseRecoverable(node.start, \"Illegal 'use strict' directive in function with non-simple parameter list\"); }\n }\n // Start a new scope with regard to labels and the `inFunction`\n // flag (restore them to their old value afterwards).\n var oldLabels = this.labels;\n this.labels = [];\n if (useStrict) { this.strict = true; }\n\n // Add the params to varDeclaredNames to ensure that an error is thrown\n // if a let/const declaration in the function clashes with one of the params.\n this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));\n // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'\n if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); }\n node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);\n node.expression = false;\n this.adaptDirectivePrologue(node.body.body);\n this.labels = oldLabels;\n }\n this.exitScope();\n};\n\npp$5.isSimpleParamList = function(params) {\n for (var i = 0, list = params; i < list.length; i += 1)\n {\n var param = list[i];\n\n if (param.type !== \"Identifier\") { return false\n } }\n return true\n};\n\n// Checks function params for various disallowed patterns such as using \"eval\"\n// or \"arguments\" and duplicate parameters.\n\npp$5.checkParams = function(node, allowDuplicates) {\n var nameHash = Object.create(null);\n for (var i = 0, list = node.params; i < list.length; i += 1)\n {\n var param = list[i];\n\n this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);\n }\n};\n\n// Parses a comma-separated list of expressions, and returns them as\n// an array. `close` is the token type that ends the list, and\n// `allowEmpty` can be turned on to allow subsequent commas with\n// nothing in between them to be parsed as `null` (which is needed\n// for array literals).\n\npp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {\n var elts = [], first = true;\n while (!this.eat(close)) {\n if (!first) {\n this.expect(types$1.comma);\n if (allowTrailingComma && this.afterTrailingComma(close)) { break }\n } else { first = false; }\n\n var elt = (void 0);\n if (allowEmpty && this.type === types$1.comma)\n { elt = null; }\n else if (this.type === types$1.ellipsis) {\n elt = this.parseSpread(refDestructuringErrors);\n if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)\n { refDestructuringErrors.trailingComma = this.start; }\n } else {\n elt = this.parseMaybeAssign(false, refDestructuringErrors);\n }\n elts.push(elt);\n }\n return elts\n};\n\npp$5.checkUnreserved = function(ref) {\n var start = ref.start;\n var end = ref.end;\n var name = ref.name;\n\n if (this.inGenerator && name === \"yield\")\n { this.raiseRecoverable(start, \"Cannot use 'yield' as identifier inside a generator\"); }\n if (this.inAsync && name === \"await\")\n { this.raiseRecoverable(start, \"Cannot use 'await' as identifier inside an async function\"); }\n if (!(this.currentThisScope().flags & SCOPE_VAR) && name === \"arguments\")\n { this.raiseRecoverable(start, \"Cannot use 'arguments' in class field initializer\"); }\n if (this.inClassStaticBlock && (name === \"arguments\" || name === \"await\"))\n { this.raise(start, (\"Cannot use \" + name + \" in class static initialization block\")); }\n if (this.keywords.test(name))\n { this.raise(start, (\"Unexpected keyword '\" + name + \"'\")); }\n if (this.options.ecmaVersion < 6 &&\n this.input.slice(start, end).indexOf(\"\\\\\") !== -1) { return }\n var re = this.strict ? this.reservedWordsStrict : this.reservedWords;\n if (re.test(name)) {\n if (!this.inAsync && name === \"await\")\n { this.raiseRecoverable(start, \"Cannot use keyword 'await' outside an async function\"); }\n this.raiseRecoverable(start, (\"The keyword '\" + name + \"' is reserved\"));\n }\n};\n\n// Parse the next token as an identifier. If `liberal` is true (used\n// when parsing properties), it will also convert keywords into\n// identifiers.\n\npp$5.parseIdent = function(liberal) {\n var node = this.parseIdentNode();\n this.next(!!liberal);\n this.finishNode(node, \"Identifier\");\n if (!liberal) {\n this.checkUnreserved(node);\n if (node.name === \"await\" && !this.awaitIdentPos)\n { this.awaitIdentPos = node.start; }\n }\n return node\n};\n\npp$5.parseIdentNode = function() {\n var node = this.startNode();\n if (this.type === types$1.name) {\n node.name = this.value;\n } else if (this.type.keyword) {\n node.name = this.type.keyword;\n\n // To fix https://github.com/acornjs/acorn/issues/575\n // `class` and `function` keywords push new context into this.context.\n // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.\n // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword\n if ((node.name === \"class\" || node.name === \"function\") &&\n (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {\n this.context.pop();\n }\n this.type = types$1.name;\n } else {\n this.unexpected();\n }\n return node\n};\n\npp$5.parsePrivateIdent = function() {\n var node = this.startNode();\n if (this.type === types$1.privateId) {\n node.name = this.value;\n } else {\n this.unexpected();\n }\n this.next();\n this.finishNode(node, \"PrivateIdentifier\");\n\n // For validating existence\n if (this.options.checkPrivateFields) {\n if (this.privateNameStack.length === 0) {\n this.raise(node.start, (\"Private field '#\" + (node.name) + \"' must be declared in an enclosing class\"));\n } else {\n this.privateNameStack[this.privateNameStack.length - 1].used.push(node);\n }\n }\n\n return node\n};\n\n// Parses yield expression inside generator.\n\npp$5.parseYield = function(forInit) {\n if (!this.yieldPos) { this.yieldPos = this.start; }\n\n var node = this.startNode();\n this.next();\n if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {\n node.delegate = false;\n node.argument = null;\n } else {\n node.delegate = this.eat(types$1.star);\n node.argument = this.parseMaybeAssign(forInit);\n }\n return this.finishNode(node, \"YieldExpression\")\n};\n\npp$5.parseAwait = function(forInit) {\n if (!this.awaitPos) { this.awaitPos = this.start; }\n\n var node = this.startNode();\n this.next();\n node.argument = this.parseMaybeUnary(null, true, false, forInit);\n return this.finishNode(node, \"AwaitExpression\")\n};\n\nvar pp$4 = Parser.prototype;\n\n// This function is used to raise exceptions on parse errors. It\n// takes an offset integer (into the current `input`) to indicate\n// the location of the error, attaches the position to the end\n// of the error message, and then raises a `SyntaxError` with that\n// message.\n\npp$4.raise = function(pos, message) {\n var loc = getLineInfo(this.input, pos);\n message += \" (\" + loc.line + \":\" + loc.column + \")\";\n if (this.sourceFile) {\n message += \" in \" + this.sourceFile;\n }\n var err = new SyntaxError(message);\n err.pos = pos; err.loc = loc; err.raisedAt = this.pos;\n throw err\n};\n\npp$4.raiseRecoverable = pp$4.raise;\n\npp$4.curPosition = function() {\n if (this.options.locations) {\n return new Position(this.curLine, this.pos - this.lineStart)\n }\n};\n\nvar pp$3 = Parser.prototype;\n\nvar Scope = function Scope(flags) {\n this.flags = flags;\n // A list of var-declared names in the current lexical scope\n this.var = [];\n // A list of lexically-declared names in the current lexical scope\n this.lexical = [];\n // A list of lexically-declared FunctionDeclaration names in the current lexical scope\n this.functions = [];\n};\n\n// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.\n\npp$3.enterScope = function(flags) {\n this.scopeStack.push(new Scope(flags));\n};\n\npp$3.exitScope = function() {\n this.scopeStack.pop();\n};\n\n// The spec says:\n// > At the top level of a function, or script, function declarations are\n// > treated like var declarations rather than like lexical declarations.\npp$3.treatFunctionsAsVarInScope = function(scope) {\n return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)\n};\n\npp$3.declareName = function(name, bindingType, pos) {\n var redeclared = false;\n if (bindingType === BIND_LEXICAL) {\n var scope = this.currentScope();\n redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;\n scope.lexical.push(name);\n if (this.inModule && (scope.flags & SCOPE_TOP))\n { delete this.undefinedExports[name]; }\n } else if (bindingType === BIND_SIMPLE_CATCH) {\n var scope$1 = this.currentScope();\n scope$1.lexical.push(name);\n } else if (bindingType === BIND_FUNCTION) {\n var scope$2 = this.currentScope();\n if (this.treatFunctionsAsVar)\n { redeclared = scope$2.lexical.indexOf(name) > -1; }\n else\n { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }\n scope$2.functions.push(name);\n } else {\n for (var i = this.scopeStack.length - 1; i >= 0; --i) {\n var scope$3 = this.scopeStack[i];\n if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||\n !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {\n redeclared = true;\n break\n }\n scope$3.var.push(name);\n if (this.inModule && (scope$3.flags & SCOPE_TOP))\n { delete this.undefinedExports[name]; }\n if (scope$3.flags & SCOPE_VAR) { break }\n }\n }\n if (redeclared) { this.raiseRecoverable(pos, (\"Identifier '\" + name + \"' has already been declared\")); }\n};\n\npp$3.checkLocalExport = function(id) {\n // scope.functions must be empty as Module code is always strict.\n if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&\n this.scopeStack[0].var.indexOf(id.name) === -1) {\n this.undefinedExports[id.name] = id;\n }\n};\n\npp$3.currentScope = function() {\n return this.scopeStack[this.scopeStack.length - 1]\n};\n\npp$3.currentVarScope = function() {\n for (var i = this.scopeStack.length - 1;; i--) {\n var scope = this.scopeStack[i];\n if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) { return scope }\n }\n};\n\n// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.\npp$3.currentThisScope = function() {\n for (var i = this.scopeStack.length - 1;; i--) {\n var scope = this.scopeStack[i];\n if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) &&\n !(scope.flags & SCOPE_ARROW)) { return scope }\n }\n};\n\nvar Node = function Node(parser, pos, loc) {\n this.type = \"\";\n this.start = pos;\n this.end = 0;\n if (parser.options.locations)\n { this.loc = new SourceLocation(parser, loc); }\n if (parser.options.directSourceFile)\n { this.sourceFile = parser.options.directSourceFile; }\n if (parser.options.ranges)\n { this.range = [pos, 0]; }\n};\n\n// Start an AST node, attaching a start offset.\n\nvar pp$2 = Parser.prototype;\n\npp$2.startNode = function() {\n return new Node(this, this.start, this.startLoc)\n};\n\npp$2.startNodeAt = function(pos, loc) {\n return new Node(this, pos, loc)\n};\n\n// Finish an AST node, adding `type` and `end` properties.\n\nfunction finishNodeAt(node, type, pos, loc) {\n node.type = type;\n node.end = pos;\n if (this.options.locations)\n { node.loc.end = loc; }\n if (this.options.ranges)\n { node.range[1] = pos; }\n return node\n}\n\npp$2.finishNode = function(node, type) {\n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)\n};\n\n// Finish node at given position\n\npp$2.finishNodeAt = function(node, type, pos, loc) {\n return finishNodeAt.call(this, node, type, pos, loc)\n};\n\npp$2.copyNode = function(node) {\n var newNode = new Node(this, node.start, this.startLoc);\n for (var prop in node) { newNode[prop] = node[prop]; }\n return newNode\n};\n\n// This file was generated by \"bin/generate-unicode-script-values.js\". Do not modify manually!\nvar scriptValuesAddedInUnicode = \"Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz\";\n\n// This file contains Unicode properties extracted from the ECMAScript specification.\n// The lists are extracted like so:\n// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)\n\n// #table-binary-unicode-properties\nvar ecma9BinaryProperties = \"ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS\";\nvar ecma10BinaryProperties = ecma9BinaryProperties + \" Extended_Pictographic\";\nvar ecma11BinaryProperties = ecma10BinaryProperties;\nvar ecma12BinaryProperties = ecma11BinaryProperties + \" EBase EComp EMod EPres ExtPict\";\nvar ecma13BinaryProperties = ecma12BinaryProperties;\nvar ecma14BinaryProperties = ecma13BinaryProperties;\n\nvar unicodeBinaryProperties = {\n 9: ecma9BinaryProperties,\n 10: ecma10BinaryProperties,\n 11: ecma11BinaryProperties,\n 12: ecma12BinaryProperties,\n 13: ecma13BinaryProperties,\n 14: ecma14BinaryProperties\n};\n\n// #table-binary-unicode-properties-of-strings\nvar ecma14BinaryPropertiesOfStrings = \"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji\";\n\nvar unicodeBinaryPropertiesOfStrings = {\n 9: \"\",\n 10: \"\",\n 11: \"\",\n 12: \"\",\n 13: \"\",\n 14: ecma14BinaryPropertiesOfStrings\n};\n\n// #table-unicode-general-category-values\nvar unicodeGeneralCategoryValues = \"Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu\";\n\n// #table-unicode-script-values\nvar ecma9ScriptValues = \"Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb\";\nvar ecma10ScriptValues = ecma9ScriptValues + \" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd\";\nvar ecma11ScriptValues = ecma10ScriptValues + \" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho\";\nvar ecma12ScriptValues = ecma11ScriptValues + \" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi\";\nvar ecma13ScriptValues = ecma12ScriptValues + \" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith\";\nvar ecma14ScriptValues = ecma13ScriptValues + \" \" + scriptValuesAddedInUnicode;\n\nvar unicodeScriptValues = {\n 9: ecma9ScriptValues,\n 10: ecma10ScriptValues,\n 11: ecma11ScriptValues,\n 12: ecma12ScriptValues,\n 13: ecma13ScriptValues,\n 14: ecma14ScriptValues\n};\n\nvar data = {};\nfunction buildUnicodeData(ecmaVersion) {\n var d = data[ecmaVersion] = {\n binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + \" \" + unicodeGeneralCategoryValues),\n binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),\n nonBinary: {\n General_Category: wordsRegexp(unicodeGeneralCategoryValues),\n Script: wordsRegexp(unicodeScriptValues[ecmaVersion])\n }\n };\n d.nonBinary.Script_Extensions = d.nonBinary.Script;\n\n d.nonBinary.gc = d.nonBinary.General_Category;\n d.nonBinary.sc = d.nonBinary.Script;\n d.nonBinary.scx = d.nonBinary.Script_Extensions;\n}\n\nfor (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {\n var ecmaVersion = list[i];\n\n buildUnicodeData(ecmaVersion);\n}\n\nvar pp$1 = Parser.prototype;\n\n// Track disjunction structure to determine whether a duplicate\n// capture group name is allowed because it is in a separate branch.\nvar BranchID = function BranchID(parent, base) {\n // Parent disjunction branch\n this.parent = parent;\n // Identifies this set of sibling branches\n this.base = base || this;\n};\n\nBranchID.prototype.separatedFrom = function separatedFrom (alt) {\n // A branch is separate from another branch if they or any of\n // their parents are siblings in a given disjunction\n for (var self = this; self; self = self.parent) {\n for (var other = alt; other; other = other.parent) {\n if (self.base === other.base && self !== other) { return true }\n }\n }\n return false\n};\n\nBranchID.prototype.sibling = function sibling () {\n return new BranchID(this.parent, this.base)\n};\n\nvar RegExpValidationState = function RegExpValidationState(parser) {\n this.parser = parser;\n this.validFlags = \"gim\" + (parser.options.ecmaVersion >= 6 ? \"uy\" : \"\") + (parser.options.ecmaVersion >= 9 ? \"s\" : \"\") + (parser.options.ecmaVersion >= 13 ? \"d\" : \"\") + (parser.options.ecmaVersion >= 15 ? \"v\" : \"\");\n this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];\n this.source = \"\";\n this.flags = \"\";\n this.start = 0;\n this.switchU = false;\n this.switchV = false;\n this.switchN = false;\n this.pos = 0;\n this.lastIntValue = 0;\n this.lastStringValue = \"\";\n this.lastAssertionIsQuantifiable = false;\n this.numCapturingParens = 0;\n this.maxBackReference = 0;\n this.groupNames = Object.create(null);\n this.backReferenceNames = [];\n this.branchID = null;\n};\n\nRegExpValidationState.prototype.reset = function reset (start, pattern, flags) {\n var unicodeSets = flags.indexOf(\"v\") !== -1;\n var unicode = flags.indexOf(\"u\") !== -1;\n this.start = start | 0;\n this.source = pattern + \"\";\n this.flags = flags;\n if (unicodeSets && this.parser.options.ecmaVersion >= 15) {\n this.switchU = true;\n this.switchV = true;\n this.switchN = true;\n } else {\n this.switchU = unicode && this.parser.options.ecmaVersion >= 6;\n this.switchV = false;\n this.switchN = unicode && this.parser.options.ecmaVersion >= 9;\n }\n};\n\nRegExpValidationState.prototype.raise = function raise (message) {\n this.parser.raiseRecoverable(this.start, (\"Invalid regular expression: /\" + (this.source) + \"/: \" + message));\n};\n\n// If u flag is given, this returns the code point at the index (it combines a surrogate pair).\n// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).\nRegExpValidationState.prototype.at = function at (i, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var s = this.source;\n var l = s.length;\n if (i >= l) {\n return -1\n }\n var c = s.charCodeAt(i);\n if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {\n return c\n }\n var next = s.charCodeAt(i + 1);\n return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c\n};\n\nRegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var s = this.source;\n var l = s.length;\n if (i >= l) {\n return l\n }\n var c = s.charCodeAt(i), next;\n if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||\n (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {\n return i + 1\n }\n return i + 2\n};\n\nRegExpValidationState.prototype.current = function current (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n return this.at(this.pos, forceU)\n};\n\nRegExpValidationState.prototype.lookahead = function lookahead (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n return this.at(this.nextIndex(this.pos, forceU), forceU)\n};\n\nRegExpValidationState.prototype.advance = function advance (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n this.pos = this.nextIndex(this.pos, forceU);\n};\n\nRegExpValidationState.prototype.eat = function eat (ch, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n if (this.current(forceU) === ch) {\n this.advance(forceU);\n return true\n }\n return false\n};\n\nRegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var pos = this.pos;\n for (var i = 0, list = chs; i < list.length; i += 1) {\n var ch = list[i];\n\n var current = this.at(pos, forceU);\n if (current === -1 || current !== ch) {\n return false\n }\n pos = this.nextIndex(pos, forceU);\n }\n this.pos = pos;\n return true\n};\n\n/**\n * Validate the flags part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp$1.validateRegExpFlags = function(state) {\n var validFlags = state.validFlags;\n var flags = state.flags;\n\n var u = false;\n var v = false;\n\n for (var i = 0; i < flags.length; i++) {\n var flag = flags.charAt(i);\n if (validFlags.indexOf(flag) === -1) {\n this.raise(state.start, \"Invalid regular expression flag\");\n }\n if (flags.indexOf(flag, i + 1) > -1) {\n this.raise(state.start, \"Duplicate regular expression flag\");\n }\n if (flag === \"u\") { u = true; }\n if (flag === \"v\") { v = true; }\n }\n if (this.options.ecmaVersion >= 15 && u && v) {\n this.raise(state.start, \"Invalid regular expression flag\");\n }\n};\n\nfunction hasProp(obj) {\n for (var _ in obj) { return true }\n return false\n}\n\n/**\n * Validate the pattern part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp$1.validateRegExpPattern = function(state) {\n this.regexp_pattern(state);\n\n // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of\n // parsing contains a |GroupName|, reparse with the goal symbol\n // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*\n // exception if _P_ did not conform to the grammar, if any elements of _P_\n // were not matched by the parse, or if any Early Error conditions exist.\n if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {\n state.switchN = true;\n this.regexp_pattern(state);\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern\npp$1.regexp_pattern = function(state) {\n state.pos = 0;\n state.lastIntValue = 0;\n state.lastStringValue = \"\";\n state.lastAssertionIsQuantifiable = false;\n state.numCapturingParens = 0;\n state.maxBackReference = 0;\n state.groupNames = Object.create(null);\n state.backReferenceNames.length = 0;\n state.branchID = null;\n\n this.regexp_disjunction(state);\n\n if (state.pos !== state.source.length) {\n // Make the same messages as V8.\n if (state.eat(0x29 /* ) */)) {\n state.raise(\"Unmatched ')'\");\n }\n if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {\n state.raise(\"Lone quantifier brackets\");\n }\n }\n if (state.maxBackReference > state.numCapturingParens) {\n state.raise(\"Invalid escape\");\n }\n for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {\n var name = list[i];\n\n if (!state.groupNames[name]) {\n state.raise(\"Invalid named capture referenced\");\n }\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction\npp$1.regexp_disjunction = function(state) {\n var trackDisjunction = this.options.ecmaVersion >= 16;\n if (trackDisjunction) { state.branchID = new BranchID(state.branchID, null); }\n this.regexp_alternative(state);\n while (state.eat(0x7C /* | */)) {\n if (trackDisjunction) { state.branchID = state.branchID.sibling(); }\n this.regexp_alternative(state);\n }\n if (trackDisjunction) { state.branchID = state.branchID.parent; }\n\n // Make the same message as V8.\n if (this.regexp_eatQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\");\n }\n if (state.eat(0x7B /* { */)) {\n state.raise(\"Lone quantifier brackets\");\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative\npp$1.regexp_alternative = function(state) {\n while (state.pos < state.source.length && this.regexp_eatTerm(state)) {}\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term\npp$1.regexp_eatTerm = function(state) {\n if (this.regexp_eatAssertion(state)) {\n // Handle `QuantifiableAssertion Quantifier` alternative.\n // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion\n // is a QuantifiableAssertion.\n if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {\n // Make the same message as V8.\n if (state.switchU) {\n state.raise(\"Invalid quantifier\");\n }\n }\n return true\n }\n\n if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {\n this.regexp_eatQuantifier(state);\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion\npp$1.regexp_eatAssertion = function(state) {\n var start = state.pos;\n state.lastAssertionIsQuantifiable = false;\n\n // ^, $\n if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {\n return true\n }\n\n // \\b \\B\n if (state.eat(0x5C /* \\ */)) {\n if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {\n return true\n }\n state.pos = start;\n }\n\n // Lookahead / Lookbehind\n if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {\n var lookbehind = false;\n if (this.options.ecmaVersion >= 9) {\n lookbehind = state.eat(0x3C /* < */);\n }\n if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {\n this.regexp_disjunction(state);\n if (!state.eat(0x29 /* ) */)) {\n state.raise(\"Unterminated group\");\n }\n state.lastAssertionIsQuantifiable = !lookbehind;\n return true\n }\n }\n\n state.pos = start;\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier\npp$1.regexp_eatQuantifier = function(state, noError) {\n if ( noError === void 0 ) noError = false;\n\n if (this.regexp_eatQuantifierPrefix(state, noError)) {\n state.eat(0x3F /* ? */);\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix\npp$1.regexp_eatQuantifierPrefix = function(state, noError) {\n return (\n state.eat(0x2A /* * */) ||\n state.eat(0x2B /* + */) ||\n state.eat(0x3F /* ? */) ||\n this.regexp_eatBracedQuantifier(state, noError)\n )\n};\npp$1.regexp_eatBracedQuantifier = function(state, noError) {\n var start = state.pos;\n if (state.eat(0x7B /* { */)) {\n var min = 0, max = -1;\n if (this.regexp_eatDecimalDigits(state)) {\n min = state.lastIntValue;\n if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {\n max = state.lastIntValue;\n }\n if (state.eat(0x7D /* } */)) {\n // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term\n if (max !== -1 && max < min && !noError) {\n state.raise(\"numbers out of order in {} quantifier\");\n }\n return true\n }\n }\n if (state.switchU && !noError) {\n state.raise(\"Incomplete quantifier\");\n }\n state.pos = start;\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom\npp$1.regexp_eatAtom = function(state) {\n return (\n this.regexp_eatPatternCharacters(state) ||\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state)\n )\n};\npp$1.regexp_eatReverseSolidusAtomEscape = function(state) {\n var start = state.pos;\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatAtomEscape(state)) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatUncapturingGroup = function(state) {\n var start = state.pos;\n if (state.eat(0x28 /* ( */)) {\n if (state.eat(0x3F /* ? */)) {\n if (this.options.ecmaVersion >= 16) {\n var addModifiers = this.regexp_eatModifiers(state);\n var hasHyphen = state.eat(0x2D /* - */);\n if (addModifiers || hasHyphen) {\n for (var i = 0; i < addModifiers.length; i++) {\n var modifier = addModifiers.charAt(i);\n if (addModifiers.indexOf(modifier, i + 1) > -1) {\n state.raise(\"Duplicate regular expression modifiers\");\n }\n }\n if (hasHyphen) {\n var removeModifiers = this.regexp_eatModifiers(state);\n if (!addModifiers && !removeModifiers && state.current() === 0x3A /* : */) {\n state.raise(\"Invalid regular expression modifiers\");\n }\n for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {\n var modifier$1 = removeModifiers.charAt(i$1);\n if (\n removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 ||\n addModifiers.indexOf(modifier$1) > -1\n ) {\n state.raise(\"Duplicate regular expression modifiers\");\n }\n }\n }\n }\n }\n if (state.eat(0x3A /* : */)) {\n this.regexp_disjunction(state);\n if (state.eat(0x29 /* ) */)) {\n return true\n }\n state.raise(\"Unterminated group\");\n }\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatCapturingGroup = function(state) {\n if (state.eat(0x28 /* ( */)) {\n if (this.options.ecmaVersion >= 9) {\n this.regexp_groupSpecifier(state);\n } else if (state.current() === 0x3F /* ? */) {\n state.raise(\"Invalid group\");\n }\n this.regexp_disjunction(state);\n if (state.eat(0x29 /* ) */)) {\n state.numCapturingParens += 1;\n return true\n }\n state.raise(\"Unterminated group\");\n }\n return false\n};\n// RegularExpressionModifiers ::\n// [empty]\n// RegularExpressionModifiers RegularExpressionModifier\npp$1.regexp_eatModifiers = function(state) {\n var modifiers = \"\";\n var ch = 0;\n while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {\n modifiers += codePointToString(ch);\n state.advance();\n }\n return modifiers\n};\n// RegularExpressionModifier :: one of\n// `i` `m` `s`\nfunction isRegularExpressionModifier(ch) {\n return ch === 0x69 /* i */ || ch === 0x6d /* m */ || ch === 0x73 /* s */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom\npp$1.regexp_eatExtendedAtom = function(state) {\n return (\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state) ||\n this.regexp_eatInvalidBracedQuantifier(state) ||\n this.regexp_eatExtendedPatternCharacter(state)\n )\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier\npp$1.regexp_eatInvalidBracedQuantifier = function(state) {\n if (this.regexp_eatBracedQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter\npp$1.regexp_eatSyntaxCharacter = function(state) {\n var ch = state.current();\n if (isSyntaxCharacter(ch)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n return false\n};\nfunction isSyntaxCharacter(ch) {\n return (\n ch === 0x24 /* $ */ ||\n ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||\n ch === 0x2E /* . */ ||\n ch === 0x3F /* ? */ ||\n ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||\n ch >= 0x7B /* { */ && ch <= 0x7D /* } */\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter\n// But eat eager.\npp$1.regexp_eatPatternCharacters = function(state) {\n var start = state.pos;\n var ch = 0;\n while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {\n state.advance();\n }\n return state.pos !== start\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter\npp$1.regexp_eatExtendedPatternCharacter = function(state) {\n var ch = state.current();\n if (\n ch !== -1 &&\n ch !== 0x24 /* $ */ &&\n !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&\n ch !== 0x2E /* . */ &&\n ch !== 0x3F /* ? */ &&\n ch !== 0x5B /* [ */ &&\n ch !== 0x5E /* ^ */ &&\n ch !== 0x7C /* | */\n ) {\n state.advance();\n return true\n }\n return false\n};\n\n// GroupSpecifier ::\n// [empty]\n// `?` GroupName\npp$1.regexp_groupSpecifier = function(state) {\n if (state.eat(0x3F /* ? */)) {\n if (!this.regexp_eatGroupName(state)) { state.raise(\"Invalid group\"); }\n var trackDisjunction = this.options.ecmaVersion >= 16;\n var known = state.groupNames[state.lastStringValue];\n if (known) {\n if (trackDisjunction) {\n for (var i = 0, list = known; i < list.length; i += 1) {\n var altID = list[i];\n\n if (!altID.separatedFrom(state.branchID))\n { state.raise(\"Duplicate capture group name\"); }\n }\n } else {\n state.raise(\"Duplicate capture group name\");\n }\n }\n if (trackDisjunction) {\n (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);\n } else {\n state.groupNames[state.lastStringValue] = true;\n }\n }\n};\n\n// GroupName ::\n// `<` RegExpIdentifierName `>`\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp$1.regexp_eatGroupName = function(state) {\n state.lastStringValue = \"\";\n if (state.eat(0x3C /* < */)) {\n if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {\n return true\n }\n state.raise(\"Invalid capture group name\");\n }\n return false\n};\n\n// RegExpIdentifierName ::\n// RegExpIdentifierStart\n// RegExpIdentifierName RegExpIdentifierPart\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp$1.regexp_eatRegExpIdentifierName = function(state) {\n state.lastStringValue = \"\";\n if (this.regexp_eatRegExpIdentifierStart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue);\n while (this.regexp_eatRegExpIdentifierPart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue);\n }\n return true\n }\n return false\n};\n\n// RegExpIdentifierStart ::\n// UnicodeIDStart\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[+U]\npp$1.regexp_eatRegExpIdentifierStart = function(state) {\n var start = state.pos;\n var forceU = this.options.ecmaVersion >= 11;\n var ch = state.current(forceU);\n state.advance(forceU);\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {\n ch = state.lastIntValue;\n }\n if (isRegExpIdentifierStart(ch)) {\n state.lastIntValue = ch;\n return true\n }\n\n state.pos = start;\n return false\n};\nfunction isRegExpIdentifierStart(ch) {\n return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */\n}\n\n// RegExpIdentifierPart ::\n// UnicodeIDContinue\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[+U]\n// <ZWNJ>\n// <ZWJ>\npp$1.regexp_eatRegExpIdentifierPart = function(state) {\n var start = state.pos;\n var forceU = this.options.ecmaVersion >= 11;\n var ch = state.current(forceU);\n state.advance(forceU);\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {\n ch = state.lastIntValue;\n }\n if (isRegExpIdentifierPart(ch)) {\n state.lastIntValue = ch;\n return true\n }\n\n state.pos = start;\n return false\n};\nfunction isRegExpIdentifierPart(ch) {\n return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D /* <ZWJ> */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape\npp$1.regexp_eatAtomEscape = function(state) {\n if (\n this.regexp_eatBackReference(state) ||\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state) ||\n (state.switchN && this.regexp_eatKGroupName(state))\n ) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n if (state.current() === 0x63 /* c */) {\n state.raise(\"Invalid unicode escape\");\n }\n state.raise(\"Invalid escape\");\n }\n return false\n};\npp$1.regexp_eatBackReference = function(state) {\n var start = state.pos;\n if (this.regexp_eatDecimalEscape(state)) {\n var n = state.lastIntValue;\n if (state.switchU) {\n // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape\n if (n > state.maxBackReference) {\n state.maxBackReference = n;\n }\n return true\n }\n if (n <= state.numCapturingParens) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatKGroupName = function(state) {\n if (state.eat(0x6B /* k */)) {\n if (this.regexp_eatGroupName(state)) {\n state.backReferenceNames.push(state.lastStringValue);\n return true\n }\n state.raise(\"Invalid named reference\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape\npp$1.regexp_eatCharacterEscape = function(state) {\n return (\n this.regexp_eatControlEscape(state) ||\n this.regexp_eatCControlLetter(state) ||\n this.regexp_eatZero(state) ||\n this.regexp_eatHexEscapeSequence(state) ||\n this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||\n (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||\n this.regexp_eatIdentityEscape(state)\n )\n};\npp$1.regexp_eatCControlLetter = function(state) {\n var start = state.pos;\n if (state.eat(0x63 /* c */)) {\n if (this.regexp_eatControlLetter(state)) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatZero = function(state) {\n if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {\n state.lastIntValue = 0;\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape\npp$1.regexp_eatControlEscape = function(state) {\n var ch = state.current();\n if (ch === 0x74 /* t */) {\n state.lastIntValue = 0x09; /* \\t */\n state.advance();\n return true\n }\n if (ch === 0x6E /* n */) {\n state.lastIntValue = 0x0A; /* \\n */\n state.advance();\n return true\n }\n if (ch === 0x76 /* v */) {\n state.lastIntValue = 0x0B; /* \\v */\n state.advance();\n return true\n }\n if (ch === 0x66 /* f */) {\n state.lastIntValue = 0x0C; /* \\f */\n state.advance();\n return true\n }\n if (ch === 0x72 /* r */) {\n state.lastIntValue = 0x0D; /* \\r */\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter\npp$1.regexp_eatControlLetter = function(state) {\n var ch = state.current();\n if (isControlLetter(ch)) {\n state.lastIntValue = ch % 0x20;\n state.advance();\n return true\n }\n return false\n};\nfunction isControlLetter(ch) {\n return (\n (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||\n (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence\npp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var start = state.pos;\n var switchU = forceU || state.switchU;\n\n if (state.eat(0x75 /* u */)) {\n if (this.regexp_eatFixedHexDigits(state, 4)) {\n var lead = state.lastIntValue;\n if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {\n var leadSurrogateEnd = state.pos;\n if (state.eat(0x5C /* \\ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {\n var trail = state.lastIntValue;\n if (trail >= 0xDC00 && trail <= 0xDFFF) {\n state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;\n return true\n }\n }\n state.pos = leadSurrogateEnd;\n state.lastIntValue = lead;\n }\n return true\n }\n if (\n switchU &&\n state.eat(0x7B /* { */) &&\n this.regexp_eatHexDigits(state) &&\n state.eat(0x7D /* } */) &&\n isValidUnicode(state.lastIntValue)\n ) {\n return true\n }\n if (switchU) {\n state.raise(\"Invalid unicode escape\");\n }\n state.pos = start;\n }\n\n return false\n};\nfunction isValidUnicode(ch) {\n return ch >= 0 && ch <= 0x10FFFF\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape\npp$1.regexp_eatIdentityEscape = function(state) {\n if (state.switchU) {\n if (this.regexp_eatSyntaxCharacter(state)) {\n return true\n }\n if (state.eat(0x2F /* / */)) {\n state.lastIntValue = 0x2F; /* / */\n return true\n }\n return false\n }\n\n var ch = state.current();\n if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape\npp$1.regexp_eatDecimalEscape = function(state) {\n state.lastIntValue = 0;\n var ch = state.current();\n if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {\n do {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);\n state.advance();\n } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)\n return true\n }\n return false\n};\n\n// Return values used by character set parsing methods, needed to\n// forbid negation of sets that can match strings.\nvar CharSetNone = 0; // Nothing parsed\nvar CharSetOk = 1; // Construct parsed, cannot contain strings\nvar CharSetString = 2; // Construct parsed, can contain strings\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape\npp$1.regexp_eatCharacterClassEscape = function(state) {\n var ch = state.current();\n\n if (isCharacterClassEscape(ch)) {\n state.lastIntValue = -1;\n state.advance();\n return CharSetOk\n }\n\n var negate = false;\n if (\n state.switchU &&\n this.options.ecmaVersion >= 9 &&\n ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)\n ) {\n state.lastIntValue = -1;\n state.advance();\n var result;\n if (\n state.eat(0x7B /* { */) &&\n (result = this.regexp_eatUnicodePropertyValueExpression(state)) &&\n state.eat(0x7D /* } */)\n ) {\n if (negate && result === CharSetString) { state.raise(\"Invalid property name\"); }\n return result\n }\n state.raise(\"Invalid property name\");\n }\n\n return CharSetNone\n};\n\nfunction isCharacterClassEscape(ch) {\n return (\n ch === 0x64 /* d */ ||\n ch === 0x44 /* D */ ||\n ch === 0x73 /* s */ ||\n ch === 0x53 /* S */ ||\n ch === 0x77 /* w */ ||\n ch === 0x57 /* W */\n )\n}\n\n// UnicodePropertyValueExpression ::\n// UnicodePropertyName `=` UnicodePropertyValue\n// LoneUnicodePropertyNameOrValue\npp$1.regexp_eatUnicodePropertyValueExpression = function(state) {\n var start = state.pos;\n\n // UnicodePropertyName `=` UnicodePropertyValue\n if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {\n var name = state.lastStringValue;\n if (this.regexp_eatUnicodePropertyValue(state)) {\n var value = state.lastStringValue;\n this.regexp_validateUnicodePropertyNameAndValue(state, name, value);\n return CharSetOk\n }\n }\n state.pos = start;\n\n // LoneUnicodePropertyNameOrValue\n if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {\n var nameOrValue = state.lastStringValue;\n return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)\n }\n return CharSetNone\n};\n\npp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {\n if (!hasOwn(state.unicodeProperties.nonBinary, name))\n { state.raise(\"Invalid property name\"); }\n if (!state.unicodeProperties.nonBinary[name].test(value))\n { state.raise(\"Invalid property value\"); }\n};\n\npp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {\n if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }\n if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }\n state.raise(\"Invalid property name\");\n};\n\n// UnicodePropertyName ::\n// UnicodePropertyNameCharacters\npp$1.regexp_eatUnicodePropertyName = function(state) {\n var ch = 0;\n state.lastStringValue = \"\";\n while (isUnicodePropertyNameCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch);\n state.advance();\n }\n return state.lastStringValue !== \"\"\n};\n\nfunction isUnicodePropertyNameCharacter(ch) {\n return isControlLetter(ch) || ch === 0x5F /* _ */\n}\n\n// UnicodePropertyValue ::\n// UnicodePropertyValueCharacters\npp$1.regexp_eatUnicodePropertyValue = function(state) {\n var ch = 0;\n state.lastStringValue = \"\";\n while (isUnicodePropertyValueCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch);\n state.advance();\n }\n return state.lastStringValue !== \"\"\n};\nfunction isUnicodePropertyValueCharacter(ch) {\n return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)\n}\n\n// LoneUnicodePropertyNameOrValue ::\n// UnicodePropertyValueCharacters\npp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {\n return this.regexp_eatUnicodePropertyValue(state)\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass\npp$1.regexp_eatCharacterClass = function(state) {\n if (state.eat(0x5B /* [ */)) {\n var negate = state.eat(0x5E /* ^ */);\n var result = this.regexp_classContents(state);\n if (!state.eat(0x5D /* ] */))\n { state.raise(\"Unterminated character class\"); }\n if (negate && result === CharSetString)\n { state.raise(\"Negated character class may contain strings\"); }\n return true\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassContents\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges\npp$1.regexp_classContents = function(state) {\n if (state.current() === 0x5D /* ] */) { return CharSetOk }\n if (state.switchV) { return this.regexp_classSetExpression(state) }\n this.regexp_nonEmptyClassRanges(state);\n return CharSetOk\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash\npp$1.regexp_nonEmptyClassRanges = function(state) {\n while (this.regexp_eatClassAtom(state)) {\n var left = state.lastIntValue;\n if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {\n var right = state.lastIntValue;\n if (state.switchU && (left === -1 || right === -1)) {\n state.raise(\"Invalid character class\");\n }\n if (left !== -1 && right !== -1 && left > right) {\n state.raise(\"Range out of order in character class\");\n }\n }\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash\npp$1.regexp_eatClassAtom = function(state) {\n var start = state.pos;\n\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatClassEscape(state)) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n var ch$1 = state.current();\n if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {\n state.raise(\"Invalid class escape\");\n }\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n\n var ch = state.current();\n if (ch !== 0x5D /* ] */) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape\npp$1.regexp_eatClassEscape = function(state) {\n var start = state.pos;\n\n if (state.eat(0x62 /* b */)) {\n state.lastIntValue = 0x08; /* <BS> */\n return true\n }\n\n if (state.switchU && state.eat(0x2D /* - */)) {\n state.lastIntValue = 0x2D; /* - */\n return true\n }\n\n if (!state.switchU && state.eat(0x63 /* c */)) {\n if (this.regexp_eatClassControlLetter(state)) {\n return true\n }\n state.pos = start;\n }\n\n return (\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state)\n )\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetExpression\n// https://tc39.es/ecma262/#prod-ClassUnion\n// https://tc39.es/ecma262/#prod-ClassIntersection\n// https://tc39.es/ecma262/#prod-ClassSubtraction\npp$1.regexp_classSetExpression = function(state) {\n var result = CharSetOk, subResult;\n if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {\n if (subResult === CharSetString) { result = CharSetString; }\n // https://tc39.es/ecma262/#prod-ClassIntersection\n var start = state.pos;\n while (state.eatChars([0x26, 0x26] /* && */)) {\n if (\n state.current() !== 0x26 /* & */ &&\n (subResult = this.regexp_eatClassSetOperand(state))\n ) {\n if (subResult !== CharSetString) { result = CharSetOk; }\n continue\n }\n state.raise(\"Invalid character in character class\");\n }\n if (start !== state.pos) { return result }\n // https://tc39.es/ecma262/#prod-ClassSubtraction\n while (state.eatChars([0x2D, 0x2D] /* -- */)) {\n if (this.regexp_eatClassSetOperand(state)) { continue }\n state.raise(\"Invalid character in character class\");\n }\n if (start !== state.pos) { return result }\n } else {\n state.raise(\"Invalid character in character class\");\n }\n // https://tc39.es/ecma262/#prod-ClassUnion\n for (;;) {\n if (this.regexp_eatClassSetRange(state)) { continue }\n subResult = this.regexp_eatClassSetOperand(state);\n if (!subResult) { return result }\n if (subResult === CharSetString) { result = CharSetString; }\n }\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetRange\npp$1.regexp_eatClassSetRange = function(state) {\n var start = state.pos;\n if (this.regexp_eatClassSetCharacter(state)) {\n var left = state.lastIntValue;\n if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {\n var right = state.lastIntValue;\n if (left !== -1 && right !== -1 && left > right) {\n state.raise(\"Range out of order in character class\");\n }\n return true\n }\n state.pos = start;\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetOperand\npp$1.regexp_eatClassSetOperand = function(state) {\n if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }\n return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)\n};\n\n// https://tc39.es/ecma262/#prod-NestedClass\npp$1.regexp_eatNestedClass = function(state) {\n var start = state.pos;\n if (state.eat(0x5B /* [ */)) {\n var negate = state.eat(0x5E /* ^ */);\n var result = this.regexp_classContents(state);\n if (state.eat(0x5D /* ] */)) {\n if (negate && result === CharSetString) {\n state.raise(\"Negated character class may contain strings\");\n }\n return result\n }\n state.pos = start;\n }\n if (state.eat(0x5C /* \\ */)) {\n var result$1 = this.regexp_eatCharacterClassEscape(state);\n if (result$1) {\n return result$1\n }\n state.pos = start;\n }\n return null\n};\n\n// https://tc39.es/ecma262/#prod-ClassStringDisjunction\npp$1.regexp_eatClassStringDisjunction = function(state) {\n var start = state.pos;\n if (state.eatChars([0x5C, 0x71] /* \\q */)) {\n if (state.eat(0x7B /* { */)) {\n var result = this.regexp_classStringDisjunctionContents(state);\n if (state.eat(0x7D /* } */)) {\n return result\n }\n } else {\n // Make the same message as V8.\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n return null\n};\n\n// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents\npp$1.regexp_classStringDisjunctionContents = function(state) {\n var result = this.regexp_classString(state);\n while (state.eat(0x7C /* | */)) {\n if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }\n }\n return result\n};\n\n// https://tc39.es/ecma262/#prod-ClassString\n// https://tc39.es/ecma262/#prod-NonEmptyClassString\npp$1.regexp_classString = function(state) {\n var count = 0;\n while (this.regexp_eatClassSetCharacter(state)) { count++; }\n return count === 1 ? CharSetOk : CharSetString\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetCharacter\npp$1.regexp_eatClassSetCharacter = function(state) {\n var start = state.pos;\n if (state.eat(0x5C /* \\ */)) {\n if (\n this.regexp_eatCharacterEscape(state) ||\n this.regexp_eatClassSetReservedPunctuator(state)\n ) {\n return true\n }\n if (state.eat(0x62 /* b */)) {\n state.lastIntValue = 0x08; /* <BS> */\n return true\n }\n state.pos = start;\n return false\n }\n var ch = state.current();\n if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }\n if (isClassSetSyntaxCharacter(ch)) { return false }\n state.advance();\n state.lastIntValue = ch;\n return true\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator\nfunction isClassSetReservedDoublePunctuatorCharacter(ch) {\n return (\n ch === 0x21 /* ! */ ||\n ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||\n ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||\n ch === 0x2E /* . */ ||\n ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||\n ch === 0x5E /* ^ */ ||\n ch === 0x60 /* ` */ ||\n ch === 0x7E /* ~ */\n )\n}\n\n// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter\nfunction isClassSetSyntaxCharacter(ch) {\n return (\n ch === 0x28 /* ( */ ||\n ch === 0x29 /* ) */ ||\n ch === 0x2D /* - */ ||\n ch === 0x2F /* / */ ||\n ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||\n ch >= 0x7B /* { */ && ch <= 0x7D /* } */\n )\n}\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator\npp$1.regexp_eatClassSetReservedPunctuator = function(state) {\n var ch = state.current();\n if (isClassSetReservedPunctuator(ch)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator\nfunction isClassSetReservedPunctuator(ch) {\n return (\n ch === 0x21 /* ! */ ||\n ch === 0x23 /* # */ ||\n ch === 0x25 /* % */ ||\n ch === 0x26 /* & */ ||\n ch === 0x2C /* , */ ||\n ch === 0x2D /* - */ ||\n ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||\n ch === 0x40 /* @ */ ||\n ch === 0x60 /* ` */ ||\n ch === 0x7E /* ~ */\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter\npp$1.regexp_eatClassControlLetter = function(state) {\n var ch = state.current();\n if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {\n state.lastIntValue = ch % 0x20;\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp$1.regexp_eatHexEscapeSequence = function(state) {\n var start = state.pos;\n if (state.eat(0x78 /* x */)) {\n if (this.regexp_eatFixedHexDigits(state, 2)) {\n return true\n }\n if (state.switchU) {\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits\npp$1.regexp_eatDecimalDigits = function(state) {\n var start = state.pos;\n var ch = 0;\n state.lastIntValue = 0;\n while (isDecimalDigit(ch = state.current())) {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);\n state.advance();\n }\n return state.pos !== start\n};\nfunction isDecimalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits\npp$1.regexp_eatHexDigits = function(state) {\n var start = state.pos;\n var ch = 0;\n state.lastIntValue = 0;\n while (isHexDigit(ch = state.current())) {\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);\n state.advance();\n }\n return state.pos !== start\n};\nfunction isHexDigit(ch) {\n return (\n (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||\n (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||\n (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)\n )\n}\nfunction hexToInt(ch) {\n if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {\n return 10 + (ch - 0x41 /* A */)\n }\n if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {\n return 10 + (ch - 0x61 /* a */)\n }\n return ch - 0x30 /* 0 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence\n// Allows only 0-377(octal) i.e. 0-255(decimal).\npp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {\n if (this.regexp_eatOctalDigit(state)) {\n var n1 = state.lastIntValue;\n if (this.regexp_eatOctalDigit(state)) {\n var n2 = state.lastIntValue;\n if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {\n state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;\n } else {\n state.lastIntValue = n1 * 8 + n2;\n }\n } else {\n state.lastIntValue = n1;\n }\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit\npp$1.regexp_eatOctalDigit = function(state) {\n var ch = state.current();\n if (isOctalDigit(ch)) {\n state.lastIntValue = ch - 0x30; /* 0 */\n state.advance();\n return true\n }\n state.lastIntValue = 0;\n return false\n};\nfunction isOctalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit\n// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp$1.regexp_eatFixedHexDigits = function(state, length) {\n var start = state.pos;\n state.lastIntValue = 0;\n for (var i = 0; i < length; ++i) {\n var ch = state.current();\n if (!isHexDigit(ch)) {\n state.pos = start;\n return false\n }\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);\n state.advance();\n }\n return true\n};\n\n// Object type used to represent tokens. Note that normally, tokens\n// simply exist as properties on the parser object. This is only\n// used for the onToken callback and the external tokenizer.\n\nvar Token = function Token(p) {\n this.type = p.type;\n this.value = p.value;\n this.start = p.start;\n this.end = p.end;\n if (p.options.locations)\n { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }\n if (p.options.ranges)\n { this.range = [p.start, p.end]; }\n};\n\n// ## Tokenizer\n\nvar pp = Parser.prototype;\n\n// Move to the next token\n\npp.next = function(ignoreEscapeSequenceInKeyword) {\n if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)\n { this.raiseRecoverable(this.start, \"Escape sequence in keyword \" + this.type.keyword); }\n if (this.options.onToken)\n { this.options.onToken(new Token(this)); }\n\n this.lastTokEnd = this.end;\n this.lastTokStart = this.start;\n this.lastTokEndLoc = this.endLoc;\n this.lastTokStartLoc = this.startLoc;\n this.nextToken();\n};\n\npp.getToken = function() {\n this.next();\n return new Token(this)\n};\n\n// If we're in an ES6 environment, make parsers iterable\nif (typeof Symbol !== \"undefined\")\n { pp[Symbol.iterator] = function() {\n var this$1$1 = this;\n\n return {\n next: function () {\n var token = this$1$1.getToken();\n return {\n done: token.type === types$1.eof,\n value: token\n }\n }\n }\n }; }\n\n// Toggle strict mode. Re-reads the next number or string to please\n// pedantic tests (`\"use strict\"; 010;` should fail).\n\n// Read a single token, updating the parser object's token-related\n// properties.\n\npp.nextToken = function() {\n var curContext = this.curContext();\n if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }\n\n this.start = this.pos;\n if (this.options.locations) { this.startLoc = this.curPosition(); }\n if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }\n\n if (curContext.override) { return curContext.override(this) }\n else { this.readToken(this.fullCharCodeAtPos()); }\n};\n\npp.readToken = function(code) {\n // Identifier or keyword. '\\uXXXX' sequences are allowed in\n // identifiers, so '\\' also dispatches to that.\n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\\' */)\n { return this.readWord() }\n\n return this.getTokenFromCode(code)\n};\n\npp.fullCharCodeAt = function(pos) {\n var code = this.input.charCodeAt(pos);\n if (code <= 0xd7ff || code >= 0xdc00) { return code }\n var next = this.input.charCodeAt(pos + 1);\n return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00\n};\n\npp.fullCharCodeAtPos = function() {\n return this.fullCharCodeAt(this.pos)\n};\n\npp.skipBlockComment = function() {\n var startLoc = this.options.onComment && this.curPosition();\n var start = this.pos, end = this.input.indexOf(\"*/\", this.pos += 2);\n if (end === -1) { this.raise(this.pos - 2, \"Unterminated comment\"); }\n this.pos = end + 2;\n if (this.options.locations) {\n for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {\n ++this.curLine;\n pos = this.lineStart = nextBreak;\n }\n }\n if (this.options.onComment)\n { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,\n startLoc, this.curPosition()); }\n};\n\npp.skipLineComment = function(startSkip) {\n var start = this.pos;\n var startLoc = this.options.onComment && this.curPosition();\n var ch = this.input.charCodeAt(this.pos += startSkip);\n while (this.pos < this.input.length && !isNewLine(ch)) {\n ch = this.input.charCodeAt(++this.pos);\n }\n if (this.options.onComment)\n { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,\n startLoc, this.curPosition()); }\n};\n\n// Called at the start of the parse and after every token. Skips\n// whitespace and comments, and.\n\npp.skipSpace = function() {\n loop: while (this.pos < this.input.length) {\n var ch = this.input.charCodeAt(this.pos);\n switch (ch) {\n case 32: case 160: // ' '\n ++this.pos;\n break\n case 13:\n if (this.input.charCodeAt(this.pos + 1) === 10) {\n ++this.pos;\n }\n case 10: case 8232: case 8233:\n ++this.pos;\n if (this.options.locations) {\n ++this.curLine;\n this.lineStart = this.pos;\n }\n break\n case 47: // '/'\n switch (this.input.charCodeAt(this.pos + 1)) {\n case 42: // '*'\n this.skipBlockComment();\n break\n case 47:\n this.skipLineComment(2);\n break\n default:\n break loop\n }\n break\n default:\n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {\n ++this.pos;\n } else {\n break loop\n }\n }\n }\n};\n\n// Called at the end of every token. Sets `end`, `val`, and\n// maintains `context` and `exprAllowed`, and skips the space after\n// the token, so that the next one's `start` will point at the\n// right position.\n\npp.finishToken = function(type, val) {\n this.end = this.pos;\n if (this.options.locations) { this.endLoc = this.curPosition(); }\n var prevType = this.type;\n this.type = type;\n this.value = val;\n\n this.updateContext(prevType);\n};\n\n// ### Token reading\n\n// This is the function that is called to fetch the next token. It\n// is somewhat obscure, because it works in character codes rather\n// than characters, and because operator parsing has been inlined\n// into it.\n//\n// All in the name of speed.\n//\npp.readToken_dot = function() {\n var next = this.input.charCodeAt(this.pos + 1);\n if (next >= 48 && next <= 57) { return this.readNumber(true) }\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'\n this.pos += 3;\n return this.finishToken(types$1.ellipsis)\n } else {\n ++this.pos;\n return this.finishToken(types$1.dot)\n }\n};\n\npp.readToken_slash = function() { // '/'\n var next = this.input.charCodeAt(this.pos + 1);\n if (this.exprAllowed) { ++this.pos; return this.readRegexp() }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.slash, 1)\n};\n\npp.readToken_mult_modulo_exp = function(code) { // '%*'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n var tokentype = code === 42 ? types$1.star : types$1.modulo;\n\n // exponentiation operator ** and **=\n if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {\n ++size;\n tokentype = types$1.starstar;\n next = this.input.charCodeAt(this.pos + 2);\n }\n\n if (next === 61) { return this.finishOp(types$1.assign, size + 1) }\n return this.finishOp(tokentype, size)\n};\n\npp.readToken_pipe_amp = function(code) { // '|&'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === code) {\n if (this.options.ecmaVersion >= 12) {\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (next2 === 61) { return this.finishOp(types$1.assign, 3) }\n }\n return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)\n }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)\n};\n\npp.readToken_caret = function() { // '^'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.bitwiseXOR, 1)\n};\n\npp.readToken_plus_min = function(code) { // '+-'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === code) {\n if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&\n (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {\n // A `-->` line comment\n this.skipLineComment(3);\n this.skipSpace();\n return this.nextToken()\n }\n return this.finishOp(types$1.incDec, 2)\n }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.plusMin, 1)\n};\n\npp.readToken_lt_gt = function(code) { // '<>'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;\n if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }\n return this.finishOp(types$1.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `<!--`, an XML-style comment that should be interpreted as a line comment\n this.skipLineComment(4);\n this.skipSpace();\n return this.nextToken()\n }\n if (next === 61) { size = 2; }\n return this.finishOp(types$1.relational, size)\n};\n\npp.readToken_eq_excl = function(code) { // '=!'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }\n if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'\n this.pos += 2;\n return this.finishToken(types$1.arrow)\n }\n return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)\n};\n\npp.readToken_question = function() { // '?'\n var ecmaVersion = this.options.ecmaVersion;\n if (ecmaVersion >= 11) {\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 46) {\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }\n }\n if (next === 63) {\n if (ecmaVersion >= 12) {\n var next2$1 = this.input.charCodeAt(this.pos + 2);\n if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }\n }\n return this.finishOp(types$1.coalesce, 2)\n }\n }\n return this.finishOp(types$1.question, 1)\n};\n\npp.readToken_numberSign = function() { // '#'\n var ecmaVersion = this.options.ecmaVersion;\n var code = 35; // '#'\n if (ecmaVersion >= 13) {\n ++this.pos;\n code = this.fullCharCodeAtPos();\n if (isIdentifierStart(code, true) || code === 92 /* '\\' */) {\n return this.finishToken(types$1.privateId, this.readWord1())\n }\n }\n\n this.raise(this.pos, \"Unexpected character '\" + codePointToString(code) + \"'\");\n};\n\npp.getTokenFromCode = function(code) {\n switch (code) {\n // The interpretation of a dot depends on whether it is followed\n // by a digit or another two dots.\n case 46: // '.'\n return this.readToken_dot()\n\n // Punctuation tokens.\n case 40: ++this.pos; return this.finishToken(types$1.parenL)\n case 41: ++this.pos; return this.finishToken(types$1.parenR)\n case 59: ++this.pos; return this.finishToken(types$1.semi)\n case 44: ++this.pos; return this.finishToken(types$1.comma)\n case 91: ++this.pos; return this.finishToken(types$1.bracketL)\n case 93: ++this.pos; return this.finishToken(types$1.bracketR)\n case 123: ++this.pos; return this.finishToken(types$1.braceL)\n case 125: ++this.pos; return this.finishToken(types$1.braceR)\n case 58: ++this.pos; return this.finishToken(types$1.colon)\n\n case 96: // '`'\n if (this.options.ecmaVersion < 6) { break }\n ++this.pos;\n return this.finishToken(types$1.backQuote)\n\n case 48: // '0'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 120 || next === 88) { return this.readRadixNumber(16) } // '0x', '0X' - hex number\n if (this.options.ecmaVersion >= 6) {\n if (next === 111 || next === 79) { return this.readRadixNumber(8) } // '0o', '0O' - octal number\n if (next === 98 || next === 66) { return this.readRadixNumber(2) } // '0b', '0B' - binary number\n }\n\n // Anything else beginning with a digit is an integer, octal\n // number, or float.\n case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9\n return this.readNumber(false)\n\n // Quotes produce strings.\n case 34: case 39: // '\"', \"'\"\n return this.readString(code)\n\n // Operators are parsed inline in tiny state machines. '=' (61) is\n // often referred to. `finishOp` simply skips the amount of\n // characters it is given as second argument, and returns a token\n // of the type given by its first argument.\n case 47: // '/'\n return this.readToken_slash()\n\n case 37: case 42: // '%*'\n return this.readToken_mult_modulo_exp(code)\n\n case 124: case 38: // '|&'\n return this.readToken_pipe_amp(code)\n\n case 94: // '^'\n return this.readToken_caret()\n\n case 43: case 45: // '+-'\n return this.readToken_plus_min(code)\n\n case 60: case 62: // '<>'\n return this.readToken_lt_gt(code)\n\n case 61: case 33: // '=!'\n return this.readToken_eq_excl(code)\n\n case 63: // '?'\n return this.readToken_question()\n\n case 126: // '~'\n return this.finishOp(types$1.prefix, 1)\n\n case 35: // '#'\n return this.readToken_numberSign()\n }\n\n this.raise(this.pos, \"Unexpected character '\" + codePointToString(code) + \"'\");\n};\n\npp.finishOp = function(type, size) {\n var str = this.input.slice(this.pos, this.pos + size);\n this.pos += size;\n return this.finishToken(type, str)\n};\n\npp.readRegexp = function() {\n var escaped, inClass, start = this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(start, \"Unterminated regular expression\"); }\n var ch = this.input.charAt(this.pos);\n if (lineBreak.test(ch)) { this.raise(start, \"Unterminated regular expression\"); }\n if (!escaped) {\n if (ch === \"[\") { inClass = true; }\n else if (ch === \"]\" && inClass) { inClass = false; }\n else if (ch === \"/\" && !inClass) { break }\n escaped = ch === \"\\\\\";\n } else { escaped = false; }\n ++this.pos;\n }\n var pattern = this.input.slice(start, this.pos);\n ++this.pos;\n var flagsStart = this.pos;\n var flags = this.readWord1();\n if (this.containsEsc) { this.unexpected(flagsStart); }\n\n // Validate pattern\n var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));\n state.reset(start, pattern, flags);\n this.validateRegExpFlags(state);\n this.validateRegExpPattern(state);\n\n // Create Literal#value property value.\n var value = null;\n try {\n value = new RegExp(pattern, flags);\n } catch (e) {\n // ESTree requires null if it failed to instantiate RegExp object.\n // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral\n }\n\n return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})\n};\n\n// Read an integer in the given radix. Return null if zero digits\n// were read, the integer value otherwise. When `len` is given, this\n// will return `null` unless the integer has exactly `len` digits.\n\npp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {\n // `len` is used for character escape sequences. In that case, disallow separators.\n var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;\n\n // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)\n // and isn't fraction part nor exponent part. In that case, if the first digit\n // is zero then disallow separators.\n var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;\n\n var start = this.pos, total = 0, lastCode = 0;\n for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {\n var code = this.input.charCodeAt(this.pos), val = (void 0);\n\n if (allowSeparators && code === 95) {\n if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, \"Numeric separator is not allowed in legacy octal numeric literals\"); }\n if (lastCode === 95) { this.raiseRecoverable(this.pos, \"Numeric separator must be exactly one underscore\"); }\n if (i === 0) { this.raiseRecoverable(this.pos, \"Numeric separator is not allowed at the first of digits\"); }\n lastCode = code;\n continue\n }\n\n if (code >= 97) { val = code - 97 + 10; } // a\n else if (code >= 65) { val = code - 65 + 10; } // A\n else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9\n else { val = Infinity; }\n if (val >= radix) { break }\n lastCode = code;\n total = total * radix + val;\n }\n\n if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, \"Numeric separator is not allowed at the last of digits\"); }\n if (this.pos === start || len != null && this.pos - start !== len) { return null }\n\n return total\n};\n\nfunction stringToNumber(str, isLegacyOctalNumericLiteral) {\n if (isLegacyOctalNumericLiteral) {\n return parseInt(str, 8)\n }\n\n // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.\n return parseFloat(str.replace(/_/g, \"\"))\n}\n\nfunction stringToBigInt(str) {\n if (typeof BigInt !== \"function\") {\n return null\n }\n\n // `BigInt(value)` throws syntax error if the string contains numeric separators.\n return BigInt(str.replace(/_/g, \"\"))\n}\n\npp.readRadixNumber = function(radix) {\n var start = this.pos;\n this.pos += 2; // 0x\n var val = this.readInt(radix);\n if (val == null) { this.raise(this.start + 2, \"Expected number in radix \" + radix); }\n if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {\n val = stringToBigInt(this.input.slice(start, this.pos));\n ++this.pos;\n } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n return this.finishToken(types$1.num, val)\n};\n\n// Read an integer, octal integer, or floating-point number.\n\npp.readNumber = function(startsWithDot) {\n var start = this.pos;\n if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, \"Invalid number\"); }\n var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;\n if (octal && this.strict) { this.raise(start, \"Invalid number\"); }\n var next = this.input.charCodeAt(this.pos);\n if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {\n var val$1 = stringToBigInt(this.input.slice(start, this.pos));\n ++this.pos;\n if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n return this.finishToken(types$1.num, val$1)\n }\n if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }\n if (next === 46 && !octal) { // '.'\n ++this.pos;\n this.readInt(10);\n next = this.input.charCodeAt(this.pos);\n }\n if ((next === 69 || next === 101) && !octal) { // 'eE'\n next = this.input.charCodeAt(++this.pos);\n if (next === 43 || next === 45) { ++this.pos; } // '+-'\n if (this.readInt(10) === null) { this.raise(start, \"Invalid number\"); }\n }\n if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n\n var val = stringToNumber(this.input.slice(start, this.pos), octal);\n return this.finishToken(types$1.num, val)\n};\n\n// Read a string value, interpreting backslash-escapes.\n\npp.readCodePoint = function() {\n var ch = this.input.charCodeAt(this.pos), code;\n\n if (ch === 123) { // '{'\n if (this.options.ecmaVersion < 6) { this.unexpected(); }\n var codePos = ++this.pos;\n code = this.readHexChar(this.input.indexOf(\"}\", this.pos) - this.pos);\n ++this.pos;\n if (code > 0x10FFFF) { this.invalidStringToken(codePos, \"Code point out of bounds\"); }\n } else {\n code = this.readHexChar(4);\n }\n return code\n};\n\npp.readString = function(quote) {\n var out = \"\", chunkStart = ++this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(this.start, \"Unterminated string constant\"); }\n var ch = this.input.charCodeAt(this.pos);\n if (ch === quote) { break }\n if (ch === 92) { // '\\'\n out += this.input.slice(chunkStart, this.pos);\n out += this.readEscapedChar(false);\n chunkStart = this.pos;\n } else if (ch === 0x2028 || ch === 0x2029) {\n if (this.options.ecmaVersion < 10) { this.raise(this.start, \"Unterminated string constant\"); }\n ++this.pos;\n if (this.options.locations) {\n this.curLine++;\n this.lineStart = this.pos;\n }\n } else {\n if (isNewLine(ch)) { this.raise(this.start, \"Unterminated string constant\"); }\n ++this.pos;\n }\n }\n out += this.input.slice(chunkStart, this.pos++);\n return this.finishToken(types$1.string, out)\n};\n\n// Reads template string tokens.\n\nvar INVALID_TEMPLATE_ESCAPE_ERROR = {};\n\npp.tryReadTemplateToken = function() {\n this.inTemplateElement = true;\n try {\n this.readTmplToken();\n } catch (err) {\n if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {\n this.readInvalidTemplateToken();\n } else {\n throw err\n }\n }\n\n this.inTemplateElement = false;\n};\n\npp.invalidStringToken = function(position, message) {\n if (this.inTemplateElement && this.options.ecmaVersion >= 9) {\n throw INVALID_TEMPLATE_ESCAPE_ERROR\n } else {\n this.raise(position, message);\n }\n};\n\npp.readTmplToken = function() {\n var out = \"\", chunkStart = this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(this.start, \"Unterminated template\"); }\n var ch = this.input.charCodeAt(this.pos);\n if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'\n if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {\n if (ch === 36) {\n this.pos += 2;\n return this.finishToken(types$1.dollarBraceL)\n } else {\n ++this.pos;\n return this.finishToken(types$1.backQuote)\n }\n }\n out += this.input.slice(chunkStart, this.pos);\n return this.finishToken(types$1.template, out)\n }\n if (ch === 92) { // '\\'\n out += this.input.slice(chunkStart, this.pos);\n out += this.readEscapedChar(true);\n chunkStart = this.pos;\n } else if (isNewLine(ch)) {\n out += this.input.slice(chunkStart, this.pos);\n ++this.pos;\n switch (ch) {\n case 13:\n if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }\n case 10:\n out += \"\\n\";\n break\n default:\n out += String.fromCharCode(ch);\n break\n }\n if (this.options.locations) {\n ++this.curLine;\n this.lineStart = this.pos;\n }\n chunkStart = this.pos;\n } else {\n ++this.pos;\n }\n }\n};\n\n// Reads a template token to search for the end, without validating any escape sequences\npp.readInvalidTemplateToken = function() {\n for (; this.pos < this.input.length; this.pos++) {\n switch (this.input[this.pos]) {\n case \"\\\\\":\n ++this.pos;\n break\n\n case \"$\":\n if (this.input[this.pos + 1] !== \"{\") { break }\n // fall through\n case \"`\":\n return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))\n\n case \"\\r\":\n if (this.input[this.pos + 1] === \"\\n\") { ++this.pos; }\n // fall through\n case \"\\n\": case \"\\u2028\": case \"\\u2029\":\n ++this.curLine;\n this.lineStart = this.pos + 1;\n break\n }\n }\n this.raise(this.start, \"Unterminated template\");\n};\n\n// Used to read escaped characters\n\npp.readEscapedChar = function(inTemplate) {\n var ch = this.input.charCodeAt(++this.pos);\n ++this.pos;\n switch (ch) {\n case 110: return \"\\n\" // 'n' -> '\\n'\n case 114: return \"\\r\" // 'r' -> '\\r'\n case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'\n case 117: return codePointToString(this.readCodePoint()) // 'u'\n case 116: return \"\\t\" // 't' -> '\\t'\n case 98: return \"\\b\" // 'b' -> '\\b'\n case 118: return \"\\u000b\" // 'v' -> '\\u000b'\n case 102: return \"\\f\" // 'f' -> '\\f'\n case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; } // '\\r\\n'\n case 10: // ' \\n'\n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }\n return \"\"\n case 56:\n case 57:\n if (this.strict) {\n this.invalidStringToken(\n this.pos - 1,\n \"Invalid escape sequence\"\n );\n }\n if (inTemplate) {\n var codePos = this.pos - 1;\n\n this.invalidStringToken(\n codePos,\n \"Invalid escape sequence in template string\"\n );\n }\n default:\n if (ch >= 48 && ch <= 55) {\n var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];\n var octal = parseInt(octalStr, 8);\n if (octal > 255) {\n octalStr = octalStr.slice(0, -1);\n octal = parseInt(octalStr, 8);\n }\n this.pos += octalStr.length - 1;\n ch = this.input.charCodeAt(this.pos);\n if ((octalStr !== \"0\" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {\n this.invalidStringToken(\n this.pos - 1 - octalStr.length,\n inTemplate\n ? \"Octal literal in template string\"\n : \"Octal literal in strict mode\"\n );\n }\n return String.fromCharCode(octal)\n }\n if (isNewLine(ch)) {\n // Unicode new line characters after \\ get removed from output in both\n // template literals and strings\n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }\n return \"\"\n }\n return String.fromCharCode(ch)\n }\n};\n\n// Used to read character escape sequences ('\\x', '\\u', '\\U').\n\npp.readHexChar = function(len) {\n var codePos = this.pos;\n var n = this.readInt(16, len);\n if (n === null) { this.invalidStringToken(codePos, \"Bad character escape sequence\"); }\n return n\n};\n\n// Read an identifier, and return it as a string. Sets `this.containsEsc`\n// to whether the word contained a '\\u' escape.\n//\n// Incrementally adds only escaped chars, adding other chunks as-is\n// as a micro-optimization.\n\npp.readWord1 = function() {\n this.containsEsc = false;\n var word = \"\", first = true, chunkStart = this.pos;\n var astral = this.options.ecmaVersion >= 6;\n while (this.pos < this.input.length) {\n var ch = this.fullCharCodeAtPos();\n if (isIdentifierChar(ch, astral)) {\n this.pos += ch <= 0xffff ? 1 : 2;\n } else if (ch === 92) { // \"\\\"\n this.containsEsc = true;\n word += this.input.slice(chunkStart, this.pos);\n var escStart = this.pos;\n if (this.input.charCodeAt(++this.pos) !== 117) // \"u\"\n { this.invalidStringToken(this.pos, \"Expecting Unicode escape sequence \\\\uXXXX\"); }\n ++this.pos;\n var esc = this.readCodePoint();\n if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))\n { this.invalidStringToken(escStart, \"Invalid Unicode escape\"); }\n word += codePointToString(esc);\n chunkStart = this.pos;\n } else {\n break\n }\n first = false;\n }\n return word + this.input.slice(chunkStart, this.pos)\n};\n\n// Read an identifier or keyword token. Will check for reserved\n// words when necessary.\n\npp.readWord = function() {\n var word = this.readWord1();\n var type = types$1.name;\n if (this.keywords.test(word)) {\n type = keywords[word];\n }\n return this.finishToken(type, word)\n};\n\n// Acorn is a tiny, fast JavaScript parser written in JavaScript.\n//\n// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and\n// various contributors and released under an MIT license.\n//\n// Git repositories for Acorn are available at\n//\n// http://marijnhaverbeke.nl/git/acorn\n// https://github.com/acornjs/acorn.git\n//\n// Please use the [github bug tracker][ghbt] to report issues.\n//\n// [ghbt]: https://github.com/acornjs/acorn/issues\n\n\nvar version = \"8.19.0\";\n\nParser.acorn = {\n Parser: Parser,\n version: version,\n defaultOptions: defaultOptions,\n Position: Position,\n SourceLocation: SourceLocation,\n getLineInfo: getLineInfo,\n Node: Node,\n TokenType: TokenType,\n tokTypes: types$1,\n keywordTypes: keywords,\n TokContext: TokContext,\n tokContexts: types,\n isIdentifierChar: isIdentifierChar,\n isIdentifierStart: isIdentifierStart,\n Token: Token,\n isNewLine: isNewLine,\n lineBreak: lineBreak,\n lineBreakG: lineBreakG,\n nonASCIIwhitespace: nonASCIIwhitespace\n};\n\n// The main exported interface (under `self.acorn` when in the\n// browser) is a `parse` function that takes a code string and returns\n// an abstract syntax tree as specified by the [ESTree spec][estree].\n//\n// [estree]: https://github.com/estree/estree\n\nfunction parse(input, options) {\n return Parser.parse(input, options)\n}\n\n// This function tries to parse a single expression at a given\n// offset in a string. Useful for parsing mixed-language formats\n// that embed JavaScript expressions.\n\nfunction parseExpressionAt(input, pos, options) {\n return Parser.parseExpressionAt(input, pos, options)\n}\n\n// Acorn is organized as a tokenizer and a recursive-descent parser.\n// The `tokenizer` export provides an interface to the tokenizer.\n\nfunction tokenizer(input, options) {\n return Parser.tokenizer(input, options)\n}\n\nexport { Node, Parser, Position, SourceLocation, TokContext, Token, TokenType, defaultOptions, getLineInfo, isIdentifierChar, isIdentifierStart, isNewLine, keywords as keywordTypes, lineBreak, lineBreakG, nonASCIIwhitespace, parse, parseExpressionAt, types as tokContexts, types$1 as tokTypes, tokenizer, version };\n","/**\n * The ECMAScript character classes the JavaScript and SugarCube readers share, so that every\n * reader agrees on what ends a line and how positions are counted (ECMA-262 §12.2–12.3).\n *\n * - LineTerminator: LF, CR, LS (U+2028) and PS (U+2029); CR LF is one line break.\n * - WhiteSpace: JavaScript's `\\s` is exactly WhiteSpace plus LineTerminator, U+FEFF and every Zs\n * character included, so readers that mean JavaScript's white space use `\\s`.\n * - Identifier characters (ID_Start, ID_Continue, `$`, `_`, ZWNJ, ZWJ and `\\u` escapes) are read by\n * acorn, which every JavaScript reader here goes through.\n */\n\n/** The four ECMAScript line terminators: LF, CR, LS and PS. */\nexport const LINE_TERMINATORS = '\\n\\r\\u2028\\u2029';\n\n/** A line break: CR LF counts as one, as ECMAScript and acorn count lines. */\nconst LINE_BREAK_RE = /\\r\\n?|[\\n\\u2028\\u2029]/g;\n\n/** Whether `ch` is one of the four ECMAScript line terminators. */\nexport function isLineTerminator(ch: string | undefined): boolean {\n return ch?.length === 1 && LINE_TERMINATORS.includes(ch);\n}\n\n/** The index of the first line terminator at or after `from` in `text`, or `text.length`. */\nexport function lineEnd(text: string, from: number): number {\n for (let i = from; i < text.length; i++) {\n if (isLineTerminator(text[i])) return i;\n }\n return text.length;\n}\n\n/** A 1-based line and column, the column counted in UTF-16 code units. */\nexport interface LineColumn {\n readonly line: number;\n readonly column: number;\n}\n\n/**\n * Returns a function that gives the line and column of an offset in `text`, counting every\n * ECMAScript line break. The line starts are found once, on the first call, so each later call\n * takes logarithmic time.\n */\nexport function lineColumnFinder(text: string): (offset: number) => LineColumn {\n let starts: number[] | undefined;\n return (offset) => {\n starts ??= [0, ...Array.from(text.matchAll(LINE_BREAK_RE), (m) => m.index + m[0].length)];\n // The last line start at or before `offset`.\n let low = 0;\n let high = starts.length - 1;\n while (low < high) {\n const mid = (low + high + 1) >> 1;\n if (Number(starts[mid]) <= offset) low = mid;\n else high = mid - 1;\n }\n return { line: low + 1, column: offset - Number(starts[low]) + 1 };\n };\n}\n\n/** `line L, column C` for an offset in `text`. */\nexport function describePosition(where: LineColumn): string {\n return `line ${where.line}, column ${where.column}`;\n}\n","/**\n * The one way twee-ts reads JavaScript: acorn, bundled into the package. Nothing is ever executed.\n *\n * Story formats and story scripts run as classic scripts, so source is read with the Script goal\n * and its Annex B additions (HTML-like comments `<!--` and line-leading `-->`) plus a leading\n * hashbang, at the latest ECMAScript version acorn knows.\n */\nimport { Parser } from 'acorn';\nimport type { Options, Program } from 'acorn';\nimport { escapeLoneSurrogates, quotableCharacterAt } from './source-text.js';\n\n/** How acorn's message for a character no token can start with begins. */\nconst UNEXPECTED_CHARACTER = 'Unexpected character ';\n\n/** Options for a classic script, read as a browser reads one (sloppy mode unless it says otherwise). */\nexport const SCRIPT_OPTIONS: Readonly<Options> = { ecmaVersion: 'latest', sourceType: 'script', allowHashBang: true };\n\n/** A syntax error acorn found: its message, where it is reported, and how far acorn had read. */\nexport class JsSyntaxError extends Error {\n constructor(\n message: string,\n /** The offset the error is reported at. */\n readonly pos: number,\n /** The offset the scanner had reached when it gave up (at least `pos`). */\n readonly raisedAt: number,\n /** Whether the code may be valid, but nests too deeply for the parser: the call stack ran out. */\n readonly tooDeep = false,\n ) {\n super(message);\n }\n}\n\n/**\n * Acorn's parser, reporting syntax errors as {@link JsSyntaxError}. Acorn's own `raise` works out a\n * line and column for its message by reading the input from the start, which callers that recover\n * from many errors cannot afford; positions are reported by offset, and the caller describes them.\n * Acorn reports every syntax error through these two methods. It also turns most stack overflows\n * into a syntax error (\"Not enough stack space to parse input\"), which is reported as nesting too deep\n * (`tooDeep`), since the code may well be valid; where the stack runs out in a part of acorn it does not\n * guard, or in `raise` itself, the engine's `RangeError` comes through, which {@link trySyntax} reports the\n * same way.\n */\nexport class AcornParser extends Parser {\n /** Acorn's current scanning position, which its type declarations leave out. */\n declare pos: number;\n\n raise(pos: number, message: string): never {\n if (message === ACORN_STACK_OVERFLOW) throw tooDeep(pos, this.pos);\n // Diagnostics quote this message. Acorn quotes an unexpected character as it reads it: a lone surrogate as it\n // is, and a high surrogate at the end of the input as U+10000; so that character is quoted from the input.\n const quoted = message.startsWith(UNEXPECTED_CHARACTER)\n ? `${UNEXPECTED_CHARACTER}'${quotableCharacterAt(this.input, pos)}'`\n : escapeLoneSurrogates(message);\n throw new JsSyntaxError(quoted, pos, this.pos);\n }\n\n raiseRecoverable(pos: number, message: string): never {\n this.raise(pos, message);\n }\n}\n\n/** What reading with acorn gave: a value, or the syntax error that stopped it. */\nexport type SyntaxRead<T> =\n { readonly ok: true; readonly value: T } | { readonly ok: false; readonly error: JsSyntaxError };\n\n/** The message of acorn's own stack overflow guard. */\nconst ACORN_STACK_OVERFLOW = 'Not enough stack space to parse input';\n\n/** The error for code nested too deeply to read: the call stack ran out, which says nothing of its syntax. */\nfunction tooDeep(pos: number, raisedAt: number): JsSyntaxError {\n return new JsSyntaxError('Nested too deeply to read: the parser ran out of stack space', pos, raisedAt, true);\n}\n\n/** The engine's messages for a stack overflow (V8, SpiderMonkey), as acorn recognises them. */\nconst STACK_OVERFLOW = /\\bstack\\b.*\\b(?:exceeded|overflow)\\b|\\btoo much recursion\\b/i;\n\n/**\n * Run a read with {@link AcornParser}, turning its syntax error, or a stack overflow on input nested\n * too deeply, into a result; other errors propagate.\n */\nexport function trySyntax<T>(read: () => T): SyntaxRead<T> {\n try {\n return { ok: true, value: read() };\n } catch (e) {\n if (e instanceof JsSyntaxError) return { ok: false, error: e };\n if (e instanceof RangeError && STACK_OVERFLOW.test(e.message)) {\n return { ok: false, error: tooDeep(0, 0) };\n }\n throw e;\n }\n}\n\n/** Parse `source` as a classic script. */\nexport function parseScript(source: string, options: Readonly<Options> = SCRIPT_OPTIONS): SyntaxRead<Program> {\n return trySyntax(() => AcornParser.parse(source, options));\n}\n","/**\n * Reads the strings in JavaScript source, as the link check needs them: SugarCube evaluates\n * quoted macro arguments as strict-mode JavaScript, and stories build macro calls in the strings\n * of their scripts (`$.wiki('<<goto \"Room\">>')`).\n *\n * Source is read with acorn (see `js-syntax.ts`), so comments, regular expression literals,\n * template literals and their nesting are told apart exactly as ECMAScript tells them apart.\n */\nimport { tokTypes } from 'acorn';\nimport type { Options, Token, TokenType } from 'acorn';\nimport { lineEnd } from './js-chars.js';\nimport { isRecord } from './util.js';\nimport { AcornParser, SCRIPT_OPTIONS, parseScript, trySyntax } from './js-syntax.js';\nimport type { JsSyntaxError } from './js-syntax.js';\n\n/**\n * Stands in for each `${…}` substitution in a template literal's value: a Unicode noncharacter,\n * which text doesn't contain. A passage name that includes it is known only in play.\n */\nexport const SUBSTITUTION = '\\ufdd0';\n\n/**\n * How code is evaluated: Story JavaScript, `<<script>>` bodies and macro arguments in strict mode\n * (SugarCube evaluates them from its strict-mode code), a `<script>` element in sloppy mode (the\n * browser runs it as a classic script), or as a module (a `<script type=\"module\">` element). Strict\n * and sloppy mode differ in their strings only in legacy octal escapes (`\\101`) and `\\8`/`\\9`, which\n * strict mode rejects; a module is strict, and has no HTML-like comments (`<!--`, line-leading `-->`).\n */\nexport type ScriptMode = 'strict' | 'sloppy' | 'module';\n\nconst STRICT_OPTIONS: Readonly<Options> = { ...SCRIPT_OPTIONS, strict: true };\n\n/**\n * The value of a quoted JavaScript string literal (quotes included, and nothing around it), as\n * JavaScript evaluates it in the given mode; `undefined` if the text is not exactly one string\n * literal, or the mode rejects it (strict mode rejects legacy octal escapes such as `\\1`, and `\\8`).\n */\nexport function evalStringLiteral(literal: string, mode: ScriptMode = 'strict'): string | undefined {\n const quote = literal[0];\n if (quote !== '\"' && quote !== \"'\") return undefined;\n const read = trySyntax(() =>\n AcornParser.parseExpressionAt(literal, 0, mode === 'sloppy' ? SCRIPT_OPTIONS : STRICT_OPTIONS),\n );\n const node = read.ok ? read.value : undefined;\n return node?.type === 'Literal' && typeof node.value === 'string' && node.end === literal.length\n ? node.value\n : undefined;\n}\n\n/**\n * Options for reading a story's code: a classic script, with what only the surrounding code could\n * make valid (a `return` or `await` at the top level, `super`, `import`) allowed, as it changes no\n * token.\n */\nconst STORY_CODE_OPTIONS: Readonly<Options> = {\n ...SCRIPT_OPTIONS,\n allowReturnOutsideFunction: true,\n allowAwaitOutsideFunction: true,\n allowSuperOutsideMethod: true,\n allowImportExportEverywhere: true,\n checkPrivateFields: false,\n};\n\n/** Options for reading story code in `mode`: a module is read with the Module goal. */\nfunction storyCodeOptions(mode: ScriptMode): Readonly<Options> {\n return mode === 'module' ? STORY_MODULE_OPTIONS : STORY_CODE_OPTIONS;\n}\n\nconst STORY_MODULE_OPTIONS: Readonly<Options> = { ...STORY_CODE_OPTIONS, sourceType: 'module' };\n\n/** The parts of an acorn token the strings are read from; `start` and `end` index the whole source. */\ninterface SourceToken {\n readonly type: TokenType;\n readonly value: unknown;\n readonly start: number;\n readonly end: number;\n}\n\nfunction tokenValue(token: Token): unknown {\n return Reflect.get(token, 'value');\n}\n\nfunction sourceToken(token: Token): SourceToken {\n return {\n type: token.type,\n // Acorn's tokens carry their value, which its type declarations leave out.\n value: tokenValue(token),\n start: token.start,\n end: token.end,\n };\n}\n\n/**\n * The values of the string and template literals in JavaScript source, in the order they end. A\n * template literal's value keeps its text and has `SUBSTITUTION` where each `${…}` was; the\n * strings inside a substitution are values of their own, and come before it. A string or\n * template literal that the mode rejects is left out.\n *\n * Source that parses as a script is read exactly. Story code often doesn't (TwineScript such as\n * `$x to \"y\"`, or a syntax error): up to the point where the parse failed, it is read exactly; from\n * there on, by acorn's tokenizer (see {@link tokenRuns}), which tells a regular expression from a\n * division by the tokens before it and keeps track of template literals however the code is\n * written.\n */\nexport function javaScriptStrings(source: string, mode: ScriptMode = 'strict'): string[] {\n const tokens: Token[] = [];\n const options = storyCodeOptions(mode);\n const parsed = parseScript(source, { ...options, onToken: tokens });\n const exact = tokens.map(sourceToken);\n const runs = parsed.ok\n ? [exact]\n : joinAt(exact, tokenRuns(source, options), Math.max(parsed.error.pos, exact.at(-1)?.end ?? 0));\n return runs.flatMap((run) => literalValues(source, run, mode));\n}\n\n/** Tokens the tokenizer read in one go, from `start`, with nothing open there. */\ninterface TokenRun {\n readonly start: number;\n readonly tokens: SourceToken[];\n}\n\n/**\n * The exact tokens before `at`, then the tokenizer's from `at` on. The tokenizer's run that\n * reaches over `at` goes on from the exact tokens, as one run, so a template literal open there\n * stays open.\n */\nfunction joinAt(exact: readonly SourceToken[], runs: readonly TokenRun[], at: number): SourceToken[][] {\n const joined: SourceToken[][] = [];\n let head: SourceToken[] | undefined = [...exact];\n for (const run of runs) {\n const after = run.tokens.filter((token) => token.start >= at);\n if (head !== undefined && run.start < at) {\n // One at a time: spreading a long run as arguments (`push(...after)`) overflows the stack.\n for (const token of after) head.push(token);\n } else if (after.length > 0) {\n if (head !== undefined) joined.push(head);\n head = undefined;\n joined.push(after);\n }\n }\n if (head !== undefined) joined.push(head);\n return joined;\n}\n\ndeclare module 'acorn' {\n // Acorn's own tokenizer methods, which its type declarations leave out; TolerantTokenizer refines them.\n interface Parser {\n /** Updates the token context and `exprAllowed` after the token just read; `prevType` is the one before. */\n updateContext(prevType: TokenType): void;\n /** Whether a `{` after a token of `prevType` opens a block (rather than an object literal). */\n braceIsBlock(prevType: TokenType): boolean;\n }\n}\n\n/** Whether one of acorn's token contexts is a brace that opened a block (acorn's `b_stat`). */\nfunction isBlockBrace(context: unknown): boolean {\n return isRecord(context) && context['token'] === '{' && context['isExpr'] === false;\n}\n\n/**\n * Acorn's tokenizer, made to read on after an error as acorn-loose does: a syntax error ends the\n * current token with a {@link JsSyntaxError}, and {@link restartAt} reads on from a later position\n * with nothing open. The members declared here are acorn's own, which its type declarations leave\n * out.\n *\n * Without a parse, acorn tells a regular expression from a division by the tokens before it. Two of\n * its rules are refined here, where they read valid code wrongly:\n * - a `{` right after a `}` that closed a block (of a statement, a function, a class or an arrow\n * function) opens a block, not an object literal: such a `}` ends a statement, so what follows\n * starts one (acorn decided by whether an expression may follow, which it may);\n * - an expression may follow `await` (except as a property name, `o.await`), so `await /re/` reads\n * a regular expression. Acorn took `await` for a name. Story code may use `await` at the top\n * level, and `await` as a variable name, the one case read wrongly now (`await / 2`), is valid\n * only in sloppy code outside async functions and practically unused.\n */\nclass TolerantTokenizer extends AcornParser {\n declare context: unknown[];\n declare exprAllowed: boolean;\n declare containsEsc: boolean;\n declare type: TokenType;\n declare value: unknown;\n declare getToken: () => Token;\n declare initialContext: () => unknown[];\n\n /** Whether the last token was a `}` that closed a block. */\n private closedBlock = false;\n\n constructor(input: string, options: Readonly<Options>) {\n super(options, input);\n }\n\n override updateContext(prevType: TokenType): void {\n const closing = this.type === tokTypes.braceR ? this.context.at(-1) : undefined;\n super.updateContext(prevType);\n this.closedBlock = closing !== undefined && isBlockBrace(closing);\n if (this.type === tokTypes.name && this.value === 'await' && prevType !== tokTypes.dot) {\n this.exprAllowed = true;\n }\n }\n\n override braceIsBlock(prevType: TokenType): boolean {\n return (prevType === tokTypes.braceR && this.closedBlock) || super.braceIsBlock(prevType);\n }\n\n /** Read on from `pos` as at the start of a script. */\n restartAt(pos: number): void {\n this.pos = pos;\n this.context = this.initialContext();\n this.exprAllowed = true;\n this.containsEsc = false;\n this.closedBlock = false;\n }\n}\n\n/**\n * The tokens of source that does not parse, in runs read by acorn's tokenizer. Where the\n * tokenizer stops at an error, the next run starts:\n * - after an unexpected character, just past it;\n * - after an unterminated block comment or template literal, nowhere: what follows is all inside it;\n * - after any other error (an unterminated string or regular expression, a bad escape or number),\n * at the start of the next line, so a string that does not close is not read again from inside.\n * Each run starts with nothing open, as at the start of a script. A run starts where the last one\n * stopped reading, or later, so this takes linear time.\n */\nfunction tokenRuns(source: string, options: Readonly<Options>): TokenRun[] {\n let run: TokenRun = { start: 0, tokens: [] };\n const runs = [run];\n const stream = new TolerantTokenizer(source, options);\n for (;;) {\n const read = trySyntax(() => stream.getToken());\n if (read.ok) {\n if (read.value.type === tokTypes.eof) break;\n run.tokens.push(sourceToken(read.value));\n } else {\n const next = resumeAfter(source, read.error);\n if (next === undefined) break;\n stream.restartAt(next);\n run = { start: next, tokens: [] };\n runs.push(run);\n }\n }\n return runs;\n}\n\n/**\n * Where to read on after a tokenizer error, or `undefined` if nothing after it can be read. The\n * kind of error is told by acorn's message; the tests pin each message this relies on.\n */\nfunction resumeAfter(source: string, stop: JsSyntaxError): number | undefined {\n const { message } = stop;\n if (message.startsWith('Unterminated comment') || message.startsWith('Unterminated template')) return undefined;\n const next = message.startsWith('Unexpected character')\n ? stop.pos + (isSurrogatePair(source, stop.pos) ? 2 : 1)\n : nextLineStart(source, Math.max(stop.pos, stop.raisedAt));\n return next < source.length ? next : undefined;\n}\n\n/** Whether a character outside the Basic Multilingual Plane, written as two code units, starts at `pos`. */\nfunction isSurrogatePair(source: string, pos: number): boolean {\n return /^[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/.test(source.slice(pos, pos + 2));\n}\n\n/** The start of the line after the one holding `pos`. */\nfunction nextLineStart(source: string, pos: number): number {\n const end = lineEnd(source, pos);\n return source.startsWith('\\r\\n', end) ? end + 2 : end + 1;\n}\n\n/** A template literal being read: its value so far, and whether every piece of it is valid. */\ninterface TemplateFrame {\n value: string;\n valid: boolean;\n}\n\nconst LEGACY_ESCAPE_CANDIDATE = /\\\\[0-9]/;\n\n/** The values of the string and template literals among `tokens`, in the order they end. */\nfunction literalValues(source: string, tokens: readonly SourceToken[], mode: ScriptMode): string[] {\n const values: string[] = [];\n const templates: TemplateFrame[] = [];\n let previous: TokenType | undefined;\n for (const token of tokens) {\n const top = templates[templates.length - 1];\n switch (token.type) {\n case tokTypes.string: {\n const raw = source.slice(token.start, token.end);\n // Acorn's tokenizer cooks strings as sloppy mode does; only an escape of a digit can differ in strict mode.\n const value =\n mode !== 'sloppy' && LEGACY_ESCAPE_CANDIDATE.test(raw) ? evalStringLiteral(raw, 'strict') : token.value;\n if (typeof value === 'string') values.push(value);\n break;\n }\n case tokTypes.backQuote:\n if (previous === tokTypes.template || previous === tokTypes.invalidTemplate) {\n // The closing quote: a template piece always comes just before it.\n const done = templates.pop();\n if (done?.valid === true) values.push(done.value);\n } else {\n templates.push({ value: '', valid: true });\n }\n break;\n case tokTypes.template:\n if (top !== undefined) top.value += typeof token.value === 'string' ? token.value : '';\n break;\n case tokTypes.invalidTemplate:\n // A tagged template's piece with an escape no template may hold as a string.\n if (top !== undefined) top.valid = false;\n break;\n case tokTypes.dollarBraceL:\n if (top !== undefined) top.value += SUBSTITUTION;\n break;\n default:\n break;\n }\n previous = token.type;\n }\n return values;\n}\n","const UNDEFINED_CODE_POINTS = new Set([\n 65534, 65535, 131070, 131071, 196606, 196607, 262142, 262143, 327678, 327679, 393214,\n 393215, 458750, 458751, 524286, 524287, 589822, 589823, 655358, 655359, 720894,\n 720895, 786430, 786431, 851966, 851967, 917502, 917503, 983038, 983039, 1048574,\n 1048575, 1114110, 1114111,\n]);\nexport const REPLACEMENT_CHARACTER = '\\uFFFD';\nexport var CODE_POINTS;\n(function (CODE_POINTS) {\n CODE_POINTS[CODE_POINTS[\"EOF\"] = -1] = \"EOF\";\n CODE_POINTS[CODE_POINTS[\"NULL\"] = 0] = \"NULL\";\n CODE_POINTS[CODE_POINTS[\"TABULATION\"] = 9] = \"TABULATION\";\n CODE_POINTS[CODE_POINTS[\"CARRIAGE_RETURN\"] = 13] = \"CARRIAGE_RETURN\";\n CODE_POINTS[CODE_POINTS[\"LINE_FEED\"] = 10] = \"LINE_FEED\";\n CODE_POINTS[CODE_POINTS[\"FORM_FEED\"] = 12] = \"FORM_FEED\";\n CODE_POINTS[CODE_POINTS[\"SPACE\"] = 32] = \"SPACE\";\n CODE_POINTS[CODE_POINTS[\"EXCLAMATION_MARK\"] = 33] = \"EXCLAMATION_MARK\";\n CODE_POINTS[CODE_POINTS[\"QUOTATION_MARK\"] = 34] = \"QUOTATION_MARK\";\n CODE_POINTS[CODE_POINTS[\"AMPERSAND\"] = 38] = \"AMPERSAND\";\n CODE_POINTS[CODE_POINTS[\"APOSTROPHE\"] = 39] = \"APOSTROPHE\";\n CODE_POINTS[CODE_POINTS[\"HYPHEN_MINUS\"] = 45] = \"HYPHEN_MINUS\";\n CODE_POINTS[CODE_POINTS[\"SOLIDUS\"] = 47] = \"SOLIDUS\";\n CODE_POINTS[CODE_POINTS[\"DIGIT_0\"] = 48] = \"DIGIT_0\";\n CODE_POINTS[CODE_POINTS[\"DIGIT_9\"] = 57] = \"DIGIT_9\";\n CODE_POINTS[CODE_POINTS[\"SEMICOLON\"] = 59] = \"SEMICOLON\";\n CODE_POINTS[CODE_POINTS[\"LESS_THAN_SIGN\"] = 60] = \"LESS_THAN_SIGN\";\n CODE_POINTS[CODE_POINTS[\"EQUALS_SIGN\"] = 61] = \"EQUALS_SIGN\";\n CODE_POINTS[CODE_POINTS[\"GREATER_THAN_SIGN\"] = 62] = \"GREATER_THAN_SIGN\";\n CODE_POINTS[CODE_POINTS[\"QUESTION_MARK\"] = 63] = \"QUESTION_MARK\";\n CODE_POINTS[CODE_POINTS[\"LATIN_CAPITAL_A\"] = 65] = \"LATIN_CAPITAL_A\";\n CODE_POINTS[CODE_POINTS[\"LATIN_CAPITAL_Z\"] = 90] = \"LATIN_CAPITAL_Z\";\n CODE_POINTS[CODE_POINTS[\"RIGHT_SQUARE_BRACKET\"] = 93] = \"RIGHT_SQUARE_BRACKET\";\n CODE_POINTS[CODE_POINTS[\"GRAVE_ACCENT\"] = 96] = \"GRAVE_ACCENT\";\n CODE_POINTS[CODE_POINTS[\"LATIN_SMALL_A\"] = 97] = \"LATIN_SMALL_A\";\n CODE_POINTS[CODE_POINTS[\"LATIN_SMALL_Z\"] = 122] = \"LATIN_SMALL_Z\";\n})(CODE_POINTS || (CODE_POINTS = {}));\nexport const SEQUENCES = {\n DASH_DASH: '--',\n CDATA_START: '[CDATA[',\n DOCTYPE: 'doctype',\n SCRIPT: 'script',\n PUBLIC: 'public',\n SYSTEM: 'system',\n};\n//Surrogates\nexport function isSurrogate(cp) {\n return cp >= 55296 && cp <= 57343;\n}\nexport function isSurrogatePair(cp) {\n return cp >= 56320 && cp <= 57343;\n}\nexport function getSurrogatePairCodePoint(cp1, cp2) {\n return (cp1 - 55296) * 1024 + 9216 + cp2;\n}\n//NOTE: excluding NULL and ASCII whitespace\nexport function isControlCodePoint(cp) {\n return ((cp !== 0x20 && cp !== 0x0a && cp !== 0x0d && cp !== 0x09 && cp !== 0x0c && cp >= 0x01 && cp <= 0x1f) ||\n (cp >= 0x7f && cp <= 0x9f));\n}\nexport function isUndefinedCodePoint(cp) {\n return (cp >= 64976 && cp <= 65007) || UNDEFINED_CODE_POINTS.has(cp);\n}\n","export var ERR;\n(function (ERR) {\n ERR[\"controlCharacterInInputStream\"] = \"control-character-in-input-stream\";\n ERR[\"noncharacterInInputStream\"] = \"noncharacter-in-input-stream\";\n ERR[\"surrogateInInputStream\"] = \"surrogate-in-input-stream\";\n ERR[\"nonVoidHtmlElementStartTagWithTrailingSolidus\"] = \"non-void-html-element-start-tag-with-trailing-solidus\";\n ERR[\"endTagWithAttributes\"] = \"end-tag-with-attributes\";\n ERR[\"endTagWithTrailingSolidus\"] = \"end-tag-with-trailing-solidus\";\n ERR[\"unexpectedSolidusInTag\"] = \"unexpected-solidus-in-tag\";\n ERR[\"unexpectedNullCharacter\"] = \"unexpected-null-character\";\n ERR[\"unexpectedQuestionMarkInsteadOfTagName\"] = \"unexpected-question-mark-instead-of-tag-name\";\n ERR[\"invalidFirstCharacterOfTagName\"] = \"invalid-first-character-of-tag-name\";\n ERR[\"unexpectedEqualsSignBeforeAttributeName\"] = \"unexpected-equals-sign-before-attribute-name\";\n ERR[\"missingEndTagName\"] = \"missing-end-tag-name\";\n ERR[\"unexpectedCharacterInAttributeName\"] = \"unexpected-character-in-attribute-name\";\n ERR[\"unknownNamedCharacterReference\"] = \"unknown-named-character-reference\";\n ERR[\"missingSemicolonAfterCharacterReference\"] = \"missing-semicolon-after-character-reference\";\n ERR[\"unexpectedCharacterAfterDoctypeSystemIdentifier\"] = \"unexpected-character-after-doctype-system-identifier\";\n ERR[\"unexpectedCharacterInUnquotedAttributeValue\"] = \"unexpected-character-in-unquoted-attribute-value\";\n ERR[\"eofBeforeTagName\"] = \"eof-before-tag-name\";\n ERR[\"eofInTag\"] = \"eof-in-tag\";\n ERR[\"missingAttributeValue\"] = \"missing-attribute-value\";\n ERR[\"missingWhitespaceBetweenAttributes\"] = \"missing-whitespace-between-attributes\";\n ERR[\"missingWhitespaceAfterDoctypePublicKeyword\"] = \"missing-whitespace-after-doctype-public-keyword\";\n ERR[\"missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers\"] = \"missing-whitespace-between-doctype-public-and-system-identifiers\";\n ERR[\"missingWhitespaceAfterDoctypeSystemKeyword\"] = \"missing-whitespace-after-doctype-system-keyword\";\n ERR[\"missingQuoteBeforeDoctypePublicIdentifier\"] = \"missing-quote-before-doctype-public-identifier\";\n ERR[\"missingQuoteBeforeDoctypeSystemIdentifier\"] = \"missing-quote-before-doctype-system-identifier\";\n ERR[\"missingDoctypePublicIdentifier\"] = \"missing-doctype-public-identifier\";\n ERR[\"missingDoctypeSystemIdentifier\"] = \"missing-doctype-system-identifier\";\n ERR[\"abruptDoctypePublicIdentifier\"] = \"abrupt-doctype-public-identifier\";\n ERR[\"abruptDoctypeSystemIdentifier\"] = \"abrupt-doctype-system-identifier\";\n ERR[\"cdataInHtmlContent\"] = \"cdata-in-html-content\";\n ERR[\"incorrectlyOpenedComment\"] = \"incorrectly-opened-comment\";\n ERR[\"eofInScriptHtmlCommentLikeText\"] = \"eof-in-script-html-comment-like-text\";\n ERR[\"eofInDoctype\"] = \"eof-in-doctype\";\n ERR[\"nestedComment\"] = \"nested-comment\";\n ERR[\"abruptClosingOfEmptyComment\"] = \"abrupt-closing-of-empty-comment\";\n ERR[\"eofInComment\"] = \"eof-in-comment\";\n ERR[\"incorrectlyClosedComment\"] = \"incorrectly-closed-comment\";\n ERR[\"eofInCdata\"] = \"eof-in-cdata\";\n ERR[\"absenceOfDigitsInNumericCharacterReference\"] = \"absence-of-digits-in-numeric-character-reference\";\n ERR[\"nullCharacterReference\"] = \"null-character-reference\";\n ERR[\"surrogateCharacterReference\"] = \"surrogate-character-reference\";\n ERR[\"characterReferenceOutsideUnicodeRange\"] = \"character-reference-outside-unicode-range\";\n ERR[\"controlCharacterReference\"] = \"control-character-reference\";\n ERR[\"noncharacterCharacterReference\"] = \"noncharacter-character-reference\";\n ERR[\"missingWhitespaceBeforeDoctypeName\"] = \"missing-whitespace-before-doctype-name\";\n ERR[\"missingDoctypeName\"] = \"missing-doctype-name\";\n ERR[\"invalidCharacterSequenceAfterDoctypeName\"] = \"invalid-character-sequence-after-doctype-name\";\n ERR[\"duplicateAttribute\"] = \"duplicate-attribute\";\n ERR[\"nonConformingDoctype\"] = \"non-conforming-doctype\";\n ERR[\"missingDoctype\"] = \"missing-doctype\";\n ERR[\"misplacedDoctype\"] = \"misplaced-doctype\";\n ERR[\"endTagWithoutMatchingOpenElement\"] = \"end-tag-without-matching-open-element\";\n ERR[\"closingOfElementWithOpenChildElements\"] = \"closing-of-element-with-open-child-elements\";\n ERR[\"disallowedContentInNoscriptInHead\"] = \"disallowed-content-in-noscript-in-head\";\n ERR[\"openElementsLeftAfterEof\"] = \"open-elements-left-after-eof\";\n ERR[\"abandonedHeadElementChild\"] = \"abandoned-head-element-child\";\n ERR[\"misplacedStartTagForHeadElement\"] = \"misplaced-start-tag-for-head-element\";\n ERR[\"nestedNoscriptInHead\"] = \"nested-noscript-in-head\";\n ERR[\"eofInElementThatCanContainOnlyText\"] = \"eof-in-element-that-can-contain-only-text\";\n})(ERR || (ERR = {}));\n","import { CODE_POINTS as $, getSurrogatePairCodePoint, isControlCodePoint, isSurrogate, isSurrogatePair, isUndefinedCodePoint, } from '../common/unicode.js';\nimport { ERR } from '../common/error-codes.js';\n//Const\nconst DEFAULT_BUFFER_WATERLINE = 1 << 16;\n//Preprocessor\n//NOTE: HTML input preprocessing\n//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream)\nexport class Preprocessor {\n constructor(handler) {\n this.handler = handler;\n this.html = '';\n this.pos = -1;\n // NOTE: Initial `lastGapPos` is -2, to ensure `col` on initialisation is 0\n this.lastGapPos = -2;\n this.gapStack = [];\n this.skipNextNewLine = false;\n this.lastChunkWritten = false;\n this.endOfChunkHit = false;\n this.bufferWaterline = DEFAULT_BUFFER_WATERLINE;\n this.isEol = false;\n this.lineStartPos = 0;\n this.droppedBufferSize = 0;\n this.line = 1;\n //NOTE: avoid reporting errors twice on advance/retreat\n this.lastErrOffset = -1;\n }\n /** The column on the current line. If we just saw a gap (eg. a surrogate pair), return the index before. */\n get col() {\n return this.pos - this.lineStartPos + Number(this.lastGapPos !== this.pos);\n }\n get offset() {\n return this.droppedBufferSize + this.pos;\n }\n getError(code, cpOffset) {\n const { line, col, offset } = this;\n const startCol = col + cpOffset;\n const startOffset = offset + cpOffset;\n return {\n code,\n startLine: line,\n endLine: line,\n startCol,\n endCol: startCol,\n startOffset,\n endOffset: startOffset,\n };\n }\n _err(code) {\n if (this.handler.onParseError && this.lastErrOffset !== this.offset) {\n this.lastErrOffset = this.offset;\n this.handler.onParseError(this.getError(code, 0));\n }\n }\n _addGap() {\n this.gapStack.push(this.lastGapPos);\n this.lastGapPos = this.pos;\n }\n _processSurrogate(cp) {\n //NOTE: try to peek a surrogate pair\n if (this.pos !== this.html.length - 1) {\n const nextCp = this.html.charCodeAt(this.pos + 1);\n if (isSurrogatePair(nextCp)) {\n //NOTE: we have a surrogate pair. Peek pair character and recalculate code point.\n this.pos++;\n //NOTE: add a gap that should be avoided during retreat\n this._addGap();\n return getSurrogatePairCodePoint(cp, nextCp);\n }\n }\n //NOTE: we are at the end of a chunk, therefore we can't infer the surrogate pair yet.\n else if (!this.lastChunkWritten) {\n this.endOfChunkHit = true;\n return $.EOF;\n }\n //NOTE: isolated surrogate\n this._err(ERR.surrogateInInputStream);\n return cp;\n }\n willDropParsedChunk() {\n return this.pos > this.bufferWaterline;\n }\n dropParsedChunk() {\n if (this.willDropParsedChunk()) {\n this.html = this.html.substring(this.pos);\n this.lineStartPos -= this.pos;\n this.droppedBufferSize += this.pos;\n this.pos = 0;\n this.lastGapPos = -2;\n this.gapStack.length = 0;\n }\n }\n write(chunk, isLastChunk) {\n if (this.html.length > 0) {\n this.html += chunk;\n }\n else {\n this.html = chunk;\n }\n this.endOfChunkHit = false;\n this.lastChunkWritten = isLastChunk;\n }\n insertHtmlAtCurrentPos(chunk) {\n this.html = this.html.substring(0, this.pos + 1) + chunk + this.html.substring(this.pos + 1);\n this.endOfChunkHit = false;\n }\n startsWith(pattern, caseSensitive) {\n // Check if our buffer has enough characters\n if (this.pos + pattern.length > this.html.length) {\n this.endOfChunkHit = !this.lastChunkWritten;\n return false;\n }\n if (caseSensitive) {\n return this.html.startsWith(pattern, this.pos);\n }\n for (let i = 0; i < pattern.length; i++) {\n const cp = this.html.charCodeAt(this.pos + i) | 0x20;\n if (cp !== pattern.charCodeAt(i)) {\n return false;\n }\n }\n return true;\n }\n peek(offset) {\n const pos = this.pos + offset;\n if (pos >= this.html.length) {\n this.endOfChunkHit = !this.lastChunkWritten;\n return $.EOF;\n }\n const code = this.html.charCodeAt(pos);\n return code === $.CARRIAGE_RETURN ? $.LINE_FEED : code;\n }\n advance() {\n this.pos++;\n //NOTE: LF should be in the last column of the line\n if (this.isEol) {\n this.isEol = false;\n this.line++;\n this.lineStartPos = this.pos;\n }\n if (this.pos >= this.html.length) {\n this.endOfChunkHit = !this.lastChunkWritten;\n return $.EOF;\n }\n let cp = this.html.charCodeAt(this.pos);\n //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters\n if (cp === $.CARRIAGE_RETURN) {\n this.isEol = true;\n this.skipNextNewLine = true;\n return $.LINE_FEED;\n }\n //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character\n //must be ignored.\n if (cp === $.LINE_FEED) {\n this.isEol = true;\n if (this.skipNextNewLine) {\n // `line` will be bumped again in the recursive call.\n this.line--;\n this.skipNextNewLine = false;\n this._addGap();\n return this.advance();\n }\n }\n this.skipNextNewLine = false;\n if (isSurrogate(cp)) {\n cp = this._processSurrogate(cp);\n }\n //OPTIMIZATION: first check if code point is in the common allowed\n //range (ASCII alphanumeric, whitespaces, big chunk of BMP)\n //before going into detailed performance cost validation.\n const isCommonValidRange = this.handler.onParseError === null ||\n (cp > 0x1f && cp < 0x7f) ||\n cp === $.LINE_FEED ||\n cp === $.CARRIAGE_RETURN ||\n (cp > 0x9f && cp < 64976);\n if (!isCommonValidRange) {\n this._checkForProblematicCharacters(cp);\n }\n return cp;\n }\n _checkForProblematicCharacters(cp) {\n if (isControlCodePoint(cp)) {\n this._err(ERR.controlCharacterInInputStream);\n }\n else if (isUndefinedCodePoint(cp)) {\n this._err(ERR.noncharacterInInputStream);\n }\n }\n retreat(count) {\n this.pos -= count;\n while (this.pos < this.lastGapPos) {\n this.lastGapPos = this.gapStack.pop();\n this.pos--;\n }\n this.isEol = false;\n }\n}\n","export var TokenType;\n(function (TokenType) {\n TokenType[TokenType[\"CHARACTER\"] = 0] = \"CHARACTER\";\n TokenType[TokenType[\"NULL_CHARACTER\"] = 1] = \"NULL_CHARACTER\";\n TokenType[TokenType[\"WHITESPACE_CHARACTER\"] = 2] = \"WHITESPACE_CHARACTER\";\n TokenType[TokenType[\"START_TAG\"] = 3] = \"START_TAG\";\n TokenType[TokenType[\"END_TAG\"] = 4] = \"END_TAG\";\n TokenType[TokenType[\"COMMENT\"] = 5] = \"COMMENT\";\n TokenType[TokenType[\"DOCTYPE\"] = 6] = \"DOCTYPE\";\n TokenType[TokenType[\"EOF\"] = 7] = \"EOF\";\n TokenType[TokenType[\"HIBERNATION\"] = 8] = \"HIBERNATION\";\n})(TokenType || (TokenType = {}));\nexport function getTokenAttr(token, attrName) {\n for (let i = token.attrs.length - 1; i >= 0; i--) {\n if (token.attrs[i].name === attrName) {\n return token.attrs[i].value;\n }\n }\n return null;\n}\n","// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134\n/**\n * C1 Unicode control character reference replacements (code points 128–159).\n * Index i gives the replacement for code point 128+i; 0 means \"no replacement\".\n */\nconst c1 = [\n 8364, 0, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, 8249, 338, 0,\n 381, 0, 0, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 353, 8250,\n 339, 0, 382, 376,\n];\n/**\n * True for NUL, UTF-16 surrogates, and values past U+10FFFF.\n * @param codePoint Unicode code point to check.\n */\nfunction isInvalidCodePoint(codePoint) {\n return (codePoint === 0 ||\n (codePoint >= 0xd8_00 && codePoint <= 0xdf_ff) ||\n codePoint > 0x10_ff_ff);\n}\n/**\n * Replace the given code point with U+FFFD if it is NUL (0), a surrogate, or\n * outside the valid Unicode range. Code points in the C1 controls range\n * (128–159) are remapped to their Windows-1252 equivalents, following the\n * HTML spec. All other code points are returned unchanged.\n * @param codePoint Unicode code point to convert.\n */\nexport function replaceCodePoint(codePoint) {\n if (isInvalidCodePoint(codePoint)) {\n return 0xff_fd;\n }\n if (codePoint >= 128 && codePoint <= 159) {\n return c1[codePoint - 128] || codePoint;\n }\n return codePoint;\n}\n/**\n * XML numeric character references are the referenced Unicode code point.\n * Invalid values still become U+FFFD; the HTML Windows-1252 C1 remap is not\n * applied.\n * @see https://www.w3.org/TR/xml/#NT-CharRef\n * @param codePoint Unicode code point to convert.\n */\nexport function replaceCodePointXML(codePoint) {\n return isInvalidCodePoint(codePoint) ? 0xff_fd : codePoint;\n}\n/**\n * Convert the code point of a decoded numeric entity to a string, replacing\n * invalid values.\n *\n * Fast path for plain BMP code points: [1..0x7F] and [0xA0..0xD7FF] pass\n * `replaceCodePoint` unchanged (no NUL, C1 remap, surrogate, or out-of-range\n * handling) and fit a single charCode. 0xd760 = 0xD800 (the first surrogate)\n * - 0xA0.\n * @param codePoint Unicode code point to convert.\n */\nexport function codePointToString(codePoint) {\n return (codePoint - 1) >>> 0 < 0x7f || (codePoint - 0xa0) >>> 0 < 0xd7_60\n ? String.fromCharCode(codePoint)\n : String.fromCodePoint(replaceCodePoint(codePoint));\n}\n//# sourceMappingURL=decode-codepoint.js.map","/*\n * Inverse of the encoder's SAFE alphabet (0x21..0x7E minus 0x22, 0x24, 0x5C),\n * precomputed once at module load. Entries for excluded chars stay 0 but\n * are never read.\n */\nconst BASE91_INVERSE = /* #__PURE__ */ (() => {\n const table = new Uint8Array(127);\n let code = 0;\n for (let char = 0x21; char <= 0x7e; char++) {\n if (char !== 0x22 && char !== 0x24 && char !== 0x5c) {\n table[char] = code++;\n }\n }\n return table;\n})();\n/**\n * Decode a dictionary-encoded trie string back into its Uint16Array.\n *\n * Stream layout (consumed in this order):\n * 1. dict1 atoms — `dict1AtomCount` uint16 values, delta+RLE encoded.\n * 2. dict2 atoms — `atomCount - dict1AtomCount` values, delta+RLE.\n * 3. dict2 ngrams — `ngramCount - (dictSize - dict1AtomCount)` entries,\n * each a pair of slot codes that resolve to earlier slots.\n * 4. dict1 ngrams — `dictSize - dict1AtomCount` entries, same shape.\n * 5. data — slot codes, each expanding to one or more uint16 values.\n *\n * Codes use a 91-char base (printable ASCII minus `\"`, `$`, `\\`):\n * - char1 < dictSize → 1-char code, slot = char1\n * - char1 ≥ dictSize → 2-char code, slot = dictSize + (char1 - dictSize)*91 + char2\n *\n * Slot index → token kind:\n * [0, A) dict1 atoms (1-char codes)\n * [A, dictSize) dict1 ngrams (1-char codes)\n * [dictSize, dictSize+D) dict2 atoms (2-char codes)\n * [dictSize+D, end) dict2 ngrams (2-char codes)\n *\n * Both atom dicts decode before any ngram, and dict2 ngrams decode before\n * dict1 ngrams. So every ngram entry references slots whose contents are\n * already filled — no forward references to handle.\n *\n * This runs on library import. Flat typed arrays store each slot as either\n * a plain value (`single`, covering every atom) or a range in a shared\n * `pool` (ngrams).\n * @param input Packed trie string.\n * @param resultLength Expected number of uint16 values in the output.\n * @param atomCount Total number of distinct uint16 values in the trie.\n * @param dict1AtomCount Atoms in the 1-char range (`A` above).\n * @param ngramCount Total number of ngram entries (dict1 + dict2).\n * @param dictSize Number of 1-char code slots; the rest of `BASE - dictSize`\n * first-byte values are 2-char codes.\n */\nexport function decodeTrieDict(input, resultLength, atomCount, dict1AtomCount, ngramCount, dictSize) {\n const base = 91;\n const inputLength = input.length;\n // For 2-char codes, slot = char1 * base - twoCharBias + char2.\n const twoCharBias = dictSize * (base - 1);\n let pos = 0;\n /** Read one slot code at `pos` and return its slot index, advancing pos. */\n const readSlotCode = () => {\n const c1 = BASE91_INVERSE[input.charCodeAt(pos++)];\n return c1 < dictSize\n ? c1\n : c1 * base - twoCharBias + BASE91_INVERSE[input.charCodeAt(pos++)];\n };\n const dict2AtomCount = atomCount - dict1AtomCount;\n const slotCount = atomCount + ngramCount;\n /*\n * Per-slot contents: atoms (always a single value) live directly in\n * `single`; ngram slots hold -1 there and expand to\n * `pool[start[slot] .. start[slot] + length[slot])`.\n */\n const single = new Int32Array(slotCount);\n single.fill(-1, dict1AtomCount, dictSize);\n single.fill(-1, dictSize + dict2AtomCount, slotCount);\n const start = new Int32Array(slotCount);\n const length = new Int32Array(slotCount);\n /**\n * Decode `count` ascending uint16 values from a delta+RLE stream into\n * `single[off..off+count)`.\n *\n * code < 89 → delta = code\n * code == 89 → run-length: next char encodes runLength-2; emit `runLength` consecutive +1 values\n * code == 90, next < 90 → escape: delta = 89 + next * BASE + after-next\n * code == 90, next == 90 → double-escape: extra char for very large deltas\n * @param count\n * @param off\n */\n function decodeDelta(count, off) {\n let previous = 0;\n let slot = off;\n const end = off + count;\n while (slot < end) {\n const code = BASE91_INVERSE[input.charCodeAt(pos++)];\n if (code < 89) {\n previous += code;\n single[slot++] = previous;\n }\n else if (code === 89) {\n let runLength = BASE91_INVERSE[input.charCodeAt(pos++)] + 2;\n while (runLength--)\n single[slot++] = ++previous;\n }\n else {\n const next = BASE91_INVERSE[input.charCodeAt(pos++)];\n previous +=\n 89 +\n // eslint-disable-next-line unicorn/prefer-minimal-ternary -- branches read a different number of side-effecting input bytes\n (next < 90\n ? next * base + BASE91_INVERSE[input.charCodeAt(pos++)]\n : BASE91_INVERSE[input.charCodeAt(pos++)] * 8281 +\n BASE91_INVERSE[input.charCodeAt(pos++)] * base +\n BASE91_INVERSE[input.charCodeAt(pos++)]);\n single[slot++] = previous;\n }\n }\n }\n // Streams 1 & 2: atoms decoded into their slot ranges.\n decodeDelta(dict1AtomCount, 0);\n decodeDelta(dict2AtomCount, dictSize);\n /*\n * Streams 3 & 4 are read in two passes: first collect every ngram's two\n * references and derive its expanded length (each ref resolves to an earlier\n * slot, so lengths are already known), which sizes the shared pool.\n * Pool ranges are handed out in decode order, so the second pass fills\n * the pool contiguously with a single write cursor.\n */\n const references = new Int32Array(ngramCount * 2);\n let poolSize = 0;\n let ngramIndex = 0;\n /**\n * Read `count` ngram entries (each = 2 slot-code references) for the slots\n * starting at `startSlot`, recording references and assigning pool ranges.\n * @param count\n * @param startSlot\n */\n function readNgramReferences(count, startSlot) {\n for (let index = 0; index < count; index++) {\n const slot = startSlot + index;\n const a = readSlotCode();\n const b = readSlotCode();\n references[ngramIndex * 2] = a;\n references[ngramIndex * 2 + 1] = b;\n ngramIndex += 1;\n start[slot] = poolSize;\n const entryLength = (single[a] < 0 ? length[a] : 1) +\n (single[b] < 0 ? length[b] : 1);\n length[slot] = entryLength;\n poolSize += entryLength;\n }\n }\n readNgramReferences(ngramCount - dictSize + dict1AtomCount, dictSize + dict2AtomCount);\n readNgramReferences(dictSize - dict1AtomCount, dict1AtomCount);\n // Second pass: concatenate each ngram's two halves into the pool.\n const pool = new Uint16Array(poolSize);\n let write = 0;\n for (let index = 0; index < ngramIndex; index++) {\n for (let half = 0; half < 2; half++) {\n const source = references[index * 2 + half];\n const value = single[source];\n if (value < 0) {\n let read = start[source];\n const readEnd = read + length[source];\n while (read < readEnd)\n pool[write++] = pool[read++];\n }\n else {\n pool[write++] = value;\n }\n }\n }\n // Stream 5: data. Each code expands to its slot's stored values.\n const out = new Uint16Array(resultLength);\n let outIndex = 0;\n while (pos < inputLength) {\n let slot = BASE91_INVERSE[input.charCodeAt(pos++)];\n if (slot >= dictSize) {\n slot =\n slot * base -\n twoCharBias +\n BASE91_INVERSE[input.charCodeAt(pos++)];\n }\n const value = single[slot];\n if (value < 0) {\n let read = start[slot];\n const readEnd = read + length[slot];\n while (read < readEnd)\n out[outIndex++] = pool[read++];\n }\n else {\n out[outIndex++] = value;\n }\n }\n return out;\n}\n//# sourceMappingURL=decode-shared.js.map","// Generated using scripts/write-decode-map.ts\nimport { decodeTrieDict } from \"../internal/decode-shared.js\";\n/** Packed HTML decode trie data. */\nexport const htmlDecodeTree = /* #__PURE__ */ decodeTrieDict(\"!}.&u%}'&}*'~!6*)%&,~!J~!J~%L~y<~!R,~~%Lu~~#GD~~#|)1#%}^%}2%+#.##%##%}&%##%'#%##&%#%#'%#&#%#&#'#%%#&#%##%#)%''%&%#%#'%#%%#%%}%%%#%#&(23#%%#&-%0%('1#(##%#'##+%'*.:1}#%#6-+(%'%%#%%%}#L'2351&('%}&/N'(0(/*-%(%%}#'+&T%7.2}#&%&#%#36/5##%&%%#&#%%#))2%%##%&&'0~!#*+&'%1~!%).'3q?&%'1~!.##%6(~!+%%%(Gw'rT~!E#<nA%#jZ~!H%(~!42##~!*31&~!G%U~#)5~#`3~!J~!Z~%]~%Y~%C~!q~!u~#kz~%#~!6'~!D~!U~!?~#T~!c%~!G#'~%7|~!G~!J~!G&~#pb~(Df}#%}*&}#%##%##%##&#-}&'#'&%#.++}%mI,#,@&(}*%}*'%&##&#%##%}&0}#.},U},%}+%}&%}#%##&}B%(}(%}+%)})%##%#&}&%##%&}<%}>%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+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xPhH(!a#U#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P\", 13_494, 2713, 49, 25, 61);\n//# sourceMappingURL=decode-data-html.js.map","// Generated using scripts/write-decode-map.ts\n/** Packed XML decode trie data. */\nexport const xmlDecodeTree = /* #__PURE__ */ new Uint16Array([\n 512, 26_465, 29_036, 7, 0, 2, 4, 116, 24_638, 116, 24_636, 8693, 29_807,\n 24_610, 621, 1, 0, 0, 3, 112, 24_614, 111, 115, 24_615,\n]);\n//# sourceMappingURL=decode-data-xml.js.map","/**\n * Bit flags & masks for the binary trie encoding used for entity decoding.\n *\n * The trie is a flat `Uint16Array`. Every node starts with one header word:\n *\n * 15..14 VALUE_LENGTH Number of words the value occupies, +1.\n * 0 = no value; 1 = value inline in bits 12..0;\n * 2/3 = value in the 1/2 words after the header.\n * 13 FLAG13 If VALUE_LENGTH > 0: semicolon required (\"strict\"\n * entity; `;` is never stored as a branch).\n * If VALUE_LENGTH == 0: this node is a compact run.\n * 12..7 BRANCH_LENGTH Number of branches (or run length for runs).\n * 6..0 JUMP_TABLE Jump-table offset / single-branch char / first\n * run char (see below).\n *\n * Branch data follows the header and any value words. Its shape is selected\n * by (JUMP_TABLE, BRANCH_LENGTH) in the header:\n *\n * Single branch JUMP_TABLE = the only child's char, BRANCH_LENGTH = 0.\n * No branch words; the child node follows immediately.\n * Jump table JUMP_TABLE = first covered char (> 0), BRANCH_LENGTH =\n * table length. One word per covered char: 0 = no branch,\n * otherwise the child's offset from the END of the table,\n * +1 (so 0 stays the no-branch sentinel).\n * Dictionary JUMP_TABLE = 0, BRANCH_LENGTH = number of branches.\n * ceil(n/2) words of sorted keys packed two per word\n * (low byte first), then n pointer words storing the\n * child's offset from the END of the branch data.\n * Compact run VALUE_LENGTH = 0, FLAG13 set. BRANCH_LENGTH = run\n * length (3..63), JUMP_TABLE = first char; remaining run\n * chars packed two per word after the header. The target\n * node follows the packed words immediately.\n *\n * Pointers are end-relative (rather than relative to the pointer's own\n * position) because that makes the common \"child encoded right after the\n * branch data\" case a small constant, which compresses far better. Offsets\n * to already-encoded (shared) nodes wrap via uint16 modulo arithmetic; the\n * decoder masks navigation results with `& 0xff_ff` to match.\n */\nexport var BinTrieFlags;\n(function (BinTrieFlags) {\n BinTrieFlags[BinTrieFlags[\"VALUE_LENGTH\"] = 49152] = \"VALUE_LENGTH\";\n BinTrieFlags[BinTrieFlags[\"FLAG13\"] = 8192] = \"FLAG13\";\n BinTrieFlags[BinTrieFlags[\"BRANCH_LENGTH\"] = 8064] = \"BRANCH_LENGTH\";\n BinTrieFlags[BinTrieFlags[\"JUMP_TABLE\"] = 127] = \"JUMP_TABLE\";\n /** Bits 12..0: the inline value of a VALUE_LENGTH = 1 header word. */\n BinTrieFlags[BinTrieFlags[\"VALUE_MASK\"] = 8191] = \"VALUE_MASK\";\n})(BinTrieFlags || (BinTrieFlags = {}));\n//# sourceMappingURL=bin-trie-flags.js.map","import { codePointToString, replaceCodePoint, replaceCodePointXML, } from \"./decode-codepoint.js\";\nimport { htmlDecodeTree } from \"./generated/decode-data-html.js\";\nimport { xmlDecodeTree } from \"./generated/decode-data-xml.js\";\nimport { BinTrieFlags } from \"./internal/bin-trie-flags.js\";\nvar CharCodes;\n(function (CharCodes) {\n CharCodes[CharCodes[\"AMP\"] = 38] = \"AMP\";\n CharCodes[CharCodes[\"NUM\"] = 35] = \"NUM\";\n CharCodes[CharCodes[\"SEMI\"] = 59] = \"SEMI\";\n CharCodes[CharCodes[\"EQUALS\"] = 61] = \"EQUALS\";\n CharCodes[CharCodes[\"ZERO\"] = 48] = \"ZERO\";\n CharCodes[CharCodes[\"NINE\"] = 57] = \"NINE\";\n CharCodes[CharCodes[\"LOWER_A\"] = 97] = \"LOWER_A\";\n CharCodes[CharCodes[\"LOWER_X\"] = 120] = \"LOWER_X\";\n})(CharCodes || (CharCodes = {}));\n/** Bit that needs to be set to convert an upper case ASCII character to lower case */\nconst TO_LOWER_BIT = 0b10_0000;\n/*\n * `parseNumericEntity` packs its two results into one 32-bit integer:\n * `(consumed << CONSUMED_SHIFT) | codePoint`. The 21-bit code point field\n * fits any valid Unicode value (max 0x10FFFF, clamped before packing); the\n * consumed count excludes `&` and gets the remaining 11 bits. Extract it\n * with `>>>` so the topmost bit isn't treated as a sign.\n *\n * Plain consts rather than a `const enum`: with `isolatedModules`, enum\n * member reads compile to runtime property loads.\n */\nconst CONSUMED_SHIFT = 21;\nconst CODE_POINT_MASK = 0x1f_ff_ff;\n/**\n * Reserved consumed field for counts of at least 2047 characters after `&`.\n * The true count is in `longNumericConsumed`.\n */\nconst CONSUMED_OVERFLOW = 0x7_ff;\n/**\n * Side channel for numeric entities of at least 2048 characters including\n * `&`. Set by `parseNumericEntity` when its consumed count reaches the\n * reserved value `CONSUMED_OVERFLOW`; callers read the true count from here.\n * A module-level slot avoids a tuple allocation on the hot path.\n */\nlet longNumericConsumed = 0;\n/**\n * Extract the consumed count from a `parseNumericEntity` packed result,\n * recovering the true length from `longNumericConsumed` when the packed\n * field contains the sentinel. Read it before the next `parseNumericEntity`\n * call, which may overwrite the side channel. This helper owns that protocol.\n * @param packed Packed result of `parseNumericEntity`.\n */\nfunction unpackConsumed(packed) {\n const consumed = packed >>> CONSUMED_SHIFT;\n return consumed === CONSUMED_OVERFLOW ? longNumericConsumed : consumed;\n}\n/**\n * Unsigned subtraction trick: (code - lo) >>> 0 wraps negatives to large\n * values, so a single `<=` covers the entire [lo..hi] range check.\n * @param code Code point to check.\n */\nfunction isNumber(code) {\n return (code - CharCodes.ZERO) >>> 0 <= 9;\n}\nfunction isHexadecimalCharacter(code) {\n return ((code | TO_LOWER_BIT) - CharCodes.LOWER_A) >>> 0 <= 5; // F - a\n}\nfunction isAlpha(code) {\n return ((code | TO_LOWER_BIT) - CharCodes.LOWER_A) >>> 0 <= 25; // Z - a\n}\n/**\n * Checks if the given character is a valid end character for an entity in an attribute.\n *\n * Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.\n * See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state\n * @param code Code point to check.\n */\nfunction isEntityInAttributeInvalidEnd(code) {\n return code === CharCodes.EQUALS || isAlpha(code) || isNumber(code);\n}\nvar EntityDecoderState;\n(function (EntityDecoderState) {\n EntityDecoderState[EntityDecoderState[\"EntityStart\"] = 0] = \"EntityStart\";\n EntityDecoderState[EntityDecoderState[\"NumericStart\"] = 1] = \"NumericStart\";\n EntityDecoderState[EntityDecoderState[\"NumericDecimal\"] = 2] = \"NumericDecimal\";\n EntityDecoderState[EntityDecoderState[\"NumericHex\"] = 3] = \"NumericHex\";\n EntityDecoderState[EntityDecoderState[\"NamedEntity\"] = 4] = \"NamedEntity\";\n})(EntityDecoderState || (EntityDecoderState = {}));\n/**\n * Decoding mode for named entities.\n */\nexport var DecodingMode;\n(function (DecodingMode) {\n /** Entities in text nodes that can end with any character. */\n DecodingMode[DecodingMode[\"Legacy\"] = 0] = \"Legacy\";\n /** Only allow entities terminated with a semicolon. */\n DecodingMode[DecodingMode[\"Strict\"] = 1] = \"Strict\";\n /** Entities in attributes have limitations on ending characters. */\n DecodingMode[DecodingMode[\"Attribute\"] = 2] = \"Attribute\";\n})(DecodingMode || (DecodingMode = {}));\n/**\n * Token decoder with support of writing partial entities.\n */\nexport class EntityDecoder {\n decodeTree;\n emitCodePoint;\n errors;\n /** The current state of the decoder. */\n state = EntityDecoderState.EntityStart;\n /** Characters that were consumed while parsing an entity. */\n consumed = 1;\n /**\n * The result of the entity.\n *\n * For named entities: the trie index of the best legacy match so far\n * (0 = none). For numeric entities: the accumulated code point.\n */\n result = 0;\n /** The current index in the decode tree. */\n treeIndex = 0;\n /**\n * Characters consumed since the last recorded legacy match, plus one.\n * Invariant at the top of the `stateNamedEntity` loop: `excess` equals\n * the number of unrecorded consumed characters + 1.\n */\n // biome-ignore lint/correctness/noUnusedPrivateClassMembers: False positive (read via destructuring)\n excess = 1;\n /** The mode in which the decoder is operating. */\n decodeMode = DecodingMode.Strict;\n /** The number of characters that have been consumed in the current run. */\n // biome-ignore lint/correctness/noUnusedPrivateClassMembers: False positive\n runConsumed = 0;\n constructor(\n /** The predefined HTML or XML decode tree. */\n decodeTree, \n /**\n * The function that is called when a codepoint is decoded.\n *\n * For named entities that decode to multiple code points, this will\n * be called multiple times, with the second codepoint, and the same\n * `consumed` value.\n * @param codepoint The decoded codepoint.\n * @param consumed The number of characters consumed by the decoder.\n */\n emitCodePoint, \n /** An object that is used to produce errors. */\n errors) {\n this.decodeTree = decodeTree;\n this.emitCodePoint = emitCodePoint;\n this.errors = errors;\n }\n /**\n * Resets the instance to make it reusable.\n * @param decodeMode Entity decoding mode to use.\n */\n startEntity(decodeMode) {\n this.decodeMode = decodeMode;\n this.state = EntityDecoderState.EntityStart;\n this.result = 0;\n this.treeIndex = 0;\n this.excess = 1;\n this.consumed = 1;\n this.runConsumed = 0;\n }\n /**\n * Write an entity to the decoder. This can be called multiple times with partial entities.\n * If the entity is incomplete, the decoder will return -1.\n *\n * Mirrors the non-streaming `decodeWithTrie`, but with the ability to stop decoding if the\n * entity is incomplete, and resume when the next string is written.\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n write(input, offset) {\n switch (this.state) {\n case EntityDecoderState.EntityStart: {\n if (input.charCodeAt(offset) === CharCodes.NUM) {\n this.state = EntityDecoderState.NumericStart;\n this.consumed += 1;\n return this.stateNumericStart(input, offset + 1);\n }\n this.state = EntityDecoderState.NamedEntity;\n return this.stateNamedEntity(input, offset);\n }\n case EntityDecoderState.NumericStart: {\n return this.stateNumericStart(input, offset);\n }\n case EntityDecoderState.NumericDecimal: {\n return this.stateNumericDecimal(input, offset);\n }\n case EntityDecoderState.NumericHex: {\n return this.stateNumericHex(input, offset);\n }\n default: {\n // NamedEntity — the only remaining state.\n return this.stateNamedEntity(input, offset);\n }\n }\n }\n /**\n * Switches between the numeric decimal and hexadecimal states.\n *\n * Equivalent to the `Numeric character reference state` in the HTML spec.\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The current offset.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n // eslint-disable-next-line unicorn/consistent-class-member-order\n stateNumericStart(input, offset) {\n if (offset >= input.length) {\n return -1;\n }\n if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {\n this.state = EntityDecoderState.NumericHex;\n this.consumed += 1;\n return this.stateNumericHex(input, offset + 1);\n }\n this.state = EntityDecoderState.NumericDecimal;\n return this.stateNumericDecimal(input, offset);\n }\n /**\n * Parses a hexadecimal numeric entity.\n *\n * Equivalent to the `Hexademical character reference state` in the HTML\n * spec. Digit parsing matches the hex loop in `parseNumericEntity`.\n * The accumulated value is preserved for numeric validation callbacks.\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The current offset.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n stateNumericHex(input, offset) {\n const inputLength = input.length;\n // Local accumulators; flushed before any exit (see stateNamedEntity).\n let { result } = this;\n let { consumed } = this;\n while (offset < inputLength) {\n const char = input.charCodeAt(offset);\n if (isNumber(char) || isHexadecimalCharacter(char)) {\n // Convert hex digit to value (0-15); 'a'/'A' -> 10.\n const digit = char <= CharCodes.NINE\n ? char - CharCodes.ZERO\n : (char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10;\n result = result * 16 + digit;\n consumed += 1;\n offset += 1;\n }\n else {\n this.result = result;\n this.consumed = consumed;\n return this.emitNumericEntity(char, 3);\n }\n }\n this.result = result;\n this.consumed = consumed;\n return -1; // Incomplete entity\n }\n /**\n * Parses a decimal numeric entity.\n *\n * Equivalent to the `Decimal character reference state` in the HTML\n * spec. Digit parsing matches the decimal loop in `parseNumericEntity`.\n * The accumulated value is preserved for numeric validation callbacks.\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The current offset.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n stateNumericDecimal(input, offset) {\n const inputLength = input.length;\n // Local accumulators; flushed before any exit (see stateNamedEntity).\n let { result } = this;\n let { consumed } = this;\n while (offset < inputLength) {\n const digit = input.charCodeAt(offset) - CharCodes.ZERO;\n if (digit >>> 0 > 9) {\n this.result = result;\n this.consumed = consumed;\n return this.emitNumericEntity(digit + CharCodes.ZERO, 2);\n }\n result = result * 10 + digit;\n consumed += 1;\n offset += 1;\n }\n this.result = result;\n this.consumed = consumed;\n return -1; // Incomplete entity\n }\n /**\n * Validate and emit a numeric entity.\n *\n * Implements the logic from the `Hexademical character reference start\n * state` and `Numeric character reference end state` in the HTML spec.\n * @param lastCp The last code point of the entity. Used to see if the\n * entity was terminated with a semicolon.\n * @param expectedLength The minimum number of characters that should be\n * consumed. Used to validate that at least one digit\n * was consumed.\n * @returns The number of characters that were consumed.\n */\n emitNumericEntity(lastCp, expectedLength) {\n // Ensure we consumed at least one digit.\n if (this.consumed <= expectedLength) {\n this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed);\n return 0;\n }\n // Figure out if this is a legit end of the entity\n if (lastCp === CharCodes.SEMI) {\n this.consumed += 1;\n }\n else if (this.decodeMode === DecodingMode.Strict) {\n return 0;\n }\n this.emitCodePoint((this.decodeTree === xmlDecodeTree\n ? replaceCodePointXML\n : replaceCodePoint)(this.result), this.consumed);\n if (this.errors) {\n if (lastCp !== CharCodes.SEMI) {\n this.errors.missingSemicolonAfterCharacterReference();\n }\n this.errors.validateNumericCharacterReference(this.result);\n }\n return this.consumed;\n }\n /**\n * Flush locally-tracked walk state back to the fields, then emit the\n * recorded legacy match or reject (cold path — at most once per\n * entity). Called after failed navigation (leaf node, branch miss, or\n * compact-run mismatch). In attribute mode, reject if no legacy was\n * recorded at the current node, if we descended past it, or if the\n * pending input character is an invalid attribute terminator.\n * @param consumed Locally-tracked consumed count.\n * @param excess Locally-tracked excess count.\n * @param char Pending input character (may be the mismatching char).\n * @param valueLength Value length at the current trie node.\n */\n flushAndEmitLegacyOrReject(consumed, excess, char, valueLength) {\n this.consumed = consumed;\n this.excess = excess;\n return this.result === 0 ||\n (this.decodeMode === DecodingMode.Attribute &&\n (valueLength === 0 ||\n excess > 1 ||\n isEntityInAttributeInvalidEnd(char)))\n ? 0\n : this.emitNotTerminatedNamedEntity();\n }\n /**\n * Parses a named entity.\n *\n * Equivalent to the `Named character reference state` in the HTML spec.\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The current offset.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n stateNamedEntity(input, offset) {\n const { decodeTree } = this;\n const inputLength = input.length;\n const isStrict = this.decodeMode === DecodingMode.Strict;\n /*\n * Local copies of the resumable walk state avoid per-character\n * field writes. They are flushed back to the fields\n * on every exit (chunk end, and before any emit helper that reads\n * them). `this.result` is only written at the (rare) record points,\n * so it stays a direct field write.\n *\n * Legacy-match recording happens in two idempotent places: at the\n * loop top when sitting on a value node, and in the chunk-end\n * epilogue (so `end()` sees matches that land exactly on a chunk\n * boundary). Recording applies `consumed += excess - 1; excess = 1`,\n * which is a no-op when repeated — the loop-top invariant is\n * `excess` = unrecorded consumed characters + 1.\n */\n let { treeIndex } = this;\n let { excess } = this;\n let { consumed } = this;\n let current = decodeTree[treeIndex];\n while (offset < inputLength) {\n /*\n * Descend through value-less jump-table nodes (including the\n * single-branch encoding) inline, mirroring `decodeWithTrie`:\n * this avoids a `determineBranch` call per level for the\n * dominant node shape — including the root on the first write.\n */\n while ((current &\n (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===\n 0 &&\n (current & BinTrieFlags.JUMP_TABLE) !== 0) {\n const char = input.charCodeAt(offset);\n const jumpOffset = current & BinTrieFlags.JUMP_TABLE;\n const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n if (branchCount === 0) {\n // Single branch encoded inline in the jump offset bits.\n if (char !== jumpOffset) {\n return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);\n }\n treeIndex += 1;\n }\n else {\n const slot = char - jumpOffset;\n if (slot >>> 0 >= branchCount) {\n return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);\n }\n const stored = decodeTree[treeIndex + 1 + slot];\n if (stored === 0) {\n return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);\n }\n // End-relative: branch data ends at treeIndex+1+branchCount.\n treeIndex = (treeIndex + branchCount + stored) & 0xff_ff;\n }\n current = decodeTree[treeIndex];\n offset += 1;\n excess += 1;\n /*\n * `charCodeAt` past the end returns NaN, which would alias\n * to slot 0 after `>>> 0` — bail out explicitly.\n */\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n if (offset >= inputLength)\n break;\n }\n if (offset >= inputLength)\n break;\n // Handle compact runs (resumable across chunks).\n if ((current &\n (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===\n BinTrieFlags.FLAG13) {\n const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7; /* 3..63 */\n let { runConsumed } = this;\n // If we are starting a run, check the first char.\n if (runConsumed === 0) {\n const char = input.charCodeAt(offset);\n if (char !== (current & BinTrieFlags.JUMP_TABLE)) {\n return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);\n }\n offset += 1;\n excess += 1;\n runConsumed = 1;\n }\n // Check remaining characters in the run (packed two per uint16 word).\n while (runConsumed < runLength) {\n if (offset >= inputLength) {\n this.treeIndex = treeIndex;\n this.excess = excess;\n this.consumed = consumed;\n this.runConsumed = runConsumed;\n return -1;\n }\n const charIndexInPacked = runConsumed - 1;\n const packedWord = decodeTree[treeIndex + 1 + (charIndexInPacked >> 1)];\n const expectedChar = (packedWord >> ((charIndexInPacked & 1) << 3)) & 0xff;\n const char = input.charCodeAt(offset);\n if (char !== expectedChar) {\n this.runConsumed = 0;\n return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);\n }\n offset += 1;\n excess += 1;\n runConsumed += 1;\n }\n this.runConsumed = 0;\n treeIndex += 1 + (runLength >> 1);\n current = decodeTree[treeIndex];\n // Loop top handles the landed-on node (record/emit/branch).\n continue;\n }\n // Header plus out-of-line value words; 0 means no value.\n const valueLength = current >>> 14;\n const char = input.charCodeAt(offset);\n if (valueLength !== 0) {\n // Record a legacy match (FLAG13 clear = semicolon optional).\n if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {\n this.result = treeIndex;\n consumed += excess - 1;\n excess = 1;\n }\n /*\n * Implicit semicolon handling: emit immediately. Covers both\n * strict (FLAG13 set) and legacy entities — neither stores\n * an explicit `;` branch in the trie.\n */\n if (char === CharCodes.SEMI) {\n return this.emitNamedEntityData(treeIndex, valueLength, consumed + excess);\n }\n /*\n * `valueLength === 1` packs the codepoint into the header\n * word's low 13 bits, where branch metadata also lives. Skip\n * the branch lookup on leaves so those value bits aren't\n * reinterpreted as branch offsets.\n */\n if (valueLength === 1) {\n return this.flushAndEmitLegacyOrReject(consumed, excess, char, valueLength);\n }\n }\n // Value-bearing or dictionary node: dispatch through determineBranch.\n const next = determineBranch(decodeTree, current, treeIndex + (valueLength || 1), char);\n if (next < 0) {\n return this.flushAndEmitLegacyOrReject(consumed, excess, char, valueLength);\n }\n treeIndex = next;\n current = decodeTree[treeIndex];\n offset += 1;\n excess += 1;\n }\n /*\n * Chunk exhausted. Record a legacy match we may be sitting on, so a\n * subsequent `end()` emits it, then persist the walk state.\n */\n if (!isStrict &&\n current >>> 14 !== 0 &&\n (current & BinTrieFlags.FLAG13) === 0) {\n this.result = treeIndex;\n consumed += excess - 1;\n excess = 1;\n }\n this.treeIndex = treeIndex;\n this.excess = excess;\n this.consumed = consumed;\n return -1;\n }\n /**\n * Emit a named entity that was not terminated with a semicolon.\n * @returns The number of characters consumed.\n */\n emitNotTerminatedNamedEntity() {\n const { result, decodeTree } = this;\n const valueLength = decodeTree[result] >>> 14;\n this.emitNamedEntityData(result, valueLength, this.consumed);\n this.errors?.missingSemicolonAfterCharacterReference();\n return this.consumed;\n }\n /**\n * Emit a named entity.\n * @param result The index of the entity in the decode tree.\n * @param valueLength Encoded value length (header plus any value words).\n * @param consumed The number of characters consumed.\n * @returns The number of characters consumed.\n */\n emitNamedEntityData(result, valueLength, consumed) {\n const { decodeTree } = this;\n this.emitCodePoint(valueLength === 1\n ? decodeTree[result] & BinTrieFlags.VALUE_MASK\n : decodeTree[result + 1], consumed);\n if (valueLength === 3) {\n // Emit the second UTF-16 code unit.\n this.emitCodePoint(decodeTree[result + 2], consumed);\n }\n return consumed;\n }\n /**\n * Signal to the parser that the end of the input was reached.\n *\n * Remaining data will be emitted and relevant errors will be produced.\n * @returns The number of characters consumed.\n */\n end() {\n switch (this.state) {\n case EntityDecoderState.NamedEntity: {\n // Emit a named entity if we have one.\n return this.result !== 0 &&\n (this.decodeMode !== DecodingMode.Attribute ||\n this.result === this.treeIndex)\n ? this.emitNotTerminatedNamedEntity()\n : 0;\n }\n // Otherwise, emit a numeric entity if we have one.\n case EntityDecoderState.NumericDecimal: {\n return this.emitNumericEntity(0, 2);\n }\n case EntityDecoderState.NumericHex: {\n return this.emitNumericEntity(0, 3);\n }\n case EntityDecoderState.NumericStart: {\n this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed);\n return 0;\n }\n default: {\n // EntityStart or unknown — return 0.\n return 0;\n }\n }\n }\n}\n/**\n * Determines the branch of the current node that is taken given the current\n * character. This function is used to traverse the trie.\n *\n * See `BinTrieFlags` for the branch-data layouts handled here.\n * @param decodeTree The trie.\n * @param current The current node's header word.\n * @param nodeIndex Index of the node's first branch-data word (the header\n * plus any value words have been skipped by the caller).\n * @param char The current character.\n * @returns The index of the next node, or -1 if no branch is taken.\n */\nexport function determineBranch(decodeTree, current, nodeIndex, char) {\n const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n const jumpOffset = current & BinTrieFlags.JUMP_TABLE;\n // Case 1: Single branch or jump table (jumpOffset encodes the first/only char code).\n if (jumpOffset) {\n if (branchCount === 0) {\n // Single branch encoded inline in the jump offset bits.\n return char === jumpOffset ? nodeIndex : -1;\n }\n /*\n * Jump table: branchCount consecutive slots starting at jumpOffset.\n * Unsigned comparison handles both < 0 and >= branchCount in one check.\n */\n const slot = char - jumpOffset;\n if (slot >>> 0 >= branchCount)\n return -1;\n const stored = decodeTree[nodeIndex + slot];\n /*\n * 0 = empty slot (no branch); otherwise the child's offset from the\n * end of the branch array, +1 (end-relative pointers compress\n * better). `& 0xff_ff` mirrors the encoder's uint16 wrap for\n * backreferences to already-encoded nodes.\n */\n return stored === 0\n ? -1\n : (nodeIndex + branchCount + stored - 1) & 0xff_ff;\n }\n /*\n * Case 2: Packed dictionary. Linear scan — over 90% of dict nodes have\n * <= 4 branches in the HTML trie, where the constant-factor savings\n * dominate over binary search's asymptotic edge.\n */\n if (branchCount === 0)\n return -1;\n const packedKeySlots = (branchCount + 1) >> 1;\n const branchEnd = nodeIndex + packedKeySlots + branchCount;\n for (let index = 0; index < branchCount; index++) {\n const packed = decodeTree[nodeIndex + (index >> 1)];\n const key = (packed >> ((index & 1) << 3)) & 0xff;\n if (key === char) {\n const pointerIndex = nodeIndex + packedKeySlots + index;\n // Pointers are relative to the end of the branch data.\n return (branchEnd + decodeTree[pointerIndex]) & 0xff_ff;\n }\n // Keys are sorted; if we've passed `char`, no match is possible.\n if (key > char)\n return -1;\n }\n return -1;\n}\n/**\n * Read the decoded value from a trie node.\n * @param decodeTree The trie.\n * @param nodeIndex The index of the node.\n * @param valueLength The length of the value (1, 2, or 3).\n * @returns The decoded string.\n */\nfunction readTrieValue(decodeTree, nodeIndex, valueLength) {\n if (valueLength === 1) {\n return String.fromCharCode(decodeTree[nodeIndex] & BinTrieFlags.VALUE_MASK);\n }\n if (valueLength === 2) {\n return String.fromCharCode(decodeTree[nodeIndex + 1]);\n }\n return String.fromCharCode(decodeTree[nodeIndex + 1], decodeTree[nodeIndex + 2]);\n}\n/**\n * Parse a numeric entity (`&#DDD;` or `&#xHHH;`).\n *\n * Encodes the result as `(consumed << CONSUMED_SHIFT) | codepoint` (see\n * the packing comment at the top of the file; overlong entities spill\n * their length into `longNumericConsumed`). Returns 0 when no digits were\n * found.\n *\n * This is the sync counterpart of the streaming\n * `EntityDecoder#stateNumericDecimal` / `#stateNumericHex`. Digit parsing\n * matches those methods; only this packed result needs a value clamp.\n * @param input The input string.\n * @param numberStart Index of the `#` character.\n * @param inputLength Cached `input.length`.\n */\nfunction parseNumericEntity(input, numberStart, inputLength) {\n let offset = numberStart + 1; // Skip \"#\"\n let cp = 0;\n let digitStart = offset;\n /*\n * Separate decimal and hexadecimal loops: each multiplies by a constant\n * and runs a single digit test, instead of a per-character base check.\n */\n if (offset < inputLength &&\n (input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {\n offset += 1;\n digitStart = offset;\n while (offset < inputLength) {\n const char = input.charCodeAt(offset);\n if (isNumber(char)) {\n cp = cp * 16 + (char - CharCodes.ZERO);\n }\n else if (isHexadecimalCharacter(char)) {\n cp = cp * 16 + ((char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10);\n }\n else {\n break;\n }\n offset += 1;\n }\n }\n else {\n while (offset < inputLength) {\n const digit = input.charCodeAt(offset) - CharCodes.ZERO;\n if (digit >>> 0 > 9)\n break;\n cp = cp * 10 + digit;\n offset += 1;\n }\n }\n if (offset === digitStart)\n return 0;\n // Include the semicolon in consumed when present.\n if (offset < inputLength && input.charCodeAt(offset) === CharCodes.SEMI) {\n offset += 1;\n }\n /*\n * Clamp out-of-range values to 0x110000 so they fit the 21-bit field\n * and decode to U+FFFD. Lengths at or above CONSUMED_OVERFLOW use the\n * side channel described with the packing constants.\n */\n if (cp > 0x10_ff_ff)\n cp = 0x11_00_00;\n let consumed = offset - numberStart;\n if (consumed >= CONSUMED_OVERFLOW) {\n // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- deliberate side channel, see `longNumericConsumed`\n longNumericConsumed = consumed;\n consumed = CONSUMED_OVERFLOW;\n }\n return (consumed << CONSUMED_SHIFT) | cp;\n}\n/**\n * Decode all entities in `input` using the HTML trie.\n *\n * Hard-wired to `htmlDecodeTree`: the inline root navigation below assumes\n * the HTML root's jump-table shape, so this must not be generalized to\n * other tries (the XML trie's dictionary root would silently match no\n * entities — `decodeXML` has its own hand-coded fast path instead).\n * @param input The string to decode.\n * @param isStrict Only match semicolon-terminated entities.\n * @param isAttribute Whether to apply attribute-specific parsing rules (disallowing certain non-semicolon terminators).\n * @returns The decoded string.\n */\nfunction decodeWithTrie(input, isStrict, isAttribute) {\n const decodeTree = htmlDecodeTree;\n // Fast path: no entities at all — return input without any allocation.\n let offset = input.indexOf(\"&\");\n if (offset < 0)\n return input;\n const inputLength = input.length;\n /*\n * `chunkStart` marks the start of the next pending slice. Rejected\n * entities don't advance it, so consecutive rejections are stitched\n * into a single `slice` once a real match (or end of input) is hit.\n */\n let chunkStart = 0;\n let result = \"\";\n /*\n * Root navigation fields, hoisted out of the per-entity loop. The HTML\n * root is a multi-branch jump-table covering [A-Za-z]; see the inline\n * first-iteration comment below.\n */\n const root = decodeTree[0];\n const rootJumpOffset = root & BinTrieFlags.JUMP_TABLE;\n const rootBranchCount = (root & BinTrieFlags.BRANCH_LENGTH) >> 7;\n do {\n const entityStart = offset + 1;\n // Quick check: entity names must start with [A-Za-z], numeric with #.\n const firstChar = input.charCodeAt(entityStart);\n let consumed;\n let value;\n if (firstChar === CharCodes.NUM) {\n const packed = parseNumericEntity(input, entityStart, inputLength);\n consumed = unpackConsumed(packed);\n // In strict mode, require semicolon termination.\n if (isStrict &&\n consumed > 0 &&\n input.charCodeAt(entityStart + consumed - 1) !== CharCodes.SEMI) {\n consumed = 0;\n }\n value =\n consumed === 0\n ? \"\"\n : codePointToString(packed & CODE_POINT_MASK);\n }\n else if (isAlpha(firstChar)) {\n consumed = 0;\n value = \"\";\n /*\n * The generator guarantees a jump-table root. Consume the first\n * character directly, then walk from its child.\n */\n const rootSlotIndex = firstChar - rootJumpOffset;\n let nodeIndex;\n if (rootSlotIndex >>> 0 < rootBranchCount) {\n const stored = decodeTree[1 + rootSlotIndex];\n nodeIndex =\n stored === 0 ? -1 : (rootBranchCount + stored) & 0xff_ff;\n }\n else {\n nodeIndex = -1;\n }\n /*\n * Best legacy (no-semicolon) match so far, as trie coordinates.\n * Deferring `readTrieValue` to the end avoids allocating a\n * string for matches that longer matches supersede.\n */\n let bestNodeIndex = 0;\n let bestValueLength = 0;\n let current = nodeIndex < 0 ? 0 : decodeTree[nodeIndex];\n let index = entityStart + 1;\n /*\n * Walk the trie from the root child. The `trie` label lets the\n * inner descent and compact-run loops abandon the entity (and\n * fall through to the legacy/reject handling) directly.\n */\n trie: while (index < inputLength) {\n /*\n * Inline value-less jump tables and single branches. A miss\n * falls through to the recorded legacy match or rejection.\n */\n while (\n // Value-less, non-run node with a nonzero jump offset.\n (current &\n (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===\n 0 &&\n (current & BinTrieFlags.JUMP_TABLE) !== 0) {\n const jumpOffset = current & BinTrieFlags.JUMP_TABLE;\n const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n if (branchCount === 0) {\n // Single branch encoded inline in the jump offset bits.\n if (input.charCodeAt(index) !== jumpOffset)\n break trie;\n nodeIndex += 1;\n }\n else {\n const slot = input.charCodeAt(index) - jumpOffset;\n if (slot >>> 0 >= branchCount)\n break trie;\n const stored = decodeTree[nodeIndex + 1 + slot];\n if (stored === 0)\n break trie;\n // End-relative: branch data ends at nodeIndex+1+branchCount.\n nodeIndex =\n (nodeIndex + branchCount + stored) & 0xff_ff;\n }\n current = decodeTree[nodeIndex];\n index += 1;\n /*\n * `charCodeAt` past the end returns NaN, which would\n * alias to slot 0 after `>>> 0` — bail out explicitly.\n */\n if (index >= inputLength)\n break trie;\n }\n // FLAG13 without a value marks a compact run.\n if ((current &\n (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===\n BinTrieFlags.FLAG13) {\n const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n // Check first char (stored in JUMP_TABLE bits).\n if (input.charCodeAt(index) !==\n (current & BinTrieFlags.JUMP_TABLE)) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n break;\n }\n index += 1;\n // Check remaining characters (packed two per uint16 word).\n const remaining = runLength - 1;\n let wordIndex = nodeIndex + 1;\n let charIndexInPacked = 0;\n /*\n * Process pairs: read one packed word, compare low byte then high byte.\n * No explicit bounds check needed — charCodeAt returns NaN for OOB,\n * which never equals an integer, so the mismatch break fires naturally.\n */\n for (; charIndexInPacked + 1 < remaining; charIndexInPacked += 2) {\n const packed = decodeTree[wordIndex];\n if (input.charCodeAt(index) !== (packed & 0xff))\n break trie;\n index += 1;\n if (input.charCodeAt(index) !== ((packed >> 8) & 0xff))\n break trie;\n index += 1;\n wordIndex += 1;\n }\n // Handle odd trailing char.\n if (charIndexInPacked < remaining) {\n if (input.charCodeAt(index) !==\n (decodeTree[wordIndex] & 0xff))\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n break;\n index += 1;\n }\n nodeIndex += 1 + (runLength >> 1);\n current = decodeTree[nodeIndex];\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n // Header plus out-of-line value words; 0 means no value.\n const valueLength = current >>> 14;\n const char = input.charCodeAt(index);\n /*\n * Check current node for a value before navigating.\n * This handles both: (a) values reached via compact runs on the\n * previous iteration, and (b) values at regular branch targets.\n */\n if (valueLength !== 0) {\n // If char is `;`, emit immediately.\n if (char === CharCodes.SEMI) {\n consumed = index - entityStart + 1;\n // Inline leaves carry the value in the low 13 bits.\n value =\n valueLength === 1\n ? String.fromCharCode(current & BinTrieFlags.VALUE_MASK)\n : readTrieValue(decodeTree, nodeIndex, valueLength);\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n break;\n }\n // Record non-terminated (legacy) match (FLAG13 clear = semicolon optional).\n if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {\n consumed = index - entityStart;\n bestNodeIndex = nodeIndex;\n bestValueLength = valueLength;\n }\n /*\n * A valueLength of 1 means the value is packed inline in the header\n * word — these are always leaf nodes with no branches, so we can\n * stop walking the trie.\n */\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n if (valueLength === 1)\n break;\n }\n // Navigate to the next node (valueLength || 1: skip past value words, minimum 1 for header).\n const next = determineBranch(decodeTree, current, nodeIndex + (valueLength || 1), char);\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n if (next < 0)\n break;\n nodeIndex = next;\n current = decodeTree[nodeIndex];\n index += 1;\n }\n /*\n * Post-loop: if the semicolon path didn't set value,\n * check for a final legacy match. The last navigation may\n * have landed on a legacy node whose value hasn't been\n * recorded yet (loop exited before the top-of-loop check\n * could run).\n */\n if (value === \"\") {\n const finalVL = current >>> 14;\n if (finalVL !== 0 &&\n !isStrict &&\n (current & BinTrieFlags.FLAG13) === 0) {\n consumed = index - entityStart;\n bestNodeIndex = nodeIndex;\n bestValueLength = finalVL;\n }\n if (consumed > 0) {\n value = readTrieValue(decodeTree, bestNodeIndex, bestValueLength);\n }\n }\n }\n else {\n consumed = 0;\n value = \"\";\n }\n /*\n * The attribute end-char rule (HTML spec §13.2.5.73) only applies to\n * unterminated *named* references. Semicolon-terminated entities and\n * numeric entities are always accepted, matching EntityDecoder behavior.\n *\n * When `attribute` is false (the common case), short-circuit skips all\n * the unterminated-named checks entirely.\n */\n if (consumed === 0 ||\n (isAttribute &&\n firstChar !== CharCodes.NUM &&\n input.charCodeAt(entityStart + consumed - 1) !==\n CharCodes.SEMI &&\n entityStart + consumed < inputLength &&\n isEntityInAttributeInvalidEnd(input.charCodeAt(entityStart + consumed)))) {\n // Rejected: leave `&` in the pending chunk, scan past it.\n offset = entityStart;\n }\n else {\n if (chunkStart < offset) {\n result += input.slice(chunkStart, offset);\n }\n result += value;\n offset = chunkStart = entityStart + consumed;\n }\n /*\n * Adjacent entities (`&x;&y;`) are common in entity-dense input;\n * checking the single character at `offset` first skips the\n * `indexOf` call (and its per-call overhead) for that case.\n */\n if (input.charCodeAt(offset) !== CharCodes.AMP) {\n offset = input.indexOf(\"&\", offset);\n }\n } while (offset >= 0);\n return result + input.slice(chunkStart);\n}\n/**\n * Decodes an HTML string.\n * @param htmlString The string to decode.\n * @param mode The decoding mode.\n * @returns The decoded string.\n */\nexport function decodeHTML(htmlString, mode = DecodingMode.Legacy) {\n return decodeWithTrie(htmlString, mode === DecodingMode.Strict, mode === DecodingMode.Attribute);\n}\n/**\n * Decodes an HTML string in an attribute.\n * @param htmlAttribute The string to decode.\n * @returns The decoded string.\n */\nexport function decodeHTMLAttribute(htmlAttribute) {\n return decodeWithTrie(htmlAttribute, false, true);\n}\n/**\n * Decodes an HTML string, requiring all entities to be terminated by a semicolon.\n * @param htmlString The string to decode.\n * @returns The decoded string.\n */\nexport function decodeHTMLStrict(htmlString) {\n return decodeWithTrie(htmlString, true, false);\n}\n/**\n * Decodes an XML string, requiring all entities to be terminated by a semicolon.\n *\n * Uses a hand-coded fast path for the 5 XML named entities (amp, lt, gt,\n * quot, apos) plus numeric entities, bypassing the trie entirely.\n * @param xmlString The string to decode.\n * @returns The decoded string.\n */\nexport function decodeXML(xmlString) {\n let offset = xmlString.indexOf(\"&\");\n if (offset < 0)\n return xmlString;\n let lastIndex = 0;\n let result = \"\";\n do {\n const start = offset + 1;\n let consumed = 0;\n let value = \"\";\n const c1 = xmlString.charCodeAt(start);\n if (c1 === CharCodes.NUM) {\n const packed = parseNumericEntity(xmlString, start, xmlString.length);\n consumed = unpackConsumed(packed);\n // XML is always strict — require semicolon.\n if (consumed === 0 ||\n xmlString.charCodeAt(start + consumed - 1) !== CharCodes.SEMI) {\n consumed = 0;\n }\n else {\n const codePoint = packed & CODE_POINT_MASK;\n // Nonzero BMP values below the surrogate range need no replacement.\n value =\n (codePoint - 1) >>> 0 < 0xd7_ff\n ? String.fromCharCode(codePoint)\n : String.fromCodePoint(replaceCodePointXML(codePoint));\n }\n }\n else {\n /* eslint-disable unicorn/no-break-in-nested-loop -- Keep XML name dispatch inline with the decode loop. */\n switch (c1) {\n // &lt; / &gt;\n case 0x6c:\n case 0x67: {\n if (xmlString.charCodeAt(start + 1) === 0x74 &&\n xmlString.charCodeAt(start + 2) === CharCodes.SEMI) {\n consumed = 3;\n value = c1 === 0x6c ? \"<\" : \">\";\n }\n break;\n }\n // &amp; / &apos;\n case 0x61: {\n const c2 = xmlString.charCodeAt(start + 1);\n if (c2 === 0x6d &&\n xmlString.charCodeAt(start + 2) === 0x70 &&\n xmlString.charCodeAt(start + 3) === CharCodes.SEMI) {\n consumed = 4;\n value = \"&\";\n }\n else if (c2 === 0x70 &&\n xmlString.charCodeAt(start + 2) === 0x6f &&\n xmlString.charCodeAt(start + 3) === 0x73 &&\n xmlString.charCodeAt(start + 4) === CharCodes.SEMI) {\n consumed = 5;\n value = \"'\";\n }\n break;\n }\n // &quot;\n case 0x71: {\n if (xmlString.charCodeAt(start + 1) === 0x75 &&\n xmlString.charCodeAt(start + 2) === 0x6f &&\n xmlString.charCodeAt(start + 3) === 0x74 &&\n xmlString.charCodeAt(start + 4) === CharCodes.SEMI) {\n consumed = 5;\n value = '\"';\n }\n break;\n }\n }\n /* eslint-enable unicorn/no-break-in-nested-loop */\n }\n if (consumed > 0) {\n if (lastIndex < offset)\n result += xmlString.slice(lastIndex, offset);\n result += value;\n offset = lastIndex = start + consumed;\n }\n else {\n offset = start;\n }\n /*\n * Adjacent entities (`&x;&y;`) are common in entity-dense input;\n * checking the single character at `lastIndex` first skips the\n * `indexOf` call (and its per-call overhead) for that case.\n */\n offset =\n xmlString.charCodeAt(offset) === CharCodes.AMP\n ? offset\n : xmlString.indexOf(\"&\", offset);\n } while (offset >= 0);\n return result + xmlString.slice(lastIndex);\n}\nexport { replaceCodePoint, replaceCodePointXML, } from \"./decode-codepoint.js\";\n// Re-export for use by eg. htmlparser2\nexport { htmlDecodeTree } from \"./generated/decode-data-html.js\";\nexport { xmlDecodeTree } from \"./generated/decode-data-xml.js\";\n//# sourceMappingURL=decode.js.map","/** All valid namespaces in HTML. */\nexport var NS;\n(function (NS) {\n NS[\"HTML\"] = \"http://www.w3.org/1999/xhtml\";\n NS[\"MATHML\"] = \"http://www.w3.org/1998/Math/MathML\";\n NS[\"SVG\"] = \"http://www.w3.org/2000/svg\";\n NS[\"XLINK\"] = \"http://www.w3.org/1999/xlink\";\n NS[\"XML\"] = \"http://www.w3.org/XML/1998/namespace\";\n NS[\"XMLNS\"] = \"http://www.w3.org/2000/xmlns/\";\n})(NS || (NS = {}));\nexport var ATTRS;\n(function (ATTRS) {\n ATTRS[\"TYPE\"] = \"type\";\n ATTRS[\"ACTION\"] = \"action\";\n ATTRS[\"ENCODING\"] = \"encoding\";\n ATTRS[\"PROMPT\"] = \"prompt\";\n ATTRS[\"NAME\"] = \"name\";\n ATTRS[\"COLOR\"] = \"color\";\n ATTRS[\"FACE\"] = \"face\";\n ATTRS[\"SIZE\"] = \"size\";\n})(ATTRS || (ATTRS = {}));\n/**\n * The mode of the document.\n *\n * @see {@link https://dom.spec.whatwg.org/#concept-document-limited-quirks}\n */\nexport var DOCUMENT_MODE;\n(function (DOCUMENT_MODE) {\n DOCUMENT_MODE[\"NO_QUIRKS\"] = \"no-quirks\";\n DOCUMENT_MODE[\"QUIRKS\"] = \"quirks\";\n DOCUMENT_MODE[\"LIMITED_QUIRKS\"] = \"limited-quirks\";\n})(DOCUMENT_MODE || (DOCUMENT_MODE = {}));\nexport var TAG_NAMES;\n(function (TAG_NAMES) {\n TAG_NAMES[\"A\"] = \"a\";\n TAG_NAMES[\"ADDRESS\"] = \"address\";\n TAG_NAMES[\"ANNOTATION_XML\"] = \"annotation-xml\";\n TAG_NAMES[\"APPLET\"] = \"applet\";\n TAG_NAMES[\"AREA\"] = \"area\";\n TAG_NAMES[\"ARTICLE\"] = \"article\";\n TAG_NAMES[\"ASIDE\"] = \"aside\";\n TAG_NAMES[\"B\"] = \"b\";\n TAG_NAMES[\"BASE\"] = \"base\";\n TAG_NAMES[\"BASEFONT\"] = \"basefont\";\n TAG_NAMES[\"BGSOUND\"] = \"bgsound\";\n TAG_NAMES[\"BIG\"] = \"big\";\n TAG_NAMES[\"BLOCKQUOTE\"] = \"blockquote\";\n TAG_NAMES[\"BODY\"] = \"body\";\n TAG_NAMES[\"BR\"] = \"br\";\n TAG_NAMES[\"BUTTON\"] = \"button\";\n TAG_NAMES[\"CAPTION\"] = \"caption\";\n TAG_NAMES[\"CENTER\"] = \"center\";\n TAG_NAMES[\"CODE\"] = \"code\";\n TAG_NAMES[\"COL\"] = \"col\";\n TAG_NAMES[\"COLGROUP\"] = \"colgroup\";\n TAG_NAMES[\"DD\"] = \"dd\";\n TAG_NAMES[\"DESC\"] = \"desc\";\n TAG_NAMES[\"DETAILS\"] = \"details\";\n TAG_NAMES[\"DIALOG\"] = \"dialog\";\n TAG_NAMES[\"DIR\"] = \"dir\";\n TAG_NAMES[\"DIV\"] = \"div\";\n TAG_NAMES[\"DL\"] = \"dl\";\n TAG_NAMES[\"DT\"] = \"dt\";\n TAG_NAMES[\"EM\"] = \"em\";\n TAG_NAMES[\"EMBED\"] = \"embed\";\n TAG_NAMES[\"FIELDSET\"] = \"fieldset\";\n TAG_NAMES[\"FIGCAPTION\"] = \"figcaption\";\n TAG_NAMES[\"FIGURE\"] = \"figure\";\n TAG_NAMES[\"FONT\"] = \"font\";\n TAG_NAMES[\"FOOTER\"] = \"footer\";\n TAG_NAMES[\"FOREIGN_OBJECT\"] = \"foreignObject\";\n TAG_NAMES[\"FORM\"] = \"form\";\n TAG_NAMES[\"FRAME\"] = \"frame\";\n TAG_NAMES[\"FRAMESET\"] = \"frameset\";\n TAG_NAMES[\"H1\"] = \"h1\";\n TAG_NAMES[\"H2\"] = \"h2\";\n TAG_NAMES[\"H3\"] = \"h3\";\n TAG_NAMES[\"H4\"] = \"h4\";\n TAG_NAMES[\"H5\"] = \"h5\";\n TAG_NAMES[\"H6\"] = \"h6\";\n TAG_NAMES[\"HEAD\"] = \"head\";\n TAG_NAMES[\"HEADER\"] = \"header\";\n TAG_NAMES[\"HGROUP\"] = \"hgroup\";\n TAG_NAMES[\"HR\"] = \"hr\";\n TAG_NAMES[\"HTML\"] = \"html\";\n TAG_NAMES[\"I\"] = \"i\";\n TAG_NAMES[\"IMG\"] = \"img\";\n TAG_NAMES[\"IMAGE\"] = \"image\";\n TAG_NAMES[\"INPUT\"] = \"input\";\n TAG_NAMES[\"IFRAME\"] = \"iframe\";\n TAG_NAMES[\"KEYGEN\"] = \"keygen\";\n TAG_NAMES[\"LABEL\"] = \"label\";\n TAG_NAMES[\"LI\"] = \"li\";\n TAG_NAMES[\"LINK\"] = \"link\";\n TAG_NAMES[\"LISTING\"] = \"listing\";\n TAG_NAMES[\"MAIN\"] = \"main\";\n TAG_NAMES[\"MALIGNMARK\"] = \"malignmark\";\n TAG_NAMES[\"MARQUEE\"] = \"marquee\";\n TAG_NAMES[\"MATH\"] = \"math\";\n TAG_NAMES[\"MENU\"] = \"menu\";\n TAG_NAMES[\"META\"] = \"meta\";\n TAG_NAMES[\"MGLYPH\"] = \"mglyph\";\n TAG_NAMES[\"MI\"] = \"mi\";\n TAG_NAMES[\"MO\"] = \"mo\";\n TAG_NAMES[\"MN\"] = \"mn\";\n TAG_NAMES[\"MS\"] = \"ms\";\n TAG_NAMES[\"MTEXT\"] = \"mtext\";\n TAG_NAMES[\"NAV\"] = \"nav\";\n TAG_NAMES[\"NOBR\"] = \"nobr\";\n TAG_NAMES[\"NOFRAMES\"] = \"noframes\";\n TAG_NAMES[\"NOEMBED\"] = \"noembed\";\n TAG_NAMES[\"NOSCRIPT\"] = \"noscript\";\n TAG_NAMES[\"OBJECT\"] = \"object\";\n TAG_NAMES[\"OL\"] = \"ol\";\n TAG_NAMES[\"OPTGROUP\"] = \"optgroup\";\n TAG_NAMES[\"OPTION\"] = \"option\";\n TAG_NAMES[\"P\"] = \"p\";\n TAG_NAMES[\"PARAM\"] = \"param\";\n TAG_NAMES[\"PLAINTEXT\"] = \"plaintext\";\n TAG_NAMES[\"PRE\"] = \"pre\";\n TAG_NAMES[\"RB\"] = \"rb\";\n TAG_NAMES[\"RP\"] = \"rp\";\n TAG_NAMES[\"RT\"] = \"rt\";\n TAG_NAMES[\"RTC\"] = \"rtc\";\n TAG_NAMES[\"RUBY\"] = \"ruby\";\n TAG_NAMES[\"S\"] = \"s\";\n TAG_NAMES[\"SCRIPT\"] = \"script\";\n TAG_NAMES[\"SEARCH\"] = \"search\";\n TAG_NAMES[\"SECTION\"] = \"section\";\n TAG_NAMES[\"SELECT\"] = \"select\";\n TAG_NAMES[\"SOURCE\"] = \"source\";\n TAG_NAMES[\"SMALL\"] = \"small\";\n TAG_NAMES[\"SPAN\"] = \"span\";\n TAG_NAMES[\"STRIKE\"] = \"strike\";\n TAG_NAMES[\"STRONG\"] = \"strong\";\n TAG_NAMES[\"STYLE\"] = \"style\";\n TAG_NAMES[\"SUB\"] = \"sub\";\n TAG_NAMES[\"SUMMARY\"] = \"summary\";\n TAG_NAMES[\"SUP\"] = \"sup\";\n TAG_NAMES[\"TABLE\"] = \"table\";\n TAG_NAMES[\"TBODY\"] = \"tbody\";\n TAG_NAMES[\"TEMPLATE\"] = \"template\";\n TAG_NAMES[\"TEXTAREA\"] = \"textarea\";\n TAG_NAMES[\"TFOOT\"] = \"tfoot\";\n TAG_NAMES[\"TD\"] = \"td\";\n TAG_NAMES[\"TH\"] = \"th\";\n TAG_NAMES[\"THEAD\"] = \"thead\";\n TAG_NAMES[\"TITLE\"] = \"title\";\n TAG_NAMES[\"TR\"] = \"tr\";\n TAG_NAMES[\"TRACK\"] = \"track\";\n TAG_NAMES[\"TT\"] = \"tt\";\n TAG_NAMES[\"U\"] = \"u\";\n TAG_NAMES[\"UL\"] = \"ul\";\n TAG_NAMES[\"SVG\"] = \"svg\";\n TAG_NAMES[\"VAR\"] = \"var\";\n TAG_NAMES[\"WBR\"] = \"wbr\";\n TAG_NAMES[\"XMP\"] = \"xmp\";\n})(TAG_NAMES || (TAG_NAMES = {}));\n/**\n * Tag IDs are numeric IDs for known tag names.\n *\n * We use tag IDs to improve the performance of tag name comparisons.\n */\nexport var TAG_ID;\n(function (TAG_ID) {\n TAG_ID[TAG_ID[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n TAG_ID[TAG_ID[\"A\"] = 1] = \"A\";\n TAG_ID[TAG_ID[\"ADDRESS\"] = 2] = \"ADDRESS\";\n TAG_ID[TAG_ID[\"ANNOTATION_XML\"] = 3] = \"ANNOTATION_XML\";\n TAG_ID[TAG_ID[\"APPLET\"] = 4] = \"APPLET\";\n TAG_ID[TAG_ID[\"AREA\"] = 5] = \"AREA\";\n TAG_ID[TAG_ID[\"ARTICLE\"] = 6] = \"ARTICLE\";\n TAG_ID[TAG_ID[\"ASIDE\"] = 7] = \"ASIDE\";\n TAG_ID[TAG_ID[\"B\"] = 8] = \"B\";\n TAG_ID[TAG_ID[\"BASE\"] = 9] = \"BASE\";\n TAG_ID[TAG_ID[\"BASEFONT\"] = 10] = \"BASEFONT\";\n TAG_ID[TAG_ID[\"BGSOUND\"] = 11] = \"BGSOUND\";\n TAG_ID[TAG_ID[\"BIG\"] = 12] = \"BIG\";\n TAG_ID[TAG_ID[\"BLOCKQUOTE\"] = 13] = \"BLOCKQUOTE\";\n TAG_ID[TAG_ID[\"BODY\"] = 14] = \"BODY\";\n TAG_ID[TAG_ID[\"BR\"] = 15] = \"BR\";\n TAG_ID[TAG_ID[\"BUTTON\"] = 16] = \"BUTTON\";\n TAG_ID[TAG_ID[\"CAPTION\"] = 17] = \"CAPTION\";\n TAG_ID[TAG_ID[\"CENTER\"] = 18] = \"CENTER\";\n TAG_ID[TAG_ID[\"CODE\"] = 19] = \"CODE\";\n TAG_ID[TAG_ID[\"COL\"] = 20] = \"COL\";\n TAG_ID[TAG_ID[\"COLGROUP\"] = 21] = \"COLGROUP\";\n TAG_ID[TAG_ID[\"DD\"] = 22] = \"DD\";\n TAG_ID[TAG_ID[\"DESC\"] = 23] = \"DESC\";\n TAG_ID[TAG_ID[\"DETAILS\"] = 24] = \"DETAILS\";\n TAG_ID[TAG_ID[\"DIALOG\"] = 25] = \"DIALOG\";\n TAG_ID[TAG_ID[\"DIR\"] = 26] = \"DIR\";\n TAG_ID[TAG_ID[\"DIV\"] = 27] = \"DIV\";\n TAG_ID[TAG_ID[\"DL\"] = 28] = \"DL\";\n TAG_ID[TAG_ID[\"DT\"] = 29] = \"DT\";\n TAG_ID[TAG_ID[\"EM\"] = 30] = \"EM\";\n TAG_ID[TAG_ID[\"EMBED\"] = 31] = \"EMBED\";\n TAG_ID[TAG_ID[\"FIELDSET\"] = 32] = \"FIELDSET\";\n TAG_ID[TAG_ID[\"FIGCAPTION\"] = 33] = \"FIGCAPTION\";\n TAG_ID[TAG_ID[\"FIGURE\"] = 34] = \"FIGURE\";\n TAG_ID[TAG_ID[\"FONT\"] = 35] = \"FONT\";\n TAG_ID[TAG_ID[\"FOOTER\"] = 36] = \"FOOTER\";\n TAG_ID[TAG_ID[\"FOREIGN_OBJECT\"] = 37] = \"FOREIGN_OBJECT\";\n TAG_ID[TAG_ID[\"FORM\"] = 38] = \"FORM\";\n TAG_ID[TAG_ID[\"FRAME\"] = 39] = \"FRAME\";\n TAG_ID[TAG_ID[\"FRAMESET\"] = 40] = \"FRAMESET\";\n TAG_ID[TAG_ID[\"H1\"] = 41] = \"H1\";\n TAG_ID[TAG_ID[\"H2\"] = 42] = \"H2\";\n TAG_ID[TAG_ID[\"H3\"] = 43] = \"H3\";\n TAG_ID[TAG_ID[\"H4\"] = 44] = \"H4\";\n TAG_ID[TAG_ID[\"H5\"] = 45] = \"H5\";\n TAG_ID[TAG_ID[\"H6\"] = 46] = \"H6\";\n TAG_ID[TAG_ID[\"HEAD\"] = 47] = \"HEAD\";\n TAG_ID[TAG_ID[\"HEADER\"] = 48] = \"HEADER\";\n TAG_ID[TAG_ID[\"HGROUP\"] = 49] = \"HGROUP\";\n TAG_ID[TAG_ID[\"HR\"] = 50] = \"HR\";\n TAG_ID[TAG_ID[\"HTML\"] = 51] = \"HTML\";\n TAG_ID[TAG_ID[\"I\"] = 52] = \"I\";\n TAG_ID[TAG_ID[\"IMG\"] = 53] = \"IMG\";\n TAG_ID[TAG_ID[\"IMAGE\"] = 54] = \"IMAGE\";\n TAG_ID[TAG_ID[\"INPUT\"] = 55] = \"INPUT\";\n TAG_ID[TAG_ID[\"IFRAME\"] = 56] = \"IFRAME\";\n TAG_ID[TAG_ID[\"KEYGEN\"] = 57] = \"KEYGEN\";\n TAG_ID[TAG_ID[\"LABEL\"] = 58] = \"LABEL\";\n TAG_ID[TAG_ID[\"LI\"] = 59] = \"LI\";\n TAG_ID[TAG_ID[\"LINK\"] = 60] = \"LINK\";\n TAG_ID[TAG_ID[\"LISTING\"] = 61] = \"LISTING\";\n TAG_ID[TAG_ID[\"MAIN\"] = 62] = \"MAIN\";\n TAG_ID[TAG_ID[\"MALIGNMARK\"] = 63] = \"MALIGNMARK\";\n TAG_ID[TAG_ID[\"MARQUEE\"] = 64] = \"MARQUEE\";\n TAG_ID[TAG_ID[\"MATH\"] = 65] = \"MATH\";\n TAG_ID[TAG_ID[\"MENU\"] = 66] = \"MENU\";\n TAG_ID[TAG_ID[\"META\"] = 67] = \"META\";\n TAG_ID[TAG_ID[\"MGLYPH\"] = 68] = \"MGLYPH\";\n TAG_ID[TAG_ID[\"MI\"] = 69] = \"MI\";\n TAG_ID[TAG_ID[\"MO\"] = 70] = \"MO\";\n TAG_ID[TAG_ID[\"MN\"] = 71] = \"MN\";\n TAG_ID[TAG_ID[\"MS\"] = 72] = \"MS\";\n TAG_ID[TAG_ID[\"MTEXT\"] = 73] = \"MTEXT\";\n TAG_ID[TAG_ID[\"NAV\"] = 74] = \"NAV\";\n TAG_ID[TAG_ID[\"NOBR\"] = 75] = \"NOBR\";\n TAG_ID[TAG_ID[\"NOFRAMES\"] = 76] = \"NOFRAMES\";\n TAG_ID[TAG_ID[\"NOEMBED\"] = 77] = \"NOEMBED\";\n TAG_ID[TAG_ID[\"NOSCRIPT\"] = 78] = \"NOSCRIPT\";\n TAG_ID[TAG_ID[\"OBJECT\"] = 79] = \"OBJECT\";\n TAG_ID[TAG_ID[\"OL\"] = 80] = \"OL\";\n TAG_ID[TAG_ID[\"OPTGROUP\"] = 81] = \"OPTGROUP\";\n TAG_ID[TAG_ID[\"OPTION\"] = 82] = \"OPTION\";\n TAG_ID[TAG_ID[\"P\"] = 83] = \"P\";\n TAG_ID[TAG_ID[\"PARAM\"] = 84] = \"PARAM\";\n TAG_ID[TAG_ID[\"PLAINTEXT\"] = 85] = \"PLAINTEXT\";\n TAG_ID[TAG_ID[\"PRE\"] = 86] = \"PRE\";\n TAG_ID[TAG_ID[\"RB\"] = 87] = \"RB\";\n TAG_ID[TAG_ID[\"RP\"] = 88] = \"RP\";\n TAG_ID[TAG_ID[\"RT\"] = 89] = \"RT\";\n TAG_ID[TAG_ID[\"RTC\"] = 90] = \"RTC\";\n TAG_ID[TAG_ID[\"RUBY\"] = 91] = \"RUBY\";\n TAG_ID[TAG_ID[\"S\"] = 92] = \"S\";\n TAG_ID[TAG_ID[\"SCRIPT\"] = 93] = \"SCRIPT\";\n TAG_ID[TAG_ID[\"SEARCH\"] = 94] = \"SEARCH\";\n TAG_ID[TAG_ID[\"SECTION\"] = 95] = \"SECTION\";\n TAG_ID[TAG_ID[\"SELECT\"] = 96] = \"SELECT\";\n TAG_ID[TAG_ID[\"SOURCE\"] = 97] = \"SOURCE\";\n TAG_ID[TAG_ID[\"SMALL\"] = 98] = \"SMALL\";\n TAG_ID[TAG_ID[\"SPAN\"] = 99] = \"SPAN\";\n TAG_ID[TAG_ID[\"STRIKE\"] = 100] = \"STRIKE\";\n TAG_ID[TAG_ID[\"STRONG\"] = 101] = \"STRONG\";\n TAG_ID[TAG_ID[\"STYLE\"] = 102] = \"STYLE\";\n TAG_ID[TAG_ID[\"SUB\"] = 103] = \"SUB\";\n TAG_ID[TAG_ID[\"SUMMARY\"] = 104] = \"SUMMARY\";\n TAG_ID[TAG_ID[\"SUP\"] = 105] = \"SUP\";\n TAG_ID[TAG_ID[\"TABLE\"] = 106] = \"TABLE\";\n TAG_ID[TAG_ID[\"TBODY\"] = 107] = \"TBODY\";\n TAG_ID[TAG_ID[\"TEMPLATE\"] = 108] = \"TEMPLATE\";\n TAG_ID[TAG_ID[\"TEXTAREA\"] = 109] = \"TEXTAREA\";\n TAG_ID[TAG_ID[\"TFOOT\"] = 110] = \"TFOOT\";\n TAG_ID[TAG_ID[\"TD\"] = 111] = \"TD\";\n TAG_ID[TAG_ID[\"TH\"] = 112] = \"TH\";\n TAG_ID[TAG_ID[\"THEAD\"] = 113] = \"THEAD\";\n TAG_ID[TAG_ID[\"TITLE\"] = 114] = \"TITLE\";\n TAG_ID[TAG_ID[\"TR\"] = 115] = \"TR\";\n TAG_ID[TAG_ID[\"TRACK\"] = 116] = \"TRACK\";\n TAG_ID[TAG_ID[\"TT\"] = 117] = \"TT\";\n TAG_ID[TAG_ID[\"U\"] = 118] = \"U\";\n TAG_ID[TAG_ID[\"UL\"] = 119] = \"UL\";\n TAG_ID[TAG_ID[\"SVG\"] = 120] = \"SVG\";\n TAG_ID[TAG_ID[\"VAR\"] = 121] = \"VAR\";\n TAG_ID[TAG_ID[\"WBR\"] = 122] = \"WBR\";\n TAG_ID[TAG_ID[\"XMP\"] = 123] = \"XMP\";\n})(TAG_ID || (TAG_ID = {}));\nconst TAG_NAME_TO_ID = new Map([\n [TAG_NAMES.A, TAG_ID.A],\n [TAG_NAMES.ADDRESS, TAG_ID.ADDRESS],\n [TAG_NAMES.ANNOTATION_XML, TAG_ID.ANNOTATION_XML],\n [TAG_NAMES.APPLET, TAG_ID.APPLET],\n [TAG_NAMES.AREA, TAG_ID.AREA],\n [TAG_NAMES.ARTICLE, TAG_ID.ARTICLE],\n [TAG_NAMES.ASIDE, TAG_ID.ASIDE],\n [TAG_NAMES.B, TAG_ID.B],\n [TAG_NAMES.BASE, TAG_ID.BASE],\n [TAG_NAMES.BASEFONT, TAG_ID.BASEFONT],\n [TAG_NAMES.BGSOUND, TAG_ID.BGSOUND],\n [TAG_NAMES.BIG, TAG_ID.BIG],\n [TAG_NAMES.BLOCKQUOTE, TAG_ID.BLOCKQUOTE],\n [TAG_NAMES.BODY, TAG_ID.BODY],\n [TAG_NAMES.BR, TAG_ID.BR],\n [TAG_NAMES.BUTTON, TAG_ID.BUTTON],\n [TAG_NAMES.CAPTION, TAG_ID.CAPTION],\n [TAG_NAMES.CENTER, TAG_ID.CENTER],\n [TAG_NAMES.CODE, TAG_ID.CODE],\n [TAG_NAMES.COL, TAG_ID.COL],\n [TAG_NAMES.COLGROUP, TAG_ID.COLGROUP],\n [TAG_NAMES.DD, TAG_ID.DD],\n [TAG_NAMES.DESC, TAG_ID.DESC],\n [TAG_NAMES.DETAILS, TAG_ID.DETAILS],\n [TAG_NAMES.DIALOG, TAG_ID.DIALOG],\n [TAG_NAMES.DIR, TAG_ID.DIR],\n [TAG_NAMES.DIV, TAG_ID.DIV],\n [TAG_NAMES.DL, TAG_ID.DL],\n [TAG_NAMES.DT, TAG_ID.DT],\n [TAG_NAMES.EM, TAG_ID.EM],\n [TAG_NAMES.EMBED, TAG_ID.EMBED],\n [TAG_NAMES.FIELDSET, TAG_ID.FIELDSET],\n [TAG_NAMES.FIGCAPTION, TAG_ID.FIGCAPTION],\n [TAG_NAMES.FIGURE, TAG_ID.FIGURE],\n [TAG_NAMES.FONT, TAG_ID.FONT],\n [TAG_NAMES.FOOTER, TAG_ID.FOOTER],\n [TAG_NAMES.FOREIGN_OBJECT, TAG_ID.FOREIGN_OBJECT],\n [TAG_NAMES.FORM, TAG_ID.FORM],\n [TAG_NAMES.FRAME, TAG_ID.FRAME],\n [TAG_NAMES.FRAMESET, TAG_ID.FRAMESET],\n [TAG_NAMES.H1, TAG_ID.H1],\n [TAG_NAMES.H2, TAG_ID.H2],\n [TAG_NAMES.H3, TAG_ID.H3],\n [TAG_NAMES.H4, TAG_ID.H4],\n [TAG_NAMES.H5, TAG_ID.H5],\n [TAG_NAMES.H6, TAG_ID.H6],\n [TAG_NAMES.HEAD, TAG_ID.HEAD],\n [TAG_NAMES.HEADER, TAG_ID.HEADER],\n [TAG_NAMES.HGROUP, TAG_ID.HGROUP],\n [TAG_NAMES.HR, TAG_ID.HR],\n [TAG_NAMES.HTML, TAG_ID.HTML],\n [TAG_NAMES.I, TAG_ID.I],\n [TAG_NAMES.IMG, TAG_ID.IMG],\n [TAG_NAMES.IMAGE, TAG_ID.IMAGE],\n [TAG_NAMES.INPUT, TAG_ID.INPUT],\n [TAG_NAMES.IFRAME, TAG_ID.IFRAME],\n [TAG_NAMES.KEYGEN, TAG_ID.KEYGEN],\n [TAG_NAMES.LABEL, TAG_ID.LABEL],\n [TAG_NAMES.LI, TAG_ID.LI],\n [TAG_NAMES.LINK, TAG_ID.LINK],\n [TAG_NAMES.LISTING, TAG_ID.LISTING],\n [TAG_NAMES.MAIN, TAG_ID.MAIN],\n [TAG_NAMES.MALIGNMARK, TAG_ID.MALIGNMARK],\n [TAG_NAMES.MARQUEE, TAG_ID.MARQUEE],\n [TAG_NAMES.MATH, TAG_ID.MATH],\n [TAG_NAMES.MENU, TAG_ID.MENU],\n [TAG_NAMES.META, TAG_ID.META],\n [TAG_NAMES.MGLYPH, TAG_ID.MGLYPH],\n [TAG_NAMES.MI, TAG_ID.MI],\n [TAG_NAMES.MO, TAG_ID.MO],\n [TAG_NAMES.MN, TAG_ID.MN],\n [TAG_NAMES.MS, TAG_ID.MS],\n [TAG_NAMES.MTEXT, TAG_ID.MTEXT],\n [TAG_NAMES.NAV, TAG_ID.NAV],\n [TAG_NAMES.NOBR, TAG_ID.NOBR],\n [TAG_NAMES.NOFRAMES, TAG_ID.NOFRAMES],\n [TAG_NAMES.NOEMBED, TAG_ID.NOEMBED],\n [TAG_NAMES.NOSCRIPT, TAG_ID.NOSCRIPT],\n [TAG_NAMES.OBJECT, TAG_ID.OBJECT],\n [TAG_NAMES.OL, TAG_ID.OL],\n [TAG_NAMES.OPTGROUP, TAG_ID.OPTGROUP],\n [TAG_NAMES.OPTION, TAG_ID.OPTION],\n [TAG_NAMES.P, TAG_ID.P],\n [TAG_NAMES.PARAM, TAG_ID.PARAM],\n [TAG_NAMES.PLAINTEXT, TAG_ID.PLAINTEXT],\n [TAG_NAMES.PRE, TAG_ID.PRE],\n [TAG_NAMES.RB, TAG_ID.RB],\n [TAG_NAMES.RP, TAG_ID.RP],\n [TAG_NAMES.RT, TAG_ID.RT],\n [TAG_NAMES.RTC, TAG_ID.RTC],\n [TAG_NAMES.RUBY, TAG_ID.RUBY],\n [TAG_NAMES.S, TAG_ID.S],\n [TAG_NAMES.SCRIPT, TAG_ID.SCRIPT],\n [TAG_NAMES.SEARCH, TAG_ID.SEARCH],\n [TAG_NAMES.SECTION, TAG_ID.SECTION],\n [TAG_NAMES.SELECT, TAG_ID.SELECT],\n [TAG_NAMES.SOURCE, TAG_ID.SOURCE],\n [TAG_NAMES.SMALL, TAG_ID.SMALL],\n [TAG_NAMES.SPAN, TAG_ID.SPAN],\n [TAG_NAMES.STRIKE, TAG_ID.STRIKE],\n [TAG_NAMES.STRONG, TAG_ID.STRONG],\n [TAG_NAMES.STYLE, TAG_ID.STYLE],\n [TAG_NAMES.SUB, TAG_ID.SUB],\n [TAG_NAMES.SUMMARY, TAG_ID.SUMMARY],\n [TAG_NAMES.SUP, TAG_ID.SUP],\n [TAG_NAMES.TABLE, TAG_ID.TABLE],\n [TAG_NAMES.TBODY, TAG_ID.TBODY],\n [TAG_NAMES.TEMPLATE, TAG_ID.TEMPLATE],\n [TAG_NAMES.TEXTAREA, TAG_ID.TEXTAREA],\n [TAG_NAMES.TFOOT, TAG_ID.TFOOT],\n [TAG_NAMES.TD, TAG_ID.TD],\n [TAG_NAMES.TH, TAG_ID.TH],\n [TAG_NAMES.THEAD, TAG_ID.THEAD],\n [TAG_NAMES.TITLE, TAG_ID.TITLE],\n [TAG_NAMES.TR, TAG_ID.TR],\n [TAG_NAMES.TRACK, TAG_ID.TRACK],\n [TAG_NAMES.TT, TAG_ID.TT],\n [TAG_NAMES.U, TAG_ID.U],\n [TAG_NAMES.UL, TAG_ID.UL],\n [TAG_NAMES.SVG, TAG_ID.SVG],\n [TAG_NAMES.VAR, TAG_ID.VAR],\n [TAG_NAMES.WBR, TAG_ID.WBR],\n [TAG_NAMES.XMP, TAG_ID.XMP],\n]);\nexport function getTagID(tagName) {\n var _a;\n return (_a = TAG_NAME_TO_ID.get(tagName)) !== null && _a !== void 0 ? _a : TAG_ID.UNKNOWN;\n}\nconst $ = TAG_ID;\nexport const SPECIAL_ELEMENTS = {\n [NS.HTML]: new Set([\n $.ADDRESS,\n $.APPLET,\n $.AREA,\n $.ARTICLE,\n $.ASIDE,\n $.BASE,\n $.BASEFONT,\n $.BGSOUND,\n $.BLOCKQUOTE,\n $.BODY,\n $.BR,\n $.BUTTON,\n $.CAPTION,\n $.CENTER,\n $.COL,\n $.COLGROUP,\n $.DD,\n $.DETAILS,\n $.DIR,\n $.DIV,\n $.DL,\n $.DT,\n $.EMBED,\n $.FIELDSET,\n $.FIGCAPTION,\n $.FIGURE,\n $.FOOTER,\n $.FORM,\n $.FRAME,\n $.FRAMESET,\n $.H1,\n $.H2,\n $.H3,\n $.H4,\n $.H5,\n $.H6,\n $.HEAD,\n $.HEADER,\n $.HGROUP,\n $.HR,\n $.HTML,\n $.IFRAME,\n $.IMG,\n $.INPUT,\n $.LI,\n $.LINK,\n $.LISTING,\n $.MAIN,\n $.MARQUEE,\n $.MENU,\n $.META,\n $.NAV,\n $.NOEMBED,\n $.NOFRAMES,\n $.NOSCRIPT,\n $.OBJECT,\n $.OL,\n $.P,\n $.PARAM,\n $.PLAINTEXT,\n $.PRE,\n $.SCRIPT,\n $.SECTION,\n $.SELECT,\n $.SOURCE,\n $.STYLE,\n $.SUMMARY,\n $.TABLE,\n $.TBODY,\n $.TD,\n $.TEMPLATE,\n $.TEXTAREA,\n $.TFOOT,\n $.TH,\n $.THEAD,\n $.TITLE,\n $.TR,\n $.TRACK,\n $.UL,\n $.WBR,\n $.XMP,\n ]),\n [NS.MATHML]: new Set([$.MI, $.MO, $.MN, $.MS, $.MTEXT, $.ANNOTATION_XML]),\n [NS.SVG]: new Set([$.TITLE, $.FOREIGN_OBJECT, $.DESC]),\n [NS.XLINK]: new Set(),\n [NS.XML]: new Set(),\n [NS.XMLNS]: new Set(),\n};\nexport const NUMBERED_HEADERS = new Set([$.H1, $.H2, $.H3, $.H4, $.H5, $.H6]);\nconst UNESCAPED_TEXT = new Set([\n TAG_NAMES.STYLE,\n TAG_NAMES.SCRIPT,\n TAG_NAMES.XMP,\n TAG_NAMES.IFRAME,\n TAG_NAMES.NOEMBED,\n TAG_NAMES.NOFRAMES,\n TAG_NAMES.PLAINTEXT,\n]);\nexport function hasUnescapedText(tn, scriptingEnabled) {\n return UNESCAPED_TEXT.has(tn) || (scriptingEnabled && tn === TAG_NAMES.NOSCRIPT);\n}\n","import { Preprocessor } from './preprocessor.js';\nimport { CODE_POINTS as $, SEQUENCES as $$, REPLACEMENT_CHARACTER, isSurrogate, isUndefinedCodePoint, isControlCodePoint, } from '../common/unicode.js';\nimport { TokenType, getTokenAttr, } from '../common/token.js';\nimport { htmlDecodeTree, EntityDecoder, DecodingMode } from 'entities/decode';\nimport { ERR } from '../common/error-codes.js';\nimport { TAG_ID, getTagID } from '../common/html.js';\n//States\nvar State;\n(function (State) {\n State[State[\"DATA\"] = 0] = \"DATA\";\n State[State[\"RCDATA\"] = 1] = \"RCDATA\";\n State[State[\"RAWTEXT\"] = 2] = \"RAWTEXT\";\n State[State[\"SCRIPT_DATA\"] = 3] = \"SCRIPT_DATA\";\n State[State[\"PLAINTEXT\"] = 4] = \"PLAINTEXT\";\n State[State[\"TAG_OPEN\"] = 5] = \"TAG_OPEN\";\n State[State[\"END_TAG_OPEN\"] = 6] = \"END_TAG_OPEN\";\n State[State[\"TAG_NAME\"] = 7] = \"TAG_NAME\";\n State[State[\"RCDATA_LESS_THAN_SIGN\"] = 8] = \"RCDATA_LESS_THAN_SIGN\";\n State[State[\"RCDATA_END_TAG_OPEN\"] = 9] = \"RCDATA_END_TAG_OPEN\";\n State[State[\"RCDATA_END_TAG_NAME\"] = 10] = \"RCDATA_END_TAG_NAME\";\n State[State[\"RAWTEXT_LESS_THAN_SIGN\"] = 11] = \"RAWTEXT_LESS_THAN_SIGN\";\n State[State[\"RAWTEXT_END_TAG_OPEN\"] = 12] = \"RAWTEXT_END_TAG_OPEN\";\n State[State[\"RAWTEXT_END_TAG_NAME\"] = 13] = \"RAWTEXT_END_TAG_NAME\";\n State[State[\"SCRIPT_DATA_LESS_THAN_SIGN\"] = 14] = \"SCRIPT_DATA_LESS_THAN_SIGN\";\n State[State[\"SCRIPT_DATA_END_TAG_OPEN\"] = 15] = \"SCRIPT_DATA_END_TAG_OPEN\";\n State[State[\"SCRIPT_DATA_END_TAG_NAME\"] = 16] = \"SCRIPT_DATA_END_TAG_NAME\";\n State[State[\"SCRIPT_DATA_ESCAPE_START\"] = 17] = \"SCRIPT_DATA_ESCAPE_START\";\n State[State[\"SCRIPT_DATA_ESCAPE_START_DASH\"] = 18] = \"SCRIPT_DATA_ESCAPE_START_DASH\";\n State[State[\"SCRIPT_DATA_ESCAPED\"] = 19] = \"SCRIPT_DATA_ESCAPED\";\n State[State[\"SCRIPT_DATA_ESCAPED_DASH\"] = 20] = \"SCRIPT_DATA_ESCAPED_DASH\";\n State[State[\"SCRIPT_DATA_ESCAPED_DASH_DASH\"] = 21] = \"SCRIPT_DATA_ESCAPED_DASH_DASH\";\n State[State[\"SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN\"] = 22] = \"SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN\";\n State[State[\"SCRIPT_DATA_ESCAPED_END_TAG_OPEN\"] = 23] = \"SCRIPT_DATA_ESCAPED_END_TAG_OPEN\";\n State[State[\"SCRIPT_DATA_ESCAPED_END_TAG_NAME\"] = 24] = \"SCRIPT_DATA_ESCAPED_END_TAG_NAME\";\n State[State[\"SCRIPT_DATA_DOUBLE_ESCAPE_START\"] = 25] = \"SCRIPT_DATA_DOUBLE_ESCAPE_START\";\n State[State[\"SCRIPT_DATA_DOUBLE_ESCAPED\"] = 26] = \"SCRIPT_DATA_DOUBLE_ESCAPED\";\n State[State[\"SCRIPT_DATA_DOUBLE_ESCAPED_DASH\"] = 27] = \"SCRIPT_DATA_DOUBLE_ESCAPED_DASH\";\n State[State[\"SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH\"] = 28] = \"SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH\";\n State[State[\"SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN\"] = 29] = \"SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN\";\n State[State[\"SCRIPT_DATA_DOUBLE_ESCAPE_END\"] = 30] = \"SCRIPT_DATA_DOUBLE_ESCAPE_END\";\n State[State[\"BEFORE_ATTRIBUTE_NAME\"] = 31] = \"BEFORE_ATTRIBUTE_NAME\";\n State[State[\"ATTRIBUTE_NAME\"] = 32] = \"ATTRIBUTE_NAME\";\n State[State[\"AFTER_ATTRIBUTE_NAME\"] = 33] = \"AFTER_ATTRIBUTE_NAME\";\n State[State[\"BEFORE_ATTRIBUTE_VALUE\"] = 34] = \"BEFORE_ATTRIBUTE_VALUE\";\n State[State[\"ATTRIBUTE_VALUE_DOUBLE_QUOTED\"] = 35] = \"ATTRIBUTE_VALUE_DOUBLE_QUOTED\";\n State[State[\"ATTRIBUTE_VALUE_SINGLE_QUOTED\"] = 36] = \"ATTRIBUTE_VALUE_SINGLE_QUOTED\";\n State[State[\"ATTRIBUTE_VALUE_UNQUOTED\"] = 37] = \"ATTRIBUTE_VALUE_UNQUOTED\";\n State[State[\"AFTER_ATTRIBUTE_VALUE_QUOTED\"] = 38] = \"AFTER_ATTRIBUTE_VALUE_QUOTED\";\n State[State[\"SELF_CLOSING_START_TAG\"] = 39] = \"SELF_CLOSING_START_TAG\";\n State[State[\"BOGUS_COMMENT\"] = 40] = \"BOGUS_COMMENT\";\n State[State[\"MARKUP_DECLARATION_OPEN\"] = 41] = \"MARKUP_DECLARATION_OPEN\";\n State[State[\"COMMENT_START\"] = 42] = \"COMMENT_START\";\n State[State[\"COMMENT_START_DASH\"] = 43] = \"COMMENT_START_DASH\";\n State[State[\"COMMENT\"] = 44] = \"COMMENT\";\n State[State[\"COMMENT_LESS_THAN_SIGN\"] = 45] = \"COMMENT_LESS_THAN_SIGN\";\n State[State[\"COMMENT_LESS_THAN_SIGN_BANG\"] = 46] = \"COMMENT_LESS_THAN_SIGN_BANG\";\n State[State[\"COMMENT_LESS_THAN_SIGN_BANG_DASH\"] = 47] = \"COMMENT_LESS_THAN_SIGN_BANG_DASH\";\n State[State[\"COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH\"] = 48] = \"COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH\";\n State[State[\"COMMENT_END_DASH\"] = 49] = \"COMMENT_END_DASH\";\n State[State[\"COMMENT_END\"] = 50] = \"COMMENT_END\";\n State[State[\"COMMENT_END_BANG\"] = 51] = \"COMMENT_END_BANG\";\n State[State[\"DOCTYPE\"] = 52] = \"DOCTYPE\";\n State[State[\"BEFORE_DOCTYPE_NAME\"] = 53] = \"BEFORE_DOCTYPE_NAME\";\n State[State[\"DOCTYPE_NAME\"] = 54] = \"DOCTYPE_NAME\";\n State[State[\"AFTER_DOCTYPE_NAME\"] = 55] = \"AFTER_DOCTYPE_NAME\";\n State[State[\"AFTER_DOCTYPE_PUBLIC_KEYWORD\"] = 56] = \"AFTER_DOCTYPE_PUBLIC_KEYWORD\";\n State[State[\"BEFORE_DOCTYPE_PUBLIC_IDENTIFIER\"] = 57] = \"BEFORE_DOCTYPE_PUBLIC_IDENTIFIER\";\n State[State[\"DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED\"] = 58] = \"DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED\";\n State[State[\"DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED\"] = 59] = \"DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED\";\n State[State[\"AFTER_DOCTYPE_PUBLIC_IDENTIFIER\"] = 60] = \"AFTER_DOCTYPE_PUBLIC_IDENTIFIER\";\n State[State[\"BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS\"] = 61] = \"BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS\";\n State[State[\"AFTER_DOCTYPE_SYSTEM_KEYWORD\"] = 62] = \"AFTER_DOCTYPE_SYSTEM_KEYWORD\";\n State[State[\"BEFORE_DOCTYPE_SYSTEM_IDENTIFIER\"] = 63] = \"BEFORE_DOCTYPE_SYSTEM_IDENTIFIER\";\n State[State[\"DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED\"] = 64] = \"DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED\";\n State[State[\"DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED\"] = 65] = \"DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED\";\n State[State[\"AFTER_DOCTYPE_SYSTEM_IDENTIFIER\"] = 66] = \"AFTER_DOCTYPE_SYSTEM_IDENTIFIER\";\n State[State[\"BOGUS_DOCTYPE\"] = 67] = \"BOGUS_DOCTYPE\";\n State[State[\"CDATA_SECTION\"] = 68] = \"CDATA_SECTION\";\n State[State[\"CDATA_SECTION_BRACKET\"] = 69] = \"CDATA_SECTION_BRACKET\";\n State[State[\"CDATA_SECTION_END\"] = 70] = \"CDATA_SECTION_END\";\n State[State[\"CHARACTER_REFERENCE\"] = 71] = \"CHARACTER_REFERENCE\";\n State[State[\"AMBIGUOUS_AMPERSAND\"] = 72] = \"AMBIGUOUS_AMPERSAND\";\n})(State || (State = {}));\n//Tokenizer initial states for different modes\nexport const TokenizerMode = {\n DATA: State.DATA,\n RCDATA: State.RCDATA,\n RAWTEXT: State.RAWTEXT,\n SCRIPT_DATA: State.SCRIPT_DATA,\n PLAINTEXT: State.PLAINTEXT,\n CDATA_SECTION: State.CDATA_SECTION,\n};\n//Utils\n//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline\n//this functions if they will be situated in another module due to context switch.\n//Always perform inlining check before modifying this functions ('node --trace-inlining').\nfunction isAsciiDigit(cp) {\n return cp >= $.DIGIT_0 && cp <= $.DIGIT_9;\n}\nfunction isAsciiUpper(cp) {\n return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_Z;\n}\nfunction isAsciiLower(cp) {\n return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_Z;\n}\nfunction isAsciiLetter(cp) {\n return isAsciiLower(cp) || isAsciiUpper(cp);\n}\nfunction isAsciiAlphaNumeric(cp) {\n return isAsciiLetter(cp) || isAsciiDigit(cp);\n}\nfunction toAsciiLower(cp) {\n return cp + 32;\n}\nfunction isWhitespace(cp) {\n return cp === $.SPACE || cp === $.LINE_FEED || cp === $.TABULATION || cp === $.FORM_FEED;\n}\nfunction isScriptDataDoubleEscapeSequenceEnd(cp) {\n return isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN;\n}\nfunction getErrorForNumericCharacterReference(code) {\n if (code === $.NULL) {\n return ERR.nullCharacterReference;\n }\n else if (code > 1114111) {\n return ERR.characterReferenceOutsideUnicodeRange;\n }\n else if (isSurrogate(code)) {\n return ERR.surrogateCharacterReference;\n }\n else if (isUndefinedCodePoint(code)) {\n return ERR.noncharacterCharacterReference;\n }\n else if (isControlCodePoint(code) || code === $.CARRIAGE_RETURN) {\n return ERR.controlCharacterReference;\n }\n return null;\n}\n//Tokenizer\nexport class Tokenizer {\n constructor(options, handler) {\n this.options = options;\n this.handler = handler;\n this.paused = false;\n /** Ensures that the parsing loop isn't run multiple times at once. */\n this.inLoop = false;\n /**\n * Indicates that the current adjusted node exists, is not an element in the HTML namespace,\n * and that it is not an integration point for either MathML or HTML.\n *\n * @see {@link https://html.spec.whatwg.org/multipage/parsing.html#tree-construction}\n */\n this.inForeignNode = false;\n this.lastStartTagName = '';\n this.active = false;\n this.state = State.DATA;\n this.returnState = State.DATA;\n this.entityStartPos = 0;\n this.consumedAfterSnapshot = -1;\n this.currentCharacterToken = null;\n this.currentToken = null;\n this.currentAttr = { name: '', value: '' };\n this.preprocessor = new Preprocessor(handler);\n this.currentLocation = this.getCurrentLocation(-1);\n this.entityDecoder = new EntityDecoder(htmlDecodeTree, (cp, consumed) => {\n // Note: Set `pos` _before_ flushing, as flushing might drop\n // the current chunk and invalidate `entityStartPos`.\n this.preprocessor.pos = this.entityStartPos + consumed - 1;\n this._flushCodePointConsumedAsCharacterReference(cp);\n }, handler.onParseError\n ? {\n missingSemicolonAfterCharacterReference: () => {\n this._err(ERR.missingSemicolonAfterCharacterReference, 1);\n },\n absenceOfDigitsInNumericCharacterReference: (consumed) => {\n this._err(ERR.absenceOfDigitsInNumericCharacterReference, this.entityStartPos - this.preprocessor.pos + consumed);\n },\n validateNumericCharacterReference: (code) => {\n const error = getErrorForNumericCharacterReference(code);\n if (error)\n this._err(error, 1);\n },\n }\n : undefined);\n }\n //Errors\n _err(code, cpOffset = 0) {\n var _a, _b;\n (_b = (_a = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a, this.preprocessor.getError(code, cpOffset));\n }\n // NOTE: `offset` may never run across line boundaries.\n getCurrentLocation(offset) {\n if (!this.options.sourceCodeLocationInfo) {\n return null;\n }\n return {\n startLine: this.preprocessor.line,\n startCol: this.preprocessor.col - offset,\n startOffset: this.preprocessor.offset - offset,\n endLine: -1,\n endCol: -1,\n endOffset: -1,\n };\n }\n _runParsingLoop() {\n if (this.inLoop)\n return;\n this.inLoop = true;\n while (this.active && !this.paused) {\n this.consumedAfterSnapshot = 0;\n const cp = this._consume();\n if (!this._ensureHibernation()) {\n this._callState(cp);\n }\n }\n this.inLoop = false;\n }\n //API\n pause() {\n this.paused = true;\n }\n resume(writeCallback) {\n if (!this.paused) {\n throw new Error('Parser was already resumed');\n }\n this.paused = false;\n // Necessary for synchronous resume.\n if (this.inLoop)\n return;\n this._runParsingLoop();\n if (!this.paused) {\n writeCallback === null || writeCallback === void 0 ? void 0 : writeCallback();\n }\n }\n write(chunk, isLastChunk, writeCallback) {\n this.active = true;\n this.preprocessor.write(chunk, isLastChunk);\n this._runParsingLoop();\n if (!this.paused) {\n writeCallback === null || writeCallback === void 0 ? void 0 : writeCallback();\n }\n }\n insertHtmlAtCurrentPos(chunk) {\n this.active = true;\n this.preprocessor.insertHtmlAtCurrentPos(chunk);\n this._runParsingLoop();\n }\n //Hibernation\n _ensureHibernation() {\n if (this.preprocessor.endOfChunkHit) {\n this.preprocessor.retreat(this.consumedAfterSnapshot);\n this.consumedAfterSnapshot = 0;\n this.active = false;\n return true;\n }\n return false;\n }\n //Consumption\n _consume() {\n this.consumedAfterSnapshot++;\n return this.preprocessor.advance();\n }\n _advanceBy(count) {\n this.consumedAfterSnapshot += count;\n for (let i = 0; i < count; i++) {\n this.preprocessor.advance();\n }\n }\n _consumeSequenceIfMatch(pattern, caseSensitive) {\n if (this.preprocessor.startsWith(pattern, caseSensitive)) {\n // We will already have consumed one character before calling this method.\n this._advanceBy(pattern.length - 1);\n return true;\n }\n return false;\n }\n //Token creation\n _createStartTagToken() {\n this.currentToken = {\n type: TokenType.START_TAG,\n tagName: '',\n tagID: TAG_ID.UNKNOWN,\n selfClosing: false,\n ackSelfClosing: false,\n attrs: [],\n location: this.getCurrentLocation(1),\n };\n }\n _createEndTagToken() {\n this.currentToken = {\n type: TokenType.END_TAG,\n tagName: '',\n tagID: TAG_ID.UNKNOWN,\n selfClosing: false,\n ackSelfClosing: false,\n attrs: [],\n location: this.getCurrentLocation(2),\n };\n }\n _createCommentToken(offset) {\n this.currentToken = {\n type: TokenType.COMMENT,\n data: '',\n location: this.getCurrentLocation(offset),\n };\n }\n _createDoctypeToken(initialName) {\n this.currentToken = {\n type: TokenType.DOCTYPE,\n name: initialName,\n forceQuirks: false,\n publicId: null,\n systemId: null,\n location: this.currentLocation,\n };\n }\n _createCharacterToken(type, chars) {\n this.currentCharacterToken = {\n type,\n chars,\n location: this.currentLocation,\n };\n }\n //Tag attributes\n _createAttr(attrNameFirstCh) {\n this.currentAttr = {\n name: attrNameFirstCh,\n value: '',\n };\n this.currentLocation = this.getCurrentLocation(0);\n }\n _leaveAttrName() {\n var _a;\n var _b;\n const token = this.currentToken;\n if (getTokenAttr(token, this.currentAttr.name) === null) {\n token.attrs.push(this.currentAttr);\n if (token.location && this.currentLocation) {\n const attrLocations = ((_a = (_b = token.location).attrs) !== null && _a !== void 0 ? _a : (_b.attrs = Object.create(null)));\n attrLocations[this.currentAttr.name] = this.currentLocation;\n // Set end location\n this._leaveAttrValue();\n }\n }\n else {\n this._err(ERR.duplicateAttribute);\n }\n }\n _leaveAttrValue() {\n if (this.currentLocation) {\n this.currentLocation.endLine = this.preprocessor.line;\n this.currentLocation.endCol = this.preprocessor.col;\n this.currentLocation.endOffset = this.preprocessor.offset;\n }\n }\n //Token emission\n prepareToken(ct) {\n this._emitCurrentCharacterToken(ct.location);\n this.currentToken = null;\n if (ct.location) {\n ct.location.endLine = this.preprocessor.line;\n ct.location.endCol = this.preprocessor.col + 1;\n ct.location.endOffset = this.preprocessor.offset + 1;\n }\n this.currentLocation = this.getCurrentLocation(-1);\n }\n emitCurrentTagToken() {\n const ct = this.currentToken;\n this.prepareToken(ct);\n ct.tagID = getTagID(ct.tagName);\n if (ct.type === TokenType.START_TAG) {\n this.lastStartTagName = ct.tagName;\n this.handler.onStartTag(ct);\n }\n else {\n if (ct.attrs.length > 0) {\n this._err(ERR.endTagWithAttributes);\n }\n if (ct.selfClosing) {\n this._err(ERR.endTagWithTrailingSolidus);\n }\n this.handler.onEndTag(ct);\n }\n this.preprocessor.dropParsedChunk();\n }\n emitCurrentComment(ct) {\n this.prepareToken(ct);\n this.handler.onComment(ct);\n this.preprocessor.dropParsedChunk();\n }\n emitCurrentDoctype(ct) {\n this.prepareToken(ct);\n this.handler.onDoctype(ct);\n this.preprocessor.dropParsedChunk();\n }\n _emitCurrentCharacterToken(nextLocation) {\n if (this.currentCharacterToken) {\n //NOTE: if we have a pending character token, make it's end location equal to the\n //current token's start location.\n if (nextLocation && this.currentCharacterToken.location) {\n this.currentCharacterToken.location.endLine = nextLocation.startLine;\n this.currentCharacterToken.location.endCol = nextLocation.startCol;\n this.currentCharacterToken.location.endOffset = nextLocation.startOffset;\n }\n switch (this.currentCharacterToken.type) {\n case TokenType.CHARACTER: {\n this.handler.onCharacter(this.currentCharacterToken);\n break;\n }\n case TokenType.NULL_CHARACTER: {\n this.handler.onNullCharacter(this.currentCharacterToken);\n break;\n }\n case TokenType.WHITESPACE_CHARACTER: {\n this.handler.onWhitespaceCharacter(this.currentCharacterToken);\n break;\n }\n }\n this.currentCharacterToken = null;\n }\n }\n _emitEOFToken() {\n const location = this.getCurrentLocation(0);\n if (location) {\n location.endLine = location.startLine;\n location.endCol = location.startCol;\n location.endOffset = location.startOffset;\n }\n this._emitCurrentCharacterToken(location);\n this.handler.onEof({ type: TokenType.EOF, location });\n this.active = false;\n }\n //Characters emission\n //OPTIMIZATION: The specification uses only one type of character token (one token per character).\n //This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters.\n //If we have a sequence of characters that belong to the same group, the parser can process it\n //as a single solid character token.\n //So, there are 3 types of character tokens in parse5:\n //1)TokenType.NULL_CHARACTER - \\u0000-character sequences (e.g. '\\u0000\\u0000\\u0000')\n //2)TokenType.WHITESPACE_CHARACTER - any whitespace/new-line character sequences (e.g. '\\n \\r\\t \\f')\n //3)TokenType.CHARACTER - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^')\n _appendCharToCurrentCharacterToken(type, ch) {\n if (this.currentCharacterToken) {\n if (this.currentCharacterToken.type === type) {\n this.currentCharacterToken.chars += ch;\n return;\n }\n else {\n this.currentLocation = this.getCurrentLocation(0);\n this._emitCurrentCharacterToken(this.currentLocation);\n this.preprocessor.dropParsedChunk();\n }\n }\n this._createCharacterToken(type, ch);\n }\n _emitCodePoint(cp) {\n const type = isWhitespace(cp)\n ? TokenType.WHITESPACE_CHARACTER\n : cp === $.NULL\n ? TokenType.NULL_CHARACTER\n : TokenType.CHARACTER;\n // OPTIMIZATION: Use String.fromCharCode for BMP characters (< 0x10000) which is faster\n // than String.fromCodePoint. Characters outside BMP are rare in HTML.\n this._appendCharToCurrentCharacterToken(type, cp < 65536 ? String.fromCharCode(cp) : String.fromCodePoint(cp));\n }\n //NOTE: used when we emit characters explicitly.\n //This is always for non-whitespace and non-null characters, which allows us to avoid additional checks.\n _emitChars(ch) {\n this._appendCharToCurrentCharacterToken(TokenType.CHARACTER, ch);\n }\n // Character reference helpers\n _startCharacterReference() {\n this.returnState = this.state;\n this.state = State.CHARACTER_REFERENCE;\n this.entityStartPos = this.preprocessor.pos;\n this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute() ? DecodingMode.Attribute : DecodingMode.Legacy);\n }\n _isCharacterReferenceInAttribute() {\n return (this.returnState === State.ATTRIBUTE_VALUE_DOUBLE_QUOTED ||\n this.returnState === State.ATTRIBUTE_VALUE_SINGLE_QUOTED ||\n this.returnState === State.ATTRIBUTE_VALUE_UNQUOTED);\n }\n _flushCodePointConsumedAsCharacterReference(cp) {\n if (this._isCharacterReferenceInAttribute()) {\n this.currentAttr.value += String.fromCodePoint(cp);\n }\n else {\n this._emitCodePoint(cp);\n }\n }\n // Calling states this way turns out to be much faster than any other approach.\n _callState(cp) {\n switch (this.state) {\n case State.DATA: {\n this._stateData(cp);\n break;\n }\n case State.RCDATA: {\n this._stateRcdata(cp);\n break;\n }\n case State.RAWTEXT: {\n this._stateRawtext(cp);\n break;\n }\n case State.SCRIPT_DATA: {\n this._stateScriptData(cp);\n break;\n }\n case State.PLAINTEXT: {\n this._statePlaintext(cp);\n break;\n }\n case State.TAG_OPEN: {\n this._stateTagOpen(cp);\n break;\n }\n case State.END_TAG_OPEN: {\n this._stateEndTagOpen(cp);\n break;\n }\n case State.TAG_NAME: {\n this._stateTagName(cp);\n break;\n }\n case State.RCDATA_LESS_THAN_SIGN: {\n this._stateRcdataLessThanSign(cp);\n break;\n }\n case State.RCDATA_END_TAG_OPEN: {\n this._stateRcdataEndTagOpen(cp);\n break;\n }\n case State.RCDATA_END_TAG_NAME: {\n this._stateRcdataEndTagName(cp);\n break;\n }\n case State.RAWTEXT_LESS_THAN_SIGN: {\n this._stateRawtextLessThanSign(cp);\n break;\n }\n case State.RAWTEXT_END_TAG_OPEN: {\n this._stateRawtextEndTagOpen(cp);\n break;\n }\n case State.RAWTEXT_END_TAG_NAME: {\n this._stateRawtextEndTagName(cp);\n break;\n }\n case State.SCRIPT_DATA_LESS_THAN_SIGN: {\n this._stateScriptDataLessThanSign(cp);\n break;\n }\n case State.SCRIPT_DATA_END_TAG_OPEN: {\n this._stateScriptDataEndTagOpen(cp);\n break;\n }\n case State.SCRIPT_DATA_END_TAG_NAME: {\n this._stateScriptDataEndTagName(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPE_START: {\n this._stateScriptDataEscapeStart(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPE_START_DASH: {\n this._stateScriptDataEscapeStartDash(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED: {\n this._stateScriptDataEscaped(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_DASH: {\n this._stateScriptDataEscapedDash(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_DASH_DASH: {\n this._stateScriptDataEscapedDashDash(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN: {\n this._stateScriptDataEscapedLessThanSign(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN: {\n this._stateScriptDataEscapedEndTagOpen(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME: {\n this._stateScriptDataEscapedEndTagName(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPE_START: {\n this._stateScriptDataDoubleEscapeStart(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPED: {\n this._stateScriptDataDoubleEscaped(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH: {\n this._stateScriptDataDoubleEscapedDash(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH: {\n this._stateScriptDataDoubleEscapedDashDash(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN: {\n this._stateScriptDataDoubleEscapedLessThanSign(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPE_END: {\n this._stateScriptDataDoubleEscapeEnd(cp);\n break;\n }\n case State.BEFORE_ATTRIBUTE_NAME: {\n this._stateBeforeAttributeName(cp);\n break;\n }\n case State.ATTRIBUTE_NAME: {\n this._stateAttributeName(cp);\n break;\n }\n case State.AFTER_ATTRIBUTE_NAME: {\n this._stateAfterAttributeName(cp);\n break;\n }\n case State.BEFORE_ATTRIBUTE_VALUE: {\n this._stateBeforeAttributeValue(cp);\n break;\n }\n case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED: {\n this._stateAttributeValueDoubleQuoted(cp);\n break;\n }\n case State.ATTRIBUTE_VALUE_SINGLE_QUOTED: {\n this._stateAttributeValueSingleQuoted(cp);\n break;\n }\n case State.ATTRIBUTE_VALUE_UNQUOTED: {\n this._stateAttributeValueUnquoted(cp);\n break;\n }\n case State.AFTER_ATTRIBUTE_VALUE_QUOTED: {\n this._stateAfterAttributeValueQuoted(cp);\n break;\n }\n case State.SELF_CLOSING_START_TAG: {\n this._stateSelfClosingStartTag(cp);\n break;\n }\n case State.BOGUS_COMMENT: {\n this._stateBogusComment(cp);\n break;\n }\n case State.MARKUP_DECLARATION_OPEN: {\n this._stateMarkupDeclarationOpen(cp);\n break;\n }\n case State.COMMENT_START: {\n this._stateCommentStart(cp);\n break;\n }\n case State.COMMENT_START_DASH: {\n this._stateCommentStartDash(cp);\n break;\n }\n case State.COMMENT: {\n this._stateComment(cp);\n break;\n }\n case State.COMMENT_LESS_THAN_SIGN: {\n this._stateCommentLessThanSign(cp);\n break;\n }\n case State.COMMENT_LESS_THAN_SIGN_BANG: {\n this._stateCommentLessThanSignBang(cp);\n break;\n }\n case State.COMMENT_LESS_THAN_SIGN_BANG_DASH: {\n this._stateCommentLessThanSignBangDash(cp);\n break;\n }\n case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH: {\n this._stateCommentLessThanSignBangDashDash(cp);\n break;\n }\n case State.COMMENT_END_DASH: {\n this._stateCommentEndDash(cp);\n break;\n }\n case State.COMMENT_END: {\n this._stateCommentEnd(cp);\n break;\n }\n case State.COMMENT_END_BANG: {\n this._stateCommentEndBang(cp);\n break;\n }\n case State.DOCTYPE: {\n this._stateDoctype(cp);\n break;\n }\n case State.BEFORE_DOCTYPE_NAME: {\n this._stateBeforeDoctypeName(cp);\n break;\n }\n case State.DOCTYPE_NAME: {\n this._stateDoctypeName(cp);\n break;\n }\n case State.AFTER_DOCTYPE_NAME: {\n this._stateAfterDoctypeName(cp);\n break;\n }\n case State.AFTER_DOCTYPE_PUBLIC_KEYWORD: {\n this._stateAfterDoctypePublicKeyword(cp);\n break;\n }\n case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER: {\n this._stateBeforeDoctypePublicIdentifier(cp);\n break;\n }\n case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED: {\n this._stateDoctypePublicIdentifierDoubleQuoted(cp);\n break;\n }\n case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED: {\n this._stateDoctypePublicIdentifierSingleQuoted(cp);\n break;\n }\n case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER: {\n this._stateAfterDoctypePublicIdentifier(cp);\n break;\n }\n case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS: {\n this._stateBetweenDoctypePublicAndSystemIdentifiers(cp);\n break;\n }\n case State.AFTER_DOCTYPE_SYSTEM_KEYWORD: {\n this._stateAfterDoctypeSystemKeyword(cp);\n break;\n }\n case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER: {\n this._stateBeforeDoctypeSystemIdentifier(cp);\n break;\n }\n case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED: {\n this._stateDoctypeSystemIdentifierDoubleQuoted(cp);\n break;\n }\n case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED: {\n this._stateDoctypeSystemIdentifierSingleQuoted(cp);\n break;\n }\n case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER: {\n this._stateAfterDoctypeSystemIdentifier(cp);\n break;\n }\n case State.BOGUS_DOCTYPE: {\n this._stateBogusDoctype(cp);\n break;\n }\n case State.CDATA_SECTION: {\n this._stateCdataSection(cp);\n break;\n }\n case State.CDATA_SECTION_BRACKET: {\n this._stateCdataSectionBracket(cp);\n break;\n }\n case State.CDATA_SECTION_END: {\n this._stateCdataSectionEnd(cp);\n break;\n }\n case State.CHARACTER_REFERENCE: {\n this._stateCharacterReference();\n break;\n }\n case State.AMBIGUOUS_AMPERSAND: {\n this._stateAmbiguousAmpersand(cp);\n break;\n }\n default: {\n throw new Error('Unknown state');\n }\n }\n }\n // State machine\n // Data state\n //------------------------------------------------------------------\n _stateData(cp) {\n switch (cp) {\n case $.LESS_THAN_SIGN: {\n this.state = State.TAG_OPEN;\n break;\n }\n case $.AMPERSAND: {\n this._startCharacterReference();\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this._emitCodePoint(cp);\n break;\n }\n case $.EOF: {\n this._emitEOFToken();\n break;\n }\n default: {\n this._emitCodePoint(cp);\n }\n }\n }\n // RCDATA state\n //------------------------------------------------------------------\n _stateRcdata(cp) {\n switch (cp) {\n case $.AMPERSAND: {\n this._startCharacterReference();\n break;\n }\n case $.LESS_THAN_SIGN: {\n this.state = State.RCDATA_LESS_THAN_SIGN;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._emitEOFToken();\n break;\n }\n default: {\n this._emitCodePoint(cp);\n }\n }\n }\n // RAWTEXT state\n //------------------------------------------------------------------\n _stateRawtext(cp) {\n switch (cp) {\n case $.LESS_THAN_SIGN: {\n this.state = State.RAWTEXT_LESS_THAN_SIGN;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._emitEOFToken();\n break;\n }\n default: {\n this._emitCodePoint(cp);\n }\n }\n }\n // Script data state\n //------------------------------------------------------------------\n _stateScriptData(cp) {\n switch (cp) {\n case $.LESS_THAN_SIGN: {\n this.state = State.SCRIPT_DATA_LESS_THAN_SIGN;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._emitEOFToken();\n break;\n }\n default: {\n this._emitCodePoint(cp);\n }\n }\n }\n // PLAINTEXT state\n //------------------------------------------------------------------\n _statePlaintext(cp) {\n switch (cp) {\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._emitEOFToken();\n break;\n }\n default: {\n this._emitCodePoint(cp);\n }\n }\n }\n // Tag open state\n //------------------------------------------------------------------\n _stateTagOpen(cp) {\n if (isAsciiLetter(cp)) {\n this._createStartTagToken();\n this.state = State.TAG_NAME;\n this._stateTagName(cp);\n }\n else\n switch (cp) {\n case $.EXCLAMATION_MARK: {\n this.state = State.MARKUP_DECLARATION_OPEN;\n break;\n }\n case $.SOLIDUS: {\n this.state = State.END_TAG_OPEN;\n break;\n }\n case $.QUESTION_MARK: {\n this._err(ERR.unexpectedQuestionMarkInsteadOfTagName);\n this._createCommentToken(1);\n this.state = State.BOGUS_COMMENT;\n this._stateBogusComment(cp);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofBeforeTagName);\n this._emitChars('<');\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.invalidFirstCharacterOfTagName);\n this._emitChars('<');\n this.state = State.DATA;\n this._stateData(cp);\n }\n }\n }\n // End tag open state\n //------------------------------------------------------------------\n _stateEndTagOpen(cp) {\n if (isAsciiLetter(cp)) {\n this._createEndTagToken();\n this.state = State.TAG_NAME;\n this._stateTagName(cp);\n }\n else\n switch (cp) {\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.missingEndTagName);\n this.state = State.DATA;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofBeforeTagName);\n this._emitChars('</');\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.invalidFirstCharacterOfTagName);\n this._createCommentToken(2);\n this.state = State.BOGUS_COMMENT;\n this._stateBogusComment(cp);\n }\n }\n }\n // Tag name state\n //------------------------------------------------------------------\n _stateTagName(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this.state = State.BEFORE_ATTRIBUTE_NAME;\n break;\n }\n case $.SOLIDUS: {\n this.state = State.SELF_CLOSING_START_TAG;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.state = State.DATA;\n this.emitCurrentTagToken();\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n token.tagName += REPLACEMENT_CHARACTER;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInTag);\n this._emitEOFToken();\n break;\n }\n default: {\n token.tagName += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);\n }\n }\n }\n // RCDATA less-than sign state\n //------------------------------------------------------------------\n _stateRcdataLessThanSign(cp) {\n if (cp === $.SOLIDUS) {\n this.state = State.RCDATA_END_TAG_OPEN;\n }\n else {\n this._emitChars('<');\n this.state = State.RCDATA;\n this._stateRcdata(cp);\n }\n }\n // RCDATA end tag open state\n //------------------------------------------------------------------\n _stateRcdataEndTagOpen(cp) {\n if (isAsciiLetter(cp)) {\n this.state = State.RCDATA_END_TAG_NAME;\n this._stateRcdataEndTagName(cp);\n }\n else {\n this._emitChars('</');\n this.state = State.RCDATA;\n this._stateRcdata(cp);\n }\n }\n handleSpecialEndTag(_cp) {\n if (!this.preprocessor.startsWith(this.lastStartTagName, false)) {\n return !this._ensureHibernation();\n }\n this._createEndTagToken();\n const token = this.currentToken;\n token.tagName = this.lastStartTagName;\n const cp = this.preprocessor.peek(this.lastStartTagName.length);\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this._advanceBy(this.lastStartTagName.length);\n this.state = State.BEFORE_ATTRIBUTE_NAME;\n return false;\n }\n case $.SOLIDUS: {\n this._advanceBy(this.lastStartTagName.length);\n this.state = State.SELF_CLOSING_START_TAG;\n return false;\n }\n case $.GREATER_THAN_SIGN: {\n this._advanceBy(this.lastStartTagName.length);\n this.emitCurrentTagToken();\n this.state = State.DATA;\n return false;\n }\n default: {\n return !this._ensureHibernation();\n }\n }\n }\n // RCDATA end tag name state\n //------------------------------------------------------------------\n _stateRcdataEndTagName(cp) {\n if (this.handleSpecialEndTag(cp)) {\n this._emitChars('</');\n this.state = State.RCDATA;\n this._stateRcdata(cp);\n }\n }\n // RAWTEXT less-than sign state\n //------------------------------------------------------------------\n _stateRawtextLessThanSign(cp) {\n if (cp === $.SOLIDUS) {\n this.state = State.RAWTEXT_END_TAG_OPEN;\n }\n else {\n this._emitChars('<');\n this.state = State.RAWTEXT;\n this._stateRawtext(cp);\n }\n }\n // RAWTEXT end tag open state\n //------------------------------------------------------------------\n _stateRawtextEndTagOpen(cp) {\n if (isAsciiLetter(cp)) {\n this.state = State.RAWTEXT_END_TAG_NAME;\n this._stateRawtextEndTagName(cp);\n }\n else {\n this._emitChars('</');\n this.state = State.RAWTEXT;\n this._stateRawtext(cp);\n }\n }\n // RAWTEXT end tag name state\n //------------------------------------------------------------------\n _stateRawtextEndTagName(cp) {\n if (this.handleSpecialEndTag(cp)) {\n this._emitChars('</');\n this.state = State.RAWTEXT;\n this._stateRawtext(cp);\n }\n }\n // Script data less-than sign state\n //------------------------------------------------------------------\n _stateScriptDataLessThanSign(cp) {\n switch (cp) {\n case $.SOLIDUS: {\n this.state = State.SCRIPT_DATA_END_TAG_OPEN;\n break;\n }\n case $.EXCLAMATION_MARK: {\n this.state = State.SCRIPT_DATA_ESCAPE_START;\n this._emitChars('<!');\n break;\n }\n default: {\n this._emitChars('<');\n this.state = State.SCRIPT_DATA;\n this._stateScriptData(cp);\n }\n }\n }\n // Script data end tag open state\n //------------------------------------------------------------------\n _stateScriptDataEndTagOpen(cp) {\n if (isAsciiLetter(cp)) {\n this.state = State.SCRIPT_DATA_END_TAG_NAME;\n this._stateScriptDataEndTagName(cp);\n }\n else {\n this._emitChars('</');\n this.state = State.SCRIPT_DATA;\n this._stateScriptData(cp);\n }\n }\n // Script data end tag name state\n //------------------------------------------------------------------\n _stateScriptDataEndTagName(cp) {\n if (this.handleSpecialEndTag(cp)) {\n this._emitChars('</');\n this.state = State.SCRIPT_DATA;\n this._stateScriptData(cp);\n }\n }\n // Script data escape start state\n //------------------------------------------------------------------\n _stateScriptDataEscapeStart(cp) {\n if (cp === $.HYPHEN_MINUS) {\n this.state = State.SCRIPT_DATA_ESCAPE_START_DASH;\n this._emitChars('-');\n }\n else {\n this.state = State.SCRIPT_DATA;\n this._stateScriptData(cp);\n }\n }\n // Script data escape start dash state\n //------------------------------------------------------------------\n _stateScriptDataEscapeStartDash(cp) {\n if (cp === $.HYPHEN_MINUS) {\n this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH;\n this._emitChars('-');\n }\n else {\n this.state = State.SCRIPT_DATA;\n this._stateScriptData(cp);\n }\n }\n // Script data escaped state\n //------------------------------------------------------------------\n _stateScriptDataEscaped(cp) {\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this.state = State.SCRIPT_DATA_ESCAPED_DASH;\n this._emitChars('-');\n break;\n }\n case $.LESS_THAN_SIGN: {\n this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInScriptHtmlCommentLikeText);\n this._emitEOFToken();\n break;\n }\n default: {\n this._emitCodePoint(cp);\n }\n }\n }\n // Script data escaped dash state\n //------------------------------------------------------------------\n _stateScriptDataEscapedDash(cp) {\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH;\n this._emitChars('-');\n break;\n }\n case $.LESS_THAN_SIGN: {\n this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this.state = State.SCRIPT_DATA_ESCAPED;\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInScriptHtmlCommentLikeText);\n this._emitEOFToken();\n break;\n }\n default: {\n this.state = State.SCRIPT_DATA_ESCAPED;\n this._emitCodePoint(cp);\n }\n }\n }\n // Script data escaped dash dash state\n //------------------------------------------------------------------\n _stateScriptDataEscapedDashDash(cp) {\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this._emitChars('-');\n break;\n }\n case $.LESS_THAN_SIGN: {\n this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.state = State.SCRIPT_DATA;\n this._emitChars('>');\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this.state = State.SCRIPT_DATA_ESCAPED;\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInScriptHtmlCommentLikeText);\n this._emitEOFToken();\n break;\n }\n default: {\n this.state = State.SCRIPT_DATA_ESCAPED;\n this._emitCodePoint(cp);\n }\n }\n }\n // Script data escaped less-than sign state\n //------------------------------------------------------------------\n _stateScriptDataEscapedLessThanSign(cp) {\n if (cp === $.SOLIDUS) {\n this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN;\n }\n else if (isAsciiLetter(cp)) {\n this._emitChars('<');\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_START;\n this._stateScriptDataDoubleEscapeStart(cp);\n }\n else {\n this._emitChars('<');\n this.state = State.SCRIPT_DATA_ESCAPED;\n this._stateScriptDataEscaped(cp);\n }\n }\n // Script data escaped end tag open state\n //------------------------------------------------------------------\n _stateScriptDataEscapedEndTagOpen(cp) {\n if (isAsciiLetter(cp)) {\n this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_NAME;\n this._stateScriptDataEscapedEndTagName(cp);\n }\n else {\n this._emitChars('</');\n this.state = State.SCRIPT_DATA_ESCAPED;\n this._stateScriptDataEscaped(cp);\n }\n }\n // Script data escaped end tag name state\n //------------------------------------------------------------------\n _stateScriptDataEscapedEndTagName(cp) {\n if (this.handleSpecialEndTag(cp)) {\n this._emitChars('</');\n this.state = State.SCRIPT_DATA_ESCAPED;\n this._stateScriptDataEscaped(cp);\n }\n }\n // Script data double escape start state\n //------------------------------------------------------------------\n _stateScriptDataDoubleEscapeStart(cp) {\n if (this.preprocessor.startsWith($$.SCRIPT, false) &&\n isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek($$.SCRIPT.length))) {\n this._emitCodePoint(cp);\n for (let i = 0; i < $$.SCRIPT.length; i++) {\n this._emitCodePoint(this._consume());\n }\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;\n }\n else if (!this._ensureHibernation()) {\n this.state = State.SCRIPT_DATA_ESCAPED;\n this._stateScriptDataEscaped(cp);\n }\n }\n // Script data double escaped state\n //------------------------------------------------------------------\n _stateScriptDataDoubleEscaped(cp) {\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH;\n this._emitChars('-');\n break;\n }\n case $.LESS_THAN_SIGN: {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;\n this._emitChars('<');\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInScriptHtmlCommentLikeText);\n this._emitEOFToken();\n break;\n }\n default: {\n this._emitCodePoint(cp);\n }\n }\n }\n // Script data double escaped dash state\n //------------------------------------------------------------------\n _stateScriptDataDoubleEscapedDash(cp) {\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH;\n this._emitChars('-');\n break;\n }\n case $.LESS_THAN_SIGN: {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;\n this._emitChars('<');\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInScriptHtmlCommentLikeText);\n this._emitEOFToken();\n break;\n }\n default: {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;\n this._emitCodePoint(cp);\n }\n }\n }\n // Script data double escaped dash dash state\n //------------------------------------------------------------------\n _stateScriptDataDoubleEscapedDashDash(cp) {\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this._emitChars('-');\n break;\n }\n case $.LESS_THAN_SIGN: {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;\n this._emitChars('<');\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.state = State.SCRIPT_DATA;\n this._emitChars('>');\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;\n this._emitChars(REPLACEMENT_CHARACTER);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInScriptHtmlCommentLikeText);\n this._emitEOFToken();\n break;\n }\n default: {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;\n this._emitCodePoint(cp);\n }\n }\n }\n // Script data double escaped less-than sign state\n //------------------------------------------------------------------\n _stateScriptDataDoubleEscapedLessThanSign(cp) {\n if (cp === $.SOLIDUS) {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_END;\n this._emitChars('/');\n }\n else {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;\n this._stateScriptDataDoubleEscaped(cp);\n }\n }\n // Script data double escape end state\n //------------------------------------------------------------------\n _stateScriptDataDoubleEscapeEnd(cp) {\n if (this.preprocessor.startsWith($$.SCRIPT, false) &&\n isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek($$.SCRIPT.length))) {\n this._emitCodePoint(cp);\n for (let i = 0; i < $$.SCRIPT.length; i++) {\n this._emitCodePoint(this._consume());\n }\n this.state = State.SCRIPT_DATA_ESCAPED;\n }\n else if (!this._ensureHibernation()) {\n this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;\n this._stateScriptDataDoubleEscaped(cp);\n }\n }\n // Before attribute name state\n //------------------------------------------------------------------\n _stateBeforeAttributeName(cp) {\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.SOLIDUS:\n case $.GREATER_THAN_SIGN:\n case $.EOF: {\n this.state = State.AFTER_ATTRIBUTE_NAME;\n this._stateAfterAttributeName(cp);\n break;\n }\n case $.EQUALS_SIGN: {\n this._err(ERR.unexpectedEqualsSignBeforeAttributeName);\n this._createAttr('=');\n this.state = State.ATTRIBUTE_NAME;\n break;\n }\n default: {\n this._createAttr('');\n this.state = State.ATTRIBUTE_NAME;\n this._stateAttributeName(cp);\n }\n }\n }\n // Attribute name state\n //------------------------------------------------------------------\n _stateAttributeName(cp) {\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED:\n case $.SOLIDUS:\n case $.GREATER_THAN_SIGN:\n case $.EOF: {\n this._leaveAttrName();\n this.state = State.AFTER_ATTRIBUTE_NAME;\n this._stateAfterAttributeName(cp);\n break;\n }\n case $.EQUALS_SIGN: {\n this._leaveAttrName();\n this.state = State.BEFORE_ATTRIBUTE_VALUE;\n break;\n }\n case $.QUOTATION_MARK:\n case $.APOSTROPHE:\n case $.LESS_THAN_SIGN: {\n this._err(ERR.unexpectedCharacterInAttributeName);\n this.currentAttr.name += String.fromCodePoint(cp);\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this.currentAttr.name += REPLACEMENT_CHARACTER;\n break;\n }\n default: {\n this.currentAttr.name += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);\n }\n }\n }\n // After attribute name state\n //------------------------------------------------------------------\n _stateAfterAttributeName(cp) {\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.SOLIDUS: {\n this.state = State.SELF_CLOSING_START_TAG;\n break;\n }\n case $.EQUALS_SIGN: {\n this.state = State.BEFORE_ATTRIBUTE_VALUE;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.state = State.DATA;\n this.emitCurrentTagToken();\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInTag);\n this._emitEOFToken();\n break;\n }\n default: {\n this._createAttr('');\n this.state = State.ATTRIBUTE_NAME;\n this._stateAttributeName(cp);\n }\n }\n }\n // Before attribute value state\n //------------------------------------------------------------------\n _stateBeforeAttributeValue(cp) {\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.QUOTATION_MARK: {\n this.state = State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;\n break;\n }\n case $.APOSTROPHE: {\n this.state = State.ATTRIBUTE_VALUE_SINGLE_QUOTED;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.missingAttributeValue);\n this.state = State.DATA;\n this.emitCurrentTagToken();\n break;\n }\n default: {\n this.state = State.ATTRIBUTE_VALUE_UNQUOTED;\n this._stateAttributeValueUnquoted(cp);\n }\n }\n }\n // Attribute value (double-quoted) state\n //------------------------------------------------------------------\n _stateAttributeValueDoubleQuoted(cp) {\n switch (cp) {\n case $.QUOTATION_MARK: {\n this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;\n break;\n }\n case $.AMPERSAND: {\n this._startCharacterReference();\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this.currentAttr.value += REPLACEMENT_CHARACTER;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInTag);\n this._emitEOFToken();\n break;\n }\n default: {\n this.currentAttr.value += String.fromCodePoint(cp);\n }\n }\n }\n // Attribute value (single-quoted) state\n //------------------------------------------------------------------\n _stateAttributeValueSingleQuoted(cp) {\n switch (cp) {\n case $.APOSTROPHE: {\n this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;\n break;\n }\n case $.AMPERSAND: {\n this._startCharacterReference();\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this.currentAttr.value += REPLACEMENT_CHARACTER;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInTag);\n this._emitEOFToken();\n break;\n }\n default: {\n this.currentAttr.value += String.fromCodePoint(cp);\n }\n }\n }\n // Attribute value (unquoted) state\n //------------------------------------------------------------------\n _stateAttributeValueUnquoted(cp) {\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this._leaveAttrValue();\n this.state = State.BEFORE_ATTRIBUTE_NAME;\n break;\n }\n case $.AMPERSAND: {\n this._startCharacterReference();\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._leaveAttrValue();\n this.state = State.DATA;\n this.emitCurrentTagToken();\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this.currentAttr.value += REPLACEMENT_CHARACTER;\n break;\n }\n case $.QUOTATION_MARK:\n case $.APOSTROPHE:\n case $.LESS_THAN_SIGN:\n case $.EQUALS_SIGN:\n case $.GRAVE_ACCENT: {\n this._err(ERR.unexpectedCharacterInUnquotedAttributeValue);\n this.currentAttr.value += String.fromCodePoint(cp);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInTag);\n this._emitEOFToken();\n break;\n }\n default: {\n this.currentAttr.value += String.fromCodePoint(cp);\n }\n }\n }\n // After attribute value (quoted) state\n //------------------------------------------------------------------\n _stateAfterAttributeValueQuoted(cp) {\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this._leaveAttrValue();\n this.state = State.BEFORE_ATTRIBUTE_NAME;\n break;\n }\n case $.SOLIDUS: {\n this._leaveAttrValue();\n this.state = State.SELF_CLOSING_START_TAG;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._leaveAttrValue();\n this.state = State.DATA;\n this.emitCurrentTagToken();\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInTag);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.missingWhitespaceBetweenAttributes);\n this.state = State.BEFORE_ATTRIBUTE_NAME;\n this._stateBeforeAttributeName(cp);\n }\n }\n }\n // Self-closing start tag state\n //------------------------------------------------------------------\n _stateSelfClosingStartTag(cp) {\n switch (cp) {\n case $.GREATER_THAN_SIGN: {\n const token = this.currentToken;\n token.selfClosing = true;\n this.state = State.DATA;\n this.emitCurrentTagToken();\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInTag);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.unexpectedSolidusInTag);\n this.state = State.BEFORE_ATTRIBUTE_NAME;\n this._stateBeforeAttributeName(cp);\n }\n }\n }\n // Bogus comment state\n //------------------------------------------------------------------\n _stateBogusComment(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.GREATER_THAN_SIGN: {\n this.state = State.DATA;\n this.emitCurrentComment(token);\n break;\n }\n case $.EOF: {\n this.emitCurrentComment(token);\n this._emitEOFToken();\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n token.data += REPLACEMENT_CHARACTER;\n break;\n }\n default: {\n token.data += String.fromCodePoint(cp);\n }\n }\n }\n // Markup declaration open state\n //------------------------------------------------------------------\n _stateMarkupDeclarationOpen(cp) {\n if (this._consumeSequenceIfMatch($$.DASH_DASH, true)) {\n this._createCommentToken($$.DASH_DASH.length + 1);\n this.state = State.COMMENT_START;\n }\n else if (this._consumeSequenceIfMatch($$.DOCTYPE, false)) {\n // NOTE: Doctypes tokens are created without fixed offsets. We keep track of the moment a doctype *might* start here.\n this.currentLocation = this.getCurrentLocation($$.DOCTYPE.length + 1);\n this.state = State.DOCTYPE;\n }\n else if (this._consumeSequenceIfMatch($$.CDATA_START, true)) {\n if (this.inForeignNode) {\n this.state = State.CDATA_SECTION;\n }\n else {\n this._err(ERR.cdataInHtmlContent);\n this._createCommentToken($$.CDATA_START.length + 1);\n this.currentToken.data = '[CDATA[';\n this.state = State.BOGUS_COMMENT;\n }\n }\n //NOTE: Sequence lookups can be abrupted by hibernation. In that case, lookup\n //results are no longer valid and we will need to start over.\n else if (!this._ensureHibernation()) {\n this._err(ERR.incorrectlyOpenedComment);\n this._createCommentToken(2);\n this.state = State.BOGUS_COMMENT;\n this._stateBogusComment(cp);\n }\n }\n // Comment start state\n //------------------------------------------------------------------\n _stateCommentStart(cp) {\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this.state = State.COMMENT_START_DASH;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.abruptClosingOfEmptyComment);\n this.state = State.DATA;\n const token = this.currentToken;\n this.emitCurrentComment(token);\n break;\n }\n default: {\n this.state = State.COMMENT;\n this._stateComment(cp);\n }\n }\n }\n // Comment start dash state\n //------------------------------------------------------------------\n _stateCommentStartDash(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this.state = State.COMMENT_END;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.abruptClosingOfEmptyComment);\n this.state = State.DATA;\n this.emitCurrentComment(token);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInComment);\n this.emitCurrentComment(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.data += '-';\n this.state = State.COMMENT;\n this._stateComment(cp);\n }\n }\n }\n // Comment state\n //------------------------------------------------------------------\n _stateComment(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this.state = State.COMMENT_END_DASH;\n break;\n }\n case $.LESS_THAN_SIGN: {\n token.data += '<';\n this.state = State.COMMENT_LESS_THAN_SIGN;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n token.data += REPLACEMENT_CHARACTER;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInComment);\n this.emitCurrentComment(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.data += String.fromCodePoint(cp);\n }\n }\n }\n // Comment less-than sign state\n //------------------------------------------------------------------\n _stateCommentLessThanSign(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.EXCLAMATION_MARK: {\n token.data += '!';\n this.state = State.COMMENT_LESS_THAN_SIGN_BANG;\n break;\n }\n case $.LESS_THAN_SIGN: {\n token.data += '<';\n break;\n }\n default: {\n this.state = State.COMMENT;\n this._stateComment(cp);\n }\n }\n }\n // Comment less-than sign bang state\n //------------------------------------------------------------------\n _stateCommentLessThanSignBang(cp) {\n if (cp === $.HYPHEN_MINUS) {\n this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH;\n }\n else {\n this.state = State.COMMENT;\n this._stateComment(cp);\n }\n }\n // Comment less-than sign bang dash state\n //------------------------------------------------------------------\n _stateCommentLessThanSignBangDash(cp) {\n if (cp === $.HYPHEN_MINUS) {\n this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH;\n }\n else {\n this.state = State.COMMENT_END_DASH;\n this._stateCommentEndDash(cp);\n }\n }\n // Comment less-than sign bang dash dash state\n //------------------------------------------------------------------\n _stateCommentLessThanSignBangDashDash(cp) {\n if (cp !== $.GREATER_THAN_SIGN && cp !== $.EOF) {\n this._err(ERR.nestedComment);\n }\n this.state = State.COMMENT_END;\n this._stateCommentEnd(cp);\n }\n // Comment end dash state\n //------------------------------------------------------------------\n _stateCommentEndDash(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.HYPHEN_MINUS: {\n this.state = State.COMMENT_END;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInComment);\n this.emitCurrentComment(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.data += '-';\n this.state = State.COMMENT;\n this._stateComment(cp);\n }\n }\n }\n // Comment end state\n //------------------------------------------------------------------\n _stateCommentEnd(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.GREATER_THAN_SIGN: {\n this.state = State.DATA;\n this.emitCurrentComment(token);\n break;\n }\n case $.EXCLAMATION_MARK: {\n this.state = State.COMMENT_END_BANG;\n break;\n }\n case $.HYPHEN_MINUS: {\n token.data += '-';\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInComment);\n this.emitCurrentComment(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.data += '--';\n this.state = State.COMMENT;\n this._stateComment(cp);\n }\n }\n }\n // Comment end bang state\n //------------------------------------------------------------------\n _stateCommentEndBang(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.HYPHEN_MINUS: {\n token.data += '--!';\n this.state = State.COMMENT_END_DASH;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.incorrectlyClosedComment);\n this.state = State.DATA;\n this.emitCurrentComment(token);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInComment);\n this.emitCurrentComment(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.data += '--!';\n this.state = State.COMMENT;\n this._stateComment(cp);\n }\n }\n }\n // DOCTYPE state\n //------------------------------------------------------------------\n _stateDoctype(cp) {\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this.state = State.BEFORE_DOCTYPE_NAME;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.state = State.BEFORE_DOCTYPE_NAME;\n this._stateBeforeDoctypeName(cp);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n this._createDoctypeToken(null);\n const token = this.currentToken;\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.missingWhitespaceBeforeDoctypeName);\n this.state = State.BEFORE_DOCTYPE_NAME;\n this._stateBeforeDoctypeName(cp);\n }\n }\n }\n // Before DOCTYPE name state\n //------------------------------------------------------------------\n _stateBeforeDoctypeName(cp) {\n if (isAsciiUpper(cp)) {\n this._createDoctypeToken(String.fromCharCode(toAsciiLower(cp)));\n this.state = State.DOCTYPE_NAME;\n }\n else\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n this._createDoctypeToken(REPLACEMENT_CHARACTER);\n this.state = State.DOCTYPE_NAME;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.missingDoctypeName);\n this._createDoctypeToken(null);\n const token = this.currentToken;\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this.state = State.DATA;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n this._createDoctypeToken(null);\n const token = this.currentToken;\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._createDoctypeToken(String.fromCodePoint(cp));\n this.state = State.DOCTYPE_NAME;\n }\n }\n }\n // DOCTYPE name state\n //------------------------------------------------------------------\n _stateDoctypeName(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this.state = State.AFTER_DOCTYPE_NAME;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.state = State.DATA;\n this.emitCurrentDoctype(token);\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n token.name += REPLACEMENT_CHARACTER;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.name += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);\n }\n }\n }\n // After DOCTYPE name state\n //------------------------------------------------------------------\n _stateAfterDoctypeName(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.state = State.DATA;\n this.emitCurrentDoctype(token);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n if (this._consumeSequenceIfMatch($$.PUBLIC, false)) {\n this.state = State.AFTER_DOCTYPE_PUBLIC_KEYWORD;\n }\n else if (this._consumeSequenceIfMatch($$.SYSTEM, false)) {\n this.state = State.AFTER_DOCTYPE_SYSTEM_KEYWORD;\n }\n //NOTE: sequence lookup can be abrupted by hibernation. In that case lookup\n //results are no longer valid and we will need to start over.\n else if (!this._ensureHibernation()) {\n this._err(ERR.invalidCharacterSequenceAfterDoctypeName);\n token.forceQuirks = true;\n this.state = State.BOGUS_DOCTYPE;\n this._stateBogusDoctype(cp);\n }\n }\n }\n }\n // After DOCTYPE public keyword state\n //------------------------------------------------------------------\n _stateAfterDoctypePublicKeyword(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this.state = State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;\n break;\n }\n case $.QUOTATION_MARK: {\n this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);\n token.publicId = '';\n this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;\n break;\n }\n case $.APOSTROPHE: {\n this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);\n token.publicId = '';\n this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.missingDoctypePublicIdentifier);\n token.forceQuirks = true;\n this.state = State.DATA;\n this.emitCurrentDoctype(token);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);\n token.forceQuirks = true;\n this.state = State.BOGUS_DOCTYPE;\n this._stateBogusDoctype(cp);\n }\n }\n }\n // Before DOCTYPE public identifier state\n //------------------------------------------------------------------\n _stateBeforeDoctypePublicIdentifier(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.QUOTATION_MARK: {\n token.publicId = '';\n this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;\n break;\n }\n case $.APOSTROPHE: {\n token.publicId = '';\n this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.missingDoctypePublicIdentifier);\n token.forceQuirks = true;\n this.state = State.DATA;\n this.emitCurrentDoctype(token);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);\n token.forceQuirks = true;\n this.state = State.BOGUS_DOCTYPE;\n this._stateBogusDoctype(cp);\n }\n }\n }\n // DOCTYPE public identifier (double-quoted) state\n //------------------------------------------------------------------\n _stateDoctypePublicIdentifierDoubleQuoted(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.QUOTATION_MARK: {\n this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n token.publicId += REPLACEMENT_CHARACTER;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.abruptDoctypePublicIdentifier);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this.state = State.DATA;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.publicId += String.fromCodePoint(cp);\n }\n }\n }\n // DOCTYPE public identifier (single-quoted) state\n //------------------------------------------------------------------\n _stateDoctypePublicIdentifierSingleQuoted(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.APOSTROPHE: {\n this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n token.publicId += REPLACEMENT_CHARACTER;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.abruptDoctypePublicIdentifier);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this.state = State.DATA;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.publicId += String.fromCodePoint(cp);\n }\n }\n }\n // After DOCTYPE public identifier state\n //------------------------------------------------------------------\n _stateAfterDoctypePublicIdentifier(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this.state = State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.state = State.DATA;\n this.emitCurrentDoctype(token);\n break;\n }\n case $.QUOTATION_MARK: {\n this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);\n token.systemId = '';\n this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;\n break;\n }\n case $.APOSTROPHE: {\n this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);\n token.systemId = '';\n this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);\n token.forceQuirks = true;\n this.state = State.BOGUS_DOCTYPE;\n this._stateBogusDoctype(cp);\n }\n }\n }\n // Between DOCTYPE public and system identifiers state\n //------------------------------------------------------------------\n _stateBetweenDoctypePublicAndSystemIdentifiers(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.emitCurrentDoctype(token);\n this.state = State.DATA;\n break;\n }\n case $.QUOTATION_MARK: {\n token.systemId = '';\n this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;\n break;\n }\n case $.APOSTROPHE: {\n token.systemId = '';\n this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);\n token.forceQuirks = true;\n this.state = State.BOGUS_DOCTYPE;\n this._stateBogusDoctype(cp);\n }\n }\n }\n // After DOCTYPE system keyword state\n //------------------------------------------------------------------\n _stateAfterDoctypeSystemKeyword(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n this.state = State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;\n break;\n }\n case $.QUOTATION_MARK: {\n this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);\n token.systemId = '';\n this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;\n break;\n }\n case $.APOSTROPHE: {\n this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);\n token.systemId = '';\n this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.missingDoctypeSystemIdentifier);\n token.forceQuirks = true;\n this.state = State.DATA;\n this.emitCurrentDoctype(token);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);\n token.forceQuirks = true;\n this.state = State.BOGUS_DOCTYPE;\n this._stateBogusDoctype(cp);\n }\n }\n }\n // Before DOCTYPE system identifier state\n //------------------------------------------------------------------\n _stateBeforeDoctypeSystemIdentifier(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.QUOTATION_MARK: {\n token.systemId = '';\n this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;\n break;\n }\n case $.APOSTROPHE: {\n token.systemId = '';\n this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.missingDoctypeSystemIdentifier);\n token.forceQuirks = true;\n this.state = State.DATA;\n this.emitCurrentDoctype(token);\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);\n token.forceQuirks = true;\n this.state = State.BOGUS_DOCTYPE;\n this._stateBogusDoctype(cp);\n }\n }\n }\n // DOCTYPE system identifier (double-quoted) state\n //------------------------------------------------------------------\n _stateDoctypeSystemIdentifierDoubleQuoted(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.QUOTATION_MARK: {\n this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n token.systemId += REPLACEMENT_CHARACTER;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.abruptDoctypeSystemIdentifier);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this.state = State.DATA;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.systemId += String.fromCodePoint(cp);\n }\n }\n }\n // DOCTYPE system identifier (single-quoted) state\n //------------------------------------------------------------------\n _stateDoctypeSystemIdentifierSingleQuoted(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.APOSTROPHE: {\n this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n token.systemId += REPLACEMENT_CHARACTER;\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this._err(ERR.abruptDoctypeSystemIdentifier);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this.state = State.DATA;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n token.systemId += String.fromCodePoint(cp);\n }\n }\n }\n // After DOCTYPE system identifier state\n //------------------------------------------------------------------\n _stateAfterDoctypeSystemIdentifier(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.SPACE:\n case $.LINE_FEED:\n case $.TABULATION:\n case $.FORM_FEED: {\n // Ignore whitespace\n break;\n }\n case $.GREATER_THAN_SIGN: {\n this.emitCurrentDoctype(token);\n this.state = State.DATA;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInDoctype);\n token.forceQuirks = true;\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default: {\n this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier);\n this.state = State.BOGUS_DOCTYPE;\n this._stateBogusDoctype(cp);\n }\n }\n }\n // Bogus DOCTYPE state\n //------------------------------------------------------------------\n _stateBogusDoctype(cp) {\n const token = this.currentToken;\n switch (cp) {\n case $.GREATER_THAN_SIGN: {\n this.emitCurrentDoctype(token);\n this.state = State.DATA;\n break;\n }\n case $.NULL: {\n this._err(ERR.unexpectedNullCharacter);\n break;\n }\n case $.EOF: {\n this.emitCurrentDoctype(token);\n this._emitEOFToken();\n break;\n }\n default:\n // Do nothing\n }\n }\n // CDATA section state\n //------------------------------------------------------------------\n _stateCdataSection(cp) {\n switch (cp) {\n case $.RIGHT_SQUARE_BRACKET: {\n this.state = State.CDATA_SECTION_BRACKET;\n break;\n }\n case $.EOF: {\n this._err(ERR.eofInCdata);\n this._emitEOFToken();\n break;\n }\n default: {\n this._emitCodePoint(cp);\n }\n }\n }\n // CDATA section bracket state\n //------------------------------------------------------------------\n _stateCdataSectionBracket(cp) {\n if (cp === $.RIGHT_SQUARE_BRACKET) {\n this.state = State.CDATA_SECTION_END;\n }\n else {\n this._emitChars(']');\n this.state = State.CDATA_SECTION;\n this._stateCdataSection(cp);\n }\n }\n // CDATA section end state\n //------------------------------------------------------------------\n _stateCdataSectionEnd(cp) {\n switch (cp) {\n case $.GREATER_THAN_SIGN: {\n this.state = State.DATA;\n break;\n }\n case $.RIGHT_SQUARE_BRACKET: {\n this._emitChars(']');\n break;\n }\n default: {\n this._emitChars(']]');\n this.state = State.CDATA_SECTION;\n this._stateCdataSection(cp);\n }\n }\n }\n // Character reference state\n //------------------------------------------------------------------\n _stateCharacterReference() {\n let length = this.entityDecoder.write(this.preprocessor.html, this.preprocessor.pos);\n if (length < 0) {\n if (this.preprocessor.lastChunkWritten) {\n length = this.entityDecoder.end();\n }\n else {\n // Wait for the rest of the entity.\n this.active = false;\n // Mark the entire buffer as read.\n this.preprocessor.pos = this.preprocessor.html.length - 1;\n this.consumedAfterSnapshot = 0;\n this.preprocessor.endOfChunkHit = true;\n return;\n }\n }\n if (length === 0) {\n // This was not a valid entity. Go back to the beginning, and\n // figure out what to do.\n this.preprocessor.pos = this.entityStartPos;\n this._flushCodePointConsumedAsCharacterReference($.AMPERSAND);\n this.state =\n !this._isCharacterReferenceInAttribute() && isAsciiAlphaNumeric(this.preprocessor.peek(1))\n ? State.AMBIGUOUS_AMPERSAND\n : this.returnState;\n }\n else {\n // We successfully parsed an entity. Switch to the return state.\n this.state = this.returnState;\n }\n }\n // Ambiguos ampersand state\n //------------------------------------------------------------------\n _stateAmbiguousAmpersand(cp) {\n if (isAsciiAlphaNumeric(cp)) {\n this._flushCodePointConsumedAsCharacterReference(cp);\n }\n else {\n if (cp === $.SEMICOLON) {\n this._err(ERR.unknownNamedCharacterReference);\n }\n this.state = this.returnState;\n this._callState(cp);\n }\n }\n}\n","import { TAG_ID as $, NS, NUMBERED_HEADERS } from '../common/html.js';\n//Element utils\nconst IMPLICIT_END_TAG_REQUIRED = new Set([$.DD, $.DT, $.LI, $.OPTGROUP, $.OPTION, $.P, $.RB, $.RP, $.RT, $.RTC]);\nconst IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = new Set([\n ...IMPLICIT_END_TAG_REQUIRED,\n $.CAPTION,\n $.COLGROUP,\n $.TBODY,\n $.TD,\n $.TFOOT,\n $.TH,\n $.THEAD,\n $.TR,\n]);\nconst SCOPING_ELEMENTS_HTML = new Set([\n $.APPLET,\n $.CAPTION,\n $.HTML,\n $.MARQUEE,\n $.OBJECT,\n $.TABLE,\n $.TD,\n $.TEMPLATE,\n $.TH,\n]);\nconst SCOPING_ELEMENTS_HTML_LIST = new Set([...SCOPING_ELEMENTS_HTML, $.OL, $.UL]);\nconst SCOPING_ELEMENTS_HTML_BUTTON = new Set([...SCOPING_ELEMENTS_HTML, $.BUTTON]);\nconst SCOPING_ELEMENTS_MATHML = new Set([$.ANNOTATION_XML, $.MI, $.MN, $.MO, $.MS, $.MTEXT]);\nconst SCOPING_ELEMENTS_SVG = new Set([$.DESC, $.FOREIGN_OBJECT, $.TITLE]);\nconst TABLE_ROW_CONTEXT = new Set([$.TR, $.TEMPLATE, $.HTML]);\nconst TABLE_BODY_CONTEXT = new Set([$.TBODY, $.TFOOT, $.THEAD, $.TEMPLATE, $.HTML]);\nconst TABLE_CONTEXT = new Set([$.TABLE, $.TEMPLATE, $.HTML]);\nconst TABLE_CELLS = new Set([$.TD, $.TH]);\n//Stack of open elements\nexport class OpenElementStack {\n get currentTmplContentOrNode() {\n return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;\n }\n constructor(document, treeAdapter, handler) {\n this.treeAdapter = treeAdapter;\n this.handler = handler;\n this.items = [];\n this.tagIDs = [];\n this.stackTop = -1;\n this.tmplCount = 0;\n this.currentTagId = $.UNKNOWN;\n this.current = document;\n }\n //Index of element\n _indexOf(element) {\n return this.items.lastIndexOf(element, this.stackTop);\n }\n //Update current element\n _isInTemplate() {\n return this.currentTagId === $.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML;\n }\n _updateCurrentElement() {\n this.current = this.items[this.stackTop];\n this.currentTagId = this.tagIDs[this.stackTop];\n }\n //Mutations\n push(element, tagID) {\n this.stackTop++;\n this.items[this.stackTop] = element;\n this.current = element;\n this.tagIDs[this.stackTop] = tagID;\n this.currentTagId = tagID;\n if (this._isInTemplate()) {\n this.tmplCount++;\n }\n this.handler.onItemPush(element, tagID, true);\n }\n pop() {\n const popped = this.current;\n if (this.tmplCount > 0 && this._isInTemplate()) {\n this.tmplCount--;\n }\n this.stackTop--;\n this._updateCurrentElement();\n this.handler.onItemPop(popped, true);\n }\n replace(oldElement, newElement) {\n const idx = this._indexOf(oldElement);\n this.items[idx] = newElement;\n if (idx === this.stackTop) {\n this.current = newElement;\n }\n }\n insertAfter(referenceElement, newElement, newElementID) {\n const insertionIdx = this._indexOf(referenceElement) + 1;\n this.items.splice(insertionIdx, 0, newElement);\n this.tagIDs.splice(insertionIdx, 0, newElementID);\n this.stackTop++;\n if (insertionIdx === this.stackTop) {\n this._updateCurrentElement();\n }\n if (this.current && this.currentTagId !== undefined) {\n this.handler.onItemPush(this.current, this.currentTagId, insertionIdx === this.stackTop);\n }\n }\n popUntilTagNamePopped(tagName) {\n let targetIdx = this.stackTop + 1;\n do {\n targetIdx = this.tagIDs.lastIndexOf(tagName, targetIdx - 1);\n } while (targetIdx > 0 && this.treeAdapter.getNamespaceURI(this.items[targetIdx]) !== NS.HTML);\n this.shortenToLength(Math.max(targetIdx, 0));\n }\n shortenToLength(idx) {\n while (this.stackTop >= idx) {\n const popped = this.current;\n if (this.tmplCount > 0 && this._isInTemplate()) {\n this.tmplCount -= 1;\n }\n this.stackTop--;\n this._updateCurrentElement();\n this.handler.onItemPop(popped, this.stackTop < idx);\n }\n }\n popUntilElementPopped(element) {\n const idx = this._indexOf(element);\n this.shortenToLength(Math.max(idx, 0));\n }\n popUntilPopped(tagNames, targetNS) {\n const idx = this._indexOfTagNames(tagNames, targetNS);\n this.shortenToLength(Math.max(idx, 0));\n }\n popUntilNumberedHeaderPopped() {\n this.popUntilPopped(NUMBERED_HEADERS, NS.HTML);\n }\n popUntilTableCellPopped() {\n this.popUntilPopped(TABLE_CELLS, NS.HTML);\n }\n popAllUpToHtmlElement() {\n //NOTE: here we assume that the root <html> element is always first in the open element stack, so\n //we perform this fast stack clean up.\n this.tmplCount = 0;\n this.shortenToLength(1);\n }\n _indexOfTagNames(tagNames, namespace) {\n for (let i = this.stackTop; i >= 0; i--) {\n if (tagNames.has(this.tagIDs[i]) && this.treeAdapter.getNamespaceURI(this.items[i]) === namespace) {\n return i;\n }\n }\n return -1;\n }\n clearBackTo(tagNames, targetNS) {\n const idx = this._indexOfTagNames(tagNames, targetNS);\n this.shortenToLength(idx + 1);\n }\n clearBackToTableContext() {\n this.clearBackTo(TABLE_CONTEXT, NS.HTML);\n }\n clearBackToTableBodyContext() {\n this.clearBackTo(TABLE_BODY_CONTEXT, NS.HTML);\n }\n clearBackToTableRowContext() {\n this.clearBackTo(TABLE_ROW_CONTEXT, NS.HTML);\n }\n remove(element) {\n const idx = this._indexOf(element);\n if (idx >= 0) {\n if (idx === this.stackTop) {\n this.pop();\n }\n else {\n this.items.splice(idx, 1);\n this.tagIDs.splice(idx, 1);\n this.stackTop--;\n this._updateCurrentElement();\n this.handler.onItemPop(element, false);\n }\n }\n }\n //Search\n tryPeekProperlyNestedBodyElement() {\n //Properly nested <body> element (should be second element in stack).\n return this.stackTop >= 1 && this.tagIDs[1] === $.BODY ? this.items[1] : null;\n }\n contains(element) {\n return this._indexOf(element) > -1;\n }\n getCommonAncestor(element) {\n const elementIdx = this._indexOf(element) - 1;\n return elementIdx >= 0 ? this.items[elementIdx] : null;\n }\n isRootHtmlElementCurrent() {\n return this.stackTop === 0 && this.tagIDs[0] === $.HTML;\n }\n //Element in scope\n hasInDynamicScope(tagName, htmlScope) {\n for (let i = this.stackTop; i >= 0; i--) {\n const tn = this.tagIDs[i];\n switch (this.treeAdapter.getNamespaceURI(this.items[i])) {\n case NS.HTML: {\n if (tn === tagName)\n return true;\n if (htmlScope.has(tn))\n return false;\n break;\n }\n case NS.SVG: {\n if (SCOPING_ELEMENTS_SVG.has(tn))\n return false;\n break;\n }\n case NS.MATHML: {\n if (SCOPING_ELEMENTS_MATHML.has(tn))\n return false;\n break;\n }\n }\n }\n return true;\n }\n hasInScope(tagName) {\n return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML);\n }\n hasInListItemScope(tagName) {\n return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML_LIST);\n }\n hasInButtonScope(tagName) {\n return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML_BUTTON);\n }\n hasNumberedHeaderInScope() {\n for (let i = this.stackTop; i >= 0; i--) {\n const tn = this.tagIDs[i];\n switch (this.treeAdapter.getNamespaceURI(this.items[i])) {\n case NS.HTML: {\n if (NUMBERED_HEADERS.has(tn))\n return true;\n if (SCOPING_ELEMENTS_HTML.has(tn))\n return false;\n break;\n }\n case NS.SVG: {\n if (SCOPING_ELEMENTS_SVG.has(tn))\n return false;\n break;\n }\n case NS.MATHML: {\n if (SCOPING_ELEMENTS_MATHML.has(tn))\n return false;\n break;\n }\n }\n }\n return true;\n }\n hasInTableScope(tagName) {\n for (let i = this.stackTop; i >= 0; i--) {\n if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {\n continue;\n }\n switch (this.tagIDs[i]) {\n case tagName: {\n return true;\n }\n case $.TABLE:\n case $.HTML: {\n return false;\n }\n }\n }\n return true;\n }\n hasTableBodyContextInTableScope() {\n for (let i = this.stackTop; i >= 0; i--) {\n if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {\n continue;\n }\n switch (this.tagIDs[i]) {\n case $.TBODY:\n case $.THEAD:\n case $.TFOOT: {\n return true;\n }\n case $.TABLE:\n case $.HTML: {\n return false;\n }\n }\n }\n return true;\n }\n hasInSelectScope(tagName) {\n for (let i = this.stackTop; i >= 0; i--) {\n if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {\n continue;\n }\n switch (this.tagIDs[i]) {\n case tagName: {\n return true;\n }\n case $.OPTION:\n case $.OPTGROUP: {\n break;\n }\n default: {\n return false;\n }\n }\n }\n return true;\n }\n //Implied end tags\n generateImpliedEndTags() {\n while (this.currentTagId !== undefined && IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId)) {\n this.pop();\n }\n }\n generateImpliedEndTagsThoroughly() {\n while (this.currentTagId !== undefined && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {\n this.pop();\n }\n }\n generateImpliedEndTagsWithExclusion(exclusionId) {\n while (this.currentTagId !== undefined &&\n this.currentTagId !== exclusionId &&\n IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {\n this.pop();\n }\n }\n}\n","//Const\nconst NOAH_ARK_CAPACITY = 3;\nexport var EntryType;\n(function (EntryType) {\n EntryType[EntryType[\"Marker\"] = 0] = \"Marker\";\n EntryType[EntryType[\"Element\"] = 1] = \"Element\";\n})(EntryType || (EntryType = {}));\nconst MARKER = { type: EntryType.Marker };\n//List of formatting elements\nexport class FormattingElementList {\n constructor(treeAdapter) {\n this.treeAdapter = treeAdapter;\n this.entries = [];\n this.bookmark = null;\n }\n //Noah Ark's condition\n //OPTIMIZATION: at first we try to find possible candidates for exclusion using\n //lightweight heuristics without thorough attributes check.\n _getNoahArkConditionCandidates(newElement, neAttrs) {\n const candidates = [];\n const neAttrsLength = neAttrs.length;\n const neTagName = this.treeAdapter.getTagName(newElement);\n const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement);\n for (let i = 0; i < this.entries.length; i++) {\n const entry = this.entries[i];\n if (entry.type === EntryType.Marker) {\n break;\n }\n const { element } = entry;\n if (this.treeAdapter.getTagName(element) === neTagName &&\n this.treeAdapter.getNamespaceURI(element) === neNamespaceURI) {\n const elementAttrs = this.treeAdapter.getAttrList(element);\n if (elementAttrs.length === neAttrsLength) {\n candidates.push({ idx: i, attrs: elementAttrs });\n }\n }\n }\n return candidates;\n }\n _ensureNoahArkCondition(newElement) {\n if (this.entries.length < NOAH_ARK_CAPACITY)\n return;\n const neAttrs = this.treeAdapter.getAttrList(newElement);\n const candidates = this._getNoahArkConditionCandidates(newElement, neAttrs);\n if (candidates.length < NOAH_ARK_CAPACITY)\n return;\n //NOTE: build attrs map for the new element, so we can perform fast lookups\n const neAttrsMap = new Map(neAttrs.map((neAttr) => [neAttr.name, neAttr.value]));\n let validCandidates = 0;\n //NOTE: remove bottommost candidates, until Noah's Ark condition will not be met\n for (let i = 0; i < candidates.length; i++) {\n const candidate = candidates[i];\n // We know that `candidate.attrs.length === neAttrs.length`\n if (candidate.attrs.every((cAttr) => neAttrsMap.get(cAttr.name) === cAttr.value)) {\n validCandidates += 1;\n if (validCandidates >= NOAH_ARK_CAPACITY) {\n this.entries.splice(candidate.idx, 1);\n }\n }\n }\n }\n //Mutations\n insertMarker() {\n this.entries.unshift(MARKER);\n }\n pushElement(element, token) {\n this._ensureNoahArkCondition(element);\n this.entries.unshift({\n type: EntryType.Element,\n element,\n token,\n });\n }\n insertElementAfterBookmark(element, token) {\n const bookmarkIdx = this.entries.indexOf(this.bookmark);\n this.entries.splice(bookmarkIdx, 0, {\n type: EntryType.Element,\n element,\n token,\n });\n }\n removeEntry(entry) {\n const entryIndex = this.entries.indexOf(entry);\n if (entryIndex !== -1) {\n this.entries.splice(entryIndex, 1);\n }\n }\n /**\n * Clears the list of formatting elements up to the last marker.\n *\n * @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker\n */\n clearToLastMarker() {\n const markerIdx = this.entries.indexOf(MARKER);\n if (markerIdx === -1) {\n this.entries.length = 0;\n }\n else {\n this.entries.splice(0, markerIdx + 1);\n }\n }\n //Search\n getElementEntryInScopeWithTagName(tagName) {\n const entry = this.entries.find((entry) => entry.type === EntryType.Marker || this.treeAdapter.getTagName(entry.element) === tagName);\n return entry && entry.type === EntryType.Element ? entry : null;\n }\n getElementEntry(element) {\n return this.entries.find((entry) => entry.type === EntryType.Element && entry.element === element);\n }\n}\n","import { DOCUMENT_MODE } from '../common/html.js';\nexport const defaultTreeAdapter = {\n //Node construction\n createDocument() {\n return {\n nodeName: '#document',\n mode: DOCUMENT_MODE.NO_QUIRKS,\n childNodes: [],\n };\n },\n createDocumentFragment() {\n return {\n nodeName: '#document-fragment',\n childNodes: [],\n };\n },\n createElement(tagName, namespaceURI, attrs) {\n return {\n nodeName: tagName,\n tagName,\n attrs,\n namespaceURI,\n childNodes: [],\n parentNode: null,\n };\n },\n createCommentNode(data) {\n return {\n nodeName: '#comment',\n data,\n parentNode: null,\n };\n },\n createTextNode(value) {\n return {\n nodeName: '#text',\n value,\n parentNode: null,\n };\n },\n //Tree mutation\n appendChild(parentNode, newNode) {\n parentNode.childNodes.push(newNode);\n newNode.parentNode = parentNode;\n },\n insertBefore(parentNode, newNode, referenceNode) {\n const insertionIdx = parentNode.childNodes.indexOf(referenceNode);\n parentNode.childNodes.splice(insertionIdx, 0, newNode);\n newNode.parentNode = parentNode;\n },\n setTemplateContent(templateElement, contentElement) {\n templateElement.content = contentElement;\n },\n getTemplateContent(templateElement) {\n return templateElement.content;\n },\n setDocumentType(document, name, publicId, systemId) {\n const doctypeNode = document.childNodes.find((node) => node.nodeName === '#documentType');\n if (doctypeNode) {\n doctypeNode.name = name;\n doctypeNode.publicId = publicId;\n doctypeNode.systemId = systemId;\n }\n else {\n const node = {\n nodeName: '#documentType',\n name,\n publicId,\n systemId,\n parentNode: null,\n };\n defaultTreeAdapter.appendChild(document, node);\n }\n },\n setDocumentMode(document, mode) {\n document.mode = mode;\n },\n getDocumentMode(document) {\n return document.mode;\n },\n detachNode(node) {\n if (node.parentNode) {\n const idx = node.parentNode.childNodes.indexOf(node);\n node.parentNode.childNodes.splice(idx, 1);\n node.parentNode = null;\n }\n },\n insertText(parentNode, text) {\n if (parentNode.childNodes.length > 0) {\n const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1];\n if (defaultTreeAdapter.isTextNode(prevNode)) {\n prevNode.value += text;\n return;\n }\n }\n defaultTreeAdapter.appendChild(parentNode, defaultTreeAdapter.createTextNode(text));\n },\n insertTextBefore(parentNode, text, referenceNode) {\n const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];\n if (prevNode && defaultTreeAdapter.isTextNode(prevNode)) {\n prevNode.value += text;\n }\n else {\n defaultTreeAdapter.insertBefore(parentNode, defaultTreeAdapter.createTextNode(text), referenceNode);\n }\n },\n adoptAttributes(recipient, attrs) {\n const recipientAttrsMap = new Set(recipient.attrs.map((attr) => attr.name));\n for (let j = 0; j < attrs.length; j++) {\n if (!recipientAttrsMap.has(attrs[j].name)) {\n recipient.attrs.push(attrs[j]);\n }\n }\n },\n //Tree traversing\n getFirstChild(node) {\n return node.childNodes[0];\n },\n getChildNodes(node) {\n return node.childNodes;\n },\n getParentNode(node) {\n return node.parentNode;\n },\n getAttrList(element) {\n return element.attrs;\n },\n //Node data\n getTagName(element) {\n return element.tagName;\n },\n getNamespaceURI(element) {\n return element.namespaceURI;\n },\n getTextNodeContent(textNode) {\n return textNode.value;\n },\n getCommentNodeContent(commentNode) {\n return commentNode.data;\n },\n getDocumentTypeNodeName(doctypeNode) {\n return doctypeNode.name;\n },\n getDocumentTypeNodePublicId(doctypeNode) {\n return doctypeNode.publicId;\n },\n getDocumentTypeNodeSystemId(doctypeNode) {\n return doctypeNode.systemId;\n },\n //Node types\n isTextNode(node) {\n return node.nodeName === '#text';\n },\n isCommentNode(node) {\n return node.nodeName === '#comment';\n },\n isDocumentTypeNode(node) {\n return node.nodeName === '#documentType';\n },\n isElementNode(node) {\n return Object.prototype.hasOwnProperty.call(node, 'tagName');\n },\n // Source code location\n setNodeSourceCodeLocation(node, location) {\n node.sourceCodeLocation = location;\n },\n getNodeSourceCodeLocation(node) {\n return node.sourceCodeLocation;\n },\n updateNodeSourceCodeLocation(node, endLocation) {\n node.sourceCodeLocation = { ...node.sourceCodeLocation, ...endLocation };\n },\n};\n","import { DOCUMENT_MODE } from './html.js';\n//Const\nconst VALID_DOCTYPE_NAME = 'html';\nconst VALID_SYSTEM_ID = 'about:legacy-compat';\nconst QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd';\nconst QUIRKS_MODE_PUBLIC_ID_PREFIXES = [\n '+//silmaril//dtd html pro v0r11 19970101//',\n '-//as//dtd html 3.0 aswedit + extensions//',\n '-//advasoft ltd//dtd html 3.0 aswedit + extensions//',\n '-//ietf//dtd html 2.0 level 1//',\n '-//ietf//dtd html 2.0 level 2//',\n '-//ietf//dtd html 2.0 strict level 1//',\n '-//ietf//dtd html 2.0 strict level 2//',\n '-//ietf//dtd html 2.0 strict//',\n '-//ietf//dtd html 2.0//',\n '-//ietf//dtd html 2.1e//',\n '-//ietf//dtd html 3.0//',\n '-//ietf//dtd html 3.2 final//',\n '-//ietf//dtd html 3.2//',\n '-//ietf//dtd html 3//',\n '-//ietf//dtd html level 0//',\n '-//ietf//dtd html level 1//',\n '-//ietf//dtd html level 2//',\n '-//ietf//dtd html level 3//',\n '-//ietf//dtd html strict level 0//',\n '-//ietf//dtd html strict level 1//',\n '-//ietf//dtd html strict level 2//',\n '-//ietf//dtd html strict level 3//',\n '-//ietf//dtd html strict//',\n '-//ietf//dtd html//',\n '-//metrius//dtd metrius presentational//',\n '-//microsoft//dtd internet explorer 2.0 html strict//',\n '-//microsoft//dtd internet explorer 2.0 html//',\n '-//microsoft//dtd internet explorer 2.0 tables//',\n '-//microsoft//dtd internet explorer 3.0 html strict//',\n '-//microsoft//dtd internet explorer 3.0 html//',\n '-//microsoft//dtd internet explorer 3.0 tables//',\n '-//netscape comm. corp.//dtd html//',\n '-//netscape comm. corp.//dtd strict html//',\n \"-//o'reilly and associates//dtd html 2.0//\",\n \"-//o'reilly and associates//dtd html extended 1.0//\",\n \"-//o'reilly and associates//dtd html extended relaxed 1.0//\",\n '-//sq//dtd html 2.0 hotmetal + extensions//',\n '-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//',\n '-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//',\n '-//spyglass//dtd html 2.0 extended//',\n '-//sun microsystems corp.//dtd hotjava html//',\n '-//sun microsystems corp.//dtd hotjava strict html//',\n '-//w3c//dtd html 3 1995-03-24//',\n '-//w3c//dtd html 3.2 draft//',\n '-//w3c//dtd html 3.2 final//',\n '-//w3c//dtd html 3.2//',\n '-//w3c//dtd html 3.2s draft//',\n '-//w3c//dtd html 4.0 frameset//',\n '-//w3c//dtd html 4.0 transitional//',\n '-//w3c//dtd html experimental 19960712//',\n '-//w3c//dtd html experimental 970421//',\n '-//w3c//dtd w3 html//',\n '-//w3o//dtd w3 html 3.0//',\n '-//webtechs//dtd mozilla html 2.0//',\n '-//webtechs//dtd mozilla html//',\n];\nconst QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = [\n ...QUIRKS_MODE_PUBLIC_ID_PREFIXES,\n '-//w3c//dtd html 4.01 frameset//',\n '-//w3c//dtd html 4.01 transitional//',\n];\nconst QUIRKS_MODE_PUBLIC_IDS = new Set([\n '-//w3o//dtd w3 html strict 3.0//en//',\n '-/w3c/dtd html 4.0 transitional/en',\n 'html',\n]);\nconst LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//'];\nconst LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = [\n ...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,\n '-//w3c//dtd html 4.01 frameset//',\n '-//w3c//dtd html 4.01 transitional//',\n];\n//Utils\nfunction hasPrefix(publicId, prefixes) {\n return prefixes.some((prefix) => publicId.startsWith(prefix));\n}\n//API\nexport function isConforming(token) {\n return (token.name === VALID_DOCTYPE_NAME &&\n token.publicId === null &&\n (token.systemId === null || token.systemId === VALID_SYSTEM_ID));\n}\nexport function getDocumentMode(token) {\n if (token.name !== VALID_DOCTYPE_NAME) {\n return DOCUMENT_MODE.QUIRKS;\n }\n const { systemId } = token;\n if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {\n return DOCUMENT_MODE.QUIRKS;\n }\n let { publicId } = token;\n if (publicId !== null) {\n publicId = publicId.toLowerCase();\n if (QUIRKS_MODE_PUBLIC_IDS.has(publicId)) {\n return DOCUMENT_MODE.QUIRKS;\n }\n let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;\n if (hasPrefix(publicId, prefixes)) {\n return DOCUMENT_MODE.QUIRKS;\n }\n prefixes =\n systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;\n if (hasPrefix(publicId, prefixes)) {\n return DOCUMENT_MODE.LIMITED_QUIRKS;\n }\n }\n return DOCUMENT_MODE.NO_QUIRKS;\n}\n","import { TAG_ID as $, NS, ATTRS, getTagID } from './html.js';\n//MIME types\nconst MIME_TYPES = {\n TEXT_HTML: 'text/html',\n APPLICATION_XML: 'application/xhtml+xml',\n};\n//Attributes\nconst DEFINITION_URL_ATTR = 'definitionurl';\nconst ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL';\nconst SVG_ATTRS_ADJUSTMENT_MAP = new Map([\n 'attributeName',\n 'attributeType',\n 'baseFrequency',\n 'baseProfile',\n 'calcMode',\n 'clipPathUnits',\n 'diffuseConstant',\n 'edgeMode',\n 'filterUnits',\n 'glyphRef',\n 'gradientTransform',\n 'gradientUnits',\n 'kernelMatrix',\n 'kernelUnitLength',\n 'keyPoints',\n 'keySplines',\n 'keyTimes',\n 'lengthAdjust',\n 'limitingConeAngle',\n 'markerHeight',\n 'markerUnits',\n 'markerWidth',\n 'maskContentUnits',\n 'maskUnits',\n 'numOctaves',\n 'pathLength',\n 'patternContentUnits',\n 'patternTransform',\n 'patternUnits',\n 'pointsAtX',\n 'pointsAtY',\n 'pointsAtZ',\n 'preserveAlpha',\n 'preserveAspectRatio',\n 'primitiveUnits',\n 'refX',\n 'refY',\n 'repeatCount',\n 'repeatDur',\n 'requiredExtensions',\n 'requiredFeatures',\n 'specularConstant',\n 'specularExponent',\n 'spreadMethod',\n 'startOffset',\n 'stdDeviation',\n 'stitchTiles',\n 'surfaceScale',\n 'systemLanguage',\n 'tableValues',\n 'targetX',\n 'targetY',\n 'textLength',\n 'viewBox',\n 'viewTarget',\n 'xChannelSelector',\n 'yChannelSelector',\n 'zoomAndPan',\n].map((attr) => [attr.toLowerCase(), attr]));\nconst XML_ATTRS_ADJUSTMENT_MAP = new Map([\n ['xlink:actuate', { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK }],\n ['xlink:arcrole', { prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK }],\n ['xlink:href', { prefix: 'xlink', name: 'href', namespace: NS.XLINK }],\n ['xlink:role', { prefix: 'xlink', name: 'role', namespace: NS.XLINK }],\n ['xlink:show', { prefix: 'xlink', name: 'show', namespace: NS.XLINK }],\n ['xlink:title', { prefix: 'xlink', name: 'title', namespace: NS.XLINK }],\n ['xlink:type', { prefix: 'xlink', name: 'type', namespace: NS.XLINK }],\n ['xml:lang', { prefix: 'xml', name: 'lang', namespace: NS.XML }],\n ['xml:space', { prefix: 'xml', name: 'space', namespace: NS.XML }],\n ['xmlns', { prefix: '', name: 'xmlns', namespace: NS.XMLNS }],\n ['xmlns:xlink', { prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS }],\n]);\n//SVG tag names adjustment map\nexport const SVG_TAG_NAMES_ADJUSTMENT_MAP = new Map([\n 'altGlyph',\n 'altGlyphDef',\n 'altGlyphItem',\n 'animateColor',\n 'animateMotion',\n 'animateTransform',\n 'clipPath',\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n 'foreignObject',\n 'glyphRef',\n 'linearGradient',\n 'radialGradient',\n 'textPath',\n].map((tn) => [tn.toLowerCase(), tn]));\n//Tags that causes exit from foreign content\nconst EXITS_FOREIGN_CONTENT = new Set([\n $.B,\n $.BIG,\n $.BLOCKQUOTE,\n $.BODY,\n $.BR,\n $.CENTER,\n $.CODE,\n $.DD,\n $.DIV,\n $.DL,\n $.DT,\n $.EM,\n $.EMBED,\n $.H1,\n $.H2,\n $.H3,\n $.H4,\n $.H5,\n $.H6,\n $.HEAD,\n $.HR,\n $.I,\n $.IMG,\n $.LI,\n $.LISTING,\n $.MENU,\n $.META,\n $.NOBR,\n $.OL,\n $.P,\n $.PRE,\n $.RUBY,\n $.S,\n $.SMALL,\n $.SPAN,\n $.STRONG,\n $.STRIKE,\n $.SUB,\n $.SUP,\n $.TABLE,\n $.TT,\n $.U,\n $.UL,\n $.VAR,\n]);\n//Check exit from foreign content\nexport function causesExit(startTagToken) {\n const tn = startTagToken.tagID;\n const isFontWithAttrs = tn === $.FONT &&\n startTagToken.attrs.some(({ name }) => name === ATTRS.COLOR || name === ATTRS.SIZE || name === ATTRS.FACE);\n return isFontWithAttrs || EXITS_FOREIGN_CONTENT.has(tn);\n}\n//Token adjustments\nexport function adjustTokenMathMLAttrs(token) {\n for (let i = 0; i < token.attrs.length; i++) {\n if (token.attrs[i].name === DEFINITION_URL_ATTR) {\n token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR;\n break;\n }\n }\n}\nexport function adjustTokenSVGAttrs(token) {\n for (let i = 0; i < token.attrs.length; i++) {\n const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP.get(token.attrs[i].name);\n if (adjustedAttrName != null) {\n token.attrs[i].name = adjustedAttrName;\n }\n }\n}\nexport function adjustTokenXMLAttrs(token) {\n for (let i = 0; i < token.attrs.length; i++) {\n const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP.get(token.attrs[i].name);\n if (adjustedAttrEntry) {\n token.attrs[i].prefix = adjustedAttrEntry.prefix;\n token.attrs[i].name = adjustedAttrEntry.name;\n token.attrs[i].namespace = adjustedAttrEntry.namespace;\n }\n }\n}\nexport function adjustTokenSVGTagName(token) {\n const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP.get(token.tagName);\n if (adjustedTagName != null) {\n token.tagName = adjustedTagName;\n token.tagID = getTagID(token.tagName);\n }\n}\n//Integration points\nfunction isMathMLTextIntegrationPoint(tn, ns) {\n return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT);\n}\nfunction isHtmlIntegrationPoint(tn, ns, attrs) {\n if (ns === NS.MATHML && tn === $.ANNOTATION_XML) {\n for (let i = 0; i < attrs.length; i++) {\n if (attrs[i].name === ATTRS.ENCODING) {\n const value = attrs[i].value.toLowerCase();\n return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML;\n }\n }\n }\n return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE);\n}\nexport function isIntegrationPoint(tn, ns, attrs, foreignNS) {\n return (((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) ||\n ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)));\n}\n","import { Tokenizer, TokenizerMode } from '../tokenizer/index.js';\nimport { OpenElementStack } from './open-element-stack.js';\nimport { FormattingElementList, EntryType } from './formatting-element-list.js';\nimport { defaultTreeAdapter } from '../tree-adapters/default.js';\nimport * as doctype from '../common/doctype.js';\nimport * as foreignContent from '../common/foreign-content.js';\nimport { ERR } from '../common/error-codes.js';\nimport * as unicode from '../common/unicode.js';\nimport { TAG_ID as $, TAG_NAMES as TN, NS, ATTRS, SPECIAL_ELEMENTS, DOCUMENT_MODE, NUMBERED_HEADERS, getTagID, } from '../common/html.js';\nimport { TokenType, getTokenAttr, } from '../common/token.js';\n//Misc constants\nconst HIDDEN_INPUT_TYPE = 'hidden';\n//Adoption agency loops iteration count\nconst AA_OUTER_LOOP_ITER = 8;\nconst AA_INNER_LOOP_ITER = 3;\n//Insertion modes\nvar InsertionMode;\n(function (InsertionMode) {\n InsertionMode[InsertionMode[\"INITIAL\"] = 0] = \"INITIAL\";\n InsertionMode[InsertionMode[\"BEFORE_HTML\"] = 1] = \"BEFORE_HTML\";\n InsertionMode[InsertionMode[\"BEFORE_HEAD\"] = 2] = \"BEFORE_HEAD\";\n InsertionMode[InsertionMode[\"IN_HEAD\"] = 3] = \"IN_HEAD\";\n InsertionMode[InsertionMode[\"IN_HEAD_NO_SCRIPT\"] = 4] = \"IN_HEAD_NO_SCRIPT\";\n InsertionMode[InsertionMode[\"AFTER_HEAD\"] = 5] = \"AFTER_HEAD\";\n InsertionMode[InsertionMode[\"IN_BODY\"] = 6] = \"IN_BODY\";\n InsertionMode[InsertionMode[\"TEXT\"] = 7] = \"TEXT\";\n InsertionMode[InsertionMode[\"IN_TABLE\"] = 8] = \"IN_TABLE\";\n InsertionMode[InsertionMode[\"IN_TABLE_TEXT\"] = 9] = \"IN_TABLE_TEXT\";\n InsertionMode[InsertionMode[\"IN_CAPTION\"] = 10] = \"IN_CAPTION\";\n InsertionMode[InsertionMode[\"IN_COLUMN_GROUP\"] = 11] = \"IN_COLUMN_GROUP\";\n InsertionMode[InsertionMode[\"IN_TABLE_BODY\"] = 12] = \"IN_TABLE_BODY\";\n InsertionMode[InsertionMode[\"IN_ROW\"] = 13] = \"IN_ROW\";\n InsertionMode[InsertionMode[\"IN_CELL\"] = 14] = \"IN_CELL\";\n InsertionMode[InsertionMode[\"IN_SELECT\"] = 15] = \"IN_SELECT\";\n InsertionMode[InsertionMode[\"IN_SELECT_IN_TABLE\"] = 16] = \"IN_SELECT_IN_TABLE\";\n InsertionMode[InsertionMode[\"IN_TEMPLATE\"] = 17] = \"IN_TEMPLATE\";\n InsertionMode[InsertionMode[\"AFTER_BODY\"] = 18] = \"AFTER_BODY\";\n InsertionMode[InsertionMode[\"IN_FRAMESET\"] = 19] = \"IN_FRAMESET\";\n InsertionMode[InsertionMode[\"AFTER_FRAMESET\"] = 20] = \"AFTER_FRAMESET\";\n InsertionMode[InsertionMode[\"AFTER_AFTER_BODY\"] = 21] = \"AFTER_AFTER_BODY\";\n InsertionMode[InsertionMode[\"AFTER_AFTER_FRAMESET\"] = 22] = \"AFTER_AFTER_FRAMESET\";\n})(InsertionMode || (InsertionMode = {}));\nconst BASE_LOC = {\n startLine: -1,\n startCol: -1,\n startOffset: -1,\n endLine: -1,\n endCol: -1,\n endOffset: -1,\n};\nconst TABLE_STRUCTURE_TAGS = new Set([$.TABLE, $.TBODY, $.TFOOT, $.THEAD, $.TR]);\nconst defaultParserOptions = {\n scriptingEnabled: true,\n sourceCodeLocationInfo: false,\n treeAdapter: defaultTreeAdapter,\n onParseError: null,\n};\n//Parser\nexport class Parser {\n constructor(options, document, \n /** @internal */\n fragmentContext = null, \n /** @internal */\n scriptHandler = null) {\n this.fragmentContext = fragmentContext;\n this.scriptHandler = scriptHandler;\n this.currentToken = null;\n this.stopped = false;\n /** @internal */\n this.insertionMode = InsertionMode.INITIAL;\n /** @internal */\n this.originalInsertionMode = InsertionMode.INITIAL;\n /** @internal */\n this.headElement = null;\n /** @internal */\n this.formElement = null;\n /** Indicates that the current node is not an element in the HTML namespace */\n this.currentNotInHTML = false;\n /**\n * The template insertion mode stack is maintained from the left.\n * Ie. the topmost element will always have index 0.\n *\n * @internal\n */\n this.tmplInsertionModeStack = [];\n /** @internal */\n this.pendingCharacterTokens = [];\n /** @internal */\n this.hasNonWhitespacePendingCharacterToken = false;\n /** @internal */\n this.framesetOk = true;\n /** @internal */\n this.skipNextNewLine = false;\n /** @internal */\n this.fosterParentingEnabled = false;\n this.options = {\n ...defaultParserOptions,\n ...options,\n };\n this.treeAdapter = this.options.treeAdapter;\n this.onParseError = this.options.onParseError;\n // Always enable location info if we report parse errors.\n if (this.onParseError) {\n this.options.sourceCodeLocationInfo = true;\n }\n this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument();\n this.tokenizer = new Tokenizer(this.options, this);\n this.activeFormattingElements = new FormattingElementList(this.treeAdapter);\n this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : $.UNKNOWN;\n this._setContextModes(fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : this.document, this.fragmentContextID);\n this.openElements = new OpenElementStack(this.document, this.treeAdapter, this);\n }\n // API\n static parse(html, options) {\n const parser = new this(options);\n parser.tokenizer.write(html, true);\n return parser.document;\n }\n static getFragmentParser(fragmentContext, options) {\n const opts = {\n ...defaultParserOptions,\n ...options,\n };\n //NOTE: use a <template> element as the fragment context if no context element was provided,\n //so we will parse in a \"forgiving\" manner\n fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : (fragmentContext = opts.treeAdapter.createElement(TN.TEMPLATE, NS.HTML, []));\n //NOTE: create a fake element which will be used as the `document` for fragment parsing.\n //This is important for jsdom, where a new `document` cannot be created. This led to\n //fragment parsing messing with the main `document`.\n const documentMock = opts.treeAdapter.createElement('documentmock', NS.HTML, []);\n const parser = new this(opts, documentMock, fragmentContext);\n if (parser.fragmentContextID === $.TEMPLATE) {\n parser.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);\n }\n parser._initTokenizerForFragmentParsing();\n parser._insertFakeRootElement();\n parser._resetInsertionMode();\n parser._findFormInFragmentContext();\n return parser;\n }\n getFragment() {\n const rootElement = this.treeAdapter.getFirstChild(this.document);\n const fragment = this.treeAdapter.createDocumentFragment();\n this._adoptNodes(rootElement, fragment);\n return fragment;\n }\n //Errors\n /** @internal */\n _err(token, code, beforeToken) {\n var _a;\n if (!this.onParseError)\n return;\n const loc = (_a = token.location) !== null && _a !== void 0 ? _a : BASE_LOC;\n const err = {\n code,\n startLine: loc.startLine,\n startCol: loc.startCol,\n startOffset: loc.startOffset,\n endLine: beforeToken ? loc.startLine : loc.endLine,\n endCol: beforeToken ? loc.startCol : loc.endCol,\n endOffset: beforeToken ? loc.startOffset : loc.endOffset,\n };\n this.onParseError(err);\n }\n //Stack events\n /** @internal */\n onItemPush(node, tid, isTop) {\n var _a, _b;\n (_b = (_a = this.treeAdapter).onItemPush) === null || _b === void 0 ? void 0 : _b.call(_a, node);\n if (isTop && this.openElements.stackTop > 0)\n this._setContextModes(node, tid);\n }\n /** @internal */\n onItemPop(node, isTop) {\n var _a, _b;\n if (this.options.sourceCodeLocationInfo) {\n this._setEndLocation(node, this.currentToken);\n }\n (_b = (_a = this.treeAdapter).onItemPop) === null || _b === void 0 ? void 0 : _b.call(_a, node, this.openElements.current);\n if (isTop) {\n let current;\n let currentTagId;\n if (this.openElements.stackTop === 0 && this.fragmentContext) {\n current = this.fragmentContext;\n currentTagId = this.fragmentContextID;\n }\n else {\n ({ current, currentTagId } = this.openElements);\n }\n this._setContextModes(current, currentTagId);\n }\n }\n _setContextModes(current, tid) {\n const isHTML = current === this.document || (current && this.treeAdapter.getNamespaceURI(current) === NS.HTML);\n this.currentNotInHTML = !isHTML;\n this.tokenizer.inForeignNode =\n !isHTML && current !== undefined && tid !== undefined && !this._isIntegrationPoint(tid, current);\n }\n /** @protected */\n _switchToTextParsing(currentToken, nextTokenizerState) {\n this._insertElement(currentToken, NS.HTML);\n this.tokenizer.state = nextTokenizerState;\n this.originalInsertionMode = this.insertionMode;\n this.insertionMode = InsertionMode.TEXT;\n }\n switchToPlaintextParsing() {\n this.insertionMode = InsertionMode.TEXT;\n this.originalInsertionMode = InsertionMode.IN_BODY;\n this.tokenizer.state = TokenizerMode.PLAINTEXT;\n }\n //Fragment parsing\n /** @protected */\n _getAdjustedCurrentElement() {\n return this.openElements.stackTop === 0 && this.fragmentContext\n ? this.fragmentContext\n : this.openElements.current;\n }\n /** @protected */\n _findFormInFragmentContext() {\n let node = this.fragmentContext;\n while (node) {\n if (this.treeAdapter.getTagName(node) === TN.FORM) {\n this.formElement = node;\n break;\n }\n node = this.treeAdapter.getParentNode(node);\n }\n }\n _initTokenizerForFragmentParsing() {\n if (!this.fragmentContext || this.treeAdapter.getNamespaceURI(this.fragmentContext) !== NS.HTML) {\n return;\n }\n switch (this.fragmentContextID) {\n case $.TITLE:\n case $.TEXTAREA: {\n this.tokenizer.state = TokenizerMode.RCDATA;\n break;\n }\n case $.STYLE:\n case $.XMP:\n case $.IFRAME:\n case $.NOEMBED:\n case $.NOFRAMES:\n case $.NOSCRIPT: {\n this.tokenizer.state = TokenizerMode.RAWTEXT;\n break;\n }\n case $.SCRIPT: {\n this.tokenizer.state = TokenizerMode.SCRIPT_DATA;\n break;\n }\n case $.PLAINTEXT: {\n this.tokenizer.state = TokenizerMode.PLAINTEXT;\n break;\n }\n default:\n // Do nothing\n }\n }\n //Tree mutation\n /** @protected */\n _setDocumentType(token) {\n const name = token.name || '';\n const publicId = token.publicId || '';\n const systemId = token.systemId || '';\n this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);\n if (token.location) {\n const documentChildren = this.treeAdapter.getChildNodes(this.document);\n const docTypeNode = documentChildren.find((node) => this.treeAdapter.isDocumentTypeNode(node));\n if (docTypeNode) {\n this.treeAdapter.setNodeSourceCodeLocation(docTypeNode, token.location);\n }\n }\n }\n /** @protected */\n _attachElementToTree(element, location) {\n if (this.options.sourceCodeLocationInfo) {\n const loc = location && {\n ...location,\n startTag: location,\n };\n this.treeAdapter.setNodeSourceCodeLocation(element, loc);\n }\n if (this._shouldFosterParentOnInsertion()) {\n this._fosterParentElement(element);\n }\n else {\n const parent = this.openElements.currentTmplContentOrNode;\n this.treeAdapter.appendChild(parent !== null && parent !== void 0 ? parent : this.document, element);\n }\n }\n /**\n * For self-closing tags. Add an element to the tree, but skip adding it\n * to the stack.\n */\n /** @protected */\n _appendElement(token, namespaceURI) {\n const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);\n this._attachElementToTree(element, token.location);\n }\n /** @protected */\n _insertElement(token, namespaceURI) {\n const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);\n this._attachElementToTree(element, token.location);\n this.openElements.push(element, token.tagID);\n }\n /** @protected */\n _insertFakeElement(tagName, tagID) {\n const element = this.treeAdapter.createElement(tagName, NS.HTML, []);\n this._attachElementToTree(element, null);\n this.openElements.push(element, tagID);\n }\n /** @protected */\n _insertTemplate(token) {\n const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);\n const content = this.treeAdapter.createDocumentFragment();\n this.treeAdapter.setTemplateContent(tmpl, content);\n this._attachElementToTree(tmpl, token.location);\n this.openElements.push(tmpl, token.tagID);\n if (this.options.sourceCodeLocationInfo)\n this.treeAdapter.setNodeSourceCodeLocation(content, null);\n }\n /** @protected */\n _insertFakeRootElement() {\n const element = this.treeAdapter.createElement(TN.HTML, NS.HTML, []);\n if (this.options.sourceCodeLocationInfo)\n this.treeAdapter.setNodeSourceCodeLocation(element, null);\n this.treeAdapter.appendChild(this.openElements.current, element);\n this.openElements.push(element, $.HTML);\n }\n /** @protected */\n _appendCommentNode(token, parent) {\n const commentNode = this.treeAdapter.createCommentNode(token.data);\n this.treeAdapter.appendChild(parent, commentNode);\n if (this.options.sourceCodeLocationInfo) {\n this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);\n }\n }\n /** @protected */\n _insertCharacters(token) {\n let parent;\n let beforeElement;\n if (this._shouldFosterParentOnInsertion()) {\n ({ parent, beforeElement } = this._findFosterParentingLocation());\n if (beforeElement) {\n this.treeAdapter.insertTextBefore(parent, token.chars, beforeElement);\n }\n else {\n this.treeAdapter.insertText(parent, token.chars);\n }\n }\n else {\n parent = this.openElements.currentTmplContentOrNode;\n this.treeAdapter.insertText(parent, token.chars);\n }\n if (!token.location)\n return;\n const siblings = this.treeAdapter.getChildNodes(parent);\n const textNodeIdx = beforeElement ? siblings.lastIndexOf(beforeElement) : siblings.length;\n const textNode = siblings[textNodeIdx - 1];\n //NOTE: if we have a location assigned by another token, then just update the end position\n const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode);\n if (tnLoc) {\n const { endLine, endCol, endOffset } = token.location;\n this.treeAdapter.updateNodeSourceCodeLocation(textNode, { endLine, endCol, endOffset });\n }\n else if (this.options.sourceCodeLocationInfo) {\n this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);\n }\n }\n /** @protected */\n _adoptNodes(donor, recipient) {\n for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {\n this.treeAdapter.detachNode(child);\n this.treeAdapter.appendChild(recipient, child);\n }\n }\n /** @protected */\n _setEndLocation(element, closingToken) {\n if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {\n const ctLoc = closingToken.location;\n const tn = this.treeAdapter.getTagName(element);\n const endLoc = \n // NOTE: For cases like <p> <p> </p> - First 'p' closes without a closing\n // tag and for cases like <td> <p> </td> - 'p' closes without a closing tag.\n closingToken.type === TokenType.END_TAG && tn === closingToken.tagName\n ? {\n endTag: { ...ctLoc },\n endLine: ctLoc.endLine,\n endCol: ctLoc.endCol,\n endOffset: ctLoc.endOffset,\n }\n : {\n endLine: ctLoc.startLine,\n endCol: ctLoc.startCol,\n endOffset: ctLoc.startOffset,\n };\n this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc);\n }\n }\n //Token processing\n shouldProcessStartTagTokenInForeignContent(token) {\n // Check that neither current === document, or ns === NS.HTML\n if (!this.currentNotInHTML)\n return false;\n let current;\n let currentTagId;\n if (this.openElements.stackTop === 0 && this.fragmentContext) {\n current = this.fragmentContext;\n currentTagId = this.fragmentContextID;\n }\n else {\n ({ current, currentTagId } = this.openElements);\n }\n if (token.tagID === $.SVG &&\n this.treeAdapter.getTagName(current) === TN.ANNOTATION_XML &&\n this.treeAdapter.getNamespaceURI(current) === NS.MATHML) {\n return false;\n }\n return (\n // Check that `current` is not an integration point for HTML or MathML elements.\n this.tokenizer.inForeignNode ||\n // If it _is_ an integration point, then we might have to check that it is not an HTML\n // integration point.\n ((token.tagID === $.MGLYPH || token.tagID === $.MALIGNMARK) &&\n currentTagId !== undefined &&\n !this._isIntegrationPoint(currentTagId, current, NS.HTML)));\n }\n /** @protected */\n _processToken(token) {\n switch (token.type) {\n case TokenType.CHARACTER: {\n this.onCharacter(token);\n break;\n }\n case TokenType.NULL_CHARACTER: {\n this.onNullCharacter(token);\n break;\n }\n case TokenType.COMMENT: {\n this.onComment(token);\n break;\n }\n case TokenType.DOCTYPE: {\n this.onDoctype(token);\n break;\n }\n case TokenType.START_TAG: {\n this._processStartTag(token);\n break;\n }\n case TokenType.END_TAG: {\n this.onEndTag(token);\n break;\n }\n case TokenType.EOF: {\n this.onEof(token);\n break;\n }\n case TokenType.WHITESPACE_CHARACTER: {\n this.onWhitespaceCharacter(token);\n break;\n }\n }\n }\n //Integration points\n /** @protected */\n _isIntegrationPoint(tid, element, foreignNS) {\n const ns = this.treeAdapter.getNamespaceURI(element);\n const attrs = this.treeAdapter.getAttrList(element);\n return foreignContent.isIntegrationPoint(tid, ns, attrs, foreignNS);\n }\n //Active formatting elements reconstruction\n /** @protected */\n _reconstructActiveFormattingElements() {\n const listLength = this.activeFormattingElements.entries.length;\n if (listLength) {\n const endIndex = this.activeFormattingElements.entries.findIndex((entry) => entry.type === EntryType.Marker || this.openElements.contains(entry.element));\n const unopenIdx = endIndex === -1 ? listLength - 1 : endIndex - 1;\n for (let i = unopenIdx; i >= 0; i--) {\n const entry = this.activeFormattingElements.entries[i];\n this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element));\n entry.element = this.openElements.current;\n }\n }\n }\n //Close elements\n /** @protected */\n _closeTableCell() {\n this.openElements.generateImpliedEndTags();\n this.openElements.popUntilTableCellPopped();\n this.activeFormattingElements.clearToLastMarker();\n this.insertionMode = InsertionMode.IN_ROW;\n }\n /** @protected */\n _closePElement() {\n this.openElements.generateImpliedEndTagsWithExclusion($.P);\n this.openElements.popUntilTagNamePopped($.P);\n }\n //Insertion modes\n /** @protected */\n _resetInsertionMode() {\n for (let i = this.openElements.stackTop; i >= 0; i--) {\n //Insertion mode reset map\n switch (i === 0 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[i]) {\n case $.TR: {\n this.insertionMode = InsertionMode.IN_ROW;\n return;\n }\n case $.TBODY:\n case $.THEAD:\n case $.TFOOT: {\n this.insertionMode = InsertionMode.IN_TABLE_BODY;\n return;\n }\n case $.CAPTION: {\n this.insertionMode = InsertionMode.IN_CAPTION;\n return;\n }\n case $.COLGROUP: {\n this.insertionMode = InsertionMode.IN_COLUMN_GROUP;\n return;\n }\n case $.TABLE: {\n this.insertionMode = InsertionMode.IN_TABLE;\n return;\n }\n case $.BODY: {\n this.insertionMode = InsertionMode.IN_BODY;\n return;\n }\n case $.FRAMESET: {\n this.insertionMode = InsertionMode.IN_FRAMESET;\n return;\n }\n case $.SELECT: {\n this._resetInsertionModeForSelect(i);\n return;\n }\n case $.TEMPLATE: {\n this.insertionMode = this.tmplInsertionModeStack[0];\n return;\n }\n case $.HTML: {\n this.insertionMode = this.headElement ? InsertionMode.AFTER_HEAD : InsertionMode.BEFORE_HEAD;\n return;\n }\n case $.TD:\n case $.TH: {\n if (i > 0) {\n this.insertionMode = InsertionMode.IN_CELL;\n return;\n }\n break;\n }\n case $.HEAD: {\n if (i > 0) {\n this.insertionMode = InsertionMode.IN_HEAD;\n return;\n }\n break;\n }\n }\n }\n this.insertionMode = InsertionMode.IN_BODY;\n }\n /** @protected */\n _resetInsertionModeForSelect(selectIdx) {\n if (selectIdx > 0) {\n for (let i = selectIdx - 1; i > 0; i--) {\n const tn = this.openElements.tagIDs[i];\n if (tn === $.TEMPLATE) {\n break;\n }\n else if (tn === $.TABLE) {\n this.insertionMode = InsertionMode.IN_SELECT_IN_TABLE;\n return;\n }\n }\n }\n this.insertionMode = InsertionMode.IN_SELECT;\n }\n //Foster parenting\n /** @protected */\n _isElementCausesFosterParenting(tn) {\n return TABLE_STRUCTURE_TAGS.has(tn);\n }\n /** @protected */\n _shouldFosterParentOnInsertion() {\n return (this.fosterParentingEnabled &&\n this.openElements.currentTagId !== undefined &&\n this._isElementCausesFosterParenting(this.openElements.currentTagId));\n }\n /** @protected */\n _findFosterParentingLocation() {\n for (let i = this.openElements.stackTop; i >= 0; i--) {\n const openElement = this.openElements.items[i];\n switch (this.openElements.tagIDs[i]) {\n case $.TEMPLATE: {\n if (this.treeAdapter.getNamespaceURI(openElement) === NS.HTML) {\n return { parent: this.treeAdapter.getTemplateContent(openElement), beforeElement: null };\n }\n break;\n }\n case $.TABLE: {\n const parent = this.treeAdapter.getParentNode(openElement);\n if (parent) {\n return { parent, beforeElement: openElement };\n }\n return { parent: this.openElements.items[i - 1], beforeElement: null };\n }\n default:\n // Do nothing\n }\n }\n return { parent: this.openElements.items[0], beforeElement: null };\n }\n /** @protected */\n _fosterParentElement(element) {\n const location = this._findFosterParentingLocation();\n if (location.beforeElement) {\n this.treeAdapter.insertBefore(location.parent, element, location.beforeElement);\n }\n else {\n this.treeAdapter.appendChild(location.parent, element);\n }\n }\n //Special elements\n /** @protected */\n _isSpecialElement(element, id) {\n const ns = this.treeAdapter.getNamespaceURI(element);\n return SPECIAL_ELEMENTS[ns].has(id);\n }\n /** @internal */\n onCharacter(token) {\n this.skipNextNewLine = false;\n if (this.tokenizer.inForeignNode) {\n characterInForeignContent(this, token);\n return;\n }\n switch (this.insertionMode) {\n case InsertionMode.INITIAL: {\n tokenInInitialMode(this, token);\n break;\n }\n case InsertionMode.BEFORE_HTML: {\n tokenBeforeHtml(this, token);\n break;\n }\n case InsertionMode.BEFORE_HEAD: {\n tokenBeforeHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD: {\n tokenInHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD_NO_SCRIPT: {\n tokenInHeadNoScript(this, token);\n break;\n }\n case InsertionMode.AFTER_HEAD: {\n tokenAfterHead(this, token);\n break;\n }\n case InsertionMode.IN_BODY:\n case InsertionMode.IN_CAPTION:\n case InsertionMode.IN_CELL:\n case InsertionMode.IN_TEMPLATE: {\n characterInBody(this, token);\n break;\n }\n case InsertionMode.TEXT:\n case InsertionMode.IN_SELECT:\n case InsertionMode.IN_SELECT_IN_TABLE: {\n this._insertCharacters(token);\n break;\n }\n case InsertionMode.IN_TABLE:\n case InsertionMode.IN_TABLE_BODY:\n case InsertionMode.IN_ROW: {\n characterInTable(this, token);\n break;\n }\n case InsertionMode.IN_TABLE_TEXT: {\n characterInTableText(this, token);\n break;\n }\n case InsertionMode.IN_COLUMN_GROUP: {\n tokenInColumnGroup(this, token);\n break;\n }\n case InsertionMode.AFTER_BODY: {\n tokenAfterBody(this, token);\n break;\n }\n case InsertionMode.AFTER_AFTER_BODY: {\n tokenAfterAfterBody(this, token);\n break;\n }\n default:\n // Do nothing\n }\n }\n /** @internal */\n onNullCharacter(token) {\n this.skipNextNewLine = false;\n if (this.tokenizer.inForeignNode) {\n nullCharacterInForeignContent(this, token);\n return;\n }\n switch (this.insertionMode) {\n case InsertionMode.INITIAL: {\n tokenInInitialMode(this, token);\n break;\n }\n case InsertionMode.BEFORE_HTML: {\n tokenBeforeHtml(this, token);\n break;\n }\n case InsertionMode.BEFORE_HEAD: {\n tokenBeforeHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD: {\n tokenInHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD_NO_SCRIPT: {\n tokenInHeadNoScript(this, token);\n break;\n }\n case InsertionMode.AFTER_HEAD: {\n tokenAfterHead(this, token);\n break;\n }\n case InsertionMode.TEXT: {\n this._insertCharacters(token);\n break;\n }\n case InsertionMode.IN_TABLE:\n case InsertionMode.IN_TABLE_BODY:\n case InsertionMode.IN_ROW: {\n characterInTable(this, token);\n break;\n }\n case InsertionMode.IN_COLUMN_GROUP: {\n tokenInColumnGroup(this, token);\n break;\n }\n case InsertionMode.AFTER_BODY: {\n tokenAfterBody(this, token);\n break;\n }\n case InsertionMode.AFTER_AFTER_BODY: {\n tokenAfterAfterBody(this, token);\n break;\n }\n default:\n // Do nothing\n }\n }\n /** @internal */\n onComment(token) {\n this.skipNextNewLine = false;\n if (this.currentNotInHTML) {\n appendComment(this, token);\n return;\n }\n switch (this.insertionMode) {\n case InsertionMode.INITIAL:\n case InsertionMode.BEFORE_HTML:\n case InsertionMode.BEFORE_HEAD:\n case InsertionMode.IN_HEAD:\n case InsertionMode.IN_HEAD_NO_SCRIPT:\n case InsertionMode.AFTER_HEAD:\n case InsertionMode.IN_BODY:\n case InsertionMode.IN_TABLE:\n case InsertionMode.IN_CAPTION:\n case InsertionMode.IN_COLUMN_GROUP:\n case InsertionMode.IN_TABLE_BODY:\n case InsertionMode.IN_ROW:\n case InsertionMode.IN_CELL:\n case InsertionMode.IN_SELECT:\n case InsertionMode.IN_SELECT_IN_TABLE:\n case InsertionMode.IN_TEMPLATE:\n case InsertionMode.IN_FRAMESET:\n case InsertionMode.AFTER_FRAMESET: {\n appendComment(this, token);\n break;\n }\n case InsertionMode.IN_TABLE_TEXT: {\n tokenInTableText(this, token);\n break;\n }\n case InsertionMode.AFTER_BODY: {\n appendCommentToRootHtmlElement(this, token);\n break;\n }\n case InsertionMode.AFTER_AFTER_BODY:\n case InsertionMode.AFTER_AFTER_FRAMESET: {\n appendCommentToDocument(this, token);\n break;\n }\n default:\n // Do nothing\n }\n }\n /** @internal */\n onDoctype(token) {\n this.skipNextNewLine = false;\n switch (this.insertionMode) {\n case InsertionMode.INITIAL: {\n doctypeInInitialMode(this, token);\n break;\n }\n case InsertionMode.BEFORE_HEAD:\n case InsertionMode.IN_HEAD:\n case InsertionMode.IN_HEAD_NO_SCRIPT:\n case InsertionMode.AFTER_HEAD: {\n this._err(token, ERR.misplacedDoctype);\n break;\n }\n case InsertionMode.IN_TABLE_TEXT: {\n tokenInTableText(this, token);\n break;\n }\n default:\n // Do nothing\n }\n }\n /** @internal */\n onStartTag(token) {\n this.skipNextNewLine = false;\n this.currentToken = token;\n this._processStartTag(token);\n if (token.selfClosing && !token.ackSelfClosing) {\n this._err(token, ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);\n }\n }\n /**\n * Processes a given start tag.\n *\n * `onStartTag` checks if a self-closing tag was recognized. When a token\n * is moved inbetween multiple insertion modes, this check for self-closing\n * could lead to false positives. To avoid this, `_processStartTag` is used\n * for nested calls.\n *\n * @param token The token to process.\n * @protected\n */\n _processStartTag(token) {\n if (this.shouldProcessStartTagTokenInForeignContent(token)) {\n startTagInForeignContent(this, token);\n }\n else {\n this._startTagOutsideForeignContent(token);\n }\n }\n /** @protected */\n _startTagOutsideForeignContent(token) {\n switch (this.insertionMode) {\n case InsertionMode.INITIAL: {\n tokenInInitialMode(this, token);\n break;\n }\n case InsertionMode.BEFORE_HTML: {\n startTagBeforeHtml(this, token);\n break;\n }\n case InsertionMode.BEFORE_HEAD: {\n startTagBeforeHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD: {\n startTagInHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD_NO_SCRIPT: {\n startTagInHeadNoScript(this, token);\n break;\n }\n case InsertionMode.AFTER_HEAD: {\n startTagAfterHead(this, token);\n break;\n }\n case InsertionMode.IN_BODY: {\n startTagInBody(this, token);\n break;\n }\n case InsertionMode.IN_TABLE: {\n startTagInTable(this, token);\n break;\n }\n case InsertionMode.IN_TABLE_TEXT: {\n tokenInTableText(this, token);\n break;\n }\n case InsertionMode.IN_CAPTION: {\n startTagInCaption(this, token);\n break;\n }\n case InsertionMode.IN_COLUMN_GROUP: {\n startTagInColumnGroup(this, token);\n break;\n }\n case InsertionMode.IN_TABLE_BODY: {\n startTagInTableBody(this, token);\n break;\n }\n case InsertionMode.IN_ROW: {\n startTagInRow(this, token);\n break;\n }\n case InsertionMode.IN_CELL: {\n startTagInCell(this, token);\n break;\n }\n case InsertionMode.IN_SELECT: {\n startTagInSelect(this, token);\n break;\n }\n case InsertionMode.IN_SELECT_IN_TABLE: {\n startTagInSelectInTable(this, token);\n break;\n }\n case InsertionMode.IN_TEMPLATE: {\n startTagInTemplate(this, token);\n break;\n }\n case InsertionMode.AFTER_BODY: {\n startTagAfterBody(this, token);\n break;\n }\n case InsertionMode.IN_FRAMESET: {\n startTagInFrameset(this, token);\n break;\n }\n case InsertionMode.AFTER_FRAMESET: {\n startTagAfterFrameset(this, token);\n break;\n }\n case InsertionMode.AFTER_AFTER_BODY: {\n startTagAfterAfterBody(this, token);\n break;\n }\n case InsertionMode.AFTER_AFTER_FRAMESET: {\n startTagAfterAfterFrameset(this, token);\n break;\n }\n default:\n // Do nothing\n }\n }\n /** @internal */\n onEndTag(token) {\n this.skipNextNewLine = false;\n this.currentToken = token;\n if (this.currentNotInHTML) {\n endTagInForeignContent(this, token);\n }\n else {\n this._endTagOutsideForeignContent(token);\n }\n }\n /** @protected */\n _endTagOutsideForeignContent(token) {\n switch (this.insertionMode) {\n case InsertionMode.INITIAL: {\n tokenInInitialMode(this, token);\n break;\n }\n case InsertionMode.BEFORE_HTML: {\n endTagBeforeHtml(this, token);\n break;\n }\n case InsertionMode.BEFORE_HEAD: {\n endTagBeforeHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD: {\n endTagInHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD_NO_SCRIPT: {\n endTagInHeadNoScript(this, token);\n break;\n }\n case InsertionMode.AFTER_HEAD: {\n endTagAfterHead(this, token);\n break;\n }\n case InsertionMode.IN_BODY: {\n endTagInBody(this, token);\n break;\n }\n case InsertionMode.TEXT: {\n endTagInText(this, token);\n break;\n }\n case InsertionMode.IN_TABLE: {\n endTagInTable(this, token);\n break;\n }\n case InsertionMode.IN_TABLE_TEXT: {\n tokenInTableText(this, token);\n break;\n }\n case InsertionMode.IN_CAPTION: {\n endTagInCaption(this, token);\n break;\n }\n case InsertionMode.IN_COLUMN_GROUP: {\n endTagInColumnGroup(this, token);\n break;\n }\n case InsertionMode.IN_TABLE_BODY: {\n endTagInTableBody(this, token);\n break;\n }\n case InsertionMode.IN_ROW: {\n endTagInRow(this, token);\n break;\n }\n case InsertionMode.IN_CELL: {\n endTagInCell(this, token);\n break;\n }\n case InsertionMode.IN_SELECT: {\n endTagInSelect(this, token);\n break;\n }\n case InsertionMode.IN_SELECT_IN_TABLE: {\n endTagInSelectInTable(this, token);\n break;\n }\n case InsertionMode.IN_TEMPLATE: {\n endTagInTemplate(this, token);\n break;\n }\n case InsertionMode.AFTER_BODY: {\n endTagAfterBody(this, token);\n break;\n }\n case InsertionMode.IN_FRAMESET: {\n endTagInFrameset(this, token);\n break;\n }\n case InsertionMode.AFTER_FRAMESET: {\n endTagAfterFrameset(this, token);\n break;\n }\n case InsertionMode.AFTER_AFTER_BODY: {\n tokenAfterAfterBody(this, token);\n break;\n }\n default:\n // Do nothing\n }\n }\n /** @internal */\n onEof(token) {\n switch (this.insertionMode) {\n case InsertionMode.INITIAL: {\n tokenInInitialMode(this, token);\n break;\n }\n case InsertionMode.BEFORE_HTML: {\n tokenBeforeHtml(this, token);\n break;\n }\n case InsertionMode.BEFORE_HEAD: {\n tokenBeforeHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD: {\n tokenInHead(this, token);\n break;\n }\n case InsertionMode.IN_HEAD_NO_SCRIPT: {\n tokenInHeadNoScript(this, token);\n break;\n }\n case InsertionMode.AFTER_HEAD: {\n tokenAfterHead(this, token);\n break;\n }\n case InsertionMode.IN_BODY:\n case InsertionMode.IN_TABLE:\n case InsertionMode.IN_CAPTION:\n case InsertionMode.IN_COLUMN_GROUP:\n case InsertionMode.IN_TABLE_BODY:\n case InsertionMode.IN_ROW:\n case InsertionMode.IN_CELL:\n case InsertionMode.IN_SELECT:\n case InsertionMode.IN_SELECT_IN_TABLE: {\n eofInBody(this, token);\n break;\n }\n case InsertionMode.TEXT: {\n eofInText(this, token);\n break;\n }\n case InsertionMode.IN_TABLE_TEXT: {\n tokenInTableText(this, token);\n break;\n }\n case InsertionMode.IN_TEMPLATE: {\n eofInTemplate(this, token);\n break;\n }\n case InsertionMode.AFTER_BODY:\n case InsertionMode.IN_FRAMESET:\n case InsertionMode.AFTER_FRAMESET:\n case InsertionMode.AFTER_AFTER_BODY:\n case InsertionMode.AFTER_AFTER_FRAMESET: {\n stopParsing(this, token);\n break;\n }\n default:\n // Do nothing\n }\n }\n /** @internal */\n onWhitespaceCharacter(token) {\n if (this.skipNextNewLine) {\n this.skipNextNewLine = false;\n if (token.chars.charCodeAt(0) === unicode.CODE_POINTS.LINE_FEED) {\n if (token.chars.length === 1) {\n return;\n }\n token.chars = token.chars.substr(1);\n }\n }\n if (this.tokenizer.inForeignNode) {\n this._insertCharacters(token);\n return;\n }\n switch (this.insertionMode) {\n case InsertionMode.IN_HEAD:\n case InsertionMode.IN_HEAD_NO_SCRIPT:\n case InsertionMode.AFTER_HEAD:\n case InsertionMode.TEXT:\n case InsertionMode.IN_COLUMN_GROUP:\n case InsertionMode.IN_SELECT:\n case InsertionMode.IN_SELECT_IN_TABLE:\n case InsertionMode.IN_FRAMESET:\n case InsertionMode.AFTER_FRAMESET: {\n this._insertCharacters(token);\n break;\n }\n case InsertionMode.IN_BODY:\n case InsertionMode.IN_CAPTION:\n case InsertionMode.IN_CELL:\n case InsertionMode.IN_TEMPLATE:\n case InsertionMode.AFTER_BODY:\n case InsertionMode.AFTER_AFTER_BODY:\n case InsertionMode.AFTER_AFTER_FRAMESET: {\n whitespaceCharacterInBody(this, token);\n break;\n }\n case InsertionMode.IN_TABLE:\n case InsertionMode.IN_TABLE_BODY:\n case InsertionMode.IN_ROW: {\n characterInTable(this, token);\n break;\n }\n case InsertionMode.IN_TABLE_TEXT: {\n whitespaceCharacterInTableText(this, token);\n break;\n }\n default:\n // Do nothing\n }\n }\n}\n//Adoption agency algorithm\n//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#adoptionAgency)\n//------------------------------------------------------------------\n//Steps 5-8 of the algorithm\nfunction aaObtainFormattingElementEntry(p, token) {\n let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);\n if (formattingElementEntry) {\n if (!p.openElements.contains(formattingElementEntry.element)) {\n p.activeFormattingElements.removeEntry(formattingElementEntry);\n formattingElementEntry = null;\n }\n else if (!p.openElements.hasInScope(token.tagID)) {\n formattingElementEntry = null;\n }\n }\n else {\n genericEndTagInBody(p, token);\n }\n return formattingElementEntry;\n}\n//Steps 9 and 10 of the algorithm\nfunction aaObtainFurthestBlock(p, formattingElementEntry) {\n let furthestBlock = null;\n let idx = p.openElements.stackTop;\n for (; idx >= 0; idx--) {\n const element = p.openElements.items[idx];\n if (element === formattingElementEntry.element) {\n break;\n }\n if (p._isSpecialElement(element, p.openElements.tagIDs[idx])) {\n furthestBlock = element;\n }\n }\n if (!furthestBlock) {\n p.openElements.shortenToLength(Math.max(idx, 0));\n p.activeFormattingElements.removeEntry(formattingElementEntry);\n }\n return furthestBlock;\n}\n//Step 13 of the algorithm\nfunction aaInnerLoop(p, furthestBlock, formattingElement) {\n let lastElement = furthestBlock;\n let nextElement = p.openElements.getCommonAncestor(furthestBlock);\n for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) {\n //NOTE: store the next element for the next loop iteration (it may be deleted from the stack by step 9.5)\n nextElement = p.openElements.getCommonAncestor(element);\n const elementEntry = p.activeFormattingElements.getElementEntry(element);\n const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER;\n const shouldRemoveFromOpenElements = !elementEntry || counterOverflow;\n if (shouldRemoveFromOpenElements) {\n if (counterOverflow) {\n p.activeFormattingElements.removeEntry(elementEntry);\n }\n p.openElements.remove(element);\n }\n else {\n element = aaRecreateElementFromEntry(p, elementEntry);\n if (lastElement === furthestBlock) {\n p.activeFormattingElements.bookmark = elementEntry;\n }\n p.treeAdapter.detachNode(lastElement);\n p.treeAdapter.appendChild(element, lastElement);\n lastElement = element;\n }\n }\n return lastElement;\n}\n//Step 13.7 of the algorithm\nfunction aaRecreateElementFromEntry(p, elementEntry) {\n const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);\n const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n return newElement;\n}\n//Step 14 of the algorithm\nfunction aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {\n const tn = p.treeAdapter.getTagName(commonAncestor);\n const tid = getTagID(tn);\n if (p._isElementCausesFosterParenting(tid)) {\n p._fosterParentElement(lastElement);\n }\n else {\n const ns = p.treeAdapter.getNamespaceURI(commonAncestor);\n if (tid === $.TEMPLATE && ns === NS.HTML) {\n commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);\n }\n p.treeAdapter.appendChild(commonAncestor, lastElement);\n }\n}\n//Steps 15-19 of the algorithm\nfunction aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) {\n const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element);\n const { token } = formattingElementEntry;\n const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs);\n p._adoptNodes(furthestBlock, newElement);\n p.treeAdapter.appendChild(furthestBlock, newElement);\n p.activeFormattingElements.insertElementAfterBookmark(newElement, token);\n p.activeFormattingElements.removeEntry(formattingElementEntry);\n p.openElements.remove(formattingElementEntry.element);\n p.openElements.insertAfter(furthestBlock, newElement, token.tagID);\n}\n//Algorithm entry point\nfunction callAdoptionAgency(p, token) {\n for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) {\n const formattingElementEntry = aaObtainFormattingElementEntry(p, token);\n if (!formattingElementEntry) {\n break;\n }\n const furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry);\n if (!furthestBlock) {\n break;\n }\n p.activeFormattingElements.bookmark = formattingElementEntry;\n const lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element);\n const commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element);\n p.treeAdapter.detachNode(lastElement);\n if (commonAncestor)\n aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement);\n aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry);\n }\n}\n//Generic token handlers\n//------------------------------------------------------------------\nfunction appendComment(p, token) {\n p._appendCommentNode(token, p.openElements.currentTmplContentOrNode);\n}\nfunction appendCommentToRootHtmlElement(p, token) {\n p._appendCommentNode(token, p.openElements.items[0]);\n}\nfunction appendCommentToDocument(p, token) {\n p._appendCommentNode(token, p.document);\n}\nfunction stopParsing(p, token) {\n p.stopped = true;\n // NOTE: Set end locations for elements that remain on the open element stack.\n if (token.location) {\n // NOTE: If we are not in a fragment, `html` and `body` will stay on the stack.\n // This is a problem, as we might overwrite their end position here.\n const target = p.fragmentContext ? 0 : 2;\n for (let i = p.openElements.stackTop; i >= target; i--) {\n p._setEndLocation(p.openElements.items[i], token);\n }\n // Handle `html` and `body`\n if (!p.fragmentContext && p.openElements.stackTop >= 0) {\n const htmlElement = p.openElements.items[0];\n const htmlLocation = p.treeAdapter.getNodeSourceCodeLocation(htmlElement);\n if (htmlLocation && !htmlLocation.endTag) {\n p._setEndLocation(htmlElement, token);\n if (p.openElements.stackTop >= 1) {\n const bodyElement = p.openElements.items[1];\n const bodyLocation = p.treeAdapter.getNodeSourceCodeLocation(bodyElement);\n if (bodyLocation && !bodyLocation.endTag) {\n p._setEndLocation(bodyElement, token);\n }\n }\n }\n }\n }\n}\n// The \"initial\" insertion mode\n//------------------------------------------------------------------\nfunction doctypeInInitialMode(p, token) {\n p._setDocumentType(token);\n const mode = token.forceQuirks ? DOCUMENT_MODE.QUIRKS : doctype.getDocumentMode(token);\n if (!doctype.isConforming(token)) {\n p._err(token, ERR.nonConformingDoctype);\n }\n p.treeAdapter.setDocumentMode(p.document, mode);\n p.insertionMode = InsertionMode.BEFORE_HTML;\n}\nfunction tokenInInitialMode(p, token) {\n p._err(token, ERR.missingDoctype, true);\n p.treeAdapter.setDocumentMode(p.document, DOCUMENT_MODE.QUIRKS);\n p.insertionMode = InsertionMode.BEFORE_HTML;\n p._processToken(token);\n}\n// The \"before html\" insertion mode\n//------------------------------------------------------------------\nfunction startTagBeforeHtml(p, token) {\n if (token.tagID === $.HTML) {\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.BEFORE_HEAD;\n }\n else {\n tokenBeforeHtml(p, token);\n }\n}\nfunction endTagBeforeHtml(p, token) {\n const tn = token.tagID;\n if (tn === $.HTML || tn === $.HEAD || tn === $.BODY || tn === $.BR) {\n tokenBeforeHtml(p, token);\n }\n}\nfunction tokenBeforeHtml(p, token) {\n p._insertFakeRootElement();\n p.insertionMode = InsertionMode.BEFORE_HEAD;\n p._processToken(token);\n}\n// The \"before head\" insertion mode\n//------------------------------------------------------------------\nfunction startTagBeforeHead(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.HEAD: {\n p._insertElement(token, NS.HTML);\n p.headElement = p.openElements.current;\n p.insertionMode = InsertionMode.IN_HEAD;\n break;\n }\n default: {\n tokenBeforeHead(p, token);\n }\n }\n}\nfunction endTagBeforeHead(p, token) {\n const tn = token.tagID;\n if (tn === $.HEAD || tn === $.BODY || tn === $.HTML || tn === $.BR) {\n tokenBeforeHead(p, token);\n }\n else {\n p._err(token, ERR.endTagWithoutMatchingOpenElement);\n }\n}\nfunction tokenBeforeHead(p, token) {\n p._insertFakeElement(TN.HEAD, $.HEAD);\n p.headElement = p.openElements.current;\n p.insertionMode = InsertionMode.IN_HEAD;\n p._processToken(token);\n}\n// The \"in head\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInHead(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.BASE:\n case $.BASEFONT:\n case $.BGSOUND:\n case $.LINK:\n case $.META: {\n p._appendElement(token, NS.HTML);\n token.ackSelfClosing = true;\n break;\n }\n case $.TITLE: {\n p._switchToTextParsing(token, TokenizerMode.RCDATA);\n break;\n }\n case $.NOSCRIPT: {\n if (p.options.scriptingEnabled) {\n p._switchToTextParsing(token, TokenizerMode.RAWTEXT);\n }\n else {\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_HEAD_NO_SCRIPT;\n }\n break;\n }\n case $.NOFRAMES:\n case $.STYLE: {\n p._switchToTextParsing(token, TokenizerMode.RAWTEXT);\n break;\n }\n case $.SCRIPT: {\n p._switchToTextParsing(token, TokenizerMode.SCRIPT_DATA);\n break;\n }\n case $.TEMPLATE: {\n p._insertTemplate(token);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n p.insertionMode = InsertionMode.IN_TEMPLATE;\n p.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);\n break;\n }\n case $.HEAD: {\n p._err(token, ERR.misplacedStartTagForHeadElement);\n break;\n }\n default: {\n tokenInHead(p, token);\n }\n }\n}\nfunction endTagInHead(p, token) {\n switch (token.tagID) {\n case $.HEAD: {\n p.openElements.pop();\n p.insertionMode = InsertionMode.AFTER_HEAD;\n break;\n }\n case $.BODY:\n case $.BR:\n case $.HTML: {\n tokenInHead(p, token);\n break;\n }\n case $.TEMPLATE: {\n templateEndTagInHead(p, token);\n break;\n }\n default: {\n p._err(token, ERR.endTagWithoutMatchingOpenElement);\n }\n }\n}\nfunction templateEndTagInHead(p, token) {\n if (p.openElements.tmplCount > 0) {\n p.openElements.generateImpliedEndTagsThoroughly();\n if (p.openElements.currentTagId !== $.TEMPLATE) {\n p._err(token, ERR.closingOfElementWithOpenChildElements);\n }\n p.openElements.popUntilTagNamePopped($.TEMPLATE);\n p.activeFormattingElements.clearToLastMarker();\n p.tmplInsertionModeStack.shift();\n p._resetInsertionMode();\n }\n else {\n p._err(token, ERR.endTagWithoutMatchingOpenElement);\n }\n}\nfunction tokenInHead(p, token) {\n p.openElements.pop();\n p.insertionMode = InsertionMode.AFTER_HEAD;\n p._processToken(token);\n}\n// The \"in head no script\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInHeadNoScript(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.BASEFONT:\n case $.BGSOUND:\n case $.HEAD:\n case $.LINK:\n case $.META:\n case $.NOFRAMES:\n case $.STYLE: {\n startTagInHead(p, token);\n break;\n }\n case $.NOSCRIPT: {\n p._err(token, ERR.nestedNoscriptInHead);\n break;\n }\n default: {\n tokenInHeadNoScript(p, token);\n }\n }\n}\nfunction endTagInHeadNoScript(p, token) {\n switch (token.tagID) {\n case $.NOSCRIPT: {\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_HEAD;\n break;\n }\n case $.BR: {\n tokenInHeadNoScript(p, token);\n break;\n }\n default: {\n p._err(token, ERR.endTagWithoutMatchingOpenElement);\n }\n }\n}\nfunction tokenInHeadNoScript(p, token) {\n const errCode = token.type === TokenType.EOF ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead;\n p._err(token, errCode);\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_HEAD;\n p._processToken(token);\n}\n// The \"after head\" insertion mode\n//------------------------------------------------------------------\nfunction startTagAfterHead(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.BODY: {\n p._insertElement(token, NS.HTML);\n p.framesetOk = false;\n p.insertionMode = InsertionMode.IN_BODY;\n break;\n }\n case $.FRAMESET: {\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_FRAMESET;\n break;\n }\n case $.BASE:\n case $.BASEFONT:\n case $.BGSOUND:\n case $.LINK:\n case $.META:\n case $.NOFRAMES:\n case $.SCRIPT:\n case $.STYLE:\n case $.TEMPLATE:\n case $.TITLE: {\n p._err(token, ERR.abandonedHeadElementChild);\n p.openElements.push(p.headElement, $.HEAD);\n startTagInHead(p, token);\n p.openElements.remove(p.headElement);\n break;\n }\n case $.HEAD: {\n p._err(token, ERR.misplacedStartTagForHeadElement);\n break;\n }\n default: {\n tokenAfterHead(p, token);\n }\n }\n}\nfunction endTagAfterHead(p, token) {\n switch (token.tagID) {\n case $.BODY:\n case $.HTML:\n case $.BR: {\n tokenAfterHead(p, token);\n break;\n }\n case $.TEMPLATE: {\n templateEndTagInHead(p, token);\n break;\n }\n default: {\n p._err(token, ERR.endTagWithoutMatchingOpenElement);\n }\n }\n}\nfunction tokenAfterHead(p, token) {\n p._insertFakeElement(TN.BODY, $.BODY);\n p.insertionMode = InsertionMode.IN_BODY;\n modeInBody(p, token);\n}\n// The \"in body\" insertion mode\n//------------------------------------------------------------------\nfunction modeInBody(p, token) {\n switch (token.type) {\n case TokenType.CHARACTER: {\n characterInBody(p, token);\n break;\n }\n case TokenType.WHITESPACE_CHARACTER: {\n whitespaceCharacterInBody(p, token);\n break;\n }\n case TokenType.COMMENT: {\n appendComment(p, token);\n break;\n }\n case TokenType.START_TAG: {\n startTagInBody(p, token);\n break;\n }\n case TokenType.END_TAG: {\n endTagInBody(p, token);\n break;\n }\n case TokenType.EOF: {\n eofInBody(p, token);\n break;\n }\n default:\n // Do nothing\n }\n}\nfunction whitespaceCharacterInBody(p, token) {\n p._reconstructActiveFormattingElements();\n p._insertCharacters(token);\n}\nfunction characterInBody(p, token) {\n p._reconstructActiveFormattingElements();\n p._insertCharacters(token);\n p.framesetOk = false;\n}\nfunction htmlStartTagInBody(p, token) {\n if (p.openElements.tmplCount === 0) {\n p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs);\n }\n}\nfunction bodyStartTagInBody(p, token) {\n const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();\n if (bodyElement && p.openElements.tmplCount === 0) {\n p.framesetOk = false;\n p.treeAdapter.adoptAttributes(bodyElement, token.attrs);\n }\n}\nfunction framesetStartTagInBody(p, token) {\n const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();\n if (p.framesetOk && bodyElement) {\n p.treeAdapter.detachNode(bodyElement);\n p.openElements.popAllUpToHtmlElement();\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_FRAMESET;\n }\n}\nfunction addressStartTagInBody(p, token) {\n if (p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n p._insertElement(token, NS.HTML);\n}\nfunction numberedHeaderStartTagInBody(p, token) {\n if (p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n if (p.openElements.currentTagId !== undefined && NUMBERED_HEADERS.has(p.openElements.currentTagId)) {\n p.openElements.pop();\n }\n p._insertElement(token, NS.HTML);\n}\nfunction preStartTagInBody(p, token) {\n if (p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n p._insertElement(token, NS.HTML);\n //NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move\n //on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.)\n p.skipNextNewLine = true;\n p.framesetOk = false;\n}\nfunction formStartTagInBody(p, token) {\n const inTemplate = p.openElements.tmplCount > 0;\n if (!p.formElement || inTemplate) {\n if (p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n p._insertElement(token, NS.HTML);\n if (!inTemplate) {\n p.formElement = p.openElements.current;\n }\n }\n}\nfunction listItemStartTagInBody(p, token) {\n p.framesetOk = false;\n const tn = token.tagID;\n for (let i = p.openElements.stackTop; i >= 0; i--) {\n const elementId = p.openElements.tagIDs[i];\n if ((tn === $.LI && elementId === $.LI) ||\n ((tn === $.DD || tn === $.DT) && (elementId === $.DD || elementId === $.DT))) {\n p.openElements.generateImpliedEndTagsWithExclusion(elementId);\n p.openElements.popUntilTagNamePopped(elementId);\n break;\n }\n if (elementId !== $.ADDRESS &&\n elementId !== $.DIV &&\n elementId !== $.P &&\n p._isSpecialElement(p.openElements.items[i], elementId)) {\n break;\n }\n }\n if (p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n p._insertElement(token, NS.HTML);\n}\nfunction plaintextStartTagInBody(p, token) {\n if (p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n p._insertElement(token, NS.HTML);\n p.tokenizer.state = TokenizerMode.PLAINTEXT;\n}\nfunction buttonStartTagInBody(p, token) {\n if (p.openElements.hasInScope($.BUTTON)) {\n p.openElements.generateImpliedEndTags();\n p.openElements.popUntilTagNamePopped($.BUTTON);\n }\n p._reconstructActiveFormattingElements();\n p._insertElement(token, NS.HTML);\n p.framesetOk = false;\n}\nfunction aStartTagInBody(p, token) {\n const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(TN.A);\n if (activeElementEntry) {\n callAdoptionAgency(p, token);\n p.openElements.remove(activeElementEntry.element);\n p.activeFormattingElements.removeEntry(activeElementEntry);\n }\n p._reconstructActiveFormattingElements();\n p._insertElement(token, NS.HTML);\n p.activeFormattingElements.pushElement(p.openElements.current, token);\n}\nfunction bStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n p._insertElement(token, NS.HTML);\n p.activeFormattingElements.pushElement(p.openElements.current, token);\n}\nfunction nobrStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n if (p.openElements.hasInScope($.NOBR)) {\n callAdoptionAgency(p, token);\n p._reconstructActiveFormattingElements();\n }\n p._insertElement(token, NS.HTML);\n p.activeFormattingElements.pushElement(p.openElements.current, token);\n}\nfunction appletStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n p._insertElement(token, NS.HTML);\n p.activeFormattingElements.insertMarker();\n p.framesetOk = false;\n}\nfunction tableStartTagInBody(p, token) {\n if (p.treeAdapter.getDocumentMode(p.document) !== DOCUMENT_MODE.QUIRKS && p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n p._insertElement(token, NS.HTML);\n p.framesetOk = false;\n p.insertionMode = InsertionMode.IN_TABLE;\n}\nfunction areaStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n p._appendElement(token, NS.HTML);\n p.framesetOk = false;\n token.ackSelfClosing = true;\n}\nfunction isHiddenInput(token) {\n const inputType = getTokenAttr(token, ATTRS.TYPE);\n return inputType != null && inputType.toLowerCase() === HIDDEN_INPUT_TYPE;\n}\nfunction inputStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n p._appendElement(token, NS.HTML);\n if (!isHiddenInput(token)) {\n p.framesetOk = false;\n }\n token.ackSelfClosing = true;\n}\nfunction paramStartTagInBody(p, token) {\n p._appendElement(token, NS.HTML);\n token.ackSelfClosing = true;\n}\nfunction hrStartTagInBody(p, token) {\n if (p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n p._appendElement(token, NS.HTML);\n p.framesetOk = false;\n token.ackSelfClosing = true;\n}\nfunction imageStartTagInBody(p, token) {\n token.tagName = TN.IMG;\n token.tagID = $.IMG;\n areaStartTagInBody(p, token);\n}\nfunction textareaStartTagInBody(p, token) {\n p._insertElement(token, NS.HTML);\n //NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move\n //on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.)\n p.skipNextNewLine = true;\n p.tokenizer.state = TokenizerMode.RCDATA;\n p.originalInsertionMode = p.insertionMode;\n p.framesetOk = false;\n p.insertionMode = InsertionMode.TEXT;\n}\nfunction xmpStartTagInBody(p, token) {\n if (p.openElements.hasInButtonScope($.P)) {\n p._closePElement();\n }\n p._reconstructActiveFormattingElements();\n p.framesetOk = false;\n p._switchToTextParsing(token, TokenizerMode.RAWTEXT);\n}\nfunction iframeStartTagInBody(p, token) {\n p.framesetOk = false;\n p._switchToTextParsing(token, TokenizerMode.RAWTEXT);\n}\n//NOTE: here we assume that we always act as a user agent with enabled plugins/frames, so we parse\n//<noembed>/<noframes> as rawtext.\nfunction rawTextStartTagInBody(p, token) {\n p._switchToTextParsing(token, TokenizerMode.RAWTEXT);\n}\nfunction selectStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n p._insertElement(token, NS.HTML);\n p.framesetOk = false;\n p.insertionMode =\n p.insertionMode === InsertionMode.IN_TABLE ||\n p.insertionMode === InsertionMode.IN_CAPTION ||\n p.insertionMode === InsertionMode.IN_TABLE_BODY ||\n p.insertionMode === InsertionMode.IN_ROW ||\n p.insertionMode === InsertionMode.IN_CELL\n ? InsertionMode.IN_SELECT_IN_TABLE\n : InsertionMode.IN_SELECT;\n}\nfunction optgroupStartTagInBody(p, token) {\n if (p.openElements.currentTagId === $.OPTION) {\n p.openElements.pop();\n }\n p._reconstructActiveFormattingElements();\n p._insertElement(token, NS.HTML);\n}\nfunction rbStartTagInBody(p, token) {\n if (p.openElements.hasInScope($.RUBY)) {\n p.openElements.generateImpliedEndTags();\n }\n p._insertElement(token, NS.HTML);\n}\nfunction rtStartTagInBody(p, token) {\n if (p.openElements.hasInScope($.RUBY)) {\n p.openElements.generateImpliedEndTagsWithExclusion($.RTC);\n }\n p._insertElement(token, NS.HTML);\n}\nfunction mathStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n foreignContent.adjustTokenMathMLAttrs(token);\n foreignContent.adjustTokenXMLAttrs(token);\n if (token.selfClosing) {\n p._appendElement(token, NS.MATHML);\n }\n else {\n p._insertElement(token, NS.MATHML);\n }\n token.ackSelfClosing = true;\n}\nfunction svgStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n foreignContent.adjustTokenSVGAttrs(token);\n foreignContent.adjustTokenXMLAttrs(token);\n if (token.selfClosing) {\n p._appendElement(token, NS.SVG);\n }\n else {\n p._insertElement(token, NS.SVG);\n }\n token.ackSelfClosing = true;\n}\nfunction genericStartTagInBody(p, token) {\n p._reconstructActiveFormattingElements();\n p._insertElement(token, NS.HTML);\n}\nfunction startTagInBody(p, token) {\n switch (token.tagID) {\n case $.I:\n case $.S:\n case $.B:\n case $.U:\n case $.EM:\n case $.TT:\n case $.BIG:\n case $.CODE:\n case $.FONT:\n case $.SMALL:\n case $.STRIKE:\n case $.STRONG: {\n bStartTagInBody(p, token);\n break;\n }\n case $.A: {\n aStartTagInBody(p, token);\n break;\n }\n case $.H1:\n case $.H2:\n case $.H3:\n case $.H4:\n case $.H5:\n case $.H6: {\n numberedHeaderStartTagInBody(p, token);\n break;\n }\n case $.P:\n case $.DL:\n case $.OL:\n case $.UL:\n case $.DIV:\n case $.DIR:\n case $.NAV:\n case $.MAIN:\n case $.MENU:\n case $.ASIDE:\n case $.CENTER:\n case $.FIGURE:\n case $.FOOTER:\n case $.HEADER:\n case $.HGROUP:\n case $.DIALOG:\n case $.DETAILS:\n case $.ADDRESS:\n case $.ARTICLE:\n case $.SEARCH:\n case $.SECTION:\n case $.SUMMARY:\n case $.FIELDSET:\n case $.BLOCKQUOTE:\n case $.FIGCAPTION: {\n addressStartTagInBody(p, token);\n break;\n }\n case $.LI:\n case $.DD:\n case $.DT: {\n listItemStartTagInBody(p, token);\n break;\n }\n case $.BR:\n case $.IMG:\n case $.WBR:\n case $.AREA:\n case $.EMBED:\n case $.KEYGEN: {\n areaStartTagInBody(p, token);\n break;\n }\n case $.HR: {\n hrStartTagInBody(p, token);\n break;\n }\n case $.RB:\n case $.RTC: {\n rbStartTagInBody(p, token);\n break;\n }\n case $.RT:\n case $.RP: {\n rtStartTagInBody(p, token);\n break;\n }\n case $.PRE:\n case $.LISTING: {\n preStartTagInBody(p, token);\n break;\n }\n case $.XMP: {\n xmpStartTagInBody(p, token);\n break;\n }\n case $.SVG: {\n svgStartTagInBody(p, token);\n break;\n }\n case $.HTML: {\n htmlStartTagInBody(p, token);\n break;\n }\n case $.BASE:\n case $.LINK:\n case $.META:\n case $.STYLE:\n case $.TITLE:\n case $.SCRIPT:\n case $.BGSOUND:\n case $.BASEFONT:\n case $.TEMPLATE: {\n startTagInHead(p, token);\n break;\n }\n case $.BODY: {\n bodyStartTagInBody(p, token);\n break;\n }\n case $.FORM: {\n formStartTagInBody(p, token);\n break;\n }\n case $.NOBR: {\n nobrStartTagInBody(p, token);\n break;\n }\n case $.MATH: {\n mathStartTagInBody(p, token);\n break;\n }\n case $.TABLE: {\n tableStartTagInBody(p, token);\n break;\n }\n case $.INPUT: {\n inputStartTagInBody(p, token);\n break;\n }\n case $.PARAM:\n case $.TRACK:\n case $.SOURCE: {\n paramStartTagInBody(p, token);\n break;\n }\n case $.IMAGE: {\n imageStartTagInBody(p, token);\n break;\n }\n case $.BUTTON: {\n buttonStartTagInBody(p, token);\n break;\n }\n case $.APPLET:\n case $.OBJECT:\n case $.MARQUEE: {\n appletStartTagInBody(p, token);\n break;\n }\n case $.IFRAME: {\n iframeStartTagInBody(p, token);\n break;\n }\n case $.SELECT: {\n selectStartTagInBody(p, token);\n break;\n }\n case $.OPTION:\n case $.OPTGROUP: {\n optgroupStartTagInBody(p, token);\n break;\n }\n case $.NOEMBED:\n case $.NOFRAMES: {\n rawTextStartTagInBody(p, token);\n break;\n }\n case $.FRAMESET: {\n framesetStartTagInBody(p, token);\n break;\n }\n case $.TEXTAREA: {\n textareaStartTagInBody(p, token);\n break;\n }\n case $.NOSCRIPT: {\n if (p.options.scriptingEnabled) {\n rawTextStartTagInBody(p, token);\n }\n else {\n genericStartTagInBody(p, token);\n }\n break;\n }\n case $.PLAINTEXT: {\n plaintextStartTagInBody(p, token);\n break;\n }\n case $.COL:\n case $.TH:\n case $.TD:\n case $.TR:\n case $.HEAD:\n case $.FRAME:\n case $.TBODY:\n case $.TFOOT:\n case $.THEAD:\n case $.CAPTION:\n case $.COLGROUP: {\n // Ignore token\n break;\n }\n default: {\n genericStartTagInBody(p, token);\n }\n }\n}\nfunction bodyEndTagInBody(p, token) {\n if (p.openElements.hasInScope($.BODY)) {\n p.insertionMode = InsertionMode.AFTER_BODY;\n //NOTE: <body> is never popped from the stack, so we need to updated\n //the end location explicitly.\n if (p.options.sourceCodeLocationInfo) {\n const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();\n if (bodyElement) {\n p._setEndLocation(bodyElement, token);\n }\n }\n }\n}\nfunction htmlEndTagInBody(p, token) {\n if (p.openElements.hasInScope($.BODY)) {\n p.insertionMode = InsertionMode.AFTER_BODY;\n endTagAfterBody(p, token);\n }\n}\nfunction addressEndTagInBody(p, token) {\n const tn = token.tagID;\n if (p.openElements.hasInScope(tn)) {\n p.openElements.generateImpliedEndTags();\n p.openElements.popUntilTagNamePopped(tn);\n }\n}\nfunction formEndTagInBody(p) {\n const inTemplate = p.openElements.tmplCount > 0;\n const { formElement } = p;\n if (!inTemplate) {\n p.formElement = null;\n }\n if ((formElement || inTemplate) && p.openElements.hasInScope($.FORM)) {\n p.openElements.generateImpliedEndTags();\n if (inTemplate) {\n p.openElements.popUntilTagNamePopped($.FORM);\n }\n else if (formElement) {\n p.openElements.remove(formElement);\n }\n }\n}\nfunction pEndTagInBody(p) {\n if (!p.openElements.hasInButtonScope($.P)) {\n p._insertFakeElement(TN.P, $.P);\n }\n p._closePElement();\n}\nfunction liEndTagInBody(p) {\n if (p.openElements.hasInListItemScope($.LI)) {\n p.openElements.generateImpliedEndTagsWithExclusion($.LI);\n p.openElements.popUntilTagNamePopped($.LI);\n }\n}\nfunction ddEndTagInBody(p, token) {\n const tn = token.tagID;\n if (p.openElements.hasInScope(tn)) {\n p.openElements.generateImpliedEndTagsWithExclusion(tn);\n p.openElements.popUntilTagNamePopped(tn);\n }\n}\nfunction numberedHeaderEndTagInBody(p) {\n if (p.openElements.hasNumberedHeaderInScope()) {\n p.openElements.generateImpliedEndTags();\n p.openElements.popUntilNumberedHeaderPopped();\n }\n}\nfunction appletEndTagInBody(p, token) {\n const tn = token.tagID;\n if (p.openElements.hasInScope(tn)) {\n p.openElements.generateImpliedEndTags();\n p.openElements.popUntilTagNamePopped(tn);\n p.activeFormattingElements.clearToLastMarker();\n }\n}\nfunction brEndTagInBody(p) {\n p._reconstructActiveFormattingElements();\n p._insertFakeElement(TN.BR, $.BR);\n p.openElements.pop();\n p.framesetOk = false;\n}\nfunction genericEndTagInBody(p, token) {\n const tn = token.tagName;\n const tid = token.tagID;\n for (let i = p.openElements.stackTop; i > 0; i--) {\n const element = p.openElements.items[i];\n const elementId = p.openElements.tagIDs[i];\n // Compare the tag name here, as the tag might not be a known tag with an ID.\n if (tid === elementId && (tid !== $.UNKNOWN || p.treeAdapter.getTagName(element) === tn)) {\n p.openElements.generateImpliedEndTagsWithExclusion(tid);\n if (p.openElements.stackTop >= i)\n p.openElements.shortenToLength(i);\n break;\n }\n if (p._isSpecialElement(element, elementId)) {\n break;\n }\n }\n}\nfunction endTagInBody(p, token) {\n switch (token.tagID) {\n case $.A:\n case $.B:\n case $.I:\n case $.S:\n case $.U:\n case $.EM:\n case $.TT:\n case $.BIG:\n case $.CODE:\n case $.FONT:\n case $.NOBR:\n case $.SMALL:\n case $.STRIKE:\n case $.STRONG: {\n callAdoptionAgency(p, token);\n break;\n }\n case $.P: {\n pEndTagInBody(p);\n break;\n }\n case $.DL:\n case $.UL:\n case $.OL:\n case $.DIR:\n case $.DIV:\n case $.NAV:\n case $.PRE:\n case $.MAIN:\n case $.MENU:\n case $.ASIDE:\n case $.BUTTON:\n case $.CENTER:\n case $.FIGURE:\n case $.FOOTER:\n case $.HEADER:\n case $.HGROUP:\n case $.DIALOG:\n case $.ADDRESS:\n case $.ARTICLE:\n case $.DETAILS:\n case $.SEARCH:\n case $.SECTION:\n case $.SUMMARY:\n case $.LISTING:\n case $.FIELDSET:\n case $.BLOCKQUOTE:\n case $.FIGCAPTION: {\n addressEndTagInBody(p, token);\n break;\n }\n case $.LI: {\n liEndTagInBody(p);\n break;\n }\n case $.DD:\n case $.DT: {\n ddEndTagInBody(p, token);\n break;\n }\n case $.H1:\n case $.H2:\n case $.H3:\n case $.H4:\n case $.H5:\n case $.H6: {\n numberedHeaderEndTagInBody(p);\n break;\n }\n case $.BR: {\n brEndTagInBody(p);\n break;\n }\n case $.BODY: {\n bodyEndTagInBody(p, token);\n break;\n }\n case $.HTML: {\n htmlEndTagInBody(p, token);\n break;\n }\n case $.FORM: {\n formEndTagInBody(p);\n break;\n }\n case $.APPLET:\n case $.OBJECT:\n case $.MARQUEE: {\n appletEndTagInBody(p, token);\n break;\n }\n case $.TEMPLATE: {\n templateEndTagInHead(p, token);\n break;\n }\n default: {\n genericEndTagInBody(p, token);\n }\n }\n}\nfunction eofInBody(p, token) {\n if (p.tmplInsertionModeStack.length > 0) {\n eofInTemplate(p, token);\n }\n else {\n stopParsing(p, token);\n }\n}\n// The \"text\" insertion mode\n//------------------------------------------------------------------\nfunction endTagInText(p, token) {\n var _a;\n if (token.tagID === $.SCRIPT) {\n (_a = p.scriptHandler) === null || _a === void 0 ? void 0 : _a.call(p, p.openElements.current);\n }\n p.openElements.pop();\n p.insertionMode = p.originalInsertionMode;\n}\nfunction eofInText(p, token) {\n p._err(token, ERR.eofInElementThatCanContainOnlyText);\n p.openElements.pop();\n p.insertionMode = p.originalInsertionMode;\n p.onEof(token);\n}\n// The \"in table\" insertion mode\n//------------------------------------------------------------------\nfunction characterInTable(p, token) {\n if (p.openElements.currentTagId !== undefined && TABLE_STRUCTURE_TAGS.has(p.openElements.currentTagId)) {\n p.pendingCharacterTokens.length = 0;\n p.hasNonWhitespacePendingCharacterToken = false;\n p.originalInsertionMode = p.insertionMode;\n p.insertionMode = InsertionMode.IN_TABLE_TEXT;\n switch (token.type) {\n case TokenType.CHARACTER: {\n characterInTableText(p, token);\n break;\n }\n case TokenType.WHITESPACE_CHARACTER: {\n whitespaceCharacterInTableText(p, token);\n break;\n }\n // Ignore null\n }\n }\n else {\n tokenInTable(p, token);\n }\n}\nfunction captionStartTagInTable(p, token) {\n p.openElements.clearBackToTableContext();\n p.activeFormattingElements.insertMarker();\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_CAPTION;\n}\nfunction colgroupStartTagInTable(p, token) {\n p.openElements.clearBackToTableContext();\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_COLUMN_GROUP;\n}\nfunction colStartTagInTable(p, token) {\n p.openElements.clearBackToTableContext();\n p._insertFakeElement(TN.COLGROUP, $.COLGROUP);\n p.insertionMode = InsertionMode.IN_COLUMN_GROUP;\n startTagInColumnGroup(p, token);\n}\nfunction tbodyStartTagInTable(p, token) {\n p.openElements.clearBackToTableContext();\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n}\nfunction tdStartTagInTable(p, token) {\n p.openElements.clearBackToTableContext();\n p._insertFakeElement(TN.TBODY, $.TBODY);\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n startTagInTableBody(p, token);\n}\nfunction tableStartTagInTable(p, token) {\n if (p.openElements.hasInTableScope($.TABLE)) {\n p.openElements.popUntilTagNamePopped($.TABLE);\n p._resetInsertionMode();\n p._processStartTag(token);\n }\n}\nfunction inputStartTagInTable(p, token) {\n if (isHiddenInput(token)) {\n p._appendElement(token, NS.HTML);\n }\n else {\n tokenInTable(p, token);\n }\n token.ackSelfClosing = true;\n}\nfunction formStartTagInTable(p, token) {\n if (!p.formElement && p.openElements.tmplCount === 0) {\n p._insertElement(token, NS.HTML);\n p.formElement = p.openElements.current;\n p.openElements.pop();\n }\n}\nfunction startTagInTable(p, token) {\n switch (token.tagID) {\n case $.TD:\n case $.TH:\n case $.TR: {\n tdStartTagInTable(p, token);\n break;\n }\n case $.STYLE:\n case $.SCRIPT:\n case $.TEMPLATE: {\n startTagInHead(p, token);\n break;\n }\n case $.COL: {\n colStartTagInTable(p, token);\n break;\n }\n case $.FORM: {\n formStartTagInTable(p, token);\n break;\n }\n case $.TABLE: {\n tableStartTagInTable(p, token);\n break;\n }\n case $.TBODY:\n case $.TFOOT:\n case $.THEAD: {\n tbodyStartTagInTable(p, token);\n break;\n }\n case $.INPUT: {\n inputStartTagInTable(p, token);\n break;\n }\n case $.CAPTION: {\n captionStartTagInTable(p, token);\n break;\n }\n case $.COLGROUP: {\n colgroupStartTagInTable(p, token);\n break;\n }\n default: {\n tokenInTable(p, token);\n }\n }\n}\nfunction endTagInTable(p, token) {\n switch (token.tagID) {\n case $.TABLE: {\n if (p.openElements.hasInTableScope($.TABLE)) {\n p.openElements.popUntilTagNamePopped($.TABLE);\n p._resetInsertionMode();\n }\n break;\n }\n case $.TEMPLATE: {\n templateEndTagInHead(p, token);\n break;\n }\n case $.BODY:\n case $.CAPTION:\n case $.COL:\n case $.COLGROUP:\n case $.HTML:\n case $.TBODY:\n case $.TD:\n case $.TFOOT:\n case $.TH:\n case $.THEAD:\n case $.TR: {\n // Ignore token\n break;\n }\n default: {\n tokenInTable(p, token);\n }\n }\n}\nfunction tokenInTable(p, token) {\n const savedFosterParentingState = p.fosterParentingEnabled;\n p.fosterParentingEnabled = true;\n // Process token in `In Body` mode\n modeInBody(p, token);\n p.fosterParentingEnabled = savedFosterParentingState;\n}\n// The \"in table text\" insertion mode\n//------------------------------------------------------------------\nfunction whitespaceCharacterInTableText(p, token) {\n p.pendingCharacterTokens.push(token);\n}\nfunction characterInTableText(p, token) {\n p.pendingCharacterTokens.push(token);\n p.hasNonWhitespacePendingCharacterToken = true;\n}\nfunction tokenInTableText(p, token) {\n let i = 0;\n if (p.hasNonWhitespacePendingCharacterToken) {\n for (; i < p.pendingCharacterTokens.length; i++) {\n tokenInTable(p, p.pendingCharacterTokens[i]);\n }\n }\n else {\n for (; i < p.pendingCharacterTokens.length; i++) {\n p._insertCharacters(p.pendingCharacterTokens[i]);\n }\n }\n p.insertionMode = p.originalInsertionMode;\n p._processToken(token);\n}\n// The \"in caption\" insertion mode\n//------------------------------------------------------------------\nconst TABLE_VOID_ELEMENTS = new Set([$.CAPTION, $.COL, $.COLGROUP, $.TBODY, $.TD, $.TFOOT, $.TH, $.THEAD, $.TR]);\nfunction startTagInCaption(p, token) {\n const tn = token.tagID;\n if (TABLE_VOID_ELEMENTS.has(tn)) {\n if (p.openElements.hasInTableScope($.CAPTION)) {\n p.openElements.generateImpliedEndTags();\n p.openElements.popUntilTagNamePopped($.CAPTION);\n p.activeFormattingElements.clearToLastMarker();\n p.insertionMode = InsertionMode.IN_TABLE;\n startTagInTable(p, token);\n }\n }\n else {\n startTagInBody(p, token);\n }\n}\nfunction endTagInCaption(p, token) {\n const tn = token.tagID;\n switch (tn) {\n case $.CAPTION:\n case $.TABLE: {\n if (p.openElements.hasInTableScope($.CAPTION)) {\n p.openElements.generateImpliedEndTags();\n p.openElements.popUntilTagNamePopped($.CAPTION);\n p.activeFormattingElements.clearToLastMarker();\n p.insertionMode = InsertionMode.IN_TABLE;\n if (tn === $.TABLE) {\n endTagInTable(p, token);\n }\n }\n break;\n }\n case $.BODY:\n case $.COL:\n case $.COLGROUP:\n case $.HTML:\n case $.TBODY:\n case $.TD:\n case $.TFOOT:\n case $.TH:\n case $.THEAD:\n case $.TR: {\n // Ignore token\n break;\n }\n default: {\n endTagInBody(p, token);\n }\n }\n}\n// The \"in column group\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInColumnGroup(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.COL: {\n p._appendElement(token, NS.HTML);\n token.ackSelfClosing = true;\n break;\n }\n case $.TEMPLATE: {\n startTagInHead(p, token);\n break;\n }\n default: {\n tokenInColumnGroup(p, token);\n }\n }\n}\nfunction endTagInColumnGroup(p, token) {\n switch (token.tagID) {\n case $.COLGROUP: {\n if (p.openElements.currentTagId === $.COLGROUP) {\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE;\n }\n break;\n }\n case $.TEMPLATE: {\n templateEndTagInHead(p, token);\n break;\n }\n case $.COL: {\n // Ignore token\n break;\n }\n default: {\n tokenInColumnGroup(p, token);\n }\n }\n}\nfunction tokenInColumnGroup(p, token) {\n if (p.openElements.currentTagId === $.COLGROUP) {\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE;\n p._processToken(token);\n }\n}\n// The \"in table body\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInTableBody(p, token) {\n switch (token.tagID) {\n case $.TR: {\n p.openElements.clearBackToTableBodyContext();\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_ROW;\n break;\n }\n case $.TH:\n case $.TD: {\n p.openElements.clearBackToTableBodyContext();\n p._insertFakeElement(TN.TR, $.TR);\n p.insertionMode = InsertionMode.IN_ROW;\n startTagInRow(p, token);\n break;\n }\n case $.CAPTION:\n case $.COL:\n case $.COLGROUP:\n case $.TBODY:\n case $.TFOOT:\n case $.THEAD: {\n if (p.openElements.hasTableBodyContextInTableScope()) {\n p.openElements.clearBackToTableBodyContext();\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE;\n startTagInTable(p, token);\n }\n break;\n }\n default: {\n startTagInTable(p, token);\n }\n }\n}\nfunction endTagInTableBody(p, token) {\n const tn = token.tagID;\n switch (token.tagID) {\n case $.TBODY:\n case $.TFOOT:\n case $.THEAD: {\n if (p.openElements.hasInTableScope(tn)) {\n p.openElements.clearBackToTableBodyContext();\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE;\n }\n break;\n }\n case $.TABLE: {\n if (p.openElements.hasTableBodyContextInTableScope()) {\n p.openElements.clearBackToTableBodyContext();\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE;\n endTagInTable(p, token);\n }\n break;\n }\n case $.BODY:\n case $.CAPTION:\n case $.COL:\n case $.COLGROUP:\n case $.HTML:\n case $.TD:\n case $.TH:\n case $.TR: {\n // Ignore token\n break;\n }\n default: {\n endTagInTable(p, token);\n }\n }\n}\n// The \"in row\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInRow(p, token) {\n switch (token.tagID) {\n case $.TH:\n case $.TD: {\n p.openElements.clearBackToTableRowContext();\n p._insertElement(token, NS.HTML);\n p.insertionMode = InsertionMode.IN_CELL;\n p.activeFormattingElements.insertMarker();\n break;\n }\n case $.CAPTION:\n case $.COL:\n case $.COLGROUP:\n case $.TBODY:\n case $.TFOOT:\n case $.THEAD:\n case $.TR: {\n if (p.openElements.hasInTableScope($.TR)) {\n p.openElements.clearBackToTableRowContext();\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n startTagInTableBody(p, token);\n }\n break;\n }\n default: {\n startTagInTable(p, token);\n }\n }\n}\nfunction endTagInRow(p, token) {\n switch (token.tagID) {\n case $.TR: {\n if (p.openElements.hasInTableScope($.TR)) {\n p.openElements.clearBackToTableRowContext();\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n }\n break;\n }\n case $.TABLE: {\n if (p.openElements.hasInTableScope($.TR)) {\n p.openElements.clearBackToTableRowContext();\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n endTagInTableBody(p, token);\n }\n break;\n }\n case $.TBODY:\n case $.TFOOT:\n case $.THEAD: {\n if (p.openElements.hasInTableScope(token.tagID) || p.openElements.hasInTableScope($.TR)) {\n p.openElements.clearBackToTableRowContext();\n p.openElements.pop();\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n endTagInTableBody(p, token);\n }\n break;\n }\n case $.BODY:\n case $.CAPTION:\n case $.COL:\n case $.COLGROUP:\n case $.HTML:\n case $.TD:\n case $.TH: {\n // Ignore end tag\n break;\n }\n default: {\n endTagInTable(p, token);\n }\n }\n}\n// The \"in cell\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInCell(p, token) {\n const tn = token.tagID;\n if (TABLE_VOID_ELEMENTS.has(tn)) {\n if (p.openElements.hasInTableScope($.TD) || p.openElements.hasInTableScope($.TH)) {\n p._closeTableCell();\n startTagInRow(p, token);\n }\n }\n else {\n startTagInBody(p, token);\n }\n}\nfunction endTagInCell(p, token) {\n const tn = token.tagID;\n switch (tn) {\n case $.TD:\n case $.TH: {\n if (p.openElements.hasInTableScope(tn)) {\n p.openElements.generateImpliedEndTags();\n p.openElements.popUntilTagNamePopped(tn);\n p.activeFormattingElements.clearToLastMarker();\n p.insertionMode = InsertionMode.IN_ROW;\n }\n break;\n }\n case $.TABLE:\n case $.TBODY:\n case $.TFOOT:\n case $.THEAD:\n case $.TR: {\n if (p.openElements.hasInTableScope(tn)) {\n p._closeTableCell();\n endTagInRow(p, token);\n }\n break;\n }\n case $.BODY:\n case $.CAPTION:\n case $.COL:\n case $.COLGROUP:\n case $.HTML: {\n // Ignore token\n break;\n }\n default: {\n endTagInBody(p, token);\n }\n }\n}\n// The \"in select\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInSelect(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.OPTION: {\n if (p.openElements.currentTagId === $.OPTION) {\n p.openElements.pop();\n }\n p._insertElement(token, NS.HTML);\n break;\n }\n case $.OPTGROUP: {\n if (p.openElements.currentTagId === $.OPTION) {\n p.openElements.pop();\n }\n if (p.openElements.currentTagId === $.OPTGROUP) {\n p.openElements.pop();\n }\n p._insertElement(token, NS.HTML);\n break;\n }\n case $.HR: {\n if (p.openElements.currentTagId === $.OPTION) {\n p.openElements.pop();\n }\n if (p.openElements.currentTagId === $.OPTGROUP) {\n p.openElements.pop();\n }\n p._appendElement(token, NS.HTML);\n token.ackSelfClosing = true;\n break;\n }\n case $.INPUT:\n case $.KEYGEN:\n case $.TEXTAREA:\n case $.SELECT: {\n if (p.openElements.hasInSelectScope($.SELECT)) {\n p.openElements.popUntilTagNamePopped($.SELECT);\n p._resetInsertionMode();\n if (token.tagID !== $.SELECT) {\n p._processStartTag(token);\n }\n }\n break;\n }\n case $.SCRIPT:\n case $.TEMPLATE: {\n startTagInHead(p, token);\n break;\n }\n default:\n // Do nothing\n }\n}\nfunction endTagInSelect(p, token) {\n switch (token.tagID) {\n case $.OPTGROUP: {\n if (p.openElements.stackTop > 0 &&\n p.openElements.currentTagId === $.OPTION &&\n p.openElements.tagIDs[p.openElements.stackTop - 1] === $.OPTGROUP) {\n p.openElements.pop();\n }\n if (p.openElements.currentTagId === $.OPTGROUP) {\n p.openElements.pop();\n }\n break;\n }\n case $.OPTION: {\n if (p.openElements.currentTagId === $.OPTION) {\n p.openElements.pop();\n }\n break;\n }\n case $.SELECT: {\n if (p.openElements.hasInSelectScope($.SELECT)) {\n p.openElements.popUntilTagNamePopped($.SELECT);\n p._resetInsertionMode();\n }\n break;\n }\n case $.TEMPLATE: {\n templateEndTagInHead(p, token);\n break;\n }\n default:\n // Do nothing\n }\n}\n// The \"in select in table\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInSelectInTable(p, token) {\n const tn = token.tagID;\n if (tn === $.CAPTION ||\n tn === $.TABLE ||\n tn === $.TBODY ||\n tn === $.TFOOT ||\n tn === $.THEAD ||\n tn === $.TR ||\n tn === $.TD ||\n tn === $.TH) {\n p.openElements.popUntilTagNamePopped($.SELECT);\n p._resetInsertionMode();\n p._processStartTag(token);\n }\n else {\n startTagInSelect(p, token);\n }\n}\nfunction endTagInSelectInTable(p, token) {\n const tn = token.tagID;\n if (tn === $.CAPTION ||\n tn === $.TABLE ||\n tn === $.TBODY ||\n tn === $.TFOOT ||\n tn === $.THEAD ||\n tn === $.TR ||\n tn === $.TD ||\n tn === $.TH) {\n if (p.openElements.hasInTableScope(tn)) {\n p.openElements.popUntilTagNamePopped($.SELECT);\n p._resetInsertionMode();\n p.onEndTag(token);\n }\n }\n else {\n endTagInSelect(p, token);\n }\n}\n// The \"in template\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInTemplate(p, token) {\n switch (token.tagID) {\n // First, handle tags that can start without a mode change\n case $.BASE:\n case $.BASEFONT:\n case $.BGSOUND:\n case $.LINK:\n case $.META:\n case $.NOFRAMES:\n case $.SCRIPT:\n case $.STYLE:\n case $.TEMPLATE:\n case $.TITLE: {\n startTagInHead(p, token);\n break;\n }\n // Re-process the token in the appropriate mode\n case $.CAPTION:\n case $.COLGROUP:\n case $.TBODY:\n case $.TFOOT:\n case $.THEAD: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;\n p.insertionMode = InsertionMode.IN_TABLE;\n startTagInTable(p, token);\n break;\n }\n case $.COL: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;\n p.insertionMode = InsertionMode.IN_COLUMN_GROUP;\n startTagInColumnGroup(p, token);\n break;\n }\n case $.TR: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n startTagInTableBody(p, token);\n break;\n }\n case $.TD:\n case $.TH: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;\n p.insertionMode = InsertionMode.IN_ROW;\n startTagInRow(p, token);\n break;\n }\n default: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;\n p.insertionMode = InsertionMode.IN_BODY;\n startTagInBody(p, token);\n }\n }\n}\nfunction endTagInTemplate(p, token) {\n if (token.tagID === $.TEMPLATE) {\n templateEndTagInHead(p, token);\n }\n}\nfunction eofInTemplate(p, token) {\n if (p.openElements.tmplCount > 0) {\n p.openElements.popUntilTagNamePopped($.TEMPLATE);\n p.activeFormattingElements.clearToLastMarker();\n p.tmplInsertionModeStack.shift();\n p._resetInsertionMode();\n p.onEof(token);\n }\n else {\n stopParsing(p, token);\n }\n}\n// The \"after body\" insertion mode\n//------------------------------------------------------------------\nfunction startTagAfterBody(p, token) {\n if (token.tagID === $.HTML) {\n startTagInBody(p, token);\n }\n else {\n tokenAfterBody(p, token);\n }\n}\nfunction endTagAfterBody(p, token) {\n var _a;\n if (token.tagID === $.HTML) {\n if (!p.fragmentContext) {\n p.insertionMode = InsertionMode.AFTER_AFTER_BODY;\n }\n //NOTE: <html> is never popped from the stack, so we need to updated\n //the end location explicitly.\n if (p.options.sourceCodeLocationInfo && p.openElements.tagIDs[0] === $.HTML) {\n p._setEndLocation(p.openElements.items[0], token);\n // Update the body element, if it doesn't have an end tag\n const bodyElement = p.openElements.items[1];\n if (bodyElement && !((_a = p.treeAdapter.getNodeSourceCodeLocation(bodyElement)) === null || _a === void 0 ? void 0 : _a.endTag)) {\n p._setEndLocation(bodyElement, token);\n }\n }\n }\n else {\n tokenAfterBody(p, token);\n }\n}\nfunction tokenAfterBody(p, token) {\n p.insertionMode = InsertionMode.IN_BODY;\n modeInBody(p, token);\n}\n// The \"in frameset\" insertion mode\n//------------------------------------------------------------------\nfunction startTagInFrameset(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.FRAMESET: {\n p._insertElement(token, NS.HTML);\n break;\n }\n case $.FRAME: {\n p._appendElement(token, NS.HTML);\n token.ackSelfClosing = true;\n break;\n }\n case $.NOFRAMES: {\n startTagInHead(p, token);\n break;\n }\n default:\n // Do nothing\n }\n}\nfunction endTagInFrameset(p, token) {\n if (token.tagID === $.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) {\n p.openElements.pop();\n if (!p.fragmentContext && p.openElements.currentTagId !== $.FRAMESET) {\n p.insertionMode = InsertionMode.AFTER_FRAMESET;\n }\n }\n}\n// The \"after frameset\" insertion mode\n//------------------------------------------------------------------\nfunction startTagAfterFrameset(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.NOFRAMES: {\n startTagInHead(p, token);\n break;\n }\n default:\n // Do nothing\n }\n}\nfunction endTagAfterFrameset(p, token) {\n if (token.tagID === $.HTML) {\n p.insertionMode = InsertionMode.AFTER_AFTER_FRAMESET;\n }\n}\n// The \"after after body\" insertion mode\n//------------------------------------------------------------------\nfunction startTagAfterAfterBody(p, token) {\n if (token.tagID === $.HTML) {\n startTagInBody(p, token);\n }\n else {\n tokenAfterAfterBody(p, token);\n }\n}\nfunction tokenAfterAfterBody(p, token) {\n p.insertionMode = InsertionMode.IN_BODY;\n modeInBody(p, token);\n}\n// The \"after after frameset\" insertion mode\n//------------------------------------------------------------------\nfunction startTagAfterAfterFrameset(p, token) {\n switch (token.tagID) {\n case $.HTML: {\n startTagInBody(p, token);\n break;\n }\n case $.NOFRAMES: {\n startTagInHead(p, token);\n break;\n }\n default:\n // Do nothing\n }\n}\n// The rules for parsing tokens in foreign content\n//------------------------------------------------------------------\nfunction nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}\nfunction characterInForeignContent(p, token) {\n p._insertCharacters(token);\n p.framesetOk = false;\n}\nfunction popUntilHtmlOrIntegrationPoint(p) {\n while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML &&\n p.openElements.currentTagId !== undefined &&\n !p._isIntegrationPoint(p.openElements.currentTagId, p.openElements.current)) {\n p.openElements.pop();\n }\n}\nfunction startTagInForeignContent(p, token) {\n if (foreignContent.causesExit(token)) {\n popUntilHtmlOrIntegrationPoint(p);\n p._startTagOutsideForeignContent(token);\n }\n else {\n const current = p._getAdjustedCurrentElement();\n const currentNs = p.treeAdapter.getNamespaceURI(current);\n if (currentNs === NS.MATHML) {\n foreignContent.adjustTokenMathMLAttrs(token);\n }\n else if (currentNs === NS.SVG) {\n foreignContent.adjustTokenSVGTagName(token);\n foreignContent.adjustTokenSVGAttrs(token);\n }\n foreignContent.adjustTokenXMLAttrs(token);\n if (token.selfClosing) {\n p._appendElement(token, currentNs);\n }\n else {\n p._insertElement(token, currentNs);\n }\n token.ackSelfClosing = true;\n }\n}\nfunction endTagInForeignContent(p, token) {\n if (token.tagID === $.P || token.tagID === $.BR) {\n popUntilHtmlOrIntegrationPoint(p);\n p._endTagOutsideForeignContent(token);\n return;\n }\n for (let i = p.openElements.stackTop; i > 0; i--) {\n const element = p.openElements.items[i];\n if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) {\n p._endTagOutsideForeignContent(token);\n break;\n }\n const tagName = p.treeAdapter.getTagName(element);\n if (tagName.toLowerCase() === token.tagName) {\n //NOTE: update the token tag name for `_setEndLocation`.\n token.tagName = tagName;\n p.openElements.shortenToLength(i);\n break;\n }\n }\n}\n","import { TAG_NAMES as $, NS, hasUnescapedText } from '../common/html.js';\nimport { escapeText, escapeAttribute } from 'entities/escape';\nimport { defaultTreeAdapter } from '../tree-adapters/default.js';\n// Sets\nconst VOID_ELEMENTS = new Set([\n $.AREA,\n $.BASE,\n $.BASEFONT,\n $.BGSOUND,\n $.BR,\n $.COL,\n $.EMBED,\n $.FRAME,\n $.HR,\n $.IMG,\n $.INPUT,\n $.KEYGEN,\n $.LINK,\n $.META,\n $.PARAM,\n $.SOURCE,\n $.TRACK,\n $.WBR,\n]);\nfunction isVoidElement(node, options) {\n return (options.treeAdapter.isElementNode(node) &&\n options.treeAdapter.getNamespaceURI(node) === NS.HTML &&\n VOID_ELEMENTS.has(options.treeAdapter.getTagName(node)));\n}\nconst defaultOpts = { treeAdapter: defaultTreeAdapter, scriptingEnabled: true };\n/**\n * Serializes an AST node to an HTML string.\n *\n * @example\n *\n * ```js\n * const parse5 = require('parse5');\n *\n * const document = parse5.parse('<!DOCTYPE html><html><head></head><body>Hi there!</body></html>');\n *\n * // Serializes a document.\n * const html = parse5.serialize(document);\n *\n * // Serializes the <html> element content.\n * const str = parse5.serialize(document.childNodes[1]);\n *\n * console.log(str); //> '<head></head><body>Hi there!</body>'\n * ```\n *\n * @param node Node to serialize.\n * @param options Serialization options.\n */\nexport function serialize(node, options) {\n const opts = { ...defaultOpts, ...options };\n if (isVoidElement(node, opts)) {\n return '';\n }\n return serializeChildNodes(node, opts);\n}\n/**\n * Serializes an AST element node to an HTML string, including the element node.\n *\n * @example\n *\n * ```js\n * const parse5 = require('parse5');\n *\n * const document = parse5.parseFragment('<div>Hello, <b>world</b>!</div>');\n *\n * // Serializes the <div> element.\n * const str = parse5.serializeOuter(document.childNodes[0]);\n *\n * console.log(str); //> '<div>Hello, <b>world</b>!</div>'\n * ```\n *\n * @param node Node to serialize.\n * @param options Serialization options.\n */\nexport function serializeOuter(node, options) {\n const opts = { ...defaultOpts, ...options };\n return serializeNode(node, opts);\n}\nfunction serializeChildNodes(parentNode, options) {\n let html = '';\n // Get container of the child nodes\n const container = options.treeAdapter.isElementNode(parentNode) &&\n options.treeAdapter.getTagName(parentNode) === $.TEMPLATE &&\n options.treeAdapter.getNamespaceURI(parentNode) === NS.HTML\n ? options.treeAdapter.getTemplateContent(parentNode)\n : parentNode;\n const childNodes = options.treeAdapter.getChildNodes(container);\n if (childNodes) {\n for (const currentNode of childNodes) {\n html += serializeNode(currentNode, options);\n }\n }\n return html;\n}\nfunction serializeNode(node, options) {\n if (options.treeAdapter.isElementNode(node)) {\n return serializeElement(node, options);\n }\n if (options.treeAdapter.isTextNode(node)) {\n return serializeTextNode(node, options);\n }\n if (options.treeAdapter.isCommentNode(node)) {\n return serializeCommentNode(node, options);\n }\n if (options.treeAdapter.isDocumentTypeNode(node)) {\n return serializeDocumentTypeNode(node, options);\n }\n // Return an empty string for unknown nodes\n return '';\n}\nfunction serializeElement(node, options) {\n const tn = options.treeAdapter.getTagName(node);\n return `<${tn}${serializeAttributes(node, options)}>${isVoidElement(node, options) ? '' : `${serializeChildNodes(node, options)}</${tn}>`}`;\n}\nfunction serializeAttributes(node, { treeAdapter }) {\n let html = '';\n for (const attr of treeAdapter.getAttrList(node)) {\n html += ' ';\n if (attr.namespace) {\n switch (attr.namespace) {\n case NS.XML: {\n html += `xml:${attr.name}`;\n break;\n }\n case NS.XMLNS: {\n if (attr.name !== 'xmlns') {\n html += 'xmlns:';\n }\n html += attr.name;\n break;\n }\n case NS.XLINK: {\n html += `xlink:${attr.name}`;\n break;\n }\n default: {\n html += `${attr.prefix}:${attr.name}`;\n }\n }\n }\n else {\n html += attr.name;\n }\n html += `=\"${escapeAttribute(attr.value)}\"`;\n }\n return html;\n}\nfunction serializeTextNode(node, options) {\n const { treeAdapter } = options;\n const content = treeAdapter.getTextNodeContent(node);\n const parent = treeAdapter.getParentNode(node);\n const parentTn = parent && treeAdapter.isElementNode(parent) && treeAdapter.getTagName(parent);\n return parentTn &&\n treeAdapter.getNamespaceURI(parent) === NS.HTML &&\n hasUnescapedText(parentTn, options.scriptingEnabled)\n ? content\n : escapeText(content);\n}\nfunction serializeCommentNode(node, { treeAdapter }) {\n return `<!--${treeAdapter.getCommentNodeContent(node)}-->`;\n}\nfunction serializeDocumentTypeNode(node, { treeAdapter }) {\n return `<!DOCTYPE ${treeAdapter.getDocumentTypeNodeName(node)}>`;\n}\n","import { Parser } from './parser/index.js';\nexport { defaultTreeAdapter } from './tree-adapters/default.js';\nexport { /** @internal */ Parser } from './parser/index.js';\nexport { serialize, serializeOuter } from './serializer/index.js';\nexport { ERR as ErrorCodes } from './common/error-codes.js';\n/** @internal */\nexport * as foreignContent from './common/foreign-content.js';\nexport * as html from './common/html.js';\nexport * as Token from './common/token.js';\n/** @internal */\nexport { Tokenizer, TokenizerMode } from './tokenizer/index.js';\n// Shorthands\n/**\n * Parses an HTML string.\n *\n * @param html Input HTML string.\n * @param options Parsing options.\n * @returns Document\n *\n * @example\n *\n * ```js\n * const parse5 = require('parse5');\n *\n * const document = parse5.parse('<!DOCTYPE html><html><head></head><body>Hi there!</body></html>');\n *\n * console.log(document.childNodes[1].tagName); //> 'html'\n *```\n */\nexport function parse(html, options) {\n return Parser.parse(html, options);\n}\nexport function parseFragment(fragmentContext, html, options) {\n if (typeof fragmentContext === 'string') {\n options = html;\n html = fragmentContext;\n fragmentContext = null;\n }\n const parser = Parser.getFragmentParser(fragmentContext, options);\n parser.tokenizer.write(html, true);\n return parser.getFragment();\n}\n","/**\n * The lexical context of a position in JavaScript or CSS source: inside a string literal, a template literal, a\n * comment, or code. The template filler uses it to escape a placeholder written into a script or style element, and\n * the script and style escapers use it to tell whether `<\\/script` keeps the value of what it escapes.\n *\n * JavaScript is tokenized with acorn (bundled), which tells a regular expression literal from a division the way a\n * parser does. CSS needs only strings and comments, which CSS Syntax Level 3 tokenizes without context.\n */\nimport { tokTypes } from 'acorn';\nimport type { Token } from 'acorn';\nimport { AcornParser, SCRIPT_OPTIONS, trySyntax } from './js-syntax.js';\n\n/** Where a range of JavaScript source lies. */\nexport type JavaScriptContext =\n | { readonly kind: 'string'; readonly quote: '\"' | \"'\"; readonly whole: boolean }\n | { readonly kind: 'template'; readonly tagged: boolean }\n | { readonly kind: 'regexp'; readonly flags: string }\n | { readonly kind: 'block-comment' }\n /** A single-line comment: `//`, or one of the HTML-like comments of classic scripts, which `start` with `<!--`. */\n | { readonly kind: 'line-comment'; readonly start: number }\n | { readonly kind: 'code' }\n /** acorn could not tokenize the source; `reason` says why. */\n | { readonly kind: 'unparsable'; readonly reason: string };\n\n/** Where a range of CSS source lies. */\nexport type CssContext =\n { readonly kind: 'string'; readonly quote: '\"' | \"'\" } | { readonly kind: 'comment' } | { readonly kind: 'code' };\n\n/** A half-open range of offsets into a source text. */\nexport interface SourceRange {\n readonly start: number;\n readonly end: number;\n}\n\ninterface JavaScriptPiece extends SourceRange {\n readonly context: JavaScriptContext;\n}\n\n/** A range and the context it lies in. */\nexport interface InContext<R, C> {\n readonly range: R;\n readonly context: C;\n}\n\n/**\n * The JavaScript context of each of `ranges` in `source`, a classic script or (with `module`) a module script. A\n * range that lies inside one string, template piece, regular expression or comment gets that context (`whole` tells\n * whether a string literal is exactly the range, quotes included); any other range is `code`.\n */\nexport function javaScriptContexts<R extends SourceRange>(\n source: string,\n ranges: readonly R[],\n module = false,\n): InContext<R, JavaScriptContext>[] {\n const read = trySyntax(() => javaScriptPieces(source, module));\n if (!read.ok) return ranges.map((range) => ({ range, context: { kind: 'unparsable', reason: read.error.message } }));\n const pieces = read.value;\n return ranges.map((range) => {\n const piece = enclosingPiece(pieces, range);\n if (piece === undefined) return { range, context: { kind: 'code' } };\n const { context } = piece;\n const whole = piece.start === range.start && piece.end === range.end;\n return { range, context: context.kind === 'string' ? { ...context, whole } : context };\n });\n}\n\n/**\n * The first of `pieces` that contains `range`. `pieces` are in source order and do not overlap, so their ends do not\n * decrease: a binary search finds the first piece that ends at or after the range, and only pieces starting at or\n * before the range can contain it (several only when empty pieces share an offset).\n */\nfunction enclosingPiece<P extends SourceRange>(pieces: readonly P[], range: SourceRange): P | undefined {\n let low = 0;\n let high = pieces.length;\n while (low < high) {\n const mid = (low + high) >>> 1;\n if ((pieces[mid]?.end ?? Infinity) < range.end) low = mid + 1;\n else high = mid;\n }\n for (let piece = pieces[low]; piece !== undefined && piece.start <= range.start; piece = pieces[++low]) {\n if (piece.end >= range.end) return piece;\n }\n return undefined;\n}\n\n/**\n * The literals and comments of JavaScript source, in source order, read as a classic script (see `js-syntax.ts`) or\n * a module, allowing what story formats allow around story code (`return` and `await` outside functions). Throws a\n * `JsSyntaxError` when acorn cannot tokenize it.\n */\nfunction javaScriptPieces(source: string, module: boolean): JavaScriptPiece[] {\n const pieces: JavaScriptPiece[] = [];\n const tokens = AcornParser.tokenizer(source, {\n ...SCRIPT_OPTIONS,\n sourceType: module ? 'module' : 'script',\n allowReturnOutsideFunction: true,\n allowAwaitOutsideFunction: true,\n allowImportExportEverywhere: true,\n onComment: (block, _text, start, end) => {\n pieces.push({ start, end, context: block ? { kind: 'block-comment' } : { kind: 'line-comment', start } });\n },\n });\n // A template literal is tagged when an expression ends right before its opening backquote.\n const openTemplates: boolean[] = [];\n let previous: Token | undefined;\n for (const token of tokens) {\n const { type, start, end } = token;\n if (type === tokTypes.string) {\n const quote = source[start] === \"'\" ? \"'\" : '\"';\n pieces.push({ start, end, context: { kind: 'string', quote, whole: false } });\n } else if (type === tokTypes.regexp) {\n const raw = source.slice(start, end);\n pieces.push({ start, end, context: { kind: 'regexp', flags: raw.slice(raw.lastIndexOf('/') + 1) } });\n } else if (type === tokTypes.backQuote) {\n if (previous?.type === tokTypes.template || previous?.type === tokTypes.invalidTemplate) {\n openTemplates.pop();\n } else {\n openTemplates.push(previous !== undefined && endsExpression(previous));\n }\n } else if (type === tokTypes.template || type === tokTypes.invalidTemplate) {\n const tagged = openTemplates[openTemplates.length - 1] === true;\n pieces.push({ start, end, context: { kind: 'template', tagged } });\n }\n previous = token;\n }\n return pieces.sort((a, b) => a.start - b.start);\n}\n\n/** Whether `token` can end an expression, so that a template literal after it is a tagged template. */\nfunction endsExpression(token: Token): boolean {\n const { type } = token;\n return (\n type === tokTypes.name ||\n type === tokTypes.parenR ||\n type === tokTypes.bracketR ||\n type === tokTypes.backQuote ||\n type === tokTypes._this ||\n type === tokTypes._super ||\n type === tokTypes.privateId\n );\n}\n\n/**\n * The CSS context of each of `ranges` in `source`, tokenized as CSS Syntax Level 3 does: a comment runs from `/*` to\n * the next `*\\/`; a string from a quote to the same unescaped quote or an unescaped line break (a bad string); a\n * backslash escapes the next character.\n */\nexport function cssContexts<R extends SourceRange>(source: string, ranges: readonly R[]): InContext<R, CssContext>[] {\n const pieces = cssPieces(source);\n return ranges.map((range) => {\n const piece = enclosingPiece(pieces, range);\n return { range, context: piece === undefined ? { kind: 'code' } : piece.context };\n });\n}\n\ninterface CssPiece extends SourceRange {\n readonly context: CssContext;\n}\n\nfunction cssPieces(source: string): CssPiece[] {\n const pieces: CssPiece[] = [];\n let i = 0;\n while (i < source.length) {\n const ch = source[i];\n if (ch === '/' && source[i + 1] === '*') {\n const close = source.indexOf('*/', i + 2);\n const end = close === -1 ? source.length : close + 2;\n pieces.push({ start: i, end, context: { kind: 'comment' } });\n i = end;\n } else if (ch === '\"' || ch === \"'\") {\n const end = cssStringEnd(source, i + 1, ch);\n pieces.push({ start: i, end, context: { kind: 'string', quote: ch } });\n i = end;\n } else if (ch === '\\\\') {\n i += 2;\n } else {\n i += 1;\n }\n }\n return pieces;\n}\n\n/** The offset after a CSS string whose content starts at `from`. */\nfunction cssStringEnd(source: string, from: number, quote: string): number {\n let i = from;\n while (i < source.length) {\n const ch = source[i];\n if (ch === quote) return i + 1;\n // An unescaped line break ends a bad string before it.\n if (ch === '\\n' || ch === '\\r' || ch === '\\f') return i;\n i += ch === '\\\\' ? 2 : 1;\n }\n return source.length;\n}\n","/**\n * The errors twee-ts throws. Each module that can stop a build throws a `TweeTsError` with a code (see\n * `TweeTsErrorCode`); this module depends on nothing else in twee-ts, so every module can import it.\n */\nimport type { Diagnostic, TweeTsErrorCode } from './types.js';\n\n/**\n * A build that could not run: nothing was built or written. `code` says why (see TweeTsErrorCode),\n * `diagnostics` holds what the build reported before it stopped, and `cause` the error behind it, if any.\n */\nexport class TweeTsError extends Error {\n readonly code: TweeTsErrorCode;\n\n constructor(\n message: string,\n readonly diagnostics: readonly Diagnostic[] = [],\n options: { readonly code?: TweeTsErrorCode; readonly cause?: unknown } = {},\n ) {\n super(message, 'cause' in options ? { cause: options.cause } : undefined);\n this.name = 'TweeTsError';\n this.code = options.code ?? 'BUILD_FAILED';\n }\n}\n","/**\n * Where things are in an HTML document, as a browser's HTML parser sees them.\n *\n * Every structural location twee-ts needs in HTML is read here from a parse by parse5 (bundled), through its public\n * API with source locations, and never by matching markup text: the end and start of the head (for modules, the head\n * file and the Vite client), the Twine 1 store area (for the IFID comment), the context of each placeholder in a\n * story format template (for escaping), and the story data of compiled HTML (for the decompiler).\n *\n * Supported subset: any input, read as the WHATWG HTML parser reads it with scripting enabled (as story formats run),\n * which is how parse5 reads it. Content inserted into the head becomes HTML-namespace children of the head element\n * (never text, a comment, an attribute value, template content or CDATA); where no such point exists, nothing is\n * inserted and the caller reports it.\n */\nimport { defaultTreeAdapter, parse, parseFragment, html as htmlSpec } from 'parse5';\nimport type { DefaultTreeAdapterTypes } from 'parse5';\nimport { cssContexts, javaScriptContexts } from './code-context.js';\nimport type { InContext, SourceRange } from './code-context.js';\nimport { attrEscape } from './escape.js';\nimport type { InsertionContext } from './escape.js';\nimport { TweeTsError } from './errors.js';\nimport { pushAll } from './util.js';\n\ntype HtmlDocument = DefaultTreeAdapterTypes.Document;\n/** An element of a parsed document. */\nexport type HtmlElement = DefaultTreeAdapterTypes.Element;\ntype ParentNode = DefaultTreeAdapterTypes.ParentNode;\ntype ChildNode = DefaultTreeAdapterTypes.ChildNode;\ntype HtmlNode = DefaultTreeAdapterTypes.Node;\n\nconst HTML_NS = htmlSpec.NS.HTML;\n\n/**\n * The deepest nesting of elements read from HTML, as Chromium's parser limits it (512). An HTML parser looks through\n * the open elements at many tags, so reading costs the size of the document times its depth; deeper documents are\n * rejected rather than read for minutes (#381). Twine's own HTML and story format templates nest a few dozen deep.\n */\nexport const MAX_HTML_DEPTH = 512;\n\n/** HTML nested more than `MAX_HTML_DEPTH` elements deep. */\nexport class HtmlNestingError extends TweeTsError {\n constructor() {\n super(`HTML nests more than ${String(MAX_HTML_DEPTH)} elements deep.`, [], { code: 'BUILD_FAILED' });\n }\n}\n\n/**\n * parse5's tree adapter, rejecting an element that would lie more than `MAX_HTML_DEPTH` elements deep (template\n * contents count as children of their template). The depth of each parent is remembered, so a check costs a lookup;\n * when the parser moves a node (the adoption agency algorithm), what was remembered is dropped and worked out again,\n * by walking up at most `MAX_HTML_DEPTH` or so parents. Either way the checks add work in proportion to the size of\n * the document.\n */\nfunction depthLimitedTreeAdapter(): typeof defaultTreeAdapter {\n const templateOfContent = new WeakMap<ParentNode, ParentNode>();\n const parentOf = (node: ParentNode): ParentNode | null | undefined =>\n 'parentNode' in node ? node.parentNode : templateOfContent.get(node);\n // The number of elements from a node up to the root, itself included, for the current `moves`.\n const known = new WeakMap<ParentNode, { readonly depth: number; readonly moves: number }>();\n let moves = 0;\n const depthOf = (start: ParentNode): number => {\n const unknown: ParentNode[] = [];\n let depth = 0;\n for (let node: ParentNode | null | undefined = start; node !== null && node !== undefined; node = parentOf(node)) {\n const remembered = known.get(node);\n if (remembered?.moves === moves) {\n depth = remembered.depth;\n break;\n }\n unknown.push(node);\n }\n for (const node of unknown.reverse()) {\n if (isElement(node)) depth += 1;\n known.set(node, { depth, moves });\n }\n return depth;\n };\n const checkDepth = (parent: ParentNode, child: ChildNode): void => {\n if (!isElement(child)) return;\n // An element that already has children is a subtree moving in: depths remembered inside it are stale.\n if (child.childNodes.length > 0 || (templateContent(child)?.childNodes.length ?? 0) > 0) moves += 1;\n const depth = depthOf(parent) + 1;\n if (depth > MAX_HTML_DEPTH) {\n throw new HtmlNestingError();\n }\n known.set(child, { depth, moves });\n };\n const placed = checkDepth;\n return {\n ...defaultTreeAdapter,\n appendChild(parent, child) {\n placed(parent, child);\n defaultTreeAdapter.appendChild(parent, child);\n },\n insertBefore(parent, child, reference) {\n placed(parent, child);\n defaultTreeAdapter.insertBefore(parent, child, reference);\n },\n detachNode(node) {\n // A node moves: the depths below it change.\n moves += 1;\n defaultTreeAdapter.detachNode(node);\n },\n setTemplateContent(template, content) {\n templateOfContent.set(content, template);\n defaultTreeAdapter.setTemplateContent(template, content);\n },\n };\n}\n\n/**\n * Parse a whole document as a browser does with scripting enabled, with the source location of every node unless\n * `locations` is false. parse5 preprocesses the input stream as the HTML standard does (CRLF and CR become LF; NUL\n * is dropped from text and becomes U+FFFD elsewhere); source locations are offsets into `html` as given. Throws a\n * `TweeTsError` when elements nest more than `MAX_HTML_DEPTH` deep (an `HtmlNestingError`).\n */\nexport function parseHtml(html: string, locations = true): HtmlDocument {\n return parse(html, {\n sourceCodeLocationInfo: locations,\n scriptingEnabled: true,\n treeAdapter: depthLimitedTreeAdapter(),\n });\n}\n\n/** Parse `html` as the content of a `div` element, as `parseHtml()` reads a document. */\nfunction parseHtmlFragment(html: string): DefaultTreeAdapterTypes.DocumentFragment {\n return parseFragment(FRAGMENT_CONTEXT, html, { scriptingEnabled: true, treeAdapter: depthLimitedTreeAdapter() });\n}\n\nfunction isElement(node: HtmlNode): node is HtmlElement {\n return 'tagName' in node;\n}\n\nfunction isHtmlElement(node: HtmlNode, tagName: string): node is HtmlElement {\n return isElement(node) && node.tagName === tagName && node.namespaceURI === HTML_NS;\n}\n\nfunction childrenOf(node: HtmlNode): readonly ChildNode[] {\n return 'childNodes' in node ? node.childNodes : [];\n}\n\n/** The content of a `template` element (in any namespace parse5 gives one), or `undefined`. */\nfunction templateContent(node: HtmlNode): ParentNode | undefined {\n return 'content' in node ? node.content : undefined;\n}\n\n/** A node of a tree walk, and whether it lies inside the content of a template element. */\ninterface Visit {\n readonly node: ChildNode;\n readonly inTemplate: boolean;\n}\n\n/**\n * The nodes under `root` in tree order (an iterative walk, so deep documents don't overflow the stack). Template\n * contents are walked too when `intoTemplates`, after the template's children; a browser's `textContent`,\n * `getElementById` and `querySelector` don't look into them.\n */\nfunction* descendants(root: HtmlNode, intoTemplates: boolean): Generator<Visit> {\n const stack: Visit[] = [...childrenOf(root)].reverse().map((node) => ({ node, inTemplate: false }));\n for (let visit = stack.pop(); visit !== undefined; visit = stack.pop()) {\n yield visit;\n const { node, inTemplate } = visit;\n const content = intoTemplates ? templateContent(node) : undefined;\n if (content !== undefined) {\n for (const child of [...content.childNodes].reverse()) stack.push({ node: child, inTemplate: true });\n }\n for (const child of [...childrenOf(node)].reverse()) stack.push({ node: child, inTemplate });\n }\n}\n\n/** The elements in tree order, outside template contents, that `matches`; as `querySelectorAll()` finds them. */\nfunction* findElements(doc: HtmlDocument, matches: (element: HtmlElement) => boolean): Generator<HtmlElement> {\n for (const { node } of descendants(doc, false)) {\n if (isElement(node) && matches(node)) yield node;\n }\n}\n\n/** The first element in tree order, outside template contents, that `matches`; as `querySelector()` finds it. */\nfunction findElement(doc: HtmlDocument, matches: (element: HtmlElement) => boolean): HtmlElement | undefined {\n for (const element of findElements(doc, matches)) return element;\n return undefined;\n}\n\n/** The value of an element's attribute (in no namespace), or `undefined`. */\nexport function attributeOf(element: HtmlElement, name: string): string | undefined {\n return element.attrs.find((attr) => attr.name === name && attr.namespace === undefined)?.value;\n}\n\n/** The text of an element as the DOM's `textContent` gives it: all its descendant text, outside template contents. */\nexport function textContent(element: HtmlElement): string {\n let text = '';\n for (const { node } of descendants(element, false)) {\n if (node.nodeName === '#text' && 'value' in node) text += node.value;\n }\n return text;\n}\n\n/** The children of an element that are elements, outside template contents. */\nexport function childElements(element: HtmlElement): readonly HtmlElement[] {\n return element.childNodes.filter(isElement);\n}\n\n/** The Twine 2 story data: the first `tw-storydata` element, in any namespace, as `querySelector()` finds it. */\nexport function findStoryData(doc: HtmlDocument): HtmlElement | undefined {\n return findElement(doc, (element) => element.tagName === 'tw-storydata');\n}\n\n/**\n * Whether any text of the document, script and style text included, or any comment, contains `needle`. Markup\n * that only holds the text in an attribute value does not count.\n */\nexport function documentTextContains(doc: HtmlDocument, needle: string): boolean {\n for (const { node } of descendants(doc, false)) {\n if (node.nodeName === '#text' && 'value' in node && node.value.includes(needle)) return true;\n if (node.nodeName === '#comment' && 'data' in node && node.data.includes(needle)) return true;\n }\n return false;\n}\n\n/** What names the Twine 1 store area in diagnostics. */\nexport const STORE_AREA_DESCRIPTION = 'element with the id \"store-area\" or \"storeArea\"';\n\n/** The ids of the Twine 1 store area: SugarCube's, then that of the Twine 1.4 story formats. */\nconst STORE_AREA_IDS: readonly [string, string] = ['store-area', 'storeArea'];\n\n/**\n * The Twine 1 store area, as a story format's `getElementById()` finds it: the first element with the id\n * `store-area` or `storeArea`, or with `prefer`, the first `store-area` element if there is one (as Tweego picks the\n * one for the IFID comment).\n */\nexport function findStoreArea(doc: HtmlDocument, prefer = false): HtmlElement | undefined {\n const isStoreArea = (id: string | undefined): boolean => STORE_AREA_IDS.some((storeId) => storeId === id);\n if (prefer) {\n const first = findElement(doc, (element) => attributeOf(element, 'id') === STORE_AREA_IDS[0]);\n if (first !== undefined) return first;\n }\n return findElement(doc, (element) => isStoreArea(attributeOf(element, 'id')));\n}\n\n/**\n * Every story the document holds, in tree order, of which a story format reads only one: each `tw-storydata`\n * element, and each Twine 1 store area that holds a tiddler (so that an empty store area a Twine 2 format's template\n * has is not counted).\n */\nexport function findStories(doc: HtmlDocument): HtmlElement[] {\n return [\n ...findElements(\n doc,\n (element) =>\n element.tagName === 'tw-storydata' ||\n (STORE_AREA_IDS.some((id) => id === attributeOf(element, 'id')) && childElements(element).some(isTiddler)),\n ),\n ];\n}\n\n/** Whether `element` is a Twine 1 tiddler: a `div` with a `tiddler` attribute, which holds a passage. */\nexport function isTiddler(element: HtmlElement): boolean {\n return element.tagName === 'div' && attributeOf(element, 'tiddler') !== undefined;\n}\n\n/** The Twine 1 archive: the store area holding `count` tiddlers, `data`. */\nexport function twine1ArchiveStoreArea(count: number, data: string): string {\n return `<div id=\"${STORE_AREA_IDS[1]}\" data-size=\"${count}\">${data}</div>\\n`;\n}\n\n/**\n * An element the HTML parser reads as it reads story data: a `tw-storydata` element (Twine 2) or a tiddler `div`\n * (Twine 1), holding text when `hasText` says the story data holds passage text that is not whitespace (text in the\n * body keeps a later `frameset` start tag from replacing the body, as such passage text does).\n */\nexport function storyDataProbe(format: 'twine2' | 'twine1', hasText: boolean): string {\n const text = hasText ? 'x' : '';\n return format === 'twine2' ? `<tw-storydata hidden>${text}</tw-storydata>` : `<div tiddler=\"\">${text}</div>`;\n}\n\n/** What follows the story data of a pre-1.4 Twine 1 format that has no footer file (as Tweego writes it). */\nexport const DEFAULT_TWINE1_FOOTER = '</div>\\n</body>\\n</html>\\n';\n\n/** The head element of a document: the `head` child of the root `html` element. */\nfunction documentHead(doc: HtmlDocument): HtmlElement | undefined {\n const root = doc.childNodes.find((node) => isHtmlElement(node, 'html'));\n return root === undefined ? undefined : root.childNodes.find((node) => isHtmlElement(node, 'head'));\n}\n\n/**\n * A canonical serialization of the document tree, with the nodes that start in `[from, to)` left out: elements with\n * their namespace and attributes, text, comments, the doctype, template contents, and the document mode. Two\n * documents with the same key build the same DOM, so inserting `[from, to)` changed nothing else when the key of the\n * document with it equals the key of the document without it.\n */\nfunction structureKey(\n doc: HtmlDocument,\n from = 0,\n to = 0,\n editText: (text: string) => string = (text) => text,\n): string {\n const parts: string[] = [doc.mode];\n // Adjacent text nodes on either side of an insertion merge or split; their text is what counts.\n let text: string | undefined;\n const flushText = (): void => {\n if (text !== undefined && text !== '') parts.push(`#text${JSON.stringify(text)}`);\n text = undefined;\n };\n const inserted = (node: ChildNode): boolean => {\n const start = node.sourceCodeLocation?.startOffset;\n return start !== undefined && start >= from && start < to;\n };\n // An explicit stack, so that the depth of the document does not decide the depth of the call stack. A task is a\n // node to write or a step to run after the nodes before it (the closing of an element, a template's content).\n type Task = ChildNode | (() => void);\n const stack: Task[] = [...doc.childNodes].reverse();\n const visit = (child: ChildNode): void => {\n if (inserted(child)) return;\n if ('value' in child) {\n text = (text ?? '') + editText(child.value);\n return;\n }\n flushText();\n if (isElement(child)) {\n const attrs = child.attrs.map((attr) => ({ ...attr, value: editText(attr.value) }));\n parts.push(`<${child.namespaceURI} ${child.tagName}${JSON.stringify(attrs)}>`);\n const content = templateContent(child);\n const steps: Task[] = [...child.childNodes];\n if (content !== undefined) {\n // One push per node: spreading a list into the call would pass an argument for each child of a wide template.\n steps.push(() => parts.push('<#content>'));\n for (const node of content.childNodes) steps.push(node);\n steps.push(() => {\n flushText();\n parts.push('</#content>');\n });\n }\n steps.push(() => {\n flushText();\n parts.push('</>');\n });\n for (const step of steps.reverse()) stack.push(step);\n } else if ('data' in child) {\n parts.push(`#comment${JSON.stringify(editText(child.data))}`);\n } else {\n parts.push(`#doctype${JSON.stringify([child.name, child.publicId, child.systemId])}`);\n }\n };\n for (let task = stack.pop(); task !== undefined; task = stack.pop()) {\n if (typeof task === 'function') task();\n else visit(task);\n }\n flushText();\n return parts.join('\\n');\n}\n\n/**\n * Whether replacing `[start, end)` of `html` (parsed as `doc`) with the element `probe` makes the probe an element of\n * the live document (in the HTML namespace, outside template contents) and changes nothing else: so that markup like\n * the probe written there becomes elements of the page. `[start, end)` lies in text.\n */\nexport function replacementIsLiveElement(\n html: string,\n doc: HtmlDocument,\n start: number,\n end: number,\n probe: string,\n): boolean {\n const { before, after } = replaced(html, doc, start, end, probe);\n const found = [...descendants(after, true)].find(({ node }) => node.sourceCodeLocation?.startOffset === start);\n const live = found !== undefined && !found.inTemplate && isElement(found.node) && found.node.namespaceURI === HTML_NS;\n return live && structureKey(after, start, start + probe.length) === before;\n}\n\n/**\n * Whether removing `[start, end)` of `html` (parsed as `doc`) changes nothing but that text: the template text on\n * either side may join into a sequence the tokenizer reads (`<!` and `--` making `<!--`), which matters only where it\n * changes the document. `[start, end)` lies in text, a comment or an attribute value.\n */\nexport function removalKeepsStructure(html: string, doc: HtmlDocument, start: number, end: number): boolean {\n const { before, after } = replaced(html, doc, start, end, '');\n return structureKey(after) === before;\n}\n\n/** The structure key of `doc` without the text `[start, end)` of `html`, and the parse of `html` with `text` there. */\nfunction replaced(\n html: string,\n doc: HtmlDocument,\n start: number,\n end: number,\n text: string,\n): { readonly before: string; readonly after: HtmlDocument } {\n const removed = html.slice(start, end);\n return {\n before: structureKey(doc, 0, 0, (value) => value.replace(removed, '')),\n after: parseHtml(html.slice(0, start) + text + html.slice(end)),\n };\n}\n\n/** Insert `text` into `html` at `offset`. */\nfunction insertAt(html: string, offset: number, text: string): string {\n return html.slice(0, offset) + text + html.slice(offset);\n}\n\n/**\n * Whether inserting `text` at `offset` in `html` (parsed as `doc`, with structure key `key`) adds nodes to the\n * document's head only: every node parsed from `text` is in the head, and everything else builds as before.\n */\nfunction insertsIntoHead(html: string, key: string, offset: number, text: string): boolean {\n const after = parseHtml(insertAt(html, offset, text));\n const end = offset + text.length;\n if (structureKey(after, offset, end) !== key) return false;\n const head = documentHead(after);\n const isInserted = (start: number | undefined): boolean => start !== undefined && start >= offset && start < end;\n const inserted = [...descendants(after, true)].filter(({ node }) => isInserted(node.sourceCodeLocation?.startOffset));\n // Something must be there: the parser drops content that a frameset replaces, for one.\n return (\n inserted.length > 0 &&\n inserted.every(({ node }) => {\n const parent = node.parentNode;\n return parent === head || isInserted(parent?.sourceCodeLocation?.startOffset);\n })\n );\n}\n\n/** A probe element, inserted to check that a place puts elements into the head. */\nconst PROBE = '<script></script>';\n\n/** Where content goes into a document's head, and how that place was found. */\nexport interface HeadPlacement {\n readonly offset: number;\n /**\n * `end-tag`: before the closing head tag that ends the head. `implicit-end`: where the head ends without one (at\n * the tag or text that implies the end, or at the end of the document). `start-tag`: after the head start tag.\n * `implied-start`: where the parser creates the head with no head start tag.\n */\n readonly how: 'end-tag' | 'implicit-end' | 'start-tag' | 'implied-start';\n}\n\n/** Offsets, in order of preference, where an insertion may put elements at the end of the head. */\nfunction headEndCandidates(doc: HtmlDocument, head: HtmlElement): number[] {\n const candidates: number[] = [];\n const location = head.sourceCodeLocation;\n if (location !== undefined && location !== null) candidates.push(location.endOffset);\n const lastChildEnd = head.childNodes.reduce<number | undefined>(\n (end, child) => child.sourceCodeLocation?.endOffset ?? end,\n undefined,\n );\n if (lastChildEnd !== undefined) candidates.push(lastChildEnd);\n pushAll(candidates, headStartCandidates(doc));\n return candidates;\n}\n\n/** Offsets, in order of preference, where an insertion may put elements at the start of an implied head. */\nfunction headStartCandidates(doc: HtmlDocument): number[] {\n const candidates: number[] = [];\n const root = doc.childNodes.find((node) => isHtmlElement(node, 'html'));\n const rootStart = root?.sourceCodeLocation?.startTag?.endOffset;\n if (rootStart !== undefined) candidates.push(rootStart);\n const doctypeEnd = doc.childNodes.find((node) => node.nodeName === '#documentType')?.sourceCodeLocation?.endOffset;\n if (doctypeEnd !== undefined) candidates.push(doctypeEnd);\n // Before the first node that the document element holds, after any leading doctype and comments.\n if (root !== undefined) {\n for (const { node } of descendants(root, false)) {\n const start = node.sourceCodeLocation?.startOffset;\n if (start !== undefined) {\n candidates.push(start);\n break;\n }\n }\n }\n candidates.push(0);\n return [...new Set(candidates)];\n}\n\n/**\n * Where content goes to come last in the head of `html`: before the closing head tag that ends the head (as Tweego\n * places it, when an element put there lands in the head); without one, where the head ends implicitly; with no head start tag either, where the parser creates\n * the head. Each place is checked by parsing the document with a probe element there. `undefined` when\n * no place puts elements into the head.\n */\nexport function locateHeadEnd(html: string, doc: HtmlDocument = parseHtml(html)): HeadPlacement | undefined {\n const head = documentHead(doc);\n if (head === undefined) return undefined;\n const endTag = head.sourceCodeLocation?.endTag;\n const key = structureKey(doc);\n // A closing head tag the parser ignores (inside an open template element, say) is still recorded as the head's\n // end tag, so it counts only where an element put there really lands in the head.\n if (endTag !== undefined && insertsIntoHead(html, key, endTag.startOffset, PROBE)) {\n return { offset: endTag.startOffset, how: 'end-tag' };\n }\n const how = head.sourceCodeLocation ? 'implicit-end' : 'implied-start';\n const offset = headEndCandidates(doc, head).find((candidate) => insertsIntoHead(html, key, candidate, PROBE));\n return offset === undefined ? undefined : { offset, how };\n}\n\n/**\n * Where content goes to come first in the head of `html`: after the head start tag; without one, where the parser\n * creates the head (after the html start tag, after the doctype, or before the first node), checked by parsing the\n * document with `probe` there. `undefined` when no place puts elements into the head.\n *\n * A head start tag found in a parse of a prefix of the document is the one a parse of the whole document finds: the\n * parser reads left to right and never changes what it built for earlier tokens. So a long document whose head\n * starts early is parsed only up to there.\n */\nexport function locateHeadStart(html: string, probe: string = PROBE): HeadPlacement | undefined {\n const prefixLength = Math.min(html.length, HEAD_START_PREFIX);\n const startTag = documentHead(parseHtml(html.slice(0, prefixLength)))?.sourceCodeLocation?.startTag;\n if (startTag !== undefined) return { offset: startTag.endOffset, how: 'start-tag' };\n if (prefixLength === html.length) return locateImpliedHeadStart(html, parseHtml(html), probe);\n const doc = parseHtml(html);\n const fullStartTag = documentHead(doc)?.sourceCodeLocation?.startTag;\n if (fullStartTag !== undefined) return { offset: fullStartTag.endOffset, how: 'start-tag' };\n return locateImpliedHeadStart(html, doc, probe);\n}\n\n/** How much of a document `locateHeadStart()` parses first. */\nconst HEAD_START_PREFIX = 65536;\n\nfunction locateImpliedHeadStart(html: string, doc: HtmlDocument, probe: string): HeadPlacement | undefined {\n const key = structureKey(doc);\n const offset = headStartCandidates(doc).find((candidate) => insertsIntoHead(html, key, candidate, probe));\n return offset === undefined ? undefined : { offset, how: 'implied-start' };\n}\n\n/**\n * Whether inserting `content` at `offset` in `html` keeps the rest of the document as it was and puts all of\n * `content` into the head. Content that is not (such as an unclosed comment or element, text, or body elements)\n * changes where the document's own nodes go.\n */\nexport function contentStaysInHead(html: string, doc: HtmlDocument, offset: number, content: string): boolean {\n return insertsIntoHead(html, structureKey(doc), offset, content);\n}\n\n/**\n * The start tag offset of the element that holds the text at `offset` (of the document `doc` was parsed from), when\n * that is an element of the template's own rather than `body`, such as the store area SugarCube 1 puts its story\n * data in. `undefined` in `body`, outside any element, or for an element with no start tag.\n */\nexport function locateTextContainer(doc: HtmlDocument, offset: number): number | undefined {\n for (const { node } of descendants(doc, false)) {\n const location = node.sourceCodeLocation;\n if (node.nodeName !== '#text' || location === undefined || location === null) continue;\n if (location.startOffset > offset || location.endOffset <= offset) continue;\n const parent = node.parentNode;\n if (parent === null || !isElement(parent)) return undefined;\n const isBody = parent.tagName === 'body' && parent.namespaceURI === HTML_NS;\n return isBody ? undefined : parent.sourceCodeLocation?.startTag?.startOffset;\n }\n return undefined;\n}\n\n/** The start tag offsets of the Twine 1 store area element, preferring `store-area` as Tweego does. */\nexport function locateStoreArea(doc: HtmlDocument): number | undefined {\n return findStoreArea(doc, true)?.sourceCodeLocation?.startTag?.startOffset;\n}\n\n/** The Vite client script element, for `src` (Vite's base followed by `@vite/client`). */\nfunction viteClientTag(src: string): string {\n return `<script type=\"module\" src=\"${attrEscape(src)}\"></script>`;\n}\n\n/**\n * Add Vite's client script to `html` as the first element of its head (see `locateHeadStart()`). A document with no\n * place that leaves the rest of it as it was (one that is all an unclosed comment) still gets the client, after its\n * doctype (so it keeps its mode), where a comment that follows moves into the head.\n */\nexport function insertViteClient(html: string, src: string): string {\n const tag = viteClientTag(src);\n const placement = locateHeadStart(html, tag);\n const doctypeEnd = (): number | undefined =>\n parseHtml(html).childNodes.find((node) => node.nodeName === '#documentType')?.sourceCodeLocation?.endOffset;\n return insertAt(html, placement?.offset ?? doctypeEnd() ?? 0, tag);\n}\n\n/** The page the Vite dev server serves until the first compile succeeds, with Vite's client for `src`. */\nexport function viteWaitingPage(src: string): string {\n return (\n '<!doctype html><html><head><meta charset=\"utf-8\">' +\n viteClientTag(src) +\n '<title>twee-ts</title></head><body><p>The story has not compiled yet.</p></body></html>'\n );\n}\n\n// --- Placeholder contexts ---\n\n/** A placeholder in a template: the whole of it, and the part between its delimiters (`{{…}}` or `\"…\"`). */\nexport interface PlaceholderOccurrence {\n readonly start: number;\n readonly end: number;\n readonly innerStart: number;\n readonly innerEnd: number;\n}\n\n/** Where a placeholder sits, as parse5 reports it. */\nexport interface PlaceholderSite {\n readonly context: InsertionContext;\n /**\n * How the placeholder's delimiters are read: `inside` when they are part of the same text, comment or attribute\n * value as the name (`{{STORY_NAME}}` in a title); `attribute` when the placeholder is a whole quoted attribute\n * value (`data-size=\"STORY_SIZE\"`); `string` when it is a whole JavaScript string literal (`\"START_AT\"`); `split`\n * when they are read apart from the name.\n */\n readonly delimiters: 'inside' | 'attribute' | 'string' | 'split';\n}\n\n/** The parse of a template with its placeholders, and the site of each placeholder. */\nexport interface TemplateAnalysis {\n /** The template with its placeholder names replaced by markers: what `doc` is the parse of, offset for offset. */\n readonly marked: string;\n readonly doc: HtmlDocument;\n readonly sites: readonly PlaceholderSite[];\n}\n\n/**\n * Parse `html` and find the site of each of `occurrences`.\n *\n * Each placeholder name is replaced, for the parse, by a marker of the same length made of private-use characters\n * that `html` doesn't contain, unique to the occurrence. A placeholder's characters (`{`, `}`, letters, `_`, and the\n * quotes kept as written) and the marker's take the same path through every tokenizer state (neither is an ASCII\n * letter after `<`, `</`, `&` or a tag name, nor whitespace, `>`, `=`, `/` or `-`), so the parse is that of the\n * template, with the same offsets; and where a marker ends up in the tree tells the placeholder's context.\n */\nexport function analyzeTemplate(html: string, occurrences: readonly PlaceholderOccurrence[]): TemplateAnalysis {\n const markers = makeMarkers(html, occurrences);\n let marked = html;\n for (const [i, occurrence] of occurrences.entries()) {\n marked = marked.slice(0, occurrence.innerStart) + (markers[i] ?? '') + marked.slice(occurrence.innerEnd);\n }\n const doc = parseHtml(marked);\n const found = findMarkers(doc, markers);\n const dropped: PlaceholderSite = { context: { kind: 'markup' }, delimiters: 'split' };\n const sites = occurrences.map((occurrence, i) => {\n const place = found.get(i);\n return place === undefined ? dropped : siteOf(html, place, occurrence, markers[i] ?? '');\n });\n return { marked, doc, sites: resolveCodeContexts(html, occurrences, sites, found) };\n}\n\n/** Markers for `occurrences`: a unique first character, then a filler, from private-use characters not in `html`. */\nfunction makeMarkers(html: string, occurrences: readonly PlaceholderOccurrence[]): string[] {\n const used = new Set<number>();\n for (const match of html.matchAll(/[\\uE000-\\uF8FF]/g)) used.add(match[0].charCodeAt(0));\n const free: string[] = [];\n for (let code = 0xe000; code <= 0xf8ff && free.length <= occurrences.length; code++) {\n if (!used.has(code)) free.push(String.fromCharCode(code));\n }\n const filler = free.pop();\n if (filler === undefined || free.length < occurrences.length) {\n throw new TweeTsError('Too many placeholders to analyze in this template.', [], { code: 'FORMAT_UNAVAILABLE' });\n }\n return occurrences.map((o, i) => (free[i] ?? '') + filler.repeat(o.innerEnd - o.innerStart - 1));\n}\n\n/** Where a marker was found in the tree. */\ntype MarkerPlace =\n | { readonly kind: 'text'; readonly parent: ParentNode; readonly inTemplate: boolean; readonly node: ChildNode }\n | { readonly kind: 'comment'; readonly data: string }\n | {\n readonly kind: 'attribute';\n readonly element: HtmlElement;\n readonly name: string;\n readonly prefix: string | undefined;\n readonly value: string;\n }\n | { readonly kind: 'markup' };\n\nfunction findMarkers(doc: HtmlDocument, markers: readonly string[]): Map<number, MarkerPlace> {\n const index = new Map(markers.map((marker, i) => [marker.charAt(0), i]));\n const found = new Map<number, MarkerPlace>();\n const scan = (text: string, place: MarkerPlace): void => {\n for (const match of text.matchAll(/[\\uE000-\\uF8FF]/g)) {\n const i = index.get(match[0]);\n if (i !== undefined && text.startsWith(markers[i] ?? '', match.index) && !found.has(i)) found.set(i, place);\n }\n };\n for (const { node, inTemplate } of descendants(doc, true)) {\n if (isElement(node)) {\n scan(node.tagName, { kind: 'markup' });\n for (const attr of node.attrs) {\n scan(attr.name, { kind: 'markup' });\n scan(attr.value, { kind: 'attribute', element: node, name: attr.name, prefix: attr.prefix, value: attr.value });\n }\n } else if ('value' in node) {\n const parent = node.parentNode;\n if (parent !== null) scan(node.value, { kind: 'text', parent, inTemplate, node });\n } else if ('data' in node) {\n scan(node.data, { kind: 'comment', data: node.data });\n } else {\n scan(`${node.name} ${node.publicId} ${node.systemId}`, { kind: 'markup' });\n }\n }\n return found;\n}\n\n/** URL attributes: their value is read as a URL. */\nconst URL_ATTRIBUTES: ReadonlySet<string> = new Set([\n 'action',\n 'background',\n 'cite',\n 'codebase',\n 'formaction',\n 'href',\n 'icon',\n 'longdesc',\n 'manifest',\n 'ping',\n 'poster',\n 'src',\n 'srcset',\n 'usemap',\n]);\n\n/** Elements whose text is never decoded: shown as written. */\nconst RAW_TEXT_ELEMENTS: ReadonlySet<string> = new Set(['xmp', 'plaintext']);\n\n/** The site of an occurrence whose marker is at `place`; script and style contexts are filled in later. */\nfunction siteOf(html: string, place: MarkerPlace, occurrence: PlaceholderOccurrence, marker: string): PlaceholderSite {\n const delimited =\n html.slice(occurrence.start, occurrence.innerStart) + marker + html.slice(occurrence.innerEnd, occurrence.end);\n // A delimiter right before or after a placeholder's name can only be read apart from it in a tag, so in a comment\n // or text it is read with it.\n if (place.kind === 'markup') return { context: { kind: 'markup' }, delimiters: 'split' };\n if (place.kind === 'comment') return { context: { kind: 'comment' }, delimiters: 'inside' };\n if (place.kind === 'text') return { context: textContext(html, place, occurrence), delimiters: 'inside' };\n const { element, name, prefix, value } = place;\n const quote = attributeQuote(html, element, prefix === undefined || prefix === '' ? name : `${prefix}:${name}`);\n const url = element.namespaceURI === HTML_NS ? URL_ATTRIBUTES.has(name) : name === 'href';\n const context: InsertionContext = { kind: 'attribute', quote, url };\n if (value.includes(delimited)) return { context, delimiters: 'inside' };\n return {\n context,\n delimiters: value === marker && quote === '\"' && delimited.startsWith('\"') ? 'attribute' : 'split',\n };\n}\n\n/** The quote of an attribute value as written: `\"`, `'` or none. */\nfunction attributeQuote(html: string, element: HtmlElement, rawName: string): '\"' | \"'\" | '' {\n const location = element.sourceCodeLocation?.attrs?.[rawName];\n if (location === undefined) return '';\n const afterName = html.slice(location.startOffset + rawName.length, location.endOffset);\n const quote = /^[\\t\\n\\f\\r ]*=[\\t\\n\\f\\r ]*([\"'])/.exec(afterName)?.[1];\n return quote === '\"' || quote === \"'\" ? quote : '';\n}\n\n/** The context of text: that of its parent element (script and style contexts are filled in later). */\nfunction textContext(\n html: string,\n place: Extract<MarkerPlace, { kind: 'text' }>,\n occurrence: PlaceholderOccurrence,\n): InsertionContext {\n const { parent, node } = place;\n // After a plaintext start tag the tokenizer reads the rest of the document as text, also where the tree builder\n // puts it into formatting elements it reopens inside the plaintext element.\n if (insidePlaintext(parent)) return { kind: 'raw-text', element: 'plaintext' };\n if (!isElement(parent)) return { kind: 'text', dropsLeadingNewline: false };\n if (parent.namespaceURI !== HTML_NS) {\n const start = node.sourceCodeLocation?.startOffset ?? occurrence.start;\n return inCdata(html.slice(start, occurrence.start))\n ? { kind: 'raw-text', element: parent.tagName }\n : { kind: 'text', dropsLeadingNewline: false };\n }\n const name = parent.tagName;\n // Script and style text get their own contexts (see `resolveCodeContexts()`).\n if (name === 'script' || name === 'style' || RAW_TEXT_ELEMENTS.has(name)) return { kind: 'raw-text', element: name };\n // The parser drops a line feed right after a `pre`, `listing` or `textarea` start tag.\n const first = parent.sourceCodeLocation?.startTag?.endOffset === occurrence.start;\n return { kind: 'text', dropsLeadingNewline: first && LEADING_NEWLINE_ELEMENTS.has(name) };\n}\n\n/** Whether `node` is, or is inside, an HTML plaintext element. */\nfunction insidePlaintext(node: ParentNode): boolean {\n let current: ParentNode | null = node;\n while (current !== null && isElement(current)) {\n if (current.tagName === 'plaintext' && current.namespaceURI === HTML_NS) return true;\n current = current.parentNode;\n }\n return false;\n}\n\n/** Elements whose start tag the parser drops a line feed right after. */\nconst LEADING_NEWLINE_ELEMENTS: ReadonlySet<string> = new Set(['pre', 'listing', 'textarea']);\n\n/**\n * Whether the end of `source`, the text of foreign content (SVG or MathML) before a placeholder, is inside a CDATA\n * section. In that text, `<![CDATA[` always starts a section and `]]>` ends it.\n */\nfunction inCdata(source: string): boolean {\n const open = source.lastIndexOf('<![CDATA[');\n return open !== -1 && !source.includes(']]>', open + 9);\n}\n\n/** The JavaScript MIME type essences (WHATWG MIME Sniffing), for which a script element holds a classic script. */\nconst JAVASCRIPT_TYPES: ReadonlySet<string> = new Set([\n 'application/ecmascript',\n 'application/javascript',\n 'application/x-ecmascript',\n 'application/x-javascript',\n 'text/ecmascript',\n 'text/javascript',\n 'text/javascript1.0',\n 'text/javascript1.1',\n 'text/javascript1.2',\n 'text/javascript1.3',\n 'text/javascript1.4',\n 'text/javascript1.5',\n 'text/jscript',\n 'text/livescript',\n 'text/x-ecmascript',\n 'text/x-javascript',\n]);\n\n/** What a script element holds. */\ntype ScriptLanguage = 'classic' | 'module' | 'json' | 'data';\n\n/** What a script element holds, from its `type` attribute (as HTML's \"prepare the script element\" reads it). */\nfunction scriptLanguage(script: HtmlElement): ScriptLanguage {\n const type = attributeOf(script, 'type');\n const language = attributeOf(script, 'language');\n if (type === '' || (type === undefined && (language === undefined || language === ''))) return 'classic';\n return typeStringLanguage(type ?? `text/${language ?? ''}`);\n}\n\n/**\n * What a script element holds, from its script block's type string (HTML's \"prepare the script element\"): a\n * JavaScript MIME type essence (ASCII case-insensitive, without parameters) is a classic script, `module` a module\n * script, anything else a data block (`json` for a JSON type, which only template filling tells apart).\n */\nfunction typeStringLanguage(type: string): ScriptLanguage {\n const typeString = type.replace(/^[\\t\\n\\f\\r ]+|[\\t\\n\\f\\r ]+$/g, '').replace(/[A-Z]/g, (c) => c.toLowerCase());\n if (JAVASCRIPT_TYPES.has(typeString)) return 'classic';\n if (typeString === 'module') return 'module';\n const essence = typeString.split(';')[0]?.trim() ?? '';\n return essence === 'application/json' || essence === 'text/json' || essence.endsWith('+json') ? 'json' : 'data';\n}\n\n/** A script that runs: classic (sloppy-mode) or module code, and its source text. */\nexport interface RunningScript {\n readonly kind: 'classic' | 'module';\n readonly code: string;\n}\n\n/** jQuery 3.7.1's `rscriptType`: the `type` of a script it runs when it inserts one. */\nconst JQUERY_SCRIPT_TYPE = /^$|^module$|\\/(?:java|ecma)script/i;\n/** jQuery 3.7.1's `rcleanScript`: the comment or CDATA wrapper it strips from a script before running it. */\nconst JQUERY_CLEAN_SCRIPT = /^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g;\n\n/** The element jQuery parses inserted HTML in (`innerHTML` of a `div`). */\nconst FRAGMENT_CONTEXT = defaultTreeAdapter.createElement('div', HTML_NS, []);\n\n/** How one script element runs when jQuery inserts it, or `undefined` when its content does not run. */\nfunction jQueryRuns(script: HtmlElement): RunningScript | undefined {\n // jQuery tests `node.type`, the raw attribute, and loads a script with a `src` rather than reading its\n // content (an SVG script has no `src` property; jQuery copies a non-empty `src` attribute, which the new\n // script then loads).\n const type = attributeOf(script, 'type') ?? '';\n const src = attributeOf(script, 'src');\n const html = script.namespaceURI === HTML_NS;\n if (!JQUERY_SCRIPT_TYPE.test(type) || (html ? src !== undefined : src !== undefined && src !== '')) {\n return undefined;\n }\n // DOMEval runs the content in a new script element with the old one's non-empty `type`, `src`, `nonce` and\n // `noModule` (not `language`); the browser decides by the type, and runs no classic script marked `nomodule`.\n const language = type === '' ? 'classic' : typeStringLanguage(type);\n const noModule = html && attributeOf(script, 'nomodule') !== undefined;\n switch (language) {\n case 'classic':\n return noModule ? undefined : { kind: 'classic', code: textContent(script).replace(JQUERY_CLEAN_SCRIPT, '') };\n case 'module':\n return { kind: 'module', code: textContent(script).replace(JQUERY_CLEAN_SCRIPT, '') };\n case 'json':\n case 'data':\n return undefined;\n default: {\n const _exhaustive: never = language;\n throw new Error(`unhandled script language: ${String(_exhaustive)}`);\n }\n }\n}\n\n/**\n * The scripts that run when jQuery 3.7.1 (which SugarCube 2 bundles) inserts `html`, as SugarCube inserts the\n * `<script>` markup of a passage, in document order. jQuery parses the HTML as `innerHTML` of a `div` (so the\n * element may end before the closing tag the markup was matched by, and other script elements may follow), and\n * runs each script element outside template contents whose `type` its filter accepts and that has no `src`; the\n * browser then runs it, or not, by HTML's script type rules. Content of a script that does not run, such as a\n * template (`type=\"text/template\"`) or JSON, is not code.\n */\nexport function scriptsJQueryRuns(html: string): RunningScript[] {\n const fragment = parseHtmlFragment(html);\n const scripts: RunningScript[] = [];\n for (const { node } of descendants(fragment, false)) {\n const running = isElement(node) && node.tagName === 'script' ? jQueryRuns(node) : undefined;\n if (running !== undefined) scripts.push(running);\n }\n return scripts;\n}\n\n/**\n * What `htmlText` reads text after: a standards-mode document whose body holds a `div`, as a story's page holds the\n * element a passage is shown in. The `hr` turns the body's frameset-ok flag off, as content before that element does,\n * so a `<frameset>` start tag in the text is ignored. (A fragment parse would read the text in the same context, but\n * ends by moving every top-level node, one at a time, which takes time that grows with the square of their number.)\n */\nconst TEXT_CONTEXT = '<!DOCTYPE html><body><hr><div>';\n\n/**\n * Elements whose text a browser never shows (the user agent style sheet hides them, or their content is not\n * rendered): their text is not the text `htmlText` reads.\n */\nconst UNSHOWN_TEXT_ELEMENTS: ReadonlySet<string> = new Set([\n 'iframe',\n 'noembed',\n 'noframes',\n 'noscript',\n 'script',\n 'style',\n 'title',\n]);\n\n/**\n * The SVG elements a browser renders, and what they hold: shapes, containers and text. The others render nothing of\n * what they hold (definitions, paint servers, metadata, animations), and neither does an element that SVG does not\n * define.\n */\nconst RENDERED_SVG_ELEMENTS: ReadonlySet<string> = new Set([\n 'a',\n 'circle',\n 'ellipse',\n 'foreignObject',\n 'g',\n 'image',\n 'line',\n 'path',\n 'polygon',\n 'polyline',\n 'rect',\n 'svg',\n 'switch',\n 'text',\n 'textPath',\n 'tspan',\n 'use',\n]);\n\n/** SVG elements whose text is rendered inside a `text` element; `text` itself renders its text anywhere. */\nconst SVG_TEXT_CHILDREN: ReadonlySet<string> = new Set(['a', 'textPath', 'tspan']);\n\n/** The MathML token elements, the only MathML elements that render their text. */\nconst MATHML_TOKEN_ELEMENTS: ReadonlySet<string> = new Set(['mi', 'mn', 'mo', 'ms', 'mtext']);\n\n/**\n * What a browser does with the elements of a tree, for the text it shows: whether an element and what is in it can be\n * seen, whether text directly in it is laid out, and what kind of elements it renders.\n */\ninterface Display {\n /** The element is rendered (not hidden, not inside a hidden element or an element that renders no such child). */\n readonly visible: boolean;\n /** Text (other than white space between elements) directly in the element is laid out. */\n readonly text: boolean;\n /** The kinds of element it renders as its children (the others, such as an HTML element in MathML, are not). */\n readonly renders: ReadonlySet<htmlSpec.NS>;\n /** The element is an SVG text content element: a `text` element, or a `tspan`, `textPath` or `a` in one. */\n readonly svgText: boolean;\n}\n\nconst ALL_NAMESPACES: ReadonlySet<htmlSpec.NS> = new Set([htmlSpec.NS.HTML, htmlSpec.NS.SVG, htmlSpec.NS.MATHML]);\nconst SVG_ONLY: ReadonlySet<htmlSpec.NS> = new Set([htmlSpec.NS.SVG]);\nconst MATHML_ONLY: ReadonlySet<htmlSpec.NS> = new Set([htmlSpec.NS.MATHML]);\n/** MathML token elements render text, and HTML in it. */\nconst MATHML_AND_HTML: ReadonlySet<htmlSpec.NS> = new Set([htmlSpec.NS.MATHML, htmlSpec.NS.HTML]);\n\nconst ROOT_DISPLAY: Display = { visible: true, text: true, renders: ALL_NAMESPACES, svgText: false };\n\n/** How a browser renders `element`, which lies in an element that is rendered as `parent`. */\nfunction displayOf(element: HtmlElement, parent: Display): Display {\n const { tagName, namespaceURI } = element;\n const hidden =\n UNSHOWN_TEXT_ELEMENTS.has(tagName) ||\n (namespaceURI === HTML_NS && tagName === 'template') ||\n (namespaceURI === htmlSpec.NS.SVG && !RENDERED_SVG_ELEMENTS.has(tagName));\n const visible = parent.visible && !hidden && parent.renders.has(namespaceURI);\n switch (namespaceURI) {\n case htmlSpec.NS.SVG: {\n const svgText = tagName === 'text' || (SVG_TEXT_CHILDREN.has(tagName) && parent.svgText);\n const foreign = tagName === 'foreignObject';\n return { visible, text: svgText || foreign, renders: foreign ? ALL_NAMESPACES : SVG_ONLY, svgText };\n }\n case htmlSpec.NS.MATHML: {\n const token = MATHML_TOKEN_ELEMENTS.has(tagName);\n return { visible, text: token, renders: token ? MATHML_AND_HTML : MATHML_ONLY, svgText: false };\n }\n default:\n return { visible, text: true, renders: ALL_NAMESPACES, svgText: false };\n }\n}\n\n/**\n * The text a browser shows in the nodes `roots` (their descendants too, in tree order, not those in a `template`'s\n * content), as the reader of a page sees it: the text nodes whose element is rendered, with a space for each `br`\n * element. Text that is not white space must be laid out by its element, which an SVG or MathML element does not do for\n * most of its text; white space between elements always parts the words around it.\n */\nfunction shownTextOf(roots: readonly ChildNode[]): string {\n const text: string[] = [];\n const stack: { readonly nodes: readonly ChildNode[]; at: number; readonly display: Display }[] = [\n { nodes: roots, at: 0, display: ROOT_DISPLAY },\n ];\n for (let level = stack[0]; level !== undefined; level = stack[stack.length - 1]) {\n const node = level.nodes[level.at];\n level.at += 1;\n if (node === undefined) {\n stack.pop();\n } else if (isElement(node)) {\n const display = displayOf(node, level.display);\n if (display.visible && node.namespaceURI === HTML_NS && node.tagName === 'br') text.push(' ');\n if (node.childNodes.length > 0) stack.push({ nodes: node.childNodes, at: 0, display });\n } else if (node.nodeName === '#text' && 'value' in node) {\n if (level.display.visible && (level.display.text || node.value.trim() === '')) text.push(node.value);\n }\n }\n return text.join('');\n}\n\n/**\n * The text an HTML parser reads from `html` in the content of a `div` element of a page (see `TEXT_CONTEXT`), as\n * `parseHtml()` reads a document, and a browser shows (see `shownTextOf`): the text of the tree it builds, in tree\n * order, with a space for each `br` element. Start and end tags, comments and doctypes give none, whatever their quoted\n * attribute values hold, and neither does a tag left open at the end, which the parser drops; a `<` that starts none\n * of them (`<3`, `a < b`) is text. A character reference gives the character it stands for. Left out:\n * - the text of `script`, `style`, `title`, `noscript` (read with scripting on), `noembed`, `noframes` and `iframe`\n * elements and the content of a `template`; that of a `textarea` is read;\n * - in SVG, text outside a `text` element (and the `tspan`, `textPath` and `a` elements in one) or a\n * `foreignObject`, and everything in an element SVG does not render (definitions, paint servers, metadata, animations:\n * `defs`, `symbol`, `mask`, `title`, `set`…);\n * - in MathML, text outside a token element (`mi`, `mn`, `mo`, `ms`, `mtext`).\n * Styles and attributes such as `hidden` are not considered. The parser drops NUL characters in most places and the\n * line feed just after a `pre`, `listing` or `textarea` start tag. Throws an `HtmlNestingError` when elements nest\n * more than `MAX_HTML_DEPTH` deep, counting the `html`, `body` and `div` elements around the text.\n */\nexport function htmlText(html: string): string {\n return shownTextOf(afterContext(parseText(html)));\n}\n\n/** The document `html` makes after `TEXT_CONTEXT` (see `afterContext`). */\nfunction parseText(html: string): HtmlDocument {\n return parse(TEXT_CONTEXT + html, { scriptingEnabled: true, treeAdapter: depthLimitedTreeAdapter() });\n}\n\n/** The body of the page that `TEXT_CONTEXT` starts. */\nfunction pageBody(document: HtmlDocument): HtmlElement | undefined {\n const page = childrenOf(document).find((node) => isHtmlElement(node, 'html'));\n return page === undefined ? undefined : childrenOf(page).find((node) => isHtmlElement(node, 'body'));\n}\n\n/** The `div` that `TEXT_CONTEXT` ends with, after its `hr`, in the document it starts. */\nfunction contextDiv(document: HtmlDocument): HtmlElement | undefined {\n const div = childrenOf(pageBody(document) ?? document)[1];\n return div !== undefined && isHtmlElement(div, 'div') ? div : undefined;\n}\n\n/**\n * What the parser put in the page after `TEXT_CONTEXT`: the content of its `div`, and what follows the `div` in the\n * body if the text closed it.\n */\nfunction afterContext(document: HtmlDocument): ChildNode[] {\n const body = pageBody(document);\n const div = contextDiv(document);\n return div === undefined || body === undefined ? [] : [...div.childNodes, ...childrenOf(body).slice(2)];\n}\n\n/**\n * What jQuery puts around HTML that starts with a table part, so that the part is parsed in its table (`wrapMap`):\n * the number of levels to go down to the elements the HTML makes, and the markup before and after it.\n */\nconst JQUERY_WRAPS: ReadonlyMap<string, readonly [levels: number, before: string, after: string]> = new Map([\n ['thead', [1, '<table>', '</table>']],\n ['tbody', [1, '<table>', '</table>']],\n ['tfoot', [1, '<table>', '</table>']],\n ['colgroup', [1, '<table>', '</table>']],\n ['caption', [1, '<table>', '</table>']],\n ['col', [2, '<table><colgroup>', '</colgroup></table>']],\n ['tr', [2, '<table><tbody>', '</tbody></table>']],\n ['td', [3, '<table><tbody><tr>', '</tr></tbody></table>']],\n ['th', [3, '<table><tbody><tr>', '</tr></tbody></table>']],\n]);\n\n/** A text node that is in no tree yet. */\nfunction textNode(value: string, parentNode: ParentNode | null = null): DefaultTreeAdapterTypes.TextNode {\n return { nodeName: '#text', value, parentNode };\n}\n\n/**\n * The nodes jQuery 3 makes of HTML it appends to an element, as SugarCube's `<html>`, `<style>` and `<svg>` elements\n * do (`jQuery(fragment).append(html)`): HTML with no `<` and no character reference is one text node, as it is; HTML\n * that starts with a table part (the first tag in it is a `tr`, a `td`, a `col`…) is parsed inside a `table` (and a\n * `tbody`, a `tr`), and only the nodes under that wrapper are appended: text that the parser put before the table (a\n * `<tr>` followed by text) is lost; any other HTML is parsed in a `div`. Throws an `HtmlNestingError` when the elements\n * nest more than `MAX_HTML_DEPTH` deep.\n */\nfunction appendedNodes(html: string): ChildNode[] {\n if (!/<|&#?\\w+;/.test(html)) return [textNode(html)];\n const tag = /<([a-z][^/\\0>\\x20\\t\\r\\n\\f]*)/i.exec(html)?.[1]?.toLowerCase() ?? '';\n const [levels, before, after] = JQUERY_WRAPS.get(tag) ?? [0, '', ''];\n const document = parseText(before + html + after);\n if (levels === 0) return afterContext(document);\n // The elements go down `levels` as jQuery's `tmp.lastChild` takes them, from the `div` the text context ends with.\n let node: HtmlNode | undefined = contextDiv(document);\n for (let level = 0; level < levels && node !== undefined; level++) node = childrenOf(node).at(-1);\n return node === undefined ? [] : [...childrenOf(node)];\n}\n\n/**\n * The line feeds and character references in passage text: SugarCube's `lineBreak` pattern, and its\n * `htmlCharacterReference` pattern for a reference, `&`, a name or number, and `;`.\n */\nconst LINE_FEED_OR_REFERENCE_RE = /\\n|&#?[0-9A-Za-z]{2,8};/g;\n\nconst referencedText = new Map<string, string>();\n\n/** The character a character reference (see `LINE_FEED_OR_REFERENCE_RE`) stands for, as a parser reads it in a `div`. */\nfunction referenceText(reference: string): string {\n let read = referencedText.get(reference);\n if (read === undefined) {\n read = childrenOf(parseFragment(FRAGMENT_CONTEXT, reference, { scriptingEnabled: true }))\n .map((node) => ('value' in node ? node.value : ''))\n .join('');\n referencedText.set(reference, read);\n }\n return read;\n}\n\n/** An element SugarCube's `htmlTag` parser makes from a start tag (see `createdElement`). */\ninterface CreatedElement {\n readonly name: string;\n readonly namespace: htmlSpec.NS;\n}\n\nconst createdElements = new Map<string, CreatedElement>();\n\n/**\n * The element SugarCube 2's `htmlTag` parser makes from a start tag `<name>` shown inside an element named `context`:\n * it sets the `innerHTML` of a new element of that name to the start tag, then takes the first child, the first child\n * of that, and so on, so the parser reads the tag in the context of the element around it. A start tag that gives no\n * node there (`<tr>` in a `div`: the parser ignores it) leaves the new element itself, a copy of the one around. The\n * same name gives different elements in different contexts (`<tr>` in a `table` gives a `tr`), and a `math` start tag\n * a MathML element.\n */\nfunction createdElement(context: string, name: string): CreatedElement {\n const key = `${context} ${name}`;\n let created = createdElements.get(key);\n if (created === undefined) {\n const contextElement = defaultTreeAdapter.createElement(context, HTML_NS, []);\n let node: HtmlNode = parseFragment(contextElement, `<${name}>`, { scriptingEnabled: true });\n for (let child = childrenOf(node)[0]; child !== undefined; child = childrenOf(node)[0]) node = child;\n created = isElement(node)\n ? { name: node.tagName, namespace: node.namespaceURI }\n : { name: context, namespace: HTML_NS };\n createdElements.set(key, created);\n }\n return created;\n}\n\n/**\n * A piece of passage markup in the order SugarCube's wikifier reads it, for `wikifiedText`:\n * - `text`: passage text, in which a line feed is a line break unless the element around it takes none (see\n * `NO_LINE_BREAK_ELEMENTS`) and a character reference (with its `;`) gives the character it stands for;\n * - `link`: link markup, an `a` element with a label;\n * - `verbatim`: text SugarCube shows as it is, in a `span` element (`<nowiki>`);\n * - `nodes`: the nodes of HTML that SugarCube appends as it is (see `appendedNodes`; `parseAppended`);\n * - `start`: a start tag of an HTML element, by its name in lower case, and whether an end tag closes the element;\n * - `end`: an end tag that closes the innermost element opened.\n */\nexport type WikifiedPiece =\n | { readonly kind: 'text'; readonly text: string }\n | { readonly kind: 'link'; readonly text: string }\n | { readonly kind: 'verbatim'; readonly text: string }\n | { readonly kind: 'nodes'; readonly nodes: readonly ChildNode[] }\n | { readonly kind: 'start'; readonly name: string; readonly container: boolean }\n | { readonly kind: 'end' };\n\n/**\n * Reads HTML that SugarCube appends to an element as it is (an `<html>`, `<style>` or `<svg>` element): the piece to\n * give `wikifiedText`, and the text it shows on its own. Throws an `HtmlNestingError` when the elements nest more than\n * `MAX_HTML_DEPTH` deep.\n */\nexport function parseAppended(html: string): { readonly piece: WikifiedPiece; readonly text: string } {\n const nodes = appendedNodes(html);\n return { piece: { kind: 'nodes', nodes }, text: shownTextOf(nodes) };\n}\n\n/**\n * The `htmlTag` parser's `nobrTags`: inside one of these elements, a line feed makes no line break (but one inside an\n * element of another name does again).\n */\nconst NO_LINE_BREAK_ELEMENTS: ReadonlySet<string> = new Set([\n 'colgroup',\n 'datalist',\n 'dl',\n 'figure',\n 'meter',\n 'ol',\n 'optgroup',\n 'picture',\n 'progress',\n 'ruby',\n 'select',\n 'table',\n 'tbody',\n 'tfoot',\n 'thead',\n 'tr',\n 'ul',\n 'video',\n]);\n\n/** An element that is being filled, as SugarCube's wikifier fills it. */\ninterface OpenElement {\n readonly element: HtmlElement;\n /** Whether a line feed in it makes no line break. */\n readonly noLineBreak: boolean;\n}\n\n/**\n * The text a reader sees when SugarCube shows passage markup that is read as `pieces`: its wikifier makes the elements\n * one at a time, each from its own start tag (see `createdElement`), puts the text and the elements that follow into\n * it up to its end tag, and the nodes it makes of HTML it appends as they are, and shows the result (see\n * `shownTextOf`). A line feed becomes a `br` element, shown as a space, but in a table, list or similar element it\n * makes none. Nothing shows in an element a browser hides (`script`, `style`, `template`, `noscript`, `iframe`...), and\n * none of an HTML element in a `math` element shows, since SugarCube makes the elements in it HTML elements, which a\n * browser does not render there.\n *\n * Throws an `HtmlNestingError` when elements nest more than `MAX_HTML_DEPTH` deep, counting the `html`, `body` and\n * `div` elements a browser puts around them.\n */\nexport function wikifiedText(pieces: Iterable<WikifiedPiece>): string {\n const passage = defaultTreeAdapter.createElement('div', HTML_NS, []);\n const open: OpenElement[] = [];\n let into: HtmlElement = passage;\n let noLineBreak = false;\n const append = (node: ChildNode): void => {\n node.parentNode = into;\n into.childNodes.push(node);\n };\n const appendElement = (name: string, namespace: htmlSpec.NS): HtmlElement => {\n const element = defaultTreeAdapter.createElement(name, namespace, []);\n append(element);\n return element;\n };\n for (const piece of pieces) {\n switch (piece.kind) {\n case 'text': {\n let from = 0;\n for (const found of piece.text.matchAll(LINE_FEED_OR_REFERENCE_RE)) {\n if (found.index > from) append(textNode(piece.text.slice(from, found.index)));\n if (found[0] === '\\n') {\n if (!noLineBreak) appendElement('br', HTML_NS);\n } else {\n append(textNode(referenceText(found[0])));\n }\n from = found.index + found[0].length;\n }\n if (from < piece.text.length) append(textNode(piece.text.slice(from)));\n break;\n }\n case 'link':\n case 'verbatim': {\n const holder = appendElement(piece.kind === 'link' ? 'a' : 'span', HTML_NS);\n holder.childNodes.push(textNode(piece.text, holder));\n break;\n }\n case 'nodes':\n for (const node of piece.nodes) append(node);\n break;\n case 'start': {\n const created = createdElement(into.tagName, piece.name);\n const element = appendElement(created.name, created.namespace);\n if (!piece.container) break;\n if (open.length + 3 >= MAX_HTML_DEPTH) throw new HtmlNestingError();\n noLineBreak = NO_LINE_BREAK_ELEMENTS.has(piece.name);\n open.push({ element, noLineBreak });\n into = element;\n break;\n }\n case 'end':\n open.pop();\n into = open[open.length - 1]?.element ?? passage;\n noLineBreak = open[open.length - 1]?.noLineBreak ?? false;\n break;\n default: {\n const _exhaustive: never = piece;\n throw new Error(`Unhandled piece: ${JSON.stringify(_exhaustive)}`);\n }\n }\n }\n return shownTextOf(passage.childNodes);\n}\n\n/**\n * The attributes of the element that SugarCube 2's `htmlTag` parser makes from a start tag it matched in passage\n * markup (`startTag`): it sets the `innerHTML` of an element (a `div` here) to the start tag, then takes the first\n * child, the first child of that, and so on. A start tag that gives no node (such as `<td>` outside a table) leaves\n * the `div` itself, which has no attributes; one that gives a text node gives `undefined`. Names are as the browser\n * parses them: lower case, and of an attribute written twice only the first.\n */\nexport function wikifiedElementAttributes(startTag: string): ReadonlyMap<string, string> | undefined {\n let node: HtmlNode = parseHtmlFragment(startTag);\n for (let child = childrenOf(node)[0]; child !== undefined; child = childrenOf(node)[0]) node = child;\n if (node.nodeName === '#document-fragment') return new Map();\n if (!isElement(node)) return undefined;\n return new Map(\n node.attrs.map((attr) => [attr.prefix === undefined ? attr.name : `${attr.prefix}:${attr.name}`, attr.value]),\n );\n}\n\n/** A placeholder in the text of a script or style element: its site index, and its range in that text. */\ninterface CodeRange extends SourceRange {\n readonly index: number;\n}\n\n/** Fill in the contexts of placeholders in script and style text, tokenizing each element's text once. */\nfunction resolveCodeContexts(\n html: string,\n occurrences: readonly PlaceholderOccurrence[],\n sites: readonly PlaceholderSite[],\n found: ReadonlyMap<number, MarkerPlace>,\n): PlaceholderSite[] {\n // The text of a script or style element starts where its start tag ends.\n const byElement = new Map<HtmlElement, { readonly textStart: number; readonly ranges: CodeRange[] }>();\n for (const [index, place] of found) {\n if (place.kind !== 'text' || !isElement(place.parent) || place.parent.namespaceURI !== HTML_NS) continue;\n const textStart = place.parent.sourceCodeLocation?.startTag?.endOffset;\n const occurrence = occurrences[index];\n if (!CODE_ELEMENTS.has(place.parent.tagName) || textStart === undefined || occurrence === undefined) continue;\n const group = byElement.get(place.parent) ?? { textStart, ranges: [] };\n group.ranges.push({ index, start: occurrence.start - textStart, end: occurrence.end - textStart });\n byElement.set(place.parent, group);\n }\n const resolved = [...sites];\n for (const [element, { textStart, ranges }] of byElement) {\n const textEnd = element.sourceCodeLocation?.endTag?.startOffset ?? html.length;\n for (const { range, context } of codeContexts(element, html.slice(textStart, textEnd), ranges)) {\n const whole =\n (context.kind === 'script' || context.kind === 'json') && context.js.kind === 'string' && context.js.whole;\n const delimiters = whole ? 'string' : (sites[range.index]?.delimiters ?? 'split');\n resolved[range.index] = { context, delimiters };\n }\n }\n return resolved;\n}\n\n/** Elements whose text is code: script and style. */\nconst CODE_ELEMENTS: ReadonlySet<string> = new Set(['script', 'style']);\n\nfunction codeContexts(\n element: HtmlElement,\n source: string,\n ranges: readonly CodeRange[],\n): InContext<CodeRange, InsertionContext>[] {\n if (element.tagName === 'style') {\n return cssContexts(source, ranges).map(({ range, context: css }) => ({ range, context: { kind: 'style', css } }));\n }\n const language = scriptLanguage(element);\n if (language === 'data') return ranges.map((range) => ({ range, context: { kind: 'raw-text', element: 'script' } }));\n const module = language === 'module';\n return javaScriptContexts(source, ranges, module).map(({ range, context: js }) => {\n const escapable = source.slice(0, range.start).includes('<!--');\n const context: InsertionContext =\n language === 'json' ? { kind: 'json', js, escapable } : { kind: 'script', module, js, escapable };\n return { range, context };\n });\n}\n","/**\n * Reads SugarCube 2 link and image markup the way SugarCube 2.37.3's\n * `Wikifier.helpers.parseSquareBracketedMarkup` does:\n *\n * - `[[Link]]`, `[[Text|Link]]`, `[[Text->Link]]` and `[[Link<-Text]]`, each with an optional\n * setter: `[[Text|Link][$x to 1]]`;\n * - `[img[Source]]`, `[img[Title|Source]]` and `[img[Source<-Title]]`, with an optional link and\n * setter: `[img[Source][Link][$x to 1]]`, and `[<img[` or `[>img[` for alignment.\n *\n * The first `|`, `->` or `<-` divides the text from the link; any later one is part of the link\n * or the text. Square brackets nest; a double-quoted string, or in a setter a single-quoted one\n * too, is read as a unit, so a `]` or a delimiter in it counts for nothing. The markup must end\n * on the line it starts on.\n */\n\n/** Link or image markup, as far as finding the passage it links to needs. */\nexport interface SquareBracketedMarkup {\n readonly type: 'link' | 'image';\n /**\n * What the markup links to, trimmed and without the `~` that forces an internal link: a link's\n * destination, or an image's link component, if it has one. SugarCube reads it as a passage name\n * if a passage has that name, and otherwise evaluates it.\n */\n readonly link: string | undefined;\n /**\n * What a link displays, untrimmed: its text component, which is the whole of `[[Link]]`. Undefined for image\n * markup.\n */\n readonly label: string | undefined;\n /** Index just past the closing `]]`. */\n readonly end: number;\n}\n\n/** A component of the markup ends here, and the next one starts at `next`. */\ninterface ComponentEnd {\n /** Index just past the component's text. */\n readonly textEnd: number;\n /** Where the next part starts: after `][` or after `]]`. */\n readonly next: number;\n /** Whether `]]` ended the markup; otherwise `][` opened another component. */\n readonly last: boolean;\n}\n\n/**\n * Characters a reading may still look at: it stops, as having failed, when they run out.\n * `scanned` is how far it has looked so far: the index just past the last character it read.\n */\ninterface Reader {\n readonly text: string;\n readonly limit: number;\n scanned: number;\n}\n\n/** Records that the reading has looked at the characters before `pos`, and returns `result`. */\nfunction readTo<T>(reader: Reader, pos: number, result: T): T {\n markScanned(reader, pos);\n return result;\n}\n\n/** Records that the reading looked at the characters before `pos`. */\nfunction markScanned(reader: Reader, pos: number): void {\n reader.scanned = Math.max(reader.scanned, pos);\n}\n\n/**\n * Reads link or image markup that starts at `start` in `text`, or returns `undefined` where\n * SugarCube rejects it (and so prints the text instead).\n *\n * `budget.left`, if given, is how many characters the reading may look at; it is reduced by as\n * many as were read, and once it runs out, every reading fails. Unclosed markup is read to the end\n * of its line, so reading every `[[` of a long line that never closes one would otherwise take\n * quadratic time. A reading is charged for the characters it looked at, up to where it ended or\n * failed (a line feed, say), and no more, so markup left unclosed on short lines costs little.\n */\nexport function readSquareBracketedMarkup(\n text: string,\n start: number,\n budget: { left: number } = { left: Infinity },\n): SquareBracketedMarkup | undefined {\n const reader: Reader = { text, limit: Math.min(text.length, start + Math.max(budget.left, 0)), scanned: start };\n const markup = readMarkup(reader, start);\n budget.left -= Math.max(reader.scanned, markup?.end ?? start) - start;\n return markup;\n}\n\nfunction readMarkup(reader: Reader, start: number): SquareBracketedMarkup | undefined {\n const { text } = reader;\n if (text[start] !== '[') {\n return undefined;\n }\n let pos = start + 1;\n let type: SquareBracketedMarkup['type'];\n if (text[pos] === '[') {\n type = 'link';\n pos += 1;\n } else {\n if (text[pos] === '<' || text[pos] === '>') {\n pos += 1;\n }\n if (!/^[Ii][Mm][Gg]\\[/.test(text.slice(pos, pos + 4))) {\n return undefined;\n }\n type = 'image';\n pos += 4;\n }\n\n const core = readCoreComponents(reader, pos);\n if (core === undefined) {\n return undefined;\n }\n if (type === 'link') {\n if (!core.end.last) {\n const setterEnd = readSetter(reader, core.end.next);\n if (setterEnd === undefined) {\n return undefined;\n }\n return { type, link: linkName(core.link), label: core.label, end: setterEnd };\n }\n return { type, link: linkName(core.link), label: core.label, end: core.end.next };\n }\n if (core.end.last) {\n return { type, link: undefined, label: undefined, end: core.end.next };\n }\n // An image's link component, then perhaps a setter.\n const linkEnd = readComponent(reader, core.end.next, false);\n if (linkEnd === undefined) {\n return undefined;\n }\n const link = linkName(text.slice(core.end.next, linkEnd.textEnd));\n if (linkEnd.last) {\n return { type, link, label: undefined, end: linkEnd.next };\n }\n const setterEnd = readSetter(reader, linkEnd.next);\n return setterEnd === undefined ? undefined : { type, link, label: undefined, end: setterEnd };\n}\n\n/** The link component as SugarCube keeps it: trimmed, and without a leading `~`. */\nfunction linkName(component: string): string {\n const trimmed = component.trim();\n return trimmed.startsWith('~') ? trimmed.slice(1) : trimmed;\n}\n\n/**\n * Reads the first components: the text and the link of link markup, or the title and the source\n * of image markup, divided by the first delimiter. `link` is the text of the link (or source)\n * component, untrimmed; `label` is the text (or title) component, untrimmed.\n */\nfunction readCoreComponents(\n reader: Reader,\n from: number,\n): { link: string; label: string; end: ComponentEnd } | undefined {\n const { text } = reader;\n const split: {\n delimiter: 'none' | 'ltr' | 'rtl';\n componentStart: number;\n labelEnd: number | undefined;\n link: string | undefined;\n } = { delimiter: 'none', componentStart: from, labelEnd: undefined, link: undefined };\n const end = scanComponent(reader, from, '\"', (ch, pos) => {\n if (split.delimiter !== 'none') {\n return pos;\n }\n if (ch === '|') {\n split.delimiter = 'ltr';\n split.labelEnd = pos - 1;\n split.componentStart = pos;\n } else if (ch === '-' && text[pos] === '>') {\n split.delimiter = 'ltr';\n split.labelEnd = pos - 1;\n split.componentStart = pos + 1;\n } else if (ch === '<' && text[pos] === '-') {\n split.delimiter = 'rtl';\n split.link = text.slice(split.componentStart, pos - 1);\n split.componentStart = pos + 1;\n }\n return Math.max(pos, split.componentStart);\n });\n // With `<-`, the link came first and this component is the text.\n if (end === undefined) return undefined;\n const rest = text.slice(split.componentStart, end.textEnd);\n return { link: split.link ?? rest, label: split.delimiter === 'ltr' ? text.slice(from, split.labelEnd) : rest, end };\n}\n\n/**\n * Reads a component after `][` that holds no delimiter: an image's link (`setter` false) or a\n * setter, in which single quotes also quote.\n */\nfunction readComponent(reader: Reader, from: number, setter: boolean): ComponentEnd | undefined {\n return scanComponent(reader, from, setter ? `\"'` : '\"', (_ch, pos) => pos);\n}\n\n/**\n * Reads a component from `from` to the `]` that brings the bracket depth back to one: square\n * brackets nest, a string in one of `quotes` is read as a unit, and a line feed ends the markup\n * unread. Any other character is passed to `onOther`, which returns where reading goes on.\n */\nfunction scanComponent(\n reader: Reader,\n from: number,\n quotes: string,\n onOther: (ch: string, pos: number) => number,\n): ComponentEnd | undefined {\n const { text } = reader;\n let depth = 2;\n let pos = from;\n while (pos < reader.limit) {\n const ch = text.charAt(pos);\n pos += 1;\n if (ch === '\\n') {\n markScanned(reader, pos);\n return undefined;\n }\n if (quotes.includes(ch)) {\n const end = readQuoted(reader, pos, ch);\n if (end === undefined) {\n return undefined;\n }\n pos = end;\n } else if (ch === '[') {\n depth += 1;\n } else if (ch === ']') {\n depth -= 1;\n if (depth === 1) {\n return componentEnd(reader, pos);\n }\n } else {\n pos = onOther(ch, pos);\n }\n }\n markScanned(reader, pos);\n return undefined;\n}\n\n/** Reads a setter, the last component; returns the index after its closing `]]`. */\nfunction readSetter(reader: Reader, from: number): number | undefined {\n const end = readComponent(reader, from, true);\n return end?.last === true ? end.next : undefined;\n}\n\n/** What the `]` just before `pos`, which brings the depth back to one, ends; `undefined` if malformed. */\nfunction componentEnd(reader: Reader, pos: number): ComponentEnd | undefined {\n // Whatever it holds, the character at `pos` has been looked at.\n switch (reader.text[pos]) {\n case '[':\n return readTo(reader, pos + 1, { textEnd: pos - 1, next: pos + 1, last: false });\n case ']':\n return readTo(reader, pos + 1, { textEnd: pos - 1, next: pos + 1, last: true });\n default:\n markScanned(reader, pos + 1);\n return undefined;\n }\n}\n\n/**\n * Reads a quoted string from just after its opening quote; a backslash escapes the character\n * after it. A line feed, or the end of the text, ends it unterminated. Returns the index after the\n * closing quote.\n */\nfunction readQuoted(reader: Reader, from: number, quote: string): number | undefined {\n const { text } = reader;\n let pos = from;\n while (pos < reader.limit) {\n const ch = text[pos];\n pos += 1;\n if (ch === quote) {\n return pos;\n }\n if (ch === '\\n') {\n markScanned(reader, pos);\n return undefined;\n }\n if (ch === '\\\\') {\n if (pos >= reader.limit || text[pos] === '\\n') {\n markScanned(reader, Math.min(pos + 1, reader.limit));\n return undefined;\n }\n pos += 1;\n }\n }\n markScanned(reader, pos);\n return undefined;\n}\n","/**\n * Reads SugarCube 2 macro calls, link markup and HTML start tags the way SugarCube 2.37.3 does, so\n * the link check sees the same passage names that `[[…]]` links, `<<link>>`, `<<button>>`,\n * `<<goto>>` and elements with a `data-passage` attribute use when the story plays.\n *\n * Each step follows a part of SugarCube's macro parser:\n * - `findMacroTags` finds where a tag starts and ends (the parser's `lookahead` pattern);\n * - `parseMacroArgs` splits the text after the macro name into arguments (`parseArgs`);\n * - quoted arguments are evaluated as strict-mode JavaScript strings (`evalStringLiteral`).\n *\n * The scanners below copy SugarCube's own regular expressions, so they follow SugarCube's grammar\n * rather than ECMAScript's; where a pattern's `.` stops at a line terminator, the shared\n * ECMAScript set from `js-chars.ts` is used. JavaScript itself (scripts, `<script>` elements,\n * `<<script>>` bodies, TwineScript arguments, quoted strings) is read with acorn, through\n * `javascript-strings.ts`.\n *\n * Link and image markup is read as `parseSquareBracketedMarkup` reads it (see `link-markup.ts`).\n * Of the rest of the wikifier, only comments, `<script>` elements and `<<script>>` bodies are\n * told apart; other markup, such as verbatim text, is read as markup (see `findPassageLinks`).\n */\nimport { SUBSTITUTION, evalStringLiteral, javaScriptStrings } from './javascript-strings.js';\nimport type { ScriptMode } from './javascript-strings.js';\nimport { scriptsJQueryRuns, wikifiedElementAttributes } from './html-structure.js';\nimport { LINE_TERMINATORS, isLineTerminator } from './js-chars.js';\nimport { readSquareBracketedMarkup } from './link-markup.js';\n\n/** A macro tag: `<<name args>>`, or a closing tag `<</name>>`. */\nexport interface MacroTag {\n /** The macro name, with a leading `/` for a closing tag. */\n readonly name: string;\n /** The text between the name (and the spaces after it) and the closing `>>`. */\n readonly args: string;\n /** Index of the opening `<<`. */\n readonly start: number;\n /** Index just past the closing `>>`. */\n readonly end: number;\n}\n\n/** What a macro argument evaluates to, as far as that is known without playing the story. */\nexport type MacroArg =\n /** A quoted string, or a bare word SugarCube keeps as text. */\n | { readonly type: 'string'; readonly value: string }\n /** A bare word SugarCube converts to a number. */\n | { readonly type: 'number'; readonly value: number }\n /** Link or image markup: `[[…]]` or `[img[…]]`. */\n | { readonly type: 'markup' }\n | { readonly type: 'null' }\n /** A variable, an expression, `setup`/`settings`, a boolean or `undefined`. */\n | { readonly type: 'other' };\n\n/** The macros whose calls name a passage. SugarCube registers `<<button>>` with `<<link>>`'s handler. */\ntype PassageLinkMacro = 'goto' | 'link' | 'button';\n\n/**\n * A passage named by link markup (`[[…]]`), by a `<<link>>`, `<<button>>` or `<<goto>>` call, or by the\n * `data-passage` attribute of an element.\n */\nexport interface PassageLink {\n /** What names it: link markup, a call of that macro, or an element's `data-passage` attribute. */\n readonly via: 'markup' | 'data-passage' | PassageLinkMacro;\n readonly passage: string;\n}\n\n/** An argument as SugarCube's lexer splits it, before its value is worked out. */\ntype LexedArg =\n | { readonly kind: 'string'; readonly value: string }\n | { readonly kind: 'expression'; readonly code: string }\n | { readonly kind: 'markup'; readonly text: string }\n | { readonly kind: 'word'; readonly text: string };\n\n/** A tag, and where a `<<link`, `<<button` or `<<goto` first appears unquoted in its arguments, if it does. */\nexport interface ScannedTag {\n readonly tag: MacroTag;\n readonly innerCall: number | undefined;\n}\n\n// SugarCube's `Patterns.macroName`, preceded by the optional `/` of a closing tag.\nconst NAME_RE = /\\/?[A-Za-z][\\w-]*|[=-]/y;\nconst SPACES_RE = /\\s*/y;\n// What a SugarCube pattern's `.` does not match.\nconst LINE_TERMINATOR_RE = new RegExp(`[${LINE_TERMINATORS}]`, 'g');\nconst SQUARE_BRACKET_OPEN_RE = /\\[(?:[<>]?[Ii][Mm][Gg])?\\[/y;\n\n// SugarCube's `Patterns.space` and `Patterns.notSpace`: JavaScript's `\\s` plus U+180E, which\n// `\\s` no longer matches.\nconst SPACE_RE = /[\\s\\u180e]/g;\nconst NOT_SPACE_RE = /[^\\s\\u180e]/g;\nconst VARIABLE_RE = /^[$_][$A-Z_a-z][$0-9A-Z_a-z]*/;\nconst SETTINGS_OR_SETUP_RE = /^(?:settings|setup)[.[]/;\nconst IMAGE_MARKUP_CHARS = '<>IiMmGg';\n\n/**\n * Macros that SugarCube doesn't split into arguments (`skipArgs` in 2.37.3), with their child\n * tags that do the same: `<<elseif>>` and `<<else>>` of `<<if>>`, and `<<optionsfrom>>` of\n * `<<cycle>>` and `<<listbox>>`. Their argument text is TwineScript, or for `<<capture>>`,\n * `<<unset>>` and `<<for>>` a syntax of their own; either way its strings are JavaScript strings.\n */\nconst RAW_ARGUMENT_MACROS: ReadonlySet<string> = new Set([\n 'break',\n 'capture',\n 'continue',\n 'done',\n 'else',\n 'elseif',\n 'for',\n 'if',\n 'nobr',\n 'optionsfrom',\n 'print',\n '=',\n '-',\n 'run',\n 'set',\n 'silent',\n 'silently',\n 'stop',\n 'switch',\n 'unset',\n 'waitforaudio',\n]);\n\n/**\n * How deep strings inside macro arguments are read for further calls. Stories nest two or three\n * levels; the limit keeps the work linear in the size of the text on any input.\n */\nconst MAX_STRING_DEPTH = 10;\n\n/**\n * What one reading of a passage carries down into the strings it reads: how deep it is, how much\n * the `<<script>>` closer search has left to read (see `scriptBodyCloser`), how much the\n * reading of link and image markup has (see `readSquareBracketedMarkup`), and how much the reading\n * of HTML start tags and the search for their end tags have (see `htmlTagReader`).\n */\ninterface ReadContext {\n readonly depth: number;\n readonly budget: { left: number };\n readonly markupBudget: { left: number };\n readonly tagBudget: { left: number };\n}\n\n/**\n * A context for reading `text`: the closer search, the markup reading and the HTML tag reading may\n * each read four times it, plus an allowance.\n */\nfunction readContext(text: string): ReadContext {\n const allowance = (): { left: number } => ({ left: 4 * text.length + 100_000 });\n return { depth: 0, budget: allowance(), markupBudget: allowance(), tagBudget: allowance() };\n}\n\nfunction deeper(context: ReadContext): ReadContext {\n return { ...context, depth: context.depth + 1 };\n}\n\n/** Index of the first match of a global `re` at or after `from`, or -1. */\nfunction searchFrom(re: RegExp, text: string, from: number): number {\n re.lastIndex = from;\n const m = re.exec(text);\n return m === null ? -1 : m.index;\n}\n\n/**\n * Finds the macro tags in text, in order, trying a tag at every `<<` as SugarCube's macro\n * parser does. A tag that doesn't parse is skipped, and the search goes on after its `<<`.\n *\n * Gives the same tags as SugarCube's pattern, without its backtracking: that pattern takes\n * exponential time when no `>>` follows a `<<name`, which a script passage can contain (`1<<n`).\n */\nexport function findMacroTags(text: string): MacroTag[] {\n return scanTags(text).map((scanned) => scanned.tag);\n}\n\nfunction scanTags(text: string): ScannedTag[] {\n const matchTagAt = tagMatcher(text);\n const tags: ScannedTag[] = [];\n let start = text.indexOf('<<');\n while (start !== -1) {\n const scanned = matchTagAt(start);\n if (scanned === undefined) {\n start = text.indexOf('<<', start + 2);\n } else {\n tags.push(scanned);\n start = text.indexOf('<<', scanned.tag.end);\n }\n }\n return tags;\n}\n\n/** A kind of argument part in which a `>>` doesn't end the tag, named by how it opens. */\ntype ArgumentPartKind = '/*' | '//' | '`' | '\"' | \"'\" | '[';\n\n/** How far an argument part reaches. */\ninterface ArgumentPartScan {\n /** Index just past the part, or `undefined` if it is never closed. */\n readonly end: number | undefined;\n /**\n * Where the scan stopped: at the part's closing quote, `*` + `/`, line end or `]]`, or where\n * it failed. A part of the same kind that starts inside this one, before this index, ends or\n * fails no earlier.\n */\n readonly stop: number;\n}\n\n/**\n * Returns a function that matches a tag at a `<<` in `text`. It must be called for positions in\n * increasing order.\n *\n * The arguments may contain comments, backquoted expressions, quoted strings and link markup,\n * whose `>>` doesn't end the tag. SugarCube's pattern treats such a part as a unit only if a\n * `>>` still follows it, and otherwise as plain characters; `lastClose`, the last `>>` in the\n * text, answers that in constant time. Once a part is read as plain characters, a part of the\n * same kind that starts inside it can't end before `lastClose` either, in this tag or a later\n * one, so it isn't scanned again: `scanFrom` records where each kind may next be scanned. This\n * keeps the search linear. `onWork` is told how many characters each step reads. (Exported for\n * tests; the module is not part of the package's API.)\n */\nexport function tagMatcher(\n text: string,\n lastClose = text.lastIndexOf('>>'),\n onWork: (characters: number) => void = () => {\n // Work is counted only for callers that ask (tests).\n },\n): (start: number) => ScannedTag | undefined {\n const scanFrom = new Map<ArgumentPartKind, number>();\n return (start) => {\n NAME_RE.lastIndex = start + 2;\n const nameMatch = NAME_RE.exec(text);\n if (nameMatch === null) {\n onWork(2);\n return undefined;\n }\n SPACES_RE.lastIndex = NAME_RE.lastIndex;\n SPACES_RE.exec(text);\n const argsStart = SPACES_RE.lastIndex;\n onWork(argsStart - start);\n\n let innerCall: number | undefined;\n let pos = argsStart;\n while (pos <= lastClose) {\n if (text.startsWith('>>', pos)) {\n const tag = { name: nameMatch[0], args: text.slice(argsStart, pos), start, end: pos + 2 };\n return { tag, innerCall };\n }\n const kind = argumentPartKindAt(text, pos);\n const from = kind === undefined ? undefined : scanFrom.get(kind);\n if (kind !== undefined && (from === undefined || pos >= from)) {\n const part = scanArgumentPart(text, pos, kind);\n onWork(part.stop - pos);\n if (part.end !== undefined && part.end <= lastClose) {\n pos = part.end;\n continue;\n }\n scanFrom.set(kind, part.stop);\n }\n if (innerCall === undefined && startsPassageLinkCall(text, pos)) {\n innerCall = pos;\n }\n onWork(1);\n pos += 1;\n }\n return undefined;\n };\n}\n\n/** Whether a `<<link`, `<<button` or `<<goto` tag, and not a longer macro name, starts at `pos`. */\nfunction startsPassageLinkCall(text: string, pos: number): boolean {\n if (!text.startsWith('<<', pos)) {\n return false;\n }\n NAME_RE.lastIndex = pos + 2;\n const name = NAME_RE.exec(text)?.[0];\n return name !== undefined && isPassageLinkMacro(name);\n}\n\n/** The kind of argument part that opens at `pos`, if one does. */\nfunction argumentPartKindAt(text: string, pos: number): ArgumentPartKind | undefined {\n const ch = text[pos];\n switch (ch) {\n case '/': {\n const next = text[pos + 1];\n return next === '*' ? '/*' : next === '/' ? '//' : undefined;\n }\n case '`':\n case '\"':\n case \"'\":\n case '[':\n return ch;\n default:\n return undefined;\n }\n}\n\nfunction scanArgumentPart(text: string, pos: number, kind: ArgumentPartKind): ArgumentPartScan {\n switch (kind) {\n case '/*': {\n const close = text.indexOf('*/', pos + 2);\n return close === -1 ? { end: undefined, stop: text.length } : { end: close + 2, stop: close };\n }\n case '//': {\n // `//.*\\n`: the comment must end at a line feed, not at any other line terminator.\n const lineEnd = searchFrom(LINE_TERMINATOR_RE, text, pos + 2);\n if (lineEnd === -1) {\n return { end: undefined, stop: text.length };\n }\n return { end: text[lineEnd] === '\\n' ? lineEnd + 1 : undefined, stop: lineEnd };\n }\n case '`':\n case '\"':\n case \"'\":\n return scanQuoted(text, pos, kind);\n case '[':\n return scanSquareBracketed(text, pos);\n default: {\n const _exhaustive: never = kind;\n throw new Error(`unhandled argument part: ${String(_exhaustive)}`);\n }\n }\n}\n\n/** A quoted part of a tag: a backslash escapes any character except a line terminator. */\nfunction scanQuoted(text: string, pos: number, quote: string): ArgumentPartScan {\n let i = pos + 1;\n while (i < text.length) {\n const ch = text[i];\n if (ch === quote) {\n return { end: i + 1, stop: i };\n }\n if (ch === '\\\\') {\n const next = text[i + 1];\n if (next === undefined || isLineTerminator(next)) {\n return { end: undefined, stop: i };\n }\n i += 2;\n } else {\n i += 1;\n }\n }\n return { end: undefined, stop: text.length };\n}\n\n/** Link or image markup in a tag: up to the first `]]` on the same line, plus any further `]`. */\nfunction scanSquareBracketed(text: string, pos: number): ArgumentPartScan {\n SQUARE_BRACKET_OPEN_RE.lastIndex = pos;\n if (!SQUARE_BRACKET_OPEN_RE.test(text)) {\n return { end: undefined, stop: pos + 1 };\n }\n for (let i = SQUARE_BRACKET_OPEN_RE.lastIndex; i < text.length; i++) {\n const ch = text[i];\n if (ch === '\\n' || ch === '\\r') {\n return { end: undefined, stop: i };\n }\n if (ch === ']' && text[i + 1] === ']') {\n let end = i + 2;\n while (text[end] === ']') {\n end += 1;\n }\n return { end, stop: i };\n }\n }\n return { end: undefined, stop: text.length };\n}\n\n/**\n * Splits a tag's argument text into arguments, as SugarCube's `parseArgs` does. Returns\n * `undefined` where SugarCube throws while splitting the text or reading a string, so the macro\n * call does nothing. (SugarCube also parses link markup a second time and rejects some that it\n * split without trouble, such as `[[\"x]]`; that is still returned as markup here.)\n */\nexport function parseMacroArgs(raw: string): MacroArg[] | undefined {\n return lexMacroArgs(raw)?.map(argValue);\n}\n\nfunction lexMacroArgs(raw: string): LexedArg[] | undefined {\n const args: LexedArg[] = [];\n let pos = searchFrom(NOT_SPACE_RE, raw, 0);\n while (pos !== -1) {\n const lexed = lexArgument(raw, pos);\n if (lexed === undefined) {\n return undefined;\n }\n args.push(lexed.arg);\n pos = searchFrom(NOT_SPACE_RE, raw, lexed.end);\n }\n return args;\n}\n\nfunction lexArgument(raw: string, pos: number): { arg: LexedArg; end: number } | undefined {\n const first = raw[pos];\n switch (first) {\n case '`': {\n const end = slurpQuote(raw, pos + 1, '`');\n return end === undefined ? undefined : { arg: { kind: 'expression', code: raw.slice(pos + 1, end - 1) }, end };\n }\n case '\"':\n case \"'\": {\n const end = slurpQuote(raw, pos + 1, first);\n if (end === undefined) {\n return undefined;\n }\n const value = evalStringLiteral(raw.slice(pos, end));\n return value === undefined ? undefined : { arg: { kind: 'string', value }, end };\n }\n case '[': {\n const end = lexSquareBracketed(raw, pos + 1);\n return end === undefined ? undefined : { arg: { kind: 'markup', text: raw.slice(pos, end) }, end };\n }\n default: {\n const space = searchFrom(SPACE_RE, raw, pos + 1);\n const end = space === -1 ? raw.length : space;\n return { arg: { kind: 'word', text: raw.slice(pos, end) }, end };\n }\n }\n}\n\n/**\n * Reads a quoted argument from just after its opening quote. A newline, or a backslash before a\n * newline, ends it unterminated. Returns the index after the closing quote.\n */\nfunction slurpQuote(raw: string, from: number, endQuote: string): number | undefined {\n let i = from;\n while (i < raw.length) {\n const ch = raw[i];\n if (ch === endQuote) {\n return i + 1;\n }\n if (ch === '\\n') {\n return undefined;\n }\n if (ch === '\\\\') {\n const next = raw[i + 1];\n if (next === undefined || next === '\\n') {\n return undefined;\n }\n i += 2;\n } else {\n i += 1;\n }\n }\n return undefined;\n}\n\n/**\n * Reads link or image markup from just after its first `[`, counting nested brackets.\n * Returns the index after the closing `]]`.\n */\nfunction lexSquareBracketed(raw: string, from: number): number | undefined {\n let i = from;\n while (i < raw.length && IMAGE_MARKUP_CHARS.includes(raw.charAt(i))) {\n i += 1;\n }\n if (raw[i] !== '[') {\n return undefined;\n }\n i += 1;\n let depth = 2;\n while (i < raw.length) {\n const ch = raw[i];\n i += 1;\n switch (ch) {\n case '\\\\': {\n const next = raw[i];\n if (next === undefined || next === '\\n') {\n return undefined;\n }\n i += 1;\n break;\n }\n case '\\n':\n return undefined;\n case '[':\n depth += 1;\n break;\n case ']':\n depth -= 1;\n if (depth < 0) {\n return undefined;\n }\n if (depth === 1 && raw[i] === ']') {\n return i + 1;\n }\n break;\n default:\n break;\n }\n }\n return undefined;\n}\n\n/** An argument's value, following SugarCube's conversions. */\nfunction argValue(arg: LexedArg): MacroArg {\n switch (arg.kind) {\n case 'string':\n return { type: 'string', value: arg.value };\n case 'expression':\n // Its value is known only in play.\n return { type: 'other' };\n case 'markup':\n return { type: 'markup' };\n case 'word':\n return bareWord(arg.text);\n default: {\n const _exhaustive: never = arg;\n throw new Error(`unhandled macro argument: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n\n/** A bare word's value, following SugarCube's conversions. */\nfunction bareWord(word: string): MacroArg {\n if (VARIABLE_RE.test(word) || SETTINGS_OR_SETUP_RE.test(word)) {\n return { type: 'other' };\n }\n switch (word) {\n case 'null':\n return { type: 'null' };\n case 'undefined':\n case 'true':\n case 'false':\n return { type: 'other' };\n case 'NaN':\n return { type: 'number', value: NaN };\n default: {\n const value = Number(word);\n return Number.isNaN(value) ? { type: 'string', value: word } : { type: 'number', value };\n }\n }\n}\n\n/** The passage name an argument gives, if it can be known without playing the story. */\nfunction passageName(arg: MacroArg): string | undefined {\n switch (arg.type) {\n case 'string':\n // A template literal's `${…}` makes the name known only in play.\n return arg.value.includes(SUBSTITUTION) ? undefined : arg.value;\n case 'number':\n // SugarCube looks a number up as a passage name by its string form.\n return String(arg.value);\n case 'markup':\n // Markup names its passage in `[[…]]`, which the link check reads on its own.\n case 'null':\n case 'other':\n return undefined;\n default: {\n const _exhaustive: never = arg;\n throw new Error(`unhandled macro argument: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n\n/**\n * The argument that names the passage in a `<<link>>`, `<<button>>` or `<<goto>>` call:\n * - `<<link linkText [passageName]>>` and `<<button linkText [passageName]>>`, unless the first\n * argument is link or image markup, which then names the passage itself and any further\n * argument is ignored;\n * - `<<goto passageName>>`.\n *\n * In text built from a template literal, a bare word with a `${…}` in it may become several\n * words in play, so no argument after it is known.\n */\nfunction passageArgument(macro: PassageLinkMacro, lexed: readonly LexedArg[]): MacroArg | undefined {\n const index = macro === 'goto' ? 0 : 1;\n if (lexed.slice(0, index + 1).some((arg) => arg.kind === 'word' && arg.text.includes(SUBSTITUTION))) {\n return undefined;\n }\n const args = lexed.map(argValue);\n switch (macro) {\n case 'link':\n case 'button': {\n const [label, passage] = args;\n // A `null` label makes SugarCube throw, as it reads `null` as markup.\n return label === undefined || label.type === 'markup' || label.type === 'null' ? undefined : passage;\n }\n case 'goto':\n return args[0];\n default: {\n const _exhaustive: never = macro;\n throw new Error(`unhandled macro: ${String(_exhaustive)}`);\n }\n }\n}\n\nfunction isPassageLinkMacro(name: string): name is PassageLinkMacro {\n return name === 'goto' || name === 'link' || name === 'button';\n}\n\n/** The passage a `<<link>>`, `<<button>>` or `<<goto>>` tag names itself, if it can be known before play. */\nfunction ownPassageLink(tag: MacroTag, lexed: readonly LexedArg[]): PassageLink | undefined {\n if (!isPassageLinkMacro(tag.name)) {\n return undefined;\n }\n const arg = passageArgument(tag.name, lexed);\n const passage = arg === undefined ? undefined : passageName(arg);\n return passage === undefined ? undefined : { via: tag.name, passage };\n}\n\n/**\n * The passage a link's destination names. SugarCube evaluates a destination that no passage is\n * named by, and a quoted string gives its value (`[[Go|\"Room\"]]`), unless that is blank.\n */\nfunction linkDestination(link: string): string {\n const value = evalStringLiteral(link);\n return value === undefined || value.trim() === '' ? link : value;\n}\n\n/**\n * The passage that link markup from `start` in `text` names, and where the markup ends, or\n * `undefined` where SugarCube rejects the markup. Image markup names the passage of its link\n * component (`[img[pic.png][Room]]`), which SugarCube goes to on a click, and none without one.\n * Markup with a template literal's `${…}` in it names none: its passage is known only in play.\n */\nfunction linkMarkupAt(\n text: string,\n start: number,\n budget?: { left: number },\n): { link: PassageLink | undefined; label: string | undefined; end: number } | undefined {\n const markup = readSquareBracketedMarkup(text, start, budget);\n if (markup === undefined) {\n return undefined;\n }\n const passage = text.slice(start, markup.end).includes(SUBSTITUTION) ? undefined : markup.link;\n return {\n link: passage === undefined ? undefined : { via: 'markup', passage: linkDestination(passage) },\n label: markup.label,\n end: markup.end,\n };\n}\n\n/** The passage that a link markup argument names, if SugarCube reads the whole argument as markup. */\nfunction markupArgumentLinks(raw: string): PassageLink[] {\n const markup = linkMarkupAt(raw, 0);\n return markup?.link === undefined || markup.end !== raw.length ? [] : [markup.link];\n}\n\n/**\n * The passages a tag names: its own, if it is a `<<link>>`, `<<button>>` or `<<goto>>` call, then those of its\n * link markup arguments (`<<button [[Go|Room]]>>`), and those of the links and calls inside the\n * strings of its arguments, which the macro may print or pass on\n * (`<<set _out to '<<link \"Go\" \"Room\">><</link>>'>>`). The arguments of the macros SugarCube\n * doesn't split are read as JavaScript; in others, a backquoted expression is.\n */\nfunction tagPassageLinks(tag: MacroTag, context: ReadContext): PassageLink[] {\n if (RAW_ARGUMENT_MACROS.has(tag.name)) {\n return javaScriptPassageLinks(tag.args, context, 'strict');\n }\n const lexed = lexMacroArgs(tag.args);\n if (lexed === undefined) {\n // SugarCube throws, so the call does nothing.\n return [];\n }\n const own = ownPassageLink(tag, lexed);\n const inner = lexed.flatMap((arg): PassageLink[] => {\n switch (arg.kind) {\n case 'string':\n return markupPassageLinks(arg.value, deeper(context));\n case 'expression':\n return javaScriptPassageLinks(arg.code, context, 'strict');\n case 'markup':\n return markupArgumentLinks(arg.text);\n case 'word':\n return [];\n default: {\n const _exhaustive: never = arg;\n throw new Error(`unhandled macro argument: ${JSON.stringify(_exhaustive)}`);\n }\n }\n });\n return own === undefined ? inner : [own, ...inner];\n}\n\n/**\n * The passage named by a `<<link>>`, `<<button>>` or `<<goto>>` that appears unquoted inside another tag's\n * arguments, at `start`. SugarCube never sees such an outer \"tag\" when its `<<` lies in text it\n * reads as something else, such as verbatim text (`{{{<<if}}}`); the call inside it then runs.\n * The call ends where the outer tag ends.\n */\nfunction innerPassageLink(\n matchTagAt: (start: number) => ScannedTag | undefined,\n start: number,\n): PassageLink | undefined {\n const inner = matchTagAt(start)?.tag;\n const lexed = inner === undefined ? undefined : lexMacroArgs(inner.args);\n return inner === undefined || lexed === undefined ? undefined : ownPassageLink(inner, lexed);\n}\n\n// Where link or image markup, a comment, a `<script>` element, another HTML start tag or italics can\n// start, as SugarCube's parsers match them: the markup whose text is read apart from the walk. `//`\n// is here only because it comes first, as in SugarCube: `//*` is italics.\nconst REGION_OPEN_RE = /\\[\\[[^[]|\\[[<>]?[Ii][Mm][Gg]\\[|\\/\\/|\\/\\*|\\/%|<!--|<[Ss][Cc][Rr][Ii][Pp][Tt]|<[A-Za-z]/g;\nconst HAS_TAG_OPEN_RE = /<[A-Za-z]/;\nconst HAS_IMAGE_OPEN_RE = /\\[[<>]?[Ii][Mm][Gg]\\[/;\ntype RegionKind = 'markup' | '//' | CommentKind | 'script' | 'tag';\n\nfunction regionKind(opener: string): RegionKind {\n if (opener.startsWith('[')) {\n return 'markup';\n }\n switch (opener) {\n case '//':\n case '/*':\n case '/%':\n case '<!--':\n return opener;\n default:\n // `<script`, or `<` and the first letter of another tag name.\n return opener.length === 2 ? 'tag' : 'script';\n }\n}\n\n// SugarCube's `Patterns.htmlTagName`: an element name, or a custom element name.\nconst CUSTOM_ELEMENT_NAME_CHAR = String.raw`(?:[\\-.0-9A-Z_a-z\\xB7\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u037D\\u037F-\\u1FFF\\u200C\\u200D\\u203F\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|[\\uD800-\\uDB7F][\\uDC00-\\uDFFF])`;\nconst HTML_TAG_NAME_RE = new RegExp(\n `[A-Za-z](?:${CUSTOM_ELEMENT_NAME_CHAR}*-${CUSTOM_ELEMENT_NAME_CHAR}*|[0-9A-Za-z]*)`,\n 'y',\n);\n// The end tag that SugarCube's `htmlTag` parser looks for to close an element: `<\\/name\\s*>`.\nconst HTML_END_TAG_RE = new RegExp(String.raw`<\\/(${HTML_TAG_NAME_RE.source})\\s*>`, 'y');\n\n/**\n * The end tag at `start`, if one is there: `</`, a tag name and optional white space before `>`, the terminator\n * SugarCube's `htmlTag` parser looks for after a start tag. Its name is given in lower case, as the parser matches it.\n */\nexport function htmlEndTagAt(text: string, start: number): { readonly name: string; readonly end: number } | undefined {\n HTML_END_TAG_RE.lastIndex = start;\n const name = HTML_END_TAG_RE.exec(text)?.[1];\n return name === undefined ? undefined : { name: name.toLowerCase(), end: HTML_END_TAG_RE.lastIndex };\n}\n\n// The parts of SugarCube's `htmlTag` pattern after the name: an attribute name, and an unquoted value.\nconst ATTRIBUTE_NAME_RE = /[^\\u0000-\\u001F\\u007F-\\u009F\\s\"'>/=]+/y;\nconst UNQUOTED_VALUE_RE = /[^\\s\"'=<>`]+/y;\nconst TAG_SPACES_RE = /\\s*/y;\n/**\n * The openers of the parsers SugarCube tries before `htmlTag` where a start tag can be: `<html>`\n * (`verbatimHtml`), `<nowiki>` (`verbatimText`), and `<style` and `<svg` (`styleTag` and `svgTag`,\n * which go on to the next `>`).\n */\nconst OTHER_TAG_OPENER_RE = /<(?:[Hh][Tt][Mm][Ll]>|[Nn][Oo][Ww][Ii][Kk][Ii]>|[Ss][Tt][Yy][Ll][Ee]|[Ss][Vv][Gg])/y;\n\n/**\n * Whether the start tag of an element that SugarCube reads with a parser of its own, rather than `htmlTag`, may start\n * at `start`: `<html>`, `<nowiki>`, `<style` or `<svg`.\n */\nfunction startsOwnElement(text: string, start: number): boolean {\n OTHER_TAG_OPENER_RE.lastIndex = start;\n return OTHER_TAG_OPENER_RE.test(text);\n}\n/** The `htmlTag` parser's `mediaTags`: a `data-passage` on them names a media passage, not a link. */\nconst MEDIA_TAGS: ReadonlySet<string> = new Set(['audio', 'img', 'source', 'track', 'video']);\n/** The `htmlTag` parser's `voidTags`, which need no end tag. */\nconst VOID_TAGS: ReadonlySet<string> = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'keygen',\n 'link',\n 'menuitem',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n]);\n\n/** An HTML start tag that SugarCube's `htmlTag` parser matches: its tag name as written, and where it ends. */\ninterface HtmlStartTag {\n readonly name: string;\n readonly end: number;\n}\n\n/**\n * An HTML start tag as SugarCube's `htmlTag` parser reads it: its name in lower case, where it ends, and whether it\n * opens an element that an end tag closes (one not void and not written with `/>`).\n */\ninterface HtmlStartTagRead {\n readonly name: string;\n readonly end: number;\n readonly container: boolean;\n}\n\n/**\n * The start tag that SugarCube's `htmlTag` pattern matches at `start` in `text`, if it does (see `htmlStartTagAt`).\n * `spend` is told how many characters were read.\n */\nfunction readHtmlStartTag(\n text: string,\n start: number,\n spend: (characters: number) => void,\n): HtmlStartTagRead | undefined {\n const tag = htmlStartTagAt(text, start, spend);\n if (tag === undefined) return undefined;\n const name = tag.name.toLowerCase();\n return { name, end: tag.end, container: !VOID_TAGS.has(name) && !text.startsWith('/>', tag.end - 2) };\n}\n\n/**\n * The start tag that SugarCube's `htmlTag` pattern matches at `start` in `text`, if it does:\n * `<` and a tag name, then attributes, each after white space, with an optional value (`=` and a\n * double- or single-quoted string, or an unquoted one), then optional white space, an optional\n * `/` and `>`. The pattern can only match one way, so it is read in one pass. `spend` is told how\n * many characters were read.\n */\nfunction htmlStartTagAt(text: string, start: number, spend: (characters: number) => void): HtmlStartTag | undefined {\n HTML_TAG_NAME_RE.lastIndex = start + 1;\n const name = HTML_TAG_NAME_RE.exec(text)?.[0];\n if (name === undefined) return undefined;\n // How far the reading has looked.\n let reach = start + 1 + name.length;\n const sticky = (re: RegExp, at: number): number => {\n re.lastIndex = at;\n const end = re.exec(text) === null ? at : re.lastIndex;\n reach = Math.max(reach, end);\n return end;\n };\n const scanned = (end: number | undefined): HtmlStartTag | undefined => {\n spend(Math.max(reach, end ?? 0) - start);\n return end === undefined ? undefined : { name, end };\n };\n for (let pos = reach; ;) {\n const spaced = sticky(TAG_SPACES_RE, pos);\n if (text[spaced] === '>') return scanned(spaced + 1);\n if (text.startsWith('/>', spaced)) return scanned(spaced + 2);\n const nameEnd = sticky(ATTRIBUTE_NAME_RE, spaced);\n if (spaced === pos || nameEnd === spaced) return scanned(undefined);\n pos = nameEnd;\n const equals = sticky(TAG_SPACES_RE, pos);\n if (text[equals] !== '=') continue;\n const valueStart = sticky(TAG_SPACES_RE, equals + 1);\n const quote = text[valueStart];\n const quoted = quote === '\"' || quote === \"'\";\n const valueEnd = quoted ? text.indexOf(quote, valueStart + 1) + 1 : sticky(UNQUOTED_VALUE_RE, valueStart);\n if (valueEnd <= valueStart) {\n // No closing quote, or no value: the `=` can start nothing the pattern allows.\n reach = quoted ? text.length : reach;\n return scanned(undefined);\n }\n pos = valueEnd;\n }\n}\n\n/**\n * Returns a function that reads the HTML start tag at a position the walk reaches, as SugarCube's\n * `htmlTag` parser reads it, giving where the walk goes on and the passage that the element's\n * `data-passage` attribute names, if it names one. Positions must come in increasing order. All\n * start tags read, and all end tag searches, in one reading of a passage stop once they have read\n * four times as many characters as the passage has, plus an allowance (`budget`, see\n * `readContext`); on input built to make them read more, the start tags after that are read as\n * markup. That keeps the time linear.\n */\nfunction htmlTagReader(\n text: string,\n budget: { left: number },\n): (start: number) => {\n readonly link: PassageLink | undefined;\n readonly end: number;\n readonly tag: HtmlStartTagRead | undefined;\n} {\n const spend = (characters: number): void => {\n budget.left -= characters;\n };\n // For each tag name, where the last search for its end tag found it (-1: none).\n const endTags = new Map<string, number>();\n const hasEndTag = (name: string, from: number): boolean => {\n const known = endTags.get(name);\n if (known === -1 || (known !== undefined && known >= from)) return known !== -1;\n // SugarCube builds the end tag pattern from the name as it is, ignoring case.\n const re = new RegExp(`<\\\\/${name}\\\\s*>`, 'gi');\n re.lastIndex = from;\n const found = re.exec(text)?.index ?? -1;\n spend((found === -1 ? text.length : found) - from);\n endTags.set(name, found);\n return found !== -1;\n };\n return (start) => {\n const tag = budget.left < 0 || startsOwnElement(text, start) ? undefined : readHtmlStartTag(text, start, spend);\n if (tag === undefined) {\n // Not a start tag `htmlTag` reads: read on as markup.\n return { link: undefined, end: start + 1, tag: undefined };\n }\n const { name } = tag;\n const markup = text.slice(start, tag.end);\n const passage =\n MEDIA_TAGS.has(name) || (tag.container && !hasEndTag(name, start)) ? undefined : dataPassage(markup);\n return { link: passage === undefined ? undefined : { via: 'data-passage', passage }, end: tag.end, tag };\n };\n}\n\n/**\n * The passage that the `data-passage` attribute of the element a start tag (`markup`) makes\n * names, as SugarCube's `htmlTag` parser follows it: none when the element has no such attribute,\n * also has an `href` (an error), or its value is empty, and none known before play when an\n * attribute directive (`@name` or `sc-eval:name`) sets `data-passage` from an expression. A\n * directive that sets `href` or `data-setter` is an error, so it names none either.\n */\nfunction dataPassage(markup: string): string | undefined {\n // An attribute name is never written with character references, so one without this text has none.\n if (!/data-passage/i.test(markup)) return undefined;\n const attributes = wikifiedElementAttributes(markup);\n const value = attributes?.get('data-passage');\n if (attributes === undefined || value === undefined || attributes.has('href')) return undefined;\n const directed = [...attributes.keys()].map((name) =>\n name.startsWith('@') ? name.slice(1) : name.startsWith('sc-eval:') ? name.slice(8) : undefined,\n );\n if (directed.some((name) => name === 'data-passage' || name === 'href' || name === 'data-setter')) return undefined;\n const passage = linkDestination(value);\n return passage === '' ? undefined : passage;\n}\n\n// SugarCube's `(?:.|\\n)*?` doesn't cross the other line terminators.\nconst SCRIPT_CLOSE_RE = /<\\/[Ss][Cc][Rr][Ii][Pp][Tt]>|[\\r\\u2028\\u2029]/g;\nconst COMMENT_CLOSE_RES: Readonly<Record<CommentKind, RegExp>> = {\n '/*': /\\*\\/|[\\r\\u2028\\u2029]/g,\n '/%': /%\\/|[\\r\\u2028\\u2029]/g,\n '<!--': /-->|[\\r\\u2028\\u2029]/g,\n};\ntype CommentKind = '/*' | '/%' | '<!--';\n\n/**\n * Returns a function that finds where a comment that opens at `start` ends, as SugarCube's\n * `commentByBlock` parser reads it, or `undefined` if it isn't closed. Calls of one kind must come\n * in increasing order: a search that fails stops at a line terminator or the end, and a later one\n * of the same kind that starts before that stop fails too, so it isn't made.\n */\nfunction commentReader(text: string): (kind: CommentKind, start: number) => number | undefined {\n const findCloser = closerReader(text, COMMENT_CLOSE_RES);\n return (kind, start) => findCloser(kind, start + kind.length)?.end;\n}\n\n/**\n * Returns a function that finds the closer of a kind from a position, with that kind's pattern in `res`: the closer\n * or a line terminator it may not cross (a match of one character), as SugarCube's `(?:.|\\n)*?` stops. Calls of one\n * kind must come in increasing order: a search that fails stops at a line terminator or the end, and a later one of\n * the same kind that starts before that stop fails too, so it isn't made. So all searches take linear time.\n */\nfunction closerReader<K extends string>(\n text: string,\n res: Readonly<Record<K, RegExp>>,\n): (kind: K, from: number) => { readonly start: number; readonly end: number } | undefined {\n const failedUntil = new Map<K, number>();\n return (kind, from) => {\n if (from < (failedUntil.get(kind) ?? -1)) {\n return undefined;\n }\n const re = res[kind];\n re.lastIndex = from;\n const m = re.exec(text);\n if (m !== null && m[0].length > 1) {\n return { start: m.index, end: m.index + m[0].length };\n }\n failedUntil.set(kind, m === null ? text.length : m.index);\n return undefined;\n };\n}\n\n/** The elements SugarCube reads with parsers of their own: `styleTag`, `svgTag`, `verbatimHtml`, `verbatimText`. */\ntype OwnElementKind = 'style' | 'svg' | 'html' | 'nowiki';\n\n/**\n * An element SugarCube reads with a parser of its own, at a `<` where `startsOwnElement` holds: where its opener ends,\n * and, when the parser finds its end, where its content lies and where it ends. Without an end, SugarCube drops the\n * opener and reads on after it.\n */\nexport interface OwnElement {\n readonly kind: OwnElementKind;\n readonly openerEnd: number;\n readonly closed: { readonly contentEnd: number; readonly end: number } | undefined;\n}\n\n// What SugarCube's `(?:.|\\n)` doesn't match: the line terminators other than a line feed.\nconst BODY_STOPS = `[\\\\r${String.fromCharCode(0x2028, 0x2029)}]`;\nconst OWN_CLOSE_RES: Readonly<Record<'style' | 'html' | 'nowiki', RegExp>> = {\n style: new RegExp(`<\\\\/[Ss][Tt][Yy][Ll][Ee]>|${BODY_STOPS}`, 'g'),\n html: new RegExp(`<\\\\/[Hh][Tt][Mm][Ll]>|${BODY_STOPS}`, 'g'),\n nowiki: new RegExp(`<\\\\/[Nn][Oo][Ww][Ii][Kk][Ii]>|${BODY_STOPS}`, 'g'),\n};\n// The tags `svgTag` counts to find the end of an `<svg>` element, without their `[^>]*>`, which is found apart.\nconst SVG_TAG_START_RE = /<\\/?[Ss][Vv][Gg]/g;\n\n/**\n * Returns a function that reads the element SugarCube reads with a parser of its own at `start`, as that parser reads\n * it, or gives `undefined` where its pattern doesn't match (an `<svg` or `<style` with no `>` after it). Positions\n * must come in increasing order. All readings take linear time: openers' `>` and closers are searched forward, and\n * the ends of `<svg>` elements are worked out once, from the depth after each `<svg` or `</svg` tag.\n */\nfunction ownElementReader(text: string): (start: number) => OwnElement | undefined {\n const findCloser = closerReader(text, OWN_CLOSE_RES);\n // The first `>` at or after the last `<style` read.\n let angle = text.indexOf('>');\n let svgElements: ReadonlyMap<number, OwnElement> | undefined;\n return (start) => {\n // As SugarCube's patterns, with no end to the tag name: `<svg-icon>` and `<styles>` are read by these parsers too.\n if (startsWithFolded(text, start, '<svg')) {\n svgElements ??= svgElementsOf(text);\n return svgElements.get(start);\n }\n const kind = startsWithFolded(text, start, '<style')\n ? 'style'\n : startsWithFolded(text, start, '<html>')\n ? 'html'\n : 'nowiki';\n if (kind === 'style' && angle !== -1 && angle < start) angle = text.indexOf('>', start);\n // `<html>` and `<nowiki>` end at their fixed `>`; `<style` runs to the next.\n const gt = kind === 'style' ? angle : start + (kind === 'html' ? 5 : 7);\n if (gt === -1) return undefined;\n const closer = findCloser(kind, gt + 1);\n return {\n kind,\n openerEnd: gt + 1,\n closed: closer === undefined ? undefined : { contentEnd: closer.start, end: closer.end },\n };\n };\n}\n\n/** Whether `text` has `prefix` at `start`, ignoring the case of ASCII letters. */\nfunction startsWithFolded(text: string, start: number, prefix: string): boolean {\n return text.slice(start, start + prefix.length).toLowerCase() === prefix;\n}\n\n/**\n * The `<svg>` elements SugarCube's `svgTag` parser could read, by where their opener starts. For an opener the\n * wikifier matched (`<svg[^>]*>`), the parser searches the tags `<(\\/?)svg[^>]*>` from the opener on, each after the\n * end of the one before, and the element ends just past the first `</svg…>` tag after which as many `</svg` tags as\n * `<svg` tags have been found, counting the opener; it is not closed when there is none. The tags found from an\n * opener are those found from any other tag of that search, but not those found from the start of the text: a\n * `<svg` in a comment the wikifier skips has a `>` of its own only far on, and the search from the start of the text\n * runs over the opener after it.\n *\n * So the element of each `<svg` tag is worked out as if the search started there. Every tag points to the tag a search\n * goes on with after its end, which makes a forest, and the element of a tag ends at the nearest tag on the way to a\n * root after which the tags closed equal the tags opened. One walk of the forest finds all of them: linear time.\n */\nfunction svgElementsOf(text: string): ReadonlyMap<number, OwnElement> {\n // Every `<svg` and `</svg` in the text with a `>` after it: where it starts, where its `[^>]*>` ends, and +1 or -1.\n const starts: number[] = [];\n const ends: number[] = [];\n const steps: number[] = [];\n let angle = -1;\n SVG_TAG_START_RE.lastIndex = 0;\n for (let m = SVG_TAG_START_RE.exec(text); m !== null; m = SVG_TAG_START_RE.exec(text)) {\n if (angle < m.index) angle = text.indexOf('>', m.index);\n // No `>` after this one: no tag from here on matches.\n if (angle === -1) break;\n starts.push(m.index);\n ends.push(angle + 1);\n steps.push(m[0].length === 4 ? 1 : -1);\n }\n const count = starts.length;\n // follower[k]: the tag a search goes on with after tag k (-1: none). Tags end in order, so one pass finds them all.\n const follower = new Int32Array(count).fill(-1);\n for (let k = 0, j = 0; k < count; k++) {\n j = Math.max(j, k + 1);\n while (j < count && (starts[j] ?? 0) < (ends[k] ?? 0)) j++;\n if (j < count) follower[k] = j;\n }\n // balance[k]: opening minus closing tags from tag k on its way to a root, tag k included.\n const balance = new Int32Array(count);\n for (let k = count - 1; k >= 0; k--) {\n const next = follower[k] ?? -1;\n balance[k] = (steps[k] ?? 0) + (next === -1 ? 0 : (balance[next] ?? 0));\n }\n // The tags that go on with a tag, as a linked list.\n const firstChild = new Int32Array(count).fill(-1);\n const nextSibling = new Int32Array(count).fill(-1);\n for (let k = count - 1; k >= 0; k--) {\n const parent = follower[k] ?? -1;\n if (parent !== -1) {\n nextSibling[k] = firstChild[parent] ?? -1;\n firstChild[parent] = k;\n }\n }\n const elements = new Map<number, OwnElement>();\n // The way from a root to the tag being visited; for each balance, the place on it of the nearest tag with that balance\n // (-1: before the root, where the balance is 0); and what a tag's balance pointed to before it.\n const path: number[] = [];\n const placeOf = new Map<number, number>([[0, -1]]);\n const hidden = new Int32Array(count);\n const ABSENT = -2;\n const enter = (k: number): void => {\n path.push(k);\n const balanced = balance[k] ?? 0;\n const above = placeOf.get(balanced);\n if ((steps[k] ?? 0) > 0) {\n // The balance changes by one at each tag, so the first tag on the way where it is the same again closes the\n // element: the tag on the way before it is the closer.\n const closer = above === undefined ? undefined : path[above + 1];\n const closed = closer === undefined ? undefined : { contentEnd: starts[closer] ?? 0, end: ends[closer] ?? 0 };\n elements.set(starts[k] ?? 0, { kind: 'svg', openerEnd: ends[k] ?? 0, closed });\n }\n hidden[k] = above ?? ABSENT;\n placeOf.set(balanced, path.length - 1);\n };\n const leave = (k: number): void => {\n const balanced = balance[k] ?? 0;\n const before = hidden[k] ?? ABSENT;\n if (before === ABSENT) placeOf.delete(balanced);\n else placeOf.set(balanced, before);\n path.pop();\n };\n const cursor = Int32Array.from(firstChild);\n for (let root = 0; root < count; root++) {\n if (follower[root] !== -1) continue;\n enter(root);\n while (path.length > 0) {\n const k = path[path.length - 1] ?? 0;\n const child = cursor[k] ?? -1;\n if (child === -1) {\n leave(k);\n } else {\n cursor[k] = nextSibling[child] ?? -1;\n enter(child);\n }\n }\n }\n return elements;\n}\n\n/** Where a `<script>` element's opener ends and its content ends, if it is complete. */\ninterface ScriptElementScan {\n /** Index just past the opener's `>`, or `undefined` if no `>` follows. */\n readonly openerEnd: number | undefined;\n /** Index of the closing `</script>`, or `undefined` if the element isn't closed. */\n readonly close: number | undefined;\n}\n\n/**\n * Returns a function that reads a `<script>` element whose opener starts at a position, as\n * SugarCube's `verbatimScriptTag` parser reads it: the opener up to its `>`, then the content\n * up to the first `</script>`. Calls must come in increasing order; each part of the text is\n * searched once.\n */\nfunction scriptElementReader(text: string): (start: number) => ScriptElementScan {\n let angle = -1;\n let noAngleAfter = Infinity;\n let failedBefore = -1;\n let noCloseAfter = Infinity;\n return (start) => {\n if (start + 7 >= noAngleAfter) {\n return { openerEnd: undefined, close: undefined };\n }\n if (angle < start + 7) {\n angle = text.indexOf('>', start + 7);\n if (angle === -1) {\n noAngleAfter = start + 7;\n return { openerEnd: undefined, close: undefined };\n }\n }\n const openerEnd = angle + 1;\n if (openerEnd < failedBefore || openerEnd >= noCloseAfter) {\n // The content would run into the line terminator where an earlier element failed.\n return { openerEnd, close: undefined };\n }\n SCRIPT_CLOSE_RE.lastIndex = openerEnd;\n const m = SCRIPT_CLOSE_RE.exec(text);\n if (m === null) {\n noCloseAfter = openerEnd;\n return { openerEnd, close: undefined };\n }\n if (m[0].length === 1) {\n failedBefore = m.index;\n return { openerEnd, close: undefined };\n }\n return { openerEnd, close: m.index };\n };\n}\n\n/**\n * Returns a function that finds the tag closing the `<<script>>` body that `opener` opens, as\n * SugarCube's `parseBody` finds it: scanning tags from every `<<` after the opener, without\n * skipping anything, for the first `<</script>>` or `<<endscript>>` that isn't matched by a\n * later `<<script>>`. (It doesn't reproduce parseBody's rejection of a closing tag with\n * arguments, nor its resuming inside the arguments of a tag whose name starts with `/` or\n * `end`.)\n *\n * The tags found from the start of the text are those parseBody finds from any opener among\n * them, so for such an opener the answer takes constant time. An opener the walk reached after\n * a comment may not be among them, when a tag that starts in the comment runs over it; then the\n * scan starts at the body and goes on until it finds the closer or reaches a tag of that list,\n * whose answers it then uses. All such scans in one reading of a passage, strings included, stop\n * once they have read four times as many characters as the passage has, plus a fixed allowance\n * (`budget`, see `readContext`); on input built to make them read more, the openers after that\n * are taken as unclosed. That keeps the time linear. (Exported for tests; the module is not part\n * of the package's API.)\n */\nexport function scriptBodyCloser(text: string, budget: { left: number }): (opener: MacroTag) => MacroTag | undefined {\n const tags = findMacroTags(text);\n const indexByStart = new Map(tags.map((tag, index) => [tag.start, index]));\n const lastClose = text.lastIndexOf('>>');\n const spend = (characters: number): void => {\n budget.left -= characters;\n };\n const step = (tag: MacroTag): number =>\n tag.name === 'script' ? 1 : tag.name === '/script' || tag.name === 'endscript' ? -1 : 0;\n // balance[k]: openers minus closers among the first k tags.\n const balance: number[] = [0];\n tags.forEach((tag, k) => balance.push((balance[k] ?? 0) + step(tag)));\n // firstBelow[k]: the first j > k with balance[j] < balance[k], if any.\n const firstBelow: (number | undefined)[] = [];\n const candidates: number[] = [];\n for (let k = balance.length - 1; k >= 0; k--) {\n const here = balance[k] ?? 0;\n let top = candidates[candidates.length - 1];\n while (top !== undefined && (balance[top] ?? 0) >= here) {\n candidates.pop();\n top = candidates[candidates.length - 1];\n }\n firstBelow[k] = top;\n candidates.push(k);\n }\n /**\n * The closer when `open` bodies are open just before `tags[index]`: each hop to\n * `firstBelow` closes one. `open` is at most one more than the openers scanned to get here.\n */\n const closeFrom = (index: number, open: number): MacroTag | undefined => {\n let k: number | undefined = index;\n for (let left = open; left > 0 && k !== undefined; left--) {\n k = firstBelow[k];\n }\n return k === undefined ? undefined : tags[k - 1];\n };\n return (opener) => {\n const index = indexByStart.get(opener.start);\n if (index !== undefined) {\n return closeFrom(index + 1, 1);\n }\n const matchTagAt = tagMatcher(text, lastClose, spend);\n let open = 1;\n let from = opener.end;\n while (budget.left >= 0) {\n const start = text.indexOf('<<', from);\n spend((start === -1 ? text.length : start) - from);\n if (start === -1) {\n return undefined;\n }\n const known = indexByStart.get(start);\n if (known !== undefined) {\n return closeFrom(known, open);\n }\n const tag = matchTagAt(start)?.tag;\n if (tag === undefined) {\n from = start + 2;\n continue;\n }\n open += step(tag);\n if (open === 0) {\n return tag;\n }\n from = tag.end;\n }\n return undefined;\n };\n}\n\n/** Adds `more` to the end of `links`, without spreading, which fails for very long lists. */\nfunction append(links: PassageLink[], more: readonly PassageLink[]): void {\n for (const link of more) {\n links.push(link);\n }\n}\n\n/**\n * The passages that link markup (`[[…]]`), `<<link>>`, `<<button>>` and `<<goto>>` calls, and\n * elements with a `data-passage` attribute in passage markup name, in the order they come. Calls\n * whose passage is known only in play (a variable or an expression) are left out. A tag's own\n * passage comes before those that its arguments name, as link markup or inside strings.\n *\n * The markup is walked in order, as SugarCube's wikifier walks it, with a tag tried at each\n * `<<` the walk reaches, and link or image markup read at each `[[` or `[img[`; markup SugarCube\n * rejects is read on from just after its opener, and so is markup after a limit on how much\n * markup a reading may scan, which only input built to take quadratic time reaches (see\n * `readSquareBracketedMarkup`). Image markup names the passage of its link component. Of the wikifier's other\n * parsers, only those whose text holds no link or call are told apart: comments (`/* … *` + `/`,\n * `/% … %/`, `<!-- … -->`), whose links and calls never run, and `<script>` elements and\n * `<<script>>` bodies, which are JavaScript: only the links and calls in their strings are read\n * (see `findJavaScriptPassageLinks`). A `<script>` element is read as jQuery and the browser run\n * it when SugarCube inserts it (see `scriptsJQueryRuns`): a classic script as sloppy-mode code, a\n * `type=\"module\"` script as module code, and one that does not run (a template or JSON `type`, a\n * `src`, a classic script marked `nomodule`) not at all. Any other HTML start tag that SugarCube's\n * `htmlTag` parser matches is read as that parser reads it (see `htmlTagReader`): its text is\n * not markup, and the element the browser makes of it is a link when it has a `data-passage`\n * attribute, no `href`, a non-empty passage known before play, is no media element (`img`,\n * `audio`, `video`, `source`, `track`), and is void or has an end tag later in the text. Its\n * content is read on as markup. Everything else, verbatim text included, is read as markup.\n *\n * Where this differs from SugarCube:\n * - a link whose passage SugarCube evaluates, because no passage has its name, is taken by its\n * name, `[[Go|$next]]` naming the passage `$next`, unless it is a quoted string, which is taken\n * by its value even when a passage has the name with the quotes;\n * - a link SugarCube takes for a URL, because no passage has its name and it looks like one or\n * holds a `/`, `.`, `?` or `#`, is still read as naming a passage;\n * - a comment or a `<<script>>` body is skipped whole, even where `parseBody` ends a container\n * such as `<<if>>` at a closing tag inside it and the rest then runs;\n * - a `[[`, `/*`, `<!--`, `<script` or other start tag inside other markup that holds no call,\n * such as verbatim text or a `<style>` element, still starts link markup, a comment or an\n * element, and a start tag of `<html>`, `<nowiki>`, `<style>` or `<svg>` is read as markup, so\n * an element with a `data-passage` inside an `<svg>` is read as one outside it (SugarCube\n * follows only an `<a>` there, also one with an `href`);\n * - an element is read as the content of a `div`, wherever it is (SugarCube reads it as the\n * content of the element the markup is put in), and a `data-passage` whose value is an\n * expression is taken by its text, as a link's passage is;\n * - a `<<` in such other markup still starts a tag. When that tag runs over a `<<link` or\n * `<<goto` outside the parts of its arguments that the tag pattern reads as units, that call\n * is still read (see `innerPassageLink`), even where the tag's arguments would be JavaScript,\n * as the check always read it. One that such a part covers is lost: a quoted string, or a `//`\n * part up to a line feed (italics, a URL) when a `>>` follows later; and a `<<script>>` body\n * the tag runs over is read as markup. The same recovery also reads a call inside a stray tag\n * that SugarCube does see, and rejects as an unknown macro (`<<Back <<goto R>>`);\n * - a `<<script>>` body's end is found as `parseBody` finds it, except that parseBody rejects a\n * closing tag with arguments, and resumes inside the arguments of a tag whose name starts with\n * `/` or `end`;\n * - a `<script>` element is taken to run when the passage is shown, as a classic script in a\n * browser that supports modules;\n * - the lines of a `<<nobr>>` body, and of every passage when a story sets\n * `Config.passages.nobr`, are not joined before they are read (see `storyInspect` for passages\n * tagged `nobr`).\n */\nexport function findPassageLinks(text: string): PassageLink[] {\n return markupPassageLinks(text, readContext(text));\n}\n\n/**\n * A part of passage markup that `walkPassageMarkup` reads apart from text. The text between parts is what the\n * wikifier prints, apart from markup this module doesn't tell apart (see `findPassageLinks`).\n */\nexport type MarkupRegion =\n /** A macro tag, and where a `<<link`, `<<button` or `<<goto` first appears unquoted in its arguments. */\n | { readonly kind: 'macro'; readonly start: number; readonly end: number; readonly scanned: ScannedTag }\n /** The body of a `<<script>>` tag, JavaScript up to `codeEnd`, and its closing tag up to `end`. */\n | { readonly kind: 'script-body'; readonly start: number; readonly codeEnd: number; readonly end: number }\n /** Link or image markup, the passage it names, if known, and the text a link shows. */\n | {\n readonly kind: 'link';\n readonly start: number;\n readonly end: number;\n readonly link: PassageLink | undefined;\n readonly label: string | undefined;\n }\n /**\n * A comment, or the opener of one that isn't closed, which SugarCube drops; or italics markup (`//`), which shows\n * no text of its own.\n */\n | { readonly kind: 'comment'; readonly start: number; readonly end: number }\n /**\n * A `<script>` element up to its `</script>`, whose content starts at `contentStart`; or, when it isn't closed\n * (`complete` false), only its opener, after which the content is read as markup.\n */\n | {\n readonly kind: 'script-element';\n readonly start: number;\n readonly contentStart: number;\n readonly end: number;\n readonly complete: boolean;\n }\n /** An HTML start tag that SugarCube's `htmlTag` parser matches, and the passage its `data-passage` names. */\n | {\n readonly kind: 'html-tag';\n readonly start: number;\n readonly end: number;\n readonly link: PassageLink | undefined;\n readonly tag: HtmlStartTagRead;\n }\n /**\n * An element SugarCube reads with a parser of its own (`<style>`, `<svg>`, `<html>`, `<nowiki>`), up to its end, or\n * only its opener when the parser finds no end; told apart only when the walk is asked to (see `walkPassageMarkup`).\n */\n | { readonly kind: 'own-element'; readonly start: number; readonly end: number; readonly element: OwnElement };\n\n/**\n * Walks passage markup in order, as SugarCube's wikifier walks it (see `findPassageLinks`), telling `visit` about\n * each part it reads apart from text, in order and without overlaps. With `ownElements`, the elements SugarCube reads\n * with parsers of their own are read as those parsers read them (see `ownElementReader`), and the walk goes on after\n * them; without, as the link check reads them, their tags are markup and what they hold is walked.\n */\nexport function walkPassageMarkup(\n text: string,\n visit: (region: MarkupRegion) => void,\n options: { readonly ownElements?: boolean } = {},\n): void {\n walkMarkup(text, readContext(text), visit, options.ownElements ?? false);\n}\n\nfunction walkMarkup(\n text: string,\n context: ReadContext,\n visit: (region: MarkupRegion) => void,\n ownElements = false,\n): void {\n const readOwnElement = ownElements ? ownElementReader(text) : undefined;\n const matchTagAt = tagMatcher(text);\n const readComment = commentReader(text);\n const readScriptElement = scriptElementReader(text);\n const readHtmlTag = htmlTagReader(text, context.tagBudget);\n let findScriptCloser: ((opener: MacroTag) => MacroTag | undefined) | undefined;\n\n /** Reads the region `opener` opens, telling `visit` about it; returns where the walk goes on. */\n const regionEnd = (opener: RegExpExecArray): number => {\n const start = opener.index;\n const kind = regionKind(opener[0]);\n switch (kind) {\n case 'markup': {\n const markup = linkMarkupAt(text, start, context.markupBudget);\n if (markup === undefined) {\n // SugarCube prints the opener it matched and reads on after it.\n return start + opener[0].length;\n }\n visit({ kind: 'link', start, end: markup.end, link: markup.link, label: markup.label });\n return markup.end;\n }\n case '//':\n // Italics, whose text is read on; `//*` is not a comment.\n visit({ kind: 'comment', start, end: start + 2 });\n return start + 2;\n case '/*':\n case '/%':\n case '<!--': {\n // A comment that isn't closed: SugarCube drops its opener and reads on.\n const end = readComment(kind, start) ?? start + kind.length;\n visit({ kind: 'comment', start, end });\n return end;\n }\n case 'script': {\n const element = readScriptElement(start);\n if (element.openerEnd === undefined) {\n // Not an opener SugarCube reads.\n return start + 1;\n }\n const complete = element.close !== undefined;\n // Unclosed, SugarCube reads the opener and nothing more; the content is markup.\n const end = element.close === undefined ? element.openerEnd : element.close + 9;\n visit({ kind: 'script-element', start, contentStart: element.openerEnd, end, complete });\n return end;\n }\n case 'tag': {\n const own = readOwnElement !== undefined && startsOwnElement(text, start) ? readOwnElement(start) : undefined;\n if (own !== undefined) {\n const end = own.closed?.end ?? own.openerEnd;\n visit({ kind: 'own-element', start, end, element: own });\n return end;\n }\n const read = readHtmlTag(start);\n if (read.tag !== undefined) {\n visit({ kind: 'html-tag', start, end: read.end, link: read.link, tag: read.tag });\n }\n return read.end;\n }\n default: {\n const _exhaustive: never = kind;\n throw new Error(`unhandled region: ${String(_exhaustive)}`);\n }\n }\n };\n\n // The next `<<` and region opener at or after `pos`, searched again only once `pos` passes them.\n let macro = -2;\n let region: RegExpExecArray | null | undefined;\n let pos = 0;\n for (;;) {\n if (macro !== -1 && macro < pos) {\n macro = text.indexOf('<<', pos);\n }\n if (region !== null && (region === undefined || region.index < pos)) {\n REGION_OPEN_RE.lastIndex = pos;\n region = REGION_OPEN_RE.exec(text);\n }\n if (region !== null && (macro === -1 || region.index < macro)) {\n pos = regionEnd(region);\n continue;\n }\n if (macro === -1) {\n return;\n }\n const scanned = matchTagAt(macro);\n if (scanned === undefined) {\n pos = macro + 2;\n continue;\n }\n const { tag } = scanned;\n visit({ kind: 'macro', start: tag.start, end: tag.end, scanned });\n pos = tag.end;\n if (tag.name === 'script') {\n findScriptCloser ??= scriptBodyCloser(text, context.budget);\n const closer = findScriptCloser(tag);\n if (closer !== undefined) {\n visit({ kind: 'script-body', start: tag.end, codeEnd: closer.start, end: closer.end });\n pos = closer.end;\n }\n }\n }\n}\n\nfunction markupPassageLinks(text: string, context: ReadContext): PassageLink[] {\n if (\n context.depth > MAX_STRING_DEPTH ||\n (!text.includes('<<') && !text.includes('[[') && !HAS_TAG_OPEN_RE.test(text) && !HAS_IMAGE_OPEN_RE.test(text))\n ) {\n return [];\n }\n // For the calls inside tags' arguments, which also come in increasing order.\n const matchInnerTagAt = tagMatcher(text);\n const links: PassageLink[] = [];\n walkMarkup(text, context, (region) => {\n switch (region.kind) {\n case 'link':\n case 'html-tag':\n if (region.link !== undefined) {\n links.push(region.link);\n }\n return;\n case 'macro': {\n const { tag, innerCall } = region.scanned;\n append(links, tagPassageLinks(tag, context));\n const inner = innerCall === undefined ? undefined : innerPassageLink(matchInnerTagAt, innerCall);\n if (inner !== undefined) {\n links.push(inner);\n }\n return;\n }\n case 'script-body':\n append(links, javaScriptPassageLinks(text.slice(region.start, region.codeEnd), context, 'strict'));\n return;\n case 'script-element':\n if (region.complete) {\n append(\n links,\n scriptElementPassageLinks(\n text.slice(region.start, region.end),\n region.contentStart - region.start,\n context,\n ),\n );\n }\n return;\n case 'comment':\n case 'own-element':\n return;\n default: {\n const _exhaustive: never = region;\n throw new Error(`unhandled region: ${JSON.stringify(_exhaustive)}`);\n }\n }\n });\n return links;\n}\n\n/**\n * The passages that link markup and `<<link>>` and `<<goto>>` calls in the strings of JavaScript\n * source name, such as a script passage or a `<<script>>` body: `$.wiki('<<goto \"Room\">>')`.\n * Code outside the strings isn't markup, so a call put together while the story plays, such as\n * `'<<goto \"' + target + '\">>'`, names no passage here, nor does an array of arrays (`[[0, 1]]`).\n */\nexport function findJavaScriptPassageLinks(source: string): PassageLink[] {\n return javaScriptPassageLinks(source, readContext(source), 'strict');\n}\n\n/**\n * What JavaScript source must contain for one of its string or template literals to hold a call\n * or link markup that is read. A value holding `<<`: each `<` in it is written as `<`, `\\<`,\n * `\\x3c`, `\\u003c`, `\\u{…}` or, in sloppy mode, the octal `\\74` or `\\074`; two can be next to\n * each other with only line continuations between, and the first is `<` or `\\<` (then the source\n * holds `<<` or `<\\`) or one of the others. A value holding `[[`, likewise: the source holds `[[`,\n * a `[` before `\\[` or a line continuation, `\\x5b`, `\\u005b`, `\\u{` or the octal `\\133`. A value\n * holding image markup (`[img[`, `[<img[`, `[>img[`): the source holds a `[` (or one of its\n * escapes, above) followed by an `i`, by `<` or `>` and an `i`, or by an escape. Or a value\n * holding an HTML start tag, such as an element with a `data-passage` attribute or a `<script>`\n * element, whose own strings can make `<<` or `[[` from escapes the outer string encodes: the `<`\n * is written as above, and the source holds `<` followed by a letter or a `\\`, or one of its escapes.\n */\nconst MAY_HOLD_LINK_RE = new RegExp(\n String.raw`<<|<\\\\|\\\\x3c|\\\\u003c|\\\\u\\{|\\\\0?74|<[a-z]|\\[\\[|\\[\\\\[[${LINE_TERMINATORS}]|\\\\x5b|\\\\u005b|\\\\133|\\[[<>]?[i\\\\]`,\n 'i',\n);\n\n/**\n * The passages named in the strings of the scripts that run when SugarCube inserts `markup`, the\n * `<script>` markup its `verbatimScriptTag` parser matched, whose opener ends at `contentStart`\n * (see `scriptsJQueryRuns`): a classic\n * script is sloppy-mode code, a module script module code. A script that does not run, such as a\n * template (`type=\"text/template\"`), JSON or one with a `src`, names no passage.\n */\nfunction scriptElementPassageLinks(markup: string, contentStart: number, context: ReadContext): PassageLink[] {\n // The code of every script in it lies after the opener.\n if (context.depth >= MAX_STRING_DEPTH || !MAY_HOLD_LINK_RE.test(markup.slice(contentStart))) return [];\n return scriptsJQueryRuns(markup).flatMap((script) =>\n javaScriptPassageLinks(script.code, context, script.kind === 'module' ? 'module' : 'sloppy'),\n );\n}\n\n/** The passages named in the strings of JavaScript `source`, evaluated in the given mode. */\nfunction javaScriptPassageLinks(source: string, context: ReadContext, mode: ScriptMode): PassageLink[] {\n if (context.depth >= MAX_STRING_DEPTH || !MAY_HOLD_LINK_RE.test(source)) {\n // No string in it can hold a link or a macro call.\n return [];\n }\n const inner = deeper(context);\n const links: PassageLink[] = [];\n for (const value of javaScriptStrings(source, mode)) {\n append(links, markupPassageLinks(value, inner));\n }\n return links;\n}\n","/**\n * Passage word counts. Every scan here is linear in the text: passage text is untrusted and may be large, so no\n * pattern here may backtrack over it.\n */\nimport type { WordCountMethod } from './types.js';\nimport { splitTweeFields } from './twee-syntax.js';\nimport { htmlEndTagAt, walkPassageMarkup } from './sugarcube-macros.js';\nimport type { OwnElement } from './sugarcube-macros.js';\nimport { HtmlNestingError, parseAppended, wikifiedText } from './html-structure.js';\nimport type { WikifiedPiece } from './html-structure.js';\n\n/** The comment forms Tweego strips before counting: `/% %/`, `/* *\\/` and `<!-- -->`. */\nconst COMMENTS: readonly (readonly [open: string, close: string])[] = [\n ['/%', '%/'],\n ['/*', '*/'],\n ['<!--', '-->'],\n];\n\n/**\n * `text` without comments, as Tweego's `(?s:/%.*?%/|/\\*.*?\\*\\/|<!--.*?-->)` removes them: from the leftmost\n * opening delimiter to the first closing one after it. An opening delimiter with no closing one after it is\n * kept, and so is everything after it.\n */\nexport function stripComments(text: string): string {\n // A closing delimiter not found from some position is not found from any later one.\n const missing = new Set<string>();\n let out = '';\n let kept = 0;\n let i = 0;\n while (i < text.length) {\n const comment = COMMENTS.find(([open, close]) => !missing.has(close) && text.startsWith(open, i));\n if (comment === undefined) {\n i++;\n continue;\n }\n const [open, close] = comment;\n const end = text.indexOf(close, i + open.length);\n if (end === -1) {\n missing.add(close);\n i++;\n continue;\n }\n out += text.slice(kept, i);\n i = end + close.length;\n kept = i;\n }\n return out + text.slice(kept);\n}\n\n// --- Normalization segments (Tweego's `norm.Iter`) ---\n\n/**\n * Code points with canonical combining class 0 that NFC may still combine with the character before them\n * (Unicode NFC_Quick_Check=Maybe): Hangul medial vowels and final consonants, and some vowel and length\n * signs. Go's `norm` package counts them as non-starters for stream-safe text, so it starts no new segment\n * before them, except after it has reordered. Derived from the Unicode 16 data.\n */\nconst COMBINING_STARTERS: ReadonlySet<string> = new Set(\n [\n 0x09be,\n 0x09d7,\n 0x0b3e,\n 0x0b56,\n 0x0b57,\n 0x0bbe,\n 0x0bd7,\n 0x0cc2,\n 0x0cd5,\n 0x0cd6,\n 0x0d3e,\n 0x0d57,\n 0x0dcf,\n 0x0ddf,\n 0x102e,\n ...codePoints(0x1161, 0x1175),\n ...codePoints(0x11a8, 0x11c2),\n 0x1b35,\n 0x11127,\n 0x1133e,\n 0x11357,\n 0x113b8,\n 0x113bb,\n 0x113c2,\n 0x113c9,\n 0x114b0,\n 0x114ba,\n 0x114bd,\n 0x115af,\n 0x11930,\n ...codePoints(0x1611e, 0x16120),\n 0x16129,\n 0x16d67,\n ].map((cp) => String.fromCodePoint(cp)),\n);\n\n/** The code points from `from` to `to`, both included. */\nfunction codePoints(from: number, to: number): number[] {\n return Array.from({ length: to - from + 1 }, (_, i) => from + i);\n}\n\n/** Whether a code point of decomposed text has a non-zero canonical combining class: canonical reordering moves it. */\nfunction isNonStarter(ch: string): boolean {\n // Every character with a non-zero combining class is a mark; testing that first is cheap.\n if (!/\\p{M}/u.test(ch)) return false;\n // Reordering puts a lower class first: U+0334 has class 1, U+05B0 class 10.\n const after = 'a' + ch + '̴';\n const before = 'aְ' + ch;\n return after.normalize('NFD') !== after || before.normalize('NFD') !== before;\n}\n\nconst nonStarters = new Map<string, boolean>();\n\n/** Whether a code point of decomposed text (or `''`, for none) has combining class 0. */\nfunction hasZeroClass(ch: string): boolean {\n if (ch < '̀') return true;\n let known = nonStarters.get(ch);\n if (known === undefined) {\n known = isNonStarter(ch);\n nonStarters.set(ch, known);\n }\n return !known;\n}\n\nconst lowerClasses = new Map<string, boolean>();\n\n/**\n * Whether the combining class of `a` is lower than that of `b`, both code points of decomposed text (or `''`,\n * class 0): canonical reordering moves `a` before `b` exactly when it is.\n */\nfunction hasLowerClass(a: string, b: string): boolean {\n if (hasZeroClass(b)) return false;\n if (hasZeroClass(a)) return true;\n const key = `${a} ${b}`;\n let known = lowerClasses.get(key);\n if (known === undefined) {\n const text = 'a' + b + a;\n known = text.normalize('NFD') !== text;\n lowerClasses.set(key, known);\n }\n return known;\n}\n\n/**\n * Whether a code point of decomposed text is a starter for Go's `norm` package (`BoundaryBefore`): combining\n * class 0, and not one that combines with the character before it.\n */\nfunction isBoundary(ch: string): boolean {\n return hasZeroClass(ch) && !COMBINING_STARTERS.has(ch);\n}\n\n/** What Go's NFKD tables hold for a character of the source text (its `Properties`). */\ninterface CharInfo {\n /** A Hangul syllable, which Go decomposes by computation rather than from its tables. */\n readonly hangul: boolean;\n /** The NFKD decomposition, when the character has one. */\n readonly decomposition: readonly string[] | undefined;\n /** The code point whose combining class is the character's leading one (`ccc`), or `''` for class 0. */\n readonly lead: string;\n /** The code point whose combining class is the character's trailing one (`tccc`), or `''` for class 0. */\n readonly trail: string;\n /** Leading non-starters: code points of class above 0, or that combine with what precedes them. */\n readonly nLead: number;\n /** Trailing non-starters. */\n readonly nTrail: number;\n /** Whether the decomposition holds more than one segment, which Go yields one by one. */\n readonly multiSegment: boolean;\n}\n\n/** Any ASCII character: Go's iterator takes each as a segment of its own. */\nconst ASCII_INFO: CharInfo = {\n hangul: false,\n decomposition: undefined,\n lead: '',\n trail: '',\n nLead: 0,\n nTrail: 0,\n multiSegment: false,\n};\n/** Go's empty `Properties`, which the iterator reads past the end of the text. */\nconst END_INFO: CharInfo = { ...ASCII_INFO };\n\nconst HANGUL_T_COUNT = 28;\n\nconst infos = new Map<string, CharInfo>();\n\nfunction charInfo(ch: string): CharInfo {\n if (ch < '\\u0080') return ASCII_INFO;\n let info = infos.get(ch);\n if (info === undefined) {\n info = computeCharInfo(ch);\n infos.set(ch, info);\n }\n return info;\n}\n\nfunction computeCharInfo(ch: string): CharInfo {\n if (ch >= '가' && ch <= '힣') {\n // A leading consonant, a vowel and, unless the syllable has none, a trailing consonant; the last two combine.\n const trailing = (ch.charCodeAt(0) - 0xac00) % HANGUL_T_COUNT === 0 ? 1 : 2;\n return { ...ASCII_INFO, hangul: true, nTrail: trailing };\n }\n const runes = Array.from(ch.normalize('NFKD'));\n const lead = runes.slice(0, 1).join('');\n const trail = runes.slice(-1).join('');\n const firstStarter = runes.findIndex(isBoundary);\n const nLead = firstStarter === -1 ? runes.length : firstStarter;\n return {\n hangul: false,\n decomposition: runes.length === 1 && lead === ch ? undefined : runes,\n lead: hasZeroClass(lead) ? '' : lead,\n trail: hasZeroClass(trail) ? '' : trail,\n nLead,\n nTrail: runes.length - 1 - runes.findLastIndex(isBoundary),\n multiSegment: nLead === 0 && hasZeroClass(lead) && runes.slice(1).some(hasZeroClass),\n };\n}\n\n/** The most non-starters in one segment; more start a new one, as in Go's stream-safe text handling. */\nconst MAX_NON_STARTERS = 30;\n\n/** Which of Go's `Iter.next` functions yields the next segment. */\ntype IterStep = 'decomposed' | 'ascii' | 'hangul' | 'multi' | 'cgj';\n\n/**\n * Go's `norm.Iter` over a text in NFKD (golang.org/x/text v0.3.2, the version Tweego 2.1.1 is built with), reduced\n * to where its segments end: a port of `nextDecomposed` and the functions it hands over to. The text is read as\n * written, a character (code point) at a time; each method names the Go function it ports.\n *\n * Go also ends a segment when its 128-byte buffer would overflow, which is left out: the 30 non-starter limit\n * always comes first. A segment holds one starter of at most 4 bytes and non-starters that each add at least 1\n * to the count per 4 bytes (a decomposition that leads with a non-starter holds only non-starters), so it holds\n * at most 4 × 31 = 124 bytes.\n */\nclass SegmentIterator {\n private readonly infos: readonly CharInfo[];\n /** The character the next segment starts at, as `i.p`. */\n private p = 0;\n /** The properties of the current character, as `i.info`. */\n private info: CharInfo;\n /** Go's `streamSafe`: the non-starters in the segment so far. */\n private ss: number;\n private step: IterStep = 'decomposed';\n /** The segments of a multi-segment decomposition still to yield, as `i.multiSeg`; empty for none. */\n private multiSeg: readonly string[] = [];\n\n constructor(text: string) {\n this.infos = Array.from(text, charInfo);\n this.info = this.at(0);\n this.ss = this.info.nTrail;\n }\n\n /** Whether no segment is left (`Done`). */\n done(): boolean {\n return this.p >= this.infos.length;\n }\n\n /** Move past the next segment (`Next`). */\n next(): void {\n switch (this.step) {\n case 'decomposed':\n this.decomposed();\n break;\n case 'ascii':\n this.ascii();\n break;\n case 'hangul':\n this.hangul();\n break;\n case 'multi':\n this.multi();\n break;\n case 'cgj':\n // `nextCGJDecompose`: a grapheme joiner, then the character that overflowed and the non-starters after it.\n this.ss = this.info.nTrail;\n this.step = 'decomposed';\n this.reorder();\n break;\n default: {\n const _exhaustive: never = this.step;\n throw new Error(`Unhandled iterator step: ${String(_exhaustive)}`);\n }\n }\n }\n\n private at(k: number): CharInfo {\n return this.infos[k] ?? END_INFO;\n }\n\n /** `streamSafe.next`: whether `next` starts a segment, overflows this one, or joins it. */\n private ssNext(next: CharInfo): 'starter' | 'overflow' | 'joins' {\n this.ss += next.nLead;\n if (this.ss > MAX_NON_STARTERS) {\n this.ss = 0;\n return 'overflow';\n }\n if (next.nLead > 0) return 'joins';\n this.ss = next.nTrail;\n return 'starter';\n }\n\n /** `nextASCIIString`. */\n private ascii(): void {\n const next = this.at(this.p + 1);\n if (next === END_INFO || next === ASCII_INFO) {\n this.p++;\n } else {\n this.info = this.at(this.p);\n this.step = 'decomposed';\n this.decomposed();\n }\n }\n\n /** `nextHangul`. */\n private hangul(): void {\n const next = this.at(this.p + 1);\n if (next === END_INFO || next.hangul) {\n this.p++;\n return;\n }\n this.ssNext(this.info);\n this.info = this.at(this.p);\n this.step = 'decomposed';\n this.decomposed();\n }\n\n /** `nextMulti`: the next segment of a decomposition that holds several. */\n private multi(): void {\n const j = this.multiSeg.findIndex((r, k) => k > 0 && isBoundary(r));\n if (j !== -1) {\n this.multiSeg = this.multiSeg.slice(j);\n return;\n }\n // The last segment, taken as a decomposition of its own.\n this.step = 'decomposed';\n this.decomposed();\n }\n\n /** `doNormDecomposed`: the character at `p` and the ones of non-zero class after it, reordered. */\n private reorder(): void {\n for (;;) {\n this.p++;\n if (this.done()) return;\n this.info = this.at(this.p);\n if (this.info.lead === '') return;\n if (this.ssNext(this.info) === 'overflow') {\n this.step = 'cgj';\n return;\n }\n }\n }\n\n /** `nextDecomposed`. */\n private decomposed(): void {\n let first = true;\n for (;;) {\n const { info } = this;\n if (info === ASCII_INFO) {\n this.ss = 0;\n this.p++;\n if (this.done()) return;\n if (this.at(this.p) === ASCII_INFO) {\n this.step = 'ascii';\n return;\n }\n } else if (info.decomposition !== undefined) {\n if (first && info.multiSegment) {\n if (this.multiSeg.length === 0) {\n this.multiSeg = info.decomposition;\n this.step = 'multi';\n this.multi();\n return;\n }\n // The last segment of the decomposition.\n this.multiSeg = [];\n }\n this.p++;\n this.info = this.at(this.p);\n const next = this.ssNext(this.info);\n if (next === 'overflow') this.step = 'cgj';\n if (next !== 'joins') return;\n first = false;\n if (hasLowerClass(this.info.lead, info.trail)) {\n this.reorder();\n return;\n }\n continue;\n } else if (info.hangul) {\n this.p++;\n if (this.done()) return;\n if (this.at(this.p).hangul) {\n this.step = 'hangul';\n return;\n }\n } else {\n this.p++;\n }\n first = false;\n if (this.done()) return;\n this.info = this.at(this.p);\n const next = this.ssNext(this.info);\n if (next === 'starter') return;\n if (next === 'overflow') {\n this.step = 'cgj';\n return;\n }\n if (hasLowerClass(this.info.lead, info.trail)) {\n this.reorder();\n return;\n }\n }\n }\n}\n\n/**\n * The number of normalization segments Go's `norm.Iter` yields for `text` in NFKD, which Tweego's word count\n * counts (see `SegmentIterator`). A segment starts at a starter (combining class 0, not combining with what\n * precedes it) and holds the non-starters after it, so `é` is one segment and a Hangul syllable is one. The\n * iterator reads the text as written, not decomposed first: when a character's leading combining class is lower\n * than the trailing class before it, it reorders, and then ends the segment at the next character of class 0,\n * even one that combines with what precedes it (U+0301 U+09BE U+09BE is two segments). More than 30\n * non-starters also end a segment. Character properties come from the JavaScript\n * engine's Unicode data, so characters newer than Go's tables can count differently.\n */\nexport function countNormalizationSegments(text: string): number {\n const iter = new SegmentIterator(text);\n let segments = 0;\n while (!iter.done()) {\n segments++;\n iter.next();\n }\n return segments;\n}\n\n// --- Markup removal for the 'whitespace' method ---\n\n/** Passage text as the `'whitespace'` method reads it, before HTML. */\ninterface MarkupText {\n /** What SugarCube's wikifier reads: the start and end tags of HTML elements, and text (see `wikifiedText`). */\n readonly pieces: readonly WikifiedPiece[];\n /** The text alone, with no tag: what is counted when the HTML can't be read. */\n readonly prose: string;\n /** An `<svg>` element or `<html>` content nests elements more than `MAX_HTML_DEPTH` deep. */\n readonly htmlTooDeep: boolean;\n}\n\n/**\n * The elements whose start tags `readMarkup` kept and no end tag has closed yet, innermost last. As SugarCube's\n * `htmlTag` parser reads an element's content up to its own end tag, only the innermost element can be closed: an end\n * tag of an outer one inside it is text. Each call takes constant time.\n */\nclass OpenElements {\n private readonly names: string[] = [];\n\n open(name: string): void {\n this.names.push(name);\n }\n\n /** Closes the innermost open element if it is named `name`; false when it is not. */\n close(name: string): boolean {\n if (this.names[this.names.length - 1] !== name) return false;\n this.names.pop();\n return true;\n }\n}\n\n/**\n * Reads passage markup as SugarCube's wikifier walks it (`walkPassageMarkup`), leftmost first: macro tags,\n * `<<script>>` bodies, comments (and the opener of one that isn't closed) and italics markup are dropped, link\n * markup gives the text it shows, a `<script>` element shows nothing, and an HTML start tag that SugarCube's\n * `htmlTag` parser reads is kept, so that a `<<` or `[[` inside its attribute values is not markup. An element\n * SugarCube reads with a parser of its own (`ownElementReader`) is read as that parser reads it: the text a `<style>`\n * or `<svg>` element (any tag name these start, as `<styles>`) or the content of `<html>` shows, read as HTML of its\n * own, is kept as the nodes jQuery makes of it (a `<style>` element shows no text), and so is the content of\n * `<nowiki>`, as text; without its end, the parser drops its opener, and so does this. In the text between them, an\n * end tag is kept when it closes the innermost element whose start tag was kept, and any other `<` is text.\n *\n * Linear time (see `OpenElements` and `ownElementReader`).\n */\nfunction readMarkup(text: string): MarkupText {\n const pieces: WikifiedPiece[] = [];\n const prose: string[] = [];\n let htmlTooDeep = false;\n const open = new OpenElements();\n const keepText = (kind: 'link' | 'verbatim', part: string): void => {\n pieces.push({ kind, text: part });\n prose.push(part);\n };\n /** Reads an element SugarCube reads with a parser of its own, at `start`. */\n const readOwnElement = (start: number, own: OwnElement): void => {\n const { closed } = own;\n if (closed === undefined) return;\n switch (own.kind) {\n case 'style':\n case 'svg':\n case 'html':\n // SugarCube parses the element (or, for `<html>`, the content) as HTML of its own, so nothing left open in it\n // reaches what follows: a `<style>` element shows nothing, a `<styles>` element its text. HTML nested too\n // deeply to read gives no text.\n try {\n const appended = parseAppended(\n own.kind === 'html' ? text.slice(own.openerEnd, closed.contentEnd) : text.slice(start, closed.end),\n );\n pieces.push(appended.piece);\n prose.push(appended.text);\n } catch (e) {\n if (!(e instanceof HtmlNestingError)) throw e;\n htmlTooDeep = true;\n }\n return;\n case 'nowiki':\n keepText('verbatim', text.slice(own.openerEnd, closed.contentEnd));\n return;\n default: {\n const _exhaustive: never = own.kind;\n throw new Error(`Unhandled element: ${String(_exhaustive)}`);\n }\n }\n };\n /** Text between markup, which the wikifier reads as it is, line feeds as line breaks. */\n const keepPassageText = (part: string): void => {\n if (part === '') return;\n pieces.push({ kind: 'text', text: part });\n prose.push(part);\n };\n let nextAngle = text.indexOf('<');\n /** The text from `from` to `end`, where the walk read no markup. */\n const between = (from: number, end: number): void => {\n let at = from;\n // The wikifier makes one text node of text that no markup interrupts, a `<` that starts none included.\n let run = '';\n for (;;) {\n if (nextAngle !== -1 && nextAngle < at) nextAngle = text.indexOf('<', at);\n if (nextAngle === -1 || nextAngle >= end) break;\n run += text.slice(at, nextAngle);\n const endTag = htmlEndTagAt(text, nextAngle);\n if (endTag !== undefined && endTag.end <= end && open.close(endTag.name)) {\n keepPassageText(run);\n run = '';\n pieces.push({ kind: 'end' });\n at = endTag.end;\n } else {\n run += '<';\n at = nextAngle + 1;\n }\n }\n keepPassageText(run + text.slice(at, end));\n };\n let kept = 0;\n walkPassageMarkup(\n text,\n (region) => {\n between(kept, region.start);\n switch (region.kind) {\n case 'link':\n if (region.label !== undefined) keepText('link', region.label);\n break;\n case 'html-tag':\n pieces.push({ kind: 'start', name: region.tag.name, container: region.tag.container });\n if (region.tag.container) open.open(region.tag.name);\n break;\n case 'script-element':\n // SugarCube shows nothing for a `<script>` element, or for an opener without a `</script>`.\n break;\n case 'own-element':\n readOwnElement(region.start, region.element);\n break;\n case 'macro':\n case 'script-body':\n case 'comment':\n break;\n default: {\n const _exhaustive: never = region;\n throw new Error(`Unhandled markup region: ${JSON.stringify(_exhaustive)}`);\n }\n }\n kept = region.end;\n },\n { ownElements: true },\n );\n between(kept, text.length);\n return { pieces, prose: prose.join(''), htmlTooDeep };\n}\n\n/** The words of passage text, and whether its HTML nests too deeply to read (see `countWhitespaceWords`). */\nexport interface WordCount {\n readonly words: number;\n /** The `'whitespace'` method could not read the HTML, so the words of its text without tags were counted. */\n readonly htmlTooDeep: boolean;\n}\n\n/**\n * The words of passage text that a reader sees, as SugarCube shows it: the text `readMarkup` leaves, with the elements\n * SugarCube makes one at a time (`wikifiedText`), split at white space. When its elements nest more than `MAX_HTML_DEPTH` deep, which a passage that\n * opens an element in each branch of an `<<if>>` can do without nesting at all when shown, the words of the text\n * without tags are counted instead.\n */\nfunction countWhitespaceWords(text: string): WordCount {\n const { pieces, prose, htmlTooDeep } = readMarkup(text);\n if (htmlTooDeep) return { words: splitTweeFields(prose).length, htmlTooDeep };\n try {\n return { words: splitTweeFields(wikifiedText(pieces)).length, htmlTooDeep: false };\n } catch (e) {\n if (!(e instanceof HtmlNestingError)) throw e;\n return { words: splitTweeFields(prose).length, htmlTooDeep: true };\n }\n}\n\n/**\n * Count the words of passage text.\n *\n * - `'tweego'` (default), as Tweego counts them: line feeds and comments are removed, the rest is decomposed\n * (NFKD) and its normalization segments counted (a letter with its accents is one), and every five, or\n * part of five, make a word.\n * - `'whitespace'`: the words a reader sees when SugarCube shows the passage (see `countWhitespaceWords`): macro\n * tags, comments and tags give none, link markup gives the text it shows, a `<` that starts no tag is text, and\n * character references give their characters. The runs of non-white-space characters are counted.\n */\nexport function countTextWordsChecked(text: string, method: WordCountMethod): WordCount {\n switch (method) {\n case 'tweego': {\n const count = countNormalizationSegments(stripComments(text.replaceAll('\\n', '')));\n return { words: Math.ceil(count / 5), htmlTooDeep: false };\n }\n case 'whitespace':\n return countWhitespaceWords(text);\n default: {\n const _exhaustive: never = method;\n throw new Error(`Unhandled word count method: ${String(_exhaustive)}`);\n }\n }\n}\n\n/** The number of words in passage text (see `countTextWordsChecked`). */\nexport function countTextWords(text: string, method: WordCountMethod): number {\n return countTextWordsChecked(text, method).words;\n}\n","/**\n * Typed decoding of untrusted JSON text, with issues that say where a value was rejected.\n *\n * Two layers:\n *\n * 1. `parseJSON(text)` is a strict RFC 8259 parser. Unlike `JSON.parse`, it keeps every object member in\n * document order, duplicates included, and builds no JavaScript objects from the keys, so a key such as\n * `__proto__` or `constructor` is plain data. It runs in linear time and without recursion, and limits\n * nesting to 10000 levels, as Go's `encoding/json` does.\n *\n * 2. Decoders turn a parsed `JsonValue` into typed values. Each one checks the type of what it reads and\n * records a `DecodeIssue` (with a path such as `$.options[1]`) for anything it rejects, so a caller never\n * drops a value silently: it decides per issue kind whether to report an error or a warning.\n * `readObject()` reads the members of an object into named fields. Its keys can match the field names\n * exactly or as Go's `encoding/json` matches struct fields, regardless of letter case.\n *\n * Results are built with own properties only (`Map`s, or objects made with `ownRecord()`), so untrusted keys\n * never reach a prototype.\n */\n\n// --- Values ---\n\n/** A JSON object, with its members in document order (a repeated key appears once per occurrence). */\nexport class JsonObject {\n constructor(readonly members: readonly JsonMember[]) {}\n}\n\nexport interface JsonMember {\n readonly key: string;\n readonly value: JsonValue;\n}\n\n/** A parsed JSON value. Arrays are JavaScript arrays; objects are `JsonObject`s. */\nexport type JsonValue = null | boolean | number | string | readonly JsonValue[] | JsonObject;\n\n/** Where and why JSON text is not valid JSON. `line` and `column` count from 1; `column` counts UTF-16 units. */\ninterface JsonSyntaxError {\n readonly message: string;\n readonly offset: number;\n readonly line: number;\n readonly column: number;\n}\n\nexport type JsonParseResult =\n { readonly ok: true; readonly value: JsonValue } | { readonly ok: false; readonly error: JsonSyntaxError };\n\n/** The deepest nesting of arrays and objects `parseJSON()` accepts, as in Go's `encoding/json`. */\nexport const MAX_JSON_DEPTH = 10000;\n\n// --- Parser ---\n\n/** Thrown inside the parser only; `parseJSON()` turns it into its result. */\nclass SyntaxFailure extends Error {\n constructor(\n readonly reason: string,\n readonly offset: number,\n ) {\n super(reason);\n }\n}\n\nconst NUMBER = /-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?/y;\n\nconst SIMPLE_ESCAPES: ReadonlyMap<string, string> = new Map([\n ['\"', '\"'],\n ['\\\\', '\\\\'],\n ['/', '/'],\n ['b', '\\b'],\n ['f', '\\f'],\n ['n', '\\n'],\n ['r', '\\r'],\n ['t', '\\t'],\n]);\n\nclass Scanner {\n pos = 0;\n constructor(readonly text: string) {}\n\n skipWhitespace(): void {\n for (;;) {\n const c = this.text.charCodeAt(this.pos);\n // JSON whitespace: space, tab, line feed, carriage return.\n if (c !== 0x20 && c !== 0x09 && c !== 0x0a && c !== 0x0d) return;\n this.pos++;\n }\n }\n\n fail(expected: string): never {\n const cp = this.text.codePointAt(this.pos);\n if (cp === undefined) throw new SyntaxFailure(`unexpected end of input; expected ${expected}`, this.pos);\n const ch = String.fromCodePoint(cp);\n throw new SyntaxFailure(`unexpected character ${JSON.stringify(ch)}; expected ${expected}`, this.pos);\n }\n\n /** Consume `ch` if it is next. */\n eat(ch: string): boolean {\n if (this.text[this.pos] !== ch) return false;\n this.pos++;\n return true;\n }\n\n expect(ch: string, expected: string): void {\n if (!this.eat(ch)) this.fail(expected);\n }\n\n string(): string {\n this.expect('\"', 'a string');\n let out = '';\n let chunk = this.pos;\n for (;;) {\n const c = this.text.charCodeAt(this.pos);\n if (Number.isNaN(c)) this.fail('a closing quotation mark');\n if (c === 0x22) {\n out += this.text.slice(chunk, this.pos);\n this.pos++;\n return out;\n }\n if (c < 0x20) this.fail('an escaped control character');\n if (c !== 0x5c) {\n this.pos++;\n continue;\n }\n out += this.text.slice(chunk, this.pos);\n this.pos++;\n out += this.escape();\n chunk = this.pos;\n }\n }\n\n /** The character an escape sequence stands for; `pos` is just past the backslash. */\n private escape(): string {\n const ch = this.text[this.pos] ?? '';\n const simple = SIMPLE_ESCAPES.get(ch);\n if (simple !== undefined) {\n this.pos++;\n return simple;\n }\n if (ch !== 'u') this.fail('an escape sequence');\n const hex = this.text.slice(this.pos + 1, this.pos + 5);\n if (!/^[0-9a-fA-F]{4}$/.test(hex)) {\n this.pos++;\n this.fail('four hexadecimal digits');\n }\n this.pos += 5;\n return String.fromCharCode(parseInt(hex, 16));\n }\n\n scalar(): JsonValue {\n const c = this.text[this.pos];\n if (c === '\"') return this.string();\n for (const [word, value] of LITERALS) {\n if (this.text.startsWith(word, this.pos)) {\n this.pos += word.length;\n return value;\n }\n }\n NUMBER.lastIndex = this.pos;\n const match = NUMBER.exec(this.text);\n if (match === null) this.fail('a JSON value');\n this.pos += match[0].length;\n return Number(match[0]);\n }\n}\n\nconst LITERALS: readonly (readonly [string, JsonValue])[] = [\n ['true', true],\n ['false', false],\n ['null', null],\n];\n\ntype Frame =\n | { readonly kind: 'array'; readonly items: JsonValue[] }\n | { readonly kind: 'object'; readonly members: JsonMember[]; key: string };\n\n/** Parse one JSON value, iteratively: nesting depth is limited by `MAX_JSON_DEPTH`, not by the call stack. */\nfunction parseValue(s: Scanner): JsonValue {\n const stack: Frame[] = [];\n // Called at each `[` or `{`, empty ones included, as Go counts the depth.\n const checkDepth = (): void => {\n if (stack.length >= MAX_JSON_DEPTH) {\n throw new SyntaxFailure(`exceeded the maximum nesting depth of ${MAX_JSON_DEPTH}`, s.pos - 1);\n }\n };\n const memberKey = (): string => {\n s.skipWhitespace();\n const key = s.string();\n s.skipWhitespace();\n s.expect(':', '\":\" after an object key');\n return key;\n };\n\n for (;;) {\n s.skipWhitespace();\n let value: JsonValue;\n if (s.eat('[')) {\n checkDepth();\n s.skipWhitespace();\n if (!s.eat(']')) {\n stack.push({ kind: 'array', items: [] });\n continue;\n }\n value = [];\n } else if (s.eat('{')) {\n checkDepth();\n s.skipWhitespace();\n if (!s.eat('}')) {\n if (s.text[s.pos] !== '\"') s.fail('a string key or \"}\"');\n stack.push({ kind: 'object', members: [], key: memberKey() });\n continue;\n }\n value = new JsonObject([]);\n } else {\n value = s.scalar();\n }\n\n // Hand the value to the enclosing arrays and objects, closing each one that ends here.\n for (;;) {\n const top = stack[stack.length - 1];\n if (top === undefined) return value;\n s.skipWhitespace();\n if (top.kind === 'array') {\n top.items.push(value);\n if (s.eat(',')) break;\n s.expect(']', '\",\" or \"]\" after an array element');\n stack.pop();\n value = top.items;\n } else {\n top.members.push({ key: top.key, value });\n if (s.eat(',')) {\n top.key = memberKey();\n break;\n }\n s.expect('}', '\",\" or \"}\" after an object member');\n stack.pop();\n value = new JsonObject(top.members);\n }\n }\n }\n}\n\n/** Line and column (both from 1) of a UTF-16 offset. */\nfunction lineAndColumn(text: string, offset: number): { line: number; column: number } {\n let line = 1;\n let lineStart = 0;\n for (let i = text.indexOf('\\n'); i !== -1 && i < offset; i = text.indexOf('\\n', i + 1)) {\n line++;\n lineStart = i + 1;\n }\n return { line, column: offset - lineStart + 1 };\n}\n\n/**\n * Parse JSON text strictly (RFC 8259): one value, surrounded only by JSON whitespace. Accepts what\n * `JSON.parse` accepts and gives the same values, except that objects keep every member in order\n * (see `JsonObject`). An invalid text gives a `JsonSyntaxError` instead of throwing.\n */\nexport function parseJSON(text: string): JsonParseResult {\n const s = new Scanner(text);\n try {\n const value = parseValue(s);\n s.skipWhitespace();\n if (s.pos < text.length) s.fail('the end of input after the JSON value');\n return { ok: true, value };\n } catch (e) {\n if (!(e instanceof SyntaxFailure)) throw e;\n const { line, column } = lineAndColumn(text, e.offset);\n return {\n ok: false,\n error: { message: `${e.reason} at line ${line}, column ${column}`, offset: e.offset, line, column },\n };\n }\n}\n\n// --- Paths ---\n\n/** Where a value sits in a document: object keys and array indices from the root. */\nexport type JsonPath = readonly (string | number)[];\n\nconst IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\n/** A path as text: `$` for the root, then `.key`, `[\"odd key\"]` or `[index]` for each step. */\nexport function formatJsonPath(path: JsonPath): string {\n return path\n .map((step) =>\n typeof step === 'number' ? `[${step}]` : IDENTIFIER.test(step) ? `.${step}` : `[${JSON.stringify(step)}]`,\n )\n .reduce((text, step) => text + step, '$');\n}\n\n// --- Issues ---\n\nexport type DecodeIssueKind =\n /** A value of the wrong type; the value is not used. */\n | 'type'\n /** An object key that matches no field; the member is not used. */\n | 'unknown-key'\n /** A key that matches a field only when letter case is ignored; the member is used for that field. */\n | 'case-variant-key'\n /** A second member for the same field; the last one is used. */\n | 'duplicate-key';\n\nexport interface DecodeIssue {\n readonly kind: DecodeIssueKind;\n readonly path: JsonPath;\n /** What is wrong, as a sentence fragment that starts with the path (see `formatJsonPath`). */\n readonly message: string;\n}\n\n/** Describe a JSON value for an issue message: `a number (3)`, `an array`, `null`. */\nexport function describeJsonValue(value: JsonValue): string {\n if (value === null) return 'null';\n if (typeof value === 'string') return `a string (${JSON.stringify(value)})`;\n if (typeof value === 'number') return `a number (${String(value)})`;\n if (typeof value === 'boolean') return `a boolean (${String(value)})`;\n return value instanceof JsonObject ? 'an object' : 'an array';\n}\n\n// --- Decoders ---\n\ntype DecodeOutcome<T> = { readonly ok: true; readonly value: T } | { readonly ok: false };\n\n/**\n * Reads a `JsonValue` as a `T`. On a value it cannot use, it records at least one issue in `issues` and\n * returns `{ ok: false }`; it may also accept a value and still record issues about parts it left out.\n */\nexport type Decoder<T> = (value: JsonValue, path: JsonPath, issues: DecodeIssue[]) => DecodeOutcome<T>;\n\nfunction rejected(value: JsonValue, path: JsonPath, issues: DecodeIssue[], expected: string): { ok: false } {\n issues.push({\n kind: 'type',\n path,\n message: `${formatJsonPath(path)} must be ${expected}, not ${describeJsonValue(value)}`,\n });\n return { ok: false };\n}\n\nexport const jsonString: Decoder<string> = (value, path, issues) =>\n typeof value === 'string' ? { ok: true, value } : rejected(value, path, issues, 'a string');\n\n/** A finite number. JSON can write a number too large for a double (`1e400`); that is rejected, as in Go. */\nexport const jsonNumber: Decoder<number> = (value, path, issues) =>\n typeof value === 'number' && Number.isFinite(value)\n ? { ok: true, value }\n : rejected(value, path, issues, 'a finite number');\n\nexport const jsonBoolean: Decoder<boolean> = (value, path, issues) =>\n typeof value === 'boolean' ? { ok: true, value } : rejected(value, path, issues, 'a boolean');\n\n/** An array whose elements `element` reads. An element it rejects is left out (and its issue recorded). */\nexport function jsonArrayOf<T>(element: Decoder<T>): Decoder<readonly T[]> {\n return (value, path, issues) => {\n if (!Array.isArray(value)) return rejected(value, path, issues, 'an array');\n const items: readonly JsonValue[] = value;\n const out = items.flatMap((item, i) => {\n const r = element(item, [...path, i], issues);\n return r.ok ? [r.value] : [];\n });\n return { ok: true, value: out };\n };\n}\n\n/**\n * An object read as a map from each key to what `entry` reads from its value. A repeated key takes its\n * last value, as in `JSON.parse`; a value `entry` rejects is left out (and its issue recorded).\n */\nexport function jsonRecordOf<T>(entry: Decoder<T>): Decoder<ReadonlyMap<string, T>> {\n return (value, path, issues) => {\n if (!(value instanceof JsonObject)) return rejected(value, path, issues, 'an object');\n const out = new Map<string, T>();\n for (const { key, value: item } of value.members) {\n const r = entry(item, [...path, key], issues);\n if (r.ok) out.set(key, r.value);\n else out.delete(key);\n }\n return { ok: true, value: out };\n };\n}\n\n/**\n * `decoder`, with `null` read as `zero`, as Go's `encoding/json` reads `null` into a field of a non-pointer\n * type (it leaves the field's zero value).\n */\nexport function nullAsZero<T>(decoder: Decoder<T>, zero: T): Decoder<T> {\n return (value, path, issues) => (value === null ? { ok: true, value: zero } : decoder(value, path, issues));\n}\n\n// --- Objects with named fields ---\n\n/** One named field of `readObject()`: reads a member's value and hands what it read to the caller. */\nexport interface FieldReader {\n read(value: JsonValue, path: JsonPath, issues: DecodeIssue[]): void;\n}\n\n/** A field read with `decoder`, whose value goes to `assign` (called again for each repeated member). */\nexport function field<T>(\n decoder: Decoder<T>,\n assign: (value: T) => void,\n options?: { readonly onNull: 'keep' },\n): FieldReader {\n return {\n read(value, path, issues) {\n if (value === null && options?.onNull === 'keep') return;\n const r = decoder(value, path, issues);\n if (r.ok) assign(r.value);\n },\n };\n}\n\nexport interface ObjectSpec {\n /** The fields by name. Names must be ASCII. */\n readonly fields: Readonly<Record<string, FieldReader>>;\n /**\n * How member keys match field names:\n * - `exact`: only the exact name;\n * - `go`: as Go's `encoding/json` matches struct fields: an exact match, else a match regardless of\n * letter case (see `goFoldKey`), which also records a `case-variant-key` issue.\n */\n readonly keys: 'exact' | 'go';\n /**\n * Called for each member whose key matches no field. Without it, such a member records an `unknown-key`\n * issue and is not used.\n */\n readonly unknown?: ((member: JsonMember, path: JsonPath, issues: DecodeIssue[]) => void) | undefined;\n}\n\n/**\n * Fold a key as Go's `encoding/json` folds object keys to match struct field names: ASCII letters to upper\n * case, and the two non-ASCII letters whose fold (`foldRune()`, the smallest rune of the `unicode.SimpleFold`\n * orbit) is an ASCII letter: `ſ` U+017F to S and `K` U+212A KELVIN SIGN to K. `İ` U+0130 and `ı` U+0131 are\n * orbits of their own in Go, so they match no field. Any other character is kept, which is exact for field\n * names that are ASCII, as every name here is.\n */\nexport function goFoldKey(key: string): string {\n let out = '';\n for (const ch of key) {\n out += GO_FOLD_TO_ASCII.get(ch) ?? (ch >= 'a' && ch <= 'z' ? ch.toUpperCase() : ch);\n }\n return out;\n}\n\nconst GO_FOLD_TO_ASCII: ReadonlyMap<string, string> = new Map([\n ['ſ', 'S'],\n ['K', 'K'],\n]);\n\n/**\n * The result of decoding JSON text: what was read (`T`) and the issues about what was left out or read\n * differently, or, when the text cannot be used at all, why.\n */\nexport type TextDecodeResult<T> =\n | (T & { readonly ok: true; readonly issues: readonly DecodeIssue[] })\n | { readonly ok: false; readonly reason: string };\n\n/**\n * Parse `text` and read the object it holds with `readObject()`. Returns the issues, or `ok: false` with the\n * reason when the text is not JSON or not an object. The values read reach the caller through `spec`'s fields.\n */\nexport function readObjectText(text: string, spec: ObjectSpec): TextDecodeResult<object> {\n const parsed = parseJSON(text);\n if (!parsed.ok) return { ok: false, reason: parsed.error.message };\n const issues: DecodeIssue[] = [];\n if (!readObject(parsed.value, [], issues, spec)) return { ok: false, reason: 'expected a JSON object' };\n return { ok: true, issues };\n}\n\n/**\n * Read the members of an object into the fields of `spec`, in document order: a field named twice is read\n * twice, so the last member wins (as in Go and `JSON.parse`), and a `duplicate-key` issue is recorded.\n * Returns false, with a `type` issue, when `value` is not an object.\n */\nexport function readObject(value: JsonValue, path: JsonPath, issues: DecodeIssue[], spec: ObjectSpec): boolean {\n if (!(value instanceof JsonObject)) {\n rejected(value, path, issues, 'an object');\n return false;\n }\n const exact = new Map(Object.entries(spec.fields));\n const folded = new Map([...exact.keys()].map((name) => [goFoldKey(name), name]));\n const seen = new Set<string>();\n for (const member of value.members) {\n const at = [...path, member.key];\n const name = exact.has(member.key)\n ? member.key\n : spec.keys === 'go'\n ? folded.get(goFoldKey(member.key))\n : undefined;\n const reader = name === undefined ? undefined : exact.get(name);\n if (name === undefined || reader === undefined) {\n if (spec.unknown) spec.unknown(member, at, issues);\n else issues.push({ kind: 'unknown-key', path: at, message: `${formatJsonPath(at)} is not a known field` });\n continue;\n }\n if (name !== member.key) {\n issues.push({\n kind: 'case-variant-key',\n path: at,\n message: `${formatJsonPath(at)} is read as \"${name}\", since keys match regardless of letter case`,\n });\n }\n if (seen.has(name)) {\n issues.push({\n kind: 'duplicate-key',\n path: at,\n message: `${formatJsonPath(at)} repeats the field \"${name}\"; the last one is used`,\n });\n }\n seen.add(name);\n reader.read(member.value, at, issues);\n }\n return true;\n}\n\n// --- Own-property-safe records ---\n\n/**\n * A plain object with `entries` as its own enumerable properties. Every key is defined as data, so a key such\n * as `__proto__` becomes an own property instead of changing the prototype.\n */\nexport function ownRecord<T>(entries: Iterable<readonly [string, T]>): Record<string, T> {\n const out: Record<string, T> = {};\n for (const [key, value] of entries) {\n Object.defineProperty(out, key, { value, enumerable: true, writable: true, configurable: true });\n }\n return out;\n}\n","/**\n * Passage helpers and output methods.\n * Ported from passage.go / passagedata.go.\n */\nimport type { Diagnostic, Passage, ReadonlyPassage, PassageMetadata, OutputMode, WordCountMethod } from './types.js';\nimport { attrEscape, fullAttrEscape, htmlEscape, tiddlerEscape, rot13 } from './escape.js';\nimport { tweeEscape } from './twee-syntax.js';\nimport { countTextWordsChecked } from './word-count.js';\nimport { MAX_HTML_DEPTH } from './html-structure.js';\nimport type { DecodeIssue, FieldReader, TextDecodeResult } from './json-decode.js';\nimport { jsonString, nullAsZero, ownRecord, readObjectText, formatJsonPath } from './json-decode.js';\nimport { pushAll } from './util.js';\n\n// Info passages contain structural data, metadata, and code rather than story content.\nconst INFO_PASSAGE_NAMES = new Set([\n 'StoryAuthor',\n 'StoryInit',\n 'StoryMenu',\n 'StorySubtitle',\n 'StoryTitle',\n 'PassageReady',\n 'PassageDone',\n 'PassageHeader',\n 'PassageFooter',\n 'StoryBanner',\n 'StoryCaption',\n 'StoryDisplayTitle',\n 'MenuOptions',\n 'MenuShare',\n 'MenuStory',\n 'StoryInterface',\n 'StoryShare',\n 'StorySettings',\n 'StoryData',\n 'StoryIncludes',\n]);\n\nconst INFO_TAGS = ['annotation', 'init', 'script', 'stylesheet', 'widget'];\n\nexport function hasTag(p: ReadonlyPassage, tag: string): boolean {\n return p.tags.includes(tag);\n}\n\nfunction hasAnyTag(p: ReadonlyPassage, tags: readonly string[]): boolean {\n return p.tags.some((t) => tags.includes(t));\n}\n\nfunction hasTagStartingWith(p: ReadonlyPassage, prefix: string): boolean {\n return p.tags.some((t) => t.startsWith(prefix));\n}\n\nfunction hasInfoTags(p: ReadonlyPassage): boolean {\n return hasAnyTag(p, INFO_TAGS) || hasTagStartingWith(p, 'Twine.');\n}\n\nfunction hasInfoName(p: ReadonlyPassage): boolean {\n return INFO_PASSAGE_NAMES.has(p.name);\n}\n\nexport function isInfoPassage(p: ReadonlyPassage): boolean {\n return hasInfoName(p) || hasInfoTags(p);\n}\n\n/** Info passages that hold story data or settings, which no story format shows. */\nconst DATA_PASSAGE_NAMES: ReadonlySet<string> = new Set(['StoryData', 'StorySettings', 'StoryIncludes']);\n\n/**\n * The info tags of passages a story format runs or shows: all but `annotation`, a note. (The `Twine.` tags mark\n * private passages and media, which no format shows either.)\n */\nconst ENTRY_TAGS = INFO_TAGS.filter((t) => t !== 'annotation');\n\n/**\n * Whether a story format runs or shows `p` without a link (StoryInit, PassageHeader, a `script`, `init` or `widget`\n * passage and the like), so that what it links to is reachable: an info passage, unless it is one only for being\n * story data (StoryData, StorySettings, StoryIncludes), a note (`annotation`) or a `Twine.` passage.\n */\nexport function isEntryPassage(p: ReadonlyPassage): boolean {\n return (hasInfoName(p) && !DATA_PASSAGE_NAMES.has(p.name)) || hasAnyTag(p, ENTRY_TAGS);\n}\n\nexport function isStoryPassage(p: ReadonlyPassage): boolean {\n return !hasInfoName(p) && !hasInfoTags(p);\n}\n\nfunction hasMetadataPosition(p: ReadonlyPassage): boolean {\n return p.metadata?.position != null && p.metadata.position !== '';\n}\n\nfunction hasMetadataSize(p: ReadonlyPassage): boolean {\n return p.metadata?.size != null && p.metadata.size !== '';\n}\n\n/**\n * The metadata entries that are written out: those with a non-empty string value, in their order. An empty\n * value stands for no value, as in Tweego.\n */\nfunction writtenMetadata(meta: Readonly<PassageMetadata> | undefined): [string, string][] {\n return Object.entries(meta ?? {}).flatMap(([key, value]) =>\n typeof value === 'string' && value ? [[key, value]] : [],\n );\n}\n\n/**\n * Passage metadata as it is written out (in Twee 3 headers and JSON output): the entries with a value, as own\n * properties (so `__proto__` is kept), or undefined when there are none.\n */\nexport function metadataForOutput(meta: Readonly<PassageMetadata> | undefined): Record<string, string> | undefined {\n const entries = writtenMetadata(meta);\n return entries.length > 0 ? ownRecord(entries) : undefined;\n}\n\n/** The metadata fields Tweego reads; any other key is a twee-ts extension, kept when its value is a string. */\nconst KNOWN_METADATA_FIELDS = ['position', 'size'] as const;\n\n/** The metadata read; its issues are about values left out or keys read as another, none of them fatal. */\ntype MetadataDecodeResult = TextDecodeResult<{ readonly metadata: PassageMetadata }>;\n\n/**\n * Decode a passage metadata block (`{\"position\":\"600,400\"}`), as Tweego decodes it into its struct:\n *\n * - `position` and `size` must be strings (`null` reads as empty). Their keys match regardless of letter case,\n * as Go matches struct fields (`Position` is `position`, with an issue saying so); a repeated key takes the\n * last value. A wrong-typed `position` or `size` makes the whole block unusable (`ok: false`), as in Tweego.\n * - Other keys are kept when their value is a string (Tweego drops them); another value is left out, with an\n * issue.\n * - Text that is not a JSON object is unusable.\n *\n * Keys are stored as own properties, so `__proto__` and `constructor` are kept like any other key.\n */\nexport function decodePassageMetadata(json: string): MetadataDecodeResult {\n const entries = new Map<string, string>();\n // Why a known field could not be read; any such field makes the block unusable.\n const rejected: string[] = [];\n const knownField = (name: string): FieldReader => ({\n read(value, path) {\n const fieldIssues: DecodeIssue[] = [];\n // As in Go, `null` leaves an earlier value; a first `null` is the empty string.\n const r =\n value === null ? { ok: true as const, value: entries.get(name) ?? '' } : jsonString(value, path, fieldIssues);\n if (r.ok) entries.set(name, r.value);\n pushAll(\n rejected,\n fieldIssues.map((issue) => issue.message),\n );\n },\n });\n const read = readObjectText(json, {\n fields: Object.fromEntries(KNOWN_METADATA_FIELDS.map((name) => [name, knownField(name)])),\n keys: 'go',\n unknown(member, path, memberIssues) {\n if (entries.has(member.key)) {\n memberIssues.push({\n kind: 'duplicate-key',\n path,\n message: `${formatJsonPath(path)} repeats a key; the last one is used`,\n });\n }\n const r = nullAsZero(jsonString, '')(member.value, path, memberIssues);\n if (r.ok) entries.set(member.key, r.value);\n else entries.delete(member.key);\n },\n });\n if (!read.ok) return read;\n if (rejected.length > 0) return { ok: false, reason: rejected.join('; ') };\n return { ok: true, metadata: ownRecord(entries), issues: read.issues };\n}\n\n/** Convert passage to Twee source. */\nexport function passageToTwee(p: ReadonlyPassage, outMode: OutputMode): string {\n let output: string;\n if (outMode === 'twee3') {\n output = ':: ' + tweeEscape(p.name);\n if (p.tags.length > 0) {\n output += ' [' + tweeEscape(p.tags.join(' ')) + ']';\n }\n const metadata = metadataForOutput(p.metadata);\n if (metadata !== undefined) output += ' ' + JSON.stringify(metadata);\n } else {\n output = ':: ' + p.name;\n if (p.tags.length > 0) {\n output += ' [' + p.tags.join(' ') + ']';\n }\n }\n output += '\\n';\n if (p.text.length > 0) {\n output += p.text + '\\n';\n }\n output += '\\n\\n';\n return output;\n}\n\n/** Generate `<tw-passagedata>` HTML for Twine 2. */\nexport function passageToPassagedata(\n p: ReadonlyPassage,\n pid: number,\n options?: { readonly sourceInfo?: boolean },\n): string {\n let position: string;\n let size: string;\n\n if (hasMetadataPosition(p)) {\n position = p.metadata?.position ?? '';\n } else {\n position = gridPosition(pid, 125, 25);\n }\n\n if (hasMetadataSize(p)) {\n size = p.metadata?.size ?? '';\n } else {\n size = '100,100';\n }\n\n let attrs = `<tw-passagedata pid=\"${pid}\" name=${quote(fullAttrEscape(p.name))} tags=${quote(attrEscape(p.tags.join(' ')))} position=${quote(attrEscape(position))} size=${quote(attrEscape(size))}`;\n if (options?.sourceInfo && p.source) {\n attrs += ` data-source-file=${quote(attrEscape(p.source.file))} data-source-line=\"${p.source.line}\"`;\n }\n return `${attrs}>${htmlEscape(p.text)}</tw-passagedata>`;\n}\n\n/**\n * Where Twine lays out passage `pid` (from 1) that has no position of its own: in rows of ten, `cell` apart,\n * the first `cell - inset` from the top left corner (Twine 2: 125 and 25; Twine 1: 140 and 130).\n */\nfunction gridPosition(pid: number, cell: number, inset: number): string {\n const x = pid % 10;\n const y = Math.floor(pid / 10);\n const column = x === 0 ? 10 : x;\n const row = x === 0 ? y : y + 1;\n return `${column * cell - inset},${row * cell - inset}`;\n}\n\n/**\n * Whether Twine 1 `obfuscate:rot13` encodes a tiddler: every one but `StorySettings` and those tagged `Twine.image`\n * (Twine 1.4 `Tiddler.isObfuscateable()`). Its engine tests the stored name and tags, which these tiddlers keep\n * unencoded, so the decompiler tests them the same way.\n */\nexport function isObfuscatable(p: Pick<ReadonlyPassage, 'name' | 'tags'>): boolean {\n return p.name !== 'StorySettings' && !p.tags.includes('Twine.image');\n}\n\n/**\n * Generate `<div tiddler>` HTML for Twine 1. With `obfuscateRot13`, an obfuscatable tiddler (see\n * `isObfuscatable()`) has its name, each tag and its text ROT13-encoded, as Twine 1.4 writes it\n * (`Tiddler.toHtml()`), and as its engine.js decodes it.\n */\nexport function passageToTiddler(p: ReadonlyPassage, pid: number, obfuscateRot13: boolean, time: Date): string {\n const position = hasMetadataPosition(p) ? (p.metadata?.position ?? '') : gridPosition(pid, 140, 130);\n\n // Twine 1's form, YYYYMMDDHHMM in UTC; every tiddler of one build has the build's time.\n const created = time.toISOString().replace(/[-:T]/g, '').slice(0, 12);\n const encode = obfuscateRot13 && isObfuscatable(p) ? rot13 : (s: string) => s;\n const name = attrEscape(encode(p.name));\n const tags = attrEscape(p.tags.map(encode).join(' '));\n return `<div tiddler=${quote(name)} tags=${quote(tags)} created=${quote(created)} modifier=${quote('twee')} twine-position=${quote(attrEscape(position))}>${tiddlerEscape(encode(p.text))}</div>`;\n}\n\n/**\n * Count the words in a passage's text (see `countTextWordsChecked` for the methods). When its HTML nests elements\n * too deeply to read, the words of its text without tags are counted, and a warning naming the passage is added to\n * `diagnostics`.\n */\nexport function countWords(\n p: ReadonlyPassage,\n method: WordCountMethod = 'tweego',\n diagnostics: Diagnostic[] = [],\n): number {\n const { words, htmlTooDeep } = countTextWordsChecked(p.text, method);\n if (htmlTooDeep) {\n diagnostics.push({\n level: 'warning',\n message: `Passage \"${p.name}\": its HTML nests more than ${String(MAX_HTML_DEPTH)} elements deep, so its words are counted without reading its HTML.`,\n ...(p.source === undefined ? {} : { file: p.source.file, line: p.source.line }),\n });\n }\n return words;\n}\n\n/**\n * Where a passage name that the compiler made up came from. Generated names yield to every other\n * name in the story: see `storyAdd()`.\n * - `code`: a stylesheet or script (a `.css`, `.js` or font file, or an imported Twine 2 story's\n * stylesheet or script). Output finds these by tag, so a new name is not reported.\n * - `media`: an image, audio, video or text track file. Stories refer to these by passage name,\n * so a new name is reported.\n */\nexport type GeneratedName =\n | { readonly kind: 'code'; readonly base: string }\n | { readonly kind: 'media'; readonly base: string; readonly file: string };\n\n/**\n * Passages whose names were generated, kept by identity so that cached passages keep the mark. A changed\n * copy of a passage is made with {@link derivePassage}, which carries the mark over.\n */\nconst generatedNames = new WeakMap<Passage, GeneratedName>();\n\n/**\n * Mark a passage's name as generated (from a file name, or for imported story code) and return\n * the passage. `origin.base` is the name that free names are numbered from: `base`, `base 2`, ….\n */\nexport function withGeneratedName(p: Passage, origin: GeneratedName): Passage {\n generatedNames.set(p, origin);\n return p;\n}\n\n/** Where the passage's name came from, when the compiler generated it. */\nexport function generatedNameOf(p: Passage): GeneratedName | undefined {\n return generatedNames.get(p);\n}\n\n/**\n * A copy of `p` with `changes` applied: the one way to make a changed copy of a passage while a story is\n * built. What is known about the passage beyond its fields carries over: a generated name stays generated\n * while the name is unchanged. A copy under a new name has an authored name, unless the caller marks it\n * again (as `storyAdd()` does when it moves a generated name aside).\n */\nexport function derivePassage(\n p: Passage,\n changes: Readonly<Partial<Pick<Passage, 'name' | 'tags' | 'text'>>>,\n): Passage {\n const copy: Passage = { ...p, ...changes };\n const origin = generatedNames.get(p);\n if (origin !== undefined && copy.name === p.name) generatedNames.set(copy, origin);\n return copy;\n}\n\n/**\n * Freeze `p` and everything it holds (tags, metadata, source), in place, and return it. A frozen passage\n * keeps its identity, so what is known about it by identity (a generated name) stays known.\n */\nexport function freezePassage(p: Passage): Passage {\n Object.freeze(p.tags);\n if (p.metadata !== undefined) Object.freeze(p.metadata);\n if (p.source !== undefined) Object.freeze(p.source);\n return Object.freeze(p);\n}\n\n/**\n * Apply tag aliases: for each passage carrying an alias tag, add the canonical tag if not already present. A\n * canonical tag that is itself an alias is followed (`{ a: 'b', b: 'c' }` adds `b` and `c` to a passage tagged\n * `a`), until no mapping adds anything, so cycles and self-mappings end too. Authored tags are kept as written (a\n * tag written twice stays twice, as in Tweego), whether or not an alias applies; added tags follow in the order they\n * were reached, and none repeats a tag already there. Returns new passage objects where tags changed; unchanged\n * passages are returned as-is. Idempotent: the result carries every tag the mappings reach, so applying the same\n * aliases again adds nothing.\n */\nexport function applyTagAliases(passages: readonly Passage[], aliases: Readonly<Record<string, string>>): Passage[] {\n const entries = Object.entries(aliases);\n if (entries.length === 0) return [...passages];\n return passages.map((p) => {\n const tags = new Set(p.tags);\n const authored = tags.size;\n for (let grew = true; grew;) {\n const before = tags.size;\n for (const [alias, canonical] of entries) {\n if (tags.has(alias)) tags.add(canonical);\n }\n grew = tags.size > before;\n }\n return tags.size > authored ? derivePassage(p, { tags: [...p.tags, ...[...tags].slice(authored)] }) : p;\n });\n}\n\nfunction quote(s: string): string {\n return `\"${s}\"`;\n}\n","/**\n * Story model + StoryData JSON marshal/unmarshal.\n * Ported from story.go + storydata.go.\n *\n * The story metadata (`name`, `ifid`, `legacyIFID`, `twine1`, `twine2`) is decided by the special passages that\n * are in the story: StoryTitle, StoryData and StorySettings. Each one decides its part entirely, from its own\n * text: a later passage of the same name replaces the earlier passage and everything it decided, and removing\n * it puts its part back to the defaults. So the metadata always equals `deriveStoryMetadata(story.passages)`,\n * whatever order passages arrive in and whatever was wrong with an earlier one.\n */\nimport type {\n Story,\n ReadonlyStory,\n Passage,\n ReadonlyPassage,\n Diagnostic,\n WordCountMethod,\n IFID,\n SourceLocation,\n Twine2Metadata,\n} from './types.js';\nimport { normalizeIFID, validateIFID } from './ifid.js';\nimport {\n isStoryPassage,\n countWords,\n derivePassage,\n freezePassage,\n generatedNameOf,\n withGeneratedName,\n} from './passage.js';\nimport type { GeneratedName } from './passage.js';\nimport { trimTweeSpace } from './twee-syntax.js';\nimport type { DecodeIssue, DecodeIssueKind, TextDecodeResult } from './json-decode.js';\nimport { pushAll } from './util.js';\nimport {\n field,\n type Decoder,\n type FieldReader,\n type JsonValue,\n jsonArrayOf,\n jsonNumber,\n jsonRecordOf,\n jsonString,\n nullAsZero,\n ownRecord,\n readObjectText,\n} from './json-decode.js';\n\n// --- Passage name index ---\n\n/**\n * A story's passage positions by name, for O(1) lookups. Only the functions of this module change\n * `story.passages` in place, and they keep the index up to date. Assigning `story.passages` a new array (as\n * the compiler does after applying tag aliases) is noticed by its identity and length, and the index rebuilt.\n */\ninterface NameIndex {\n /** The array the index describes. */\n readonly passages: readonly Passage[];\n /** Its length when the index was last updated. */\n length: number;\n /** Position by name; with duplicate names in the array, the last position. */\n readonly positions: Map<string, number>;\n}\n\nconst passageIndex = new WeakMap<Story, NameIndex>();\n\nfunction buildIndex(story: Story): NameIndex {\n const positions = new Map(story.passages.map((p, i) => [p.name, i]));\n const index: NameIndex = { passages: story.passages, length: story.passages.length, positions };\n passageIndex.set(story, index);\n return index;\n}\n\n/** The index, rebuilt if `story.passages` was reassigned or changed length. */\nfunction currentIndex(story: Story): NameIndex {\n const index = passageIndex.get(story);\n return index?.passages === story.passages && index.length === story.passages.length ? index : buildIndex(story);\n}\n\n/** The position of the passage named `name`, or -1. A hit is checked against the passage there. */\nfunction position(story: Story, name: string): number {\n const i = currentIndex(story).positions.get(name);\n if (i === undefined) return -1;\n if (story.passages[i]?.name === name) return i;\n return buildIndex(story).positions.get(name) ?? -1;\n}\n\n/** Add a passage whose name no passage has yet at the end. */\nfunction push(story: Story, p: Passage): void {\n const index = currentIndex(story);\n index.positions.set(p.name, story.passages.length);\n story.passages.push(p);\n index.length = story.passages.length;\n}\n\n/** Put a passage at position `i`, in place of the passage there. */\nfunction replaceAt(story: Story, i: number, p: Passage): void {\n const renamed = story.passages[i]?.name !== p.name;\n story.passages[i] = p;\n if (renamed) buildIndex(story);\n}\n\n/** Take the passage at position `i` out. */\nfunction removeAt(story: Story, i: number): void {\n story.passages.splice(i, 1);\n buildIndex(story);\n}\n\n// --- Generated passage names ---\n\n/** Names of compiler special passages, which storyAdd() reads into the story model. */\nconst SPECIAL_PASSAGE_NAMES: ReadonlySet<string> = new Set([\n 'StoryData',\n 'StoryIncludes',\n 'StorySettings',\n 'StoryTitle',\n]);\n\n/** The first of `base`, `base 2`, `base 3`, … that `isFree` accepts. */\nexport function freeName(base: string, isFree: (name: string) => boolean): string {\n if (isFree(base)) return base;\n for (let n = 2; ; n++) {\n const candidate = `${base} ${n}`;\n if (isFree(candidate)) return candidate;\n }\n}\n\n/** Whether a generated name may take `name`: no passage has it and it is no special name. */\nfunction isFreeForGenerated(story: Story, name: string): boolean {\n return !SPECIAL_PASSAGE_NAMES.has(name) && position(story, name) === -1;\n}\n\nfunction reportRename(origin: GeneratedName, from: string, to: string, diagnostics: Diagnostic[]): void {\n switch (origin.kind) {\n case 'code':\n return;\n case 'media': {\n const reason = SPECIAL_PASSAGE_NAMES.has(from)\n ? `\"${from}\" is a compiler special passage name`\n : `another passage has the name \"${from}\"`;\n diagnostics.push({\n level: 'warning',\n message: `Passage \"${from}\" from \"${origin.file}\" renamed to \"${to}\"; ${reason}.`,\n });\n return;\n }\n default: {\n const _exhaustive: never = origin;\n throw new Error(`unhandled generated name: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n\n/** Add a passage with a generated name, under the first free name if its own is taken. */\nfunction addGenerated(story: Story, p: Passage, origin: GeneratedName, diagnostics: Diagnostic[]): void {\n if (isFreeForGenerated(story, p.name)) {\n push(story, p);\n return;\n }\n const name = freeName(origin.base, (n) => isFreeForGenerated(story, n));\n reportRename(origin, p.name, name, diagnostics);\n push(story, withGeneratedName(derivePassage(p, { name }), origin));\n}\n\n/**\n * If a passage with a generated name has `name`, give it the first free name, in its place in the\n * passage list, so that a passage from the sources can take the name.\n */\nfunction moveGeneratedAside(story: Story, name: string, diagnostics: Diagnostic[]): void {\n const i = position(story, name);\n const existing = i === -1 ? undefined : story.passages[i];\n const origin = existing === undefined ? undefined : generatedNameOf(existing);\n if (existing === undefined || origin === undefined) return;\n const free = freeName(origin.base, (n) => isFreeForGenerated(story, n));\n reportRename(origin, name, free, diagnostics);\n replaceAt(story, i, withGeneratedName(derivePassage(existing, { name: free }), origin));\n}\n\n// --- Story ---\n\nfunction defaultTwine2Metadata(): Twine2Metadata {\n return {\n format: '',\n formatVersion: '',\n options: new Map(),\n start: '',\n tags: '',\n tagColors: new Map(),\n zoom: 1,\n };\n}\n\n/** No IFID: the empty string. Only the empty string is ever branded without validation. */\nconst NO_IFID = normalizeIFID('');\n\nexport function createStory(): Story {\n const story: Story = {\n name: '',\n ifid: NO_IFID,\n passages: [],\n legacyIFID: NO_IFID,\n twine1: { settings: new Map() },\n twine2: defaultTwine2Metadata(),\n };\n buildIndex(story);\n return story;\n}\n\nexport function storyHas(story: Story, name: string): boolean {\n return position(story, name) !== -1;\n}\n\nexport function storyGet(story: Story, name: string): Passage | undefined {\n const i = position(story, name);\n return i === -1 ? undefined : story.passages[i];\n}\n\n// --- Diagnostics with source locations ---\n\n/** Where a passage came from, for a diagnostic: `{ file, line }`, or nothing for a passage made in memory. */\nfunction at(source: SourceLocation | undefined): { file?: string; line?: number } {\n return source === undefined ? {} : { file: source.file, line: source.line };\n}\n\n/**\n * The warning for `p` replacing `existing`. It is located at `p`, and says where the replaced passage was, so\n * that both copies can be found.\n */\nfunction duplicateWarning(existing: Passage | undefined, p: Passage): Diagnostic {\n const source = existing?.source;\n const where = source === undefined ? '' : ` It replaces the one from ${source.file} (line ${source.line}).`;\n return {\n level: 'warning',\n message: `Replacing existing passage \"${p.name}\" with duplicate.${where}`,\n ...at(p.source),\n };\n}\n\n// --- StoryData JSON ---\n\nexport function marshalStoryData(story: ReadonlyStory): string {\n const options = [...story.twine2.options].flatMap(([opt, on]) => (on ? [opt] : []));\n // Keys in the order Tweego writes them; each only when set. `tag-colors` keys are own properties.\n const data = {\n ...(story.ifid ? { ifid: story.ifid } : {}),\n ...(story.twine2.format ? { format: story.twine2.format } : {}),\n ...(story.twine2.formatVersion ? { 'format-version': story.twine2.formatVersion } : {}),\n ...(options.length > 0 ? { options } : {}),\n ...(story.twine2.start ? { start: story.twine2.start } : {}),\n ...(story.twine2.tags ? { tags: story.twine2.tags } : {}),\n ...(story.twine2.tagColors.size > 0 ? { 'tag-colors': ownRecord(story.twine2.tagColors) } : {}),\n ...(story.twine2.zoom !== 1 ? { zoom: story.twine2.zoom } : {}),\n };\n return JSON.stringify(data, null, '\\t');\n}\n\n/** The StoryData read; its issues are about fields left out or keys read as another (see `storyDataIssueLevel`). */\ntype StoryDataDecodeResult = TextDecodeResult<{ readonly ifid: IFID; readonly twine2: Twine2Metadata }>;\n\n/**\n * Decode the text of a StoryData passage, as Tweego decodes it into its `storyDataJSON` struct with Go's\n * `encoding/json`:\n *\n * - Keys match the field names regardless of letter case (`IFID` is `ifid`); a repeated key takes the last\n * value, except that a repeated `tag-colors` object is merged into the earlier one and a repeated `options`\n * array fills the earlier one's slots. `null` leaves a string or number as it was (its default when first), and\n * clears `options` and `tag-colors`. Every field the text leaves out has its default.\n * - A field of the wrong type is left out (`zoom: \"2\"`); Tweego stops with an error there.\n * - An unknown key is left out (as in Tweego); `tags` (the Twine 2 story tags) is read, which Tweego does not.\n * - A `zoom` of 0 is the default zoom, 1.\n *\n * Every field left out and every key read as another one gives an issue. Text that is not a JSON object gives\n * `ok: false`.\n */\nexport function decodeStoryData(text: string): StoryDataDecodeResult {\n const twine2 = defaultTwine2Metadata();\n let ifid = NO_IFID;\n // Go's decoder reads `null` into a scalar as \"leave it\", and into a map or slice as \"clear it\". A repeated\n // map is merged into the one read before; a repeated array decodes into the slots of the one read before.\n const scalar = <T>(decoder: Decoder<T>, assign: (value: T) => void): FieldReader =>\n field(decoder, assign, { onNull: 'keep' });\n const slots: string[] = [];\n const read = readObjectText(text, {\n keys: 'go',\n fields: {\n ifid: scalar(jsonString, (v) => {\n ifid = normalizeIFID(v);\n }),\n format: scalar(jsonString, (v) => {\n twine2.format = v;\n }),\n 'format-version': scalar(jsonString, (v) => {\n twine2.formatVersion = v;\n }),\n options: {\n read(value, path, issues) {\n if (value === null) {\n slots.length = 0;\n twine2.options = new Map();\n return;\n }\n if (!Array.isArray(value)) {\n jsonArrayOf(jsonString)(value, path, issues);\n return;\n }\n const items: readonly JsonValue[] = value;\n // Go replaces the slice with a new empty one for `[]`, so its old slots are gone.\n if (items.length === 0) slots.length = 0;\n const kept = items.flatMap((item, i) => {\n if (item === null) return [slots[i] ?? ''];\n const r = jsonString(item, [...path, i], issues);\n if (r.ok) slots[i] = r.value;\n return r.ok ? [r.value] : [];\n });\n twine2.options = new Map(kept.map((o) => [o, true]));\n },\n },\n start: scalar(jsonString, (v) => {\n twine2.start = v;\n }),\n tags: scalar(jsonString, (v) => {\n twine2.tags = v;\n }),\n 'tag-colors': {\n read(value, path, issues) {\n if (value === null) {\n twine2.tagColors = new Map();\n return;\n }\n const r = jsonRecordOf(nullAsZero(jsonString, ''))(value, path, issues);\n if (r.ok) twine2.tagColors = new Map([...twine2.tagColors, ...r.value]);\n },\n },\n zoom: scalar(jsonNumber, (v) => {\n twine2.zoom = v === 0 ? 1 : v;\n }),\n },\n });\n return read.ok ? { ok: true, ifid, twine2, issues: read.issues } : read;\n}\n\n/**\n * How a StoryData issue is reported. A wrong-typed value is an error, since Tweego stops there and the story\n * would otherwise be built with another format, start or IFID than the author wrote. The rest are warnings:\n * the value is used (a case variant or repeated key) or was never part of StoryData (an unknown key), but the\n * StoryData passage is rewritten without it.\n */\nfunction storyDataIssueLevel(kind: DecodeIssueKind): Diagnostic['level'] {\n switch (kind) {\n case 'type':\n return 'error';\n case 'unknown-key':\n case 'case-variant-key':\n case 'duplicate-key':\n return 'warning';\n default: {\n const _exhaustive: never = kind;\n throw new Error(`unhandled decode issue kind: ${String(_exhaustive)}`);\n }\n }\n}\n\nfunction storyDataIssueMessage(issue: DecodeIssue): string {\n switch (issue.kind) {\n case 'type':\n return `\"StoryData\" ${issue.message}; the field is left out.`;\n case 'unknown-key':\n return `\"StoryData\" ${issue.message}; it is left out.`;\n case 'case-variant-key':\n case 'duplicate-key':\n return `\"StoryData\" ${issue.message}.`;\n default: {\n const _exhaustive: never = issue.kind;\n throw new Error(`unhandled decode issue kind: ${String(_exhaustive)}`);\n }\n }\n}\n\n// --- StorySettings (legacy) ---\n\n/** Lower case as Go's `bytes.ToLower`: each code point mapped on its own (U+0130 İ to i, Σ always to σ). */\nfunction goToLower(s: string): string {\n let out = '';\n for (const ch of s) out += ch === 'İ' ? 'i' : ch.toLowerCase();\n return out;\n}\n\ninterface StorySettingsData {\n readonly settings: ReadonlyMap<string, string>;\n /** The IFID of a valid `ifid` entry, or empty. */\n readonly legacyIFID: IFID;\n /** Lines with no `:`, which are skipped. */\n readonly malformed: readonly string[];\n /** The obsolete keys found (`ifid`, `zoom`), quoted, in order. */\n readonly obsolete: readonly string[];\n}\n\n/**\n * Decode the text of a StorySettings passage, as Tweego does: each line that holds a `:` is a `key:value`\n * pair, both trimmed and lower-cased; a repeated key takes the last value. `ifid` and `zoom` are obsolete:\n * a valid `ifid` is kept as the legacy IFID, and neither is a setting.\n */\nfunction decodeStorySettings(text: string): StorySettingsData {\n const settings = new Map<string, string>();\n const malformed: string[] = [];\n const obsolete: string[] = [];\n let legacyIFID = NO_IFID;\n for (const rawLine of text.split('\\n')) {\n const line = trimTweeSpace(rawLine);\n if (line.length === 0) continue;\n const colon = line.indexOf(':');\n if (colon === -1) {\n malformed.push(line);\n continue;\n }\n const key = goToLower(trimTweeSpace(line.slice(0, colon)));\n const val = goToLower(trimTweeSpace(line.slice(colon + 1)));\n switch (key) {\n case 'ifid':\n if (validateIFID(val) === null) legacyIFID = normalizeIFID(val);\n obsolete.push('\"ifid\"');\n break;\n case 'zoom':\n obsolete.push('\"zoom\"');\n break;\n default:\n // Any other key is a setting.\n settings.set(key, val);\n break;\n }\n }\n return { settings, legacyIFID, malformed, obsolete };\n}\n\nfunction storySettingsDiagnostics(data: StorySettingsData, source: SourceLocation | undefined): Diagnostic[] {\n const diagnostics: Diagnostic[] = data.malformed.map((line) => ({\n level: 'warning',\n message: `Malformed \"StorySettings\" entry; skipping \"${line}\".`,\n ...at(source),\n }));\n if (data.obsolete.length > 0) {\n const entries = data.obsolete.length === 1 ? 'entry' : 'entries';\n const pronoun = data.obsolete.length === 1 ? 'it' : 'them';\n diagnostics.push({\n level: 'warning',\n message:\n `Detected obsolete \"StorySettings\" ${entries}: ${data.obsolete.join(', ')}. ` +\n `Please remove ${pronoun} from the \"StorySettings\" special passage.`,\n ...at(source),\n });\n }\n return diagnostics;\n}\n\n/**\n * Set the StorySettings part of the story's metadata (`twine1.settings` and `legacyIFID`) from the text of a\n * StorySettings passage, replacing what an earlier one set.\n */\nexport function unmarshalStorySettings(story: Story, text: string, diagnostics: Diagnostic[]): void {\n const data = decodeStorySettings(text);\n story.twine1 = { settings: new Map(data.settings) };\n story.legacyIFID = data.legacyIFID;\n pushAll(diagnostics, storySettingsDiagnostics(data, undefined));\n}\n\n// --- Story metadata from special passages ---\n\n/** The parts of a story that its special passages decide. */\nexport type StoryMetadata = Pick<Story, 'name' | 'ifid' | 'legacyIFID' | 'twine1' | 'twine2'>;\n\n/**\n * Set the part of the story metadata that a special passage decides from that passage alone, and return the\n * passage as the story stores it (a StoryTitle trimmed; a StoryData that decodes rewritten from what was\n * read, as Tweego does, so that every field it left out was reported). Any other passage is returned as is.\n */\nfunction readSpecialPassage(story: Story, p: Passage, diagnostics: Diagnostic[]): Passage {\n switch (p.name) {\n case 'StoryIncludes':\n diagnostics.push({\n level: 'warning',\n message:\n 'Ignoring \"StoryIncludes\" compiler special passage; twee-ts allows you to specify project files and/or directories to recursively search.',\n ...at(p.source),\n });\n return p;\n\n case 'StoryData': {\n const decoded = decodeStoryData(p.text);\n if (!decoded.ok) {\n // The passage still replaces any earlier StoryData, so the story has none of its metadata.\n story.ifid = NO_IFID;\n story.twine2 = defaultTwine2Metadata();\n diagnostics.push({\n level: 'error',\n message: `Cannot unmarshal \"StoryData\" compiler special passage; ${decoded.reason}. Its metadata (IFID, format, start, …) is not used.`,\n ...at(p.source),\n });\n return p;\n }\n story.ifid = decoded.ifid;\n story.twine2 = decoded.twine2;\n for (const issue of decoded.issues) {\n diagnostics.push({\n level: storyDataIssueLevel(issue.kind),\n message: storyDataIssueMessage(issue),\n ...at(p.source),\n });\n }\n const ifidError = decoded.ifid.length > 0 ? validateIFID(decoded.ifid) : null;\n if (ifidError !== null) {\n diagnostics.push({ level: 'error', message: `Cannot validate IFID; ${ifidError}.`, ...at(p.source) });\n }\n return derivePassage(p, { text: marshalStoryData(story) });\n }\n\n case 'StorySettings': {\n const data = decodeStorySettings(p.text);\n story.twine1 = { settings: new Map(data.settings) };\n story.legacyIFID = data.legacyIFID;\n pushAll(diagnostics, storySettingsDiagnostics(data, p.source));\n return p;\n }\n\n case 'StoryTitle': {\n const name = trimTweeSpace(p.text);\n story.name = name;\n return derivePassage(p, { text: name });\n }\n\n default:\n // Any other name is an ordinary passage.\n return p;\n }\n}\n\n/** Put the part of the story metadata that the special passage `name` decides back to its defaults. */\nfunction clearSpecialPassage(story: Story, name: string): void {\n switch (name) {\n case 'StoryData':\n story.ifid = NO_IFID;\n story.twine2 = defaultTwine2Metadata();\n return;\n case 'StorySettings':\n story.twine1 = { settings: new Map() };\n story.legacyIFID = NO_IFID;\n return;\n case 'StoryTitle':\n story.name = '';\n return;\n default:\n // Other passages decide nothing.\n return;\n }\n}\n\n/**\n * The story metadata that a list of passages decides: what its StoryTitle, StoryData and StorySettings\n * passages say, or the defaults for each one that is missing. When a name is repeated, the last passage\n * decides, as it would replace the others. Pure; diagnostics are not reported.\n */\nexport function deriveStoryMetadata(passages: readonly ReadonlyPassage[]): StoryMetadata {\n const story = createStory();\n for (const p of passages) {\n if (SPECIAL_PASSAGE_NAMES.has(p.name)) {\n readSpecialPassage(story, { name: p.name, tags: [...p.tags], text: p.text }, []);\n }\n }\n const { name, ifid, legacyIFID, twine1, twine2 } = story;\n return { name, ifid, legacyIFID, twine1, twine2 };\n}\n\n// --- Adding passages ---\n\n/**\n * Add `p` at the end (or the front), or in place of the passage with its name, with a warning that says\n * where both came from.\n */\nfunction storyPlace(story: Story, p: Passage, diagnostics: Diagnostic[], where: 'end' | 'front'): void {\n const i = position(story, p.name);\n if (i !== -1) {\n diagnostics.push(duplicateWarning(story.passages[i], p));\n replaceAt(story, i, p);\n } else if (where === 'end') {\n push(story, p);\n } else {\n story.passages.unshift(p);\n // Every position moves up by one.\n buildIndex(story);\n }\n}\n\n/**\n * Add a passage at the front, or in place of the passage with its name, with a warning. A special passage\n * added this way is not read into the metadata: the caller adds one that holds the story's metadata (a\n * StoryTitle with the story name, or a StoryData written from the story).\n */\nexport function storyPrepend(story: Story, p: Passage, diagnostics: Diagnostic[]): void {\n moveGeneratedAside(story, p.name, diagnostics);\n storyPlace(story, p, diagnostics, 'front');\n}\n\n/**\n * Add a passage to the story. A special passage (StoryTitle, StoryData, StorySettings, StoryIncludes) also\n * sets the part of the metadata it decides, replacing what an earlier one of its name set (see\n * `readSpecialPassage`). The input passage is not changed; the story may store a rewritten copy.\n *\n * A passage replaces an earlier one with the same name, except where either name was generated\n * (see `withGeneratedName()`): a generated name never replaces a passage and is never replaced.\n * A passage with a generated name takes the first free name of `base`, `base 2`, … when its own\n * is taken or is a compiler special name. A passage with a name from the sources that a generated\n * name holds takes it over, and the generated one moves to the first free name in its place.\n */\nexport function storyAdd(story: Story, p: Passage, diagnostics: Diagnostic[]): void {\n const origin = generatedNameOf(p);\n if (origin !== undefined) {\n addGenerated(story, p, origin, diagnostics);\n return;\n }\n moveGeneratedAside(story, p.name, diagnostics);\n storyPlace(story, readSpecialPassage(story, p, diagnostics), diagnostics, 'end');\n}\n\n/** Take the passage named `name` out of the story, with the metadata it decided. Returns it, if there was one. */\nfunction storyRemove(story: Story, name: string): Passage | undefined {\n const i = position(story, name);\n const p = story.passages[i];\n if (p === undefined) return undefined;\n removeAt(story, i);\n clearSpecialPassage(story, name);\n return p;\n}\n\n/**\n * Rename the passage named `from` to `to`, keeping its place. A passage already named `to` is replaced, with\n * a warning. Metadata follows the names: renaming a StoryData passage away removes its metadata, and\n * renaming a passage to StoryData reads it as StoryData. Returns false when no passage is named `from`.\n */\nfunction storyRename(story: Story, from: string, to: string, diagnostics: Diagnostic[]): boolean {\n const p = storyGet(story, from);\n if (p === undefined) return false;\n if (from === to) return true;\n const renamed = derivePassage(p, { name: to });\n const existing = storyGet(story, to);\n if (existing !== undefined) {\n diagnostics.push(duplicateWarning(existing, renamed));\n storyRemove(story, to);\n }\n clearSpecialPassage(story, from);\n // Its position after any removal above.\n replaceAt(story, position(story, from), readSpecialPassage(story, renamed, diagnostics));\n return true;\n}\n\n/**\n * Get story passage count and word count stats. A passage whose words could only be counted another way adds a\n * warning to `diagnostics` (see `countWords`).\n */\nexport function getStoryStats(\n story: Story,\n wordCountMethod: WordCountMethod = 'tweego',\n diagnostics: Diagnostic[] = [],\n): { passages: number; storyPassages: number; words: number } {\n let storyPassages = 0;\n let words = 0;\n for (const p of story.passages) {\n if (isStoryPassage(p)) {\n storyPassages++;\n words += countWords(p, wordCountMethod, diagnostics);\n }\n }\n return { passages: story.passages.length, storyPassages, words };\n}\n\n// --- StoryBuilder ---\n\n/** A copy of a passage that shares nothing with it; metadata keys stay own properties. */\nfunction copyPassage(p: ReadonlyPassage): Passage {\n return {\n name: p.name,\n tags: [...p.tags],\n text: p.text,\n ...(p.metadata === undefined ? {} : { metadata: ownRecord(Object.entries(p.metadata)) }),\n ...(p.source === undefined ? {} : { source: { file: p.source.file, line: p.source.line } }),\n };\n}\n\nfunction frozenPassage(p: ReadonlyPassage): ReadonlyPassage {\n return freezePassage(copyPassage(p));\n}\n\n/** A frozen copy of the story: later changes to it do not reach the copy, and the copy cannot be changed. */\nexport function snapshot(story: Story): ReadonlyStory {\n return Object.freeze({\n name: story.name,\n ifid: story.ifid,\n legacyIFID: story.legacyIFID,\n passages: Object.freeze(story.passages.map(frozenPassage)),\n twine1: Object.freeze({ settings: new Map(story.twine1.settings) }),\n twine2: Object.freeze({\n ...story.twine2,\n options: new Map(story.twine2.options),\n tagColors: new Map(story.twine2.tagColors),\n }),\n });\n}\n\n/**\n * Builds a story from passages, as the compiler does: duplicates replace earlier passages (with a warning),\n * and the special passages StoryTitle, StoryData and StorySettings decide the story metadata.\n *\n * The story is changed only through the builder's methods, so its passage list, its name lookups and its\n * metadata always agree. Passages are copied in and out: changing a passage object after `add()`, or one that\n * `get()`, `passages` or `build()` returned, does not change the builder.\n */\nexport class StoryBuilder {\n readonly #story: Story = createStory();\n\n /** Add a passage, handling special passages (StoryData, StoryTitle, etc.) and duplicates. */\n add(passage: Passage, diagnostics: Diagnostic[]): void {\n storyAdd(this.#story, copyPassage(passage), diagnostics);\n }\n\n /** Whether a passage has this name. */\n has(name: string): boolean {\n return storyHas(this.#story, name);\n }\n\n /** The passage with this name (a frozen copy), or undefined. */\n get(name: string): ReadonlyPassage | undefined {\n const p = storyGet(this.#story, name);\n return p === undefined ? undefined : frozenPassage(p);\n }\n\n /**\n * Remove the passage with this name, and with it the metadata it decided (removing StoryData clears the\n * IFID, format and start). Returns false when no passage has the name.\n */\n remove(name: string): boolean {\n return storyRemove(this.#story, name) !== undefined;\n }\n\n /**\n * Rename a passage, keeping its place in the story. A passage that already has the new name is replaced,\n * with a warning, as a duplicate would be. Returns false when no passage has the old name.\n */\n rename(from: string, to: string, diagnostics: Diagnostic[]): boolean {\n return storyRename(this.#story, from, to, diagnostics);\n }\n\n /** The passages, in order (frozen copies). */\n get passages(): readonly ReadonlyPassage[] {\n return Object.freeze(this.#story.passages.map(frozenPassage));\n }\n\n /** The story as it is now, as a frozen copy that later changes to the builder do not reach. */\n build(): ReadonlyStory {\n return snapshot(this.#story);\n }\n}\n","/**\n * Extension → MIME type mapping.\n * Ported from util.go:mediaTypeFromExt().\n */\n\nimport { extname } from 'node:path';\n\nconst MEDIA_TYPE_MAP: Record<string, string> = {\n // Audio\n aac: 'audio/aac',\n flac: 'audio/flac',\n ogg: 'audio/ogg',\n wav: 'audio/wav',\n mp3: 'audio/mpeg',\n m4a: 'audio/mp4',\n oga: 'audio/ogg',\n opus: 'audio/ogg',\n wave: 'audio/wav',\n weba: 'audio/webm',\n\n // Fonts\n otf: 'font/otf',\n ttf: 'font/ttf',\n woff: 'font/woff',\n woff2: 'font/woff2',\n\n // Images\n gif: 'image/gif',\n jpeg: 'image/jpeg',\n jpg: 'image/jpeg',\n png: 'image/png',\n svg: 'image/svg+xml',\n tif: 'image/tiff',\n tiff: 'image/tiff',\n webp: 'image/webp',\n\n // Metadata\n vtt: 'text/vtt',\n\n // Video\n mp4: 'video/mp4',\n ogv: 'video/ogg',\n webm: 'video/webm',\n};\n\nexport function mediaTypeFromExt(ext: string): string {\n const type = Object.hasOwn(MEDIA_TYPE_MAP, ext) ? MEDIA_TYPE_MAP[ext] : undefined;\n return type ?? 'application/octet-stream';\n}\n\nexport function mediaTypeFromFilename(filename: string): string {\n return mediaTypeFromExt(normalizedFileExt(filename));\n}\n\nexport function normalizedFileExt(filename: string): string {\n const ext = extname(filename);\n if (!ext) return '';\n return ext.slice(1).toLowerCase();\n}\n\n/** Slugify a string for safe use as a DOM ID. */\nexport function slugify(original: string): string {\n return original.replace(/[\\x00-\\x20!-/:-@[-^`{-\\x9f]+/g, '_');\n}\n\n/** Check if a file has a known type that should be processed. */\nexport function isKnownFileType(filename: string): boolean {\n const ext = normalizedFileExt(filename);\n return KNOWN_EXTENSIONS.has(ext);\n}\n\nconst KNOWN_EXTENSIONS = new Set([\n 'tw',\n 'twee',\n 'tw2',\n 'twee2',\n 'htm',\n 'html',\n 'css',\n 'js',\n 'otf',\n 'ttf',\n 'woff',\n 'woff2',\n 'gif',\n 'jpeg',\n 'jpg',\n 'png',\n 'svg',\n 'tif',\n 'tiff',\n 'webp',\n 'aac',\n 'flac',\n 'm4a',\n 'mp3',\n 'oga',\n 'ogg',\n 'opus',\n 'wav',\n 'wave',\n 'weba',\n 'mp4',\n 'ogv',\n 'webm',\n 'vtt',\n]);\n\n/** Font format hint for @font-face. */\nexport function fontFormatHint(ext: string): string {\n switch (ext) {\n case 'ttf':\n return 'truetype';\n case 'otf':\n return 'opentype';\n default:\n return ext;\n }\n}\n","/**\n * Canonical path identity: one answer to \"is this the same file?\" for every part of twee-ts that\n * compares paths (source discovery, exclude globs, the incremental cache, the watchers, the\n * output-overlap checks, the bundler plugins and the paths reported to users).\n *\n * A path is identified by {@link identify}, which gives a {@link PathIdentity}:\n *\n * - `authored`: the path exactly as the caller wrote it.\n * - `absolute`: `authored` resolved lexically against the working directory. Links are not followed.\n * - `canonical`: the real path. The deepest ancestor that exists is resolved with every symbolic\n * link in it followed (`realpath`), and the components below it that don't exist yet are\n * appended as written. A dangling link is followed to where its target would be, link by link,\n * so the output named through a dangling link has the identity of the file a write would create.\n * On Windows the drive letter is upper-cased and the `\\\\?\\` and `\\\\?\\UNC\\` prefixes are dropped.\n * It is a path that can be opened.\n * - `key`: the comparison key. It is `canonical`, with letter case folded when the volume that\n * holds the path compares names without case (see below), and with a UNC server and share name\n * folded on Windows. Two paths name the same file exactly when their keys are equal. A key is\n * not meant to be opened or shown.\n * - `display`: the form for messages and for exclude globs. It is the path relative to the working\n * directory when the file is inside it, comparing the written paths first and the real paths\n * second (so a working directory reached through a link, such as macOS's `/var` and\n * `/private/var`, still gives a relative path; a link to a file keeps its own name there when\n * its folder is inside, else it is shown by its target). A file outside the working directory keeps the\n * lexical relative path (`../other/a.tw`), or an absolute path when no relative one exists (another\n * Windows drive). It uses the platform's separators.\n * - `caseInsensitive`: whether the volume compares names without case.\n *\n * Case-insensitive volumes are detected per volume, not assumed per operating system: macOS and\n * Windows volumes can be case-sensitive, and Linux can mount case-insensitive ones (vfat, exFAT,\n * ext4 with casefold, SMB shares). A volume is probed once, by looking up an existing name of a\n * folder on it with its letter case flipped and checking whether the same file answers. When no\n * name on the volume has a letter to flip, the platform's usual answer is used (insensitive on\n * Windows and macOS). The answer is cached per volume (`stat().dev`). Limits: a volume whose\n * folders differ in case sensitivity (ext4 casefold set per folder, Windows per-folder case\n * sensitivity) gets the answer of the first folder probed on it; and names are not compared\n * after Unicode normalization (macOS volumes are normalization-insensitive), which only matters\n * for path components that don't exist yet, since `realpath` returns the stored form of the rest.\n *\n * Exclude globs ({@link matchesExclude}) are matched against `display` (and the real path relative\n * to the working directory when that differs), and an absolute glob against `absolute` and\n * `canonical`, with Node's `path.matchesGlob`. On a case-insensitive volume the whole match ignores\n * case. Elsewhere only the file extension does, as the loader reads `Photo.PNG` as a PNG image: the\n * extension of the glob's last segment (the text after its last `.`, a plain run of characters or one\n * `{…}` group) is compared without case.\n *\n * Everything that touches the file system goes through an {@link IdentityFileSystem}, and the path\n * flavour (POSIX or Windows) is a parameter, so {@link createPathIdentifier} can be tested with a fake\n * file system for either platform. The module-level functions use the real file system, the\n * platform's own path flavour and `process.cwd()` at the time of each call.\n */\nimport { lstatSync, opendirSync, readlinkSync, realpathSync } from 'node:fs';\nimport * as nodePath from 'node:path';\nimport type { ExcludeGlob } from './types.js';\n/** A path flavour: `path.posix` or `path.win32`. */\nexport type PathFlavour = typeof nodePath.posix;\n\n/** What {@link identify} says about a path. See the module comment for each field. */\nexport interface PathIdentity {\n readonly authored: string;\n readonly absolute: string;\n readonly canonical: string;\n readonly key: string;\n readonly display: string;\n readonly caseInsensitive: boolean;\n}\n\n/** The facts about a directory entry the identity needs: no throw for a missing or unreadable entry. */\nexport interface IdentityStat {\n readonly dev: bigint;\n readonly ino: bigint;\n isSymbolicLink(): boolean;\n isDirectory(): boolean;\n}\n\n/** The file-system queries path identity makes. The real one wraps `node:fs`; tests pass a fake. */\nexport interface IdentityFileSystem {\n /** The real path of an existing path, every link resolved. Throws when it can't be resolved. */\n realpath(path: string): string;\n /** The entry at `path` itself (a link is not followed), or undefined when it can't be read. */\n lstat(path: string): IdentityStat | undefined;\n /** The target a symbolic link holds, as written in it. Throws when it is no readable link. */\n readlink(path: string): string;\n /** Up to `limit` names in the folder `dir`, or none when it can't be read. */\n readdir(dir: string, limit: number): readonly string[];\n}\n\n/** How a {@link PathIdentifier} is set up. Every field has a default for the running process. */\nexport interface PathIdentifierOptions {\n /** The path flavour: `path.posix` or `path.win32`. Default: the platform's. */\n readonly path?: PathFlavour;\n /** Default: the real file system. */\n readonly fs?: IdentityFileSystem;\n /** The working directory, read on each call. Default: `process.cwd()`. */\n readonly cwd?: () => string;\n /**\n * The answer for a volume with no name to probe (no letter in any name on it). Default: true on\n * Windows and macOS, false elsewhere.\n */\n readonly defaultCaseInsensitive?: boolean;\n}\n\n/** Path identity bound to one file system, path flavour and working directory. */\nexport interface PathIdentifier {\n /** The identity of `path`, a path written by a user or found on disk. */\n identify(path: string): PathIdentity;\n /** Whether `a` and `b` name the same file: their keys are equal. */\n sameFile(a: string, b: string): boolean;\n /** Whether `inner` is `outer` or inside it, comparing keys. */\n isSameOrInside(inner: string, outer: string): boolean;\n /** Whether the file is matched by one of the exclude globs. See the module comment. */\n matchesExclude(identity: PathIdentity, globs: readonly (string | ExcludeGlob)[]): boolean;\n /** Forgets which volumes were found case-insensitive (a volume may have been remounted). */\n clearCache(): void;\n}\n\n/** Links followed before a path counts as a cycle (Linux stops at 40 as well). */\nconst MAX_LINK_DEPTH = 40;\n\n/** Names read from a folder to find one to probe with: enough to find a letter, few enough to be cheap. */\nconst PROBE_ENTRIES = 64;\n\n/** Case-folds a string per code point, keeping a code point whose lower case has another length. */\nexport function foldCase(text: string): string {\n let folded = '';\n for (const ch of text) {\n const lower = ch.toLowerCase();\n // Simple folding only: a lower case of another length (İ to i̇) is not used.\n folded += lower.length === ch.length ? lower : ch;\n }\n return folded;\n}\n\n/** `name` with the case of every cased letter swapped, to probe a volume with. */\nexport function flipCase(name: string): string {\n let flipped = '';\n for (const ch of name) {\n const upper = ch.toUpperCase();\n flipped += upper === ch ? ch.toLowerCase() : upper;\n }\n return flipped;\n}\n\n/**\n * A Windows path in one spelling: no `\\\\?\\` or `\\\\?\\UNC\\` prefix, backslashes, an upper-case drive\n * letter. `path` must be absolute.\n */\nexport function normalizeWindowsPath(path: string): string {\n let p = path.replace(/\\//g, '\\\\');\n if (/^\\\\\\\\\\?\\\\UNC\\\\/i.test(p)) p = `\\\\\\\\${p.slice(8)}`;\n else if (/^\\\\\\\\\\?\\\\[a-z]:/i.test(p)) p = p.slice(4);\n return p.replace(/^[a-z](?=:)/, (drive) => drive.toUpperCase());\n}\n\n/** A Windows key: the UNC server and share names compare without case, whatever the volume. */\nfunction foldUncRoot(path: string): string {\n return path.replace(/^\\\\\\\\[^\\\\]+\\\\[^\\\\]+/, (root) => foldCase(root));\n}\n\n/** Whether the key `inner` is the key `outer` or below it, for keys in the flavour with separator `sep`. */\nexport function isKeyInside(inner: string, outer: string, sep: string): boolean {\n if (inner === outer) return true;\n return inner.startsWith(outer.endsWith(sep) ? outer : outer + sep);\n}\n\n/** Whether a relative path stays inside the folder it is relative to. */\nfunction isInsideRelative(rel: string, path: PathFlavour): boolean {\n return rel !== '..' && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel);\n}\n\n/**\n * The glob with the extension of its last segment lower-cased, for matching a path whose extension\n * is lower-cased too; undefined when the last segment has no extension in a form this understands\n * (a plain run of characters, or a single `{…}` group, after the last `.`).\n */\nexport function lowerGlobExtension(pattern: string): string | undefined {\n const lastSep = Math.max(pattern.lastIndexOf('/'), pattern.lastIndexOf('\\\\'));\n const dot = pattern.lastIndexOf('.');\n if (dot <= lastSep) return undefined;\n const tail = pattern.slice(dot + 1);\n if (!/^(?:\\{[^{}/\\\\]*\\}|[^{},/\\\\]*)$/.test(tail)) return undefined;\n return pattern.slice(0, dot + 1) + tail.toLowerCase();\n}\n\n/** `path` with the extension of its last component lower-cased. */\nfunction lowerPathExtension(path: string, flavour: PathFlavour): string {\n const ext = flavour.extname(path);\n return ext === '' ? path : path.slice(0, path.length - ext.length) + ext.toLowerCase();\n}\n\n/** The real file system, as path identity queries it. */\nexport const nodeIdentityFileSystem: IdentityFileSystem = {\n realpath: (path) => realpathSync.native(path),\n lstat(path) {\n try {\n return lstatSync(path, { bigint: true, throwIfNoEntry: false });\n } catch {\n // Unreadable (a folder above it can't be searched): treated as missing.\n return undefined;\n }\n },\n readlink: (path) => readlinkSync(path),\n readdir(dir, limit) {\n const names: string[] = [];\n try {\n const handle = opendirSync(dir);\n try {\n for (let entry = handle.readSync(); entry !== null && names.length < limit; entry = handle.readSync()) {\n names.push(entry.name);\n }\n } finally {\n handle.closeSync();\n }\n } catch {\n // An unreadable folder has no name to probe with.\n }\n return names;\n },\n};\n\n/** The result of resolving a path: its real path, and the deepest part of it that exists. */\ninterface Resolved {\n readonly canonical: string;\n /** The real path of the deepest ancestor (or the path itself) that exists; '' when none does. */\n readonly existing: string;\n}\n\n/** Creates path identity for one file system, path flavour and working directory. */\nexport function createPathIdentifier(options: PathIdentifierOptions = {}): PathIdentifier {\n const flavour = options.path ?? nodePath;\n const fs = options.fs ?? nodeIdentityFileSystem;\n const cwd = options.cwd ?? (() => process.cwd());\n const windows = flavour.sep === '\\\\';\n const defaultInsensitive =\n options.defaultCaseInsensitive ??\n (windows || (flavour === nodePath && (process.platform === 'darwin' || process.platform === 'win32')));\n const byVolume = new Map<bigint, boolean>();\n\n const tidy = (path: string): string => (windows ? normalizeWindowsPath(path) : path);\n\n function realpathOrUndefined(path: string): string | undefined {\n try {\n return tidy(fs.realpath(path));\n } catch {\n return undefined;\n }\n }\n\n function readlinkOrUndefined(path: string): string | undefined {\n try {\n return fs.readlink(path);\n } catch {\n // Replaced by something else since it was found to be a link.\n return undefined;\n }\n }\n\n /** `abs` resolved: followed through every link that exists, dangling ones included. */\n function resolvePath(abs: string, depth: number): Resolved {\n const real = realpathOrUndefined(abs);\n if (real !== undefined) return { canonical: real, existing: real };\n const parent = flavour.dirname(abs);\n if (parent === abs) return { canonical: abs, existing: '' };\n const above = resolvePath(parent, depth);\n const here = flavour.join(above.canonical, flavour.basename(abs));\n const stat = fs.lstat(here);\n if (stat?.isSymbolicLink() && depth < MAX_LINK_DEPTH) {\n // A link whose target is missing: follow it to where the target would be. A relative target is\n // relative to the folder that really holds the link, not to the path written.\n const target = readlinkOrUndefined(here);\n if (target !== undefined) {\n const next = resolvePath(tidy(flavour.resolve(above.canonical, target)), depth + 1);\n return { canonical: next.canonical, existing: next.existing === '' ? above.existing : next.existing };\n }\n }\n // Missing (or a link cycle, or unreadable): the rest of the path is kept as written.\n return { canonical: here, existing: stat === undefined ? above.existing : here };\n }\n\n /** Whether lookups of `name` in the folder `dir` ignore case; undefined when `name` can't tell. */\n function probeName(dir: string, name: string): boolean | undefined {\n const flipped = flipCase(name);\n if (flipped === name) return undefined;\n const original = fs.lstat(flavour.join(dir, name));\n if (original === undefined) return undefined;\n const other = fs.lstat(flavour.join(dir, flipped));\n return other?.dev === original.dev && other.ino === original.ino;\n }\n\n /** Whether the volume holding the existing folder `dir` compares names without case. */\n function volumeIsInsensitive(dir: string): boolean {\n const stat = fs.lstat(dir);\n if (stat === undefined) return defaultInsensitive;\n const cached = byVolume.get(stat.dev);\n if (cached !== undefined) return cached;\n let answer: boolean | undefined;\n // A name in the folder itself, else the folder's own name in the folder above, while that is on\n // the same volume, and so on up.\n for (const name of fs.readdir(dir, PROBE_ENTRIES)) {\n answer = probeName(dir, name);\n if (answer !== undefined) break;\n }\n for (let below = dir, above = flavour.dirname(dir); answer === undefined && above !== below;) {\n if (fs.lstat(above)?.dev !== stat.dev) break;\n answer = probeName(above, flavour.basename(below));\n below = above;\n above = flavour.dirname(above);\n }\n const result = answer ?? defaultInsensitive;\n byVolume.set(stat.dev, result);\n return result;\n }\n\n function caseInsensitiveAt(existing: string): boolean {\n if (existing === '') return defaultInsensitive;\n const stat = fs.lstat(existing);\n return volumeIsInsensitive(stat?.isDirectory() === true ? existing : flavour.dirname(existing));\n }\n\n function keyOf(canonical: string, insensitive: boolean): string {\n const key = insensitive ? foldCase(canonical) : canonical;\n return windows ? foldUncRoot(key) : key;\n }\n\n function displayOf(absolute: string, canonical: string, canonicalCwd: () => string): string {\n const rel = flavour.relative(tidy(cwd()), absolute);\n if (isInsideRelative(rel, flavour)) return rel === '' ? '.' : rel;\n // Outside the working directory as written: try again between the real paths, first keeping the\n // file's own name (a link to a file is reported by its name, not its target's), then the target.\n const located = flavour.join(resolvePath(flavour.dirname(absolute), 0).canonical, flavour.basename(absolute));\n for (const candidate of [located, canonical]) {\n const realRel = flavour.relative(canonicalCwd(), candidate);\n if (isInsideRelative(realRel, flavour)) return realRel === '' ? '.' : realRel;\n }\n return rel;\n }\n\n function identify(authored: string): PathIdentity {\n const absolute = tidy(flavour.resolve(tidy(cwd()), authored));\n const resolved = resolvePath(absolute, 0);\n const caseInsensitive = caseInsensitiveAt(resolved.existing);\n let realCwd: string | undefined;\n const canonicalCwd = (): string => (realCwd ??= resolvePath(tidy(cwd()), 0).canonical);\n return {\n authored,\n absolute,\n canonical: resolved.canonical,\n key: keyOf(resolved.canonical, caseInsensitive),\n display: displayOf(absolute, resolved.canonical, canonicalCwd),\n caseInsensitive,\n };\n }\n\n function matchesExclude(identity: PathIdentity, globs: readonly (string | ExcludeGlob)[]): boolean {\n if (globs.length === 0) return false;\n const { matchesGlob } = flavour;\n const realRel = flavour.relative(resolvePath(tidy(cwd()), 0).canonical, identity.canonical);\n const relative = [identity.display, ...(isInsideRelative(realRel, flavour) ? [realRel] : [])];\n const absolute = [identity.absolute, identity.canonical];\n const fold = (text: string): string => (identity.caseInsensitive ? foldCase(text) : text);\n /** The file's paths below a literal folder: its spelling and its real path, each against the folder. */\n const below = (base: string): string[] => {\n const baseAbsolute = tidy(flavour.resolve(tidy(cwd()), base));\n const pairs: [string, string][] = [\n [baseAbsolute, identity.absolute],\n [resolvePath(baseAbsolute, 0).canonical, identity.canonical],\n ];\n return pairs\n .map(([from, to]) => flavour.relative(fold(from), fold(to)))\n .filter((rel) => rel !== '' && isInsideRelative(rel, flavour));\n };\n return globs.some((rule) => {\n const glob = typeof rule === 'string' ? rule : rule.glob;\n const pattern = glob.replace(/^\\.[/\\\\]/, '');\n const absolutePattern = flavour.isAbsolute(pattern);\n const candidates = absolutePattern ? absolute : typeof rule === 'string' ? relative : below(rule.base);\n if (identity.caseInsensitive) {\n const folded = foldCase(pattern);\n return candidates.some((candidate) => matchesGlob(foldCase(candidate), folded));\n }\n const lowered = lowerGlobExtension(pattern);\n return candidates.some(\n (candidate) =>\n matchesGlob(candidate, pattern) ||\n (lowered !== undefined && matchesGlob(lowerPathExtension(candidate, flavour), lowered)),\n );\n });\n }\n\n return {\n identify,\n sameFile: (a, b) => identify(a).key === identify(b).key,\n isSameOrInside: (inner, outer) => isKeyInside(identify(inner).key, identify(outer).key, flavour.sep),\n matchesExclude,\n clearCache: () => {\n byVolume.clear();\n },\n };\n}\n\n/** Path identity on the real file system, for the running platform and working directory. */\nconst defaultIdentifier = createPathIdentifier();\n\n/** The identity of `path` on the real file system. See {@link PathIdentifier.identify}. */\nexport function identify(path: string): PathIdentity {\n return defaultIdentifier.identify(path);\n}\n\n/** Whether `a` and `b` name the same file on the real file system. */\nexport function sameFile(a: string, b: string): boolean {\n return defaultIdentifier.sameFile(a, b);\n}\n\n/** Whether `inner` is `outer` or inside it on the real file system. */\nexport function isSameOrInside(inner: string, outer: string): boolean {\n return defaultIdentifier.isSameOrInside(inner, outer);\n}\n\n/** Whether one of `globs` excludes the file. See the module comment. */\nexport function matchesExclude(identity: PathIdentity, globs: readonly (string | ExcludeGlob)[]): boolean {\n return defaultIdentifier.matchesExclude(identity, globs);\n}\n\n/** Forgets the volumes probed so far. */\nexport function clearPathIdentityCache(): void {\n defaultIdentifier.clearCache();\n}\n","/**\n * What a build does when an input can't be used: one table for every input role and failure kind,\n * so that sources, modules, the head file and the config file fail the same way for the same cause\n * (and a source or module given twice is skipped with the same warning, see `duplicateInput()`),\n * and Tweego's choices are kept where Tweego makes one. docs/cli.md shows the same table.\n *\n * Levels:\n * - `ignore`: skipped without a word (Tweego skips these too).\n * - `warning`: skipped, with a warning.\n * - `error`: an error diagnostic. The build goes on, so every such problem is reported at once, but\n * the CLI writes nothing and exits with status 1.\n * - `fatal`: a TweeTsError before anything is built; nothing is written by any entry point.\n *\n * Every message names the role and the path and gives the cause: `load head file h.html: ENOENT: …`, or for\n * what source discovery finds while walking, as Tweego words it, `path a.tw: …` (`module path m.js: …`).\n */\nimport { lstatSync } from 'node:fs';\nimport type { Diagnostic } from './types.js';\n\n/** What an input is for. */\nexport type InputRole = 'source' | 'module' | 'head' | 'config';\n\n/** How an input was found: named by the user (CLI, config, options), or found walking a named folder. */\nexport type InputDiscovery = 'named' | 'found';\n\n/** Why an input can't be used. */\nexport type InputFailure =\n /** Nothing at the path (for a file found in a folder: it went away between the walk and the read). */\n | 'missing'\n /** The file can't be opened or read (permissions, I/O error). */\n | 'unreadable'\n /** A folder inside a source or module folder can't be listed. */\n | 'unreadable-folder'\n /** A folder where a file is needed. */\n | 'directory'\n /** A symbolic link whose target doesn't exist (an editor's lock file, say). */\n | 'dangling-link'\n /** A file whose extension the role doesn't load. */\n | 'unsupported-type'\n /** A FIFO, device or socket where a file of the role's types is needed. */\n | 'not-a-file'\n /** Bytes that can't be decoded (invalid UTF-16 after a UTF-16 byte order mark, or UTF-32). */\n | 'undecodable';\n\nexport type PolicyLevel = 'ignore' | 'warning' | 'error' | 'fatal';\n\n/** Every failure kind, in the order the docs list them. */\nexport const INPUT_FAILURES: readonly InputFailure[] = [\n 'missing',\n 'unreadable',\n 'unreadable-folder',\n 'directory',\n 'dangling-link',\n 'unsupported-type',\n 'not-a-file',\n 'undecodable',\n];\n\ntype FailurePolicy = Readonly<Record<InputFailure, PolicyLevel>>;\n\n/**\n * A named source or module folder is walked, not read: `directory` here is a file that was replaced by a\n * folder after the walk found it. The head and config files are read whatever their type and kind\n * (`--head <(…)` is a pipe), so their `unsupported-type` and `not-a-file` cells are `ignore`.\n */\nconst NAMED_LIST_INPUT: FailurePolicy = {\n missing: 'warning',\n unreadable: 'error',\n 'unreadable-folder': 'warning',\n directory: 'error',\n 'dangling-link': 'warning',\n 'unsupported-type': 'warning',\n 'not-a-file': 'warning',\n undecodable: 'error',\n};\n\nconst FOUND_LIST_INPUT: FailurePolicy = {\n missing: 'warning',\n unreadable: 'error',\n 'unreadable-folder': 'warning',\n directory: 'error',\n 'dangling-link': 'ignore',\n 'unsupported-type': 'ignore',\n 'not-a-file': 'ignore',\n undecodable: 'error',\n};\n\nconst SINGLE_FILE_INPUT: FailurePolicy = {\n missing: 'fatal',\n unreadable: 'fatal',\n 'unreadable-folder': 'fatal',\n directory: 'fatal',\n 'dangling-link': 'fatal',\n 'unsupported-type': 'ignore',\n 'not-a-file': 'ignore',\n undecodable: 'fatal',\n};\n\n/** The policy table: role × discovery × failure kind → level. */\nexport const INPUT_POLICY: Readonly<Record<InputRole, Readonly<Record<InputDiscovery, FailurePolicy>>>> = {\n source: { named: NAMED_LIST_INPUT, found: FOUND_LIST_INPUT },\n module: { named: NAMED_LIST_INPUT, found: FOUND_LIST_INPUT },\n // Tweego's modifyHead() stops on any head file it can't read.\n head: { named: SINGLE_FILE_INPUT, found: SINGLE_FILE_INPUT },\n // A config file that is found (twee-ts.config.json in the working directory) and missing is no config.\n config: { named: SINGLE_FILE_INPUT, found: { ...SINGLE_FILE_INPUT, missing: 'ignore' } },\n};\n\n/** How a role is named in messages: a source by its path alone, as Tweego names it. */\nconst ROLE_NOUN: Readonly<Record<InputRole, string>> = {\n source: '',\n module: 'module ',\n head: 'head file ',\n config: 'config file ',\n};\n\n/** Failures source discovery finds while walking, rather than while reading a file. */\nconst WALK_FAILURES: ReadonlySet<InputFailure> = new Set([\n 'missing',\n 'dangling-link',\n 'unreadable-folder',\n 'not-a-file',\n]);\n\n/** One input that can't be used, with the policy's verdict. */\nexport interface InputProblem {\n readonly role: InputRole;\n readonly discovery: InputDiscovery;\n readonly failure: InputFailure;\n /** The path as reported (relative to the working directory when inside it). */\n readonly path: string;\n readonly level: PolicyLevel;\n /** Why it can't be used: the cause's message, or a sentence for a failure without an error. */\n readonly reason: string;\n /** `load <role> <path>: <reason>`. */\n readonly message: string;\n readonly cause: unknown;\n}\n\n/** The reason text for a failure: the cause's message, or a sentence for failures that have no error. */\nfunction reasonOf(failure: InputFailure, role: InputRole, path: string, cause: unknown): string {\n const message = cause instanceof Error ? cause.message.replace(/^read \\S+: /, '') : undefined;\n switch (failure) {\n case 'missing':\n case 'unreadable':\n case 'unreadable-folder':\n case 'undecodable':\n return message ?? String(cause);\n case 'directory':\n return message ?? 'Is a folder, not a file.';\n case 'dangling-link':\n return `Symbolic link to a missing target${typeof cause === 'string' ? ` (${cause})` : ''}.`;\n case 'unsupported-type': {\n const dot = path.lastIndexOf('.');\n const ext = dot > path.lastIndexOf('/') && dot > path.lastIndexOf('\\\\') ? path.slice(dot) : '(none)';\n return `Not a supported ${role} file type (extension ${ext}); skipped.`;\n }\n case 'not-a-file':\n return 'Not a regular file; skipped.';\n default: {\n const _exhaustive: never = failure;\n throw new Error(`unhandled input failure: ${String(_exhaustive)}`);\n }\n }\n}\n\n/** The policy's verdict on one failed input. */\nexport function inputProblem(\n role: InputRole,\n discovery: InputDiscovery,\n failure: InputFailure,\n path: string,\n cause: unknown,\n): InputProblem {\n const level = INPUT_POLICY[role][discovery][failure];\n const reason = reasonOf(failure, role, path, cause);\n // What source discovery finds while walking is reported as Tweego's walk reports it: `path a.tw: …`.\n const walk =\n (role === 'source' || role === 'module') &&\n WALK_FAILURES.has(failure) &&\n !(failure === 'missing' && discovery === 'found');\n const message = walk ? `${ROLE_NOUN[role]}path ${path}: ${reason}` : `load ${ROLE_NOUN[role]}${path}: ${reason}`;\n return { role, discovery, failure, path, level, reason, message, cause };\n}\n\n/** The diagnostic for a problem at the `warning` or `error` level; undefined for `ignore` (and `fatal`, thrown instead). */\nexport function problemDiagnostic(problem: InputProblem): Diagnostic | undefined {\n switch (problem.level) {\n case 'ignore':\n case 'fatal':\n return undefined;\n case 'warning':\n case 'error':\n return { level: problem.level, message: problem.message, file: problem.path };\n default: {\n const _exhaustive: never = problem.level;\n throw new Error(`unhandled policy level: ${String(_exhaustive)}`);\n }\n }\n}\n\n/**\n * The failure kind of an error thrown while opening or reading the file at `path`, telling a dangling symbolic\n * link (which reads as ENOENT) from a missing file.\n */\nexport function failureOfRead(path: string, e: unknown): InputFailure {\n const failure = failureOfError(e);\n if (failure !== 'missing') return failure;\n try {\n return lstatSync(path).isSymbolicLink() ? 'dangling-link' : 'missing';\n } catch {\n // Nothing to look at (it is missing, or below a file): missing.\n return 'missing';\n }\n}\n\n/** The warning for an input given again, under this or another spelling (`earlier`), which is skipped. */\nexport function duplicateInput(role: InputRole, path: string, earlier: string): Diagnostic {\n const same = earlier === path ? '' : ` (the same file as ${earlier})`;\n return { level: 'warning', message: `load ${ROLE_NOUN[role]}${path}: Skipping duplicate${same}.` };\n}\n\n/** The failure kind of an error thrown while opening or reading a file. */\nexport function failureOfError(e: unknown): InputFailure {\n if (e instanceof Error && e.name === 'TextDecodeError') return 'undecodable';\n const code = e instanceof Error && 'code' in e ? e.code : undefined;\n switch (code) {\n case 'ENOENT':\n case 'ENOTDIR':\n return 'missing';\n case 'EISDIR':\n return 'directory';\n default:\n return 'unreadable';\n }\n}\n","/**\n * The FSEvents stream behind every folder watch of a process on macOS (#436).\n *\n * libuv watches each folder on macOS through FSEvents, and runs all folder watches of a process on one stream:\n * starting or closing any folder watch replaces that stream (uv__fsevents_reschedule destroys it, with the events\n * it has not delivered yet, and creates a new one that reports changes from \"now\"). A change made while the stream\n * is being replaced is reported to no watch, including the watches that ran all along. A watch that starts watching\n * a new link's target, say, makes the edits that follow it go unseen.\n *\n * What was missed can't be known, but when the new stream runs can: a probe writes a file in a folder of its own,\n * watched like any other, until the stream reports it. Every change after that is reported again, and a full build\n * then reads every change made before it. Each watch that subscribes is told when the stream runs again.\n */\nimport { mkdtempSync, rmSync, watch, writeFileSync } from 'node:fs';\nimport type { FSWatcher } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\n\n/** How often the probe writes its file while it waits for the stream to report it. */\nconst PROBE_INTERVAL_MS = 25;\n/** How many times it writes before it gives up (10 s): a stream that never reports it is no worse off than before. */\nconst PROBE_ATTEMPTS = 400;\n\ninterface Probe {\n readonly dir: string;\n readonly watcher: FSWatcher;\n}\n\nconst listeners = new Set<() => void>();\n/** The probe while anything subscribes; undefined when it could not be set up, or nothing subscribes. */\nlet probe: Probe | undefined;\n/** Counts the replacements: the probe waits for its file of the latest one, never an earlier stream's event. */\nlet generation = 0;\n/** Whether the stream was replaced and has not reported the probe since. */\nlet pending = false;\nlet attempts = 0;\nlet timer: ReturnType<typeof setTimeout> | undefined;\n/** The file the probe wrote last, removed when it writes another. */\nlet written: string | undefined;\n\nconst probeName = (gen: number): string => `probe-${String(gen)}`;\n\nfunction settle(): void {\n pending = false;\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n for (const listener of [...listeners]) listener();\n}\n\nfunction openProbe(parent: string): Probe | undefined {\n let dir: string | undefined;\n try {\n dir = mkdtempSync(join(parent, 'twee-ts-watch-probe-'));\n const watcher = watch(dir, {}, (_event, filename) => {\n if (pending && filename === probeName(generation)) settle();\n });\n watcher.on('error', () => {\n // The probe stops answering; replacements go unanswered, as they did before the probe.\n watcher.close();\n });\n return { dir, watcher };\n } catch {\n // No folder to probe in, or no watch on it: replacements go unanswered, as they did before the probe.\n if (dir !== undefined) rmSync(dir, { recursive: true, force: true });\n return undefined;\n }\n}\n\nfunction closeProbe(): void {\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n pending = false;\n written = undefined;\n if (probe === undefined) return;\n probe.watcher.close();\n rmSync(probe.dir, { recursive: true, force: true });\n probe = undefined;\n}\n\n/** Writes the probe's file for the latest replacement, again every PROBE_INTERVAL_MS until it is reported. */\nfunction attempt(dir: string): void {\n timer = undefined;\n if (!pending || attempts >= PROBE_ATTEMPTS) return;\n attempts++;\n const name = probeName(generation);\n try {\n if (written !== undefined && written !== name) rmSync(join(dir, written), { force: true });\n writeFileSync(join(dir, name), '');\n written = name;\n } catch {\n // The folder went (a cleaner of the temporary folder, say): the next attempt tries again.\n }\n timer = setTimeout(() => {\n attempt(dir);\n }, PROBE_INTERVAL_MS);\n}\n\n/**\n * Calls `listener` each time the stream has been replaced and runs again, for as long as the returned function is\n * not called. The probe's folder is made in `parent` (the system's temporary folder by default) when the first\n * listener subscribes, and removed when the last one leaves.\n */\nexport function onStreamRunning(listener: () => void, parent: string = tmpdir()): () => void {\n if (listeners.size === 0) probe = openProbe(parent);\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n if (listeners.size === 0) closeProbe();\n };\n}\n\n/** Folder watches were started or closed: the stream is replaced, and the probe waits for the new one. */\nexport function streamReplaced(): void {\n if (probe === undefined) return;\n generation++;\n pending = true;\n attempts = 0;\n if (timer === undefined) attempt(probe.dir);\n}\n","/**\n * File system utilities: source discovery, output-path checks, watch mode.\n * Ported from filesystem.go. Every path comparison goes through path-identity.ts.\n */\nimport {\n accessSync,\n constants as fsConstants,\n lstatSync,\n readFileSync,\n readdirSync,\n readlinkSync,\n statSync,\n watch as fsWatch,\n} from 'node:fs';\nimport type { FSWatcher, Stats } from 'node:fs';\nimport { basename, dirname, isAbsolute, join, parse, resolve, sep } from 'node:path';\nimport { isKnownFileType, normalizedFileExt } from './media-types.js';\nimport { identify, isKeyInside, matchesExclude } from './path-identity.js';\nimport type { PathIdentity } from './path-identity.js';\nimport { failureOfError, inputProblem, problemDiagnostic } from './input-policy.js';\nimport type { InputDiscovery, InputFailure, InputRole } from './input-policy.js';\nimport type { Diagnostic, ExcludeGlob } from './types.js';\nimport { attributeOf, documentTextContains, findStoreArea, findStoryData, parseHtml } from './html-structure.js';\nimport { JsonObject, parseJSON } from './json-decode.js';\nimport { onStreamRunning, streamReplaced } from './folder-stream.js';\nimport type { JsonValue } from './json-decode.js';\n\n/**\n * Whether `filename` matches one of the `exclude` globs (see `matchesExclude` in path-identity.ts): the\n * globs are matched against the file's path relative to the working directory, the path getFilenames\n * reports, and against its real path relative to the working directory; an absolute glob against the\n * absolute paths. A leading `./` in a glob is dropped. The extension is matched without case, and on a\n * case-insensitive volume the whole path.\n */\nexport function isExcluded(filename: string, exclude: readonly (string | ExcludeGlob)[]): boolean {\n if (exclude.length === 0) return false;\n return matchesExclude(identify(filename), exclude);\n}\n\n/**\n * The paths a build writes. Source discovery never reads them back as sources,\n * and the watchers don't rebuild for them.\n */\nexport interface BuildOutputs {\n /**\n * Files the build writes: the story, and for a bundler also its chunks, its\n * assets and the public files it copies.\n */\n readonly files: readonly string[];\n /**\n * The story files among `files`, which the build writes whole. A bundler overwrites its other files\n * without a word, but the story is checked as a named output file is: an existing file of a type the\n * source folders load, which twee-ts didn't build, is the author's own and is never overwritten.\n */\n readonly stories?: readonly string[];\n /**\n * Folders the build writes into, which hold nothing but its output. One found\n * while walking a source folder is skipped whole, files from earlier builds\n * included (old hashed chunks, say). A folder named as a source, or one that\n * holds a source folder, is still walked, and only `files` are left out of it.\n */\n readonly dirs: readonly string[];\n}\n\n/** A build that writes nothing: `compile()`, or output to stdout. */\nconst NO_BUILD_OUTPUTS: BuildOutputs = { files: [], dirs: [] };\n\n/** The outputs of a build that writes the one file `outFile`, or none without it. */\nexport function toBuildOutputs(outputs: BuildOutputs | string | undefined): BuildOutputs {\n if (outputs === undefined) return NO_BUILD_OUTPUTS;\n return typeof outputs === 'string' ? { files: [outputs], dirs: [] } : outputs;\n}\n\n/**\n * The real path of `path` (see `canonical` in path-identity.ts): absolute, with every symbolic link\n * resolved, so two paths that reach the same file through different links compare equal. A path that\n * doesn't exist yet is its nearest existing folder's real path joined with the rest.\n */\nexport function realPathOf(path: string): string {\n return identify(path).canonical;\n}\n\n/** The inode of an existing file, as `dev:ino`, so a hard link of an output is recognised as one. */\nfunction inodeOf(path: string): string | undefined {\n try {\n const stats = statSync(path, { bigint: true });\n return stats.isFile() ? `${stats.dev}:${stats.ino}` : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** A build's outputs, with the checks discovery and the watchers make. Every path is compared by identity. */\nexport interface OutputPaths {\n /** Whether `path` is a file the build writes (the same file, or a hard link to it). */\n isFile(path: string): boolean;\n /** Whether `path` is a folder the build owns (see BuildOutputs.dirs). */\n isDir(path: string): boolean;\n /** Whether the folder at `path` is an owned folder or holds an output, at any depth. */\n holds(path: string): boolean;\n /**\n * Whether source discovery, walking the folders `roots`, leaves the path out\n * as output: an output file, or a path it only reaches through an owned folder.\n */\n isOutput(path: string, roots: readonly string[]): boolean;\n}\n\nexport function outputPaths(outputs: BuildOutputs): OutputPaths {\n const files = new Set(outputs.files.map((f) => identify(f).key));\n // Read when asked: an output that is written, or replaced, after these paths are made is a new file.\n const outputInodes = (): ReadonlySet<string> => new Set(outputs.files.map(inodeOf).filter((id) => id !== undefined));\n const dirs = new Set(outputs.dirs.map((d) => identify(d).key));\n const all = [...files, ...dirs];\n const keyOf = (path: string): string => identify(path).key;\n const isFile = (path: string): boolean => {\n if (files.has(keyOf(path))) return true;\n const inode = inodeOf(path);\n return inode !== undefined && outputInodes().has(inode);\n };\n return {\n isFile,\n isDir: (path) => dirs.has(keyOf(path)),\n holds(path) {\n const key = keyOf(path);\n return dirs.has(key) || all.some((output) => output !== key && isKeyInside(output, key, sep));\n },\n isOutput(path, roots) {\n if (isFile(path)) return true;\n const key = keyOf(path);\n const owners = [...dirs].filter((dir) => isKeyInside(key, dir, sep));\n if (owners.length === 0) return false;\n // A root walks into the path unless an owned folder below the root holds it.\n const reaching = roots.map(keyOf).filter((root) => isKeyInside(key, root, sep));\n return reaching.every((root) => owners.some((dir) => dir !== root && isKeyInside(dir, root, sep)));\n },\n };\n}\n\n/**\n * A folder entry as source discovery walks it, found at `pathname` with the real\n * path `real` when it is no link: a link to a file counts as that file, and a\n * link to anything else (a folder above all) as nothing, undefined. Throws when\n * the entry or a link's target can't be read (a dangling link: ENOENT).\n */\nexport function walkedEntry(\n pathname: string,\n real: string,\n): { readonly stat: Stats; readonly real: string } | undefined {\n const stat = lstatSync(pathname);\n if (!stat.isSymbolicLink()) return { stat, real };\n const target = statSync(pathname);\n return target.isFile() ? { stat: target, real: realPathOf(pathname) } : undefined;\n}\n\n/** A file source discovery found, as the loader reads and reports it. */\nexport interface DiscoveredFile {\n /** The path reported for it: relative to the working directory when inside it (`display` of its identity). */\n readonly path: string;\n /** Its identity key: the same for every spelling of the same file. */\n readonly key: string;\n /** Named by the user, or found walking a named folder. */\n readonly discovery: InputDiscovery;\n /** Reached through a symbolic link (the entry found, or the path named, is a link). */\n readonly link?: boolean;\n}\n\n/** An output file found while walking a source or module folder: left out of the inputs. */\nexport interface SkippedOutput {\n readonly path: string;\n /** The named folder whose walk found it. */\n readonly folder: string;\n}\n\nexport interface FilenamesResult {\n /** The paths of `files`, for callers that only need them. */\n readonly filenames: string[];\n readonly files: readonly DiscoveredFile[];\n /** A warning (or error) per path that could not be used, as the input policy says (see input-policy.ts). */\n readonly diagnostics: Diagnostic[];\n /**\n * The paths given that are themselves an output file. A build reading one would\n * overwrite its own source; the compiler refuses it, as Tweego does.\n */\n readonly outputSources: string[];\n /** Output files found while walking a named folder, which were left out. */\n readonly skippedOutputs: readonly SkippedOutput[];\n}\n\n/** Orders folder entries by code point, as Tweego's walk (Go's sort.Strings on UTF-8) does, on every OS. */\nfunction compareNames(a: string, b: string): number {\n return Buffer.compare(Buffer.from(a, 'utf8'), Buffer.from(b, 'utf8'));\n}\n\n/**\n * Recursively walk directories, collecting regular file paths.\n *\n * Leaves out what the build writes (`outputs`, compared by identity, see path-identity.ts) so its last\n * output is never read back, and the files that match an `exclude` glob (see isExcluded). A path given\n * that is itself an output file is not walked but listed in `outputSources`. Folder entries are walked in\n * code-point order, so the order sources load in (and so which duplicate passage wins) is the same on\n * every operating system.\n *\n * Symbolic links: a path given is followed wherever it leads. Inside a folder, a\n * link to a file is read, but a link to a folder is not followed, as Tweego's walk\n * doesn't follow one. A link back to its own folder or a parent would otherwise\n * walk the same files again at every depth.\n *\n * What can't be used (a missing path, a dangling link, an unreadable folder) is handled as the input\n * policy says for `role` (see input-policy.ts): a missing named path is a warning, as in Tweego, and a\n * dangling link found in a folder (an editor's lock file) is skipped without a word.\n *\n * `onFolder` is called with each folder the walk lists, just before it lists it, so a caller can tell later\n * whether what is in the folders walked changed since (the Vite dev server, which then needs no walk).\n */\nexport function getFilenames(\n pathnames: readonly string[],\n outputs?: BuildOutputs | string,\n exclude: readonly (string | ExcludeGlob)[] = [],\n role: Extract<InputRole, 'source' | 'module'> = 'source',\n onFolder?: (folder: string) => void,\n): FilenamesResult {\n const files: DiscoveredFile[] = [];\n const diagnostics: Diagnostic[] = [];\n const outputSources: string[] = [];\n const skippedOutputs: SkippedOutput[] = [];\n const output = outputPaths(toBuildOutputs(outputs));\n\n function problem(discovery: InputDiscovery, failure: InputFailure, path: string, cause: unknown): void {\n const diagnostic = problemDiagnostic(inputProblem(role, discovery, failure, path, cause));\n if (diagnostic !== undefined) diagnostics.push(diagnostic);\n }\n\n function addFile(id: PathIdentity, discovery: InputDiscovery, link: boolean): void {\n if (matchesExclude(id, exclude)) return;\n files.push({ path: id.display, key: id.key, discovery, ...(link ? { link } : {}) });\n }\n\n function walkDir(pathname: string, discovery: InputDiscovery, folder: string): void {\n let entries: string[];\n onFolder?.(pathname);\n try {\n entries = readdirSync(pathname).sort(compareNames);\n } catch (e) {\n problem(discovery, 'unreadable-folder', pathname, e);\n return;\n }\n for (const entry of entries) walkEntry(join(pathname, entry), folder);\n }\n\n function walkEntry(pathname: string, folder: string): void {\n let stat: Stats;\n let link = false;\n try {\n stat = lstatSync(pathname);\n if (stat.isSymbolicLink()) {\n link = true;\n // A link is judged by its own name first (#446), as a file is: a file type the role doesn't load and a file\n // `exclude` leaves out are skipped before the target is read, so no failure of the target can fail the build.\n if (!isLoadableType(pathname, role) || matchesExclude(identify(pathname), exclude)) return;\n const target = statLinkTarget(pathname);\n if (target === undefined) {\n problem('found', 'dangling-link', pathname, readLinkText(pathname));\n return;\n }\n // A link to a folder is not followed.\n if (target.isDirectory()) return;\n stat = target;\n }\n } catch (e) {\n problem('found', 'unreadable', pathname, e);\n return;\n }\n if (stat.isFile()) {\n const id = identify(pathname);\n if (output.isFile(pathname)) {\n if (!matchesExclude(id, exclude)) skippedOutputs.push({ path: id.display, folder });\n return;\n }\n addFile(id, 'found', link);\n } else if (stat.isDirectory()) {\n if (!output.isDir(pathname)) walkDir(pathname, 'found', folder);\n } else {\n problem('found', 'not-a-file', pathname, undefined);\n }\n }\n\n for (const pathname of pathnames) {\n if (pathname === '-') {\n diagnostics.push({ level: 'warning', message: 'path -: Reading from standard input is unsupported.' });\n continue;\n }\n let stat: Stats;\n try {\n stat = statSync(pathname);\n } catch (e) {\n if (isSymbolicLink(pathname)) problem('named', 'dangling-link', pathname, readLinkText(pathname));\n else problem('named', failureOfError(e), pathname, e);\n continue;\n }\n if (stat.isFile()) {\n if (output.isFile(pathname)) outputSources.push(pathname);\n else addFile(identify(pathname), 'named', lstatSync(pathname).isSymbolicLink());\n } else if (stat.isDirectory()) {\n walkDir(pathname, 'named', pathname);\n } else {\n problem('named', 'not-a-file', pathname, undefined);\n }\n }\n\n return { filenames: files.map((f) => f.path), files, diagnostics, outputSources, skippedOutputs };\n}\n\n/**\n * What `lstat` finds at `path`, or undefined when there is nothing it can look at: a missing path (ENOENT), a\n * path below a file (ENOTDIR), a folder it may not search (EACCES), a link loop (ELOOP). The watcher asks this\n * while the file system changes under it, and treats all of them as \"not there yet\".\n */\nfunction lstatIfReadable(path: string): Stats | undefined {\n try {\n return lstatSync(path);\n } catch {\n return undefined;\n }\n}\n\n/** Whether `path` is itself a symbolic link; false when it can't be looked at (the caller already has that cause). */\nfunction isSymbolicLink(path: string): boolean {\n try {\n return lstatSync(path).isSymbolicLink();\n } catch {\n return false;\n }\n}\n\n/**\n * What a link leads to, or undefined when it leads to nothing: a missing target (ENOENT) or a loop of links (ELOOP,\n * which has no target either). Other failures (a folder on the way that can't be searched) are thrown.\n */\nfunction statLinkTarget(link: string): Stats | undefined {\n try {\n return statSync(link, { throwIfNoEntry: false });\n } catch (e) {\n if (e instanceof Error && 'code' in e && e.code === 'ELOOP') return undefined;\n throw e;\n }\n}\n\n/** The target a link holds, for a message; undefined when it can't be read. */\nfunction readLinkText(path: string): string | undefined {\n try {\n return readlinkSync(path);\n } catch {\n return undefined;\n }\n}\n\n/** The creator Twine 2 story data and JSON output name (see compiler.ts and output-twine2.ts). */\nconst CREATOR = 'Twee-ts';\n\n/** The words Twine 1 HTML output puts where its story format has the `\"VERSION\"` placeholder. */\nconst TWINE1_VERSION_TEXT = 'Compiled with twee-ts, ';\n\n/** Whether a parsed JSON value is the story JSON output writes: an object with the creator and the passages. */\nfunction isStoryJson(value: JsonValue): boolean {\n if (!(value instanceof JsonObject)) return false;\n const member = (key: string): JsonValue | undefined => value.members.find((m) => m.key === key)?.value;\n return member('creator') === CREATOR && Array.isArray(member('passages'));\n}\n\n/**\n * Whether the file at `path` is a story twee-ts built, recognised by its structure and not by text that\n * happens to appear in it: JSON output is a JSON object with the creator and the passages; Twine 2 HTML and\n * archive output hold a `tw-storydata` element whose `creator` attribute is twee-ts; Twine 1 HTML output has\n * a store area, and the version text where its story format put it (in text or a comment, never only in an\n * attribute). HTML is read only from a file named as HTML (`.html`, `.htm`): any text parses as HTML, and a\n * script, a stylesheet or a Twee file that quotes `<tw-storydata creator=\"Twee-ts\">` is not a build. Twee\n * output and Twine 1 archives carry no mark and are never recognised; false for a file that can't be read.\n */\nexport function isPreviousBuild(path: string): boolean {\n let text: string;\n try {\n text = readFileSync(path, 'utf8');\n } catch {\n return false;\n }\n const json = parseJSON(text);\n if (json.ok) return isStoryJson(json.value);\n if (!['html', 'htm'].includes(normalizedFileExt(path))) return false;\n let doc: ReturnType<typeof parseHtml>;\n try {\n doc = parseHtml(text, false);\n } catch {\n // Nested deeper than any HTML twee-ts writes.\n return false;\n }\n const storyData = findStoryData(doc);\n if (storyData !== undefined) return attributeOf(storyData, 'creator') === CREATOR;\n return findStoreArea(doc) !== undefined && documentTextContains(doc, TWINE1_VERSION_TEXT);\n}\n\n/** Whether `path` has a file type the `role` loads from a folder. */\nexport function isLoadableType(path: string, role: Extract<InputRole, 'source' | 'module'>): boolean {\n if (role === 'source') return isKnownFileType(path);\n return ['css', 'js', 'otf', 'ttf', 'woff', 'woff2'].includes(normalizedFileExt(path));\n}\n\n/** A file the last build found, as the watcher is told about it (see WatchHandle.track). */\ninterface TrackedFile {\n readonly path: string;\n /** Reached through a symbolic link. */\n readonly link?: boolean;\n}\n\nexport interface WatchHandle {\n close(): void;\n /**\n * Tells the watcher which files the last build found, for as long as the next call doesn't list them\n * again. Each one outside the watched folders, and each one reached through a symbolic link, is also\n * watched on its own (the link, every link on the way, and the target): Node's recursive watch on Linux\n * reports neither a change to a link's target outside the folder nor a link deleted or retargeted.\n */\n track(files: readonly TrackedFile[]): void;\n}\n\n/**\n * A watched path that can't be watched: fs.watch failed on it, or on the folder it is\n * watched through. watchFilesystem passes it to its `onError` and keeps watching the rest.\n */\nexport class WatchPathError extends Error {\n constructor(\n readonly path: string,\n cause: unknown,\n ) {\n super(`Cannot watch ${path}: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });\n this.name = 'WatchPathError';\n }\n}\n\n/** What a stat finds at a path: a folder (with its identity) or something else. */\ntype PathKind =\n { readonly kind: 'dir'; readonly id: string } | { readonly kind: 'file' } | { readonly kind: 'missing' };\n\nfunction pathKind(path: string): PathKind {\n try {\n const stats = statSync(path);\n return stats.isDirectory() ? { kind: 'dir', id: `${stats.dev}:${stats.ino}` } : { kind: 'file' };\n } catch {\n // Missing, or unreadable: either way, wait for it to change.\n return { kind: 'missing' };\n }\n}\n\n/** A folder a watched path is watched through, and the names in it that lead to the path. */\ninterface Anchor {\n readonly path: string;\n readonly id: string;\n readonly names: ReadonlySet<string>;\n}\n\n/**\n * Where a watched path stands, and so which folders its watches must be on. A watch follows the\n * folder it was started on, not its path, so the watches are set up again whenever this changes.\n */\ninterface RootState {\n /**\n * The folders the path is watched through, which see it, every symbolic link on the way to it and\n * its final target created, deleted, replaced or retargeted: the folder holding each, or while that\n * is missing, the nearest folder above it that exists.\n */\n readonly anchors: readonly Anchor[];\n /** The path itself, links followed: a folder is watched recursively; a file is watched through `anchors`. */\n readonly self: PathKind;\n}\n\n/** Separators in a link target: Windows reads both spellings; on POSIX a backslash is an ordinary name character. */\nconst TARGET_SEPARATORS = sep === '\\\\' ? /[\\\\/]/ : '/';\n\n/** Links followed before a path counts as a cycle (Linux stops at 40 as well). */\nconst MAX_LINK_DEPTH = 40;\n\n/**\n * Every place a change can alter what `abs` refers to: `abs` itself, each symbolic link met while\n * resolving it component by component (in the path's folders or as the path itself), and the final\n * target. Each is absolute; a relative link target is resolved against the folder that really holds it.\n */\nfunction linkLocations(abs: string): string[] {\n const locations = [abs];\n const { root } = parse(abs);\n let resolved = root;\n let rest = abs.slice(root.length).split(sep).filter(Boolean);\n for (let hops = 0; rest.length > 0;) {\n const [name, ...after] = rest;\n const next = join(resolved, name ?? '');\n const stat = lstatIfReadable(next);\n if (stat?.isSymbolicLink() === true && hops < MAX_LINK_DEPTH) {\n hops++;\n if (!locations.includes(next)) locations.push(next);\n const target = readLinkText(next) ?? '';\n const targetRoot = isAbsolute(target) ? parse(target).root : '';\n resolved = targetRoot === '' ? resolved : targetRoot;\n rest = [...target.slice(targetRoot.length).split(TARGET_SEPARATORS).filter(Boolean), ...after];\n } else {\n resolved = join(resolved, name ?? '');\n rest = after;\n }\n }\n if (!locations.includes(resolved)) locations.push(resolved);\n return locations;\n}\n\nfunction nearestFolderAbove(\n abs: string,\n): { readonly path: string; readonly id: string; readonly name: string } | undefined {\n for (let dir = dirname(abs), below = abs; dir !== below; below = dir, dir = dirname(dir)) {\n const kind = pathKind(dir);\n if (kind.kind === 'dir') return { path: dir, id: kind.id, name: basename(below) };\n }\n return undefined;\n}\n\nfunction rootState(abs: string): RootState {\n // One watch per folder, however many spellings reach it (the path as written, and its real path).\n const byFolder = new Map<string, { path: string; names: Set<string> }>();\n for (const location of linkLocations(abs)) {\n const anchor = nearestFolderAbove(location);\n if (anchor === undefined) continue;\n const entry = byFolder.get(anchor.id) ?? { path: anchor.path, names: new Set<string>() };\n entry.names.add(anchor.name);\n byFolder.set(anchor.id, entry);\n }\n const anchors = [...byFolder].map(([id, { path, names }]) => ({ path, id, names }));\n return { anchors, self: pathKind(abs) };\n}\n\n/** Whether two states need the same watches: the same anchor folders (and names), and the same watched folder. */\nfunction sameWatches(a: RootState, b: RootState): boolean {\n const selfId = (s: RootState): string | undefined => (s.self.kind === 'dir' ? s.self.id : undefined);\n const anchorsId = (s: RootState): string => JSON.stringify(s.anchors.map((x) => [x.path, x.id, [...x.names].sort()]));\n return selfId(a) === selfId(b) && anchorsId(a) === anchorsId(b);\n}\n\n/** One watched path (a source, module or head file, or a file a build read through a link), as given and absolute. */\ninterface Root {\n readonly path: string;\n readonly abs: string;\n /** Watched because a build read it (see WatchHandle.track), not because it was named. */\n readonly tracked: boolean;\n state: RootState;\n watchers: FSWatcher[];\n /** The folders found under a watched folder, by identity key, so a folder that goes away is recognised. */\n folders: Set<string>;\n /** A watch could not be started, or broke: it is tried again on the next event in its anchor folder. */\n failed: boolean;\n /** The last failure reported, so that one that persists is reported once. */\n lastReport: string | undefined;\n /** Whether the recursive watch saw an event since it was started, so a file may have been replaced under it. */\n dirty: boolean;\n}\n\n/** How long watch mode waits for changes to settle before it builds. */\nexport interface WatchTiming {\n /** A build starts this long after the last change (default 500 ms, Tweego's rate). */\n readonly debounceMs?: number;\n /** …but no later than this long after the first change it builds (default 1000 ms), so a steady stream still builds. */\n readonly maxWaitMs?: number;\n}\n\n/** How the folder watches of the process share one event stream (see folder-stream.ts). */\nexport interface FolderStream {\n /**\n * Whether starting or closing a folder watch replaces the stream every folder watch reports through, so that\n * changes made meanwhile go unreported: true on macOS (FSEvents). Tests set it to check the handling elsewhere.\n */\n readonly shared?: boolean;\n /** Where the probe that learns when the stream runs again makes its folder (the system's temporary folder). */\n readonly probeParent?: string;\n}\n\n/** Every folder below `dir` (links to folders not followed), by identity key, `dir` included. */\nfunction foldersUnder(dir: string): Set<string> {\n const found = new Set<string>([identify(dir).key]);\n const visit = (path: string): void => {\n let entries;\n try {\n entries = readdirSync(path, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const child = join(path, entry.name);\n found.add(identify(child).key);\n visit(child);\n }\n };\n visit(dir);\n return found;\n}\n\n/**\n * Watch paths for changes, calling the build callback on known file type changes.\n * A folder is watched recursively; a file is watched on its own and counts\n * whatever its type (a head file, say). A change to a file `ignore` returns true\n * for (given the path relative to the working directory) schedules no build.\n *\n * Events are hints, not the truth: every build walks the sources again. A change to a file of a known\n * type is reported as that file (`changedFiles`, the path relative to the working directory), so it is\n * read again whatever its modification time. Any event on something that is not such a file (a folder\n * created, deleted, moved or renamed, or a path that was a folder) schedules a full build\n * (`changedFiles` undefined), which revalidates every cached file. Changes to files of unknown types\n * schedule nothing.\n *\n * A build starts once changes stop for `timing.debounceMs`, but no later than `timing.maxWaitMs` after\n * the first change it covers, so a steady stream of changes still builds.\n *\n * A watched path that doesn't exist yet is waited for, and one that is deleted, or renamed away and\n * replaced, is followed to the new folder or file at its path: each path is watched through the folder\n * above it, and so are every symbolic link on the way to it and its final target (#239), so editing,\n * replacing or retargeting any of them rebuilds. When that sets up a path's watches again, the next build\n * is a full one, since changes made in between went unseen. A path that can't be watched is passed to\n * `onError` as a WatchPathError, once while the failure persists; the other paths are still watched.\n *\n * Where folder watches share one event stream (`stream.shared`, macOS), starting or closing any of them loses the\n * changes made while the stream is replaced, in every watched folder: once the new stream runs, a full build reads\n * them (#436).\n */\nexport function watchFilesystem(\n pathnames: string[],\n outFilename: string,\n callback: (changedFiles?: ReadonlySet<string>) => void,\n ignore: (filename: string) => boolean = () => false,\n onError: (error: WatchPathError) => void = () => {\n // Errors are dropped when the caller does not ask for them.\n },\n timing: WatchTiming = {},\n stream: FolderStream = {},\n): WatchHandle {\n const output = outputPaths(toBuildOutputs(outFilename));\n const debounceMs = timing.debounceMs ?? 500;\n const maxWaitMs = Math.max(debounceMs, timing.maxWaitMs ?? 2 * debounceMs);\n let buildTimer: ReturnType<typeof setTimeout> | null = null;\n let firstPendingAt: number | undefined;\n const pendingFiles = new Set<string>();\n let pendingFullBuild = false;\n let closed = false;\n /** The files the last build read, as reported (see WatchHandle.track). */\n let lastInputs: ReadonlySet<string> = new Set();\n\n // `changedFile` undefined: a full build, which wins over the changed files pending with it.\n function scheduleBuild(changedFile?: string): void {\n if (changedFile === undefined) pendingFullBuild = true;\n else pendingFiles.add(changedFile);\n const now = Date.now();\n firstPendingAt ??= now;\n if (buildTimer) clearTimeout(buildTimer);\n const delay = Math.max(0, Math.min(debounceMs, firstPendingAt + maxWaitMs - now));\n buildTimer = setTimeout(() => {\n buildTimer = null;\n firstPendingAt = undefined;\n const files = pendingFullBuild || pendingFiles.size === 0 ? undefined : new Set(pendingFiles);\n pendingFiles.clear();\n pendingFullBuild = false;\n // The folders this build is about to read: an event for a folder may have been delivered as one for\n // a file in it (FSEvents merges them), so the folder was never added, and its later move out would\n // look like the deletion of an unknown path (#337).\n for (const root of roots) {\n if (root.state.self.kind === 'dir') root.folders = foldersUnder(root.abs);\n }\n // Node's recursive watch on Linux keeps its registration on a file an editor's atomic save\n // replaced and reports nothing of later edits (#325): start the watches that saw events again\n // before this build reads the files, so the files at their paths now are the ones watched.\n // The native recursive watches of macOS and Windows follow the path and are left alone.\n if (process.platform === 'linux') {\n for (const root of roots) {\n if (root.dirty && !root.tracked && root.state.self.kind === 'dir') arm(root);\n }\n }\n callback(files);\n }, delay);\n }\n\n const makeRoot = (path: string, tracked: boolean): Root => {\n const abs = resolve(path);\n const state = rootState(abs);\n return {\n path,\n abs,\n tracked,\n state,\n watchers: [],\n folders: state.self.kind === 'dir' ? foldersUnder(abs) : new Set(),\n failed: false,\n lastReport: undefined,\n dirty: false,\n };\n };\n const roots: Root[] = pathnames.map((path) => makeRoot(path, false));\n\n // Each start or close of folder watches may have lost changes: build in full once the stream runs again.\n const shared = stream.shared ?? process.platform === 'darwin';\n const leaveStream = shared\n ? onStreamRunning(() => {\n scheduleBuild();\n }, stream.probeParent)\n : undefined;\n const watchesChanged = (): void => {\n if (shared) streamReplaced();\n };\n\n // A watched path that is a file counts whatever its type.\n const isNamedFile = (abs: string): boolean => roots.some((r) => r.abs === abs && r.state.self.kind === 'file');\n\n // A changed file. `named`: it is one of the watched paths itself, so it counts whatever its type.\n // Reported relative to the working directory, the form getFilenames gives.\n function fileChanged(abs: string, named: boolean): void {\n if (!named && !isKnownFileType(abs)) return;\n if (output.isFile(abs)) return;\n const { display } = identify(abs);\n if (!ignore(display)) scheduleBuild(display);\n }\n\n // An event in a watched folder `root` for the path `abs` below it.\n function changedBelow(root: Root, abs: string): void {\n if (output.isFile(abs)) return;\n const kind = pathKind(abs);\n if (kind.kind === 'dir') {\n // A folder created, moved in or renamed: walk again, and remember what is in it.\n for (const key of foldersUnder(abs)) root.folders.add(key);\n scheduleBuild();\n return;\n }\n if (kind.kind === 'missing') {\n const id = identify(abs);\n const gone = [...root.folders].filter((folder) => isKeyInside(folder, id.key, sep));\n if (gone.length > 0) {\n // A folder deleted, moved out or renamed: its files went with it, without events of their own.\n for (const folder of gone) root.folders.delete(folder);\n scheduleBuild();\n return;\n }\n // A dangling link (an editor's lock file, `.#a.tw`) is no source, unless the last build read a\n // file through it before its target went.\n if (lstatIfReadable(abs)?.isSymbolicLink() === true) {\n if (lastInputs.has(id.display)) scheduleBuild();\n return;\n }\n }\n fileChanged(abs, isNamedFile(abs));\n }\n\n function report(root: Root, cause: unknown): void {\n const error = new WatchPathError(root.path, cause);\n if (error.message === root.lastReport) return;\n root.lastReport = error.message;\n onError(error);\n }\n\n /** Starts one watch for `root`; false, with the error reported, when it can't be started. */\n function startWatch(root: Root, path: string, recursive: boolean, listener: (filename: string) => void): boolean {\n try {\n // A recursive watch on a folder it can't read starts without an error on Linux, and\n // then never reports anything: check first.\n if (recursive) accessSync(path, fsConstants.R_OK | fsConstants.X_OK);\n const watcher = fsWatch(path, { recursive }, (_event, filename) => {\n if (!closed) listener(filename ?? '');\n });\n watcher.on('error', (e) => {\n watcher.close();\n watchesChanged();\n root.watchers = root.watchers.filter((w) => w !== watcher);\n root.failed = true;\n if (!closed && !recheck(root, false)) report(root, e);\n });\n root.watchers.push(watcher);\n return true;\n } catch (e) {\n report(root, e);\n return false;\n }\n }\n\n const selfKind = (root: Root): PathKind['kind'] => root.state.self.kind;\n\n // Starts the watches `root.state` calls for, closing any earlier ones.\n function arm(root: Root): void {\n for (const w of root.watchers) w.close();\n root.watchers = [];\n root.failed = false;\n root.dirty = false;\n const { anchors, self } = root.state;\n const anchorsStarted = anchors.map((anchor) =>\n startWatch(root, anchor.path, false, (filename) => {\n // A file is watched through its folder, not on its own: the OS reports only the file's\n // name for a watch on the file, and an editor that saves by replacing the file would\n // leave such a watch on the old one. Any event may mean the folder itself went away.\n const before = root.state.self.kind;\n recheck(root, true);\n // Read through a function: recheck() may have replaced root.state.\n const isFile = before === 'file' || selfKind(root) === 'file';\n if (isFile && anchor.names.has(filename)) fileChanged(root.abs, !root.tracked || isKnownFileType(root.abs));\n }),\n );\n const selfStarted =\n self.kind !== 'dir' ||\n startWatch(root, root.path, true, (filename) => {\n // No name: an event on the folder itself, such as its deletion.\n if (filename === '') recheck(root, true);\n else {\n root.dirty = true;\n changedBelow(root, resolve(root.abs, filename));\n }\n });\n if (anchorsStarted.every(Boolean) && selfStarted) root.lastReport = undefined;\n else root.failed = true;\n watchesChanged();\n }\n\n /**\n * Sets up `root`'s watches again when its path, a link on the way to it, or the folder above any of\n * them is no longer the one they were started on (or, with `retry`, when one of them failed), and then\n * schedules a full build. Returns whether its state changed.\n */\n function recheck(root: Root, retry: boolean): boolean {\n const before = root.state;\n const after = rootState(root.abs);\n const changed = !sameWatches(before, after);\n const wasFailed = root.failed;\n if (!changed && !(retry && wasFailed)) {\n root.state = after;\n return false;\n }\n root.state = after;\n root.folders = after.self.kind === 'dir' ? foldersUnder(root.abs) : new Set();\n arm(root);\n const recovered = wasFailed && !root.failed;\n if ((changed || recovered) && (before.self.kind !== 'missing' || after.self.kind !== 'missing')) scheduleBuild();\n return changed;\n }\n\n for (const root of roots) arm(root);\n\n // Build once initially (no changedFiles = full build).\n callback();\n\n /** Whether `path` is already seen by a named root: inside a watched folder, or a watched file itself. */\n const covered = (key: string): boolean =>\n roots.some(\n (root) =>\n !root.tracked &&\n (root.state.self.kind === 'dir'\n ? isKeyInside(key, identify(root.abs).key, sep)\n : identify(root.abs).key === key),\n );\n\n return {\n close() {\n closed = true;\n if (buildTimer) clearTimeout(buildTimer);\n buildTimer = null;\n for (const root of roots) for (const w of root.watchers) w.close();\n leaveStream?.();\n // The other watches of the process report through the stream these watches leave.\n if (shared) streamReplaced();\n },\n track(files) {\n if (closed) return;\n const wanted = new Map<string, string>();\n lastInputs = new Set(files.map((file) => file.path));\n for (const file of files) {\n if (file.link === true || !covered(identify(file.path).key)) wanted.set(resolve(file.path), file.path);\n }\n for (let i = roots.length - 1; i >= 0; i--) {\n const root = roots[i];\n if (root?.tracked !== true) continue;\n if (wanted.has(root.abs)) wanted.delete(root.abs);\n else if (lstatIfReadable(root.abs) !== undefined) {\n // Still there but no longer an input (excluded, say): stop watching it. One that went away is\n // still waited for: Node's recursive watch on Linux may not report a link created again in its\n // place.\n for (const w of root.watchers) w.close();\n watchesChanged();\n roots.splice(i, 1);\n }\n }\n for (const path of wanted.values()) {\n const root = makeRoot(path, true);\n roots.push(root);\n arm(root);\n }\n },\n };\n}\n","/**\n * SemVer parsing and precedence, shared by every story format lookup (local folders, format URLs\n * and format indices).\n *\n * Parsing follows SemVer 2.0.0 with two of Tweego's `semver.NewVersion` (Masterminds/semver)\n * extensions: a leading `v` or `V` is allowed, and `x` or `x.y` stand for `x.0.0` and `x.y.0`.\n * As SemVer 2.0.0 §2 and §9 require, a numeric identifier (major, minor, patch, or a numeric\n * prerelease identifier) has no leading zero: `01.2.3` and `1.2.3-01` are not versions.\n * Major, minor and patch must not exceed `Number.MAX_SAFE_INTEGER`, so that they compare exactly;\n * a larger number is not accepted as a version. Numeric prerelease identifiers have no size limit.\n *\n * Comparison follows SemVer 2.0.0 §11: a prerelease ranks below its release, prerelease\n * identifiers compare field by field (numeric ones by value and below alphanumeric ones, which\n * compare in ASCII order), and build metadata is ignored.\n */\nimport type { SemVer } from './types.js';\n\nconst NUMBER = String.raw`0|[1-9]\\d*`;\n/** A prerelease identifier: a number without leading zeros, or an alphanumeric one with at least one non-digit. */\nconst PRERELEASE_ID = String.raw`(?:${NUMBER}|\\d*[A-Za-z-][0-9A-Za-z-]*)`;\nconst BUILD_ID = String.raw`[0-9A-Za-z-]+`;\nconst VERSION = new RegExp(\n String.raw`^[vV]?(${NUMBER})(?:\\.(${NUMBER}))?(?:\\.(${NUMBER}))?` +\n String.raw`(?:-(${PRERELEASE_ID}(?:\\.${PRERELEASE_ID})*))?(?:\\+${BUILD_ID}(?:\\.${BUILD_ID})*)?$`,\n);\nconst NUMERIC = /^\\d+$/;\n\n/** A version number part, or undefined when it is too large to compare exactly. */\nfunction versionNumber(digits: string | undefined): number | undefined {\n const value = Number(digits ?? '0');\n return Number.isSafeInteger(value) ? value : undefined;\n}\n\n/** Parse a version string, or return null when it is not a version (see the module comment). */\nexport function parseVersion(text: string): SemVer | null {\n const m = VERSION.exec(text);\n if (!m) return null;\n const major = versionNumber(m[1]);\n const minor = versionNumber(m[2]);\n const patch = versionNumber(m[3]);\n if (major === undefined || minor === undefined || patch === undefined) return null;\n return { major, minor, patch, prerelease: m[4] === undefined ? [] : m[4].split('.') };\n}\n\n/** Compare two digit strings without leading zeros by value, whatever their size. */\nfunction compareDigits(a: string, b: string): number {\n if (a.length !== b.length) return Math.sign(a.length - b.length);\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** Compare two prerelease identifiers: numeric ones by value and below alphanumeric ones, which compare as ASCII. */\nfunction compareIdentifiers(a: string, b: string): number {\n const aNumeric = NUMERIC.test(a);\n const bNumeric = NUMERIC.test(b);\n if (aNumeric && bNumeric) return compareDigits(a, b);\n if (aNumeric !== bNumeric) return aNumeric ? -1 : 1;\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** Compare prerelease identifier lists. An empty list (a release) ranks above any prerelease. */\nfunction comparePrerelease(a: readonly string[], b: readonly string[]): number {\n if (a.length === 0 || b.length === 0) return Math.sign(b.length - a.length);\n const shared = Math.min(a.length, b.length);\n for (let i = 0; i < shared; i++) {\n const order = compareIdentifiers(a[i] ?? '', b[i] ?? '');\n if (order !== 0) return order;\n }\n return Math.sign(a.length - b.length);\n}\n\n/** Compare two versions by SemVer precedence: negative when `a` ranks lower, 0 when equal, positive when higher. */\nexport function compareVersions(a: SemVer, b: SemVer): number {\n return (\n Math.sign(a.major - b.major) ||\n Math.sign(a.minor - b.minor) ||\n Math.sign(a.patch - b.patch) ||\n comparePrerelease(a.prerelease, b.prerelease)\n );\n}\n\n/** Whether two version strings name the same version (prerelease included, build metadata ignored). */\nexport function sameVersion(a: string, b: string): boolean {\n const left = parseVersion(a);\n const right = parseVersion(b);\n return left !== null && right !== null && compareVersions(left, right) === 0;\n}\n","/**\n * Story format file decoding: find the object a Twine 2 `format.js` passes to `storyFormat()` and\n * read its metadata, without evaluating anything.\n *\n * The file is parsed as a classic script with acorn (see `js-syntax.ts`); a file that is not valid\n * JavaScript is rejected with acorn's error and its position. The format object is the first\n * argument of the one call whose callee is `storyFormat` itself or a property access ending in\n * `storyFormat`: `storyFormat(…)`, `window.storyFormat(…)`, `window['storyFormat'](…)`,\n * `a.b.storyFormat(…)`, `window.storyFormat?.(…)`, parenthesized or not, anywhere in the file\n * (Unicode escapes in the name count, as JavaScript reads them). A file with no such call is read\n * as a format object only if all of it is one object literal (as Tweego reads it); a file with\n * several such calls is rejected, as which one a loader sees is not knowable without running it.\n *\n * The object is read as data, never run. Supported, with JavaScript's own values:\n * - string, number, `true`, `false` and `null` literals, numbers in every notation the Script goal\n * allows (hexadecimal, octal, binary, legacy octal `010`, separators `1_000`, exponents);\n * - a `-` or `+` before a number literal;\n * - template literals without substitutions;\n * - arrays without holes or spreads, and nested objects;\n * - property keys that are identifiers, strings or numbers (numeric keys become the string\n * JavaScript makes of them: `0x10` is `\"16\"`, `1e3` is `\"1000\"`), with duplicate keys resolved as\n * JavaScript resolves them (the last value wins, in the place of the first).\n *\n * A property whose value is a function (`setup: function () {…}`, an arrow function, or a method\n * such as Harlowe's `setup() {…}`) is not data: it is left out. A note says so only for a top-level\n * property twee-ts reads (`name`, `version`, `source`, …); Twine's own code (`setup`,\n * `editorExtensions`) is left out silently. Anything else is\n * an error naming the property and its line and column: identifiers (including `undefined`, `NaN`\n * and `Infinity`), BigInts, regular expressions, computed keys, spreads, getters and setters,\n * shorthand properties, array holes, operators and calls. So is a `__proto__` key, which in\n * JavaScript sets the prototype rather than adding a property.\n */\nimport type {\n AnyNode,\n ArrayExpression,\n CallExpression,\n Expression,\n ObjectExpression,\n Program,\n Property,\n SpreadElement,\n Super,\n} from 'acorn';\nimport { tokTypes } from 'acorn';\nimport type { FormatDecodeResult, Twine2FormatJSON } from './types.js';\nimport { describePosition, lineColumnFinder } from './js-chars.js';\nimport type { LineColumn } from './js-chars.js';\nimport { AcornParser, SCRIPT_OPTIONS, parseScript, trySyntax } from './js-syntax.js';\nimport { parseVersion } from './semver.js';\n\n/** The name given to a format.js that names no format. */\nexport const UNNAMED_FORMAT_NAME = 'Untitled Story Format';\n\nconst STORY_FORMAT = 'storyFormat';\n\nconst OPTIONAL_TEXT_FIELDS = ['author', 'description', 'image', 'url', 'license'] as const;\n\n/**\n * The top-level properties of a format object that twee-ts reads: the required `version` and `source`\n * and the optional fields. A function at one of these is a mistake the author can fix; a function\n * anywhere else (Harlowe's `setup`, `editorExtensions`) is code for Twine, which twee-ts never reads.\n */\nconst READ_FIELDS: readonly string[] = ['name', 'version', 'source', 'proofing', ...OPTIONAL_TEXT_FIELDS];\n\n/** Whether a value read from the tree is an acorn node. */\nfunction isNode(value: unknown): value is AnyNode {\n return typeof value === 'object' && value !== null && 'type' in value && typeof value.type === 'string';\n}\n\n/** Every `storyFormat(…)` call in the program, in source order. */\nfunction findStoryFormatCalls(program: Program): CallExpression[] {\n const calls: CallExpression[] = [];\n // An explicit stack, so deeply nested code cannot exhaust the call stack.\n const pending: AnyNode[] = [program];\n for (let node = pending.pop(); node !== undefined; node = pending.pop()) {\n if (node.type === 'CallExpression' && callsStoryFormat(node.callee)) calls.push(node);\n for (const child of Object.values(node)) {\n if (Array.isArray(child)) {\n for (const item of child) if (isNode(item)) pending.push(item);\n } else if (isNode(child)) {\n pending.push(child);\n }\n }\n }\n return calls.sort((a, b) => a.start - b.start);\n}\n\n/** Whether a callee names `storyFormat`: the identifier, or a property access that ends in it. */\nfunction callsStoryFormat(callee: Expression | Super): boolean {\n switch (callee.type) {\n case 'Identifier':\n return callee.name === STORY_FORMAT;\n case 'ChainExpression':\n return callee.expression.type === 'MemberExpression' && callsStoryFormat(callee.expression);\n case 'MemberExpression': {\n const { property } = callee;\n return callee.computed\n ? property.type === 'Literal' && property.value === STORY_FORMAT\n : property.type === 'Identifier' && property.name === STORY_FORMAT;\n }\n default:\n return false;\n }\n}\n\n/** What reading the format object found: its top-level properties, or the first error. */\ntype ObjectRead = { readonly ok: true; readonly value: ReadonlyMap<string, unknown> } | ErrorResult;\ntype ValueRead = { readonly ok: true; readonly value: unknown } | ErrorResult;\ninterface ErrorResult {\n readonly ok: false;\n readonly reason: string;\n}\n\n/** A property left out of the value: a function, which is not data. */\nconst SKIPPED: unique symbol = Symbol('skipped');\n\n/** Reads literal values out of the tree of one file, collecting notes about what it leaves out. */\nclass LiteralReader {\n readonly notes: string[] = [];\n private readonly where: (offset: number) => LineColumn;\n\n constructor(source: string) {\n this.where = lineColumnFinder(source);\n }\n\n position(offset: number): string {\n return describePosition(this.where(offset));\n }\n\n fail(path: string, node: AnyNode, what: string): ErrorResult {\n return {\n ok: false,\n reason: `Unsupported ${what} at ${describePath(path)} (${this.position(node.start)}); only literal data is read`,\n };\n }\n\n /** The properties of an object literal, in JavaScript's order, functions left out. */\n readObject(node: ObjectExpression, path: string): ObjectRead {\n const entries = new Map<string, unknown>();\n for (const property of node.properties) {\n const read = this.readProperty(property, path);\n if (!read.ok) return read;\n const { key, value } = read;\n // A later definition replaces an earlier one in its place, as in JavaScript; a skipped\n // function still replaces it, so the earlier value is not kept in its stead.\n entries.set(key, value);\n }\n for (const [key, value] of entries) if (value === SKIPPED) entries.delete(key);\n return { ok: true, value: entries };\n }\n\n private readProperty(\n property: Property | SpreadElement,\n path: string,\n ): { readonly ok: true; readonly key: string; readonly value: unknown } | ErrorResult {\n if (property.type === 'SpreadElement') return this.fail(path, property, 'spread property');\n const key = propertyKey(property);\n if (key === undefined) return this.fail(path, property, 'computed property key');\n const keyPath = joinPath(path, key);\n if (property.kind !== 'init') return this.fail(keyPath, property, `${property.kind}ter`);\n if (property.shorthand) return this.fail(keyPath, property, 'shorthand property');\n if (property.method || isFunction(property.value)) {\n // Only a function where twee-ts expects data is worth a warning: nothing else in the file is its to fix.\n if (path === '' && READ_FIELDS.includes(key)) {\n this.notes.push(`Skipped the function at ${describePath(keyPath)} (${this.position(property.start)})`);\n }\n return { ok: true, key, value: SKIPPED };\n }\n if (key === '__proto__') return this.fail(keyPath, property, '__proto__ key (it sets the prototype)');\n const value = this.readValue(property.value, keyPath);\n return value.ok ? { ok: true, key, value: value.value } : value;\n }\n\n readValue(node: Expression, path: string): ValueRead {\n switch (node.type) {\n case 'Literal':\n if (typeof node.value === 'string' || typeof node.value === 'number' || typeof node.value === 'boolean') {\n return { ok: true, value: node.value };\n }\n if (node.value === null && node.regex === undefined && node.bigint === undefined) {\n return { ok: true, value: null };\n }\n return this.fail(path, node, node.bigint === undefined ? 'regular expression' : 'BigInt');\n case 'UnaryExpression': {\n const { argument } = node;\n if ((node.operator === '-' || node.operator === '+') && argument.type === 'Literal') {\n const { value } = argument;\n if (typeof value === 'number') return { ok: true, value: node.operator === '-' ? -value : value };\n }\n return this.fail(path, node, `${node.operator} expression`);\n }\n case 'TemplateLiteral': {\n const [quasi] = node.quasis;\n const cooked = quasi?.value.cooked;\n return node.expressions.length === 0 && typeof cooked === 'string'\n ? { ok: true, value: cooked }\n : this.fail(path, node, 'template literal with substitutions');\n }\n case 'ArrayExpression':\n return this.readArray(node, path);\n case 'ObjectExpression': {\n const read = this.readObject(node, path);\n return read.ok ? { ok: true, value: Object.fromEntries(read.value) } : read;\n }\n default:\n return this.fail(path, node, describeNode(node));\n }\n }\n\n private readArray(node: ArrayExpression, path: string): ValueRead {\n const values: unknown[] = [];\n for (const [index, element] of node.elements.entries()) {\n const elementPath = `${path}[${index}]`;\n if (element === null) return this.fail(elementPath, node, 'array hole');\n if (element.type === 'SpreadElement') return this.fail(elementPath, element, 'spread element');\n if (isFunction(element)) return this.fail(elementPath, element, 'function in an array');\n const value = this.readValue(element, elementPath);\n if (!value.ok) return value;\n values.push(value.value);\n }\n return { ok: true, value: values };\n }\n}\n\nfunction isFunction(node: Expression): boolean {\n return node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression';\n}\n\n/** A property's key as JavaScript makes it, or `undefined` for a computed key. */\nfunction propertyKey(property: Property): string | undefined {\n if (property.computed) return undefined;\n const { key } = property;\n if (key.type === 'Identifier') return key.name;\n // Otherwise a string, number or BigInt literal (acorn parses no other key that is not computed),\n // named by its string form as in JavaScript: `0x10` is \"16\", `1.50` is \"1.5\", `1n` is \"1\".\n return key.type === 'Literal' ? String(key.value) : undefined;\n}\n\nconst IDENTIFIER_NAME = /^[$_\\p{ID_Start}][$\\u200c\\u200d\\p{ID_Continue}]*$/u;\n\n/** The path of a property, written as JavaScript would access it: `a.b`, `a[\"c-d\"]`, `a[0]`. */\nfunction joinPath(path: string, key: string): string {\n if (IDENTIFIER_NAME.test(key)) return path === '' ? key : `${path}.${key}`;\n return `${path}[${JSON.stringify(key)}]`;\n}\n\nfunction describePath(path: string): string {\n return path === '' ? 'the format object' : `property ${path}`;\n}\n\n/** A readable name for a kind of expression: `CallExpression` is \"call expression\". */\nfunction describeNode(node: AnyNode): string {\n if (node.type === 'Identifier') return `identifier ${JSON.stringify(node.name)}`;\n return node.type.replace(/(?<=[a-z])(?=[A-Z])/g, ' ').toLowerCase();\n}\n\n/**\n * The object literal that is all of `source`, if it is one: a format.js written as bare JSON or as\n * an object literal, which Tweego reads too.\n */\nfunction wholeFileObject(source: string, program: Program | undefined): ObjectExpression | undefined {\n // In parentheses, the object is a script of one expression statement.\n const [statement, ...others] = program?.body ?? [];\n if (statement?.type === 'ExpressionStatement' && others.length === 0) {\n return statement.expression.type === 'ObjectExpression' ? statement.expression : undefined;\n }\n // Bare, it is no valid script ({a: 1, b: 2}) or a labelled block ({a: 1}): read it as an expression.\n const read = trySyntax(() => {\n const node = AcornParser.parseExpressionAt(source, 0, SCRIPT_OPTIONS);\n // Only comments and white space may follow.\n const after = AcornParser.tokenizer(source.slice(node.end), SCRIPT_OPTIONS).getToken();\n return node.type === 'ObjectExpression' && after.type === tokTypes.eof ? node : undefined;\n });\n return read.ok ? read.value : undefined;\n}\n\n/** The format object of a parsed file, or why there is none. */\nfunction locateFormatObject(\n source: string,\n program: Program,\n reader: LiteralReader,\n): { readonly ok: true; readonly node: ObjectExpression } | ErrorResult {\n const calls = findStoryFormatCalls(program);\n const [call, ...others] = calls;\n if (call === undefined) {\n const node = wholeFileObject(source, program);\n return node === undefined\n ? { ok: false, reason: 'Could not find a storyFormat({…}) call in the story format file.' }\n : { ok: true, node };\n }\n if (others.length > 0) {\n const where = calls.map((c) => reader.position(c.start)).join('; ');\n return {\n ok: false,\n reason: `The story format file calls storyFormat() ${calls.length} times (${where}); expected exactly one call.`,\n };\n }\n const [argument] = call.arguments;\n if (argument?.type !== 'ObjectExpression') {\n return {\n ok: false,\n reason: `The storyFormat() call at ${reader.position(call.start)} is not given an object literal.`,\n };\n }\n return { ok: true, node: argument };\n}\n\n/** The properties of a format.js's format object, with notes on what was left out, or why it has none. */\ntype FormatObjectRead =\n { readonly ok: true; readonly fields: ReadonlyMap<string, unknown>; readonly notes: string[] } | ErrorResult;\n\n/**\n * Find and read the format object of a format.js, as the module comment describes. (Exported for\n * tests; the module is not part of the package's API.)\n */\nexport function readFormatObject(source: string): FormatObjectRead {\n const reader = new LiteralReader(source);\n const parsed = parseScript(source);\n let node: ObjectExpression | undefined;\n if (parsed.ok) {\n const located = locateFormatObject(source, parsed.value, reader);\n if (!located.ok) return located;\n node = located.node;\n } else {\n // A file that is one object literal with several properties is not a valid script.\n node = wholeFileObject(source, undefined);\n if (node === undefined) {\n const { error } = parsed;\n return {\n ok: false,\n reason: error.tooDeep\n ? `The story format file nests too deeply to read (the JavaScript parser ran out of stack space) at ${reader.position(error.pos)}.`\n : `The story format file is not valid JavaScript: ${error.message} at ${reader.position(error.pos)}.`,\n };\n }\n }\n const read = reader.readObject(node, '');\n if (!read.ok) return { ok: false, reason: `Could not decode the story format object: ${read.reason}.` };\n return { ok: true, fields: read.value, notes: reader.notes };\n}\n\n/**\n * Read the metadata of a Twine 2 format.js, or say why it cannot be used. See the module comment\n * for what the file and its format object may contain.\n */\nexport function decodeFormatJSON(source: string): FormatDecodeResult {\n const read = readFormatObject(source);\n return read.ok ? toFormatJSON(read.fields, read.notes) : read;\n}\n\n/**\n * Check a format object's fields. Per spec, `name` is optional; `version` and `source` are\n * required. An optional field of the wrong type is ignored, with a note.\n */\nfunction toFormatJSON(fields: ReadonlyMap<string, unknown>, notes: string[]): FormatDecodeResult {\n const version = fields.get('version');\n const source = fields.get('source');\n if (typeof version !== 'string') return { ok: false, reason: 'Story format has no \"version\" string.' };\n if (typeof source !== 'string') return { ok: false, reason: 'Story format has no \"source\" string.' };\n if (!parseVersion(version)) {\n return { ok: false, reason: `Story format version ${JSON.stringify(version)} is not a SemVer version.` };\n }\n const optionalString = (key: string): string | undefined => {\n const value = fields.get(key);\n if (value === undefined || typeof value === 'string') return value;\n notes.push(`Ignored \"${key}\": it is not a string`);\n return undefined;\n };\n const name = optionalString('name') ?? UNNAMED_FORMAT_NAME;\n const proofing = fields.get('proofing');\n if (proofing !== undefined && typeof proofing !== 'boolean') notes.push('Ignored \"proofing\": it is not a boolean');\n const data: Twine2FormatJSON = { name, version, source, proofing: proofing === true };\n for (const key of OPTIONAL_TEXT_FIELDS) {\n const value = optionalString(key);\n if (value !== undefined) data[key] = value;\n }\n return { ok: true, data, notes };\n}\n\n/**\n * Read the format object of a Twine 2 `format.js` (the object literal passed to its `storyFormat()` call);\n * null when the file holds no usable format. Compiling reports why a format cannot be used.\n */\nexport function parseFormatJSON(source: string): Twine2FormatJSON | null {\n const result = decodeFormatJSON(source);\n return result.ok ? result.data : null;\n}\n","/**\n * Story format discovery in local folders, and the one selection policy every source shares.\n * Ported from formats.go + config.go.\n *\n * Every source (local folders here; format URLs and format indices in format-resolution.ts) turns\n * what it has into {@link FormatCandidate}s, and {@link selectFormat} alone decides which one\n * answers a request. docs/story-formats.md (\"How a format is chosen\") states the same policy.\n */\nimport { readdirSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { homedir } from 'node:os';\nimport type { Diagnostic, FormatDecodeResult, FormatRequest, SemVer, StoryFormatInfo } from './types.js';\nimport { decodeFormatJSON } from './format-decode.js';\nimport { compareVersions, parseVersion } from './semver.js';\nimport { normalizeSourceText } from './source-text.js';\nimport { decodeText, pushAll, readUTF8 } from './util.js';\nimport { TweeTsError } from './errors.js';\n\n/** The message of a caught error, or the text of a thrown value that is not an Error. */\nexport function errorText(e: unknown): string {\n return e instanceof Error ? e.message : String(e);\n}\n\n/** A directory's entries in a stable order, or none when it cannot be read. */\nfunction listDirectory(dir: string): string[] {\n try {\n return readdirSync(dir).sort();\n } catch {\n return [];\n }\n}\n\nfunction isDirectory(path: string): boolean {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n}\n\n/** The device and inode of the folder at `path` (the same however the folder is named), or undefined for no folder. */\nfunction directoryIdentity(path: string): string | undefined {\n try {\n const stat = statSync(path, { bigint: true });\n return stat.isDirectory() ? `${stat.dev}:${stat.ino}` : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction isFile(path: string): boolean {\n try {\n return statSync(path).isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * Load the format in one folder: its format.js (Twine 2), else its header.html (Twine 1).\n * A format.js that cannot be used is reported as a warning, as Tweego does.\n */\nfunction loadFormatDir(\n searchDir: string,\n id: string,\n diagnostics: Diagnostic[] | undefined,\n): StoryFormatInfo | undefined {\n const formatDir = join(searchDir, id);\n if (!isDirectory(formatDir)) return undefined;\n\n for (const baseFilename of ['format.js', 'header.html']) {\n const filename = join(formatDir, baseFilename);\n if (!isFile(filename)) continue;\n\n if (baseFilename === 'header.html') {\n // Twine 1 format: the folder name is its name.\n return { id, filename, isTwine2: false, name: id, version: '', proofing: false };\n }\n\n // An encoding warning explains a skipped format; for a usable one, readFormatSource() reports it when used.\n const encoding: Diagnostic[] = [];\n let decoded: FormatDecodeResult;\n try {\n decoded = decodeFormatJSON(readUTF8(filename, encoding));\n } catch (e) {\n decoded = { ok: false, reason: `Could not read ${filename}: ${errorText(e)}` };\n }\n if (!decoded.ok) {\n pushAll(diagnostics, encoding);\n diagnostics?.push({\n level: 'warning',\n message: `format ${id}: Skipping format; ${decoded.reason} (${filename})`,\n });\n continue;\n }\n return formatInfoFromJSON(id, filename, decoded.data);\n }\n return undefined;\n}\n\n/** The StoryFormatInfo of a Twine 2 format, from its decoded format.js metadata. */\nexport function formatInfoFromJSON(\n id: string,\n filename: string,\n data: {\n readonly name: string;\n readonly version: string;\n readonly proofing?: boolean | undefined;\n readonly author?: string | undefined;\n readonly description?: string | undefined;\n readonly image?: string | undefined;\n readonly url?: string | undefined;\n readonly license?: string | undefined;\n },\n): StoryFormatInfo {\n const format: StoryFormatInfo = {\n id,\n filename,\n isTwine2: true,\n name: data.name,\n version: data.version,\n proofing: data.proofing === true,\n };\n if (data.author) format.author = data.author;\n if (data.description) format.description = data.description;\n if (data.image) format.image = data.image;\n if (data.url) format.url = data.url;\n if (data.license) format.license = data.license;\n return format;\n}\n\n/**\n * Discover every story format in the search directories, keyed by folder name (the format ID),\n * without version pruning.\n *\n * Directories are searched in order, and a later directory outranks an earlier one: when two hold\n * the same folder name, the later one's format is kept. The map iterates in that order too, lowest\n * rank first. Formats that cannot be used are left out, with a warning in `diagnostics`.\n */\nexport function discoverAllFormats(\n searchDirs: readonly string[],\n diagnostics?: Diagnostic[],\n): Map<string, StoryFormatInfo> {\n const formats = new Map<string, StoryFormatInfo>();\n for (const searchDir of searchDirs) {\n for (const entry of listDirectory(searchDir)) {\n const format = loadFormatDir(searchDir, entry, diagnostics);\n if (!format) continue;\n // Re-insert, so the map's order follows the directories' rank.\n formats.delete(entry);\n formats.set(entry, format);\n }\n }\n return formats;\n}\n\n/** The version a format is pruned and selected by, or null for one outside SemVer pruning. */\nfunction prunableVersion(format: StoryFormatInfo): SemVer | null {\n return format.isTwine2 && format.name ? parseVersion(format.version) : null;\n}\n\n/** The search directory a discovered format was found in. */\nfunction searchDirOf(format: StoryFormatInfo): string {\n return dirname(dirname(format.filename));\n}\n\n/**\n * The rank of each format's search directory in a discovered map (higher outranks lower).\n * Search directories first appear in the map in rank order (see {@link discoverAllFormats}).\n */\nfunction searchDirRanks(formats: ReadonlyMap<string, StoryFormatInfo>): Map<StoryFormatInfo, number> {\n const dirRank = new Map<string, number>();\n return new Map(\n [...formats.values()].map((format) => {\n const dir = searchDirOf(format);\n const rank = dirRank.get(dir) ?? dirRank.size;\n dirRank.set(dir, rank);\n return [format, rank] as const;\n }),\n );\n}\n\n/**\n * The pruning group of a format: its name, exactly as written (as in Tweego), and its major version.\n * Two formats whose names differ only in case both survive pruning, so that selection can prefer\n * the one in the request's exact case between equal versions.\n */\nfunction pruneGroup(format: StoryFormatInfo, version: SemVer): string {\n return `${format.name}\\0${version.major}`;\n}\n\n/**\n * Prune formats by SemVer: within each (name, major) group, keep only the version with the highest\n * precedence (a release outranks its prereleases). Between equal versions, the folder in the higher-ranked search directory wins, and within\n * one directory the first folder name in sort order. Returns a new map in the same order.\n *\n * Pruning serves name-based selection and listings. An explicit format ID is looked up in the\n * unpruned map, so a pinned folder is used even when another folder holds a newer version.\n */\nexport function pruneFormats(formats: ReadonlyMap<string, StoryFormatInfo>): Map<string, StoryFormatInfo> {\n const ranks = searchDirRanks(formats);\n const best = new Map<string, { readonly format: StoryFormatInfo; readonly version: SemVer; readonly rank: number }>();\n for (const [format, rank] of ranks) {\n const version = prunableVersion(format);\n if (!version) continue;\n const group = pruneGroup(format, version);\n const current = best.get(group);\n const order = current ? compareVersions(version, current.version) : 1;\n if (order > 0 || (order === 0 && current && rank > current.rank)) {\n best.set(group, { format, version, rank });\n }\n }\n return new Map(\n [...formats].filter(([, format]) => {\n const version = prunableVersion(format);\n return version === null || best.get(pruneGroup(format, version))?.format === format;\n }),\n );\n}\n\n/**\n * Discover all story formats in the given search directories, pruned by SemVer: within each\n * (name, major) group only the highest version survives. A later search directory outranks an earlier one,\n * and a format in it replaces one of the same name and version from an earlier directory.\n */\nexport function discoverFormats(searchDirs: readonly string[]): Map<string, StoryFormatInfo> {\n return pruneFormats(discoverAllFormats(searchDirs));\n}\n\n/**\n * Get the format search directories, lowest rank first: the story format subdirectories of the\n * home directory, then of the working directory, then each `TWEEGO_PATH` entry, then `extraPaths`\n * (`formatPaths`). A later directory outranks an earlier one for the same format folder name, so\n * `formatPaths` override `TWEEGO_PATH`, which overrides the home and working directories, as in\n * Tweego.\n */\nexport function getFormatSearchDirs(extraPaths: readonly string[] = [], useTweegoPath = true): string[] {\n const subdirNames = ['storyformats', '.storyformats', 'story-formats', 'storyFormats', 'targets'];\n const basePaths = new Set<string>();\n\n // Home directory\n try {\n basePaths.add(homedir());\n } catch {\n // ignore\n }\n\n // Working directory\n basePaths.add(process.cwd());\n\n // On a case-insensitive file system (macOS and Windows by default) `storyformats` and\n // `storyFormats` name one folder, as do two names that reach it through a link. Each folder\n // is searched once, at the rank of the first name found for it, on every platform.\n const seen = new Set<string>();\n const dirs = [...basePaths]\n .flatMap((base) => subdirNames.map((sub) => join(base, sub)))\n .filter((dir) => {\n const identity = directoryIdentity(dir);\n if (identity === undefined || seen.has(identity)) return false;\n seen.add(identity);\n return true;\n });\n\n // TWEEGO_PATH environment variable\n const tweegoPath = useTweegoPath ? process.env['TWEEGO_PATH'] : undefined;\n if (tweegoPath) pushAll(dirs, tweegoPath.split(process.platform === 'win32' ? ';' : ':'));\n\n // Extra user-provided paths outrank everything else.\n pushAll(dirs, extraPaths);\n\n return dirs;\n}\n\n/**\n * The key two format names match by: names that differ only in letter case are the same format.\n * Every lookup, pruning, and `cache clear` compare names through this one function.\n */\nexport function formatNameKey(name: string): string {\n return name.toLowerCase();\n}\n\n/**\n * Build a directory-style format ID from a name and version, e.g. ('SugarCube', '2.37.3') →\n * 'sugarcube-2': the name in lower case with each run of whitespace replaced by `-`, then the major\n * version. A version that is not a version gives major 0.\n */\nexport function makeFormatId(name: string, version: string): string {\n const major = parseVersion(version)?.major ?? 0;\n return `${formatNameKey(name).replace(/\\s+/g, '-')}-${major}`;\n}\n\n/** Describe a format request for diagnostics. */\nexport function describeFormatRequest(request: FormatRequest): string {\n switch (request.kind) {\n case 'id':\n return `\"${request.id}\"`;\n case 'name':\n return request.version ? `\"${request.name}\" at version \"${request.version}\"` : `\"${request.name}\"`;\n default: {\n const _exhaustive: never = request;\n throw new Error(`unhandled format request: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n\n// --- The candidate model and the selection policy ---\n\n/** The kind of source a candidate comes from. */\nexport type FormatSourceKind = 'local' | 'url' | 'index';\n\n/**\n * One format some source can supply, with what selection needs to know about it. Candidates from\n * every source have this one shape, so {@link selectFormat} cannot treat two sources differently\n * except through `rank`.\n */\nexport interface FormatCandidate {\n /** The format's name: from its format.js, an index entry, or (Twine 1, local) its folder. */\n readonly name: string;\n /** The format's version as written; '' for a local Twine 1 format. */\n readonly version: string;\n readonly isTwine2: boolean;\n readonly source: FormatSourceKind;\n /**\n * The position of the candidate's source in the source order: local folders 0, then each format\n * URL, then each format index. A lower rank is preferred (see {@link selectFormat}).\n */\n readonly rank: number;\n /** A local candidate's folder name, which an ID request may name. */\n readonly folder?: string | undefined;\n /** A local candidate's search directory rank (higher outranks lower). */\n readonly dirRank?: number | undefined;\n}\n\n/**\n * How a candidate answers a request, best first:\n * - `pinned`: an ID request names the candidate's local folder.\n * - `exact`: a name request's version, by SemVer precedence.\n * - `newer`: a name request, the same major version and above the version asked for.\n * - `any`: a name request whose version is empty or not a version: any version.\n * - `id`: an ID request matches the candidate's name and major version ({@link makeFormatId}).\n * - `older`: a name request, the same major version and below the version asked for. Used only\n * when no source has a candidate of any other tier, and then with a warning.\n */\nexport type MatchTier = 'pinned' | 'exact' | 'newer' | 'any' | 'id' | 'older';\n\nconst TIER_ORDER: readonly MatchTier[] = ['pinned', 'exact', 'newer', 'any', 'id', 'older'];\n\n/** How a candidate relates to a request: the tier it answers in, or why it does not answer. */\nexport type Judgement =\n | { readonly kind: 'match'; readonly tier: MatchTier; readonly version: SemVer | null }\n | { readonly kind: 'rejected'; readonly reason: string };\n\nfunction rejected(reason: string): Judgement {\n return { kind: 'rejected', reason };\n}\n\n/** Whether a request's ID names a local candidate's folder (without regard to case). */\nfunction namesFolder(request: { readonly id: string }, candidate: FormatCandidate): boolean {\n return candidate.folder !== undefined && formatNameKey(candidate.folder) === formatNameKey(request.id);\n}\n\n/** Judge one candidate against a request: the policy for a single candidate, whatever its source. */\nexport function judgeCandidate(request: FormatRequest, candidate: FormatCandidate): Judgement {\n const version = parseVersion(candidate.version);\n switch (request.kind) {\n case 'id': {\n if (namesFolder(request, candidate)) return { kind: 'match', tier: 'pinned', version };\n if (!version) return rejected('its version is not a SemVer version');\n const id = makeFormatId(candidate.name, candidate.version);\n const wanted = formatNameKey(request.id);\n if (id !== wanted) {\n const sameName = id.replace(/-\\d+$/, '') === wanted.replace(/-\\d+$/, '');\n return rejected(`${sameName ? 'another major version' : 'a different format'} (its ID is ${id})`);\n }\n return { kind: 'match', tier: 'id', version };\n }\n case 'name': {\n if (formatNameKey(candidate.name) !== formatNameKey(request.name)) return rejected('a different format');\n if (!candidate.isTwine2) return rejected('a Twine 1 format (StoryData names Twine 2 formats)');\n if (!version) return rejected('its version is not a SemVer version');\n const wanted = parseVersion(request.version);\n if (!wanted) return { kind: 'match', tier: 'any', version };\n const order = compareVersions(version, wanted);\n if (order === 0) return { kind: 'match', tier: 'exact', version };\n if (version.major !== wanted.major) return rejected(`another major version than ${wanted.major}`);\n return { kind: 'match', tier: order > 0 ? 'newer' : 'older', version };\n }\n default: {\n const _exhaustive: never = request;\n throw new Error(`unhandled format request: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n\n/** Whether a candidate's name (or, for an ID request, folder) has the request's exact letter case. */\nfunction hasExactCase(request: FormatRequest, candidate: FormatCandidate): boolean {\n return request.kind === 'id' ? candidate.folder === request.id : candidate.name === request.name;\n}\n\n/** Options for {@link selectFormat}. */\nexport interface SelectFormatOptions {\n /** When no candidate answers in another tier, take one from the `older` tier. */\n readonly allowOlder?: boolean | undefined;\n}\n\n/** The candidate {@link selectFormat} chose, and the tier it answers the request in. */\nexport interface FormatSelection<C extends FormatCandidate> {\n readonly choice: C;\n readonly tier: MatchTier;\n}\n\n/**\n * Choose the candidate that answers a request. This is the whole selection policy:\n *\n * 1. Each candidate is judged alone ({@link judgeCandidate}); the result depends on its name,\n * version and (local) folder, never on its source kind.\n * 2. Every tier but `older` answers. Among the answering candidates, the lowest source rank wins;\n * within one source, the better tier ({@link MatchTier}); then the greater version (SemVer\n * precedence); then a name (or folder) in the request's exact letter case; then the\n * higher-ranked search directory (local folders); then the earlier candidate.\n * 3. Only when no candidate answers, and `allowOlder` is set, the `older` candidates are ordered\n * the same way (source rank, then greater version, …) and the first is taken.\n *\n * Because the source rank comes first among answering candidates, a source's answer never depends\n * on sources ranked after it, so callers may gather sources one at a time and stop at the first\n * answer: the result equals selecting over every source at once.\n */\nexport function selectFormat<C extends FormatCandidate>(\n request: FormatRequest,\n candidates: readonly C[],\n options: SelectFormatOptions = {},\n): FormatSelection<C> | undefined {\n const judged = candidates.flatMap((candidate, index) => {\n const judgement = judgeCandidate(request, candidate);\n return judgement.kind === 'match' ? [{ candidate, index, tier: judgement.tier, version: judgement.version }] : [];\n });\n type Judged = (typeof judged)[number];\n const order = (a: Judged, b: Judged): number =>\n a.candidate.rank - b.candidate.rank ||\n TIER_ORDER.indexOf(a.tier) - TIER_ORDER.indexOf(b.tier) ||\n compareOptionalVersions(b.version, a.version) ||\n Number(hasExactCase(request, b.candidate)) - Number(hasExactCase(request, a.candidate)) ||\n (b.candidate.dirRank ?? 0) - (a.candidate.dirRank ?? 0) ||\n a.index - b.index;\n\n const answering = judged.filter((j) => j.tier !== 'older').sort(order);\n const best =\n answering[0] ?? (options.allowOlder ? judged.filter((j) => j.tier === 'older').sort(order)[0] : undefined);\n return best && { choice: best.candidate, tier: best.tier };\n}\n\n/** Compare versions that may be missing (a local Twine 1 format); a missing one ranks lowest. */\nfunction compareOptionalVersions(a: SemVer | null, b: SemVer | null): number {\n if (a && b) return compareVersions(a, b);\n return Number(a !== null) - Number(b !== null);\n}\n\n/** Local formats as candidates: rank 0, their folder, and their search directory's rank. */\nexport function localCandidates(\n formats: ReadonlyMap<string, StoryFormatInfo>,\n): (FormatCandidate & { readonly folder: string; readonly info: StoryFormatInfo })[] {\n const ranks = searchDirRanks(formats);\n return [...formats].map(([folder, info]) => ({\n name: info.name,\n version: info.version,\n isTwine2: info.isTwine2,\n source: 'local' as const,\n rank: 0,\n folder,\n dirRank: ranks.get(info),\n info,\n }));\n}\n\n/**\n * Get format ID from Twine 2 name and version, as a compile selects a local format by StoryData:\n * {@link selectFormat} over the pruned formats, so the greatest version with the same major that\n * is not older than `version` (any major when `version` is empty or unparseable).\n */\nexport function getFormatIdByNameAndVersion(\n formats: ReadonlyMap<string, StoryFormatInfo>,\n name: string,\n version: string,\n): string | undefined {\n const request: FormatRequest = { kind: 'name', name, version };\n return selectFormat(request, localCandidates(pruneFormats(formats)))?.choice.folder;\n}\n\n/** Get format ID from Twine 2 name, picking the greatest version. */\nexport function getFormatIdByName(formats: ReadonlyMap<string, StoryFormatInfo>, name: string): string | undefined {\n return getFormatIdByNameAndVersion(formats, name, '');\n}\n\n// --- Format sources ---\n\n/** The bytes of formats that were downloaded, kept with their info so they are never read back from disk. */\nconst downloadedBytes = new WeakMap<\n StoryFormatInfo,\n { readonly bytes: Uint8Array; readonly from: string; readonly files: ReadonlyMap<string, Uint8Array> }\n>();\n\n/**\n * Keep the bytes of a downloaded format with its info, so {@link readFormatSource} uses exactly the\n * bytes that were verified, even when the cache could not be written or changes later. `files` are all\n * the files of the download (a Twine 1 format's `code.js` and `userlib.js` besides its header), which\n * {@link readFormatComponent} reads.\n */\nexport function withFormatBytes(\n info: StoryFormatInfo,\n bytes: Uint8Array,\n from: string,\n files: ReadonlyMap<string, Uint8Array>,\n): StoryFormatInfo {\n downloadedBytes.set(info, { bytes, from, files });\n return info;\n}\n\n/**\n * A component file of a downloaded format (`code.js`, `userlib.js`), as the verified download has it, or\n * `undefined` when the format is not a download or the download has no such file. `diagnostics` receives a\n * warning when it is not valid UTF-8 (it is read as Windows-1252).\n */\nexport function readFormatComponent(\n format: StoryFormatInfo,\n file: string,\n diagnostics?: Diagnostic[],\n): string | undefined {\n const downloaded = downloadedBytes.get(format);\n const bytes = downloaded?.files.get(file);\n if (downloaded === undefined || bytes === undefined) return undefined;\n const decoded = decodeText(bytes, `${downloaded.from} (${file})`);\n pushAll(diagnostics, decoded.diagnostics);\n return normalizeSourceText(decoded.text);\n}\n\n/**\n * Read the story format source (for Twine 2, extract the `source` property from JSON).\n * `diagnostics` receives a warning when the format file is not valid UTF-8 (it is read as Windows-1252).\n */\nexport function readFormatSource(format: StoryFormatInfo, diagnostics?: Diagnostic[]): string {\n const downloaded = downloadedBytes.get(format);\n let source: string;\n if (downloaded) {\n const decoded = decodeText(downloaded.bytes, downloaded.from);\n pushAll(diagnostics, decoded.diagnostics);\n source = normalizeSourceText(decoded.text);\n } else {\n source = readUTF8(format.filename, diagnostics);\n }\n if (!format.isTwine2) return source;\n const decoded = decodeFormatJSON(source);\n if (!decoded.ok) {\n // Discovery decoded the same file, so it changed since; a download is decoded from the bytes it checked.\n throw new TweeTsError(`Cannot parse format ${format.id} JSON: ${decoded.reason}`, [], {\n code: 'FORMAT_UNAVAILABLE',\n });\n }\n // What decoding left out of the format a build uses (a skipped function, a field of the wrong\n // type), once per build, naming where the format came from.\n const from = downloaded ? `downloaded from ${downloaded.from}` : format.filename;\n pushAll(\n diagnostics,\n decoded.notes.map((note) => ({ level: 'warning' as const, message: `format ${format.id}: ${note} (${from})` })),\n );\n return decoded.data.source;\n}\n","/**\n * Writing the files twee-ts produces: build output, and downloaded story formats (which other\n * twee-ts processes share). How a file is written depends on what is at its path:\n *\n * | target | how |\n * |---|---|\n * | nothing, or a regular file with one link | atomic replace: a temporary file in the same folder, renamed over it |\n * | a regular file with more than one hard link | written in place, so every link sees the new build |\n * | a writable regular file whose folder takes no temporary file or rename (a read-only folder, a file bind-mounted on its own) | written in place, as Tweego writes it: not atomic |\n * | a read-only regular file | refused (EACCES), as Tweego's `os.Create` refuses it |\n * | a FIFO, a character device (`/dev/null`, a terminal), `/dev/stdout`, `/dev/fd/N`, a Windows device name (`NUL`) | written through, as a stream |\n * | a folder, a socket, a block device | refused |\n * | nothing, in a folder that does not exist | refused (ENOENT) |\n *\n * A symbolic link (even a dangling one, or a chain of them) is followed to the file it finally points to,\n * which is then written as above; the link stays. A replaced file keeps its permissions. An error names the\n * path the caller gave, never the temporary file.\n */\nimport { createHash, randomBytes } from 'node:crypto';\nimport {\n accessSync,\n chmodSync,\n constants as fsConstants,\n lstatSync,\n readFileSync,\n readlinkSync,\n renameSync,\n rmSync,\n statSync,\n writeFileSync,\n writeSync,\n} from 'node:fs';\nimport type { Stats } from 'node:fs';\nimport { basename, dirname, join, posix, resolve } from 'node:path';\nimport { getSystemErrorMessage } from 'node:util';\nimport { identify } from './path-identity.js';\n\n/**\n * Writes `data` to `path` as the table above says. An atomic replace means a reader sees either the\n * previous file or the complete new one, never a partly written file.\n *\n * On failure (a full disk, a missing folder, a refused target) a temporary file is removed, `path` is\n * left as it was (unless it was being written in place), and the error is thrown with `path` in its\n * message, its original `code`, and the original error as its `cause`.\n */\nexport function writeFileAtomic(path: string, data: string, platform: NodeJS.Platform = process.platform): void {\n try {\n writeTo(path, data, platform);\n } catch (e) {\n throw writeError(path, e);\n }\n const signature = signatureOf(path);\n if (signature !== undefined)\n ownOutputs.set(identify(path).key, { signature, hash: sha256(Buffer.from(data, 'utf-8')) });\n}\n\n/** What identifies a file this process wrote: its stat signature right after the write, and a hash of what was written. */\ninterface WrittenOutput {\n readonly signature: string;\n readonly hash: string;\n}\n\n/** The files this process wrote, by identity key. */\nconst ownOutputs = new Map<string, WrittenOutput>();\n\nfunction sha256(bytes: Uint8Array): string {\n return createHash('sha256').update(bytes).digest('hex');\n}\n\n/**\n * What identifies a regular file's state: size, inode and modification time. An edit in place that keeps all\n * of them (a copy that preserves timestamps) is not seen by this, so {@link isOwnOutput} also checks the content.\n */\nfunction signatureOf(path: string): string | undefined {\n const stat = statSync(path, { throwIfNoEntry: false, bigint: true });\n return stat?.isFile() === true ? `${stat.size}:${stat.dev}:${stat.ino}:${stat.mtimeNs}` : undefined;\n}\n\n/**\n * Whether the file at `path` is one this process wrote and nothing has changed since: an earlier build of\n * a running watch, which may be written over. Its size, inode and modification time must be as they were\n * after the write, and it must hold exactly the bytes that were written: a same-size edit that restores the\n * modification time still changes the content, and the file is then the author's.\n */\nexport function isOwnOutput(path: string): boolean {\n const signature = signatureOf(path);\n const written = ownOutputs.get(identify(path).key);\n if (signature === undefined || written?.signature !== signature) return false;\n try {\n return sha256(readFileSync(path)) === written.hash;\n } catch {\n return false;\n }\n}\n\n/** How a target is written. */\ntype WriteStrategy = 'atomic' | 'in-place' | 'stream';\n\n/**\n * The descriptor of this process that `path` names (`/dev/stdout` is 1, `/dev/fd/3` is 3), or undefined.\n * It is written directly: a socket (what a parent process often gives as standard output) can't be opened\n * by its `/dev/fd` path.\n */\nexport function ownDescriptor(path: string): number | undefined {\n const match = /^\\/dev\\/(?:(stdout)|(stderr)|fd\\/(\\d+))$|^\\/proc\\/self\\/fd\\/(\\d+)$/.exec(posix.resolve(path));\n if (match === null) return undefined;\n if (match[1] !== undefined) return 1;\n if (match[2] !== undefined) return 2;\n return Number(match[3] ?? match[4]);\n}\n\n/** Writes all of `data` to the open descriptor `fd`, waiting while a non-blocking pipe is full. */\nexport function writeToDescriptor(\n fd: number,\n data: string,\n write: (fd: number, bytes: Buffer, offset: number) => number = writeSync,\n): void {\n const bytes = Buffer.from(data, 'utf-8');\n for (let offset = 0; offset < bytes.length;) {\n try {\n offset += write(fd, bytes, offset);\n } catch (e) {\n if (!(e instanceof Error && 'code' in e && e.code === 'EAGAIN')) throw e;\n pause(1);\n }\n }\n}\n\n/**\n * Throws, as writeFileAtomic() would, when `path` can't be written: a folder, a read-only file, a missing\n * folder. A caller checks this before a build, so a target that can't be written fails before the work.\n */\nexport function checkWritable(path: string, platform: NodeJS.Platform = process.platform): void {\n try {\n planWrite(path, platform);\n } catch (e) {\n throw writeError(path, e);\n }\n}\n\n/** The file `path` is written to (links resolved) and how, or undefined for a stream path; throws when it can't be. */\nfunction planWrite(\n path: string,\n platform: NodeJS.Platform,\n): { readonly target: string; readonly strategy: WriteStrategy } | undefined {\n if (isStreamPath(path, platform)) return undefined;\n const target = resolveWriteTarget(path);\n const stat = statSync(target, { throwIfNoEntry: false });\n if (stat === undefined) checkFolder(target);\n return { target, strategy: strategyFor(target, stat) };\n}\n\n/**\n * Throws when there is no folder to hold the new file `target`: nothing at its path, or a file. (On POSIX a\n * file there has already failed the look at `target`, with ENOTDIR; Windows reports that look as ENOENT.)\n */\nfunction checkFolder(target: string): void {\n const folder = dirname(target);\n if (statSync(folder, { throwIfNoEntry: false })?.isDirectory() !== true)\n throw codeError('ENOENT', `the folder ${folder} does not exist`);\n}\n\nfunction writeTo(path: string, data: string, platform: NodeJS.Platform): void {\n const plan = planWrite(path, platform);\n if (plan === undefined) {\n const fd = platform === 'win32' ? undefined : ownDescriptor(path);\n if (fd === undefined) writeFileSync(path, data, { encoding: 'utf-8' });\n else writeToDescriptor(fd, data);\n return;\n }\n const { target, strategy } = plan;\n switch (strategy) {\n case 'stream':\n case 'in-place':\n writeFileSync(target, data, { encoding: 'utf-8' });\n return;\n case 'atomic':\n replaceAtomically(target, data);\n return;\n default: {\n const _exhaustive: never = strategy;\n throw new Error(`unhandled write strategy: ${String(_exhaustive)}`);\n }\n }\n}\n\n/** An error with a Node-style `code`. */\nfunction codeError(code: string, message: string): Error {\n return Object.assign(new Error(`${code}: ${message}`), { code });\n}\n\n/** How the file at `target` (links resolved) is written, or a thrown error when it must not be. */\nexport function strategyFor(target: string, stat: Stats | undefined): WriteStrategy {\n if (stat === undefined) return 'atomic';\n if (stat.isDirectory()) throw codeError('EISDIR', 'the output is a folder');\n if (stat.isFIFO() || stat.isCharacterDevice()) return 'stream';\n if (!stat.isFile()) throw codeError('EINVAL', 'the output is not a file, a FIFO or a character device');\n try {\n accessSync(target, fsConstants.W_OK);\n } catch (cause) {\n throw Object.assign(codeError('EACCES', 'the output file is read-only'), { cause });\n }\n return stat.nlink > 1 ? 'in-place' : 'atomic';\n}\n\n/** Windows device names, which are devices in every folder and with any extension. */\nconst WINDOWS_DEVICE = /(?:^|[\\\\/])(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]|conin\\$|conout\\$)(?:\\.[^\\\\/]*)?$/i;\n\n/**\n * Whether `path` names a stream the operating system resolves itself, which is written through\n * without looking at it: the process's own descriptors (`/dev/stdout`, `/dev/stderr`, `/dev/fd/N`,\n * `/proc/self/fd/N`), whose links don't lead to a path that can be replaced, and on Windows the\n * device names (`NUL`, `CON`, `\\\\.\\…`).\n */\nexport function isStreamPath(path: string, platform: NodeJS.Platform): boolean {\n if (platform === 'win32') {\n return path.startsWith('\\\\\\\\.\\\\') || WINDOWS_DEVICE.test(path);\n }\n return /^\\/dev\\/(?:stdout|stderr|stdin|fd\\/\\d+)$|^\\/proc\\/(?:self|\\d+)\\/fd\\/\\d+$/.test(posix.resolve(path));\n}\n\n/** The most bytes (UTF-8) of the target's name that a temporary name repeats. */\nconst TEMPORARY_NAME_ROOM = 100;\n\n/**\n * The name of the temporary file for a target named `targetName` (a name, not a path): the start of the target's\n * name, cut to {@link TEMPORARY_NAME_ROOM} bytes so a leftover file shows what it was for, then the process and a\n * random token. Whatever the target's name, the result stays well below the 255 that file systems allow in a name,\n * counted in bytes (Linux, macOS) or in UTF-16 code units (Windows), because a cut never splits a character and a\n * kept byte is at least one code unit. It is a name in the target's own folder, so the rename stays atomic.\n */\nexport function temporaryName(targetName: string, pid: number, token: string): string {\n let kept = '';\n let bytes = 0;\n for (const character of targetName) {\n bytes += Buffer.byteLength(character);\n if (bytes > TEMPORARY_NAME_ROOM) break;\n kept += character;\n }\n return `.${kept}.${pid}-${token}.tmp`;\n}\n\n/**\n * Replaces `target` with a temporary file holding `data`, keeping the permissions of the file replaced. When\n * the folder refuses the temporary file or the rename and `target` is a file that can be written, it is\n * written in place instead (see canWriteInPlace).\n */\nfunction replaceAtomically(target: string, data: string): void {\n const temp = join(dirname(target), temporaryName(basename(target), process.pid, randomBytes(6).toString('hex')));\n try {\n writeFileSync(temp, data, { encoding: 'utf-8', flag: 'wx' });\n keepPermissions(target, temp);\n renameWithRetry(temp, target);\n } catch (e) {\n rmSync(temp, { force: true });\n if (!canWriteInPlace(target, e)) throw e;\n writeFileSync(target, data, { encoding: 'utf-8' });\n }\n}\n\n/**\n * Codes for a folder that takes no new file (EACCES, EPERM: a read-only folder) or no rename over the file\n * (EBUSY: a file bind-mounted on its own; on Windows also EPERM, EACCES while another program holds it open).\n */\nconst NO_REPLACE_CODES = new Set(['EACCES', 'EPERM', 'EBUSY']);\n\n/**\n * Whether a replace that failed with `error` falls back to writing `target` in place: the folder refused the\n * temporary file or the rename, and `target` is a regular file (strategyFor() found it writable). Tweego writes\n * every output in place, so a file it can rebuild, twee-ts can too; it is then not atomic. Any other failure (a\n * full disk, no file to write in place) is kept, and a file made read-only meanwhile refuses the write itself.\n */\nfunction canWriteInPlace(target: string, error: unknown): boolean {\n const code = error instanceof Error && 'code' in error ? error.code : undefined;\n return (\n typeof code === 'string' &&\n NO_REPLACE_CODES.has(code) &&\n statSync(target, { throwIfNoEntry: false })?.isFile() === true\n );\n}\n\n/** Codes Windows gives a rename over a file that another program (an antivirus, a live server) has open. */\nconst TRANSIENT_RENAME_CODES = new Set(['EPERM', 'EBUSY', 'EACCES']);\n\n/** How long a rename on Windows is retried, in milliseconds per attempt. */\nconst RENAME_BACKOFF_MS = [10, 20, 40, 80, 160, 320] as const;\n\n/** Blocks the thread for `ms` milliseconds (the write is synchronous, and short). */\nfunction pause(ms: number): void {\n Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);\n}\n\n/**\n * Renames `from` to `to`. On Windows a rename over a file another program holds open fails with\n * EPERM, EBUSY or EACCES for a moment; it is retried with a growing pause, about 0.6 s in all.\n */\nexport function renameWithRetry(\n from: string,\n to: string,\n rename: (from: string, to: string) => void = renameSync,\n platform: NodeJS.Platform = process.platform,\n wait: (ms: number) => void = pause,\n): void {\n for (const delay of platform === 'win32' ? RENAME_BACKOFF_MS : []) {\n try {\n rename(from, to);\n return;\n } catch (e) {\n const code = e instanceof Error && 'code' in e ? e.code : undefined;\n if (typeof code !== 'string' || !TRANSIENT_RENAME_CODES.has(code)) throw e;\n wait(delay);\n }\n }\n rename(from, to);\n}\n\n/** Links followed before a path counts as a cycle (Linux stops at 40 as well). */\nconst MAX_LINK_DEPTH = 40;\n\n/**\n * The file a symlink at `path` finally points to, or `path` itself when it is no link. Links are\n * followed one by one, so a link whose target does not exist yet (absolute, relative, or a chain\n * of them) still resolves to the file that should be created. A relative target is resolved against\n * the folder that really holds the link (see path-identity.ts). A cycle or an unreadable link throws.\n */\nfunction resolveWriteTarget(path: string): string {\n let current = path;\n for (let depth = 0; depth <= MAX_LINK_DEPTH; depth++) {\n const stat = lstatSync(current, { throwIfNoEntry: false });\n if (!stat?.isSymbolicLink()) return current;\n current = resolve(identify(dirname(current)).canonical, readlinkSync(current));\n }\n throw codeError('ELOOP', `too many levels of symbolic links, ${path}`);\n}\n\n/**\n * Gives `temp` the permission bits of `target`, when `target` exists. Best effort: on a file\n * system without Unix permissions chmod can fail, and writing in place never kept them there either.\n */\nfunction keepPermissions(target: string, temp: string): void {\n const existing = statSync(target, { throwIfNoEntry: false });\n if (existing === undefined) return;\n try {\n chmodSync(temp, existing.mode & 0o7777);\n } catch {\n // The new file keeps the default permissions.\n }\n}\n\n/**\n * `cause` as an error that names `path` and keeps the original error code. A system error's own message names\n * the file its call was given, which may be the temporary file: its code and description are used instead.\n */\nfunction writeError(path: string, cause: unknown): Error {\n const message =\n cause instanceof Error && 'errno' in cause && typeof cause.errno === 'number' && 'code' in cause\n ? `${String(cause.code)}: ${getSystemErrorMessage(cause.errno)}`\n : cause instanceof Error\n ? cause.message\n : String(cause);\n const error: Error & { code?: unknown } = new Error(`Cannot write ${path}: ${message}`, { cause });\n if (cause instanceof Error && 'code' in cause) error.code = cause.code;\n return error;\n}\n","/**\n * The story format download cache, keyed by provenance.\n *\n * Each download is one entry, named by a hash of where it came from (its origin): a format index\n * URL plus the index entry (Twine version, name and version as the index lists them), or a format\n * URL. A cache hit is therefore only ever for the same origin, so one project's index or URL never\n * answers another project's request, and directory names never depend on format names (no case,\n * reserved-name or path problems on any platform).\n *\n * Layout, below {@link getCacheDir}:\n *\n * entries/<key>/record.json what the entry is, where it came from, and its files' SHA-256\n * entries/<key>/<content>/<file> the files as downloaded; <content> is a hash of their hashes\n *\n * A content directory is written under a temporary name and renamed into place, and record.json is\n * replaced atomically after it, so a reader sees either the old entry or the new one. Every read\n * checks the files against the hashes in record.json; an entry that does not match is not used.\n * Directories from before this layout (`<name>/<version>/format.js`, and `storyformat-urls/`) are\n * ignored, and removed by {@link clearCachedFormats}.\n */\nimport { createHash, randomBytes } from 'node:crypto';\nimport { lstatSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { basename, dirname, isAbsolute, join, resolve } from 'node:path';\nimport type { StoryFormatInfo } from './types.js';\nimport { renameWithRetry } from './atomic-write.js';\nimport { errorText, formatInfoFromJSON, formatNameKey, makeFormatId } from './formats.js';\nimport { isRecord } from './util.js';\n\n/** Which list of an index an entry comes from. */\nexport type TwineKind = 'twine1' | 'twine2';\n\n/** Where a cached download came from. */\nexport type CacheOrigin =\n | {\n readonly kind: 'index';\n /** The format index URL, as configured (without a fragment). */\n readonly index: string;\n readonly twine: TwineKind;\n /** The entry's name and version, exactly as the index lists them. */\n readonly name: string;\n readonly version: string;\n }\n | { readonly kind: 'url'; readonly url: string };\n\n/** Metadata a Twine 2 format.js may carry besides its name and version. */\nexport interface FormatMetadata {\n readonly proofing: boolean;\n readonly author?: string | undefined;\n readonly description?: string | undefined;\n readonly image?: string | undefined;\n readonly url?: string | undefined;\n readonly license?: string | undefined;\n}\n\n/** What a cache entry holds, as record.json stores it. */\nexport interface CacheRecord {\n /** The entry's directory name: a hash of its origin. */\n readonly key: string;\n readonly origin: CacheOrigin;\n /** The format's name and version (for a format.js that names no format, the index entry's name). */\n readonly name: string;\n readonly version: string;\n readonly isTwine2: boolean;\n readonly metadata: FormatMetadata;\n /** The file the format is read from: format.js (Twine 2) or header.html (Twine 1). */\n readonly main: string;\n /** Each file's lower-case hex SHA-256. */\n readonly files: ReadonlyMap<string, string>;\n /** The content directory name. */\n readonly dir: string;\n /** When the files were downloaded (ISO 8601). */\n readonly fetchedAt: string;\n /** The URL the main file was downloaded from. */\n readonly downloadUrl: string;\n /** Validators from the response, for a conditional request when a format URL is checked again. */\n readonly etag?: string | undefined;\n readonly lastModified?: string | undefined;\n}\n\n/** A cache entry that was read and checked: its record and its files' bytes. */\nexport interface LoadedEntry {\n readonly record: CacheRecord;\n readonly files: ReadonlyMap<string, Uint8Array<ArrayBuffer>>;\n /** The path of the main file. */\n readonly path: string;\n}\n\nconst RECORD_SCHEMA = 2;\nconst ENTRIES = 'entries';\nconst RECORD_FILE = 'record.json';\nconst TEMP_PREFIX = '.tmp-';\nconst HEX64 = /^[0-9a-f]{64}$/;\n\n/** The files a cache entry may hold: those twee-ts reads from a format's folder. */\nconst CACHEABLE_FILES: ReadonlySet<string> = new Set(['format.js', 'header.html', 'code.js', 'userlib.js']);\n\n/**\n * The cache base directory: `$XDG_CACHE_HOME`, else `~/.cache`. As the XDG Base Directory spec\n * says, an empty or relative `XDG_CACHE_HOME` is ignored, so the cache never moves with the\n * working directory.\n */\nfunction cacheBase(): string {\n const xdg = process.env['XDG_CACHE_HOME'];\n return xdg !== undefined && xdg !== '' && isAbsolute(xdg) ? xdg : join(homedir(), '.cache');\n}\n\n/** Get the cache directory for downloaded story formats. */\nexport function getCacheDir(): string {\n return join(cacheBase(), 'twee-ts', 'storyformats');\n}\n\n/** Where twee-ts 1.x kept downloads from format URLs; only removed now. */\nfunction legacyUrlCacheDir(): string {\n return join(cacheBase(), 'twee-ts', 'storyformat-urls');\n}\n\nfunction entriesDir(): string {\n return join(resolve(getCacheDir()), ENTRIES);\n}\n\n/** The lower-case hex SHA-256 of some bytes or text. */\nexport function sha256Hex(data: Uint8Array | string): string {\n return createHash('sha256').update(data).digest('hex');\n}\n\n/** The cache entry name of an origin. */\nexport function cacheKey(origin: CacheOrigin): string {\n switch (origin.kind) {\n case 'index':\n return sha256Hex(JSON.stringify(['index', origin.index, origin.twine, origin.name, origin.version]));\n case 'url':\n return sha256Hex(JSON.stringify(['url', origin.url]));\n default: {\n const _exhaustive: never = origin;\n throw new Error(`unhandled cache origin: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n\n/** The content directory name of a set of files: a hash of their names and hashes. */\nfunction contentDirName(files: ReadonlyMap<string, string>): string {\n return sha256Hex(JSON.stringify([...files].map(([file, hash]) => `${file}:${hash}`).sort()));\n}\n\n// --- Reading record.json ---\n\nfunction optionalString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction parseOrigin(value: unknown): CacheOrigin | undefined {\n if (!isRecord(value)) return undefined;\n const kind = value['kind'];\n if (kind === 'url') {\n const url = value['url'];\n return typeof url === 'string' ? { kind, url } : undefined;\n }\n if (kind !== 'index') return undefined;\n const { index, twine, name, version } = value;\n if (typeof index !== 'string' || typeof name !== 'string' || typeof version !== 'string') return undefined;\n if (twine !== 'twine1' && twine !== 'twine2') return undefined;\n return { kind, index, twine, name, version };\n}\n\nfunction parseFiles(value: unknown): Map<string, string> | undefined {\n if (!isRecord(value)) return undefined;\n const files = new Map<string, string>();\n for (const [file, hash] of Object.entries(value)) {\n if (!CACHEABLE_FILES.has(file) || typeof hash !== 'string' || !HEX64.test(hash)) return undefined;\n files.set(file, hash);\n }\n return files;\n}\n\nfunction parseMetadata(value: unknown): FormatMetadata | undefined {\n if (!isRecord(value) || typeof value['proofing'] !== 'boolean') return undefined;\n return {\n proofing: value['proofing'],\n author: optionalString(value['author']),\n description: optionalString(value['description']),\n image: optionalString(value['image']),\n url: optionalString(value['url']),\n license: optionalString(value['license']),\n };\n}\n\n/** A record.json's content as a record, or undefined when it is not one written for `key`. */\nfunction parseRecord(key: string, json: unknown): CacheRecord | undefined {\n if (!isRecord(json) || json['schema'] !== RECORD_SCHEMA) return undefined;\n const origin = parseOrigin(json['origin']);\n const files = parseFiles(json['files']);\n const metadata = parseMetadata(json['metadata']);\n const { name, version, isTwine2, main, dir, fetchedAt, downloadUrl } = json;\n if (!origin || !files || !metadata || cacheKey(origin) !== key) return undefined;\n if (typeof name !== 'string' || typeof version !== 'string' || typeof isTwine2 !== 'boolean') return undefined;\n if (typeof main !== 'string' || !files.has(main) || typeof dir !== 'string' || dir !== contentDirName(files)) {\n return undefined;\n }\n if (typeof fetchedAt !== 'string' || typeof downloadUrl !== 'string') return undefined;\n return {\n key,\n origin,\n name,\n version,\n isTwine2,\n metadata,\n main,\n files,\n dir,\n fetchedAt,\n downloadUrl,\n etag: optionalString(json['etag']),\n lastModified: optionalString(json['lastModified']),\n };\n}\n\n/** The record of the entry for `origin`, or undefined when there is none (or it is damaged). */\nexport function readRecord(origin: CacheOrigin): CacheRecord | undefined {\n return readRecordByKey(cacheKey(origin));\n}\n\nfunction readRecordByKey(key: string): CacheRecord | undefined {\n try {\n const keyDir = join(entriesDir(), key);\n // A symlinked entry could lead out of the cache: only plain directories are entries.\n if (!lstatSync(keyDir, { throwIfNoEntry: false })?.isDirectory()) return undefined;\n return parseRecord(key, JSON.parse(readFileSync(join(keyDir, RECORD_FILE), 'utf-8')));\n } catch {\n return undefined;\n }\n}\n\n/** Every readable cache entry's record, in a stable order (by key). */\nexport function listRecords(): CacheRecord[] {\n let keys: string[];\n try {\n keys = readdirSync(entriesDir()).filter((key) => HEX64.test(key));\n } catch {\n return [];\n }\n return keys.sort().flatMap((key) => readRecordByKey(key) ?? []);\n}\n\n/**\n * Read a cache entry's files and check each against its record. Returns the reason when the entry\n * cannot be used (a file is missing, unreadable, or not the bytes the record names).\n */\nexport function loadEntry(record: CacheRecord): LoadedEntry | { readonly error: string } {\n const contentDir = join(entriesDir(), record.key, record.dir);\n const files = new Map<string, Uint8Array<ArrayBuffer>>();\n for (const [file, hash] of record.files) {\n const path = join(contentDir, file);\n let bytes: Uint8Array<ArrayBuffer>;\n try {\n if (!lstatSync(path).isFile()) return { error: `${path} is not a plain file` };\n bytes = new Uint8Array(readFileSync(path));\n } catch (e) {\n return { error: `could not read ${path}: ${errorText(e)}` };\n }\n const actual = sha256Hex(bytes);\n if (actual !== hash) return { error: `${path} has SHA-256 ${actual}, but was saved with ${hash}` };\n files.set(file, bytes);\n }\n return { record, files, path: join(contentDir, record.main) };\n}\n\n/** The StoryFormatInfo of a cache record whose main file is at `filename`. */\nexport function recordFormatInfo(\n record: Pick<CacheRecord, 'name' | 'version' | 'isTwine2' | 'metadata'>,\n filename: string,\n): StoryFormatInfo {\n const id = makeFormatId(record.name, record.version);\n if (record.isTwine2) {\n return formatInfoFromJSON(id, filename, { name: record.name, version: record.version, ...record.metadata });\n }\n return { id, filename, isTwine2: false, name: record.name, version: record.version, proofing: false };\n}\n\n// --- Writing ---\n\n/** Whether `e` is a Node.js system error with one of the given codes. */\nfunction hasErrorCode(e: unknown, ...codes: readonly string[]): boolean {\n return e instanceof Error && 'code' in e && typeof e.code === 'string' && codes.includes(e.code);\n}\n\n/**\n * Create `dir` as a plain directory, or check that it already is one (a symlink could lead out of\n * the cache). A directory another process creates between the check and the mkdir is fine.\n */\nfunction ensurePlainDirectory(dir: string): void {\n try {\n mkdirSync(dir);\n } catch (e) {\n if (!hasErrorCode(e, 'EEXIST')) throw e;\n }\n const stat = lstatSync(dir);\n if (stat.isSymbolicLink() || !stat.isDirectory()) {\n throw new Error(`Refusing to write a story format outside the cache directory: ${dir} is not a plain directory`);\n }\n}\n\n/**\n * Write `data` to `path` through a temporary file renamed into place. Several processes share the cache, and on\n * Windows a rename over a file another process has open fails for a moment (EPERM), so it is retried.\n */\nfunction writeAtomically(path: string, data: string | Uint8Array): void {\n const temp = join(dirname(path), `${TEMP_PREFIX}${process.pid}-${randomBytes(6).toString('hex')}`);\n try {\n writeFileSync(temp, data, { flag: 'wx' });\n renameWithRetry(temp, path);\n } catch (e) {\n rmSync(temp, { force: true });\n throw e;\n }\n}\n\n/** What {@link writeEntry} saves besides the files. */\nexport type NewRecord = Omit<CacheRecord, 'key' | 'files' | 'dir'>;\n\n/**\n * Save a download as the cache entry of its origin, replacing any earlier one, and return the\n * path of its main file. Throws (with the cache path in the message) when the cache cannot be\n * written; the caller decides whether that fails anything.\n */\nexport function writeEntry(record: NewRecord, files: ReadonlyMap<string, Uint8Array>): string {\n const hashes = new Map([...files].map(([file, bytes]) => [file, sha256Hex(bytes)] as const));\n if (!hashes.has(record.main) || ![...hashes.keys()].every((file) => CACHEABLE_FILES.has(file))) {\n throw new Error(`A cache entry needs its main file ${record.main}, and only format files`);\n }\n const key = cacheKey(record.origin);\n const dir = contentDirName(hashes);\n const root = entriesDir();\n mkdirSync(root, { recursive: true });\n const keyDir = join(root, key);\n ensurePlainDirectory(keyDir);\n const contentDir = join(keyDir, dir);\n writeContentDir(keyDir, contentDir, files, hashes);\n\n const json = {\n schema: RECORD_SCHEMA,\n origin: record.origin,\n name: record.name,\n version: record.version,\n isTwine2: record.isTwine2,\n metadata: record.metadata,\n main: record.main,\n files: Object.fromEntries(hashes),\n dir,\n fetchedAt: record.fetchedAt,\n downloadUrl: record.downloadUrl,\n ...(record.etag === undefined ? {} : { etag: record.etag }),\n ...(record.lastModified === undefined ? {} : { lastModified: record.lastModified }),\n };\n const replaced = readRecordByKey(key)?.dir;\n writeAtomically(join(keyDir, RECORD_FILE), `${JSON.stringify(json, null, 2)}\\n`);\n // Another writer's cleanup may have removed this content, or set it aside, as the one its record\n // replaced (the same bytes saved again) before this record was published: the record is published\n // now, so no cleanup removes the directory any more (see removeContentDir); make it whole under it.\n writeContentDir(keyDir, contentDir, files, hashes);\n removeStaleContent(keyDir, replaced);\n return join(contentDir, record.main);\n}\n\n/**\n * Make `contentDir` (named by the hashes of `files`) hold exactly these files: they go to a temporary\n * directory that is renamed into place, so the directory is complete or absent. A directory that is\n * already there is not trusted: each of its files is checked, and one that is missing, damaged or not\n * a plain file is written again (see {@link repairContentDir}).\n */\nfunction writeContentDir(\n keyDir: string,\n contentDir: string,\n files: ReadonlyMap<string, Uint8Array>,\n hashes: ReadonlyMap<string, string>,\n): void {\n const existing = lstatSync(contentDir, { throwIfNoEntry: false });\n if (existing?.isDirectory()) {\n repairContentDir(contentDir, files, hashes);\n return;\n }\n if (existing) {\n throw new Error(`Refusing to write a story format outside the cache directory: ${contentDir} is not a directory`);\n }\n const temp = join(keyDir, `${TEMP_PREFIX}${process.pid}-${randomBytes(6).toString('hex')}`);\n try {\n mkdirSync(temp);\n for (const [file, bytes] of files) writeFileSync(join(temp, file), bytes, { flag: 'wx' });\n renameWithRetry(temp, contentDir);\n } catch (e) {\n rmSync(temp, { recursive: true, force: true });\n // Another process put content there meanwhile (the name is a hash of it): check it like any other.\n if (lstatSync(contentDir, { throwIfNoEntry: false })?.isDirectory()) {\n repairContentDir(contentDir, files, hashes);\n return;\n }\n throw e;\n }\n}\n\n/** Whether `path` is a plain file holding the bytes with SHA-256 `hash`. */\nfunction isIntactFile(path: string, hash: string): boolean {\n try {\n return lstatSync(path).isFile() && sha256Hex(readFileSync(path)) === hash;\n } catch {\n return false;\n }\n}\n\n/**\n * Write again each file of an existing content directory that is missing, damaged or not a plain\n * file, each through a temporary file renamed into place (replacing a link, never writing through it).\n */\nfunction repairContentDir(\n contentDir: string,\n files: ReadonlyMap<string, Uint8Array>,\n hashes: ReadonlyMap<string, string>,\n): void {\n for (const [file, bytes] of files) {\n const path = join(contentDir, file);\n if (isIntactFile(path, hashes.get(file) ?? '')) continue;\n // A folder cannot be renamed over by a file.\n if (lstatSync(path, { throwIfNoEntry: false })?.isDirectory()) rmSync(path, { recursive: true, force: true });\n writeAtomically(path, bytes);\n }\n}\n\n/**\n * How long a content directory that no record named is kept: a writer that has written its content\n * but not yet published the record must not lose it to another writer's cleanup.\n */\nconst IN_FLIGHT_MS = 10 * 60 * 1000;\n\n/**\n * Clean up after a writer published a record that replaced the one naming the content directory\n * `replaced`: remove that directory, and any other that no record names and that is older than a\n * writer takes to publish, and temporary files and directories as old (best effort). The published\n * record is read now, not when the caller wrote it, so a writer that was paused never removes what a\n * later writer published, and a directory another writer has just written, but not yet published,\n * is left alone. Each directory is removed by {@link removeContentDir}, so a writer that publishes\n * the same content again meanwhile keeps it.\n */\nexport function removeStaleContent(keyDir: string, replaced: string | undefined, now = Date.now()): void {\n try {\n const current = readRecordByKey(basename(keyDir))?.dir;\n for (const name of readdirSync(keyDir)) {\n const stat = lstatSync(join(keyDir, name), { throwIfNoEntry: false });\n if (stat === undefined) continue;\n const old = now - stat.mtimeMs > IN_FLIGHT_MS;\n if (name.startsWith(TEMP_PREFIX)) {\n // Left by a writer or a cleanup that stopped part way.\n if (old) rmSync(join(keyDir, name), { recursive: true, force: true });\n } else if (HEX64.test(name) && name !== current && (name === replaced || old)) {\n removeContentDir(keyDir, name);\n }\n }\n } catch {\n // A directory left behind only takes space; the record decides what is read.\n }\n}\n\n/**\n * Remove the content directory `name` of the entry in `keyDir`, unless its record names it by then.\n * The directory is renamed aside first, and the record read again: a writer that saved the same bytes\n * again may have published a record naming it meanwhile, and then it is put back. A writer that\n * publishes after that reading finds the directory gone and writes it again (see {@link writeEntry}),\n * so the directory a published record names is never left missing.\n */\nfunction removeContentDir(keyDir: string, name: string): void {\n const path = join(keyDir, name);\n const aside = join(keyDir, `${TEMP_PREFIX}removed-${process.pid}-${randomBytes(6).toString('hex')}`);\n try {\n renameSync(path, aside);\n } catch {\n // Gone already, or in use: nothing to remove now.\n return;\n }\n if (readRecordByKey(basename(keyDir))?.dir === name) {\n try {\n renameSync(aside, path);\n return;\n } catch {\n // The writer that published it has written it again: the copy set aside is not needed.\n }\n }\n rmSync(aside, { recursive: true, force: true });\n}\n\n// --- Listing and clearing ---\n\n/** Info about a cached format entry with size and modification date. */\nexport interface CachedFormatEntry {\n /** The format's name and version. */\n readonly name: string;\n readonly version: string;\n /** Where it was downloaded from: a format index or a format URL. */\n readonly source: 'index' | 'url';\n /** The format index URL or the format URL. */\n readonly origin: string;\n readonly sizeBytes: number;\n /** When it was downloaded. */\n readonly modifiedAt: Date;\n}\n\nfunction entrySize(record: CacheRecord): number {\n const contentDir = join(entriesDir(), record.key, record.dir);\n return [...record.files.keys()].reduce((sum, file) => {\n try {\n return sum + statSync(join(contentDir, file)).size;\n } catch {\n return sum;\n }\n }, 0);\n}\n\nfunction originUrl(origin: CacheOrigin): string {\n return origin.kind === 'index' ? origin.index : origin.url;\n}\n\n/** List all cached formats (downloads from format indices and from format URLs), in a stable order. */\nexport function listCachedFormats(): readonly CachedFormatEntry[] {\n return listRecords().map((record) => ({\n name: record.name,\n version: record.version,\n source: record.origin.kind,\n origin: originUrl(record.origin),\n sizeBytes: entrySize(record),\n modifiedAt: new Date(record.fetchedAt),\n }));\n}\n\n/**\n * Every cached format whose files are intact, keyed by cache entry (so two downloads of the same\n * name and version from different origins are both listed).\n */\nexport function discoverCachedFormats(): Map<string, StoryFormatInfo> {\n const formats = new Map<string, StoryFormatInfo>();\n for (const record of listRecords()) {\n const loaded = loadEntry(record);\n if ('record' in loaded) formats.set(record.key, recordFormatInfo(record, loaded.path));\n }\n return formats;\n}\n\n/**\n * Clear all cached formats (no name given), or only those with a given name (matched as format names are, without\n * regard to letter case; an empty name matches none). Returns the number of cached formats removed. Clearing all also removes\n * the directories older twee-ts versions wrote.\n */\nexport function clearCachedFormats(name?: string): number {\n const records = listRecords();\n if (name === undefined) {\n rmSync(getCacheDir(), { recursive: true, force: true });\n rmSync(legacyUrlCacheDir(), { recursive: true, force: true });\n return records.length;\n }\n const matching = records.filter((record) => formatNameKey(record.name) === formatNameKey(name));\n for (const record of matching) rmSync(join(entriesDir(), record.key), { recursive: true, force: true });\n return matching.length;\n}\n\n/** Get total cache size in bytes and format count. */\nexport function getCacheSize(): { readonly totalBytes: number; readonly count: number } {\n const entries = listCachedFormats();\n return { totalBytes: entries.reduce((sum, e) => sum + e.sizeBytes, 0), count: entries.length };\n}\n","/**\n * Story formats from the network: format URLs and format indices (the Story Formats Archive by\n * default), with request sharing, time and size limits, checksum and identity checks, and the\n * provenance-keyed cache in format-cache.ts.\n *\n * Every URL is parsed once, at the boundary, with the WHATWG URL parser ({@link checkRemoteUrl}),\n * and every URL derived from it is resolved with `new URL(relative, base)`.\n */\nimport type { RemoteFetchOptions, StoryFormatInfo } from './types.js';\nimport { decodeFormatJSON, UNNAMED_FORMAT_NAME } from './format-decode.js';\nimport { errorText, formatNameKey, withFormatBytes } from './formats.js';\nimport { parseVersion, sameVersion } from './semver.js';\nimport { decodeText } from './util.js';\nimport type { DecodeIssue, Decoder, JsonPath, JsonValue } from './json-decode.js';\nimport {\n field,\n formatJsonPath,\n jsonArrayOf,\n jsonBoolean,\n jsonRecordOf,\n jsonString,\n JsonObject,\n parseJSON,\n readObject,\n} from './json-decode.js';\nimport type { CacheOrigin, CacheRecord, FormatMetadata, NewRecord, TwineKind } from './format-cache.js';\nimport { getCacheDir, loadEntry, readRecord, recordFormatInfo, sha256Hex, writeEntry } from './format-cache.js';\n\nexport {\n getCacheDir,\n discoverCachedFormats,\n listCachedFormats,\n clearCachedFormats,\n getCacheSize,\n} from './format-cache.js';\n\n/** The Story Formats Archive indices, consulted after a project's own format indices. */\nexport const DEFAULT_SFA_INDICES: readonly string[] = [\n 'https://videlais.github.io/story-formats-archive/official/index.json',\n 'https://videlais.github.io/story-formats-archive/unofficial/index.json',\n];\n\n/** How long one story format request (an index or a format file) may take by default, in milliseconds. */\nconst DEFAULT_FORMAT_FETCH_TIMEOUT = 30_000;\n\n/**\n * How long the search for one story format may take in all by default, in milliseconds: four\n * requests at their default limit. A search asks each format URL and index in turn, so without an\n * overall limit a few hung servers would hold a build for minutes; with it, a build that cannot\n * reach the network ends within two minutes, answering from the download cache where it can.\n */\nconst DEFAULT_FORMAT_RESOLUTION_TIMEOUT = 120_000;\n\n/** The longest delay a timer accepts; a longer timeout means no limit. */\nexport const MAX_TIMER_DELAY = 2_147_483_647;\n\n/** The largest response accepted for an index or a format file, in bytes (32 MiB). */\nexport const MAX_RESPONSE_BYTES = 32 * 1024 * 1024;\n\n// --- URLs ---\n\n/** The URL schemes twee-ts fetches from. */\nconst FETCHABLE_PROTOCOLS: ReadonlySet<string> = new Set(['http:', 'https:']);\n\n/** Redirects followed for one download before giving up (as browsers and curl do, a bounded chain). */\nconst MAX_REDIRECTS = 20;\n\n/** A configured URL, parsed: its normalized form, or why it cannot be used. */\nexport type UrlCheck = { readonly ok: true; readonly url: string } | { readonly ok: false; readonly reason: string };\n\n/**\n * Parse a configured format URL or format index URL. Only absolute `http:` and `https:` URLs\n * without credentials are accepted; a local file belongs in a folder listed in `formatPaths`. The\n * fragment is dropped (it is never sent); the query is kept.\n */\nexport function checkRemoteUrl(text: string): UrlCheck {\n let url: URL;\n try {\n url = new URL(text);\n } catch {\n return {\n ok: false,\n reason: `${JSON.stringify(text)} is not an absolute URL (for a local format, use formatPaths)`,\n };\n }\n if (url.protocol === 'file:') {\n return {\n ok: false,\n reason: `${JSON.stringify(text)}: file: URLs are not supported; put the format in a folder listed in formatPaths`,\n };\n }\n if (!FETCHABLE_PROTOCOLS.has(url.protocol)) {\n return { ok: false, reason: `${JSON.stringify(text)}: only http: and https: URLs are supported` };\n }\n if (url.username !== '' || url.password !== '') {\n return { ok: false, reason: `${JSON.stringify(text)}: URLs with a user name or password are not supported` };\n }\n url.hash = '';\n return { ok: true, url: url.href };\n}\n\n/**\n * The URL of one file of an index entry: `<twine1|twine2>/<name>/<version>/<file>`, each segment\n * percent-encoded, resolved against the URL the index was finally served from (after redirects).\n * As with any relative reference, the index URL's file name, query and fragment do not carry over.\n */\nfunction indexFileUrl(indexResponseUrl: string, entry: IndexEntry, file: string): string {\n const path = [entry.twine, entry.name, entry.version, file].map(encodeURIComponent).join('/');\n return new URL(path, indexResponseUrl).href;\n}\n\n// --- Requests ---\n\n/** One network request with everyone in this process who waits on its result. */\ninterface SharedRequest {\n readonly promise: Promise<Fetched>;\n readonly controller: AbortController;\n waiters: number;\n}\n\n/** Requests in progress, by what they fetch, so concurrent compiles make each request once. */\nconst sharedRequests = new Map<string, SharedRequest>();\n\n/** How one caller waits on a shared request. */\ninterface WaitOptions {\n /** Stops this caller's wait at once, rejecting with the signal's reason. */\n readonly signal: AbortSignal | undefined;\n /** How long this caller waits, in milliseconds (0: no limit). */\n readonly timeout: number;\n /** The error this caller's wait ends with when its timeout passes. */\n readonly timedOut: () => Error;\n}\n\n/**\n * Runs `start` once for all callers that ask for `key` while it is in progress. Each caller waits\n * under its own limits: a caller whose `signal` aborts, or whose `timeout` passes, stops waiting\n * at once and rejects, while the others keep waiting. The request itself is aborted (through\n * the signal `start` receives) once no caller waits on it. `start` must not depend on any one\n * caller: what differs between callers belongs after the shared result.\n */\nfunction shareRequest(\n key: string,\n { signal, timeout, timedOut }: WaitOptions,\n start: (signal: AbortSignal) => Promise<Fetched>,\n): Promise<Fetched> {\n if (signal?.aborted) {\n const reason: unknown = signal.reason;\n return Promise.reject(reason);\n }\n const request = sharedRequests.get(key) ?? startSharedRequest(key, start);\n request.waiters++;\n\n return new Promise<Fetched>((resolve, reject) => {\n let waiting = true;\n let timer: ReturnType<typeof setTimeout> | undefined;\n const stopWaiting = (): void => {\n if (!waiting) return;\n waiting = false;\n signal?.removeEventListener('abort', onAbort);\n clearTimeout(timer);\n request.waiters--;\n };\n const giveUp = (reason: unknown): void => {\n stopWaiting();\n if (request.waiters === 0) {\n if (sharedRequests.get(key) === request) sharedRequests.delete(key);\n request.controller.abort(reason);\n }\n reject(reason);\n };\n const onAbort = (): void => {\n giveUp(signal?.reason);\n };\n signal?.addEventListener('abort', onAbort, { once: true });\n if (timeout > 0 && timeout <= MAX_TIMER_DELAY) {\n timer = setTimeout(() => {\n giveUp(timedOut());\n }, timeout);\n }\n request.promise.then(\n (value) => {\n stopWaiting();\n resolve(value);\n },\n (e: unknown) => {\n stopWaiting();\n reject(e);\n },\n );\n });\n}\n\nfunction startSharedRequest(key: string, start: (signal: AbortSignal) => Promise<Fetched>): SharedRequest {\n const controller = new AbortController();\n const request: SharedRequest = { promise: start(controller.signal), controller, waiters: 0 };\n sharedRequests.set(key, request);\n const forget = (): void => {\n if (sharedRequests.get(key) === request) sharedRequests.delete(key);\n };\n request.promise.then(forget, forget);\n return request;\n}\n\n/** The time limit for each request, from the caller's options. Throws a RangeError for an invalid one. */\nexport function requestTimeout(options: RemoteFetchOptions): number {\n const timeout = options.timeout ?? DEFAULT_FORMAT_FETCH_TIMEOUT;\n if (!(timeout >= 0)) {\n throw new RangeError(`A story format request timeout must be 0 or more milliseconds, not ${timeout}`);\n }\n return timeout;\n}\n\n/**\n * The time limit for a whole format search, in milliseconds (0: none), from `value` (default\n * {@link DEFAULT_FORMAT_RESOLUTION_TIMEOUT}), which the caller has checked to be 0 or more.\n */\nexport function resolutionTimeout(value: number | undefined): number {\n return value ?? DEFAULT_FORMAT_RESOLUTION_TIMEOUT;\n}\n\n/** How one caller waits for `url`: under its own signal and timeout. `what` names the request in errors. */\nfunction waitOptions(options: RemoteFetchOptions, what: string, url: string): WaitOptions {\n const timeout = requestTimeout(options);\n return {\n signal: options.signal,\n timeout,\n timedOut: () => new Error(`Failed to ${what} from ${url}: timed out after ${timeout} ms`),\n };\n}\n\n/** Validators of a cached copy, sent so that an unchanged resource is not downloaded again. */\ninterface Validators {\n readonly etag?: string | undefined;\n readonly lastModified?: string | undefined;\n}\n\n/** A response: its bytes (none for 304 Not Modified), the URL it came from after redirects, and its validators. */\ninterface Fetched extends Validators {\n readonly notModified: boolean;\n readonly bytes: Uint8Array<ArrayBuffer>;\n readonly url: string;\n}\n\n/** A short description of why `fetch` failed: its message and the system error code underneath. */\nfunction describeFetchError(e: unknown): string {\n const cause: unknown = e instanceof Error ? e.cause : undefined;\n if (!(cause instanceof Error)) return errorText(e);\n const code = 'code' in cause && typeof cause.code === 'string' ? cause.code : cause.message;\n return `${errorText(e)} (${code})`;\n}\n\n/**\n * Read a response body, stopping as soon as it grows past {@link MAX_RESPONSE_BYTES}: undefined\n * then. A body that breaks off rejects with the stream's error.\n */\nasync function readLimited(res: Response): Promise<Uint8Array<ArrayBuffer> | undefined> {\n if (Number(res.headers.get('content-length') ?? '0') > MAX_RESPONSE_BYTES) {\n await res.body?.cancel();\n return undefined;\n }\n if (!res.body) return new Uint8Array(0);\n const chunks: Uint8Array[] = [];\n let total = 0;\n const reader = res.body.getReader();\n for (;;) {\n const result = await reader.read();\n if (result.done) break;\n // A fetch response body is a byte stream; the type says `any`.\n const value: unknown = result.value;\n if (!(value instanceof Uint8Array)) throw new TypeError('the response body is not a byte stream');\n total += value.byteLength;\n if (total > MAX_RESPONSE_BYTES) {\n await reader.cancel();\n return undefined;\n }\n chunks.push(value);\n }\n const bytes = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n bytes.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return bytes;\n}\n\n/** Where undici keeps the dispatcher every `fetch` without its own uses; its class is the one to ask for another. */\nconst UNDICI_GLOBAL_DISPATCHER = Symbol.for('undici.globalDispatcher.1');\n\ntype FetchDispatcher = NonNullable<RequestInit['dispatcher']>;\n\n/** A dispatcher for one download, and the call that frees its connections. */\ninterface RequestDispatcher {\n readonly dispatcher: FetchDispatcher;\n readonly release: () => void;\n}\n\nfunction isDispatcher(value: unknown): value is FetchDispatcher {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'dispatch' in value &&\n typeof value.dispatch === 'function' &&\n 'destroy' in value &&\n typeof value.destroy === 'function'\n );\n}\n\n/** The `fetch` of this process when the module loaded: a test or a host may replace the global one with a function that ignores a dispatcher. */\nconst nativeFetch = globalThis.fetch;\n\n/**\n * The global dispatcher Node created, with its default options, for the request with which\n * {@link ensureGlobalDispatcher} made it; `undefined` while there is none (a dispatcher that was in\n * place before may be one the host installed, with options of its own).\n */\nlet nodeDefaultDispatcher: object | undefined;\n\n/**\n * Makes undici create its global dispatcher, which it does with the first request of a process: a\n * request for a data: URL makes no connection. undici creates it during the call, before any other\n * code can run, so the dispatcher there right after the call is Node's own. `request` is exported\n * for tests.\n */\nexport async function ensureGlobalDispatcher(request: (url: string) => Promise<Response> = nativeFetch): Promise<void> {\n if (Reflect.get(globalThis, UNDICI_GLOBAL_DISPATCHER) !== undefined) return;\n const answer = request('data:,');\n const made: unknown = Reflect.get(globalThis, UNDICI_GLOBAL_DISPATCHER);\n if (typeof made === 'object' && made !== null) nodeDefaultDispatcher = made;\n await answer.then(\n (res) => res.body?.cancel(),\n () => undefined,\n );\n}\n\n/**\n * A dispatcher whose sockets `signal` destroys, so that a request that ends (at its limit, by a\n * caller's signal or by the resolution deadline) also ends its connection attempt. Aborting `fetch`\n * alone does not: undici leaves a connection attempt in progress to its own ten-second connect\n * timeout, and a host that drops packets holds the process open that long. undici passes these\n * options on to `net.connect()` and `tls.connect()`: `connect` for a direct connection,\n * `proxyTls` for the connection to a proxy, `requestTls` for TLS through its tunnel.\n *\n * Node exports no dispatcher class, so this builds one from the class of the global dispatcher, and\n * only when that is the one Node created with its default options for twee-ts's own first request:\n * a dispatcher built from another's class would lose the options the host gave it (its CA, its proxy\n * URLs). Where the global dispatcher was in place before, or was replaced since, the request runs\n * on it unchanged (`undefined`), and a connection attempt in progress ends at undici's own limit.\n */\nasync function requestDispatcher(signal: AbortSignal): Promise<RequestDispatcher | undefined> {\n await ensureGlobalDispatcher();\n const current = nodeDefaultDispatcher;\n if (current === undefined || Reflect.get(globalThis, UNDICI_GLOBAL_DISPATCHER) !== current) return undefined;\n const dispatcherClass: unknown = current.constructor;\n if (typeof dispatcherClass !== 'function') return undefined;\n let made: unknown;\n try {\n made = Reflect.construct(dispatcherClass, [{ connect: { signal }, proxyTls: { signal }, requestTls: { signal } }]);\n } catch {\n return undefined;\n }\n if (!isDispatcher(made)) return undefined;\n const dispatcher = made;\n return {\n dispatcher,\n release: () => {\n // The download is over (or aborted): its connections are of no further use, and an idle one\n // would hold the process open. Closing cannot fail in a way that matters to the caller.\n void Promise.resolve(dispatcher.destroy()).catch(() => undefined);\n },\n };\n}\n\n/**\n * Fetch `url`, aborting when `signal` does. `what` names the request in errors, as in \"Failed to\n * <what> from <url>: <cause>\". The bytes are returned undecoded, so checksums cover what was served.\n * A redirect must stay on http: or https:, and never go from https: to http:.\n */\nasync function fetchBytes(url: string, what: string, signal: AbortSignal, validators: Validators): Promise<Fetched> {\n const own = await requestDispatcher(signal);\n try {\n return await fetchBytesVia(url, what, signal, validators, own?.dispatcher);\n } finally {\n own?.release();\n }\n}\n\nasync function fetchBytesVia(\n url: string,\n what: string,\n signal: AbortSignal,\n validators: Validators,\n dispatcher: FetchDispatcher | undefined,\n): Promise<Fetched> {\n const fail = (reason: string, cause?: unknown): Error =>\n new Error(`Failed to ${what} from ${url}: ${reason}`, cause === undefined ? undefined : { cause });\n const headers = new Headers();\n if (validators.etag !== undefined) headers.set('if-none-match', validators.etag);\n if (validators.lastModified !== undefined) headers.set('if-modified-since', validators.lastModified);\n const init: RequestInit = { signal, headers, redirect: 'manual', ...(dispatcher && { dispatcher }) };\n let res: Response;\n let finalUrl = url;\n let sawHttps = new URL(url).protocol === 'https:';\n for (let hops = 0; ; hops++) {\n try {\n res = await fetch(finalUrl, init);\n } catch (e) {\n throw fail(describeFetchError(e), e);\n }\n const location = res.status >= 300 && res.status < 400 ? res.headers.get('location') : null;\n if (location === null) break;\n await res.body?.cancel();\n if (hops >= MAX_REDIRECTS) throw fail(`more than ${MAX_REDIRECTS} redirects`);\n let next: URL;\n try {\n next = new URL(location, finalUrl);\n } catch (e) {\n throw fail(`redirected to ${location}, which is not a valid URL`, e);\n }\n if (!FETCHABLE_PROTOCOLS.has(next.protocol) || (sawHttps && next.protocol === 'http:')) {\n throw fail(\n `redirected to ${next.href}, which is not allowed (only http: and https:, never from https: to http:)`,\n );\n }\n sawHttps ||= next.protocol === 'https:';\n finalUrl = next.href;\n }\n const fromHeaders = {\n etag: res.headers.get('etag') ?? undefined,\n lastModified: res.headers.get('last-modified') ?? undefined,\n };\n if (res.status === 304 && (validators.etag !== undefined || validators.lastModified !== undefined)) {\n await res.body?.cancel();\n return { notModified: true, bytes: new Uint8Array(0), url: finalUrl, ...fromHeaders };\n }\n if (!res.ok) {\n await res.body?.cancel();\n throw fail(`${res.status} ${res.statusText}`.trim());\n }\n let bytes: Uint8Array<ArrayBuffer> | undefined;\n try {\n bytes = await readLimited(res);\n } catch (e) {\n throw fail(describeFetchError(e), e);\n }\n if (bytes === undefined) throw fail(`the response is larger than the limit of ${MAX_RESPONSE_BYTES} bytes`);\n return { notModified: false, bytes, url: finalUrl, ...fromHeaders };\n}\n\n/** Fetch `url` once for every caller in this process that asks for it (with the same validators) meanwhile. */\nfunction sharedFetch(\n url: string,\n what: string,\n options: RemoteFetchOptions,\n validators: Validators = {},\n): Promise<Fetched> {\n const key = JSON.stringify([what, url, validators.etag ?? null, validators.lastModified ?? null]);\n return shareRequest(key, waitOptions(options, what, url), (signal) => fetchBytes(url, what, signal, validators));\n}\n\n/** Decode downloaded text as local files are (UTF-8, else Windows-1252), without a leading BOM. */\nfunction decodeDownload(bytes: Uint8Array, url: string): string {\n const { text } = decodeText(bytes, url);\n return text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;\n}\n\n// --- Format indices ---\n\n/** One usable entry of a format index. */\nexport interface IndexEntry {\n readonly twine: TwineKind;\n readonly name: string;\n readonly version: string;\n readonly proofing: boolean;\n /** The entry's files, when it lists them. */\n readonly files: readonly string[] | undefined;\n /** SHA-256 checksums by exact file name, lower-case hex. */\n readonly checksums: ReadonlyMap<string, string>;\n}\n\n/** An index entry that cannot be used, and why. */\ninterface SkippedIndexEntry {\n readonly twine: TwineKind;\n /** The entry's position in its list, from 0. */\n readonly position: number;\n /** Its name, when it has one. */\n readonly name: string | undefined;\n readonly reason: string;\n}\n\n/** A format index as fetched and checked. */\nexport interface FormatIndex {\n /** The index URL as configured. */\n readonly url: string;\n /** The URL the index was finally served from, which its file URLs are resolved against. */\n readonly responseUrl: string;\n readonly entries: readonly IndexEntry[];\n readonly skipped: readonly SkippedIndexEntry[];\n}\n\n/** A SHA-256 digest in lower-case hex, as checksums are kept. */\nconst SHA256_HEX = /^[0-9a-f]{64}$/;\n\n/** Reads any JSON value as it is, so each list element is checked on its own. */\nconst anyJson: Decoder<JsonValue> = (value) => ({ ok: true, value });\n\n/** The string `name` member of a raw entry, for describing a skipped one. */\nfunction rawName(raw: JsonValue): string | undefined {\n if (!(raw instanceof JsonObject)) return undefined;\n const member = raw.members.findLast((m) => m.key === 'name');\n return typeof member?.value === 'string' ? member.value : undefined;\n}\n\n/** What an index entry's members gave. */\ninterface EntryFields {\n name?: string;\n version?: string;\n proofing?: boolean;\n files?: readonly string[];\n checksums?: ReadonlyMap<string, string>;\n}\n\n/**\n * Why an issue found in an index makes the entry or the index unusable. A repeated field is worded by what it\n * does here (`consequence`): the decoder's own wording, that the last one is used, holds for the readers that\n * accept it, not for an index, which states what a download must be.\n */\nfunction indexIssueReason(issue: DecodeIssue, consequence: string): string {\n if (issue.kind !== 'duplicate-key') return issue.message;\n return `${formatJsonPath(issue.path)} repeats the field \"${String(issue.path.at(-1))}\", ${consequence}`;\n}\n\n/**\n * Check one index entry at `path`; a string is the reason it cannot be used. Members other than\n * these fields (`author`, `description`, …) are not used. A member of the wrong type, or a repeated\n * one, makes the entry unusable: an index states what a download must be, so nothing in it is guessed.\n */\nfunction parseIndexEntry(twine: TwineKind, raw: JsonValue, path: JsonPath): IndexEntry | string {\n const issues: DecodeIssue[] = [];\n const read: EntryFields = {};\n readObject(raw, path, issues, {\n keys: 'exact',\n fields: {\n name: field(jsonString, (v) => (read.name = v)),\n version: field(jsonString, (v) => (read.version = v)),\n proofing: field(jsonBoolean, (v) => (read.proofing = v)),\n files: field(jsonArrayOf(jsonString), (v) => (read.files = v)),\n // A malformed digest only matters for a file twee-ts downloads; it is refused there.\n checksums: field(jsonRecordOf(jsonString), (v) => (read.checksums = v)),\n },\n unknown: () => undefined,\n });\n if (issues.length > 0) return issues.map((issue) => indexIssueReason(issue, 'so the entry is skipped')).join('; ');\n const at = formatJsonPath(path);\n const { name, version } = read;\n if (name === undefined) return `${at} has no \"name\"`;\n if (name === '' || name === '.' || name === '..') return `${at}.name ${JSON.stringify(name)} is not a usable name`;\n if (version === undefined) return `${at} has no \"version\"`;\n if (!parseVersion(version)) return `${at}.version ${JSON.stringify(version)} is not a SemVer version`;\n return {\n twine,\n name,\n version,\n proofing: read.proofing ?? false,\n files: read.files,\n checksums: new Map([...(read.checksums ?? [])].map(([file, sum]) => [file, sum.toLowerCase()] as const)),\n };\n}\n\n/**\n * Check an index.json (with src/json-decode.ts): an object whose optional `twine1` and `twine2`\n * members are lists of entries. Each entry needs a name and a SemVer version; `files` (a list of\n * names) and `checksums` (an object of strings) are optional. Entries that are not usable are kept\n * in `skipped` with the reason. Throws when the text is not JSON or not an index.\n */\nexport function parseFormatIndex(text: string, url: string, responseUrl: string): FormatIndex {\n const parsed = parseJSON(text);\n if (!parsed.ok) throw new Error(`it is not JSON: ${parsed.error.message}`);\n const lists = new Map<TwineKind, readonly JsonValue[]>();\n const issues: DecodeIssue[] = [];\n const isObject = readObject(parsed.value, [], issues, {\n keys: 'exact',\n fields: {\n twine1: field(jsonArrayOf(anyJson), (v) => lists.set('twine1', v)),\n twine2: field(jsonArrayOf(anyJson), (v) => lists.set('twine2', v)),\n },\n unknown: () => undefined,\n });\n if (!isObject) throw new Error('it is not a format index (an object with \"twine1\" and \"twine2\" lists)');\n if (issues.length > 0) {\n throw new Error(issues.map((issue) => indexIssueReason(issue, 'so the index is not used')).join('; '));\n }\n const entries: IndexEntry[] = [];\n const skipped: SkippedIndexEntry[] = [];\n // Twine 2 entries first, so they come first among equals.\n for (const twine of ['twine2', 'twine1'] as const) {\n (lists.get(twine) ?? []).forEach((raw, position) => {\n const entry = parseIndexEntry(twine, raw, [twine, position]);\n if (typeof entry === 'string') skipped.push({ twine, position, name: rawName(raw), reason: entry });\n else entries.push(entry);\n });\n }\n return { url, responseUrl, entries, skipped };\n}\n\n/** Indices fetched during this compile, by URL. Cleared each compile. */\nconst indexCache = new Map<string, FormatIndex>();\n\n/** Clear the in-memory index cache. */\nexport function clearIndexCache(): void {\n indexCache.clear();\n}\n\n/**\n * Fetch and check a format index ({@link parseFormatIndex}), at most once per compile. Concurrent\n * calls for one URL share a request. `url` must have passed {@link checkRemoteUrl}.\n */\nexport async function fetchIndex(url: string, options: RemoteFetchOptions = {}): Promise<FormatIndex> {\n options.signal?.throwIfAborted();\n requestTimeout(options);\n const cached = indexCache.get(url);\n if (cached) return cached;\n const fetched = await sharedFetch(url, 'fetch format index', options);\n try {\n const index = parseFormatIndex(decodeDownload(fetched.bytes, url), url, fetched.url);\n indexCache.set(url, index);\n return index;\n } catch (e) {\n throw new Error(`Failed to read format index ${url}: ${errorText(e)}`, { cause: e });\n }\n}\n\n// --- Obtaining formats ---\n\n/** A format ready to use, and warnings about how it was obtained (an unverified file, a cache that could not be written). */\nexport interface Obtained {\n readonly info: StoryFormatInfo;\n readonly warnings: readonly string[];\n}\n\n/** The main file of an index entry: format.js for Twine 2, header.html for Twine 1. */\nfunction mainFile(twine: TwineKind): string {\n return twine === 'twine2' ? 'format.js' : 'header.html';\n}\n\n/**\n * The files of an index entry that twee-ts downloads besides its main file: for Twine 1, the\n * format's own scripts that its header includes (`code.js`, `userlib.js`) when the entry lists them.\n */\nfunction componentFiles(entry: IndexEntry): readonly string[] {\n return entry.twine === 'twine2' ? [] : ['code.js', 'userlib.js'].filter((file) => entry.files?.includes(file));\n}\n\n/** The cache origin of an index entry. */\nfunction indexEntryOrigin(index: Pick<FormatIndex, 'url'>, entry: IndexEntry): CacheOrigin {\n return { kind: 'index', index: index.url, twine: entry.twine, name: entry.name, version: entry.version };\n}\n\n/** Save a download to the cache; when that fails, warn and keep it for this build only (at its URL). */\nfunction saveDownload(\n record: NewRecord,\n files: ReadonlyMap<string, Uint8Array>,\n options: RemoteFetchOptions,\n): { readonly path: string; readonly warnings: readonly string[] } {\n // This caller gave up meanwhile: leave the cache as it was.\n options.signal?.throwIfAborted();\n try {\n return { path: writeEntry(record, files), warnings: [] };\n } catch (e) {\n const reason = errorText(e);\n return {\n path: record.downloadUrl,\n warnings: [\n `Could not save ${record.name} ${record.version} from ${record.downloadUrl} to the format cache ` +\n `(${getCacheDir()}): ${reason}. It is used for this build only.`,\n ],\n };\n }\n}\n\n/** The info of a format with its bytes kept in memory (see {@link withFormatBytes}). */\nfunction formatWithBytes(\n record: Pick<CacheRecord, 'name' | 'version' | 'isTwine2' | 'metadata' | 'main' | 'downloadUrl'>,\n path: string,\n files: ReadonlyMap<string, Uint8Array>,\n): StoryFormatInfo {\n const bytes = files.get(record.main) ?? new Uint8Array(0);\n return withFormatBytes(recordFormatInfo(record, path), bytes, record.downloadUrl, files);\n}\n\n/**\n * A cached entry as a format, after checking its files against its record. Throws, naming the\n * entry and the reason, when the entry is damaged.\n */\nexport function useCachedRecord(record: CacheRecord): StoryFormatInfo {\n const loaded = loadEntry(record);\n if ('error' in loaded) {\n throw new Error(`The cached copy of ${record.name} ${record.version} cannot be used: ${loaded.error}`);\n }\n return formatWithBytes(record, loaded.path, loaded.files);\n}\n\n/** Whether a cached entry holds every file `files` names, with the checksums the index lists now. */\nfunction cachedEntryMatches(record: CacheRecord, entry: IndexEntry, files: readonly string[]): boolean {\n return files.every((file) => {\n const have = record.files.get(file);\n const listed = entry.checksums.get(file);\n return have !== undefined && (listed === undefined || listed === have);\n });\n}\n\n/** Check that a downloaded format.js is the format the index entry names; nameless formats take the entry's name. */\nfunction checkEntryIdentity(\n entry: IndexEntry,\n data: { readonly name: string; readonly version: string },\n url: string,\n): void {\n const nameMatches = data.name === UNNAMED_FORMAT_NAME || formatNameKey(data.name) === formatNameKey(entry.name);\n if (nameMatches && sameVersion(data.version, entry.version)) return;\n throw new Error(\n `Story format mismatch for ${url}: the index lists ${entry.name} ${entry.version}, ` +\n `but the download is ${data.name} ${data.version}`,\n );\n}\n\n/** Read a downloaded format.js's metadata, or throw with the URL and the reason. */\nfunction decodeDownloadedFormat(\n bytes: Uint8Array,\n url: string,\n): { readonly name: string; readonly version: string } & FormatMetadata {\n const decoded = decodeFormatJSON(decodeDownload(bytes, url));\n if (!decoded.ok) throw new Error(`Failed to read the story format at ${url}: ${decoded.reason}`);\n const { data } = decoded;\n return { ...data, proofing: data.proofing === true };\n}\n\n/** The metadata fields of a decoded format, without its name and version. */\nfunction metadataOf(data: FormatMetadata): FormatMetadata {\n return {\n proofing: data.proofing,\n author: data.author,\n description: data.description,\n image: data.image,\n url: data.url,\n license: data.license,\n };\n}\n\n/**\n * Obtain the format an index entry names: its cached copy when that is from the same index entry\n * and matches the checksums the index lists, else a download of its files, each checked against\n * the index's checksum, and (Twine 2) checked to be the format the entry names. The download is\n * then cached under the entry's origin.\n */\nexport async function obtainIndexEntry(\n index: FormatIndex,\n entry: IndexEntry,\n options: RemoteFetchOptions = {},\n): Promise<Obtained> {\n const origin = indexEntryOrigin(index, entry);\n const main = mainFile(entry.twine);\n const files = [main, ...componentFiles(entry)];\n const warnings: string[] = [];\n const cached = readRecord(origin);\n if (cached && cachedEntryMatches(cached, entry, files)) {\n try {\n return { info: useCachedRecord(cached), warnings };\n } catch (e) {\n warnings.push(`${errorText(e)}; downloading it again.`);\n }\n }\n\n /** Download one of the entry's files and check it against the checksum the index lists. */\n const download = async (file: string): Promise<Uint8Array<ArrayBuffer>> => {\n const url = indexFileUrl(index.responseUrl, entry, file);\n const { bytes } = await sharedFetch(url, 'download format', options);\n const listed = entry.checksums.get(file);\n const actual = sha256Hex(bytes);\n if (listed === undefined) {\n warnings.push(`The format index ${index.url} lists no checksum for ${url}; it was used unverified.`);\n } else if (!SHA256_HEX.test(listed)) {\n throw new Error(\n `The format index ${index.url} lists ${JSON.stringify(listed)} as the checksum of ${url}, which is not a SHA-256 hex digest`,\n );\n } else if (listed !== actual) {\n throw new Error(\n `Checksum mismatch for ${url}: the format index ${index.url} lists SHA-256 ${listed}, but the download has ${actual}`,\n );\n }\n return bytes;\n };\n const mainBytes = await download(main);\n const downloaded = new Map([[main, mainBytes]]);\n for (const file of componentFiles(entry)) downloaded.set(file, await download(file));\n\n const mainUrl = indexFileUrl(index.responseUrl, entry, main);\n let identity: { readonly name: string; readonly version: string; readonly metadata: FormatMetadata };\n if (entry.twine === 'twine2') {\n const data = decodeDownloadedFormat(mainBytes, mainUrl);\n checkEntryIdentity(entry, data, mainUrl);\n // A format.js that names no format is known by the name its index entry gives it.\n const name = data.name === UNNAMED_FORMAT_NAME ? entry.name : data.name;\n identity = { name, version: data.version, metadata: metadataOf(data) };\n } else {\n identity = { name: entry.name, version: entry.version, metadata: { proofing: false } };\n }\n const record: NewRecord = {\n origin,\n ...identity,\n isTwine2: entry.twine === 'twine2',\n main,\n fetchedAt: new Date().toISOString(),\n downloadUrl: mainUrl,\n };\n const saved = saveDownload(record, downloaded, options);\n return { info: formatWithBytes(record, saved.path, downloaded), warnings: [...warnings, ...saved.warnings] };\n}\n\n/** The cached copy of a format URL, if it has one. `url` must have passed {@link checkRemoteUrl}. */\nexport function cachedUrlRecord(url: string): CacheRecord | undefined {\n return readRecord({ kind: 'url', url });\n}\n\n/**\n * Obtain the format at a format URL, online. A cached copy is checked again with a conditional\n * request (ETag or Last-Modified) and used when the server says it has not changed; otherwise the\n * new download replaces it. `url` must have passed {@link checkRemoteUrl}.\n */\nexport async function obtainUrlFormat(url: string, options: RemoteFetchOptions = {}): Promise<Obtained> {\n const cached = cachedUrlRecord(url);\n const intact = cached && 'record' in loadEntry(cached) ? cached : undefined;\n const fetched = await sharedFetch(url, 'download format', options, intact ?? {});\n if (fetched.notModified && intact) return { info: useCachedRecord(intact), warnings: [] };\n\n const data = decodeDownloadedFormat(fetched.bytes, url);\n const record: NewRecord = {\n origin: { kind: 'url', url },\n name: data.name,\n version: data.version,\n isTwine2: true,\n metadata: metadataOf(data),\n main: 'format.js',\n fetchedAt: new Date().toISOString(),\n downloadUrl: url,\n etag: fetched.etag,\n lastModified: fetched.lastModified,\n };\n const files = new Map([['format.js', fetched.bytes]]);\n const saved = saveDownload(record, files, options);\n return { info: formatWithBytes(record, saved.path, files), warnings: saved.warnings };\n}\n\n/**\n * Download a direct format.js URL (or confirm that its cached copy is current), cache it under\n * that URL, and return its StoryFormatInfo. Concurrent calls for one URL share one request.\n * Throws when the URL is not usable, the download fails, or the cache cannot be written.\n */\nexport async function fetchDirectFormat(url: string, options: RemoteFetchOptions = {}): Promise<StoryFormatInfo> {\n const checked = checkRemoteUrl(url);\n if (!checked.ok) throw new Error(`Cannot download a format from ${checked.reason}`);\n const { info, warnings } = await obtainUrlFormat(checked.url, options);\n if (warnings.length > 0) throw new Error(warnings.join(' '));\n return info;\n}\n","/**\n * Story format selection for a compile: gather candidates, select one, then obtain it.\n *\n * The request comes from the explicit `formatId` option, else the StoryData format name and\n * version, else the default ID. Sources are gathered in their documented order (local folders,\n * then each format URL, then each format index), every source yielding {@link FormatCandidate}s;\n * {@link selectFormat} alone picks one, and only the chosen candidate is downloaded. When obtaining\n * it fails, the failure is reported and the selection runs again without it. A request no source\n * can answer is reported as an error rather than swapped for a different story format.\n * docs/story-formats.md (\"How a format is chosen\") states the same policy.\n */\nimport type { Diagnostic, FormatRequest, RemoteFetchOptions, RemoteResolveOptions, StoryFormatInfo } from './types.js';\nimport type { FormatCandidate, MatchTier } from './formats.js';\nimport {\n describeFormatRequest,\n discoverAllFormats,\n errorText,\n formatNameKey,\n getFormatSearchDirs,\n judgeCandidate,\n localCandidates,\n pruneFormats,\n selectFormat,\n} from './formats.js';\nimport type { CacheRecord } from './format-cache.js';\nimport { listRecords } from './format-cache.js';\nimport type { FormatIndex, Obtained } from './remote-formats.js';\nimport {\n cachedUrlRecord,\n checkRemoteUrl,\n clearIndexCache,\n DEFAULT_SFA_INDICES,\n fetchIndex,\n MAX_TIMER_DELAY,\n obtainIndexEntry,\n obtainUrlFormat,\n requestTimeout,\n resolutionTimeout,\n useCachedRecord,\n} from './remote-formats.js';\nimport { parseVersion } from './semver.js';\nimport { TweeTsError } from './errors.js';\nimport { pushAll } from './util.js';\n\n/** Where to look for story formats. */\nexport interface FormatResolutionOptions {\n readonly formatPaths?: readonly string[] | undefined;\n readonly useTweegoPath?: boolean | undefined;\n readonly noRemote?: boolean | undefined;\n readonly formatIndices?: readonly string[] | undefined;\n readonly formatUrls?: readonly string[] | undefined;\n /** Aborts the format requests; resolution then rejects with the signal's reason. */\n readonly signal?: AbortSignal | undefined;\n /** Milliseconds each format request may take. */\n readonly formatFetchTimeout?: number | undefined;\n /** Milliseconds the whole search may take (0: no limit). */\n readonly formatResolutionTimeout?: number | undefined;\n /** Whether the Story Formats Archive indices are asked after `formatIndices` (default true). */\n readonly useDefaultFormatIndices?: boolean | undefined;\n}\n\n/** Choose the format request: explicit format ID > StoryData format > default ID. */\nexport function formatRequestFor(\n formatId: string | undefined,\n storyFormat: string,\n storyFormatVersion: string,\n defaultId: string,\n): FormatRequest {\n if (formatId) return { kind: 'id', id: formatId };\n if (storyFormat) return { kind: 'name', name: storyFormat, version: storyFormatVersion };\n return { kind: 'id', id: defaultId };\n}\n\n/** A candidate with how to describe it and how to obtain the format it stands for. */\ninterface SourcedCandidate extends FormatCandidate {\n /** Where the candidate comes from, for diagnostics. */\n readonly label: string;\n readonly obtain: () => Promise<Obtained>;\n}\n\n/** The sources one resolution consults, already checked. */\ninterface Sources {\n /** The local search directories, or undefined to consult no local folders. */\n readonly searchDirs: readonly string[] | undefined;\n readonly urls: readonly string[];\n readonly indices: readonly string[];\n /** Whether the network may be used; offline, URLs and indices answer from their cached copies. */\n readonly online: boolean;\n}\n\n/** An index entry that could not be a candidate, with the index it is in. */\ninterface Skipped {\n readonly label: string;\n readonly name: string | undefined;\n readonly reason: string;\n}\n\n/** What a resolution found, and every failure it met on the way. */\ninterface Resolution {\n readonly info: StoryFormatInfo | undefined;\n readonly failures: readonly string[];\n}\n\n/** Rethrow the abort reason when the signal has aborted; failures after an abort are not failures of a source. */\nfunction throwIfAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw signal.reason;\n}\n\n/**\n * The overall time limit of one search: `signal` aborts the requests when either the caller's signal\n * aborts or the limit passes (with `message` as the reason); `expired` tells whether the limit\n * passed. `dispose` stops the timer, and must be called when the search ends.\n */\ninterface Deadline {\n readonly signal: AbortSignal | undefined;\n readonly caller: AbortSignal | undefined;\n readonly expired: () => boolean;\n readonly message: string;\n readonly dispose: () => void;\n}\n\n/** Start the time limit of a search: `ms` milliseconds (0, or more than a timer takes: none), named `option` in messages. */\nfunction startDeadline(caller: AbortSignal | undefined, ms: number, option: string): Deadline {\n const message =\n `the search stopped after ${ms} ms, the limit ${option} sets for finding the story format; ` +\n 'the format URLs and indices not asked by then were read from the download cache only';\n if (ms === 0 || ms > MAX_TIMER_DELAY) {\n return { signal: caller, caller, expired: () => false, message, dispose: () => undefined };\n }\n const limit = new AbortController();\n const timer = setTimeout(() => {\n limit.abort(new Error(message));\n }, ms);\n return {\n signal: caller === undefined ? limit.signal : AbortSignal.any([caller, limit.signal]),\n caller,\n expired: () => limit.signal.aborted,\n message,\n dispose: () => {\n clearTimeout(timer);\n },\n };\n}\n\n/** A cached download as a candidate: it answers as the index entry or URL it was downloaded for. */\nfunction cachedCandidate(record: CacheRecord, rank: number, label: string): SourcedCandidate {\n const identity = record.origin.kind === 'index' ? record.origin : record;\n return {\n name: identity.name,\n version: identity.version,\n isTwine2: record.isTwine2,\n source: record.origin.kind,\n rank,\n label,\n obtain: () => Promise.resolve({ info: useCachedRecord(record), warnings: [] }),\n };\n}\n\n/** The candidates of a format index, from the index itself (online) or from what was downloaded from it. */\nfunction indexCandidates(index: FormatIndex, rank: number, options: RemoteFetchOptions): SourcedCandidate[] {\n return index.entries.map((entry) => ({\n name: entry.name,\n version: entry.version,\n isTwine2: entry.twine === 'twine2',\n source: 'index',\n rank,\n label: `${entry.twine} entry ${entry.name} ${entry.version} of format index ${index.url}`,\n obtain: () => obtainIndexEntry(index, entry, options),\n }));\n}\n\n/** Describe the candidates related to the request and why none answered, for the \"not available\" error. */\nfunction describeUnusable(\n request: FormatRequest,\n seen: readonly SourcedCandidate[],\n skipped: readonly Skipped[],\n): string[] {\n const wantedName =\n request.kind === 'name' ? formatNameKey(request.name) : formatNameKey(request.id).replace(/-\\d+$/, '');\n const related = (name: string): boolean =>\n request.kind === 'name'\n ? formatNameKey(name) === wantedName\n : formatNameKey(name).replace(/\\s+/g, '-') === wantedName;\n const candidates = seen\n .filter((c) => related(c.name))\n .map((c) => {\n // Nothing answered, so a candidate that matches was chosen once and could not be obtained.\n const judgement = judgeCandidate(request, c);\n const why = judgement.kind === 'rejected' ? judgement.reason : 'could not be obtained (see the warning)';\n return `${c.label} (${c.name} ${c.version || 'without a version'}): ${why}`;\n });\n const entries = skipped.filter((s) => s.name !== undefined && related(s.name)).map((s) => `${s.label}: ${s.reason}`);\n return [...candidates, ...entries];\n}\n\nconst MAX_LISTED = 10;\n\n/**\n * Resolve a request against the sources: gather each source in order, and after each one select\n * among everything gathered so far. Because {@link selectFormat} ranks sources first, stopping at\n * the first source that answers gives the same result as gathering every source. When nothing\n * answers, a same-major older candidate is taken with a warning. Diagnostics go to `diagnostics`.\n */\nasync function resolveWith(\n request: FormatRequest,\n sources: Sources,\n options: RemoteFetchOptions,\n deadline: Deadline,\n diagnostics: Diagnostic[],\n): Promise<Resolution> {\n const wanted = describeFormatRequest(request);\n const failures: string[] = [];\n const fail = (message: string): void => {\n const text = `Remote format fetch failed for ${wanted}: ${message}`;\n if (failures.includes(text)) return;\n failures.push(text);\n diagnostics.push({ level: 'warning', message: text });\n };\n /** Whether the network may be used now: not offline, and the time limit has not passed. */\n const online = (): boolean => {\n if (!sources.online) return false;\n if (!deadline.expired()) return true;\n fail(deadline.message);\n return false;\n };\n /** Rethrow a caller's abort; otherwise describe why a request failed (the time limit, when it passed). */\n const failure = (e: unknown): string => {\n throwIfAborted(deadline.caller);\n return deadline.expired() ? deadline.message : errorText(e);\n };\n const notes: string[] = [];\n const skipped: Skipped[] = [];\n const localIds: string[] = [];\n let records: readonly CacheRecord[] | undefined;\n const cachedFrom = (indexUrl: string, rank: number): SourcedCandidate[] => {\n records ??= listRecords();\n return records\n .filter((r) => r.origin.kind === 'index' && r.origin.index === indexUrl)\n .map((r) =>\n cachedCandidate(r, rank, `the cached download of ${r.name} ${r.version} from format index ${indexUrl}`),\n );\n };\n\n if (request.kind === 'name' && !parseVersion(request.version)) {\n diagnostics.push({\n level: 'warning',\n message:\n request.version === ''\n ? `format \"${request.name}\": Auto-selecting greatest version; StoryData gives no format-version.`\n : `format \"${request.name}\": Auto-selecting greatest version; Could not parse version \"${request.version}\".`,\n });\n }\n\n const gatherLocal = (searchDirs: readonly string[]): SourcedCandidate[] => {\n const all = discoverAllFormats(searchDirs, diagnostics);\n pushAll(localIds, all.keys());\n // As in Tweego, a name request selects among the greatest version of each name and major.\n const formats = request.kind === 'name' ? pruneFormats(all) : all;\n return localCandidates(formats).map((c) => ({\n ...c,\n label: `local format ${c.folder} (${c.info.filename})`,\n obtain: () => Promise.resolve({ info: c.info, warnings: [] }),\n }));\n };\n\n const gatherUrl = async (url: string, rank: number): Promise<SourcedCandidate[]> => {\n const label = `the cached copy of format URL ${url}`;\n if (!online()) {\n const record = cachedUrlRecord(url);\n if (!record) notes.push(`format URL ${url} has no cached copy`);\n return record ? [cachedCandidate(record, rank, label)] : [];\n }\n try {\n const obtained = await obtainUrlFormat(url, options);\n const { info } = obtained;\n return [\n {\n name: info.name,\n version: info.version,\n isTwine2: info.isTwine2,\n source: 'url',\n rank,\n label: `format URL ${url}`,\n obtain: () => Promise.resolve(obtained),\n },\n ];\n } catch (e) {\n const why = failure(e);\n const record = cachedUrlRecord(url);\n fail(`${why}${record ? `; using the copy downloaded on ${record.fetchedAt}` : ''}`);\n return record ? [cachedCandidate(record, rank, label)] : [];\n }\n };\n\n const gatherIndex = async (indexUrl: string, rank: number): Promise<SourcedCandidate[]> => {\n if (!online()) return cachedFrom(indexUrl, rank);\n let index: FormatIndex;\n try {\n index = await fetchIndex(indexUrl, options);\n } catch (e) {\n const why = failure(e);\n const fallback = cachedFrom(indexUrl, rank);\n fail(`${why}${fallback.length > 0 ? '; using the formats downloaded from it before' : ''}`);\n return fallback;\n }\n pushAll(\n skipped,\n index.skipped.map((s) => ({\n label: `${s.twine} entry ${s.position} of format index ${indexUrl}`,\n name: s.name,\n reason: s.reason,\n })),\n );\n return indexCandidates(index, rank, options);\n };\n\n const { searchDirs } = sources;\n const groups: (() => Promise<SourcedCandidate[]> | SourcedCandidate[])[] = [\n ...(searchDirs ? [() => gatherLocal(searchDirs)] : []),\n ...sources.urls.map((url, i) => () => gatherUrl(url, 1 + i)),\n ...sources.indices.map((url, j) => () => gatherIndex(url, 1 + sources.urls.length + j)),\n ];\n\n const gathered: SourcedCandidate[] = [];\n const seen: SourcedCandidate[] = [];\n const choose = async (\n allowOlder: boolean,\n ): Promise<{ readonly info: StoryFormatInfo; readonly tier: MatchTier; readonly label: string } | undefined> => {\n for (;;) {\n const selection = selectFormat(request, gathered, { allowOlder });\n if (!selection) return undefined;\n try {\n const obtained = await selection.choice.obtain();\n pushAll(\n diagnostics,\n obtained.warnings.map((message) => ({ level: 'warning' as const, message })),\n );\n return { info: obtained.info, tier: selection.tier, label: selection.choice.label };\n } catch (e) {\n fail(failure(e));\n gathered.splice(gathered.indexOf(selection.choice), 1);\n }\n }\n };\n\n let found: Awaited<ReturnType<typeof choose>>;\n for (const gather of groups) {\n const candidates = await gather();\n pushAll(gathered, candidates);\n pushAll(seen, candidates);\n found = await choose(false);\n if (found) break;\n }\n found ??= await choose(true);\n\n if (found) {\n const { info, tier, label } = found;\n if (tier === 'older') {\n diagnostics.push({\n level: 'warning',\n message: `Story format ${wanted} is not available; using ${info.name} ${info.version} instead.`,\n });\n }\n if (tier === 'id') {\n const names = new Set(\n seen\n .filter((c) => {\n const judgement = judgeCandidate(request, c);\n return judgement.kind === 'match' && judgement.tier === 'id';\n })\n .map((c) => c.name),\n );\n if (new Set([...names].map(formatNameKey)).size > 1) {\n diagnostics.push({\n level: 'warning',\n message:\n `Story format ID ${wanted} matches formats with different names (${[...names].join(', ')}); ` +\n `using ${info.name} ${info.version} from ${label}.`,\n });\n }\n }\n return { info, failures };\n }\n\n const reason = sources.online ? '' : ' (remote fetching disabled)';\n const unusable = [...describeUnusable(request, seen, skipped), ...notes];\n const listed = unusable.slice(0, MAX_LISTED);\n const more = unusable.length > MAX_LISTED ? `; and ${unusable.length - MAX_LISTED} more` : '';\n const details = listed.length > 0 ? ` Not usable: ${listed.join('; ')}${more}.` : '';\n diagnostics.push({\n level: 'error',\n message: `Story format ${wanted} is not available${reason}. Found: ${localIds.join(', ') || 'none'}.${details}`,\n });\n return { info: undefined, failures };\n}\n\n/** Check configured URLs; each one that is not usable is an error diagnostic and is left out. */\nfunction checkedUrls(urls: readonly string[] | undefined, option: string, diagnostics: Diagnostic[]): string[] {\n return (urls ?? []).flatMap((text) => {\n const checked = checkRemoteUrl(text);\n if (checked.ok) return [checked.url];\n diagnostics.push({ level: 'error', message: `${option}: ${checked.reason}` });\n return [];\n });\n}\n\n/**\n * Resolve a format request to a story format, as docs/story-formats.md (\"How a format is chosen\")\n * describes. Local formats that cannot be used, sources that fail, and an older version used\n * instead of the one asked for are reported as warnings; configured URLs that are not usable,\n * and a request nothing answers, as errors (the result is then `undefined`).\n */\nexport async function resolveStoryFormat(\n request: FormatRequest,\n options: FormatResolutionOptions,\n diagnostics: Diagnostic[],\n): Promise<StoryFormatInfo | undefined> {\n requestTimeout({ timeout: options.formatFetchTimeout });\n // compile() has checked both time limits (validateOptions()).\n const limit = resolutionTimeout(options.formatResolutionTimeout);\n const sources: Sources = {\n searchDirs: getFormatSearchDirs(options.formatPaths, options.useTweegoPath ?? true),\n urls: checkedUrls(options.formatUrls, 'formatUrls', diagnostics),\n indices: [\n ...checkedUrls(options.formatIndices, 'formatIndices', diagnostics),\n ...((options.useDefaultFormatIndices ?? true) ? DEFAULT_SFA_INDICES : []),\n ],\n online: !(options.noRemote ?? false),\n };\n const deadline = startDeadline(options.signal, limit, 'formatResolutionTimeout');\n try {\n const fetchOptions: RemoteFetchOptions = { signal: deadline.signal, timeout: options.formatFetchTimeout };\n return (await resolveWith(request, sources, fetchOptions, deadline, diagnostics)).info;\n } finally {\n deadline.dispose();\n }\n}\n\n/** The time limit of a lookup; a TweeTsError (`INVALID_OPTIONS`) names a time limit that is not 0 or more. */\nfunction lookupLimit(options: RemoteResolveOptions): number {\n const limits = [\n ['timeout', options.timeout],\n ['resolutionTimeout', options.resolutionTimeout],\n ] as const;\n for (const [option, value] of limits) {\n if (value !== undefined && !(value >= 0)) {\n throw new TweeTsError(`${option} must be 0 or more milliseconds, not ${value}`, [], { code: 'INVALID_OPTIONS' });\n }\n }\n return resolutionTimeout(options.resolutionTimeout);\n}\n\n/**\n * Resolve a story format by name and version from format URLs and format indices only (no local\n * folders), by the same policy as a compile: `options.urls` first, then `options.indices`, then the\n * Story Formats Archive. Returns undefined when no source has the format.\n *\n * `options.signal` aborts the lookup, which then rejects with the signal's reason;\n * `options.timeout` limits each request (default 30000 ms), and `options.resolutionTimeout` the\n * whole lookup (default 120000 ms); `options.useDefaultIndices: false` leaves the Story Formats\n * Archive out.\n *\n * @throws A TweeTsError: `INVALID_OPTIONS` for a URL or time limit that cannot be used, before any\n * request; `FORMAT_UNAVAILABLE`, listing every failure (also in its `diagnostics`), when no source\n * has the format and some source failed.\n */\nexport async function resolveRemoteFormat(\n name: string,\n version: string,\n options: RemoteResolveOptions = {},\n): Promise<StoryFormatInfo | undefined> {\n options.signal?.throwIfAborted();\n const limit = lookupLimit(options);\n // As each compile does: an index is fetched afresh for each lookup, then shared within it.\n clearIndexCache();\n const diagnostics: Diagnostic[] = [];\n const sources: Sources = {\n searchDirs: undefined,\n urls: checkedUrls(options.urls, 'urls', diagnostics),\n indices: [\n ...checkedUrls(options.indices, 'indices', diagnostics),\n ...((options.useDefaultIndices ?? true) ? DEFAULT_SFA_INDICES : []),\n ],\n online: true,\n };\n const invalid = diagnostics.filter((d) => d.level === 'error');\n if (invalid.length > 0) {\n throw new TweeTsError(invalid.map((d) => d.message).join('\\n'), invalid, { code: 'INVALID_OPTIONS' });\n }\n const deadline = startDeadline(options.signal, limit, 'resolutionTimeout');\n try {\n const fetchOptions: RemoteFetchOptions = { signal: deadline.signal, timeout: options.timeout };\n const request: FormatRequest = { kind: 'name', name, version };\n const { info, failures } = await resolveWith(request, sources, fetchOptions, deadline, diagnostics);\n if (info === undefined && failures.length > 0) {\n throw new TweeTsError(failures.join('\\n'), diagnostics, { code: 'FORMAT_UNAVAILABLE' });\n }\n return info;\n } finally {\n deadline.dispose();\n }\n}\n","/**\n * All public interfaces for twee-ts.\n */\n\n// --- Output modes ---\n\nexport type OutputMode = 'html' | 'twee3' | 'twee1' | 'twine2-archive' | 'twine1-archive' | 'json';\n\n// --- Word count ---\n\nexport type WordCountMethod = 'tweego' | 'whitespace';\n\n// --- Source input ---\n\nexport interface InlineSource {\n filename: string;\n content: string | Buffer;\n}\nexport type SourceInput = string | InlineSource;\n\n// --- Compile options ---\n\n/** A glob that leaves out the files below a folder, with the folder kept apart from the glob. */\nexport interface ExcludeGlob {\n /** A folder (relative to the working directory, or absolute), read literally, never as a glob. */\n readonly base: string;\n /** The glob, matched against the file's path below `base`. */\n readonly glob: string;\n}\n\n/**\n * The options of `compile()` and the functions built on it. Only `sources` is required; an optional\n * property set to `undefined` means the same as leaving it out.\n *\n * - `formatId` and `startPassage` win over StoryData's `format`/`format-version` and `start`; without\n * either, the default is 'sugarcube-2' and 'Start'. A `formatId` that is a local folder name uses\n * that folder as it is, so it keeps a stable format when a newer prerelease is installed; an exact\n * `format-version` in StoryData does not, because name requests see only the greatest local\n * version of each name and major version.\n * - `formatUrls` and `formatIndices` take absolute `http:`/`https:` URLs. The local formats are\n * consulted first, then each format URL (requested again, conditionally, on every online build),\n * then each index, then the Story Formats Archive. A download is cached for the URL or index it\n * came from, and `noRemote` builds still use those cached downloads.\n * - A missing or unreadable `headFile` is a TweeTsError (`INPUT_UNAVAILABLE`); an option of the wrong type,\n * an empty string or a negative `formatFetchTimeout` one with `INVALID_OPTIONS`, before anything is read.\n */\nexport interface CompileOptions {\n /**\n * Files, directories, or inline sources to compile. Directories are walked\n * recursively; inside one, a symbolic link to a file is read, but a link to a\n * directory is not followed (as in Tweego).\n */\n sources: readonly SourceInput[];\n /**\n * Glob patterns for files to leave out of `sources`, matched against each file's\n * path relative to the working directory (as `stats.files` lists it). Not the modules or head file.\n * An {@link ExcludeGlob} matches against the path below its own folder instead (a config file's globs\n * come that way when its folder's name holds glob characters).\n */\n exclude?: readonly (string | ExcludeGlob)[] | undefined;\n /** Output mode. Default: 'html'. */\n outputMode?: OutputMode | undefined;\n /** Story format ID (e.g. 'sugarcube-2'). Default: StoryData's format, else 'sugarcube-2'. */\n formatId?: string | undefined;\n /** Name of the starting passage. Default: StoryData's `start`, else 'Start'. */\n startPassage?: string | undefined;\n /** Extra directories to search for story formats. */\n formatPaths?: readonly string[] | undefined;\n /** Also search TWEEGO_PATH env for formats. Default: true. */\n useTweegoPath?: boolean | undefined;\n /** Module files (JS, CSS or fonts) to inject into the head of HTML output. */\n modules?: readonly string[] | undefined;\n /** Raw HTML file to append to the head of HTML output. */\n headFile?: string | undefined;\n /** Trim white space at both ends of passage text, in Twee and HTML sources. Default: true. */\n trim?: boolean | undefined;\n /** Twee2 compatibility mode (`.tw2` and `.twee2` files always use it). Default: false. */\n twee2Compat?: boolean | undefined;\n /** Add the `debug` option to the story's options. Default: false. */\n testMode?: boolean | undefined;\n /** URLs of SFA-compatible index.json files, consulted after `formatUrls`. */\n formatIndices?: readonly string[] | undefined;\n /** URLs of format.js files, consulted after the local formats and before `formatIndices`. */\n formatUrls?: readonly string[] | undefined;\n /** Download no story formats (cached downloads are still used). Default: false. */\n noRemote?: boolean | undefined;\n /**\n * Cancels the compile. Story format requests still in progress are aborted, and the compile\n * rejects with the signal's reason. `watch()` aborts its builds, and stops watching, when it aborts.\n */\n signal?: AbortSignal | undefined;\n /**\n * Milliseconds each story format request (an index or a format.js) may take before it fails\n * with a warning and the next source is tried. 0 turns the limit off. Default: 30000.\n */\n formatFetchTimeout?: number | undefined;\n /**\n * Milliseconds the search for the story format may take in all, over every request it makes.\n * When the limit passes, the request in progress is stopped and the format URLs and indices not\n * yet asked are read from the download cache only. 0 turns the limit off. Default: 120000.\n */\n formatResolutionTimeout?: number | undefined;\n /**\n * Whether the Story Formats Archive indices are asked after `formatIndices`. Set it to false so a\n * project with its own archive never contacts the Story Formats Archive. Default: true.\n */\n useDefaultFormatIndices?: boolean | undefined;\n /** Map alias tags to target tags (e.g. { library: 'script' }); each passage with an alias gets the target too. */\n tagAliases?: Readonly<Record<string, string>> | undefined;\n /** Emit source file and line as data- attributes on passage elements. Default: false. */\n sourceInfo?: boolean | undefined;\n /** Word counting method. Default: 'tweego'. */\n wordCountMethod?: WordCountMethod | undefined;\n}\n\nexport interface CompileToFileOptions extends CompileOptions {\n /**\n * Output file path. It is never read as a source, even inside a source folder or\n * reached through a symbolic link. Naming it as a source, a module or the head\n * file (in any output mode, by any spelling, or as a hard link) is a TweeTsError\n * (`OUTPUT_IS_INPUT`), and nothing is written. So is an existing file of a source\n * type inside a source folder that is not an earlier twee-ts build. How it is\n * written depends on what is there: see docs/cli.md, \"Output safety\".\n */\n outFile: string;\n}\n\nexport interface WatchOptions extends CompileToFileOptions {\n /**\n * Called after each build is written, including one whose diagnostics report errors. Builds\n * run one at a time and are reported in order, each as it finishes, also while changes keep\n * arriving: the changes made during a build go into one follow-up build after it.\n */\n onBuild?: ((result: CompileResult) => void) | undefined;\n /**\n * Called when a build fails with a fatal error (nothing is written), when `onBuild` throws,\n * and when a watched path can't be watched (the other paths are still watched). An exception\n * thrown here is reported to the console, and watching goes on. A TweeTsError no edit to the\n * sources can fix (`OUTPUT_IS_INPUT`, `INVALID_OPTIONS`) also stops watching.\n */\n onError?: ((error: Error) => void) | undefined;\n}\n\n// --- Compile result ---\n\n/**\n * A warning or an error a build reports. `file` and `line` say where, when known. (`fatal` is not set\n * by twee-ts: a build that cannot go on throws a TweeTsError instead.)\n */\nexport type Diagnostic =\n | { readonly level: 'warning'; readonly message: string; readonly file?: string; readonly line?: number }\n | {\n readonly level: 'error';\n readonly message: string;\n readonly file?: string;\n readonly line?: number;\n readonly fatal?: boolean;\n };\n\nexport interface CompileResult {\n /** The compiled output string (HTML, Twee, JSON, etc.). */\n readonly output: string;\n /** The story model, read-only. */\n readonly story: ReadonlyStory;\n /** The format used for compilation (undefined for non-HTML modes). */\n readonly format?: StoryFormatInfo | undefined;\n /** Warnings and errors. The output is built even when some are errors; check them. */\n readonly diagnostics: readonly Diagnostic[];\n /** Compilation statistics. */\n readonly stats: CompileStats;\n}\n\nexport interface CompileStats {\n /** Every passage. */\n readonly passages: number;\n /** The passages that are not info passages (special names, script, stylesheet, `Twine.*` tags…). */\n readonly storyPassages: number;\n /** The word count of the story passages (see `wordCountMethod`). */\n readonly words: number;\n /** The source files loaded, in order, as paths relative to the working directory when inside it. */\n readonly files: readonly string[];\n /** The module files and the head file the build injected (HTML output only), as Tweego's \"External files\". */\n readonly externalFiles?: readonly string[];\n}\n\n/**\n * Why a TweeTsError stopped a build:\n * - `OUTPUT_IS_INPUT`: the output would overwrite an input (a source, module, head file, config file or story\n * format), or a source file of the output's type found in a source folder.\n * - `INPUT_UNAVAILABLE`: an input the input policy makes fatal (the head file, the config file) can't be used.\n * - `INVALID_OPTIONS`: an option is out of range or not usable (a format URL that is not http(s), say), or the\n * Vite plugin runs under a Vite older than 8.\n * - `FORMAT_UNAVAILABLE`: `resolveRemoteFormat()` found the format nowhere and some source failed; the\n * error's diagnostics hold every failure.\n * - `BUILD_FAILED`: anything else (no story format for HTML output, say).\n */\nexport type TweeTsErrorCode =\n 'OUTPUT_IS_INPUT' | 'INPUT_UNAVAILABLE' | 'INVALID_OPTIONS' | 'FORMAT_UNAVAILABLE' | 'BUILD_FAILED';\n\n// --- Passage ---\n\nexport interface SourceLocation {\n readonly file: string;\n readonly line: number;\n}\n\nexport interface PassageMetadata {\n position?: string;\n size?: string;\n [key: string]: string | undefined;\n}\n\nexport interface Passage {\n name: string;\n tags: string[];\n text: string;\n metadata?: PassageMetadata | undefined;\n source?: SourceLocation | undefined;\n}\n\n// --- Branded types ---\n\nexport type IFID = string & { readonly __brand: 'IFID' };\n\n// --- Story ---\n\nexport interface Twine1Metadata {\n settings: Map<string, string>;\n}\n\nexport interface Twine2Metadata {\n format: string;\n formatVersion: string;\n options: Map<string, boolean>;\n start: string;\n tags: string;\n tagColors: Map<string, string>;\n zoom: number;\n}\n\nexport interface Story {\n name: string;\n ifid: IFID;\n passages: Passage[];\n legacyIFID: IFID;\n twine1: Twine1Metadata;\n twine2: Twine2Metadata;\n}\n\n// --- Readonly story (post-construction) ---\n\nexport type ReadonlyPassage = Readonly<Omit<Passage, 'tags' | 'metadata'>> & {\n readonly tags: readonly string[];\n readonly metadata?: Readonly<PassageMetadata> | undefined;\n};\n\nexport type ReadonlyStory = Readonly<Omit<Story, 'passages' | 'twine1' | 'twine2'>> & {\n readonly passages: readonly ReadonlyPassage[];\n readonly twine1: {\n readonly settings: ReadonlyMap<string, string>;\n };\n readonly twine2: Readonly<Omit<Twine2Metadata, 'options' | 'tagColors'>> & {\n readonly options: ReadonlyMap<string, boolean>;\n readonly tagColors: ReadonlyMap<string, string>;\n };\n};\n\n// --- Passage omission (why an output leaves a passage out) ---\n\nexport type OmittingTag = 'Twine.private' | 'script' | 'stylesheet';\n\nexport type PassageOmission =\n | { readonly kind: 'special-name'; readonly name: 'StoryData' | 'StoryTitle' }\n | { readonly kind: 'tag'; readonly tag: OmittingTag }\n | { readonly kind: 'empty-story-settings' };\n\n/** The output whose rules decide which passages a story emits as passages. */\nexport type PassageOutputTarget = 'twine1' | 'twine2';\n\n// --- HTML decompile ---\n\nexport interface DecompileOptions {\n /**\n * Trim whitespace at both ends of passage text (and of the Twine 2 story stylesheet and script),\n * as the Twee lexer does. When false, the stored text is kept exactly. Default: true.\n */\n readonly trim?: boolean | undefined;\n}\n\n// --- Story inspection ---\n\nexport interface InspectOptions {\n /**\n * Check link destinations against this output's passage rules. A link to a passage that the\n * output leaves out (in Twine 2: `script`, `stylesheet` and `Twine.private` passages,\n * StoryData, StoryTitle and an empty StorySettings; in Twine 1: `Twine.private` passages) is\n * then a broken link, and says why. The passages it leaves out also give no links, as their\n * text never reaches the player, except script passages, which Twine 2 output runs. Without a\n * target, every source passage gives links, and a link is broken only when no passage has its\n * name.\n */\n readonly target?: PassageOutputTarget | undefined;\n}\n\n// --- Story format ---\n\nexport interface StoryFormatInfo {\n id: string;\n /**\n * The format's file (format.js or header.html): in a local format folder, in the download cache,\n * or, for a download the cache could not store, the URL it was downloaded from.\n */\n filename: string;\n isTwine2: boolean;\n name: string;\n version: string;\n proofing: boolean;\n author?: string;\n description?: string;\n image?: string;\n url?: string;\n license?: string;\n}\n\n/**\n * The story format a compile asks for: a directory-style ID (e.g. 'sugarcube-2', which names\n * a format and a major version) or a Twine 2 format name with a version (as StoryData has it).\n */\nexport type FormatRequest =\n | { readonly kind: 'id'; readonly id: string }\n | { readonly kind: 'name'; readonly name: string; readonly version: string };\n\nexport interface Twine2FormatJSON {\n name: string;\n version: string;\n proofing?: boolean;\n source: string;\n author?: string;\n description?: string;\n image?: string;\n url?: string;\n license?: string;\n}\n\n/**\n * The result of reading a format.js: its metadata, with notes on what was left out (a\n * function-valued property such as Harlowe's `setup`, a field of the wrong type), or why it cannot\n * be used.\n */\nexport type FormatDecodeResult =\n | { readonly ok: true; readonly data: Twine2FormatJSON; readonly notes: readonly string[] }\n | { readonly ok: false; readonly reason: string };\n\n/**\n * A parsed SemVer version. Build metadata is dropped, since it takes no part in precedence.\n * Each prerelease identifier is kept as written ('beta', '1').\n */\nexport interface SemVer {\n readonly major: number;\n readonly minor: number;\n readonly patch: number;\n readonly prerelease: readonly string[];\n}\n\n// --- Lexer ---\n\nexport const ItemType = {\n Error: 0,\n EOF: 1,\n Header: 2,\n Name: 3,\n Tags: 4,\n Metadata: 5,\n Content: 6,\n} as const;\nexport type ItemType = (typeof ItemType)[keyof typeof ItemType];\n\nexport interface LexerItem {\n type: ItemType;\n line: number;\n pos: number;\n val: string;\n}\n\n// --- Story Format Archive (SFA) ---\n\nexport interface SFAIndexEntry {\n name: string;\n version: string;\n proofing: boolean;\n files: string[];\n checksums: Record<string, string>;\n}\n\nexport interface SFAIndex {\n twine1: SFAIndexEntry[];\n twine2: SFAIndexEntry[];\n}\n\n/** Options for the network requests that fetch story formats and their indices. */\nexport interface RemoteFetchOptions {\n /** Aborts the requests; the call then rejects with the signal's reason. */\n readonly signal?: AbortSignal | undefined;\n /** Milliseconds each request may take before it fails. 0 turns the limit off. Default: 30000. */\n readonly timeout?: number | undefined;\n}\n\n/** Options of a lookup that may ask several sources, as `resolveRemoteFormat()` does. */\nexport interface RemoteResolveOptions extends RemoteFetchOptions {\n /** SFA-compatible index.json URLs, asked in order after `urls`. */\n readonly indices?: readonly string[] | undefined;\n /** Direct format.js URLs, asked first, in order. */\n readonly urls?: readonly string[] | undefined;\n /**\n * Milliseconds the whole lookup may take, over every request. When it passes, the request in\n * progress is stopped and the sources not yet asked are read from the download cache only. 0 turns\n * the limit off. Default: 120000.\n */\n readonly resolutionTimeout?: number | undefined;\n /** Whether the Story Formats Archive indices are asked after the given indices. Default: true. */\n readonly useDefaultIndices?: boolean | undefined;\n}\n\n// --- Incremental compilation cache ---\n\nexport interface FileCacheEntry {\n readonly mtimeMs: number;\n /**\n * Identity of the parse options (`trim`, `twee2Compat`) the entry was parsed with. An entry is\n * reused only when this matches the current options; an entry without it is treated as stale\n * and reparsed. The value is opaque: leave it to twee-ts to set.\n */\n readonly parseOptionsKey?: string;\n /**\n * What else identifies the file's contents besides `mtimeMs` (its size, inode and status-change\n * time), so a write that keeps the modification time is still seen. An entry is reused only when\n * this matches too; an entry without it is treated as stale. The value is opaque: leave it to\n * twee-ts to set.\n */\n readonly signature?: string;\n /**\n * The file's passages, frozen with everything they hold, so that no build and no caller can change what a\n * later build replays. `CompileResult.story` holds copies of them, never these objects.\n */\n readonly passages: readonly Passage[];\n /** The diagnostics of reading the file, frozen; each build reports copies of them. */\n readonly diagnostics: readonly Diagnostic[];\n}\n\n// --- Config file ---\n\n/** The compile options a config file may set, with the same meaning (see CompileOptions). */\ntype ConfigCompileOption =\n | 'exclude'\n | 'outputMode'\n | 'formatId'\n | 'startPassage'\n | 'formatPaths'\n | 'formatIndices'\n | 'formatUrls'\n | 'useTweegoPath'\n | 'modules'\n | 'headFile'\n | 'trim'\n | 'twee2Compat'\n | 'testMode'\n | 'noRemote'\n | 'formatFetchTimeout'\n | 'formatResolutionTimeout'\n | 'useDefaultFormatIndices'\n | 'tagAliases'\n | 'sourceInfo'\n | 'wordCountMethod';\n\n/**\n * A config file (`twee-ts.config.json`): the compile options it may set, which mean what they mean in\n * `CompileOptions`, plus `sources` (paths only) and `output`.\n */\nexport interface TweeTsConfig extends Pick<CompileOptions, ConfigCompileOption> {\n /** Files or directories to compile. */\n sources?: readonly string[] | undefined;\n /** Output file path; \"-\" for standard output. */\n output?: string | undefined;\n}\n","/**\n * Twee 3 state-machine lexer implemented as a synchronous generator.\n * Ported from tweelexer.go — Go channels become `yield`.\n */\nimport type { LexerItem } from './types.js';\nimport { ItemType } from './types.js';\nimport { quotableCharacterAt } from './source-text.js';\n\nconst EOF = -1;\nconst HEADER_DELIM = '::';\nconst NEWLINE_HEADER_DELIM = '\\n::';\n\ntype StateFn = ((ctx: LexerContext) => StateFn | null) | null;\n\nclass LexerContext {\n readonly input: string;\n line = 1;\n start = 0;\n pos = 0;\n private items: LexerItem[] = [];\n\n constructor(input: string) {\n this.input = input;\n }\n\n next(): number {\n if (this.pos >= this.input.length) return EOF;\n const ch = this.input.charCodeAt(this.pos);\n this.pos++;\n if (ch === 0x0a) this.line++;\n return ch;\n }\n\n peek(): number {\n if (this.pos >= this.input.length) return EOF;\n return this.input.charCodeAt(this.pos);\n }\n\n backup(): void {\n if (this.pos > this.start) {\n this.pos--;\n if (this.input.charCodeAt(this.pos) === 0x0a) this.line--;\n } else {\n throw new Error('backup would leave pos < start');\n }\n }\n\n // Line-counting invariant: next() increments this.line for each newline during\n // character-by-character scanning. However, Content items are produced by jumping\n // this.pos directly (e.g. via indexOf) without calling next(), so those newlines\n // haven't been counted yet. emit() re-counts newlines in [start, pos) for Content\n // items to compensate. This is safe because this.start is reset to this.pos after\n // every emit(), so no range is ever counted twice.\n emit(type: ItemType): void {\n const val = this.input.slice(this.start, this.pos);\n this.items.push({ type, line: this.line, pos: this.start, val });\n if (type === ItemType.Content) {\n for (let i = this.start; i < this.pos; i++) {\n if (this.input.charCodeAt(i) === 0x0a) this.line++;\n }\n }\n this.start = this.pos;\n }\n\n ignore(): void {\n for (let i = this.start; i < this.pos; i++) {\n if (this.input.charCodeAt(i) === 0x0a) this.line++;\n }\n this.start = this.pos;\n }\n\n acceptRun(valid: string): void {\n let ch: number;\n for (ch = this.next(); ch !== EOF && valid.includes(String.fromCharCode(ch)); ch = this.next()) {\n // consume\n }\n if (ch !== EOF) this.backup();\n }\n\n errorf(message: string): null {\n this.items.push({\n type: ItemType.Error,\n line: this.line,\n pos: this.start,\n val: message,\n });\n return null;\n }\n\n /** Drain all pending items and return them. */\n drainItems(): LexerItem[] {\n const result = this.items;\n this.items = [];\n return result;\n }\n}\n\nfunction acceptQuoted(ctx: LexerContext, quote: number): string | null {\n for (;;) {\n const ch = ctx.next();\n switch (ch) {\n case 0x5c: {\n // A backslash escapes the next character, but not a line end.\n const r = ctx.next();\n if (r === 0x0a || r === EOF) return 'unterminated quoted string';\n break;\n }\n case 0x0a:\n case EOF:\n return 'unterminated quoted string';\n default:\n if (ch === quote) return null;\n break;\n }\n }\n}\n\n// --- State functions ---\n\nfunction lexProlog(ctx: LexerContext): StateFn {\n if (ctx.input.startsWith(HEADER_DELIM, ctx.pos)) {\n return lexHeaderDelim;\n }\n const i = ctx.input.indexOf(NEWLINE_HEADER_DELIM, ctx.pos);\n if (i > -1) {\n ctx.pos = i + 1; // skip to the newline, then past it\n ctx.ignore();\n return lexHeaderDelim;\n }\n ctx.emit(ItemType.EOF);\n return null;\n}\n\nfunction lexContent(ctx: LexerContext): StateFn {\n if (ctx.input.startsWith(HEADER_DELIM, ctx.pos)) {\n return lexHeaderDelim;\n }\n const i = ctx.input.indexOf(NEWLINE_HEADER_DELIM, ctx.pos);\n if (i > -1) {\n ctx.pos = i + 1;\n ctx.emit(ItemType.Content);\n return lexHeaderDelim;\n }\n ctx.pos = ctx.input.length;\n if (ctx.pos > ctx.start) {\n ctx.emit(ItemType.Content);\n }\n ctx.emit(ItemType.EOF);\n return null;\n}\n\nfunction lexHeaderDelim(ctx: LexerContext): StateFn {\n ctx.pos += HEADER_DELIM.length;\n ctx.emit(ItemType.Header);\n return lexName;\n}\n\nfunction lexName(ctx: LexerContext): StateFn {\n let r: number;\n outer: for (;;) {\n r = ctx.next();\n if (r === 0x5c) {\n // A backslash escapes the next character, but an escaped line end still ends the name.\n const next = ctx.next();\n if (next !== 0x0a && next !== EOF) continue;\n r = next;\n }\n switch (r) {\n case 0x5b: // [\n case 0x5d: // ]\n case 0x7b: // {\n case 0x7d: // }\n case 0x0a: // \\n\n case EOF:\n if (r !== EOF) ctx.backup();\n break outer;\n default:\n // Any other character is part of the name.\n break;\n }\n }\n // Always emit a name item, even if empty.\n ctx.emit(ItemType.Name);\n return lexAfterHeaderPart(ctx, r);\n}\n\nfunction lexNextOptionalBlock(ctx: LexerContext): StateFn {\n // Consume whitespace.\n ctx.acceptRun(' \\t');\n ctx.ignore();\n return lexAfterHeaderPart(ctx, ctx.peek());\n}\n\n/**\n * The state after the passage name or an optional block, by the character `r` that follows it (not yet\n * consumed). The name ends only at one of the characters handled here, so only an optional block can be\n * followed by an illegal one.\n */\nfunction lexAfterHeaderPart(ctx: LexerContext, r: number): StateFn {\n switch (r) {\n case 0x5b:\n return lexTags; // [\n case 0x5d:\n return ctx.errorf(`unexpected right square bracket ']'`);\n case 0x7b:\n return lexMetadata; // {\n case 0x7d:\n return ctx.errorf(`unexpected right curly brace '}'`);\n case 0x0a: // newline\n ctx.pos++;\n ctx.ignore();\n return lexContent;\n case EOF:\n ctx.emit(ItemType.EOF);\n return null;\n default:\n // `r` is the character at `pos`, which may be the first half of a surrogate pair.\n return ctx.errorf(`illegal character '${quotableCharacterAt(ctx.input, ctx.pos)}' amid the optional blocks`);\n }\n}\n\nfunction lexTags(ctx: LexerContext): StateFn {\n // Consume the left delimiter '['.\n ctx.pos++;\n\n for (;;) {\n const r = ctx.next();\n switch (r) {\n case 0x5c: {\n // A backslash escapes the next character, but not a line end. As in Tweego (which falls through to\n // the line end case), the line end is backed up, so the error is reported on the header's line.\n const next = ctx.next();\n if (next === 0x0a) ctx.backup();\n if (next === 0x0a || next === EOF) return ctx.errorf('unterminated tag block');\n break;\n }\n case 0x0a:\n ctx.backup();\n return ctx.errorf('unterminated tag block');\n case EOF:\n return ctx.errorf('unterminated tag block');\n case 0x5d: // ]\n if (ctx.pos > ctx.start) ctx.emit(ItemType.Tags);\n return lexNextOptionalBlock;\n case 0x5b: // [\n return ctx.errorf(`unexpected left square bracket '['`);\n case 0x7b: // {\n return ctx.errorf(`unexpected left curly brace '{'`);\n case 0x7d: // }\n return ctx.errorf(`unexpected right curly brace '}'`);\n default:\n // Any other character is part of the tags.\n break;\n }\n }\n}\n\nfunction lexMetadata(ctx: LexerContext): StateFn {\n // Consume the left delimiter '{'.\n ctx.pos++;\n\n let depth = 1;\n for (;;) {\n const r = ctx.next();\n switch (r) {\n case 0x22: {\n // double quote\n const err = acceptQuoted(ctx, 0x22);\n if (err) return ctx.errorf(err);\n break;\n }\n case 0x0a: // newline\n ctx.backup();\n return ctx.errorf('unterminated metadata block');\n case EOF:\n return ctx.errorf('unterminated metadata block');\n case 0x7b: // {\n depth++;\n break;\n case 0x7d: // }\n depth--;\n if (depth === 0) {\n if (ctx.pos > ctx.start) ctx.emit(ItemType.Metadata);\n return lexNextOptionalBlock;\n }\n break;\n default:\n // Any other character is part of the metadata.\n break;\n }\n }\n}\n\n/**\n * Twee 3 lexer — yields LexerItem tokens from Twee source text.\n *\n * In the Go reference, this uses goroutines and channels.\n * Here we use a synchronous generator that accumulates items per state step.\n */\nexport function* tweeLexer(input: string): Generator<LexerItem, void, undefined> {\n const ctx = new LexerContext(input);\n let state: StateFn = lexProlog;\n while (state !== null) {\n state = state(ctx);\n const items = ctx.drainItems();\n for (const item of items) {\n yield item;\n }\n }\n}\n\n/** Convenience class wrapper for the lexer generator. */\nexport class TweeLexer {\n private gen: Generator<LexerItem, void, undefined>;\n\n constructor(input: string) {\n this.gen = tweeLexer(input);\n }\n\n nextItem(): { item: LexerItem; done: boolean } {\n const result = this.gen.next();\n if (result.done) {\n return { item: { type: ItemType.EOF, line: 0, pos: 0, val: '' }, done: true };\n }\n return { item: result.value, done: false };\n }\n\n *[Symbol.iterator](): Generator<LexerItem, void, undefined> {\n yield* this.gen;\n }\n}\n","/**\n * Twee2 to Twee 3 header conversion, as Tweego's twee2compat.go does it.\n *\n * Tweego uses three Go (RE2) regular expressions in multi-line mode:\n *\n * - detect: `(?m)^:: *[^\\[]*?(?: *\\[.*?\\])? *<(.*?)> *$`\n * - header: `(?m)^(:: *[^\\[]*?)( *\\[.*?\\])?(?: *<(.*?)>)? *$`, replaced with `${1}${2} {\"position\":\"${3}\"}`\n * - empty position: `(?m)^(::.*?) *{\"position\":\" *\"}$`, replaced with `$1`\n *\n * In Go, lines end only at LF, `.` matches anything but LF, and a negated class such as `[^\\[]` matches LF\n * too. JavaScript regular expressions also end lines at CR, U+2028 and U+2029, and backtrack, which takes\n * polynomial time on long runs of spaces. So the expressions are evaluated here by hand, line by line, in\n * linear time, with the match RE2 would choose (leftmost-first, preferring the shorter lazy match). The test\n * suite checks this against JavaScript expressions written to have Go's semantics.\n */\n\nconst POSITION_OPEN = '{\"position\":\"';\nconst POSITION_CLOSE = '\"}';\n\n/** Index of the last character of `s` before `end` that is not a space (U+0020), or -1. */\nfunction lastNonSpace(s: string, end: number): number {\n let i = end - 1;\n while (i >= 0 && s.charCodeAt(i) === 0x20) i--;\n return i;\n}\n\n/**\n * Whether the detect expression has a match that ends at the end of `line`: the line, without trailing spaces,\n * ends with `>`, and an earlier `<` follows either text with no `[` or a tag block (`[…]`), each with optional\n * spaces before the `<`.\n */\nfunction endsWithPositionBlock(line: string): boolean {\n const end = lastNonSpace(line, line.length);\n if (end < 0 || line[end] !== '>') return false;\n const firstBracket = line.indexOf('[');\n for (let lt = line.indexOf('<'); lt !== -1 && lt < end; lt = line.indexOf('<', lt + 1)) {\n if (firstBracket === -1 || firstBracket >= lt) return true;\n const before = lastNonSpace(line, lt);\n if (line[before] === ']' && before > firstBracket) return true;\n }\n return false;\n}\n\n/**\n * Whether `lines` hold Twee2 syntax, as Tweego's detect expression finds it. Its `[^\\[]*?` crosses line\n * breaks, so the `<…>` block may end a later line than the header's, as long as no `[` comes between the\n * header's `::` and that line.\n */\nfunction hasTwee2Syntax(lines: readonly string[]): boolean {\n let open = false;\n for (const line of lines) {\n const header = line.startsWith('::');\n if ((open || header) && endsWithPositionBlock(line)) return true;\n open = header ? !line.slice(2).includes('[') : open && !line.includes('[');\n }\n return false;\n}\n\n/** What the header expression captures: `head` (group 1), `tags` (group 2) and `position` (group 3). */\ninterface HeaderMatch {\n readonly head: string;\n readonly tags: string;\n readonly position: string;\n}\n\n/**\n * The header expression's match for a line that starts with `::`, or undefined when it has none. The rest of\n * the line after `::` is split into a name part with no `[` (as short as possible), an optional tag block and\n * an optional `<…>` block, with only spaces after them.\n */\nfunction matchHeader(line: string): HeaderMatch | undefined {\n const rest = line.slice(2);\n const end = lastNonSpace(rest, rest.length);\n // The position block when its `<` is at `lt` (the first character after the spaces that may precede it):\n // the line then ends with `>` and spaces.\n const positionAt = (lt: number): string | undefined =>\n rest[lt] === '<' && lt < end && rest[end] === '>' ? rest.slice(lt + 1, end) : undefined;\n const match = (nameEnd: number, tagsEnd: number, position: string | undefined): HeaderMatch => ({\n head: '::' + rest.slice(0, nameEnd),\n tags: rest.slice(nameEnd, tagsEnd),\n position: position ?? '',\n });\n\n // The greedy ` *` after `::` takes the leading spaces into group 1 first; a match is always found with all\n // of them taken, if there is one at all, so the name part starts after them.\n let leading = 0;\n while (rest.charCodeAt(leading) === 0x20) leading++;\n const bracket = rest.indexOf('[');\n const nameLimit = bracket === -1 ? rest.length : bracket;\n // A tag block can start only after the run of spaces just before the first `[`.\n const tagsFrom = bracket === -1 ? -1 : Math.max(leading, lastNonSpace(rest, bracket) + 1);\n // The first character at or after `nameEnd` that is not a space; it only moves forward, so the loop is linear.\n let next = leading;\n for (let nameEnd = leading; nameEnd <= nameLimit; nameEnd++) {\n if (nameEnd === tagsFrom) {\n const tagged = matchTagBlock(rest, bracket, end, positionAt);\n if (tagged !== undefined) return match(nameEnd, tagged.tagsEnd, tagged.position);\n }\n next = Math.max(next, nameEnd);\n while (rest.charCodeAt(next) === 0x20) next++;\n // No tag block: a position block, or nothing but spaces.\n const position = positionAt(next);\n if (position !== undefined) return match(nameEnd, nameEnd, position);\n if (nameEnd > end) return match(nameEnd, nameEnd, undefined);\n }\n return undefined;\n}\n\n/**\n * The tag block that starts at the `[` at `bracket`: it ends at the first `]` after which the line holds only\n * a position block or only spaces. The spaces skipped after each `]` end at the next `]` at the latest, so\n * the search is linear.\n */\nfunction matchTagBlock(\n rest: string,\n bracket: number,\n end: number,\n positionAt: (lt: number) => string | undefined,\n): { readonly tagsEnd: number; readonly position: string | undefined } | undefined {\n for (let close = rest.indexOf(']', bracket + 1); close !== -1; close = rest.indexOf(']', close + 1)) {\n let lt = close + 1;\n while (rest.charCodeAt(lt) === 0x20) lt++;\n const position = positionAt(lt);\n if (position !== undefined || close === end) return { tagsEnd: close + 1, position };\n }\n return undefined;\n}\n\n/** A line with an empty or all-space position block at its end removed, with the spaces before it. */\nfunction withoutEmptyPosition(line: string): string {\n if (!line.startsWith('::') || !line.endsWith(POSITION_CLOSE)) return line;\n const spacesFrom = lastNonSpace(line, line.length - POSITION_CLOSE.length) + 1;\n const open = spacesFrom - POSITION_OPEN.length;\n if (open < 2 || line.slice(open, spacesFrom) !== POSITION_OPEN) return line;\n // The line starts with `::`, so at least that is kept.\n return line.slice(0, lastNonSpace(line, open) + 1);\n}\n\n/**\n * `text` as the content of a JSON string: a `\"`, `\\` or control character in a position is escaped, so it stays\n * part of the position. Tweego puts the text in as it is, so `<1\",\"size\":\"9,9>` adds a `size` key there and\n * `<1\\>` makes the metadata invalid JSON.\n */\nfunction jsonStringContent(text: string): string {\n return JSON.stringify(text).slice(1, -1);\n}\n\n/**\n * Convert Twee2 position blocks `<x,y>` in passage headers to Twee 3 metadata blocks `{\"position\":\"x,y\"}`,\n * as Tweego does, except that the position is escaped as a JSON string (see {@link jsonStringContent}).\n * Source text with no Twee2 syntax is returned unchanged.\n */\nexport function twee2ToV3(s: string): string {\n const lines = s.split('\\n');\n if (!hasTwee2Syntax(lines)) return s;\n return lines\n .map((line) => {\n if (!line.startsWith('::')) return line;\n const m = matchHeader(line);\n const converted =\n m === undefined ? line : `${m.head}${m.tags} ${POSITION_OPEN}${jsonStringContent(m.position)}${POSITION_CLOSE}`;\n return withoutEmptyPosition(converted);\n })\n .join('\\n');\n}\n","/**\n * Parse lexer items into Passage[].\n * Ported from storyload.go:loadTwee().\n */\nimport type { Passage, Diagnostic } from './types.js';\nimport { ItemType } from './types.js';\nimport { tweeLexer } from './lexer.js';\nimport { twee2ToV3 } from './twee2-compat.js';\nimport { decodePassageMetadata } from './passage.js';\nimport {\n normalizeTweeSource,\n splitTweeFields,\n stripTrailingBlankLines,\n trimTweeSpace,\n tweeUnescape,\n} from './twee-syntax.js';\n\nexport interface ParseOptions {\n /** Filename for diagnostics. */\n filename?: string | undefined;\n /**\n * Trim white space at both ends of passage content. Default: true. When false, the content is kept as\n * written except for its trailing blank lines, which the Twee 3 specification requires a reader to drop.\n */\n trim?: boolean | undefined;\n /** Enable Twee2 compatibility. Default: false. */\n twee2Compat?: boolean | undefined;\n}\n\nexport interface ParseResult {\n passages: Passage[];\n diagnostics: Diagnostic[];\n}\n\n/**\n * Parse Twee source text into passages.\n *\n * The source is normalized first (see `normalizeTweeSource`): a leading UTF-8 BOM is removed, CRLF and bare CR\n * line endings become LF, and a BOM at the start of a later line, directly before `::` (left there by\n * concatenating files), is removed too, so that line stays a passage header.\n *\n * Names and tags are read as Tweego reads them: unescaped, then the name trimmed and the tags split at white\n * space, where white space is Go's `unicode.IsSpace` (see `isTweeSpace`).\n */\nexport function parseTwee(source: string, options: ParseOptions = {}): ParseResult {\n const { filename = '<inline>', trim = true, twee2Compat = false } = options;\n const diagnostics: Diagnostic[] = [];\n\n const normalized = normalizeTweeSource(source);\n const tweeSource = twee2Compat ? twee2ToV3(normalized) : normalized;\n\n const passages: Passage[] = [];\n let current: Passage | null = null;\n let pCount = 0;\n let lastType: ItemType = ItemType.EOF;\n\n const malformed = (line: number, problem: string): Diagnostic => ({\n level: 'error',\n message: `line ${line}: Malformed twee source; ${problem}.`,\n file: filename,\n line,\n });\n\n for (const item of tweeLexer(tweeSource)) {\n switch (item.type) {\n case ItemType.Error:\n diagnostics.push(malformed(item.line, item.val));\n // Fatal: return what we have\n return { passages, diagnostics };\n\n case ItemType.EOF:\n if (pCount > 0 && current) {\n passages.push(current);\n }\n return { passages, diagnostics };\n\n case ItemType.Header:\n pCount++;\n if (pCount > 1 && current) {\n passages.push(current);\n }\n current = { name: '', tags: [], text: '', source: { file: filename, line: item.line } };\n break;\n\n case ItemType.Name: {\n if (!current) break;\n const unescaped = tweeUnescape(item.val);\n const name = trimTweeSpace(unescaped.text);\n if (name.length === 0) {\n diagnostics.push(malformed(item.line, 'passage with no name'));\n return { passages, diagnostics };\n }\n if (unescaped.danglingBackslash) {\n diagnostics.push({\n level: 'warning',\n message: `line ${item.line}: The passage name ${JSON.stringify(name)} ends in a backslash that escapes nothing; it is dropped, as in Tweego. Write \"\\\\\\\\\" for a backslash.`,\n file: filename,\n line: item.line,\n });\n }\n current.name = name;\n break;\n }\n\n case ItemType.Tags: {\n if (!current) break;\n if (lastType !== ItemType.Name) {\n diagnostics.push(malformed(item.line, 'optional tags block must immediately follow the passage name'));\n return { passages, diagnostics };\n }\n // Strip the surrounding [ and ]. The lexer ends a tag block only at an unescaped `]`, so its text\n // never ends in a lone backslash.\n current.tags = splitTweeFields(tweeUnescape(item.val.slice(1, -1)).text);\n break;\n }\n\n case ItemType.Metadata: {\n if (!current) break;\n if (lastType !== ItemType.Name && lastType !== ItemType.Tags) {\n diagnostics.push(\n malformed(item.line, 'optional metadata block must immediately follow the passage name or tags block'),\n );\n return { passages, diagnostics };\n }\n const decoded = decodePassageMetadata(item.val);\n if (decoded.ok) {\n current.metadata = decoded.metadata;\n for (const issue of decoded.issues) {\n diagnostics.push({\n level: 'warning',\n message: `load ${filename}: line ${item.line}: Passage metadata: ${issue.message}.`,\n file: filename,\n line: item.line,\n });\n }\n } else {\n diagnostics.push({\n level: 'warning',\n message: `load ${filename}: line ${item.line}: Malformed twee source; could not decode metadata (reason: ${decoded.reason}).`,\n file: filename,\n line: item.line,\n });\n }\n break;\n }\n\n case ItemType.Content: {\n if (!current) break;\n current.text = trim ? trimTweeSpace(item.val) : stripTrailingBlankLines(item.val);\n break;\n }\n\n default: {\n const _exhaustive: never = item.type;\n diagnostics.push(malformed(item.line, `unhandled lexer item type ${String(_exhaustive)}`));\n return { passages, diagnostics };\n }\n }\n\n lastType = item.type;\n }\n\n // Shouldn't reach here (EOF is always emitted), but just in case:\n if (pCount > 0 && current) {\n passages.push(current);\n }\n return { passages, diagnostics };\n}\n","/**\n * Twine 1 ROT13 obfuscation (`obfuscate:rot13` in StorySettings), as Twine 1.4 writes it and its engine reads it.\n */\nimport type { ReadonlyPassage } from './types.js';\nimport { createStory, unmarshalStorySettings } from './story.js';\n\n/**\n * Whether the StorySettings tiddlers among `passages` (those written to, or read from, a Twine 1 store area) turn\n * on ROT13 obfuscation, read the way the engine reads them: `obfuscate:rot13`, in any letter case.\n */\nexport function isRot13Obfuscated(passages: readonly Pick<ReadonlyPassage, 'name' | 'text'>[]): boolean {\n const settings = createStory();\n for (const p of passages) {\n // Diagnostics are dropped here; they are reported where the passage is added to a story.\n if (p.name === 'StorySettings') unmarshalStorySettings(settings, p.text, []);\n }\n return settings.twine1.settings.get('obfuscate') === 'rot13';\n}\n","/**\n * Twine HTML decompiler: parse compiled Twine 2 or Twine 1 HTML back into a Story model.\n * Ported from storyload.go:loadHTML().\n *\n * The HTML is read as a browser reads it (with parse5, scripting enabled; see `html-structure.ts`), so the story is\n * the one a story format finds: the first `tw-storydata` element (or Twine 1 store area) outside template contents,\n * comments and raw text; line breaks normalized and NUL handled as the HTML input stream does; and each passage's\n * text its `textContent`.\n *\n * Round trip: decompiling compiled HTML gives the compiled story back, except for code that the compiler escapes for\n * its element (`</script`, `</style` and, in double-escaped script text, `<!--` come back with a backslash after the\n * `<`; see `scriptContentEscape()`), the names of script and stylesheet passages (joined into one element), and what\n * HTML cannot carry (see `html-output-check.ts`), which compiling reports.\n */\nimport type { Passage, PassageMetadata, Diagnostic, DecompileOptions, Story } from './types.js';\nimport { createStory, storyAdd, storyPrepend, marshalStoryData, freeName } from './story.js';\nimport { rot13, tiddlerUnescape } from './escape.js';\nimport { normalizeIFID, validateIFID } from './ifid.js';\nimport { isObfuscatable, withGeneratedName } from './passage.js';\nimport {\n attributeOf,\n childElements,\n findStoreArea,\n findStories,\n findStoryData,\n isTiddler,\n parseHtml,\n textContent,\n} from './html-structure.js';\nimport type { HtmlElement } from './html-structure.js';\nimport { isRot13Obfuscated } from './twine1-obfuscation.js';\nimport { splitTweeFields, trimTweeSpace } from './twee-syntax.js';\nimport { pushAll } from './util.js';\n\nexport interface DecompileResult {\n story: Story;\n diagnostics: Diagnostic[];\n}\n\n/** What decompiling reports beyond what it reads. */\ninterface DecompileChecks {\n /** Report a missing or invalid `tw-storydata` IFID. */\n readonly ifid: boolean;\n}\n\n/**\n * Parse a Twine 2 or Twine 1 compiled HTML file back into a Story model.\n * Tweego always trims passage text; here `trim: false` keeps it exactly, as for Twee sources.\n * A missing or invalid `tw-storydata` IFID is reported as a warning; an invalid one is kept as\n * written (uppercased), a missing one stays empty.\n */\nexport function decompileHTML(html: string, options: DecompileOptions = {}): DecompileResult {\n return decompile(html, options, { ifid: true });\n}\n\n/**\n * `decompileHTML()` for loading an HTML file into a compile. The importer's StoryData passage is\n * checked when it is added to the story being compiled, which reports a missing or invalid IFID,\n * so the IFID is not reported here as well.\n */\nexport function decompileHTMLForImport(html: string, options: DecompileOptions = {}): DecompileResult {\n return decompile(html, options, { ifid: false });\n}\n\nfunction decompile(html: string, options: DecompileOptions, checks: DecompileChecks): DecompileResult {\n const diagnostics: Diagnostic[] = [];\n const story = createStory();\n const passageText = options.trim === false ? (text: string) => text : trimTweeSpace;\n\n const doc = parseHtml(html, false);\n\n // Try Twine 2 first (tw-storydata), then the Twine 1 store area.\n const twine2Data = findStoryData(doc);\n const twine1Data = twine2Data ? undefined : findStoreArea(doc);\n if (twine2Data) {\n decompileTwine2(twine2Data, story, passageText, checks, diagnostics);\n } else if (twine1Data) {\n decompileTwine1(twine1Data, story, passageText, diagnostics);\n } else {\n diagnostics.push({ level: 'error', message: 'Malformed HTML source; story data not found.' });\n return { story, diagnostics };\n }\n pushAll(diagnostics, otherStoriesDiagnostics(findStories(doc), twine2Data ?? twine1Data, story.name));\n return { story, diagnostics };\n}\n\n/**\n * A warning when the document holds `stories` besides the one read (`read`, named `name`): a Twine 2 library\n * archive, or files joined together. Only the first is read, as a story format and Tweego read it.\n */\nfunction otherStoriesDiagnostics(\n stories: readonly HtmlElement[],\n read: HtmlElement | undefined,\n name: string,\n): Diagnostic[] {\n const others = stories.filter((element) => element !== read).length;\n if (others === 0) return [];\n const which = name === '' ? 'one of them' : JSON.stringify(name);\n return [{ level: 'warning', message: `The HTML holds ${String(others + 1)} stories; only ${which} is read.` }];\n}\n\n/** Turns stored passage text into passage text: trimmed at both ends, or kept as is. */\ntype PassageText = (text: string) => string;\n\n/** Split a space-separated attribute value (tags, options) at white space, as Twee splits tags. */\nfunction splitList(value: string | undefined): string[] {\n return splitTweeFields(value ?? '');\n}\n\nfunction decompileTwine2(\n storyData: HtmlElement,\n story: Story,\n passageText: PassageText,\n checks: DecompileChecks,\n diagnostics: Diagnostic[],\n): void {\n // Parse tw-storydata attributes.\n let startnode = 0;\n let startFound = false;\n const attr = (name: string): string => attributeOf(storyData, name) ?? '';\n\n if (attr('name')) story.name = attr('name');\n if (attr('startnode')) {\n const parsed = parseInteger(attr('startnode'));\n if (parsed === undefined) {\n diagnostics.push({\n level: 'warning',\n message: `Cannot parse \"tw-storydata\" content attribute \"startnode\" as an integer; value \"${attr('startnode')}\".`,\n });\n } else {\n startnode = parsed;\n }\n }\n if (attr('ifid')) story.ifid = normalizeIFID(attr('ifid'));\n if (checks.ifid) pushAll(diagnostics, storyDataIFIDDiagnostics(attr('ifid')));\n if (attr('zoom')) {\n const parsed = parseDecimal(attr('zoom'));\n if (parsed === undefined) {\n diagnostics.push({\n level: 'warning',\n message: `Cannot parse \"tw-storydata\" content attribute \"zoom\" as a float; value \"${attr('zoom')}\".`,\n });\n } else {\n story.twine2.zoom = parsed;\n }\n }\n if (attr('tags')) story.twine2.tags = attr('tags');\n if (attr('format')) story.twine2.format = attr('format');\n if (attr('format-version')) story.twine2.formatVersion = attr('format-version');\n for (const opt of splitList(attr('options'))) story.twine2.options.set(opt, true);\n\n // The story stylesheet and script get generated passage names. Ordinary passages may use those\n // names too, so reserve every real passage name first and give the code passages names left free.\n const children = childElements(storyData);\n const takenNames = new Set(children.filter((node) => node.tagName === 'tw-passagedata').map(passageDataName));\n\n for (const node of children) {\n switch (node.tagName) {\n case 'style':\n case 'script': {\n const content = textContent(node);\n // Whitespace alone is no stylesheet or script, whether or not the text is trimmed.\n if (trimTweeSpace(content).length === 0) continue;\n const text = passageText(content);\n const base = node.tagName === 'style' ? 'Story Stylesheet' : 'Story JavaScript';\n const name = freeName(base, (n) => !takenNames.has(n));\n takenNames.add(name);\n const tags = node.tagName === 'style' ? ['stylesheet'] : ['script'];\n // Marked as generated, so that it also yields to passages of other files (see storyAdd()).\n storyAdd(story, withGeneratedName({ name, tags, text }, { kind: 'code', base }), diagnostics);\n break;\n }\n\n case 'tw-tag': {\n const tagName = attributeOf(node, 'name') ?? '';\n const tagColor = attributeOf(node, 'color') ?? '';\n if (tagName) story.twine2.tagColors.set(tagName, tagColor);\n break;\n }\n\n case 'tw-passagedata': {\n let pid = 0;\n const name = passageDataName(node);\n const tags = splitList(attributeOf(node, 'tags'));\n const metadata: PassageMetadata = {};\n const pidValue = attributeOf(node, 'pid') ?? '';\n\n if (pidValue) {\n const parsed = parseInteger(pidValue);\n if (parsed === undefined) {\n diagnostics.push({\n level: 'warning',\n message: `Cannot parse \"tw-passagedata\" content attribute \"pid\" as an integer; value \"${pidValue}\".`,\n });\n } else {\n pid = parsed;\n }\n }\n\n const position = attributeOf(node, 'position');\n const size = attributeOf(node, 'size');\n if (position) metadata.position = position;\n if (size) metadata.size = size;\n\n const text = passageText(textContent(node));\n const own = ownName(name, text, story, takenNames, diagnostics);\n if (pid === startnode && pid !== 0) {\n story.twine2.start = own;\n startFound = true;\n }\n const passage: Passage = { name: own, tags, text };\n if (metadata.position || metadata.size) {\n passage.metadata = metadata;\n }\n storyAdd(story, passage, diagnostics);\n break;\n }\n\n default:\n // Other elements inside tw-storydata are not part of the story.\n break;\n }\n }\n\n if (startnode !== 0 && !startFound) {\n diagnostics.push({\n level: 'warning',\n message: `The \"tw-storydata\" content attribute \"startnode\" is ${startnode}, but no \"tw-passagedata\" has that \"pid\"; the story has no start passage.`,\n });\n }\n\n // Prepend StoryData passage with serialized metadata.\n storyPrepend(story, { name: 'StoryData', tags: [], text: marshalStoryData(story) }, diagnostics);\n}\n\n/** An integer as Go's `strconv.Atoi` reads it (an optional sign and ASCII digits), within JavaScript's safe range. */\nfunction parseInteger(value: string): number | undefined {\n if (!/^[+-]?[0-9]+$/.test(value)) return undefined;\n const n = Number(value);\n return Number.isSafeInteger(n) ? n : undefined;\n}\n\n/** A finite decimal number (`0.6`, `.5`, `6e-1`), with nothing else around it. */\nfunction parseDecimal(value: string): number | undefined {\n if (!/^[+-]?(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/.test(value)) return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** What the special passages that the `tw-storydata` attributes stand for hold. */\nconst ATTRIBUTE_PASSAGES: Readonly<Record<string, string>> = {\n StoryData: 'the story metadata',\n StoryTitle: 'the story name',\n};\n\n/**\n * The name a `tw-passagedata` passage keeps in the story. In Twine 2 HTML the story metadata and name are the\n * `tw-storydata` attributes, and a passage named StoryData or StoryTitle is an ordinary passage; in Twee those\n * names are the special passages that hold them. So such a passage, unless it is a StoryTitle that holds the\n * story name, takes the first free name (`StoryData 2`, …), with a warning, and the attributes keep deciding.\n */\nfunction ownName(name: string, text: string, story: Story, taken: Set<string>, diagnostics: Diagnostic[]): string {\n const holds = Object.hasOwn(ATTRIBUTE_PASSAGES, name) ? ATTRIBUTE_PASSAGES[name] : undefined;\n if (holds === undefined || (name === 'StoryTitle' && trimTweeSpace(text) === story.name)) return name;\n const free = freeName(name, (n) => !taken.has(n));\n taken.add(free);\n diagnostics.push({\n level: 'warning',\n message: `Passage \"${name}\" renamed to \"${free}\": in Twee, \"${name}\" is the special passage that holds ${holds}, which this file's \"tw-storydata\" attributes give. Links to it must be changed by hand.`,\n });\n return free;\n}\n\nfunction passageDataName(node: HtmlElement): string {\n return attributeOf(node, 'name') ?? '';\n}\n\n/** Diagnostics for the `ifid` attribute of `tw-storydata`; `value` is empty when it is missing. */\nfunction storyDataIFIDDiagnostics(value: string): Diagnostic[] {\n if (value === '') {\n return [\n {\n level: 'warning',\n message: 'Story IFID not found; the \"tw-storydata\" content attribute \"ifid\" is missing or empty.',\n },\n ];\n }\n const err = validateIFID(value);\n if (err === null) return [];\n return [\n {\n level: 'warning',\n message: `Cannot parse \"tw-storydata\" content attribute \"ifid\" as an IFID; value \"${value}\" (${err}).`,\n },\n ];\n}\n\nfunction decompileTwine1(\n storeArea: HtmlElement,\n story: Story,\n passageText: PassageText,\n diagnostics: Diagnostic[],\n): void {\n const passages = childElements(storeArea)\n .filter(isTiddler)\n .map((node) => tiddlerToPassage(node, passageText));\n\n // When StorySettings says `obfuscate:rot13`, Twine 1.4 (and twee-ts) ROT13-encode the name, tags and text of\n // every obfuscatable tiddler, so read the settings before adding (and so interpreting) anything else. Whether a\n // tiddler is obfuscatable is decided on its stored name and tags, which such tiddlers keep unencoded.\n const obfuscated = isRot13Obfuscated(passages);\n for (const p of passages) {\n const passage =\n obfuscated && isObfuscatable(p) ? { ...p, name: rot13(p.name), tags: p.tags.map(rot13), text: rot13(p.text) } : p;\n storyAdd(story, passage, diagnostics);\n }\n}\n\nfunction tiddlerToPassage(node: HtmlElement, passageText: PassageText): Passage {\n const name = attributeOf(node, 'tiddler') ?? '';\n const tags = splitList(attributeOf(node, 'tags'));\n const text = passageText(tiddlerUnescape(textContent(node)));\n\n const passage: Passage = { name, tags, text };\n const position = attributeOf(node, 'twine-position');\n if (position) {\n passage.metadata = { position };\n }\n return passage;\n}\n","/**\n * File loading: dispatch by file extension.\n * Ported from storyload.go.\n */\nimport { basename } from 'node:path';\nimport { statSync } from 'node:fs';\nimport type { Story, Diagnostic, InlineSource, Passage, FileCacheEntry } from './types.js';\nimport type { DiscoveredFile } from './filesystem.js';\nimport { identify } from './path-identity.js';\nimport { duplicateInput, failureOfRead, inputProblem, problemDiagnostic } from './input-policy.js';\nimport { normalizedFileExt, mediaTypeFromFilename, mediaTypeFromExt, fontFormatHint } from './media-types.js';\nimport { storyAdd, storyHas, storyPrepend } from './story.js';\nimport { freezePassage, withGeneratedName } from './passage.js';\nimport { parseTwee } from './parser.js';\nimport { decompileHTMLForImport } from './html-parser.js';\nimport { readUTF8, readBase64, fileStem, decodeText, pushAll } from './util.js';\nimport type { DecodedText } from './util.js';\nimport { normalizeSourceText } from './source-text.js';\nimport { cssStringEscape } from './escape.js';\n\ninterface LoadOptions {\n trim?: boolean;\n twee2Compat?: boolean;\n}\n\n/**\n * A source file to load: a DiscoveredFile from getFilenames, or a bare path (treated as found in a folder,\n * so a file of an unknown type is skipped without a word).\n */\nexport type SourceFile = string | DiscoveredFile;\n\nfunction toDiscovered(file: SourceFile): DiscoveredFile {\n return typeof file === 'string' ? { path: file, key: identify(file).key, discovery: 'found' } : file;\n}\n\n/**\n * The identity keys of the files a build has loaded, next to the paths in its `processedFiles` set (which\n * the caller owns and reports as `stats.files`), so the same file reached by two spellings is loaded once.\n */\nconst processedKeys = new WeakMap<Set<string>, Map<string, string>>();\n\n/** The earlier spelling of `file` the build already loaded, if any; records `file` as loaded otherwise. */\nfunction alreadyLoaded(processedFiles: Set<string>, file: DiscoveredFile): string | undefined {\n let keys = processedKeys.get(processedFiles);\n if (keys === undefined) {\n keys = new Map([...processedFiles].map((path) => [identify(path).key, path]));\n processedKeys.set(processedFiles, keys);\n }\n return keys.get(file.key);\n}\n\nfunction markLoaded(processedFiles: Set<string>, file: DiscoveredFile): void {\n processedFiles.add(file.path);\n processedKeys.get(processedFiles)?.set(file.key, file.path);\n}\n\n/** The diagnostic the input policy gives a source file that failed to load (see input-policy.ts). */\nfunction loadFailure(file: DiscoveredFile, e: unknown): Diagnostic | undefined {\n return problemDiagnostic(inputProblem('source', file.discovery, failureOfRead(file.path, e), file.path, e));\n}\n\n/** The diagnostic for a file of a type sources don't load: a warning for a file named directly (FS-17). */\nfunction unsupportedType(file: DiscoveredFile): Diagnostic | undefined {\n return problemDiagnostic(inputProblem('source', file.discovery, 'unsupported-type', file.path, undefined));\n}\n\n/**\n * Load all source files into a story. A file that fails to load is reported as the input policy says\n * (an error, or a warning for a file found in a folder that went away since the walk), and the others are\n * still loaded, so one build reports every problem.\n */\nexport function loadSources(\n story: Story,\n filenames: readonly SourceFile[],\n opts: LoadOptions,\n diagnostics: Diagnostic[],\n processedFiles: Set<string>,\n): void {\n for (const file of filenames.map(toDiscovered)) {\n const filename = file.path;\n const earlier = alreadyLoaded(processedFiles, file);\n if (earlier !== undefined) {\n diagnostics.push(duplicateInput('source', file.path, earlier));\n continue;\n }\n\n let result: ParseResult | undefined;\n try {\n result = parseFile(filename, opts);\n } catch (e) {\n const failure = loadFailure(file, e);\n if (failure) diagnostics.push(failure);\n continue;\n }\n if (result === undefined) {\n const unsupported = unsupportedType(file);\n if (unsupported) diagnostics.push(unsupported);\n continue;\n }\n addParsed(story, result, diagnostics);\n markLoaded(processedFiles, file);\n }\n\n prependStoryTitle(story, diagnostics);\n}\n\n/**\n * Load inline sources (string content or InlineSource objects).\n */\nexport function loadInlineSources(\n story: Story,\n sources: (string | InlineSource)[],\n opts: LoadOptions,\n diagnostics: Diagnostic[],\n): void {\n for (const source of sources) {\n if (typeof source === 'string') {\n // Treat as a file path — handled externally\n continue;\n }\n // The type first: the content of a type in-memory sources don't load is never decoded, nor warned about.\n const ext = normalizedFileExt(source.filename);\n const kind = inlineSourceKind(ext);\n if (kind === undefined) {\n diagnostics.push({\n level: 'warning',\n message: `load ${source.filename}: in-memory sources of type .${ext} are not supported; skipped.`,\n });\n continue;\n }\n // Decode and normalize like readUTF8() does for files, so in-memory and on-disk sources load the same.\n let decoded: DecodedText;\n try {\n decoded =\n typeof source.content === 'string'\n ? { text: source.content, diagnostics: [] }\n : decodeText(source.content, source.filename);\n } catch (e) {\n const failure = loadFailure({ path: source.filename, key: '', discovery: 'named' }, e);\n if (failure) diagnostics.push(failure);\n continue;\n }\n pushAll(diagnostics, decoded.diagnostics);\n const content = normalizeSourceText(decoded.text);\n\n switch (kind) {\n case 'twee':\n case 'twee2': {\n const result = parseTwee(content, {\n filename: source.filename,\n trim: opts.trim ?? true,\n twee2Compat: kind === 'twee2' || (opts.twee2Compat ?? false),\n });\n pushAll(diagnostics, result.diagnostics);\n for (const p of result.passages) {\n storyAdd(story, p, diagnostics);\n }\n break;\n }\n case 'stylesheet':\n case 'script':\n storyAdd(story, codePassage(basename(source.filename), kind, content), diagnostics);\n break;\n default: {\n const _exhaustive: never = kind;\n throw new Error(`unhandled in-memory source kind: ${String(_exhaustive)}`);\n }\n }\n }\n}\n\n/** What an in-memory source loads as by its extension `ext` (Twee, CSS or JavaScript), or undefined for another type. */\nfunction inlineSourceKind(ext: string): 'twee' | 'twee2' | 'stylesheet' | 'script' | undefined {\n switch (ext) {\n case '':\n case 'tw':\n case 'twee':\n return 'twee';\n case 'tw2':\n case 'twee2':\n return 'twee2';\n case 'css':\n return 'stylesheet';\n case 'js':\n return 'script';\n default:\n return undefined;\n }\n}\n\ninterface ParseResult {\n passages: Passage[];\n diagnostics: Diagnostic[];\n}\n\nfunction parseTweeFile(filename: string, opts: LoadOptions): ParseResult {\n const readDiagnostics: Diagnostic[] = [];\n const source = readUTF8(filename, readDiagnostics);\n const result = parseTwee(source, {\n filename,\n trim: opts.trim ?? true,\n twee2Compat: opts.twee2Compat ?? false,\n });\n return { passages: result.passages, diagnostics: [...readDiagnostics, ...result.diagnostics] };\n}\n\n/**\n * A stylesheet or script passage named after its file, as Tweego names it. The name only labels\n * the code, so when another passage has it, the passage takes a free one (see `storyAdd()`).\n */\nfunction codePassage(name: string, tag: string, text: string): Passage {\n return withGeneratedName({ name, tags: [tag], text }, { kind: 'code', base: name });\n}\n\n/** Mark every passage of a parse result as a code passage named after its file. */\nfunction codeNames(result: ParseResult): ParseResult {\n for (const p of result.passages) withGeneratedName(p, { kind: 'code', base: p.name });\n return result;\n}\n\nfunction parseTaggedFile(tag: string, filename: string): ParseResult {\n const diagnostics: Diagnostic[] = [];\n const source = readUTF8(filename, diagnostics);\n return { passages: [codePassage(basename(filename), tag, source)], diagnostics };\n}\n\nfunction parseMediaFile(tag: string, filename: string): ParseResult {\n const source = readBase64(filename);\n const name = fileStem(filename);\n const passage = { name, tags: [tag], text: `data:${mediaTypeFromFilename(filename)};base64,${source}` };\n return {\n passages: [withGeneratedName(passage, { kind: 'media', base: name, file: filename })],\n diagnostics: [],\n };\n}\n\nfunction parseFontFile(filename: string): ParseResult {\n const source = readBase64(filename);\n const name = basename(filename);\n const family = fileStem(filename);\n const ext = normalizedFileExt(filename);\n const mediaType = mediaTypeFromExt(ext);\n const hint = fontFormatHint(ext);\n return codeNames({\n passages: [\n {\n name,\n tags: ['stylesheet'],\n text: `@font-face {\\n\\tfont-family: \"${cssStringEscape(family)}\";\\n\\tsrc: url(\"data:${mediaType};base64,${source}\") format(\"${hint}\");\\n}`,\n },\n ],\n diagnostics: [],\n });\n}\n\nfunction parseHTMLFile(filename: string, opts: LoadOptions): ParseResult {\n const readDiagnostics: Diagnostic[] = [];\n const { story, diagnostics } = decompileHTMLForImport(readUTF8(filename, readDiagnostics), {\n trim: opts.trim ?? true,\n });\n // Twine 2 HTML keeps the story name in an attribute, not a passage. Only passages reach the\n // outer story (and the cache), so carry the name as a StoryTitle passage, as Twine 1 HTML does.\n const passages =\n story.name !== '' && !storyHas(story, 'StoryTitle')\n ? [{ name: 'StoryTitle', tags: [], text: story.name }, ...story.passages]\n : story.passages;\n return { passages, diagnostics: [...readDiagnostics, ...diagnostics] };\n}\n\n/**\n * Identity of the options that affect how a file parses, stored on its cache entry.\n * Twee files depend on `trim` and `twee2Compat`, HTML files on `trim`; every other file type\n * yields the same key for all options.\n */\nfunction parseOptionsKey(filename: string, opts: LoadOptions): string {\n const ext = normalizedFileExt(filename);\n const trim = opts.trim ?? true;\n if (ext === 'htm' || ext === 'html') return JSON.stringify({ trim });\n const twee2File = ext === 'tw2' || ext === 'twee2';\n if (!twee2File && ext !== 'tw' && ext !== 'twee') return '';\n return JSON.stringify({ trim, twee2Compat: twee2File || (opts.twee2Compat ?? false) });\n}\n\nfunction parseFile(filename: string, opts: LoadOptions): ParseResult | undefined {\n const ext = normalizedFileExt(filename);\n switch (ext) {\n case 'tw':\n case 'twee':\n return parseTweeFile(filename, opts);\n case 'tw2':\n case 'twee2':\n return parseTweeFile(filename, { ...opts, twee2Compat: true });\n case 'htm':\n case 'html':\n return parseHTMLFile(filename, opts);\n case 'css':\n return parseTaggedFile('stylesheet', filename);\n case 'js':\n return parseTaggedFile('script', filename);\n case 'otf':\n case 'ttf':\n case 'woff':\n case 'woff2':\n return parseFontFile(filename);\n case 'gif':\n case 'jpeg':\n case 'jpg':\n case 'png':\n case 'svg':\n case 'tif':\n case 'tiff':\n case 'webp':\n return parseMediaFile('Twine.image', filename);\n case 'aac':\n case 'flac':\n case 'm4a':\n case 'mp3':\n case 'oga':\n case 'ogg':\n case 'opus':\n case 'wav':\n case 'wave':\n case 'weba':\n return parseMediaFile('Twine.audio', filename);\n case 'mp4':\n case 'ogv':\n case 'webm':\n return parseMediaFile('Twine.video', filename);\n case 'vtt':\n return parseMediaFile('Twine.vtt', filename);\n default:\n return undefined;\n }\n}\n\n/** Adds a parsed file's passages to the story, after its diagnostics. */\nfunction addParsed(\n story: Story,\n result: { readonly passages: readonly Passage[]; readonly diagnostics: readonly Diagnostic[] },\n diagnostics: Diagnostic[],\n): void {\n // Copies: the caller gets diagnostics it may change, and the cache keeps its own (#246 S-4).\n pushAll(\n diagnostics,\n result.diagnostics.map((d): Diagnostic => ({ ...d })),\n );\n for (const p of result.passages) {\n storyAdd(story, p, diagnostics);\n }\n}\n\n/** Prepends a StoryTitle passage when the story has a name but no such passage. */\nfunction prependStoryTitle(story: Story, diagnostics: Diagnostic[]): void {\n if (story.name !== '' && !story.passages.some((p) => p.name === 'StoryTitle')) {\n storyPrepend(story, { name: 'StoryTitle', tags: [], text: story.name }, diagnostics);\n }\n}\n\n/**\n * What a change to a file alters besides its modification time: its size, its inode (a file replaced by\n * another), and its status-change time, which a write updates even when it puts the modification time\n * back (`cp -p`, `rsync -t`, `tar x`, `touch -r`).\n */\nfunction fileSignature(stats: { size: number; ino: number; dev: number; ctimeMs: number }): string {\n return `${stats.size}:${stats.dev}:${stats.ino}:${stats.ctimeMs}`;\n}\n\n/**\n * Load sources with caching for incremental rebuilds: a cached file is reused while its modification\n * time and its signature (size, inode, status-change time) are unchanged. Cache entries are keyed by the\n * path the file is loaded under; `changedFiles` may name a file in any spelling (absolute, `./`-prefixed,\n * relative to the working directory, or through a link) and is matched to the files by identity (see\n * path-identity.ts). Always creates a fresh Story; cached passages are replayed via storyAdd().\n */\nexport function loadSourcesCached(\n story: Story,\n filenames: readonly SourceFile[],\n opts: LoadOptions,\n diagnostics: Diagnostic[],\n processedFiles: Set<string>,\n cache: Map<string, FileCacheEntry>,\n changedFiles?: ReadonlySet<string>,\n buildFiles?: ReadonlySet<string>,\n): void {\n const currentFiles = new Set<string>(buildFiles);\n const changedKeys = changedFiles === undefined ? undefined : new Set([...changedFiles].map((f) => identify(f).key));\n\n for (const file of filenames.map(toDiscovered)) {\n const filename = file.path;\n const earlier = alreadyLoaded(processedFiles, file);\n if (earlier !== undefined) {\n diagnostics.push(duplicateInput('source', file.path, earlier));\n // Not loaded under this path, so its entry is not kept up to date: a change to the file reaches only the\n // entry of the spelling that loaded it. Dropped, so it can't be replayed stale once this path loads (#400).\n cache.delete(filename);\n continue;\n }\n\n currentFiles.add(filename);\n const optionsKey = parseOptionsKey(filename, opts);\n // An entry parsed under other options (or without a recorded key) is stale.\n const entry = cache.get(filename);\n const cached = entry?.parseOptionsKey === optionsKey ? entry : undefined;\n // A file changedFiles names is always reparsed: a save can keep the modification time\n // (a timestamp-preserving write, or a filesystem with coarse timestamps).\n const changed = changedKeys?.has(file.key) ?? false;\n\n // If changedFiles is provided and this file isn't changed and we have a cache hit, skip stat\n if (changedKeys && cached && !changed) {\n addParsed(story, cached, diagnostics);\n markLoaded(processedFiles, file);\n continue;\n }\n\n let mtimeMs: number;\n let signature: string;\n try {\n const stats = statSync(filename);\n mtimeMs = stats.mtimeMs;\n signature = fileSignature(stats);\n } catch (e) {\n // Deleted (or made unreadable) between getFilenames and here. Its entry goes too, so a later\n // build that doesn't name it in changedFiles can't replay its old passages.\n cache.delete(filename);\n const failure = loadFailure(file, e);\n if (failure) diagnostics.push(failure);\n continue;\n }\n\n // Cache hit with matching mtime and signature, for a file not known to have changed: replay\n if (cached && !changed && cached.mtimeMs === mtimeMs && cached.signature === signature) {\n addParsed(story, cached, diagnostics);\n markLoaded(processedFiles, file);\n continue;\n }\n\n // Cache miss: parse and store\n try {\n const result = parseFile(filename, opts);\n if (!result) {\n const unsupported = unsupportedType(file);\n if (unsupported) diagnostics.push(unsupported);\n continue;\n }\n\n // Frozen, so that nothing a build hands out, nor a later step of this build, can change what the\n // next build replays (#246 S-4). The passages keep their identity, and with it a generated name.\n cache.set(filename, {\n mtimeMs,\n signature,\n parseOptionsKey: optionsKey,\n passages: Object.freeze(result.passages.map(freezePassage)),\n diagnostics: Object.freeze(result.diagnostics.map((d) => Object.freeze(d))),\n });\n\n addParsed(story, result, diagnostics);\n } catch (e) {\n // A file that fails to load keeps no entry: the next build tries it again, and reports\n // the error again while it persists, rather than replaying its old passages.\n cache.delete(filename);\n const failure = loadFailure(file, e);\n if (failure) diagnostics.push(failure);\n continue;\n }\n markLoaded(processedFiles, file);\n }\n\n // Purge cache entries for deleted files\n for (const key of cache.keys()) {\n if (!currentFiles.has(key)) {\n cache.delete(key);\n }\n }\n\n prependStoryTitle(story, diagnostics);\n}\n","/**\n * Story format template filling.\n *\n * Placeholders are found in the template text before anything is inserted, so inserted text (a story title,\n * passage data, a start passage name, module or head file content) is never scanned for placeholders. Where each\n * placeholder sits, and where the head ends and the Twine 1 store area starts, is read from one parse of the\n * template (see `html-structure.ts`), and each value is escaped for the context it lands in.\n */\nimport type { Diagnostic } from './types.js';\nimport {\n analyzeTemplate,\n contentStaysInHead,\n HtmlNestingError,\n locateHeadEnd,\n locateStoreArea,\n locateTextContainer,\n removalKeepsStructure,\n replacementIsLiveElement,\n STORE_AREA_DESCRIPTION,\n} from './html-structure.js';\nimport type { HeadPlacement, PlaceholderOccurrence, PlaceholderSite } from './html-structure.js';\nimport { escapeForContext, htmlEscape, jsStringEscape } from './escape.js';\nimport type { InsertionContext } from './escape.js';\nimport { pushAll } from './util.js';\nimport { TweeTsError } from './errors.js';\n\n/** What replaces a placeholder. */\nexport type PlaceholderValue =\n /** Text, escaped for the context of each occurrence (the story name; Twine 1 `\"VERSION\"` and `\"TIME\"`). */\n | { readonly kind: 'text'; readonly text: string }\n /**\n * HTML elements, inserted as they are, only where they become elements of the page (the story data). `probe` is\n * an empty element of the kind `html` starts with, which is inserted to check that. `comment` (the IFID comment)\n * goes before them, or, where the placeholder is inside an element of the template's own rather than `body`,\n * before that element: so that element's child nodes are the ones its template gives it (SugarCube 1 reads its\n * store area's first child node as the story data).\n */\n | { readonly kind: 'markup'; readonly html: string; readonly probe: string; readonly comment?: string }\n /**\n * Text whose placeholder's quotes become the quotes of a JavaScript string literal (`\"START_AT\"`) or of an\n * attribute value (`data-size=\"STORY_SIZE\"`), as Tweego writes them; elsewhere the quotes are kept as text.\n */\n | { readonly kind: 'quoted'; readonly text: string };\n\n/** A placeholder of a story format template. */\nexport interface Placeholder {\n /** The placeholder as written, delimiters included: `{{STORY_NAME}}`, or `\"STORY\"` for Twine 1. */\n readonly token: string;\n /** Replace only the first occurrence that takes the value, or every occurrence. */\n readonly occurrences: 'first' | 'all';\n readonly value: PlaceholderValue;\n}\n\n/** A story format template to fill. */\nexport interface TemplateFill {\n /** The template text, where placeholders are looked for. */\n readonly template: string;\n readonly placeholders: readonly Placeholder[];\n /**\n * For a pre-1.4 Twine 1 format: the story data and the footer that follow the template, and an element the parser\n * reads as it reads the data (see `storyDataProbe()`). The head content and the store area comment may go into the\n * footer; placeholders there are left alone (as Tweego leaves them).\n */\n readonly tail?: { readonly data: string; readonly footer: string; readonly probe: string } | undefined;\n /** Content for the end of the head (modules and the head file). Nothing is inserted when it is empty. */\n readonly head?: string | undefined;\n /** A comment for before the Twine 1 store area element (the IFID comment). */\n readonly beforeStoreArea?: string | undefined;\n /** Names the template in diagnostics, such as `Story format \"Harlowe\" 3.3.9`. */\n readonly owner: string;\n}\n\n/** A filled template, and the warnings about it. */\nexport interface FilledTemplate {\n readonly output: string;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** An edit of the template text: replace `[start, end)` with `text` (an insertion when `start === end`). */\ninterface Edit {\n readonly start: number;\n readonly end: number;\n readonly text: string;\n}\n\n/**\n * Fill a story format template: placeholders, head content and the store area comment. Throws a TweeTsError naming\n * the template when it nests elements too deeply to read.\n */\nexport function fillFormatTemplate(fill: TemplateFill): FilledTemplate {\n try {\n return fillTemplate(fill);\n } catch (e) {\n if (!(e instanceof HtmlNestingError)) throw e;\n throw new TweeTsError(`${fill.owner}: ${e.message}`, [], { code: e.code, cause: e });\n }\n}\n\nfunction fillTemplate(fill: TemplateFill): FilledTemplate {\n const { template, tail, owner } = fill;\n // The story data of a pre-1.4 Twine 1 format, between the template and the footer, is a sequence of tiddler\n // elements; one stands in for it while the template and footer are parsed together.\n const sentinel = tail === undefined || tail.data === '' ? '' : tail.probe;\n const document = tail === undefined ? template : template + sentinel + tail.footer;\n const found = findPlaceholders(template, fill.placeholders);\n const analysis = analyzeTemplate(document, found);\n const diagnostics: Diagnostic[] = [];\n const edits: Edit[] = [];\n\n for (const placeholder of fill.placeholders) {\n const occurrences = found.flatMap((occurrence, i) => {\n const site = analysis.sites[i];\n return occurrence.placeholder === placeholder && site !== undefined ? [{ occurrence, site }] : [];\n });\n const locate: MarkupLocator = {\n isLive: (occurrence, probe) =>\n replacementIsLiveElement(analysis.marked, analysis.doc, occurrence.start, occurrence.end, probe),\n container: (occurrence) => locateTextContainer(analysis.doc, occurrence.start),\n keepsStructure: (occurrence) =>\n removalKeepsStructure(analysis.marked, analysis.doc, occurrence.start, occurrence.end),\n };\n const placed = placeholderEdits(document, placeholder, occurrences, owner, locate);\n pushAll(edits, placed.edits);\n pushAll(diagnostics, placed.diagnostics);\n }\n\n const head = fill.head ?? '';\n if (head !== '') {\n const placement = locateHeadEnd(analysis.marked, analysis.doc);\n pushAll(diagnostics, headDiagnostics(placement, owner, document));\n if (placement !== undefined) {\n // On its own line, as Tweego writes it; but where the head has already ended, the line break would be text\n // after the head, so it is left out there.\n const stays = (text: string): boolean =>\n contentStaysInHead(analysis.marked, analysis.doc, placement.offset, text);\n let content = `${head}\\n`;\n if (placement.how !== 'end-tag' && !stays(content) && stays(head)) content = head;\n if (!stays(content)) {\n diagnostics.push({\n level: 'warning',\n message:\n `The modules and head file content injected into the head of ${owner} do not stay in the head: ` +\n 'they hold text, body elements, or an unclosed comment, element or attribute, which changes how the ' +\n 'rest of the page is read.',\n });\n }\n edits.push({ start: placement.offset, end: placement.offset, text: content });\n }\n }\n\n if (fill.beforeStoreArea !== undefined) {\n const at = locateStoreArea(analysis.doc);\n if (at === undefined) {\n diagnostics.push({\n level: 'warning',\n message: `${owner} has no ${STORE_AREA_DESCRIPTION}; the IFID comment was not added.`,\n });\n } else {\n edits.push({ start: at, end: at, text: fill.beforeStoreArea });\n }\n }\n\n if (tail !== undefined) {\n edits.push({ start: template.length, end: template.length + sentinel.length, text: tail.data });\n }\n return { output: applyEdits(document, edits), diagnostics };\n}\n\n/** An occurrence of a placeholder in the template. */\ninterface Found extends PlaceholderOccurrence {\n readonly placeholder: Placeholder;\n}\n\n/** Every occurrence of the placeholders in `template`, left to right and not overlapping. */\nfunction findPlaceholders(template: string, placeholders: readonly Placeholder[]): Found[] {\n if (placeholders.length === 0) return [];\n const tokens = new Map(placeholders.map((placeholder) => [placeholder.token, placeholder]));\n const pattern = new RegExp(\n [...tokens.keys()].map((token) => token.replace(/[.*+?^${}()|[\\]\\\\/]/g, '\\\\$&')).join('|'),\n 'g',\n );\n return [...template.matchAll(pattern)].flatMap((match) => {\n const placeholder = tokens.get(match[0]);\n if (placeholder === undefined) return [];\n const start = match.index;\n const end = start + match[0].length;\n const delimiter = match[0].startsWith('{{') ? 2 : 1;\n return [{ placeholder, start, end, innerStart: start + delimiter, innerEnd: end - delimiter }];\n });\n}\n\n/** Where markup lands in the template. */\ninterface MarkupLocator {\n /** Whether `probe` written at the occurrence becomes an element of the page (see `replacementIsLiveElement()`). */\n readonly isLive: (occurrence: Found, probe: string) => boolean;\n /** The start of the element of the template's own that holds the occurrence (see `locateTextContainer()`). */\n readonly container: (occurrence: Found) => number | undefined;\n /** Whether removing the occurrence changes nothing else in the page (see `removalKeepsStructure()`). */\n readonly keepsStructure: (occurrence: Found) => boolean;\n}\n\n/** The edits for one placeholder, given each of its occurrences and where it sits. */\nfunction placeholderEdits(\n document: string,\n placeholder: Placeholder,\n occurrences: readonly { readonly occurrence: Found; readonly site: PlaceholderSite }[],\n owner: string,\n locate: MarkupLocator,\n): { edits: Edit[]; diagnostics: Diagnostic[] } {\n const replace = ({ occurrence, site }: { occurrence: Found; site: PlaceholderSite }): string | undefined => {\n const { value } = placeholder;\n if (value.kind === 'markup') {\n const { context, delimiters } = site;\n const inText = delimiters === 'inside' && context.kind === 'text';\n return inText && locate.isLive(occurrence, value.probe) ? value.html : undefined;\n }\n const before = document.slice(0, occurrence.start);\n const after = document.slice(occurrence.end);\n const text = replacementFor(value, site, before, after);\n // An empty value cannot be escaped; in a context that takes values, the template text around it joining up for\n // the HTML tokenizer matters only where that changes the page (`<!` and `--` making `<!--` in script text that\n // still ends at its end tag does not). A context that takes no value (JavaScript code), and text that joins up\n // for the script or style language itself (`*` and `/` ending a comment, a backslash escape), still warn.\n const empty =\n value.kind === 'text' &&\n value.text === '' &&\n site.delimiters === 'inside' &&\n escapeForContext('', site.context) !== undefined &&\n !codeGlues(site.context, before, after);\n return text === undefined && empty && locate.keepsStructure(occurrence) ? '' : text;\n };\n // The markup's comment goes before the element of the template's own that holds a live placeholder, else first.\n const edit = (occurrence: Found, text: string, live: boolean): Edit[] => {\n const { value } = placeholder;\n const comment = value.kind === 'markup' ? value.comment : undefined;\n const container = comment !== undefined && live ? locate.container(occurrence) : undefined;\n if (comment === undefined) return [{ start: occurrence.start, end: occurrence.end, text }];\n if (container === undefined) return [{ start: occurrence.start, end: occurrence.end, text: comment + text }];\n return [\n { start: container, end: container, text: comment },\n { start: occurrence.start, end: occurrence.end, text },\n ];\n };\n\n if (placeholder.occurrences === 'first') {\n for (const entry of occurrences) {\n const text = replace(entry);\n if (text !== undefined) return { edits: edit(entry.occurrence, text, true), diagnostics: [] };\n }\n const [first] = occurrences;\n if (first === undefined) return { edits: [], diagnostics: [] };\n return {\n edits: edit(first.occurrence, fallbackFor(placeholder.value), false),\n diagnostics: [unsupportedSite(placeholder, first, owner, document)],\n };\n }\n\n const edits: Edit[] = [];\n const diagnostics: Diagnostic[] = [];\n for (const entry of occurrences) {\n const text = replace(entry);\n if (text === undefined) diagnostics.push(unsupportedSite(placeholder, entry, owner, document));\n pushAll(edits, edit(entry.occurrence, text ?? fallbackFor(placeholder.value), text !== undefined));\n }\n return { edits, diagnostics };\n}\n\n/**\n * What replaces a text placeholder at `site`, between the template texts `before` and `after`, or `undefined` when\n * the value cannot be written there.\n */\nfunction replacementFor(\n value: Exclude<PlaceholderValue, { kind: 'markup' }>,\n site: PlaceholderSite,\n before: string,\n after: string,\n): string | undefined {\n const { context, delimiters } = site;\n if (value.kind === 'text') {\n return delimiters === 'inside' ? escapeAtBoundary(value.text, context, before, after) : undefined;\n }\n // A quoted placeholder: its quotes are a JavaScript string literal's, an attribute value's, or text.\n if (delimiters === 'string') return `\"${jsStringEscape(value.text)}\"`;\n if (delimiters === 'attribute') return `\"${htmlEscape(value.text)}\"`;\n if (delimiters === 'split') return undefined;\n const text = escapeAtBoundary(value.text, context, `${before}\"`, `\"${after}`);\n return text === undefined ? undefined : `\"${text}\"`;\n}\n\n/** What Tweego writes for a value in a place twee-ts cannot escape for. */\nfunction fallbackFor(value: PlaceholderValue): string {\n if (value.kind === 'markup') return value.html;\n return value.kind === 'text' ? htmlEscape(value.text) : `\"${jsStringEscape(value.text)}\"`;\n}\n\n/** Matches text ending in an unfinished character reference (`&`, `&am`, `&#x4`), which a following character extends. */\nconst REFERENCE_START = /&[0-9A-Za-z#]*$/;\n/** Matches text ending in a `<` that a following letter, `/`, `!` or `?` makes a tag, end tag or comment. */\nconst TAG_START = /<\\/?[A-Za-z]*$/;\n/** The sequences that change how the HTML tokenizer reads script text: the escape states and the end tag. */\nconst SCRIPT_SEQUENCES = /<!--|-->|<\\/?script[\\t\\n\\f\\r />]/gi;\n/** The same, in script text with no `<!--` before: only an escaped state ends at `-->`, and there is none. */\nconst PLAIN_SCRIPT_SEQUENCES = /<!--|<\\/?script[\\t\\n\\f\\r />]/gi;\n/** The sequence that ends style text. */\nconst STYLE_SEQUENCES = /<\\/style[\\t\\n\\f\\r />]/gi;\n/** Matches text ending in an odd number of backslashes, which escape the character that follows. */\nconst ESCAPING_BACKSLASH = /(?<!\\\\)(?:\\\\\\\\)*\\\\$/;\n\n/** A context whose text has no escapes: a JavaScript or CSS comment. */\ntype CodeContext = Extract<InsertionContext, { kind: 'script' | 'json' | 'style' }>;\n\nfunction isCodeComment(context: CodeContext): boolean {\n if (context.kind === 'style') return context.css.kind === 'comment';\n return context.js.kind === 'block-comment' || context.js.kind === 'line-comment';\n}\n\n/**\n * Escape `value` for `context` (see `escapeForContext()`), so that it also forms nothing with the template text\n * around it: a character reference started before it, a tag, end tag or comment after a `<`, a `</script`, `<!--`\n * or `-->` in a script, a JavaScript or CSS escape sequence, a template substitution, or the end of a comment.\n * `undefined` when no escaping can avoid that.\n */\nfunction escapeAtBoundary(value: string, context: InsertionContext, before: string, after: string): string | undefined {\n const escaped = escapeForContext(value, context);\n if (escaped === undefined) return undefined;\n // Where the parser drops a line feed right after the start tag, one more keeps the line feed that follows.\n const extraNewline =\n context.kind === 'text' && context.dropsLeadingNewline && /^[\\n\\r]/.test(escaped + after) ? '\\n' : '';\n if (escaped === '') return extraNewline === '' && startGlues(context, before, after) ? undefined : extraNewline;\n let text = escaped;\n if (startGlues(context, before, text)) {\n if (context.kind !== 'style' && context.kind !== 'script' && context.kind !== 'json') {\n text = `&#${text.charCodeAt(0)};${text.slice(1)}`;\n } else if (isCodeComment(context)) {\n text = ` ${text}`;\n } else if (ESCAPING_BACKSLASH.test(before)) {\n // A backslash before the value escapes its first character, whatever that is.\n return undefined;\n } else {\n text = codeEscape(context, text.charAt(0)) + text.slice(1);\n }\n }\n if (endGlues(context, text, after)) {\n text = isCodeComment(context) ? `${text} ` : text.slice(0, -1) + codeEscape(context, '-');\n }\n return extraNewline + text;\n}\n\n/**\n * Whether escaped `text` ends where it forms something with the template text `after`: `-->` in script text (the\n * text holds no `<`), or `*\\/` in a JavaScript or CSS block comment.\n */\nfunction endGlues(context: InsertionContext, text: string, after: string): context is CodeContext {\n switch (context.kind) {\n case 'script':\n case 'json':\n if (context.js.kind === 'block-comment' && text.endsWith('*') && after.startsWith('/')) return true;\n if (!context.escapable) return false;\n return (text.endsWith('--') && after.startsWith('>')) || (text.endsWith('-') && after.startsWith('->'));\n case 'style':\n return context.css.kind === 'comment' && text.endsWith('*') && after.startsWith('/');\n default:\n return false;\n }\n}\n\n/** Whether `next`, written after the template text `before` in `context`, would be read together with it. */\nfunction startGlues(context: InsertionContext, before: string, next: string): boolean {\n // Raw text and markup take no value (see `escapeForContext()`).\n if (next === '' || context.kind === 'raw-text' || context.kind === 'markup') return false;\n // The input stream reads a carriage return and a line feed after it as one line break.\n if (before.endsWith('\\r') && next.startsWith('\\n')) return true;\n switch (context.kind) {\n case 'text':\n return (\n (REFERENCE_START.test(before) && /^[0-9A-Za-z#;=]/.test(next)) ||\n (TAG_START.test(before) && /^[A-Za-z!/?]/.test(next))\n );\n case 'attribute':\n return REFERENCE_START.test(before) && /^[0-9A-Za-z#;=]/.test(next);\n case 'comment':\n return (\n // A bogus comment opened by `</` or `<!` is an end tag or a doctype, CDATA section or comment with a letter,\n // `[` or `-` after it, and nothing with `>` right after `</`.\n (before.endsWith('</') && /^[A-Za-z>]/.test(next)) ||\n (before.endsWith('<!') && /^[A-Za-z[-]/.test(next)) ||\n (before.endsWith('-') && next.startsWith('-')) ||\n (before.endsWith('--') && /^[!>]/.test(next)) ||\n (before.endsWith('--!') && next.startsWith('>'))\n );\n case 'style':\n return spansBoundary(STYLE_SEQUENCES, before, next) || codeGlues(context, before, next);\n case 'script':\n case 'json':\n return (\n spansBoundary(context.escapable ? SCRIPT_SEQUENCES : PLAIN_SCRIPT_SEQUENCES, before, next) ||\n codeGlues(context, before, next)\n );\n default: {\n const _unhandled: never = context;\n throw new Error(`Unhandled context at a boundary: ${JSON.stringify(_unhandled)}`);\n }\n }\n}\n\n/**\n * Whether `next`, written after the template text `before` in JavaScript, JSON or CSS text, would be read together\n * with it by that language (not by the HTML tokenizer): `*` and `/` ending a block comment, or a backslash escaping\n * the next character of a string. The HTML structure cannot show these, so an empty value warns here too.\n */\nfunction codeGlues(context: InsertionContext, before: string, next: string): boolean {\n if (next === '' || (context.kind !== 'style' && context.kind !== 'script' && context.kind !== 'json')) return false;\n if (!isCodeComment(context)) {\n // (A template literal's `${` cannot form: `$` right before a placeholder's `{{` would already be one.)\n return ESCAPING_BACKSLASH.test(before);\n }\n const block = context.kind === 'style' || context.js.kind === 'block-comment';\n return block && before.endsWith('*') && next.startsWith('/');\n}\n\n/** Whether `pattern` matches `before` followed by `next` across the boundary between them, but in neither alone. */\nfunction spansBoundary(pattern: RegExp, before: string, next: string): boolean {\n // The longest sequence, `</script` and a space, has 9 characters.\n const tail = before.slice(-8);\n const window = tail + next.slice(0, 8);\n return [...window.matchAll(pattern)].some((m) => m.index < tail.length && m.index + m[0].length > tail.length);\n}\n\n/** `ch` written as an escape sequence of a JavaScript, JSON or CSS string or template literal. */\nfunction codeEscape(context: CodeContext, ch: string): string {\n const hex = ch.charCodeAt(0).toString(16);\n return CODE_ESCAPES[context.kind](hex);\n}\n\n/** A character code (in hex) as an escape sequence of a CSS string, a JSON string or a JavaScript literal. */\nconst CODE_ESCAPES: Readonly<Record<CodeContext['kind'], (hex: string) => string>> = {\n style: (hex) => `\\\\${hex} `,\n json: (hex) => `\\\\u${hex.padStart(4, '0')}`,\n script: (hex) => `\\\\u{${hex}}`,\n};\n\n/** Describe an insertion context for a diagnostic. */\nfunction describeContext(site: PlaceholderSite): string {\n const { context } = site;\n if (site.delimiters === 'split' && context.kind !== 'markup') return 'where its delimiters are read apart from it';\n if (context.kind === 'text') return 'in text';\n if (context.kind === 'attribute')\n return context.quote === '' ? 'in an unquoted attribute value' : 'in an attribute value';\n if (context.kind === 'comment') return 'in a comment';\n if (context.kind === 'script') {\n const { js } = context;\n return `in a script (${js.kind === 'unparsable' ? `unparsable: ${js.reason}` : `JavaScript ${js.kind}`})`;\n }\n if (context.kind === 'json') return `in a JSON script (${context.js.kind})`;\n if (context.kind === 'style') return `in a style element (CSS ${context.css.kind})`;\n if (context.kind === 'raw-text') return `in the raw text of a \"${context.element}\" element`;\n return 'inside a tag or doctype, or where the HTML parser drops it';\n}\n\nfunction unsupportedSite(\n placeholder: Placeholder,\n entry: { readonly occurrence: Found; readonly site: PlaceholderSite },\n owner: string,\n document: string,\n): Diagnostic {\n const { line, column } = lineAndColumn(document, entry.occurrence.start);\n const what =\n placeholder.value.kind === 'markup'\n ? 'is not where the HTML parser reads it as elements of the page, so the browser will not see the inserted story data'\n : 'is in a place twee-ts cannot escape a value for, so the value may be changed or break the page';\n return {\n level: placeholder.value.kind === 'markup' ? 'error' : 'warning',\n message:\n `${owner}: the placeholder ${placeholder.token} at line ${line}, column ${column} is ` +\n `${describeContext(entry.site)}; it ${what}. It was replaced as Tweego replaces it.`,\n };\n}\n\nfunction lineAndColumn(text: string, offset: number): { line: number; column: number } {\n const before = text.slice(0, offset);\n const lineStart = before.lastIndexOf('\\n') + 1;\n return { line: before.split('\\n').length, column: offset - lineStart + 1 };\n}\n\n/** The warning about where the head content went, or none when it went before the closing head tag. */\nfunction headDiagnostics(placement: HeadPlacement | undefined, owner: string, document: string): Diagnostic[] {\n if (placement === undefined) {\n return [\n {\n level: 'warning',\n message: `${owner} has no place in its head for the modules and head file; they were not injected.`,\n },\n ];\n }\n if (placement.how === 'end-tag') return [];\n const { line, column } = lineAndColumn(document, placement.offset);\n return [\n {\n level: 'warning',\n message:\n `${owner} has no closing head tag that ends its head; the modules and head file were injected ` +\n `where the head ends, at line ${line}, column ${column}.`,\n },\n ];\n}\n\n/** Apply non-overlapping edits to `text`; an insertion goes before a replacement that starts at the same offset. */\nfunction applyEdits(text: string, edits: readonly Edit[]): string {\n const sorted = [...edits].sort((a, b) => a.start - b.start || a.end - a.start - (b.end - b.start));\n let output = '';\n let at = 0;\n for (const edit of sorted) {\n output += text.slice(at, edit.start) + edit.text;\n at = edit.end;\n }\n return output + text.slice(at);\n}\n","/**\n * Checks at the HTML output boundary: story text that HTML cannot carry, and code that the script and style\n * escapers change.\n *\n * HTML carries any text except: U+0000 NULL, which the parser drops from text and turns into U+FFFD elsewhere; lone\n * surrogates, which UTF-8 cannot encode (they are written as U+FFFD); and a carriage return in script or style\n * text, which the parser turns into a line feed (in text and attribute values it is written as `&#13;`, which keeps\n * it). Tags are written space-separated, so a tag holding white space (as Twee splits tags) reads back as several\n * tags.\n */\nimport type { Diagnostic, ReadonlyPassage, ReadonlyStory } from './types.js';\nimport { javaScriptContexts, cssContexts } from './code-context.js';\nimport type { JavaScriptContext } from './code-context.js';\nimport { scriptEscapeSites, styleEscapeSites } from './escape.js';\nimport type { EscapeSite } from './escape.js';\nimport { isTweeTag, splitTweeFields } from './twee-syntax.js';\n\n/** Matches a code point HTML cannot carry: U+0000 or a lone surrogate. */\nconst UNREPRESENTABLE = /\\u0000|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/;\n\n/** An error when `text` (named `what` in the message) holds a code point HTML cannot carry, else `undefined`. */\nfunction unrepresentableTextDiagnostic(what: string, text: string): Diagnostic | undefined {\n const match = UNREPRESENTABLE.exec(text);\n if (match === null) return undefined;\n const codePoint = `U+${match[0].charCodeAt(0).toString(16).toUpperCase().padStart(4, '0')}`;\n return {\n level: 'error',\n message:\n `${what} contains ${codePoint}, which HTML cannot carry: ` +\n 'the browser drops it or reads it as U+FFFD. Remove it.',\n };\n}\n\n/**\n * Add to `diagnostics` the error for `text` (named `what`) when it holds a code point HTML cannot carry (see\n * `unrepresentableTextDiagnostic()`): for text the HTML output inserts besides the story data, such as the head\n * file, a module or a story format's template and components.\n */\nexport function checkInsertedText(diagnostics: Diagnostic[] | undefined, what: string, text: string): void {\n const diagnostic = unrepresentableTextDiagnostic(what, text);\n if (diagnostic !== undefined) diagnostics?.push(diagnostic);\n}\n\n/** A list of diagnostics and a function that adds the error for text HTML cannot carry (see `checkInsertedText()`). */\nfunction textChecker(): { readonly diagnostics: Diagnostic[]; readonly check: (what: string, text: string) => void } {\n const diagnostics: Diagnostic[] = [];\n return {\n diagnostics,\n check(what, text) {\n checkInsertedText(diagnostics, what, text);\n },\n };\n}\n\n/**\n * Errors for the text of `story` and of the passages it writes (`passages`) that HTML cannot carry: names, tags,\n * passage text, the layout metadata the output mode writes (`layout`: Twine 2 writes `position` and `size`, Twine 1\n * only `position`) and the story's own metadata.\n */\nexport function unrepresentableTextDiagnostics(\n story: ReadonlyStory,\n passages: readonly ReadonlyPassage[],\n layout: readonly ('position' | 'size')[],\n): Diagnostic[] {\n const { diagnostics, check } = textChecker();\n check('The story name', story.name);\n check('The story tags', story.twine2.tags);\n for (const [tag, color] of story.twine2.tagColors) {\n check(`The color of tag \"${tag}\"`, `${tag}${color}`);\n }\n for (const p of passages) {\n check(`The name of passage \"${p.name}\"`, p.name);\n check(`The text of passage \"${p.name}\"`, p.text);\n for (const field of layout) {\n const value = p.metadata?.[field];\n if (typeof value === 'string') check(`The ${field} of passage \"${p.name}\"`, value);\n }\n for (const tag of p.tags) {\n check(`The tag \"${tag}\" of passage \"${p.name}\"`, tag);\n const fields = splitTweeFields(tag);\n if (fields.length !== 1 || fields[0] !== tag) {\n diagnostics.push({\n level: 'error',\n message:\n `The tag ${JSON.stringify(tag)} of passage \"${p.name}\" is empty or contains white space; ` +\n 'tags are written space-separated, so it would not read back as this tag.',\n });\n }\n }\n }\n return diagnostics;\n}\n\n/**\n * Errors for the Twine 2 story fields (`format`, `format-version` and `options` of `tw-storydata`) that HTML cannot\n * carry. Only the options that are on are written, space-separated, so an active option that is empty or holds white\n * space (as Twee splits tags) would read back as other options. Options that are off are not written and not checked.\n */\nexport function twine2StoryFieldDiagnostics(story: ReadonlyStory): Diagnostic[] {\n const { diagnostics, check } = textChecker();\n check('The story format name', story.twine2.format);\n check('The story format version', story.twine2.formatVersion);\n for (const [option, on] of story.twine2.options) {\n if (!on) continue;\n check(`The story option \"${option}\"`, option);\n if (!isTweeTag(option)) {\n diagnostics.push({\n level: 'error',\n message:\n `The story option ${JSON.stringify(option)} is empty or contains white space; ` +\n 'options are written space-separated, so it would not read back as this option.',\n });\n }\n }\n return diagnostics;\n}\n\n/** The text of a script or style element, made of parts that each came from somewhere. */\nexport interface CodeText {\n readonly text: string;\n /**\n * Where each part starts in `text`, in order, and what names it in diagnostics (such as\n * `script passage \"Story JavaScript\"` or `module \"lib.js\"`).\n */\n readonly parts: readonly [CodePart, ...CodePart[]];\n}\n\n/** A part of the text of a script or style element. */\nexport interface CodePart {\n readonly label: string;\n readonly start: number;\n}\n\n/**\n * Warnings for code written into a `script` (JavaScript) or `style` (CSS) element: a carriage return, which the\n * HTML parser turns into a line feed, and each `</script`, `</style` or `<!--` that the escaper writes with a\n * backslash (`scriptContentEscape()`, `styleContentEscape()`) where the backslash changes the code: outside a\n * string, comment or regular expression literal, in a tagged template, or in a `u` or `v` regular expression (for\n * `<\\!--`). Where it does not change the code, decompiling still returns the escaped text.\n */\nexport function codeEscapeDiagnostics(kind: 'script' | 'style', code: CodeText): Diagnostic[] {\n const { text, parts } = code;\n // Line starts are found once; each warning then costs two binary searches rather than a scan of the text.\n const lineStarts = [0];\n for (let i = text.indexOf('\\n'); i !== -1; i = text.indexOf('\\n', i + 1)) lineStarts.push(i + 1);\n const lastAtOrBefore = (starts: readonly number[], offset: number): number => {\n let low = 0;\n let high = starts.length - 1;\n while (low < high) {\n const mid = (low + high + 1) >> 1;\n if ((starts[mid] ?? 0) <= offset) low = mid;\n else high = mid - 1;\n }\n return low;\n };\n const partStarts = parts.map((p) => p.start);\n const where = (offset: number, what: string): string => {\n const part = parts[lastAtOrBefore(partStarts, offset)] ?? parts[0];\n // Lines are counted from the start of the part, as the text before it is not that part's.\n const line = lastAtOrBefore(lineStarts, offset) - lastAtOrBefore(lineStarts, part.start) + 1;\n return `The ${part.label} has ${what} at line ${line}`;\n };\n const diagnostics: Diagnostic[] = [];\n // One warning for the first carriage return of each part.\n const carriageReturns = parts.flatMap((part, i) => {\n const offset = text.slice(part.start, parts[i + 1]?.start ?? text.length).indexOf('\\r');\n return offset === -1 ? [] : [part.start + offset];\n });\n for (const offset of carriageReturns) {\n diagnostics.push({\n level: 'warning',\n message:\n where(offset, 'a carriage return') + `, which the HTML parser reads as a line feed in a ${kind} element.`,\n });\n }\n for (const site of changingEscapes(kind, text)) {\n diagnostics.push({\n level: 'warning',\n message:\n where(site.offset, JSON.stringify(site.sequence)) +\n ' outside a string, comment or regular expression literal; it is written with a backslash after the \"<\" ' +\n `so that the HTML parser does not end the ${kind} element there, which changes the code.`,\n });\n }\n return diagnostics;\n}\n\n/** The escape sites in `text` where the inserted backslash changes the code. */\nfunction changingEscapes(kind: 'script' | 'style', text: string): EscapeSite[] {\n const sites = kind === 'script' ? scriptEscapeSites(text) : styleEscapeSites(text);\n if (sites.length === 0) return [];\n const ranges = sites.map((site) => ({ start: site.offset, end: site.offset + site.sequence.length, site }));\n if (kind === 'style') {\n return cssContexts(text, ranges).flatMap(({ range, context }) => (context.kind === 'code' ? [range.site] : []));\n }\n return javaScriptContexts(text, ranges).flatMap(({ range, context }) =>\n escapeChangesCode(range.site, context) ? [range.site] : [],\n );\n}\n\n/** Whether writing a backslash after the `<` of `site`, in JavaScript `context`, changes the code. */\nfunction escapeChangesCode(site: EscapeSite, context: JavaScriptContext): boolean {\n switch (context.kind) {\n case 'string':\n case 'block-comment':\n return false;\n case 'line-comment':\n // `<\\!--` no longer opens the HTML-like comment that `<!--` opened.\n return context.start === site.offset;\n case 'template':\n return context.tagged;\n case 'regexp':\n return site.sequence === '<!--' && /[uv]/.test(context.flags);\n case 'code':\n case 'unparsable':\n return true;\n default: {\n const _exhaustive: never = context;\n throw new Error(`Unhandled JavaScript context: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n","/**\n * The twee-ts version, read at runtime from the package's own package.json.\n *\n * The release workflow (semantic-release) writes the new version into the\n * published package.json only; git keeps the old one. Reading it at runtime\n * is the only way the CLI and `creator-version` report the published version.\n */\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isRecord } from './util.js';\n\nconst PACKAGE_NAME = '@rohal12/twee-ts';\n\n/** Walks up from `startDir` to the nearest package.json named @rohal12/twee-ts and returns its version. */\nexport function findPackageVersion(startDir: string): string | undefined {\n let dir = startDir;\n for (;;) {\n try {\n const pkg: unknown = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf-8'));\n if (isRecord(pkg) && pkg['name'] === PACKAGE_NAME && typeof pkg['version'] === 'string') return pkg['version'];\n } catch {\n // No readable package.json here; keep walking up.\n }\n const parent = dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\n/**\n * The version of the package this module belongs to. The folder is found from `import.meta.url` in every format\n * (the CJS build turns it into the module's own `__filename`): a bare `__dirname` would be a global in the ESM build,\n * which `node -e`, the REPL and shims for CommonJS code define (#447).\n */\nexport const VERSION: string = findPackageVersion(dirname(fileURLToPath(import.meta.url))) ?? '0.0.0';\n","/**\n * Twine 2 HTML and archive output.\n * Ported from storyout.go.\n */\nimport type {\n Diagnostic,\n OmittingTag,\n PassageOmission,\n ReadonlyStory,\n ReadonlyPassage,\n StoryFormatInfo,\n} from './types.js';\nimport { attrEscape, commentSanitize, htmlCommentSanitize, scriptContentEscape, styleContentEscape } from './escape.js';\nimport { passageToPassagedata, hasTag } from './passage.js';\nimport { readFormatSource } from './formats.js';\nimport { storyDataProbe } from './html-structure.js';\nimport { fillFormatTemplate } from './template.js';\nimport {\n checkInsertedText,\n codeEscapeDiagnostics,\n twine2StoryFieldDiagnostics,\n unrepresentableTextDiagnostics,\n} from './html-output-check.js';\nimport type { CodePart, CodeText } from './html-output-check.js';\nimport { ineffectiveImportDiagnostics } from './css-imports.js';\nimport { VERSION } from './version.js';\nimport { pushAll } from './util.js';\n\nconst CREATOR_NAME = 'Twee-ts';\n\nexport function toTwine2Archive(\n story: ReadonlyStory,\n startName: string,\n options?: { readonly sourceInfo?: boolean; readonly diagnostics?: Diagnostic[] },\n): string {\n if (options?.diagnostics) pushAll(options.diagnostics, twine2DataDiagnostics(story));\n return ifidComment(story) + getTwine2DataChunk(story, startName, options) + '\\n';\n}\n\n/**\n * Fill the Twine 2 format template: every `{{STORY_NAME}}` gets the story name, escaped for the place it is in, and\n * the first `{{STORY_DATA}}` in HTML text gets the story data (as Tweego does), after the IFID comment (or, where the\n * placeholder is in an element of the template's own, such as SugarCube 1's store area, with the IFID comment before\n * that element, since SugarCube 1 reads the story data as its first child node), and `head` goes before the closing\n * head tag (see `fillFormatTemplate()`). All three are found in the template before anything is inserted, so a story\n * name, passage text or head content holding a placeholder or a closing head tag stays literal.\n * `options.diagnostics` receives a warning when the format file is not valid UTF-8, any diagnostic about the\n * template, and an error for text that HTML cannot carry.\n */\nexport function toTwine2HTML(\n story: ReadonlyStory,\n format: StoryFormatInfo,\n startName: string,\n options?: { readonly sourceInfo?: boolean; readonly head?: string; readonly diagnostics?: Diagnostic[] },\n): string {\n const template = readFormatSource(format, options?.diagnostics);\n checkInsertedText(options?.diagnostics, `The story format \"${format.name}\" ${format.version}`, template);\n // Advertise the format this HTML was built with (as Tweego does), not whatever StoryData named.\n const built = { ...story, twine2: { ...story.twine2, format: format.name, formatVersion: format.version } };\n if (options?.diagnostics) pushAll(options.diagnostics, twine2DataDiagnostics(built));\n const filled = fillFormatTemplate({\n template,\n placeholders: [\n { token: '{{STORY_NAME}}', occurrences: 'all', value: { kind: 'text', text: story.name } },\n {\n token: '{{STORY_DATA}}',\n occurrences: 'first',\n value: {\n kind: 'markup',\n html: getTwine2DataChunk(built, startName, options),\n comment: ifidComment(built),\n probe: storyDataProbe(\n 'twine2',\n story.passages.some((p) => twine2PassageOmission(story, p) === undefined && /[^\\t\\n\\f\\r ]/.test(p.text)),\n ),\n },\n },\n ],\n head: options?.head,\n owner: `Story format \"${format.name}\" ${format.version}`,\n });\n pushAll(options?.diagnostics, filled.diagnostics);\n return filled.output;\n}\n\n/** Diagnostics for what the Twine 2 story data cannot carry. */\nfunction twine2DataDiagnostics(story: ReadonlyStory): Diagnostic[] {\n return [...twine2TagColors(story).diagnostics, ...twine2MarkupDiagnostics(story)];\n}\n\n/**\n * The diagnostics for what the Twine 2 story data cannot carry as HTML markup (HTML and archive output), beyond\n * those JSON output also gives (tag colors): text HTML cannot carry, tags and story options that would not read back,\n * script and style code the escapers change, and the `@import` rules the stylesheet as these outputs join it ignores\n * (JSON output joins it otherwise, and reports its own). Lint reports these too.\n */\nexport function twine2MarkupDiagnostics(story: ReadonlyStory): Diagnostic[] {\n const { scripts, stylesheets } = codePassages(story);\n return [\n ...twine2StoryFieldDiagnostics(story),\n ...unrepresentableTextDiagnostics(\n story,\n story.passages.filter((p) => !hasTag(p, 'Twine.private')),\n ['position', 'size'],\n ),\n ...codeEscapeDiagnostics('script', joinCode(scripts, 'script')),\n ...codeEscapeDiagnostics('style', joinCode(stylesheets, 'stylesheet')),\n ...stylesheetImportDiagnostics(stylesheets),\n ];\n}\n\n/** Warnings for `@import` rules that the joined story stylesheet puts after other rules. */\nfunction stylesheetImportDiagnostics(stylesheets: readonly ReadonlyPassage[]): Diagnostic[] {\n return ineffectiveImportDiagnostics(\n stylesheets.map((p) => ({ label: `Stylesheet passage \"${p.name}\"`, text: p.text })),\n joinCode(stylesheets, 'stylesheet'),\n );\n}\n\n/** The named tag colors of the Twine 2 HTML output specification. */\nconst NAMED_TAG_COLORS: ReadonlySet<string> = new Set(['gray', 'red', 'orange', 'yellow', 'green', 'blue', 'purple']);\n/** A CSS hex color: `#` and 3, 4, 6 or 8 hex digits. */\nconst HEX_TAG_COLOR = /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;\n\n/**\n * The tag colors the Twine 2 story data carries (`<tw-tag>` elements in HTML and archives, `tag-colors` in JSON),\n * in the story's order, as written: those whose color is one of the specification's named colors, in any ASCII case\n * (CSS color names ignore case, and the JSON specification's example writes `Green`), or a CSS hex color. Every other\n * color is left out, with a warning in `diagnostics`.\n */\nexport function twine2TagColors(story: ReadonlyStory): {\n readonly colors: readonly (readonly [tag: string, color: string])[];\n readonly diagnostics: readonly Diagnostic[];\n} {\n const colors: (readonly [string, string])[] = [];\n const diagnostics: Diagnostic[] = [];\n for (const [tag, color] of story.twine2.tagColors) {\n if (NAMED_TAG_COLORS.has(asciiLowerCase(color)) || HEX_TAG_COLOR.test(color)) {\n colors.push([tag, color]);\n continue;\n }\n diagnostics.push({\n level: 'warning',\n message:\n `The color ${JSON.stringify(color)} of tag ${JSON.stringify(tag)} is not a Twine 2 tag color, ` +\n 'so it is left out. Use gray, red, orange, yellow, green, blue or purple, or a hex color (#rgb, #rgba, ' +\n '#rrggbb or #rrggbbaa).',\n });\n }\n return { colors, diagnostics };\n}\n\nfunction asciiLowerCase(s: string): string {\n return s.replace(/[A-Z]/g, (c) => c.toLowerCase());\n}\n\nconst OMITTING_TAGS: readonly OmittingTag[] = ['Twine.private', 'script', 'stylesheet'];\n\n/**\n * Why Twine 2 output leaves a passage out of its `<tw-passagedata>` elements,\n * or `undefined` when the passage is emitted (and so can be the starting passage).\n */\nexport function twine2PassageOmission(story: ReadonlyStory, p: ReadonlyPassage): PassageOmission | undefined {\n if (p.name === 'StoryTitle' || p.name === 'StoryData') return { kind: 'special-name', name: p.name };\n const tag = OMITTING_TAGS.find((t) => hasTag(p, t));\n if (tag !== undefined) return { kind: 'tag', tag };\n // Drop empty StorySettings\n if (p.name === 'StorySettings' && story.twine1.settings.size === 0) return { kind: 'empty-story-settings' };\n return undefined;\n}\n\n/** The script and stylesheet passages that go into the story's script and style elements. */\nfunction codePassages(story: ReadonlyStory): { scripts: ReadonlyPassage[]; stylesheets: ReadonlyPassage[] } {\n const scripts: ReadonlyPassage[] = [];\n const stylesheets: ReadonlyPassage[] = [];\n for (const p of story.passages) {\n if (hasTag(p, 'Twine.private')) continue;\n if (hasTag(p, 'script')) scripts.push(p);\n else if (hasTag(p, 'stylesheet')) stylesheets.push(p);\n }\n return { scripts, stylesheets };\n}\n\n/**\n * `script` ended so that whatever follows it starts a new statement: on a line of its own (a trailing line comment\n * must not swallow the `;`), then an empty statement. JavaScript does not insert a semicolon before a following\n * `(`, `[`, `/`, `` ` `` or `+`, so literal concatenation would turn `a = {}` and `(function(){})()` into one call.\n */\nexport function terminateScript(script: string): string {\n return `${script}${script.endsWith('\\n') ? '' : '\\n'};\\n`;\n}\n\n/**\n * The text of the story's script or style element: the text of a single passage, or the passages joined, each after\n * a comment naming it (as Tweego joins them), with where each passage's text starts.\n */\nfunction joinCode(passages: readonly ReadonlyPassage[], kind: 'script' | 'stylesheet'): CodeText {\n const label = (p: ReadonlyPassage): string => `${kind} passage \"${p.name}\"`;\n const [first, ...rest] = passages;\n if (first === undefined) return { text: '', parts: [{ label: `${kind} element`, start: 0 }] };\n if (rest.length === 0) return { text: first.text, parts: [{ label: label(first), start: 0 }] };\n const header = (p: ReadonlyPassage, n: number): string =>\n `/* twine-user-${kind} #${n}: \"${commentSanitize(p.name)}\" */\\n`;\n let text = header(first, 1);\n const parts: [CodePart, ...CodePart[]] = [{ label: label(first), start: text.length }];\n text += first.text;\n rest.forEach((p, i) => {\n text = kind === 'script' ? terminateScript(text) : text.endsWith('\\n') ? text : `${text}\\n`;\n text += header(p, i + 2);\n parts.push({ label: label(p), start: text.length });\n text += p.text;\n });\n return { text, parts };\n}\n\n/** The IFID comment that precedes the story data, as Tweego writes it (the Treaty of Babel's HTML IFID). */\nfunction ifidComment(story: ReadonlyStory): string {\n return `<!-- UUID://${htmlCommentSanitize(story.ifid)}// -->`;\n}\n\n/** The `tw-storydata` element. */\nfunction getTwine2DataChunk(\n story: ReadonlyStory,\n startName: string,\n options?: { readonly sourceInfo?: boolean },\n): string {\n const parts: string[] = [];\n let startID = '';\n let pid = 0;\n\n const { scripts, stylesheets } = codePassages(story);\n const styleContent = joinCode(stylesheets, 'stylesheet').text;\n parts.push(\n `<style role=\"stylesheet\" id=\"twine-user-stylesheet\" type=\"text/twine-css\">${styleContentEscape(styleContent)}</style>`,\n );\n const scriptContent = joinCode(scripts, 'script').text;\n parts.push(\n `<script role=\"script\" id=\"twine-user-script\" type=\"text/twine-javascript\">${scriptContentEscape(scriptContent)}</script>`,\n );\n\n for (const [tag, color] of twine2TagColors(story).colors) {\n parts.push(`<tw-tag name=\"${attrEscape(tag)}\" color=\"${attrEscape(color)}\"></tw-tag>`);\n }\n\n // Normal passage elements\n pid = 1;\n for (const p of story.passages) {\n if (twine2PassageOmission(story, p) !== undefined) continue;\n\n parts.push(passageToPassagedata(p, pid, options));\n if (startName === p.name) {\n startID = String(pid);\n }\n pid++;\n }\n\n // Build options string\n const opts: string[] = [];\n for (const [opt, val] of story.twine2.options) {\n if (val) opts.push(opt);\n }\n const optionsStr = opts.join(' ');\n\n // Wrap in tw-storydata\n const zoom = String(story.twine2.zoom);\n\n const wrapper =\n `<tw-storydata name=\"${attrEscape(story.name)}\" startnode=\"${attrEscape(startID)}\" ` +\n `creator=\"${attrEscape(CREATOR_NAME)}\" creator-version=\"${attrEscape(VERSION)}\" ` +\n `ifid=\"${attrEscape(story.ifid)}\" zoom=\"${attrEscape(zoom)}\" ` +\n `format=\"${attrEscape(story.twine2.format)}\" ` +\n `format-version=\"${attrEscape(story.twine2.formatVersion)}\" ` +\n `options=\"${attrEscape(optionsStr)}\" tags=\"${attrEscape(story.twine2.tags)}\" hidden>`;\n\n return wrapper + parts.join('') + '</tw-storydata>';\n}\n","/**\n * The time a build is stamped with: the Twine 1 `\"TIME\"` placeholder and the `created` attribute of Twine 1\n * tiddlers. One build reads it once, so every stamp in one output agrees. `SOURCE_DATE_EPOCH`, the variable the\n * Reproducible Builds project defines (https://reproducible-builds.org/specs/source-date-epoch/), sets it, so\n * that building the same sources twice gives the same bytes.\n */\nimport { TweeTsError } from './errors.js';\n\n/**\n * The last second Twine 1's time stamp can hold, 9999-12-31T23:59:59Z: its `created` attribute has four digits\n * for the year (YYYYMMDDHHMM).\n */\nconst LAST_SECOND = 253402300799;\n\n/**\n * The build time: `SOURCE_DATE_EPOCH` (whole seconds since 1970, UTC) when it is set and not empty, else now.\n * Only the output that is stamped (Twine 1) reads it. A value that is not such a number, or is after the year\n * 9999, is a TweeTsError (`INVALID_OPTIONS`), as the specification asks: a build must not silently use another\n * time than the one asked for.\n */\nexport function buildTime(env: Readonly<Record<string, string | undefined>> = process.env): Date {\n const epoch = env['SOURCE_DATE_EPOCH'];\n if (epoch === undefined || epoch === '') return new Date();\n const seconds = /^[0-9]+$/.test(epoch) ? Number(epoch) : Number.NaN;\n if (!(seconds <= LAST_SECOND)) {\n throw new TweeTsError(\n `SOURCE_DATE_EPOCH must be a whole number of seconds since 1970-01-01T00:00:00Z, at most ${LAST_SECOND} (the end of the year 9999), not ${JSON.stringify(epoch)}.`,\n [],\n { code: 'INVALID_OPTIONS' },\n );\n }\n return new Date(seconds * 1000);\n}\n","/**\n * Twine 1 HTML and archive output.\n * Ported from storyout.go.\n */\nimport { join, dirname } from 'node:path';\nimport type { Diagnostic, PassageOmission, ReadonlyPassage, ReadonlyStory, StoryFormatInfo } from './types.js';\nimport { pushAll, readUTF8 } from './util.js';\nimport { hasTag, isObfuscatable, passageToTiddler } from './passage.js';\nimport { readFormatComponent, readFormatSource } from './formats.js';\nimport { DEFAULT_TWINE1_FOOTER, storyDataProbe, twine1ArchiveStoreArea } from './html-structure.js';\nimport { fillFormatTemplate } from './template.js';\nimport type { Placeholder } from './template.js';\nimport { htmlCommentSanitize, rot13 } from './escape.js';\nimport { checkInsertedText, unrepresentableTextDiagnostics } from './html-output-check.js';\nimport { isRot13Obfuscated } from './twine1-obfuscation.js';\nimport { VERSION } from './version.js';\nimport { TweeTsError } from './errors.js';\nimport { buildTime } from './build-time.js';\nimport { failureOfRead } from './input-policy.js';\n\nconst CREATOR_NAME = 'twee-ts';\n\nexport function toTwine1Archive(\n story: ReadonlyStory,\n _startName: string,\n options?: { readonly diagnostics?: Diagnostic[]; readonly time?: Date },\n): string {\n const { data, count, diagnostics } = getTwine1PassageChunk(story, options?.time ?? buildTime());\n pushAll(options?.diagnostics, diagnostics);\n return twine1ArchiveStoreArea(count, data);\n}\n\n/**\n * Fill the Twine 1 format template. The format's components are inserted first, one after another, as Tweego and\n * Twine 1 do. Then the story placeholders (`\"VERSION\"`, `\"TIME\"`, `\"START_AT\"`, `\"STORY_SIZE\"`, `\"STORY\"`), the IFID\n * comment (before the store area element) and `head` (at the end of the head) are placed by the template's HTML\n * structure (see `fillFormatTemplate()`), so a start passage name or story data holding a placeholder or a closing\n * head tag stays literal. `options.diagnostics` receives a warning for each format file that is not valid UTF-8, any\n * diagnostic about the template, and an error for text that HTML cannot carry.\n */\nexport function toTwine1HTML(\n story: ReadonlyStory,\n format: StoryFormatInfo,\n startName: string,\n options?: { readonly head?: string; readonly diagnostics?: Diagnostic[]; readonly time?: Date },\n): string {\n const time = options?.time ?? buildTime();\n const formatDir = dirname(format.filename);\n const parentDir = dirname(formatDir);\n const diagnostics = options?.diagnostics;\n let template = readFormatSource(format, diagnostics);\n checkInsertedText(diagnostics, `The story format \"${format.name}\"`, template);\n const chunk = getTwine1PassageChunk(story, time);\n const { data, count } = chunk;\n pushAll(diagnostics, chunk.diagnostics);\n\n // Component replacements\n // The format's own components come from the verified download when it is one, else from its folder.\n const own = (file: string) => (): string | undefined => readFormatComponent(format, file, diagnostics);\n template = tryReplaceComponent(\n template,\n '\"USER_LIB\"',\n join(formatDir, 'userlib.js'),\n false,\n diagnostics,\n own('userlib.js'),\n );\n template = tryReplaceComponent(template, '\"ENGINE\"', join(parentDir, 'engine.js'), true, diagnostics);\n template = tryReplaceComponent(\n template,\n '\"SUGARCANE\"',\n join(formatDir, 'code.js'),\n true,\n diagnostics,\n own('code.js'),\n );\n template = tryReplaceComponent(template, '\"JONAH\"', join(formatDir, 'code.js'), true, diagnostics, own('code.js'));\n\n if (story.twine1.settings.get('jquery') === 'on') {\n template = tryReplaceComponent(template, '\"JQUERY\"', join(parentDir, 'jquery.js'), true, diagnostics);\n }\n if (story.twine1.settings.get('modernizr') === 'on') {\n template = tryReplaceComponent(template, '\"MODERNIZR\"', join(parentDir, 'modernizr.js'), true, diagnostics);\n }\n\n // A pre-1.4 format has no \"STORY\" placeholder: the story data and a footer go after the template.\n const isPre14 = !template.includes('\"STORY\"');\n const footer = isPre14 ? readFooter(formatDir, diagnostics) : '';\n\n // Story instance replacements. \"START_AT\" is a JavaScript string literal (`testplay = \"START_AT\";` in Sugarcane),\n // and \"STORY_SIZE\" a quoted attribute value (`data-size=\"STORY_SIZE\"`); their quotes are kept as theirs.\n const displayStart = startName === 'Start' ? '' : startName;\n const probe = storyDataProbe('twine1', chunk.hasText);\n const storyData: readonly Placeholder[] = isPre14\n ? []\n : [{ token: '\"STORY\"', occurrences: 'first', value: { kind: 'markup', html: data, probe } }];\n const filled = fillFormatTemplate({\n template,\n placeholders: [\n {\n token: '\"VERSION\"',\n occurrences: 'first',\n value: { kind: 'text', text: `Compiled with ${CREATOR_NAME}, ${VERSION}` },\n },\n { token: '\"TIME\"', occurrences: 'first', value: { kind: 'text', text: `Built on ${time.toUTCString()}` } },\n { token: '\"START_AT\"', occurrences: 'first', value: { kind: 'quoted', text: displayStart } },\n { token: '\"STORY_SIZE\"', occurrences: 'first', value: { kind: 'quoted', text: String(count) } },\n ...storyData,\n ],\n // The IFID comment and the head content may go into the footer, if the template has no place for them.\n tail: isPre14 ? { data, footer, probe } : undefined,\n head: options?.head,\n beforeStoreArea: story.ifid ? `<!-- UUID://${htmlCommentSanitize(story.ifid)}// -->` : undefined,\n owner: `Story format \"${format.name}\"`,\n });\n pushAll(diagnostics, filled.diagnostics);\n return filled.output;\n}\n\n/**\n * The footer of a pre-1.4 format, or the default one when the format has none (nothing at its path, or a dangling\n * link, as Tweego tells them). A footer that is there but can't be read is a TweeTsError (see `componentUnavailable()`).\n */\nfunction readFooter(formatDir: string, diagnostics: Diagnostic[] | undefined): string {\n const path = join(formatDir, 'footer.html');\n let footer: string;\n try {\n footer = readUTF8(path, diagnostics);\n } catch (e) {\n if (isAbsent(path, e)) return DEFAULT_TWINE1_FOOTER;\n throw componentUnavailable('Format component cannot be read', path, e);\n }\n checkInsertedText(diagnostics, `The story format component \"${path}\"`, footer);\n return footer;\n}\n\n/**\n * Whether reading an optional format component failed because nothing is at its path: only then does the format\n * do without it, as in Tweego (`os.IsNotExist`, which a dangling link also gives). A folder, a file it may not read\n * or bytes it can't decode are errors, so the output never silently lacks a part of the format.\n */\nfunction isAbsent(path: string, e: unknown): boolean {\n const failure = failureOfRead(path, e);\n return failure === 'missing' || failure === 'dangling-link';\n}\n\n/** The TweeTsError for a format component that can't be used. */\nfunction componentUnavailable(what: string, path: string, e: unknown): TweeTsError {\n return new TweeTsError(`${what}: ${path}: ${e instanceof Error ? e.message : String(e)}`, [], {\n code: 'FORMAT_UNAVAILABLE',\n cause: e,\n });\n}\n\n/**\n * Why Twine 1 output leaves a passage out of its tiddlers, or `undefined` when the passage is emitted.\n */\nexport function twine1PassageOmission(p: ReadonlyPassage): PassageOmission | undefined {\n return hasTag(p, 'Twine.private') ? { kind: 'tag', tag: 'Twine.private' } : undefined;\n}\n\n/**\n * The tiddlers of the passages Twine 1 output writes, their count, and the diagnostics about them.\n *\n * The tiddlers are ROT13-obfuscated when the StorySettings tiddler that is written says `obfuscate:rot13`, since\n * that is what tells the engine to decode them; a StorySettings passage left out (`Twine.private`) cannot, so then\n * nothing is obfuscated, with a warning. Obfuscation that would turn a name into `StorySettings` or a tag into\n * `Twine.image` is an error: the engine reads such a tiddler as the settings, or as an image it doesn't decode.\n */\nfunction getTwine1PassageChunk(\n story: ReadonlyStory,\n time: Date,\n): {\n data: string;\n count: number;\n hasText: boolean;\n diagnostics: Diagnostic[];\n} {\n const written = story.passages.filter((p) => twine1PassageOmission(p) === undefined);\n const obfuscateRot13 = isRot13Obfuscated(written);\n const diagnostics = unrepresentableTextDiagnostics(story, written, ['position']);\n if (!obfuscateRot13 && story.twine1.settings.get('obfuscate') === 'rot13') {\n diagnostics.push({\n level: 'warning',\n message:\n 'The \"StorySettings\" passage says \"obfuscate:rot13\", but it is not written to the output (it is tagged ' +\n '\"Twine.private\"), so the story engine could not decode obfuscated passages; they are written unobfuscated.',\n });\n }\n if (obfuscateRot13) pushAll(diagnostics, obfuscationCollisions(written));\n const data = written.map((p, i) => passageToTiddler(p, i + 1, obfuscateRot13, time)).join('');\n const hasText = written.some((p) => /[^\\t\\n\\f\\r ]/.test(p.text));\n return { data, count: written.length, hasText, diagnostics };\n}\n\n/** Errors for passages whose ROT13-encoded name or tag is one the Twine 1 engine reads unencoded. */\nfunction obfuscationCollisions(passages: readonly ReadonlyPassage[]): Diagnostic[] {\n return passages.filter(isObfuscatable).flatMap((p): Diagnostic[] => {\n const reserved = [rot13(p.name) === 'StorySettings' ? `its name to \"StorySettings\"` : undefined]\n .concat(p.tags.map((tag) => (rot13(tag) === 'Twine.image' ? `its tag \"${tag}\" to \"Twine.image\"` : undefined)))\n .filter((what) => what !== undefined);\n return reserved.map((what) => ({\n level: 'error',\n message:\n `Passage \"${p.name}\" cannot be obfuscated: ROT13 turns ${what}, which the Twine 1 engine reads ` +\n 'unencoded, so it would not decode the passage. Rename it, or turn off \"obfuscate:rot13\".',\n }));\n });\n}\n\nfunction tryReplaceComponent(\n template: string,\n placeholder: string,\n componentPath: string,\n required: boolean,\n diagnostics: Diagnostic[] | undefined,\n downloaded?: () => string | undefined,\n): string {\n if (!template.includes(placeholder)) return template;\n try {\n const content = downloaded?.() ?? readUTF8(componentPath, diagnostics);\n checkInsertedText(diagnostics, `The story format component \"${componentPath}\"`, content);\n return template.replace(placeholder, () => content);\n } catch (e) {\n if (required) throw componentUnavailable('Required format component not found', componentPath, e);\n // An optional component is left out only when it is absent (see isAbsent()).\n if (isAbsent(componentPath, e)) return template;\n throw componentUnavailable('Format component cannot be read', componentPath, e);\n }\n}\n","/**\n * Twee 3/1 decompile output.\n * Ported from storyout.go.\n */\nimport type { Diagnostic, ReadonlyStory, ReadonlyPassage, OutputMode, Passage } from './types.js';\nimport { metadataForOutput, passageToTwee } from './passage.js';\nimport { decodeStoryData, marshalStoryData } from './story.js';\nimport { parseTwee } from './parser.js';\nimport { ownRecord } from './json-decode.js';\nimport { isHeaderLine, sourceLines, splitTweeFields, trimTweeSpace } from './twee-syntax.js';\nimport { pushAll } from './util.js';\n\n/**\n * Serialize the story as Twee. The StoryData passage is written from the story model rather than\n * from its loaded text, so changes made after loading (a start passage override, test mode) are kept.\n * Tweego writes the loaded text; its own normalization makes the two the same for an unchanged story.\n *\n * Every passage is checked by reading what is written for it back with the Twee reader (`parseTwee`, with its\n * default options), so the check and the reader cannot disagree. `diagnostics` receives a warning for each\n * passage that does not read back the same, saying what changes. The white space around passage text is not\n * compared: Twee readers trim it (Tweego always does). Twee 1 has no metadata, so it is left out, with one\n * warning. Tweego writes the same Twee without warnings.\n *\n * `addStoryData`: add a StoryData passage when the story has none, so that StoryData fields the\n * compile options set are recorded. Default: false.\n */\nexport function toTwee(\n story: ReadonlyStory,\n outMode: OutputMode,\n options: { readonly addStoryData?: boolean; readonly diagnostics?: Diagnostic[] } = {},\n): string {\n const passages = withEffectiveStoryData(story, options.addStoryData ?? false);\n const written = passages.map((p) => tweeRoundTrip(p, outMode));\n pushAll(\n options.diagnostics,\n written.flatMap(({ diagnostics }) => diagnostics),\n );\n if (outMode === 'twee1' && options.diagnostics) pushAll(options.diagnostics, twee1MetadataWarning(passages));\n return written.map(({ twee }) => twee).join('');\n}\n\nfunction withEffectiveStoryData(story: ReadonlyStory, addStoryData: boolean): readonly ReadonlyPassage[] {\n const storyData: ReadonlyPassage = { name: 'StoryData', tags: [], text: marshalStoryData(story) };\n const index = story.passages.findIndex((p) => p.name === 'StoryData');\n if (index !== -1) {\n return story.passages.map((p, i) => (i === index && isStoryDataJSON(p.text) ? { ...p, text: storyData.text } : p));\n }\n if (!addStoryData) return story.passages;\n // Place it where Twine and the HTML decompiler do: first, or right after a leading StoryTitle.\n const at = story.passages[0]?.name === 'StoryTitle' ? 1 : 0;\n return [...story.passages.slice(0, at), storyData, ...story.passages.slice(at)];\n}\n\n/**\n * Whether the text loaded as StoryData. Text that did not is kept as written, for the author to fix; the story\n * has none of its metadata, and reading the text back gives none again.\n */\nfunction isStoryDataJSON(text: string): boolean {\n return decodeStoryData(text).ok;\n}\n\nfunction twee1MetadataWarning(passages: readonly ReadonlyPassage[]): Diagnostic[] {\n const count = passages.filter((p) => metadataForOutput(p.metadata) !== undefined).length;\n if (count === 0) return [];\n return [\n {\n level: 'warning',\n message: `Twee 1 has no passage metadata, so the metadata (such as \"position\") of ${count} ${count === 1 ? 'passage is' : 'passages are'} left out.`,\n },\n ];\n}\n\n/** A passage as it is written to Twee, and the warnings about what will not read back the same. */\ninterface WrittenPassage {\n readonly twee: string;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** The Twee written for a passage, and the passages the Twee reader reads from it (none on a reader error). */\ninterface ReadBack {\n readonly twee: string;\n readonly passages: readonly Passage[];\n}\n\nfunction readBack(p: ReadonlyPassage, outMode: OutputMode): ReadBack {\n const twee = passageToTwee(p, outMode);\n const { passages, diagnostics } = parseTwee(twee);\n return { twee, passages: diagnostics.some((d) => d.level === 'error') ? [] : passages };\n}\n\nfunction sameStrings(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((s, i) => s === b[i]);\n}\n\n/** The metadata as written: its entries with a value, in order (see `metadataForOutput`). */\nfunction metadataEntries(p: ReadonlyPassage): [string, string][] {\n return Object.entries(metadataForOutput(p.metadata) ?? {});\n}\n\nfunction sameEntries(a: readonly (readonly [string, string])[], b: readonly (readonly [string, string])[]): boolean {\n return sameStrings(\n a.map((entry) => JSON.stringify(entry)),\n b.map((entry) => JSON.stringify(entry)),\n );\n}\n\n/** Characters Twee 3 escapes in names and tags, and Twee 1 cannot write there at all. */\nconst TWEE1_UNWRITABLE = /[[\\]{}\\\\]/;\n\n/** Why a name may not read back as written; empty when nothing is known to be wrong with it. */\nfunction nameProblems(name: string, outMode: OutputMode): string[] {\n const trimmed = trimTweeSpace(name);\n return [\n ...(trimmed === '' ? ['its name is empty'] : []),\n ...(trimmed !== '' && trimmed !== name ? ['its name has leading or trailing whitespace, which Twee drops'] : []),\n ...(/[\\r\\n]/.test(name) ? ['its name has a line break, which ends a Twee passage header'] : []),\n ...(outMode === 'twee1' && TWEE1_UNWRITABLE.test(name)\n ? ['its name has \"[\", \"]\", \"{\", \"}\" or \"\\\\\", which Twee 1 cannot escape']\n : []),\n ];\n}\n\n/** Why tags may not read back as written; empty when nothing is known to be wrong with them. */\nfunction tagProblems(tags: readonly string[], outMode: OutputMode): string[] {\n // A tag reads back as itself only when it is one field: not empty, with no white space.\n const isOneField = (tag: string): boolean => sameStrings(splitTweeFields(tag), [tag]);\n return tags.flatMap((tag) => [\n ...(isOneField(tag)\n ? []\n : [`its tag ${JSON.stringify(tag)} is empty or has whitespace, which splits tags in Twee`]),\n ...(outMode === 'twee1' && TWEE1_UNWRITABLE.test(tag)\n ? [`its tag ${JSON.stringify(tag)} has \"[\", \"]\", \"{\", \"}\" or \"\\\\\", which Twee 1 cannot escape`]\n : []),\n ]);\n}\n\n/** `known` when it says anything, else `fallback`. */\nfunction orElse(known: readonly string[], fallback: string): readonly string[] {\n return known.length > 0 ? known : [fallback];\n}\n\n/**\n * The differences between a passage and what reading its Twee gives, as phrases for a warning. Whether there\n * are any is decided by comparing with what the reader gave; the phrases say why, where that is known.\n */\nfunction differences(p: ReadonlyPassage, { passages }: ReadBack, outMode: OutputMode): string[] {\n const headerLines = textHeaderLines(p.text);\n const problems = headerLines.length > 0 ? [describeHeaderLines(headerLines)] : [];\n const [back] = passages;\n if (back === undefined) {\n return [\n ...problems,\n ...orElse([...nameProblems(p.name, outMode), ...tagProblems(p.tags, outMode)], 'its header cannot be read back'),\n ];\n }\n // A name that reads back differently may have taken part of the header or text with it: nothing else is\n // worth comparing.\n if (back.name !== p.name) {\n return [\n ...problems,\n ...orElse(nameProblems(p.name, outMode), `its name reads back as ${JSON.stringify(back.name)}`),\n ];\n }\n if (!sameStrings(back.tags, p.tags)) {\n pushAll(problems, orElse(tagProblems(p.tags, outMode), `its tags read back as ${JSON.stringify(back.tags)}`));\n }\n if (outMode === 'twee3' && !sameEntries(metadataEntries(back), metadataEntries(p))) {\n problems.push(`its metadata reads back as ${JSON.stringify(ownRecord(metadataEntries(back)))}`);\n }\n // With the header read back as written and no text line read as a header, the Twee holds one passage, and\n // only a carriage return (read as a line break) can change its text.\n if (headerLines.length === 0 && back.text !== trimTweeSpace(p.text)) {\n problems.push('its text reads back differently (Twee reads a carriage return as a line break)');\n }\n return problems;\n}\n\n/** `p` with each text line that reads as a passage header indented by one space. */\nfunction withHeaderLinesIndented(p: ReadonlyPassage): ReadonlyPassage {\n const parts = p.text.split(/(\\r\\n|\\r|\\n)/);\n return { ...p, text: parts.map((part, i) => (i % 2 === 0 && isHeaderLine(part) ? ` ${part}` : part)).join('') };\n}\n\n/**\n * Write `p` as Twee, check that it reads back the same, and say what does not. Twee has no way to escape\n * passage text, so a text line that reads as a passage header (it starts with `::`, after any byte order\n * marks) cannot be written. In stylesheet and script passages such a line is indented by one space, which\n * keeps the CSS or JavaScript working (only a template literal or a string continued across lines would see\n * the space), and the warning says so; other passages' text is written as it is.\n */\nfunction tweeRoundTrip(p: ReadonlyPassage, outMode: OutputMode): WrittenPassage {\n const label = `Passage ${JSON.stringify(p.name)}`;\n const headerLines = textHeaderLines(p.text);\n const indent = headerLines.length > 0 && p.tags.some((tag) => tag === 'stylesheet' || tag === 'script');\n const written = indent ? withHeaderLinesIndented(p) : p;\n const back = readBack(written, outMode);\n // Indenting leaves no header lines, so `differences` below reports only what else changes.\n const notes: Diagnostic[] = indent\n ? [\n {\n level: 'warning',\n message: `${label}: ${describeHeaderLines(headerLines)}; ${headerLines.length === 1 ? 'it was' : 'they were'} written indented by one space.`,\n },\n ]\n : [];\n const problems = differences(written, back, outMode).map((problem): Diagnostic => ({\n level: 'warning',\n message: `${label} cannot be written as Twee that reads back the same: ${problem}.`,\n }));\n return { twee: back.twee, diagnostics: [...notes, ...problems] };\n}\n\n/** The numbers (from 1) of the lines of `text` that read as passage headers. */\nfunction textHeaderLines(text: string): number[] {\n return sourceLines(text).flatMap((line, i) => (isHeaderLine(line) ? [i + 1] : []));\n}\n\nfunction describeHeaderLines(lines: readonly number[]): string {\n const one = lines.length === 1;\n return `${one ? 'line' : 'lines'} ${lines.join(', ')} of its text start${one ? 's' : ''} with \"::\", which Twee reads as a passage header`;\n}\n","/**\n * Module/head injection into the head.\n * Ported from module.go + io.go:modifyHead(). The renderers inject the head content while filling the format\n * template (`fillFormatTemplate()`), so the end of the head is looked for in the template only, never in inserted\n * story data.\n */\nimport type { Diagnostic } from './types.js';\nimport { normalizedFileExt, mediaTypeFromExt, fontFormatHint, slugify } from './media-types.js';\nimport { readUTF8, readBase64, fileStem, pushAll } from './util.js';\nimport { cssStringEscape, scriptContentEscape, styleContentEscape } from './escape.js';\nimport { checkInsertedText, codeEscapeDiagnostics } from './html-output-check.js';\nimport { fillFormatTemplate } from './template.js';\nimport { duplicateInput } from './input-policy.js';\n\n/**\n * Load modules and return HTML tags to inject at the end of the head. `diagnostics` receives a warning for each\n * module that is not valid UTF-8 (it is read as Windows-1252), an error for text HTML cannot carry (U+0000, lone\n * surrogates), a warning for code that escaping it for its element changes (see `codeEscapeDiagnostics()`), and a\n * warning for each module whose element id another module already has (see `moduleIds()`), and a warning for a\n * module given again, which is skipped. A caller that loads the modules of one page in several calls passes the\n * same `idFor` to each, so the ids stay unique across them.\n */\nexport function loadModules(\n filenames: string[],\n diagnostics?: Diagnostic[],\n idFor: ModuleIdFor = moduleIds(diagnostics),\n): string {\n const processed = new Set<string>();\n const headTags: string[] = [];\n\n for (const filename of filenames) {\n if (processed.has(filename)) {\n // Skipped with a warning, as Tweego skips it (module.go), and as compile() skips a module given twice.\n diagnostics?.push(duplicateInput('module', filename, filename));\n continue;\n }\n\n const ext = normalizedFileExt(filename);\n let tag: string | null = null;\n\n switch (ext) {\n case 'css':\n tag = loadModuleTagged('style', filename, idFor, diagnostics);\n break;\n case 'js':\n tag = loadModuleTagged('script', filename, idFor, diagnostics);\n break;\n case 'otf':\n case 'ttf':\n case 'woff':\n case 'woff2':\n tag = loadModuleFont(filename, idFor);\n break;\n default:\n continue;\n }\n\n if (tag) headTags.push(tag);\n processed.add(filename);\n }\n\n return headTags.join('\\n');\n}\n\n/** Gives a module element its id from the id its file stem gives (`base`), unique in the page. */\nexport type ModuleIdFor = (base: string, filename: string) => string;\n\n/**\n * The ids of a page's module elements. A module gets the id its file stem gives, as in Tweego\n * (`script-module-<stem>`, `style-module-<stem>` for stylesheets and fonts). When an earlier module already has\n * that id (two files with the same stem, or stems that slugify alike), it gets the first free id of `<id>-2`,\n * `<id>-3` and so on instead, and `diagnostics` receives a warning naming both modules.\n */\nexport function moduleIds(diagnostics?: Diagnostic[]): ModuleIdFor {\n const owners = new Map<string, string>();\n return (base, filename) => {\n let id = base;\n for (let n = 2; owners.has(id); n++) id = `${base}-${String(n)}`;\n const first = owners.get(base);\n if (first !== undefined) {\n diagnostics?.push({\n level: 'warning',\n message: `The modules \"${first}\" and \"${filename}\" would both have the element id \"${base}\"; \"${filename}\" has the id \"${id}\" instead.`,\n });\n }\n owners.set(id, filename);\n return id;\n };\n}\n\nfunction loadModuleTagged(\n tag: 'script' | 'style',\n filename: string,\n idFor: ModuleIdFor,\n diagnostics?: Diagnostic[],\n): string | null {\n const source = readUTF8(filename, diagnostics).trim();\n if (source.length === 0) return null;\n checkInsertedText(diagnostics, `The module \"${filename}\"`, source);\n if (diagnostics) {\n pushAll(\n diagnostics,\n codeEscapeDiagnostics(tag, { text: source, parts: [{ label: `module \"${filename}\"`, start: 0 }] }),\n );\n }\n\n const family = fileStem(filename);\n const idSlug = idFor(`${tag}-module-${slugify(family)}`, filename);\n const mimeType = tag === 'script' ? 'text/javascript' : 'text/css';\n const content = tag === 'script' ? scriptContentEscape(source) : styleContentEscape(source);\n\n return `<${tag} id=\"${idSlug}\" type=\"${mimeType}\">${content}</${tag}>`;\n}\n\nfunction loadModuleFont(filename: string, idFor: ModuleIdFor): string | null {\n const source = readBase64(filename);\n const family = fileStem(filename);\n const idSlug = idFor(`style-module-${slugify(family)}`, filename);\n const ext = normalizedFileExt(filename);\n const mediaType = mediaTypeFromExt(ext);\n const hint = fontFormatHint(ext);\n\n return `<style id=\"${idSlug}\" type=\"text/css\">@font-face {\\n\\tfont-family: \"${cssStringEscape(family)}\";\\n\\tsrc: url(\"data:${mediaType};base64,${source}\") format(\"${hint}\");\\n}</style>`;\n}\n\n/**\n * Load the module tags and head file content to inject into the head (see `placeHead()`), joined by newlines,\n * or `''` when there is nothing to inject.\n */\nexport function loadHeadContent(\n modulePaths: string[],\n headFile?: string,\n diagnostics?: Diagnostic[],\n idFor?: ModuleIdFor,\n): string {\n const parts: string[] = [];\n\n if (modulePaths.length > 0) {\n const modules = loadModules(modulePaths, diagnostics, idFor).trim();\n if (modules.length > 0) parts.push(modules);\n }\n\n if (headFile) {\n try {\n const source = readUTF8(headFile, diagnostics).trim();\n checkInsertedText(diagnostics, `The head file \"${headFile}\"`, source);\n if (source.length > 0) parts.push(source);\n } catch (e) {\n diagnostics?.push({\n level: 'warning',\n message: `Failed to read head file \"${headFile}\": ${e instanceof Error ? e.message : String(e)}`,\n });\n }\n }\n\n return parts.join('\\n');\n}\n\n/**\n * Inject modules and head file content into `html` the way the renderers inject it into a format template: at the\n * end of the head, found by parsing (see `fillFormatTemplate()`), adding any warning to `diagnostics`.\n */\nexport function modifyHead(html: string, modulePaths: string[], headFile?: string, diagnostics?: Diagnostic[]): string {\n const head = loadHeadContent(modulePaths, headFile, diagnostics);\n const filled = fillFormatTemplate({ template: html, placeholders: [], head, owner: 'The HTML' });\n pushAll(diagnostics, filled.diagnostics);\n return filled.output;\n}\n","/**\n * Which passages an output leaves out of its passage elements, and how to say why.\n * The rules themselves live with each output renderer; this module picks one by target.\n */\nimport type { PassageOmission, PassageOutputTarget, ReadonlyPassage, ReadonlyStory } from './types.js';\nimport { twine2PassageOmission } from './output-twine2.js';\nimport { twine1PassageOmission } from './output-twine1.js';\n\n/**\n * Why the `target` output leaves `passage` out of its passage elements, or `undefined` when it\n * emits the passage (and so a link or the start can name it).\n */\nexport function passageOmission(\n story: ReadonlyStory,\n passage: ReadonlyPassage,\n target: PassageOutputTarget,\n): PassageOmission | undefined {\n switch (target) {\n case 'twine2':\n return twine2PassageOmission(story, passage);\n case 'twine1':\n return twine1PassageOmission(passage);\n default: {\n const _exhaustive: never = target;\n throw new Error(`unhandled passage output target: ${String(_exhaustive)}`);\n }\n }\n}\n\n/** Why a passage is left out, as a predicate: `Passage \"X\" ${describeOmission(o)}`. */\nexport function describeOmission(omission: PassageOmission): string {\n switch (omission.kind) {\n case 'special-name':\n return `is the special \"${omission.name}\" passage`;\n case 'tag':\n return `is tagged \"${omission.tag}\"`;\n case 'empty-story-settings':\n return 'is an empty \"StorySettings\" passage';\n default: {\n const _exhaustive: never = omission;\n throw new Error(`unhandled passage omission: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n","/**\n * Starting passage validation: the effective start must exist and be a\n * passage that the output actually emits, or the story has nowhere to begin.\n */\nimport type { Diagnostic, PassageOutputTarget, ReadonlyStory } from './types.js';\nimport { describeOmission, passageOmission } from './passage-omission.js';\n\n/**\n * Check that `startName` names a passage the `target` output emits.\n * Returns the error diagnostics to report (empty when the start is usable).\n */\nexport function startPassageDiagnostics(\n story: ReadonlyStory,\n startName: string,\n target: PassageOutputTarget,\n): readonly Diagnostic[] {\n const passage = story.passages.find((p) => p.name === startName);\n if (passage === undefined) {\n return [{ level: 'error', message: `Starting passage \"${startName}\" not found.` }];\n }\n const omission = passageOmission(story, passage, target);\n if (omission === undefined) return [];\n return [\n {\n level: 'error',\n message: `Starting passage \"${startName}\" ${describeOmission(omission)}, so it is left out of the story data. Choose a story passage.`,\n },\n ];\n}\n\n/**\n * Check that the story has a name. Twine 1 reads its name from the StoryTitle passage, so that passage\n * must exist; a Twine 2 story may also take its name from an imported file, but it must have one.\n * Returns the error diagnostics to report (empty when the story is named).\n */\nexport function storyTitleDiagnostics(story: ReadonlyStory, target: PassageOutputTarget): readonly Diagnostic[] {\n const hasPassage = story.passages.some((p) => p.name === 'StoryTitle');\n if ((target === 'twine1' || story.name === '') && !hasPassage) {\n return [{ level: 'error', message: 'Special passage \"StoryTitle\" not found.' }];\n }\n if (story.name === '') {\n return [{ level: 'error', message: 'Special passage \"StoryTitle\" is empty, so the story has no name.' }];\n }\n return [];\n}\n","/**\n * Config file loading and validation for twee-ts.\n *\n * One table, CONFIG_SPEC, says what each key may hold. validateConfig() checks a config against it, and\n * configJsonSchema() renders it as the JSON Schema shipped in schemas/twee-ts.config.schema.json; a test\n * keeps the two equal, so the schema an editor checks with and the checks twee-ts makes cannot drift apart.\n */\nimport { dirname, isAbsolute, join, sep } from 'node:path';\nimport type { Diagnostic, ExcludeGlob, TweeTsConfig, OutputMode, WordCountMethod } from './types.js';\nimport { pushAll, readUTF8, similarKey } from './util.js';\nimport { VERSION } from './version.js';\nimport { identify } from './path-identity.js';\nimport { failureOfRead, inputProblem } from './input-policy.js';\nimport type { InputDiscovery } from './input-policy.js';\nimport { TweeTsError } from './errors.js';\nimport { isTweeTag } from './twee-syntax.js';\nimport { JsonObject, field, formatJsonPath, ownRecord, parseJSON, readObject } from './json-decode.js';\nimport type { Decoder, DecodeIssue, FieldReader, JsonPath, JsonValue } from './json-decode.js';\n\nexport const CONFIG_FILENAME = 'twee-ts.config.json';\n\nconst VALID_OUTPUT_MODES: readonly OutputMode[] = [\n 'html',\n 'twee3',\n 'twee1',\n 'twine2-archive',\n 'twine1-archive',\n 'json',\n];\nconst VALID_WORD_COUNT_METHODS: readonly WordCountMethod[] = ['tweego', 'whitespace'];\n\n/** A tag name: at least one character and no Twee whitespace (see `isTweeSpace`), since Twee separates tags with it. */\nconst TAG_PATTERN = '^[^\\\\t-\\\\r \\\\u0085\\\\u00a0\\\\u1680\\\\u2000-\\\\u200a\\\\u2028\\\\u2029\\\\u202f\\\\u205f\\\\u3000]+$';\n\n/** What one config key may hold, as the JSON schema states it. */\ntype FieldSpec = { readonly description: string; readonly default?: unknown } & (\n | { readonly kind: 'string'; readonly minLength?: number }\n | { readonly kind: 'boolean' }\n | { readonly kind: 'number'; readonly minimum: number }\n | { readonly kind: 'enum'; readonly values: readonly string[] }\n | { readonly kind: 'string-array' }\n | { readonly kind: 'tag-map' }\n);\n\n/** A config key's spec, and the decoder that reads its value (its errors name the key as `label`). */\ninterface ConfigField<T> {\n readonly spec: FieldSpec;\n readonly decoder: (label: string) => Decoder<T>;\n}\n\n/** Every config key with its spec, each decoder giving the type TweeTsConfig names for the key. */\ntype ConfigSpec = { readonly [K in keyof TweeTsConfig]-?: ConfigField<NonNullable<TweeTsConfig[K]>> };\n\n/** Records a config error and rejects the value. */\nfunction invalid(issues: DecodeIssue[], path: JsonPath, message: string): { readonly ok: false } {\n issues.push({ kind: 'type', path, message });\n return { ok: false };\n}\n\nfunction stringField(\n description: string,\n options: { readonly minLength?: number; readonly default?: string } = {},\n): ConfigField<string> {\n const { minLength } = options;\n return {\n spec: {\n kind: 'string',\n description,\n ...(minLength === undefined ? {} : { minLength }),\n ...(options.default === undefined ? {} : { default: options.default }),\n },\n decoder: (label) => (value, path, issues) => {\n if (typeof value !== 'string') return invalid(issues, path, `${label} must be a string.`);\n if (minLength !== undefined && value.length < minLength) {\n return invalid(issues, path, `${label} must not be empty.`);\n }\n return { ok: true, value };\n },\n };\n}\n\nfunction booleanField(description: string, defaultValue: boolean): ConfigField<boolean> {\n return {\n spec: {\n kind: 'boolean',\n description,\n default: defaultValue,\n },\n decoder: (label) => (value, path, issues) =>\n typeof value === 'boolean' ? { ok: true, value } : invalid(issues, path, `${label} must be a boolean.`),\n };\n}\n\n/** A number of milliseconds, `minimum` or more. */\nfunction millisecondsField(description: string, minimum: number, defaultValue: number): ConfigField<number> {\n return {\n spec: {\n kind: 'number',\n description,\n minimum,\n default: defaultValue,\n },\n decoder: (label) => (value, path, issues) =>\n typeof value === 'number' && Number.isFinite(value) && value >= minimum\n ? { ok: true, value }\n : invalid(issues, path, `${label} must be a number of milliseconds, ${minimum} or more.`),\n };\n}\n\nfunction enumField<T extends string>(values: readonly T[], defaultValue: T, description: string): ConfigField<T> {\n return {\n spec: {\n kind: 'enum',\n values,\n description,\n default: defaultValue,\n },\n decoder: (label) => (value, path, issues) => {\n const known = values.find((v) => v === value);\n return known === undefined\n ? invalid(issues, path, `${label} must be one of: ${values.join(', ')}.`)\n : { ok: true, value: known };\n },\n };\n}\n\nfunction stringArrayField(description: string): ConfigField<string[]> {\n return {\n spec: {\n kind: 'string-array',\n description,\n },\n decoder: (label) => (value, path, issues) => {\n if (!Array.isArray(value)) return invalid(issues, path, `${label} must be an array.`);\n const items: readonly JsonValue[] = value;\n const strings = items.filter((item): item is string => typeof item === 'string');\n if (strings.length !== items.length) return invalid(issues, path, `${label} must be an array of strings.`);\n if (strings.includes('')) return invalid(issues, path, `${label} must not hold an empty string.`);\n return { ok: true, value: strings };\n },\n };\n}\n\nfunction tagMapField(description: string): ConfigField<Record<string, string>> {\n return {\n spec: {\n kind: 'tag-map',\n description,\n },\n decoder: (label) => (value, path, issues) => {\n if (!(value instanceof JsonObject)) return invalid(issues, path, `${label} must be an object.`);\n const entries: [string, string][] = [];\n for (const { key: alias, value: target } of value.members) {\n if (typeof target !== 'string') {\n return invalid(issues, [...path, alias], `${label.slice(0, -1)}.${alias}\" must be a string.`);\n }\n const problem = tagAliasProblem(alias, target);\n if (problem !== undefined) return invalid(issues, [...path, alias], `${label}: ${problem}.`);\n entries.push([alias, target]);\n }\n // Own properties, so an alias `__proto__` is kept (#241).\n return { ok: true, value: ownRecord(entries) };\n },\n };\n}\n\n/** Every config key, with what it may hold. The JSON schema is generated from this (configJsonSchema()). */\nexport const CONFIG_SPEC: ConfigSpec = {\n sources: stringArrayField('Files or directories to compile, relative to the config file.'),\n exclude: stringArrayField(\n 'Glob patterns for files to leave out of sources, relative to the config file (e.g. \"**/*.png\", \"src/art/**\").',\n ),\n output: stringField('Output file path, relative to the config file; \"-\" for standard output.', { minLength: 1 }),\n outputMode: enumField(VALID_OUTPUT_MODES, 'html', 'Output mode.'),\n // No schema default for these two: when they are left out, StoryData decides, so no value is the default.\n formatId: stringField(\n \"Story format ID (e.g. 'sugarcube-2'). Overrides StoryData's format; without it, StoryData's format decides, and 'sugarcube-2' when StoryData names none.\",\n { minLength: 1 },\n ),\n startPassage: stringField(\n \"Name of the starting passage. Overrides StoryData's start; without it, StoryData's start decides, and 'Start' when StoryData names none.\",\n { minLength: 1 },\n ),\n formatPaths: stringArrayField('Extra directories to search for story formats, relative to the config file.'),\n formatIndices: stringArrayField('URLs to SFA-compatible index.json files for remote format lookup.'),\n formatUrls: stringArrayField('Direct URLs to format.js files.'),\n useTweegoPath: booleanField('Also search TWEEGO_PATH env for formats.', true),\n modules: stringArrayField('Module files to inject into <head>, relative to the config file.'),\n headFile: stringField('Raw HTML file to append to <head>, relative to the config file.', { minLength: 1 }),\n trim: booleanField('Trim passage whitespace.', true),\n twee2Compat: booleanField('Twee2 compatibility mode.', false),\n testMode: booleanField('Enable debug/test mode option.', false),\n noRemote: booleanField('Disable remote format fetching.', false),\n formatFetchTimeout: millisecondsField(\n 'Milliseconds each story format request (an index or a format.js) may take before it fails with a warning and the next source is tried. 0 turns the limit off.',\n 0,\n 30000,\n ),\n formatResolutionTimeout: millisecondsField(\n 'Milliseconds the search for the story format may take in all, over every request. When it passes, the format URLs and indices not yet asked are read from the download cache only. 0 turns the limit off.',\n 0,\n 120000,\n ),\n useDefaultFormatIndices: booleanField(\n 'Ask the Story Formats Archive indices after formatIndices. false: only the configured indices and URLs are asked.',\n true,\n ),\n tagAliases: tagMapField(\n 'Map alias tags to canonical special tags (e.g. { \"library\": \"script\" }). Tags are non-empty and hold no whitespace.',\n ),\n sourceInfo: booleanField('Emit source file and line as data- attributes on passage elements.', false),\n wordCountMethod: enumField(\n VALID_WORD_COUNT_METHODS,\n 'tweego',\n \"Word counting method. 'tweego': NFKD normalize, divide chars by 5 (matches Tweego). 'whitespace': split on whitespace after stripping comments and markup.\",\n ),\n};\n\n/** The keys a config file may hold besides `$schema`; the JSON schema's `properties` list the same keys. */\nexport const CONFIG_KEYS: readonly (keyof TweeTsConfig)[] = Object.keys(CONFIG_SPEC).filter(\n (key): key is keyof TweeTsConfig => Object.hasOwn(CONFIG_SPEC, key),\n);\n\n/** The key that only references the JSON schema, for editors. */\nconst SCHEMA_KEY = '$schema';\n\n/** Why a tag alias can't be used, or undefined when it can. The CLI's --tag-alias checks the same. */\nexport function tagAliasProblem(alias: string, target: string): string | undefined {\n if (!isTweeTag(alias)) return `the alias \"${alias}\" must be a non-empty tag name without whitespace`;\n if (!isTweeTag(target))\n return `the target \"${target}\" of alias \"${alias}\" must be a non-empty tag name without whitespace`;\n return undefined;\n}\n\n/**\n * Load a config file from the given directory (default: cwd). Returns null when nothing is at its path.\n *\n * @param diagnostics Receives warnings that do not stop the config from loading: keys the config does not\n * define, and a file that is not valid UTF-8 (it is read as Windows-1252).\n * @throws A TweeTsError when something is at the path but cannot be read (a dangling symbolic link, a link loop,\n * a folder that can't be searched, a file it may not read), is not valid JSON or fails {@link validateConfig}.\n */\nexport function loadConfig(dir?: string, diagnostics?: Diagnostic[]): TweeTsConfig | null {\n const base = dir ?? process.cwd();\n return readConfig(join(base, CONFIG_FILENAME), 'found', diagnostics);\n}\n\n/**\n * Load a config from a specific file path.\n *\n * The paths in it (`sources`, `output`, `modules`, `headFile`, `formatPaths`) are relative to the folder\n * that holds the config file, and so are the `exclude` globs: the config is returned with them rebased onto\n * the working directory (or absolute, when that folder is outside it).\n *\n * @param diagnostics Receives warnings that do not stop the config from loading: keys the config does not\n * define, and a file that is not valid UTF-8 (it is read as Windows-1252).\n * @throws A TweeTsError when the file cannot be read, is not valid JSON or fails {@link validateConfig}.\n */\nexport function loadConfigFile(filePath: string, diagnostics?: Diagnostic[]): TweeTsConfig {\n return readConfig(filePath, 'named', diagnostics);\n}\n\n/**\n * Read the config file at `filePath`. A file that can't be read is as the input policy says: no config (null) where\n * it says `ignore` (a config found in the working directory with nothing at its path), else a TweeTsError. A named\n * config file is never ignored (see `INPUT_POLICY.config.named`).\n */\nfunction readConfig(filePath: string, discovery: 'named', diagnostics: Diagnostic[] | undefined): TweeTsConfig;\nfunction readConfig(\n filePath: string,\n discovery: InputDiscovery,\n diagnostics: Diagnostic[] | undefined,\n): TweeTsConfig | null;\nfunction readConfig(\n filePath: string,\n discovery: InputDiscovery,\n diagnostics: Diagnostic[] | undefined,\n): TweeTsConfig | null {\n const readDiagnostics: Diagnostic[] = [];\n let raw: string;\n try {\n raw = readUTF8(filePath, readDiagnostics);\n } catch (e) {\n const problem = inputProblem('config', discovery, failureOfRead(filePath, e), filePath, e);\n if (problem.level === 'ignore') return null;\n throw new TweeTsError(`Cannot read config file ${filePath}: ${problem.reason}`, [], {\n code: 'INPUT_UNAVAILABLE',\n cause: e,\n });\n }\n\n const config = parseConfig(raw, filePath, readDiagnostics);\n pushAll(diagnostics, readDiagnostics);\n return rebaseConfigPaths(config, filePath);\n}\n\n/**\n * Parse and validate the text of the config file at `path` (strict JSON, see json-decode.ts). Unknown and\n * repeated keys are added to `diagnostics` as warnings, so a config with a stray key keeps loading.\n */\nfunction parseConfig(raw: string, path: string, diagnostics: Diagnostic[]): TweeTsConfig {\n const parsed = parseJSON(raw);\n if (!parsed.ok) {\n throw new TweeTsError(`Invalid JSON in ${path}: ${parsed.error.message}`, [], { code: 'INVALID_OPTIONS' });\n }\n const decoded = decodeConfig(parsed.value);\n if (decoded.errors.length > 0) {\n throw new TweeTsError(`Invalid config in ${path}:\\n ${decoded.errors.join('\\n ')}`, [], {\n code: 'INVALID_OPTIONS',\n });\n }\n pushAll(\n diagnostics,\n decoded.warnings.map((message): Diagnostic => ({\n level: 'warning',\n message: `${path}: ${message}`,\n file: path,\n })),\n );\n return decoded.config;\n}\n\n/**\n * A config value as JSON: what `JSON.parse` would give back, a value JSON can't hold (a function, `undefined`, an\n * object inside itself) read as `null`.\n */\nfunction toJsonValue(value: unknown, ancestors: readonly object[] = []): JsonValue {\n if (value === null || typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number') {\n return value;\n }\n if (typeof value !== 'object' || ancestors.includes(value)) return null;\n const inside = [...ancestors, value];\n if (Array.isArray(value)) return value.map((item: unknown) => toJsonValue(item, inside));\n return new JsonObject(Object.entries(value).map(([key, item]) => ({ key, value: toJsonValue(item, inside) })));\n}\n\n/**\n * The error for `value` given to the option `key` from JavaScript (the compile options, a plugin's\n * `compileOptions`), as the config key of that name reports it: one table, CONFIG_SPEC, decides what each option\n * may hold wherever it is set. `label` names the option in the message. Undefined when the value is valid.\n */\nexport function configValueError(key: keyof TweeTsConfig, value: unknown, label: string): string | undefined {\n const issues: DecodeIssue[] = [];\n const decoded = CONFIG_SPEC[key].decoder(`\"${label}\"`)(toJsonValue(value), [], issues);\n return decoded.ok ? undefined : issues.map((issue) => issue.message).join(' ');\n}\n\n/** The warning for a key the config does not define, with the key it may stand for. */\nfunction unknownKeyWarning(key: string): string {\n const suggestion = similarKey(key, CONFIG_KEYS);\n const hint = suggestion === undefined ? '' : ` (did you mean \"${suggestion}\"?)`;\n return `Unknown config key \"${key}\"${hint}; it is ignored.`;\n}\n\n/** A config read from JSON: what it sets, the errors that make it unusable, and the warnings. */\ninterface DecodedConfig {\n readonly config: TweeTsConfig;\n readonly errors: readonly string[];\n readonly warnings: readonly string[];\n}\n\n/** Reads a config with the decoders of json-decode.ts, every key checked as CONFIG_SPEC says. */\nfunction decodeConfig(value: JsonValue): DecodedConfig {\n const issues: DecodeIssue[] = [];\n const warnings: string[] = [];\n const config: TweeTsConfig = {};\n // `specs` is CONFIG_SPEC, typed over the one key so that its decoder has that key's type.\n const reader = <K extends keyof TweeTsConfig>(\n key: K,\n specs: { readonly [P in K]: ConfigField<NonNullable<TweeTsConfig[P]>> },\n ): FieldReader =>\n field(specs[key].decoder(`\"${key}\"`), (v) => {\n config[key] = v;\n });\n const fields: Record<string, FieldReader> = ownRecord([\n // `$schema` is only checked: it names the schema for editors and sets nothing.\n [SCHEMA_KEY, field(stringField('').decoder(`\"${SCHEMA_KEY}\"`), () => undefined)],\n ...CONFIG_KEYS.map((key): [string, FieldReader] => [key, reader(key, CONFIG_SPEC)]),\n ]);\n const isObject = readObject(value, [], issues, {\n fields,\n keys: 'exact',\n unknown: (member) => warnings.push(unknownKeyWarning(member.key)),\n });\n if (!isObject) return { config: {}, errors: ['Config must be a JSON object.'], warnings: [] };\n for (const issue of issues) {\n if (issue.kind === 'duplicate-key') {\n warnings.push(`${formatJsonPath(issue.path)} is given more than once; the last one is used.`);\n }\n }\n return { config, errors: issues.filter((i) => i.kind === 'type').map((i) => i.message), warnings };\n}\n\n/**\n * Validate a config object. Returns an array of error strings (empty = valid).\n * Keys the config does not define are not errors; {@link unknownConfigKeyWarnings} reports them.\n */\nexport function validateConfig(data: unknown): string[] {\n return [...decodeConfig(toJsonValue(data)).errors];\n}\n\n/**\n * Warnings for the keys of a config object that the config does not define (the JSON schema's\n * `additionalProperties: false`), other than `$schema`. twee-ts ignores such a key, so a misspelt one would\n * otherwise leave its option at the default without a word. A key that differs from a defined one only in\n * letter case, `-` or `_` (`formatID`, `output-mode`) gets a suggestion. Returns `[]` for anything that is not\n * an object, which {@link validateConfig} reports.\n */\nexport function unknownConfigKeyWarnings(data: unknown): string[] {\n return [...decodeConfig(toJsonValue(data)).warnings];\n}\n\n/** The JSON Schema of one field. */\nfunction fieldSchema(spec: FieldSpec): Record<string, unknown> {\n const base = (() => {\n switch (spec.kind) {\n case 'string':\n return { type: 'string', ...(spec.minLength === undefined ? {} : { minLength: spec.minLength }) };\n case 'boolean':\n return { type: 'boolean' };\n case 'number':\n return { type: 'number', minimum: spec.minimum };\n case 'enum':\n return { type: 'string', enum: [...spec.values] };\n case 'string-array':\n return { type: 'array', items: { type: 'string', minLength: 1 } };\n case 'tag-map':\n return {\n type: 'object',\n propertyNames: { pattern: TAG_PATTERN },\n additionalProperties: { type: 'string', pattern: TAG_PATTERN },\n };\n default: {\n const _exhaustive: never = spec;\n throw new Error(`unhandled config field kind: ${JSON.stringify(_exhaustive)}`);\n }\n }\n })();\n return { ...base, ...('default' in spec ? { default: spec.default } : {}), description: spec.description };\n}\n\n/** The JSON Schema for config files, as schemas/twee-ts.config.schema.json holds it. */\nexport function configJsonSchema(): Record<string, unknown> {\n return {\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: SCHEMA_URL,\n title: 'twee-ts Configuration',\n description: 'Configuration file for twee-ts, a TypeScript Twee-to-HTML compiler.',\n type: 'object',\n additionalProperties: false,\n properties: {\n [SCHEMA_KEY]: { type: 'string', description: 'JSON Schema reference for editor support.' },\n ...Object.fromEntries(CONFIG_KEYS.map((key) => [key, fieldSchema(CONFIG_SPEC[key].spec)])),\n },\n };\n}\n\n/**\n * A glob relative to the folder `dir` (as reported, relative to the working directory or absolute). A\n * folder whose name holds glob syntax (or a backslash, which is a name character on POSIX) stays apart\n * from the glob as an {@link ExcludeGlob}: Node's glob matching has no working escape, so no spelling of\n * such a name inside a glob matches that name and nothing else.\n */\nfunction rebaseGlob(dir: string, glob: string): string | ExcludeGlob {\n const pattern = glob.replace(/^\\.[/\\\\]/, '');\n if (isAbsolute(pattern)) return pattern;\n // On Windows the separators of `dir` are backslashes, and `/` is the glob's own.\n const spelled = sep === '\\\\' ? dir.replace(/\\\\/g, '/') : dir;\n return /[[\\]{}()*?+@!,\\\\]/.test(spelled) ? { base: dir, glob: pattern } : `${spelled.replace(/\\/$/, '')}/${pattern}`;\n}\n\n/**\n * The config with the paths in it, which are relative to the folder holding the config file at\n * `configPath`, made relative to the working directory (or absolute, when that folder is outside it).\n * Absolute paths and `\"-\"` (standard output) stay as they are. A config file in the\n * working directory is returned unchanged.\n */\nexport function rebaseConfigPaths(config: TweeTsConfig, configPath: string): TweeTsConfig {\n const folder = identify(dirname(configPath));\n if (folder.key === identify('.').key) return config;\n const dir = folder.display;\n const rebase = (path: string): string => (path === '-' || isAbsolute(path) ? path : join(dir, path));\n const { sources, exclude, output, modules, headFile, formatPaths } = config;\n return {\n ...config,\n ...(sources === undefined ? {} : { sources: sources.map(rebase) }),\n ...(exclude === undefined\n ? {}\n : { exclude: exclude.map((glob) => (typeof glob === 'string' ? rebaseGlob(dir, glob) : glob)) }),\n ...(output === undefined ? {} : { output: rebase(output) }),\n ...(modules === undefined ? {} : { modules: modules.map(rebase) }),\n ...(headFile === undefined ? {} : { headFile: rebase(headFile) }),\n ...(formatPaths === undefined ? {} : { formatPaths: formatPaths.map(rebase) }),\n };\n}\n\n/** Where the schema of the newest release is published; also the schema's `$id`. */\nconst SCHEMA_URL = 'https://unpkg.com/@rohal12/twee-ts/schemas/twee-ts.config.schema.json';\n\n/**\n * The schema URL a new config names: the schema of `version`, so that an editor checks the config against the\n * keys the installed twee-ts reads, not those of a later release (#250). A build from a checkout reports\n * `0.0.0-development`, which is never published, and names the newest schema.\n */\nfunction schemaUrlFor(version: string): string {\n const published = /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$/.test(version) && !version.startsWith('0.0.0-');\n return published ? SCHEMA_URL.replace('/twee-ts/', `/twee-ts@${version}/`) : SCHEMA_URL;\n}\n\n/** Return a default config JSON string for --init scaffolding, naming the schema of `version` (this twee-ts). */\nexport function scaffoldConfig(version: string = VERSION): string {\n const config = {\n $schema: schemaUrlFor(version),\n sources: ['src/'],\n output: 'story.html',\n };\n return JSON.stringify(config, null, 2) + '\\n';\n}\n","/**\n * The one check of the compile options as a JavaScript caller may pass them, whatever their types say:\n * compile(), compileToFile(), watch(), compileIncremental(), lint() and the bundler plugins' `compileOptions`.\n *\n * An option a config file also sets is checked by that config key's decoder in CONFIG_SPEC, so an option holds\n * the same values from the API, the plugins and the config file; the command line refuses empty values and\n * merges with the config. The options a config file can't set (inline sources, `{ base, glob }` excludes, the\n * signal, the output file and the callbacks) are checked here.\n */\nimport type { Diagnostic, WatchOptions } from './types.js';\nimport { CONFIG_KEYS, configValueError } from './config.js';\nimport { TweeTsError } from './errors.js';\nimport { isRecord, similarKey } from './util.js';\n\n/**\n * Every option compile(), compileToFile() and watch() read. `satisfies` keeps the list complete: an option\n * added to the types and not here, or listed here and not in the types, is a compile error.\n */\nconst OPTION_KEYS: readonly string[] = Object.keys({\n sources: true,\n exclude: true,\n outputMode: true,\n formatId: true,\n startPassage: true,\n formatPaths: true,\n useTweegoPath: true,\n modules: true,\n headFile: true,\n trim: true,\n twee2Compat: true,\n testMode: true,\n formatIndices: true,\n formatUrls: true,\n noRemote: true,\n signal: true,\n formatFetchTimeout: true,\n formatResolutionTimeout: true,\n useDefaultFormatIndices: true,\n tagAliases: true,\n sourceInfo: true,\n wordCountMethod: true,\n outFile: true,\n onBuild: true,\n onError: true,\n} satisfies Record<keyof WatchOptions, true>);\n\n/** What the options of the plugins and the config file are called in the compile options. */\nconst OTHER_NAMES: ReadonlyMap<string, string> = new Map([\n ['format', 'formatId'],\n ['output', 'outFile'],\n]);\n\n/**\n * A warning for each option the build does not read, as for a key a config file does not define: called from\n * JavaScript, or with a spread config object, a misspelt option (`format` for `formatId`) would otherwise be\n * left at its default without a word.\n */\nexport function unknownOptionWarnings(options: object): Diagnostic[] {\n return Object.keys(options)\n .filter((key) => !OPTION_KEYS.includes(key))\n .map((key): Diagnostic => {\n const suggestion = OTHER_NAMES.get(key) ?? similarKey(key, OPTION_KEYS);\n const hint = suggestion === undefined ? '' : ` (did you mean \"${suggestion}\"?)`;\n return { level: 'warning', message: `Unknown compile option \"${key}\"${hint}; it is ignored.` };\n });\n}\n\n/** Whether `value` is an `ExcludeGlob`: exactly a non-empty `base` and a non-empty `glob`, both strings. */\nfunction isExcludeGlob(value: unknown): boolean {\n return (\n isRecord(value) &&\n Object.keys(value).length === 2 &&\n ['base', 'glob'].every((key) => typeof value[key] === 'string' && value[key] !== '')\n );\n}\n\n/** Whether `value` is an `InlineSource`: a non-empty `filename` and a string or Buffer `content`. */\nfunction isInlineSource(value: unknown): boolean {\n if (!isRecord(value)) return false;\n const { filename, content } = value;\n return typeof filename === 'string' && filename !== '' && (typeof content === 'string' || Buffer.isBuffer(content));\n}\n\nconst nonEmptyString = (value: unknown): boolean => typeof value === 'string' && value !== '';\n\n/** The options a config file can't set (or sets differently), each with its check and what it must be. */\nconst OWN_CHECKS: ReadonlyMap<string, { readonly valid: (value: unknown) => boolean; readonly expected: string }> =\n new Map([\n [\n 'sources',\n {\n valid: (value) =>\n Array.isArray(value) && value.every((item: unknown) => nonEmptyString(item) || isInlineSource(item)),\n expected: 'an array of non-empty paths and { filename, content } inline sources',\n },\n ],\n [\n 'exclude',\n {\n valid: (value) =>\n Array.isArray(value) && value.every((item: unknown) => nonEmptyString(item) || isExcludeGlob(item)),\n expected: 'an array of non-empty strings and { base, glob } objects',\n },\n ],\n ['signal', { valid: (value) => value instanceof AbortSignal, expected: 'an AbortSignal' }],\n ['outFile', { valid: nonEmptyString, expected: 'a non-empty string' }],\n ['onBuild', { valid: (value) => typeof value === 'function', expected: 'a function' }],\n ['onError', { valid: (value) => typeof value === 'function', expected: 'a function' }],\n ]);\n\n/** The compile options a config file sets with the same meaning, checked by its decoders. */\nconst CONFIG_CHECKED = CONFIG_KEYS.filter((key) => !OWN_CHECKS.has(key) && key !== 'output');\n\n/** The time limits, which from JavaScript may also be `Infinity`, a number JSON can't hold: no limit, as 0 is. */\nconst TIME_LIMITS: ReadonlySet<string> = new Set(['formatFetchTimeout', 'formatResolutionTimeout']);\n\n/**\n * What is wrong with `options` as compile options, one message per option, each naming the option with\n * `prefix` before it (a plugin's `compileOptions.`). An option set to `undefined` is the same as one left out;\n * the options in `required` must be set. Options the build does not read are left to unknownOptionWarnings().\n */\nexport function compileOptionErrors(\n options: unknown,\n required: readonly ('sources' | 'outFile')[],\n prefix = '',\n): string[] {\n // A plugin checks that its `compileOptions` is an object before it gets here.\n if (!isRecord(options)) return ['The compile options must be an object.'];\n const value = (key: string): unknown => (Object.hasOwn(options, key) ? options[key] : undefined);\n const missing = required.filter((key) => value(key) === undefined).map((key) => `\"${prefix}${key}\" must be set.`);\n const own = [...OWN_CHECKS].flatMap(([key, check]) => {\n const given = value(key);\n return given === undefined || check.valid(given) ? [] : [`\"${prefix}${key}\" must be ${check.expected}.`];\n });\n const shared = CONFIG_CHECKED.flatMap((key) => {\n const given = value(key);\n const noCheck = given === undefined || (given === Number.POSITIVE_INFINITY && TIME_LIMITS.has(key));\n const error = noCheck ? undefined : configValueError(key, given, `${prefix}${key}`);\n return error === undefined ? [] : [error];\n });\n return [...missing, ...own, ...shared];\n}\n\n/** Throws a TweeTsError (`INVALID_OPTIONS`) naming each option that compileOptionErrors() finds wrong. */\nexport function validateCompileOptions(options: unknown, required: readonly ('sources' | 'outFile')[]): void {\n const errors = compileOptionErrors(options, required);\n if (errors.length === 0) return;\n const message = !isRecord(options)\n ? errors.join('')\n : errors.length === 1\n ? `Invalid compile option: ${errors.join('')}`\n : `Invalid compile options:\\n ${errors.join('\\n ')}`;\n throw new TweeTsError(message, [], { code: 'INVALID_OPTIONS' });\n}\n","/**\n * Main compiler orchestrator.\n * compile(), compileToFile(), watch().\n * Ported from tweego.go + config.go.\n */\nimport { dirname, join, sep } from 'node:path';\nimport type {\n CompileOptions,\n CompileToFileOptions,\n WatchOptions,\n CompileResult,\n CompileStats,\n Diagnostic,\n Story,\n StoryFormatInfo,\n OutputMode,\n InlineSource,\n FileCacheEntry,\n} from './types.js';\nimport { ineffectiveImportDiagnostics, joinWithLineFeeds } from './css-imports.js';\nimport type { StylesheetSource } from './css-imports.js';\nimport { createStory, getStoryStats, snapshot } from './story.js';\nimport {\n getFilenames,\n isExcluded,\n isLoadableType,\n isPreviousBuild,\n outputPaths,\n toBuildOutputs,\n watchFilesystem,\n} from './filesystem.js';\nimport type {\n BuildOutputs,\n DiscoveredFile,\n FilenamesResult,\n FolderStream,\n OutputPaths,\n SkippedOutput,\n WatchTiming,\n} from './filesystem.js';\nimport { formatRequestFor, resolveStoryFormat } from './format-resolution.js';\nimport { loadSources, loadInlineSources, loadSourcesCached } from './loader.js';\nimport { applyTagAliases, hasTag, metadataForOutput } from './passage.js';\nimport { generateIFID } from './ifid.js';\nimport { toTwine2HTML, toTwine2Archive, terminateScript, twine2TagColors } from './output-twine2.js';\nimport { toTwine1HTML, toTwine1Archive } from './output-twine1.js';\nimport { toTwee } from './output-twee.js';\nimport { loadHeadContent, moduleIds } from './modules.js';\nimport { checkInsertedText } from './html-output-check.js';\nimport { startPassageDiagnostics, storyTitleDiagnostics } from './start-passage.js';\nimport { clearIndexCache } from './remote-formats.js';\nimport { checkWritable, isOwnOutput, writeFileAtomic } from './atomic-write.js';\nimport { identify, isKeyInside } from './path-identity.js';\nimport { duplicateInput, failureOfRead, inputProblem, problemDiagnostic } from './input-policy.js';\nimport type { InputProblem } from './input-policy.js';\nimport { MAX_STRING_LENGTH, pushAll, readUTF8 } from './util.js';\nimport { unknownOptionWarnings, validateCompileOptions } from './compile-options.js';\nimport { VERSION } from './version.js';\nimport { TweeTsError } from './errors.js';\n\nexport { TweeTsError };\n\nconst CREATOR_NAME = 'Twee-ts';\n\nconst DEFAULT_FORMAT_ID = 'sugarcube-2';\nconst DEFAULT_START_NAME = 'Start';\n\n/** Whether `error` is one no change to the sources can fix: a watch stops on it. */\nfunction isConfigurationError(error: unknown): error is TweeTsError {\n return error instanceof TweeTsError && (error.code === 'OUTPUT_IS_INPUT' || error.code === 'INVALID_OPTIONS');\n}\n\n/**\n * Compile Twee sources to HTML, Twee, or JSON.\n */\nexport async function compile(options: CompileOptions): Promise<CompileResult> {\n return buildOutput(options, {});\n}\n\n/**\n * Compile and write to a file. How the file is written depends on what is there (see atomic-write.ts): a\n * regular file is replaced atomically, so a reader sees the previous build or the new one, never part of it,\n * and a failed write leaves the previous build; a FIFO or a device is written through; a read-only file is\n * refused. An output that can't be written (a read-only file, a missing folder) fails before the build.\n */\nexport async function compileToFile(options: CompileToFileOptions): Promise<CompileResult> {\n validateCompileOptions(options, ['sources', 'outFile']);\n const result = await compileForOutputFile(options, options.outFile, undefined, [], true);\n // The build may have been aborted after it finished: the previous output stays.\n options.signal?.throwIfAborted();\n writeFileAtomic(options.outFile, result.output);\n return result;\n}\n\n/** An input named outside the compile options, which the output must not overwrite either. */\nexport interface ExtraInput {\n readonly role: 'config';\n readonly path: string;\n}\n\n/**\n * Builds as compileToFile() does for `outputs`, without writing them: an output may sit\n * inside a source folder, so its last build is left out of the sources and modules and\n * never read back. `outputs` is the one file the CLI writes, or every path a bundler's\n * build writes (see BuildOutputs). The caller decides whether the result is written.\n * With no outputs (output to stdout, or none), this is compile(). With `cache`, files\n * are cached as compileIncremental() caches them. `extraInputs` (the CLI's config file)\n * are checked against the outputs as the sources are. With `writesOutput`, the output file\n * the caller writes afterwards is checked to be writable before any input is read.\n *\n * Throws a TweeTsError (`OUTPUT_IS_INPUT`) when an input would be overwritten (see checkNamedInputs).\n *\n * Internal, for the CLI and the bundler plugins; not part of the public API.\n */\nexport async function compileForOutputFile(\n options: CompileOptions,\n outputs: BuildOutputs | string | undefined,\n cache?: Map<string, FileCacheEntry>,\n extraInputs: readonly ExtraInput[] = [],\n writesOutput = false,\n): Promise<CompileResult> {\n return buildOutput(options, { cache, outputs, extraInputs, writesOutput });\n}\n\n/**\n * The JSON build lint inspects, for a project whose builds are written to `outputs` (see `compileForOutputFile()`).\n * It also reads the modules and head file as HTML output does, so it reports what HTML output would about them:\n * a module that can't be used, text HTML cannot carry, code the escapers change, and a head file that can't be\n * read (fatal, as in a build).\n *\n * Internal, for lint; not part of the public API.\n */\nexport async function compileForLint(\n options: Omit<CompileOptions, 'outputMode'>,\n outputs: string | undefined,\n): Promise<CompileResult> {\n return buildOutput({ ...options, outputMode: 'json' }, { outputs, checkHead: true, omitStyleImports: true });\n}\n\n/**\n * Compile with incremental caching support.\n * Plugins and advanced users can manage their own cache and changed-file tracking.\n *\n * Without `changedFiles`, a cached file is reused while its modification time, size, inode and\n * status-change time are unchanged. With it, a file it names is always reparsed, and every\n * other cached file is reused as it is. A file may be named by an absolute path or by a path\n * relative to the working directory, with or without a leading `./`, or through a link: entries are\n * matched to the source files by identity (see path-identity.ts). A file that fails to load is\n * dropped from the cache, so the next build tries it again.\n */\nexport async function compileIncremental(\n options: CompileOptions,\n cache: Map<string, FileCacheEntry>,\n changedFiles?: ReadonlySet<string>,\n): Promise<CompileResult> {\n return buildOutput(options, { cache, changedFiles });\n}\n\n/**\n * Watch for file changes and recompile. Every build is written to `outFile` (as compileToFile()\n * writes it), including one whose diagnostics report errors. Builds run one at a time, and each\n * one is written and reported as it finishes, in order: changes made during a build go into one\n * follow-up build after it. A watched path that can't be watched is passed to `onError`.\n *\n * Options that can't work (an output that is also a named input or an authored file in a source or module\n * folder, an out-of-range option) reject the returned promise before anything is watched. A build that fails for such a reason later (a link\n * changed to make the output an input) is passed to `onError`, and watching stops.\n *\n * Aborting the returned controller, or the `signal` in the options, stops watching and\n * aborts the story format requests of the build in progress.\n */\nexport function watch(options: WatchOptions): Promise<AbortController> {\n // Watching starts synchronously; an error while starting rejects rather than throws.\n return new Promise((resolveWatch) => {\n resolveWatch(watchWithWriteFilter(options, () => true));\n });\n}\n\n/**\n * watch(), writing to `outFile` only the builds `shouldWrite` accepts. A rejected build\n * leaves the output file as it was; `onBuild` receives every build either way.\n *\n * Throws (a TweeTsError) when the options can't work, before anything is watched.\n *\n * Internal, for the CLI, which keeps the last good output when a rebuild reports errors;\n * not part of the public API.\n */\nexport function watchWithWriteFilter(\n options: WatchOptions,\n shouldWrite: (result: CompileResult) => boolean,\n hooks: WatchHooks = {},\n): AbortController {\n validateCompileOptions(options, ['sources', 'outFile']);\n const written = toBuildOutputs(options.outFile);\n checkNamedInputs(namedInputs(options, hooks.extraInputs ?? []), outputPaths(written), []);\n checkFolderOutputs(options, written);\n\n const controller = new AbortController();\n const cache = new Map<string, FileCacheEntry>();\n // Every build runs with the controller's signal, which the caller's own signal also aborts (below).\n const buildOptions: WatchOptions = { ...options, signal: controller.signal };\n\n // Separate file paths from inline sources\n const filePaths = options.sources.filter((s): s is string => typeof s === 'string');\n const modulePaths = options.modules ?? [];\n const headPaths = options.headFile ? [options.headFile] : [];\n const allPaths = [...filePaths, ...modulePaths, ...headPaths];\n\n // A change to an excluded source builds nothing. `exclude` leaves modules and the\n // head file alone, so a module (or a file in a module folder) or the head file\n // still rebuilds when a glob matches it.\n const exclude = options.exclude ?? [];\n const notExcludable = [...modulePaths, ...headPaths].map((p) => identify(p).key);\n const ignore = (filename: string): boolean => {\n if (!isExcluded(filename, exclude)) return false;\n const { key } = identify(filename);\n return !notExcludable.some((root) => isKeyInside(key, root, sep));\n };\n\n // One build at a time. Changes reported while a build is in flight wait in `queued` and go\n // into a single follow-up build once it finishes. Every finished build is delivered first:\n // it can't be older than what was delivered before it, and delivering each one means a\n // steady stream of changes still produces regular output and reports.\n let building = false;\n let queued: WatchBuildRequest | undefined;\n\n // onError is the last place an error can go; an exception from it is reported to the\n // console instead, so that it never ends the watch as an unhandled rejection.\n const reportError = (error: Error): void => {\n try {\n options.onError?.(error);\n } catch (e) {\n console.error(`twee-ts watch: onError threw while handling \"${error.message}\": ${toError(e).message}`);\n }\n };\n\n const deliver = (outcome: WatchBuildOutcome): void => {\n try {\n if (!outcome.ok) throw outcome.error;\n if (shouldWrite(outcome.result)) writeFileAtomic(options.outFile, outcome.result.output);\n options.onBuild?.(outcome.result);\n } catch (e) {\n reportError(toError(e));\n // An error no edit to the sources can fix (FS-13): stop, as Tweego does.\n if (isConfigurationError(e)) controller.abort(e);\n }\n };\n\n // Runs `first`, then the follow-up for whatever was queued meanwhile, until nothing is.\n // `building` is cleared in the same step as the last delivery, so a change reported\n // right after it starts a new build rather than waiting in `queued`.\n const drain = async (first: WatchBuildRequest): Promise<void> => {\n building = true;\n try {\n let request: WatchBuildRequest | undefined = first;\n while (request !== undefined) {\n let found: readonly DiscoveredFile[] = [];\n const outcome = await buildOutput(buildOptions, {\n cache,\n changedFiles: request.changedFiles,\n outputs: options.outFile,\n extraInputs: hooks.extraInputs ?? [],\n onDiscovered: (files) => {\n found = files;\n },\n }).then(\n (result): WatchBuildOutcome => ({ ok: true, result }),\n (e: unknown): WatchBuildOutcome => ({ ok: false, error: toError(e) }),\n );\n if (controller.signal.aborted) return;\n handle.track(found);\n deliver(outcome);\n request = queued;\n queued = undefined;\n }\n } finally {\n building = false;\n hooks.onIdle?.();\n }\n };\n\n const handle = watchFilesystem(\n allPaths,\n options.outFile,\n (changedFiles) => {\n if (controller.signal.aborted) return;\n const request: WatchBuildRequest = { changedFiles };\n if (building) {\n queued = queued === undefined ? request : mergeBuildRequests(queued, request);\n return;\n }\n drain(request).catch((e: unknown) => {\n reportError(toError(e));\n });\n },\n ignore,\n reportError,\n hooks.timing,\n hooks.stream,\n );\n\n const outer = options.signal;\n const onOuterAbort = (): void => {\n controller.abort(outer?.reason);\n };\n controller.signal.addEventListener('abort', () => {\n queued = undefined;\n handle.close();\n outer?.removeEventListener('abort', onOuterAbort);\n });\n if (outer?.aborted) onOuterAbort();\n else outer?.addEventListener('abort', onOuterAbort, { once: true });\n return controller;\n}\n\n/** Internal hooks into watchWithWriteFilter(); not part of the public API. */\nexport interface WatchHooks {\n /**\n * Called each time the watch's builds have run out: the last one was delivered or, after\n * an abort, dropped, and none is in flight. Lets a test wait for a build to finish when\n * nothing it does shows.\n */\n readonly onIdle?: () => void;\n /** How long to wait for changes to settle (see watchFilesystem); tests shorten it. */\n readonly timing?: WatchTiming;\n /** Whether folder watches share one event stream (see watchFilesystem); tests set it. */\n readonly stream?: FolderStream;\n /** Inputs besides the compile options' own (the CLI's config file), which the output must not overwrite. */\n readonly extraInputs?: readonly ExtraInput[];\n}\n\n/** A watch-mode build: the files that changed, or `undefined` for a full build. */\ninterface WatchBuildRequest {\n readonly changedFiles: ReadonlySet<string> | undefined;\n}\n\ntype WatchBuildOutcome =\n { readonly ok: true; readonly result: CompileResult } | { readonly ok: false; readonly error: Error };\n\n/** One build covering both requests: a full build if either is one, else every changed file. */\nfunction mergeBuildRequests(a: WatchBuildRequest, b: WatchBuildRequest): WatchBuildRequest {\n if (a.changedFiles === undefined || b.changedFiles === undefined) return { changedFiles: undefined };\n return { changedFiles: new Set([...a.changedFiles, ...b.changedFiles]) };\n}\n\nfunction toError(e: unknown): Error {\n return e instanceof Error ? e : new Error(String(e));\n}\n\n/** An input the output must not overwrite, named by the user. */\ninterface NamedInput {\n readonly role: 'source' | 'module' | 'head' | 'config' | 'story format';\n readonly path: string;\n}\n\n/** Every input named in `options` (and `extra`), whatever the output mode. */\nfunction namedInputs(options: CompileOptions, extra: readonly ExtraInput[]): NamedInput[] {\n return [\n ...options.sources\n .filter((s): s is string => typeof s === 'string')\n .map((path) => ({ role: 'source' as const, path })),\n ...(options.modules ?? []).map((path) => ({ role: 'module' as const, path })),\n ...(options.headFile ? [{ role: 'head' as const, path: options.headFile }] : []),\n ...extra,\n ];\n}\n\n/** The TweeTsError for an output that would overwrite `input`. */\nfunction outputIsInput(input: NamedInput, diagnostics: readonly Diagnostic[], detail = ''): TweeTsError {\n const role = input.role === 'source' ? '' : ` (the ${input.role === 'head' ? 'head file' : input.role})`;\n return new TweeTsError(\n `path ${input.path}: Output file cannot be an input source${role}.${detail}`,\n [...diagnostics],\n {\n code: 'OUTPUT_IS_INPUT',\n },\n );\n}\n\n/**\n * The one output-safety check for inputs named directly, run before the output mode is looked at, so it\n * holds for every mode and every role: a source, module, head file or config file (or, once it is known,\n * a story format file) that is an output file (the same file by identity, or a hard link to it) is a\n * TweeTsError, as in Tweego. Writing the build would overwrite it. A folder that holds an output is\n * walked instead, and the output inside it left out (see checkSkippedOutputs).\n */\nfunction checkNamedInputs(\n inputs: readonly NamedInput[],\n output: OutputPaths,\n diagnostics: readonly Diagnostic[],\n): void {\n const overlap = inputs.find((input) => output.isFile(input.path));\n if (overlap !== undefined) throw outputIsInput(overlap, diagnostics);\n}\n\n/**\n * The output-safety check for output files found while walking a source or module folder, which are\n * left out of the inputs. Writing over one is fine when it is a previous build, or a file the walk\n * would not load anyway; but an existing file of a type the folder's role loads, which twee-ts did not\n * build, is the author's own file (FS-07): a TweeTsError, unless an exclude glob leaves it out.\n */\nfunction checkSkippedOutputs(\n skipped: readonly SkippedOutput[],\n role: 'source' | 'module',\n diagnostics: readonly Diagnostic[],\n only?: OutputPaths,\n): void {\n for (const output of skipped) {\n if (only !== undefined && !only.isFile(output.path)) continue;\n if (!isLoadableType(output.path, role) || isOwnOutput(output.path) || isPreviousBuild(output.path)) continue;\n throw outputIsInput(\n { role, path: output.path },\n diagnostics,\n ` It is a ${role} file inside the ${role} folder ${output.folder}, and not an earlier build. Move the output out of the folder, or exclude the file.`,\n );\n }\n}\n\n/**\n * The output-safety check for an output inside a source or module folder (see checkSkippedOutputs), which a\n * watch makes before it watches anything, as its first build would: the error is then the rejection of watch(),\n * not one that stops the watch silently when there is no `onError` (#363).\n */\nfunction checkFolderOutputs(options: CompileOptions, written: BuildOutputs): void {\n const sources = options.sources.filter((s): s is string => typeof s === 'string');\n checkSkippedOutputs(getFilenames(sources, written, options.exclude).skippedOutputs, 'source', []);\n checkSkippedOutputs(getFilenames(options.modules ?? [], written, [], 'module').skippedOutputs, 'module', []);\n}\n\n/** The files a story format reads, which the output must not overwrite. */\nfunction formatInputs(format: StoryFormatInfo): NamedInput[] {\n if (format.isTwine2) return [{ role: 'story format', path: format.filename }];\n // A Twine 1 format reads its components from its own folder and the one above it (see output-twine1.ts).\n const formatDir = dirname(format.filename);\n const parentDir = dirname(formatDir);\n return [\n format.filename,\n join(formatDir, 'userlib.js'),\n join(formatDir, 'code.js'),\n join(formatDir, 'footer.html'),\n join(parentDir, 'engine.js'),\n join(parentDir, 'jquery.js'),\n join(parentDir, 'modernizr.js'),\n ].map((path) => ({ role: 'story format', path }));\n}\n\n/** Throws the TweeTsError a fatal input problem calls for. */\nfunction fatalInput(problem: InputProblem, diagnostics: readonly Diagnostic[]): TweeTsError {\n return new TweeTsError(problem.message, [...diagnostics], { code: 'INPUT_UNAVAILABLE', cause: problem.cause });\n}\n\n/**\n * The head file's text, trimmed. Any failure to read it is fatal, as in Tweego (`modifyHead`): the output\n * would silently lack what the author put in the head.\n */\nfunction readHeadFile(path: string, diagnostics: Diagnostic[]): string {\n let text: string;\n try {\n text = readUTF8(path, diagnostics).trim();\n } catch (e) {\n throw fatalInput(inputProblem('head', 'named', failureOfRead(path, e), path, e), diagnostics);\n }\n checkInsertedText(diagnostics, `The head file \"${path}\"`, text);\n return text;\n}\n\n/**\n * The module tags for the head, each module read on its own so a failure names its file, and the modules loaded\n * (Tweego's \"External files\"). A module that can't be read is reported as the input policy says (an error) and\n * left out, and so is one of a type modules don't load; a module given again, under this or another spelling, is\n * skipped with a warning, as a source is.\n */\nfunction moduleTags(\n files: readonly DiscoveredFile[],\n diagnostics: Diagnostic[],\n): { readonly tags: string; readonly loaded: readonly string[] } {\n const seen = new Map<string, string>();\n const tags: string[] = [];\n const loaded: string[] = [];\n // One id namespace for the page, kept across the single-module loads below.\n const idFor = moduleIds(diagnostics);\n for (const file of files) {\n const earlier = seen.get(file.key);\n if (earlier !== undefined) {\n diagnostics.push(duplicateInput('module', file.path, earlier));\n continue;\n }\n if (!isLoadableType(file.path, 'module')) {\n const diagnostic = problemDiagnostic(\n inputProblem('module', file.discovery, 'unsupported-type', file.path, undefined),\n );\n if (diagnostic) diagnostics.push(diagnostic);\n continue;\n }\n try {\n const tag = loadHeadContent([file.path], undefined, diagnostics, idFor);\n if (tag.length > 0) tags.push(tag);\n } catch (e) {\n const diagnostic = problemDiagnostic(\n inputProblem('module', file.discovery, failureOfRead(file.path, e), file.path, e),\n );\n if (diagnostic) diagnostics.push(diagnostic);\n continue;\n }\n // Only a module that loaded counts as given: one that failed is tried, and reported, again (as a source is).\n seen.set(file.key, file.path);\n loaded.push(file.path);\n }\n return { tags: tags.join('\\n'), loaded };\n}\n\n/**\n * The content HTML output injects into the head (the module tags, then the head file) and what went into it, the\n * modules that loaded and the head file, as Tweego lists them. Adds what reading them reports to `diagnostics`;\n * a head file that can't be read is fatal (see `readHeadFile()`).\n */\nfunction headContent(\n modules: FilenamesResult,\n headFile: string | undefined,\n diagnostics: Diagnostic[],\n): { readonly head: string; readonly injected: string[] } {\n pushAll(diagnostics, modules.diagnostics);\n const tags = moduleTags(modules.files, diagnostics);\n const head = [tags.tags, headFile ? readHeadFile(headFile, diagnostics) : '']\n .filter((part) => part.length > 0)\n .join('\\n');\n return { head, injected: [...tags.loaded, ...(headFile ? [identify(headFile).display] : [])] };\n}\n\n/**\n * `outputs`: what the build writes (an output file's path, or a bundler's outputs),\n * which source and module discovery skip, so an output inside a source folder is\n * never loaded back. The output-safety checks run before any input is read and before\n * the output mode matters: see checkNamedInputs and checkSkippedOutputs.\n */\nasync function buildOutput(options: CompileOptions, context: BuildContext): Promise<CompileResult> {\n try {\n return await runBuild(options, context);\n } catch (e) {\n throw resourceLimitError(e) ?? e;\n }\n}\n\n/**\n * A TweeTsError that says which limit of the JavaScript engine a build reached, for the engine's own error (a\n * `RangeError` such as \"Invalid string length\"), or `undefined` for any other error.\n */\nexport function resourceLimitError(e: unknown): TweeTsError | undefined {\n if (!(e instanceof RangeError)) return undefined;\n const limit = ENGINE_LIMITS.find(({ pattern }) => pattern.test(e.message));\n if (limit === undefined) return undefined;\n return new TweeTsError(`The build stopped at a limit of the JavaScript engine: ${limit.what}.`, [], {\n code: 'BUILD_FAILED',\n cause: e,\n });\n}\n\n/** The engine's messages (V8, SpiderMonkey) for the limits a large input can reach, and what each one means. */\nconst ENGINE_LIMITS: readonly { readonly pattern: RegExp; readonly what: string }[] = [\n {\n pattern: /\\bInvalid string length\\b|\\bstring (?:is )?too (?:long|large)\\b|\\ballocation size overflow\\b/i,\n what: `a text it builds would be longer than a string can be (${String(MAX_STRING_LENGTH)} characters); the story or its output is too large`,\n },\n {\n pattern: /\\bInvalid (?:typed )?array length\\b|\\bArray buffer allocation failed\\b/i,\n what: 'a list it builds would be longer than an array can be; the story is too large',\n },\n {\n pattern: /\\bstack\\b.*\\b(?:exceeded|overflow)\\b|\\btoo much recursion\\b/i,\n what: 'it ran out of call stack space, which twee-ts should never do: please report it with the input that caused it',\n },\n];\n\nasync function runBuild(options: CompileOptions, context: BuildContext): Promise<CompileResult> {\n validateCompileOptions(options, ['sources']);\n const { cache, changedFiles, outputs, extraInputs = [] } = context;\n const written = toBuildOutputs(outputs);\n const outputGuard = outputPaths(written);\n // The story file a user named (CLI, compileToFile, watch). A bundler's outputs are its own: it writes\n // over its chunks and assets in a source folder on every build, so for it only named inputs and its story\n // (`BuildOutputs.stories`) are checked.\n const namedOutput = typeof outputs === 'string';\n // What is checked in a source or module folder: every output file of a named output; of a bundler's, only its\n // story (when the caller says it writes one).\n const stories = outputPaths({ files: written.stories ?? [], dirs: [] });\n const guardsFolders = namedOutput || (written.stories?.length ?? 0) > 0;\n const guarded = namedOutput ? undefined : stories;\n const diagnostics: Diagnostic[] = [];\n const outputMode: OutputMode = options.outputMode ?? 'html';\n const trim = options.trim ?? true;\n const twee2Compat = options.twee2Compat ?? false;\n const testMode = options.testMode ?? false;\n const noRemote = options.noRemote ?? false;\n const sourceInfo = options.sourceInfo ?? false;\n\n options.signal?.throwIfAborted();\n pushAll(diagnostics, unknownOptionWarnings(options));\n checkNamedInputs(namedInputs(options, extraInputs), outputGuard, diagnostics);\n\n // Clear per-compile index cache\n clearIndexCache();\n\n // Group the sources in the order supplied: each run of file paths is walked (directories\n // expanded in place) and each run of inline sources is kept together, so a later source\n // overrides an earlier one whatever kind each is.\n const groups: SourceGroup[] = [];\n for (const source of options.sources) {\n const last = groups[groups.length - 1];\n if (typeof source === 'string') {\n if (last?.kind === 'paths') last.paths.push(source);\n else groups.push({ kind: 'paths', paths: [source] });\n } else if (last?.kind === 'inline') {\n last.sources.push(source);\n } else {\n groups.push({ kind: 'inline', sources: [source] });\n }\n }\n\n const walked = groups.map((group) => {\n if (group.kind === 'inline') return group;\n const found = getFilenames(group.paths, written, options.exclude);\n pushAll(diagnostics, found.diagnostics);\n if (guardsFolders) checkSkippedOutputs(found.skippedOutputs, 'source', diagnostics, guarded);\n return { kind: 'files' as const, files: found.files };\n });\n // Modules are read for HTML output only, but checked in every mode.\n const modules = getFilenames(options.modules ?? [], written, [], 'module');\n if (guardsFolders) checkSkippedOutputs(modules.skippedOutputs, 'module', diagnostics, guarded);\n // Once the output is known to be no input, and before the work: a target that can't be written fails now.\n if (context.writesOutput === true && typeof outputs === 'string') checkWritable(outputs);\n context.onDiscovered?.([...walked.flatMap((group) => (group.kind === 'files' ? group.files : [])), ...modules.files]);\n // Every file of the build, so that a cache purge while loading one group keeps the others' entries.\n const buildFiles = new Set(walked.flatMap((group) => (group.kind === 'files' ? group.files.map((f) => f.path) : [])));\n\n // Create story and load sources\n const story = createStory();\n const processedFiles = new Set<string>();\n\n for (const group of walked) {\n if (group.kind === 'inline') {\n loadInlineSources(story, group.sources, { trim, twee2Compat }, diagnostics);\n } else if (cache) {\n loadSourcesCached(\n story,\n group.files,\n { trim, twee2Compat },\n diagnostics,\n processedFiles,\n cache,\n changedFiles,\n buildFiles,\n );\n } else {\n loadSources(story, group.files, { trim, twee2Compat }, diagnostics, processedFiles);\n }\n }\n if (cache && buildFiles.size === 0) {\n loadSourcesCached(story, [], { trim, twee2Compat }, diagnostics, processedFiles, cache, changedFiles);\n }\n\n // Apply tag aliases (e.g. library → script)\n if (options.tagAliases) {\n story.passages = applyTagAliases(story.passages, options.tagAliases);\n }\n\n // Resolve format: explicit formatId > StoryData format > default, looked up locally,\n // in the download cache, then remotely. An unavailable request is an error, never another format.\n let format: StoryFormatInfo | undefined;\n\n if (outputMode === 'html') {\n const request = formatRequestFor(\n options.formatId,\n story.twine2.format,\n story.twine2.formatVersion,\n DEFAULT_FORMAT_ID,\n );\n format = await resolveStoryFormat(request, { ...options, noRemote }, diagnostics);\n // The caller may have aborted while the format was being found.\n options.signal?.throwIfAborted();\n if (format) checkNamedInputs(formatInputs(format), outputGuard, diagnostics);\n }\n\n // Merge config from StoryData: command-line > StoryData > default.\n // An explicit override is recorded on the story so JSON output and inspection see it too.\n if (options.startPassage) story.twine2.start = options.startPassage;\n const startName = story.twine2.start || DEFAULT_START_NAME;\n\n // Apply test mode\n if (testMode) {\n story.twine2.options.set('debug', true);\n }\n\n // The Twine 2 story data carries the IFID; the other outputs write it when the story has one (as Tweego does).\n if (requiresIFID(outputMode, format)) ensureIFID(story, diagnostics);\n\n // Generate output\n let output: string;\n let externalFiles: string[] | undefined;\n\n switch (outputMode) {\n case 'twee3':\n case 'twee1':\n // Without a StoryData passage, add one only to record what the options changed.\n output = toTwee(story, outputMode, { addStoryData: Boolean(options.startPassage) || testMode, diagnostics });\n break;\n\n case 'twine2-archive':\n output = toTwine2Archive(story, startName, { sourceInfo, diagnostics });\n break;\n\n case 'twine1-archive':\n output = toTwine1Archive(story, startName, { diagnostics });\n break;\n\n case 'json':\n output = storyToJSON(story, startName, diagnostics, context.omitStyleImports !== true);\n break;\n\n case 'html': {\n // Sanity checks for HTML mode\n pushAll(diagnostics, startPassageDiagnostics(story, startName, format?.isTwine2 === false ? 'twine1' : 'twine2'));\n\n if (!format) {\n throw new TweeTsError('No story format available for HTML output.', diagnostics);\n }\n\n // A story without a name cannot start in SugarCube, and Twine 1 reads its name from the StoryTitle passage.\n pushAll(diagnostics, storyTitleDiagnostics(story, format.isTwine2 ? 'twine2' : 'twine1'));\n\n // Modules and head file, injected before the template's closing head tag while the template is filled\n const { head, injected } = headContent(modules, options.headFile, diagnostics);\n externalFiles = injected;\n\n output = format.isTwine2\n ? toTwine2HTML(story, format, startName, { sourceInfo, head, diagnostics })\n : toTwine1HTML(story, format, startName, { head, diagnostics });\n break;\n }\n\n default: {\n const _exhaustive: never = outputMode;\n throw new TweeTsError(`Unhandled output mode: ${_exhaustive}`, diagnostics);\n }\n }\n // Lint reads the modules and head file as HTML output does, for what HTML output would report about them.\n if (context.checkHead === true && outputMode !== 'html') headContent(modules, options.headFile, diagnostics);\n\n // Compute stats\n const stats: CompileStats = {\n ...getStoryStats(story, options.wordCountMethod, diagnostics),\n files: [...processedFiles],\n ...(externalFiles === undefined ? {} : { externalFiles }),\n };\n\n // Nothing is delivered, or written by the caller, for a build that was aborted meanwhile.\n options.signal?.throwIfAborted();\n // The output may have been moved (a link retargeted) while the build awaited a format: the file it will be\n // written to is checked again, against every input, as the last step before the caller writes it.\n if (namedOutput) {\n checkNamedInputs(\n [\n ...namedInputs(options, extraInputs),\n ...(format ? formatInputs(format) : []),\n ...walked\n .flatMap((group) => (group.kind === 'files' ? group.files : []))\n .map((file) => ({ role: 'source' as const, path: file.path })),\n ...modules.files.map((file) => ({ role: 'module' as const, path: file.path })),\n ],\n outputPaths(written),\n diagnostics,\n );\n }\n // The same holds for an output that became an authored file of a source or module folder while the build awaited\n // a format (edited, or created at a path nothing was at): the folders are walked again for what they now skip.\n if (guardsFolders && outputMode === 'html') {\n for (const group of groups) {\n if (group.kind === 'paths') {\n checkSkippedOutputs(\n getFilenames(group.paths, written, options.exclude).skippedOutputs,\n 'source',\n diagnostics,\n guarded,\n );\n }\n }\n checkSkippedOutputs(\n getFilenames(options.modules ?? [], written, [], 'module').skippedOutputs,\n 'module',\n diagnostics,\n guarded,\n );\n }\n // The story handed out is a frozen copy: it shares no object with the incremental cache (#246 S-4).\n return { output: output, story: snapshot(story), format, diagnostics, stats };\n}\n\n/** How a build runs, beyond its options: what buildOutput() is called with by each entry point. */\ninterface BuildContext {\n /** Cache files as compileIncremental() caches them. */\n readonly cache?: Map<string, FileCacheEntry> | undefined;\n /** The files known to have changed since the last build with `cache`. */\n readonly changedFiles?: ReadonlySet<string> | undefined;\n /** What the build writes, which no input may be (see checkNamedInputs). */\n readonly outputs?: BuildOutputs | string | undefined;\n /** Inputs besides the options' own (the CLI's config file). */\n readonly extraInputs?: readonly ExtraInput[];\n /** Receives every source and module file the build found, before any is read (for the watcher). */\n readonly onDiscovered?: (files: readonly DiscoveredFile[]) => void;\n /** Read the modules and head file as HTML output does, whatever the output mode (for lint). */\n readonly checkHead?: boolean;\n /**\n * Leave out the warnings about `@import` rules that JSON output's stylesheet makes ineffective (for lint, which\n * reports those of the Twine 2 HTML output's stylesheet instead).\n */\n readonly omitStyleImports?: boolean;\n /**\n * Whether the output file named in `outputs` is written after the build: it is then checked to be writable\n * (see checkWritable) once the inputs are checked and before any is read, so a missing folder or a read-only\n * file fails before the work.\n */\n readonly writesOutput?: boolean;\n}\n\n/** A run of sources of one kind, in the order supplied. */\ntype SourceGroup =\n { readonly kind: 'paths'; readonly paths: string[] } | { readonly kind: 'inline'; readonly sources: InlineSource[] };\n\n/**\n * Whether the output needs an IFID: Twine 2 HTML and the Twine 2 archive, whose `tw-storydata` element has an `ifid`\n * attribute that Twine 2 requires, as Tweego requires it. Twine 1 HTML and archives, Twee and JSON (where `ifid` is\n * optional) are written without one when the story has none. HTML output with no format fails anyway.\n */\nfunction requiresIFID(outputMode: OutputMode, format: StoryFormatInfo | undefined): boolean {\n switch (outputMode) {\n case 'html':\n return format?.isTwine2 !== false;\n case 'twine2-archive':\n return true;\n case 'twine1-archive':\n case 'twee3':\n case 'twee1':\n case 'json':\n return false;\n default: {\n const _exhaustive: never = outputMode;\n throw new TweeTsError(`Unhandled output mode: ${String(_exhaustive)}`, []);\n }\n }\n}\n\n/** Give the story an IFID for output that requires one: the legacy IFID, else a generated one, reported. */\nfunction ensureIFID(story: Story, diagnostics: Diagnostic[]): void {\n if (story.ifid !== '') return;\n\n if (story.legacyIFID !== '') {\n story.ifid = story.legacyIFID;\n diagnostics.push({\n level: 'warning',\n message: 'Story IFID not found; reusing \"ifid\" entry from the \"StorySettings\" special passage.',\n });\n } else {\n const ifid = generateIFID();\n story.ifid = ifid;\n diagnostics.push({\n level: 'error',\n message: `Story IFID not found. Add an IFID to your story: {\"ifid\":\"${ifid}\"}`,\n });\n }\n}\n\n/**\n * Serialize a Story to JSON per the Twine 2 JSON Output Specification (v1.0):\n * https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-jsonoutput-doc.md\n * `start` is the start passage the other output modes use (`startName`): the one StoryData or the options name,\n * else the default `Start` when the JSON lists a passage of that name. `tag-colors` holds the tag colors Twine 2\n * output writes; `diagnostics` receives a warning for each color left out (see `twine2TagColors()`), and for each\n * `@import` that the `style` joined here makes ineffective unless `reportStyleImports` is false (lint, which reports\n * those of the Twine 2 HTML output's join instead).\n */\nfunction storyToJSON(story: Story, startName: string, diagnostics: Diagnostic[], reportStyleImports: boolean): string {\n // Gather script and stylesheet content, excluding them from passages.\n const scripts: string[] = [];\n const stylesheets: StylesheetSource[] = [];\n const storyPassages: { name: string; tags: string[]; text: string; metadata?: Record<string, string> }[] = [];\n\n for (const p of story.passages) {\n if (p.name === 'StoryTitle' || p.name === 'StoryData') continue;\n if (hasTag(p, 'Twine.private')) continue;\n\n if (hasTag(p, 'script')) {\n scripts.push(p.text);\n } else if (hasTag(p, 'stylesheet')) {\n stylesheets.push({ label: `Stylesheet passage \"${p.name}\"`, text: p.text });\n } else {\n const entry: { name: string; tags: string[]; text: string; metadata?: Record<string, string> } = {\n name: p.name,\n tags: p.tags,\n text: p.text,\n };\n // Own properties, so a key such as `__proto__` is kept.\n const metadata = metadataForOutput(p.metadata);\n if (metadata !== undefined) entry.metadata = metadata;\n storyPassages.push(entry);\n }\n }\n\n const tagColors = twine2TagColors(story);\n pushAll(diagnostics, tagColors.diagnostics);\n const style = joinWithLineFeeds(stylesheets);\n if (reportStyleImports) pushAll(diagnostics, ineffectiveImportDiagnostics(stylesheets, style));\n const start = story.twine2.start !== '' || storyPassages.some((p) => p.name === startName) ? startName : '';\n // Keys in the order the JSON output lists them; optional ones only when set.\n const obj = {\n name: story.name,\n ...(story.ifid ? { ifid: story.ifid } : {}),\n ...(story.twine2.format ? { format: story.twine2.format } : {}),\n ...(story.twine2.formatVersion ? { 'format-version': story.twine2.formatVersion } : {}),\n ...(start ? { start } : {}),\n ...(tagColors.colors.length > 0 ? { 'tag-colors': Object.fromEntries(tagColors.colors) } : {}),\n ...(story.twine2.zoom !== 1 ? { zoom: story.twine2.zoom } : {}),\n creator: CREATOR_NAME,\n 'creator-version': VERSION,\n style: style.text,\n script: scripts.map((text, i) => (i < scripts.length - 1 ? terminateScript(text) : text)).join(''),\n passages: storyPassages,\n };\n\n return JSON.stringify(obj, null, 2);\n}\n","/**\n * A diagnostic as one line of text, for the places that print them: the command line, the lint report and the\n * build plugins. Depends on nothing else in twee-ts but the Diagnostic type.\n */\nimport type { Diagnostic } from './types.js';\n\n/**\n * The message with where it happened in front: `file:line: message`, or `file: message` when no line is known.\n * The parser starts its messages with \"line N: \"; the location already says it. A message that already\n * names the file as its location (`load a.tw: line 3: …`, `read a.tw: …`, `path a.tw: …`) is given as it is, and so\n * is one without a file. A file named in passing (\"It replaces the one from a.tw (line 7)\") is not a location.\n */\nexport function formatDiagnostic(d: Readonly<Diagnostic>): string {\n if (!d.file || d.message.includes(`${d.file}:`)) return d.message;\n if (!d.line) return `${d.file}: ${d.message}`;\n return `${d.file}:${d.line}: ${d.message.replace(/^line \\d+: /, '')}`;\n}\n"],"ignoreList":[6,10,11,12,13,14,15,16,17,18,19,20,21,22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