diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4c39d117..b278d5ee4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,10 +11,11 @@ jobs: - name: checkout uses: actions/checkout@main - - name: build - run: | - npm ci - npm run build + - run: npm ci + + - run: cp -rf patches/shiki-twoslash/* node_modules/shiki-twoslash/dist/ + + - run: npm run build - name: deploy uses: JamesIves/github-pages-deploy-action@v4 diff --git a/patches/shiki-twoslash/shiki-twoslash.cjs.development.js b/patches/shiki-twoslash/shiki-twoslash.cjs.development.js new file mode 100644 index 000000000..4beefd158 --- /dev/null +++ b/patches/shiki-twoslash/shiki-twoslash.cjs.development.js @@ -0,0 +1,791 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var shiki = require('shiki'); +var shiki__default = _interopDefault(shiki); +var twoslash = require('@typescript/twoslash'); + +function _extends() { + return _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); + } + return n; + }, _extends.apply(null, arguments); +} + +var htmlForTags = function htmlForTags(tags) { + var html = ""; + tags.forEach(function (t) { + if (t.name === "annotate" && t.annotation) { + var meta = t.annotation.split(" - "); + var text = meta.pop(); + var info = (meta[0] || "").trim(); + var flipped = info.includes("right"); + var settings = { + flipped: flipped, + arrowRot: flipped ? "90deg 20px 20px" : "90deg 20px 20px", + textDegree: "0deg", + top: t.line + "em" + }; + if (info.includes("{")) { + var theInfo = "{" + info.split("{")[1]; + try { + var specificSettings = JSON.parse(theInfo); + settings = _extends({}, settings, specificSettings); + } catch (error) { + throw new twoslash.TwoslashError("Could not parse annotation", "The annotation " + JSON.stringify(t) + " could convert '" + theInfo + "' into JSON", "Look at " + error.message + "."); + } + } + var arrowSVG = arrow(settings); + html += "\n
\n " + arrowSVG + "\n

" + text + "

\n
"; + } + }); + return html; +}; +var arrow = function arrow(style) { + var leftInner = "M27 39C26.5 32.7511 21.9 17.5173 7.5 6.57333M16.5 4.04L0.999999 0.999998C3.16667 4.88444 7.5 13.16 7.5 15.1867"; + var rightInner = "M1 39C1.5 32.7511 6.1 17.5173 20.5 6.57333M11.5 4.04L27 0.999998C24.8333 4.88444 20.5 13.16 20.5 15.1867"; + var inner = style.flipped ? leftInner : rightInner; + var rot = style.arrowRot.split(" "); + return "\n \n"; +}; + +/** + * We're given the text which lives inside the token, and this function will + * annotate it with twoslash metadata + */ +function createHighlightedString(ranges, text, targetedWord) { + if (targetedWord === void 0) { + targetedWord = ""; + } + // Why the weird chars? We need to make sure that generic syntax isn't + // interpreted as html tags - to do that we need to switch out < to < - *but* + // making that transition changes the indexes because it's gone from 1 char to 4 chars + // + // So, use an obscure character to indicate a real < for HTML, then switch it after + var tag = function tag(x) { + return "\u21CD" + x + "\u21CF"; + }; + var makeTagFromRange = function makeTagFromRange(r, close) { + switch (r.classes) { + case "lsp": + // The LSP response lives inside a dom attribute, which _can_ have < inside it, so switch them ahead of time. + var lsp = htmlAttrReplacer(r.lsp || ""); + var underLineTargetedWord = r.lsp === targetedWord ? "style=⇯border-bottom: solid 2px lightgrey;⇯" : ""; + return close ? tag("/data-lsp") : tag("data-lsp lsp=\xBF" + lsp + "\xBF " + underLineTargetedWord); + case "query": + return tag((close ? "/" : "") + "data-highlight"); + // handle both unknown and err variant as error-tag + // case "err": is not required, just to be useful for others + case "err": + default: + return tag((close ? "/" : "") + "data-err"); + } + }; + ranges.sort(function (a, b) { + // Order of precedence + // if two same offset meet, the lsp will be put as innermost than err and query + var precedenceOf = function precedenceOf(x) { + return ["err", "query", "lsp"].indexOf(x != null ? x : ""); + }; + var cmp = 0; + // Can be desugared into, + // 1. compare based on smaller begin, !(cmp) means if it's 0 then + // 2. compare based on bigger end, ^ same thing again then + // 3. compare based on higher precedence + // && is so that if a step made cmp to something other than 0, it stops + /***1*/ + !(cmp = a.begin - b.begin) && /*2*/!(cmp = b.end - a.end) && /*3*/!(cmp = precedenceOf(a.classes) - precedenceOf(b.classes)); + return cmp; + }); // `Array.sort` works in place + // Marks how much of the text has been put into the output/html + var cursor = 0; + // should be maximum of O(n) where n is length of ranges + var _nest = function nest(data) { + var stack = ""; + var top = data.shift(); // I have made sure data can't be empty + // parse from cursor to top.begin to make sure + // strings on the way are parsed + stack += text.substring(cursor, top.begin); + cursor = top.begin; + // open tag + stack += makeTagFromRange(top); + // if the data still have an element that's in the top's range + if (data.some(function (x) { + return x.begin < top.end; + })) { + stack += _nest(data); + } else { + // othewise slice the text and set cursor + stack += text.substring(top.begin, top.end); + cursor = top.end; + } + // close tag + stack += makeTagFromRange(top, true); + // if the tag is complete but still have some data left in the range + if (data.length !== 0) { + stack += _nest(data); + } + return stack; + }; + // cloned because I don't feel comfortable modifying this as a side-effect from recursion + var data = JSON.parse(JSON.stringify(ranges)); + var html = _nest(data) + text.substring(cursor); // nested + leftover texts + return htmlAttrUnReplacer(replaceTripleArrow(stripHTML(html))); +} +// HTML attributes have different rules, +var htmlAttrReplacer = function htmlAttrReplacer(str) { + return str.replace(/"/g, "⃟"); +}; +var htmlAttrUnReplacer = function htmlAttrUnReplacer(str) { + return str.replace(/⃟/g, '"'); +}; +// Inline strings which are shown at HTML level +var subTripleArrow = function subTripleArrow(str) { + return str.replace(//g, "⇏").replace(/'/g, "⇯"); +}; +var replaceTripleArrow = function replaceTripleArrow(str) { + return str.replace(/⇍/g, "<").replace(/⇏/g, ">").replace(/⇯/g, "'").replace(/¿/g, "'"); +}; +var replaceTripleArrowEncoded = function replaceTripleArrowEncoded(str) { + return str.replace(/⇍/g, "<").replace(/⇏/g, ">").replace(/⇯/g, "'"); +}; +function stripHTML(text) { + var table = { + "<": "lt", + '"': "quot", + "'": "apos", + "&": "amp", + "\r": "#13", + "\n": "#10" + }; + return text.toString().replace(/[<"'\r\n&]/g, function (chr) { + return "&" + table[chr] + ";"; + }); +} +function escapeHtml(html) { + return html.replace(//g, ">"); +} +/** Does anything in the object imply that we should highlight any lines? */ +var shouldBeHighlightable = function shouldBeHighlightable(highlight) { + return !!Object.keys(highlight || {}).find(function (key) { + if (key.includes("-")) return true; + if (!isNaN(parseInt(key))) return true; + return false; + }); +}; +/** Returns a func for figuring out if this line should be highlighted */ +var shouldHighlightLine = function shouldHighlightLine(highlight) { + var lines = []; + Object.keys(highlight || {}).find(function (key) { + if (!isNaN(parseInt(key))) lines.push(parseInt(key)); + if (key.includes("-")) { + var _key$split = key.split("-"), + first = _key$split[0], + last = _key$split[1]; + var lastIndex = parseInt(last) + 1; + for (var i = parseInt(first); i < lastIndex; i++) { + lines.push(i); + } + } + }); + return function (line) { + return lines.includes(line); + }; +}; + +/** A func for setting a consistent
 */
+var preOpenerFromRenderingOptsWithExtras = function preOpenerFromRenderingOptsWithExtras(opts, meta, classes) {
+  var bg = opts.bg || "#fff";
+  var fg = opts.fg || "black";
+  var theme = opts.themeName || "";
+  // shiki + `class` from fence + with-title if title exists + classes
+  var classList = ["shiki", theme, meta["class"], meta.title ? "with-title" : ""].concat(classes || []).filter(Boolean).join(" ").trim();
+  var attributes = Object.entries(meta).filter(function (entry) {
+    // exclude types other than string, number, boolean
+    // exclude keys class, twoslash
+    // exclude falsy booleans
+    return ["string", "number", "boolean"].includes(typeof entry[1]) && !["class", "twoslash"].includes(entry[0]) && entry[1] !== false;
+  }).map(function (_ref) {
+    var key = _ref[0],
+      value = _ref[1];
+    return key + "=\"" + value + "\"";
+  }).join(" ").trim();
+  // prettier-ignore
+  return "
";
+};
+/** You don't have a language which shiki twoslash can handle, make a DOM compatible version  */
+function plainTextRenderer(code, options, meta) {
+  var html = "";
+  html += preOpenerFromRenderingOptsWithExtras(options, meta, []);
+  if (meta.title) {
+    html += "
" + meta.title + "
"; + } + if (options.langId) { + html += "
" + options.langId + "
"; + } + html += "
"; + html += escapeHtml(code); + html = html.replace(/\n*$/, ""); // Get rid of final new lines + html += "
"; + return html; +} + +// OK, so - this is just straight up complex code. +// What we're trying to do is merge two sets of information into a single tree for HTML +// 1: Syntax highlight info from shiki +// 2: Twoslash metadata like errors, identifiers etc +// Because shiki gives use a set of lines to work from, then the first thing which happens +// is converting twoslash data into the same format. +// Things which make it hard: +// +// - Twoslash results can be cut, so sometimes there is edge cases between twoslash results +// - Twoslash results can be multi-file +// - the DOM requires a flattened graph of html elements (e.g. spans can' be interspersed) +// +function twoslashRenderer(lines, options, twoslash, meta) { + var html = ""; + var hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight); + var hl = shouldHighlightLine(meta.highlight); + if (twoslash.tags && twoslash.tags.length) html += "
"; + html += preOpenerFromRenderingOptsWithExtras(options, meta, ["twoslash", "lsp"]); + if (meta.title) { + html += "
" + meta.title + "
"; + } + if (options.langId) { + html += "
" + options.langId + "
"; + } + html += "
"; + var errorsGroupedByLine = groupBy(twoslash.errors, function (e) { + return e.line; + }) || new Map(); + var staticQuickInfosGroupedByLine = groupBy(twoslash.staticQuickInfos, function (q) { + return q.line; + }) || new Map(); + // A query is always about the line above it! + var queriesGroupedByLine = groupBy(twoslash.queries, function (q) { + return q.line - 1; + }) || new Map(); + var tagsGroupedByLine = groupBy(twoslash.tags, function (q) { + return q.line - 1; + }) || new Map(); + /** + * This is the index of the original twoslash code reference, it is not + * related to the HTML output + */ + var filePos = 0; + lines.forEach(function (l, i) { + var errors = errorsGroupedByLine.get(i) || []; + var lspValues = staticQuickInfosGroupedByLine.get(i) || []; + var queries = queriesGroupedByLine.get(i) || []; + var tags = tagsGroupedByLine.get(i) || []; + var hiClass = hasHighlight ? hl(i + 1) ? " highlight" : " dim" : ""; + var prefix = "
"; + if (l.length === 0 && i === 0) { + // Skip the first newline if it's blank + filePos += 1; + } else if (l.length === 0) { + var emptyLine = prefix + " 
"; + html += emptyLine; + filePos += 1; + } else { + html += prefix; + // Keep track of the position of the current token in a line so we can match it up to the + // errors and lang serv identifiers + var tokenPos = 0; + l.forEach(function (token) { + var targetedQueryWord; + var tokenContent = ""; + // Underlining particular words + var findTokenFunc = function findTokenFunc(start) { + return function (e) { + return start <= e.character && start + token.content.length >= e.character + e.length; + }; + }; + var errorsInToken = errors.filter(findTokenFunc(tokenPos)); + var lspResponsesInToken = lspValues.filter(findTokenFunc(tokenPos)); + var queriesInToken = queries.filter(findTokenFunc(tokenPos)); + // Does this line have a word targeted by a query? + targetedQueryWord = targetedQueryWord || lspResponsesInToken.find(function (response) { + return response.text === (queries.length && queries[0].text); + }); + var allTokens = [].concat(errorsInToken, lspResponsesInToken, queriesInToken); + var allTokensByStart = allTokens.sort(function (l, r) { + return (l.start || 0) - (r.start || 0); + }); + if (allTokensByStart.length) { + var _targetedQueryWord; + var ranges = allTokensByStart.map(function (token) { + var range = { + begin: token.start - filePos, + end: token.start + token.length - filePos + }; + if ("renderedMessage" in token) range.classes = "err"; + if ("kind" in token) range.classes = token.kind; + if ("targetString" in token) { + range.classes = "lsp"; + var lspText = options.includeJSDocInHover && token.docs ? token.docs + "\n\n" + token.text : token.text; + range["lsp"] = lspText; + } + return range; + }); + tokenContent += createHighlightedString(ranges, token.content, (_targetedQueryWord = targetedQueryWord) == null ? void 0 : _targetedQueryWord.text); + } else { + tokenContent += subTripleArrow(token.content); + } + html += "" + tokenContent + ""; + tokenPos += token.content.length; + filePos += token.content.length; + }); + html += "
"; + // This is the \n which the
represents + filePos += 1; + } + // Adding error messages to the line after + if (errors.length) { + var messages = errors.map(function (e) { + return escapeHtml(e.renderedMessage); + }).join("
"); + var codes = errors.map(function (e) { + return e.code; + }).join("
"); + html += "" + messages + "" + codes + ""; + html += "" + messages + ""; + } + // Add queries to the next line + if (queries.length) { + queries.forEach(function (query) { + // This is used to wrap popovers and completions to improve styling options for users. + html += "
"; + switch (query.kind) { + case "query": + { + var queryTextWithPrefix = escapeHtml(query.text); + var _lspValues = staticQuickInfosGroupedByLine.get(i) || []; + var targetedWord = _lspValues.find(function (response) { + return response.text === (queries.length && queries[0].text); + }); + var halfWayAcrossTheTargetedWord = (targetedWord && targetedWord.character + (targetedWord == null ? void 0 : targetedWord.length) / 2) - 1 || 0; + html += "" + " ".repeat(halfWayAcrossTheTargetedWord) + "" + ("
" + queryTextWithPrefix + "
"); + break; + } + case "completions": + { + if (!query.completions) { + html += "" + ("//" + "".padStart(query.offset - 2) + "^ - No completions found") + ""; + } else { + var prefixed = query.completions.filter(function (c) { + return c.name.startsWith(query.completionsPrefix || "____"); + }); + var lis = prefixed.sort(function (l, r) { + return l.name.localeCompare(r.name); + }).map(function (c) { + var _query$completionsPre, _c$kindModifiers; + var after = c.name.substr(((_query$completionsPre = query.completionsPrefix) == null ? void 0 : _query$completionsPre.length) || 0); + var name = "" + (query.completionsPrefix || "") + "" + after + ""; + var isDeprecated = (_c$kindModifiers = c.kindModifiers) == null ? void 0 : _c$kindModifiers.split(",").includes("deprecated"); + var liClass = isDeprecated ? "deprecated" : ""; + return "
  • " + name + "
  • "; + }).join(""); + html += " ".repeat(query.offset) + ""; + } + } + } + html += "
    "; + }); + } + // Any tags (currently that's warn/error/log) + if (tags.length) { + tags.forEach(function (tag) { + if (!["error", "warn", "log"].includes(tag.name)) return; + // This is used to wrap popovers and completions to improve styling options for users. + html += "
    "; + switch (tag.name) { + case "error": + html += errorSVG + "" + (tag.annotation || "N/A") + ""; + break; + case "warn": + html += warningSVG + "" + (tag.annotation || "N/A") + ""; + break; + case "log": + html += logSVG + "" + (tag.annotation || "N/A") + ""; + break; + } + html += "
    "; + }); + } + }); + html = replaceTripleArrowEncoded(html.replace(/\n*$/, "")); // Get rid of final new lines + if (options.addTryButton) { + var playgroundLink = "Try"; + html += "
    " + playgroundLink; + } else { + html += ""; + } + html += "
    "; + // Attach annotations which live above of the code + if (twoslash.tags && twoslash.tags.length) { + html += htmlForTags(twoslash.tags); + html += ""; + } + return html; +} +/** Returns a map where all the keys are the value in keyGetter */ +function groupBy(list, keyGetter) { + var map = new Map(); + list.forEach(function (item) { + var key = keyGetter(item); + var collection = map.get(key); + if (!collection) { + map.set(key, [item]); + } else { + collection.push(item); + } + }); + return map; +} +var errorSVG = ""; +var warningSVG = ""; +var logSVG = ""; + +function defaultShikiRenderer(lines, options, meta) { + var html = ""; + var hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight); + var hl = shouldHighlightLine(meta.highlight); + html += preOpenerFromRenderingOptsWithExtras(options, meta, []); + if (meta.title) { + html += "
    " + meta.title + "
    "; + } + if (options.langId) { + html += "
    " + options.langId + "
    "; + } + html += "
    "; + lines.forEach(function (l, i) { + if (l.length === 0) { + html += "
    "; + } else { + var hiClass = hasHighlight ? hl(i) ? " highlight" : " dim" : ""; + var prefix = "
    "; + html += prefix; + l.forEach(function (token) { + var cssDeclarations = ["color: " + token.color]; + if (token.fontStyle) { + if (token.fontStyle & shiki__default.FontStyle.Italic) { + cssDeclarations.push('font-style: italic'); + } + if (token.fontStyle & shiki__default.FontStyle.Bold) { + cssDeclarations.push('font-weight: bold'); + } + if (token.fontStyle & shiki__default.FontStyle.Underline) { + cssDeclarations.push('text-decoration: underline'); + } + } + html += "" + escapeHtml(token.content) + ""; + }); + html += "
    "; + } + }); + html = html.replace(/\n*$/, ""); // Get rid of final new lines + html += "
    "; + return html; +} + +var tsconfig = { + compilerOptions: "The set of compiler options for your project", + allowJs: "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.", + allowSyntheticDefaultImports: "Allow 'import x from y' when a module doesn't have a default export.", + allowUmdGlobalAccess: "Allow accessing UMD globals from modules.", + allowUnreachableCode: "Disable error reporting for unreachable code.", + allowUnusedLabels: "Disable error reporting for unused labels.", + alwaysStrict: "Ensure 'use strict' is always emitted.", + assumeChangesOnlyAffectDirectDependencies: "Have recompiles in projects that use [`incremental`](#incremental) and `watch` mode assume that changes within a file will only affect files directly depending on it.", + baseUrl: "Specify the base directory to resolve non-relative module names.", + charset: "No longer supported. In early versions, manually set the text encoding for reading files.", + checkJs: "Enable error reporting in type-checked JavaScript files.", + clean: "Delete the outputs of all projects.", + composite: "Enable constraints that allow a TypeScript project to be used with project references.", + declaration: "Generate .d.ts files from TypeScript and JavaScript files in your project.", + declarationDir: "Specify the output directory for generated declaration files.", + declarationMap: "Create sourcemaps for d.ts files.", + diagnostics: "Output compiler performance information after building.", + disableFilenameBasedTypeAcquisition: "Disables inference for type acquisition by looking at filenames in a project.", + disableReferencedProjectLoad: "Reduce the number of projects loaded automatically by TypeScript.", + disableSizeLimit: "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.", + disableSolutionSearching: "Opt a project out of multi-project reference checking when editing.", + disableSourceOfProjectReferenceRedirect: "Disable preferring source files instead of declaration files when referencing composite projects", + downlevelIteration: "Emit more compliant, but verbose and less performant JavaScript for iteration.", + emitBOM: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.", + emitDeclarationOnly: "Only output d.ts files and not JavaScript files.", + emitDecoratorMetadata: "Emit design-type metadata for decorated declarations in source files.", + enable: "Disable the type acquisition for JavaScript projects", + esModuleInterop: "Emit additional JavaScript to ease support for importing CommonJS modules. This enables [`allowSyntheticDefaultImports`](#allowSyntheticDefaultImports) for type compatibility.", + exactOptionalPropertyTypes: "Differentiate between undefined and not present when type checking", + exclude: "Filters results from the [`include`](#include) option.", + excludeDirectories: "Remove a list of directories from the watch process.", + excludeFiles: "Remove a list of files from the watch mode's processing.", + experimentalDecorators: "Enable experimental support for TC39 stage 2 draft decorators.", + explainFiles: "Print files read during the compilation including why it was included.", + extendedDiagnostics: "Output more detailed compiler performance information after building.", + "extends": "Specify one or more path or node module references to base configuration files from which settings are inherited.", + fallbackPolling: "Specify what approach the watcher should use if the system runs out of native file watchers.", + files: "Include a list of files. This does not support glob patterns, as opposed to [`include`](#include).", + force: "Build all projects, including those that appear to be up to date", + forceConsistentCasingInFileNames: "Ensure that casing is correct in imports.", + generateCpuProfile: "Emit a v8 CPU profile of the compiler run for debugging.", + importHelpers: "Allow importing helper functions from tslib once per project, instead of including them per-file.", + importsNotUsedAsValues: "Specify emit/checking behavior for imports that are only used for types.", + include: "Specify a list of glob patterns that match files to be included in compilation.", + incremental: "Save .tsbuildinfo files to allow for incremental compilation of projects.", + inlineSourceMap: "Include sourcemap files inside the emitted JavaScript.", + inlineSources: "Include source code in the sourcemaps inside the emitted JavaScript.", + isolatedModules: "Ensure that each file can be safely transpiled without relying on other imports.", + jsx: "Specify what JSX code is generated.", + jsxFactory: "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'", + jsxFragmentFactory: "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.", + jsxImportSource: "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.", + keyofStringsOnly: "Make keyof only return strings instead of string, numbers or symbols. Legacy option.", + lib: "Specify a set of bundled library declaration files that describe the target runtime environment.", + listEmittedFiles: "Print the names of emitted files after a compilation.", + listFiles: "Print all of the files read during the compilation.", + locale: "Set the language of the messaging from TypeScript. This does not affect emit.", + mapRoot: "Specify the location where debugger should locate map files instead of generated locations.", + maxNodeModuleJsDepth: "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with [`allowJs`](#allowJs).", + module: "Specify what module code is generated.", + moduleResolution: "Specify how TypeScript looks up a file from a given module specifier.", + newLine: "Set the newline character for emitting files.", + noEmit: "Disable emitting file from a compilation.", + noEmitHelpers: "Disable generating custom helper functions like `__extends` in compiled output.", + noEmitOnError: "Disable emitting files if any type checking errors are reported.", + noErrorTruncation: "Disable truncating types in error messages.", + noFallthroughCasesInSwitch: "Enable error reporting for fallthrough cases in switch statements.", + noImplicitAny: "Enable error reporting for expressions and declarations with an implied `any` type..", + noImplicitOverride: "Ensure overriding members in derived classes are marked with an override modifier.", + noImplicitReturns: "Enable error reporting for codepaths that do not explicitly return in a function.", + noImplicitThis: "Enable error reporting when `this` is given the type `any`.", + noImplicitUseStrict: "Disable adding 'use strict' directives in emitted JavaScript files.", + noLib: "Disable including any library files, including the default lib.d.ts.", + noPropertyAccessFromIndexSignature: "Enforces using indexed accessors for keys declared using an indexed type", + noResolve: "Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project.", + noStrictGenericChecks: "Disable strict checking of generic signatures in function types.", + noUncheckedIndexedAccess: "Add `undefined` to a type when accessed using an index.", + noUnusedLocals: "Enable error reporting when a local variables aren't read.", + noUnusedParameters: "Raise an error when a function parameter isn't read", + out: "Deprecated setting. Use [`outFile`](#outFile) instead.", + outDir: "Specify an output folder for all emitted files.", + outFile: "Specify a file that bundles all outputs into one JavaScript file. If [`declaration`](#declaration) is true, also designates a file that bundles all .d.ts output.", + paths: "Specify a set of entries that re-map imports to additional lookup locations.", + plugins: "Specify a list of language service plugins to include.", + preserveConstEnums: "Disable erasing `const enum` declarations in generated code.", + preserveSymlinks: "Disable resolving symlinks to their realpath. This correlates to the same flag in node.", + preserveWatchOutput: "Disable wiping the console in watch mode", + pretty: "Enable color and formatting in output to make compiler errors easier to read", + reactNamespace: "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.", + references: "Specify an array of objects that specify paths for projects. Used in project references.", + removeComments: "Disable emitting comments.", + resolveJsonModule: "Enable importing .json files", + rootDir: "Specify the root folder within your source files.", + rootDirs: "Allow multiple folders to be treated as one when resolving modules.", + skipDefaultLibCheck: "Skip type checking .d.ts files that are included with TypeScript.", + skipLibCheck: "Skip type checking all .d.ts files.", + sourceMap: "Create source map files for emitted JavaScript files.", + sourceRoot: "Specify the root path for debuggers to find the reference source code.", + strict: "Enable all strict type checking options.", + strictBindCallApply: "Check that the arguments for `bind`, `call`, and `apply` methods match the original function.", + strictFunctionTypes: "When assigning functions, check to ensure parameters and the return values are subtype-compatible.", + strictNullChecks: "When type checking, take into account `null` and `undefined`.", + strictPropertyInitialization: "Check for class properties that are declared but not set in the constructor.", + stripInternal: "Disable emitting declarations that have `@internal` in their JSDoc comments.", + suppressExcessPropertyErrors: "Disable reporting of excess property errors during the creation of object literals.", + suppressImplicitAnyIndexErrors: "Suppress [`noImplicitAny`](#noImplicitAny) errors when indexing objects that lack index signatures.", + synchronousWatchDirectory: "Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively.", + target: "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.", + traceResolution: "Log paths used during the [`moduleResolution`](#moduleResolution) process.", + tsBuildInfoFile: "Specify the folder for .tsbuildinfo incremental compilation files.", + typeAcquisition: "Specify options for automatic acquisition of declaration files.", + typeRoots: "Specify multiple folders that act like `./node_modules/@types`.", + types: "Specify type package names to be included without being referenced in a source file.", + useDefineForClassFields: "Emit ECMAScript-standard-compliant class fields.", + useUnknownInCatchVariables: "Default catch clause variables as `unknown` instead of `any`.", + verbose: "Enable verbose logging", + watchDirectory: "Specify how directories are watched on systems that lack recursive file-watching functionality.", + watchFile: "Specify how the TypeScript watch mode works." +}; + +/** Uses tmLanguage scopes to determine what the content of the token is */ +var tokenIsJSONKey = function tokenIsJSONKey(token) { + if (!token.explanation) return false; + return token.explanation.find(function (e) { + return e.scopes.find(function (s) { + return s.scopeName.includes("support.type.property-name"); + }); + }); +}; +/** Can you look up the token in the tsconfig reference? */ +var isKeyInTSConfig = function isKeyInTSConfig(token) { + if (token.content === '"') return; + var name = token.content.slice(1, token.content.length - 1); + return name in tsconfig; +}; +/** + * Renders a TSConfig JSON object with additional LSP-ish information + * @param lines the result of shiki highlighting + * @param options shiki display options + */ +function tsconfigJSONRenderer(lines, options, meta) { + var html = ""; + html += preOpenerFromRenderingOptsWithExtras(options, meta, ["tsconfig", "lsp"]); + if (meta.title) { + html += "
    " + meta.title + "
    "; + } + if (options.langId) { + html += "
    " + options.langId + "
    "; + } + html += "
    "; + lines.forEach(function (l) { + if (l.length === 0) { + html += "
    "; + } else { + html += "
    "; + l.forEach(function (token) { + // This means we're looking at a token which could be '"module"', '"', '"compilerOptions"' etc + if (tokenIsJSONKey(token) && isKeyInTSConfig(token)) { + var key = token.content.slice(1, token.content.length - 1); + var oneliner = tsconfig[key]; + // prettier-ignore + html += "\"\""; + } else { + html += "" + escapeHtml(token.content) + ""; + } + }); + html += "
    "; + } + }); + html = html.replace(/\n*$/, ""); // Get rid of final new lines + html += "
    "; + return html; +} + +/** + * This gets filled in by the promise below, then should + * hopefully be more or less synchronous access by each parse + * of the highlighter + */ +var storedHighlighter = null; +/** + * Creates a *cached singleton* Shiki highlighter, this is an async call because of the call to WASM to get + * the regex parser set up. + * + * In other functions, passing a the result of this highlighter function is kind of optional but it's the author's + * opinion that you should be in control of the highlighter, and not this library. + * + */ +var createShikiHighlighter = function createShikiHighlighter(options) { + if (storedHighlighter) return Promise.resolve(storedHighlighter); + return shiki.getHighlighter(options).then(function (newHighlighter) { + storedHighlighter = newHighlighter; + return storedHighlighter; + }); +}; +/** + * Renders a code sample to HTML, automatically taking into account: + * + * - rendering overrides for twoslash and tsconfig + * - whether the language exists in shiki + * + * @param code the source code to render + * @param lang the language to use in highlighting + * @param info additional metadata which lives after the code-fence lang (e.g. `{ twoslash: true }`) + * @param shikiOptions user settings + * @param highlighter optional, but you should use it, highlighter + * @param twoslash optional, but required when info contains 'twoslash' as a string + */ +var renderCodeToHTML = function renderCodeToHTML(code, lang, meta, shikiOptions, highlighter, twoslash) { + if (!highlighter && !storedHighlighter) { + throw new Error("The highlighter object hasn't been initialised via `setupHighLighter` yet in shiki-twoslash"); + } + // Shiki does know the lang, so tokenize + var renderHighlighter = highlighter || storedHighlighter; + var renderOpts = _extends({ + fg: renderHighlighter.getForegroundColor(), + bg: renderHighlighter.getBackgroundColor() + }, shikiOptions); + var tokens; + try { + // I'm a little unsure about why we need this, perhaps the jsx language + // upstream in shiki is broken? + var tmpLang = lang === "jsx" ? "tsx" : lang; + tokens = renderHighlighter.codeToThemedTokens(code, tmpLang); + } catch (error) { + // Shiki doesn't know this lang, so render it as plain text, but + // also add a note at the end as a HTML comment + var note = ""; + return plainTextRenderer(code, renderOpts, meta) + note; + } + // Twoslash specific renderer + if (lang && meta.twoslash && twoslash) { + return twoslashRenderer(tokens, _extends({}, renderOpts, { + langId: lang + }), twoslash, meta); + } + // TSConfig renderer + if (lang && lang.startsWith("json") && meta.tsconfig) { + return tsconfigJSONRenderer(tokens, renderOpts, meta); + } + // Otherwise just the normal shiki renderer + return defaultShikiRenderer(tokens, _extends({}, renderOpts, { + langId: lang + }), meta); +}; +/** + * Runs Twoslash over the code passed in with a particular language as the default file. + */ +var runTwoSlash = function runTwoSlash(input, lang, settings) { + if (settings === void 0) { + settings = {}; + } + var code = input; + // Shiki doesn't handle a few filetype mappings, so do that ahead of time. Oddly enough, this also + // gets re-done at remark-shiki level + var replacer = { + json5: "json", + yml: "yaml" + }; + // @ts-ignore + if (replacer[lang]) lang = replacer[lang]; + var hasReactImport = /^import\s+React(?:.*)\s+from\s+('|")react\1/gm; + // Add react import to code samples indicating they're needing react. + if (["tsx", "jsx"].includes(lang) && !settings.disableImplicitReactImport && !hasReactImport.test(code)) { + var reactImport = "import React from 'react'\n"; + var cutString = "// ---cut---\n"; + // ^ cutString taken directly from + // https://github.com/microsoft/TypeScript-Website/blob/0c8d98a69d520365c1909d536fa1323f03a8438c/packages/ts-twoslasher/src/index.ts#L694 + if (code.includes(cutString)) { + code = code.split(cutString).map(function (item, index) { + return index == 0 ? reactImport.concat(item) : item; + }).join(cutString); + } else { + code = [reactImport, cutString, code].join(""); + } + } + settings.customTags = ["annotate", "log", "warn", "error"]; + var results = twoslash.twoslasher(code, lang, settings); + return results; +}; +/** Set of renderers if you want to explicitly call one instead of using renderCodeToHTML */ +var renderers = { + plainTextRenderer: plainTextRenderer, + defaultShikiRenderer: defaultShikiRenderer, + twoslashRenderer: twoslashRenderer, + tsconfigJSONRenderer: tsconfigJSONRenderer +}; + +exports.createShikiHighlighter = createShikiHighlighter; +exports.renderCodeToHTML = renderCodeToHTML; +exports.renderers = renderers; +exports.runTwoSlash = runTwoSlash; +//# sourceMappingURL=shiki-twoslash.cjs.development.js.map diff --git a/patches/shiki-twoslash/shiki-twoslash.cjs.development.js.map b/patches/shiki-twoslash/shiki-twoslash.cjs.development.js.map new file mode 100644 index 000000000..aa4f7167b --- /dev/null +++ b/patches/shiki-twoslash/shiki-twoslash.cjs.development.js.map @@ -0,0 +1 @@ +{"version":3,"file":"shiki-twoslash.cjs.development.js","sources":["../src/annotations.ts","../src/utils.ts","../src/renderers/plain.ts","../src/renderers/twoslash.ts","../src/renderers/shiki.ts","../src/tsconfig-oneliners.generated.ts","../src/renderers/tsconfig.ts","../src/index.ts"],"sourcesContent":["import { TwoslashError, TwoSlashReturn } from \"@typescript/twoslash\"\n\nexport const htmlForTags = (tags: TwoSlashReturn[\"tags\"]) => {\n let html = \"\"\n tags.forEach(t => {\n if (t.name === \"annotate\" && t.annotation) {\n const meta = t.annotation.split(\" - \")\n const text = meta.pop()\n const info = (meta[0] || \"\").trim()\n const flipped = info.includes(\"right\")\n let settings = {\n flipped,\n arrowRot: flipped ? \"90deg 20px 20px\" : \"90deg 20px 20px\",\n textDegree: \"0deg\",\n top: `${t.line}em`\n }\n \n \n if (info.includes(\"{\")) {\n const theInfo = \"{\" + info.split(\"{\")[1]\n try {\n const specificSettings = JSON.parse(theInfo)\n settings = {...settings, ...specificSettings }\n } catch (error) {\n throw new TwoslashError(\"Could not parse annotation\", `The annotation ${JSON.stringify(t)} could convert '${theInfo}' into JSON`, `Look at ${(error as any).message}.`)\n }\n }\n \n const arrowSVG = arrow(settings)\n\n html += `\n
    \n ${arrowSVG}\n

    ${text}

    \n
    `\n }\n })\n\n return html\n}\n\nconst arrow = (style: { flipped: boolean; arrowRot: string, textDegree: string, top: string }) => {\n const leftInner = `M27 39C26.5 32.7511 21.9 17.5173 7.5 6.57333M16.5 4.04L0.999999 0.999998C3.16667 4.88444 7.5 13.16 7.5 15.1867`\n const rightInner = `M1 39C1.5 32.7511 6.1 17.5173 20.5 6.57333M11.5 4.04L27 0.999998C24.8333 4.88444 20.5 13.16 20.5 15.1867`\n const inner = style.flipped ? leftInner : rightInner\n const rot = style.arrowRot.split(\" \")\n return `\n \n`\n}\n","import type { parse } from \"fenceparser\"\n\nexport type Meta = NonNullable>\n\ntype Range = {\n begin: number\n end: number\n text?: string\n count?: number\n tooltip?: string[]\n classes?: string\n lsp?: string\n}\n\n/**\n * We're given the text which lives inside the token, and this function will\n * annotate it with twoslash metadata\n */\nexport function createHighlightedString(ranges: Range[], text: string, targetedWord: string = \"\") {\n // Why the weird chars? We need to make sure that generic syntax isn't\n // interpreted as html tags - to do that we need to switch out < to < - *but*\n // making that transition changes the indexes because it's gone from 1 char to 4 chars\n //\n // So, use an obscure character to indicate a real < for HTML, then switch it after\n const tag = (x: string) => `⇍${x}⇏`\n const makeTagFromRange = (r: Range, close?: true) => {\n switch (r.classes) {\n case \"lsp\":\n // The LSP response lives inside a dom attribute, which _can_ have < inside it, so switch them ahead of time.\n const lsp = htmlAttrReplacer(r.lsp || \"\")\n const underLineTargetedWord = r.lsp === targetedWord ? \"style=⇯border-bottom: solid 2px lightgrey;⇯\" : \"\"\n return close ? tag(\"/data-lsp\") : tag(`data-lsp lsp=¿${lsp}¿ ${underLineTargetedWord}`)\n case \"query\":\n return tag(`${close ? \"/\" : \"\"}data-highlight`)\n // handle both unknown and err variant as error-tag\n // case \"err\": is not required, just to be useful for others\n case \"err\":\n default:\n return tag(`${close ? \"/\" : \"\"}data-err`)\n }\n }\n\n ranges.sort((a, b) => {\n // Order of precedence\n // if two same offset meet, the lsp will be put as innermost than err and query\n const precedenceOf = (x?: string) => [\"err\", \"query\", \"lsp\"].indexOf(x ?? \"\")\n\n let cmp = 0\n // Can be desugared into,\n // 1. compare based on smaller begin, !(cmp) means if it's 0 then\n // 2. compare based on bigger end, ^ same thing again then\n // 3. compare based on higher precedence\n // && is so that if a step made cmp to something other than 0, it stops\n /***1*/ !(cmp = a.begin - b.begin) &&\n /*2*/ !(cmp = b.end - a.end) &&\n /*3*/ !(cmp = precedenceOf(a.classes) - precedenceOf(b.classes))\n return cmp\n }) // `Array.sort` works in place\n\n // Marks how much of the text has been put into the output/html\n let cursor = 0\n // should be maximum of O(n) where n is length of ranges\n const nest = (data: typeof ranges) => {\n let stack = \"\"\n const top = data.shift()! // I have made sure data can't be empty\n\n // parse from cursor to top.begin to make sure\n // strings on the way are parsed\n stack += text.substring(cursor, top.begin)\n cursor = top.begin\n\n // open tag\n stack += makeTagFromRange(top)\n\n // if the data still have an element that's in the top's range\n if (data.some(x => x.begin < top.end)) {\n stack += nest(data)\n } else {\n // othewise slice the text and set cursor\n stack += text.substring(top.begin, top.end)\n cursor = top.end\n }\n\n // close tag\n stack += makeTagFromRange(top, true)\n\n // if the tag is complete but still have some data left in the range\n if (data.length !== 0) {\n stack += nest(data)\n }\n\n return stack\n }\n\n // cloned because I don't feel comfortable modifying this as a side-effect from recursion\n const data = JSON.parse(JSON.stringify(ranges))\n const html = nest(data) + text.substring(cursor) // nested + leftover texts\n\n return htmlAttrUnReplacer(replaceTripleArrow(stripHTML(html)))\n}\n\n// HTML attributes have different rules,\nconst htmlAttrReplacer = (str: string) => str.replace(/\"/g, \"⃟\")\nconst htmlAttrUnReplacer = (str: string) => str.replace(/⃟/g, '\"')\n\n// Inline strings which are shown at HTML level\nexport const subTripleArrow = (str: string) => str.replace(//g, \"⇏\").replace(/'/g, \"⇯\")\nexport const replaceTripleArrow = (str: string) =>\n str.replace(/⇍/g, \"<\").replace(/⇏/g, \">\").replace(/⇯/g, \"'\").replace(/¿/g, \"'\")\nexport const replaceTripleArrowEncoded = (str: string) =>\n str.replace(/⇍/g, \"<\").replace(/⇏/g, \">\").replace(/⇯/g, \"'\")\n\nexport function stripHTML(text: string) {\n var table: any = {\n \"<\": \"lt\",\n '\"': \"quot\",\n \"'\": \"apos\",\n \"&\": \"amp\",\n \"\\r\": \"#13\",\n \"\\n\": \"#10\",\n }\n\n return text.toString().replace(/[<\"'\\r\\n&]/g, function (chr) {\n return \"&\" + table[chr] + \";\"\n })\n}\n\nexport function escapeHtml(html: string) {\n return html.replace(//g, \">\")\n}\n\n/** Does anything in the object imply that we should highlight any lines? */\nexport const shouldBeHighlightable = (highlight: any) => {\n return !!Object.keys(highlight || {}).find(key => {\n if (key.includes(\"-\")) return true\n if (!isNaN(parseInt(key))) return true\n return false\n })\n}\n\n/** Returns a func for figuring out if this line should be highlighted */\nexport const shouldHighlightLine = (highlight: any) => {\n const lines: number[] = []\n Object.keys(highlight || {}).find(key => {\n if (!isNaN(parseInt(key))) lines.push(parseInt(key))\n if (key.includes(\"-\")) {\n const [first, last] = key.split(\"-\")\n const lastIndex = parseInt(last) + 1\n for (let i = parseInt(first); i < lastIndex; i++) {\n lines.push(i)\n }\n }\n })\n\n return (line: number) => lines.includes(line)\n}\n","import { escapeHtml, Meta } from \"../utils\"\n\n// C&P'd from shiki\nexport interface HtmlRendererOptions {\n langId?: string\n fg?: string\n bg?: string\n themeName?: string\n}\n\n/** A func for setting a consistent
     */\nexport const preOpenerFromRenderingOptsWithExtras = (opts: HtmlRendererOptions, meta: Meta, classes?: string[]) => {\n  const bg = opts.bg || \"#fff\"\n  const fg = opts.fg || \"black\"\n  const theme = opts.themeName || \"\"\n\n  // shiki + `class` from fence + with-title if title exists + classes\n  const classList = [\"shiki\", theme, meta.class, meta.title ? \"with-title\" : \"\", ...(classes || [])]\n    .filter(Boolean)\n    .join(\" \")\n    .trim()\n\n  const attributes = Object.entries(meta)\n    .filter(entry => {\n      // exclude types other than string, number, boolean\n      // exclude keys class, twoslash\n      // exclude falsy booleans\n      return (\n        [\"string\", \"number\", \"boolean\"].includes(typeof entry[1]) &&\n        ![\"class\", \"twoslash\"].includes(entry[0]) &&\n        entry[1] !== false\n      )\n    })\n    .map(([key, value]) => `${key}=\"${value}\"`)\n    .join(\" \")\n    .trim()\n\n  // prettier-ignore\n  return `
    `\n}\n\n/** You don't have a language which shiki twoslash can handle, make a DOM compatible version  */\nexport function plainTextRenderer(code: string, options: HtmlRendererOptions, meta: Meta) {\n  let html = \"\"\n\n  html += preOpenerFromRenderingOptsWithExtras(options, meta, [])\n  if (meta.title) {\n    html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n html += escapeHtml(code)\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","type Lines = import(\"shiki\").IThemedToken[][]\ntype TwoSlash = import(\"@typescript/twoslash\").TwoSlashReturn\n\nimport { TwoslashShikiOptions } from \"..\"\nimport { htmlForTags } from \"../annotations\"\nimport {\n shouldBeHighlightable,\n shouldHighlightLine,\n createHighlightedString,\n subTripleArrow,\n replaceTripleArrowEncoded,\n escapeHtml,\n Meta,\n} from \"../utils\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\n// OK, so - this is just straight up complex code.\n\n// What we're trying to do is merge two sets of information into a single tree for HTML\n\n// 1: Syntax highlight info from shiki\n// 2: Twoslash metadata like errors, identifiers etc\n\n// Because shiki gives use a set of lines to work from, then the first thing which happens\n// is converting twoslash data into the same format.\n\n// Things which make it hard:\n//\n// - Twoslash results can be cut, so sometimes there is edge cases between twoslash results\n// - Twoslash results can be multi-file\n// - the DOM requires a flattened graph of html elements (e.g. spans can' be interspersed)\n//\n\nexport function twoslashRenderer(lines: Lines, options: HtmlRendererOptions & TwoslashShikiOptions, twoslash: TwoSlash, meta: Meta) {\n let html = \"\"\n\n const hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight)\n const hl = shouldHighlightLine(meta.highlight)\n\n if (twoslash.tags && twoslash.tags.length) html += \"
    \"\n \n html += preOpenerFromRenderingOptsWithExtras(options, meta, [\"twoslash\", \"lsp\"])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n const errorsGroupedByLine = groupBy(twoslash.errors, e => e.line) || new Map()\n const staticQuickInfosGroupedByLine = groupBy(twoslash.staticQuickInfos, q => q.line) || new Map()\n // A query is always about the line above it!\n const queriesGroupedByLine = groupBy(twoslash.queries, q => q.line - 1) || new Map()\n const tagsGroupedByLine = groupBy(twoslash.tags, q => q.line - 1) || new Map()\n\n /**\n * This is the index of the original twoslash code reference, it is not\n * related to the HTML output\n */\n let filePos = 0\n\n lines.forEach((l, i) => {\n const errors = errorsGroupedByLine.get(i) || []\n const lspValues = staticQuickInfosGroupedByLine.get(i) || []\n const queries = queriesGroupedByLine.get(i) || []\n const tags = tagsGroupedByLine.get(i) || []\n\n const hiClass = hasHighlight ? (hl(i + 1) ? \" highlight\" : \" dim\") : \"\"\n const prefix = `
    `\n\n if (l.length === 0 && i === 0) {\n // Skip the first newline if it's blank\n filePos += 1\n } else if (l.length === 0) {\n const emptyLine = `${prefix} 
    ` \n html += emptyLine\n filePos += 1\n } else {\n html += prefix\n\n // Keep track of the position of the current token in a line so we can match it up to the\n // errors and lang serv identifiers\n let tokenPos = 0\n\n l.forEach(token => {\n let targetedQueryWord: typeof twoslash.staticQuickInfos[number] | undefined\n\n let tokenContent = \"\"\n // Underlining particular words\n const findTokenFunc = (start: number) => (e: any) =>\n start <= e.character && start + token.content.length >= e.character + e.length\n\n const findTokenDebug = (start: number) => (e: any) => {\n const result = start <= e.character && start + token.content.length >= e.character + e.length\n // prettier-ignore\n console.log(result, start, '<=', e.character, '&&', start + token.content.length, '>=', e.character + e.length)\n if (result) {\n console.log(\"Found:\", e)\n console.log(\"Inside:\", token)\n }\n return result\n }\n\n const errorsInToken = errors.filter(findTokenFunc(tokenPos))\n const lspResponsesInToken = lspValues.filter(findTokenFunc(tokenPos))\n const queriesInToken = queries.filter(findTokenFunc(tokenPos))\n\n // Does this line have a word targeted by a query?\n targetedQueryWord = targetedQueryWord || lspResponsesInToken.find(response => response.text === (queries.length && queries[0].text))!\n\n const allTokens = [...errorsInToken, ...lspResponsesInToken, ...queriesInToken]\n const allTokensByStart = allTokens.sort((l, r) => {\n return (l.start || 0) - (r.start || 0)\n })\n\n if (allTokensByStart.length) {\n const ranges = allTokensByStart.map(token => {\n const range: any = {\n begin: token.start! - filePos,\n end: token.start! + token.length! - filePos,\n }\n\n // prettier-ignore\n if (range.begin < 0 || range.end < 0) {\n // prettier-ignore\n // throw new Error(`The begin range of a token is at a minus location, filePos:${filePos} current token: ${JSON.stringify(token, null, ' ')}\\n result: ${JSON.stringify(range, null, ' ')}`)\n }\n\n if (\"renderedMessage\" in token) range.classes = \"err\"\n if (\"kind\" in token) range.classes = token.kind\n if (\"targetString\" in token) {\n range.classes = \"lsp\"\n const lspText = options.includeJSDocInHover && token.docs ? `${token.docs}\\n\\n${token.text}` : token.text\n range[\"lsp\"] = lspText\n }\n return range\n })\n\n tokenContent += createHighlightedString(ranges, token.content, targetedQueryWord?.text)\n } else {\n tokenContent += subTripleArrow(token.content)\n }\n\n html += `${tokenContent}`\n tokenPos += token.content.length\n filePos += token.content.length\n })\n\n html += `
    `\n // This is the \\n which the
    represents\n filePos += 1\n }\n\n // Adding error messages to the line after\n if (errors.length) {\n const messages = errors.map(e => escapeHtml(e.renderedMessage)).join(\"
    \")\n const codes = errors.map(e => e.code).join(\"
    \")\n html += `${messages}${codes}`\n html += `${messages}`\n }\n\n // Add queries to the next line\n if (queries.length) {\n queries.forEach(query => {\n // This is used to wrap popovers and completions to improve styling options for users.\n html += `
    `\n\n switch (query.kind) {\n case \"query\": {\n const queryTextWithPrefix = escapeHtml(query.text!)\n const lspValues = staticQuickInfosGroupedByLine.get(i) || []\n const targetedWord = lspValues.find(response => response.text === (queries.length && queries[0].text))!\n const halfWayAcrossTheTargetedWord = ((targetedWord && targetedWord.character + targetedWord?.length / 2) - 1) || 0\n html +=\n `` +\n \" \".repeat(halfWayAcrossTheTargetedWord) +\n \"\" +\n `
    ${queryTextWithPrefix}
    `\n break\n }\n\n case \"completions\": {\n if (!query.completions) {\n html += `${\"//\" + \"\".padStart(query.offset - 2) + \"^ - No completions found\"}`\n } else {\n const prefixed = query.completions.filter(c => c.name.startsWith(query.completionsPrefix || \"____\"))\n\n const lis = prefixed\n .sort((l, r) => l.name.localeCompare(r.name))\n .map(c => {\n const after = c.name.substr(query.completionsPrefix?.length || 0)\n const name = `${query.completionsPrefix || \"\"}${after}`\n const isDeprecated = c.kindModifiers?.split(\",\").includes(\"deprecated\")\n const liClass = isDeprecated ? \"deprecated\" : \"\"\n return `
  • ${name}
  • `\n })\n .join(\"\")\n html += `${\" \".repeat(query.offset)}`\n }\n }\n }\n html += \"
    \"\n })\n }\n\n // Any tags (currently that's warn/error/log)\n if (tags.length) {\n tags.forEach(tag => {\n if(![\"error\", \"warn\", \"log\"].includes(tag.name)) return\n\n // This is used to wrap popovers and completions to improve styling options for users.\n html += `
    `\n switch(tag.name) {\n case \"error\": html += `${errorSVG}${tag.annotation || \"N/A\"}`; break;\n case \"warn\": html += `${warningSVG}${tag.annotation || \"N/A\"}`; break;\n case \"log\": html += `${logSVG}${tag.annotation || \"N/A\"}`; break;\n }\n html += \"
    \"\n })\n }\n })\n html = replaceTripleArrowEncoded(html.replace(/\\n*$/, \"\")) // Get rid of final new lines\n\n if (options.addTryButton) {\n const playgroundLink = `Try`\n html += `
    ${playgroundLink}`\n } else {\n html += ``\n }\n\n html += `
    `\n\n // Attach annotations which live above of the code\n if (twoslash.tags && twoslash.tags.length) {\n html += htmlForTags(twoslash.tags)\n html += \"\"\n }\n\n return html\n}\n\n/** Returns a map where all the keys are the value in keyGetter */\nfunction groupBy(list: T[], keyGetter: (obj: any) => number) {\n const map = new Map()\n list.forEach(item => {\n const key = keyGetter(item)\n const collection = map.get(key)\n if (!collection) {\n map.set(key, [item])\n } else {\n collection.push(item)\n }\n })\n return map\n}\n\n\nconst errorSVG = ``\nconst warningSVG = ``\nconst logSVG = ``","import { shouldBeHighlightable, shouldHighlightLine, escapeHtml, Meta } from \"../utils\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\nimport shiki from \"shiki\"\n\ntype Lines = shiki.IThemedToken[][]\n\nexport function defaultShikiRenderer(lines: Lines, options: HtmlRendererOptions, meta: Meta) {\n let html = \"\"\n\n const hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight)\n const hl = shouldHighlightLine(meta.highlight)\n\n html += preOpenerFromRenderingOptsWithExtras(options, meta, [])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n lines.forEach((l, i) => {\n if (l.length === 0) {\n html += `
    `\n } else {\n const hiClass = hasHighlight ? (hl(i) ? \" highlight\" : \" dim\") : \"\"\n const prefix = `
    `\n html += prefix\n\n l.forEach(token => {\n const cssDeclarations = [`color: ${token.color}`];\n if (token.fontStyle) {\n if (token.fontStyle & shiki.FontStyle.Italic) {\n cssDeclarations.push('font-style: italic');\n }\n if (token.fontStyle & shiki.FontStyle.Bold) {\n cssDeclarations.push('font-weight: bold');\n }\n if (token.fontStyle & shiki.FontStyle.Underline) {\n cssDeclarations.push('text-decoration: underline');\n }\n }\n html += `${escapeHtml(token.content)}`\n })\n html += `
    `\n }\n })\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","export const tsconfig = {\n compilerOptions: `The set of compiler options for your project`,\n allowJs: `Allow JavaScript files to be a part of your program. Use the \\`checkJS\\` option to get errors from these files.`,\n allowSyntheticDefaultImports: `Allow 'import x from y' when a module doesn't have a default export.`,\n allowUmdGlobalAccess: `Allow accessing UMD globals from modules.`,\n allowUnreachableCode: `Disable error reporting for unreachable code.`,\n allowUnusedLabels: `Disable error reporting for unused labels.`,\n alwaysStrict: `Ensure 'use strict' is always emitted.`,\n assumeChangesOnlyAffectDirectDependencies: `Have recompiles in projects that use [\\`incremental\\`](#incremental) and \\`watch\\` mode assume that changes within a file will only affect files directly depending on it.`,\n baseUrl: `Specify the base directory to resolve non-relative module names.`,\n charset: `No longer supported. In early versions, manually set the text encoding for reading files.`,\n checkJs: `Enable error reporting in type-checked JavaScript files.`,\n clean: `Delete the outputs of all projects.`,\n composite: `Enable constraints that allow a TypeScript project to be used with project references.`,\n declaration: `Generate .d.ts files from TypeScript and JavaScript files in your project.`,\n declarationDir: `Specify the output directory for generated declaration files.`,\n declarationMap: `Create sourcemaps for d.ts files.`,\n diagnostics: `Output compiler performance information after building.`,\n disableFilenameBasedTypeAcquisition: `Disables inference for type acquisition by looking at filenames in a project.`,\n disableReferencedProjectLoad: `Reduce the number of projects loaded automatically by TypeScript.`,\n disableSizeLimit: `Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.`,\n disableSolutionSearching: `Opt a project out of multi-project reference checking when editing.`,\n disableSourceOfProjectReferenceRedirect: `Disable preferring source files instead of declaration files when referencing composite projects`,\n downlevelIteration: `Emit more compliant, but verbose and less performant JavaScript for iteration.`,\n emitBOM: `Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.`,\n emitDeclarationOnly: `Only output d.ts files and not JavaScript files.`,\n emitDecoratorMetadata: `Emit design-type metadata for decorated declarations in source files.`,\n enable: `Disable the type acquisition for JavaScript projects`,\n esModuleInterop: `Emit additional JavaScript to ease support for importing CommonJS modules. This enables [\\`allowSyntheticDefaultImports\\`](#allowSyntheticDefaultImports) for type compatibility.`,\n exactOptionalPropertyTypes: `Differentiate between undefined and not present when type checking`,\n exclude: `Filters results from the [\\`include\\`](#include) option.`,\n excludeDirectories: `Remove a list of directories from the watch process.`,\n excludeFiles: `Remove a list of files from the watch mode's processing.`,\n experimentalDecorators: `Enable experimental support for TC39 stage 2 draft decorators.`,\n explainFiles: `Print files read during the compilation including why it was included.`,\n extendedDiagnostics: `Output more detailed compiler performance information after building.`,\n extends: `Specify one or more path or node module references to base configuration files from which settings are inherited.`,\n fallbackPolling: `Specify what approach the watcher should use if the system runs out of native file watchers.`,\n files: `Include a list of files. This does not support glob patterns, as opposed to [\\`include\\`](#include).`,\n force: `Build all projects, including those that appear to be up to date`,\n forceConsistentCasingInFileNames: `Ensure that casing is correct in imports.`,\n generateCpuProfile: `Emit a v8 CPU profile of the compiler run for debugging.`,\n importHelpers: `Allow importing helper functions from tslib once per project, instead of including them per-file.`,\n importsNotUsedAsValues: `Specify emit/checking behavior for imports that are only used for types.`,\n include: `Specify a list of glob patterns that match files to be included in compilation.`,\n incremental: `Save .tsbuildinfo files to allow for incremental compilation of projects.`,\n inlineSourceMap: `Include sourcemap files inside the emitted JavaScript.`,\n inlineSources: `Include source code in the sourcemaps inside the emitted JavaScript.`,\n isolatedModules: `Ensure that each file can be safely transpiled without relying on other imports.`,\n jsx: `Specify what JSX code is generated.`,\n jsxFactory: `Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'`,\n jsxFragmentFactory: `Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.`,\n jsxImportSource: `Specify module specifier used to import the JSX factory functions when using \\`jsx: react-jsx*\\`.`,\n keyofStringsOnly: `Make keyof only return strings instead of string, numbers or symbols. Legacy option.`,\n lib: `Specify a set of bundled library declaration files that describe the target runtime environment.`,\n listEmittedFiles: `Print the names of emitted files after a compilation.`,\n listFiles: `Print all of the files read during the compilation.`,\n locale: `Set the language of the messaging from TypeScript. This does not affect emit.`,\n mapRoot: `Specify the location where debugger should locate map files instead of generated locations.`,\n maxNodeModuleJsDepth: `Specify the maximum folder depth used for checking JavaScript files from \\`node_modules\\`. Only applicable with [\\`allowJs\\`](#allowJs).`,\n module: `Specify what module code is generated.`,\n moduleResolution: `Specify how TypeScript looks up a file from a given module specifier.`,\n newLine: `Set the newline character for emitting files.`,\n noEmit: `Disable emitting file from a compilation.`,\n noEmitHelpers: `Disable generating custom helper functions like \\`__extends\\` in compiled output.`,\n noEmitOnError: `Disable emitting files if any type checking errors are reported.`,\n noErrorTruncation: `Disable truncating types in error messages.`,\n noFallthroughCasesInSwitch: `Enable error reporting for fallthrough cases in switch statements.`,\n noImplicitAny: `Enable error reporting for expressions and declarations with an implied \\`any\\` type..`,\n noImplicitOverride: `Ensure overriding members in derived classes are marked with an override modifier.`,\n noImplicitReturns: `Enable error reporting for codepaths that do not explicitly return in a function.`,\n noImplicitThis: `Enable error reporting when \\`this\\` is given the type \\`any\\`.`,\n noImplicitUseStrict: `Disable adding 'use strict' directives in emitted JavaScript files.`,\n noLib: `Disable including any library files, including the default lib.d.ts.`,\n noPropertyAccessFromIndexSignature: `Enforces using indexed accessors for keys declared using an indexed type`,\n noResolve: `Disallow \\`import\\`s, \\`require\\`s or \\`\\`s from expanding the number of files TypeScript should add to a project.`,\n noStrictGenericChecks: `Disable strict checking of generic signatures in function types.`,\n noUncheckedIndexedAccess: `Add \\`undefined\\` to a type when accessed using an index.`,\n noUnusedLocals: `Enable error reporting when a local variables aren't read.`,\n noUnusedParameters: `Raise an error when a function parameter isn't read`,\n out: `Deprecated setting. Use [\\`outFile\\`](#outFile) instead.`,\n outDir: `Specify an output folder for all emitted files.`,\n outFile: `Specify a file that bundles all outputs into one JavaScript file. If [\\`declaration\\`](#declaration) is true, also designates a file that bundles all .d.ts output.`,\n paths: `Specify a set of entries that re-map imports to additional lookup locations.`,\n plugins: `Specify a list of language service plugins to include.`,\n preserveConstEnums: `Disable erasing \\`const enum\\` declarations in generated code.`,\n preserveSymlinks: `Disable resolving symlinks to their realpath. This correlates to the same flag in node.`,\n preserveWatchOutput: `Disable wiping the console in watch mode`,\n pretty: `Enable color and formatting in output to make compiler errors easier to read`,\n reactNamespace: `Specify the object invoked for \\`createElement\\`. This only applies when targeting \\`react\\` JSX emit.`,\n references: `Specify an array of objects that specify paths for projects. Used in project references.`,\n removeComments: `Disable emitting comments.`,\n resolveJsonModule: `Enable importing .json files`,\n rootDir: `Specify the root folder within your source files.`,\n rootDirs: `Allow multiple folders to be treated as one when resolving modules.`,\n skipDefaultLibCheck: `Skip type checking .d.ts files that are included with TypeScript.`,\n skipLibCheck: `Skip type checking all .d.ts files.`,\n sourceMap: `Create source map files for emitted JavaScript files.`,\n sourceRoot: `Specify the root path for debuggers to find the reference source code.`,\n strict: `Enable all strict type checking options.`,\n strictBindCallApply: `Check that the arguments for \\`bind\\`, \\`call\\`, and \\`apply\\` methods match the original function.`,\n strictFunctionTypes: `When assigning functions, check to ensure parameters and the return values are subtype-compatible.`,\n strictNullChecks: `When type checking, take into account \\`null\\` and \\`undefined\\`.`,\n strictPropertyInitialization: `Check for class properties that are declared but not set in the constructor.`,\n stripInternal: `Disable emitting declarations that have \\`@internal\\` in their JSDoc comments.`,\n suppressExcessPropertyErrors: `Disable reporting of excess property errors during the creation of object literals.`,\n suppressImplicitAnyIndexErrors: `Suppress [\\`noImplicitAny\\`](#noImplicitAny) errors when indexing objects that lack index signatures.`,\n synchronousWatchDirectory: `Synchronously call callbacks and update the state of directory watchers on platforms that don\\`t support recursive watching natively.`,\n target: `Set the JavaScript language version for emitted JavaScript and include compatible library declarations.`,\n traceResolution: `Log paths used during the [\\`moduleResolution\\`](#moduleResolution) process.`,\n tsBuildInfoFile: `Specify the folder for .tsbuildinfo incremental compilation files.`,\n typeAcquisition: `Specify options for automatic acquisition of declaration files.`,\n typeRoots: `Specify multiple folders that act like \\`./node_modules/@types\\`.`,\n types: `Specify type package names to be included without being referenced in a source file.`,\n useDefineForClassFields: `Emit ECMAScript-standard-compliant class fields.`,\n useUnknownInCatchVariables: `Default catch clause variables as \\`unknown\\` instead of \\`any\\`.`,\n verbose: `Enable verbose logging`,\n watchDirectory: `Specify how directories are watched on systems that lack recursive file-watching functionality.`,\n watchFile: `Specify how the TypeScript watch mode works.`,\n};\n","type Lines = import(\"shiki\").IThemedToken[][]\n\nimport type { IThemedToken } from \"shiki\"\nimport { escapeHtml, Meta } from \"../utils\"\nimport { tsconfig } from \"../tsconfig-oneliners.generated\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\n/** Uses tmLanguage scopes to determine what the content of the token is */\nconst tokenIsJSONKey = (token: IThemedToken) => {\n if (!token.explanation) return false\n return token.explanation.find(e => e.scopes.find(s => s.scopeName.includes(\"support.type.property-name\")))\n}\n\n/** Can you look up the token in the tsconfig reference? */\nconst isKeyInTSConfig = (token: IThemedToken) => {\n if (token.content === '\"') return\n const name = token.content.slice(1, token.content.length - 1)\n return name in tsconfig\n}\n\n/**\n * Renders a TSConfig JSON object with additional LSP-ish information\n * @param lines the result of shiki highlighting\n * @param options shiki display options\n */\nexport function tsconfigJSONRenderer(lines: Lines, options: HtmlRendererOptions, meta: Meta) {\n let html = \"\"\n\n html += preOpenerFromRenderingOptsWithExtras(options, meta, [\"tsconfig\", \"lsp\"])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n lines.forEach(l => {\n if (l.length === 0) {\n html += `
    `\n } else {\n html += `
    `\n l.forEach(token => {\n // This means we're looking at a token which could be '\"module\"', '\"', '\"compilerOptions\"' etc\n if (tokenIsJSONKey(token) && isKeyInTSConfig(token)) {\n const key = token.content.slice(1, token.content.length - 1)\n const oneliner = (tsconfig as Record)[key]\n // prettier-ignore\n html += `\"\"`\n } else {\n html += `${escapeHtml(token.content)}`\n }\n })\n html += `
    `\n }\n })\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","import { getHighlighter, Highlighter, HighlighterOptions, IThemedToken } from \"shiki\"\nimport { twoslasher, TwoSlashOptions, TwoSlashReturn } from \"@typescript/twoslash\"\nimport { twoslashRenderer } from \"./renderers/twoslash\"\nimport { HtmlRendererOptions, plainTextRenderer } from \"./renderers/plain\"\nimport { defaultShikiRenderer } from \"./renderers/shiki\"\nimport { tsconfigJSONRenderer } from \"./renderers/tsconfig\"\nimport { Meta } from \"./utils\"\n\nexport interface TwoslashShikiOptions {\n /** A way to turn on the try buttons seen on the TS website */\n addTryButton?: true\n /** A way to disable implicit React imports on tsx/jsx language codeblocks */\n disableImplicitReactImport?: true\n /** A way to add a div wrapper for multi-theme outputs */\n wrapFragments?: true\n /** Include JSDoc comments in the hovers */\n includeJSDocInHover?: true\n /** Instead of showing twoslash exceptions inline, throw the entire process like it will on CI */\n alwayRaiseForTwoslashExceptions?: true\n /** Ignore transforming certain code blocks */\n ignoreCodeblocksWithCodefenceMeta?: string[]\n}\n\n/** The possible user config, a combination of all shiki, twoslash and twoslash-shiki options */\nexport type UserConfigSettings = HighlighterOptions & TwoSlashOptions & TwoslashShikiOptions\n\n/**\n * This gets filled in by the promise below, then should\n * hopefully be more or less synchronous access by each parse\n * of the highlighter\n */\nlet storedHighlighter: Highlighter = null as any\n\n/**\n * Creates a *cached singleton* Shiki highlighter, this is an async call because of the call to WASM to get\n * the regex parser set up.\n *\n * In other functions, passing a the result of this highlighter function is kind of optional but it's the author's\n * opinion that you should be in control of the highlighter, and not this library.\n *\n */\nexport const createShikiHighlighter = (options: HighlighterOptions) => {\n if (storedHighlighter) return Promise.resolve(storedHighlighter)\n\n return getHighlighter(options).then(newHighlighter => {\n storedHighlighter = newHighlighter\n return storedHighlighter\n })\n}\n\n/**\n * Renders a code sample to HTML, automatically taking into account:\n *\n * - rendering overrides for twoslash and tsconfig\n * - whether the language exists in shiki\n *\n * @param code the source code to render\n * @param lang the language to use in highlighting\n * @param info additional metadata which lives after the code-fence lang (e.g. `{ twoslash: true }`)\n * @param shikiOptions user settings\n * @param highlighter optional, but you should use it, highlighter\n * @param twoslash optional, but required when info contains 'twoslash' as a string\n */\nexport const renderCodeToHTML = (\n code: string,\n lang: string,\n meta: Meta,\n shikiOptions?: UserConfigSettings & { themeName: string },\n highlighter?: Highlighter,\n twoslash?: TwoSlashReturn\n) => {\n if (!highlighter && !storedHighlighter) {\n throw new Error(\"The highlighter object hasn't been initialised via `setupHighLighter` yet in shiki-twoslash\")\n }\n\n // Shiki does know the lang, so tokenize\n const renderHighlighter = highlighter || storedHighlighter\n\n const renderOpts: HtmlRendererOptions = {\n fg: renderHighlighter.getForegroundColor(),\n bg: renderHighlighter.getBackgroundColor(),\n ...shikiOptions,\n }\n\n let tokens: IThemedToken[][]\n try {\n // I'm a little unsure about why we need this, perhaps the jsx language\n // upstream in shiki is broken?\n const tmpLang = lang === \"jsx\" ? \"tsx\" : lang\n\n tokens = renderHighlighter.codeToThemedTokens(code, tmpLang as any)\n } catch (error) {\n // Shiki doesn't know this lang, so render it as plain text, but\n // also add a note at the end as a HTML comment\n const note = ``\n return plainTextRenderer(code, renderOpts, meta) + note\n }\n\n // Twoslash specific renderer\n if (lang && meta.twoslash && twoslash) {\n return twoslashRenderer(tokens, { ...renderOpts, langId: lang }, twoslash, meta)\n }\n\n // TSConfig renderer\n if (lang && lang.startsWith(\"json\") && meta.tsconfig) {\n return tsconfigJSONRenderer(tokens, renderOpts, meta)\n }\n\n // Otherwise just the normal shiki renderer\n return defaultShikiRenderer(tokens, { ...renderOpts, langId: lang }, meta)\n}\n\n/**\n * Runs Twoslash over the code passed in with a particular language as the default file.\n */\nexport const runTwoSlash = (input: string, lang: string, settings: UserConfigSettings = {}): TwoSlashReturn => {\n let code = input\n\n // Shiki doesn't handle a few filetype mappings, so do that ahead of time. Oddly enough, this also\n // gets re-done at remark-shiki level\n const replacer = {\n json5: \"json\",\n yml: \"yaml\",\n }\n\n // @ts-ignore\n if (replacer[lang]) lang = replacer[lang]\n\n const hasReactImport = /^import\\s+React(?:.*)\\s+from\\s+('|\")react\\1/gm\n\n // Add react import to code samples indicating they're needing react.\n if ([\"tsx\", \"jsx\"].includes(lang) && !settings.disableImplicitReactImport && !hasReactImport.test(code)) {\n const reactImport = \"import React from 'react'\\n\"\n const cutString = \"// ---cut---\\n\"\n // ^ cutString taken directly from\n // https://github.com/microsoft/TypeScript-Website/blob/0c8d98a69d520365c1909d536fa1323f03a8438c/packages/ts-twoslasher/src/index.ts#L694\n\n if (code.includes(cutString)) {\n code = code\n .split(cutString)\n .map((item, index) => (index == 0 ? reactImport.concat(item) : item))\n .join(cutString)\n } else {\n code = [reactImport, cutString, code].join(\"\")\n }\n }\n\n settings.customTags = [\"annotate\", \"log\", \"warn\", \"error\"]\n const results = twoslasher(code, lang, settings)\n return results\n}\n\n/** Set of renderers if you want to explicitly call one instead of using renderCodeToHTML */\nexport const renderers = {\n plainTextRenderer,\n defaultShikiRenderer,\n twoslashRenderer,\n tsconfigJSONRenderer,\n}\n"],"names":["htmlForTags","tags","html","forEach","t","name","annotation","meta","split","text","pop","info","trim","flipped","includes","settings","arrowRot","textDegree","top","line","theInfo","specificSettings","JSON","parse","_extends","error","TwoslashError","stringify","message","arrowSVG","arrow","style","leftInner","rightInner","inner","rot","createHighlightedString","ranges","targetedWord","tag","x","makeTagFromRange","r","close","classes","lsp","htmlAttrReplacer","underLineTargetedWord","sort","a","b","precedenceOf","indexOf","cmp","begin","end","cursor","nest","data","stack","shift","substring","some","length","htmlAttrUnReplacer","replaceTripleArrow","stripHTML","str","replace","subTripleArrow","replaceTripleArrowEncoded","table","toString","chr","escapeHtml","shouldBeHighlightable","highlight","Object","keys","find","key","isNaN","parseInt","shouldHighlightLine","lines","push","_key$split","first","last","lastIndex","i","preOpenerFromRenderingOptsWithExtras","opts","bg","fg","theme","themeName","classList","title","concat","filter","Boolean","join","attributes","entries","entry","map","_ref","value","plainTextRenderer","code","options","langId","twoslashRenderer","twoslash","hasHighlight","hl","errorsGroupedByLine","groupBy","errors","e","Map","staticQuickInfosGroupedByLine","staticQuickInfos","q","queriesGroupedByLine","queries","tagsGroupedByLine","filePos","l","get","lspValues","hiClass","prefix","emptyLine","tokenPos","token","targetedQueryWord","tokenContent","findTokenFunc","start","character","content","errorsInToken","lspResponsesInToken","queriesInToken","response","allTokens","allTokensByStart","_targetedQueryWord","range","kind","lspText","includeJSDocInHover","docs","color","messages","renderedMessage","codes","query","queryTextWithPrefix","halfWayAcrossTheTargetedWord","repeat","completions","padStart","offset","prefixed","c","startsWith","completionsPrefix","lis","localeCompare","after","substr","_query$completionsPre","isDeprecated","_c$kindModifiers","kindModifiers","liClass","errorSVG","warningSVG","logSVG","addTryButton","playgroundLink","playgroundURL","list","keyGetter","item","collection","set","defaultShikiRenderer","cssDeclarations","fontStyle","shiki","FontStyle","Italic","Bold","Underline","tsconfig","compilerOptions","allowJs","allowSyntheticDefaultImports","allowUmdGlobalAccess","allowUnreachableCode","allowUnusedLabels","alwaysStrict","assumeChangesOnlyAffectDirectDependencies","baseUrl","charset","checkJs","clean","composite","declaration","declarationDir","declarationMap","diagnostics","disableFilenameBasedTypeAcquisition","disableReferencedProjectLoad","disableSizeLimit","disableSolutionSearching","disableSourceOfProjectReferenceRedirect","downlevelIteration","emitBOM","emitDeclarationOnly","emitDecoratorMetadata","enable","esModuleInterop","exactOptionalPropertyTypes","exclude","excludeDirectories","excludeFiles","experimentalDecorators","explainFiles","extendedDiagnostics","fallbackPolling","files","force","forceConsistentCasingInFileNames","generateCpuProfile","importHelpers","importsNotUsedAsValues","include","incremental","inlineSourceMap","inlineSources","isolatedModules","jsx","jsxFactory","jsxFragmentFactory","jsxImportSource","keyofStringsOnly","lib","listEmittedFiles","listFiles","locale","mapRoot","maxNodeModuleJsDepth","module","moduleResolution","newLine","noEmit","noEmitHelpers","noEmitOnError","noErrorTruncation","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noImplicitUseStrict","noLib","noPropertyAccessFromIndexSignature","noResolve","noStrictGenericChecks","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","out","outDir","outFile","paths","plugins","preserveConstEnums","preserveSymlinks","preserveWatchOutput","pretty","reactNamespace","references","removeComments","resolveJsonModule","rootDir","rootDirs","skipDefaultLibCheck","skipLibCheck","sourceMap","sourceRoot","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","stripInternal","suppressExcessPropertyErrors","suppressImplicitAnyIndexErrors","synchronousWatchDirectory","target","traceResolution","tsBuildInfoFile","typeAcquisition","typeRoots","types","useDefineForClassFields","useUnknownInCatchVariables","verbose","watchDirectory","watchFile","tokenIsJSONKey","explanation","scopes","s","scopeName","isKeyInTSConfig","slice","tsconfigJSONRenderer","oneliner","storedHighlighter","createShikiHighlighter","Promise","resolve","getHighlighter","then","newHighlighter","renderCodeToHTML","lang","shikiOptions","highlighter","Error","renderHighlighter","renderOpts","getForegroundColor","getBackgroundColor","tokens","tmpLang","codeToThemedTokens","note","runTwoSlash","input","replacer","json5","yml","hasReactImport","disableImplicitReactImport","test","reactImport","cutString","index","customTags","results","twoslasher","renderers"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA4B;EACtD,IAAIC,IAAI,GAAG,EAAE;EACbD,IAAI,CAACE,OAAO,CAAC,UAAAC,CAAC;IACZ,IAAIA,CAAC,CAACC,IAAI,KAAK,UAAU,IAAID,CAAC,CAACE,UAAU,EAAE;MACzC,IAAMC,IAAI,GAAGH,CAAC,CAACE,UAAU,CAACE,KAAK,CAAC,KAAK,CAAC;MACtC,IAAMC,IAAI,GAAGF,IAAI,CAACG,GAAG,EAAE;MACvB,IAAMC,IAAI,GAAG,CAACJ,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,EAAEK,IAAI,EAAE;MACnC,IAAMC,OAAO,GAAGF,IAAI,CAACG,QAAQ,CAAC,OAAO,CAAC;MACtC,IAAIC,QAAQ,GAAG;QACbF,OAAO,EAAPA,OAAO;QACPG,QAAQ,EAAEH,OAAO,GAAG,iBAAiB,GAAG,iBAAiB;QACzDI,UAAU,EAAE,MAAM;QAClBC,GAAG,EAAKd,CAAC,CAACe,IAAI;OACf;MAGD,IAAIR,IAAI,CAACG,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,IAAMM,OAAO,GAAI,GAAG,GAAGT,IAAI,CAACH,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI;UACF,IAAMa,gBAAgB,GAAGC,IAAI,CAACC,KAAK,CAACH,OAAO,CAAC;UAC5CL,QAAQ,GAAAS,QAAA,KAAOT,QAAQ,EAAKM,gBAAgB,CAAE;SAC/C,CAAC,OAAOI,KAAK,EAAE;UACd,MAAM,IAAIC,sBAAa,CAAC,4BAA4B,sBAAoBJ,IAAI,CAACK,SAAS,CAACvB,CAAC,CAAC,wBAAmBgB,OAAO,+BAA2BK,KAAa,CAACG,OAA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;EAEzC,IAAMiB,cAAc,GAAG,+CAA+C;;EAGtE,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAChV,QAAQ,CAAC+T,IAAI,CAAC,IAAI,CAAC9T,QAAQ,CAACgV,0BAA0B,IAAI,CAACD,cAAc,CAACE,IAAI,CAAClP,IAAI,CAAC,EAAE;IACvG,IAAMmP,WAAW,GAAG,6BAA6B;IACjD,IAAMC,SAAS,GAAG,gBAAgB;;;IAIlC,IAAIpP,IAAI,CAAChG,QAAQ,CAACoV,SAAS,CAAC,EAAE;MAC5BpP,IAAI,GAAGA,IAAI,CACRtG,KAAK,CAAC0V,SAAS,CAAC,CAChBxP,GAAG,CAAC,UAACiF,IAAI,EAAEwK,KAAK;QAAA,OAAMA,KAAK,IAAI,CAAC,GAAGF,WAAW,CAAC9P,MAAM,CAACwF,IAAI,CAAC,GAAGA,IAAI;OAAC,CAAC,CACpErF,IAAI,CAAC4P,SAAS,CAAC;KACnB,MAAM;MACLpP,IAAI,GAAG,CAACmP,WAAW,EAAEC,SAAS,EAAEpP,IAAI,CAAC,CAACR,IAAI,CAAC,EAAE,CAAC;;;EAIlDvF,QAAQ,CAACqV,UAAU,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;EAC1D,IAAMC,OAAO,GAAGC,mBAAU,CAACxP,IAAI,EAAE+N,IAAI,EAAE9T,QAAQ,CAAC;EAChD,OAAOsV,OAAO;AAChB,CAAC;AAED;AACA,IAAaE,SAAS,GAAG;EACvB1P,iBAAiB,EAAjBA,iBAAiB;EACjBiF,oBAAoB,EAApBA,oBAAoB;EACpB7E,gBAAgB,EAAhBA,gBAAgB;EAChBkN,oBAAoB,EAApBA;CACD;;;;;;;"} \ No newline at end of file diff --git a/patches/shiki-twoslash/shiki-twoslash.cjs.production.min.js b/patches/shiki-twoslash/shiki-twoslash.cjs.production.min.js new file mode 100644 index 000000000..f89a4cab7 --- /dev/null +++ b/patches/shiki-twoslash/shiki-twoslash.cjs.production.min.js @@ -0,0 +1,2 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("shiki"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@typescript/twoslash");function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t\n '+d+"\n

    '+o+"

    \n"}})),t},a=function(e){var t=e.flipped?"M27 39C26.5 32.7511 21.9 17.5173 7.5 6.57333M16.5 4.04L0.999999 0.999998C3.16667 4.88444 7.5 13.16 7.5 15.1867":"M1 39C1.5 32.7511 6.1 17.5173 20.5 6.57333M11.5 4.04L27 0.999998C24.8333 4.88444 20.5 13.16 20.5 15.1867",n=e.arrowRot.split(" ");return"\n \n'};function s(e){return e.replace(//g,">")}var l=function(e){return!!Object.keys(e||{}).find((function(e){return!!e.includes("-")||!isNaN(parseInt(e))}))},c=function(e){var t=[];return Object.keys(e||{}).find((function(e){if(isNaN(parseInt(e))||t.push(parseInt(e)),e.includes("-"))for(var n=e.split("-"),i=n[0],r=parseInt(n[1])+1,o=parseInt(i);o"};function d(e,t,n){var i="";return i+=p(t,n,[]),n.title&&(i+="
    "+n.title+"
    "),t.langId&&(i+='
    '+t.langId+"
    "),i+="
    ",(i=(i+=s(e)).replace(/\n*$/,""))+"
    "}function u(e,t,n,i){var r="",a=i.highlight&&l(i.highlight),d=c(i.highlight);n.tags&&n.tags.length&&(r+="
    "),r+=p(t,i,["twoslash","lsp"]),i.title&&(r+="
    "+i.title+"
    "),t.langId&&(r+='
    '+t.langId+"
    "),r+="
    ";var u,y=f(n.errors,(function(e){return e.line}))||new Map,v=f(n.staticQuickInfos,(function(e){return e.line}))||new Map,b=f(n.queries,(function(e){return e.line-1}))||new Map,w=f(n.tags,(function(e){return e.line-1}))||new Map,S=0;return e.forEach((function(e,n){var i=y.get(n)||[],o=v.get(n)||[],l=b.get(n)||[],c=w.get(n)||[],p="
    ";if(0===e.length&&0===n)S+=1;else if(0===e.length)r+=p+" 
    ",S+=1;else{r+=p;var u=0;e.forEach((function(e){var n,a="",s=function(t){return function(n){return t<=n.character&&t+e.content.length>=n.character+n.length}},c=i.filter(s(u)),p=o.filter(s(u)),d=l.filter(s(u));n=n||p.find((function(e){return e.text===(l.length&&l[0].text)}));var f,h=[].concat(c,p,d).sort((function(e,t){return(e.start||0)-(t.start||0)}));a+=h.length?function(e,t,n){void 0===n&&(n="");var i=function(e){return"⇍"+e+"⇏"},r=function(e,t){switch(e.classes){case"lsp":var r=function(e){return e.replace(/"/g,"⃟")}(e.lsp||"");return i(t?"/data-lsp":"data-lsp lsp=¿"+r+"¿ "+(e.lsp===n?"style=⇯border-bottom: solid 2px lightgrey;⇯":""));case"query":return i((t?"/":"")+"data-highlight");case"err":default:return i((t?"/":"")+"data-err")}};e.sort((function(e,t){var n=function(e){return["err","query","lsp"].indexOf(null!=e?e:"")},i=0;return!(i=e.begin-t.begin)&&!(i=t.end-e.end)&&(i=n(e.classes)-n(t.classes)),i}));var o=0,a=function(e){var n="",i=e.shift();return n+=t.substring(o,i.begin),o=i.begin,n+=r(i),e.some((function(e){return e.begin").replace(/⇯/g,"'").replace(/¿/g,"'")}(function(e){var t={"<":"lt",'"':"quot","'":"apos","&":"amp","\r":"#13","\n":"#10"};return e.toString().replace(/[<"'\r\n&]/g,(function(e){return"&"+t[e]+";"}))}(a(s)+t.substring(o))))}(h.map((function(e){var n={begin:e.start-S,end:e.start+e.length-S};return"renderedMessage"in e&&(n.classes="err"),"kind"in e&&(n.classes=e.kind),"targetString"in e&&(n.classes="lsp",n.lsp=t.includeJSDocInHover&&e.docs?e.docs+"\n\n"+e.text:e.text),n})),e.content,null==(f=n)?void 0:f.text):e.content.replace(//g,"⇏").replace(/'/g,"⇯"),r+=''+a+"",u+=e.content.length,S+=e.content.length})),r+="
    ",S+=1}if(i.length){var f=i.map((function(e){return s(e.renderedMessage)})).join("
    "),x=i.map((function(e){return e.code})).join("
    ");r+=''+f+''+x+"",r+=''+f+""}l.length&&l.forEach((function(e){switch(r+="
    ",e.kind){case"query":var t=s(e.text),i=(v.get(n)||[]).find((function(e){return e.text===(l.length&&l[0].text)}));r+=""+" ".repeat((i&&i.character+(null==i?void 0:i.length)/2)-1||0)+"
    "+t+"
    ";break;case"completions":if(e.completions){var o=e.completions.filter((function(t){return t.name.startsWith(e.completionsPrefix||"____")})).sort((function(e,t){return e.name.localeCompare(t.name)})).map((function(t){var n,i,r=t.name.substr((null==(n=e.completionsPrefix)?void 0:n.length)||0),o=""+(e.completionsPrefix||"")+""+r+"";return"
  • "+o+"
  • "})).join("");r+=" ".repeat(e.offset)+""}else r+="//"+"".padStart(e.offset-2)+"^ - No completions found"}r+="
    "})),c.length&&c.forEach((function(e){if(["error","warn","log"].includes(e.name)){switch(r+="
    ",e.name){case"error":r+=h+""+(e.annotation||"N/A")+"";break;case"warn":r+=g+""+(e.annotation||"N/A")+"";break;case"log":r+=m+""+(e.annotation||"N/A")+""}r+="
    "}}))})),u=r.replace(/\n*$/,""),r=u.replace(/⇍/g,"<").replace(/⇏/g,">").replace(/⇯/g,"'"),r+=t.addTryButton?"
    Try":"",r+="
    ",n.tags&&n.tags.length&&(r+=o(n.tags),r+=""),r}function f(e,t){var n=new Map;return e.forEach((function(e){var i=t(e),r=n.get(i);r?r.push(e):n.set(i,[e])})),n}var h='',g='',m='';function y(e,t,i){var r="",o=i.highlight&&l(i.highlight),a=c(i.highlight);return r+=p(t,i,[]),i.title&&(r+="
    "+i.title+"
    "),t.langId&&(r+='
    '+t.langId+"
    "),r+="
    ",e.forEach((function(e,t){if(0===e.length)r+="
    ";else{var i=o?a(t)?" highlight":" dim":"";r+="
    ",e.forEach((function(e){var t=["color: "+e.color];e.fontStyle&&(e.fontStyle&n.FontStyle.Italic&&t.push("font-style: italic"),e.fontStyle&n.FontStyle.Bold&&t.push("font-weight: bold"),e.fontStyle&n.FontStyle.Underline&&t.push("text-decoration: underline")),r+=''+s(e.content)+""})),r+="
    "}})),r=r.replace(/\n*$/,""),r+="
    "}var v={compilerOptions:"The set of compiler options for your project",allowJs:"Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.",allowSyntheticDefaultImports:"Allow 'import x from y' when a module doesn't have a default export.",allowUmdGlobalAccess:"Allow accessing UMD globals from modules.",allowUnreachableCode:"Disable error reporting for unreachable code.",allowUnusedLabels:"Disable error reporting for unused labels.",alwaysStrict:"Ensure 'use strict' is always emitted.",assumeChangesOnlyAffectDirectDependencies:"Have recompiles in projects that use [`incremental`](#incremental) and `watch` mode assume that changes within a file will only affect files directly depending on it.",baseUrl:"Specify the base directory to resolve non-relative module names.",charset:"No longer supported. In early versions, manually set the text encoding for reading files.",checkJs:"Enable error reporting in type-checked JavaScript files.",clean:"Delete the outputs of all projects.",composite:"Enable constraints that allow a TypeScript project to be used with project references.",declaration:"Generate .d.ts files from TypeScript and JavaScript files in your project.",declarationDir:"Specify the output directory for generated declaration files.",declarationMap:"Create sourcemaps for d.ts files.",diagnostics:"Output compiler performance information after building.",disableFilenameBasedTypeAcquisition:"Disables inference for type acquisition by looking at filenames in a project.",disableReferencedProjectLoad:"Reduce the number of projects loaded automatically by TypeScript.",disableSizeLimit:"Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.",disableSolutionSearching:"Opt a project out of multi-project reference checking when editing.",disableSourceOfProjectReferenceRedirect:"Disable preferring source files instead of declaration files when referencing composite projects",downlevelIteration:"Emit more compliant, but verbose and less performant JavaScript for iteration.",emitBOM:"Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.",emitDeclarationOnly:"Only output d.ts files and not JavaScript files.",emitDecoratorMetadata:"Emit design-type metadata for decorated declarations in source files.",enable:"Disable the type acquisition for JavaScript projects",esModuleInterop:"Emit additional JavaScript to ease support for importing CommonJS modules. This enables [`allowSyntheticDefaultImports`](#allowSyntheticDefaultImports) for type compatibility.",exactOptionalPropertyTypes:"Differentiate between undefined and not present when type checking",exclude:"Filters results from the [`include`](#include) option.",excludeDirectories:"Remove a list of directories from the watch process.",excludeFiles:"Remove a list of files from the watch mode's processing.",experimentalDecorators:"Enable experimental support for TC39 stage 2 draft decorators.",explainFiles:"Print files read during the compilation including why it was included.",extendedDiagnostics:"Output more detailed compiler performance information after building.",extends:"Specify one or more path or node module references to base configuration files from which settings are inherited.",fallbackPolling:"Specify what approach the watcher should use if the system runs out of native file watchers.",files:"Include a list of files. This does not support glob patterns, as opposed to [`include`](#include).",force:"Build all projects, including those that appear to be up to date",forceConsistentCasingInFileNames:"Ensure that casing is correct in imports.",generateCpuProfile:"Emit a v8 CPU profile of the compiler run for debugging.",importHelpers:"Allow importing helper functions from tslib once per project, instead of including them per-file.",importsNotUsedAsValues:"Specify emit/checking behavior for imports that are only used for types.",include:"Specify a list of glob patterns that match files to be included in compilation.",incremental:"Save .tsbuildinfo files to allow for incremental compilation of projects.",inlineSourceMap:"Include sourcemap files inside the emitted JavaScript.",inlineSources:"Include source code in the sourcemaps inside the emitted JavaScript.",isolatedModules:"Ensure that each file can be safely transpiled without relying on other imports.",jsx:"Specify what JSX code is generated.",jsxFactory:"Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'",jsxFragmentFactory:"Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.",jsxImportSource:"Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.",keyofStringsOnly:"Make keyof only return strings instead of string, numbers or symbols. Legacy option.",lib:"Specify a set of bundled library declaration files that describe the target runtime environment.",listEmittedFiles:"Print the names of emitted files after a compilation.",listFiles:"Print all of the files read during the compilation.",locale:"Set the language of the messaging from TypeScript. This does not affect emit.",mapRoot:"Specify the location where debugger should locate map files instead of generated locations.",maxNodeModuleJsDepth:"Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with [`allowJs`](#allowJs).",module:"Specify what module code is generated.",moduleResolution:"Specify how TypeScript looks up a file from a given module specifier.",newLine:"Set the newline character for emitting files.",noEmit:"Disable emitting file from a compilation.",noEmitHelpers:"Disable generating custom helper functions like `__extends` in compiled output.",noEmitOnError:"Disable emitting files if any type checking errors are reported.",noErrorTruncation:"Disable truncating types in error messages.",noFallthroughCasesInSwitch:"Enable error reporting for fallthrough cases in switch statements.",noImplicitAny:"Enable error reporting for expressions and declarations with an implied `any` type..",noImplicitOverride:"Ensure overriding members in derived classes are marked with an override modifier.",noImplicitReturns:"Enable error reporting for codepaths that do not explicitly return in a function.",noImplicitThis:"Enable error reporting when `this` is given the type `any`.",noImplicitUseStrict:"Disable adding 'use strict' directives in emitted JavaScript files.",noLib:"Disable including any library files, including the default lib.d.ts.",noPropertyAccessFromIndexSignature:"Enforces using indexed accessors for keys declared using an indexed type",noResolve:"Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project.",noStrictGenericChecks:"Disable strict checking of generic signatures in function types.",noUncheckedIndexedAccess:"Add `undefined` to a type when accessed using an index.",noUnusedLocals:"Enable error reporting when a local variables aren't read.",noUnusedParameters:"Raise an error when a function parameter isn't read",out:"Deprecated setting. Use [`outFile`](#outFile) instead.",outDir:"Specify an output folder for all emitted files.",outFile:"Specify a file that bundles all outputs into one JavaScript file. If [`declaration`](#declaration) is true, also designates a file that bundles all .d.ts output.",paths:"Specify a set of entries that re-map imports to additional lookup locations.",plugins:"Specify a list of language service plugins to include.",preserveConstEnums:"Disable erasing `const enum` declarations in generated code.",preserveSymlinks:"Disable resolving symlinks to their realpath. This correlates to the same flag in node.",preserveWatchOutput:"Disable wiping the console in watch mode",pretty:"Enable color and formatting in output to make compiler errors easier to read",reactNamespace:"Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.",references:"Specify an array of objects that specify paths for projects. Used in project references.",removeComments:"Disable emitting comments.",resolveJsonModule:"Enable importing .json files",rootDir:"Specify the root folder within your source files.",rootDirs:"Allow multiple folders to be treated as one when resolving modules.",skipDefaultLibCheck:"Skip type checking .d.ts files that are included with TypeScript.",skipLibCheck:"Skip type checking all .d.ts files.",sourceMap:"Create source map files for emitted JavaScript files.",sourceRoot:"Specify the root path for debuggers to find the reference source code.",strict:"Enable all strict type checking options.",strictBindCallApply:"Check that the arguments for `bind`, `call`, and `apply` methods match the original function.",strictFunctionTypes:"When assigning functions, check to ensure parameters and the return values are subtype-compatible.",strictNullChecks:"When type checking, take into account `null` and `undefined`.",strictPropertyInitialization:"Check for class properties that are declared but not set in the constructor.",stripInternal:"Disable emitting declarations that have `@internal` in their JSDoc comments.",suppressExcessPropertyErrors:"Disable reporting of excess property errors during the creation of object literals.",suppressImplicitAnyIndexErrors:"Suppress [`noImplicitAny`](#noImplicitAny) errors when indexing objects that lack index signatures.",synchronousWatchDirectory:"Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively.",target:"Set the JavaScript language version for emitted JavaScript and include compatible library declarations.",traceResolution:"Log paths used during the [`moduleResolution`](#moduleResolution) process.",tsBuildInfoFile:"Specify the folder for .tsbuildinfo incremental compilation files.",typeAcquisition:"Specify options for automatic acquisition of declaration files.",typeRoots:"Specify multiple folders that act like `./node_modules/@types`.",types:"Specify type package names to be included without being referenced in a source file.",useDefineForClassFields:"Emit ECMAScript-standard-compliant class fields.",useUnknownInCatchVariables:"Default catch clause variables as `unknown` instead of `any`.",verbose:"Enable verbose logging",watchDirectory:"Specify how directories are watched on systems that lack recursive file-watching functionality.",watchFile:"Specify how the TypeScript watch mode works."};function b(e,t,n){var i="";return i+=p(t,n,["tsconfig","lsp"]),n.title&&(i+='
    '+n.title+"
    "),t.langId&&(i+='
    '+t.langId+"
    "),i+="
    ",e.forEach((function(e){0===e.length?i+="
    ":(i+="
    ",e.forEach((function(e){if(function(e){return!!e.explanation&&e.explanation.find((function(e){return e.scopes.find((function(e){return e.scopeName.includes("support.type.property-name")}))}))}(e)&&function(e){if('"'!==e.content)return e.content.slice(1,e.content.length-1)in v}(e)){var t=e.content.slice(1,e.content.length-1);i+='""'}else i+=''+s(e.content)+""})),i+="
    ")})),i=i.replace(/\n*$/,""),i+="
    "}var w=null,S={plainTextRenderer:d,defaultShikiRenderer:y,twoslashRenderer:u,tsconfigJSONRenderer:b};exports.createShikiHighlighter=function(e){return w?Promise.resolve(w):t.getHighlighter(e).then((function(e){return w=e}))},exports.renderCodeToHTML=function(e,t,n,i,o,a){if(!o&&!w)throw new Error("The highlighter object hasn't been initialised via `setupHighLighter` yet in shiki-twoslash");var s,l=o||w,c=r({fg:l.getForegroundColor(),bg:l.getBackgroundColor()},i);try{s=l.codeToThemedTokens(e,"jsx"===t?"tsx":t)}catch(i){var p="\x3c!-- Note from shiki-twoslash: the language "+t+" was not set up for Shiki to use, and so there is no code highlighting --\x3e";return d(e,c,n)+p}return t&&n.twoslash&&a?u(s,r({},c,{langId:t}),a,n):t&&t.startsWith("json")&&n.tsconfig?b(s,c,n):y(s,r({},c,{langId:t}),n)},exports.renderers=S,exports.runTwoSlash=function(e,t,n){void 0===n&&(n={});var r=e,o={json5:"json",yml:"yaml"};if(o[t]&&(t=o[t]),["tsx","jsx"].includes(t)&&!n.disableImplicitReactImport&&!/^import\s+React(?:.*)\s+from\s+('|")react\1/gm.test(r)){var a="import React from 'react'\n",s="// ---cut---\n";r=r.includes(s)?r.split(s).map((function(e,t){return 0==t?a.concat(e):e})).join(s):[a,s,r].join("")}return n.customTags=["annotate","log","warn","error"],i.twoslasher(r,t,n)}; +//# sourceMappingURL=shiki-twoslash.cjs.production.min.js.map diff --git a/patches/shiki-twoslash/shiki-twoslash.cjs.production.min.js.map b/patches/shiki-twoslash/shiki-twoslash.cjs.production.min.js.map new file mode 100644 index 000000000..a2970b66d --- /dev/null +++ b/patches/shiki-twoslash/shiki-twoslash.cjs.production.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"shiki-twoslash.cjs.production.min.js","sources":["../src/annotations.ts","../src/utils.ts","../src/renderers/plain.ts","../src/renderers/twoslash.ts","../src/renderers/shiki.ts","../src/tsconfig-oneliners.generated.ts","../src/renderers/tsconfig.ts","../src/index.ts"],"sourcesContent":["import { TwoslashError, TwoSlashReturn } from \"@typescript/twoslash\"\n\nexport const htmlForTags = (tags: TwoSlashReturn[\"tags\"]) => {\n let html = \"\"\n tags.forEach(t => {\n if (t.name === \"annotate\" && t.annotation) {\n const meta = t.annotation.split(\" - \")\n const text = meta.pop()\n const info = (meta[0] || \"\").trim()\n const flipped = info.includes(\"right\")\n let settings = {\n flipped,\n arrowRot: flipped ? \"90deg 20px 20px\" : \"90deg 20px 20px\",\n textDegree: \"0deg\",\n top: `${t.line}em`\n }\n \n \n if (info.includes(\"{\")) {\n const theInfo = \"{\" + info.split(\"{\")[1]\n try {\n const specificSettings = JSON.parse(theInfo)\n settings = {...settings, ...specificSettings }\n } catch (error) {\n throw new TwoslashError(\"Could not parse annotation\", `The annotation ${JSON.stringify(t)} could convert '${theInfo}' into JSON`, `Look at ${(error as any).message}.`)\n }\n }\n \n const arrowSVG = arrow(settings)\n\n html += `\n
    \n ${arrowSVG}\n

    ${text}

    \n
    `\n }\n })\n\n return html\n}\n\nconst arrow = (style: { flipped: boolean; arrowRot: string, textDegree: string, top: string }) => {\n const leftInner = `M27 39C26.5 32.7511 21.9 17.5173 7.5 6.57333M16.5 4.04L0.999999 0.999998C3.16667 4.88444 7.5 13.16 7.5 15.1867`\n const rightInner = `M1 39C1.5 32.7511 6.1 17.5173 20.5 6.57333M11.5 4.04L27 0.999998C24.8333 4.88444 20.5 13.16 20.5 15.1867`\n const inner = style.flipped ? leftInner : rightInner\n const rot = style.arrowRot.split(\" \")\n return `\n \n`\n}\n","import type { parse } from \"fenceparser\"\n\nexport type Meta = NonNullable>\n\ntype Range = {\n begin: number\n end: number\n text?: string\n count?: number\n tooltip?: string[]\n classes?: string\n lsp?: string\n}\n\n/**\n * We're given the text which lives inside the token, and this function will\n * annotate it with twoslash metadata\n */\nexport function createHighlightedString(ranges: Range[], text: string, targetedWord: string = \"\") {\n // Why the weird chars? We need to make sure that generic syntax isn't\n // interpreted as html tags - to do that we need to switch out < to < - *but*\n // making that transition changes the indexes because it's gone from 1 char to 4 chars\n //\n // So, use an obscure character to indicate a real < for HTML, then switch it after\n const tag = (x: string) => `⇍${x}⇏`\n const makeTagFromRange = (r: Range, close?: true) => {\n switch (r.classes) {\n case \"lsp\":\n // The LSP response lives inside a dom attribute, which _can_ have < inside it, so switch them ahead of time.\n const lsp = htmlAttrReplacer(r.lsp || \"\")\n const underLineTargetedWord = r.lsp === targetedWord ? \"style=⇯border-bottom: solid 2px lightgrey;⇯\" : \"\"\n return close ? tag(\"/data-lsp\") : tag(`data-lsp lsp=¿${lsp}¿ ${underLineTargetedWord}`)\n case \"query\":\n return tag(`${close ? \"/\" : \"\"}data-highlight`)\n // handle both unknown and err variant as error-tag\n // case \"err\": is not required, just to be useful for others\n case \"err\":\n default:\n return tag(`${close ? \"/\" : \"\"}data-err`)\n }\n }\n\n ranges.sort((a, b) => {\n // Order of precedence\n // if two same offset meet, the lsp will be put as innermost than err and query\n const precedenceOf = (x?: string) => [\"err\", \"query\", \"lsp\"].indexOf(x ?? \"\")\n\n let cmp = 0\n // Can be desugared into,\n // 1. compare based on smaller begin, !(cmp) means if it's 0 then\n // 2. compare based on bigger end, ^ same thing again then\n // 3. compare based on higher precedence\n // && is so that if a step made cmp to something other than 0, it stops\n /***1*/ !(cmp = a.begin - b.begin) &&\n /*2*/ !(cmp = b.end - a.end) &&\n /*3*/ !(cmp = precedenceOf(a.classes) - precedenceOf(b.classes))\n return cmp\n }) // `Array.sort` works in place\n\n // Marks how much of the text has been put into the output/html\n let cursor = 0\n // should be maximum of O(n) where n is length of ranges\n const nest = (data: typeof ranges) => {\n let stack = \"\"\n const top = data.shift()! // I have made sure data can't be empty\n\n // parse from cursor to top.begin to make sure\n // strings on the way are parsed\n stack += text.substring(cursor, top.begin)\n cursor = top.begin\n\n // open tag\n stack += makeTagFromRange(top)\n\n // if the data still have an element that's in the top's range\n if (data.some(x => x.begin < top.end)) {\n stack += nest(data)\n } else {\n // othewise slice the text and set cursor\n stack += text.substring(top.begin, top.end)\n cursor = top.end\n }\n\n // close tag\n stack += makeTagFromRange(top, true)\n\n // if the tag is complete but still have some data left in the range\n if (data.length !== 0) {\n stack += nest(data)\n }\n\n return stack\n }\n\n // cloned because I don't feel comfortable modifying this as a side-effect from recursion\n const data = JSON.parse(JSON.stringify(ranges))\n const html = nest(data) + text.substring(cursor) // nested + leftover texts\n\n return htmlAttrUnReplacer(replaceTripleArrow(stripHTML(html)))\n}\n\n// HTML attributes have different rules,\nconst htmlAttrReplacer = (str: string) => str.replace(/\"/g, \"⃟\")\nconst htmlAttrUnReplacer = (str: string) => str.replace(/⃟/g, '\"')\n\n// Inline strings which are shown at HTML level\nexport const subTripleArrow = (str: string) => str.replace(//g, \"⇏\").replace(/'/g, \"⇯\")\nexport const replaceTripleArrow = (str: string) =>\n str.replace(/⇍/g, \"<\").replace(/⇏/g, \">\").replace(/⇯/g, \"'\").replace(/¿/g, \"'\")\nexport const replaceTripleArrowEncoded = (str: string) =>\n str.replace(/⇍/g, \"<\").replace(/⇏/g, \">\").replace(/⇯/g, \"'\")\n\nexport function stripHTML(text: string) {\n var table: any = {\n \"<\": \"lt\",\n '\"': \"quot\",\n \"'\": \"apos\",\n \"&\": \"amp\",\n \"\\r\": \"#13\",\n \"\\n\": \"#10\",\n }\n\n return text.toString().replace(/[<\"'\\r\\n&]/g, function (chr) {\n return \"&\" + table[chr] + \";\"\n })\n}\n\nexport function escapeHtml(html: string) {\n return html.replace(//g, \">\")\n}\n\n/** Does anything in the object imply that we should highlight any lines? */\nexport const shouldBeHighlightable = (highlight: any) => {\n return !!Object.keys(highlight || {}).find(key => {\n if (key.includes(\"-\")) return true\n if (!isNaN(parseInt(key))) return true\n return false\n })\n}\n\n/** Returns a func for figuring out if this line should be highlighted */\nexport const shouldHighlightLine = (highlight: any) => {\n const lines: number[] = []\n Object.keys(highlight || {}).find(key => {\n if (!isNaN(parseInt(key))) lines.push(parseInt(key))\n if (key.includes(\"-\")) {\n const [first, last] = key.split(\"-\")\n const lastIndex = parseInt(last) + 1\n for (let i = parseInt(first); i < lastIndex; i++) {\n lines.push(i)\n }\n }\n })\n\n return (line: number) => lines.includes(line)\n}\n","import { escapeHtml, Meta } from \"../utils\"\n\n// C&P'd from shiki\nexport interface HtmlRendererOptions {\n langId?: string\n fg?: string\n bg?: string\n themeName?: string\n}\n\n/** A func for setting a consistent
     */\nexport const preOpenerFromRenderingOptsWithExtras = (opts: HtmlRendererOptions, meta: Meta, classes?: string[]) => {\n  const bg = opts.bg || \"#fff\"\n  const fg = opts.fg || \"black\"\n  const theme = opts.themeName || \"\"\n\n  // shiki + `class` from fence + with-title if title exists + classes\n  const classList = [\"shiki\", theme, meta.class, meta.title ? \"with-title\" : \"\", ...(classes || [])]\n    .filter(Boolean)\n    .join(\" \")\n    .trim()\n\n  const attributes = Object.entries(meta)\n    .filter(entry => {\n      // exclude types other than string, number, boolean\n      // exclude keys class, twoslash\n      // exclude falsy booleans\n      return (\n        [\"string\", \"number\", \"boolean\"].includes(typeof entry[1]) &&\n        ![\"class\", \"twoslash\"].includes(entry[0]) &&\n        entry[1] !== false\n      )\n    })\n    .map(([key, value]) => `${key}=\"${value}\"`)\n    .join(\" \")\n    .trim()\n\n  // prettier-ignore\n  return `
    `\n}\n\n/** You don't have a language which shiki twoslash can handle, make a DOM compatible version  */\nexport function plainTextRenderer(code: string, options: HtmlRendererOptions, meta: Meta) {\n  let html = \"\"\n\n  html += preOpenerFromRenderingOptsWithExtras(options, meta, [])\n  if (meta.title) {\n    html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n html += escapeHtml(code)\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","type Lines = import(\"shiki\").IThemedToken[][]\ntype TwoSlash = import(\"@typescript/twoslash\").TwoSlashReturn\n\nimport { TwoslashShikiOptions } from \"..\"\nimport { htmlForTags } from \"../annotations\"\nimport {\n shouldBeHighlightable,\n shouldHighlightLine,\n createHighlightedString,\n subTripleArrow,\n replaceTripleArrowEncoded,\n escapeHtml,\n Meta,\n} from \"../utils\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\n// OK, so - this is just straight up complex code.\n\n// What we're trying to do is merge two sets of information into a single tree for HTML\n\n// 1: Syntax highlight info from shiki\n// 2: Twoslash metadata like errors, identifiers etc\n\n// Because shiki gives use a set of lines to work from, then the first thing which happens\n// is converting twoslash data into the same format.\n\n// Things which make it hard:\n//\n// - Twoslash results can be cut, so sometimes there is edge cases between twoslash results\n// - Twoslash results can be multi-file\n// - the DOM requires a flattened graph of html elements (e.g. spans can' be interspersed)\n//\n\nexport function twoslashRenderer(lines: Lines, options: HtmlRendererOptions & TwoslashShikiOptions, twoslash: TwoSlash, meta: Meta) {\n let html = \"\"\n\n const hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight)\n const hl = shouldHighlightLine(meta.highlight)\n\n if (twoslash.tags && twoslash.tags.length) html += \"
    \"\n \n html += preOpenerFromRenderingOptsWithExtras(options, meta, [\"twoslash\", \"lsp\"])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n const errorsGroupedByLine = groupBy(twoslash.errors, e => e.line) || new Map()\n const staticQuickInfosGroupedByLine = groupBy(twoslash.staticQuickInfos, q => q.line) || new Map()\n // A query is always about the line above it!\n const queriesGroupedByLine = groupBy(twoslash.queries, q => q.line - 1) || new Map()\n const tagsGroupedByLine = groupBy(twoslash.tags, q => q.line - 1) || new Map()\n\n /**\n * This is the index of the original twoslash code reference, it is not\n * related to the HTML output\n */\n let filePos = 0\n\n lines.forEach((l, i) => {\n const errors = errorsGroupedByLine.get(i) || []\n const lspValues = staticQuickInfosGroupedByLine.get(i) || []\n const queries = queriesGroupedByLine.get(i) || []\n const tags = tagsGroupedByLine.get(i) || []\n\n const hiClass = hasHighlight ? (hl(i + 1) ? \" highlight\" : \" dim\") : \"\"\n const prefix = `
    `\n\n if (l.length === 0 && i === 0) {\n // Skip the first newline if it's blank\n filePos += 1\n } else if (l.length === 0) {\n const emptyLine = `${prefix} 
    ` \n html += emptyLine\n filePos += 1\n } else {\n html += prefix\n\n // Keep track of the position of the current token in a line so we can match it up to the\n // errors and lang serv identifiers\n let tokenPos = 0\n\n l.forEach(token => {\n let targetedQueryWord: typeof twoslash.staticQuickInfos[number] | undefined\n\n let tokenContent = \"\"\n // Underlining particular words\n const findTokenFunc = (start: number) => (e: any) =>\n start <= e.character && start + token.content.length >= e.character + e.length\n\n const findTokenDebug = (start: number) => (e: any) => {\n const result = start <= e.character && start + token.content.length >= e.character + e.length\n // prettier-ignore\n console.log(result, start, '<=', e.character, '&&', start + token.content.length, '>=', e.character + e.length)\n if (result) {\n console.log(\"Found:\", e)\n console.log(\"Inside:\", token)\n }\n return result\n }\n\n const errorsInToken = errors.filter(findTokenFunc(tokenPos))\n const lspResponsesInToken = lspValues.filter(findTokenFunc(tokenPos))\n const queriesInToken = queries.filter(findTokenFunc(tokenPos))\n\n // Does this line have a word targeted by a query?\n targetedQueryWord = targetedQueryWord || lspResponsesInToken.find(response => response.text === (queries.length && queries[0].text))!\n\n const allTokens = [...errorsInToken, ...lspResponsesInToken, ...queriesInToken]\n const allTokensByStart = allTokens.sort((l, r) => {\n return (l.start || 0) - (r.start || 0)\n })\n\n if (allTokensByStart.length) {\n const ranges = allTokensByStart.map(token => {\n const range: any = {\n begin: token.start! - filePos,\n end: token.start! + token.length! - filePos,\n }\n\n // prettier-ignore\n if (range.begin < 0 || range.end < 0) {\n // prettier-ignore\n // throw new Error(`The begin range of a token is at a minus location, filePos:${filePos} current token: ${JSON.stringify(token, null, ' ')}\\n result: ${JSON.stringify(range, null, ' ')}`)\n }\n\n if (\"renderedMessage\" in token) range.classes = \"err\"\n if (\"kind\" in token) range.classes = token.kind\n if (\"targetString\" in token) {\n range.classes = \"lsp\"\n const lspText = options.includeJSDocInHover && token.docs ? `${token.docs}\\n\\n${token.text}` : token.text\n range[\"lsp\"] = lspText\n }\n return range\n })\n\n tokenContent += createHighlightedString(ranges, token.content, targetedQueryWord?.text)\n } else {\n tokenContent += subTripleArrow(token.content)\n }\n\n html += `${tokenContent}`\n tokenPos += token.content.length\n filePos += token.content.length\n })\n\n html += `
    `\n // This is the \\n which the
    represents\n filePos += 1\n }\n\n // Adding error messages to the line after\n if (errors.length) {\n const messages = errors.map(e => escapeHtml(e.renderedMessage)).join(\"
    \")\n const codes = errors.map(e => e.code).join(\"
    \")\n html += `${messages}${codes}`\n html += `${messages}`\n }\n\n // Add queries to the next line\n if (queries.length) {\n queries.forEach(query => {\n // This is used to wrap popovers and completions to improve styling options for users.\n html += `
    `\n\n switch (query.kind) {\n case \"query\": {\n const queryTextWithPrefix = escapeHtml(query.text!)\n const lspValues = staticQuickInfosGroupedByLine.get(i) || []\n const targetedWord = lspValues.find(response => response.text === (queries.length && queries[0].text))!\n const halfWayAcrossTheTargetedWord = ((targetedWord && targetedWord.character + targetedWord?.length / 2) - 1) || 0\n html +=\n `` +\n \" \".repeat(halfWayAcrossTheTargetedWord) +\n \"\" +\n `
    ${queryTextWithPrefix}
    `\n break\n }\n\n case \"completions\": {\n if (!query.completions) {\n html += `${\"//\" + \"\".padStart(query.offset - 2) + \"^ - No completions found\"}`\n } else {\n const prefixed = query.completions.filter(c => c.name.startsWith(query.completionsPrefix || \"____\"))\n\n const lis = prefixed\n .sort((l, r) => l.name.localeCompare(r.name))\n .map(c => {\n const after = c.name.substr(query.completionsPrefix?.length || 0)\n const name = `${query.completionsPrefix || \"\"}${after}`\n const isDeprecated = c.kindModifiers?.split(\",\").includes(\"deprecated\")\n const liClass = isDeprecated ? \"deprecated\" : \"\"\n return `
  • ${name}
  • `\n })\n .join(\"\")\n html += `${\" \".repeat(query.offset)}`\n }\n }\n }\n html += \"
    \"\n })\n }\n\n // Any tags (currently that's warn/error/log)\n if (tags.length) {\n tags.forEach(tag => {\n if(![\"error\", \"warn\", \"log\"].includes(tag.name)) return\n\n // This is used to wrap popovers and completions to improve styling options for users.\n html += `
    `\n switch(tag.name) {\n case \"error\": html += `${errorSVG}${tag.annotation || \"N/A\"}`; break;\n case \"warn\": html += `${warningSVG}${tag.annotation || \"N/A\"}`; break;\n case \"log\": html += `${logSVG}${tag.annotation || \"N/A\"}`; break;\n }\n html += \"
    \"\n })\n }\n })\n html = replaceTripleArrowEncoded(html.replace(/\\n*$/, \"\")) // Get rid of final new lines\n\n if (options.addTryButton) {\n const playgroundLink = `Try`\n html += `
    ${playgroundLink}`\n } else {\n html += ``\n }\n\n html += `
    `\n\n // Attach annotations which live above of the code\n if (twoslash.tags && twoslash.tags.length) {\n html += htmlForTags(twoslash.tags)\n html += \"\"\n }\n\n return html\n}\n\n/** Returns a map where all the keys are the value in keyGetter */\nfunction groupBy(list: T[], keyGetter: (obj: any) => number) {\n const map = new Map()\n list.forEach(item => {\n const key = keyGetter(item)\n const collection = map.get(key)\n if (!collection) {\n map.set(key, [item])\n } else {\n collection.push(item)\n }\n })\n return map\n}\n\n\nconst errorSVG = ``\nconst warningSVG = ``\nconst logSVG = ``","import { shouldBeHighlightable, shouldHighlightLine, escapeHtml, Meta } from \"../utils\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\nimport shiki from \"shiki\"\n\ntype Lines = shiki.IThemedToken[][]\n\nexport function defaultShikiRenderer(lines: Lines, options: HtmlRendererOptions, meta: Meta) {\n let html = \"\"\n\n const hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight)\n const hl = shouldHighlightLine(meta.highlight)\n\n html += preOpenerFromRenderingOptsWithExtras(options, meta, [])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n lines.forEach((l, i) => {\n if (l.length === 0) {\n html += `
    `\n } else {\n const hiClass = hasHighlight ? (hl(i) ? \" highlight\" : \" dim\") : \"\"\n const prefix = `
    `\n html += prefix\n\n l.forEach(token => {\n const cssDeclarations = [`color: ${token.color}`];\n if (token.fontStyle) {\n if (token.fontStyle & shiki.FontStyle.Italic) {\n cssDeclarations.push('font-style: italic');\n }\n if (token.fontStyle & shiki.FontStyle.Bold) {\n cssDeclarations.push('font-weight: bold');\n }\n if (token.fontStyle & shiki.FontStyle.Underline) {\n cssDeclarations.push('text-decoration: underline');\n }\n }\n html += `${escapeHtml(token.content)}`\n })\n html += `
    `\n }\n })\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","export const tsconfig = {\n compilerOptions: `The set of compiler options for your project`,\n allowJs: `Allow JavaScript files to be a part of your program. Use the \\`checkJS\\` option to get errors from these files.`,\n allowSyntheticDefaultImports: `Allow 'import x from y' when a module doesn't have a default export.`,\n allowUmdGlobalAccess: `Allow accessing UMD globals from modules.`,\n allowUnreachableCode: `Disable error reporting for unreachable code.`,\n allowUnusedLabels: `Disable error reporting for unused labels.`,\n alwaysStrict: `Ensure 'use strict' is always emitted.`,\n assumeChangesOnlyAffectDirectDependencies: `Have recompiles in projects that use [\\`incremental\\`](#incremental) and \\`watch\\` mode assume that changes within a file will only affect files directly depending on it.`,\n baseUrl: `Specify the base directory to resolve non-relative module names.`,\n charset: `No longer supported. In early versions, manually set the text encoding for reading files.`,\n checkJs: `Enable error reporting in type-checked JavaScript files.`,\n clean: `Delete the outputs of all projects.`,\n composite: `Enable constraints that allow a TypeScript project to be used with project references.`,\n declaration: `Generate .d.ts files from TypeScript and JavaScript files in your project.`,\n declarationDir: `Specify the output directory for generated declaration files.`,\n declarationMap: `Create sourcemaps for d.ts files.`,\n diagnostics: `Output compiler performance information after building.`,\n disableFilenameBasedTypeAcquisition: `Disables inference for type acquisition by looking at filenames in a project.`,\n disableReferencedProjectLoad: `Reduce the number of projects loaded automatically by TypeScript.`,\n disableSizeLimit: `Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.`,\n disableSolutionSearching: `Opt a project out of multi-project reference checking when editing.`,\n disableSourceOfProjectReferenceRedirect: `Disable preferring source files instead of declaration files when referencing composite projects`,\n downlevelIteration: `Emit more compliant, but verbose and less performant JavaScript for iteration.`,\n emitBOM: `Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.`,\n emitDeclarationOnly: `Only output d.ts files and not JavaScript files.`,\n emitDecoratorMetadata: `Emit design-type metadata for decorated declarations in source files.`,\n enable: `Disable the type acquisition for JavaScript projects`,\n esModuleInterop: `Emit additional JavaScript to ease support for importing CommonJS modules. This enables [\\`allowSyntheticDefaultImports\\`](#allowSyntheticDefaultImports) for type compatibility.`,\n exactOptionalPropertyTypes: `Differentiate between undefined and not present when type checking`,\n exclude: `Filters results from the [\\`include\\`](#include) option.`,\n excludeDirectories: `Remove a list of directories from the watch process.`,\n excludeFiles: `Remove a list of files from the watch mode's processing.`,\n experimentalDecorators: `Enable experimental support for TC39 stage 2 draft decorators.`,\n explainFiles: `Print files read during the compilation including why it was included.`,\n extendedDiagnostics: `Output more detailed compiler performance information after building.`,\n extends: `Specify one or more path or node module references to base configuration files from which settings are inherited.`,\n fallbackPolling: `Specify what approach the watcher should use if the system runs out of native file watchers.`,\n files: `Include a list of files. This does not support glob patterns, as opposed to [\\`include\\`](#include).`,\n force: `Build all projects, including those that appear to be up to date`,\n forceConsistentCasingInFileNames: `Ensure that casing is correct in imports.`,\n generateCpuProfile: `Emit a v8 CPU profile of the compiler run for debugging.`,\n importHelpers: `Allow importing helper functions from tslib once per project, instead of including them per-file.`,\n importsNotUsedAsValues: `Specify emit/checking behavior for imports that are only used for types.`,\n include: `Specify a list of glob patterns that match files to be included in compilation.`,\n incremental: `Save .tsbuildinfo files to allow for incremental compilation of projects.`,\n inlineSourceMap: `Include sourcemap files inside the emitted JavaScript.`,\n inlineSources: `Include source code in the sourcemaps inside the emitted JavaScript.`,\n isolatedModules: `Ensure that each file can be safely transpiled without relying on other imports.`,\n jsx: `Specify what JSX code is generated.`,\n jsxFactory: `Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'`,\n jsxFragmentFactory: `Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.`,\n jsxImportSource: `Specify module specifier used to import the JSX factory functions when using \\`jsx: react-jsx*\\`.`,\n keyofStringsOnly: `Make keyof only return strings instead of string, numbers or symbols. Legacy option.`,\n lib: `Specify a set of bundled library declaration files that describe the target runtime environment.`,\n listEmittedFiles: `Print the names of emitted files after a compilation.`,\n listFiles: `Print all of the files read during the compilation.`,\n locale: `Set the language of the messaging from TypeScript. This does not affect emit.`,\n mapRoot: `Specify the location where debugger should locate map files instead of generated locations.`,\n maxNodeModuleJsDepth: `Specify the maximum folder depth used for checking JavaScript files from \\`node_modules\\`. Only applicable with [\\`allowJs\\`](#allowJs).`,\n module: `Specify what module code is generated.`,\n moduleResolution: `Specify how TypeScript looks up a file from a given module specifier.`,\n newLine: `Set the newline character for emitting files.`,\n noEmit: `Disable emitting file from a compilation.`,\n noEmitHelpers: `Disable generating custom helper functions like \\`__extends\\` in compiled output.`,\n noEmitOnError: `Disable emitting files if any type checking errors are reported.`,\n noErrorTruncation: `Disable truncating types in error messages.`,\n noFallthroughCasesInSwitch: `Enable error reporting for fallthrough cases in switch statements.`,\n noImplicitAny: `Enable error reporting for expressions and declarations with an implied \\`any\\` type..`,\n noImplicitOverride: `Ensure overriding members in derived classes are marked with an override modifier.`,\n noImplicitReturns: `Enable error reporting for codepaths that do not explicitly return in a function.`,\n noImplicitThis: `Enable error reporting when \\`this\\` is given the type \\`any\\`.`,\n noImplicitUseStrict: `Disable adding 'use strict' directives in emitted JavaScript files.`,\n noLib: `Disable including any library files, including the default lib.d.ts.`,\n noPropertyAccessFromIndexSignature: `Enforces using indexed accessors for keys declared using an indexed type`,\n noResolve: `Disallow \\`import\\`s, \\`require\\`s or \\`\\`s from expanding the number of files TypeScript should add to a project.`,\n noStrictGenericChecks: `Disable strict checking of generic signatures in function types.`,\n noUncheckedIndexedAccess: `Add \\`undefined\\` to a type when accessed using an index.`,\n noUnusedLocals: `Enable error reporting when a local variables aren't read.`,\n noUnusedParameters: `Raise an error when a function parameter isn't read`,\n out: `Deprecated setting. Use [\\`outFile\\`](#outFile) instead.`,\n outDir: `Specify an output folder for all emitted files.`,\n outFile: `Specify a file that bundles all outputs into one JavaScript file. If [\\`declaration\\`](#declaration) is true, also designates a file that bundles all .d.ts output.`,\n paths: `Specify a set of entries that re-map imports to additional lookup locations.`,\n plugins: `Specify a list of language service plugins to include.`,\n preserveConstEnums: `Disable erasing \\`const enum\\` declarations in generated code.`,\n preserveSymlinks: `Disable resolving symlinks to their realpath. This correlates to the same flag in node.`,\n preserveWatchOutput: `Disable wiping the console in watch mode`,\n pretty: `Enable color and formatting in output to make compiler errors easier to read`,\n reactNamespace: `Specify the object invoked for \\`createElement\\`. This only applies when targeting \\`react\\` JSX emit.`,\n references: `Specify an array of objects that specify paths for projects. Used in project references.`,\n removeComments: `Disable emitting comments.`,\n resolveJsonModule: `Enable importing .json files`,\n rootDir: `Specify the root folder within your source files.`,\n rootDirs: `Allow multiple folders to be treated as one when resolving modules.`,\n skipDefaultLibCheck: `Skip type checking .d.ts files that are included with TypeScript.`,\n skipLibCheck: `Skip type checking all .d.ts files.`,\n sourceMap: `Create source map files for emitted JavaScript files.`,\n sourceRoot: `Specify the root path for debuggers to find the reference source code.`,\n strict: `Enable all strict type checking options.`,\n strictBindCallApply: `Check that the arguments for \\`bind\\`, \\`call\\`, and \\`apply\\` methods match the original function.`,\n strictFunctionTypes: `When assigning functions, check to ensure parameters and the return values are subtype-compatible.`,\n strictNullChecks: `When type checking, take into account \\`null\\` and \\`undefined\\`.`,\n strictPropertyInitialization: `Check for class properties that are declared but not set in the constructor.`,\n stripInternal: `Disable emitting declarations that have \\`@internal\\` in their JSDoc comments.`,\n suppressExcessPropertyErrors: `Disable reporting of excess property errors during the creation of object literals.`,\n suppressImplicitAnyIndexErrors: `Suppress [\\`noImplicitAny\\`](#noImplicitAny) errors when indexing objects that lack index signatures.`,\n synchronousWatchDirectory: `Synchronously call callbacks and update the state of directory watchers on platforms that don\\`t support recursive watching natively.`,\n target: `Set the JavaScript language version for emitted JavaScript and include compatible library declarations.`,\n traceResolution: `Log paths used during the [\\`moduleResolution\\`](#moduleResolution) process.`,\n tsBuildInfoFile: `Specify the folder for .tsbuildinfo incremental compilation files.`,\n typeAcquisition: `Specify options for automatic acquisition of declaration files.`,\n typeRoots: `Specify multiple folders that act like \\`./node_modules/@types\\`.`,\n types: `Specify type package names to be included without being referenced in a source file.`,\n useDefineForClassFields: `Emit ECMAScript-standard-compliant class fields.`,\n useUnknownInCatchVariables: `Default catch clause variables as \\`unknown\\` instead of \\`any\\`.`,\n verbose: `Enable verbose logging`,\n watchDirectory: `Specify how directories are watched on systems that lack recursive file-watching functionality.`,\n watchFile: `Specify how the TypeScript watch mode works.`,\n};\n","type Lines = import(\"shiki\").IThemedToken[][]\n\nimport type { IThemedToken } from \"shiki\"\nimport { escapeHtml, Meta } from \"../utils\"\nimport { tsconfig } from \"../tsconfig-oneliners.generated\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\n/** Uses tmLanguage scopes to determine what the content of the token is */\nconst tokenIsJSONKey = (token: IThemedToken) => {\n if (!token.explanation) return false\n return token.explanation.find(e => e.scopes.find(s => s.scopeName.includes(\"support.type.property-name\")))\n}\n\n/** Can you look up the token in the tsconfig reference? */\nconst isKeyInTSConfig = (token: IThemedToken) => {\n if (token.content === '\"') return\n const name = token.content.slice(1, token.content.length - 1)\n return name in tsconfig\n}\n\n/**\n * Renders a TSConfig JSON object with additional LSP-ish information\n * @param lines the result of shiki highlighting\n * @param options shiki display options\n */\nexport function tsconfigJSONRenderer(lines: Lines, options: HtmlRendererOptions, meta: Meta) {\n let html = \"\"\n\n html += preOpenerFromRenderingOptsWithExtras(options, meta, [\"tsconfig\", \"lsp\"])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n lines.forEach(l => {\n if (l.length === 0) {\n html += `
    `\n } else {\n html += `
    `\n l.forEach(token => {\n // This means we're looking at a token which could be '\"module\"', '\"', '\"compilerOptions\"' etc\n if (tokenIsJSONKey(token) && isKeyInTSConfig(token)) {\n const key = token.content.slice(1, token.content.length - 1)\n const oneliner = (tsconfig as Record)[key]\n // prettier-ignore\n html += `\"\"`\n } else {\n html += `${escapeHtml(token.content)}`\n }\n })\n html += `
    `\n }\n })\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","import { getHighlighter, Highlighter, HighlighterOptions, IThemedToken } from \"shiki\"\nimport { twoslasher, TwoSlashOptions, TwoSlashReturn } from \"@typescript/twoslash\"\nimport { twoslashRenderer } from \"./renderers/twoslash\"\nimport { HtmlRendererOptions, plainTextRenderer } from \"./renderers/plain\"\nimport { defaultShikiRenderer } from \"./renderers/shiki\"\nimport { tsconfigJSONRenderer } from \"./renderers/tsconfig\"\nimport { Meta } from \"./utils\"\n\nexport interface TwoslashShikiOptions {\n /** A way to turn on the try buttons seen on the TS website */\n addTryButton?: true\n /** A way to disable implicit React imports on tsx/jsx language codeblocks */\n disableImplicitReactImport?: true\n /** A way to add a div wrapper for multi-theme outputs */\n wrapFragments?: true\n /** Include JSDoc comments in the hovers */\n includeJSDocInHover?: true\n /** Instead of showing twoslash exceptions inline, throw the entire process like it will on CI */\n alwayRaiseForTwoslashExceptions?: true\n /** Ignore transforming certain code blocks */\n ignoreCodeblocksWithCodefenceMeta?: string[]\n}\n\n/** The possible user config, a combination of all shiki, twoslash and twoslash-shiki options */\nexport type UserConfigSettings = HighlighterOptions & TwoSlashOptions & TwoslashShikiOptions\n\n/**\n * This gets filled in by the promise below, then should\n * hopefully be more or less synchronous access by each parse\n * of the highlighter\n */\nlet storedHighlighter: Highlighter = null as any\n\n/**\n * Creates a *cached singleton* Shiki highlighter, this is an async call because of the call to WASM to get\n * the regex parser set up.\n *\n * In other functions, passing a the result of this highlighter function is kind of optional but it's the author's\n * opinion that you should be in control of the highlighter, and not this library.\n *\n */\nexport const createShikiHighlighter = (options: HighlighterOptions) => {\n if (storedHighlighter) return Promise.resolve(storedHighlighter)\n\n return getHighlighter(options).then(newHighlighter => {\n storedHighlighter = newHighlighter\n return storedHighlighter\n })\n}\n\n/**\n * Renders a code sample to HTML, automatically taking into account:\n *\n * - rendering overrides for twoslash and tsconfig\n * - whether the language exists in shiki\n *\n * @param code the source code to render\n * @param lang the language to use in highlighting\n * @param info additional metadata which lives after the code-fence lang (e.g. `{ twoslash: true }`)\n * @param shikiOptions user settings\n * @param highlighter optional, but you should use it, highlighter\n * @param twoslash optional, but required when info contains 'twoslash' as a string\n */\nexport const renderCodeToHTML = (\n code: string,\n lang: string,\n meta: Meta,\n shikiOptions?: UserConfigSettings & { themeName: string },\n highlighter?: Highlighter,\n twoslash?: TwoSlashReturn\n) => {\n if (!highlighter && !storedHighlighter) {\n throw new Error(\"The highlighter object hasn't been initialised via `setupHighLighter` yet in shiki-twoslash\")\n }\n\n // Shiki does know the lang, so tokenize\n const renderHighlighter = highlighter || storedHighlighter\n\n const renderOpts: HtmlRendererOptions = {\n fg: renderHighlighter.getForegroundColor(),\n bg: renderHighlighter.getBackgroundColor(),\n ...shikiOptions,\n }\n\n let tokens: IThemedToken[][]\n try {\n // I'm a little unsure about why we need this, perhaps the jsx language\n // upstream in shiki is broken?\n const tmpLang = lang === \"jsx\" ? \"tsx\" : lang\n\n tokens = renderHighlighter.codeToThemedTokens(code, tmpLang as any)\n } catch (error) {\n // Shiki doesn't know this lang, so render it as plain text, but\n // also add a note at the end as a HTML comment\n const note = ``\n return plainTextRenderer(code, renderOpts, meta) + note\n }\n\n // Twoslash specific renderer\n if (lang && meta.twoslash && twoslash) {\n return twoslashRenderer(tokens, { ...renderOpts, langId: lang }, twoslash, meta)\n }\n\n // TSConfig renderer\n if (lang && lang.startsWith(\"json\") && meta.tsconfig) {\n return tsconfigJSONRenderer(tokens, renderOpts, meta)\n }\n\n // Otherwise just the normal shiki renderer\n return defaultShikiRenderer(tokens, { ...renderOpts, langId: lang }, meta)\n}\n\n/**\n * Runs Twoslash over the code passed in with a particular language as the default file.\n */\nexport const runTwoSlash = (input: string, lang: string, settings: UserConfigSettings = {}): TwoSlashReturn => {\n let code = input\n\n // Shiki doesn't handle a few filetype mappings, so do that ahead of time. Oddly enough, this also\n // gets re-done at remark-shiki level\n const replacer = {\n json5: \"json\",\n yml: \"yaml\",\n }\n\n // @ts-ignore\n if (replacer[lang]) lang = replacer[lang]\n\n const hasReactImport = /^import\\s+React(?:.*)\\s+from\\s+('|\")react\\1/gm\n\n // Add react import to code samples indicating they're needing react.\n if ([\"tsx\", \"jsx\"].includes(lang) && !settings.disableImplicitReactImport && !hasReactImport.test(code)) {\n const reactImport = \"import React from 'react'\\n\"\n const cutString = \"// ---cut---\\n\"\n // ^ cutString taken directly from\n // https://github.com/microsoft/TypeScript-Website/blob/0c8d98a69d520365c1909d536fa1323f03a8438c/packages/ts-twoslasher/src/index.ts#L694\n\n if (code.includes(cutString)) {\n code = code\n .split(cutString)\n .map((item, index) => (index == 0 ? reactImport.concat(item) : item))\n .join(cutString)\n } else {\n code = [reactImport, cutString, code].join(\"\")\n }\n }\n\n settings.customTags = [\"annotate\", \"log\", \"warn\", \"error\"]\n const results = twoslasher(code, lang, settings)\n return results\n}\n\n/** Set of renderers if you want to explicitly call one instead of using renderCodeToHTML */\nexport const renderers = {\n plainTextRenderer,\n defaultShikiRenderer,\n twoslashRenderer,\n tsconfigJSONRenderer,\n}\n"],"names":["htmlForTags","tags","html","forEach","t","name","annotation","meta","split","text","pop","info","trim","flipped","includes","settings","arrowRot","textDegree","top","line","theInfo","_extends","JSON","parse","error","TwoslashError","stringify","message","arrowSVG","arrow","style","inner","rot","escapeHtml","replace","shouldBeHighlightable","highlight","Object","keys","find","key","isNaN","parseInt","shouldHighlightLine","lines","push","_key$split","first","lastIndex","i","preOpenerFromRenderingOptsWithExtras","opts","classes","bg","fg","classList","themeName","title","concat","filter","Boolean","join","attributes","entries","entry","map","_ref","plainTextRenderer","code","options","langId","twoslashRenderer","twoslash","hasHighlight","hl","length","str","errorsGroupedByLine","groupBy","errors","e","Map","staticQuickInfosGroupedByLine","staticQuickInfos","q","queriesGroupedByLine","queries","tagsGroupedByLine","filePos","l","get","lspValues","prefix","tokenPos","token","targetedQueryWord","tokenContent","findTokenFunc","start","character","content","errorsInToken","lspResponsesInToken","queriesInToken","response","_targetedQueryWord","allTokensByStart","sort","r","ranges","targetedWord","tag","x","makeTagFromRange","close","lsp","htmlAttrReplacer","a","b","precedenceOf","indexOf","cmp","begin","end","cursor","nest","data","stack","shift","substring","some","htmlAttrUnReplacer","replaceTripleArrow","table","<","\"","'","&","\r","\n","toString","chr","stripHTML","createHighlightedString","range","kind","includeJSDocInHover","docs","color","messages","renderedMessage","codes","query","queryTextWithPrefix","repeat","completions","lis","c","startsWith","completionsPrefix","localeCompare","after","substr","_query$completionsPre","_c$kindModifiers","kindModifiers","offset","padStart","errorSVG","warningSVG","logSVG","addTryButton","playgroundURL","list","keyGetter","item","collection","set","defaultShikiRenderer","hiClass","cssDeclarations","fontStyle","shiki","FontStyle","Italic","Bold","Underline","tsconfig","compilerOptions","allowJs","allowSyntheticDefaultImports","allowUmdGlobalAccess","allowUnreachableCode","allowUnusedLabels","alwaysStrict","assumeChangesOnlyAffectDirectDependencies","baseUrl","charset","checkJs","clean","composite","declaration","declarationDir","declarationMap","diagnostics","disableFilenameBasedTypeAcquisition","disableReferencedProjectLoad","disableSizeLimit","disableSolutionSearching","disableSourceOfProjectReferenceRedirect","downlevelIteration","emitBOM","emitDeclarationOnly","emitDecoratorMetadata","enable","esModuleInterop","exactOptionalPropertyTypes","exclude","excludeDirectories","excludeFiles","experimentalDecorators","explainFiles","extendedDiagnostics","extends","fallbackPolling","files","force","forceConsistentCasingInFileNames","generateCpuProfile","importHelpers","importsNotUsedAsValues","include","incremental","inlineSourceMap","inlineSources","isolatedModules","jsx","jsxFactory","jsxFragmentFactory","jsxImportSource","keyofStringsOnly","lib","listEmittedFiles","listFiles","locale","mapRoot","maxNodeModuleJsDepth","module","moduleResolution","newLine","noEmit","noEmitHelpers","noEmitOnError","noErrorTruncation","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noImplicitUseStrict","noLib","noPropertyAccessFromIndexSignature","noResolve","noStrictGenericChecks","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","out","outDir","outFile","paths","plugins","preserveConstEnums","preserveSymlinks","preserveWatchOutput","pretty","reactNamespace","references","removeComments","resolveJsonModule","rootDir","rootDirs","skipDefaultLibCheck","skipLibCheck","sourceMap","sourceRoot","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","stripInternal","suppressExcessPropertyErrors","suppressImplicitAnyIndexErrors","synchronousWatchDirectory","target","traceResolution","tsBuildInfoFile","typeAcquisition","typeRoots","types","useDefineForClassFields","useUnknownInCatchVariables","verbose","watchDirectory","watchFile","tsconfigJSONRenderer","explanation","scopes","s","scopeName","tokenIsJSONKey","slice","isKeyInTSConfig","storedHighlighter","renderers","Promise","resolve","getHighlighter","then","newHighlighter","lang","shikiOptions","highlighter","Error","tokens","renderHighlighter","renderOpts","getForegroundColor","getBackgroundColor","codeToThemedTokens","note","input","replacer","json5","yml","disableImplicitReactImport","test","reactImport","cutString","index","customTags","twoslasher"],"mappings":"6YAEO,IAAMA,EAAc,SAACC,GAC1B,IAAIC,EAAO,GAmCX,OAlCAD,EAAKE,SAAQ,SAAAC,GACX,GAAe,aAAXA,EAAEC,MAAuBD,EAAEE,WAAY,CACzC,IAAMC,EAAOH,EAAEE,WAAWE,MAAM,OAC1BC,EAAOF,EAAKG,MACZC,GAAQJ,EAAK,IAAM,IAAIK,OACvBC,EAAUF,EAAKG,SAAS,SAC1BC,EAAW,CACbF,QAAAA,EACAG,SAAoB,kBACpBC,WAAY,OACZC,IAAQd,EAAEe,WAIZ,GAAIR,EAAKG,SAAS,KAAM,CACtB,IAAMM,EAAW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AwBkL,EAAgBvH,KAAK,WAAU5B,EAAW6D,EAAMM,sBAE1ElG,gBAIJA,EAAOA,EAAKgC,QAAQ,OAAQ,IAC5BhC,6BCnDWyL,EAAW,CACtBC,+DACAC,wHACAC,oGACAC,iEACAC,qEACAC,+DACAC,sDACAC,mNACAC,2EACAC,oGACAC,mEACAC,4CACAC,mGACAC,yFACAC,+EACAC,mDACAC,sEACAC,oHACAC,iGACAC,yHACAC,+FACAC,2IACAC,oGACAC,+EACAC,uEACAC,8FACAC,8DACAC,kMACAC,gGACAC,iEACAC,0EACAC,wEACAC,wFACAC,sFACAC,4FACAC,4HACAC,+GACAC,2GACAC,yEACAC,6EACAC,8EACAC,kHACAC,kGACAC,0FACAC,wFACAC,yEACAC,qFACAC,mGACAC,0CACAC,oHACAC,8IACAC,kHACAC,wGACAC,uGACAC,yEACAC,gEACAC,uFACAC,sGACAC,4JACAC,gDACAC,yFACAC,wDACAC,mDACAC,gGACAC,iFACAC,gEACAC,gGACAC,qGACAC,wGACAC,sGACAC,6EACAC,0FACAC,6EACAC,8GACAC,oIACAC,yFACAC,mFACAC,4EACAC,yEACAC,6DACAC,yDACAC,4KACAC,qFACAC,iEACAC,kFACAC,2GACAC,+DACAC,sFACAC,oHACAC,sGACAC,4CACAC,iDACAC,4DACAC,+EACAC,wFACAC,mDACAC,kEACAC,oFACAC,kDACAC,oHACAC,yHACAC,iFACAC,4GACAC,6FACAC,mHACAC,qIACAC,iKACAC,iHACAC,6FACAC,qFACAC,kFACAC,4EACAC,6FACAC,2EACAC,2FACAC,iCACAC,iHACAC,0DC7FF,SAAgBC,EAAqBtQ,EAAcyB,EAA8B9D,GAC/E,IAAIL,EAAO,GAmCX,OAjCAA,GAAQgD,EAAqCmB,EAAS9D,EAAM,CAAC,WAAY,QACrEA,EAAKkD,QACPvD,8BAAmCK,EAAKkD,gBAGtCY,EAAQC,SACVpE,+BAAoCmE,EAAQC,iBAG9CpE,wCAEA0C,EAAMzC,SAAQ,SAAAsF,GACK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