@vite-hub/workspace 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/{abort-BCwpdrN0.js → abort-CQGxJBqa.js} +1 -2
  2. package/dist/{asset-registry-DfBV5kmw.js → asset-registry-0CdRAjIV.js} +2 -3
  3. package/dist/blob-database/postgres.d.ts +2 -3
  4. package/dist/blob-database/postgres.js +1 -2
  5. package/dist/{blob-database-sources-DDZ1wV9w.js → blob-database-sources-CQPAyCz3.js} +1 -2
  6. package/dist/blob-database.d.ts +2 -8
  7. package/dist/blob-database.js +12 -15
  8. package/dist/checkout.d.ts +1 -2
  9. package/dist/checkout.js +3 -4
  10. package/dist/cloudflare.d.ts +1 -5
  11. package/dist/cloudflare.js +1 -2
  12. package/dist/{config-B-863EgC.js → config-CsgNNVAI.js} +1 -2
  13. package/dist/{config-hxABr_Gg.d.ts → config-DeA287c0.d.ts} +1 -5
  14. package/dist/{config-DiyPi3Ff.js → config-jo5QgE1w.js} +18 -27
  15. package/dist/{discard-CNNtCozM.js → discard-BkoLmmmN.js} +1 -2
  16. package/dist/durability.d.ts +2 -5
  17. package/dist/durability.js +4 -5
  18. package/dist/{error-diagnostics-Cth97txN.js → error-diagnostics-B4me-ouV.js} +1 -2
  19. package/dist/{error-diagnostics-C0KyI408.js → error-diagnostics-kKXseq8d.js} +5 -2
  20. package/dist/{errors-DXCZjdUU.d.ts → errors-CnFDXxeJ.d.ts} +0 -2
  21. package/dist/{file-C1DYoGz3.js → file-BrNAXQgY.js} +4 -8
  22. package/dist/{file-metadata-Dv2JZwal.js → file-metadata-Bpsvjw_X.js} +2 -3
  23. package/dist/{files-iHyik8jj.js → files--z2dLC5z.js} +3 -4
  24. package/dist/files.d.ts +6 -10
  25. package/dist/files.js +6 -6
  26. package/dist/{github-CFHl6RI0.js → github-k--_LCrX.js} +7 -9
  27. package/dist/{glob-BitxqDhb.js → glob-BEutagp1.js} +3 -4
  28. package/dist/{glob-Buxfvmyy.js → glob-BreFjNAV.js} +3 -4
  29. package/dist/{history-schema-BBWbpDk4.d.ts → history-schema-BR4UDPHL.d.ts} +0 -2
  30. package/dist/{history-schema-postgres-U_ueRvmO.js → history-schema-postgres-DZepCSBq.js} +0 -1
  31. package/dist/{host-Dmr2Ctem.js → host-C8yZizfk.js} +11 -14
  32. package/dist/{hosted-BktlvkF2.js → hosted-8BTKAtMX.js} +15 -18
  33. package/dist/{hosted-vercel-blob-D0IPAjb1.js → hosted-vercel-blob-B6kygYqn.js} +10 -12
  34. package/dist/hosted-vercel-blob.d.ts +1 -3
  35. package/dist/hosted-vercel-blob.js +1 -2
  36. package/dist/hosted.d.ts +1 -3
  37. package/dist/hosted.js +1 -2
  38. package/dist/index.d.ts +7 -25
  39. package/dist/index.js +18 -22
  40. package/dist/internal/path.d.ts +1 -1
  41. package/dist/internal/path.js +1 -2
  42. package/dist/internal/workspace.d.ts +1 -5
  43. package/dist/internal/workspace.js +2 -3
  44. package/dist/{lifecycle-D6WN2dd_.js → lifecycle-IReZfi0b.js} +9 -10
  45. package/dist/lineage.d.ts +1 -3
  46. package/dist/lineage.js +1 -2
  47. package/dist/loader.d.ts +1 -7
  48. package/dist/loader.js +4 -6
  49. package/dist/{mcp-resources-TtxLNSL6.js → mcp-resources-DeJnbOaw.js} +4 -5
  50. package/dist/{memory-DjzwSng2.js → memory-BlSRrBH1.js} +7 -9
  51. package/dist/{metadata-target-CR0aDtvS.js → metadata-target-CaGLY4ay.js} +15 -23
  52. package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
  53. package/dist/{operation-definition-CI2PJGqu.d.ts → operation-definition-CqZkx1Rm.d.ts} +0 -4
  54. package/dist/{operations-Cib30_dt.js → operations-BIaK_uYG.js} +7 -8
  55. package/dist/{operations-dtcU5LkD.js → operations-DS1C4uXd.js} +22 -29
  56. package/dist/operations.d.ts +2 -6
  57. package/dist/operations.js +2 -2
  58. package/dist/{path-BlIBpI7U.js → path-Bb9OIc_F.js} +2 -3
  59. package/dist/{path-zHxQUbqa.d.ts → path-C0uZxDdW.d.ts} +0 -2
  60. package/dist/{path-DrSIenjj.js → path-CuYE8-X6.js} +2 -4
  61. package/dist/{plugins-DKCBrH31.d.ts → plugins-CLc32jvL.d.ts} +1 -3
  62. package/dist/{provider-Fc3M6bEx.js → provider-CN14ewvx.js} +15 -20
  63. package/dist/providers/github/store.d.ts +2 -4
  64. package/dist/providers/github/store.js +1 -2
  65. package/dist/{registry-DpB5PBA4.d.ts → registry-B0g19sdy.d.ts} +1 -5
  66. package/dist/{registry-CedQvQxW.js → registry-BbUg9vJB.js} +4 -5
  67. package/dist/{registry-CLL0TY0L.d.ts → registry-s2Ob9PeX.d.ts} +2 -4
  68. package/dist/{request-scope-Bcv2kD8h.js → request-scope-CXCI_wCb.js} +2 -3
  69. package/dist/{results-DgkZUmTL.js → results-z-HpV9EP.js} +1 -2
  70. package/dist/{rolldown-runtime-rQ84J-ij.js → rolldown-runtime-DnNXxpGL.js} +2 -3
  71. package/dist/{rule-keys-Bsz6jTTF.js → rule-keys-BLEbi1h5.js} +2 -3
  72. package/dist/{rules-OHaPFopX.js → rules-BPDXypZV.js} +6 -8
  73. package/dist/runtime/assets.d.ts +2 -3
  74. package/dist/runtime/assets.js +5 -6
  75. package/dist/runtime/empty-assets-registry.d.ts +1 -3
  76. package/dist/runtime/empty-assets-registry.js +1 -2
  77. package/dist/runtime/empty-registry.d.ts +2 -4
  78. package/dist/runtime/empty-registry.js +1 -2
  79. package/dist/runtime/registry.d.ts +1 -1
  80. package/dist/runtime/registry.js +2 -3
  81. package/dist/runtime/request.d.ts +1 -3
  82. package/dist/runtime/request.js +2 -3
  83. package/dist/runtime/state.d.ts +5 -5
  84. package/dist/runtime/state.js +9 -10
  85. package/dist/runtime/workspace.d.ts +1 -1
  86. package/dist/runtime/workspace.js +1 -2
  87. package/dist/runtime.d.ts +8 -24
  88. package/dist/runtime.js +21 -24
  89. package/dist/{search-BqNV9LnO.js → search-C_nVorq7.js} +3 -4
  90. package/dist/{server-CFtrOPk6.js → server-aa1a4rkV.js} +8 -10
  91. package/dist/server.d.ts +3 -4
  92. package/dist/server.js +1 -2
  93. package/dist/{shared-BgDjxY3J.js → shared-C20Wh1mp.js} +12 -19
  94. package/dist/source-metadata.d.ts +2 -6
  95. package/dist/source-metadata.js +4 -5
  96. package/dist/{state-DBV6VHS6.d.ts → state-BdDfBtOR.d.ts} +5 -15
  97. package/dist/{store-BRMdD8Ft.js → store-cx3OqNTi.js} +11 -14
  98. package/dist/{sync-BezGVzrW.js → sync-BBfR4g5y.js} +6 -7
  99. package/dist/test.d.ts +1 -1
  100. package/dist/test.js +1 -2
  101. package/dist/{types-9DMtFjaa.d.ts → types-Bel5IDmF.d.ts} +0 -2
  102. package/dist/{use-Dv973swc.d.ts → use-CpphIBof.d.ts} +1 -5
  103. package/dist/{use-Dm2tbI5F.js → use-D0DyTMxM.js} +12 -14
  104. package/dist/{use-tools-CMUthOdy.d.ts → use-tools-CAK10LTc.d.ts} +2 -4
  105. package/dist/{use-tools-C1qvhzme.js → use-tools-CHduR5k6.js} +7 -10
  106. package/dist/{utils-C0Au2R16.js → utils-DXP9xfXo.js} +7 -9
  107. package/dist/vite.d.ts +3 -21
  108. package/dist/vite.js +574 -409
  109. package/dist/{vitehub-grants-C8IAl5-M.js → vitehub-grants-Co713QTg.js} +2 -4
  110. package/dist/{workspace-Cw4ycIW-.d.ts → workspace-BOuxrZrP.d.ts} +1 -3
  111. package/dist/{workspace-CFrwWhEm.js → workspace-CLuPkyZR.js} +26 -35
  112. package/package.json +24 -24
