@vite-hub/workspace 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +62 -19
  2. package/dist/{abort-BCwpdrN0.js → abort-CQGxJBqa.js} +1 -2
  3. package/dist/{asset-registry-DfBV5kmw.js → asset-registry-0CdRAjIV.js} +2 -3
  4. package/dist/blob-database/postgres.d.ts +423 -0
  5. package/dist/blob-database/postgres.js +1 -0
  6. package/dist/blob-database-sources-CQPAyCz3.js +8 -0
  7. package/dist/blob-database.d.ts +29 -449
  8. package/dist/blob-database.js +636 -210
  9. package/dist/checkout.d.ts +1 -2
  10. package/dist/checkout.js +3 -4
  11. package/dist/cloudflare.d.ts +1 -5
  12. package/dist/cloudflare.js +1 -2
  13. package/dist/{config-B-863EgC.js → config-CsgNNVAI.js} +1 -2
  14. package/dist/{config-CDeGd0RB.d.ts → config-DeA287c0.d.ts} +1 -5
  15. package/dist/{config-D1QENneP.js → config-jo5QgE1w.js} +18 -27
  16. package/dist/{discard-CNNtCozM.js → discard-BkoLmmmN.js} +1 -2
  17. package/dist/durability.d.ts +10 -4
  18. package/dist/durability.js +47 -6
  19. package/dist/{error-diagnostics-B5s9kNEA.js → error-diagnostics-B4me-ouV.js} +11 -4
  20. package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-kKXseq8d.js} +10 -3
  21. package/dist/{path-uxLkzrZm.d.ts → errors-CnFDXxeJ.d.ts} +0 -3
  22. package/dist/{file-CqG9zqiF.js → file-BrNAXQgY.js} +4 -8
  23. package/dist/{target-Dm9dHAVJ.js → file-metadata-Bpsvjw_X.js} +3 -32
  24. package/dist/{files-B6wpAhEx.js → files--z2dLC5z.js} +3 -4
  25. package/dist/files.d.ts +12 -8
  26. package/dist/files.js +7 -6
  27. package/dist/{github-DKAlO0Vh.js → github-k--_LCrX.js} +7 -9
  28. package/dist/{glob-BOqSKzSg.js → glob-BEutagp1.js} +9 -10
  29. package/dist/{glob-Cjxms1t7.js → glob-BreFjNAV.js} +3 -4
  30. package/dist/history-schema-BR4UDPHL.d.ts +434 -0
  31. package/dist/history-schema-postgres-DZepCSBq.js +40 -0
  32. package/dist/{host-Bf1a2uo_.js → host-C8yZizfk.js} +153 -22
  33. package/dist/{hosted-zG7HJaE4.js → hosted-8BTKAtMX.js} +27 -21
  34. package/dist/{hosted-vercel-blob-AbXG8fvR.js → hosted-vercel-blob-B6kygYqn.js} +10 -12
  35. package/dist/hosted-vercel-blob.d.ts +1 -3
  36. package/dist/hosted-vercel-blob.js +1 -2
  37. package/dist/hosted.d.ts +1 -3
  38. package/dist/hosted.js +1 -2
  39. package/dist/index.d.ts +11 -41
  40. package/dist/index.js +34 -116
  41. package/dist/internal/path.d.ts +1 -1
  42. package/dist/internal/path.js +1 -2
  43. package/dist/internal/workspace.d.ts +10 -0
  44. package/dist/internal/workspace.js +85 -0
  45. package/dist/{lifecycle-D8FdpBod.js → lifecycle-IReZfi0b.js} +15 -13
  46. package/dist/lineage.d.ts +1 -3
  47. package/dist/lineage.js +1 -2
  48. package/dist/loader.d.ts +1 -7
  49. package/dist/loader.js +4 -6
  50. package/dist/{mcp-resources-DntxtmDU.js → mcp-resources-DeJnbOaw.js} +4 -5
  51. package/dist/{memory-D5jq9HZW.js → memory-BlSRrBH1.js} +19 -13
  52. package/dist/{metadata-target-DDoOQNp1.js → metadata-target-CaGLY4ay.js} +214 -77
  53. package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
  54. package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
  55. package/dist/{operations-DsY2MQnG.js → operations-CtRDU3cA.js} +34 -29
  56. package/dist/{operations-D8uCpzhM.js → operations-DfbqHWAe.js} +7 -8
  57. package/dist/operations.d.ts +2 -6
  58. package/dist/operations.js +2 -2
  59. package/dist/{path--wrT_Azm.js → path-Bb9OIc_F.js} +3 -19
  60. package/dist/{path-zHxQUbqa.d.ts → path-C0uZxDdW.d.ts} +0 -2
  61. package/dist/{path-DrSIenjj.js → path-CuYE8-X6.js} +2 -4
  62. package/dist/{plugins-CsrXCA1Q.d.ts → plugins-CLc32jvL.d.ts} +1 -3
  63. package/dist/{provider-sm9uzkLg.js → provider-CN14ewvx.js} +30 -22
  64. package/dist/providers/github/store.d.ts +2 -4
  65. package/dist/providers/github/store.js +1 -2
  66. package/dist/{registry-CFl1Htyc.d.ts → registry-B0g19sdy.d.ts} +5 -8
  67. package/dist/{registry-DmVfUe4K.js → registry-BbUg9vJB.js} +10 -6
  68. package/dist/registry-s2Ob9PeX.d.ts +9 -0
  69. package/dist/{request-scope-Dw5n8bMC.js → request-scope-CXCI_wCb.js} +4 -4
  70. package/dist/{results-DgkZUmTL.js → results-z-HpV9EP.js} +1 -2
  71. package/dist/{rolldown-runtime-rQ84J-ij.js → rolldown-runtime-DnNXxpGL.js} +2 -3
  72. package/dist/rule-keys-BLEbi1h5.js +18 -0
  73. package/dist/rules-BPDXypZV.js +267 -0
  74. package/dist/runtime/assets.d.ts +2 -3
  75. package/dist/runtime/assets.js +5 -6
  76. package/dist/runtime/empty-assets-registry.d.ts +1 -3
  77. package/dist/runtime/empty-assets-registry.js +1 -2
  78. package/dist/runtime/empty-registry.d.ts +2 -4
  79. package/dist/runtime/empty-registry.js +1 -2
  80. package/dist/runtime/registry.d.ts +2 -2
  81. package/dist/runtime/registry.js +2 -3
  82. package/dist/runtime/request.d.ts +1 -3
  83. package/dist/runtime/request.js +2 -3
  84. package/dist/runtime/state.d.ts +5 -4
  85. package/dist/runtime/state.js +18 -7
  86. package/dist/runtime/workspace.d.ts +1 -1
  87. package/dist/runtime/workspace.js +1 -2
  88. package/dist/runtime.d.ts +9 -24
  89. package/dist/runtime.js +29 -25
  90. package/dist/{search-C_RfoM2j.js → search-C_nVorq7.js} +3 -4
  91. package/dist/{server-Cd4-iCh5.js → server-aa1a4rkV.js} +8 -10
  92. package/dist/server.d.ts +3 -4
  93. package/dist/server.js +1 -2
  94. package/dist/{shared-ovXVSV3-.js → shared-C20Wh1mp.js} +23 -19
  95. package/dist/source-metadata.d.ts +2 -6
  96. package/dist/source-metadata.js +4 -5
  97. package/dist/state-BdDfBtOR.d.ts +17 -0
  98. package/dist/{store-NZoRto-Y.js → store-cx3OqNTi.js} +42 -44
  99. package/dist/{sync-CrT8zjwc.js → sync-BBfR4g5y.js} +6 -7
  100. package/dist/test.d.ts +1 -1
  101. package/dist/test.js +1 -2
  102. package/dist/{types-1Z-tKK3g.d.ts → types-Bel5IDmF.d.ts} +52 -6
  103. package/dist/{use-CjbF8EO9.d.ts → use-CpphIBof.d.ts} +20 -32
  104. package/dist/{use-B0o5HoBl.js → use-D0DyTMxM.js} +19 -21
  105. package/dist/use-tools-CAK10LTc.d.ts +10 -0
  106. package/dist/{state-Cb_hIyAw.js → use-tools-CHduR5k6.js} +8 -24
  107. package/dist/{utils-Dw-WULEZ.js → utils-DXP9xfXo.js} +80 -273
  108. package/dist/vite.d.ts +30 -19
  109. package/dist/vite.js +1481 -1617
  110. package/dist/vitehub-grants-Co713QTg.js +36 -0
  111. package/dist/workspace-BOuxrZrP.d.ts +5 -0
  112. package/dist/{workspace-DvKu5PRa.js → workspace-CLuPkyZR.js} +28 -36
  113. package/package.json +34 -24
  114. package/dist/registry-CwryP59t.d.ts +0 -9
  115. package/dist/state-C-YtsaiJ.d.ts +0 -35
  116. package/dist/workspace-CIXgHeyX.d.ts +0 -7
