{"version":3,"file":"vendor.valtown.be0d811107790df7.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACdyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,eAAO,GAAG,wBAAK;AAC5B;AACA,eAAe,oCAAa,YAAY;AACxC,KAAK;AACL,CAAC;AACD;;ACb8C;AACG;AACH;AAC9C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAU;AACrB,+CAA+C,eAAO;AACtD;AACA;AACA;AACA;AACA;AACA,QAAQ,kBAAkB;AAC1B,KAAK;AACL;AACA;;AC3B8C;AACF;AAC5C;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mCAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpB4B;AAC0B;AACK;AACZ;AAC/C;AACA,IAAI,4BAAoB;AACxB;AACO,eAAe,mCAAiB,GAAG,0EAA0E;AACpH,YAAY,gBAAgB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qFAAqF,IAAI;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;ACjD2D;AACb;AAC9C;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AClB4C;AAC5C;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;;;;ACpB4B;AAC5B;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,aAAa,6BAAqB;AAClC;AACA,aAAa,6BAAqB;AAClC;AACA,aAAa,6BAAqB;AAClC;AACA,aAAa,6BAAqB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9D+E;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACO,oBAAoB,qCAAqC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA,gGAAgG,wBAAwB;AACxH;AACA,2BAA2B,uBAAuB;AAClD;AACA;;ACnB0C;AACD;AACK;AAC9C;AACA;AACA;AACA;AACA;AACA;AACO,oBAAoB,2BAA2B,IAAI;AAC1D,WAAW,4BAAM;AACjB,wCAAwC,eAAO;AAC/C;AACA,cAAc,QAAQ;AACtB;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;;ACpB0C;AACE;AAC5C;AACA;AACA;AACA;AACA;AACA;AACO,0BAA0B,2BAA2B,IAAI;AAChE;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;;ACnBO,oBAAoB,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,6BAAe;AAC5B;AACA;AACA;AACA;AACA,2CAA2C,UAAU;AACrD;AACA;AACA;AACA,aAAa;AACb;AACA;;ACjBgD;AACP;AACY;AACP;AAC9C;AACA;AACA;AACA;AACA;AACO,mBAAmB,gBAAgB,6BAAe,IAAI,IAAI;AACjE,WAAW,6BAAY;AACvB,wCAAwC,eAAO;AAC/C;AACA;AACA,0BAA0B,QAAQ;AAClC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AC3BgD;AACK;AACT;AAC5C;AACA;AACA;AACA;AACA;AACO,yBAAyB,mCAAmC,IAAI;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AC1ByD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,2BAAa,GAAG,wBAAK;AAClC;AACA,eAAe,oCAAa,YAAY;AACxC,KAAK;AACL,CAAC;AACD;;AChBiC;AACM;AACU;AACM;AACH;AACjB;AACM;AACN;AACA;AACM;AACL;AACD;AACM;AACzC","sources":["webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/sync/update.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/facet/tsFacet.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/sync/tsSync.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/sync/tsSyncWorker.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/autocomplete/icons.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/autocomplete/getAutocompletion.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/autocomplete/tsAutocomplete.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/autocomplete/tsAutocompleteWorker.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/lint/utils.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/lint/getLints.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/lint/tsLinter.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/lint/tsLinterWorker.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/hover/getHover.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/hover/renderTooltip.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/hover/tsHover.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/hover/tsHoverWorker.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/facet/tsFacetWorker.js","webpack://admin/./node_modules/@valtown/codemirror-ts/dist/esm/index.js"],"sourcesContent":["/**\n * In TypeScript, updates are not like PUTs, you\n * need to create a file before updating it.\n *\n * This method lets us treat the two as the same.\n */\nexport function createOrUpdateFile(env, path, code) {\n if (!env.getSourceFile(path)) {\n env.createFile(path, code);\n }\n else {\n env.updateFile(path, code);\n }\n}\n//# sourceMappingURL=update.js.map","import { combineConfig, Facet } from \"@codemirror/state\";\n/**\n * This is how the ts-related extensions are\n * configured: this facet sets the path of the file\n * and the environment to use, and the rest of\n * the extensions, like tsLint and tsAutocomplete,\n * pull those settings automatically from editor state.\n */\nexport const tsFacet = Facet.define({\n combine(configs) {\n return combineConfig(configs, {});\n },\n});\n//# sourceMappingURL=tsFacet.js.map","import { EditorView } from \"@codemirror/view\";\nimport { createOrUpdateFile } from \"./update.js\";\nimport { tsFacet } from \"../facet/tsFacet.js\";\n/**\n * Sync updates from CodeMirror to the TypeScript\n * virtual environment. Note that this updates a file - it isn't\n * responsible (yet) for deleting or renaming files if they\n * do get deleted or renamed.\n */\nexport function tsSync() {\n // TODO: this is a weak solution to the cold start problem.\n // If you boot up a CodeMirror instance, we want the initial\n // value to get loaded into CodeMirror. We do get a change event,\n // but it surprisingly doesn't have `docChanged: true` on it,\n // so this is a rough heuristic to just accept the first event\n // regardless of whether it looks significant.\n let first = true;\n return EditorView.updateListener.of((update) => {\n const config = update.view.state.facet(tsFacet);\n if (!config)\n return;\n if (!update.docChanged && !first)\n return;\n first = false;\n createOrUpdateFile(config.env, config.path, update.state.doc.toString() || ' ');\n });\n}\n//# sourceMappingURL=tsSync.js.map","import { EditorView } from \"@codemirror/view\";\nimport { tsFacetWorker } from \"../index.js\";\n/**\n * Sync updates from CodeMirror to the worker.\n */\nexport function tsSyncWorker() {\n // TODO: this is a weak solution to the cold start problem.\n // If you boot up a CodeMirror instance, we want the initial\n // value to get loaded into CodeMirror. We do get a change event,\n // but it surprisingly doesn't have `docChanged: true` on it,\n // so this is a rough heuristic to just accept the first event\n // regardless of whether it looks significant.\n let first = true;\n return EditorView.updateListener.of((update) => {\n const config = update.view.state.facet(tsFacetWorker);\n if (!config)\n return;\n if (!update.docChanged && !first)\n return;\n first = false;\n config.worker.updateFile({\n path: config.path,\n code: update.state.doc.toString(),\n });\n });\n}\n//# sourceMappingURL=tsSyncWorker.js.map","/**\n * There is some overlap between CodeMirror's\n * types and TypeScripts. This is all of the default\n * icons for CodeMirror: if TypeScript gives us one\n * of these, we pass it through.\n */\nexport const DEFAULT_CODEMIRROR_TYPE_ICONS = new Set([\n `class`,\n `constant`,\n `enum`,\n `function`,\n `interface`,\n `keyword`,\n `method`,\n `namespace`,\n `property`,\n `text`,\n `type`,\n `variable`,\n]);\n//# sourceMappingURL=icons.js.map","import ts from \"typescript\";\nimport { AUTOCOMPLETION_SYMBOLS } from \"./symbols.js\";\nimport { DEFAULT_CODEMIRROR_TYPE_ICONS } from \"./icons.js\";\nimport { matchBefore } from \"./matchBefore.js\";\nconst TS_COMPLETE_BLOCKLIST = [\n ts.ScriptElementKind.warning,\n];\nexport async function getAutocompletion({ env, path, context, keepLegacyLimitationForAutocompletionSymbols = true, }) {\n const { pos, explicit } = context;\n const rawContents = env.getSourceFile(path)?.getFullText();\n if (!rawContents)\n return null;\n // If there's space behind the cursor, don't try and autocomplete.\n // https://codemirror.net/examples/autocompletion/\n let word = matchBefore(rawContents, pos, /\\w*/);\n if (!word?.text) {\n word = matchBefore(rawContents, pos, /\\./);\n }\n if (!word?.text && !explicit)\n return null;\n const completionInfo = env.languageService.getCompletionsAtPosition(path, pos, {}, {});\n // TODO: build ATA support for a 'loading' state\n // while types are being fetched\n if (!completionInfo)\n return null;\n const options = completionInfo.entries\n .filter((entry) => !TS_COMPLETE_BLOCKLIST.includes(entry.kind) &&\n (entry.sortText < \"15\" ||\n (completionInfo.optionalReplacementSpan?.length &&\n (!keepLegacyLimitationForAutocompletionSymbols || AUTOCOMPLETION_SYMBOLS.includes(entry.name)))))\n .map((entry) => {\n const boost = -Number(entry.sortText) || 0;\n let type = entry.kind ? String(entry.kind) : undefined;\n if (type === \"member\")\n type = \"property\";\n if (type && !DEFAULT_CODEMIRROR_TYPE_ICONS.has(type)) {\n type = undefined;\n }\n return {\n label: entry.name,\n type,\n boost,\n };\n });\n return {\n from: word ? (word.text === \".\" ? word.to : word.from) : pos,\n options,\n };\n}\n//# sourceMappingURL=getAutocompletion.js.map","import { getAutocompletion } from \"./getAutocompletion.js\";\nimport { tsFacet } from \"../facet/tsFacet.js\";\n/**\n * Create a `CompletionSource` that queries\n * the _on-thread_ TypeScript environments for autocompletions\n * at this character.\n */\nexport function tsAutocomplete() {\n return async (context) => {\n const config = context.state.facet(tsFacet);\n if (!config)\n return null;\n return getAutocompletion({\n ...config,\n context,\n });\n };\n}\n//# sourceMappingURL=tsAutocomplete.js.map","import { tsFacetWorker } from \"../index.js\";\n/**\n * Create a `CompletionSource` that queries\n * the TypeScript environment in a web worker.\n */\nexport function tsAutocompleteWorker() {\n return async (context) => {\n const config = context.state.facet(tsFacetWorker);\n if (!config)\n return null;\n return config.worker.getAutocompletion({\n path: config.path,\n // Reduce this object so that it's serializable.\n context: {\n pos: context.pos,\n explicit: context.explicit,\n },\n });\n };\n}\n//# sourceMappingURL=tsAutocompleteWorker.js.map","import ts from \"typescript\";\n/**\n * TypeScript has a set of diagnostic categories,\n * which maps roughly onto CodeMirror's categories.\n * Here, we do the mapping.\n */\nexport function tsCategoryToSeverity(diagnostic) {\n if (diagnostic.code === 7027) {\n // Unreachable code detected\n return \"warning\";\n }\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Error:\n return \"error\";\n case ts.DiagnosticCategory.Message:\n return \"info\";\n case ts.DiagnosticCategory.Warning:\n return \"warning\";\n case ts.DiagnosticCategory.Suggestion:\n return \"info\";\n }\n}\n/**\n * Not all TypeScript diagnostic relate to specific\n * ranges in source code: here we filter for those that\n * do.\n */\nexport function isDiagnosticWithLocation(diagnostic) {\n return !!(diagnostic.file &&\n typeof diagnostic.start === \"number\" &&\n typeof diagnostic.length === \"number\");\n}\n/**\n * Get the message for a diagnostic. TypeScript\n * is kind of weird: messageText might have the message,\n * or a pointer to the message. This follows the chain\n * to get a string, regardless of which case we're in.\n */\nexport function tsDiagnosticMessage(diagnostic) {\n if (typeof diagnostic.messageText === \"string\") {\n return diagnostic.messageText;\n }\n // TODO: go through linked list\n return diagnostic.messageText.messageText;\n}\n/**\n * TypeScript and CodeMirror have slightly different\n * ways of representing diagnostics. This converts\n * from one to the other.\n */\nexport function convertTSDiagnosticToCM(d) {\n // We add some code at the end of the document, but we can't have a\n // diagnostic in an invalid range\n const start = d.start;\n const message = tsDiagnosticMessage(d);\n return {\n from: start,\n to: start + d.length,\n message: message,\n severity: tsCategoryToSeverity(d),\n };\n}\n//# sourceMappingURL=utils.js.map","import { convertTSDiagnosticToCM, isDiagnosticWithLocation } from \"./utils.js\";\n/**\n * Lower-level interface to get semantic and syntactic\n * diagnostics from the TypeScript environment.\n *\n * This is used by tsLinter and tsLinterWorker,\n * but you can use it directly to power other UI.\n */\nexport function getLints({ env, path, diagnosticCodesToIgnore, }) {\n // Don't crash if the relevant file isn't created yet.\n const exists = env.getSourceFile(path);\n if (!exists)\n return [];\n const syntaticDiagnostics = env.languageService.getSyntacticDiagnostics(path);\n const semanticDiagnostics = env.languageService.getSemanticDiagnostics(path);\n const diagnostics = [...syntaticDiagnostics, ...semanticDiagnostics].filter((diagnostic) => isDiagnosticWithLocation(diagnostic) &&\n !diagnosticCodesToIgnore.includes(diagnostic.code));\n return diagnostics.map(convertTSDiagnosticToCM);\n}\n//# sourceMappingURL=getLints.js.map","import { linter } from \"@codemirror/lint\";\nimport { getLints } from \"./getLints.js\";\nimport { tsFacet } from \"../facet/tsFacet.js\";\n/**\n * Binds the TypeScript `lint()` method with TypeScript's\n * semantic and syntactic diagnostics. You can use\n * the `getLints` method for a lower-level interface\n * to the same data.\n */\nexport function tsLinter({ diagnosticCodesToIgnore, } = {}) {\n return linter(async (view) => {\n const config = view.state.facet(tsFacet);\n return config\n ? getLints({\n ...config,\n diagnosticCodesToIgnore: diagnosticCodesToIgnore || [],\n })\n : [];\n });\n}\n//# sourceMappingURL=tsLinter.js.map","import { linter } from \"@codemirror/lint\";\nimport { tsFacetWorker } from \"../index.js\";\n/**\n * Binds the TypeScript `lint()` method with TypeScript's\n * semantic and syntactic diagnostics. You can use\n * the `getLints` method for a lower-level interface\n * to the same data.\n */\nexport function tsLinterWorker({ diagnosticCodesToIgnore, } = {}) {\n return linter(async (view) => {\n const config = view.state.facet(tsFacetWorker);\n return config\n ? config.worker.getLints({\n path: config.path,\n diagnosticCodesToIgnore: diagnosticCodesToIgnore || [],\n })\n : [];\n });\n}\n//# sourceMappingURL=tsLinterWorker.js.map","export function getHover({ env, path, pos, }) {\n const sourcePos = pos;\n if (sourcePos === null)\n return null;\n const quickInfo = env.languageService.getQuickInfoAtPosition(path, sourcePos);\n if (!quickInfo)\n return null;\n const start = quickInfo.textSpan.start;\n const typeDef = env.languageService.getTypeDefinitionAtPosition(path, sourcePos) ??\n env.languageService.getDefinitionAtPosition(path, sourcePos);\n return {\n start,\n end: start + quickInfo.textSpan.length,\n typeDef,\n quickInfo,\n };\n}\n//# sourceMappingURL=getHover.js.map","/**\n * Default, barebones tooltip renderer. Generates\n * structure of a div, containing a series of\n * span elements with the typescript `kind` as\n * classes.\n */\nexport const defaultRenderer = (info) => {\n const div = document.createElement(\"div\");\n if (info.quickInfo?.displayParts) {\n for (let part of info.quickInfo.displayParts) {\n const span = div.appendChild(document.createElement(\"span\"));\n span.className = `quick-info-${part.kind}`;\n span.innerText = part.text;\n }\n }\n return { dom: div };\n};\n//# sourceMappingURL=renderTooltip.js.map","import { hoverTooltip } from \"@codemirror/view\";\nimport { getHover } from \"./getHover.js\";\nimport { defaultRenderer } from \"./renderTooltip.js\";\nimport { tsFacet } from \"../facet/tsFacet.js\";\n/**\n * This binds the CodeMirror `hoverTooltip` method\n * with a code that pulls types and documentation\n * from the TypeScript environment.\n */\nexport function tsHover({ renderTooltip = defaultRenderer, } = {}) {\n return hoverTooltip(async (view, pos) => {\n const config = view.state.facet(tsFacet);\n if (!config)\n return null;\n const hoverData = getHover({\n ...config,\n pos,\n });\n if (!hoverData)\n return null;\n return {\n pos: hoverData.start,\n end: hoverData.end,\n create: () => renderTooltip(hoverData, view),\n };\n });\n}\n//# sourceMappingURL=tsHover.js.map","import { hoverTooltip } from \"@codemirror/view\";\nimport { defaultRenderer } from \"./renderTooltip.js\";\nimport { tsFacetWorker } from \"../index.js\";\n/**\n * This binds the CodeMirror `hoverTooltip` method\n * with a code that pulls types and documentation\n * from the TypeScript environment.\n */\nexport function tsHoverWorker({ renderTooltip = defaultRenderer, } = {}) {\n return hoverTooltip(async (view, pos) => {\n const config = view.state.facet(tsFacetWorker);\n if (!config)\n return null;\n const hoverData = await config.worker.getHover({\n path: config.path,\n pos,\n });\n if (!hoverData)\n return null;\n return {\n pos: hoverData.start,\n end: hoverData.end,\n create: () => renderTooltip(hoverData, view),\n };\n });\n}\n//# sourceMappingURL=tsHoverWorker.js.map","import { combineConfig, Facet } from \"@codemirror/state\";\n/**\n * Use this facet if you intend to run your TypeScript\n * virtual environment within a web worker.\n *\n * This is how the ts-related extensions are\n * configured: this facet sets the path of the file\n * and the environment to use, and the rest of\n * the extensions, like tsLint and tsAutocomplete,\n * pull those settings automatically from editor state.\n */\nexport const tsFacetWorker = Facet.define({\n combine(configs) {\n return combineConfig(configs, {});\n },\n});\n//# sourceMappingURL=tsFacetWorker.js.map","export * from \"./sync/tsSync.js\";\nexport * from \"./sync/tsSyncWorker.js\";\nexport * from \"./autocomplete/tsAutocomplete.js\";\nexport * from \"./autocomplete/tsAutocompleteWorker.js\";\nexport * from \"./autocomplete/getAutocompletion.js\";\nexport * from \"./lint/tsLinter.js\";\nexport * from \"./lint/tsLinterWorker.js\";\nexport * from \"./lint/getLints.js\";\nexport * from \"./hover/tsHover.js\";\nexport * from \"./hover/tsHoverWorker.js\";\nexport * from \"./hover/getHover.js\";\nexport * from \"./facet/tsFacet.js\";\nexport * from \"./facet/tsFacetWorker.js\";\n//# sourceMappingURL=index.js.map"],"names":[],"sourceRoot":""}