package/dist/vite.js CHANGED
@@ -1,18 +1,18 @@
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-DjzwSng2.js";
3
- import { t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
4
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Cth97txN.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-DS1C4uXd.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-C0KyI408.js";
8
- import { n as isWorkspaceStore, r as normalizeWorkspaceStoreOptions } from "./provider-Fc3M6bEx.js";
9
- import { i as installHostedWorkspaceRuntime } from "./hosted-BktlvkF2.js";
10
- import { a as normalizeWorkspaceSources, n as createSourceContext } from "./config-DiyPi3Ff.js";
11
- import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-CedQvQxW.js";
12
- import { n as installHostedVercelBlobWorkspaceRuntime } from "./hosted-vercel-blob-D0IPAjb1.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-dtcU5LkD.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-CFtrOPk6.js";
15
- import { n as syncWorkspaceDefinition } from "./lifecycle-D6WN2dd_.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";
@@ -27,7 +27,7 @@ import { promisify } from "node:util";
27
27
  import { resolveModulePath } from "exsolve";
28
28
  import { createJiti } from "jiti";
29
29
  import { execFile } from "node:child_process";
30
- //#region src/config.ts
30
+ // src/config.ts
31
31
  const workspaceConfigKeys = /* @__PURE__ */ new Set([
32
32
  "assets",
33
33
  "projectRoot",
@@ -48,8 +48,7 @@ function normalizeWorkspaceOptions(options, input = {}) {
48
48
  store: normalizeWorkspaceStoreOptions(resolvedOptions.store, input) || { driver: "local" }
49
49
  };
50
50
  }
51
- //#endregion
52
- //#region ../internal/src/invariant.ts
51
+ // ../internal/src/invariant.ts
53
52
  const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
54
53
  docsBase: "https://vitehub.dev/docs/development/diagnostics",
55
54
  codes: { INTERNAL_INVARIANT_FAILED: {
@@ -68,8 +67,7 @@ function invariantError(what) {
68
67
  function invariant(condition, what) {
69
68
  if (!condition) throw invariantError(what);
70
69
  }
71
- //#endregion
72
- //#region ../internal/src/build/client-output.ts
70
+ // ../internal/src/build/client-output.ts
73
71
  function hasStaticIndex(clientDir) {
74
72
  return existsSync(resolve$1(clientDir, "index.html"));
75
73
  }
@@ -106,8 +104,7 @@ async function copyClientOutput(clientDir, targetDir, excludedDirs = []) {
106
104
  filter
107
105
  });
108
106
  }
109
- //#endregion
110
- //#region ../internal/src/build/provider-output-config.ts
107
+ // ../internal/src/build/provider-output-config.ts
111
108
  function isProviderJsonArray(value, ancestors) {
112
109
  if (Object.getPrototypeOf(value) !== Array.prototype || ancestors.has(value)) return false;
113
110
  if (Reflect.ownKeys(value).length !== value.length + 1) return false;
@@ -245,13 +242,11 @@ async function cleanProviderOutputConfig(file, ownership) {
245
242
  if (!changed) return;
246
243
  await persistProviderJsonRecord(file, next, true);
247
244
  }
248
- //#endregion
249
- //#region ../internal/src/build/user-entry.ts
245
+ // ../internal/src/build/user-entry.ts
250
246
  function toSafeAppName(rootDir) {
251
247
  return basename(rootDir).replace(/[^a-z0-9-]+/gi, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").toLowerCase();
252
248
  }
253
- //#endregion
254
- //#region ../internal/src/build/cloudflare.ts
249
+ // ../internal/src/build/cloudflare.ts
255
250
  function createDefaultCloudflareOutputRoot(rootDir) {
256
251
  return resolve(rootDir, "dist", toSafeAppName(rootDir));
257
252
  }
@@ -268,21 +263,23 @@ async function writeCloudflareWranglerConfig(options) {
268
263
  removeIfEmpty: true
269
264
  });
270
265
  }
271
- //#endregion
272
- //#region ../internal/src/build/bundle-options.ts
266
+ // ../internal/src/build/bundle-options.ts
273
267
  const encodedAliasPrefixMarker = "\0vitehub-prefix:";
274
268
  const encodedAliasExactMarker = "\0vitehub-exact:";
275
269
  /** Select the runtime constants from one resolved Vite configuration. */
276
270
  function resolveViteHubBundleDefines(config) {
277
271
  const defines = {};
278
- for (const name of ["__VITEHUB_PUBLIC_URL__", "__VITEHUB_APP_BASE_URL__"]) {
272
+ for (const name of [
273
+ "__VITEHUB_PUBLIC_URL__",
274
+ "__VITEHUB_APP_BASE_URL__",
275
+ "__VITEHUB_CONSOLE_URL__"
276
+ ]) {
279
277
  const value = config.define?.[name];
280
278
  if (typeof value === "string") defines[name] = value;
281
279
  }
282
280
  return defines;
283
281
  }
284
- //#endregion
285
- //#region ../internal/src/build/ast-walk.ts
282
+ // ../internal/src/build/ast-walk.ts
286
283
  /** The oxc parser grammar for a file, from its extension. Defaults to TypeScript. */
287
284
  function moduleLanguage(file) {
288
285
  if (/\.(?:c|m)?tsx$/i.test(file)) return "tsx";
@@ -305,8 +302,7 @@ function walk(node, visit, parent) {
305
302
  } else if (isNode(child)) walk(child, visit, node);
306
303
  }
307
304
  }
308
- //#endregion
309
- //#region ../internal/src/build/rolldown.ts
305
+ // ../internal/src/build/rolldown.ts
310
306
  const viteRawPrefix = "\0vitehub-vite-raw:";
311
307
  const markdownTemplatePrefix = "\0vitehub-markdown-template:";
312
308
  const markdownTemplateFileSuffix = ".template.md";
@@ -672,20 +668,20 @@ function createFileUrlPlugin() {
672
668
  }
673
669
  };
674
670
  }
675
- /**
676
- * Copies a `.wasm?module` import next to the bundle and keeps it as a relative `.wasm` import. Wrangler and Nitro load
677
- * such an import as a compiled WebAssembly module, which Workers need because they can't compile WebAssembly bytes.
678
- * Node.js compiles WebAssembly bytes, so there the import becomes the bytes of the file.
679
- */
680
671
  function createWasmModulePlugin(outdir, workingDir, copy) {
681
672
  return {
682
673
  name: "vitehub-wasm-module",
683
674
  async resolveId(source, importer, extra) {
684
- if (!source.endsWith(".wasm?module")) return;
685
- const resolved = await this.resolve(source.slice(0, -7), importerFor(importer, workingDir), {
675
+ const explicitModule = source.endsWith(".wasm?module");
676
+ if (!explicitModule && (!copy || !source.endsWith(".wasm") || extra.custom?.[skipMarkdownTemplateResolve])) return;
677
+ const path = explicitModule ? source.slice(0, -7) : source;
678
+ const resolved = await this.resolve(path, importerFor(importer, workingDir), {
686
679
  custom: extra.custom,
687
- kind: extra.kind
680
+ isEntry: extra.isEntry,
681
+ kind: extra.kind,
682
+ skipSelf: true
688
683
  });
684
+ if (!explicitModule && (!isFileResolution(resolved) || !resolved.id.endsWith(".wasm"))) return resolved ?? void 0;
689
685
  if (!isFileResolution(resolved)) this.error(`[vitehub] Could not resolve ${JSON.stringify(source)}.`);
690
686
  if (!copy) return resolved.id;
691
687
  const bytes = await readFile(resolved.id);
@@ -903,8 +899,7 @@ async function bundleEsmEntry(entryFile, outfile, options = {}) {
903
899
  await writeFile(outfile, chunk.code, { signal: options.signal });
904
900
  options.signal?.throwIfAborted();
905
901
  }
906
- //#endregion
907
- //#region ../internal/src/build/paths.ts
902
+ // ../internal/src/build/paths.ts
908
903
  function resolveRuntimeModule(packageDir, modulePath) {
909
904
  const distFile = resolve$1(packageDir, "dist", `${modulePath}.js`);
910
905
  return existsSync(distFile) ? distFile : resolve$1(packageDir, "src", `${modulePath}.ts`);
@@ -944,8 +939,7 @@ function realpathIfExists(path) {
944
939
  return resolve$1(path);
945
940
  }
946
941
  }
947
- //#endregion
948
- //#region ../internal/src/build/runtime-package-files.ts
942
+ // ../internal/src/build/runtime-package-files.ts
949
943
  const alwaysPublishedFile = /^(?:package\.json|(?:readme|copying|licen[cs]e)(?:\..*[^~$])?)$/i;
950
944
  const rootExcluded = /* @__PURE__ */ new Set([
951
945
  "package-lock.json",
@@ -1104,8 +1098,7 @@ async function copyRuntimePackageFiles(packageDir, targetDir) {
1104
1098
  await unlessGone(() => copyFile(join(packageDir, path), target));
1105
1099
  }
1106
1100
  }
1107
- //#endregion
1108
- //#region ../internal/src/build/provider-output-sources.ts
1101
+ // ../internal/src/build/provider-output-sources.ts
1109
1102
  /** Removes retained provider output after readers release it, tolerating transient filesystem contention. */
1110
1103
  async function removeProviderOutputArtifactDir(path) {
1111
1104
  await rm(path, {
@@ -1115,8 +1108,7 @@ async function removeProviderOutputArtifactDir(path) {
1115
1108
  retryDelay: 50
1116
1109
  });
1117
1110
  }
1118
- //#endregion
1119
- //#region ../internal/src/build/vercel-config.ts
1111
+ // ../internal/src/build/vercel-config.ts
1120
1112
  function createDefaultVercelOutputRoot(rootDir) {
1121
1113
  return resolve(rootDir, ".vercel", "output");
1122
1114
  }
@@ -1139,8 +1131,7 @@ function createNodeFunctionConfig(extra = {}) {
1139
1131
  ...extra
1140
1132
  };
1141
1133
  }
1142
- //#endregion
1143
- //#region ../internal/src/build/runtime-package-resolution.ts
1134
+ // ../internal/src/build/runtime-package-resolution.ts
1144
1135
  /** Locates package metadata through exports, an entry's ancestors, or the project's dependency roots. */
1145
1136
  function createRuntimePackageResolver(readPackageName) {
1146
1137
  return async (name, resolver, fromDir) => {
@@ -1181,8 +1172,7 @@ function isPackageResolutionMiss(error) {
1181
1172
  const code = error?.code;
1182
1173
  return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED";
1183
1174
  }
1184
- //#endregion
1185
- //#region ../internal/src/build/runtime-package-directory.ts
1175
+ // ../internal/src/build/runtime-package-directory.ts
1186
1176
  /** Update a staged copy, then publish it with rollback on failure or cancellation. */
1187
1177
  async function updateRuntimePackageDirectory(options) {
1188
1178
  const stagingRoot = await mkdtemp(join(dirname(options.directory), ".vitehub-runtime-packages-"));
@@ -1229,8 +1219,7 @@ async function updateRuntimePackageDirectory(options) {
1229
1219
  });
1230
1220
  }
1231
1221
  }
1232
- //#endregion
1233
- //#region ../internal/src/build/vercel-runtime-packages.ts
1222
+ // ../internal/src/build/vercel-runtime-packages.ts
1234
1223
  const runtimeExportConditions = /* @__PURE__ */ new Set([
1235
1224
  "default",
1236
1225
  "import",
@@ -1444,8 +1433,7 @@ function parsePackageJson(value, path) {
1444
1433
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw internalErrorDiagnostics.INTERNAL_B0047({ message: `Expected ${path} to contain a JSON object.` });
1445
1434
  return value;
1446
1435
  }
1447
- //#endregion
1448
- //#region ../internal/src/build/provider-output-catalog.ts
1436
+ // ../internal/src/build/provider-output-catalog.ts
1449
1437
  var ProviderOutputCatalog = class {
1450
1438
  bundleDefines = {};
1451
1439
  #appliedCloudflareContributions = /* @__PURE__ */ new Map();
@@ -1673,8 +1661,7 @@ function useProviderOutputCatalog(config) {
1673
1661
  providerOutputCatalogs.set(config, catalog);
1674
1662
  return catalog;
1675
1663
  }
1676
- //#endregion
1677
- //#region ../internal/src/build/deployment-output.ts
1664
+ // ../internal/src/build/deployment-output.ts
1678
1665
  const providerDeploymentOutputRegistry = globalThis;
1679
1666
  const providerDeploymentOutputWrites = providerDeploymentOutputRegistry.__vitehubProviderDeploymentOutputWrites ??= /* @__PURE__ */ new Map();
1680
1667
  const providerDeploymentOutputFinalizations = providerDeploymentOutputRegistry.__vitehubProviderDeploymentOutputFinalizations ??= /* @__PURE__ */ new WeakMap();
@@ -2686,8 +2673,7 @@ async function finalizeProviderDeploymentOutputs(catalog, options = {}) {
2686
2673
  if (providerDeploymentOutputFinalizations.get(catalog) === active) providerDeploymentOutputFinalizations.delete(catalog);
2687
2674
  }
2688
2675
  }
2689
- //#endregion
2690
- //#region ../internal/src/definition-catalog.ts
2676
+ // ../internal/src/definition-catalog.ts
2691
2677
  const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
2692
2678
  const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
2693
2679
  const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
@@ -2834,8 +2820,7 @@ async function writeFileIfChanged(file, contents) {
2834
2820
  await mkdir(resolve$1(file, ".."), { recursive: true });
2835
2821
  await writeFile(file, contents, "utf8");
2836
2822
  }
2837
- //#endregion
2838
- //#region ../internal/src/dev-endpoint.ts
2823
+ // ../internal/src/dev-endpoint.ts
2839
2824
  function firstHeader(value) {
2840
2825
  return Array.isArray(value) ? value[0] : value;
2841
2826
  }
@@ -3074,8 +3059,7 @@ function hostFromNitroPreset(value) {
3074
3059
  if (normalized === "node" || normalized.startsWith("node-")) return "node";
3075
3060
  if (normalized.startsWith("vercel")) return "vercel";
3076
3061
  }
3077
- //#endregion
3078
- //#region ../internal/src/hosting.ts
3062
+ // ../internal/src/hosting.ts
3079
3063
  /**
3080
3064
  * Returns the Nitro preset name that this build targets, as the developer wrote it.
3081
3065
  * The order is `nitro.preset`, `hosting`, `NITRO_PRESET`, `SERVER_PRESET`, then `VITEHUB_HOST`.
@@ -3097,8 +3081,7 @@ function getHostingProvider(hosting) {
3097
3081
  const host = hostFromNitroPreset(hosting);
3098
3082
  if (host === "cloudflare" || host === "netlify" || host === "vercel") return host;
3099
3083
  }
3100
- //#endregion
3101
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/utils/helpers.js
3084
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/utils/helpers.js
3102
3085
  function dedupePlugins(defaultPlugins, userPlugins) {
3103
3086
  const plugins = /* @__PURE__ */ new Map();
3104
3087
  for (const plugin of defaultPlugins) plugins.set(plugin.name, plugin);
@@ -3114,8 +3097,7 @@ function dedupePlugins(defaultPlugins, userPlugins) {
3114
3097
  function defineComarkPlugin(fn) {
3115
3098
  return fn;
3116
3099
  }
3117
- //#endregion
3118
- //#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
3100
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/syntax/brackets.js
3119
3101
  function findClosingBracket(str, openIndex) {
3120
3102
  if (str[openIndex] !== "[") return -1;
3121
3103
  let index = openIndex + 1;
@@ -3142,8 +3124,7 @@ function parseBracketContent(str, startIndex) {
3142
3124
  endIndex: close + 1
3143
3125
  };
3144
3126
  }
3145
- //#endregion
3146
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/sanitize.js
3127
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/sanitize.js
3147
3128
  const unsafeProtocols = ["javascript:", "vbscript:"];
3148
3129
  function isUnsafeProtocol(url, allowDataImage) {
3149
3130
  if (unsafeProtocols.includes(url.protocol)) return true;
@@ -3202,7 +3183,8 @@ const URL_PROPS = /* @__PURE__ */ new Set([
3202
3183
  "poster",
3203
3184
  "cite",
3204
3185
  "background",
3205
- "ping"
3186
+ "ping",
3187
+ "longdesc"
3206
3188
  ]);
3207
3189
  const URL_PROP_SUFFIX = /(?:href|src|url|uri|link)s?$/;
3208
3190
  function isUrlProp(name) {
@@ -3214,13 +3196,74 @@ function normalizePropName(attribute) {
3214
3196
  function isUrlPropKey(key) {
3215
3197
  return isUrlProp(normalizePropName(key));
3216
3198
  }
3217
- //#endregion
3218
- //#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
3219
- const HTML_SINK_PROPS = /* @__PURE__ */ new Set([
3199
+ const tagSelectors = ["as", "is"];
3200
+ const componentOptionKeys = /* @__PURE__ */ new Set([
3201
+ "template",
3202
+ "render",
3203
+ "ssrrender",
3204
+ "setup",
3205
+ "extends",
3206
+ "mixins",
3207
+ "__v_isvnode",
3208
+ "__isteleport",
3209
+ "__issuspense",
3210
+ "__iskeepalive"
3211
+ ]);
3212
+ const htmlSinkProps = /* @__PURE__ */ new Set([
3220
3213
  "innerhtml",
3221
3214
  "dangerouslysetinnerhtml",
3222
3215
  "textcontent"
3223
3216
  ]);
3217
+ function isHtmlSinkKey(key) {
3218
+ return htmlSinkProps.has(key.replace(/^[.^]/, "").toLowerCase());
3219
+ }
3220
+ function isVNodeMarkerKey(key) {
3221
+ return key.replace(/^(?::|v-bind:)/, "").toLowerCase() === "__v_isvnode";
3222
+ }
3223
+ function isUnsafeRendererProp(attribute, value) {
3224
+ return isComponentSelectorViolation(attribute, value) || hasUnsafeObjectKeys(value);
3225
+ }
3226
+ function isComponentSelectorViolation(attribute, value) {
3227
+ const name = normalizePropName(attribute);
3228
+ if (tagSelectors.includes(name)) return value != null && typeof value !== "string";
3229
+ if (name !== "tag") return false;
3230
+ return typeof value === "function" || typeof value === "object" && value !== null && !Array.isArray(value);
3231
+ }
3232
+ function ownsComponentOptions(value) {
3233
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
3234
+ for (const key of Object.keys(value)) if (componentOptionKeys.has(key.toLowerCase())) return true;
3235
+ return false;
3236
+ }
3237
+ function ownsHtmlSink(value) {
3238
+ if (Array.isArray(value)) return false;
3239
+ for (const key of Object.keys(value)) if (isHtmlSinkKey(key)) return true;
3240
+ return false;
3241
+ }
3242
+ const unsafeObjectKeysCache = /* @__PURE__ */ new WeakMap();
3243
+ function hasUnsafeObjectKeys(value) {
3244
+ if (typeof value !== "object" || value === null) return false;
3245
+ const cached = unsafeObjectKeysCache.get(value);
3246
+ if (cached !== void 0) return cached;
3247
+ const seen = /* @__PURE__ */ new Set();
3248
+ const pending = [value];
3249
+ let found = false;
3250
+ while (pending.length && !found) {
3251
+ const current = pending.pop();
3252
+ if (typeof current !== "object" || current === null || seen.has(current)) continue;
3253
+ const known = unsafeObjectKeysCache.get(current);
3254
+ if (known !== void 0) {
3255
+ found = known;
3256
+ continue;
3257
+ }
3258
+ seen.add(current);
3259
+ if (ownsComponentOptions(current) || ownsHtmlSink(current)) found = true;
3260
+ else for (const item of Object.values(current)) pending.push(item);
3261
+ }
3262
+ unsafeObjectKeysCache.set(value, found);
3263
+ if (!found) for (const object of seen) unsafeObjectKeysCache.set(object, false);
3264
+ return found;
3265
+ }
3266
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/html-attributes.js
3224
3267
  function resolveAttributes(attrs, renderData, options = {}) {
3225
3268
  const result = {};
3226
3269
  for (const key in attrs) {
@@ -3228,8 +3271,7 @@ function resolveAttributes(attrs, renderData, options = {}) {
3228
3271
  const value = attrs[key];
3229
3272
  const isBinding = key.charCodeAt(0) === 58;
3230
3273
  const outKey = isBinding ? key.slice(1) : key;
3231
- const lowerOutKey = outKey.replace(/^[.^]/, "").toLowerCase();
3232
- if (HTML_SINK_PROPS.has(lowerOutKey)) continue;
3274
+ if (isHtmlSinkKey(outKey) || isVNodeMarkerKey(outKey)) continue;
3233
3275
  let outValue;
3234
3276
  let resultKey = key;
3235
3277
  if (options.parseJson && isBinding) {
@@ -3247,6 +3289,7 @@ function resolveAttributes(attrs, renderData, options = {}) {
3247
3289
  resultKey = outKey;
3248
3290
  } else outValue = value;
3249
3291
  } else outValue = value;
3292
+ if (options.parseJson && isUnsafeRendererProp(outKey, outValue)) continue;
3250
3293
  if (isBinding && isUrlPropKey(outKey) && typeof outValue === "string" && isUnsafeUrlValue(outValue)) continue;
3251
3294
  result[resultKey] = outValue;
3252
3295
  }
@@ -3284,8 +3327,7 @@ function htmlAttributes(attributes, { verbatim = false } = {}) {
3284
3327
  }
3285
3328
  return parts.join(" ");
3286
3329
  }
3287
- //#endregion
3288
- //#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
3330
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/transform-node.js
3289
3331
  function applyNodeTransforms(transforms, node, props, renderData, parent) {
3290
3332
  if (!transforms) return void 0;
3291
3333
  const list = typeof transforms === "function" ? [transforms] : transforms;
@@ -3311,8 +3353,7 @@ function applyNodeTransforms(transforms, node, props, renderData, parent) {
3311
3353
  props: nextProps
3312
3354
  };
3313
3355
  }
3314
- //#endregion
3315
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/utils/index.js
3356
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/utils/index.js
3316
3357
  function textContent(node, options) {
3317
3358
  return collectText(node, options?.decodeHTML);
3318
3359
  }
@@ -3478,8 +3519,7 @@ function get(data, key) {
3478
3519
  else return;
3479
3520
  return value;
3480
3521
  }
3481
- //#endregion
3482
- //#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
3522
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/syntax/props.js
3483
3523
  const bracketPairs = {
3484
3524
  "[": "]",
3485
3525
  "{": "}",
@@ -3573,8 +3613,7 @@ function searchProps(content, index = 0) {
3573
3613
  index
3574
3614
  };
3575
3615
  }
3576
- //#endregion
3577
- //#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
3616
+ // ../../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
3578
3617
  const RE_BLOCK_NAME = /^[a-z$][$\w.-]*/i;
3579
3618
  function parseBlockParams(str) {
3580
3619
  str = str.trim();
@@ -3606,8 +3645,7 @@ function parseBlockParams(str) {
3606
3645
  if (unparsedRemaining) result.remaining = unparsedRemaining;
3607
3646
  return result;
3608
3647
  }
3609
- //#endregion
3610
- //#region ../../node_modules/.pnpm/js-yaml@5.5.0/node_modules/js-yaml/dist/js-yaml.mjs
3648
+ // ../../node_modules/.pnpm/js-yaml@5.5.0/node_modules/js-yaml/dist/js-yaml.mjs
3611
3649
  /*! js-yaml 5.5.0 https://github.com/nodeca/js-yaml @license MIT */
3612
3650
  /**
3613
3651
  * Returned by a scalar resolver when the source does not match its tag.
@@ -6939,8 +6977,7 @@ COLLECTION_STYLE.FLOW;
6939
6977
  CHOMPING_MODE.CLIP;
6940
6978
  CHOMPING_MODE.STRIP;
6941
6979
  CHOMPING_MODE.KEEP;
6942
- //#endregion
6943
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/yaml.js
6980
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/yaml.js
6944
6981
  function parseYaml(content) {
6945
6982
  const documents = loadAll(content, { schema: JSON_SCHEMA });
6946
6983
  if (documents.length > 1) throw new YAMLException("expected a single document in the stream, but found more");
@@ -6968,8 +7005,7 @@ function stringifyYaml(data, options) {
6968
7005
  }
6969
7006
  return lines.join("\n");
6970
7007
  }
6971
- //#endregion
6972
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/indent.js
7008
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/indent.js
6973
7009
  function dedentLine(state, line, columns) {
6974
7010
  const lineStart = state.bMarks[line];
6975
7011
  const max = state.eMarks[line];
@@ -7024,8 +7060,7 @@ function restoreLines(state, from, bMarks, bsCount, sCount, tShift) {
7024
7060
  state.tShift[line] = tShift[i];
7025
7061
  }
7026
7062
  }
7027
- //#endregion
7028
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/components.js
7063
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/components.js
7029
7064
  const RE_COMPONENT_NAME = /^[a-z$][\w$-]*/i;
7030
7065
  function isValidComponentName(name) {
7031
7066
  return RE_COMPONENT_NAME.test(name);
@@ -7369,8 +7404,7 @@ var components_default = defineComarkPlugin(() => ({
7369
7404
  name: "components",
7370
7405
  markdownItPlugins: [markdownItComponents]
7371
7406
  }));
7372
- //#endregion
7373
- //#region ../../node_modules/.pnpm/markdown-exit@2.1.0/node_modules/markdown-exit/dist/chunk-CXurZ27M.js
7407
+ // ../../node_modules/.pnpm/markdown-exit@2.1.3/node_modules/markdown-exit/dist/chunk-CXurZ27M.js
7374
7408
  var __defProp = Object.defineProperty;
7375
7409
  var __exportAll = (all, symbols) => {
7376
7410
  let target = {};
@@ -7381,8 +7415,7 @@ var __exportAll = (all, symbols) => {
7381
7415
  if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
7382
7416
  return target;
7383
7417
  };
7384
- //#endregion
7385
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
7418
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
7386
7419
  const decodeCache = {};
7387
7420
  function getDecodeCache(exclude) {
7388
7421
  let cache = decodeCache[exclude];
@@ -7452,8 +7485,7 @@ function decode(string, exclude) {
7452
7485
  }
7453
7486
  decode.defaultChars = ";/?:@&=+$,#";
7454
7487
  decode.componentChars = "";
7455
- //#endregion
7456
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.mjs
7488
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.mjs
7457
7489
  const encodeCache = {};
7458
7490
  function getEncodeCache(exclude) {
7459
7491
  let cache = encodeCache[exclude];
@@ -7506,8 +7538,7 @@ function encode(string, exclude, keepEscaped) {
7506
7538
  }
7507
7539
  encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
7508
7540
  encode.componentChars = "-_.!~*'()";
7509
- //#endregion
7510
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/format.mjs
7541
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/format.mjs
7511
7542
  function format(url) {
7512
7543
  let result = "";
7513
7544
  result += url.protocol || "";
@@ -7521,8 +7552,7 @@ function format(url) {
7521
7552
  result += url.hash || "";
7522
7553
  return result;
7523
7554
  }
7524
- //#endregion
7525
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/parse.mjs
7555
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/parse.mjs
7526
7556
  function Url() {
7527
7557
  this.protocol = null;
7528
7558
  this.slashes = null;
@@ -7693,16 +7723,14 @@ Url.prototype.parseHost = function(host) {
7693
7723
  }
7694
7724
  if (host) this.hostname = host;
7695
7725
  };
7696
- //#endregion
7697
- //#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.mjs
7726
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.mjs
7698
7727
  var mdurl_exports = /* @__PURE__ */ __exportAll$1({
7699
7728
  decode: () => decode,
7700
7729
  encode: () => encode,
7701
7730
  format: () => format,
7702
7731
  parse: () => urlParse
7703
7732
  });
7704
- //#endregion
7705
- //#region ../../node_modules/.pnpm/uc.micro@3.0.0/node_modules/uc.micro/build/index.mjs
7733
+ // ../../node_modules/.pnpm/uc.micro@3.0.0/node_modules/uc.micro/build/index.mjs
7706
7734
  var build_exports = /* @__PURE__ */ __exportAll$1({
7707
7735
  Any: () => Any,
7708
7736
  Cc: () => Cc,
@@ -7717,8 +7745,7 @@ const Cf = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\
7717
7745
  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]/;
7718
7746
  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]/;
7719
7747
  const Z = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
7720
- //#endregion
7721
- //#region ../../node_modules/.pnpm/character-entities@2.0.2/node_modules/character-entities/index.js
7748
+ // ../../node_modules/.pnpm/character-entities@2.0.2/node_modules/character-entities/index.js
7722
7749
  /**
7723
7750
  * Map of named character references.
7724
7751
  *
@@ -9851,8 +9878,7 @@ const characterEntities = {
9851
9878
  zwj: "‍",
9852
9879
  zwnj: "‌"
9853
9880
  };
9854
- //#endregion
9855
- //#region ../../node_modules/.pnpm/markdown-exit@2.1.0/node_modules/markdown-exit/dist/index.core-Ccg4mWUA.js
9881
+ // ../../node_modules/.pnpm/markdown-exit@2.1.3/node_modules/markdown-exit/dist/index.core-BrabpolG.js
9856
9882
  var import_punycode = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
9857
9883
  /** Highest positive signed 32-bit float value */
9858
9884
  const maxInt = 2147483647;
@@ -10527,8 +10553,8 @@ var StateBlock = class {
10527
10553
  const s = this.src;
10528
10554
  const len = s.length;
10529
10555
  for (let start = 0; start < len;) {
10530
- const lineEnd = s.indexOf("\n", start);
10531
- const end = lineEnd === -1 ? len : lineEnd;
10556
+ const lineEnd$1 = s.indexOf("\n", start);
10557
+ const end = lineEnd$1 === -1 ? len : lineEnd$1;
10532
10558
  let indent = 0;
10533
10559
  let offset = 0;
10534
10560
  let pos = start;
@@ -10678,11 +10704,16 @@ var StateInline = class {
10678
10704
  */
10679
10705
  _prev_delimiters = [];
10680
10706
  /**
10681
- * backtick length => last seen position
10707
+ * backtick run length => position of its last run, built lazily on first use
10682
10708
  */
10683
10709
  backticks = {};
10684
10710
  backticksScanned = false;
10685
10711
  /**
10712
+ * Set when html comment / PI / declaration / CDATA has no terminator,
10713
+ * to skip further scans of these constructs
10714
+ */
10715
+ skipHtmlSpecial = false;
10716
+ /**
10686
10717
  * Counter used to disable inline linkify-it execution
10687
10718
  * inside `<a>` and markdown links
10688
10719
  */
@@ -11331,10 +11362,7 @@ var html_blocks_default = [
11331
11362
  "track",
11332
11363
  "ul"
11333
11364
  ];
11334
- const open_tag = `<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`;
11335
- const close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
11336
- const HTML_TAG_RE$1 = /* @__PURE__ */ new RegExp(`^(?:${open_tag}|${close_tag}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<\\?[\\s\\S]*?\\?>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`);
11337
- const HTML_OPEN_CLOSE_TAG_RE = /* @__PURE__ */ new RegExp(`^(?:${open_tag}|${close_tag})`);
11365
+ 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*>)`);
11338
11366
  const HTML_SEQUENCES = [
11339
11367
  [
11340
11368
  /^<(script|pre|style|textarea)(?=(\s|>|$))/i,
@@ -11635,129 +11663,141 @@ function paragraph(state, startLine, endLine) {
11635
11663
  state.parentType = oldParentType;
11636
11664
  return true;
11637
11665
  }
11666
+ const MAX_LABEL_LENGTH = 999;
11667
+ function countCodePoints(str) {
11668
+ let length = str.length;
11669
+ for (let i = 0; i < str.length - 1; i++) {
11670
+ const high = str.charCodeAt(i);
11671
+ if (high < 55296 || high > 56319) continue;
11672
+ const low = str.charCodeAt(i + 1);
11673
+ if (low >= 56320 && low <= 57343) {
11674
+ length--;
11675
+ i++;
11676
+ }
11677
+ }
11678
+ return length;
11679
+ }
11680
+ function lineEnd(state, line) {
11681
+ return Math.min(state.eMarks[line] + 1, state.src.length);
11682
+ }
11683
+ function getNextLinePos(state, nextLine) {
11684
+ const endLine = state.lineMax;
11685
+ if (nextLine >= endLine || state.isEmpty(nextLine)) return -1;
11686
+ let isContinuation = false;
11687
+ if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
11688
+ if (state.sCount[nextLine] < 0) isContinuation = true;
11689
+ if (!isContinuation) {
11690
+ const terminatorRules = state.md.block.ruler.getRules("reference");
11691
+ const oldParentType = state.parentType;
11692
+ state.parentType = "reference";
11693
+ let terminate = false;
11694
+ for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
11695
+ terminate = true;
11696
+ break;
11697
+ }
11698
+ state.parentType = oldParentType;
11699
+ if (terminate) return -1;
11700
+ }
11701
+ return state.bMarks[nextLine] + state.tShift[nextLine];
11702
+ }
11638
11703
  function reference(state, startLine, endLine, silent) {
11704
+ const src = state.src;
11639
11705
  let pos = state.bMarks[startLine] + state.tShift[startLine];
11640
- let max = state.eMarks[startLine];
11641
11706
  let nextLine = startLine + 1;
11642
11707
  if (state.sCount[startLine] - state.blkIndent >= 4) return false;
11643
- if (state.src.charCodeAt(pos) !== 91) return false;
11644
- function getNextLine(nextLine$1) {
11645
- const endLine$1 = state.lineMax;
11646
- if (nextLine$1 >= endLine$1 || state.isEmpty(nextLine$1)) return null;
11647
- let isContinuation = false;
11648
- if (state.sCount[nextLine$1] - state.blkIndent > 3) isContinuation = true;
11649
- if (state.sCount[nextLine$1] < 0) isContinuation = true;
11650
- if (!isContinuation) {
11651
- const terminatorRules = state.md.block.ruler.getRules("reference");
11652
- const oldParentType = state.parentType;
11653
- state.parentType = "reference";
11654
- let terminate = false;
11655
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine$1, endLine$1, true)) {
11656
- terminate = true;
11657
- break;
11658
- }
11659
- state.parentType = oldParentType;
11660
- if (terminate) return null;
11661
- }
11662
- const pos$1 = state.bMarks[nextLine$1] + state.tShift[nextLine$1];
11663
- const max$1 = state.eMarks[nextLine$1];
11664
- return state.src.slice(pos$1, max$1 + 1);
11665
- }
11666
- let str = state.src.slice(pos, max + 1);
11667
- max = str.length;
11708
+ if (src.charCodeAt(pos) !== 91) return false;
11709
+ let max = lineEnd(state, startLine);
11710
+ let rawLabel = "";
11668
11711
  let labelEnd = -1;
11669
- for (pos = 1; pos < max; pos++) {
11670
- const ch = str.charCodeAt(pos);
11712
+ let segmentStart = ++pos;
11713
+ while (pos < max) {
11714
+ if (rawLabel.length + pos - segmentStart > MAX_LABEL_LENGTH * 2) return false;
11715
+ let ch = src.charCodeAt(pos);
11671
11716
  if (ch === 91) return false;
11672
- else if (ch === 93) {
11717
+ if (ch === 93) {
11673
11718
  labelEnd = pos;
11674
11719
  break;
11675
- } else if (ch === 10) {
11676
- const lineContent = getNextLine(nextLine);
11677
- if (lineContent !== null) {
11678
- str += lineContent;
11679
- max = str.length;
11680
- nextLine++;
11681
- }
11682
- } else if (ch === 92) {
11683
- pos++;
11684
- if (pos < max && str.charCodeAt(pos) === 10) {
11685
- const lineContent = getNextLine(nextLine);
11686
- if (lineContent !== null) {
11687
- str += lineContent;
11688
- max = str.length;
11689
- nextLine++;
11690
- }
11691
- }
11692
11720
  }
11721
+ if (ch === 92) ch = src.charCodeAt(++pos);
11722
+ if (ch === 10 && pos < max) {
11723
+ const nextPos = getNextLinePos(state, nextLine);
11724
+ if (nextPos < 0) return false;
11725
+ rawLabel += src.slice(segmentStart, max);
11726
+ pos = segmentStart = nextPos;
11727
+ max = lineEnd(state, nextLine++);
11728
+ continue;
11729
+ }
11730
+ pos++;
11693
11731
  }
11694
- if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) return false;
11695
- for (pos = labelEnd + 2; pos < max; pos++) {
11696
- const ch = str.charCodeAt(pos);
11732
+ if (labelEnd < 0 || src.charCodeAt(labelEnd + 1) !== 58) return false;
11733
+ rawLabel += src.slice(segmentStart, labelEnd);
11734
+ if (rawLabel.length > MAX_LABEL_LENGTH && countCodePoints(rawLabel) > MAX_LABEL_LENGTH) return false;
11735
+ pos = labelEnd + 2;
11736
+ while (pos < max) {
11737
+ const ch = src.charCodeAt(pos);
11697
11738
  if (ch === 10) {
11698
- const lineContent = getNextLine(nextLine);
11699
- if (lineContent !== null) {
11700
- str += lineContent;
11701
- max = str.length;
11702
- nextLine++;
11703
- }
11704
- } else if (isSpace(ch)) {} else break;
11739
+ const nextPos = getNextLinePos(state, nextLine);
11740
+ if (nextPos < 0) break;
11741
+ pos = nextPos;
11742
+ max = lineEnd(state, nextLine++);
11743
+ } else if (isSpace(ch)) pos++;
11744
+ else break;
11705
11745
  }
11706
- const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
11746
+ const destRes = state.md.helpers.parseLinkDestination(src, pos, max);
11707
11747
  if (!destRes.ok) return false;
11708
11748
  const href = state.md.normalizeLink(destRes.str);
11709
11749
  if (!state.md.validateLink(href)) return false;
11710
11750
  pos = destRes.pos;
11711
11751
  const destEndPos = pos;
11752
+ const destEndMax = max;
11712
11753
  const destEndLineNo = nextLine;
11713
- const start = pos;
11714
- for (; pos < max; pos++) {
11715
- const ch = str.charCodeAt(pos);
11754
+ while (pos < max) {
11755
+ const ch = src.charCodeAt(pos);
11716
11756
  if (ch === 10) {
11717
- const lineContent = getNextLine(nextLine);
11718
- if (lineContent !== null) {
11719
- str += lineContent;
11720
- max = str.length;
11721
- nextLine++;
11722
- }
11723
- } else if (isSpace(ch)) {} else break;
11757
+ const nextPos = getNextLinePos(state, nextLine);
11758
+ if (nextPos < 0) break;
11759
+ pos = nextPos;
11760
+ max = lineEnd(state, nextLine++);
11761
+ } else if (isSpace(ch)) pos++;
11762
+ else break;
11724
11763
  }
11725
- let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
11764
+ const titleStart = pos;
11765
+ let titleRes = state.md.helpers.parseLinkTitle(src, pos, max);
11726
11766
  while (titleRes.can_continue) {
11727
- const lineContent = getNextLine(nextLine);
11728
- if (lineContent === null) break;
11729
- str += lineContent;
11730
- pos = max;
11731
- max = str.length;
11732
- nextLine++;
11733
- titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
11767
+ const nextPos = getNextLinePos(state, nextLine);
11768
+ if (nextPos < 0) break;
11769
+ pos = nextPos;
11770
+ max = lineEnd(state, nextLine++);
11771
+ titleRes = state.md.helpers.parseLinkTitle(src, pos, max, titleRes);
11734
11772
  }
11735
11773
  let title;
11736
- if (pos < max && start !== pos && titleRes.ok) {
11774
+ if (titleStart !== destEndPos && titleRes.ok) {
11737
11775
  title = titleRes.str;
11738
11776
  pos = titleRes.pos;
11739
11777
  } else {
11740
11778
  title = "";
11741
11779
  pos = destEndPos;
11780
+ max = destEndMax;
11742
11781
  nextLine = destEndLineNo;
11743
11782
  }
11744
11783
  while (pos < max) {
11745
- if (!isSpace(str.charCodeAt(pos))) break;
11784
+ if (!isSpace(src.charCodeAt(pos))) break;
11746
11785
  pos++;
11747
11786
  }
11748
- if (pos < max && str.charCodeAt(pos) !== 10) {
11787
+ if (pos < max && src.charCodeAt(pos) !== 10) {
11749
11788
  if (title) {
11750
11789
  title = "";
11751
11790
  pos = destEndPos;
11791
+ max = destEndMax;
11752
11792
  nextLine = destEndLineNo;
11753
11793
  while (pos < max) {
11754
- if (!isSpace(str.charCodeAt(pos))) break;
11794
+ if (!isSpace(src.charCodeAt(pos))) break;
11755
11795
  pos++;
11756
11796
  }
11757
11797
  }
11758
11798
  }
11759
- if (pos < max && str.charCodeAt(pos) !== 10) return false;
11760
- const label = normalizeReference(str.slice(1, labelEnd));
11799
+ if (pos < max && src.charCodeAt(pos) !== 10) return false;
11800
+ const label = normalizeReference(rawLabel);
11761
11801
  if (!label) return false;
11762
11802
  /* istanbul ignore if */
11763
11803
  if (silent) return true;
@@ -12065,6 +12105,7 @@ function linkify$1(state) {
12065
12105
  for (let j = 0, l = blockTokens.length; j < l; j++) {
12066
12106
  if (blockTokens[j].type !== "inline" || !linkify$2.test(blockTokens[j].content)) continue;
12067
12107
  const tokens = blockTokens[j].children;
12108
+ const replacements = [];
12068
12109
  let htmlLinkLevel = 0;
12069
12110
  for (let i = tokens.length - 1; i >= 0; i--) {
12070
12111
  const currentToken = tokens[i];
@@ -12125,19 +12166,38 @@ function linkify$1(state) {
12125
12166
  token.level = level;
12126
12167
  nodes.push(token);
12127
12168
  }
12128
- tokens.splice(i, 1, ...nodes);
12169
+ replacements.push({
12170
+ index: i,
12171
+ nodes
12172
+ });
12129
12173
  }
12130
12174
  }
12175
+ if (replacements.length > 0) {
12176
+ let newTokensLength = tokens.length;
12177
+ for (const replacement of replacements) newTokensLength += replacement.nodes.length - 1;
12178
+ const newTokens = new Array(newTokensLength);
12179
+ let replacementIndex = 0;
12180
+ let newTokenIndex = 0;
12181
+ replacements.reverse();
12182
+ for (let i = 0; i < tokens.length; i++) {
12183
+ const replacement = replacements[replacementIndex];
12184
+ if (replacement?.index === i) {
12185
+ for (const node of replacement.nodes) newTokens[newTokenIndex++] = node;
12186
+ replacementIndex++;
12187
+ } else newTokens[newTokenIndex++] = tokens[i];
12188
+ }
12189
+ blockTokens[j].children = newTokens;
12190
+ }
12131
12191
  }
12132
12192
  }
12133
- const NEWLINES_RE = /\r\n?|\n/g;
12193
+ const UNNORMALIZED_NEWLINE_RE = /\r\n?/g;
12134
12194
  const NULL_RE = /\0/g;
12135
12195
  function normalize(state) {
12136
12196
  let str = state.src;
12137
12197
  const hasCR = str.includes("\r");
12138
12198
  const hasNull = str.includes("\0");
12139
12199
  if (!hasCR && !hasNull) return;
12140
- if (hasCR) str = str.replace(NEWLINES_RE, "\n");
12200
+ if (hasCR) str = str.replace(UNNORMALIZED_NEWLINE_RE, "\n");
12141
12201
  if (hasNull) str = str.replace(NULL_RE, "�");
12142
12202
  state.src = str;
12143
12203
  }
@@ -12184,6 +12244,14 @@ function replace(state) {
12184
12244
  const QUOTE_TEST_RE = /['"]/;
12185
12245
  const QUOTE_RE = /['"]/g;
12186
12246
  const APOSTROPHE = "’";
12247
+ const MAX_OPENERS = 1e3;
12248
+ function truncateStack(stack, heads, length) {
12249
+ while (stack.length > length) {
12250
+ const item = stack.pop();
12251
+ if (item.isSingleQuote) heads.single = item.prevSameQuoteIdx;
12252
+ else heads.double = item.prevSameQuoteIdx;
12253
+ }
12254
+ }
12187
12255
  function addReplacement(replacements, tokenIdx, pos, ch) {
12188
12256
  if (!replacements[tokenIdx]) replacements[tokenIdx] = [];
12189
12257
  replacements[tokenIdx].push({
@@ -12205,12 +12273,16 @@ function applyReplacements(str, replacements) {
12205
12273
  function process_inlines(tokens, state) {
12206
12274
  let j;
12207
12275
  const stack = [];
12276
+ const heads = {
12277
+ single: -1,
12278
+ double: -1
12279
+ };
12208
12280
  const replacements = {};
12209
12281
  for (let i = 0; i < tokens.length; i++) {
12210
12282
  const token = tokens[i];
12211
12283
  const thisLevel = tokens[i].level;
12212
12284
  for (j = stack.length - 1; j >= 0; j--) if (stack[j].level <= thisLevel) break;
12213
- stack.length = j + 1;
12285
+ truncateStack(stack, heads, j + 1);
12214
12286
  if (token.type !== "text") continue;
12215
12287
  const text$1 = token.content;
12216
12288
  let pos = 0;
@@ -12262,11 +12334,10 @@ function process_inlines(tokens, state) {
12262
12334
  if (isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
12263
12335
  continue;
12264
12336
  }
12265
- if (canClose) for (j = stack.length - 1; j >= 0; j--) {
12266
- let item = stack[j];
12267
- if (stack[j].level < thisLevel) break;
12268
- if (item.single === isSingle && stack[j].level === thisLevel) {
12269
- item = stack[j];
12337
+ if (canClose) {
12338
+ j = isSingle ? heads.single : heads.double;
12339
+ if (j >= 0 && stack[j].level === thisLevel) {
12340
+ const item = stack[j];
12270
12341
  let openQuote;
12271
12342
  let closeQuote;
12272
12343
  if (isSingle) {
@@ -12277,18 +12348,23 @@ function process_inlines(tokens, state) {
12277
12348
  closeQuote = state.md.options.quotes[1];
12278
12349
  }
12279
12350
  addReplacement(replacements, i, t.index, closeQuote);
12280
- addReplacement(replacements, item.token, item.pos, openQuote);
12281
- stack.length = j;
12351
+ addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote);
12352
+ truncateStack(stack, heads, j);
12282
12353
  continue OUTER;
12283
12354
  }
12284
12355
  }
12285
- if (canOpen) stack.push({
12286
- token: i,
12287
- pos: t.index,
12288
- single: isSingle,
12289
- level: thisLevel
12290
- });
12291
- else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
12356
+ if (canOpen) {
12357
+ if (stack.length >= MAX_OPENERS) return;
12358
+ stack.push({
12359
+ tokenIdx: i,
12360
+ contentPos: t.index,
12361
+ isSingleQuote: isSingle,
12362
+ level: thisLevel,
12363
+ prevSameQuoteIdx: isSingle ? heads.single : heads.double
12364
+ });
12365
+ if (isSingle) heads.single = stack.length - 1;
12366
+ else heads.double = stack.length - 1;
12367
+ } else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
12292
12368
  }
12293
12369
  }
12294
12370
  Object.keys(replacements).forEach((tokenIdx) => {
@@ -12554,43 +12630,54 @@ function autolink(state, silent) {
12554
12630
  }
12555
12631
  return false;
12556
12632
  }
12633
+ function buildLastRuns(src) {
12634
+ const lastRuns = {};
12635
+ let pos = 0;
12636
+ while (true) {
12637
+ pos = src.indexOf("`", pos);
12638
+ if (pos === -1) break;
12639
+ const start = pos;
12640
+ while (src.charCodeAt(++pos) === 96);
12641
+ lastRuns[pos - start] = start;
12642
+ }
12643
+ return lastRuns;
12644
+ }
12557
12645
  function backtick(state, silent) {
12558
- let pos = state.pos;
12646
+ const start = state.pos;
12559
12647
  const src = state.src;
12560
- if (src.charCodeAt(pos) !== 96) return false;
12561
- const start = pos;
12562
- pos++;
12648
+ if (src.charCodeAt(start) !== 96) return false;
12563
12649
  const max = state.posMax;
12650
+ let pos = start + 1;
12564
12651
  while (pos < max && src.charCodeAt(pos) === 96) pos++;
12565
12652
  const marker = src.slice(start, pos);
12566
12653
  const openerLength = marker.length;
12567
- if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
12568
- if (!silent) state.pending += marker;
12569
- state.pos += openerLength;
12570
- return true;
12571
- }
12572
- let matchEnd = pos;
12573
- let matchStart;
12574
- while (true) {
12575
- matchStart = src.indexOf("`", matchEnd);
12576
- if (matchStart === -1) break;
12577
- matchEnd = matchStart + 1;
12578
- while (matchEnd < max && src.charCodeAt(matchEnd) === 96) matchEnd++;
12579
- const closerLength = matchEnd - matchStart;
12580
- if (closerLength === openerLength) {
12581
- if (!silent) {
12582
- const token = state.push("code_inline", "code", 0);
12583
- token.markup = marker;
12584
- token.content = src.slice(pos, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1");
12654
+ if (!state.backticksScanned) {
12655
+ state.backticks = buildLastRuns(src);
12656
+ state.backticksScanned = true;
12657
+ }
12658
+ if ((state.backticks[openerLength] ?? -1) >= pos) {
12659
+ let matchEnd = pos;
12660
+ while (true) {
12661
+ const matchStart = src.indexOf("`", matchEnd);
12662
+ if (matchStart === -1 || matchStart >= max) break;
12663
+ matchEnd = matchStart + 1;
12664
+ while (src.charCodeAt(matchEnd) === 96) matchEnd++;
12665
+ if (matchEnd > max) break;
12666
+ if (matchEnd - matchStart === openerLength) {
12667
+ if (!silent) {
12668
+ const token = state.push("code_inline", "code", 0);
12669
+ token.markup = marker;
12670
+ let content = src.slice(pos, matchStart).replace(/\n/g, " ");
12671
+ if (content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) content = content.slice(1, -1);
12672
+ token.content = content;
12673
+ }
12674
+ state.pos = matchEnd;
12675
+ return true;
12585
12676
  }
12586
- state.pos = matchEnd;
12587
- return true;
12588
12677
  }
12589
- state.backticks[closerLength] = matchStart;
12590
12678
  }
12591
- state.backticksScanned = true;
12592
12679
  if (!silent) state.pending += marker;
12593
- state.pos += openerLength;
12680
+ state.pos = pos;
12594
12681
  return true;
12595
12682
  }
12596
12683
  function processDelimiters(delimiters) {
@@ -12830,22 +12917,53 @@ function isLetter$1(ch) {
12830
12917
  const lc = ch | 32;
12831
12918
  return lc >= 97 && lc <= 122;
12832
12919
  }
12920
+ function scanSpecial(state, pos) {
12921
+ const src = state.src;
12922
+ let start;
12923
+ let terminator;
12924
+ if (src.startsWith("<!--", pos)) {
12925
+ if (src.startsWith(">", pos + 4)) return pos + 5;
12926
+ if (src.startsWith("->", pos + 4)) return pos + 6;
12927
+ start = pos + 4;
12928
+ terminator = "-->";
12929
+ } else if (src.startsWith("<![CDATA[", pos)) {
12930
+ start = pos + 9;
12931
+ terminator = "]]>";
12932
+ } else if (src.charCodeAt(pos + 1) === 63) {
12933
+ start = pos + 2;
12934
+ terminator = "?>";
12935
+ } else if (isLetter$1(src.charCodeAt(pos + 2))) {
12936
+ start = pos + 3;
12937
+ terminator = ">";
12938
+ } else return -1;
12939
+ if (state.skipHtmlSpecial) return -1;
12940
+ const end = src.indexOf(terminator, start);
12941
+ if (end < 0) {
12942
+ state.skipHtmlSpecial = true;
12943
+ return -1;
12944
+ }
12945
+ return end + terminator.length;
12946
+ }
12833
12947
  function html_inline(state, silent) {
12834
12948
  if (!state.md.options.html) return false;
12835
12949
  const max = state.posMax;
12836
12950
  const pos = state.pos;
12837
12951
  if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) return false;
12952
+ let end;
12838
12953
  const ch = state.src.charCodeAt(pos + 1);
12839
- if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter$1(ch)) return false;
12840
- const match = state.src.slice(pos).match(HTML_TAG_RE$1);
12841
- if (!match) return false;
12954
+ if (ch === 33 || ch === 63) end = scanSpecial(state, pos);
12955
+ else if (ch === 47 || isLetter$1(ch)) {
12956
+ const match = state.src.slice(pos).match(HTML_OPEN_CLOSE_TAG_RE);
12957
+ end = match ? pos + match[0].length : -1;
12958
+ } else return false;
12959
+ if (end < 0) return false;
12842
12960
  if (!silent) {
12843
12961
  const token = state.push("html_inline", "", 0);
12844
- token.content = match[0];
12962
+ token.content = state.src.slice(pos, end);
12845
12963
  if (isLinkOpen(token.content)) state.linkLevel++;
12846
12964
  if (isLinkClose(token.content)) state.linkLevel--;
12847
12965
  }
12848
- state.pos += match[0].length;
12966
+ state.pos = end;
12849
12967
  return true;
12850
12968
  }
12851
12969
  function image(state, silent) {
@@ -13014,7 +13132,12 @@ function link$2(state, silent) {
13014
13132
  state.posMax = max;
13015
13133
  return true;
13016
13134
  }
13017
- const SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
13135
+ function isAsciiAlpha$1(code$1) {
13136
+ return code$1 >= 65 && code$1 <= 90 || code$1 >= 97 && code$1 <= 122;
13137
+ }
13138
+ function isSchemeChar(code$1) {
13139
+ 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;
13140
+ }
13018
13141
  function linkify(state, silent) {
13019
13142
  if (!state.md.options.linkify) return false;
13020
13143
  if (state.linkLevel > 0) return false;
@@ -13024,20 +13147,22 @@ function linkify(state, silent) {
13024
13147
  if (state.src.charCodeAt(pos) !== 58) return false;
13025
13148
  if (state.src.charCodeAt(pos + 1) !== 47) return false;
13026
13149
  if (state.src.charCodeAt(pos + 2) !== 47) return false;
13027
- const match = state.pending.match(SCHEME_RE);
13028
- if (!match) return false;
13029
- const proto = match[1];
13030
- const link$1 = requireLinkify(state.md.linkify).matchAtStart(state.src.slice(pos - proto.length));
13150
+ const protoMin = pos - Math.min(10, state.pending.length, pos);
13151
+ let protoStart = pos;
13152
+ while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) protoStart--;
13153
+ if (protoStart === pos || !isAsciiAlpha$1(state.src.charCodeAt(protoStart))) return false;
13154
+ const protoLength = pos - protoStart;
13155
+ const link$1 = requireLinkify(state.md.linkify).matchAtStart(state.src.slice(protoStart));
13031
13156
  if (!link$1) return false;
13032
13157
  let url = link$1.url;
13033
- if (url.length <= proto.length) return false;
13158
+ if (url.length <= protoLength) return false;
13034
13159
  let urlEnd = url.length;
13035
13160
  while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 42) urlEnd--;
13036
13161
  if (urlEnd !== url.length) url = url.slice(0, urlEnd);
13037
13162
  const fullUrl = state.md.normalizeLink(url);
13038
13163
  if (!state.md.validateLink(fullUrl)) return false;
13039
13164
  if (!silent) {
13040
- state.pending = state.pending.slice(0, -proto.length);
13165
+ state.pending = state.pending.slice(0, -protoLength);
13041
13166
  const token_o = state.push("link_open", "a", 1);
13042
13167
  token_o.attrs = [["href", fullUrl]];
13043
13168
  token_o.markup = "linkify";
@@ -13048,7 +13173,7 @@ function linkify(state, silent) {
13048
13173
  token_c.markup = "linkify";
13049
13174
  token_c.info = "auto";
13050
13175
  }
13051
- state.pos += url.length - proto.length;
13176
+ state.pos += url.length - protoLength;
13052
13177
  return true;
13053
13178
  }
13054
13179
  function newline(state, silent) {
@@ -13318,7 +13443,12 @@ function normalizeLink(url) {
13318
13443
  parsed.hostname = import_punycode.default.toASCII(parsed.hostname);
13319
13444
  } catch {}
13320
13445
  }
13321
- return encode(format(parsed));
13446
+ if (parsed.auth) parsed.auth = encode(parsed.auth);
13447
+ if (parsed.hostname) parsed.hostname = encode(parsed.hostname);
13448
+ if (parsed.pathname) parsed.pathname = encode(parsed.pathname);
13449
+ if (parsed.search) parsed.search = encode(parsed.search);
13450
+ if (parsed.hash) parsed.hash = encode(parsed.hash);
13451
+ return format(parsed);
13322
13452
  }
13323
13453
  function normalizeLinkText(url) {
13324
13454
  const parsed = urlParse(url, true);
@@ -13956,8 +14086,7 @@ var MarkdownExit = class extends Parser {
13956
14086
  static StateInline = StateInline;
13957
14087
  };
13958
14088
  var index_core_default = callable(MarkdownExit);
13959
- //#endregion
13960
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/attributes.js
14089
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/attributes.js
13961
14090
  const TEXT_TOKENS = /* @__PURE__ */ new Set([
13962
14091
  "text",
13963
14092
  "text_special",
@@ -14100,8 +14229,7 @@ var attributes_default = defineComarkPlugin(() => ({
14100
14229
  name: "attributes",
14101
14230
  markdownItPlugins: [markdownItAttributes]
14102
14231
  }));
14103
- //#endregion
14104
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/task-list.js
14232
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/task-list.js
14105
14233
  function attrSet(token, name, value) {
14106
14234
  const index = token.attrIndex(name);
14107
14235
  const attr = [name, value];
@@ -14178,8 +14306,7 @@ var task_list_default = defineComarkPlugin(() => ({
14178
14306
  name: "task-list",
14179
14307
  markdownItPlugins: [markdownItTaskList]
14180
14308
  }));
14181
- //#endregion
14182
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/alert.js
14309
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/alert.js
14183
14310
  const markers = {
14184
14311
  "!TIP": {
14185
14312
  type: "tip",
@@ -14235,8 +14362,7 @@ var alert_default = defineComarkPlugin(() => ({
14235
14362
  });
14236
14363
  }
14237
14364
  }));
14238
- //#endregion
14239
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/html.js
14365
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/html.js
14240
14366
  var html_default = defineComarkPlugin((opts = {}) => {
14241
14367
  return {
14242
14368
  name: "html",
@@ -14389,8 +14515,7 @@ function htmlToTokens(str) {
14389
14515
  if (textStart < len) pushText(tokens, str.slice(textStart));
14390
14516
  return tokens;
14391
14517
  }
14392
- //#endregion
14393
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/frontmatter.js
14518
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/frontmatter.js
14394
14519
  const FRONTMATTER_DELIMITER_DEFAULT = "---";
14395
14520
  const CR = "\r";
14396
14521
  function parseFrontmatter(content) {
@@ -14419,8 +14544,7 @@ function renderFrontmatter(data, content, yamlOptions) {
14419
14544
  if (content) return "---\n" + fm + "\n---\n\n" + content.trim();
14420
14545
  return fm;
14421
14546
  }
14422
- //#endregion
14423
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/frontmatter.js
14547
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/frontmatter.js
14424
14548
  var frontmatter_default = defineComarkPlugin(() => ({
14425
14549
  name: "frontmatter",
14426
14550
  pre(state) {
@@ -14431,8 +14555,7 @@ var frontmatter_default = defineComarkPlugin(() => ({
14431
14555
  if (content && frontmatterText) state.parsedLines = (state.parsedLines ?? 0) + frontmatterText.split("\n").length + 1;
14432
14556
  }
14433
14557
  }));
14434
- //#endregion
14435
- //#region ../../node_modules/.pnpm/linkify-it@6.1.0/node_modules/linkify-it/build/index.mjs
14558
+ // ../../node_modules/.pnpm/linkify-it@6.1.0/node_modules/linkify-it/build/index.mjs
14436
14559
  var REBuilder = class {
14437
14560
  src_Any = Any.source;
14438
14561
  src_Cc = Cc.source;
@@ -14960,8 +15083,7 @@ var LinkifyIt = class {
14960
15083
  if (match.schema === "mailto:" && !/^mailto:/i.test(match.url)) match.url = `mailto:${match.url}`;
14961
15084
  }
14962
15085
  };
14963
- //#endregion
14964
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/linkify.js
15086
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/linkify.js
14965
15087
  const markdownItPlugins = /* @__PURE__ */ new Map();
14966
15088
  function markdownItLinkify(options) {
14967
15089
  const key = JSON.stringify(options);
@@ -14979,8 +15101,7 @@ var linkify_default = defineComarkPlugin((options = {}) => ({
14979
15101
  name: "linkify",
14980
15102
  markdownItPlugins: [markdownItLinkify(options)]
14981
15103
  }));
14982
- //#endregion
14983
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/bracket-math.js
15104
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/bracket-math.js
14984
15105
  function findBracketClose(text, from, close, end = text.length) {
14985
15106
  for (let pos = from; pos + 1 < end; pos++) {
14986
15107
  if (text.charCodeAt(pos) !== 92) continue;
@@ -15251,6 +15372,8 @@ function healRegion(text, o) {
15251
15372
  let htmlLt = -1;
15252
15373
  let starInWord = false;
15253
15374
  let starDisabled = false;
15375
+ let starSkippedLen = 0;
15376
+ let starSkippedDepth = -1;
15254
15377
  let noParenClose = -1;
15255
15378
  let noBracketClose = -1;
15256
15379
  for (let i = 0; i < len; i++) {
@@ -15259,6 +15382,7 @@ function healRegion(text, o) {
15259
15382
  if (c === 10) {
15260
15383
  lineStart = i + 1;
15261
15384
  starInWord = false;
15385
+ starSkippedLen = 0;
15262
15386
  htmlLt = -1;
15263
15387
  continue;
15264
15388
  }
@@ -15274,6 +15398,7 @@ function healRegion(text, o) {
15274
15398
  }
15275
15399
  if (c === 32 || c === 9 || c === 13) {
15276
15400
  starInWord = false;
15401
+ starSkippedLen = 0;
15277
15402
  continue;
15278
15403
  }
15279
15404
  if (c === 92) {
@@ -15360,19 +15485,29 @@ function healRegion(text, o) {
15360
15485
  const enabled = n === 1 ? o.italic : n === 2 ? o.bold : o.boldItalic;
15361
15486
  if (c === 42) {
15362
15487
  const inWord = attachedLeft && isAlnum(prev) && isAlnum(next);
15363
- if (!inWord || starInWord) {
15488
+ if (inWord && !starInWord) {
15489
+ starSkippedLen = n;
15490
+ starSkippedDepth = frames.length;
15491
+ } else {
15364
15492
  if (attachedLeft && top !== null && top.k === F_STAR && (!inWord || top.len === n)) {
15365
15493
  closeRun(frames, F_STAR, n);
15494
+ starSkippedLen = 0;
15366
15495
  starInWord = true;
15367
15496
  i += n - 1;
15368
15497
  continue;
15369
15498
  }
15499
+ if (attachedLeft && !inWord && starSkippedLen === n && starSkippedDepth === frames.length && !isOpeningPunct(prev)) {
15500
+ starSkippedLen = 0;
15501
+ i += n - 1;
15502
+ continue;
15503
+ }
15370
15504
  if (openRight && enabled) {
15371
15505
  frames.push({
15372
15506
  k: F_STAR,
15373
15507
  len: n,
15374
15508
  pos: i
15375
15509
  });
15510
+ starSkippedLen = 0;
15376
15511
  starInWord = true;
15377
15512
  i += n - 1;
15378
15513
  continue;
@@ -15729,6 +15864,13 @@ function isAlnum(cp) {
15729
15864
  if (c <= 127) return c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122;
15730
15865
  return ALNUM_CP_RE.test(cp);
15731
15866
  }
15867
+ const OPENING_PUNCT_RE = /\p{Ps}|\p{Pi}/u;
15868
+ function isOpeningPunct(cp) {
15869
+ if (cp === "") return false;
15870
+ const c = cp.charCodeAt(0);
15871
+ if (c <= 127) return c === 40 || c === 91 || c === 123;
15872
+ return OPENING_PUNCT_RE.test(cp);
15873
+ }
15732
15874
  function isAsciiAlpha(c) {
15733
15875
  return c >= 97 && c <= 122 || c >= 65 && c <= 90;
15734
15876
  }
@@ -15875,8 +16017,7 @@ function closeTables(markdown) {
15875
16017
  if (!hasSeparator) lines.splice(start + 1, 0, generateSeparator());
15876
16018
  return lines.join("\n");
15877
16019
  }
15878
- //#endregion
15879
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/utils/trace.js
16020
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/utils/trace.js
15880
16021
  const noopSpan = { end: () => {} };
15881
16022
  const noopTracer = {
15882
16023
  startSpan: () => noopSpan,
@@ -15897,8 +16038,7 @@ function withSpan(tracer, name, fn, options) {
15897
16038
  }
15898
16039
  });
15899
16040
  }
15900
- //#endregion
15901
- //#region ../../node_modules/.pnpm/character-entities-legacy@3.0.0/node_modules/character-entities-legacy/index.js
16041
+ // ../../node_modules/.pnpm/character-entities-legacy@3.0.0/node_modules/character-entities-legacy/index.js
15902
16042
  /**
15903
16043
  * List of legacy HTML named character references that don’t need a trailing semicolon.
15904
16044
  *
@@ -16012,8 +16152,7 @@ const characterEntitiesLegacy = [
16012
16152
  "yen",
16013
16153
  "yuml"
16014
16154
  ];
16015
- //#endregion
16016
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/entities.js
16155
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/entities.js
16017
16156
  const own = Object.prototype.hasOwnProperty;
16018
16157
  const legacy = new Set(characterEntitiesLegacy);
16019
16158
  const C1 = {
@@ -16099,8 +16238,7 @@ function decodeHTMLAttribute(input) {
16099
16238
  }
16100
16239
  return out + input.slice(last);
16101
16240
  }
16102
- //#endregion
16103
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/utils.js
16241
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/utils.js
16104
16242
  function isSpaceCode$1(c) {
16105
16243
  return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
16106
16244
  }
@@ -16232,8 +16370,7 @@ function parseHtmlAttributes(attrsStr) {
16232
16370
  }
16233
16371
  return attrs;
16234
16372
  }
16235
- //#endregion
16236
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/unwrap.js
16373
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/unwrap.js
16237
16374
  function resolveUnwrapTags(unwrap) {
16238
16375
  if (!unwrap) return [];
16239
16376
  if (unwrap === true) return ["p"];
@@ -16264,8 +16401,7 @@ function applyUnwrap(nodes, tags) {
16264
16401
  else merged.push(node);
16265
16402
  return merged;
16266
16403
  }
16267
- //#endregion
16268
- //#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
16404
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/tree-utils.js
16269
16405
  const MAX_HIGHLIGHT_LINES = 1e3;
16270
16406
  function parseCodeblockInfo(info) {
16271
16407
  if (!info) return {};
@@ -16357,8 +16493,7 @@ function mergeAdjacentTextNodes(nodes) {
16357
16493
  }
16358
16494
  return merged;
16359
16495
  }
16360
- //#endregion
16361
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/heading-id.js
16496
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/heading-id.js
16362
16497
  function createHeadingIdTracker(option = true) {
16363
16498
  if (option === false) return void 0;
16364
16499
  return {
@@ -16401,8 +16536,7 @@ function nextHeadingId(text, level, tracker) {
16401
16536
  usedIds.add(id);
16402
16537
  return id;
16403
16538
  }
16404
- //#endregion
16405
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/parse/tree.js
16539
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/parse/tree.js
16406
16540
  const inlineTags$1 = /* @__PURE__ */ new Set([
16407
16541
  "strong",
16408
16542
  "em",
@@ -16584,10 +16718,13 @@ function processChildren(tokens, start, closeType, state, nestHtml = false) {
16584
16718
  nextIndex: i
16585
16719
  };
16586
16720
  }
16587
- function processPossibleAttributesSyntax(tokens, value) {
16588
- const extractedAttributes = extractAttributes(tokens, value.nextIndex);
16721
+ function processPossibleAttributesSyntax(tokens, value, skipEmptyText = true) {
16722
+ const extractedAttributes = extractAttributes(tokens, value.nextIndex, skipEmptyText);
16589
16723
  if (value.nextIndex < extractedAttributes.nextIndex) {
16590
- value.node[1] = Object.assign(value.node[1], extractedAttributes.attrs);
16724
+ const attrs = extractedAttributes.attrs;
16725
+ const current = value.node[1];
16726
+ if (typeof current.class === "string" && typeof attrs.class === "string") attrs.class = `${current.class} ${attrs.class}`;
16727
+ value.node[1] = Object.assign(current, attrs);
16591
16728
  value.nextIndex = extractedAttributes.nextIndex;
16592
16729
  }
16593
16730
  return value;
@@ -16882,15 +17019,10 @@ const processors = {
16882
17019
  },
16883
17020
  mdc_inline_component(tokens, start) {
16884
17021
  const token = tokens[start];
16885
- const tokenAttrs = processAttributes(token.attrs);
16886
- const { attrs, nextIndex } = extractAttributes(tokens, start + 1, false);
16887
- return {
16888
- node: [token.tag, {
16889
- ...tokenAttrs,
16890
- ...attrs
16891
- }],
16892
- nextIndex
16893
- };
17022
+ return processPossibleAttributesSyntax(tokens, {
17023
+ node: [token.tag, { ...processAttributes(token.attrs) }],
17024
+ nextIndex: start + 1
17025
+ }, false);
16894
17026
  },
16895
17027
  image(tokens, start) {
16896
17028
  const token = tokens[start];
@@ -17033,8 +17165,7 @@ function tokenListToTree(tokens, options = {}) {
17033
17165
  }
17034
17166
  return nodes;
17035
17167
  }
17036
- //#endregion
17037
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/core.js
17168
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/core.js
17038
17169
  const MAX_SHARED_PARSERS = 32;
17039
17170
  let nextPluginId = 0;
17040
17171
  const pluginIds = /* @__PURE__ */ new WeakMap();
@@ -17136,8 +17267,7 @@ function createMarkdownParser$1(options = {}) {
17136
17267
  };
17137
17268
  return parseFn;
17138
17269
  }
17139
- //#endregion
17140
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/index.js
17270
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/index.js
17141
17271
  let warnedLinkifyOption = false;
17142
17272
  function resolveParserOptions(options) {
17143
17273
  const { autoClose = true, tracer = noopTracer, linkify: linkifyOption, ...rest } = options;
@@ -17177,8 +17307,7 @@ function createMarkdownParser(options = {}) {
17177
17307
  async function parseMarkdown(markdown, options = {}) {
17178
17308
  return await createMarkdownParser(options)(markdown);
17179
17309
  }
17180
- //#endregion
17181
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/state.js
17310
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/state.js
17182
17311
  function findHandler(ctx, node) {
17183
17312
  const name = node[0];
17184
17313
  const userHandler = (Object.hasOwn(ctx.handlers, name) ? ctx.handlers[name] : void 0) || (Object.hasOwn(ctx.handlers, pascalCase(name)) ? ctx.handlers[pascalCase(name)] : void 0);
@@ -17192,7 +17321,7 @@ async function one$1(node, state, parent, atLineStart = false) {
17192
17321
  "&": void 0,
17193
17322
  "\"": void 0
17194
17323
  });
17195
- if (parent?.[1].$?.html === 1 && parent[1].$?.block === 1) return node;
17324
+ if (parent?.[1].$?.html === 1 && parent[1].$?.block === 1) return state.context.rawHtmlText === "verbatim" ? node : escapeRawHtmlText(node, String(parent[0]));
17196
17325
  return escapeTextNode(node, atLineStart);
17197
17326
  }
17198
17327
  if (node[0] === null) return await state.handlers.comment(node, state, parent);
@@ -17307,6 +17436,37 @@ const COLON_PREV_CHARS = /* @__PURE__ */ new Set([
17307
17436
  ")",
17308
17437
  ">"
17309
17438
  ]);
17439
+ const TEXT_ONLY_TAGS = {
17440
+ script: "<\\/",
17441
+ style: "<\\/",
17442
+ textarea: "&lt;/"
17443
+ };
17444
+ function escapeRawHtmlText(text, tag) {
17445
+ if (!text.includes("<")) return text;
17446
+ const lowerTag = tag.toLowerCase();
17447
+ const closerEscape = Object.hasOwn(TEXT_ONLY_TAGS, lowerTag) ? TEXT_ONLY_TAGS[lowerTag] : void 0;
17448
+ if (closerEscape) {
17449
+ const lower = text.toLowerCase();
17450
+ const closer = `</${lowerTag}`;
17451
+ let result = "";
17452
+ let last = 0;
17453
+ for (let index = lower.indexOf(closer); index !== -1; index = lower.indexOf(closer, last)) {
17454
+ result += text.slice(last, index) + closerEscape;
17455
+ last = index + 2;
17456
+ }
17457
+ return result + text.slice(last);
17458
+ }
17459
+ let result = "";
17460
+ let last = 0;
17461
+ for (let index = text.indexOf("<"); index !== -1; index = text.indexOf("<", index + 1)) {
17462
+ const next = text.charCodeAt(index + 1);
17463
+ if (next >= 65 && next <= 90 || next >= 97 && next <= 122 || next === 33 || next === 47 || next === 63) {
17464
+ result += text.slice(last, index) + "&lt;";
17465
+ last = index + 1;
17466
+ }
17467
+ }
17468
+ return result + text.slice(last);
17469
+ }
17310
17470
  function escapeTextNode(text, atLineStart = false) {
17311
17471
  const escaped = escapeInline(text);
17312
17472
  if (!atLineStart && !escaped.includes("\n")) return escaped;
@@ -17325,6 +17485,7 @@ function buildNextIndex(source, charCode) {
17325
17485
  }
17326
17486
  return next;
17327
17487
  }
17488
+ const OPEN_TAG_START = /<\/?[a-z][a-z0-9-]*[\s/]/iy;
17328
17489
  function escapeInline(text) {
17329
17490
  let nextGt;
17330
17491
  return text.replace(inlineSyntax, (char, offset, source) => {
@@ -17333,7 +17494,10 @@ function escapeInline(text) {
17333
17494
  const next = source.charCodeAt(offset + 1);
17334
17495
  if (!(next >= 65 && next <= 90 || next >= 97 && next <= 122 || next === 33 || next === 63 || next === 47)) return char;
17335
17496
  nextGt ??= buildNextIndex(source, 62);
17336
- if (nextGt[offset + 1] === -1) return char;
17497
+ if (nextGt[offset + 1] === -1) {
17498
+ OPEN_TAG_START.lastIndex = offset;
17499
+ if (!OPEN_TAG_START.test(source)) return char;
17500
+ }
17337
17501
  return `\\${char}`;
17338
17502
  }
17339
17503
  if (char === "&" && !/^&#?[a-zA-Z0-9]+;/.test(source.slice(offset))) return char;
@@ -17364,8 +17528,7 @@ function escapeLeadingBlock(line) {
17364
17528
  if (line[0] === ":") return `\\${line}`;
17365
17529
  return line;
17366
17530
  }
17367
- //#endregion
17368
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/fence.js
17531
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/fence.js
17369
17532
  function pickFence(content) {
17370
17533
  let maxBackticks = 0;
17371
17534
  let maxTildes = 0;
@@ -17380,8 +17543,7 @@ function pickFence(content) {
17380
17543
  const char = maxBackticks <= maxTildes ? "`" : "~";
17381
17544
  return char.repeat(Math.max(3, (char === "`" ? maxBackticks : maxTildes) + 1));
17382
17545
  }
17383
- //#endregion
17384
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/internal/stringify/attributes.js
17546
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/attributes.js
17385
17547
  const IMPLICIT_ATTRS = {
17386
17548
  blockquote: { drop: ["as"] },
17387
17549
  ol: { drop: ["start"] },
@@ -17451,18 +17613,23 @@ function comarkYamlAttributes(attributes, style = "codeblock") {
17451
17613
  const fence = pickFence(yamlContent);
17452
17614
  return `${fence}yaml [props]\n${yamlContent}\n${fence}`;
17453
17615
  }
17454
- //#endregion
17455
- //#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
17616
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/code.js
17456
17617
  function code(node, _state) {
17457
17618
  const [_, attributes] = node;
17458
17619
  const attrs = userBlockAttrs("code", attributes);
17459
17620
  const attrsString = Object.keys(attrs).length > 0 ? comarkAttributes(attrs) : "";
17460
17621
  const content = textContent(node);
17461
- const fence = content.includes("`") ? "``" : "`";
17462
- return `${fence}${content}${fence}${attrsString}`;
17622
+ const fence = pickInlineFence(content);
17623
+ const edgeBacktick = content.startsWith("`") || content.endsWith("`");
17624
+ const edgeSpaces = content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content);
17625
+ const pad = edgeBacktick || edgeSpaces ? " " : "";
17626
+ return `${fence}${pad}${content}${pad}${fence}${attrsString}`;
17627
+ }
17628
+ function pickInlineFence(content) {
17629
+ const longest = (content.match(/`+/g) ?? []).reduce((max, run) => Math.max(max, run.length), 0);
17630
+ return "`".repeat(longest + 1);
17463
17631
  }
17464
- //#endregion
17465
- //#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
17632
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/pre.js
17466
17633
  function pre(node, state) {
17467
17634
  const [_, attributes, ...children] = node;
17468
17635
  const codeClasses = children[0]?.[1]?.class;
@@ -17494,20 +17661,18 @@ function formatHighlights(highlights) {
17494
17661
  }
17495
17662
  return ranges.join(",");
17496
17663
  }
17497
- //#endregion
17498
- //#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
17664
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/hr.js
17499
17665
  function hr(_n, state, parent) {
17500
17666
  if (parent?.[0] === "p") return ":hr";
17501
17667
  return "---" + state.context.blockSeparator;
17502
17668
  }
17503
- //#endregion
17504
- //#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
17669
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/heading.js
17505
17670
  const trackers = /* @__PURE__ */ new WeakMap();
17506
17671
  function autoHeadingId(node, level, state, id) {
17507
- let tracker = trackers.get(state);
17672
+ let tracker = trackers.get(state.context);
17508
17673
  if (tracker === void 0) {
17509
17674
  tracker = createHeadingIdTracker(state.context.headingIds) ?? null;
17510
- trackers.set(state, tracker);
17675
+ trackers.set(state.context, tracker);
17511
17676
  }
17512
17677
  if (!tracker) return void 0;
17513
17678
  const autoId = nextHeadingId(node.slice(2).filter((child) => !(Array.isArray(child) && child[1]?.$?.permalink === "separate")).map((child) => textContent(child)).join(""), level, tracker);
@@ -17527,8 +17692,7 @@ async function heading(node, state) {
17527
17692
  const suffix = attrs ? ` ${attrs}` : "";
17528
17693
  return "#".repeat(level) + " " + content + suffix + state.context.blockSeparator;
17529
17694
  }
17530
- //#endregion
17531
- //#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
17695
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/p.js
17532
17696
  async function p(node, state, parent) {
17533
17697
  const children = node.slice(2);
17534
17698
  let result = "";
@@ -17538,8 +17702,44 @@ async function p(node, state, parent) {
17538
17702
  if (parent?.[0] === "li") return result;
17539
17703
  return result + state.context.blockSeparator;
17540
17704
  }
17541
- //#endregion
17542
- //#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
17705
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/link.js
17706
+ const SPECIAL_SCHEME = /^(?:https?|wss?|ftp|file):$/;
17707
+ function isBalanced(value, open, close, escapes) {
17708
+ let depth = 0;
17709
+ for (let i = 0; i < value.length; i++) if (escapes && value[i] === "\\") i++;
17710
+ else if (value[i] === open) depth++;
17711
+ else if (value[i] === close && --depth < 0) return false;
17712
+ return depth === 0;
17713
+ }
17714
+ function linkDestination(url) {
17715
+ if (url === void 0 || url === null || url === "") return "<>";
17716
+ let value = String(url);
17717
+ if (value.includes("\\")) try {
17718
+ const parsed = new URL(value);
17719
+ if (SPECIAL_SCHEME.test(parsed.protocol)) value = parsed.href;
17720
+ } catch {}
17721
+ const escapeParens = !isBalanced(value, "(", ")", false);
17722
+ let result = "";
17723
+ for (let i = 0; i < value.length; i++) {
17724
+ const char = value[i];
17725
+ const code = value.charCodeAt(i);
17726
+ if (code <= 32 || code === 127) result += `%${code.toString(16).toUpperCase().padStart(2, "0")}`;
17727
+ else if (char === "\\" || char === "<" || char === ">" || escapeParens && (char === "(" || char === ")") || char === "&" && /^&#?[a-z0-9]+;/i.test(value.slice(i, i + 34))) result += `\\${char}`;
17728
+ else result += char;
17729
+ }
17730
+ return result;
17731
+ }
17732
+ function linkTitle(title) {
17733
+ return String(title).replace(/["\\<&]/g, "\\$&");
17734
+ }
17735
+ function imageAlt(alt) {
17736
+ const value = String(alt);
17737
+ return isBalanced(value, "[", "]", true) ? value : value.replace(/(?<!\\)[[\]]/g, "\\$&");
17738
+ }
17739
+ function isAutolinkSafe(url) {
17740
+ return /^[a-z][a-z0-9+.-]{1,31}:[^\s<>\\]*$/i.test(url);
17741
+ }
17742
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/a.js
17543
17743
  async function a(node, state, parent) {
17544
17744
  const [_, attrs] = node;
17545
17745
  if (attrs.$?.permalink === "separate") return "";
@@ -17547,11 +17747,10 @@ async function a(node, state, parent) {
17547
17747
  const { href, ...rest } = attrs;
17548
17748
  const attrsString = Object.keys(rest).length > 0 ? comarkAttributes(rest) : "";
17549
17749
  const content = await state.flow(node, state);
17550
- if (content === href && !attrsString) return `<${href}>`;
17551
- return `[${content}](${href})${attrsString}`;
17750
+ if (content === href && !attrsString && isAutolinkSafe(href)) return `<${href}>`;
17751
+ return `[${content}](${linkDestination(href)})${attrsString}`;
17552
17752
  }
17553
- //#endregion
17554
- //#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
17753
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/ul.js
17555
17754
  async function ul(node, state) {
17556
17755
  const children = node.slice(2);
17557
17756
  const revert = state.applyContext({
@@ -17572,8 +17771,7 @@ async function ul(node, state) {
17572
17771
  else result = result + state.context.blockSeparator;
17573
17772
  return result;
17574
17773
  }
17575
- //#endregion
17576
- //#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
17774
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/ol.js
17577
17775
  async function ol(node, state) {
17578
17776
  const children = node.slice(2);
17579
17777
  const start = Number(node[1].start);
@@ -17596,8 +17794,7 @@ async function ol(node, state) {
17596
17794
  else result = result + state.context.blockSeparator;
17597
17795
  return result;
17598
17796
  }
17599
- //#endregion
17600
- //#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
17797
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/li.js
17601
17798
  const blockElements = /* @__PURE__ */ new Set([
17602
17799
  "pre",
17603
17800
  "blockquote",
@@ -17666,8 +17863,7 @@ function takeCheckbox(children) {
17666
17863
  }
17667
17864
  }
17668
17865
  }
17669
- //#endregion
17670
- //#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
17866
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/html.js
17671
17867
  const textBlocks = /* @__PURE__ */ new Set([
17672
17868
  "p",
17673
17869
  "h1",
@@ -17772,8 +17968,7 @@ function paddNoneHtmlContent(content, state, tag) {
17772
17968
  }
17773
17969
  return (content.trim().startsWith("<") ? "" : "") + content + (content.trim().endsWith(">") ? "" : "");
17774
17970
  }
17775
- //#endregion
17776
- //#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
17971
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/strong.js
17777
17972
  async function strong(node, state) {
17778
17973
  const [_, attrs, ...children] = node;
17779
17974
  let content = "";
@@ -17782,8 +17977,7 @@ async function strong(node, state) {
17782
17977
  const attrsString = Object.keys(attrs).length > 0 ? comarkAttributes(attrs) : "";
17783
17978
  return `**${content}**${attrsString}`;
17784
17979
  }
17785
- //#endregion
17786
- //#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
17980
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/emphesis.js
17787
17981
  async function emphesis(node, state) {
17788
17982
  const [_, attrs, ...children] = node;
17789
17983
  let content = "";
@@ -17792,8 +17986,7 @@ async function emphesis(node, state) {
17792
17986
  const attrsString = Object.keys(attrs).length > 0 ? comarkAttributes(attrs) : "";
17793
17987
  return `*${content}*${attrsString}`;
17794
17988
  }
17795
- //#endregion
17796
- //#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
17989
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/blockquote.js
17797
17990
  async function blockquote(node, state) {
17798
17991
  const children = node.slice(2);
17799
17992
  let childResult = "";
@@ -17806,16 +17999,15 @@ async function blockquote(node, state) {
17806
17999
  if (node[1].as) return `> [!${String(node[1].as).toUpperCase()}]\n` + content + state.context.blockSeparator;
17807
18000
  return content + state.context.blockSeparator;
17808
18001
  }
17809
- //#endregion
17810
- //#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
18002
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/img.js
17811
18003
  function img(node, _state) {
17812
18004
  const [_, attrs] = node;
17813
18005
  const { title, src, alt = "", ...rest } = attrs;
17814
18006
  const attrsString = Object.keys(rest).length > 0 ? comarkAttributes(rest) : "";
17815
- return `${title ? `![${alt}](${src} "${title}")` : `![${alt}](${src})`}${attrsString}`;
18007
+ const destination = linkDestination(src);
18008
+ return `${title ? `![${imageAlt(alt)}](${destination} "${linkTitle(title)}")` : `![${imageAlt(alt)}](${destination})`}${attrsString}`;
17816
18009
  }
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/del.js
18010
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/del.js
17819
18011
  async function del(node, state) {
17820
18012
  const [_, attrs, ...children] = node;
17821
18013
  let content = "";
@@ -17824,8 +18016,7 @@ async function del(node, state) {
17824
18016
  const attrsString = Object.keys(attrs).length > 0 ? comarkAttributes(attrs) : "";
17825
18017
  return `~~${content}~~${attrsString}`;
17826
18018
  }
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/mdc.js
18019
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/mdc.js
17829
18020
  const INLINE_HTML_ELEMENTS = /* @__PURE__ */ new Set([
17830
18021
  "a",
17831
18022
  "strong",
@@ -17866,8 +18057,7 @@ async function mdc(node, state, parent) {
17866
18057
  const afterList = Array.isArray(prev) && (prev[0] === "ul" || prev[0] === "ol");
17867
18058
  return inline ? result : indent(result, { level: parent && !afterList ? 1 : 0 });
17868
18059
  }
17869
- //#endregion
17870
- //#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
18060
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/br.js
17871
18061
  function isSpaceCode(c) {
17872
18062
  return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
17873
18063
  }
@@ -17886,13 +18076,11 @@ function br(node, state, parent) {
17886
18076
  const open = prevSpace ? ":br" : " :br";
17887
18077
  return nextSpace ? open : `${open} `;
17888
18078
  }
17889
- //#endregion
17890
- //#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
18079
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/component.js
17891
18080
  function component(node, state, parent) {
17892
18081
  return state.context.format === "markdown/comark" ? state.handlers.mdc(node, state, parent) : state.handlers.html(node, state, parent);
17893
18082
  }
17894
- //#endregion
17895
- //#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
18083
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/template.js
17896
18084
  async function template(node, state, parent) {
17897
18085
  const [_, attrs] = node;
17898
18086
  if (typeof attrs.name !== "string") return component(node, state, parent);
@@ -17904,8 +18092,7 @@ async function template(node, state, parent) {
17904
18092
  const extraAttrs = comarkAttributes(rest);
17905
18093
  return `#${attrs.name}${extraAttrs}\n${content}` + state.context.blockSeparator;
17906
18094
  }
17907
- //#endregion
17908
- //#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
18095
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/table.js
17909
18096
  const TABLE_SECTIONS = /* @__PURE__ */ new Set([
17910
18097
  "thead",
17911
18098
  "tbody",
@@ -18028,8 +18215,7 @@ function th(_node, _state) {
18028
18215
  function td(_node, _state) {
18029
18216
  return "";
18030
18217
  }
18031
- //#endregion
18032
- //#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
18218
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/comment.js
18033
18219
  function comment(node, state, parent) {
18034
18220
  if (node[0] === null) {
18035
18221
  const inline = state.context.inline === true || parent?.[0] === "p" || (parent?.some((child, index) => index > 1 && typeof child === "string") ?? false);
@@ -18037,8 +18223,7 @@ function comment(node, state, parent) {
18037
18223
  }
18038
18224
  return state.context.format === "markdown/comark" ? state.handlers.mdc(node, state, parent) : state.handlers.html(node, state, parent);
18039
18225
  }
18040
- //#endregion
18041
- //#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
18226
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/math.js
18042
18227
  function math(node, state, parent) {
18043
18228
  const className = node[1].class;
18044
18229
  const classes = typeof className === "string" ? className.split(" ") : [];
@@ -18057,8 +18242,7 @@ function math(node, state, parent) {
18057
18242
  if (markup === "\\[") return `\\[\n${content}\n\\]${state.context.blockSeparator}`;
18058
18243
  return `$$\n${content}\n$$${state.context.blockSeparator}`;
18059
18244
  }
18060
- //#endregion
18061
- //#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
18245
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/mermaid.js
18062
18246
  function mermaid(node, state, parent) {
18063
18247
  const [_, attributes] = node;
18064
18248
  if (typeof attributes.content !== "string") return component(node, state, parent);
@@ -18068,8 +18252,7 @@ function mermaid(node, state, parent) {
18068
18252
  const fence = pickFence(body);
18069
18253
  return `${fence}mermaid${attrs ? ` ${attrs}` : ""}\n${body}\n${fence}${state.context.blockSeparator}`;
18070
18254
  }
18071
- //#endregion
18072
- //#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
18255
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/internal/stringify/handlers/index.js
18073
18256
  const handlers = {
18074
18257
  code,
18075
18258
  pre,
@@ -18104,8 +18287,7 @@ const handlers = {
18104
18287
  math,
18105
18288
  mermaid
18106
18289
  };
18107
- //#endregion
18108
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/render/index.js
18290
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/render/index.js
18109
18291
  async function render(document, context = {}) {
18110
18292
  const state = createState(handlers, {
18111
18293
  ...context,
@@ -18123,8 +18305,7 @@ async function renderMarkdown(document, options) {
18123
18305
  });
18124
18306
  return renderFrontmatter(document.frontmatter || {}, content, options?.frontmatterOptions);
18125
18307
  }
18126
- //#endregion
18127
- //#region ../../node_modules/.pnpm/comark@0.9.0_katex@0.19.1_shiki@4.5.0/node_modules/comark/dist/plugins/binding.js
18308
+ // ../../node_modules/.pnpm/comark@0.9.2_katex@0.19.1_shiki@4.6.0/node_modules/comark/dist/plugins/binding.js
18128
18309
  const markdownItInlineBinding = (md, options = {}) => {
18129
18310
  const tag = options.tag || "binding";
18130
18311
  md.inline.ruler.after("entity", "mdc_inline_binding", (state, silent) => {
@@ -18156,8 +18337,7 @@ var binding_default = defineComarkPlugin((opts = {}) => {
18156
18337
  markdownItPlugins: [((md) => markdownItInlineBinding(md, opts))]
18157
18338
  };
18158
18339
  });
18159
- //#endregion
18160
- //#region ../markdown-template/dist/prepare-B9amb4_J.js
18340
+ // ../markdown-template/dist/prepare-er_eo8pi.js
18161
18341
  const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
18162
18342
  const markdownTemplateErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
18163
18343
  docsBase: "https://vitehub.dev/docs/markdown-template/diagnostics",
@@ -18472,8 +18652,7 @@ function validateBranches(template) {
18472
18652
  }
18473
18653
  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." });
18474
18654
  }
18475
- //#endregion
18476
- //#region ../markdown-template/dist/render-BJDteOoz.js
18655
+ // ../markdown-template/dist/render-Mm1YBgGT.js
18477
18656
  const ordered = (compare) => (value, expected) => (typeof value === "number" && typeof expected === "number" || typeof value === "string" && typeof expected === "string") && compare(value, expected);
18478
18657
  const comparisons = {
18479
18658
  eq: (value, expected) => value === expected,
@@ -18778,8 +18957,7 @@ function parseMarkdownTemplateRequest(id) {
18778
18957
  if (id.slice(queryIndex + 1) !== "markdown-template") return;
18779
18958
  return { path };
18780
18959
  }
18781
- //#endregion
18782
- //#region ../internal/src/contributions.ts
18960
+ // ../internal/src/contributions.ts
18783
18961
  const unnamedPlugin = "unnamed plugin";
18784
18962
  function isNonEmptyString(value) {
18785
18963
  return String(value) === value && value.length > 0;
@@ -18884,8 +19062,7 @@ function readContribution(entry, plugin, options, fail) {
18884
19062
  ...base
18885
19063
  };
18886
19064
  }
18887
- //#endregion
18888
- //#region src/build/contributions.ts
19065
+ // src/build/contributions.ts
18889
19066
  /**
18890
19067
  * Collects `vitehub.workspaces` contributions from Vite plugins. Invalid entries fail with `WORKSPACE_B0004`. Two
18891
19068
  * contributions with one name fail with `WORKSPACE_B0003`.
@@ -18899,8 +19076,7 @@ async function collectWorkspaceContributions(plugins, context) {
18899
19076
  kind: "Workspace"
18900
19077
  });
18901
19078
  }
18902
- //#endregion
18903
- //#region src/build/workspace-config.ts
19079
+ // src/build/workspace-config.ts
18904
19080
  const workspaceSuffixPattern = /\.workspace\.(?:c|m)?[jt]s$/i;
18905
19081
  const workspaceConfigPattern = /^config\.(?:c|m)?[jt]s$/i;
18906
19082
  const workspaceAgentPattern = /^agent\.(?:c|m)?[jt]s$/i;
@@ -18912,8 +19088,7 @@ const workspaceConfigFileNames = [
18912
19088
  "config.mjs",
18913
19089
  "config.cjs"
18914
19090
  ];
18915
- //#endregion
18916
- //#region src/build/registry-source.injected.ts
19091
+ // src/build/registry-source.injected.ts
18917
19092
  /**
18918
19093
  * The registry line that rejects a contributed Workspace module without its definition export. It is source text of the
18919
19094
  * generated registry module, which runs in the app and does not import the Workspace catalog.
@@ -18921,8 +19096,7 @@ const workspaceConfigFileNames = [
18921
19096
  function missingDefinitionExportCheck(message) {
18922
19097
  return ` if (!definition) throw new TypeError(${JSON.stringify(message)})`;
18923
19098
  }
18924
- //#endregion
18925
- //#region src/build/discovery.ts
19099
+ // src/build/discovery.ts
18926
19100
  /** Discovery source label of definitions that a Vite plugin contributes. */
18927
19101
  const contributedWorkspaceSource = "vite-plugin-contribution";
18928
19102
  const configFileNameSet = new Set(workspaceConfigFileNames);
@@ -19122,8 +19296,7 @@ function createWorkspaceVirtualRegistryContents(definitions) {
19122
19296
  async function createWorkspaceManifest(definitions) {
19123
19297
  return { workspaces: definitions.map((definition) => ({ name: definition.name })) };
19124
19298
  }
19125
- //#endregion
19126
- //#region src/build/assets.ts
19299
+ // src/build/assets.ts
19127
19300
  function shouldBundleWorkspaceAssets(assets, name) {
19128
19301
  return assets === void 0 || assets === true || Array.isArray(assets) && assets.includes(name);
19129
19302
  }
@@ -19383,8 +19556,7 @@ function createWorkspaceAssetsRegistryContents(registryFile, bundles, modulePath
19383
19556
  ""
19384
19557
  ].join("\n");
19385
19558
  }
19386
- //#endregion
19387
- //#region src/build/integration.ts
19559
+ // src/build/integration.ts
19388
19560
  async function refreshWorkspaceBuildState(root, definitions) {
19389
19561
  const state = {
19390
19562
  manifest: await createWorkspaceManifest(definitions),
@@ -19416,8 +19588,7 @@ function createWorkspaceTypeAugmentation(definitions) {
19416
19588
  ""
19417
19589
  ].join("\n");
19418
19590
  }
19419
- //#endregion
19420
- //#region src/checkout-cli.ts
19591
+ // src/checkout-cli.ts
19421
19592
  const valueFlags = /* @__PURE__ */ new Set([
19422
19593
  "dir",
19423
19594
  "message",
@@ -19645,8 +19816,7 @@ function workspaceCheckoutFeatures() {
19645
19816
  }
19646
19817
  ];
19647
19818
  }
19648
- //#endregion
19649
- //#region src/hooks-cli.ts
19819
+ // src/hooks-cli.ts
19650
19820
  const exec = promisify(execFile);
19651
19821
  const marker = "# Installed by `vitehub hooks install`.";
19652
19822
  const hookNames = ["pre-commit", "pre-push"];
@@ -19967,8 +20137,7 @@ function workspaceHooksNamespace(options = {}) {
19967
20137
  name: "hooks"
19968
20138
  };
19969
20139
  }
19970
- //#endregion
19971
- //#region src/cli.ts
20140
+ // src/cli.ts
19972
20141
  const workspaceDevEndpoint = {
19973
20142
  header: workspaceDevHeader,
19974
20143
  headerValue: "1",
@@ -20250,8 +20419,7 @@ function createWorkspaceCliContributor() {
20250
20419
  workspaceHooksNamespace()
20251
20420
  ] };
20252
20421
  }
20253
- //#endregion
20254
- //#region src/inspect.ts
20422
+ // src/inspect.ts
20255
20423
  function workspaceDefinitionKind(definition) {
20256
20424
  if (definition.source === "server-agent-workspaces") return "Agent workspace";
20257
20425
  if (definition.source === "vite-plugin-contribution") return "Contributed Workspace Definition";
@@ -20309,15 +20477,13 @@ const workspaceConsoleSection = {
20309
20477
  notice: "Workspace files, Sources, collections, sync state, and processes are not opened or initialized by this build-time catalog."
20310
20478
  }
20311
20479
  };
20312
- //#endregion
20313
- //#region ../internal/src/arrays.ts
20480
+ // ../internal/src/arrays.ts
20314
20481
  function pushUnique(arr, item, key = (value) => value) {
20315
20482
  const id = key(item);
20316
20483
  if (arr.some((entry) => key(entry) === id)) return;
20317
20484
  arr.push(item);
20318
20485
  }
20319
- //#endregion
20320
- //#region src/integrations/cloudflare.ts
20486
+ // src/integrations/cloudflare.ts
20321
20487
  function configureCloudflareArtifacts(target, config) {
20322
20488
  if (!config) return;
20323
20489
  const store = config.store;
@@ -20333,8 +20499,7 @@ function configureCloudflareArtifacts(target, config) {
20333
20499
  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.` });
20334
20500
  pushUnique(target.cloudflare.wrangler.artifacts, artifact, (entry) => entry.binding);
20335
20501
  }
20336
- //#endregion
20337
- //#region src/hosts/vite/plugin.ts
20502
+ // src/hosts/vite/plugin.ts
20338
20503
  const WORKSPACE_PACKAGE_NAME = "@vite-hub/workspace";
20339
20504
  const WORKSPACES_ID = "#vitehub/workspaces";
20340
20505
  const WORKSPACE_PREFIX = "#vitehub/workspaces/";
@@ -20778,7 +20943,8 @@ function mergeNitroWorkspaceConfig(value, root, dev) {
20778
20943
  }
20779
20944
  kit.addHandler({
20780
20945
  handler: ownModule(import.meta.url, "runtime/request"),
20781
- middleware: true
20946
+ middleware: true,
20947
+ route: "/**"
20782
20948
  }, "start");
20783
20949
  return kit.config;
20784
20950
  }
@@ -21274,5 +21440,4 @@ function hubWorkspace(options) {
21274
21440
  }
21275
21441
  };
21276
21442
  }
21277
- //#endregion
21278
21443
  export { collectWorkspaceContributions, createWorkspaceNitroConfig, discoverViteWorkspaceDefinitions, hubWorkspace, inspectWorkspaceDefinitions, workspaceConsoleSection };