package/dist/vite.js CHANGED
@@ -1,24 +1,25 @@
1
- import { n as __exportAll$1, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-rQ84J-ij.js";
2
- import { t as createMemoryWorkspaceStore } from "./memory-D5jq9HZW.js";
3
- import { t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
4
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B5s9kNEA.js";
1
+ import { n as __exportAll$1, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-DnNXxpGL.js";
2
+ import { S as resolve$1, _ as redactInspectionText, a as createNoExternalAddition, b as isAbsolute$1, c as isProductionBuild, d as resolveViteHubProjectRoot, f as shouldSkipViteProviderBuild, g as requireViteHubDevServerUrl, h as readViteHubDevTargetOption, i as createNativePackageLoading, l as isServerEnvironment, m as fetchViteHubDevEndpoint, n as callOperationFromCli, o as createViteHubEnvImportAliases, p as discoverViteHubDevServer, s as generatedViteHubWatchIgnoredAddition, t as workspaceOperations, u as publishViteHubDevServer, v as relativeDefinitionFile, x as relative$1, y as dirname$1 } from "./operations-CtRDU3cA.js";
3
+ import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
4
+ import { n as isRecordOrFunction, t as isRecord$1 } from "./object-CAK6UYR5.js";
5
+ import { a as refreshWorkspaceDevToken, c as workspaceDevHeader, d as workspaceDevTokenHeader, f as workspaceDevTokenServerId, n as ensureWorkspaceDevToken, o as runWorkspaceDevCommand, p as isViteHubSecretEqual, r as readWorkspaceDevToken, s as validateWorkspaceDevToken, u as workspaceDevRoute } from "./server-aa1a4rkV.js";
6
+ import { n as syncWorkspaceDefinition } from "./lifecycle-IReZfi0b.js";
7
+ import { a as normalizeWorkspaceSources, n as createSourceContext } from "./config-jo5QgE1w.js";
8
+ import { t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
9
+ import { t as createMemoryWorkspaceStore } from "./memory-BlSRrBH1.js";
10
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
5
11
  import { assertNoSymlinks, checkoutFailure, conflictMarkerPatterns, folderOf, formatWorkspaceStatus, ignoredName, localCheckoutStatus, pullWorkspaces, pushWorkspaces, resolveWorkspaceConflicts, workspaceLockFile, workspaceStatus } from "./checkout.js";
6
- import { n as isRecordOrFunction, t as isRecord$1 } from "./object-Da1zyPCR.js";
7
- import { t as internalErrorDiagnostics } from "./error-diagnostics-CQ4BUqRe.js";
8
- import { n as isWorkspaceStore, r as normalizeWorkspaceStoreOptions } from "./provider-sm9uzkLg.js";
9
- import { i as installHostedWorkspaceRuntime } from "./hosted-zG7HJaE4.js";
10
- import { a as normalizeWorkspaceSources, n as createSourceContext } from "./config-D1QENneP.js";
11
- import { s as workspaceRegistryLoadError, t as normalizeWorkspaceDefinition } from "./registry-DmVfUe4K.js";
12
- import { n as installHostedVercelBlobWorkspaceRuntime } from "./hosted-vercel-blob-AbXG8fvR.js";
13
- import { S as resolve$1, _ as redactInspectionText, a as createNoExternalAddition, b as isAbsolute$1, c as isProductionBuild, d as resolveViteHubProjectRoot, f as shouldSkipViteProviderBuild, g as requireViteHubDevServerUrl, h as readViteHubDevTargetOption, i as createNativePackageLoading, l as isServerEnvironment, m as fetchViteHubDevEndpoint, n as callOperationFromCli, o as createViteHubEnvImportAliases, p as discoverViteHubDevServer, s as generatedViteHubWatchIgnoredAddition, t as workspaceOperations, u as publishViteHubDevServer, v as relativeDefinitionFile, x as relative$1, y as dirname$1 } from "./operations-DsY2MQnG.js";
14
- import { a as refreshWorkspaceDevToken, c as workspaceDevHeader, d as workspaceDevTokenHeader, f as workspaceDevTokenServerId, n as ensureWorkspaceDevToken, o as runWorkspaceDevCommand, p as isViteHubSecretEqual, r as readWorkspaceDevToken, s as validateWorkspaceDevToken, u as workspaceDevRoute } from "./server-Cd4-iCh5.js";
15
- import { n as syncWorkspaceDefinition } from "./lifecycle-D8FdpBod.js";
12
+ import { n as isWorkspaceStore, r as normalizeWorkspaceStoreOptions } from "./provider-CN14ewvx.js";
13
+ import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-BbUg9vJB.js";
14
+ import { i as installHostedWorkspaceRuntime } from "./hosted-8BTKAtMX.js";
15
+ import { n as installHostedVercelBlobWorkspaceRuntime } from "./hosted-vercel-blob-B6kygYqn.js";
16
16
  import { createRequire, isBuiltin } from "node:module";
17
17
  import { formatRuntimeDiagnosticError } from "@vite-hub/runtime";
18
18
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
19
19
  import { createHash } from "node:crypto";
20
+ import { Minimatch } from "minimatch";
20
21
  import { defineDiagnostics } from "nostics";
21
- import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
22
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
22
23
  import { access, chmod, copyFile, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
23
24
  import { tmpdir } from "node:os";
24
25
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -26,7 +27,7 @@ import { promisify } from "node:util";
26
27
  import { resolveModulePath } from "exsolve";
27
28
  import { createJiti } from "jiti";
28
29
  import { execFile } from "node:child_process";
29
- //#region src/config.ts
30
+ // src/config.ts
30
31
  const workspaceConfigKeys = /* @__PURE__ */ new Set([
31
32
  "assets",
32
33
  "projectRoot",
@@ -47,8 +48,7 @@ function normalizeWorkspaceOptions(options, input = {}) {
47
48
  store: normalizeWorkspaceStoreOptions(resolvedOptions.store, input) || { driver: "local" }
48
49
  };
49
50
  }
50
- //#endregion
51
- //#region ../internal/src/invariant.ts
51
+ // ../internal/src/invariant.ts
52
52
  const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
53
53
  docsBase: "https://vitehub.dev/docs/development/diagnostics",
54
54
  codes: { INTERNAL_INVARIANT_FAILED: {
@@ -67,8 +67,7 @@ function invariantError(what) {
67
67
  function invariant(condition, what) {
68
68
  if (!condition) throw invariantError(what);
69
69
  }
70
- //#endregion
71
- //#region ../internal/src/build/client-output.ts
70
+ // ../internal/src/build/client-output.ts
72
71
  function hasStaticIndex(clientDir) {
73
72
  return existsSync(resolve$1(clientDir, "index.html"));
74
73
  }
@@ -105,8 +104,7 @@ async function copyClientOutput(clientDir, targetDir, excludedDirs = []) {
105
104
  filter
106
105
  });
107
106
  }
108
- //#endregion
109
- //#region ../internal/src/build/provider-output-config.ts
107
+ // ../internal/src/build/provider-output-config.ts
110
108
  function isProviderJsonArray(value, ancestors) {
111
109
  if (Object.getPrototypeOf(value) !== Array.prototype || ancestors.has(value)) return false;
112
110
  if (Reflect.ownKeys(value).length !== value.length + 1) return false;
@@ -244,13 +242,11 @@ async function cleanProviderOutputConfig(file, ownership) {
244
242
  if (!changed) return;
245
243
  await persistProviderJsonRecord(file, next, true);
246
244
  }
247
- //#endregion
248
- //#region ../internal/src/build/user-entry.ts
245
+ // ../internal/src/build/user-entry.ts
249
246
  function toSafeAppName(rootDir) {
250
247
  return basename(rootDir).replace(/[^a-z0-9-]+/gi, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").toLowerCase();
251
248
  }
252
- //#endregion
253
- //#region ../internal/src/build/cloudflare.ts
249
+ // ../internal/src/build/cloudflare.ts
254
250
  function createDefaultCloudflareOutputRoot(rootDir) {
255
251
  return resolve(rootDir, "dist", toSafeAppName(rootDir));
256
252
  }
@@ -267,8 +263,7 @@ async function writeCloudflareWranglerConfig(options) {
267
263
  removeIfEmpty: true
268
264
  });
269
265
  }
270
- //#endregion
271
- //#region ../internal/src/build/bundle-options.ts
266
+ // ../internal/src/build/bundle-options.ts
272
267
  const encodedAliasPrefixMarker = "\0vitehub-prefix:";
273
268
  const encodedAliasExactMarker = "\0vitehub-exact:";
274
269
  /** Select the runtime constants from one resolved Vite configuration. */
@@ -280,8 +275,7 @@ function resolveViteHubBundleDefines(config) {
280
275
  }
281
276
  return defines;
282
277
  }
283
- //#endregion
284
- //#region ../internal/src/build/ast-walk.ts
278
+ // ../internal/src/build/ast-walk.ts
285
279
  /** The oxc parser grammar for a file, from its extension. Defaults to TypeScript. */
286
280
  function moduleLanguage(file) {
287
281
  if (/\.(?:c|m)?tsx$/i.test(file)) return "tsx";
@@ -304,8 +298,7 @@ function walk(node, visit, parent) {
304
298
  } else if (isNode(child)) walk(child, visit, node);
305
299
  }
306
300
  }
307
- //#endregion
308
- //#region ../internal/src/build/rolldown.ts
301
+ // ../internal/src/build/rolldown.ts
309
302
  const viteRawPrefix = "\0vitehub-vite-raw:";
310
303
  const markdownTemplatePrefix = "\0vitehub-markdown-template:";
311
304
  const markdownTemplateFileSuffix = ".template.md";
@@ -798,6 +791,24 @@ function createExternalMatcher(patterns) {
798
791
  });
799
792
  return (id) => matchers.some((matches) => matches(id));
800
793
  }
794
+ /** Returns the modules of the chunks that no chunk loaded from the entry chunk imports. */
795
+ function findUnusedChunkModules(chunks) {
796
+ const used = new Set(chunks.filter((chunk) => chunk.isEntry));
797
+ for (const chunk of used) for (const other of chunks) if (!used.has(other) && chunk.code.includes(other.fileName)) used.add(other);
798
+ return new Set(chunks.filter((chunk) => !used.has(chunk)).flatMap((chunk) => chunk.moduleIds));
799
+ }
800
+ function createEmptyModulesPlugin(ids) {
801
+ return {
802
+ name: "vitehub-empty-unused-chunks",
803
+ load(id) {
804
+ if (ids.has(id)) return {
805
+ code: "",
806
+ moduleSideEffects: false,
807
+ moduleType: "js"
808
+ };
809
+ }
810
+ };
811
+ }
801
812
  async function bundleEsmEntry(entryFile, outfile, options = {}) {
802
813
  const { rolldown } = await importRolldown();
803
814
  options.signal?.throwIfAborted();
@@ -828,7 +839,7 @@ async function bundleEsmEntry(entryFile, outfile, options = {}) {
828
839
  " globalThis.__dirname = globalThis.process.getBuiltinModule(\"node:path\").dirname(globalThis.__filename);",
829
840
  "}"
830
841
  ] : []].filter(Boolean).join("\n");
831
- const bundle = await rolldown({
842
+ const build = (extraPlugins = [], shimMissingExports = false) => rolldown({
832
843
  cwd: workingDir,
833
844
  external: isExternal ? (id) => isExternal(id) : void 0,
834
845
  input: entryFile,
@@ -837,41 +848,54 @@ async function bundleEsmEntry(entryFile, outfile, options = {}) {
837
848
  },
838
849
  moduleTypes: platform === "node" ? { ".wasm": "binary" } : void 0,
839
850
  platform,
840
- plugins,
851
+ plugins: [...extraPlugins, ...plugins],
841
852
  resolve: {
842
853
  conditionNames: options.conditions ?? (platform === "node" ? ["node"] : void 0),
843
854
  extensions: options.extensions,
844
855
  mainFields: options.mainFields ?? (platform === "neutral" ? ["module", "main"] : void 0),
845
856
  symlinks: !options.preserveSymlinks
846
857
  },
858
+ shimMissingExports,
847
859
  transform: {
848
860
  define: options.define,
849
861
  target: "es2022"
850
862
  },
851
863
  tsconfig: options.tsconfig ?? true
852
864
  });
865
+ const generate = async (bundle, codeSplitting) => (await bundle.generate({
866
+ banner: banner || void 0,
867
+ chunkFileNames: codeSplitting ? "chunk-[hash].js" : void 0,
868
+ codeSplitting,
869
+ format,
870
+ keepNames: options.keepNames ?? Boolean(options.minifySyntax || options.minifyIdentifiers),
871
+ minify,
872
+ polyfillRequire: !(format === "esm" && platform === "node"),
873
+ sourcemap: false
874
+ })).output;
875
+ let bundle = await build();
853
876
  let output;
854
877
  try {
855
- output = (await bundle.generate({
856
- banner: banner || void 0,
857
- codeSplitting: false,
858
- format,
859
- keepNames: options.keepNames ?? Boolean(options.minifySyntax || options.minifyIdentifiers),
860
- minify,
861
- polyfillRequire: !(format === "esm" && platform === "node"),
862
- sourcemap: false
863
- })).output;
878
+ output = await generate(bundle, true);
879
+ const chunks = output.filter((file) => file.type === "chunk");
880
+ if (chunks.length > 1 || chunks.some((chunk) => chunk.dynamicImports.includes(chunk.fileName))) {
881
+ options.signal?.throwIfAborted();
882
+ const unusedModules = findUnusedChunkModules(chunks);
883
+ if (unusedModules.size) {
884
+ await bundle.close();
885
+ bundle = await build([createEmptyModulesPlugin(unusedModules)], true);
886
+ }
887
+ output = await generate(bundle, false);
888
+ }
864
889
  } finally {
865
890
  await bundle.close();
866
891
  }
867
892
  options.signal?.throwIfAborted();
868
- const chunk = output.find((file) => file.type === "chunk");
893
+ const chunk = output.find((file) => file.type === "chunk" && file.isEntry);
869
894
  await mkdir(dirname(outfile), { recursive: true });
870
895
  await writeFile(outfile, chunk.code, { signal: options.signal });
871
896
  options.signal?.throwIfAborted();
872
897
  }
873
- //#endregion
874
- //#region ../internal/src/build/paths.ts
898
+ // ../internal/src/build/paths.ts
875
899
  function resolveRuntimeModule(packageDir, modulePath) {
876
900
  const distFile = resolve$1(packageDir, "dist", `${modulePath}.js`);
877
901
  return existsSync(distFile) ? distFile : resolve$1(packageDir, "src", `${modulePath}.ts`);
@@ -911,8 +935,166 @@ function realpathIfExists(path) {
911
935
  return resolve$1(path);
912
936
  }
913
937
  }
914
- //#endregion
915
- //#region ../internal/src/build/provider-output-sources.ts
938
+ // ../internal/src/build/runtime-package-files.ts
939
+ const alwaysPublishedFile = /^(?:package\.json|(?:readme|copying|licen[cs]e)(?:\..*[^~$])?)$/i;
940
+ const rootExcluded = /* @__PURE__ */ new Set([
941
+ "package-lock.json",
942
+ "yarn.lock",
943
+ "pnpm-lock.yaml",
944
+ "bun.lockb",
945
+ ".lock-wscript",
946
+ "build/config.gypi"
947
+ ]);
948
+ const excludedEntry = /^(?:node_modules|\.git|\.hg|\.svn|CVS|\.npmrc|\.npmignore|\.gitignore|\.DS_Store|npm-debug\.log|\._.*|.*\.orig|\..*\.swp)$/i;
949
+ function hasNodeModulesSegment$1(path) {
950
+ return path.split(/[\\/]/).includes("node_modules");
951
+ }
952
+ function isNestedPath(path) {
953
+ return Boolean(path) && path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path);
954
+ }
955
+ /** Runs a filesystem read, and returns `undefined` when the path is gone. */
956
+ async function unlessGone(read) {
957
+ try {
958
+ return await read();
959
+ } catch (error) {
960
+ const { code } = error;
961
+ if (code === "ENOENT" || code === "ENOTDIR") return void 0;
962
+ throw error;
963
+ }
964
+ }
965
+ function readIfPresent(read) {
966
+ try {
967
+ return read();
968
+ } catch (error) {
969
+ if (error.code === "ENOENT") return void 0;
970
+ throw error;
971
+ }
972
+ }
973
+ function packageRule(entry) {
974
+ const include = !entry.startsWith("!");
975
+ const pattern = (include ? entry : entry.slice(1)).replace(/^\.\//, "/").replace(/\/$/, "") || "**";
976
+ const matcher = new Minimatch(pattern, {
977
+ dot: true,
978
+ matchBase: true,
979
+ nocase: true,
980
+ nocomment: true,
981
+ nonegate: true
982
+ });
983
+ return {
984
+ include,
985
+ matches: (path, partial = false) => matcher.match(path, partial) || matcher.match(`/${path}`, partial)
986
+ };
987
+ }
988
+ /** Files selected for a linked package's publish list; `undefined` keeps the whole package. */
989
+ function publishedPackagePaths(packageDir) {
990
+ let manifest;
991
+ const contents = readIfPresent(() => readFileSync(join(packageDir, "package.json"), "utf8"));
992
+ if (contents === void 0) return void 0;
993
+ try {
994
+ manifest = JSON.parse(contents);
995
+ } catch {
996
+ return;
997
+ }
998
+ if (!manifest || typeof manifest !== "object" || !("files" in manifest) || !Array.isArray(manifest.files)) return void 0;
999
+ const rules = [];
1000
+ const required = /* @__PURE__ */ new Set();
1001
+ const requiredAncestors = /* @__PURE__ */ new Set();
1002
+ const requirePath = (entry) => {
1003
+ const path = relative(packageDir, join(packageDir, entry));
1004
+ if (!isNestedPath(path)) return;
1005
+ required.add(path);
1006
+ for (let parent = dirname(path); parent !== "."; parent = dirname(parent)) requiredAncestors.add(parent);
1007
+ };
1008
+ for (const entry of manifest.files) {
1009
+ if (typeof entry !== "string" || !entry) continue;
1010
+ const candidate = join(packageDir, entry);
1011
+ if (!entry.startsWith("!") && isNestedPath(relative(packageDir, candidate)) && readIfPresent(() => lstatSync(candidate))?.isFile()) requirePath(entry);
1012
+ else rules.push(packageRule(entry.endsWith("/*") ? `${entry}*` : entry));
1013
+ }
1014
+ if ("main" in manifest && typeof manifest.main === "string") requirePath(manifest.main);
1015
+ if ("browser" in manifest && typeof manifest.browser === "string") requirePath(manifest.browser);
1016
+ if ("bin" in manifest) {
1017
+ const bin = manifest.bin;
1018
+ if (typeof bin === "string") requirePath(bin);
1019
+ else if (bin && typeof bin === "object") {
1020
+ for (const file of Object.values(bin)) if (typeof file === "string") requirePath(file);
1021
+ }
1022
+ }
1023
+ const files = /* @__PURE__ */ new Set();
1024
+ const entries = /* @__PURE__ */ new Set([""]);
1025
+ const visit = (directory, ancestors, inheritedIgnores) => {
1026
+ const children = readIfPresent(() => readdirSync(join(packageDir, directory)));
1027
+ if (!children) return;
1028
+ let ignores = inheritedIgnores;
1029
+ if (directory) {
1030
+ const ignore = readIfPresent(() => readFileSync(join(packageDir, directory, ".npmignore"), "utf8")) ?? readIfPresent(() => readFileSync(join(packageDir, directory, ".gitignore"), "utf8"));
1031
+ if (ignore) {
1032
+ const localRules = ignore.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map(packageRule);
1033
+ ignores = [...ignores, (paths, included) => {
1034
+ for (const rule of localRules) if (paths.slice(ancestors.length).some((path) => rule.matches(path.slice(directory.length + 1)))) included = !rule.include;
1035
+ return included;
1036
+ }];
1037
+ }
1038
+ }
1039
+ for (const child of children) {
1040
+ const path = join(directory, child);
1041
+ const portablePath = path.replaceAll(sep, "/");
1042
+ if (excludedEntry.test(child) || rootExcluded.has(portablePath) || child.includes("*")) continue;
1043
+ const prefixes = [...ancestors, portablePath];
1044
+ let included = false;
1045
+ for (const rule of rules) if (prefixes.some((prefix) => rule.matches(prefix))) included = rule.include;
1046
+ const includeFile = included && ignores.every((ignore) => ignore(prefixes, true)) || required.has(path) || !directory && alwaysPublishedFile.test(child);
1047
+ const includeDirectory = included || requiredAncestors.has(path) || rules.some((rule) => rule.include && rule.matches(portablePath, true));
1048
+ if (!includeFile && !includeDirectory) continue;
1049
+ const info = readIfPresent(() => lstatSync(join(packageDir, path)));
1050
+ if (info?.isDirectory() && includeDirectory) visit(path, prefixes, ignores);
1051
+ else if (info?.isFile() && includeFile) {
1052
+ files.add(path);
1053
+ for (let entry = path; entry !== "." && !entries.has(entry); entry = dirname(entry)) entries.add(entry);
1054
+ }
1055
+ }
1056
+ };
1057
+ visit("", [], []);
1058
+ return {
1059
+ files,
1060
+ entries
1061
+ };
1062
+ }
1063
+ /** Copies a file or folder and follows links. `node_modules` folders and paths that disappear during the copy are skipped. */
1064
+ async function copyTree(source, target) {
1065
+ const info = await unlessGone(() => stat(source));
1066
+ if (!info) return;
1067
+ if (!info.isDirectory()) {
1068
+ await unlessGone(() => copyFile(source, target));
1069
+ return;
1070
+ }
1071
+ const entries = await unlessGone(() => readdir(source));
1072
+ if (!entries) return;
1073
+ await mkdir(target, { recursive: true });
1074
+ for (const entry of entries) if (entry !== "node_modules") await copyTree(join(source, entry), join(target, entry));
1075
+ }
1076
+ /**
1077
+ * Copies one runtime package into deployment output, without its `node_modules`.
1078
+ *
1079
+ * An installed package only holds its published files. A linked workspace package, such as a `link:` or `workspace:`
1080
+ * dependency, is a whole source folder with tests and fixtures, so only the files that `npm publish` would ship are
1081
+ * copied. A path that disappears during the copy, such as a temporary test folder that another process removes, is
1082
+ * skipped instead of failing the build.
1083
+ */
1084
+ async function copyRuntimePackageFiles(packageDir, targetDir) {
1085
+ const paths = hasNodeModulesSegment$1(packageDir) ? void 0 : publishedPackagePaths(packageDir);
1086
+ if (!paths) {
1087
+ await copyTree(packageDir, targetDir);
1088
+ return;
1089
+ }
1090
+ await mkdir(targetDir, { recursive: true });
1091
+ for (const path of paths.files) {
1092
+ const target = join(targetDir, path);
1093
+ await mkdir(dirname(target), { recursive: true });
1094
+ await unlessGone(() => copyFile(join(packageDir, path), target));
1095
+ }
1096
+ }
1097
+ // ../internal/src/build/provider-output-sources.ts
916
1098
  /** Removes retained provider output after readers release it, tolerating transient filesystem contention. */
917
1099
  async function removeProviderOutputArtifactDir(path) {
918
1100
  await rm(path, {
@@ -922,8 +1104,10 @@ async function removeProviderOutputArtifactDir(path) {
922
1104
  retryDelay: 50
923
1105
  });
924
1106
  }
925
- //#endregion
926
- //#region ../internal/src/build/vercel-config.ts
1107
+ // ../internal/src/build/vercel-config.ts
1108
+ function createDefaultVercelOutputRoot(rootDir) {
1109
+ return resolve(rootDir, ".vercel", "output");
1110
+ }
927
1111
  function createVercelConfigJson() {
928
1112
  return {
929
1113
  routes: [{ handle: "filesystem" }, {
@@ -943,8 +1127,309 @@ function createNodeFunctionConfig(extra = {}) {
943
1127
  ...extra
944
1128
  };
945
1129
  }
946
- //#endregion
947
- //#region ../internal/src/build/provider-output-catalog.ts
1130
+ // ../internal/src/build/runtime-package-resolution.ts
1131
+ /** Locates package metadata through exports, an entry's ancestors, or the project's dependency roots. */
1132
+ function createRuntimePackageResolver(readPackageName) {
1133
+ return async (name, resolver, fromDir) => {
1134
+ try {
1135
+ return resolver.resolve(`${name}/package.json`);
1136
+ } catch (error) {
1137
+ if (!isPackageResolutionMiss(error)) throw error;
1138
+ }
1139
+ try {
1140
+ let current = dirname(resolver.resolve(name));
1141
+ while (current !== dirname(current)) {
1142
+ const candidate = join(current, "package.json");
1143
+ try {
1144
+ await access(candidate);
1145
+ if (readPackageName(await readFile(candidate, "utf8"), candidate) === name) return candidate;
1146
+ } catch (error) {
1147
+ if (error.code !== "ENOENT") throw error;
1148
+ }
1149
+ current = dirname(current);
1150
+ }
1151
+ } catch (error) {
1152
+ if (!isPackageResolutionMiss(error)) throw error;
1153
+ }
1154
+ let current = fromDir;
1155
+ while (current !== dirname(current)) {
1156
+ const candidate = join(current, "node_modules", ...name.split("/"), "package.json");
1157
+ try {
1158
+ await access(candidate);
1159
+ return candidate;
1160
+ } catch (error) {
1161
+ if (error.code !== "ENOENT") throw error;
1162
+ }
1163
+ current = dirname(current);
1164
+ }
1165
+ };
1166
+ }
1167
+ function isPackageResolutionMiss(error) {
1168
+ const code = error?.code;
1169
+ return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED";
1170
+ }
1171
+ // ../internal/src/build/runtime-package-directory.ts
1172
+ /** Update a staged copy, then publish it with rollback on failure or cancellation. */
1173
+ async function updateRuntimePackageDirectory(options) {
1174
+ const stagingRoot = await mkdtemp(join(dirname(options.directory), ".vitehub-runtime-packages-"));
1175
+ const stagedDirectory = join(stagingRoot, "node_modules");
1176
+ const previousDirectory = join(stagingRoot, "previous-node_modules");
1177
+ let movedPreviousOutput = false;
1178
+ let installedReplacement = false;
1179
+ let cleanupStagingRoot = true;
1180
+ try {
1181
+ try {
1182
+ await cp(options.directory, stagedDirectory, { recursive: true });
1183
+ } catch (error) {
1184
+ if (error.code !== "ENOENT") throw error;
1185
+ }
1186
+ await mkdir(stagedDirectory, { recursive: true });
1187
+ await options.update(stagedDirectory);
1188
+ options.signal?.throwIfAborted();
1189
+ try {
1190
+ await rename(options.directory, previousDirectory);
1191
+ movedPreviousOutput = true;
1192
+ cleanupStagingRoot = false;
1193
+ } catch (error) {
1194
+ if (error.code !== "ENOENT") throw error;
1195
+ }
1196
+ try {
1197
+ options.signal?.throwIfAborted();
1198
+ await rename(stagedDirectory, options.directory);
1199
+ installedReplacement = true;
1200
+ options.signal?.throwIfAborted();
1201
+ cleanupStagingRoot = true;
1202
+ } catch (error) {
1203
+ if (installedReplacement) await rm(options.directory, {
1204
+ force: true,
1205
+ recursive: true
1206
+ });
1207
+ if (movedPreviousOutput) await rename(previousDirectory, options.directory);
1208
+ cleanupStagingRoot = true;
1209
+ throw error;
1210
+ }
1211
+ } finally {
1212
+ if (cleanupStagingRoot) await rm(stagingRoot, {
1213
+ force: true,
1214
+ recursive: true
1215
+ });
1216
+ }
1217
+ }
1218
+ // ../internal/src/build/vercel-runtime-packages.ts
1219
+ const runtimeExportConditions = /* @__PURE__ */ new Set([
1220
+ "default",
1221
+ "import",
1222
+ "module",
1223
+ "node",
1224
+ "node-addons",
1225
+ "require"
1226
+ ]);
1227
+ const resolvePackageJson = createRuntimePackageResolver((source, path) => parsePackageJson(JSON.parse(source), path).name);
1228
+ let nodeFileTracePromise;
1229
+ /** Collects the runtime packages that features add to Vercel functions, then traces and copies them once per function. */
1230
+ function createVercelFunctionRuntimePackagesPass(beforeWrite) {
1231
+ const requests = [];
1232
+ return {
1233
+ add(request) {
1234
+ requests.push(request);
1235
+ },
1236
+ async copy(signal) {
1237
+ const functions = /* @__PURE__ */ new Map();
1238
+ for (const request of requests.splice(0)) {
1239
+ const outputRoot = request.outputRoot ?? createDefaultVercelOutputRoot(request.rootDir);
1240
+ const serverDir = resolve(outputRoot, "functions", request.serverFunctionName ?? "__server.func");
1241
+ const entry = functions.get(serverDir) ?? {
1242
+ requests: [],
1243
+ rootDir: request.rootDir
1244
+ };
1245
+ entry.requests.push(request);
1246
+ functions.set(serverDir, entry);
1247
+ }
1248
+ for (const [serverDir, entry] of functions) await copyFunctionRuntimePackages(serverDir, entry.rootDir, entry.requests, signal, beforeWrite);
1249
+ }
1250
+ };
1251
+ }
1252
+ async function copyFunctionRuntimePackages(serverDir, rootDir, requests, signal, beforeWrite) {
1253
+ try {
1254
+ await access(serverDir);
1255
+ } catch (error) {
1256
+ if (error.code === "ENOENT") return;
1257
+ throw error;
1258
+ }
1259
+ const groups = [];
1260
+ for (const request of requests) {
1261
+ const requested = Array.isArray(request.packages) ? request.packages : await request.packages();
1262
+ if (requested.length) groups.push(requested.map((runtimePackage) => ({
1263
+ ...runtimePackage,
1264
+ resolveFrom: runtimePackage.resolveFrom ?? join(request.rootDir, "package.json")
1265
+ })));
1266
+ }
1267
+ if (!groups.length) return;
1268
+ const directory = resolve(serverDir, "node_modules");
1269
+ await beforeWrite?.(directory);
1270
+ await updateRuntimePackageDirectory({
1271
+ directory,
1272
+ signal,
1273
+ update: (outputNodeModules) => copyNodeRuntimePackageGroups(outputNodeModules, rootDir, groups)
1274
+ });
1275
+ }
1276
+ async function copyNodeRuntimePackageGroups(outputNodeModules, rootDir, groups) {
1277
+ const selected = /* @__PURE__ */ new Map();
1278
+ const requested = /* @__PURE__ */ new Map();
1279
+ for (const packages of groups) {
1280
+ const visited = /* @__PURE__ */ new Set();
1281
+ const expanded = /* @__PURE__ */ new Set();
1282
+ for (const runtimePackage of packages) {
1283
+ const resolveFrom = runtimePackage.resolveFrom ?? join(rootDir, "package.json");
1284
+ const resolver = createRequire(resolveFrom);
1285
+ const packageJsonPath = await selectRuntimePackage(runtimePackage.name, resolver, dirname(resolveFrom), selected, visited, expanded, runtimePackage);
1286
+ if (!packageJsonPath) continue;
1287
+ const previous = requested.get(runtimePackage.name);
1288
+ if (previous && previous !== packageJsonPath) throw internalErrorDiagnostics.INTERNAL_RUNTIME_PACKAGE_VERSION_CONFLICT({
1289
+ first: dirname(previous),
1290
+ name: runtimePackage.name,
1291
+ second: dirname(packageJsonPath)
1292
+ });
1293
+ requested.set(runtimePackage.name, packageJsonPath);
1294
+ }
1295
+ }
1296
+ for (const [name, { packageJson, packageJsonPath, resolver }] of selected) {
1297
+ const packageDir = dirname(packageJsonPath);
1298
+ const targetDir = join(outputNodeModules, ...name.split("/"));
1299
+ await rm(targetDir, {
1300
+ force: true,
1301
+ recursive: true
1302
+ });
1303
+ if (!await copyTracedPackageFiles(name, resolver, packageDir, packageJsonPath, packageJson, targetDir)) await copyRuntimePackageFiles(packageDir, targetDir);
1304
+ }
1305
+ }
1306
+ async function selectRuntimePackage(name, resolver, fromDir, selected, visited, expanded, options = { name }) {
1307
+ const packageJsonPath = await resolvePackageJson(name, resolver, fromDir);
1308
+ if (!packageJsonPath) {
1309
+ if (options.optional) return void 0;
1310
+ throw internalErrorDiagnostics.INTERNAL_B0046({ message: `Could not resolve package.json for ${name}.` });
1311
+ }
1312
+ const resolvedPackageJsonPath = await realpath(packageJsonPath);
1313
+ const packageDir = dirname(resolvedPackageJsonPath);
1314
+ const packageJson = parsePackageJson(JSON.parse(await readFile(resolvedPackageJsonPath, "utf8")), resolvedPackageJsonPath);
1315
+ const packageKey = `${name}\0${resolvedPackageJsonPath}`;
1316
+ if (!visited.has(packageKey)) {
1317
+ visited.add(packageKey);
1318
+ selected.set(name, {
1319
+ packageJson,
1320
+ packageJsonPath: resolvedPackageJsonPath,
1321
+ resolver
1322
+ });
1323
+ }
1324
+ const expansionKey = `${packageKey}\0${options.includePeerDependencies ? "peers" : "dependencies"}`;
1325
+ if (expanded.has(expansionKey)) return resolvedPackageJsonPath;
1326
+ expanded.add(expansionKey);
1327
+ const packageRequire = createRequire(resolvedPackageJsonPath);
1328
+ const dependencyNames = new Set(Object.keys(packageJson.dependencies || {}));
1329
+ const optionalDependencyNames = new Set(Object.keys(packageJson.optionalDependencies || {}));
1330
+ for (const dependencyName of optionalDependencyNames) dependencyNames.add(dependencyName);
1331
+ const requiredPeerDependencyNames = /* @__PURE__ */ new Set();
1332
+ if (options.includePeerDependencies) {
1333
+ for (const dependencyName of Object.keys(packageJson.peerDependencies || {})) if (!packageJson.peerDependenciesMeta?.[dependencyName]?.optional) {
1334
+ dependencyNames.add(dependencyName);
1335
+ requiredPeerDependencyNames.add(dependencyName);
1336
+ }
1337
+ }
1338
+ for (const dependencyName of dependencyNames) await selectRuntimePackage(dependencyName, packageRequire, packageDir, selected, visited, expanded, {
1339
+ includePeerDependencies: options.includePeerDependencies,
1340
+ name: dependencyName,
1341
+ optional: optionalDependencyNames.has(dependencyName) && !requiredPeerDependencyNames.has(dependencyName)
1342
+ });
1343
+ return resolvedPackageJsonPath;
1344
+ }
1345
+ async function copyTracedPackageFiles(name, resolver, packageDir, packageJsonPath, packageJson, targetDir) {
1346
+ const entries = await resolvePackageTraceEntries(name, resolver, packageDir, packageJson);
1347
+ if (!entries) return false;
1348
+ const { fileList } = await (await loadNodeFileTrace())([...entries], {
1349
+ base: packageDir,
1350
+ conditions: ["node"],
1351
+ exportsOnly: true,
1352
+ processCwd: packageDir
1353
+ });
1354
+ fileList.add(relative(packageDir, packageJsonPath));
1355
+ for (const file of fileList) {
1356
+ const source = resolve(packageDir, file);
1357
+ if (!isInsideDirectory(packageDir, source) || hasNodeModulesSegment(file)) continue;
1358
+ if (!(await stat(source)).isFile()) continue;
1359
+ const target = resolve(targetDir, file);
1360
+ await mkdir(dirname(target), { recursive: true });
1361
+ await copyFile(source, target);
1362
+ }
1363
+ return true;
1364
+ }
1365
+ async function loadNodeFileTrace() {
1366
+ nodeFileTracePromise ??= import("@vercel/nft").then(({ nodeFileTrace }) => nodeFileTrace);
1367
+ return nodeFileTracePromise;
1368
+ }
1369
+ async function resolvePackageTraceEntries(name, resolver, packageDir, packageJson) {
1370
+ const entryCandidates = /* @__PURE__ */ new Set();
1371
+ if (packageJson.exports) {
1372
+ const exportedTargets = collectRuntimeExportTargets(packageJson.exports);
1373
+ if (!exportedTargets) return void 0;
1374
+ for (const target of exportedTargets) entryCandidates.add(resolve(packageDir, target));
1375
+ } else {
1376
+ try {
1377
+ entryCandidates.add(resolver.resolve(name));
1378
+ } catch (error) {
1379
+ if (!isPackageResolutionMiss(error)) throw error;
1380
+ }
1381
+ if (packageJson.main) entryCandidates.add(resolve(packageDir, packageJson.main));
1382
+ if (packageJson.module) entryCandidates.add(resolve(packageDir, packageJson.module));
1383
+ entryCandidates.add(resolve(packageDir, "index.js"));
1384
+ }
1385
+ const entries = [];
1386
+ for (const candidate of entryCandidates) try {
1387
+ const candidateStat = await stat(candidate);
1388
+ if (candidateStat.isFile()) entries.push(candidate);
1389
+ else if (candidateStat.isDirectory()) return void 0;
1390
+ } catch (error) {
1391
+ if (error.code !== "ENOENT") throw error;
1392
+ }
1393
+ return entries.length ? entries : void 0;
1394
+ }
1395
+ function collectRuntimeExportTargets(exportsValue, condition) {
1396
+ if (typeof exportsValue === "string") {
1397
+ if (condition === "types") return /* @__PURE__ */ new Set();
1398
+ if (exportsValue.includes("*")) return void 0;
1399
+ return exportsValue.startsWith("./") ? /* @__PURE__ */ new Set([exportsValue]) : /* @__PURE__ */ new Set();
1400
+ }
1401
+ if (Array.isArray(exportsValue)) {
1402
+ const targets = /* @__PURE__ */ new Set();
1403
+ for (const entry of exportsValue) {
1404
+ const entryTargets = collectRuntimeExportTargets(entry, condition);
1405
+ if (!entryTargets) return void 0;
1406
+ for (const target of entryTargets) targets.add(target);
1407
+ }
1408
+ return targets;
1409
+ }
1410
+ if (typeof exportsValue !== "object" || exportsValue === null) return /* @__PURE__ */ new Set();
1411
+ const targets = /* @__PURE__ */ new Set();
1412
+ for (const [key, value] of Object.entries(exportsValue)) {
1413
+ if (key === "types") continue;
1414
+ if (!key.startsWith(".") && !runtimeExportConditions.has(key)) continue;
1415
+ const entryTargets = collectRuntimeExportTargets(value, key);
1416
+ if (!entryTargets) return void 0;
1417
+ for (const target of entryTargets) targets.add(target);
1418
+ }
1419
+ return targets;
1420
+ }
1421
+ function hasNodeModulesSegment(path) {
1422
+ return path.split(/[\\/]/).includes("node_modules");
1423
+ }
1424
+ function isInsideDirectory(parent, child) {
1425
+ const childRelativePath = relative(parent, child);
1426
+ return childRelativePath === "" || !childRelativePath.startsWith(`..${sep}`) && childRelativePath !== ".." && !isAbsolute(childRelativePath);
1427
+ }
1428
+ function parsePackageJson(value, path) {
1429
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw internalErrorDiagnostics.INTERNAL_B0047({ message: `Expected ${path} to contain a JSON object.` });
1430
+ return value;
1431
+ }
1432
+ // ../internal/src/build/provider-output-catalog.ts
948
1433
  var ProviderOutputCatalog = class {
949
1434
  bundleDefines = {};
950
1435
  #appliedCloudflareContributions = /* @__PURE__ */ new Map();
@@ -1172,8 +1657,7 @@ function useProviderOutputCatalog(config) {
1172
1657
  providerOutputCatalogs.set(config, catalog);
1173
1658
  return catalog;
1174
1659
  }
1175
- //#endregion
1176
- //#region ../internal/src/build/deployment-output.ts
1660
+ // ../internal/src/build/deployment-output.ts
1177
1661
  const providerDeploymentOutputRegistry = globalThis;
1178
1662
  const providerDeploymentOutputWrites = providerDeploymentOutputRegistry.__vitehubProviderDeploymentOutputWrites ??= /* @__PURE__ */ new Map();
1179
1663
  const providerDeploymentOutputFinalizations = providerDeploymentOutputRegistry.__vitehubProviderDeploymentOutputFinalizations ??= /* @__PURE__ */ new WeakMap();
@@ -1264,9 +1748,6 @@ async function writeProviderOutputOwnershipFiles(outputRoot, ownership, files) {
1264
1748
  await writeFile(file, `${JSON.stringify(values, null, 2)}\n`, "utf8");
1265
1749
  }));
1266
1750
  }
1267
- function createDefaultVercelOutputRoot(rootDir) {
1268
- return resolve(rootDir, ".vercel", "output");
1269
- }
1270
1751
  function createDefaultNetlifyOutputRoot(rootDir) {
1271
1752
  return resolve(rootDir, ".netlify", "v1");
1272
1753
  }
@@ -2107,9 +2588,11 @@ async function finalizeProviderDeploymentOutputs(catalog, options = {}) {
2107
2588
  const write = withProviderDeploymentOutputRootLock(rootDir, async () => {
2108
2589
  await withProviderDeploymentOutputRootTransaction(rootDir, async (transaction) => {
2109
2590
  try {
2591
+ const vercelRuntimePackages = createVercelFunctionRuntimePackagesPass((nodeModules) => transaction.snapshot([nodeModules]));
2110
2592
  for (const contribution of rootContributions) {
2111
2593
  throwIfProviderOutputAborted(controller.signal);
2112
2594
  await contribution.write({
2595
+ addVercelRuntimePackages: (request) => vercelRuntimePackages.add(request),
2113
2596
  readCloudflareState: async (options) => await readCloudflareProviderDeploymentOutputState(rootDir, options),
2114
2597
  signal: controller.signal,
2115
2598
  write: async (writeOptions) => {
@@ -2125,6 +2608,8 @@ async function finalizeProviderDeploymentOutputs(catalog, options = {}) {
2125
2608
  });
2126
2609
  throwIfProviderOutputAborted(controller.signal);
2127
2610
  }
2611
+ await vercelRuntimePackages.copy(controller.signal);
2612
+ throwIfProviderOutputAborted(controller.signal);
2128
2613
  ready();
2129
2614
  const rollback = await rootDecision;
2130
2615
  if (rollback !== void 0) throw rollback;
@@ -2184,8 +2669,7 @@ async function finalizeProviderDeploymentOutputs(catalog, options = {}) {
2184
2669
  if (providerDeploymentOutputFinalizations.get(catalog) === active) providerDeploymentOutputFinalizations.delete(catalog);
2185
2670
  }
2186
2671
  }
2187
- //#endregion
2188
- //#region ../internal/src/definition-catalog.ts
2672
+ // ../internal/src/definition-catalog.ts
2189
2673
  const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
2190
2674
  const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
2191
2675
  const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
@@ -2332,276 +2816,7 @@ async function writeFileIfChanged(file, contents) {
2332
2816
  await mkdir(resolve$1(file, ".."), { recursive: true });
2333
2817
  await writeFile(file, contents, "utf8");
2334
2818
  }
2335
- //#endregion
2336
- //#region ../internal/src/build/runtime-package-resolution.ts
2337
- /** Locates package metadata through exports, an entry's ancestors, or the project's dependency roots. */
2338
- function createRuntimePackageResolver(readPackageName) {
2339
- return async (name, resolver, fromDir) => {
2340
- try {
2341
- return resolver.resolve(`${name}/package.json`);
2342
- } catch (error) {
2343
- if (!isPackageResolutionMiss(error)) throw error;
2344
- }
2345
- try {
2346
- let current = dirname(resolver.resolve(name));
2347
- while (current !== dirname(current)) {
2348
- const candidate = join(current, "package.json");
2349
- try {
2350
- await access(candidate);
2351
- if (readPackageName(await readFile(candidate, "utf8"), candidate) === name) return candidate;
2352
- } catch (error) {
2353
- if (error.code !== "ENOENT") throw error;
2354
- }
2355
- current = dirname(current);
2356
- }
2357
- } catch (error) {
2358
- if (!isPackageResolutionMiss(error)) throw error;
2359
- }
2360
- let current = fromDir;
2361
- while (current !== dirname(current)) {
2362
- const candidate = join(current, "node_modules", ...name.split("/"), "package.json");
2363
- try {
2364
- await access(candidate);
2365
- return candidate;
2366
- } catch (error) {
2367
- if (error.code !== "ENOENT") throw error;
2368
- }
2369
- current = dirname(current);
2370
- }
2371
- };
2372
- }
2373
- function isPackageResolutionMiss(error) {
2374
- const code = error?.code;
2375
- return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED";
2376
- }
2377
- //#endregion
2378
- //#region ../internal/src/build/runtime-package-directory.ts
2379
- /** Update a staged copy, then publish it with rollback on failure or cancellation. */
2380
- async function updateRuntimePackageDirectory(options) {
2381
- const stagingRoot = await mkdtemp(join(dirname(options.directory), ".vitehub-runtime-packages-"));
2382
- const stagedDirectory = join(stagingRoot, "node_modules");
2383
- const previousDirectory = join(stagingRoot, "previous-node_modules");
2384
- let movedPreviousOutput = false;
2385
- let installedReplacement = false;
2386
- let cleanupStagingRoot = true;
2387
- try {
2388
- try {
2389
- await cp(options.directory, stagedDirectory, { recursive: true });
2390
- } catch (error) {
2391
- if (error.code !== "ENOENT") throw error;
2392
- }
2393
- await mkdir(stagedDirectory, { recursive: true });
2394
- await options.update(stagedDirectory);
2395
- options.signal?.throwIfAborted();
2396
- try {
2397
- await rename(options.directory, previousDirectory);
2398
- movedPreviousOutput = true;
2399
- cleanupStagingRoot = false;
2400
- } catch (error) {
2401
- if (error.code !== "ENOENT") throw error;
2402
- }
2403
- try {
2404
- options.signal?.throwIfAborted();
2405
- await rename(stagedDirectory, options.directory);
2406
- installedReplacement = true;
2407
- options.signal?.throwIfAborted();
2408
- cleanupStagingRoot = true;
2409
- } catch (error) {
2410
- if (installedReplacement) await rm(options.directory, {
2411
- force: true,
2412
- recursive: true
2413
- });
2414
- if (movedPreviousOutput) await rename(previousDirectory, options.directory);
2415
- cleanupStagingRoot = true;
2416
- throw error;
2417
- }
2418
- } finally {
2419
- if (cleanupStagingRoot) await rm(stagingRoot, {
2420
- force: true,
2421
- recursive: true
2422
- });
2423
- }
2424
- }
2425
- //#endregion
2426
- //#region ../internal/src/build/vercel-runtime-packages.ts
2427
- const runtimeExportConditions = /* @__PURE__ */ new Set([
2428
- "default",
2429
- "import",
2430
- "module",
2431
- "node",
2432
- "node-addons",
2433
- "require"
2434
- ]);
2435
- const resolvePackageJson = createRuntimePackageResolver((source, path) => parsePackageJson(JSON.parse(source), path).name);
2436
- let nodeFileTracePromise;
2437
- async function copyVercelFunctionRuntimePackages(options) {
2438
- const outputRoot = options.outputRoot ?? createDefaultVercelOutputRoot(options.rootDir);
2439
- const serverFunctionName = options.serverFunctionName ?? "__server.func";
2440
- const serverDir = resolve(outputRoot, "functions", serverFunctionName);
2441
- try {
2442
- await access(serverDir);
2443
- } catch (error) {
2444
- if (error.code === "ENOENT") return;
2445
- throw error;
2446
- }
2447
- const packages = Array.isArray(options.packages) ? options.packages : await options.packages();
2448
- if (!packages.length) return;
2449
- await updateRuntimePackageDirectory({
2450
- directory: resolve(serverDir, "node_modules"),
2451
- signal: options.signal,
2452
- update: (outputNodeModules) => copyNodeRuntimePackages({
2453
- outputNodeModules,
2454
- packages,
2455
- rootDir: options.rootDir
2456
- })
2457
- });
2458
- }
2459
- async function copyNodeRuntimePackages(options) {
2460
- if (!options.packages.length) return;
2461
- const copied = /* @__PURE__ */ new Set();
2462
- const expanded = /* @__PURE__ */ new Set();
2463
- for (const runtimePackage of options.packages) {
2464
- const resolveFrom = runtimePackage.resolveFrom ?? join(options.rootDir, "package.json");
2465
- const resolver = createRequire(resolveFrom);
2466
- await copyPackageToNodeModules(runtimePackage.name, resolver, dirname(resolveFrom), options.outputNodeModules, copied, expanded, runtimePackage);
2467
- }
2468
- }
2469
- async function copyPackageToNodeModules(name, resolver, fromDir, outputNodeModules, copied, expanded, options = { name }) {
2470
- const packageJsonPath = await resolvePackageJson(name, resolver, fromDir);
2471
- if (!packageJsonPath) {
2472
- if (options.optional) return;
2473
- throw internalErrorDiagnostics.INTERNAL_B0046({ message: `Could not resolve package.json for ${name}.` });
2474
- }
2475
- const resolvedPackageJsonPath = await realpath(packageJsonPath);
2476
- const packageDir = dirname(resolvedPackageJsonPath);
2477
- const packageJson = parsePackageJson(JSON.parse(await readFile(resolvedPackageJsonPath, "utf8")), resolvedPackageJsonPath);
2478
- const packageKey = `${name}\0${resolvedPackageJsonPath}`;
2479
- if (!copied.has(packageKey)) {
2480
- copied.add(packageKey);
2481
- const targetDir = join(outputNodeModules, ...name.split("/"));
2482
- await rm(targetDir, {
2483
- force: true,
2484
- recursive: true
2485
- });
2486
- if (!await copyTracedPackageFiles(name, resolver, packageDir, resolvedPackageJsonPath, packageJson, targetDir)) await copyPackageDirectory(packageDir, targetDir);
2487
- }
2488
- const expansionKey = `${packageKey}\0${options.includePeerDependencies ? "peers" : "dependencies"}`;
2489
- if (expanded.has(expansionKey)) return;
2490
- expanded.add(expansionKey);
2491
- const packageRequire = createRequire(resolvedPackageJsonPath);
2492
- const dependencyNames = new Set(Object.keys(packageJson.dependencies || {}));
2493
- const optionalDependencyNames = new Set(Object.keys(packageJson.optionalDependencies || {}));
2494
- for (const dependencyName of optionalDependencyNames) dependencyNames.add(dependencyName);
2495
- const requiredPeerDependencyNames = /* @__PURE__ */ new Set();
2496
- if (options.includePeerDependencies) {
2497
- for (const dependencyName of Object.keys(packageJson.peerDependencies || {})) if (!packageJson.peerDependenciesMeta?.[dependencyName]?.optional) {
2498
- dependencyNames.add(dependencyName);
2499
- requiredPeerDependencyNames.add(dependencyName);
2500
- }
2501
- }
2502
- for (const dependencyName of dependencyNames) await copyPackageToNodeModules(dependencyName, packageRequire, packageDir, outputNodeModules, copied, expanded, {
2503
- includePeerDependencies: options.includePeerDependencies,
2504
- name: dependencyName,
2505
- optional: optionalDependencyNames.has(dependencyName) && !requiredPeerDependencyNames.has(dependencyName)
2506
- });
2507
- }
2508
- async function copyTracedPackageFiles(name, resolver, packageDir, packageJsonPath, packageJson, targetDir) {
2509
- const entries = await resolvePackageTraceEntries(name, resolver, packageDir, packageJson);
2510
- if (!entries) return false;
2511
- const { fileList } = await (await loadNodeFileTrace())([...entries], {
2512
- base: packageDir,
2513
- conditions: ["node"],
2514
- exportsOnly: true,
2515
- processCwd: packageDir
2516
- });
2517
- fileList.add(relative(packageDir, packageJsonPath));
2518
- for (const file of fileList) {
2519
- const source = resolve(packageDir, file);
2520
- if (!isInsideDirectory(packageDir, source) || hasNodeModulesSegment(file)) continue;
2521
- if (!(await stat(source)).isFile()) continue;
2522
- const target = resolve(targetDir, file);
2523
- await mkdir(dirname(target), { recursive: true });
2524
- await copyFile(source, target);
2525
- }
2526
- return true;
2527
- }
2528
- async function copyPackageDirectory(packageDir, targetDir) {
2529
- await mkdir(dirname(targetDir), { recursive: true });
2530
- await cp(packageDir, targetDir, {
2531
- dereference: true,
2532
- filter: (source) => !hasNodeModulesSegment(relative(packageDir, source)),
2533
- recursive: true
2534
- });
2535
- }
2536
- async function loadNodeFileTrace() {
2537
- nodeFileTracePromise ??= import("@vercel/nft").then(({ nodeFileTrace }) => nodeFileTrace);
2538
- return nodeFileTracePromise;
2539
- }
2540
- async function resolvePackageTraceEntries(name, resolver, packageDir, packageJson) {
2541
- const entryCandidates = /* @__PURE__ */ new Set();
2542
- if (packageJson.exports) {
2543
- const exportedTargets = collectRuntimeExportTargets(packageJson.exports);
2544
- if (!exportedTargets) return void 0;
2545
- for (const target of exportedTargets) entryCandidates.add(resolve(packageDir, target));
2546
- } else {
2547
- try {
2548
- entryCandidates.add(resolver.resolve(name));
2549
- } catch (error) {
2550
- if (!isPackageResolutionMiss(error)) throw error;
2551
- }
2552
- if (packageJson.main) entryCandidates.add(resolve(packageDir, packageJson.main));
2553
- if (packageJson.module) entryCandidates.add(resolve(packageDir, packageJson.module));
2554
- entryCandidates.add(resolve(packageDir, "index.js"));
2555
- }
2556
- const entries = [];
2557
- for (const candidate of entryCandidates) try {
2558
- const candidateStat = await stat(candidate);
2559
- if (candidateStat.isFile()) entries.push(candidate);
2560
- else if (candidateStat.isDirectory()) return void 0;
2561
- } catch (error) {
2562
- if (error.code !== "ENOENT") throw error;
2563
- }
2564
- return entries.length ? entries : void 0;
2565
- }
2566
- function collectRuntimeExportTargets(exportsValue, condition) {
2567
- if (typeof exportsValue === "string") {
2568
- if (condition === "types") return /* @__PURE__ */ new Set();
2569
- if (exportsValue.includes("*")) return void 0;
2570
- return exportsValue.startsWith("./") ? /* @__PURE__ */ new Set([exportsValue]) : /* @__PURE__ */ new Set();
2571
- }
2572
- if (Array.isArray(exportsValue)) {
2573
- const targets = /* @__PURE__ */ new Set();
2574
- for (const entry of exportsValue) {
2575
- const entryTargets = collectRuntimeExportTargets(entry, condition);
2576
- if (!entryTargets) return void 0;
2577
- for (const target of entryTargets) targets.add(target);
2578
- }
2579
- return targets;
2580
- }
2581
- if (typeof exportsValue !== "object" || exportsValue === null) return /* @__PURE__ */ new Set();
2582
- const targets = /* @__PURE__ */ new Set();
2583
- for (const [key, value] of Object.entries(exportsValue)) {
2584
- if (key === "types") continue;
2585
- if (!key.startsWith(".") && !runtimeExportConditions.has(key)) continue;
2586
- const entryTargets = collectRuntimeExportTargets(value, key);
2587
- if (!entryTargets) return void 0;
2588
- for (const target of entryTargets) targets.add(target);
2589
- }
2590
- return targets;
2591
- }
2592
- function hasNodeModulesSegment(path) {
2593
- return path.split(/[\\/]/).includes("node_modules");
2594
- }
2595
- function isInsideDirectory(parent, child) {
2596
- const childRelativePath = relative(parent, child);
2597
- return childRelativePath === "" || !childRelativePath.startsWith(`..${sep}`) && childRelativePath !== ".." && !isAbsolute(childRelativePath);
2598
- }
2599
- function parsePackageJson(value, path) {
2600
- if (typeof value !== "object" || value === null || Array.isArray(value)) throw internalErrorDiagnostics.INTERNAL_B0047({ message: `Expected ${path} to contain a JSON object.` });
2601
- return value;
2602
- }
2603
- //#endregion
2604
- //#region ../internal/src/dev-endpoint.ts
2819
+ // ../internal/src/dev-endpoint.ts
2605
2820
  function firstHeader(value) {
2606
2821
  return Array.isArray(value) ? value[0] : value;
2607
2822
  }
@@ -2793,8 +3008,8 @@ function registerViteHubDevEndpoint(server, options) {
2793
3008
  });
2794
3009
  });
2795
3010
  }
2796
- //#endregion
2797
- //#region ../internal/src/nitro-kit.ts
3011
+ Object.freeze({ vitehubAuthAccess: "handler" });
3012
+ Object.freeze({ vitehubOwnAccess: true });
2798
3013
  function cloneArray(value) {
2799
3014
  return Array.isArray(value) ? [...value] : [];
2800
3015
  }
@@ -2840,8 +3055,7 @@ function hostFromNitroPreset(value) {
2840
3055
  if (normalized === "node" || normalized.startsWith("node-")) return "node";
2841
3056
  if (normalized.startsWith("vercel")) return "vercel";
2842
3057
  }
2843
- //#endregion
2844
- //#region ../internal/src/hosting.ts
3058
+ // ../internal/src/hosting.ts
2845
3059
  /**
2846
3060
  * Returns the Nitro preset name that this build targets, as the developer wrote it.
2847
3061
  * The order is `nitro.preset`, `hosting`, `NITRO_PRESET`, `SERVER_PRESET`, then `VITEHUB_HOST`.
@@ -2863,8 +3077,7 @@ function getHostingProvider(hosting) {
2863
3077
  const host = hostFromNitroPreset(hosting);
2864
3078
  if (host === "cloudflare" || host === "netlify" || host === "vercel") return host;
2865
3079
  }
2866
- //#endregion
2867
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/utils/helpers.js
3080
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/utils/helpers.js
2868
3081
  function dedupePlugins(defaultPlugins, userPlugins) {
2869
3082
  const plugins = /* @__PURE__ */ new Map();
2870
3083
  for (const plugin of defaultPlugins) plugins.set(plugin.name, plugin);
@@ -2880,8 +3093,7 @@ function dedupePlugins(defaultPlugins, userPlugins) {
2880
3093
  function defineComarkPlugin(fn) {
2881
3094
  return fn;
2882
3095
  }
2883
- //#endregion
2884
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/syntax/brackets.js
3096
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/syntax/brackets.js
2885
3097
  function findClosingBracket(str, openIndex) {
2886
3098
  if (str[openIndex] !== "[") return -1;
2887
3099
  let index = openIndex + 1;
@@ -2908,8 +3120,7 @@ function parseBracketContent(str, startIndex) {
2908
3120
  endIndex: close + 1
2909
3121
  };
2910
3122
  }
2911
- //#endregion
2912
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/sanitize.js
3123
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/sanitize.js
2913
3124
  const unsafeProtocols = ["javascript:", "vbscript:"];
2914
3125
  function isUnsafeProtocol(url, allowDataImage) {
2915
3126
  if (unsafeProtocols.includes(url.protocol)) return true;
@@ -2968,7 +3179,8 @@ const URL_PROPS = /* @__PURE__ */ new Set([
2968
3179
  "poster",
2969
3180
  "cite",
2970
3181
  "background",
2971
- "ping"
3182
+ "ping",
3183
+ "longdesc"
2972
3184
  ]);
2973
3185
  const URL_PROP_SUFFIX = /(?:href|src|url|uri|link)s?$/;
2974
3186
  function isUrlProp(name) {
@@ -2980,13 +3192,74 @@ function normalizePropName(attribute) {
2980
3192
  function isUrlPropKey(key) {
2981
3193
  return isUrlProp(normalizePropName(key));
2982
3194
  }
2983
- //#endregion
2984
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/html-attributes.js
2985
- const HTML_SINK_PROPS = /* @__PURE__ */ new Set([
3195
+ const tagSelectors = ["as", "is"];
3196
+ const componentOptionKeys = /* @__PURE__ */ new Set([
3197
+ "template",
3198
+ "render",
3199
+ "ssrrender",
3200
+ "setup",
3201
+ "extends",
3202
+ "mixins",
3203
+ "__v_isvnode",
3204
+ "__isteleport",
3205
+ "__issuspense",
3206
+ "__iskeepalive"
3207
+ ]);
3208
+ const htmlSinkProps = /* @__PURE__ */ new Set([
2986
3209
  "innerhtml",
2987
3210
  "dangerouslysetinnerhtml",
2988
3211
  "textcontent"
2989
3212
  ]);
3213
+ function isHtmlSinkKey(key) {
3214
+ return htmlSinkProps.has(key.replace(/^[.^]/, "").toLowerCase());
3215
+ }
3216
+ function isVNodeMarkerKey(key) {
3217
+ return key.replace(/^(?::|v-bind:)/, "").toLowerCase() === "__v_isvnode";
3218
+ }
3219
+ function isUnsafeRendererProp(attribute, value) {
3220
+ return isComponentSelectorViolation(attribute, value) || hasUnsafeObjectKeys(value);
3221
+ }
3222
+ function isComponentSelectorViolation(attribute, value) {
3223
+ const name = normalizePropName(attribute);
3224
+ if (tagSelectors.includes(name)) return value != null && typeof value !== "string";
3225
+ if (name !== "tag") return false;
3226
+ return typeof value === "function" || typeof value === "object" && value !== null && !Array.isArray(value);
3227
+ }
3228
+ function ownsComponentOptions(value) {
3229
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
3230
+ for (const key of Object.keys(value)) if (componentOptionKeys.has(key.toLowerCase())) return true;
3231
+ return false;
3232
+ }
3233
+ function ownsHtmlSink(value) {
3234
+ if (Array.isArray(value)) return false;
3235
+ for (const key of Object.keys(value)) if (isHtmlSinkKey(key)) return true;
3236
+ return false;
3237
+ }
3238
+ const unsafeObjectKeysCache = /* @__PURE__ */ new WeakMap();
3239
+ function hasUnsafeObjectKeys(value) {
3240
+ if (typeof value !== "object" || value === null) return false;
3241
+ const cached = unsafeObjectKeysCache.get(value);
3242
+ if (cached !== void 0) return cached;
3243
+ const seen = /* @__PURE__ */ new Set();
3244
+ const pending = [value];
3245
+ let found = false;
3246
+ while (pending.length && !found) {
3247
+ const current = pending.pop();
3248
+ if (typeof current !== "object" || current === null || seen.has(current)) continue;
3249
+ const known = unsafeObjectKeysCache.get(current);
3250
+ if (known !== void 0) {
3251
+ found = known;
3252
+ continue;
3253
+ }
3254
+ seen.add(current);
3255
+ if (ownsComponentOptions(current) || ownsHtmlSink(current)) found = true;
3256
+ else for (const item of Object.values(current)) pending.push(item);
3257
+ }
3258
+ unsafeObjectKeysCache.set(value, found);
3259
+ if (!found) for (const object of seen) unsafeObjectKeysCache.set(object, false);
3260
+ return found;
3261
+ }
3262
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/html-attributes.js
2990
3263
  function resolveAttributes(attrs, renderData, options = {}) {
2991
3264
  const result = {};
2992
3265
  for (const key in attrs) {
@@ -2994,8 +3267,7 @@ function resolveAttributes(attrs, renderData, options = {}) {
2994
3267
  const value = attrs[key];
2995
3268
  const isBinding = key.charCodeAt(0) === 58;
2996
3269
  const outKey = isBinding ? key.slice(1) : key;
2997
- const lowerOutKey = outKey.replace(/^[.^]/, "").toLowerCase();
2998
- if (HTML_SINK_PROPS.has(lowerOutKey)) continue;
3270
+ if (isHtmlSinkKey(outKey) || isVNodeMarkerKey(outKey)) continue;
2999
3271
  let outValue;
3000
3272
  let resultKey = key;
3001
3273
  if (options.parseJson && isBinding) {
@@ -3013,6 +3285,7 @@ function resolveAttributes(attrs, renderData, options = {}) {
3013
3285
  resultKey = outKey;
3014
3286
  } else outValue = value;
3015
3287
  } else outValue = value;
3288
+ if (options.parseJson && isUnsafeRendererProp(outKey, outValue)) continue;
3016
3289
  if (isBinding && isUrlPropKey(outKey) && typeof outValue === "string" && isUnsafeUrlValue(outValue)) continue;
3017
3290
  result[resultKey] = outValue;
3018
3291
  }
@@ -3050,8 +3323,7 @@ function htmlAttributes(attributes, { verbatim = false } = {}) {
3050
3323
  }
3051
3324
  return parts.join(" ");
3052
3325
  }
3053
- //#endregion
3054
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/transform-node.js
3326
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/transform-node.js
3055
3327
  function applyNodeTransforms(transforms, node, props, renderData, parent) {
3056
3328
  if (!transforms) return void 0;
3057
3329
  const list = typeof transforms === "function" ? [transforms] : transforms;
@@ -3077,8 +3349,7 @@ function applyNodeTransforms(transforms, node, props, renderData, parent) {
3077
3349
  props: nextProps
3078
3350
  };
3079
3351
  }
3080
- //#endregion
3081
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/utils/index.js
3352
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/utils/index.js
3082
3353
  function textContent(node, options) {
3083
3354
  return collectText(node, options?.decodeHTML);
3084
3355
  }
@@ -3244,8 +3515,7 @@ function get(data, key) {
3244
3515
  else return;
3245
3516
  return value;
3246
3517
  }
3247
- //#endregion
3248
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/syntax/props.js
3518
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/syntax/props.js
3249
3519
  const bracketPairs = {
3250
3520
  "[": "]",
3251
3521
  "{": "}",
@@ -3339,8 +3609,7 @@ function searchProps(content, index = 0) {
3339
3609
  index
3340
3610
  };
3341
3611
  }
3342
- //#endregion
3343
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/syntax/block-params.js
3612
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/syntax/block-params.js
3344
3613
  const RE_BLOCK_NAME = /^[a-z$][$\w.-]*/i;
3345
3614
  function parseBlockParams(str) {
3346
3615
  str = str.trim();
@@ -3372,8 +3641,7 @@ function parseBlockParams(str) {
3372
3641
  if (unparsedRemaining) result.remaining = unparsedRemaining;
3373
3642
  return result;
3374
3643
  }
3375
- //#endregion
3376
- //#region ../../node_modules/.pnpm/js-yaml@5.5.0/node_modules/js-yaml/dist/js-yaml.mjs
3644
+ // ../../node_modules/.pnpm/js-yaml@5.5.0/node_modules/js-yaml/dist/js-yaml.mjs
3377
3645
  /*! js-yaml 5.5.0 https://github.com/nodeca/js-yaml @license MIT */
3378
3646
  /**
3379
3647
  * Returned by a scalar resolver when the source does not match its tag.
@@ -6705,8 +6973,7 @@ COLLECTION_STYLE.FLOW;
6705
6973
  CHOMPING_MODE.CLIP;
6706
6974
  CHOMPING_MODE.STRIP;
6707
6975
  CHOMPING_MODE.KEEP;
6708
- //#endregion
6709
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/yaml.js
6976
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/yaml.js
6710
6977
  function parseYaml(content) {
6711
6978
  const documents = loadAll(content, { schema: JSON_SCHEMA });
6712
6979
  if (documents.length > 1) throw new YAMLException("expected a single document in the stream, but found more");
@@ -6734,8 +7001,7 @@ function stringifyYaml(data, options) {
6734
7001
  }
6735
7002
  return lines.join("\n");
6736
7003
  }
6737
- //#endregion
6738
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/indent.js
7004
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/indent.js
6739
7005
  function dedentLine(state, line, columns) {
6740
7006
  const lineStart = state.bMarks[line];
6741
7007
  const max = state.eMarks[line];
@@ -6790,8 +7056,7 @@ function restoreLines(state, from, bMarks, bsCount, sCount, tShift) {
6790
7056
  state.tShift[line] = tShift[i];
6791
7057
  }
6792
7058
  }
6793
- //#endregion
6794
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/components.js
7059
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/components.js
6795
7060
  const RE_COMPONENT_NAME = /^[a-z$][\w$-]*/i;
6796
7061
  function isValidComponentName(name) {
6797
7062
  return RE_COMPONENT_NAME.test(name);
@@ -7135,8 +7400,7 @@ var components_default = defineComarkPlugin(() => ({
7135
7400
  name: "components",
7136
7401
  markdownItPlugins: [markdownItComponents]
7137
7402
  }));
7138
- //#endregion
7139
- //#region ../../node_modules/.pnpm/markdown-exit@2.1.0/node_modules/markdown-exit/dist/chunk-CXurZ27M.js
7403
+ // ../../node_modules/.pnpm/markdown-exit@2.1.3/node_modules/markdown-exit/dist/chunk-CXurZ27M.js
7140
7404
  var __defProp = Object.defineProperty;
7141
7405
  var __exportAll = (all, symbols) => {
7142
7406
  let target = {};
@@ -7147,8 +7411,7 @@ var __exportAll = (all, symbols) => {
7147
7411
  if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
7148
7412
  return target;
7149
7413
  };
7150
- //#endregion
7151
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
7414
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
7152
7415
  const decodeCache = {};
7153
7416
  function getDecodeCache(exclude) {
7154
7417
  let cache = decodeCache[exclude];
@@ -7218,8 +7481,7 @@ function decode(string, exclude) {
7218
7481
  }
7219
7482
  decode.defaultChars = ";/?:@&=+$,#";
7220
7483
  decode.componentChars = "";
7221
- //#endregion
7222
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.mjs
7484
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.mjs
7223
7485
  const encodeCache = {};
7224
7486
  function getEncodeCache(exclude) {
7225
7487
  let cache = encodeCache[exclude];
@@ -7272,8 +7534,7 @@ function encode(string, exclude, keepEscaped) {
7272
7534
  }
7273
7535
  encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
7274
7536
  encode.componentChars = "-_.!~*'()";
7275
- //#endregion
7276
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/format.mjs
7537
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/format.mjs
7277
7538
  function format(url) {
7278
7539
  let result = "";
7279
7540
  result += url.protocol || "";
@@ -7287,8 +7548,7 @@ function format(url) {
7287
7548
  result += url.hash || "";
7288
7549
  return result;
7289
7550
  }
7290
- //#endregion
7291
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/parse.mjs
7551
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/parse.mjs
7292
7552
  function Url() {
7293
7553
  this.protocol = null;
7294
7554
  this.slashes = null;
@@ -7459,16 +7719,14 @@ Url.prototype.parseHost = function(host) {
7459
7719
  }
7460
7720
  if (host) this.hostname = host;
7461
7721
  };
7462
- //#endregion
7463
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.mjs
7722
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.mjs
7464
7723
  var mdurl_exports = /* @__PURE__ */ __exportAll$1({
7465
7724
  decode: () => decode,
7466
7725
  encode: () => encode,
7467
7726
  format: () => format,
7468
7727
  parse: () => urlParse
7469
7728
  });
7470
- //#endregion
7471
- //#region ../../node_modules/.pnpm/uc.micro@3.0.0/node_modules/uc.micro/build/index.mjs
7729
+ // ../../node_modules/.pnpm/uc.micro@3.0.0/node_modules/uc.micro/build/index.mjs
7472
7730
  var build_exports = /* @__PURE__ */ __exportAll$1({
7473
7731
  Any: () => Any,
7474
7732
  Cc: () => Cc,
@@ -7483,8 +7741,7 @@ const Cf = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\
7483
7741
  const P = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/;
7484
7742
  const S = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/;
7485
7743
  const Z = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
7486
- //#endregion
7487
- //#region ../../node_modules/.pnpm/character-entities@2.0.2/node_modules/character-entities/index.js
7744
+ // ../../node_modules/.pnpm/character-entities@2.0.2/node_modules/character-entities/index.js
7488
7745
  /**
7489
7746
  * Map of named character references.
7490
7747
  *
@@ -9617,8 +9874,7 @@ const characterEntities = {
9617
9874
  zwj: "‍",
9618
9875
  zwnj: "‌"
9619
9876
  };
9620
- //#endregion
9621
- //#region ../../node_modules/.pnpm/markdown-exit@2.1.0/node_modules/markdown-exit/dist/index.core-Ccg4mWUA.js
9877
+ // ../../node_modules/.pnpm/markdown-exit@2.1.3/node_modules/markdown-exit/dist/index.core-BrabpolG.js
9622
9878
  var import_punycode = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
9623
9879
  /** Highest positive signed 32-bit float value */
9624
9880
  const maxInt = 2147483647;
@@ -10293,8 +10549,8 @@ var StateBlock = class {
10293
10549
  const s = this.src;
10294
10550
  const len = s.length;
10295
10551
  for (let start = 0; start < len;) {
10296
- const lineEnd = s.indexOf("\n", start);
10297
- const end = lineEnd === -1 ? len : lineEnd;
10552
+ const lineEnd$1 = s.indexOf("\n", start);
10553
+ const end = lineEnd$1 === -1 ? len : lineEnd$1;
10298
10554
  let indent = 0;
10299
10555
  let offset = 0;
10300
10556
  let pos = start;
@@ -10444,11 +10700,16 @@ var StateInline = class {
10444
10700
  */
10445
10701
  _prev_delimiters = [];
10446
10702
  /**
10447
- * backtick length => last seen position
10703
+ * backtick run length => position of its last run, built lazily on first use
10448
10704
  */
10449
10705
  backticks = {};
10450
10706
  backticksScanned = false;
10451
10707
  /**
10708
+ * Set when html comment / PI / declaration / CDATA has no terminator,
10709
+ * to skip further scans of these constructs
10710
+ */
10711
+ skipHtmlSpecial = false;
10712
+ /**
10452
10713
  * Counter used to disable inline linkify-it execution
10453
10714
  * inside `<a>` and markdown links
10454
10715
  */
@@ -11097,10 +11358,7 @@ var html_blocks_default = [
11097
11358
  "track",
11098
11359
  "ul"
11099
11360
  ];
11100
- const open_tag = `<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`;
11101
- const close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
11102
- const HTML_TAG_RE$1 = /* @__PURE__ */ new RegExp(`^(?:${open_tag}|${close_tag}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<\\?[\\s\\S]*?\\?>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`);
11103
- const HTML_OPEN_CLOSE_TAG_RE = /* @__PURE__ */ new RegExp(`^(?:${open_tag}|${close_tag})`);
11361
+ const HTML_OPEN_CLOSE_TAG_RE = /* @__PURE__ */ new RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`);
11104
11362
  const HTML_SEQUENCES = [
11105
11363
  [
11106
11364
  /^<(script|pre|style|textarea)(?=(\s|>|$))/i,
@@ -11401,129 +11659,141 @@ function paragraph(state, startLine, endLine) {
11401
11659
  state.parentType = oldParentType;
11402
11660
  return true;
11403
11661
  }
11662
+ const MAX_LABEL_LENGTH = 999;
11663
+ function countCodePoints(str) {
11664
+ let length = str.length;
11665
+ for (let i = 0; i < str.length - 1; i++) {
11666
+ const high = str.charCodeAt(i);
11667
+ if (high < 55296 || high > 56319) continue;
11668
+ const low = str.charCodeAt(i + 1);
11669
+ if (low >= 56320 && low <= 57343) {
11670
+ length--;
11671
+ i++;
11672
+ }
11673
+ }
11674
+ return length;
11675
+ }
11676
+ function lineEnd(state, line) {
11677
+ return Math.min(state.eMarks[line] + 1, state.src.length);
11678
+ }
11679
+ function getNextLinePos(state, nextLine) {
11680
+ const endLine = state.lineMax;
11681
+ if (nextLine >= endLine || state.isEmpty(nextLine)) return -1;
11682
+ let isContinuation = false;
11683
+ if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
11684
+ if (state.sCount[nextLine] < 0) isContinuation = true;
11685
+ if (!isContinuation) {
11686
+ const terminatorRules = state.md.block.ruler.getRules("reference");
11687
+ const oldParentType = state.parentType;
11688
+ state.parentType = "reference";
11689
+ let terminate = false;
11690
+ for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
11691
+ terminate = true;
11692
+ break;
11693
+ }
11694
+ state.parentType = oldParentType;
11695
+ if (terminate) return -1;
11696
+ }
11697
+ return state.bMarks[nextLine] + state.tShift[nextLine];
11698
+ }
11404
11699
  function reference(state, startLine, endLine, silent) {
11700
+ const src = state.src;
11405
11701
  let pos = state.bMarks[startLine] + state.tShift[startLine];
11406
- let max = state.eMarks[startLine];
11407
11702
  let nextLine = startLine + 1;
11408
11703
  if (state.sCount[startLine] - state.blkIndent >= 4) return false;
11409
- if (state.src.charCodeAt(pos) !== 91) return false;
11410
- function getNextLine(nextLine$1) {
11411
- const endLine$1 = state.lineMax;
11412
- if (nextLine$1 >= endLine$1 || state.isEmpty(nextLine$1)) return null;
11413
- let isContinuation = false;
11414
- if (state.sCount[nextLine$1] - state.blkIndent > 3) isContinuation = true;
11415
- if (state.sCount[nextLine$1] < 0) isContinuation = true;
11416
- if (!isContinuation) {
11417
- const terminatorRules = state.md.block.ruler.getRules("reference");
11418
- const oldParentType = state.parentType;
11419
- state.parentType = "reference";
11420
- let terminate = false;
11421
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine$1, endLine$1, true)) {
11422
- terminate = true;
11423
- break;
11424
- }
11425
- state.parentType = oldParentType;
11426
- if (terminate) return null;
11427
- }
11428
- const pos$1 = state.bMarks[nextLine$1] + state.tShift[nextLine$1];
11429
- const max$1 = state.eMarks[nextLine$1];
11430
- return state.src.slice(pos$1, max$1 + 1);
11431
- }
11432
- let str = state.src.slice(pos, max + 1);
11433
- max = str.length;
11704
+ if (src.charCodeAt(pos) !== 91) return false;
11705
+ let max = lineEnd(state, startLine);
11706
+ let rawLabel = "";
11434
11707
  let labelEnd = -1;
11435
- for (pos = 1; pos < max; pos++) {
11436
- const ch = str.charCodeAt(pos);
11708
+ let segmentStart = ++pos;
11709
+ while (pos < max) {
11710
+ if (rawLabel.length + pos - segmentStart > MAX_LABEL_LENGTH * 2) return false;
11711
+ let ch = src.charCodeAt(pos);
11437
11712
  if (ch === 91) return false;
11438
- else if (ch === 93) {
11713
+ if (ch === 93) {
11439
11714
  labelEnd = pos;
11440
11715
  break;
11441
- } else if (ch === 10) {
11442
- const lineContent = getNextLine(nextLine);
11443
- if (lineContent !== null) {
11444
- str += lineContent;
11445
- max = str.length;
11446
- nextLine++;
11447
- }
11448
- } else if (ch === 92) {
11449
- pos++;
11450
- if (pos < max && str.charCodeAt(pos) === 10) {
11451
- const lineContent = getNextLine(nextLine);
11452
- if (lineContent !== null) {
11453
- str += lineContent;
11454
- max = str.length;
11455
- nextLine++;
11456
- }
11457
- }
11458
11716
  }
11717
+ if (ch === 92) ch = src.charCodeAt(++pos);
11718
+ if (ch === 10 && pos < max) {
11719
+ const nextPos = getNextLinePos(state, nextLine);
11720
+ if (nextPos < 0) return false;
11721
+ rawLabel += src.slice(segmentStart, max);
11722
+ pos = segmentStart = nextPos;
11723
+ max = lineEnd(state, nextLine++);
11724
+ continue;
11725
+ }
11726
+ pos++;
11459
11727
  }
11460
- if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) return false;
11461
- for (pos = labelEnd + 2; pos < max; pos++) {
11462
- const ch = str.charCodeAt(pos);
11728
+ if (labelEnd < 0 || src.charCodeAt(labelEnd + 1) !== 58) return false;
11729
+ rawLabel += src.slice(segmentStart, labelEnd);
11730
+ if (rawLabel.length > MAX_LABEL_LENGTH && countCodePoints(rawLabel) > MAX_LABEL_LENGTH) return false;
11731
+ pos = labelEnd + 2;
11732
+ while (pos < max) {
11733
+ const ch = src.charCodeAt(pos);
11463
11734
  if (ch === 10) {
11464
- const lineContent = getNextLine(nextLine);
11465
- if (lineContent !== null) {
11466
- str += lineContent;
11467
- max = str.length;
11468
- nextLine++;
11469
- }
11470
- } else if (isSpace(ch)) {} else break;
11735
+ const nextPos = getNextLinePos(state, nextLine);
11736
+ if (nextPos < 0) break;
11737
+ pos = nextPos;
11738
+ max = lineEnd(state, nextLine++);
11739
+ } else if (isSpace(ch)) pos++;
11740
+ else break;
11471
11741
  }
11472
- const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
11742
+ const destRes = state.md.helpers.parseLinkDestination(src, pos, max);
11473
11743
  if (!destRes.ok) return false;
11474
11744
  const href = state.md.normalizeLink(destRes.str);
11475
11745
  if (!state.md.validateLink(href)) return false;
11476
11746
  pos = destRes.pos;
11477
11747
  const destEndPos = pos;
11748
+ const destEndMax = max;
11478
11749
  const destEndLineNo = nextLine;
11479
- const start = pos;
11480
- for (; pos < max; pos++) {
11481
- const ch = str.charCodeAt(pos);
11750
+ while (pos < max) {
11751
+ const ch = src.charCodeAt(pos);
11482
11752
  if (ch === 10) {
11483
- const lineContent = getNextLine(nextLine);
11484
- if (lineContent !== null) {
11485
- str += lineContent;
11486
- max = str.length;
11487
- nextLine++;
11488
- }
11489
- } else if (isSpace(ch)) {} else break;
11753
+ const nextPos = getNextLinePos(state, nextLine);
11754
+ if (nextPos < 0) break;
11755
+ pos = nextPos;
11756
+ max = lineEnd(state, nextLine++);
11757
+ } else if (isSpace(ch)) pos++;
11758
+ else break;
11490
11759
  }
11491
- let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
11760
+ const titleStart = pos;
11761
+ let titleRes = state.md.helpers.parseLinkTitle(src, pos, max);
11492
11762
  while (titleRes.can_continue) {
11493
- const lineContent = getNextLine(nextLine);
11494
- if (lineContent === null) break;
11495
- str += lineContent;
11496
- pos = max;
11497
- max = str.length;
11498
- nextLine++;
11499
- titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
11763
+ const nextPos = getNextLinePos(state, nextLine);
11764
+ if (nextPos < 0) break;
11765
+ pos = nextPos;
11766
+ max = lineEnd(state, nextLine++);
11767
+ titleRes = state.md.helpers.parseLinkTitle(src, pos, max, titleRes);
11500
11768
  }
11501
11769
  let title;
11502
- if (pos < max && start !== pos && titleRes.ok) {
11770
+ if (titleStart !== destEndPos && titleRes.ok) {
11503
11771
  title = titleRes.str;
11504
11772
  pos = titleRes.pos;
11505
11773
  } else {
11506
11774
  title = "";
11507
11775
  pos = destEndPos;
11776
+ max = destEndMax;
11508
11777
  nextLine = destEndLineNo;
11509
11778
  }
11510
11779
  while (pos < max) {
11511
- if (!isSpace(str.charCodeAt(pos))) break;
11780
+ if (!isSpace(src.charCodeAt(pos))) break;
11512
11781
  pos++;
11513
11782
  }
11514
- if (pos < max && str.charCodeAt(pos) !== 10) {
11783
+ if (pos < max && src.charCodeAt(pos) !== 10) {
11515
11784
  if (title) {
11516
11785
  title = "";
11517
11786
  pos = destEndPos;
11787
+ max = destEndMax;
11518
11788
  nextLine = destEndLineNo;
11519
11789
  while (pos < max) {
11520
- if (!isSpace(str.charCodeAt(pos))) break;
11790
+ if (!isSpace(src.charCodeAt(pos))) break;
11521
11791
  pos++;
11522
11792
  }
11523
11793
  }
11524
11794
  }
11525
- if (pos < max && str.charCodeAt(pos) !== 10) return false;
11526
- const label = normalizeReference(str.slice(1, labelEnd));
11795
+ if (pos < max && src.charCodeAt(pos) !== 10) return false;
11796
+ const label = normalizeReference(rawLabel);
11527
11797
  if (!label) return false;
11528
11798
  /* istanbul ignore if */
11529
11799
  if (silent) return true;
@@ -11831,6 +12101,7 @@ function linkify$1(state) {
11831
12101
  for (let j = 0, l = blockTokens.length; j < l; j++) {
11832
12102
  if (blockTokens[j].type !== "inline" || !linkify$2.test(blockTokens[j].content)) continue;
11833
12103
  const tokens = blockTokens[j].children;
12104
+ const replacements = [];
11834
12105
  let htmlLinkLevel = 0;
11835
12106
  for (let i = tokens.length - 1; i >= 0; i--) {
11836
12107
  const currentToken = tokens[i];
@@ -11891,19 +12162,38 @@ function linkify$1(state) {
11891
12162
  token.level = level;
11892
12163
  nodes.push(token);
11893
12164
  }
11894
- tokens.splice(i, 1, ...nodes);
12165
+ replacements.push({
12166
+ index: i,
12167
+ nodes
12168
+ });
12169
+ }
12170
+ }
12171
+ if (replacements.length > 0) {
12172
+ let newTokensLength = tokens.length;
12173
+ for (const replacement of replacements) newTokensLength += replacement.nodes.length - 1;
12174
+ const newTokens = new Array(newTokensLength);
12175
+ let replacementIndex = 0;
12176
+ let newTokenIndex = 0;
12177
+ replacements.reverse();
12178
+ for (let i = 0; i < tokens.length; i++) {
12179
+ const replacement = replacements[replacementIndex];
12180
+ if (replacement?.index === i) {
12181
+ for (const node of replacement.nodes) newTokens[newTokenIndex++] = node;
12182
+ replacementIndex++;
12183
+ } else newTokens[newTokenIndex++] = tokens[i];
11895
12184
  }
12185
+ blockTokens[j].children = newTokens;
11896
12186
  }
11897
12187
  }
11898
12188
  }
11899
- const NEWLINES_RE = /\r\n?|\n/g;
12189
+ const UNNORMALIZED_NEWLINE_RE = /\r\n?/g;
11900
12190
  const NULL_RE = /\0/g;
11901
12191
  function normalize(state) {
11902
12192
  let str = state.src;
11903
12193
  const hasCR = str.includes("\r");
11904
12194
  const hasNull = str.includes("\0");
11905
12195
  if (!hasCR && !hasNull) return;
11906
- if (hasCR) str = str.replace(NEWLINES_RE, "\n");
12196
+ if (hasCR) str = str.replace(UNNORMALIZED_NEWLINE_RE, "\n");
11907
12197
  if (hasNull) str = str.replace(NULL_RE, "�");
11908
12198
  state.src = str;
11909
12199
  }
@@ -11950,6 +12240,14 @@ function replace(state) {
11950
12240
  const QUOTE_TEST_RE = /['"]/;
11951
12241
  const QUOTE_RE = /['"]/g;
11952
12242
  const APOSTROPHE = "’";
12243
+ const MAX_OPENERS = 1e3;
12244
+ function truncateStack(stack, heads, length) {
12245
+ while (stack.length > length) {
12246
+ const item = stack.pop();
12247
+ if (item.isSingleQuote) heads.single = item.prevSameQuoteIdx;
12248
+ else heads.double = item.prevSameQuoteIdx;
12249
+ }
12250
+ }
11953
12251
  function addReplacement(replacements, tokenIdx, pos, ch) {
11954
12252
  if (!replacements[tokenIdx]) replacements[tokenIdx] = [];
11955
12253
  replacements[tokenIdx].push({
@@ -11971,12 +12269,16 @@ function applyReplacements(str, replacements) {
11971
12269
  function process_inlines(tokens, state) {
11972
12270
  let j;
11973
12271
  const stack = [];
12272
+ const heads = {
12273
+ single: -1,
12274
+ double: -1
12275
+ };
11974
12276
  const replacements = {};
11975
12277
  for (let i = 0; i < tokens.length; i++) {
11976
12278
  const token = tokens[i];
11977
12279
  const thisLevel = tokens[i].level;
11978
12280
  for (j = stack.length - 1; j >= 0; j--) if (stack[j].level <= thisLevel) break;
11979
- stack.length = j + 1;
12281
+ truncateStack(stack, heads, j + 1);
11980
12282
  if (token.type !== "text") continue;
11981
12283
  const text$1 = token.content;
11982
12284
  let pos = 0;
@@ -12028,11 +12330,10 @@ function process_inlines(tokens, state) {
12028
12330
  if (isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
12029
12331
  continue;
12030
12332
  }
12031
- if (canClose) for (j = stack.length - 1; j >= 0; j--) {
12032
- let item = stack[j];
12033
- if (stack[j].level < thisLevel) break;
12034
- if (item.single === isSingle && stack[j].level === thisLevel) {
12035
- item = stack[j];
12333
+ if (canClose) {
12334
+ j = isSingle ? heads.single : heads.double;
12335
+ if (j >= 0 && stack[j].level === thisLevel) {
12336
+ const item = stack[j];
12036
12337
  let openQuote;
12037
12338
  let closeQuote;
12038
12339
  if (isSingle) {
@@ -12043,18 +12344,23 @@ function process_inlines(tokens, state) {
12043
12344
  closeQuote = state.md.options.quotes[1];
12044
12345
  }
12045
12346
  addReplacement(replacements, i, t.index, closeQuote);
12046
- addReplacement(replacements, item.token, item.pos, openQuote);
12047
- stack.length = j;
12347
+ addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote);
12348
+ truncateStack(stack, heads, j);
12048
12349
  continue OUTER;
12049
12350
  }
12050
12351
  }
12051
- if (canOpen) stack.push({
12052
- token: i,
12053
- pos: t.index,
12054
- single: isSingle,
12055
- level: thisLevel
12056
- });
12057
- else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
12352
+ if (canOpen) {
12353
+ if (stack.length >= MAX_OPENERS) return;
12354
+ stack.push({
12355
+ tokenIdx: i,
12356
+ contentPos: t.index,
12357
+ isSingleQuote: isSingle,
12358
+ level: thisLevel,
12359
+ prevSameQuoteIdx: isSingle ? heads.single : heads.double
12360
+ });
12361
+ if (isSingle) heads.single = stack.length - 1;
12362
+ else heads.double = stack.length - 1;
12363
+ } else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
12058
12364
  }
12059
12365
  }
12060
12366
  Object.keys(replacements).forEach((tokenIdx) => {
@@ -12320,43 +12626,54 @@ function autolink(state, silent) {
12320
12626
  }
12321
12627
  return false;
12322
12628
  }
12629
+ function buildLastRuns(src) {
12630
+ const lastRuns = {};
12631
+ let pos = 0;
12632
+ while (true) {
12633
+ pos = src.indexOf("`", pos);
12634
+ if (pos === -1) break;
12635
+ const start = pos;
12636
+ while (src.charCodeAt(++pos) === 96);
12637
+ lastRuns[pos - start] = start;
12638
+ }
12639
+ return lastRuns;
12640
+ }
12323
12641
  function backtick(state, silent) {
12324
- let pos = state.pos;
12642
+ const start = state.pos;
12325
12643
  const src = state.src;
12326
- if (src.charCodeAt(pos) !== 96) return false;
12327
- const start = pos;
12328
- pos++;
12644
+ if (src.charCodeAt(start) !== 96) return false;
12329
12645
  const max = state.posMax;
12646
+ let pos = start + 1;
12330
12647
  while (pos < max && src.charCodeAt(pos) === 96) pos++;
12331
12648
  const marker = src.slice(start, pos);
12332
12649
  const openerLength = marker.length;
12333
- if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
12334
- if (!silent) state.pending += marker;
12335
- state.pos += openerLength;
12336
- return true;
12337
- }
12338
- let matchEnd = pos;
12339
- let matchStart;
12340
- while (true) {
12341
- matchStart = src.indexOf("`", matchEnd);
12342
- if (matchStart === -1) break;
12343
- matchEnd = matchStart + 1;
12344
- while (matchEnd < max && src.charCodeAt(matchEnd) === 96) matchEnd++;
12345
- const closerLength = matchEnd - matchStart;
12346
- if (closerLength === openerLength) {
12347
- if (!silent) {
12348
- const token = state.push("code_inline", "code", 0);
12349
- token.markup = marker;
12350
- token.content = src.slice(pos, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1");
12650
+ if (!state.backticksScanned) {
12651
+ state.backticks = buildLastRuns(src);
12652
+ state.backticksScanned = true;
12653
+ }
12654
+ if ((state.backticks[openerLength] ?? -1) >= pos) {
12655
+ let matchEnd = pos;
12656
+ while (true) {
12657
+ const matchStart = src.indexOf("`", matchEnd);
12658
+ if (matchStart === -1 || matchStart >= max) break;
12659
+ matchEnd = matchStart + 1;
12660
+ while (src.charCodeAt(matchEnd) === 96) matchEnd++;
12661
+ if (matchEnd > max) break;
12662
+ if (matchEnd - matchStart === openerLength) {
12663
+ if (!silent) {
12664
+ const token = state.push("code_inline", "code", 0);
12665
+ token.markup = marker;
12666
+ let content = src.slice(pos, matchStart).replace(/\n/g, " ");
12667
+ if (content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) content = content.slice(1, -1);
12668
+ token.content = content;
12669
+ }
12670
+ state.pos = matchEnd;
12671
+ return true;
12351
12672
  }
12352
- state.pos = matchEnd;
12353
- return true;
12354
12673
  }
12355
- state.backticks[closerLength] = matchStart;
12356
12674
  }
12357
- state.backticksScanned = true;
12358
12675
  if (!silent) state.pending += marker;
12359
- state.pos += openerLength;
12676
+ state.pos = pos;
12360
12677
  return true;
12361
12678
  }
12362
12679
  function processDelimiters(delimiters) {
@@ -12596,22 +12913,53 @@ function isLetter$1(ch) {
12596
12913
  const lc = ch | 32;
12597
12914
  return lc >= 97 && lc <= 122;
12598
12915
  }
12916
+ function scanSpecial(state, pos) {
12917
+ const src = state.src;
12918
+ let start;
12919
+ let terminator;
12920
+ if (src.startsWith("<!--", pos)) {
12921
+ if (src.startsWith(">", pos + 4)) return pos + 5;
12922
+ if (src.startsWith("->", pos + 4)) return pos + 6;
12923
+ start = pos + 4;
12924
+ terminator = "-->";
12925
+ } else if (src.startsWith("<![CDATA[", pos)) {
12926
+ start = pos + 9;
12927
+ terminator = "]]>";
12928
+ } else if (src.charCodeAt(pos + 1) === 63) {
12929
+ start = pos + 2;
12930
+ terminator = "?>";
12931
+ } else if (isLetter$1(src.charCodeAt(pos + 2))) {
12932
+ start = pos + 3;
12933
+ terminator = ">";
12934
+ } else return -1;
12935
+ if (state.skipHtmlSpecial) return -1;
12936
+ const end = src.indexOf(terminator, start);
12937
+ if (end < 0) {
12938
+ state.skipHtmlSpecial = true;
12939
+ return -1;
12940
+ }
12941
+ return end + terminator.length;
12942
+ }
12599
12943
  function html_inline(state, silent) {
12600
12944
  if (!state.md.options.html) return false;
12601
12945
  const max = state.posMax;
12602
12946
  const pos = state.pos;
12603
12947
  if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) return false;
12948
+ let end;
12604
12949
  const ch = state.src.charCodeAt(pos + 1);
12605
- if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter$1(ch)) return false;
12606
- const match = state.src.slice(pos).match(HTML_TAG_RE$1);
12607
- if (!match) return false;
12950
+ if (ch === 33 || ch === 63) end = scanSpecial(state, pos);
12951
+ else if (ch === 47 || isLetter$1(ch)) {
12952
+ const match = state.src.slice(pos).match(HTML_OPEN_CLOSE_TAG_RE);
12953
+ end = match ? pos + match[0].length : -1;
12954
+ } else return false;
12955
+ if (end < 0) return false;
12608
12956
  if (!silent) {
12609
12957
  const token = state.push("html_inline", "", 0);
12610
- token.content = match[0];
12958
+ token.content = state.src.slice(pos, end);
12611
12959
  if (isLinkOpen(token.content)) state.linkLevel++;
12612
12960
  if (isLinkClose(token.content)) state.linkLevel--;
12613
12961
  }
12614
- state.pos += match[0].length;
12962
+ state.pos = end;
12615
12963
  return true;
12616
12964
  }
12617
12965
  function image(state, silent) {
@@ -12780,7 +13128,12 @@ function link$2(state, silent) {
12780
13128
  state.posMax = max;
12781
13129
  return true;
12782
13130
  }
12783
- const SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
13131
+ function isAsciiAlpha$1(code$1) {
13132
+ return code$1 >= 65 && code$1 <= 90 || code$1 >= 97 && code$1 <= 122;
13133
+ }
13134
+ function isSchemeChar(code$1) {
13135
+ return code$1 >= 65 && code$1 <= 90 || code$1 >= 97 && code$1 <= 122 || code$1 >= 48 && code$1 <= 57 || code$1 === 43 || code$1 === 45 || code$1 === 46;
13136
+ }
12784
13137
  function linkify(state, silent) {
12785
13138
  if (!state.md.options.linkify) return false;
12786
13139
  if (state.linkLevel > 0) return false;
@@ -12790,20 +13143,22 @@ function linkify(state, silent) {
12790
13143
  if (state.src.charCodeAt(pos) !== 58) return false;
12791
13144
  if (state.src.charCodeAt(pos + 1) !== 47) return false;
12792
13145
  if (state.src.charCodeAt(pos + 2) !== 47) return false;
12793
- const match = state.pending.match(SCHEME_RE);
12794
- if (!match) return false;
12795
- const proto = match[1];
12796
- const link$1 = requireLinkify(state.md.linkify).matchAtStart(state.src.slice(pos - proto.length));
13146
+ const protoMin = pos - Math.min(10, state.pending.length, pos);
13147
+ let protoStart = pos;
13148
+ while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) protoStart--;
13149
+ if (protoStart === pos || !isAsciiAlpha$1(state.src.charCodeAt(protoStart))) return false;
13150
+ const protoLength = pos - protoStart;
13151
+ const link$1 = requireLinkify(state.md.linkify).matchAtStart(state.src.slice(protoStart));
12797
13152
  if (!link$1) return false;
12798
13153
  let url = link$1.url;
12799
- if (url.length <= proto.length) return false;
13154
+ if (url.length <= protoLength) return false;
12800
13155
  let urlEnd = url.length;
12801
13156
  while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 42) urlEnd--;
12802
13157
  if (urlEnd !== url.length) url = url.slice(0, urlEnd);
12803
13158
  const fullUrl = state.md.normalizeLink(url);
12804
13159
  if (!state.md.validateLink(fullUrl)) return false;
12805
13160
  if (!silent) {
12806
- state.pending = state.pending.slice(0, -proto.length);
13161
+ state.pending = state.pending.slice(0, -protoLength);
12807
13162
  const token_o = state.push("link_open", "a", 1);
12808
13163
  token_o.attrs = [["href", fullUrl]];
12809
13164
  token_o.markup = "linkify";
@@ -12814,7 +13169,7 @@ function linkify(state, silent) {
12814
13169
  token_c.markup = "linkify";
12815
13170
  token_c.info = "auto";
12816
13171
  }
12817
- state.pos += url.length - proto.length;
13172
+ state.pos += url.length - protoLength;
12818
13173
  return true;
12819
13174
  }
12820
13175
  function newline(state, silent) {
@@ -13084,7 +13439,12 @@ function normalizeLink(url) {
13084
13439
  parsed.hostname = import_punycode.default.toASCII(parsed.hostname);
13085
13440
  } catch {}
13086
13441
  }
13087
- return encode(format(parsed));
13442
+ if (parsed.auth) parsed.auth = encode(parsed.auth);
13443
+ if (parsed.hostname) parsed.hostname = encode(parsed.hostname);
13444
+ if (parsed.pathname) parsed.pathname = encode(parsed.pathname);
13445
+ if (parsed.search) parsed.search = encode(parsed.search);
13446
+ if (parsed.hash) parsed.hash = encode(parsed.hash);
13447
+ return format(parsed);
13088
13448
  }
13089
13449
  function normalizeLinkText(url) {
13090
13450
  const parsed = urlParse(url, true);
@@ -13722,8 +14082,7 @@ var MarkdownExit = class extends Parser {
13722
14082
  static StateInline = StateInline;
13723
14083
  };
13724
14084
  var index_core_default = callable(MarkdownExit);
13725
- //#endregion
13726
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/attributes.js
14085
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/attributes.js
13727
14086
  const TEXT_TOKENS = /* @__PURE__ */ new Set([
13728
14087
  "text",
13729
14088
  "text_special",
@@ -13866,8 +14225,7 @@ var attributes_default = defineComarkPlugin(() => ({
13866
14225
  name: "attributes",
13867
14226
  markdownItPlugins: [markdownItAttributes]
13868
14227
  }));
13869
- //#endregion
13870
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/task-list.js
14228
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/task-list.js
13871
14229
  function attrSet(token, name, value) {
13872
14230
  const index = token.attrIndex(name);
13873
14231
  const attr = [name, value];
@@ -13944,8 +14302,7 @@ var task_list_default = defineComarkPlugin(() => ({
13944
14302
  name: "task-list",
13945
14303
  markdownItPlugins: [markdownItTaskList]
13946
14304
  }));
13947
- //#endregion
13948
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/alert.js
14305
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/alert.js
13949
14306
  const markers = {
13950
14307
  "!TIP": {
13951
14308
  type: "tip",
@@ -14001,8 +14358,7 @@ var alert_default = defineComarkPlugin(() => ({
14001
14358
  });
14002
14359
  }
14003
14360
  }));
14004
- //#endregion
14005
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/html.js
14361
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/html.js
14006
14362
  var html_default = defineComarkPlugin((opts = {}) => {
14007
14363
  return {
14008
14364
  name: "html",
@@ -14155,8 +14511,7 @@ function htmlToTokens(str) {
14155
14511
  if (textStart < len) pushText(tokens, str.slice(textStart));
14156
14512
  return tokens;
14157
14513
  }
14158
- //#endregion
14159
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/frontmatter.js
14514
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/frontmatter.js
14160
14515
  const FRONTMATTER_DELIMITER_DEFAULT = "---";
14161
14516
  const CR = "\r";
14162
14517
  function parseFrontmatter(content) {
@@ -14185,8 +14540,7 @@ function renderFrontmatter(data, content, yamlOptions) {
14185
14540
  if (content) return "---\n" + fm + "\n---\n\n" + content.trim();
14186
14541
  return fm;
14187
14542
  }
14188
- //#endregion
14189
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/frontmatter.js
14543
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/frontmatter.js
14190
14544
  var frontmatter_default = defineComarkPlugin(() => ({
14191
14545
  name: "frontmatter",
14192
14546
  pre(state) {
@@ -14197,8 +14551,7 @@ var frontmatter_default = defineComarkPlugin(() => ({
14197
14551
  if (content && frontmatterText) state.parsedLines = (state.parsedLines ?? 0) + frontmatterText.split("\n").length + 1;
14198
14552
  }
14199
14553
  }));
14200
- //#endregion
14201
- //#region ../../node_modules/.pnpm/linkify-it@6.1.0/node_modules/linkify-it/build/index.mjs
14554
+ // ../../node_modules/.pnpm/linkify-it@6.1.0/node_modules/linkify-it/build/index.mjs
14202
14555
  var REBuilder = class {
14203
14556
  src_Any = Any.source;
14204
14557
  src_Cc = Cc.source;
@@ -14726,8 +15079,7 @@ var LinkifyIt = class {
14726
15079
  if (match.schema === "mailto:" && !/^mailto:/i.test(match.url)) match.url = `mailto:${match.url}`;
14727
15080
  }
14728
15081
  };
14729
- //#endregion
14730
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/linkify.js
15082
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/linkify.js
14731
15083
  const markdownItPlugins = /* @__PURE__ */ new Map();
14732
15084
  function markdownItLinkify(options) {
14733
15085
  const key = JSON.stringify(options);
@@ -14745,8 +15097,7 @@ var linkify_default = defineComarkPlugin((options = {}) => ({
14745
15097
  name: "linkify",
14746
15098
  markdownItPlugins: [markdownItLinkify(options)]
14747
15099
  }));
14748
- //#endregion
14749
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/bracket-math.js
15100
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/bracket-math.js
14750
15101
  function findBracketClose(text, from, close, end = text.length) {
14751
15102
  for (let pos = from; pos + 1 < end; pos++) {
14752
15103
  if (text.charCodeAt(pos) !== 92) continue;
@@ -15017,6 +15368,8 @@ function healRegion(text, o) {
15017
15368
  let htmlLt = -1;
15018
15369
  let starInWord = false;
15019
15370
  let starDisabled = false;
15371
+ let starSkippedLen = 0;
15372
+ let starSkippedDepth = -1;
15020
15373
  let noParenClose = -1;
15021
15374
  let noBracketClose = -1;
15022
15375
  for (let i = 0; i < len; i++) {
@@ -15025,6 +15378,7 @@ function healRegion(text, o) {
15025
15378
  if (c === 10) {
15026
15379
  lineStart = i + 1;
15027
15380
  starInWord = false;
15381
+ starSkippedLen = 0;
15028
15382
  htmlLt = -1;
15029
15383
  continue;
15030
15384
  }
@@ -15040,6 +15394,7 @@ function healRegion(text, o) {
15040
15394
  }
15041
15395
  if (c === 32 || c === 9 || c === 13) {
15042
15396
  starInWord = false;
15397
+ starSkippedLen = 0;
15043
15398
  continue;
15044
15399
  }
15045
15400
  if (c === 92) {
@@ -15126,19 +15481,29 @@ function healRegion(text, o) {
15126
15481
  const enabled = n === 1 ? o.italic : n === 2 ? o.bold : o.boldItalic;
15127
15482
  if (c === 42) {
15128
15483
  const inWord = attachedLeft && isAlnum(prev) && isAlnum(next);
15129
- if (!inWord || starInWord) {
15484
+ if (inWord && !starInWord) {
15485
+ starSkippedLen = n;
15486
+ starSkippedDepth = frames.length;
15487
+ } else {
15130
15488
  if (attachedLeft && top !== null && top.k === F_STAR && (!inWord || top.len === n)) {
15131
15489
  closeRun(frames, F_STAR, n);
15490
+ starSkippedLen = 0;
15132
15491
  starInWord = true;
15133
15492
  i += n - 1;
15134
15493
  continue;
15135
15494
  }
15495
+ if (attachedLeft && !inWord && starSkippedLen === n && starSkippedDepth === frames.length && !isOpeningPunct(prev)) {
15496
+ starSkippedLen = 0;
15497
+ i += n - 1;
15498
+ continue;
15499
+ }
15136
15500
  if (openRight && enabled) {
15137
15501
  frames.push({
15138
15502
  k: F_STAR,
15139
15503
  len: n,
15140
15504
  pos: i
15141
15505
  });
15506
+ starSkippedLen = 0;
15142
15507
  starInWord = true;
15143
15508
  i += n - 1;
15144
15509
  continue;
@@ -15495,6 +15860,13 @@ function isAlnum(cp) {
15495
15860
  if (c <= 127) return c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122;
15496
15861
  return ALNUM_CP_RE.test(cp);
15497
15862
  }
15863
+ const OPENING_PUNCT_RE = /\p{Ps}|\p{Pi}/u;
15864
+ function isOpeningPunct(cp) {
15865
+ if (cp === "") return false;
15866
+ const c = cp.charCodeAt(0);
15867
+ if (c <= 127) return c === 40 || c === 91 || c === 123;
15868
+ return OPENING_PUNCT_RE.test(cp);
15869
+ }
15498
15870
  function isAsciiAlpha(c) {
15499
15871
  return c >= 97 && c <= 122 || c >= 65 && c <= 90;
15500
15872
  }
@@ -15641,8 +16013,7 @@ function closeTables(markdown) {
15641
16013
  if (!hasSeparator) lines.splice(start + 1, 0, generateSeparator());
15642
16014
  return lines.join("\n");
15643
16015
  }
15644
- //#endregion
15645
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/utils/trace.js
16016
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/utils/trace.js
15646
16017
  const noopSpan = { end: () => {} };
15647
16018
  const noopTracer = {
15648
16019
  startSpan: () => noopSpan,
@@ -15663,8 +16034,7 @@ function withSpan(tracer, name, fn, options) {
15663
16034
  }
15664
16035
  });
15665
16036
  }
15666
- //#endregion
15667
- //#region ../../node_modules/.pnpm/character-entities-legacy@3.0.0/node_modules/character-entities-legacy/index.js
16037
+ // ../../node_modules/.pnpm/character-entities-legacy@3.0.0/node_modules/character-entities-legacy/index.js
15668
16038
  /**
15669
16039
  * List of legacy HTML named character references that don’t need a trailing semicolon.
15670
16040
  *
@@ -15778,8 +16148,7 @@ const characterEntitiesLegacy = [
15778
16148
  "yen",
15779
16149
  "yuml"
15780
16150
  ];
15781
- //#endregion
15782
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/entities.js
16151
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/entities.js
15783
16152
  const own = Object.prototype.hasOwnProperty;
15784
16153
  const legacy = new Set(characterEntitiesLegacy);
15785
16154
  const C1 = {
@@ -15824,7 +16193,7 @@ function fromNumericReference(value) {
15824
16193
  if (value === 0 || value > 1114111 || value >= 55296 && value <= 57343) return "�";
15825
16194
  return String.fromCodePoint(C1[value] ?? value);
15826
16195
  }
15827
- function decodeHTMLAttribute$1(input) {
16196
+ function decodeHTMLAttribute(input) {
15828
16197
  let amp = input.indexOf("&");
15829
16198
  if (amp === -1) return input;
15830
16199
  let out = "";
@@ -15865,8 +16234,7 @@ function decodeHTMLAttribute$1(input) {
15865
16234
  }
15866
16235
  return out + input.slice(last);
15867
16236
  }
15868
- //#endregion
15869
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/utils.js
16237
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/utils.js
15870
16238
  function isSpaceCode$1(c) {
15871
16239
  return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
15872
16240
  }
@@ -15984,7 +16352,7 @@ function parseHtmlInline(content) {
15984
16352
  };
15985
16353
  }
15986
16354
  function decodeAttributeValue(value) {
15987
- return value.includes("&") ? decodeHTMLAttribute$1(value) : value;
16355
+ return value.includes("&") ? decodeHTMLAttribute(value) : value;
15988
16356
  }
15989
16357
  function parseHtmlAttributes(attrsStr) {
15990
16358
  const attrs = {};
@@ -15998,8 +16366,7 @@ function parseHtmlAttributes(attrsStr) {
15998
16366
  }
15999
16367
  return attrs;
16000
16368
  }
16001
- //#endregion
16002
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/unwrap.js
16369
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/unwrap.js
16003
16370
  function resolveUnwrapTags(unwrap) {
16004
16371
  if (!unwrap) return [];
16005
16372
  if (unwrap === true) return ["p"];
@@ -16030,8 +16397,7 @@ function applyUnwrap(nodes, tags) {
16030
16397
  else merged.push(node);
16031
16398
  return merged;
16032
16399
  }
16033
- //#endregion
16034
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/tree-utils.js
16400
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/tree-utils.js
16035
16401
  const MAX_HIGHLIGHT_LINES = 1e3;
16036
16402
  function parseCodeblockInfo(info) {
16037
16403
  if (!info) return {};
@@ -16123,8 +16489,7 @@ function mergeAdjacentTextNodes(nodes) {
16123
16489
  }
16124
16490
  return merged;
16125
16491
  }
16126
- //#endregion
16127
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/heading-id.js
16492
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/heading-id.js
16128
16493
  function createHeadingIdTracker(option = true) {
16129
16494
  if (option === false) return void 0;
16130
16495
  return {
@@ -16167,8 +16532,7 @@ function nextHeadingId(text, level, tracker) {
16167
16532
  usedIds.add(id);
16168
16533
  return id;
16169
16534
  }
16170
- //#endregion
16171
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/tree.js
16535
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/tree.js
16172
16536
  const inlineTags$1 = /* @__PURE__ */ new Set([
16173
16537
  "strong",
16174
16538
  "em",
@@ -16350,10 +16714,13 @@ function processChildren(tokens, start, closeType, state, nestHtml = false) {
16350
16714
  nextIndex: i
16351
16715
  };
16352
16716
  }
16353
- function processPossibleAttributesSyntax(tokens, value) {
16354
- const extractedAttributes = extractAttributes(tokens, value.nextIndex);
16717
+ function processPossibleAttributesSyntax(tokens, value, skipEmptyText = true) {
16718
+ const extractedAttributes = extractAttributes(tokens, value.nextIndex, skipEmptyText);
16355
16719
  if (value.nextIndex < extractedAttributes.nextIndex) {
16356
- value.node[1] = Object.assign(value.node[1], extractedAttributes.attrs);
16720
+ const attrs = extractedAttributes.attrs;
16721
+ const current = value.node[1];
16722
+ if (typeof current.class === "string" && typeof attrs.class === "string") attrs.class = `${current.class} ${attrs.class}`;
16723
+ value.node[1] = Object.assign(current, attrs);
16357
16724
  value.nextIndex = extractedAttributes.nextIndex;
16358
16725
  }
16359
16726
  return value;
@@ -16648,15 +17015,10 @@ const processors = {
16648
17015
  },
16649
17016
  mdc_inline_component(tokens, start) {
16650
17017
  const token = tokens[start];
16651
- const tokenAttrs = processAttributes(token.attrs);
16652
- const { attrs, nextIndex } = extractAttributes(tokens, start + 1, false);
16653
- return {
16654
- node: [token.tag, {
16655
- ...tokenAttrs,
16656
- ...attrs
16657
- }],
16658
- nextIndex
16659
- };
17018
+ return processPossibleAttributesSyntax(tokens, {
17019
+ node: [token.tag, { ...processAttributes(token.attrs) }],
17020
+ nextIndex: start + 1
17021
+ }, false);
16660
17022
  },
16661
17023
  image(tokens, start) {
16662
17024
  const token = tokens[start];
@@ -16799,8 +17161,7 @@ function tokenListToTree(tokens, options = {}) {
16799
17161
  }
16800
17162
  return nodes;
16801
17163
  }
16802
- //#endregion
16803
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/core.js
17164
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/core.js
16804
17165
  const MAX_SHARED_PARSERS = 32;
16805
17166
  let nextPluginId = 0;
16806
17167
  const pluginIds = /* @__PURE__ */ new WeakMap();
@@ -16888,329 +17249,61 @@ function createMarkdownParser$1(options = {}) {
16888
17249
  state.tree = {
16889
17250
  frontmatter: frontmatterData,
16890
17251
  meta: {},
16891
- nodes
16892
- };
16893
- lastOutput = null;
16894
- lastInput = null;
16895
- }
16896
- for (const plugin of plugins) {
16897
- if (!plugin.post) continue;
16898
- await withSpan(tracer, `comark:post:${plugin.name}`, () => plugin.post(state));
16899
- }
16900
- return state.tree;
16901
- });
16902
- };
16903
- return parseFn;
16904
- }
16905
- //#endregion
16906
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/index.js
16907
- let warnedLinkifyOption = false;
16908
- function resolveParserOptions(options) {
16909
- const { autoClose = true, tracer = noopTracer, linkify: linkifyOption, ...rest } = options;
16910
- const userPlugins = options.plugins ?? [];
16911
- if (linkifyOption !== void 0 && !warnedLinkifyOption) {
16912
- warnedLinkifyOption = true;
16913
- console.warn("[comark] `ParserOptions.linkify` is deprecated and will be removed in a future major version. Use `registerDefaultPlugins: false` and register `linkify()` from `comark/plugins/linkify` only when needed.");
16914
- }
16915
- const registerDefaults = options.registerDefaultPlugins !== false;
16916
- const plugins = dedupePlugins([...linkifyOption ?? registerDefaults ? [linkify_default()] : [], ...registerDefaults ? [
16917
- frontmatter_default(),
16918
- html_default(),
16919
- alert_default(),
16920
- task_list_default(),
16921
- components_default(),
16922
- attributes_default()
16923
- ] : []], userPlugins);
16924
- const hasPlugin = (name) => plugins.some((plugin) => plugin.name === name);
16925
- const pluginAutoClose = Object.assign({}, ...plugins.map((p) => p.autoClose));
16926
- return {
16927
- ...rest,
16928
- plugins,
16929
- tracer,
16930
- autoClose: autoClose === true ? (markdown, streaming) => autoCloseMarkdown(markdown, {
16931
- ...pluginAutoClose,
16932
- frontmatter: hasPlugin("frontmatter") && streaming,
16933
- syntax: hasPlugin("components"),
16934
- attributes: hasPlugin("components") || hasPlugin("attributes"),
16935
- math: hasPlugin("math"),
16936
- dropTrailingOpeners: streaming === true
16937
- }) : autoClose || void 0
16938
- };
16939
- }
16940
- function createMarkdownParser(options = {}) {
16941
- return createMarkdownParser$1(resolveParserOptions(options));
16942
- }
16943
- async function parseMarkdown(markdown, options = {}) {
16944
- return await createMarkdownParser(options)(markdown);
16945
- }
16946
- //#endregion
16947
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/binding.js
16948
- const markdownItInlineBinding = (md, options = {}) => {
16949
- const tag = options.tag || "binding";
16950
- md.inline.ruler.after("entity", "mdc_inline_binding", (state, silent) => {
16951
- const start = state.pos;
16952
- if (state.src[start] !== "{" || state.src[start + 1] !== "{") return false;
16953
- let end = start + 2;
16954
- while (end < state.posMax - 1) {
16955
- if (state.src[end] === "}" && state.src[end + 1] === "}") break;
16956
- end += 1;
16957
- }
16958
- if (end >= state.posMax - 1) return false;
16959
- const inner = state.src.slice(start + 2, end).trim();
16960
- if (!inner) return false;
16961
- const separator = inner.indexOf("||");
16962
- const value = separator === -1 ? inner : inner.slice(0, separator).trim();
16963
- const defaultValue = separator === -1 ? "" : inner.slice(separator + 2).trim();
16964
- if (!value) return false;
16965
- state.pos = end + 2;
16966
- if (silent) return true;
16967
- const token = state.push("mdc_inline_component", tag, 0);
16968
- token.attrSet(":value", value);
16969
- if (defaultValue) token.attrSet("defaultValue", defaultValue);
16970
- return true;
16971
- });
16972
- };
16973
- var binding_default = defineComarkPlugin((opts = {}) => {
16974
- return {
16975
- name: "binding",
16976
- markdownItPlugins: [((md) => markdownItInlineBinding(md, opts))]
16977
- };
16978
- });
16979
- //#endregion
16980
- //#region ../markdown-template/dist/prepare-BUVd_uB_.js
16981
- const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
16982
- const markdownTemplateErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
16983
- docsBase: "https://vitehub.dev/docs/markdown-template/diagnostics",
16984
- codes: {
16985
- MARKDOWN_TEMPLATE_R0002: {
16986
- ...dynamicError,
16987
- fix: "Bind the condition to a `data.<path>` path that the template may read, or to a JSON literal, such as `:condition=\"data.ready\"`."
16988
- },
16989
- MARKDOWN_TEMPLATE_B0001: {
16990
- ...dynamicError,
16991
- fix: "Pass a path that starts with `./`, ends with `.template.md`, and uses `/` between folders, such as `./review/PULL_REQUEST.template.md`."
16992
- },
16993
- MARKDOWN_TEMPLATE_B0002: {
16994
- ...dynamicError,
16995
- fix: "Remove the empty, `.`, and `..` folders from the path, such as `./review/PULL_REQUEST.template.md` in place of `./review/../PULL_REQUEST.template.md`."
16996
- },
16997
- MARKDOWN_TEMPLATE_R0011: {
16998
- ...dynamicError,
16999
- fix: "Pass a link value in the template data that is a safe URL, such as an `https:` or relative URL without spaces at the ends, control characters, backslashes, or HTML character references."
17000
- },
17001
- MARKDOWN_TEMPLATE_R0012: {
17002
- ...dynamicError,
17003
- fix: "Pass a link value in the template data that is a safe URL, such as an `https:` or relative URL without spaces at the ends, control characters, backslashes, or HTML character references."
17004
- },
17005
- MARKDOWN_TEMPLATE_R0013: {
17006
- ...dynamicError,
17007
- fix: "Pass a link value in the template data that is a safe URL, such as an `https:` or relative URL without spaces at the ends, control characters, backslashes, or HTML character references."
17008
- },
17009
- MARKDOWN_TEMPLATE_R0014: {
17010
- ...dynamicError,
17011
- fix: "Pass the template text as a string to `renderMarkdownTemplate()`, or use `renderMarkdownFile()` with the path of a template file."
17012
- },
17013
- MARKDOWN_TEMPLATE_R0015: {
17014
- ...dynamicError,
17015
- fix: "Write `::else-if` and `::else` blocks only inside the `::if` block that they follow, as in `::if{:condition=\"data.ready\"}` ... `::else` ... `::`."
17016
- },
17017
- MARKDOWN_TEMPLATE_R0017: {
17018
- ...dynamicError,
17019
- fix: "Add the value that the message names to the `data` that you pass to the renderer, or remove its binding from the template."
17020
- },
17021
- MARKDOWN_TEMPLATE_R0018: {
17022
- ...dynamicError,
17023
- fix: "Bind the value that the message names to a string, number, or boolean in `data`, or use `:insert{:markdown=\"data.<path>\"}` for a Markdown fragment."
17024
- },
17025
- MARKDOWN_TEMPLATE_R0020: {
17026
- ...dynamicError,
17027
- fix: "Give each `:insert` a bound `:markdown` prop with an allowed `data.<path>` that holds a Markdown string, such as `:insert{:markdown=\"data.summary\"}`."
17028
- },
17029
- MARKDOWN_TEMPLATE_R0021: {
17030
- ...dynamicError,
17031
- fix: "Put the `:insert` on its own line with blank lines around it, or pass a fragment that is one paragraph."
17032
- },
17033
- MARKDOWN_TEMPLATE_R0022: {
17034
- ...dynamicError,
17035
- fix: "Remove the condition from the `::else` block, or use `::else-if{:condition=\"data.<path>\"}` for a branch with a condition."
17036
- },
17037
- MARKDOWN_TEMPLATE_R0023: {
17038
- ...dynamicError,
17039
- fix: "Put `::else` last in its `::if` block, and move each `::else-if` before it."
17040
- },
17041
- MARKDOWN_TEMPLATE_R0024: {
17042
- ...dynamicError,
17043
- fix: "Give `::if` and `::else-if` a bound `:condition` or `:value` prop, such as `::if{:condition=\"data.ready\"}`, and use only the `eq`, `neq`, `gt`, `gte`, `lt`, and `lte` props next to it."
17044
- },
17045
- MARKDOWN_TEMPLATE_R0025: {
17046
- ...dynamicError,
17047
- fix: "Write `::else-if` and `::else` blocks only inside the `::if` block that they follow, as in `::if{:condition=\"data.ready\"}` ... `::else` ... `::`."
17048
- },
17049
- MARKDOWN_TEMPLATE_R0026: {
17050
- ...dynamicError,
17051
- fix: "Put `::else` last in its `::if` block, and move each `::else-if` before it."
17052
- },
17053
- MARKDOWN_TEMPLATE_R0027: {
17054
- ...dynamicError,
17055
- fix: "Remove the condition from the `::else` block, or use `::else-if{:condition=\"data.<path>\"}` for a branch with a condition."
17056
- },
17057
- MARKDOWN_TEMPLATE_R0029: {
17058
- ...dynamicError,
17059
- fix: "Add a closing `::` line for each `::if`, `::else-if`, and `::else` block of the template."
17060
- },
17061
- MARKDOWN_TEMPLATE_R0030: {
17062
- ...dynamicError,
17063
- fix: "Remove the `:srcdoc` binding from the template, and write the iframe content as static markup."
17064
- },
17065
- MARKDOWN_TEMPLATE_R0031: {
17066
- ...dynamicError,
17067
- fix: "Remove the binding of the HTML event-handler attribute, such as `:onclick`, from the template."
17068
- },
17069
- MARKDOWN_TEMPLATE_R0032: {
17070
- ...dynamicError,
17071
- fix: "Remove the `:style` binding from the template, and use a static `style` attribute or a class."
17072
- },
17073
- MARKDOWN_TEMPLATE_R0033: {
17074
- ...dynamicError,
17075
- fix: "Write the link as `[label](){:href=\"data.<path>\"}` in place of `{{ }}` in the link destination."
17076
- }
17077
- }
17078
- });
17079
- const openTag = /^(\s*<\s*[A-Za-z][\w:-]*)(\s+[\s\S]*?)?(\s*\/?>\s*)$/;
17080
- const attribute = /([:\w.-]+)(\s*=\s*)?(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))?/g;
17081
- /**
17082
- * Comark 0.8 decodes HTML attribute values with the body decoder, so `&copy=2` becomes `©=2`.
17083
- * Browsers leave that reference alone inside attributes. Escape `&` before Comark decodes,
17084
- * so the template receives the authored value and applies attribute decoding itself.
17085
- */
17086
- const rawHtmlAttributes = defineComarkPlugin(() => ({
17087
- name: "vitehub-raw-html-attributes",
17088
- markdownItPost(state) {
17089
- const visit = (tokens) => {
17090
- for (const token of tokens) {
17091
- if (token.type === "html_inline") token.content = escapeAttributeValues(token.content);
17092
- if (token.children) visit(token.children);
17252
+ nodes
17253
+ };
17254
+ lastOutput = null;
17255
+ lastInput = null;
17093
17256
  }
17094
- };
17095
- visit(state.tokens);
17096
- }
17097
- }));
17098
- function escapeAttributeValues(tag) {
17099
- const match = tag.match(openTag);
17100
- if (!match?.[2]?.includes("&")) return tag;
17101
- const attributes = match[2].replace(attribute, (source, name, equals, double, single, bare) => {
17102
- if (!equals) return source;
17103
- const escape = (value) => value.replaceAll("&", "&amp;");
17104
- if (double !== void 0) return `${name}${equals}"${escape(double)}"`;
17105
- if (single !== void 0) return `${name}${equals}'${escape(single)}'`;
17106
- return bare === void 0 ? source : `${name}${equals}${escape(bare)}`;
17107
- });
17108
- return `${match[1]}${attributes}${match[3]}`;
17257
+ for (const plugin of plugins) {
17258
+ if (!plugin.post) continue;
17259
+ await withSpan(tracer, `comark:post:${plugin.name}`, () => plugin.post(state));
17260
+ }
17261
+ return state.tree;
17262
+ });
17263
+ };
17264
+ return parseFn;
17109
17265
  }
17110
- const comarkHtml = html_default({ markdown: false });
17111
- /** Plugins that keep authored HTML blocks raw and their attributes undecoded, as the template renderer expects. */
17112
- const htmlPlugins = [{
17113
- ...comarkHtml,
17114
- markdownItPost(state) {
17115
- for (const [index, token] of state.tokens.entries()) {
17116
- const first = token.children?.[0];
17117
- if (token.type !== "inline" || state.tokens[index - 1]?.type !== "paragraph_open" || first?.type !== "html_inline") continue;
17118
- token.children.unshift(Object.assign(Object.create(Object.getPrototypeOf(first)), first, {
17119
- type: "text",
17120
- content: ""
17121
- }));
17122
- }
17123
- comarkHtml.markdownItPost?.(state);
17266
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/index.js
17267
+ let warnedLinkifyOption = false;
17268
+ function resolveParserOptions(options) {
17269
+ const { autoClose = true, tracer = noopTracer, linkify: linkifyOption, ...rest } = options;
17270
+ const userPlugins = options.plugins ?? [];
17271
+ if (linkifyOption !== void 0 && !warnedLinkifyOption) {
17272
+ warnedLinkifyOption = true;
17273
+ console.warn("[comark] `ParserOptions.linkify` is deprecated and will be removed in a future major version. Use `registerDefaultPlugins: false` and register `linkify()` from `comark/plugins/linkify` only when needed.");
17124
17274
  }
17125
- }, rawHtmlAttributes()];
17126
- const parserOptions = {
17127
- autoClose: false,
17128
- autoUnwrap: false,
17129
- linkify: false,
17130
- plugins: [...htmlPlugins, binding_default()]
17131
- };
17132
- const literalHtmlTags$1 = /* @__PURE__ */ new Set([
17133
- "code",
17134
- "pre",
17135
- "script",
17136
- "style",
17137
- "textarea",
17138
- "kbd",
17139
- "samp",
17140
- "var"
17141
- ]);
17142
- /** Whether authored HTML children are reparsed as Markdown by the template renderer. */
17143
- function hasMarkdownHtmlChildren([tag, attrs, ...children]) {
17144
- return attrs.$?.html === 1 && attrs.$?.block === 1 && tag !== "a" && tag !== "img" && !literalHtmlTags$1.has(tag) && children.every((child) => typeof child === "string");
17145
- }
17146
- const literalHtmlTags = /* @__PURE__ */ new Set([
17147
- "code",
17148
- "pre",
17149
- "script",
17150
- "style",
17151
- "textarea",
17152
- "kbd",
17153
- "samp",
17154
- "var"
17155
- ]);
17156
- async function prepareTemplate(source) {
17157
- const prefix = `VITEHUBCODE${crypto.randomUUID().replaceAll("-", "")}`;
17158
- const lines = [];
17159
- const masked = source.replace(/^([\t ]*)(:[^\r\n]*)$/gm, (_match, indent, line) => `${indent}${prefix}${lines.push(line) - 1}END`);
17160
- const pattern = new RegExp(`${prefix}(\\d+)END`, "g");
17161
- const inCode = /* @__PURE__ */ new Set();
17162
- const visit = (nodes, literal = false) => {
17163
- for (const node of nodes) if (typeof node === "string") {
17164
- if (literal) for (const match of node.matchAll(pattern)) inCode.add(Number(match[1]));
17165
- } else visit(node.slice(2), literal || node[0] !== null && literalHtmlTags.has(node[0]));
17166
- };
17167
- if (lines.length) visit((await parseMarkdown(masked, {
17168
- autoClose: false,
17169
- autoUnwrap: false,
17170
- linkify: false,
17171
- plugins: htmlPlugins
17172
- })).nodes);
17173
- const template = masked.replace(pattern, (token, index) => inCode.has(Number(index)) ? token : lines[Number(index)]);
17174
- validateBranches(template);
17275
+ const registerDefaults = options.registerDefaultPlugins !== false;
17276
+ const plugins = dedupePlugins([...linkifyOption ?? registerDefaults ? [linkify_default()] : [], ...registerDefaults ? [
17277
+ frontmatter_default(),
17278
+ html_default(),
17279
+ alert_default(),
17280
+ task_list_default(),
17281
+ components_default(),
17282
+ attributes_default()
17283
+ ] : []], userPlugins);
17284
+ const hasPlugin = (name) => plugins.some((plugin) => plugin.name === name);
17285
+ const pluginAutoClose = Object.assign({}, ...plugins.map((p) => p.autoClose));
17175
17286
  return {
17176
- template,
17177
- restore: (rendered) => rendered.replace(pattern, (_token, index) => lines[Number(index)])
17287
+ ...rest,
17288
+ plugins,
17289
+ tracer,
17290
+ autoClose: autoClose === true ? (markdown, streaming) => autoCloseMarkdown(markdown, {
17291
+ ...pluginAutoClose,
17292
+ frontmatter: hasPlugin("frontmatter") && streaming,
17293
+ syntax: hasPlugin("components"),
17294
+ attributes: hasPlugin("components") || hasPlugin("attributes"),
17295
+ math: hasPlugin("math"),
17296
+ dropTrailingOpeners: streaming === true
17297
+ }) : autoClose || void 0
17178
17298
  };
17179
17299
  }
17180
- function validateBranches(template) {
17181
- const stack = [];
17182
- for (const line of template.split(/\r?\n/)) {
17183
- if (/^\s*::\s*$/.test(line)) {
17184
- stack.pop();
17185
- continue;
17186
- }
17187
- const match = line.match(/^\s*::([\w-]+)(?:\{(.*)\})?\s*$/);
17188
- if (!match) continue;
17189
- const tag = match[1];
17190
- if (tag !== "else" && tag !== "else-if") {
17191
- stack.push({
17192
- tag,
17193
- sawElse: false
17194
- });
17195
- continue;
17196
- }
17197
- const current = stack.at(-1);
17198
- if (current?.tag === "else") throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0026({ message: `[vitehub] Markdown template ${tag} block cannot follow else.` });
17199
- if (current?.tag !== "if" && current?.tag !== "else-if") throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0025({ message: `[vitehub] Markdown template ${tag} block must follow an if block.` });
17200
- if (current.sawElse) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0026({ message: `[vitehub] Markdown template ${tag} block cannot follow else.` });
17201
- if (tag === "else") {
17202
- if (match[2]?.trim()) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0027({ message: "[vitehub] Markdown template else block does not accept a condition." });
17203
- current.sawElse = true;
17204
- }
17205
- stack.push({
17206
- tag,
17207
- sawElse: false
17208
- });
17209
- }
17210
- if (stack.some((entry) => entry.tag === "if" || entry.tag === "else-if" || entry.tag === "else")) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0029({ message: "[vitehub] Markdown template if block is missing a closing :: line." });
17300
+ function createMarkdownParser(options = {}) {
17301
+ return createMarkdownParser$1(resolveParserOptions(options));
17302
+ }
17303
+ async function parseMarkdown(markdown, options = {}) {
17304
+ return await createMarkdownParser(options)(markdown);
17211
17305
  }
17212
- //#endregion
17213
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/state.js
17306
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/state.js
17214
17307
  function findHandler(ctx, node) {
17215
17308
  const name = node[0];
17216
17309
  const userHandler = (Object.hasOwn(ctx.handlers, name) ? ctx.handlers[name] : void 0) || (Object.hasOwn(ctx.handlers, pascalCase(name)) ? ctx.handlers[pascalCase(name)] : void 0);
@@ -17224,7 +17317,7 @@ async function one$1(node, state, parent, atLineStart = false) {
17224
17317
  "&": void 0,
17225
17318
  "\"": void 0
17226
17319
  });
17227
- if (parent?.[1].$?.html === 1 && parent[1].$?.block === 1) return node;
17320
+ if (parent?.[1].$?.html === 1 && parent[1].$?.block === 1) return state.context.rawHtmlText === "verbatim" ? node : escapeRawHtmlText(node, String(parent[0]));
17228
17321
  return escapeTextNode(node, atLineStart);
17229
17322
  }
17230
17323
  if (node[0] === null) return await state.handlers.comment(node, state, parent);
@@ -17339,6 +17432,37 @@ const COLON_PREV_CHARS = /* @__PURE__ */ new Set([
17339
17432
  ")",
17340
17433
  ">"
17341
17434
  ]);
17435
+ const TEXT_ONLY_TAGS = {
17436
+ script: "<\\/",
17437
+ style: "<\\/",
17438
+ textarea: "&lt;/"
17439
+ };
17440
+ function escapeRawHtmlText(text, tag) {
17441
+ if (!text.includes("<")) return text;
17442
+ const lowerTag = tag.toLowerCase();
17443
+ const closerEscape = Object.hasOwn(TEXT_ONLY_TAGS, lowerTag) ? TEXT_ONLY_TAGS[lowerTag] : void 0;
17444
+ if (closerEscape) {
17445
+ const lower = text.toLowerCase();
17446
+ const closer = `</${lowerTag}`;
17447
+ let result = "";
17448
+ let last = 0;
17449
+ for (let index = lower.indexOf(closer); index !== -1; index = lower.indexOf(closer, last)) {
17450
+ result += text.slice(last, index) + closerEscape;
17451
+ last = index + 2;
17452
+ }
17453
+ return result + text.slice(last);
17454
+ }
17455
+ let result = "";
17456
+ let last = 0;
17457
+ for (let index = text.indexOf("<"); index !== -1; index = text.indexOf("<", index + 1)) {
17458
+ const next = text.charCodeAt(index + 1);
17459
+ if (next >= 65 && next <= 90 || next >= 97 && next <= 122 || next === 33 || next === 47 || next === 63) {
17460
+ result += text.slice(last, index) + "&lt;";
17461
+ last = index + 1;
17462
+ }
17463
+ }
17464
+ return result + text.slice(last);
17465
+ }
17342
17466
  function escapeTextNode(text, atLineStart = false) {
17343
17467
  const escaped = escapeInline(text);
17344
17468
  if (!atLineStart && !escaped.includes("\n")) return escaped;
@@ -17357,6 +17481,7 @@ function buildNextIndex(source, charCode) {
17357
17481
  }
17358
17482
  return next;
17359
17483
  }
17484
+ const OPEN_TAG_START = /<\/?[a-z][a-z0-9-]*[\s/]/iy;
17360
17485
  function escapeInline(text) {
17361
17486
  let nextGt;
17362
17487
  return text.replace(inlineSyntax, (char, offset, source) => {
@@ -17365,7 +17490,10 @@ function escapeInline(text) {
17365
17490
  const next = source.charCodeAt(offset + 1);
17366
17491
  if (!(next >= 65 && next <= 90 || next >= 97 && next <= 122 || next === 33 || next === 63 || next === 47)) return char;
17367
17492
  nextGt ??= buildNextIndex(source, 62);
17368
- if (nextGt[offset + 1] === -1) return char;
17493
+ if (nextGt[offset + 1] === -1) {
17494
+ OPEN_TAG_START.lastIndex = offset;
17495
+ if (!OPEN_TAG_START.test(source)) return char;
17496
+ }
17369
17497
  return `\\${char}`;
17370
17498
  }
17371
17499
  if (char === "&" && !/^&#?[a-zA-Z0-9]+;/.test(source.slice(offset))) return char;
@@ -17396,8 +17524,7 @@ function escapeLeadingBlock(line) {
17396
17524
  if (line[0] === ":") return `\\${line}`;
17397
17525
  return line;
17398
17526
  }
17399
- //#endregion
17400
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/fence.js
17527
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/fence.js
17401
17528
  function pickFence(content) {
17402
17529
  let maxBackticks = 0;
17403
17530
  let maxTildes = 0;
@@ -17412,8 +17539,7 @@ function pickFence(content) {
17412
17539
  const char = maxBackticks <= maxTildes ? "`" : "~";
17413
17540
  return char.repeat(Math.max(3, (char === "`" ? maxBackticks : maxTildes) + 1));
17414
17541
  }
17415
- //#endregion
17416
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/attributes.js
17542
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/attributes.js
17417
17543
  const IMPLICIT_ATTRS = {
17418
17544
  blockquote: { drop: ["as"] },
17419
17545
  ol: { drop: ["start"] },
@@ -17483,18 +17609,23 @@ function comarkYamlAttributes(attributes, style = "codeblock") {
17483
17609
  const fence = pickFence(yamlContent);
17484
17610
  return `${fence}yaml [props]\n${yamlContent}\n${fence}`;
17485
17611
  }
17486
- //#endregion
17487
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/code.js
17612
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/code.js
17488
17613
  function code(node, _state) {
17489
17614
  const [_, attributes] = node;
17490
17615
  const attrs = userBlockAttrs("code", attributes);
17491
17616
  const attrsString = Object.keys(attrs).length > 0 ? comarkAttributes(attrs) : "";
17492
17617
  const content = textContent(node);
17493
- const fence = content.includes("`") ? "``" : "`";
17494
- return `${fence}${content}${fence}${attrsString}`;
17618
+ const fence = pickInlineFence(content);
17619
+ const edgeBacktick = content.startsWith("`") || content.endsWith("`");
17620
+ const edgeSpaces = content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content);
17621
+ const pad = edgeBacktick || edgeSpaces ? " " : "";
17622
+ return `${fence}${pad}${content}${pad}${fence}${attrsString}`;
17495
17623
  }
17496
- //#endregion
17497
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/pre.js
17624
+ function pickInlineFence(content) {
17625
+ const longest = (content.match(/`+/g) ?? []).reduce((max, run) => Math.max(max, run.length), 0);
17626
+ return "`".repeat(longest + 1);
17627
+ }
17628
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/pre.js
17498
17629
  function pre(node, state) {
17499
17630
  const [_, attributes, ...children] = node;
17500
17631
  const codeClasses = children[0]?.[1]?.class;
@@ -17526,20 +17657,18 @@ function formatHighlights(highlights) {
17526
17657
  }
17527
17658
  return ranges.join(",");
17528
17659
  }
17529
- //#endregion
17530
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/hr.js
17660
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/hr.js
17531
17661
  function hr(_n, state, parent) {
17532
17662
  if (parent?.[0] === "p") return ":hr";
17533
17663
  return "---" + state.context.blockSeparator;
17534
17664
  }
17535
- //#endregion
17536
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/heading.js
17665
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/heading.js
17537
17666
  const trackers = /* @__PURE__ */ new WeakMap();
17538
17667
  function autoHeadingId(node, level, state, id) {
17539
- let tracker = trackers.get(state);
17668
+ let tracker = trackers.get(state.context);
17540
17669
  if (tracker === void 0) {
17541
17670
  tracker = createHeadingIdTracker(state.context.headingIds) ?? null;
17542
- trackers.set(state, tracker);
17671
+ trackers.set(state.context, tracker);
17543
17672
  }
17544
17673
  if (!tracker) return void 0;
17545
17674
  const autoId = nextHeadingId(node.slice(2).filter((child) => !(Array.isArray(child) && child[1]?.$?.permalink === "separate")).map((child) => textContent(child)).join(""), level, tracker);
@@ -17559,8 +17688,7 @@ async function heading(node, state) {
17559
17688
  const suffix = attrs ? ` ${attrs}` : "";
17560
17689
  return "#".repeat(level) + " " + content + suffix + state.context.blockSeparator;
17561
17690
  }
17562
- //#endregion
17563
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/p.js
17691
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/p.js
17564
17692
  async function p(node, state, parent) {
17565
17693
  const children = node.slice(2);
17566
17694
  let result = "";
@@ -17570,8 +17698,44 @@ async function p(node, state, parent) {
17570
17698
  if (parent?.[0] === "li") return result;
17571
17699
  return result + state.context.blockSeparator;
17572
17700
  }
17573
- //#endregion
17574
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/a.js
17701
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/link.js
17702
+ const SPECIAL_SCHEME = /^(?:https?|wss?|ftp|file):$/;
17703
+ function isBalanced(value, open, close, escapes) {
17704
+ let depth = 0;
17705
+ for (let i = 0; i < value.length; i++) if (escapes && value[i] === "\\") i++;
17706
+ else if (value[i] === open) depth++;
17707
+ else if (value[i] === close && --depth < 0) return false;
17708
+ return depth === 0;
17709
+ }
17710
+ function linkDestination(url) {
17711
+ if (url === void 0 || url === null || url === "") return "<>";
17712
+ let value = String(url);
17713
+ if (value.includes("\\")) try {
17714
+ const parsed = new URL(value);
17715
+ if (SPECIAL_SCHEME.test(parsed.protocol)) value = parsed.href;
17716
+ } catch {}
17717
+ const escapeParens = !isBalanced(value, "(", ")", false);
17718
+ let result = "";
17719
+ for (let i = 0; i < value.length; i++) {
17720
+ const char = value[i];
17721
+ const code = value.charCodeAt(i);
17722
+ if (code <= 32 || code === 127) result += `%${code.toString(16).toUpperCase().padStart(2, "0")}`;
17723
+ else if (char === "\\" || char === "<" || char === ">" || escapeParens && (char === "(" || char === ")") || char === "&" && /^&#?[a-z0-9]+;/i.test(value.slice(i, i + 34))) result += `\\${char}`;
17724
+ else result += char;
17725
+ }
17726
+ return result;
17727
+ }
17728
+ function linkTitle(title) {
17729
+ return String(title).replace(/["\\<&]/g, "\\$&");
17730
+ }
17731
+ function imageAlt(alt) {
17732
+ const value = String(alt);
17733
+ return isBalanced(value, "[", "]", true) ? value : value.replace(/(?<!\\)[[\]]/g, "\\$&");
17734
+ }
17735
+ function isAutolinkSafe(url) {
17736
+ return /^[a-z][a-z0-9+.-]{1,31}:[^\s<>\\]*$/i.test(url);
17737
+ }
17738
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/a.js
17575
17739
  async function a(node, state, parent) {
17576
17740
  const [_, attrs] = node;
17577
17741
  if (attrs.$?.permalink === "separate") return "";
@@ -17579,11 +17743,10 @@ async function a(node, state, parent) {
17579
17743
  const { href, ...rest } = attrs;
17580
17744
  const attrsString = Object.keys(rest).length > 0 ? comarkAttributes(rest) : "";
17581
17745
  const content = await state.flow(node, state);
17582
- if (content === href && !attrsString) return `<${href}>`;
17583
- return `[${content}](${href})${attrsString}`;
17746
+ if (content === href && !attrsString && isAutolinkSafe(href)) return `<${href}>`;
17747
+ return `[${content}](${linkDestination(href)})${attrsString}`;
17584
17748
  }
17585
- //#endregion
17586
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/ul.js
17749
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/ul.js
17587
17750
  async function ul(node, state) {
17588
17751
  const children = node.slice(2);
17589
17752
  const revert = state.applyContext({
@@ -17604,8 +17767,7 @@ async function ul(node, state) {
17604
17767
  else result = result + state.context.blockSeparator;
17605
17768
  return result;
17606
17769
  }
17607
- //#endregion
17608
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/ol.js
17770
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/ol.js
17609
17771
  async function ol(node, state) {
17610
17772
  const children = node.slice(2);
17611
17773
  const start = Number(node[1].start);
@@ -17628,8 +17790,7 @@ async function ol(node, state) {
17628
17790
  else result = result + state.context.blockSeparator;
17629
17791
  return result;
17630
17792
  }
17631
- //#endregion
17632
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/li.js
17793
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/li.js
17633
17794
  const blockElements = /* @__PURE__ */ new Set([
17634
17795
  "pre",
17635
17796
  "blockquote",
@@ -17698,8 +17859,7 @@ function takeCheckbox(children) {
17698
17859
  }
17699
17860
  }
17700
17861
  }
17701
- //#endregion
17702
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/html.js
17862
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/html.js
17703
17863
  const textBlocks = /* @__PURE__ */ new Set([
17704
17864
  "p",
17705
17865
  "h1",
@@ -17804,8 +17964,7 @@ function paddNoneHtmlContent(content, state, tag) {
17804
17964
  }
17805
17965
  return (content.trim().startsWith("<") ? "" : "") + content + (content.trim().endsWith(">") ? "" : "");
17806
17966
  }
17807
- //#endregion
17808
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/strong.js
17967
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/strong.js
17809
17968
  async function strong(node, state) {
17810
17969
  const [_, attrs, ...children] = node;
17811
17970
  let content = "";
@@ -17814,8 +17973,7 @@ async function strong(node, state) {
17814
17973
  const attrsString = Object.keys(attrs).length > 0 ? comarkAttributes(attrs) : "";
17815
17974
  return `**${content}**${attrsString}`;
17816
17975
  }
17817
- //#endregion
17818
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/emphesis.js
17976
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/emphesis.js
17819
17977
  async function emphesis(node, state) {
17820
17978
  const [_, attrs, ...children] = node;
17821
17979
  let content = "";
@@ -17824,8 +17982,7 @@ async function emphesis(node, state) {
17824
17982
  const attrsString = Object.keys(attrs).length > 0 ? comarkAttributes(attrs) : "";
17825
17983
  return `*${content}*${attrsString}`;
17826
17984
  }
17827
- //#endregion
17828
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/blockquote.js
17985
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/blockquote.js
17829
17986
  async function blockquote(node, state) {
17830
17987
  const children = node.slice(2);
17831
17988
  let childResult = "";
@@ -17838,16 +17995,15 @@ async function blockquote(node, state) {
17838
17995
  if (node[1].as) return `> [!${String(node[1].as).toUpperCase()}]\n` + content + state.context.blockSeparator;
17839
17996
  return content + state.context.blockSeparator;
17840
17997
  }
17841
- //#endregion
17842
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/img.js
17998
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/img.js
17843
17999
  function img(node, _state) {
17844
18000
  const [_, attrs] = node;
17845
18001
  const { title, src, alt = "", ...rest } = attrs;
17846
18002
  const attrsString = Object.keys(rest).length > 0 ? comarkAttributes(rest) : "";
17847
- return `${title ? `![${alt}](${src} "${title}")` : `![${alt}](${src})`}${attrsString}`;
18003
+ const destination = linkDestination(src);
18004
+ return `${title ? `![${imageAlt(alt)}](${destination} "${linkTitle(title)}")` : `![${imageAlt(alt)}](${destination})`}${attrsString}`;
17848
18005
  }
17849
- //#endregion
17850
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/del.js
18006
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/del.js
17851
18007
  async function del(node, state) {
17852
18008
  const [_, attrs, ...children] = node;
17853
18009
  let content = "";
@@ -17856,8 +18012,7 @@ async function del(node, state) {
17856
18012
  const attrsString = Object.keys(attrs).length > 0 ? comarkAttributes(attrs) : "";
17857
18013
  return `~~${content}~~${attrsString}`;
17858
18014
  }
17859
- //#endregion
17860
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/mdc.js
18015
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/mdc.js
17861
18016
  const INLINE_HTML_ELEMENTS = /* @__PURE__ */ new Set([
17862
18017
  "a",
17863
18018
  "strong",
@@ -17898,8 +18053,7 @@ async function mdc(node, state, parent) {
17898
18053
  const afterList = Array.isArray(prev) && (prev[0] === "ul" || prev[0] === "ol");
17899
18054
  return inline ? result : indent(result, { level: parent && !afterList ? 1 : 0 });
17900
18055
  }
17901
- //#endregion
17902
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/br.js
18056
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/br.js
17903
18057
  function isSpaceCode(c) {
17904
18058
  return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
17905
18059
  }
@@ -17918,13 +18072,11 @@ function br(node, state, parent) {
17918
18072
  const open = prevSpace ? ":br" : " :br";
17919
18073
  return nextSpace ? open : `${open} `;
17920
18074
  }
17921
- //#endregion
17922
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/component.js
18075
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/component.js
17923
18076
  function component(node, state, parent) {
17924
18077
  return state.context.format === "markdown/comark" ? state.handlers.mdc(node, state, parent) : state.handlers.html(node, state, parent);
17925
18078
  }
17926
- //#endregion
17927
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/template.js
18079
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/template.js
17928
18080
  async function template(node, state, parent) {
17929
18081
  const [_, attrs] = node;
17930
18082
  if (typeof attrs.name !== "string") return component(node, state, parent);
@@ -17936,8 +18088,7 @@ async function template(node, state, parent) {
17936
18088
  const extraAttrs = comarkAttributes(rest);
17937
18089
  return `#${attrs.name}${extraAttrs}\n${content}` + state.context.blockSeparator;
17938
18090
  }
17939
- //#endregion
17940
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/table.js
18091
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/table.js
17941
18092
  const TABLE_SECTIONS = /* @__PURE__ */ new Set([
17942
18093
  "thead",
17943
18094
  "tbody",
@@ -18060,8 +18211,7 @@ function th(_node, _state) {
18060
18211
  function td(_node, _state) {
18061
18212
  return "";
18062
18213
  }
18063
- //#endregion
18064
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/comment.js
18214
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/comment.js
18065
18215
  function comment(node, state, parent) {
18066
18216
  if (node[0] === null) {
18067
18217
  const inline = state.context.inline === true || parent?.[0] === "p" || (parent?.some((child, index) => index > 1 && typeof child === "string") ?? false);
@@ -18069,8 +18219,7 @@ function comment(node, state, parent) {
18069
18219
  }
18070
18220
  return state.context.format === "markdown/comark" ? state.handlers.mdc(node, state, parent) : state.handlers.html(node, state, parent);
18071
18221
  }
18072
- //#endregion
18073
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/math.js
18222
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/math.js
18074
18223
  function math(node, state, parent) {
18075
18224
  const className = node[1].class;
18076
18225
  const classes = typeof className === "string" ? className.split(" ") : [];
@@ -18089,8 +18238,7 @@ function math(node, state, parent) {
18089
18238
  if (markup === "\\[") return `\\[\n${content}\n\\]${state.context.blockSeparator}`;
18090
18239
  return `$$\n${content}\n$$${state.context.blockSeparator}`;
18091
18240
  }
18092
- //#endregion
18093
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/mermaid.js
18241
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/mermaid.js
18094
18242
  function mermaid(node, state, parent) {
18095
18243
  const [_, attributes] = node;
18096
18244
  if (typeof attributes.content !== "string") return component(node, state, parent);
@@ -18100,8 +18248,7 @@ function mermaid(node, state, parent) {
18100
18248
  const fence = pickFence(body);
18101
18249
  return `${fence}mermaid${attrs ? ` ${attrs}` : ""}\n${body}\n${fence}${state.context.blockSeparator}`;
18102
18250
  }
18103
- //#endregion
18104
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/handlers/index.js
18251
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/index.js
18105
18252
  const handlers = {
18106
18253
  code,
18107
18254
  pre,
@@ -18136,8 +18283,7 @@ const handlers = {
18136
18283
  math,
18137
18284
  mermaid
18138
18285
  };
18139
- //#endregion
18140
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/render/index.js
18286
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/render/index.js
18141
18287
  async function render(document, context = {}) {
18142
18288
  const state = createState(handlers, {
18143
18289
  ...context,
@@ -18155,588 +18301,145 @@ async function renderMarkdown(document, options) {
18155
18301
  });
18156
18302
  return renderFrontmatter(document.frontmatter || {}, content, options?.frontmatterOptions);
18157
18303
  }
18158
- //#endregion
18159
- //#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode-codepoint.js
18160
- /**
18161
- * C1 Unicode control character reference replacements (code points 128–159).
18162
- * Index i gives the replacement for code point 128+i; 0 means "no replacement".
18163
- */
18164
- const c1 = [
18165
- 8364,
18166
- 0,
18167
- 8218,
18168
- 402,
18169
- 8222,
18170
- 8230,
18171
- 8224,
18172
- 8225,
18173
- 710,
18174
- 8240,
18175
- 352,
18176
- 8249,
18177
- 338,
18178
- 0,
18179
- 381,
18180
- 0,
18181
- 0,
18182
- 8216,
18183
- 8217,
18184
- 8220,
18185
- 8221,
18186
- 8226,
18187
- 8211,
18188
- 8212,
18189
- 732,
18190
- 8482,
18191
- 353,
18192
- 8250,
18193
- 339,
18194
- 0,
18195
- 382,
18196
- 376
18197
- ];
18198
- /**
18199
- * True for NUL, UTF-16 surrogates, and values past U+10FFFF.
18200
- * @param codePoint Unicode code point to check.
18201
- */
18202
- function isInvalidCodePoint(codePoint) {
18203
- return codePoint === 0 || codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111;
18204
- }
18205
- /**
18206
- * Replace the given code point with U+FFFD if it is NUL (0), a surrogate, or
18207
- * outside the valid Unicode range. Code points in the C1 controls range
18208
- * (128–159) are remapped to their Windows-1252 equivalents, following the
18209
- * HTML spec. All other code points are returned unchanged.
18210
- * @param codePoint Unicode code point to convert.
18211
- */
18212
- function replaceCodePoint(codePoint) {
18213
- if (isInvalidCodePoint(codePoint)) return 65533;
18214
- if (codePoint >= 128 && codePoint <= 159) return c1[codePoint - 128] || codePoint;
18215
- return codePoint;
18216
- }
18217
- /**
18218
- * Convert the code point of a decoded numeric entity to a string, replacing
18219
- * invalid values.
18220
- *
18221
- * Fast path for plain BMP code points: [1..0x7F] and [0xA0..0xD7FF] pass
18222
- * `replaceCodePoint` unchanged (no NUL, C1 remap, surrogate, or out-of-range
18223
- * handling) and fit a single charCode. 0xd760 = 0xD800 (the first surrogate)
18224
- * - 0xA0.
18225
- * @param codePoint Unicode code point to convert.
18226
- */
18227
- function codePointToString(codePoint) {
18228
- return codePoint - 1 >>> 0 < 127 || codePoint - 160 >>> 0 < 55136 ? String.fromCharCode(codePoint) : String.fromCodePoint(replaceCodePoint(codePoint));
18229
- }
18230
- //#endregion
18231
- //#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/decode-shared.js
18232
- const BASE91_INVERSE = /* #__PURE__ */ (() => {
18233
- const table = /* @__PURE__ */ new Uint8Array(127);
18234
- let code = 0;
18235
- for (let char = 33; char <= 126; char++) if (char !== 34 && char !== 36 && char !== 92) table[char] = code++;
18236
- return table;
18237
- })();
18238
- /**
18239
- * Decode a dictionary-encoded trie string back into its Uint16Array.
18240
- *
18241
- * Stream layout (consumed in this order):
18242
- * 1. dict1 atoms — `dict1AtomCount` uint16 values, delta+RLE encoded.
18243
- * 2. dict2 atoms — `atomCount - dict1AtomCount` values, delta+RLE.
18244
- * 3. dict2 ngrams — `ngramCount - (dictSize - dict1AtomCount)` entries,
18245
- * each a pair of slot codes that resolve to earlier slots.
18246
- * 4. dict1 ngrams — `dictSize - dict1AtomCount` entries, same shape.
18247
- * 5. data — slot codes, each expanding to one or more uint16 values.
18248
- *
18249
- * Codes use a 91-char base (printable ASCII minus `"`, `$`, `\`):
18250
- * - char1 < dictSize → 1-char code, slot = char1
18251
- * - char1 ≥ dictSize → 2-char code, slot = dictSize + (char1 - dictSize)*91 + char2
18252
- *
18253
- * Slot index → token kind:
18254
- * [0, A) dict1 atoms (1-char codes)
18255
- * [A, dictSize) dict1 ngrams (1-char codes)
18256
- * [dictSize, dictSize+D) dict2 atoms (2-char codes)
18257
- * [dictSize+D, end) dict2 ngrams (2-char codes)
18258
- *
18259
- * Both atom dicts decode before any ngram, and dict2 ngrams decode before
18260
- * dict1 ngrams. So every ngram entry references slots whose contents are
18261
- * already filled — no forward references to handle.
18262
- *
18263
- * This runs on library import. Flat typed arrays store each slot as either
18264
- * a plain value (`single`, covering every atom) or a range in a shared
18265
- * `pool` (ngrams).
18266
- * @param input Packed trie string.
18267
- * @param resultLength Expected number of uint16 values in the output.
18268
- * @param atomCount Total number of distinct uint16 values in the trie.
18269
- * @param dict1AtomCount Atoms in the 1-char range (`A` above).
18270
- * @param ngramCount Total number of ngram entries (dict1 + dict2).
18271
- * @param dictSize Number of 1-char code slots; the rest of `BASE - dictSize`
18272
- * first-byte values are 2-char codes.
18273
- */
18274
- function decodeTrieDict(input, resultLength, atomCount, dict1AtomCount, ngramCount, dictSize) {
18275
- const base = 91;
18276
- const inputLength = input.length;
18277
- const twoCharBias = dictSize * 90;
18278
- let pos = 0;
18279
- /** Read one slot code at `pos` and return its slot index, advancing pos. */
18280
- const readSlotCode = () => {
18281
- const c1 = BASE91_INVERSE[input.charCodeAt(pos++)];
18282
- return c1 < dictSize ? c1 : c1 * base - twoCharBias + BASE91_INVERSE[input.charCodeAt(pos++)];
18283
- };
18284
- const dict2AtomCount = atomCount - dict1AtomCount;
18285
- const slotCount = atomCount + ngramCount;
18286
- const single = new Int32Array(slotCount);
18287
- single.fill(-1, dict1AtomCount, dictSize);
18288
- single.fill(-1, dictSize + dict2AtomCount, slotCount);
18289
- const start = new Int32Array(slotCount);
18290
- const length = new Int32Array(slotCount);
18291
- /**
18292
- * Decode `count` ascending uint16 values from a delta+RLE stream into
18293
- * `single[off..off+count)`.
18294
- *
18295
- * code < 89 → delta = code
18296
- * code == 89 → run-length: next char encodes runLength-2; emit `runLength` consecutive +1 values
18297
- * code == 90, next < 90 → escape: delta = 89 + next * BASE + after-next
18298
- * code == 90, next == 90 → double-escape: extra char for very large deltas
18299
- * @param count
18300
- * @param off
18301
- */
18302
- function decodeDelta(count, off) {
18303
- let previous = 0;
18304
- let slot = off;
18305
- const end = off + count;
18306
- while (slot < end) {
18307
- const code = BASE91_INVERSE[input.charCodeAt(pos++)];
18308
- if (code < 89) {
18309
- previous += code;
18310
- single[slot++] = previous;
18311
- } else if (code === 89) {
18312
- let runLength = BASE91_INVERSE[input.charCodeAt(pos++)] + 2;
18313
- while (runLength--) single[slot++] = ++previous;
18314
- } else {
18315
- const next = BASE91_INVERSE[input.charCodeAt(pos++)];
18316
- previous += 89 + (next < 90 ? next * base + BASE91_INVERSE[input.charCodeAt(pos++)] : BASE91_INVERSE[input.charCodeAt(pos++)] * 8281 + BASE91_INVERSE[input.charCodeAt(pos++)] * base + BASE91_INVERSE[input.charCodeAt(pos++)]);
18317
- single[slot++] = previous;
18318
- }
18319
- }
18320
- }
18321
- decodeDelta(dict1AtomCount, 0);
18322
- decodeDelta(dict2AtomCount, dictSize);
18323
- const references = new Int32Array(ngramCount * 2);
18324
- let poolSize = 0;
18325
- let ngramIndex = 0;
18326
- /**
18327
- * Read `count` ngram entries (each = 2 slot-code references) for the slots
18328
- * starting at `startSlot`, recording references and assigning pool ranges.
18329
- * @param count
18330
- * @param startSlot
18331
- */
18332
- function readNgramReferences(count, startSlot) {
18333
- for (let index = 0; index < count; index++) {
18334
- const slot = startSlot + index;
18335
- const a = readSlotCode();
18336
- const b = readSlotCode();
18337
- references[ngramIndex * 2] = a;
18338
- references[ngramIndex * 2 + 1] = b;
18339
- ngramIndex += 1;
18340
- start[slot] = poolSize;
18341
- const entryLength = (single[a] < 0 ? length[a] : 1) + (single[b] < 0 ? length[b] : 1);
18342
- length[slot] = entryLength;
18343
- poolSize += entryLength;
18344
- }
18345
- }
18346
- readNgramReferences(ngramCount - dictSize + dict1AtomCount, dictSize + dict2AtomCount);
18347
- readNgramReferences(dictSize - dict1AtomCount, dict1AtomCount);
18348
- const pool = new Uint16Array(poolSize);
18349
- let write = 0;
18350
- for (let index = 0; index < ngramIndex; index++) for (let half = 0; half < 2; half++) {
18351
- const source = references[index * 2 + half];
18352
- const value = single[source];
18353
- if (value < 0) {
18354
- let read = start[source];
18355
- const readEnd = read + length[source];
18356
- while (read < readEnd) pool[write++] = pool[read++];
18357
- } else pool[write++] = value;
18358
- }
18359
- const out = new Uint16Array(resultLength);
18360
- let outIndex = 0;
18361
- while (pos < inputLength) {
18362
- let slot = BASE91_INVERSE[input.charCodeAt(pos++)];
18363
- if (slot >= dictSize) slot = slot * base - twoCharBias + BASE91_INVERSE[input.charCodeAt(pos++)];
18364
- const value = single[slot];
18365
- if (value < 0) {
18366
- let read = start[slot];
18367
- const readEnd = read + length[slot];
18368
- while (read < readEnd) out[outIndex++] = pool[read++];
18369
- } else out[outIndex++] = value;
18370
- }
18371
- return out;
18372
- }
18373
- //#endregion
18374
- //#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/generated/decode-data-html.js
18375
- /** Packed HTML decode trie data. */
18376
- const htmlDecodeTree = /* #__PURE__ */ decodeTrieDict("!}.&u%}'&}*'~!6*)%&,~!J~!J~%L~y<~!R,~~%Lu~~#GD~~#|)1#%}^%}2%+#.##%##%}&%##%'#%##&%#%#'%#&#%#&#'#%%#&#%##%#)%''%&%#%#'%#%%#%%}%%%#%#&(23#%%#&-%0%('1#(##%#'##+%'*.:1}#%#6-+(%'%%#%%%}#L'2351&('%}&/N'(0(/*-%(%%}#'+&T%7.2}#&%&#%#36/5##%&%%#&#%%#))2%%##%&&'0~!#*+&'%1~!%).'3q?&%'1~!.##%6(~!+%%%(Gw'rT~!E#<nA%#jZ~!H%(~!42##~!*31&~!G%U~#)5~#`3~!J~!Z~%]~%Y~%C~!q~!u~#kz~%#~!6'~!D~!U~!?~#T~!c%~!G#'~%7|~!G~!J~!G&~#pb~(Df}#%}*&}#%##%##%##&#-}&'#'&%#.++}%mI,#,@&(}*%}*'%&##&#%##%}&0}#.},U},%}+%}&%}#%##&}B%(}(%}+%)})%##%#&}&%##%&}<%}>%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#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5Jvk!a)javYrquJu3x4ia#T)2@SmYM?C2F|HAxPhH(!a#U#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P", 13494, 2713, 49, 25, 61);
18377
- //#endregion
18378
- //#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/bin-trie-flags.js
18379
- /**
18380
- * Bit flags & masks for the binary trie encoding used for entity decoding.
18381
- *
18382
- * The trie is a flat `Uint16Array`. Every node starts with one header word:
18383
- *
18384
- * 15..14 VALUE_LENGTH Number of words the value occupies, +1.
18385
- * 0 = no value; 1 = value inline in bits 12..0;
18386
- * 2/3 = value in the 1/2 words after the header.
18387
- * 13 FLAG13 If VALUE_LENGTH > 0: semicolon required ("strict"
18388
- * entity; `;` is never stored as a branch).
18389
- * If VALUE_LENGTH == 0: this node is a compact run.
18390
- * 12..7 BRANCH_LENGTH Number of branches (or run length for runs).
18391
- * 6..0 JUMP_TABLE Jump-table offset / single-branch char / first
18392
- * run char (see below).
18393
- *
18394
- * Branch data follows the header and any value words. Its shape is selected
18395
- * by (JUMP_TABLE, BRANCH_LENGTH) in the header:
18396
- *
18397
- * Single branch JUMP_TABLE = the only child's char, BRANCH_LENGTH = 0.
18398
- * No branch words; the child node follows immediately.
18399
- * Jump table JUMP_TABLE = first covered char (> 0), BRANCH_LENGTH =
18400
- * table length. One word per covered char: 0 = no branch,
18401
- * otherwise the child's offset from the END of the table,
18402
- * +1 (so 0 stays the no-branch sentinel).
18403
- * Dictionary JUMP_TABLE = 0, BRANCH_LENGTH = number of branches.
18404
- * ceil(n/2) words of sorted keys packed two per word
18405
- * (low byte first), then n pointer words storing the
18406
- * child's offset from the END of the branch data.
18407
- * Compact run VALUE_LENGTH = 0, FLAG13 set. BRANCH_LENGTH = run
18408
- * length (3..63), JUMP_TABLE = first char; remaining run
18409
- * chars packed two per word after the header. The target
18410
- * node follows the packed words immediately.
18411
- *
18412
- * Pointers are end-relative (rather than relative to the pointer's own
18413
- * position) because that makes the common "child encoded right after the
18414
- * branch data" case a small constant, which compresses far better. Offsets
18415
- * to already-encoded (shared) nodes wrap via uint16 modulo arithmetic; the
18416
- * decoder masks navigation results with `& 0xff_ff` to match.
18417
- */
18418
- var BinTrieFlags;
18419
- (function(BinTrieFlags) {
18420
- BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
18421
- BinTrieFlags[BinTrieFlags["FLAG13"] = 8192] = "FLAG13";
18422
- BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 8064] = "BRANCH_LENGTH";
18423
- BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
18424
- /** Bits 12..0: the inline value of a VALUE_LENGTH = 1 header word. */
18425
- BinTrieFlags[BinTrieFlags["VALUE_MASK"] = 8191] = "VALUE_MASK";
18426
- })(BinTrieFlags || (BinTrieFlags = {}));
18427
- //#endregion
18428
- //#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode.js
18429
- var CharCodes;
18430
- (function(CharCodes) {
18431
- CharCodes[CharCodes["AMP"] = 38] = "AMP";
18432
- CharCodes[CharCodes["NUM"] = 35] = "NUM";
18433
- CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
18434
- CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
18435
- CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
18436
- CharCodes[CharCodes["NINE"] = 57] = "NINE";
18437
- CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
18438
- CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
18439
- })(CharCodes || (CharCodes = {}));
18440
- /** Bit that needs to be set to convert an upper case ASCII character to lower case */
18441
- const TO_LOWER_BIT = 32;
18442
- const CONSUMED_SHIFT = 21;
18443
- const CODE_POINT_MASK = 2097151;
18444
- /**
18445
- * Reserved consumed field for counts of at least 2047 characters after `&`.
18446
- * The true count is in `longNumericConsumed`.
18447
- */
18448
- const CONSUMED_OVERFLOW = 2047;
18449
- /**
18450
- * Side channel for numeric entities of at least 2048 characters including
18451
- * `&`. Set by `parseNumericEntity` when its consumed count reaches the
18452
- * reserved value `CONSUMED_OVERFLOW`; callers read the true count from here.
18453
- * A module-level slot avoids a tuple allocation on the hot path.
18454
- */
18455
- let longNumericConsumed = 0;
18456
- /**
18457
- * Extract the consumed count from a `parseNumericEntity` packed result,
18458
- * recovering the true length from `longNumericConsumed` when the packed
18459
- * field contains the sentinel. Read it before the next `parseNumericEntity`
18460
- * call, which may overwrite the side channel. This helper owns that protocol.
18461
- * @param packed Packed result of `parseNumericEntity`.
18462
- */
18463
- function unpackConsumed(packed) {
18464
- const consumed = packed >>> CONSUMED_SHIFT;
18465
- return consumed === CONSUMED_OVERFLOW ? longNumericConsumed : consumed;
18466
- }
18467
- /**
18468
- * Unsigned subtraction trick: (code - lo) >>> 0 wraps negatives to large
18469
- * values, so a single `<=` covers the entire [lo..hi] range check.
18470
- * @param code Code point to check.
18471
- */
18472
- function isNumber(code) {
18473
- return code - CharCodes.ZERO >>> 0 <= 9;
18474
- }
18475
- function isHexadecimalCharacter(code) {
18476
- return (code | TO_LOWER_BIT) - CharCodes.LOWER_A >>> 0 <= 5;
18477
- }
18478
- function isAlpha(code) {
18479
- return (code | TO_LOWER_BIT) - CharCodes.LOWER_A >>> 0 <= 25;
18480
- }
18481
- /**
18482
- * Checks if the given character is a valid end character for an entity in an attribute.
18483
- *
18484
- * Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
18485
- * See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
18486
- * @param code Code point to check.
18487
- */
18488
- function isEntityInAttributeInvalidEnd(code) {
18489
- return code === CharCodes.EQUALS || isAlpha(code) || isNumber(code);
18490
- }
18491
- var EntityDecoderState;
18492
- (function(EntityDecoderState) {
18493
- EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
18494
- EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
18495
- EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
18496
- EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
18497
- EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
18498
- })(EntityDecoderState || (EntityDecoderState = {}));
18499
- /**
18500
- * Decoding mode for named entities.
18501
- */
18502
- var DecodingMode;
18503
- (function(DecodingMode) {
18504
- /** Entities in text nodes that can end with any character. */
18505
- DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
18506
- /** Only allow entities terminated with a semicolon. */
18507
- DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
18508
- /** Entities in attributes have limitations on ending characters. */
18509
- DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
18510
- })(DecodingMode || (DecodingMode = {}));
18511
- /**
18512
- * Determines the branch of the current node that is taken given the current
18513
- * character. This function is used to traverse the trie.
18514
- *
18515
- * See `BinTrieFlags` for the branch-data layouts handled here.
18516
- * @param decodeTree The trie.
18517
- * @param current The current node's header word.
18518
- * @param nodeIndex Index of the node's first branch-data word (the header
18519
- * plus any value words have been skipped by the caller).
18520
- * @param char The current character.
18521
- * @returns The index of the next node, or -1 if no branch is taken.
18522
- */
18523
- function determineBranch(decodeTree, current, nodeIndex, char) {
18524
- const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
18525
- const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
18526
- if (jumpOffset) {
18527
- if (branchCount === 0) return char === jumpOffset ? nodeIndex : -1;
18528
- const slot = char - jumpOffset;
18529
- if (slot >>> 0 >= branchCount) return -1;
18530
- const stored = decodeTree[nodeIndex + slot];
18531
- return stored === 0 ? -1 : nodeIndex + branchCount + stored - 1 & 65535;
18532
- }
18533
- if (branchCount === 0) return -1;
18534
- const packedKeySlots = branchCount + 1 >> 1;
18535
- const branchEnd = nodeIndex + packedKeySlots + branchCount;
18536
- for (let index = 0; index < branchCount; index++) {
18537
- const key = decodeTree[nodeIndex + (index >> 1)] >> ((index & 1) << 3) & 255;
18538
- if (key === char) return branchEnd + decodeTree[nodeIndex + packedKeySlots + index] & 65535;
18539
- if (key > char) return -1;
18540
- }
18541
- return -1;
18542
- }
18543
- /**
18544
- * Read the decoded value from a trie node.
18545
- * @param decodeTree The trie.
18546
- * @param nodeIndex The index of the node.
18547
- * @param valueLength The length of the value (1, 2, or 3).
18548
- * @returns The decoded string.
18549
- */
18550
- function readTrieValue(decodeTree, nodeIndex, valueLength) {
18551
- if (valueLength === 1) return String.fromCharCode(decodeTree[nodeIndex] & BinTrieFlags.VALUE_MASK);
18552
- if (valueLength === 2) return String.fromCharCode(decodeTree[nodeIndex + 1]);
18553
- return String.fromCharCode(decodeTree[nodeIndex + 1], decodeTree[nodeIndex + 2]);
18554
- }
18555
- /**
18556
- * Parse a numeric entity (`&#DDD;` or `&#xHHH;`).
18557
- *
18558
- * Encodes the result as `(consumed << CONSUMED_SHIFT) | codepoint` (see
18559
- * the packing comment at the top of the file; overlong entities spill
18560
- * their length into `longNumericConsumed`). Returns 0 when no digits were
18561
- * found.
18562
- *
18563
- * This is the sync counterpart of the streaming
18564
- * `EntityDecoder#stateNumericDecimal` / `#stateNumericHex`. Digit parsing
18565
- * matches those methods; only this packed result needs a value clamp.
18566
- * @param input The input string.
18567
- * @param numberStart Index of the `#` character.
18568
- * @param inputLength Cached `input.length`.
18569
- */
18570
- function parseNumericEntity(input, numberStart, inputLength) {
18571
- let offset = numberStart + 1;
18572
- let cp = 0;
18573
- let digitStart = offset;
18574
- if (offset < inputLength && (input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
18575
- offset += 1;
18576
- digitStart = offset;
18577
- while (offset < inputLength) {
18578
- const char = input.charCodeAt(offset);
18579
- if (isNumber(char)) cp = cp * 16 + (char - CharCodes.ZERO);
18580
- else if (isHexadecimalCharacter(char)) cp = cp * 16 + ((char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10);
18581
- else break;
18582
- offset += 1;
18583
- }
18584
- } else while (offset < inputLength) {
18585
- const digit = input.charCodeAt(offset) - CharCodes.ZERO;
18586
- if (digit >>> 0 > 9) break;
18587
- cp = cp * 10 + digit;
18588
- offset += 1;
18589
- }
18590
- if (offset === digitStart) return 0;
18591
- if (offset < inputLength && input.charCodeAt(offset) === CharCodes.SEMI) offset += 1;
18592
- if (cp > 1114111) cp = 1114112;
18593
- let consumed = offset - numberStart;
18594
- if (consumed >= CONSUMED_OVERFLOW) {
18595
- longNumericConsumed = consumed;
18596
- consumed = CONSUMED_OVERFLOW;
18597
- }
18598
- return consumed << CONSUMED_SHIFT | cp;
18599
- }
18600
- /**
18601
- * Decode all entities in `input` using the HTML trie.
18602
- *
18603
- * Hard-wired to `htmlDecodeTree`: the inline root navigation below assumes
18604
- * the HTML root's jump-table shape, so this must not be generalized to
18605
- * other tries (the XML trie's dictionary root would silently match no
18606
- * entities — `decodeXML` has its own hand-coded fast path instead).
18607
- * @param input The string to decode.
18608
- * @param isStrict Only match semicolon-terminated entities.
18609
- * @param isAttribute Whether to apply attribute-specific parsing rules (disallowing certain non-semicolon terminators).
18610
- * @returns The decoded string.
18611
- */
18612
- function decodeWithTrie(input, isStrict, isAttribute) {
18613
- const decodeTree = htmlDecodeTree;
18614
- let offset = input.indexOf("&");
18615
- if (offset < 0) return input;
18616
- const inputLength = input.length;
18617
- let chunkStart = 0;
18618
- let result = "";
18619
- const root = decodeTree[0];
18620
- const rootJumpOffset = root & BinTrieFlags.JUMP_TABLE;
18621
- const rootBranchCount = (root & BinTrieFlags.BRANCH_LENGTH) >> 7;
18622
- do {
18623
- const entityStart = offset + 1;
18624
- const firstChar = input.charCodeAt(entityStart);
18625
- let consumed;
18626
- let value;
18627
- if (firstChar === CharCodes.NUM) {
18628
- const packed = parseNumericEntity(input, entityStart, inputLength);
18629
- consumed = unpackConsumed(packed);
18630
- if (isStrict && consumed > 0 && input.charCodeAt(entityStart + consumed - 1) !== CharCodes.SEMI) consumed = 0;
18631
- value = consumed === 0 ? "" : codePointToString(packed & CODE_POINT_MASK);
18632
- } else if (isAlpha(firstChar)) {
18633
- consumed = 0;
18634
- value = "";
18635
- const rootSlotIndex = firstChar - rootJumpOffset;
18636
- let nodeIndex;
18637
- if (rootSlotIndex >>> 0 < rootBranchCount) {
18638
- const stored = decodeTree[1 + rootSlotIndex];
18639
- nodeIndex = stored === 0 ? -1 : rootBranchCount + stored & 65535;
18640
- } else nodeIndex = -1;
18641
- let bestNodeIndex = 0;
18642
- let bestValueLength = 0;
18643
- let current = nodeIndex < 0 ? 0 : decodeTree[nodeIndex];
18644
- let index = entityStart + 1;
18645
- trie: while (index < inputLength) {
18646
- while ((current & (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) === 0 && (current & BinTrieFlags.JUMP_TABLE) !== 0) {
18647
- const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
18648
- const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
18649
- if (branchCount === 0) {
18650
- if (input.charCodeAt(index) !== jumpOffset) break trie;
18651
- nodeIndex += 1;
18652
- } else {
18653
- const slot = input.charCodeAt(index) - jumpOffset;
18654
- if (slot >>> 0 >= branchCount) break trie;
18655
- const stored = decodeTree[nodeIndex + 1 + slot];
18656
- if (stored === 0) break trie;
18657
- nodeIndex = nodeIndex + branchCount + stored & 65535;
18658
- }
18659
- current = decodeTree[nodeIndex];
18660
- index += 1;
18661
- if (index >= inputLength) break trie;
18662
- }
18663
- if ((current & (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) === BinTrieFlags.FLAG13) {
18664
- const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
18665
- if (input.charCodeAt(index) !== (current & BinTrieFlags.JUMP_TABLE)) break;
18666
- index += 1;
18667
- const remaining = runLength - 1;
18668
- let wordIndex = nodeIndex + 1;
18669
- let charIndexInPacked = 0;
18670
- for (; charIndexInPacked + 1 < remaining; charIndexInPacked += 2) {
18671
- const packed = decodeTree[wordIndex];
18672
- if (input.charCodeAt(index) !== (packed & 255)) break trie;
18673
- index += 1;
18674
- if (input.charCodeAt(index) !== (packed >> 8 & 255)) break trie;
18675
- index += 1;
18676
- wordIndex += 1;
18677
- }
18678
- if (charIndexInPacked < remaining) {
18679
- if (input.charCodeAt(index) !== (decodeTree[wordIndex] & 255)) break;
18680
- index += 1;
18681
- }
18682
- nodeIndex += 1 + (runLength >> 1);
18683
- current = decodeTree[nodeIndex];
18684
- continue;
18685
- }
18686
- const valueLength = current >>> 14;
18687
- const char = input.charCodeAt(index);
18688
- if (valueLength !== 0) {
18689
- if (char === CharCodes.SEMI) {
18690
- consumed = index - entityStart + 1;
18691
- value = valueLength === 1 ? String.fromCharCode(current & BinTrieFlags.VALUE_MASK) : readTrieValue(decodeTree, nodeIndex, valueLength);
18692
- break;
18693
- }
18694
- if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {
18695
- consumed = index - entityStart;
18696
- bestNodeIndex = nodeIndex;
18697
- bestValueLength = valueLength;
18698
- }
18699
- if (valueLength === 1) break;
18700
- }
18701
- const next = determineBranch(decodeTree, current, nodeIndex + (valueLength || 1), char);
18702
- if (next < 0) break;
18703
- nodeIndex = next;
18704
- current = decodeTree[nodeIndex];
18705
- index += 1;
18706
- }
18707
- if (value === "") {
18708
- const finalVL = current >>> 14;
18709
- if (finalVL !== 0 && !isStrict && (current & BinTrieFlags.FLAG13) === 0) {
18710
- consumed = index - entityStart;
18711
- bestNodeIndex = nodeIndex;
18712
- bestValueLength = finalVL;
18713
- }
18714
- if (consumed > 0) value = readTrieValue(decodeTree, bestNodeIndex, bestValueLength);
18715
- }
18716
- } else {
18717
- consumed = 0;
18718
- value = "";
18304
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/binding.js
18305
+ const markdownItInlineBinding = (md, options = {}) => {
18306
+ const tag = options.tag || "binding";
18307
+ md.inline.ruler.after("entity", "mdc_inline_binding", (state, silent) => {
18308
+ const start = state.pos;
18309
+ if (state.src[start] !== "{" || state.src[start + 1] !== "{") return false;
18310
+ let end = start + 2;
18311
+ while (end < state.posMax - 1) {
18312
+ if (state.src[end] === "}" && state.src[end + 1] === "}") break;
18313
+ end += 1;
18719
18314
  }
18720
- if (consumed === 0 || isAttribute && firstChar !== CharCodes.NUM && input.charCodeAt(entityStart + consumed - 1) !== CharCodes.SEMI && entityStart + consumed < inputLength && isEntityInAttributeInvalidEnd(input.charCodeAt(entityStart + consumed))) offset = entityStart;
18721
- else {
18722
- if (chunkStart < offset) result += input.slice(chunkStart, offset);
18723
- result += value;
18724
- offset = chunkStart = entityStart + consumed;
18315
+ if (end >= state.posMax - 1) return false;
18316
+ const inner = state.src.slice(start + 2, end).trim();
18317
+ if (!inner) return false;
18318
+ const separator = inner.indexOf("||");
18319
+ const value = separator === -1 ? inner : inner.slice(0, separator).trim();
18320
+ const defaultValue = separator === -1 ? "" : inner.slice(separator + 2).trim();
18321
+ if (!value) return false;
18322
+ state.pos = end + 2;
18323
+ if (silent) return true;
18324
+ const token = state.push("mdc_inline_component", tag, 0);
18325
+ token.attrSet(":value", value);
18326
+ if (defaultValue) token.attrSet("defaultValue", defaultValue);
18327
+ return true;
18328
+ });
18329
+ };
18330
+ var binding_default = defineComarkPlugin((opts = {}) => {
18331
+ return {
18332
+ name: "binding",
18333
+ markdownItPlugins: [((md) => markdownItInlineBinding(md, opts))]
18334
+ };
18335
+ });
18336
+ // ../markdown-template/dist/prepare-er_eo8pi.js
18337
+ const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
18338
+ const markdownTemplateErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
18339
+ docsBase: "https://vitehub.dev/docs/markdown-template/diagnostics",
18340
+ codes: {
18341
+ MARKDOWN_TEMPLATE_R0002: {
18342
+ ...dynamicError,
18343
+ fix: "Bind the condition to a `data.<path>` path that the template may read, or to a JSON literal, such as `:condition=\"data.ready\"`."
18344
+ },
18345
+ MARKDOWN_TEMPLATE_B0001: {
18346
+ ...dynamicError,
18347
+ fix: "Pass a path that starts with `./`, ends with `.template.md`, and uses `/` between folders, such as `./review/PULL_REQUEST.template.md`."
18348
+ },
18349
+ MARKDOWN_TEMPLATE_B0002: {
18350
+ ...dynamicError,
18351
+ fix: "Remove the empty, `.`, and `..` folders from the path, such as `./review/PULL_REQUEST.template.md` in place of `./review/../PULL_REQUEST.template.md`."
18352
+ },
18353
+ MARKDOWN_TEMPLATE_BINDING_IN_CODE: {
18354
+ why: ({ path }) => `The binding "{{ ${path} }}" is inside inline code or a code block, so the template shows it as text and does not fill it.`,
18355
+ fix: "Move the binding out of the code, such as `**{{ data.repository }}**` in place of `` `{{ data.repository }}` ``. To show a value as code, put the Markdown in `data`, such as `` `vitejs/vite` ``, and insert it with `:insert{:markdown=\"data.<path>\"}`."
18356
+ },
18357
+ MARKDOWN_TEMPLATE_BINDING_OUTSIDE_DATA: {
18358
+ why: ({ path }) => `The binding "${path}" does not start with \`data.\`. A template reads each value from \`data\`, so "${path}" is never defined.`,
18359
+ fix: "Start each binding with `data.`: write `{{ data.name }}` in place of `{{ name }}`, and `:href=\"data.url\"` in place of `:href=\"url\"`. Pass the same values in `data`."
18360
+ },
18361
+ MARKDOWN_TEMPLATE_R0011: {
18362
+ ...dynamicError,
18363
+ fix: "Pass a link value in the template data that is a safe URL, such as an `https:` or relative URL without spaces at the ends, control characters, backslashes, or HTML character references."
18364
+ },
18365
+ MARKDOWN_TEMPLATE_R0012: {
18366
+ ...dynamicError,
18367
+ fix: "Pass a link value in the template data that is a safe URL, such as an `https:` or relative URL without spaces at the ends, control characters, backslashes, or HTML character references."
18368
+ },
18369
+ MARKDOWN_TEMPLATE_R0013: {
18370
+ ...dynamicError,
18371
+ fix: "Pass a link value in the template data that is a safe URL, such as an `https:` or relative URL without spaces at the ends, control characters, backslashes, or HTML character references."
18372
+ },
18373
+ MARKDOWN_TEMPLATE_R0014: {
18374
+ ...dynamicError,
18375
+ fix: "Pass the template text as a string to `renderMarkdownTemplate()`, or use `renderMarkdownFile()` with the path of a template file."
18376
+ },
18377
+ MARKDOWN_TEMPLATE_R0015: {
18378
+ ...dynamicError,
18379
+ fix: "Write `::else-if` and `::else` blocks only inside the `::if` block that they follow, as in `::if{:condition=\"data.ready\"}` ... `::else` ... `::`."
18380
+ },
18381
+ MARKDOWN_TEMPLATE_R0017: {
18382
+ ...dynamicError,
18383
+ fix: "Add the value that the message names to the `data` that you pass to the renderer, or remove its binding from the template."
18384
+ },
18385
+ MARKDOWN_TEMPLATE_R0018: {
18386
+ ...dynamicError,
18387
+ fix: "Bind the value that the message names to a string, number, or boolean in `data`, or use `:insert{:markdown=\"data.<path>\"}` for a Markdown fragment."
18388
+ },
18389
+ MARKDOWN_TEMPLATE_R0020: {
18390
+ ...dynamicError,
18391
+ fix: "Give each `:insert` a bound `:markdown` prop with an allowed `data.<path>` that holds a Markdown string, such as `:insert{:markdown=\"data.summary\"}`."
18392
+ },
18393
+ MARKDOWN_TEMPLATE_R0021: {
18394
+ ...dynamicError,
18395
+ fix: "Put the `:insert` on its own line with blank lines around it, or pass a fragment that is one paragraph."
18396
+ },
18397
+ MARKDOWN_TEMPLATE_R0022: {
18398
+ ...dynamicError,
18399
+ fix: "Remove the condition from the `::else` block, or use `::else-if{:condition=\"data.<path>\"}` for a branch with a condition."
18400
+ },
18401
+ MARKDOWN_TEMPLATE_R0023: {
18402
+ ...dynamicError,
18403
+ fix: "Put `::else` last in its `::if` block, and move each `::else-if` before it."
18404
+ },
18405
+ MARKDOWN_TEMPLATE_R0024: {
18406
+ ...dynamicError,
18407
+ fix: "Give `::if` and `::else-if` a bound `:condition` or `:value` prop, such as `::if{:condition=\"data.ready\"}`, and use only the `eq`, `neq`, `gt`, `gte`, `lt`, and `lte` props next to it."
18408
+ },
18409
+ MARKDOWN_TEMPLATE_R0025: {
18410
+ ...dynamicError,
18411
+ fix: "Write `::else-if` and `::else` blocks only inside the `::if` block that they follow, as in `::if{:condition=\"data.ready\"}` ... `::else` ... `::`."
18412
+ },
18413
+ MARKDOWN_TEMPLATE_R0026: {
18414
+ ...dynamicError,
18415
+ fix: "Put `::else` last in its `::if` block, and move each `::else-if` before it."
18416
+ },
18417
+ MARKDOWN_TEMPLATE_R0027: {
18418
+ ...dynamicError,
18419
+ fix: "Remove the condition from the `::else` block, or use `::else-if{:condition=\"data.<path>\"}` for a branch with a condition."
18420
+ },
18421
+ MARKDOWN_TEMPLATE_R0029: {
18422
+ ...dynamicError,
18423
+ fix: "Add a closing `::` line for each `::if`, `::else-if`, and `::else` block of the template."
18424
+ },
18425
+ MARKDOWN_TEMPLATE_R0030: {
18426
+ ...dynamicError,
18427
+ fix: "Remove the `:srcdoc` binding from the template, and write the iframe content as static markup."
18428
+ },
18429
+ MARKDOWN_TEMPLATE_R0031: {
18430
+ ...dynamicError,
18431
+ fix: "Remove the binding of the HTML event-handler attribute, such as `:onclick`, from the template."
18432
+ },
18433
+ MARKDOWN_TEMPLATE_R0032: {
18434
+ ...dynamicError,
18435
+ fix: "Remove the `:style` binding from the template, and use a static `style` attribute or a class."
18436
+ },
18437
+ MARKDOWN_TEMPLATE_R0033: {
18438
+ ...dynamicError,
18439
+ fix: "Write the link as `[label](){:href=\"data.<path>\"}` in place of `{{ }}` in the link destination."
18725
18440
  }
18726
- if (input.charCodeAt(offset) !== CharCodes.AMP) offset = input.indexOf("&", offset);
18727
- } while (offset >= 0);
18728
- return result + input.slice(chunkStart);
18729
- }
18730
- /**
18731
- * Decodes an HTML string in an attribute.
18732
- * @param htmlAttribute The string to decode.
18733
- * @returns The decoded string.
18734
- */
18735
- function decodeHTMLAttribute(htmlAttribute) {
18736
- return decodeWithTrie(htmlAttribute, false, true);
18737
- }
18738
- //#endregion
18739
- //#region ../markdown-template/dist/render-CpaRdP2V.js
18441
+ }
18442
+ });
18740
18443
  function pathValue(value, parts) {
18741
18444
  if (!parts.length) return { value };
18742
18445
  if (value === null || typeof value !== "object" && typeof value !== "function") return void 0;
@@ -18747,15 +18450,35 @@ function pathValue(value, parts) {
18747
18450
  if (resolved !== void 0) return resolved;
18748
18451
  }
18749
18452
  }
18453
+ function isJsonLiteral(value) {
18454
+ try {
18455
+ JSON.parse(value);
18456
+ return true;
18457
+ } catch {
18458
+ return false;
18459
+ }
18460
+ }
18461
+ function bindingRoot(value) {
18462
+ return isJsonLiteral(value) ? void 0 : value.split(".", 1)[0];
18463
+ }
18464
+ const bindingRoots = /* @__PURE__ */ new Set([
18465
+ "data",
18466
+ "frontmatter",
18467
+ "meta",
18468
+ "props"
18469
+ ]);
18470
+ /** Rejects a bound path that starts with no known name, such as `{{ name }}` from templates before `data.` paths. */
18471
+ function assertBindingRoot(value) {
18472
+ const root = bindingRoot(value);
18473
+ if (root !== void 0 && !bindingRoots.has(root)) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_BINDING_OUTSIDE_DATA({ path: value });
18474
+ }
18750
18475
  function resolveTemplateAttributes(attributes, renderData) {
18751
18476
  const values = Object.create(null);
18752
18477
  const rewritten = { ...attributes };
18753
18478
  for (const [key, value] of Object.entries(attributes)) {
18754
18479
  if (!key.startsWith(":") || typeof value !== "string") continue;
18755
- try {
18756
- JSON.parse(value);
18757
- continue;
18758
- } catch {}
18480
+ if (isJsonLiteral(value)) continue;
18481
+ assertBindingRoot(value);
18759
18482
  const alias = `binding${Object.keys(values).length}`;
18760
18483
  values[alias] = pathValue(renderData, value.split("."))?.value;
18761
18484
  rewritten[key] = `props.${alias}`;
@@ -18809,6 +18532,123 @@ function snapshotTemplateData(value, seen = /* @__PURE__ */ new WeakMap()) {
18809
18532
  }
18810
18533
  return copy;
18811
18534
  }
18535
+ const comarkHtml = html_default({ markdown: false });
18536
+ /** Plugins that keep authored HTML blocks raw, as the template renderer expects. */
18537
+ const htmlPlugins = [{
18538
+ ...comarkHtml,
18539
+ markdownItPost(state) {
18540
+ for (const [index, token] of state.tokens.entries()) {
18541
+ const first = token.children?.[0];
18542
+ if (token.type !== "inline" || state.tokens[index - 1]?.type !== "paragraph_open" || first?.type !== "html_inline") continue;
18543
+ token.children.unshift(Object.assign(Object.create(Object.getPrototypeOf(first)), first, {
18544
+ type: "text",
18545
+ content: ""
18546
+ }));
18547
+ }
18548
+ comarkHtml.markdownItPost?.(state);
18549
+ }
18550
+ }];
18551
+ const defaultPlugins = [
18552
+ frontmatter_default,
18553
+ alert_default,
18554
+ task_list_default,
18555
+ components_default,
18556
+ attributes_default
18557
+ ];
18558
+ /**
18559
+ * Comark's default plugins without linkify, so plain URLs stay text, then `plugins`.
18560
+ * A plugin in `plugins` replaces the default plugin with the same name, as Comark does.
18561
+ */
18562
+ function templatePlugins(...plugins) {
18563
+ const names = new Set(plugins.map((plugin) => plugin.name));
18564
+ return [...defaultPlugins.map((plugin) => plugin()).filter((plugin) => !names.has(plugin.name)), ...plugins];
18565
+ }
18566
+ const bindingPlugin = binding_default();
18567
+ const parserOptions = {
18568
+ autoClose: false,
18569
+ autoUnwrap: false,
18570
+ registerDefaultPlugins: false,
18571
+ plugins: templatePlugins(...htmlPlugins, bindingPlugin)
18572
+ };
18573
+ /** Parser options for one render, with the caller's extra plugins. */
18574
+ function templateParserOptions(plugins = []) {
18575
+ return {
18576
+ ...parserOptions,
18577
+ plugins: templatePlugins(...htmlPlugins, bindingPlugin, ...plugins)
18578
+ };
18579
+ }
18580
+ /** HTML tags whose text the renderer keeps as written. */
18581
+ const literalHtmlTags = /* @__PURE__ */ new Set([
18582
+ "code",
18583
+ "pre",
18584
+ "script",
18585
+ "style",
18586
+ "textarea",
18587
+ "kbd",
18588
+ "samp",
18589
+ "var"
18590
+ ]);
18591
+ /** Whether authored HTML children are reparsed as Markdown by the template renderer. */
18592
+ function hasMarkdownHtmlChildren([tag, attrs, ...children]) {
18593
+ return attrs.$?.html === 1 && attrs.$?.block === 1 && tag !== "a" && tag !== "img" && !literalHtmlTags.has(tag) && children.every((child) => typeof child === "string");
18594
+ }
18595
+ async function prepareTemplate(source) {
18596
+ const prefix = `VITEHUBCODE${crypto.randomUUID().replaceAll("-", "")}`;
18597
+ const lines = [];
18598
+ const masked = source.replace(/^([\t ]*)(:[^\r\n]*)$/gm, (_match, indent, line) => `${indent}${prefix}${lines.push(line) - 1}END`);
18599
+ const pattern = new RegExp(`${prefix}(\\d+)END`, "g");
18600
+ const inCode = /* @__PURE__ */ new Set();
18601
+ const visit = (nodes, literal = false) => {
18602
+ for (const node of nodes) if (typeof node === "string") {
18603
+ if (literal) for (const match of node.matchAll(pattern)) inCode.add(Number(match[1]));
18604
+ } else visit(node.slice(2), literal || node[0] !== null && literalHtmlTags.has(node[0]));
18605
+ };
18606
+ if (lines.length) visit((await parseMarkdown(masked, {
18607
+ autoClose: false,
18608
+ autoUnwrap: false,
18609
+ registerDefaultPlugins: false,
18610
+ plugins: templatePlugins(...htmlPlugins)
18611
+ })).nodes);
18612
+ const template = masked.replace(pattern, (token, index) => inCode.has(Number(index)) ? token : lines[Number(index)]);
18613
+ validateBranches(template);
18614
+ return {
18615
+ template,
18616
+ restore: (rendered) => rendered.replace(pattern, (_token, index) => lines[Number(index)])
18617
+ };
18618
+ }
18619
+ function validateBranches(template) {
18620
+ const stack = [];
18621
+ for (const line of template.split(/\r\n|[\r\n]/)) {
18622
+ if (/^\s*::\s*$/.test(line)) {
18623
+ stack.pop();
18624
+ continue;
18625
+ }
18626
+ const match = line.match(/^\s*::([\w-]+)(?:\{(.*)\})?\s*$/);
18627
+ if (!match) continue;
18628
+ const tag = match[1];
18629
+ if (tag !== "else" && tag !== "else-if") {
18630
+ stack.push({
18631
+ tag,
18632
+ sawElse: false
18633
+ });
18634
+ continue;
18635
+ }
18636
+ const current = stack.at(-1);
18637
+ if (current?.tag === "else") throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0026({ message: `[vitehub] Markdown template ${tag} block cannot follow else.` });
18638
+ if (current?.tag !== "if" && current?.tag !== "else-if") throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0025({ message: `[vitehub] Markdown template ${tag} block must follow an if block.` });
18639
+ if (current.sawElse) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0026({ message: `[vitehub] Markdown template ${tag} block cannot follow else.` });
18640
+ if (tag === "else") {
18641
+ if (match[2]?.trim()) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0027({ message: "[vitehub] Markdown template else block does not accept a condition." });
18642
+ current.sawElse = true;
18643
+ }
18644
+ stack.push({
18645
+ tag,
18646
+ sawElse: false
18647
+ });
18648
+ }
18649
+ if (stack.some((entry) => entry.tag === "if" || entry.tag === "else-if" || entry.tag === "else")) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0029({ message: "[vitehub] Markdown template if block is missing a closing :: line." });
18650
+ }
18651
+ // ../markdown-template/dist/render-Mm1YBgGT.js
18812
18652
  const ordered = (compare) => (value, expected) => (typeof value === "number" && typeof expected === "number" || typeof value === "string" && typeof expected === "string") && compare(value, expected);
18813
18653
  const comparisons = {
18814
18654
  eq: (value, expected) => value === expected,
@@ -18829,12 +18669,7 @@ function matchesCondition(attributes, renderData, validatePath) {
18829
18669
  if (!allowedProps.has(key.replace(/^:/, ""))) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0024({ message: `[vitehub] Unsupported Markdown template condition prop "${key}". Use Comark-bound condition or value props.` });
18830
18670
  if (key === "condition" || key === "value") throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0024({ message: `[vitehub] Markdown template ${key} prop must be bound. Write :${key}="data.path" instead of ${key}="${String(value)}".` });
18831
18671
  if (validatePath && key.startsWith(":") && typeof value === "string") {
18832
- let literal = false;
18833
- try {
18834
- JSON.parse(value);
18835
- literal = true;
18836
- } catch {}
18837
- if (!literal && (!value.startsWith("data.") || !validatePath(value.slice(5)))) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0002({ message: `[vitehub] Unsafe Markdown template condition "${value}".` });
18672
+ if (!isJsonLiteral(value) && (!value.startsWith("data.") || !validatePath(value.slice(5)))) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0002({ message: `[vitehub] Unsafe Markdown template condition "${value}".` });
18838
18673
  }
18839
18674
  }
18840
18675
  const isCondition = (key) => key === "condition" || key === ":condition";
@@ -18852,19 +18687,18 @@ function matchesCondition(attributes, renderData, validatePath) {
18852
18687
  }
18853
18688
  const legacyHtmlReferences = new Set(characterEntitiesLegacy);
18854
18689
  async function safeLinkDestination(value, path, options = {}) {
18855
- const decodedValue = options.decodeHtmlEntities ? decodeHTMLAttribute(value) : value;
18856
- const suffixIndex = decodedValue.search(/[?#]/);
18857
- const scheme = decodedValue.match(/^([a-z][a-z\d+.-]*):/i);
18858
- const hasPathBackslash = (!scheme || /^(?:file|ftp|https?|wss?)$/i.test(scheme[1])) && decodedValue.slice(0, suffixIndex < 0 ? void 0 : suffixIndex).includes("\\");
18859
- const hasHtmlReferencePrefix = !options.decodeHtmlEntities && (/&#(?:\d+|x[\dA-F]+)/i.test(value) || [...value.matchAll(/&([A-Za-z][A-Za-z\d]*)(?=[^=A-Za-z\d]|$)/g)].some((match) => legacyHtmlReferences.has(match[1])));
18860
- const hasBracketedAuthority = /^(?:[a-z][a-z\d+.-]*:)?\/{2,}(?:[^/?#]*@)?\[/i.test(decodedValue) || /^(?:file|ftp|https?|wss?):\/*(?:[^/?#]*@)?\[/i.test(decodedValue);
18861
- if (decodedValue.startsWith(" ") || decodedValue.endsWith(" ") || /%(?![\dA-F]{2})/i.test(decodedValue) || hasPathBackslash || hasHtmlReferencePrefix || hasBracketedAuthority || [...decodedValue].some((character) => {
18690
+ const suffixIndex = value.search(/[?#]/);
18691
+ const scheme = value.match(/^([a-z][a-z\d+.-]*):/i);
18692
+ const hasPathBackslash = (!scheme || /^(?:file|ftp|https?|wss?)$/i.test(scheme[1])) && value.slice(0, suffixIndex < 0 ? void 0 : suffixIndex).includes("\\");
18693
+ const hasHtmlReferencePrefix = !options.decoded && (/&#(?:\d+|x[\dA-F]+)/i.test(value) || [...value.matchAll(/&([A-Za-z][A-Za-z\d]*)(?=[^=A-Za-z\d]|$)/g)].some((match) => legacyHtmlReferences.has(match[1])));
18694
+ const hasBracketedAuthority = /^(?:[a-z][a-z\d+.-]*:)?\/{2,}(?:[^/?#]*@)?\[/i.test(value) || /^(?:file|ftp|https?|wss?):\/*(?:[^/?#]*@)?\[/i.test(value);
18695
+ if (value.startsWith(" ") || value.endsWith(" ") || /%(?![\dA-F]{2})/i.test(value) || hasPathBackslash || hasHtmlReferencePrefix || hasBracketedAuthority || [...value].some((character) => {
18862
18696
  const codePoint = character.codePointAt(0);
18863
18697
  return codePoint < 32 || codePoint === 127;
18864
18698
  })) throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0011({ message: `[vitehub] Markdown template link binding "{{ ${path} }}" must resolve to a safe destination.` });
18865
18699
  let encoded;
18866
18700
  try {
18867
- encoded = encodeURI(decodedValue);
18701
+ encoded = encodeURI(value);
18868
18702
  encoded = encoded.replace(/%25([\dA-F]{2})/gi, "%$1").replace(/[()]/g, (character) => `%${character.codePointAt(0).toString(16).toUpperCase()}`);
18869
18703
  } catch {
18870
18704
  throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0012({ message: `[vitehub] Markdown template link binding "{{ ${path} }}" must resolve to a safe destination.` });
@@ -18914,11 +18748,9 @@ async function renderMarkdownTemplate(template, options = {}) {
18914
18748
  async function renderMarkdownTemplateInternal(template, options = {}) {
18915
18749
  if (typeof template !== "string") throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0014({ message: "[vitehub] Markdown template must be a string." });
18916
18750
  const prepared = await prepareTemplate(template);
18917
- const parseOptions = {
18918
- ...parserOptions,
18919
- plugins: [...parserOptions.plugins, ...options.plugins ?? []]
18920
- };
18751
+ const parseOptions = templateParserOptions(options.plugins);
18921
18752
  const tree = await parseMarkdown(prepared.template, parseOptions);
18753
+ const bindingPositions = /* @__PURE__ */ new WeakMap();
18922
18754
  const data = snapshotTemplateData(options.data ?? {});
18923
18755
  const renderData = (state) => ({
18924
18756
  ...state.renderData,
@@ -18927,7 +18759,7 @@ async function renderMarkdownTemplateInternal(template, options = {}) {
18927
18759
  const renderAuthoredHtml = async (node, state, parent, childPolicy) => {
18928
18760
  const [tag, attrs, ...children] = node;
18929
18761
  const sanitized = await sanitizeUrlAttributes(tag, resolveScalarTemplateAttributes(attrs, renderData(state)), attrs, state.context.svg === true);
18930
- const escaped = Object.fromEntries(Object.entries(sanitized).map(([key, value]) => [key, typeof value === "string" ? escapeHtml$1(value) : value]));
18762
+ const escaped = Object.fromEntries(Object.entries(sanitized).map(([key, value]) => [key, typeof value === "string" ? value.replaceAll("&", "&amp;") : value]));
18931
18763
  const content = childPolicy === "markdown" && hasMarkdownHtmlChildren(node) ? (await parseMarkdown(children.join(""), parseOptions)).nodes : rawBlockTags.has(tag) && attrs.$?.block === 1 && typeof children[0] === "string" ? [children[0].replace(/^\r?\n/, ""), ...children.slice(1)] : children;
18932
18764
  const revert = state.applyContext({ svg: tag.toLowerCase() === "svg" || state.context.svg === true && tag.toLowerCase() !== "foreignobject" });
18933
18765
  try {
@@ -18945,7 +18777,8 @@ async function renderMarkdownTemplateInternal(template, options = {}) {
18945
18777
  };
18946
18778
  return prepared.restore((await renderMarkdown(tree, { components: {
18947
18779
  Binding: async (node, state, parent) => {
18948
- rejectLinkDestinationBinding(node, parent);
18780
+ if (typeof node[1][":value"] === "string") assertBindingRoot(node[1][":value"]);
18781
+ rejectLinkDestinationBinding(node, parent, bindingPositions);
18949
18782
  return state.one(resolveScalarTemplateBinding(node[1], renderData(state)), state, parent, true);
18950
18783
  },
18951
18784
  If: async (node, state, parent) => {
@@ -18962,7 +18795,7 @@ async function renderMarkdownTemplateInternal(template, options = {}) {
18962
18795
  if (typeof value !== "string") throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0020({ message: `[vitehub] Markdown template Insert markdown prop "${String(path ?? "markdown")}" must resolve to a string.` });
18963
18796
  const fragment = await parseMarkdown(value, {
18964
18797
  ...parseOptions,
18965
- plugins: [...htmlPlugins, ...options.plugins ?? []]
18798
+ plugins: templatePlugins(...htmlPlugins, ...options.plugins ?? [])
18966
18799
  });
18967
18800
  if (parent && (parent[0] === "p" || state.context.inline)) {
18968
18801
  if (!fragment.nodes.length) return "";
@@ -18999,26 +18832,30 @@ async function renderMarkdownTemplateInternal(template, options = {}) {
18999
18832
  }
19000
18833
  } })).trim());
19001
18834
  }
19002
- /**
19003
- * Comark does not parse `[label]({{ data.url }})` as a link. It keeps the brackets as text around the binding, and the
19004
- * output shows the escaped brackets and a bare URL. Reject that form and name the attribute syntax.
19005
- */
19006
- function rejectLinkDestinationBinding(node, parent) {
19007
- if (!parent) return;
19008
- const siblings = parent.slice(2);
19009
- const index = siblings.indexOf(node);
19010
- const before = siblings[index - 1];
19011
- const after = siblings[index + 1];
19012
- if (index < 1 || typeof before !== "string" || typeof after !== "string") return;
18835
+ function rejectLinkDestinationBinding(node, parent, positions) {
18836
+ if (!parent || parent.length < 5) return;
18837
+ let indexes = positions.get(parent);
18838
+ if (!indexes) {
18839
+ indexes = /* @__PURE__ */ new Map();
18840
+ for (let index = 2; index < parent.length; index++) {
18841
+ const child = parent[index];
18842
+ if (Array.isArray(child) && child[0] !== null && !indexes.has(child)) indexes.set(child, index);
18843
+ }
18844
+ positions.set(parent, indexes);
18845
+ }
18846
+ const index = indexes.get(node);
18847
+ if (index === void 0 || index < 3) return;
18848
+ const before = parent[index - 1];
18849
+ const after = parent[index + 1];
18850
+ if (typeof before !== "string" || typeof after !== "string") return;
19013
18851
  const destination = before.match(/\]\(\s*$/);
19014
18852
  if (!destination || !/^(?:\s+(?:"[\s\S]*"|'[\s\S]*'|\([\s\S]*\)))?\s*\)/.test(after)) return;
19015
- const text = siblings.slice(0, index).map((sibling) => typeof sibling === "string" ? sibling : "x").join("");
18853
+ const text = parent.slice(2, index).map((sibling) => typeof sibling === "string" ? sibling : "x").join("");
19016
18854
  const label = labelStart(text.slice(0, text.length - destination[0].length + 1));
19017
18855
  if (label === void 0 || text[label - 1] === "!") return;
19018
18856
  const path = String(node[1][":value"]);
19019
18857
  throw markdownTemplateErrorDiagnostics.MARKDOWN_TEMPLATE_R0033({ message: `[vitehub] Markdown template binding "{{ ${path} }}" cannot be a Markdown link destination. Use [label](){:href="${path}"}.` });
19020
18858
  }
19021
- /** Returns the matching unescaped opening `[` in the label text. */
19022
18859
  function labelStart(text) {
19023
18860
  let depth = 0;
19024
18861
  for (let index = text.length - 1; index >= 0; index--) {
@@ -19057,7 +18894,7 @@ async function sanitizeUrlAttributes(tag, props, source, svgContext = false) {
19057
18894
  const isUrl = urlAttributesByTag.get(tag.toLowerCase())?.has(attribute) || (attribute === "href" || attribute === "xlink:href") && (svgUrlAttributes.has(tag.toLowerCase()) || tag.toLowerCase() === "img" && svgContext);
19058
18895
  if (typeof value !== "string" || !isUrl) continue;
19059
18896
  const binding = source[`:${key}`];
19060
- sanitized[key] = await safeLinkDestination(value, String(binding ?? key), { decodeHtmlEntities: binding === void 0 });
18897
+ sanitized[key] = await safeLinkDestination(value, String(binding ?? key), { decoded: binding === void 0 });
19061
18898
  }
19062
18899
  return sanitized;
19063
18900
  }
@@ -19103,8 +18940,11 @@ function conditionalBranches(node) {
19103
18940
  after
19104
18941
  };
19105
18942
  }
19106
- //#endregion
19107
- //#region ../markdown-template/dist/vite-BGJ4jHJz.js
18943
+ [.../* @__PURE__ */ new Set([
18944
+ "if",
18945
+ "else-if",
18946
+ "else"
18947
+ ])];
19108
18948
  function parseMarkdownTemplateRequest(id) {
19109
18949
  if (id.includes("#")) return;
19110
18950
  const queryIndex = id.indexOf("?");
@@ -19113,8 +18953,7 @@ function parseMarkdownTemplateRequest(id) {
19113
18953
  if (id.slice(queryIndex + 1) !== "markdown-template") return;
19114
18954
  return { path };
19115
18955
  }
19116
- //#endregion
19117
- //#region ../internal/src/contributions.ts
18956
+ // ../internal/src/contributions.ts
19118
18957
  const unnamedPlugin = "unnamed plugin";
19119
18958
  function isNonEmptyString(value) {
19120
18959
  return String(value) === value && value.length > 0;
@@ -19152,6 +18991,10 @@ async function collectContributions(plugins, options) {
19152
18991
  const candidates = [];
19153
18992
  await flattenPlugins(plugins ?? [], candidates, /* @__PURE__ */ new Set());
19154
18993
  const collected = /* @__PURE__ */ new Map();
18994
+ const context = {
18995
+ ...options.context,
18996
+ plugins: candidates
18997
+ };
19155
18998
  for (const plugin of candidates) {
19156
18999
  if (!Object.hasOwn(plugin, "vitehub")) continue;
19157
19000
  const metadata = Reflect.get(plugin, "vitehub");
@@ -19163,7 +19006,7 @@ async function collectContributions(plugins, options) {
19163
19006
  throw options.invalid(`[vitehub] Plugin ${JSON.stringify(contributor)} contributed an invalid ${options.kind}: ${reason}`);
19164
19007
  };
19165
19008
  const callable = typeof source === "function";
19166
- const entries = callable ? await Reflect.apply(source, void 0, [options.context]) : source;
19009
+ const entries = callable ? await Reflect.apply(source, void 0, [context]) : source;
19167
19010
  if (entries === void 0 && callable) continue;
19168
19011
  if (!Array.isArray(entries)) fail(`\`vitehub.${options.key}\` must be an array or a function that returns one.`);
19169
19012
  const list = entries;
@@ -19215,8 +19058,7 @@ function readContribution(entry, plugin, options, fail) {
19215
19058
  ...base
19216
19059
  };
19217
19060
  }
19218
- //#endregion
19219
- //#region src/build/contributions.ts
19061
+ // src/build/contributions.ts
19220
19062
  /**
19221
19063
  * Collects `vitehub.workspaces` contributions from Vite plugins. Invalid entries fail with `WORKSPACE_B0004`. Two
19222
19064
  * contributions with one name fail with `WORKSPACE_B0003`.
@@ -19230,8 +19072,7 @@ async function collectWorkspaceContributions(plugins, context) {
19230
19072
  kind: "Workspace"
19231
19073
  });
19232
19074
  }
19233
- //#endregion
19234
- //#region src/build/workspace-config.ts
19075
+ // src/build/workspace-config.ts
19235
19076
  const workspaceSuffixPattern = /\.workspace\.(?:c|m)?[jt]s$/i;
19236
19077
  const workspaceConfigPattern = /^config\.(?:c|m)?[jt]s$/i;
19237
19078
  const workspaceAgentPattern = /^agent\.(?:c|m)?[jt]s$/i;
@@ -19243,8 +19084,7 @@ const workspaceConfigFileNames = [
19243
19084
  "config.mjs",
19244
19085
  "config.cjs"
19245
19086
  ];
19246
- //#endregion
19247
- //#region src/build/registry-source.injected.ts
19087
+ // src/build/registry-source.injected.ts
19248
19088
  /**
19249
19089
  * The registry line that rejects a contributed Workspace module without its definition export. It is source text of the
19250
19090
  * generated registry module, which runs in the app and does not import the Workspace catalog.
@@ -19252,8 +19092,7 @@ const workspaceConfigFileNames = [
19252
19092
  function missingDefinitionExportCheck(message) {
19253
19093
  return ` if (!definition) throw new TypeError(${JSON.stringify(message)})`;
19254
19094
  }
19255
- //#endregion
19256
- //#region src/build/discovery.ts
19095
+ // src/build/discovery.ts
19257
19096
  /** Discovery source label of definitions that a Vite plugin contributes. */
19258
19097
  const contributedWorkspaceSource = "vite-plugin-contribution";
19259
19098
  const configFileNameSet = new Set(workspaceConfigFileNames);
@@ -19453,8 +19292,7 @@ function createWorkspaceVirtualRegistryContents(definitions) {
19453
19292
  async function createWorkspaceManifest(definitions) {
19454
19293
  return { workspaces: definitions.map((definition) => ({ name: definition.name })) };
19455
19294
  }
19456
- //#endregion
19457
- //#region src/build/assets.ts
19295
+ // src/build/assets.ts
19458
19296
  function shouldBundleWorkspaceAssets(assets, name) {
19459
19297
  return assets === void 0 || assets === true || Array.isArray(assets) && assets.includes(name);
19460
19298
  }
@@ -19714,8 +19552,7 @@ function createWorkspaceAssetsRegistryContents(registryFile, bundles, modulePath
19714
19552
  ""
19715
19553
  ].join("\n");
19716
19554
  }
19717
- //#endregion
19718
- //#region src/build/integration.ts
19555
+ // src/build/integration.ts
19719
19556
  async function refreshWorkspaceBuildState(root, definitions) {
19720
19557
  const state = {
19721
19558
  manifest: await createWorkspaceManifest(definitions),
@@ -19747,8 +19584,7 @@ function createWorkspaceTypeAugmentation(definitions) {
19747
19584
  ""
19748
19585
  ].join("\n");
19749
19586
  }
19750
- //#endregion
19751
- //#region src/checkout-cli.ts
19587
+ // src/checkout-cli.ts
19752
19588
  const valueFlags = /* @__PURE__ */ new Set([
19753
19589
  "dir",
19754
19590
  "message",
@@ -19976,8 +19812,7 @@ function workspaceCheckoutFeatures() {
19976
19812
  }
19977
19813
  ];
19978
19814
  }
19979
- //#endregion
19980
- //#region src/hooks-cli.ts
19815
+ // src/hooks-cli.ts
19981
19816
  const exec = promisify(execFile);
19982
19817
  const marker = "# Installed by `vitehub hooks install`.";
19983
19818
  const hookNames = ["pre-commit", "pre-push"];
@@ -20298,8 +20133,7 @@ function workspaceHooksNamespace(options = {}) {
20298
20133
  name: "hooks"
20299
20134
  };
20300
20135
  }
20301
- //#endregion
20302
- //#region src/cli.ts
20136
+ // src/cli.ts
20303
20137
  const workspaceDevEndpoint = {
20304
20138
  header: workspaceDevHeader,
20305
20139
  headerValue: "1",
@@ -20581,8 +20415,7 @@ function createWorkspaceCliContributor() {
20581
20415
  workspaceHooksNamespace()
20582
20416
  ] };
20583
20417
  }
20584
- //#endregion
20585
- //#region src/inspect.ts
20418
+ // src/inspect.ts
20586
20419
  function workspaceDefinitionKind(definition) {
20587
20420
  if (definition.source === "server-agent-workspaces") return "Agent workspace";
20588
20421
  if (definition.source === "vite-plugin-contribution") return "Contributed Workspace Definition";
@@ -20640,15 +20473,13 @@ const workspaceConsoleSection = {
20640
20473
  notice: "Workspace files, Sources, collections, sync state, and processes are not opened or initialized by this build-time catalog."
20641
20474
  }
20642
20475
  };
20643
- //#endregion
20644
- //#region ../internal/src/arrays.ts
20476
+ // ../internal/src/arrays.ts
20645
20477
  function pushUnique(arr, item, key = (value) => value) {
20646
20478
  const id = key(item);
20647
20479
  if (arr.some((entry) => key(entry) === id)) return;
20648
20480
  arr.push(item);
20649
20481
  }
20650
- //#endregion
20651
- //#region src/integrations/cloudflare.ts
20482
+ // src/integrations/cloudflare.ts
20652
20483
  function configureCloudflareArtifacts(target, config) {
20653
20484
  if (!config) return;
20654
20485
  const store = config.store;
@@ -20664,8 +20495,7 @@ function configureCloudflareArtifacts(target, config) {
20664
20495
  if (existing && existing.namespace !== artifact.namespace) throw workspaceErrorDiagnostics.WORKSPACE_R0029({ message: `[vitehub] Cloudflare Artifacts binding "${artifact.binding}" cannot use both namespace "${existing.namespace}" and "${artifact.namespace}". Configure a unique binding for each namespace.` });
20665
20496
  pushUnique(target.cloudflare.wrangler.artifacts, artifact, (entry) => entry.binding);
20666
20497
  }
20667
- //#endregion
20668
- //#region src/hosts/vite/plugin.ts
20498
+ // src/hosts/vite/plugin.ts
20669
20499
  const WORKSPACE_PACKAGE_NAME = "@vite-hub/workspace";
20670
20500
  const WORKSPACES_ID = "#vitehub/workspaces";
20671
20501
  const WORKSPACE_PREFIX = "#vitehub/workspaces/";
@@ -20680,6 +20510,8 @@ const WORKSPACE_LOAD_ID_PATTERN = /(?:^\0#vitehub(?:-workspace-registry$|\/works
20680
20510
  const generatedNitroWorkspacePlugin = ".vitehub/nitro/workspace/plugin.ts";
20681
20511
  const generatedNitroWorkspaceRegistry = ".vitehub/nitro/workspace/registry.js";
20682
20512
  const generatedNitroWorkspaceDurabilityRegistry = ".vitehub/nitro/workspace/durability-registry.js";
20513
+ const generatedNitroWorkspaceDurabilityFallback = ".vitehub/nitro/workspace/durability-fallback.js";
20514
+ const generatedNitroWorkspaceDurabilityLoader = ".vitehub/nitro/workspace/durability-loader.js";
20683
20515
  const cloudflareArtifactsBindingsFileName = ".vitehub-workspace-artifacts-bindings.json";
20684
20516
  const noExternalAddition = createNoExternalAddition(WORKSPACE_PACKAGE_NAME);
20685
20517
  const workspacesDirSegment = /[\\/](?:server[\\/])?workspaces(?:[\\/]|$)/;
@@ -21079,7 +20911,32 @@ function shouldInstallNitroWorkspacePlugin(config, options, normalized, definiti
21079
20911
  }
21080
20912
  function mergeNitroWorkspaceConfig(value, root, dev) {
21081
20913
  const kit = createNitroServerKit(isRecord(value) ? { ...value } : {});
21082
- kit.addPlugin(resolve(root, generatedNitroWorkspacePlugin), dev ? "start" : "end");
20914
+ const pluginFile = resolve(root, generatedNitroWorkspacePlugin);
20915
+ kit.addPlugin(pluginFile, dev ? "start" : "end");
20916
+ if (!dev) {
20917
+ const modules = Array.isArray(kit.config.modules) ? kit.config.modules : [];
20918
+ kit.config.modules = [...modules, {
20919
+ name: "vitehub-workspace-durability-registry",
20920
+ setup({ options }) {
20921
+ if (!options.plugins.some((file) => file.replaceAll("\\", "/").endsWith("/.vitehub/nitro/durability/plugin.mjs"))) return;
20922
+ const registry = resolve(root, generatedNitroWorkspaceDurabilityRegistry);
20923
+ const fallback = resolve(root, generatedNitroWorkspaceDurabilityFallback);
20924
+ const importerFile = pluginFile.replaceAll("\\", "/");
20925
+ const registryImport = moduleImportSpecifier(pluginFile, resolve(root, generatedNitroWorkspaceRegistry));
20926
+ const plugin = {
20927
+ name: "vitehub-workspace-durability-registry",
20928
+ resolveId: {
20929
+ order: "pre",
20930
+ handler(id, importer) {
20931
+ if (id === WORKSPACE_REGISTRY_ID) return fallback;
20932
+ if (id === registryImport && importer === importerFile) return registry;
20933
+ }
20934
+ }
20935
+ };
20936
+ options.buildPlugins = [...options.buildPlugins, plugin];
20937
+ }
20938
+ }];
20939
+ }
21083
20940
  kit.addHandler({
21084
20941
  handler: ownModule(import.meta.url, "runtime/request"),
21085
20942
  middleware: true
@@ -21206,6 +21063,16 @@ async function writeNitroWorkspacePlugin(root, config, options, definitions, clo
21206
21063
  await writeFileIfChanged(registryFile, createWorkspaceRegistryContents(registryFile, definitions, definitionOverrides));
21207
21064
  const durabilityRegistryFile = resolve(root, generatedNitroWorkspaceDurabilityRegistry);
21208
21065
  await writeFileIfChanged(durabilityRegistryFile, createWorkspaceRegistryContents(durabilityRegistryFile, definitions, definitionOverrides, true));
21066
+ const fallbackFile = resolve(root, generatedNitroWorkspaceDurabilityFallback);
21067
+ const loaderFile = resolve(root, generatedNitroWorkspaceDurabilityLoader);
21068
+ const names = JSON.stringify(definitions.map((definition) => definition.name));
21069
+ await writeFileIfChanged(loaderFile, `export { default } from ${JSON.stringify(moduleImportSpecifier(loaderFile, durabilityRegistryFile))}\n`);
21070
+ await writeFileIfChanged(fallbackFile, [
21071
+ `const names = ${names}`,
21072
+ `const loadRegistry = () => import(${JSON.stringify(moduleImportSpecifier(fallbackFile, loaderFile))})`,
21073
+ "export default Object.fromEntries(names.map(name => [name, async () => (await loadRegistry()).default[name]()]))",
21074
+ ""
21075
+ ].join("\n"));
21209
21076
  await writeFileIfChanged(pluginFile, renderNitroWorkspacePlugin(runtimeConfig, moduleImportSpecifier(pluginFile, registryFile), resolveNitroHostedStoreProviders(runtimeConfig, definitions.length, storeUsage), cloudflareRuntime));
21210
21077
  }
21211
21078
  async function createWorkspaceNitroConfig(options = {}) {
@@ -21254,7 +21121,7 @@ function stripWorkspaceInternalOptions(options) {
21254
21121
  return publicOptions;
21255
21122
  }
21256
21123
  function hubWorkspace(options) {
21257
- const packageLoading = createNativePackageLoading();
21124
+ const packageLoading = createNativePackageLoading([import.meta.resolve(WORKSPACE_PACKAGE_NAME)]);
21258
21125
  const internalOptions = options;
21259
21126
  let hosting = internalOptions ? internalOptions.hosting : void 0;
21260
21127
  const publicOptions = stripWorkspaceInternalOptions(options);
@@ -21279,13 +21146,12 @@ function hubWorkspace(options) {
21279
21146
  }
21280
21147
  function invalidateVirtualWorkspaceModules() {
21281
21148
  if (!server) return;
21282
- const moduleGraph = server.moduleGraph;
21283
21149
  const ids = [
21284
21150
  RESOLVED_WORKSPACE_REGISTRY_ID,
21285
21151
  RESOLVED_WORKSPACES_ID,
21286
21152
  ...manifest.workspaces.map((w) => `${RESOLVED_WORKSPACE_PREFIX}${w.name}`)
21287
21153
  ];
21288
- for (const id of ids) {
21154
+ for (const { moduleGraph } of Object.values(server.environments)) for (const id of ids) {
21289
21155
  const mod = moduleGraph.getModuleById(id);
21290
21156
  if (mod) moduleGraph.invalidateModule(mod);
21291
21157
  }
@@ -21390,7 +21256,7 @@ function hubWorkspace(options) {
21390
21256
  if (!isServerEnvironment(name, config)) return;
21391
21257
  return { resolve: {
21392
21258
  dedupe: dedupeAddition(config.resolve?.dedupe),
21393
- ...packageLoading.configureEnvironment(name, env) ? {} : { noExternal: noExternalAddition(config.resolve?.noExternal) }
21259
+ ...packageLoading.configureEnvironment(name, env, config) ? {} : { noExternal: noExternalAddition(config.resolve?.noExternal) }
21394
21260
  } };
21395
21261
  },
21396
21262
  async buildStart() {
@@ -21418,12 +21284,11 @@ function hubWorkspace(options) {
21418
21284
  providerOutputGenerations.defer(this, providerOutput, {
21419
21285
  owner: "workspace",
21420
21286
  rootDir: roots.projectRoot,
21421
- write: async ({ readCloudflareState, signal, write }) => {
21287
+ write: async ({ addVercelRuntimePackages, readCloudflareState, write }) => {
21422
21288
  const definitions = discoverDefinitions(roots, serverDirs, contributions);
21423
- await copyVercelFunctionRuntimePackages({
21289
+ addVercelRuntimePackages({
21424
21290
  packages: vercelFunctionRuntimePackages(),
21425
- rootDir: roots.projectRoot,
21426
- signal
21291
+ rootDir: roots.projectRoot
21427
21292
  });
21428
21293
  await writeCloudflareArtifactsProviderOutput(roots.projectRoot, resolved.build?.outDir ?? "dist/client", workspaceOptions, definitions, readCloudflareState, write, resolved.resolve ? workspaceDefinitionLoaderAliases(resolved.resolve.alias) : void 0);
21429
21294
  }
@@ -21550,7 +21415,7 @@ function hubWorkspace(options) {
21550
21415
  }
21551
21416
  },
21552
21417
  load: {
21553
- filter: { id: WORKSPACE_LOAD_ID_PATTERN },
21418
+ filter: { id: new RegExp(`${WORKSPACE_LOAD_ID_PATTERN.source}|/vitehub-grants(?:-[\\w-]+)?\\.js$`) },
21554
21419
  handler(id) {
21555
21420
  if (id === RESOLVED_WORKSPACE_REGISTRY_ID) return registryContents;
21556
21421
  if (id === RESOLVED_WORKSPACES_ID) return `export const workspaces = ${JSON.stringify(manifest.workspaces)};\nexport default { workspaces };\n`;
@@ -21570,5 +21435,4 @@ function hubWorkspace(options) {
21570
21435
  }
21571
21436
  };
21572
21437
  }
21573
- //#endregion
21574
21438
  export { collectWorkspaceContributions, createWorkspaceNitroConfig, discoverViteWorkspaceDefinitions, hubWorkspace, inspectWorkspaceDefinitions, workspaceConsoleSection };